Posts

Showing posts from May, 2014

3dsmax - Converting coordinates system for FBX model in OpenGL -

i load fbx models using autodesk fbx sdk2013.the models rotated 90 degrees on x-axis default. the sdk supplies method : fbxaxissystem::opengl.convertscene(scene); to perform axis conversion.but doesn't work.calling changes nothing.moreover,it seems fbx exporter uses opengl right hand sytem default,at least says on import: fbxaxissystem fbxaxis = scene->getglobalsettings().getaxissystem(); if (fbxaxis != fbxaxissystem::opengl) { //.... } returns false. don't understand;if opengl (right handed system,why models have z axis up? sdk bug? i found solution.someone here said convertscene() doesn't affect vertices array sets node global/local matrices.with these can transform node geometry or vertices. so here how done: fbxmatrix globaltransform = mesh->getnode()->getscene()->getevaluator()->getnodeglobaltransform( mesh->getnode()); dvec4 c0 = glm::make_vec4((double*)

javascript - how to get inner HTML with jquery 2.0? -

this code (jquery 2.0.3): alert($('<p>test <b>me</b></p>').filter('p').get(0).html()); chrome says: cannot call method 'html' of undefined what's wrong? btw, i'm expecting test <b>me</b> . ps. problem i'm running xslt, not html. answers. remove .get(0) method. http://jsfiddle.net/nmhqw/ alert($('<p>test <b>me</b></p>').filter('p').html());

python - Why does "from [Module] import [Something]" takes more time than "import [Module" -

this question has answer here: why take longer import function module entire module itself? 3 answers i used python -mtimeit test , found out takes more time from module import sth comparing import module e.g. $ python -mtimeit "import math; math.sqrt(4)" 1000000 loops, best of 3: 0.618 usec per loop $ python -mtimeit "from math import sqrt; sqrt(4)" 1000000 loops, best of 3: 1.11 usec per loop same other case. please explain rationale behind? thank you! there 2 issues here. first step figure out part faster: import statement, or call. so, let's that: $ python -mtimeit 'import math' 1000000 loops, best of 3: 0.555 usec per loop $ python -mtimeit 'from math import sqrt' 1000000 loops, best of 3: 1.22 usec per loop $ python -mtimeit -s 'from math import sqrt' 'sqrt(10)' 10000000 loops, best of

java - Why doesn't putting a random http link in code cause a compilation error? -

this question has answer here: my java code has obvious error. why compile , run? 2 answers for example: public class mylink{ public static void main(string[] args) { http://google.com system.out.println("and works!"); } } this code compile without problems. why? in java http: label can use in loops or pther statements, whereas //google.com single-line comment .

c# - How does Thread.Abort() work? -

we throw exception when invalid input passed method or when object enter invalid state. let's consider following example private void somemethod(string value) { if(value == null) throw new argumentnullexception("value"); //method logic goes here } in above example inserted throw statement throws argumentnullexception . question how runtime manages throw threadabortexception . not possible use throw statement in methods, runtime manages throw threadabortexception in our custom methods too. i wondering how it? curious know happening behind scenes, opened reflector open thread.abort , end this [methodimplattribute(methodimploptions.internalcall)] private extern void abortinternal();//implemented in clr then googled , found how threadabortexception work . link says runtime posts apc through queueuserapc function , that's how trick. wasn't aware of queueuserapc method gave try see whether possible code. following code shows try. [d

sorting - How to implement sort in hadoop? -

my problem sorting values in file. keys , values integers , need maintain keys of sorted values. key value 1 24 3 4 4 12 5 23 output: 1 24 5 23 4 12 3 4 i working massive data , must run code in cluster of hadoop machines. how can mapreduce? you can (i'm assuming using java here) from maps emit - context.write(24,1); context.write(4,3); context.write(12,4) context.write(23,5) so, values needs sorted should key in mapreduce job. hadoop default sorts ascending order of key. hence, either sort in descending order, job.setsortcomparatorclass(longwritable.decreasingcomparator.class); or, this, you need set custom descending sort comparator, goes in job. public static class descendingkeycomparator extends writablecomparator { protected descendingkeycomparator() { super(text.class, true); } @suppresswarnings("rawtypes") @override public int compare(writablecomparable w1, writablec

vb.net - regex - return all characters between quotes, multiple times per line -

i novice @ using regular expressions , still trying figure out, please excuse inconsistencies in question below. everything below i'd using regular expressions in vb.net . using regex in vb.net , i'm attempting extract delimited data flat file shares similarities csv formatted file, keep data between double quotes, delimited commas. here example of typical line: [java] customer [customerid="1000", customername="acme service, inc"] [java] customer [customerid="2000", customername="widget factory, llc"] the output i'm looking is: "1000","acme service, inc" "2000","widget factory, llc" edit using expression, "([""'])(?:(?=(\\?))\2.)*?\1" , i've been able extract "1000" , having trouble getting first , subsequent double quoted "" values on same line. also, not limited 2 values, indeterminate set of double quoted values on same

javascript - How would I dynamically convert form fields to multi-dimensional js object? -

i'm struggling dynamically convert set of inputs multi-dimensional object passing in ajax call. assume have person, multiple addresses. fields this: <input name='person[name]' value='bradley'/> <input name='person[addresses][home]' value='123 anywhere drive.'/> <input name='person[addresses][work]' value='456 anywhere road.'/> how 1 convert fields ab object looks this: person : { name: 'bradley', addresses: { home: '123 anywhere drive.', work: '456 anywhere road.' } } i need dynamically (function needs work regardless of inputs provided) , work @ n-depth. (note: jquery available). http://jsfiddle.net/w4wqh/1/ honestly think there's way in regex.. couldn't figure out. so, it's bit of ugly string manipulation. either way, should on right track think: function serialize () { var serialized = {}; $("[name]"

javascript - get elements that did not load -

how find out elements did not load because resource wasnt found? <body> <img src="notthere.png"> <script src="notinhere.png"></script> <img src="doesexist.png"> // want find first , script unexisting sources, not second image existing source. </body> can give me hint how find out elements? think, setting onerror each element no solution because elements may loaded dynamically.. unfortunately, window.onerror not fired on 'resource not found' errors. example: <body> <script src="someonesscript.js"></script> <!-- script might load images/audio etc.. --> <script> // put here whatever // find out resources (images,scripts,..) tried load (from script above) // , can't loaded </script> </body> hope example understand question. while th

php - stream updates to database onto website? -

i'm not sure how approach problem, since i'm new web programming. have python program collects keyword specific tweets twitter, adds them mysql database. continuously long program kept running. now want post tweets collects on website (just start posting tweet text, simple) program enters database, or in real time/as close real time can get. hope makes sense. anyways, how should approach this? thinking either: 1) have python send tweet text directly website using ajax? 2) have website html/javascript/php use ajax ask mysql if there new updates, if so, post new tweets...or need in reverse ajax? any advice or suggestions appreciated! javascript ajax... use jquery mixed in here: $(document).ready(function(){ setinterval(function(){ $.ajax({ //call php script returns new tweets mysql in table form or other }).done(function(response){ $('#displaydiv').append(response); }); }, 1000);//every 1 secon

android - How to export signed application package in eclipse with proguard and crashlytics? -

the crashlytics knowledge base says : "when building release eclipse, export application apk using “export crashlytics-enabled android application” exporter eclipse export menu." but couldn't find option. here's link any appreciated. thanks! never mind found it. it's in file-> export , under android folder, there's new "export crashlytics-enabled android application" option. had habit of exporting other way never looked here before.

java - How to get a session Object in the ContainerRequest to can use the annotation @RolesAllowed(Role_user)? -

i building application using app engine jersey. use annotation @rolesallowed(role_user) permit create filter in request. the problem need configure class securitycontextfilter . my objective id of user stored in session check role directly in function : public containerrequest filter(containerrequest request) of class securitycontextfilter . i need inject httprequest session, when inject exception java.lang.null . i want session object in class containerrequest . how can this? edit: i have find solution issue don't know if clean: can inject httprequest directly in function : isuserinrole(_role) use , userid session role user , check if match _role , return true or false. i'm pretty not sure whether can inject httpservletrequest on top of containerrequestfilter in jersey still can programmatically instead of using annotations: @override public containerrequest filter(containerrequest request) { if(request.isuserinrole("some_role")

unit testing - Is There Documentation for xUnit++ -

xunit++ isn't same thing xunit, , google doesn't point me documentation. xunit++ site has wiki, 5 pages of general stuff, no real specifics , no tutorials. does know of relatively complete, or detailed, documentation of xunit++. also, if know of tutorials, great! thanks! at moment, there isn't. opened issue on author's homepage on month ago. link here. https://bitbucket.org/moswald/xunit/issue/13/tutorial-and-quick-start it can assumed he's busy because programmers swamped. i suggest making bitbucket account comment on issue, or asking author move repository github, community take care of rest of work him. it might little bit difficult because using mecurial version control. not of answer, there other people looking same information you. [change 2016-05-10] started using catch framework doing unit test in c , c++ approximately 2 months after answering question. documented , in active development on github. might worth try.

c# - UI automation and menu item -

i trying use .net ui automation. have third party application know written in .net, have no source code for. starting application, process.start("exe path"); , getting processid , search main application window this.mainwindow = automationelement.rootelement.findfirst (treescope.children, new andcondition( new propertycondition(automationelement.processidproperty, this.processid), new propertycondition(automationelement.nameproperty, initialwindowname) )); this working find in main window, there menu bar has common "file, edit, ..." so, next step select menu bar , expand file menu with var menubar = this.mainwindow.findfirst(treescope.children, new propertycondition(automationelement.localizedcontroltypeproperty, "menu bar")); var filemenu = menubar.findall(treescope.children

sql - Validate password in stored procedure -

i'm having trouble validating account in sql server stored procedure. hashbyte password of user. when wants log in account again hashbyte parameter( @fpassword ) , compare hashbyte password in database. problem keep getting different value. for example: declare @fpassword nvarchar(4000) set @fpassword = 'sharingan1' if (convert(nvarchar(4000), hashbytes('sha1', @fpassword), 1)) <> (select fpassword customertable fusername = 'cesark14') begin print 'b' end else print 'c' i keep getting 'b' . when replace @fpassword 'sharingan1' , 'c' (which want). does know why (convert(nvarchar(4000), hashbytes('sha1', @fpassword), 1)) where set @fpassword = 'sharingan1' different (convert(nvarchar(4000), hashbytes('sha1', 'sharingan1'), 1)) your variable @fpassword nvarchar. when hardcode string, of type varchar. if put 'n' before string, in "n&#

excel vba - Trying to get vba to "loop until" with a count -

Image
i'm trying code read value input box desired investment amount ie. 3000. read down list (40 rows long) of amount of btc available @ particular price, , consecutively sum these total dollar amounts (quantity*price) going down list until point adding next line greater desired investment amount (ie. i'm trying see cheapest way acquire bunch of btc). i'll write bit make make rest of value next line won't reached can't seem bit work. when execute code i'm getting weird results don't make sense. i've put example of table in can see i'm working (the first price 94.25 b3/activecell) extremely trivial i've never done of stuff before. time , hope i've outlined enough. sub projected() dim investvalue single dim sumbtce single dim sumup single dim numbtc single dim count integer investvalue = inputbox("input investment amount:") numbtc = 0 sumup = 0 activeworkbook.sheets("btc-e data").cells(3, 2).select until (sumup + (acti

regex - Python3: File Globbing by Whole Strings -

i understand file globbing in python3 well. however, official python3 documentation did not have on want ask. have folder many xaiml files (xml databases betabots). grouping files together. instance, used glob.glob('./temp/xaiml2/[iijjkkllppqqrr]*.[xx][aa][ii][mm][ll]') so later put these files 1 file. here challenge, want group files start s, s, t, t, u, u, v, v, , dict8. yes, files starting full string may have other characters after it. have tried doing code [ssttuuvv'dict8'], glob command not ('syntaxerror: invalid syntax'). possible, , if so, how? glob.glob right command use? you need use os.listdir() directory contents, , re.match() match filename contents. [f f in os.listdir(somedir) if re.match(r'([s-v]|dict8).*\.xaiml', f, re.i)]

linux: which is the right way to copy folder? -

i want copy folder ajax_search , path: /home/thejobco/public_html/jccore/ajax_search/ inside foler: /home/thejobco/public_html/demo/typo3conf/ext/ , should run command way: cp -r /home/thejobco/public_html/jccore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext/ or cp -r /home/thejobco/public_html/jccore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext i familiar window, not unix/linux, put / after ajax_search , know way ajax_search/ , shows ajax_search folder, not know should put / after ext or not? can explain me right way copy folder? thanks with cp , if destination directory exists , not use trailing slash on source-dir , then putting copy of source-dir inside dest-dir ; can problem when forgot destination directory exists. you should include trailing slash , make obvious cp trying copy directory name new directory name, , not copy directory into existing one, if exists.

xml parsing - Bash: grep pattern to parse command output -

Image
i'm trying parse output of command line tool. outputs xml directly stdou , want parse it. the tool outputs full xml document following: my goal parse output , the string between <date> tag, since document might contain <date> tags, must check the <date> follows <key>sulastchecktime</key> . (and messy situation new line/spaces there). currently i'm solving situation following command: tool... | grep -a1 '<key>sulastchecktime</key>' | grep 'string.$' | sed -e 's,.*<date>\([^<]*\)</date>.*,\1,g' it works fine it's messy can see , can't write better? can me making better? thank you! ps: since i'm doing in osx, don't have new gnu grep options. btw, bash version 3.2.48(1). and... can't afford install other tools parse xml in better way. maybe this? $ cat foo.input foo foo <key>some key</key> <date>some date</date>

ruby on rails - Unicorn Memory Usage filling up almost all the RAM -

Image
there 3 problems here: 1) unicorn seems steadily filling ram, causing me remove workers manually. 2) unicorn seems spawning additional workers reason, although have specified fixed number of workers (7 of them). partly causing ram buildup, causing me remove workers manually. 3) 0 downtime deployment unreliable in case. picks changes, gateway timeouts. each deploy becomes stressful situation. i don't using monit, because kills workers without waiting workers finish serving requests. so, normal? other people deploy using unicorn have same problem ram grows uncontrollably? and workers number of workers spawned not match number of workers defined? the other alternative unicorn worker killer, trying out after reading unicorn eating memory . tiny update: so came point new relic telling me memory 95%. had kill worker. interestingly, killing worker brought memory down quite lot, seen graph below. what's that? for reference, here's unicorn.rb , unicorn

sql - Why this CTE expression hangs while temp table runs fine -

i have below sql cte statement found bottleneck performance. while debugging, hangs there (i think table scan) replaced temp table , query runs fine. wanted know if there difference in way cte expression written making statement hang. know ctes have performance hit attached don't think doing special in below query make cte give me such bad performance. ;with contlist (contkey, ckey, createddate, deleteddate, sourceid) ( select contkey, ckey, createddate, deleteddate, sourceid #sometemptable union select list.contkey contkey, fact.ckey ckey, case when fact.createddate > list.createddate fact.createddate else list.createddate end createddate, case when isnull(fact.deleteddate, '9999/01/01') < isnull(list.deleteddate, '9999/01/01') fact.deleteddate else list.deleteddate end deleteddate, fact.datasourcedimkey sourceid contlist list inner join somefact

jquery - How do i make the green box only slide 90% -

i green box ( #box3 ) go 90% right. box directly inside body element. <div id='box1'> <div id='box2'> </div> <div id='box3'> </div> </div> $( "#box1" ).click(function() { $( "#box3" ).toggle("slide", #box1 { background-color: white; height: 600px; width: 600px; margin: auto; } #box2 { background-color: red; height: 600px; width: 300px; float: left; } #box3 { background-color: green; height: 600px; width: 300px; float: left; } you can use jquery animation instead: // define left position, used defined 80% <div id='box3' style="left:80%"> <script> $( "#box1" ).click(function() { $('#box3').animate({left:'90%'},"fast","swing"); } ); </script> // box 3 #box3 { position:relative; background-colo

ruby on rails - How can I write a down or reversible function in this migration? -

so, in-case migration causes errors i'd able revert back/rake db:rollback. the code: class changeuidtoprimarykey < activerecord::migration def change execute alter table "users" drop constraint "users_pkey". execute alter table "users" add primary key "uid" end end what down/reversible code can add make rake db:rollback work in case? you following i.e. keeping unique index on email if need revert back. class changeuidtoprimarykey < activerecord::migration def self.up execute "alter table users add constraint unique_users_email unique(email)" execute "alter table users drop constraint users_pkey" execute "alter table users add primary key (uid)" end def self.down execute "alter table users drop constraint users_pkey" execute "alter table users drop constraint unique_users_email" execute "alter table users add primary key (email)&q

javascript - JQuery Script looping error -

<html> <head> <script src="jquery.js"></script> <script> $(document).ready(function(){ setinterval(function(){ var = 1; while(i<3){ var left = $("#"+i).offset().left; $("#"+i).css({'left':left}).animate({'left':'-10000px'},8000); if(i == 1){ i++; } if(i == 2){ i--; } } },2500); }); </script> </head> <body> <div id=mydivwrapper style="overflow:hidden"> <div id=1 style="right:0;width:100%;height:100%;background:url('1.jpg');position:absolute;"></div> <div id=2 style="right:0;width:100%;height:100%;background:url('2.jpg');"> </div> <body> </html> i'm trying create jquery image slider using while loop. here integer i'm incrementing. don't want 3 l

unix - why vi can modify a file while this file is write locked? -

i compile file , run in 1 console. #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char *argv[]) { /* l_type l_whence l_start l_len l_pid */ struct flock fl = {f_wrlck, seek_set, 0, 0, 0 }; int fd; fl.l_pid = getpid(); if (argc > 1) fl.l_type = f_rdlck; if ((fd = open("lockdemo.c", o_rdwr)) == -1) { perror("open"); exit(1); } printf("press <return> try lock: "); getchar(); printf("trying lock..."); if (fcntl(fd, f_setlkw, &fl) == -1) { perror("fcntl"); exit(1); } printf("got lock\n"); printf("press <return> release lock: "); getchar(); fl.l_type = f_unlck; /* set unlock same region */ if (fcntl(fd, f_setlk, &fl) == -1) { perror("fcnt

Interaction between MQL5 (or C++) and C# via Named Pipes -

good day, i trying send data via named pipes. created named pipe server in c# , client in mql5 (it c++ wrapper). server works fine , can reached named pipe client written in c# communication c# <-> c# works fine . tried utility pipelist , shows pipe server visible , available. the problem client written in mql5 (c++) - not find path pipe server communication mql <-> c# failing . could suggest : what doing wrong? how check both c# , mql accessing same physical path , same location? server : namedpipeserverstream pipestream = new namedpipeserverstream("mql5", pipedirection.in, 1, pipetransmissionmode.byte) i tried full path \\\\.\\pipe\\mql5 no success client : cfilepipe ipipe; while(isstopped() == false) { print("this loop infinite because there no connection"); if (ipipe.open("\\\\.\\pipe\\mql5", file_read | file_write | file_bin) != invalid_handle) break; sleep(250); } thanks, art answer foun

java - Why does List interface extend Collection interface? -

the collection interface has multiple methods. list interface extends collection interface. declares same methods collection interface? why so? for example interface collection extends iterable { public abstract int size(); public abstract boolean isempty(); public abstract boolean contains(java.lang.object); public abstract java.util.iterator<e> iterator(); public abstract java.lang.object[] toarray(); public abstract <t extends java/lang/object> t[] toarray(t[]); public abstract boolean add(e); public abstract boolean remove(java.lang.object); public abstract boolean containsall(java.util.collection<?>); public abstract boolean addall(java.util.collection<? extends e>); public abstract boolean removeall(java.util.collection<?>); public abstract boolean retainall(java.util.collection<?>); public abstract void clear(); public abstract boolean equals(java.lang.object); public abstract int hashcode(); } and same methods pre

submit files failed when using perforce -

the story this: 1. submit group of files server p4 gui, , of files new (mark add), e.g: a.cpp 2. need out files down errors. out , submit. 3. check out files 3. now, a.cpp become a.cpp(0/2). when submit files, come out following errors: out of date .... 4. question , how can submit files again? thanks. or can force submit files no matter errors come? you give little information in question, guess: seems having trouble trying add a.cpp because has been submitted changelist. it looks other changelist has submitted a.cpp, , has in fact submitted second revision of it. so a.cpp(0/2) is trying tell you have a.cpp open add (you're @ revision 0), while repository records a.cpp @ revision 2. so need convert add request edit request, follows; make copy of a.cpp file somewhere safe revert a.cpp, no longer have open sync a.cpp, revision #2 in workspace open a.cpp edit, can change it copy saved copy of a.cpp step (1) workspace directory diff copy see changes are

emacs - How to call query-replace-regexp inside a function? -

i tend use query-replace-regexp on entire buffer rather @ current position regularly use sequence c-< (beginning-of-buffer), c-r (query-replace-repexp). i'd make function bound c-s-r (c-r) me. thought if wrapped such as: (defun query-replace-regexp-whole-buffer () "query-replace-regexp beginning of buffer." (interactive) (beginning-of-buffer) (query-replace-regexp)) that adequate, unfortunately though i'm getting errors. query-replace-regexp-whole-buffer: wrong number of arguments: #[(regexp to-string &optional delimited start end) "Å Æ Ç& " [regexp to-string delimited start end perform-replace t nil] 10 1940879 (let ((common (query-replace-read-args (concat "query replace" (if current-prefix-arg " word" "") " regexp" (if (and transient-mark-mode mark-active) " in region" "")) t))) (list (nth 0 common) (nth 1 common) (nth 2 common) (if (and transient-mark-mode mark-

Query that works in MYSQL but not SQLite ( Syntax difference? ) -

hi have query selects houses houses table grouped street address. counts how many on street counts how many on street referenced in canvass table. i have query working in mysql when try sqlite in ios app doesn't work. there syntax differences between 2 unaware of? select haddress hd, count( * ) , ( select count( * ) canvass, house canvass.hid = house.hid , house.haddress = hd ) house group haddress seems can't reference column aliases in inner queries on sqlite, you'll have change inner query use alias house can reference outer house.haddress . altered query should work on both sqlite , mysql; select haddress hd, count( * ), ( select count( * ) canvass, house house2 canvass.hid = house2.hid , house2.haddress = house.haddress ) house group haddress

java - List<MyStructure> error: App crashes, No idea why -

i've built class named "item", here it: (thats whole code) public class item { private int id; private string title; private string desc; private double lat; private double lon; private string pub; private int p; private int n; public item(int id, string title, string desc, double lat, double lon, string pub, int p, int n) { super(); this.id = id; this.title = title; this.desc = desc; this.lat = lat; this.lon = lon; this.pub = pub; this.p = p; this.n = n; } now have make list<item> , add() "item"s it, reason application crushes. thats activity: public class mainactivity extends activity { list<item> markers; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); item = new item(1, "lol", "sdfs", 32.45345, 34.54353, "nir", 0, 0); markers.add(a)

class - C++ Private structure and non static const variables initialization -

i totally disappointed. have class, there have private structure. , what's silly problem: can't preinitialize variables! mean: need: struct somestruct { somestruct *next = null; int number; }; i want create easy dynamic list, adding new elements heap. , should do? struct somestruct { somestruct *next; int number; }; put somestruct *newelement = new somestruct; newelement.next = null; every time? can forget this. please me. because it's not problem when need add 1 useless string. if have 50 default variables? you cannot initialize class members when declare them. instead, need constructor : struct somestruct { somestruct(): next(null), number(0) {} somestruct *next; int number; }; alternatively, pod (plain old data) , use original class no constructors , use somestruct *newelement = new somestruct(); create somestruct . initializes members zero. also, c++11 supports in-class membe

html - Select more than one Element jQuery -

i need select more 1 element in same page. for example, this: $("#administratorusername").mouseenter(function () { $("#administratorusername").focus(); }); $("#administratorpassword").mouseenter(function () { $("#administratorpassword").focus(); }); also need select label element apply same code. ex: $("#administratorusername, label") , $("#administratorusername - label") . i don't know how it, , precisely question. $('#administratorusername, #administratorpassword').mouseenter(function () { $(this).focus(); }); that should work. note comma in between. have switch using object selected. hence change $(this).focus() opposed selecting again.

iphone - How to add interstitial admob ads to my ios project -

i want add interstitial admob ads iphone , ipad project, there working sample or tutorial? edit: i've added project, if don't have internet connection app stuck in loading image, should do? please not provide android links... talking ios. thank you! if using google mobile ad sdk, google provides excellent guide here . if prefer example projects, google supplies 1 here (currently called interstitialexample_ios_2.6.zip) .

java - While loop executes only once -

i have hard time figuring out why while loop won't loop. runs through once , stops. import java.util.*; public class mileskm { public static void main(string[] args) { scanner inp = new scanner(system.in); boolean continue1 = true; while (continue1 == true) { system.out.println("would convert m-km or km-m(km m-km , m km-m)"); string convert = inp.nextline(); if (convert.equalsignorecase("km")) { system.out.println("enter mileage converted."); double num = inp.nextdouble(); double con = num * 1.60934; system.out.println(con); continue1 = true; } else if (convert.equalsignorecase("m")) { system.out.println("enter km converted."); double num = inp.nextdouble(); double con = num * 0.621371; system.out.println

Google apps script ui enable button only when all values in grid are int -

i have google apps script application written using ui service (not html service), , app embedded in google site. i have grid of 15 values (3x5). able use clienthandler validate the values in each textbox integers. i want ensure 15 of values correctly set before enabling submit button. what best way this? obviously, toggling the button .setenabled property onchange no good, if 1 widget disables button, next valid integer, re-enable button. i thought using serverhandler, figured slow , unreliable. i'd keep client side if can. feels should possible, can't work out. missing? all advice welcomed. thanks. this enable submit once fields integers, it'll need more added handle cases values changed non-integer after first passing validation. function doget() { var app = uiapp.createapplication(); var field1 = app.createtextbox(); var field2 = app.createtextbox(); var field3 = app.createtextbox(); var submit = app.createbutton('submit

wordpress - Scout error when using MAMP with WP-foundation theme -

this first question on so if not adhering guidelines correctly, please let me know. i trying work locally on wordpress theme wp-foundation zurb. have downloaded wp , installed in htdocs folder of mamp , downloaded wp-foundation theme , pasted themes folder. able set database , setup config file. of seems working fine. i want work in scss using scout app. set scout this: input folder: /applications/mamp/htdocs/testsite/wp-content/themes/wp-foundation/sass output folder: /applications/mamp/htdocs/testsite/wp-content/themes/wp-foundation/stylesheets when tell scout start looking changes following error message: loaderror on line 1038 of org/jruby/rubykernel.java: no such file load -- zurb-foundation /applications/scout.app/contents/resources/vendor/gems/gems/compass-0.12.2/lib/compass/configuration/data.rb:161:in `require' /applications/mamp/htdocs/testsite/wp-content/themes/wp-foundation/config.rb:20:in `parse_string' org/jruby/rubykernel.java:1088:in `eval' /

javascript - HTML terminal like text input -

i trying have form field (just normal html text input box) can typed in , have value changed renders text invisible. i need box visible visibility: hidden; or display: none; won't trick. i can't make text same color background because background not single color. need text invisible while rest of input remains visible. the effect trying achieve when type password in terminal , accepts input shows no feedback (this not password though). i can't make text same color background because background not single color. what transparent color? does help? input[type="text"] { color: transparent; } jsbin demo #1 update: i implemented @shomz idea, can keep cursor @ beginning or change characters * . i've used jquery bind event: jquery version: var holder = [], exceptions = [13]; var hidechar = function(elm) { elm.value = ''; // or // elm.value = elm.value.replace(/[^*]/, '*'); }; $('#console')

php - Types of testcases in PHPUnit -

i new phpunit, infact started today. and, far have been reading, came understand script does. class usertest extends phpunit_framework_testcase { protected $user; // test talk method protected function setup() { $this->user = new user(); $this->user->setname("tom"); } protected function teardown() { unset($this->user); } public function testtalk() { $expected = "hello world!"; $actual = $this->user->talk(); $this->assertequals($expected, $actual); } } for class: <?php class user { protected $name; public function getname() { return $this->name; } public function setname($name) { $this->name = $name; } public function talk() { return "hello world!"; } } ok, have established test returns ok/fail statement based on equality of test, what looking for more. need ways test more comple

git - Eclipse changes file mode from 644 to 755 on all files it touches -

i'm using eclipse under win7, editing files shared ubuntu virtualbox vm on vboxsf. files created file mode 644, eclipse changing files 755 (even ones i've not edited). how can prevent eclipse changing permissions of files in repository? making official answer (thanks john). linked worked me , many others: how make git ignore file mode (chmod) changes?

java - Scope and lifetime of List -

i have static list of products type.when populate list shopowner class, works fine, when compile customer.java , list returns blank set. why populated list not retaining ? class products { string name; int itemcode; products(){} static list <products> list = new arraylist<products>(); products(string name,int itemcode) { this.name=name; this.itemcode=itemcode; } public string tostring() {return (name+""+itemcode);} } class shopowner { public static void main (string ...at) { products o = new products("shamppo",12); products.list.add(o); products o1 = new products("choco",1112); products.list.add(o1); system.out.println(products.list); //prints fine } } class customer { public static void main (string args[]) { system.out.println(products.list); //prints []

php - jQuery .get() function returns an error -

i have jquery code: $("#delete_products").click(function() { $(":checkbox:checked").each(function() { var pid = $(this).val(); $.get('delete_product.php',{pid: pid}); }); location.reload(); }); for reason, $.get() function doesn't work. when run .fail() , tell me has failed. here delete_product.php page: if(isset($_get['pid']) && !empty($_get['pid']) && is_numeric($_get['pid'])){ $pid = $_get['pid']; $query = "delete `products` `id` = $pid limit 1"; $query_run = mysql_query($query) or die(mysql_error()); $query = "delete `products2categories` `product_id` = $pid"; $query_run = mysql_query($query) or die(mysql_error()); $pictodelete = ("../products_images/$pid.jpg"); if(file_exists($pictodelete)){ unlink($pictodelete); } header("location: index.php"); exit(); } any idea why happening?

android - To get data from another activity -

the question asking might have been asked have got stuck. want pass data edittext of 1 activity listview in activity how can that. have used intent putextra , not able implement function can tell me how implement function on listview . private static class listviewadapter extends baseadapter{ private layoutinflater linflate; private object convertview; public listviewadapter(context context) { linflate=layoutinflater.from(context); } @override public int getcount() { // todo auto-generated method stub return listviewcontent.size(); } @override public object getitem(int arg0) { // todo auto-generated method stub return null; } @override public long getitemid(int arg0) { // todo auto-generated method stub return 0; } @override public view getview(int position, view v, viewgroup arg2) { final listcontent holder; if (v== null) {

Weird issue with verifying variable in PHP -

i have code supposed check if page doesn't exist, or if contains shouldn't, , reason it's throwing error @ me, more 406, if go page other home page ($_get = ""). here's code , in advance :) $currentpage = $_get['a']; $pages[1] = ""; $pages[2] = "help"; $pages[3] = "work"; $pages[4] = "download"; $pages[5] = "process"; $pages[6] = "safariex"; $pages[7] = "services"; if(isset($_get) && !ctype_alpha($_get) && $_get['a'] != ""){ header("location: http://pattersoncode.ca/error.php?ec=406"); } if (!ctype_alpha($_get['a']) && $_get['a'] != "") { header("location: http://pattersoncode.ca/error.php?ec=406"); } if ( ! in_array( $currentpage, $pages ) ) { header("location: http://pattersoncode.ca/error.php?ec=404"); } i believe wrong: !ctype_alpha($_get) $_get array

c# - AutoMapper generic map method does not map enum values -

i have generic mapper function mapping between view models , domain models. reason, not map enum values. public tdomainmodel maptodomainmodel<tviewmodel, tdomainmodel>(tviewmodel viewmodel) { mapper.createmap<tviewmodel, tdomainmodel>(); tdomainmodel result = mapper.map<tviewmodel, tdomainmodel>(viewmodel); return result; } public tviewmodel maptoviewmodel<tdomainmodel, tviewmodel>(tdomainmodel domainmodel) { mapper.createmap<tdomainmodel, tviewmodel>(); tviewmodel result = mapper.map<tdomainmodel, tviewmodel>(domainmodel); return result; } i need map enum values integers when mapping view model domain model. , map integers enum values when mapping domain models view models. it great if solution flexible enough convert nullable enums more types (short, byte etc) , vice versa.

jquery - javascript validator not working, just returning it passed when it didn't -

here code, compared site has script working , can't seem spot difference why mine not working. missing simple. this site got script instructions little vague: http://rickharrison.github.io/validate.js/ this working example: http://www.boutiqueapartments.com/index.php/contact/test <!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" /> <!-- main style sheet--> <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css"/> <!-- validation script--> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript" src="../bugs/javascr

c# - Unable to get service reference when uploaded to main website server -

i new web services , own domain , server test web-apps live. tried create web-service normal addition operation. running fine on localhost published web-server, , accessed using "add service reference" in visual studio 2012 http://www.mydomain.com/requestserver/webservice.asmx gave me resource not found error the requestserver folder @ webserver contains web-service. want know that: what server settings should done access web-service? what correct way access web-service? please tell me missing important step? for wcf in 2010 , iis 7, you need set servicemetadata tag, located in following hierarchy of web.config: <system.servicemodel> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true"/> this enable meta data publishing, allows service reference feature work. i assume same in 2012 , whatever build of iis using.

plot - How to make a step-chart in Microsoft Access? -

Image
currently, have table dates of price changes in various goods. have form line chart like: instead, more accurate me have step-chart like: but can't find how change chart type step-chart in access 2007. ideas? one way "fake" such chart create query repeats previous price before next one. example, sample data date price ---------- ----- 2013-08-01 $6.00 2013-08-02 $5.00 2013-08-03 $5.00 2013-08-04 $6.00 2013-08-05 $8.00 2013-08-06 $9.00 2013-08-07 $7.00 2013-08-08 $6.00 2013-08-09 $7.00 you use query select [date], [price] prices union select dateadd("s",86399,[date]), [price] prices order 1; to produce data date price ------------------- ----- 2013-08-01 $6.00 2013-08-01 23:59:59 $6.00 2013-08-02 $5.00 2013-08-02 23:59:59 $5.00 2013-08-03 $5.00 2013-08-03 23:59:59 $5.00 2013-08-04 $6.00 2013-08-04 23:59:59 $6.00 2013-08-05 $8.00 2013-08-05 23:59:59 $8.00 20

actionscript 3 - Flash CS6 AS3: Click listener on overlapping movieclips only fires top movieclip -

i have several movieclips overlap 1 another, each 1 has different graphic of body part. user able click on body part , highlights. i've set event listeners detect click on movieclips , apply colortransform. problem top movieclip gets selected, , not one's below though movieclips have transparent bitmap (png) images in them. is there way can create hotspots support opaque pixels?

.net - Create an event for a DataGridViewButtonCell in VB.Net -

i have datagridviewbuttoncolumn, need respond when clicked can execute code. can help? if want use datagridviewcellcontentclick event. , execute logic if button cell clicked. following code snippet should give idea. private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { // find out column clicked if (datagridview1.columns[e.columnindex] == column1) { //get value want display string customer = (string) datagridview1.rows[e.rowindex].cells[2].value; // display on new form. form form2 = new form(); form2.text = customer; form2.showdialog(); } }

netmsmqbinding - Long running WCF MSMQ Processing -

i reading programming wcf services 3rd ed. juval lowy. in chapter "queued services" covers netmsmqbinding, on page 473, says "... should keep service's processing of queued call relatively short, or risk aborting playback transaction. important observation here is wrong equate queued calls lengthy asynchronous calls." 1) short call? 2) best practice long running operations; send send them off threadpool? this article ran same problem in practice: wcf & msmq & transactionscope long process i have looked , looked, , cannot find best practices regarding matter on internet. 3) rule apply if have no transaction? 1) default short process transaction takes less 10 minutes (default transaction timeout) 2) can be, if lose transactional behavior (if server goes down message lost) 3) yes. default transaction scope has default timeout abort transaction. the news can override timeout on machine.config file: http://blogs.inkeysolutions.com/2012/

chained proxy in delphi -

i read chaining proxies , wanted try in delphi, played around indy tidhttp component , couldnt figure out how it, need 2 tidhttp components? maybe 1 sends request another? http1.proxyparams.proxyport := port1; http1.proxyparams.proxyserver := server1; http2.proxyparams.proxyport := port2; http2.proxyparams.proxyserver := server2; i want send simple get/post chained proxies. is doable? or there other component me task? thank you. the tidhttp.proxyparams property not support chaining. to use chained proxies, need to: assign tidiohandlersocket -derived component tidhttp.iohandler property. either: a. tidiohandlerstack , indy's standard tcp/ip implementation. b. tidssliohandlersocketbase -derived component, such tidssliohandlersocketopenssl . must use if want work https urls. assign tidcustomtransparentproxy -derived component iohandler's transarentproxy property. indy provides 2 such components default: a. tidsocksinfo , implements

android - How to get HTML ImageGetter to work properly -

i have implemented imagegetter within html.fromhtml method reading following posts: html.fromhtml problem , , html.imagegetter . here code imagegetter: if (mitem != null) { ((textview) rootview.findviewbyid(r.id.exercise_detail)) .settext(html.fromhtml(mitem.description, new imagegetter(){ @override public drawable getdrawable(string source) { drawable drawfrompath; int path = exercisedetailfragment.this.getresources().getidentifier(source, "drawable", "com.package.chaitanyavarier.mytrainer2go"); drawfrompath = (drawable) exercisedetailfragment.this.getresources().getdrawable(path); drawfrompath.setbounds(0, 0, drawfrompath.getintrinsicwidth(), drawfrompath.getintrinsicheight()); return drawfrompath; }

c# - How to add an extra properties argument to a textbox? -

i have winforms textboxes . each textbox show setting values .ini file. of .ini file values encrypted , require values decrypted before placing value inside textbox . created function: storeinivaluetovar(string inisection, string inikey, bool? encrypt) is possible extend textbox properties custom argument such boolean? encrypt? thinking pass custom argument boolean? encrypt value storeinivaluetovar function. there's generic property called tag. can store kind of strings in it. disadvantage return type object, don't have derive ui control. example: private void ontextboxchanged(object sender, eventargs e) { var updatedtextbox = sender textbox; object tagobject = updatedtextbox.tag; // further converting of tag here... } set events of textboxes (here textchanged) 1 single eventhandler , can textbox instance , tag well.

activerecord - Rails 4: find all records -

now activerecord::relation#all deprecated in rails 4, how supposed iterate records? used like: foo.all.each |foo| # whatever end i can approximate so, feels dirty: foo.where(true).each |foo| # whatever end is there better way? according rails guide on active record query interface , correct way iterate through records using find_each . using foo.all.each load entire table memory, instantiating rows; iterate through instances. find_each in batches, more efficient in terms of memory usage. from guide: the find_each method retrieves batch of records , yields each record block individually model. in following example, find_each retrieve 1000 records (the current default both find_each , find_in_batches ) , yield each record individually block model. process repeated until of records have been processed: user.find_each |user| newsletter.weekly_deliver(user) end references: active record query interface activerecord::batches