Posts

Showing posts from July, 2010

How to execute a function if url contains "x" in jQuery -

i'd execute function up(); if url contains "invt". so far have this: if(window.location.pathname == "/invt/"){ alert("invt"); } however, wasn't alerting me. ideas? i've since got work, answers below. consider: $(document).ready(function () { if(window.location.href.indexof("invt") > -1) { //checks url "invt" (all products contain this) up(); return; } }); try this: if ( window.location.pathname.indexof('invt') >= 0 ) { alert("invt"); }

ruby on rails - NameError: uninitialized constant Faker:: -

before(:all) puts "hello :d" end i have problem code: /spec/factories.rb require 'faker' factorygirl.define factory :booking_error booking_id { faker::number.number(3).to_i } error_type_cd bookingerror.error_types.values.shuffle.first process_name enums::flightenum::processes.keys.shuffle.first description "description" old_value "old_string" new_value "new_string" end end /spec/models/booking_error_spec.rb require 'spec_helper' describe bookingerror before(:all) @booking_error = factorygirl.build(:booking_error) @booking_error_types = bookingerror.error_types end 'validating bookingerror save.' @booking_error.save.should be_true end end gemfile source 'https://rubygems.org' gem 'rails', '3.2.13' gem 'mysql2' , '0.3.11' gem 'devis

perl - Passing array by reference -

i have written simple perl program ( driver.pl ) passes array reference , calls subroutine add in calculate.pm module. the calculate.pm module pushes 2 values 100 , 500 array. when print array in driver.pl file, prints nothing. driver.pl file: use calculate; our @my_array; sub init() { $x = 1; calculate::add($x, /@my_array); } init(); (@my_array) { print $_; #prints nothing. } calculate.pm sub add() { ($x, @arr) = @_; push (@arr, 100); push (@arr, 200); } 1; first of all, here code want: file calculate.pm : package calculate; sub add { ($x, $arrayref) = @_; push @$arrayref, 100, 200; } 1; file driver.pl : use calculate; @array; sub init { calculate::add(1, \@array); } init(); foreach (@array) { print "$_\n"; } what did do? well, fixed (syntax-)errors: the reference operator \ nor / . loops for or foreach never for each . there each function allows iterate on collections, isn't useful her

HCS12 Assembly Arithmetic -

so learning assembly hcs12 microcontroller. i need evaluate expression -45+6+(13*2)-(7*4)-65+33 . expression needs evaluated left right, following standard order of operations. each operation needs performed on byte values, , can use addition, subtraction, , shifts. i can evaluate -45+6+(13*2)-(7*4) fine, problems arise when try subtract 65 -41. understand what's going on, don't know how work around it. edit : should more clear, know happening (the values being truncated). don't know why. edit2 : solved! line ldab #term5 should ldab term5 (same thing next line) here's code i'm using, reference: ; local defines term3: equ 13 term4: equ 07 ;******************************************************************** myconst: section ; place constant data here constdata: dc.b -45,16 term5: dc.b 65 term6: dc.b 33 ;******************************************************************** mycode: section main: entry:

javascript - Binding to Elements of Arrays in AngularJS -

in angularjs, can bind text inputs elements of arrays: <input type="text" ng-model="foo[2]" /> is allowed, or work accident? when try bind select elements or checkbox input array elements fail work - i.e. select element not change displayed, or bound, value on selection , checkbox not display tick when clicked. am missing here? update: works in jsfiddle: http://jsfiddle.net/azfzc/ it work on select elements look jsfiddle http://jsfiddle.net/fste7/ html <div ng-app> <div ng-controller="mycontroller"> select <select ng-change="changed()" ng-options="option.value option.label option in options" ng-model="ar[0]"> </select> </div> </div> js function mycontroller($scope){ $scope.options = [ { label : "first element", value : 0 }, { label : "second element", value : 1 }, ] $scope.ar = []; $

java - Get Metadata from Dropbox Link Without Auth -

i want check version changed/get metadata of text-file shared link on dropbox. not using dropbox api makes users use own accounts. want them link account , cannot manually since might change password later. so: no auth token, metadata shared link of dropbox can check version changes , if version has changed download contents of new file. also: i'm open other suggestions make work well. please explain in little detail solution. updated e-tag issue: public void getfromonlinetxtdatabase(){ try{ url url = new url("url-here"); httpurlconnection.setfollowredirects(true); httpurlconnection con = (httpurlconnection) url.openconnection(); con.setdooutput(false); con.setreadtimeout(20000); con.setrequestproperty("connection", "keep-alive"); //get etag update check string etag = con.getheaderfield("etag"); //string etag= &q

How to export Oracle schema and user detail in sqldeveloper -

in sqldeveloper there useful tool exporting on sql file object exist on schema. anyhow unable find similar exporting schema , user informations. the sqldeveloper version i'm using 3.2 thanks, piwakkio. declare objectddl clob; begin in (select * user_objects object_type in(/*whatever want*/) ) loop select dbms_metadata.get_ddl(i.object_type,i.object_name) objectddl dual; dbms_output.put_line(objectddl); end loop; end; good luck :)

php - How do I set expire time for Zend Cache Storage? -

i store xml in zend filesystem cache , have expire after 30 minutes. how 1 set cache duration / expiry? using zend cache component , not in context of full zf2 application. $cache = \zend\cache\storagefactory::factory(array( 'adapter' => array( 'name' => 'filesystem', 'ttl' => 60, // kept short during testing 'options' => array('cache_dir' => __dir__.'/cache'), ), 'plugins' => array( // don't throw exceptions on cache errors 'exception_handler' => array( 'throw_exceptions' => false ), ) )); $key = 'spektrix-events'; $events = new simplexmlelement($cache->getitem($key, $success)); if (!$success) { $response = $client->setmethod('get')->send(); $events = new simplexmlelement($response->getcontent()); $cache->setitem('spektrix-events', $events

java - Lucene - How to use TeeSinkTokenFilter? -

would please explain how(and for) use teesinktokenfilter, lucene? example appreciated =p. didn't find official documentation clear , , have looked many sites, without progress. thanks. yeah, didn't think official documentation clear, either. think part of made confusing demonstrated 2 different features in way made hard tell them apart. let me see if can rewrite example show basic case. teesinktokenfilter source1 = new teesinktokenfilter( new whitespacetokenizer(version, reader1)); teesinktokenfilter.sinktokenstream sink1 = source1.newsinktokenstream(); teesinktokenfilter.sinktokenstream sink2 = source1.newsinktokenstream(); source1.consumealltokens(); // tokens cached @ point tokenstream final3 = new entitydetect(sink1); tokenstream final4 = new urldetect(sink2); d.add(new textfield("f3", final3, field.store.no)); d.add(new textfield("f4", final4, field.store.no)); this allows final3 , final4 token streams share processing done so

PHP Expression: Why var_dump(false < -1) = true? -

can please explain how php execute code , result true ? var_dump( (false < -1) ); //bool(true) false boolean type, , php maunal: -1 considered true, other non-zero (whether negative or positive) number! resource: http://php.net/bool

java - Horizontal scroll view scrolling one item at time -

i implementing panel include horizontal list view using horizontal scroll view . in need control scrolling of horizontal scroll view , scrolling 1 item @ time. could 1 give me idea kind of thing. i manged using overriding horizontalscrollview , merging code got various internet examples .it working fine . i have used gesturedetector , onfling method achieve task. public void setcenter(int index) { viewgroup parent = (viewgroup) getchildat(0); view preview = parent.getchildat(previndex); //preview.setbackgroundcolor(color.parsecolor("#64cbd8")); android.widget.linearlayout.layoutparams lp = new linearlayout.layoutparams( linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content); lp.setmargins(5, 0, 5, 0); preview.setlayoutparams(lp); view view = parent.getchildat(index); //view.setbackgroundcolor(color.red); int screenwidth = ((activity) context).getwindowmanager()

css - Box model issue -

i play around layout , i'm having problem. my header element pushed right top of container http://codepen.io/anon/pen/cslkh i'm missing cant think what! i have set margin-top , it's still push top of container? please guy's your .header has margin-top: 25px which, due margin collapse, causes .container move down. instead of top-margin , use padding-top on .container . here's updated pen: http://codepen.io/anon/pen/pbvfi

javascript - jQuery on element unhidden, populate a div with text -

i have div displays information based on options chosen. there's few divs on page set hidden, when user selects options dropdown aren't holding text (like "please select..." or variant) price div populates price. ids , classes of options can change , there's no way determine them before hand (dynamically populated). i've got div on page i'm looking populate when first price div becomes visible, extract amount it, perform calculation on , display it. i thinking along lines of this: jquery( "form.variations_form cart" ).children("div.single_variation").change( function(){ /* update div */ } ); i've put down on jsfiddle can see please note comments. here's link jsfiddle: http://jsfiddle.net/scott_mcgready/h3g6a/1/ any idea on how monitor initial box, pull through price , display on other one? working demo try i have edited html html <fieldset class="variations"> <

cube - MDX SSAS - Max Date in Measure -

just need max date in measures in cube. instance, dateid dimention , [measure].[first measure],...,...,[second measure] . how list of max(dateid) measures in cube. the following max date value associated each measure...but have manually create calculated member corresponding each measure. with member [measures].[max date - internet sales amount] tail( nonempty( [date].[date].[date] ,[measures].[internet sales amount] ) ,1 ).item(0).membervalue member [measures].[max date - reseller sales amount] tail( nonempty( [date].[date].[date] ,[measures].[reseller sales amount] ) ,1 ).item(0).membervalue select { [measures].[max date - internet sales amount], [measures].[max date - reseller sales amount] } on 0 [adventure works] if want single max date across measures in cube

objective c - UINavigationBar position is not the same depending on iOS version ( 7 and 6 ) -

Image
i'm updating app ios7 , noticed had re-adjust manually placed uinavigationbars come under status bar. now bars have been manually moved in ib below status bar i've problem looks great on ios7 in other version there pronounced gap between status bar , uinavigationbar . could advice me why problem happening between ios versions , how overcome it? ios7 ios6

javascript - Form of select tags, I want to fire an event if any of them change -

i have form 18 different questions, each 1 has select field options. my goal time user opens select field , picks option , want ajax call. my form's id #new-survey , there way put watcher on child elements (the select menus) or similar watch of fields? note: using jquery in pure javascript: var form = document.getelementbyid("new-survey"); var selects = form.getelementsbytagname("select"); (var i=0; i< selects.length; i++) { selects[i].setattribute("onchange", domyajax); } function domyajax(e) { /// ajax content in here } in jquery: $("#new-survey").find("select").change(function(){ // $(this); });

bitbucket - Git: Forget about upstream repo -

i working small team on private repo. @ first thought should follow fork , merge workflow, started 'project-official' repository , forked own 'project' repo. no 1 else has used official repo yet, , have realized forking , merging not optimal project. how can disconnect 'project' repo 'project-official' repo before deleting 'project-official'? it's redundant now. the reason don't want fork , merge because wiki not forked part of project on bitbucket, , because want 1 central issue tracker. prefer make 'task' branches , merge them completed. update to clean .git/config file, remove [remote "upstream"] , right? keeping fork, not original repo. no 1 me has touched either repo. [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] ### has url of repo keeping. fetch = +refs/heads/*:refs/remotes/origin/* url = git@bitbucket.org:d4g

php - Explode array and set as associative with default values? -

0i have string: 01, 02, 03, 04, 05, 06, 07, 08, 09 and need convert in associative array numbers keys , values set 0 array( "01" => 0, "02" => 0, etc ) i've found function array_walk if try use it: http://phpfiddle.org/main/code/5z2-bar $string = "01, 02, 03, 04, 05, 06, 07, 08, 09"; $days = explode(",", $string); $assdays = array(); function associate($element) { $assdays[$element] = 0; } echo "<pre>"; print_r(array_walk($days, 'associate')); echo "</pre>"; doesn't work. i'm sure problem don't pass values function associate don't know how do. use array_fill_keys : $assdays = array_fill_keys($days, 0);

c# - who is who or creating objects from extended class -

Image
try understand power of oop create 3 classes class { public string foo() { return "a"; } } class b:a { public string foo1() { return "a"; } } class program { static void main(string[] args) { a = new b(); //can use method b b = new b(); //both aa = new a(); //just string result = b.foo(); string n = ((a)b).foo().tostring(); } } currently try understand difference between a = new b(); , a = new a(); - try use - can use same method classes - see pic also try understand difference beetwen b b = new b(); ((a)b).foo(); and a = new b(); b.foo(); and a =(А) new b(); , a = new a(); also try find tutorial explanation of main principles of oop, still have question. understanding the simplest difference is: a = new b(); b b = (b) a; // works! a = new a(); b b = (b) a; // compiler error even if assign b instance a -typed variable it's

c++ - Windows function ChoosePixelFormat returns ERR_OLD_WIN_VERSION on windows 7 -

i'm trying teach myself win32 api making window , attaching opengl context it. in order fetch appropriate pixel format call choosepixelformat must made should return pixel format system supports , best meets needs. when check errors goes smoothly until function called stops execution , logs error 1150-err_old_win_version supposed mean version of windows not support function. not case , msdn confirms function runs on versions of windows since windows 2000. right i'm running windows 7 x64 on desktop , made sure video driver , os updated. lots of people seem have had trouble pixel format functions have not found problem decided post here help. here full code; have not tested on machines other own. winmain.cpp (the non-default msvc lib linked opengl32.lib) #include"display.h" #include<iostream> #include<fstream> msg message; dword error; int status; lresult callback wndproc(hwnd hwindow, uint message, wparam wparam, lparam lparam) { switch(m

jboss7.x - Access to a Client's Certificate from Inside an EJB? -

having client authentication set on jboss 7, i'd access client's certificate form inside ejb, or inside login module. is possible? thanks in case there servlet request (from jsf or servletfilter) can do: servletrequest servletrequest = (servletrequest) facescontext.getexternalcontext().getrequest(); x509certificate[] x509certificates = (x509certificate[]) servletrequest.getattribute("javax.servlet.request.x509certificate");

javascript - Lush Slider full width and restricted height -

i believe have tried , failing miserably. have been working lush responsive slider , have been having major issues. to start off took exact code demo , placed in header, had strange padding on bottom , right side removed , thought working fine except height. it's large takes on more half page. when resized window , reloaded page though background of slider sat in top left corner smaller needed be. responsiveness works if reload @ 100% screen? doesn't make scenes. also, height bothering me. cannot resize @ , when did put static heights on ul , li of 10em did resize, responsiveness went out window. i tried post in js fiddle, plugin code crashed without running anything. if can post dev site on it. said used exact html , css demo files took away bit of padding make full width. any appreciated. ok, have managed work out solution width issue. problem seems relate initial basewidth, defaults 1140 pixels. playing around data-base-width="600" , data-b

twitter bootstrap - What is a best way to customize Bootstrap3 in Rails? -

Image
twitter bootstrap 3 has been released recently. we're going use in new project , customize fit our needs. here're few issues came across in past 2 projects. as tb written less took time unless there reliable sass version working unstable sass version found out styles imported more once - perhaps due old sass bug includes same files more once we could't make 'include-once' workaround work sass version gem we figured out best can build tb builder but… it requires lot of work on our part simple modifications e.g customizing navbar can't override default variables we looking solution make customizing bootstrap less problematic. experience? strategy use? have tried use tb3 in rails(4)? one of options use jlong's sass implementation . follow these steps setting bootstrap3 work rails 4 (this way of doing it, @ answer , checkout project well.) step 1: download zip jlongs repo. step 2: unzip file , copy contents of lib folder. step 3

sql - Case statement within select case statement -

i trying create case statement work seem messing syntax somehow. here have far: select lp.assign_date, case when lp.assign_date > '01-jan-13' (select count(*) > 0 'bad' else 'good' end transaction_table account = :v_acct , transaction_date < :v_tran_date , transaction_code = :v_tran_code , :v_tran_code in (1,6,25) , attorney_id = :v_atty_id) else (select function_legal_chk(:v_acct, :v_tran_date) dual) legal_placement lp; essentially checking see if assigned date after january, if next case statement else function . here error receiving: ora-00923: keyword not found expected 00923. 00000 - "from keyword not found expected" from know , research i've done on case statements , syntax seems correct not sure if case within case can done. any appreciated. here correct syntax: select lp.assign_date, (case when lp.assign_date > '01-jan-13' (select (case wh

html5 - Kendo ui mobile set default theme to flat ui -

im starting out kendo ui , running basic example below. it displays ios want set flat ui theme time. cant see in demos or documentation state how this. can tell me how change default theme flat design? <!doctype html> <html> <head> <!-- kendo ui mobile css --> <link href="styles/kendo.mobile.all.min.css" rel="stylesheet" /> <!-- jquery javascript --> <script src="js/jquery.min.js"></script> <!-- kendo ui mobile combined javascript --> <script src="js/kendo.mobile.min.js"></script> <title>kendo ui examples</title> </head> <body> <!-- kendo mobile view --> <div data-role="view" data-title="test" id="index"> <!--kendo mobile header --> <header data-role="header"> <!--kendo mobile navbar widget --> <div data-role="navbar"> &l

d3.js - d3js column bar chart height error -

i'm trying replicate this simple column bar chart in d3 except use negative values. able figure out how use negative values, axis seems off. think it's i'm doing y-values. here's i'm drawing bars: var chart = d3.select("body").append("svg") .attr("class","chart") .attr("width", w * data.length - 1) .append("g") .attr("height", h); chart.selectall("rect") .data(data) .attr("class","rect") .enter().append("rect") .attr("x", function(d, i) { return x(i) - .5; }) .attr("y", function(d) { return h - y(d.value) - .5; }) .attr("width", w) .attr("height", function(d) { return math.abs(y(d.value) - y(0)); }); and here's fiddle everything: http://jsfiddle.net/y4wac/2/ i want have x-axis @ 0 , bars originating x-axis simple i'm n00b thank

python - Using Regex (or simmilar) to change song name (or other tag) in itunes via script -

so have scripting issue (and cannot find specific app in conjunction itunes). i can script in python, have song title: beat of heart - original mix and want change beat of heart (original mix) in python would: string = 'beat of heart - original mix' location = string.index(' - ') fixed_string = string[,location] + '(' + string[location+3,] + ')' simple right? want batch in itunes (on mac) on tracks have labeled such any suggestions? thx with applescript, can use text item delimiters : set astid applescript's text item delimiters tell application "itunes" repeat song in (selection of browser window 1) set the_name name of song if the_name contains " - " set applescript's text item delimiters ("- ") set the_name text items of the_name set applescript's text item delimiters ("(") set the_name (the_name strin

email - Trigger VBA code to run after a new mail is received in Outlook? -

win 7, outlook 2013 use vba code takes action on of files arrive in inbox. however, have click/run button run macro. is there way code run automatically when email arrives? i have tried outlook rule run script not successful. i tried this, works when once run macro private sub application_newmail() call getattachments_from_inbox (my macro) end sub i use script run rule, applied messages. gives easy , clear access mail item receive. since want run on each message setting withevents on inbox probably best bet. for example: you can create listeners outlook folder follows: private withevents maininboxitems outlook.items public sub application_startup() dim olapp outlook.application dim objns outlook.namespace set olapp = outlook.application set objns = olapp.getnamespace("mapi") set maininboxitems = objns.folders("whatever main mailbox called").folders("assignnumber").items 'assumes "assignnu

Urban Airship Android push getting "This app is not configured for iOS push" -

i'm using urban airship , testing using rest api. have google cloud messaging connected urban airship account, , 1 android device registered successfully. can send test messages the interface on urban airship dashboard. but when try using rest api https://go.urbanairship.com/api/push/ body { "audience" : "all" , "device_types" : "all", "notification" : { "android": { "alert" : "this broadcast." } } } i 400 bad request response this app not configured ios push any idea why? update: listing specific device apid in "audience" section returns same result what have correct, need include following http header: accept: "application/vnd.urbanairship+json; version=3; for beginner ruby developers, can achieved this: req = net::http::post.new(uri.path) req["accept"] = "application/vnd.urbanairship+json; version=3;" when, e.g.

c# - String returning with a null reference value -

i have silly error can't shot of. i'm using string check name of folders , extension types. i'm doing can navigate between folders. works fine first folder selection, however, when try , click on second 1 null reference exception. this have @ moment. string clickobject = listbox1.selecteditem.tostring(); int index = clickobject .lastindexof('.'); string extension = clickobject .substring(index + 1, clickobject .length - index - 1); if (extension == "folder") { // stuff } after check files in folder. when go root of searchable folder , click on directory, when error , line string clickobject = listbox1.selecteditem.tostring(); highlighted. at end of method set tried setting clickedobject = null; tried remove string contained clickobject.remove(0); error still persists. how can clear information held in clickedobject can overwrite new information? edit sorry forgot mention when go root have button calls method: usi

search - How to find a certain property from an object in Java -

so i'm making book class, each book has title, author, etc... want make method searches through properties of objects , finds query. example public void titlesearch(string query) { find book query title } i'm not sure duplicate didn't know search for. thanks help. let me know if need more of code. look @ jxpath library. jxpath can use xpath queries search graphs of objects. consider example of searhing addressses zipcode=90210: address address = (address)jxpathcontext.newcontext(vendor). getvalue("locations[address/zipcode='90210']/address"); this xpath expression equivalent following java code: address address = null; collection locations = vendor.getlocations(); iterator = locations.iterator(); while (it.hasnext()){ location location = (location)it.next(); string zipcode = location.getaddress().getzipcode(); if (zipcode.equals("90210")){ address = location.getaddress(); break;

assembly - Convert .so code from ARM to x86 on Android -

i'm trying convert .so file generated ndk has been compiled arm android device .so file x86 device. i can take .so file , use objdump read assembly, objdump doesn't put format can recompile it-- seems easier convert machine code instructions one-to-one. any ideas? i'm hoping convert arm libraries x86 native code arm apps ndk run better on x86 android vmware. what you're talking binary translation. can read intel's solution x86-based mobile devices. this not easy thing solve generally. try adapt qemu 's engine, converts binaries intermediate format , generates native code it, if you've used android emulator know performance of solution can poor.

php - subversion update does not replace my local changes with the latest file -

i working on php project in netbeans, using subversion version control. have made local changes file , saved without committing. coworker made changes , commitments file later today. when update file, leaves current file intact, when go history shows latest version of file-- coworker's edits-- , can diff , see many changes. why hasn't update replaced local edits made? missing something, or default behavior of subversion? if run update, expect have updated file, not file includes uncommitted edits. i'm new subversion, help. you have tell subversion overwrite local changes. overwrite , update in eclipse.

jquery - Regex to check filename extension before upload -

i'm trying validate file extension used regex have fails if there periods in filename or if there no extension @ all. appreciated. thanks! current code: // looks @ file type attemped , validates $('input[type="file"]').change(function () { var ext = this.value.match(/\.(.+)$/)[1]; switch (ext) { case 'bmp': case 'doc': case 'xls': $('#publicsubmit').attr('disabled', false); break; default: alert('this , invalid file extension. vaild extension(s): bmp, doc, xls'); //$('#publicsubmit').attr('disabled', true); this.value = ''; } }); if not depending on regex, use: var ext = value.split('.').slice(-1)[0]; to files extension.

ios - Tally a Dictionary Value For Key Object -

i guess i'm tired today. can't come correct way tally number object in loop used build pdf report. need keep running total (+=) on object , put @ bottom of report. here i'm referring pdf context. (inside loop). dictionary created fetched array. mynewstring = [decimalformatter stringfromnumber:[resultsdict valueforkey:@"dispatchmtmiles"]]; [mynewstring drawinrect:cgrectmake(525, currentpagey, 40, 15) withfont:loadlinefont linebreakmode:nslinebreakbytruncatingtail alignment:nstextalignmentright]; i need keep running total of dispatchmtmiles in core data integer16 type. help. if understand right, , have array of dictionaries @"dispatchmtmiles" key, can sum them key coding function, example: nsarray *a = @[@{@"x": @1}, @{@"x": @2}, @{@"x": @3}]; nsnumber *sum = [a valueforkeypath:@"@sum.x"]; // 6

Why isn't Rails recognizing nil if blank in my form? -

i'm reworking rails 2 website. right now, i'm getting error, , think it's because value being submitted blank instead of .nil. however, attempts keep nil don't seem working. appreciate have offer. from model, based on make blank params[] nil null_attrs = %w( start_masterlocation_id ) before_save :nil_if_blank protected def nil_if_blank null_attrs.each { |attr| self[attr] = nil if self[attr].blank? } end view i've got jquery adds value hidden field when start_masterlocation_id exists. i've got jquery removes field attribute when not exist. <%= hidden_field :newsavedmap, :start_masterlocation_id, :id => "start-masterlocation-id-field" %> finally, here part of controller throwing error. controller page holds form (maptry), not controller newsavedmap. think have delete @newsavedmap.id, @newsavedmap.mapname, , @newsavedmap.optimize lines i'm going form handlers, don't think that's related er

php - use curl to pass file from one server to another -

i have web server receives posted data form, 1 part of can attached image. want use curl send information along second server. works fine requests not include image, when image included in original post get: curl error 26: failed creating formpost data i know indicates curl unable find file, having trouble determining why not. here code if ($_post) { $postdata = array(); //copy in post fields posted here foreach ($_post $key => $value) { $postdata[$key] = $value; } //copy in files have been included foreach ($_files $key => $value) { if ($value["tmp_name"]) { //if null, no file uploaded $fn = "existing_image.jpg";//(use existing debugging //in reality, use tmp image) $postdata[$key] = "@" . realpath($fn) . ";type=" . $value["type"]; $testmsg .= "added file $key value of '" . $postdata[$key] .

objective c - UIActionSheet pass touches through? -

i'm looking use uiactionsheet kind of contextual message box (with no action buttons @ , label in bubble arrow pointing @ something). since there no actions user can take, not require tap dismiss, can't see way (such passthroughviews property) allow this. it's not designed this, happen handy it. this example code of how show uialertview , dismiss automatically. show it: - (void)show { uialertview* alert = [[uialertview alloc] initwithtitle:@"title" delegate:self cancelbuttontitle:nil otherbuttontitles:nil]; alert.tag = tag; [alert show]; } dismiss it: - (void)dismiss { (uiwindow* w in [uiapplication sharedapplication].windows) (nsobject* o in w.subviews) if ([o iskindofclass:[uialertview class]]) { uialertview *alert = (uialertview*) o; if (alert.t

9-patch images in Android WebView -

do 9-patch images work inside android webview? haven't found definitively answers 1 way or another. know there's project uses javascript mimic on web ( https://github.com/chrislondon/9-patch-image-for-websites ), figure use workable alternative wondered if else had ideas. i think feasible , there several ways have try. do in js/css. mentioned, there several js plugin support parsing 9patch. , css3 has new feature named border-image, achieve same result. do in android. if used in android, can use webview.addjavascriptinterface() , enable js invoke android code. when javascript want image, send image uri , desired size of image android. android try load image , use ninepatchdrawable parse it. convert bitmap , return back.

git - Pulling All Remote Branches Xcode -

i writing project in xcode team , use git version control. xcode has bunch of nice built in features git , 1 of pull option. great have xcode pull remote branches not have pull them 1 one. there easy way or forced command line every time wish pull branches. thanks.

c# - How add control programmatically in gridview template? -

i want add control label in gridview, possible add datatable? here code: <asp:gridview id="reportscheduledetailsgridview" runat="server" autogeneratecolumns="false"> </asp:gridview> i try use tag html span, not render: string querystring = @"select * [table1]"; sqlcommand cmd = new sqlcommand(querystring, connokto); using (sqldatareader sdrmaster = cmd.executereader()) { while (sdrmaster.read()) { datarow rows = datatable.newrow(); rows[0] = sdrmaster["name"].tostring(); (var x = 1; x < maxcol; x++) { querystring = @"select * table2"; cmd = new sqlcommand(querystring, connokto); using (sqldatareader sdrrev = cmd.executereader()) { while (sdrrev.read()) { blok = "<span></span>"; no = (int)in

php - Flipping active = -1 to active = 1 -

built this, , executed it, database in phpmyadmin has no changes... missing? active column name in each table... there 107 tables need flip. thanks. <?php mysql_connect("localhost", "root", "789fernshb")or die("cannot connect server"); mysql_select_db("core")or die("cannot select db"); $sql = "show tables core"; $result = mysql_query($sql); $arraycount = 0; while($row = mysql_fetch_row($result)) { $tablenames[$arraycount] = $row[0]; $arraycount++; //only make sure starts @ index 0 } //print_r($tablenames); for($i=0;$i<sizeof($tablenames);$i++){ $table= $tablenames[$i]; echo $query = "update ".$table." set active=1 active=-1"; echo'>>'.mysql_query($query).'<br>'; } ?> explicitely call mysql_error() function see happens. example in http://ca2.php.net/manual/en

Rolling Hash Algorithm for Rabin-Karp Algorithm Java -

i have been trying understand rabin-karp algorithm algorithms class. having alot of trouble understanding tried implement (i don't have implement it). think understand except rolling hash function. algorithm works if pattern char[] matches @ beginning of text char[]. cannot figure out rolling hash going wrong. if please point me in direction of error greatful. results text "my test string" pattern "my" - comes matched pattern "test" - shows not matched private static int int_mod(int a, int b) { return (a%b +b)%b; } public static int rabin_karp(char[] text, char[] pattern) { int textsize = text.length; int patternsize = pattern.length; int base = 257; int primemod = 1000000007; if(textsize < patternsize) return -1;n int patternhash = 0; for(int = 0; < patternsize; i++) patternhash += int_mod(patternhash * base + pattern[i], primemod);//this done once put method here system.

what is the padding's role on the css and html -

Image
this question has answer here: when use margin vs padding in css 16 answers i use sytle padding script like this <style> #img1{padding:7px 10px} </style> <body> <img src="myjpg.jpg" id="img1"/> </body> i can't understand exactely role of padding. maybe padding's function object's out layer margin?? as can see in image (shared josh) : say have element c parent p. padding : when applied p, adds space inside p, outside c. padding : when applied c, adds space inside c. margin : when applied c, adds space outside c, inside p. margin : when applied p, adds space outside p, inside p's parent. you may notice 1st & 3rd case alike when p & c considered.

navigate data between pages in jquery mobile without using external libraries -

how navigate data between pages in query mobile without using external library. have searched on google can't proper answer working correctly. okay, preferably this: in page want pass set sessionstorage item , in other page item: (this works persisting data untill session cleared) window.sessionstorage.setitem("param1","12345"); window.sessionstorage.getitem("param1"); or use data-param="12345" in element (div, listview etc..): <div id="divid" data-param1=""></div> $("#divid").data("param1", "12345"); and read in other page: $("#divid").data("param1");

Joomla 1.5 show Author name of post -

joomla experts let me ask question! i'm using component mosets tree make ebook site. show custom fields of mosets tree ok, don't know how show author name of post :| mosets tree's demo http://demo.mosets.com/tree/877-mosets.html got angry joomla!!!

python dictionary weird behavior -

i can't understand why, when c=2 , c=3, dict2['a']=1 , dict2['a']=4 respectively , not 0, though make dict2 equal dict1, dict1['a']=0? why dict1['a'] change 0? don't change of dict1 variables! why dict3 show correct values within loop, shows values last iteration 3 after loop finished. thank much. import collections def main(): dict1 = collections.ordereddict() dict2 = collections.ordereddict() dict3 = collections.ordereddict() dict1['a'] = 0 dict1['b'] = 0 dict1['c'] = 0 c in [1, 2, 3]: print('c=' + str(c)) dict2 = dict1 print('dict1a=' + str(dict1['a'])) print('dict2a=' + str(dict2['a'])) if c == 1: dict2['a'] = 1 dict2['b'] = 2 dict2['c'] = 3 elif c ==2: dict2['a'] = 4 dict2['b'] = 5

javascript - JQuery easy ui tree drag and drop feature hangs for large tree -

i using j query easy ui creating tree structure , using drag & drop feature. works fine tree less 100 nodes . have tree approximately 7 thousand nodes , in such cases drag n drop feature hangs , web page becomes not responding. suggestions or alternatives welcome. ty

Decompress string in java from compressed string in C# -

i searching correct solution decompress string in java coming c# code.i tried myself lot of techniques in java like(gzip,inflatter etc.).but didn't solution.i got error while trying decompress string in java compressed string c# code. my c# code compress string is, public static string compressstring(string text) { byte[] bytearray = encoding.getencoding(1252).getbytes(text);// encoding.ascii.getbytes(text); using (var ms = new memorystream()) { // compress text using (var ds = new deflatestream(ms, compressionmode.compress)) { ds.write(bytearray, 0, bytearray.length); } return convert.tobase64string(ms.toarray()); } } and decompress string in java using, private static void compressanddecompress(){ try { // encode string bytes string string = "xxxxxxsamplecompressedstringxxxxxxxxxx"; // // compress bytes byte[] decoded = base64.decodebase64(string.getbytes()); byte[] outpu

swing - Creating an Open Function in Java using JFIleChooser -

hi having issues completetly understanding feature of notepad. want user ot search .txt file desire in directory , able open it. remember notepad file must readeable , writable. created simple open stuck in fact keep getting red in br = new bufferedreader(new filereader(open));, on new filereader(open)); part. how can fix this? appreciated. public void actionperformed (actionevent event) { if(event.getsource() == this.newfile){ this.textarea.settext(""); }else if(event.getsource() == this.openfile){ jfilechooser open = new jfilechooser(); int option = open.showopendialog(this); filereader fr; bufferedreader br; if(option == jfilechooser.approve_option){ try{ br = new bufferedreader(new filereader(open)); //while(){ //} }catch(exception ex){ system.out.println(""); } } } }

ruby - Adding address to mailchimp using Gibbon gem -

im using gibbon 0.4.6 ruby 1.9.3p392, , tried add address of contacts couldn't find correct format of parameters. respuesta = gb.listsubscribe({ :id => lista_id, :email_address => email, :merge_vars => {'fname' => nombre, 'lname' => apellido, 'mmerge3' => ['addr1' => 'aqui', 'addr2' => 'alla', 'city' => 'mexico df', 'zip' => '06700', 'country' => 'mx'] } }) update as amro suggested, im using gibbon 1.0, have same problem: i used this respuesta = gb.lists.subscribe({ :id => lista_id, :email => {:email => email}, :merge_vars => {'fname' => nombre, 'lname' => apellido, 'mmerge3' => {'addr1' => 'aqui', 'addr2' => 'alla', 'city' => 'mexico df', 'zip' => '06700

mongoose - MongoDB empty string value vs null value -

in mongodb production, if value of key empty or not provided (optional), should use empty string value or should use null value. 1) there pros vs cons between using empty string vs null? 2) there pros vs cons if set value undefined remove properties existing doc vs letting properties value either empty string or null? thanks i think best way undefined suggest not including key altogether. mongo doesn't work sql, have have @ least null in every column. if don't have value, don't include key. if make query documents, key doesn't exists work correctly, otherwise not. if don't use key save little bit of disk space. correct way in mongo. function deleteempty (v) { if(v==null){ return undefined; } return v; } var userschema = new schema({ email: { type: string, set: deleteempty } });

android - Connecting to a bluetooth device programatically -

i writing program new vehicle security app. app allows user control lock/unlock operations via phone app. lets user's phone bluetooth switched off @ first. if that's case, when opens app, phone bluetooth adapter should automatically switched on , should connect bluetooth module fixed in vehicle. according code have done, programatic enabling of bt adapter of phone works fine. connection vehicle bt module not happen. but if user opens app while phone bt adapter switched on, connection establishing between vehicle , phone happens automatically. i need know why connection not happen when bt adapter turned on programatically. note - phone , vehicle bt module paired. bluetooth modules mac address hard coded in coding. coding follows. pasted necessary parts. hope every needed understand , solve problem here. way posted code pretty messed up. sorry that. hope it's clear. i'm new this. private static final uuid my_uuid = uuid.fromstring("00001101-0

repeating the first frame of a video with ffmpeg -

to repeat first frame of video, example padding compensate longer audio, following pipeline can used. ffmpeg -i video.mp4 -vframes 1 -f image2 image.jpg ffmpeg -loop 1 -i image.jpg -t 5 pad.mkv ffmpeg -i pad.mkv -i video.mp4 -i audio.mp3 -filter_complex '[0:v] [1:v] concat' -c:a copy -map 2:a out.mkv (concat filter preferred concat input because codecs of video , padding clip may differ.) in contrast, paddings audio silence @ start fits in 1 line. ffmpeg -i video.mp4 -i audio.mp3 -map 0:v -filter_complex 'aevalsrc=0:duration=5 [pad],[pad] [1:a] concat=v=0:a=1' -c:v copy out.mkv can video padding condensed in 1 ffmpeg execution, too?

OpenCV-Driver for firewire camera -

i'm trying use firewire, sony handycam opencv application. believe need download driver cmu 1394 driver integrates firewire cameras seems compatible windows. there soemthign can use mac make camera open cvcapture*capture=0; capture=cvcapturefromcam(0); i had similar problem. changing permissions /dev/raw1394 , /dev/ieee1394 worked me (testing prosilica ec ubuntu lucid).

jquery - Alert box for `alert($('input:number[name=userNum]').val());` does not pop-up -

script(type='text/javascript', src='js/jquery.min.js') script. function afunction() { alert($('input:text[name=username]').val()); /* alert box, works fine. */ alert($('input:number[name=usernum]').val()); /* error here. alert box not pop-up */ } body form(name='aform', method='post', onsubmit='afunction();') input(type='text', name='username', placeholder='enter name') input(type='number', name='usernum', placeholder='enter number') button(type='submit') submit the alert box pops name entered, alert box not pop number entered. error there? for input type number , can use code like: alert($('input[name=usernum]').val()); since, in jquery don't have selector number yet! though have selector :text .