Posts

Showing posts from August, 2013

xcode - Alternative iOS layouts for portrait and landscape using just one .xib file -

Image
using interface builder in xcode , 1 .xib file, how can create alternate layouts when rotating between landscape , portrait orientations? see diagram of differing layouts n.b . green view/area contain 3 items flowing horizontal in landscape , in portrait 3 items flow vertically within green view/area. a way have 3 views in .xib file. first 1 normal view of viewcontroller no subviews. then create views portrait , landscape need them. 3 have root-level views (have @ screenshot) in viewcontroller, create 2 iboutlets, 1 portrait , 1 landscape view , connect them corresponding views in interface builder: iboutlet uiview *_portraitview; iboutlet uiview *_landscapeview; uiview *_currentview; the third view, _currentview needed keep track of 1 of these views being displayed. create new function this: -(void)setupviewfororientation:(uiinterfaceorientation)orientation { [_currentview removefromsuperview]; if(uiinterfaceorientationislandscape(orientation))

The semicolon inference doesn't work when an assignment statement is followed by curly braces in Scala? -

@ http://www.artima.com/pins1ed/builtin-control-structures.html#7.7 , see following code val = 1; { val = 2 println(a) } println(a) where says semicolon required here, why? from rule @ http://www.artima.com/pins1ed/classes-and-objects.html#4.2 , think semicolon should auto added since val = 1 can legal statement. the next line begins { , think can start legal statement. (since there's no compile error if add semicolon , separate first 2 lines 2 statements.) val = 1 not in parentheses or brackets. because legal call apply : implicit class richint(i: int) { def apply(thunk: => unit) = 33 } val = 1 { val = 2 println(a) } println(a) // 33 ! 1 { ... } short 1.apply {...} . apply not defined int default, implicit enrichment shows, possible. edit : semicolon inference conditions described in '§1.2 newline characters' of scala language specification . inferred semicolon called 'special token " nl "' in text.

git fetch vs pull (need full merge syntax) -

so i've read plenty of answers on already, saying pull = fetch + merge. i'm not totally convinced. morning instead of doing "git pull" update code everyone's changes, did "git fetch," , ran "git merge" resulted in bunch of errors. actually, "git merge" didn't work on own. i'm on origin/develop branch, did "git merge origin develop" , gave me several errors (which didn't save, unfortunately). so, exact syntax should've used? you should've used git merge @{u} . @{u} shorthand remote tracking branch (e.g., origin/master ). looks might working branch called develop , equivalent: git merge origin/develop . i can't remember if pull ask provide message actual merge--in case cannot fast-forward. so, full command might more akin git merge --no-edit @{u} .

firebase - Concurrent users and multiple observers -

i know there a thread on how number of concurrent users calculated in firebase, doesn't answer question, is: if single user has multiple observers multiple locations in single firebase application, count 1 or several concurrent users? multiple observers multiple location same firebase connection counted 1 concurrent only. every web page shares single connection given firebase, not across iframes or tabs. every node.js, ios or android process share 1 connection per firebase well.

javascript - distance jQuery UI draggable object has been moved, dragged -

i using following code allow members of .datacard class draggable left or right, revert original positions. $('.datacard').draggable({ axis: 'x', revert: true }); how can tell distance item away original position? have made across 1 axis .. drag: function (e, ui){ y2 = ui.position.top; x2 = ui.position.left; if(y2>100){alert("greater");} if(y2>100){alert("greater");} } jsfiddle demo

javascript - jQuery Adding and Removing Rows Trouble -

Image
i'm trying create new use implemented tool use here @ work, i'm sure i'm doing wrong. i can't figure out how make delete row. , more, can figure out how clone within .pt-entry, , have replicated inside of incremental .pt-entry...but without user filled in info. hopefully makes sense. you can check out pen here , here's code breakdown rest of yous: html: <table class="manage-pt" id="0"> <tr class="pt-entry"> <td class="pt-toggle-group"> <input type="button" class="pt-button togptbutton" value="?" /> <input type="button" class="pt-button addptbutton" value="+" /> <input type="button" class="pt-button delptbutton" value="-" /> </td> <td class="pt-values"> <div> <input ty

algorithm - find the first longest ascending or descending sub-sequence in a given unsorted sequence by C++ -

i writing c++ program find , print first longest ascending or descending continuous subsequence vector of integers. example, given vector with 4, 2, 1, 2, 3, 4, 3, 5, 1, 2, 4, 6, 5 return 1,2,3,4 my code follows: but, not know how return first optimal solution. example, above sequence has 1, 2, 4, 6 4 long. but, need return 1,2,3,4. bool findlong(const vector<int> v) { if (v.size() <1) return false; if (v.size() == 1){ cout << v[0] << endl; return true; } vector::const_iterator itr_left, itr_right; itr_left = v.begin(); itr_right = v.begin()+1; bool ascending_flag ; int counter =0; if (*itr_right > *(itr_right-1)){ bool ascending_flag = true; ++ascending_counter; } else{ bool ascending_flag = false; ++descending_counter; } int longest = int_min; vector<int>::iterator longest_left = v.begin(), longest_right =v.begin(); ++itr_right; while (itr_right != v.end()) { if (a

c# - Is there any way to make sure the DataGridView columns stay the same size on high-resolution displays? -

i have datagridview after deployed on systems columns small, on high resolution laptops. there way make sure columns stay same size? the datagridview same size last 2 columns shrink, , therefore not usable. check last 2 column's property, may set "fill" in autoresizemode (under layout). change "displayed cells" or "column header".

javascript - iscroll is not working completely until inspect element is on -

i'm making chat box contains iscroll , dragging fine scroll bar not appearing when dialogues entered , when turn on inspect element works fine ,but when mores dialogues entered scroll bar doesn't change length , again turning on inspect element works fine . html : <div id="conversation" class="conversation "> <div id="scroller"> </div> </div> css : .conversation { position:relative; width: 100%; background: #a00; padding-top: 10px; overflow: auto; height: 205px; } #conversation{ overflow:auto; height: 205px; } #scroller{ position: relative; background: #000; bottom: 10px; overflow: auto; } js : var myscroll; function loaded() { myscroll = new iscroll('conversation'); } document.addeventlistener('touchmove', function (e) { e.preventdefault(); }, false); document.addeventlistener('domcontentloaded', function () { settimeout(loaded, 200); }, false); help please :)

ios - Is it possible to pass existing methods to callbacks defined similar to UIView.animateWithDuration? -

the method accepts 2 callbacks, animations , complete . if define needs done in class methods, how pass them animatewithduration ? from: https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/clm/uiview/animatewithduration:animations : the signature looks + (void)animatewithduration:(nstimeinterval)duration animations:(void (^)(void))animations usually looks like: [uiview animatewithduration:0.2f delay:0.0f options:uiviewanimationoptioncurveeasein animations:^{ _someview.frame = cgrectmake(-150, -200, 460, 650); _someview.alpha = 0.0; } completion:^(bool finished) { }]; so looking assigning animations method in class. this method chosen well-known example. root have own class tries same approach , wondering if keep code cleaner not calling class methods w

python - Pyinstaller-created-program Prerequisites -

i broke solid state drive had reinstall windows etc. after fresh install, program created pyinstaller wouldn't open or give me error message. have installed visual studio 2012, works fine. i'm assuming vs comes bunch of redistributables, 1 or more of required pyinstaller. know can inform users? edit: uninstalled every visual c++ redistributable , .net framework , still works. in case else comes across this, believe narrowed down redistributable package https://www.microsoft.com/en-ca/download/details.aspx?id=30679

assembly - Poke opcodes into memory -

hi trying understand whether possible take instruction opcodes , 'poke' them memory or smehow convert them binary program. have found abandoned lisp project here: http://common-lisp.net/viewvc/cl-x86-asm/cl-x86-asm/ takes x86 asm instructions , converts them opcodes (please see example below). project not go further complete creation of binary executable. hence need 'manually' ideas can me. thanks. ;; assemble code in (cl-x86-asm::assemble-forms '((.entry :push :eax) (:sub :eax #xfffea) (:mov :eax :ebx) (:pop :eax) (:push :eax) (.exit :ret)) processing... ;; print assembled segment (cl-x86-asm::print-segment) * segment type data-segment segment size 0000000c bytes 50 81 05 00 0f ff ea 89 03 58 50 c3 clozure common lisp example has built-in. called lap , lisp assembly program . see defx86lapfunction . example: (defx86lapfunction fast-mod ((number arg_y) (divisor arg_z)) (xorq (% imm1) (% imm1)) (mov (% number) (%

axapta - Create a new record in form LedgerJournalTransCustPaym through x++ code -

i need create reord in ledgerjournaltrans through x++ code. while debugging found out class ledgerjournalengine_custpayment used initiate form as ledgerjournalengine_custpayment = new ledgerjournalengine_custpayment(element) and later ledgerjournalengine.initvalue(ledgerjournaltrans); also after assiging accountnum methods executed @ modified() method of datasource field ledgerjournaltrans:accountnum element.accountnummodifiedpost(); etc. while trying achieve same through code not able initiate class ledgerjournalengine_custpayment , other methods in form ledgerjournaltranscustpaym system does. pls help.. joyce ledgerjournalengine* classes used forms work , execute code before/after events , datasource actions. you're trying do, make more sense complete of necessary ledgerjournaltrans fields, .insert(). here code wrote want though using engine some: static void job81(args _args) { ledgerjournalengine_custpayment ledgerjournalengine;

html - Tricky sticky footer with sidebar -

Image
i'm looking place sticky footer inside of content area of page full-height sidebar. here copy of page i'm working on: http://www.lavenderstone.co.uk/stackoverflow/ i've worked http://ryanfait.com/sticky-footer/ many times in past, , method using %'s instead. twist problem i'm having there 100% height sidebar (green) , need footer (orange) @ bottom of content div (grey). i can't place footer div @ bottom of parent div, nor can force sibling have 100% height minus hight of footer. i've tried both no avail. i place footer right @ bottom of page, disrupt design of side bar. can help? i'm wanting resort javascript! add style content-wrap element #content-wrap{ height:100%; } put footer element in content element , add style; #footer{ position:absolute; bottom:0; }

java - deserialize JSON data for different types of objects -

im using gson on android device. i have json data coming in, can come in form of few different objects. this how think need handle it. public class command { public string command; } string json = {"command":"something", "date":"now"} string command = gson.fromjson(message, command.class); then switch on command switch(command) { case: //deserialize "something" object; break; case: other somthing //deserialize "other somthing" object; break; case: object 3 //deserialize "object 3" object; break; } does gson have sort of auto mapping best suited object, dont have make custom object handler , deseraialize string twice? i parse general jsonobject using jsonparser parser = new jsonparser(); jsonobject jsonobject = parser.parse(json).getasjsonobject(); then find unique each json schema , depending on schema convert bean using gson.fromjson(jsonobject, appropriatebea

How to remove a character in a variable of string type in R -

hi dear have variable of type in r: v1 car10100231095000c car10100231189000 car10100231191000c car10100231192000 car10100231194000c car101002311950002 car101002311960001 my problem rows have c last element of observation. trying use nchar() function have others rows have same length example car10100231191000c and car101002311960001. problem how remove c raws character , new variable of form: v1 car10100231095000 car10100231189000 car10100231191000 car10100231192000 car10100231194000 car101002311950002 car101002311960001 where cs removed rows have , rest of rows have original form. thanks you can use sub this: sub('c$', '', v1) which removes letter c last position in string if exists.

android - Programmatically adding ABOVE to LayoutParams causes view height to be 0 -

i have custom view . in constructor view, create , add 2 subviews. however, using layoutparams.addrule() causing problems. rules such center_horizontal work, when try use above , subview ends height of 0. here code in constructor: setlayoutparams(new layoutparams(layoutparams.match_parent, layoutparams.match_parent)); mlayoutparams = new layoutparams(width, height); mlayoutparams.leftmargin = left; mlayoutparams.topmargin = top; mimage = new imageview(getcontext()); mimage.setimagedrawable(getresources().getdrawable(r.drawable.my_image_drawable)); mimage.setscaletype(scaletype.fit_xy); mimage.setid(r.id.my_image_id); addview(mimage, mlayoutparams); mtext = new textview(getcontext()); mtext.settext(r.string.my_text); mtext.setid(r.id.my_text_id); layoutparams textparams = new layoutparams(200, 40); // textparams.addrule(center_horizontal, true); //works textparams.addrule(above, mimage.getid()); //doesn't work

sql - Msg 102, Level 15, State 1, Line 27 - Incorrect syntax near ')' -

select * [h_active_students] /* section below works independently fine, generates error when used subquery */ (select view_h_active_students.stud_id, view_h_active_students.stud_last_name, view_h_active_students.stud_first_name, view_h_active_students.stud_middle_initial, cast(view_h_active_students.stud_birth date) stud_birth, view_h_active_students.stud_sex, view_h_active_students.stud_mail_street_address, view_h_active_students.stud_mail_city, view_h_active_students.stud_mail_st, view_h_active_students.stud_mail_zip_code, view_h_active_students.stud_area_cd, view_h_active_students.stud_phone_no, view_h_active_students.stud_pin, view_h_active_students.semc_yr_sem, view_h_active_students.semc_active_units, view_h_active_students.semc_finaid_active_units, view_h_active_students.semc_active_hours, view_h_active_students.semc_finaid_active_hou

javascript - JS Image Transition Not Working -

i unable css opacity transition work adding using javascript. please let me know wrong code. http://jsfiddle.net/copperspeed/bvwbb (function () { var myimgs = document.getelementbyid('vz0'); var = 0; function cycle() { if (i <= 3) { var myarray = [ 'http://jsrun.it/assets/t/r/u/o/truot.jpg', 'http://jsrun.it/assets/6/c/y/s/6cysh.jpg', 'http://jsrun.it/assets/w/m/r/i/wmriq.jpg', 'http://jsrun.it/assets/5/q/8/f/5q8fw.jpg' ]; console.log(myarray[0]); myimgs.setattribute("src", myarray[i]); if (myimgs.style.opacity === '0') { console.log('trans'); myimgs.style.transitionproperty = 'opacity'; myimgs.style.transitionduration = "1500ms";

Google Drive Javascript API: Detect drive changes - return changes only -

i try detect changes on users drive update contents in list when request changes receive entries on drive. to explain why want this: handy feature when user has 2 tabs opened, 1 google drive environment , 1 application uses drive (doesn't need reload app see content changes made in drive environment). i'm following guide listed here: https://developers.google.com/drive/v2/reference/changes/list a strange thing need largestchangeid+1 , how know value? not know largestchangeid , set null . no matter i'm doing value content. i made following code: o.getcloudfileupdates = function(fcallback, sfolderid ) { var odefq = {q:'trashed=false '+(typeof sfolderid == 'string'?('and "'+sfolderid+'" in parents'):''), largestchangeid:null, orderby:'title', maxresults:1000}, fgetfiles = function(request, result) { request.execute(function(resp) { //$d(resp);

python - Conditional multi column matching (reviewed with new example) -

i tried rework question in order match quality criteria , spent more time in trying achieve result on own. given 2 dataframes a = dataframe({"id" : ["id1"] * 3 + ["id2"] * 3 + ["id3"] * 3, "left" : [6, 2, 5, 2, 1, 4, 5, 2, 4], "right" : [1, 3, 4, 6, 5, 3, 6, 3, 2] }) b = dataframe({"id" : ["id1"] * 6 + ["id2"] * 6 + ["id3"] * 6, "left_and_right" : range(1,7) * 3, "boolen" : [0, 0, 1, 0, 1, 0, 1, 0, 0 , 1, 1, 0, 0, 0, 1, 0, 0, 1] }) the expected result is result = dataframe({"id" : ["id1"] * 3 + ["id2"] * 3 + ["id3"] * 3, "left" : [6, 2, 5, 2, 1, 4, 5, 2, 4], "right" : [1, 3, 4, 6, 5, 3, 6, 3, 2], "new": [0, 1, 1, 0, 1, 1, 1,

java - Regex that matches only one occurrence -

i'm wanting replace occurrences of "=" "==" in string regex, there single occurrence of "=". basically want transform: where = b | c == d into where == b | c == d what i'm struggling finding 1 occurrence. i've tried [^=]=[^=] , matching characters on either side too. you can try using lookarounds : (?<!=)=(?!=) using example: system.out.println("where = b | c == d".replaceall("(?<!=)=(?!=)", "==")); == b | c == d

php - New Relic warning: the Xdebug extension prevents the New Relic agent from gathering errors. No errors will be recorded -

in /var/log/newrelic/php_agent.log on servers see lines this: 2013-08-30 16:05:01.444 (15615/child) warning: xdebug extension prevents new relic agent gathering errors. no errors recorded. yet, still see [at least some] php errors in new relic. what's going on? warning bug in new relic? i found this says: if using xdebug, have warning this. turn off xdebug , or write own handler , call new relic api allow errors report new relic properly. see comments of kris weltz more information. the words "kris weltz" link a missing document . here's i've got installed: # rpm -qa | grep relic newrelic-php5-common-3.7.5.7-1.noarch newrelic-php5-3.7.5.7-1.x86_64 newrelic-repo-5-3.noarch newrelic-daemon-3.7.5.7-1.x86_64 newrelic-sysmond-1.2.0.257-1.x86_64 i got new relic support. their response xdebug indeed conflicts new relic, , should not used simultaneously. uninstalling xdebug php extension made warning go away. it may possible d

Cannot parse array with HTML code using jQuery's $.parseJSON -

i trying use jquery's $.parsejson() convert variable json 1 of values in json string consists of html code. when remove html variable , replace 'test', variable can parsed using $.parsejson , sent php script using ajax objects can manipulated. i trying figure out how pass html code variable , parse in order make object accessible php script. currently, questionshtml[index] variable breaking script. i've tried using 'questionsvalues[index].replace("}{", "},{");' in order remove double quotes , backslashes script still breaks. can provide solution getting html code prepared parsed using $.parsejson() ? javascript code var questionstype = []; var questionshtml = []; var questionsquestion = []; //store questions, types, , html each fieldset 3 separate arrays for(var i=1;i<=formpreviewid;i++) { questionsquestion.push($("#formelement_"+i + " legend").text()); questionstype.push($("#formelement_"+i).a

content management system - Opencart, Javascript file common,js uneditable? -

i running on version 1.5.5.1 of opencart , , odd reasons, if try change common.js file located in (/catalog/view/javascript/common.js) , never taken in consideration or code burnt down if never existed. tried renaming file, name stayed same, browser kept on loading old file doesnt exist anymore on server xd (and opened fresh new browser test that, dont have in cache or whatever else). so wondering if know problem and/or solve ! thanks in advance it depends on how server set , if it's setting far future expires files javascript, css etc. i don't know xd servers, under apache run complex .htaccess rule set caches everything, it's based on .htaccess file included html5 boilerplate not knowing browser you're using, 1 thing question stands out opening new window isn't going clear cache, need manually that. i have problem , clearing cache takes care of it. one way i've found os increment js , css files dynamically , edit number when make ch

java - Are Custom Libraries Unprofessional? -

i'm still in university @ moment, , i'll either try security or programming job. first programming course used custom library came book. replaced , added many of basics of java arrays, custom math functions, input (scanner), hashmaps, queues , stacks. if did land programming gig, considered unprofessional use given custom library such 1 above? either way, i've pretty weaned myself off of 75% of custom classes in favor of standard java classes/objects, wanted know if slipping in premade class textbook frowned upon. guys. "custom library" broad category useful. libraries reimplement functionality that's standard in jre, such collections api, useless, , did more harm in educational setting. however, there large number of tools, particularly google guava (enhanced collections multisets , bimaps), apache commons tools (including string parsing, hashcode building, , like), slf4j/log4j logging, , runtime environments such spring standard in industry.

rounding - lsqcurvefit when expecting small coefficients -

i've generated plot of attenutation seen in electrical trace frequency of 14e10 rad/s. ydata ranges approximately 1-10 np/m. i'm trying generate fit of form y = a*sqrt(x) + b*x + c*x^2. i expect around 10^-6, b around 10^-11, , c around 10^-23. however, smallest coefficient lsqcurvefit return 10^-7. also, return nonzero coefficient a, while returning 0 b , c. fit looks physics indicates b , c should not 0. here how i'm calling function % measurement estimate x_alpha = [1e-6 1e-11 1e-23]; lb = [1e-7, 1e-13, 1e-25]; ub = [1e-3, 1e-6, 1e-15]; x_alpha = lsqcurvefit(@modelfun, x_alpha, omega, alpha_t, lb,ub) here model function function [ yhat ] = modelfun( x, xdata ) yhat = x(1)*xdata.^.5 + x(2)*xdata + x(3)*xdata.^2; end is possible lsqcurvefit return such small coefficients? error in rounding or else? ways can change tolerance see fit closer expect? found stackoverflow page seems address issue! fit using lsqcurvefit

exception - Why is this error-throwing recursive Python function jumping back and forth over the last few calls? -

consider recursive function, tapped out colleague of mine: def a(): try: a() except: a() if run it, (python 2.7) interpreter hangs. surprised me because expected recursion depth (say n) gets hit throw runtimeerror , jump (n-1)th except block, runtimeerror , jump (n-2)th except , etc. so fleshed out function bit debugging: y = 10000 def a(x=0): global y if y: y -= 1 try: print "t: %d" % x a(x+1) except runtimeerror: print "e: %d" % x a(x+1) the y there force function terminate @ point, don't think otherwise changes behaviour of function. in interpreter (where recursion limit 1000) calling a() produces sequences such as: t: 998 e: 998 e: 997 t: 998 e: 998 e: 990 t: 991 t: 992 t: 993 t: 994 t: 995 t: 996 t: 997 t: 998 e: 998 e: 997 t: 998 e: 998 e: 996 looking @ longer sequence, can't discern real pattern (although confess didn't try plotting it). thought maybe stack bounc

angularjs - wait for angular app to be fully rendered from phantom script -

i'm writing script generates png images every page of frontend. i'm using angular ui , capturing pages phantom. the view take while until angular finish rendering have wait a little before capturing: var page = require('webpage').create(); page.open('http://localhost:9000/', function () { window.settimeout(function () { page.render('snapshot.png'); phantom.exit(); }, 2000); }); i wonder if there better way achieve this. found angular can emit event when page rendered: $scope.$on('$viewcontentloaded', function () { // }); and found way communicate phantom oncallback write like: $scope.$on('$viewcontentloaded', function () { window.callphantom({ hello: 'world' }); }); then in other place in phantom script: page.oncallback = function() { page.render('snapshot.png'); phantom.exit(); }; but i'm lost in how inject angular $viewcontentloaded handle phantom script. i don't kno

c# - How to separate this code in two classes? -

i want code html scraper in c# can links or other targetted strings page want to. i began , ran straight problem: have no idea how seperate code in classes, can use different search engines. this current code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.diagnostics; using system.net; using htmlagilitypack; namespace scraper.components { class scraper { public scraper() { webclient client = new webclient(); client.headers.add("user-agent", "mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 2.0.50727; .net clr 1.1.4322; .net clr 3.0.04506.30; .net clr 3.0.04506.648)"); htmldocument doc = new htmldocument(); doc.load(client.openread("xxx")); htmlnode rootnode = doc.documentnode; htmlnodecollection adnodes = rootnode.selectnodes("//a[@class='ad-title

email - mail codeigniter was sent,but not found in inbox -

i testing send email using codeigniter , send email,but when checked inbox,i didn't find email send before. here's controller: $this->load->library('email'); $this->email->from('email@yahoo.com', 'my name'); $this->email->to('email@yahoo.com'); $this->email->subject('email test'); $this->email->message('testing email class.'); $this->email->send(); echo $this->email->print_debugger(); success message: your message has been sent using following protocol: mail from: "xxxxxxxxxxxxxx" return-path: reply-to: "xxxxxxx@yahoo.com" x-sender: xxxxxxx@yahoo.com x-mailer: codeigniter x-priority: 3 (normal) message-id: <xxxxxxx@yahoo.com> mime-version: 1.0 content-type: text/plain; charset=utf-8 content-transfer-encoding: 8bit =?utf-8?q?email_test?= testing email class. you may check spam folder in email account. gmail/yahoo set

svg - Scaling down Raphael World Map -

i'm creating splash page project website. instructed design world map menu on side , add blinking effect while hovering on sub menus. i'm done transforming/scaling map, i'm having problem when hovering on sub menus, small red circles doesn't pop on should be. without .transform() method, small red circles pop correctly, gives me big cropped map. i used .transform() method scale world map down. i put .transform() method here: r.path(worldmap.shapes[country]).attr({stroke: "#9b59b6", fill: c, "stroke-opacity": 0.25}).transform("s.628,.740 0,0"); here's page transform() method. here's page without transform() method. in code of locations of cities stored lon/lat coordinates in name attribute. parsed through world.parselatlon function calls getxy() . in function getxy returning coordinates need transformed well. there interesting number manipulation going on there (multiplying 2.6938 , adding 465.4) - adjusting

Cannot access to selector of div that is created by jquery? -

i trying access selector created using html() of jquery function. tried many solutions few websites, doesn't work. now, make example, please correct , tell me reason please see example here $(document).ready(function(){ $(".close").click(function(){ alert("message closed"); }); $("button").click(function(){ $("#msg").html('<div class="close">close</div><div>message...</div>'); }); thank much. since close created dynamically, need use event delegation $(document).ready(function () { $('#msg').on('click', ".close", function () { alert("message closed"); }); $("button").click(function () { $("#msg").html('<div class="close">close</div><div>message...</div>'); }); }); demo: fiddle

Google Analytics Event Tracking onClick Code -

i'm trying set event tracking on web site can't working correctly. my tracking code: <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-420xxxxxxx', 'mywebsite.org'); ga('send', 'pageview'); </script> my event tracking code: <a href="#purchasepanellink" class="uk-button uk-button-primary" onclick="$('#purchasepanel').show(); _gaq.push(['_trackevent', 'button', 'click', 'purchase details',, false]);">purchase details</a> you mixing classic code universal code. not work. need replace this: _gaq.pus

ruby on rails - rake db:migrate issue postgresql -

i'm complete noob @ postgresql, ruby on rails.. i'm trying follow tutorial (without rubymine) http://www.codeproject.com/articles/575551/user-authentication-in-ruby-on-rails#installingrubymine4 i have such migrate (001_create_user_model.rb): class createusermodel < activerecord::migration def self.up create_table :users |t| t.column :username, :string t.column :email, :string t.column :password_hash, :string t.column :password_salt, :string end end def self.down drop_table :users end end the error i'm getting goes this: syntax error, unexpected ':', expecting ';' or '\n' t.column...sers |t| ... c:131071:in 'disable_dll_transaction' task:top => db:migrate what this: class createusermodel < activerecord::migration def self.up create_table :users |t| t.string :username, :null => false t.string :email,:null => false t.string :pa

Get value from object in javascript -

Image
i have several objects structure: then create function update quantity of item matched search id : function setquantityincartbyid(json, itemid, val){ for(var in json){ console.log(json[i].id); if(json[i].id == itemid){ json[i].quantityincart = val; break; } } return json; } this json ; {"departmentid":12,"categoryid":117,"brandid":19,"brandimage":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","brandname":"general","id":708,"name":"grand 6port power center","picturename":"http://111.92.241.110/wwwproducts/unknown.png","notes":"","priceshow":"$10.00","price":0,"pricea":0,"priceb":0,"pricec":0,"websiteprice":0,"quantity":2,"quantityincart":2,"

winforms - Getting info on C# menu items after a click -

another question c# newbie- use single function respond list of choices offered in menu. when run in debug mode can hover mouse on sender , clear sender has information need, both index of item in menu , text associated it. however, have not figured out how write code in way looking for. following not compile: int device; private void mymenuiteminputclick(object sender, eventargs e) { device = sender.index; } what see when put breakpoint on mymenuiteminputclick , put mouse on sender is: sender {windows.system.forms.menuitem, items.count:0, text:stereo mix (realtek high defini} moving mouse on "+" sign becomes "-" , list of debug statements drops down shows there item index want. how write code item i'm looking for? cast sender menuitem possibly solve problem. int device; private void mymenuiteminputclick(object sender, eventargs e) { device = ((menuitem)sender).index; } the variation bharath mentioned like, int device; p

static initialization block vs constructor java -

this question has answer here: in order static/instance initializer blocks in java run? 7 answers class prog { static { system.out.println("s1"); } prog() { system.out.println("s2"); } public static void main(string...args) { prog p = new prog(); } } output s1 s2 as per output, seems static initialization block gets executed before default constructor executed. can tell rationale behind ? strictly speaking, static initializers executed, when the class initialized . class loading separate step, happens earlier. class loaded , initialized, timing doesn't matter of time. is possible load class without initializing (for example using the three-argument class.forname() variant ). no matter way approach it: class always initialized @ time create instance of it, static block have been run @ time.

php - Making a downloadable file password protected on webpage -

i want make webpage has download option pdf, want password protected i.e. if clicks on link has enter username , password , if directly open link "www.example.com/~folder_name/abc.pdf" server ask password first , allow download edit: want user view file in browser, not force download here code <?php /* authentication script goes here*/ $file = 'http://example.com/folder_name/abc.pdf'; //header('content-description: file transfer'); header('content-type: application/pdf'); header('content-disposition: inline; filename=' . basename($file)); header('content-transfer-encoding: binary'); //header('expires: 0'); //header('cache-control: must-revalidate, post-check=0, pre-check=0'); //header('pragma: public'); header('content-length: ' . filesize($file)); header('accept-ranges: bytes'); @readfile($file); ?> but code not opening pdf in bro

c++ - How do I correct "expected primary-expression before...?" -

i'm beginning program , have no idea i'm doing. professor gave program sets , i've completed it, when compile file " j:\untitled1.cpp in function `int main()': "36 j:\untitled1.cpp expected primary-expression before '<<' token " here's full set, remember i'm beginner: /** concepts program #1, template program name: yay.cpp program/assignment: description: finds total input(s): output(s): suffering_with_c++ date of completion */ //included libraries #include <iostream> #include <iomanip> #include <stdlib.h> #include <time.h.> #define cls system("cls") #define pauseoutput system("pause")// using namespace std; int main() { //variable declaration/initialization time_t nowisthemoment; time(&nowisthemoment); string datetime;// cls; cout <<"\new live in moment--only moment ours. current date , time is: " <<ctime (&nowi

php - Get response <select> and show it in form <select> -

i have form in have list of indian states , cities. on selecting 1 of states, cities state displayed in <select> show cities. using php script hosted somewhere (a similar website) , think can solve purpose. script takes value of state options parameter , returns <select> corresponding cities. the script http://www.indane.co.in/state.php?stateid=2196 2196 id/value of selected state. i need display contents of in cities' . please suggest me how can this. so far have tried this, <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script language="javascript"> function showcat(id,ss,type) { var cid=id.value; if(type=='s

android - Unknown Error in XML -

hi have made xml file throwing error : incorrect line ending: found carriage return (\r) without corresponding newline (\n) here xml file : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <imageview android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:src="@drawable/help_new_session" android:layout_above="@

JavaBinder-Failed Binder Transaction in Android..? -

i showing image thumbnail in gridview sdcard , when click on image want start new activity , show image in fullscreen. facing problem activity not getting started ? posting code , logcat hope can in advance.. getfromsdcard(parent, child); (int = 0; < f.size(); i++) { cursor desc = sql.fetchcatimagedesc(f.get(i).substring( f.get(i).lastindexof("/") + 1)); while (desc.movetonext()) { itemname = desc.getstring(desc .getcolumnindexorthrow(image_sql.item_name)); } image.add(new image(bit.get(i), itemname)); } adapter = new myadapter(this.getactivity(), image); gv.setadapter(adapter); gv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub cursor desc = sql.fetchcatimagedesc(compare.get(arg2));

c# - We need enterprise library logging to throw errors -

do know how can errors enterprise library 5 logging block? as know, logging's philosophy non disrupting, if there error in configuration example, not error thrown. but in our application, logging critical, need have application out of order, running without logs. so need configure so, throw error if there any. i've found events here: enterprise library logging application block options so should able listen event, , throw our own error @ least, not able reference logging instrumentation, because, cannot see getinstrumentationeventprovider() method in following code. logginginstrumentationprovider instrumentation = logger.writer.getinstrumentationeventprovider() logginginstrumentationprovider; instrumentation.failureloggingerror += (s, z) => { throw z.exception; }; thank help. i think logginginstrumentationprovider definition changed between version 4 , 5 remove events posted approach won't work enterprise library 5. there few ways change beh