Posts

Showing posts from August, 2011

javascript - How to append the url to anchor tag inside a div which i got as a json response? -

i made ajax api , json response $.ajax({ url: 'http://api.yipit.com/v1/deals/key=tmbyhkzfcntmb&limit=20&division=boston', datatype: 'jsonp', success: function (data) { console.log(data); var = data.response.deals[0].business.url; // below url of page .htm extension console.log("link "+a); var mydiv = document.getelementbyid("empid"); var atag = document.createelement('a'); atag.setattribute('href', "what i'm supposed put here "); atag.innerhtml = "link text"; empid.appendchild(atag); } }); i have got value in a variable link , want use url in anchor tag. use atag.setattribute('href', a); a more appropriate way be $.ajax({ url: 'http://api.yipit.com/v1/deals/key=tmbyh...

rest - Restful way to validate a resource -

imagine have resource of special case of e-commerce application /cart in api supports crud operations: get, post i want have service validates if cart correct (stock availability, etc...) need cart information, don't want store partial states of cart, that's why put not supported resource. the question method , path correct kind of service in restful way? i think if want build restful web service, should not bind business logic in it. restful service should think infrastructure of system. provides consistent api allow others access resource. you build bussiness layer upon restful resources, in layer can complex business logic, example, checking stock availability(maybe underlying accessing stock resource), or making payment(maybe underlying accessing payment resources , product resources)

linux - How redirect time gcc output to a file? -

i using command : time gcc -lm test.c > time.txt to determine compilation time etc. , write them file.but when use above command nothing gets printed file? where going wrong? it depends on shell use. in bash, time builtin , cannot redirected. have use subshell redirect standard error: (time gcc -lm test.c ) 2> time.txt

web applications - Does Google spider read robots.txt before accessing a resource? -

i have been wondering while. know if, instance, link here site example.com , domain hosts robots.txt file disallow everything, google won't index it. however, happens if i, instance, insert here in stackoverflow js (script src ...) loads resource example.com? google read robots.txt first , decide load resource, or going load anyway, not index it? (this question) basically worries me since have tracker , not spiders increase number of visits. of course there possibility of blocking several spiders in code putting user-agent, not 100% valid measure since many other spiders (not google, or not search spiders) count. in theory, google says not read resources excluded robots.txt. in practice, google has not been consistent on this. several months year (and 2012), google not obeying robots.txt sure received complaints - provided mine! however, of mid-may 2013, googlebot seems reading , respecting robots.txt. means reads robots.txt, , reads resources not excluded. why ...

php - Symfony 2.2 - no request scope in Voter -

i'm trying migrate symfony 2.1 version 2.2.1. use own voter deciding if user granted access given route. voter simple , worked before update. problem voter needs request service parameters required check if user can access site (it id given in route, e.g. /profile/show/{userid}). check if request scope active prevent error when using cli or phpunit: $this->request = null; if ($container->isscopeactive('request')) { $this->request = $container->get('request'); } and later throw exception if there no request in vote method: if ($this->request === null) { throw new \runtimeexception("there's no request in profilevoter"); } i got exception after every vote calling (= on every page of app). edit: happens in dev environment. according symfony2.2 documentation: "take care not store request in property of object future call of service cause same issue described in first section (except symfony cannot detect wron...

how to change the values in a combobox dynamically in Ruby Tk -

the idea quite simple: have 2 comboboxes. second 1 should refreseh values depending on chose first one. # combobox 1: $shape = tkvariable.new $combobox_1 = tk::tile::combobox.new(parent) { textvariable $shape; values ['ipe', 'hea']} # combobox 2: $size = tkvariable.new $combobox_2 = tk::tile::combobox.new(parent) { textvariable $size; values $size_list} # action $combobox_1.bind("<comboboxselected>") { case $shape when 'ipe' $size_list = [80, 100, ...] when 'hea' $size_list = [90, 130, ...] end } but nothing happens. combobox 2 doesn't seem realize values have been changed. how can solve problem? this not work, used variable create combo box, changing not change combobox. i suppose looking set when 'ipe' $combobox_2.values([80, 100, ...])

Not able to parse a string that contains utf8 0xc2 0x85 characters using jdom parser -

i have utf-8 string contains 0xc2 0x85 characters. eclipse treats whitespace. application treats '...'. since, string xml, i'm using jdom parser , jdom parser fails , gives following exception. org.jdom.input.jdomparseexception: error on line 1: content not allowed in prolog. @ org.jdom.input.saxbuilder.build(saxbuilder.java:381) @ org.jdom.input.saxbuilder.build(saxbuilder.java:764) any idea on why jdom parser doesn't treat whitespace? else can have parser validate xml successfully? other elements in xml string seems fine. whitespace has specific meaning in xml. outside root element in xml characters allowed (#x20 | #x9 | #xd | #xa)+ (space, carriage return, newline, , tab). the prolog area in xml allowed contain limited structures , , space. the characters have shown not allowed in valid xml outside root element. sorry.

performance - how can i see which optimizations Java makes -

i have following code public boolean matches(string word) { pattern p = pattern.compile("\\w$"); matcher m = p.matcher(word); return m.find(); } i want know if java compiler substitutes pattern.compile("\w$") phrase object, or creates object every time function called. how can find out java makes code? there eclipse plugin shows this? according source code, creates object every time function called. public static pattern compile(string regex) { return new pattern(regex, 0); }

iphone - SugarSync Integration in ios -

i trying implement sugarsync in application using sugarsync sdk project, shows target specifies product type 'com.apple.product-type.framework.static', there's no such product type 'iphonesimulator' platform error whenever going run application. a quick google search brings lot of results that.

java - Why does a Derby database take up so much space? -

i new databases , love how easy data relational database (such derby database). don't how data 1 takes up; have made database 2 tables, written total of 130 records these tables (each table has 6 columns), , whole relational database gets saved in system directory folder houses total of approximately 1914014 bytes! (assuming did arithmetic right....) heck going on cause such huge request of memory?! //i notice there log1.dat file in log folder takes 1mb of data. looked file via notepad++, , saw null characters. about? when last checked in 2011, empty derby database takes 770 k of disk space: http://apache-database.10148.n7.nabble.com/database-size-larger-than-expected-td104630.html the log1.dat file transaction log, , records database changes database can recovered if there crash (or if program calls rollback). note log1.dat disk space , not memory . if you'd learn basics of derby's transaction log, start here: http://db.apache.org/derby/papers/recover...

how to send a check box value as a php parameter on a button click -

hi have check box , button opens popup window on button click sending parameter works fine have added check box , want send value parameter , stuck here n have no idea of has done here script <?php if($addflag == 0){ echo "<td>"; echo '<font color="red"><strong>print on letter head</strong></font><input type="checkbox" id="dtype" name="dtype" value="1" checked></input>'; echo '<input class="cmdprint" type="button" id="submit" name="print" value="print" onclick="window.open(\'quotprin.php?vouchno='.$getvouch.'&dtype=\'document.getelementbyid(\'status1\').value;\'\',\'popupwindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\...

android - AndEngine GLES 2.0 - Power button issue - App Crashes onResume() -

app crashes when press power button lock screen , press again unlock screen. app crashes after scren gets unlocked. this stacktress got in logcat: 05-09 18:46:57.254: e/androidruntime(25354): fatal exception: main 05-09 18:46:57.254: e/androidruntime(25354): java.lang.nullpointerexception 05-09 18:46:57.254: e/androidruntime(25354): @ org.andengine.ui.activity.basegameactivity.onresumegame(basegameactivity.java:222) 05-09 18:46:57.254: e/androidruntime(25354): @ org.andengine.ui.activity.basegameactivity$4.run(basegameactivity.java:373) 05-09 18:46:57.254: e/androidruntime(25354): @ android.os.handler.handlecallback(handler.java:615) 05-09 18:46:57.254: e/androidruntime(25354): @ android.os.handler.dispatchmessage(handler.java:92) 05-09 18:46:57.254: e/androidruntime(25354): @ android.os.looper.loop(looper.java:137) 05-09 18:46:57.254: e/androidruntime(25354): @ android.app.activitythread.main(activitythread.java:4744) 05-09 18:46:57.254: e/androidruntim...

polling - Configure Jenkins to Poll less then a every minute -

configuring jenkins polling interval to: * * * * * poll scm every minute. there way configure poll less minute? example every 30 seconds? get scm trigger build instead of polling it. what scm using? edit: you can tell jenkins wait 'x' seconds after check in change before starting build. have same issue, dev's doing multiple check ins. there 2 options configure this, system wide option or per-job option. the system wide option under manage -> configure system -> quiet period. in seconds. the per job option under advanced project options, , called quiet period. if set quiet period 90, jenkins wait until 90 seconds after last detected check in before starting build.

iphone - Retrieve core-data model version from appDelegate -

anybody knows how core-data model version when app starts? i've implemented lightweight migration , works fine need check if sqlite db based old model version before migration process starts. in new model added new entity need populate value of entity of old model. want 1 time. is there way in appdelegate? thanks, max i solved setting db-version in preferences (.plist). if change db, set new db-version in there , store version last start in nsuserdefaults . nsnumber *newdbversion = [[[nsbundle mainbundle] infodictionary] objectforkey:@"dbversion"]; nsnumber *olddbversion = [[nsuserdefaults standarduserdefaults] objectforkey:@"dbversion"]; if (olddbversion == nil) { // part without handling, know max db version. }else { if([olddbversion intvalue] < [newdbversion intvalue]) { // try liteweight migration , if failed, migrate hand } }

jquery - dialog("close") doesn't work inside ajax:success event handler -

i trying using jquery dialog make user sign in. using ajax , devise. after users sign in, dialog windows should close. put dialog("close") inside bind("ajax:success"), doesn't work , error: "cannot call methods on dialog prior initialization; attempt call method 'close'" code: $(function(){ $(" #sign_in").click(function(){ $('<div id="box" >').dialog({ open: function(){ var that=this; $(this).load("/users/sign_in",function(){ $("#new_user").bind("ajax:success",function(evt,data,status,xhr){ $("div#utility").html('welcome'+data.user+' |<a href="/users/sign_out" data-method="delete" rel="nofollow">sign out</a> ') ; $(that).dialog('close'); }) }) ...

java - Application not running, android (eclipse) -

i wanted run applications directly through device. did necessary configurations , when run application eclipse lists devices choose from. device there , has serial number of 'samsung-gt_s5570..' target of 2.3.4. when click ok says installed , done, how come application doesn't start on phone ? there step run application or start ? out of curiosity mounting usb having not starting ? update manifest file <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapp" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > </application> </manifest> you need hav...

shell - Call vbp inside vb6 IDE -

i have debug group of vb6 projects. there root project (say toolbar.exe). program toolbar call .exe ex:call shell(app.path & "\modmag2008.exe ", argument ...... i have modmag2008.vbp , call debug (it in same project group toolbar.vbp) so start debugging toolbar.vbp , go on debugging modmag2008.vbp is possible? note: cannot change architecture. to debug vb6 application, called .exe other application see 2 possibilities: 1/change callig code call application thorough visulal studio 6 call shell(app.path & "\modmag2008.exe ", argument ...... is replaced call shell("c:\program files (x86)\microsoft visual studio\vb98\vb6.exe /r " & app.path & "\modmag2008.exe /cmd ", argument ...... see: working command line switches 2/ use visual studio.net debug vb6 binaries - debuging not convenient - not necessary modify original application: debugging vb6 binaries in visual studio .net

64bit - vb.net 32 bit vs 64 bit controls become disabled -

i working on vb.net winforms application compiles against 2.0 framework. issue running windows 7 32 bit machine , app works fine when code copied on windows 7 64 bit machine of controls on form strangely disabled. in project properties set compile x86 target. has experienced similar problem , have answer why having problems on 64 bit machine? set compile any cpu instead of x86 . framework deal rest you, should target platform if have references/controls require or if you're playing around application performance.

ember.js - How to use multiple models with a single route in EmberJS / Ember Data? -

Image
from reading docs, looks have (or should) assign model route so: app.postroute = ember.route.extend({ model: function() { return app.post.find(); } }); what if need use several objects in route? i.e. posts, comments , users? how tell route load those? last update forever : can't keep updating this. deprecated , way. here's better, , more up-to-date thread emberjs: how load multiple models on same route? update: in original answer said use embedded: true in model definition. that's incorrect. in revision 12, ember-data expects foreign keys defined suffix ( link ) _id single record or _ids collection. similar following: { id: 1, title: 'string', body: 'string string string string...', author_id: 1, comment_ids: [1, 2, 3, 6], tag_ids: [3,4] } i have updated fiddle , again if changes or if find more issues code provided in answer. answer related models: for scenario describing, rely on asso...

vb.net - ASP.NET: Div event click fail -

i'm trying call vb method clicking on div method not defined. my code: <div id="div1" class="btn btn-primary pull-right" runat="server" onclick="prueba2()" > </div> <script type="text/vb" runat="server"> sub prueba2() msgbox("seee") end sub </script> debug: uncaught referenceerror: prueba2 not defined thanks in advance! in case, onclick javascript: <div id="div1" class="btn btn-primary pull-right" runat="server" onclick="prueba2()" ></div> <script type="text/javascript"> function prueba2() { //do } </script> note, asp.net controls, not same. have onclick code behind function , onclientclick client-side javascript function: <asp:button id="_somebutton" onclick="vbfunction" text="some text" onclientclick="prueba2()...

php - How can I select the lowest number from multiple tables in MySQL? -

lets have 3 tables: table1 id score 1 2 2 5 3 5 table2 id score 1 1 2 2 3 3 table3 id score 1 4 2 4 3 2 how can lowest value each id 3 tables? when execute query post this: id lowestscore 1 1 2 2 3 2 thanks!! you can use union combine records 3 tables , wrap on subquery use min() lowest score each id . select id, min(score) score ( select id, score table1 union select id, score table2 union select id, score table3 ) sub group id sqlfiddle demo output ╔════╦═══════╗ ║ id ║ score ║ ╠════╬═══════╣ ║ 1 ║ 1 ║ ║ 2 ║ 2 ║ ║ 3 ║ 2 ║ ╚════╩═══════╝

java - resource not found when populating list in android -

i trying simple list in android application , fill strings. have implemented following main activity: public class mainmenuactivity extends baseactivity{ private arraylist<string> teamlist = new arraylist<string>(); private arrayadapter<string> teamlistadapter; private listview teamlistview; protected void loadgui() { setcontentview(r.layout.main_login); teamlistview = (listview) findviewbyid(r.id.teamlist); teamlistadapter = new arrayadapter<string>(mcontext, r.id.teamlist, teamlist); teamlistview.setadapter(teamlistadapter); additem("test"); } public void additem(string item) { teamlist.add(item); teamlistadapter.notifydatasetchanged(); } } with baseactivity class implementing oncreate methods etc: public abstract class baseactivity extends activity { protected activity mactivity; protected context mcontext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestat...

sql - Create a computed column based on another column in MySQL -

i have 2 columns in table: varchar(8) , int . i want auto-increment int column , when do, want copy value varchar(8) column , pad 0's until 8 characters long, example, if int column incremented 3 , varchar(8) column contain '00000003' . my 2 questions are, happens when varchar(8) column gets '99999999' because don't want have duplicates? how in mysql? if values can between 00000000 99999999 , how many values can have before run out? this alternative approach creating random 8 character string , checking mysql duplicates. thought better approach , allow greater number of values. because formatted column depends upon, , derivable from, id column, table design violates 3nf . either create view has derived column in (see in sqlfiddle ): create view myview select *, substring(cast(100000000 + id char(9)), 2) formatted_id mytable or start auto-increment @ 10000000 , 8 digits long: alter table mytable auto_increment = 10000000; ...

javascript - trigger.io - hide a html element on touch/tap event -

the problem seems simple enough yet not working. what want div hide on tap. using jquery if know have in more native manner id love that! i have tried using did not work $(".event_image").on('tap', function(e) { $(this).hide() }); anyone got ideas? jquery doesn't have touch/tap events, can build own using these: touchstart touchmove touchend touchcancel more information available here . or can use plugin such hammer.js supports touch events & more!

xaml - WPF MVVM - Activate ViewModel-command by use of hot keys from MainWindow -

i have mvvm application in mainwindow contains grid several views. in 1 of viewmodels there command can activate using hot keys in corresponding view. can activate command when placed in part of mainwindow contains specific view. the following code works fine, if want able activate command in specific view: componentview.xaml: ... <usercontrol.inputbindings> <keybinding gesture="ctrl+u" command="{binding path=uploadcmd}"/> </usercontrol.inputbindings> </usercontrol> able activate command using hot keys part of mainwindow. this failed attempt keybinding in mainwindow, command can activated anywhere: mainwindow.xaml: <window x:class="myprogram.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:view="clr-namespace:myprogram.view" xmlns:vm="...

How to line up inner charta and outer chart in a Donut chart Highcharts -

how can line inner charta , outer chart in donut chart highcharts. should donut chart have outer data line inner chart? yes , should line . because if both inner , outer values match , do-nut chart pleasant (i.e) color , chart split synchronize

ios - Keep a static graphic always fixed on screen while changing uiviews in xcode -

is there way have static graphic on screen doesn't move when pushing / popping view controllers? the best way can think describe tab bar. if have tab on tab bar has multiple pages swipe left/right, can view these different pages, , main content area moves, while tab bar stays fixed , doesn't swipe in/out along content. i want similar custom toolbar have created , added view, slides out previous viewcontroller , slides in new view controller. is there way keep fixed on screen doesn't move. hope makes sense! yes, can using container view. it new xcode, doesn't have widespread use navigation controllers , tab bars do, works similarly. basically, create new uiviewcontroller instance in storyboard, , put container view inside view controller, filling entire view controller. there, right click on view controller flow starts (probably either tab bar controller or navigation controller) select embed, , target container view in new view controller. f...

c# - What are the practical usage of Cloning -

can give me practical usage clone used, understand how done , types in it, dont see practical usage. read somewhere used save state of object, still think entire state of object important. if have object y encapsulated (for instance private) within object x, provide accessor method (such gety()) risk returning reference private object , that's not good. don't want client code able reference it. instead might copy or clone object within gety(). mentioned though copying preferred vs. clone -- see effective java item 11. here example code: public class x { private date y = new date(); // other code here public date gety() { //this bad: //return y; //this good: return new date(y); }

JavaScript - Object failing -

this main problem: var obj = { "22": false, "32": true, } console.log(obj.32) //<---- not working??!?!?! why can't reach part of object?? i know can't begin variables numbers can object parts, how can read this? just use: console.log(obj["32"]); demo: http://jsfiddle.net/wrzbv/1/ or obj[32] - 32 converted string , found same using "32" . there 2 ways access object property name - bracket notation (what suggested) , dot notation (what you're using). dot notation, must use valid identifier, 32 not...just can't var 32 = "whatever"; reference: javascript property access: dot notation vs. brackets?

c# - How do I format decimal as Percentage in EF Code First rendered in Razor TextBoxFor? -

i have property: public decimal myproperty { get; set; } and here render: @html.textboxfor(m => m.myproperty , new { @class = "percentage" }) how do percentage? you decorate view model property [displayformat] attribute allowing specify format: [displayformat(applyformatineditmode = true, dataformatstring = "{0:p2}")] public decimal myproperty { get; set; } and in view: @html.editorfor(x => x.myproperty) but careful because displayformat attribute (as name suggests) used displaying purposes. not used default model binder. when user submits value posting form chances validation error because example 0.45% not valid decimal value. have illustrated in this post how custom model binder defined use format defined displayformat attribute when binding value.

java - Get resource from WebView that has already been downloaded -

i have webview loads external web page. want implement custom caching mechanism there no need download resources css, js , images again. have tried 2 methods: override shouldinterceptrequest method of webviewclient this way able provide local resource webview. there no way resource webview downloads. real downloading happens after method has ended. according documentation resource downloaded if method returns null . override onloadresource method of webviewclient this way can url of loaded resource , nothing more... thanks help!

sendmail - CGI Script Send Mail error -

hopefully can user has 0 experience cgi coding. prior yesterday, following code working fine when our clients submit orders. yesterday internal server error message appear in browser. when our hosting company did trouble shooting error log saying: 20130508t200031: www.4printer.com/cgi-bin/mailit.cgi open |/usr/lib/sendmail -t -oi -oem: permission denied @ /home/users/web/b643/ipw.i4printe/public_html/cgi-bin/mailit.cgi line 110 unfortunately not support coding issues. line 110 of code says this: $msg->send(); this entire cgi code: #!/usr/bin/perl # webmaster@qnis.net $date = `/bin/date`; chop($date); # read input read(stdin, $buffer, $env{'content_length'}); # split name-value pairs @pairs = split(/&/, $buffer); if(!($buffer =~ /customer/)){ print <<"(error_msg)"; content-type:text/html <center><font size='4'><b>no data recorded. please use browsers button , try again. (error_msg) exit; } $mail...

sql - How to avoid duplicates in creating view with Left Join if a joining column in one table can have duplicates? -

i need create view 2 tables. linked 1 column, in 1 table column primary key, in table column can have duplicates. resulting view should not have duplicates column. if row in 2nd table meets case condition result in view should 'y' regardless on other rows same key. please, see scrip , join results. the 1st row in results incorrect, should eliminated create table a1table( integer not null ); create table a2table( integer, b integer ); insert a1table values (1); insert a1table values (2); insert a1table values (3); insert a2table values (1, 1); insert a2table values (1, 100); create view a12 select a1.a, case when a2.b=100 , a2.b not null 'y' else 'n' end report a1table a1 left join a2table a2 on a2.a = a1.a; --> | report ---+-------- **1 | n** -> *should eliminated* 1 | y 2 | n 3 | n put condition on a2.b in join condition. select a1.a, if(a2.b not null, "y", "n") ...

Configuring PayPal Auto-Return (Redirect) After Payment -

i not know happened before, redirect after payment going well, not working anymore. i have this: <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="mail@name.com"> <input type="hidden" name="item_name" value="<? echo $site->site_brand;?> <? echo $pack->name;?>"> <input type="hidden" name="item_number" value="<? echo $pack->days;?> days"> <input type="hidden" name="custom" value="<? echo $data->id; ?>"> <input type="hidden" name="amount" value="<? echo $pack->price;?>"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden...

Module Alias Namespace In Alloy 4 -

lets following: open util/ordering[a] open util/ordering[b] what value ordering/first have? undefined? need use module aliases disambiguate? yes, should use aliases, e.g., did below open util/ordering[a] orda open util/ordering[b] ordb sig a{} sig b{} sig c { firsta: a, firstb: b } { firsta = orda/first firstb = ordb/first } run {one c}

vba - Need SQL to update table with data from another table IF numbers match -

i have function below letting user choose excel file , imports data table(mytable). single column excel file. table imports contains 2 columns(f1,f2). i need docmd.runsql command following info 2nd column. mytable.f1 oem part number need take number , compare 2 columns (oempartnumer, oemsub) in (jdsubs) table have setup if finds match need compare 2 matches (jdsubs) table , try find in (ami) table in column (oemitem) if finds match need return value column (item) table (ami) , insert (mytable) column (f2) table contents example mytable ---------------- f1 | f2 ar77530 | ar12345 | jdsubs --------------------------- oempartnumer | oemsub ar65123 | ar77530 ar12345 | ar56242 ami --------------------------- item | oemitem amar77530 | ar77530 amar56242 | ar12345 so number being imported excel file 1 of 2 numbers(sometimes there no sub number) i need match companies part number (ami) oem number here function importing work...

c++ - Unable to instantiate templated class inside another class -

i have 2 classes: 1 templated, 1 not. trying create instance of templated class inside non-templated class , program won't compile. i'm using visual studio 2012 , error 'intellisense: expected type specifier' on line in bar.h: foo<int> foo_complex(99); i can use syntax outside class (see console.cpp below). can use empty constructor inside class. gives? how correctly use non-empty constructor foo inside bar? thanks in advance help. i've looked everywhere solution , come empty. example code below. class implementation inline clarity. foo.h #pragma once template<typename t> class foo { public: foo(); foo(int i); }; template<typename t> foo<t>::foo() { std::cout << "you created instance of foo without value." << std::endl; } template<typename t> foo<t>::foo(int i) { std::cout << "you created instance of foo int " << << std::endl; } bar.h #pragm...

actionscript 3 - Adding the same movieclip multiple times to the stage -

iam trying to learn action script 3 flash cs6 creating game, want place random cards on stage multiple times user adds them , disappear, ive got cards appearing on stage getting multiple versions appear stopped, can them appear once, have idea how ? thank much stop(); var pressed_1:int =0; var pressed_2:int =0; function checktol (pressed_1,pressed_2) { if (pressed_1+pressed_2 ==11) { trace("winner"); trace(pressed_1+pressed_2); } else { trace ("loser") trace(pressed_1+pressed_2); pressed_1=0; pressed_2=0; trace("is reset 1 " +pressed_1); trace("is reset 2 " +pressed_2); trace("this 1 " +pressed_1); trace("this 2 " +pressed_2); } } function click_1(event:mouseevent = null) { if (pressed_1==0) { pressed_1=1; trace("holder_1 = " + pressed_1); cardprint1.removeeventlistener(mou...

desktop application - Im trying to add items to a text field in Java using NetBeans 6.9.1 -

my code in action button press is: @action public void add() { int miles=integer.parseint(jtextfield1.gettext()); double km=miles/.621; jtextarea1.add } as can see, didn't finish jtextarea1 code. want add new line every button press "1 mile(s) = xx km" (with xx being km variable) i'm not clear on how add text jtextarea1 though, second day using desktopapplications, did console apps. call: jtextarea1.append("text goes here\n"); also, start reading oracles swing tutorial instead posting new question every 5 minutes. regards.

bash: "fill in the blank" alias that allows further typing -

background: a well-known feature of bash "alias" command. it allows user save keystrokes "abbreviating" frequently-used or annoying-to-type commands , executing them if user had typed in entire command herself , hit enter @ bash prompt. problem: the alias command automatically executes command corresponds alias after alias has been entered user. there may times when user not want behavior. question: is there way in bash create "fill-in-the-blank" alias commands? alias not automatically run command after hitting enter, instead gives user chance type argument. pitfalls avoid: ruled out reverse-i-search: "reverse-i-search" feature of bash supports "fill-in-the-blank" functionality request, (apparently) not allow user specify commands ahead of time, instead searching through history. may not desired behavior. ruled out functions use of bash functions meet functionality request, may not desired solution because user m...

How to use a template and variable name to count some values of a specific node in xsl -

i use template as <xsl:template name="mytemplate"> and need count amount of level nodes values "on" , "off". the final report want have: this file contains 3 "on" values , 2 "off" values. look @ part of xml file. <?xml version="1.0" encoding="iso-8859-1"?> <?xml:stylesheet type='text/xsl' href='view.xsl'?> <doc> <show>view<show/> <entry> <light>ae</light> <level>on</level> </entry> <entry> <light>by</light> <level>off</level> </entry> <entry> <light>ac</light> <level>off</level> </entry> <entry> <light>pc</light> <level>on</level> </entry> <entry> <light>tc</light> <level>on</level> </entry> thank help these simple xpaths trick: count(/*/*/level[....

python - matplotlib 3d plot with changing labels -

so have 3d live-updating graph! shows 1 point @ time can track motion of point! here problem: no matter seem do, point placed in center of graph , tick marks on axis change in order that. makes life difficult because don't see motion on point. here code: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot plt pylab import * import time import pandas pd import pickle def pickleload(picklefile): pkl_file = open(picklefile, 'rb') data = pickle.load(pkl_file) pkl_file.close() return data data = pickleload('/users/ryansaxe/desktop/kaggle_parkinsons/accelerometry/lily_dataframe') data = data.reset_index(drop=true) df = data.ix[0:,['x.mean','y.mean','z.mean','time']] ion() fig = figure() ax = fig.add_subplot(111, projection='3d') count = 0 plotting = true labels = range(-10,11) ax.set_xlabel('x label') ax.set_ylabel('y label') ax.set_zlabel('z label') ax.set_yticklabels(lab...

c - Code is not updating in Windows -

i running c program using devc++ , codeblocks in windows , code not updating. added single printf message , not shown in output. tried clean,rebuild,recompile, everything. please tell me what's going wrong. try adding newline printf. (with compilers), output isn't flushed screen until newline printed. printf( "\n" );

Why is this expect shell script to ssh into and reboot cisco appliances failing? -

created simple script perform reboot on cisco (telepresence) cts1300, 1000 , 3000 codecs. goal restart bunch of these units weekly through use of cron. using cygwin, , here's expect script: #!/usr/bin/expect -f spawn ssh adminuser@123.123.123.123 expect "*?assword:*" send -- "mypassword\r" expect "*admin:*" "send -- "utils system restart\r" expect -exact "are sure want perform system restart ?\r enter \"yes\" restart system or other key abort\r continue: " send -- "yes\r" expect "*admin:*" send -- "quit\r" expect eof the output is: superuser@superpc ~/ctspsswd ./restartall2 spawn ssh adminuser@123.123.123.123 adminuser@123.123.123.123's password: command line interface starting up, please wait ... welcome telepresence command line interface (version 1.1) admin:utils system restart sure want perform system restart ? enter "yes" restart system or other key abort c...

jquery - Is it possible to bind a list of complex json objects to a C# object using an ajax GET request? -

public class person { public int id { get; set; } public string name { get; set; } } public actionresult test (list<person> persons) { ... } javascript: var person = { name: "p1", id: 1 }; var persons = []; persons.push(person); persons.push(person); var json = json.stringify(persons); $.ajax({ url: '@url.action("test")', type: 'get', datatype: 'json', data: json, contenttype: 'application/json; charset=utf-8', }); i trying send list of person objects controller using request. problem persons list null. when make post request works fine. is possible bind list of complex json objects c# object using ajax request? is possible bind list of complex json objects c# object using ajax request? no, isn't. remember there's limit in query string send, having complex objects in request not should doing anyway. verb used retrieving data simple things id , couple of other qu...

ios - UIImageView is cut off on right side within PageControl after zooming -

my image cut off on right side after zooming in. if don't set offset cgrect make, not cut off, want image centered on screen. how can have image centered , not cut off right portion after zooming? - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. self.view.backgroundcolor = [uicolor graycolor]; uiscrollview *mainscrollview = [[uiscrollview alloc] initwithframe:self.view.bounds]; mainscrollview.pagingenabled = yes; mainscrollview.showshorizontalscrollindicator = no; mainscrollview.showsverticalscrollindicator = no; cgrect innerscrollframe = mainscrollview.bounds; (nsinteger = 0; < 2; i++) { uiimageview *imageforzooming = [[uiimageview alloc] initwithimage:[uiimage imagenamed:[nsstring stringwithformat:@"page%d", + 1]]]; imageforzooming.tag = view_for_zoom_tag; imageforzooming.frame = cgrectmake(50, 0, imageforzooming.bounds.size.width, imageforzooming.bounds.size.height); uiscrollview *pagescroll...

com - MSXML4.0 on Windows Server 2008r2 - Cannot create object MSXML2.ServerXMLHTTP.4.0 -

we have large codebase (primarily vbscript) migrating windows 2000 (32 bit) server windows 2008 r2 (64 bit). portion of code relies on msxml 4.0 parser , unfortunately, not have option of using version 3 or 6 (for reasons beyond scope of question). i've installed 4.0 version of msxml per instructions @ http://www.microsoft.com/en-us/download/details.aspx?id=15697 , verified installed correctly. "msxml4.dll" exists in "c:\windows\syswow64" , there key in registry @ hkey_classes_root\msxml2.serverxmlhttp.4.0 . ran regsrv32.exe against dll , said registered correctly. however, when trying do set objasp = createobject("msxml2.serverxmlhttp.4.0") it fails with: script: c:\test.vbs line: 1 char: 1 error: activex component can't create object: 'msxml2.serverxmlhttp.4.0' code: 800a01ad source: microsoft vbscript runtime error and in powershell: $objasp = new-object -comobject msxml2...

ios - How to hardware accelerate a box-shadow animation in CSS? -

Image
i animating on box-shadow css. using instruments program, discovered animation alone taking 35% of cpu on ios safari! iphone become hotter , hotter when leave page running. if comment out animation, cpu usage normal. how can hardware accelerate animation not strain cpu? jsfiddle : http://jsfiddle.net/tokyotech/tutlh/ @-webkit-keyframes pulseglow { 0% { box-shadow: none; } 10% { box-shadow: 0 0 1.4em rgba(255,0,0,1), 0 0 1em rgba(255,0,0,1) inset; border-color: rgba(255,0,0,0.5); } } #recordbutton { display: block; width: 5em; height: 5em; background: salmon; border-radius: 50%; -webkit-animation: pulseglow 1s ease-in-out 1s infinite; } the short answer browser decides on when use hardware acceleration render something; it's not can force on particular class or style. can use css properties more have browser use hardware acceleration on it, example -webkit-transform: translate3d (even ...

Trouble with printing out of Classes in Python -

we supposed use code below print out parameters listed in it, unable , using round method. supposed print out things instead of print out in game class in playturn function def __str__(self): x = self.name + ":\t" x += "card(s):" y in range(len(self.hand)): x +=self.hand[y].face + self.hand[y].suit + " " if (self.name != "dealer"): x += "\t money: $" + str(self.money) return(x) here our actual code, if see other issues input appreciated from random import* #do need address anywhere face cards worth 10? class card(object): def __init__(self,suit,number): self.number=number self.suit=suit def __str__(self): return '%s'%(self.number) class deckofcards(object): def __init__(self,deck): self.deck=deck self.shuffledeck=self.shuffle() def shuffle(self): b=[] count=0 while count<...