Posts

Showing posts from May, 2011

TYPO3: Access old-style piBase methods from Extbase extension -

can access old-style pibase classes , methods extbase extension? for example, can create accessmyoldextensionservice.php service wrapper class , pull return values controller? in case, need return list of old data records can't migrated mvc style directly. if so, basic approach be? to access on db records of old extension can map table new extension. create new model matching properties of needed table fields. create mapping in ts setup.txt like persistence{ [...] classes{ tx_yournewextension_domain_model_bar { mapping { tablename = tablenameofoldextension } } } } create related repository.

jquery - javascript simple countdown with refresh function -

i getting output of 00 min nan sec. know may wrong code? desired outcome, countdown 5min add class 'ended' using jquery.countdown.js thank you. $(function() { var enddate = "05:00"; $('.countdown.callback').countdown({ date: enddate, render: function(data) { $(this.el).html("<div>" + this.leadingzeros(data.min, 2) + " <span>min</span></div><div>" + this.leadingzeros(data.sec, 2) + " <span>sec</span></div>"); }, onend: function() { $(this.el).addclass('ended'); } }).on("click", function() { $(this).removeclass('ended').data('countdown').update(enddate).start(); }); }); if recall correctly, enddate variable not valid. believe needs follow javascript method of getting date might need this var enddate = new da

sql - Conditionally Select additional rows from another table -

i have 2 tables: tablea pk alpha critter etc 1 zebra apple 2 c lion orange 3 r giraffe banana 4 d gopher pear tablec pk alpha animal misc 1 d beaver kiwi 2 d camel avacado i need result: result pk alpha critter etc 22 zebra apple 23 c lion orange 24 r giraffe banana 25 d gopher pear 26 d beaver kiwi 27 d camel avacado if value of tablea.alpha equals more 1 tablec.alpha same value select be: select ta.alpha, ta.critter, ta.etc tablea ta and select tc.alpha, tc.animal, tc.misc tablec tc on separate rows (3 rows in above example) otherwise just select ta.alpha, ta.critter, ta.etc tablea ta (one row) i might use cte. like: with t_cte (alpha,countalpha) (select tc. alpha, count(tc.alpha) countalpha tablec tc group tc.alpha having (count(tc.alpha) > 1 ))

javascript - Retaining elements while using .replaceWith() -

i've struggled welcome. have created toggle between grid(divs) , table using jquery replacewith function. works great, issue lies keeping each element's specific link constant through each click. in attached example, i've added item replacewith function, renders outside desired elements. example, want link remain in tr or div resides in. when renders, links render outside table/div elements. example: <table class="toggle" style="display: table;"> <tbody> <tr class="table-head"> <--- link should here ---> <th>title</th><th>date</th><th>info</th></tr><tr><td>class title</td><td>item details</td><td>item details</td></tr> </tbody> </table> hopefully i've described enough answer. http://jsfiddle.net/rymill2/r3j5m/ js: $btntable = ".button-table"; $btngrid = ".button-gr

php - CakePHP: How to find columns ordered by number of related models? -

i hope able me. have 2 tables websites , likes. each website has likes. can't figure out how can websites ordered number of likes. sounds pretty basic me failed find solution... something following tried last (actsas containable in model available): $this->paginate = array('contain' => array( 'like' => array( 'order' => array('count(like.id) desc') ) )); $this->set('websites', $this->paginate()); could me please? cheers. andreas // update found solution. use countercache. interested should countercache - cache count() here , thats code $this->paginate = array( 'order' => array('like_count' => 'desc'), 'limit' => 15 ); $this->set('websites', $this->paginate()); i found solution. use countercache. interested should read countercache - cache count() here , thats code $this->paginate = array( 'order' =&

css - Keeping active menu option's background the same colour -

i have superfish menu that, when hover on , sub-menu comes view, wish keep background-color selected option. i have written this, however, doesn't seem apply: .sf-menu ul li:hover > {background-color: #da2026;} would work if targeted element , used < arrow work backwards? this place start .sf-menu li li a:hover, .sf-menu li.sfhover li a:hover { background-color: #da2026; } or maybe .sf-menu li li.sfhover a{ background-color: #da2026; }

Windows Phone 7: How to access built-in Calculator? -

does know how access built-in calculator application on windows phone 7? have googled 4 hours , couldn't find answer. any suggestion highly appreciated, thanks i'm afraid not possible windows phone 7 sdk: launching apps/services, need use launchers in launchers list , there isn't calculator. even on windows phone 8 have access more launchers via uri schemes , there no way launch calculator.

android - How to call contact picker from home screen? -

i'm experimenting creating custom android home screen. i've used sample home screen application , have adapted it. do, open contact picker button in home screen , use contact user chose in next action. i've stumbled on same problem mentioned in this question . how can work around home screen stays "singleinstance" , can call startactivityforresult()? is contacts picker activity can subclass (i've searched can't find any) can use solution david wasser proposes in aforementioned question? i've found elegant solution after all: my main activity launches intermediate, invisible activity has android:theme="@android:style/theme.nodisplay" this intermediate activity calls contact picker in oncreate intent phonecontactintent = new intent(intent.action_pick, contactscontract.contacts.content_uri); // show user contacts w/ phone numbers phonecontactintent.settype(phone.content_type); startactivityforresult(phonecontactinten

java - Can I Set Nested Values on MOXy DynamicEntities that are null? -

i using eclipselink moxy dynamic entity creation , having trouble 1 thing. app hold no libraries in codebase downstream soap services. on startup creates of objects using dynamicjaxbcontextfactory.createcontextfromxsd() . here, take own locally defined objects , convert them using metadata in app. if downstream objects simple, no nested classes, can create converted objects no problem. have downstream dynamictype like: class person { class address { string city; string state; } string first; string last; address address; } i've tried create person object using set xpath methods: dynamicentity person = jaxbcontext.newdynamicentity(jaxbcontext.getdynamictype( "person" )); jaxbcontext.setvaluebyxpath( person, "first/text()", null, "tres"); jaxbcontext.setvaluebyxpath( person, "last/text()", null, "bailey"); jaxbcontext.setvaluebyxpath( person, "address/city/text()", null, &qu

immutability - C# Changing a string after it has been created -

okay know question painfully simple, , i'll admit pretty new c# well. title doesn't describe entire situation here hear me out. i need alter url string being created in c# code behind, removing substring ".aspx" end of string. know url, coming class, "blah.aspx" , want rid of ".aspx" part of string. assume quite easy finding substring, , removing if exists (or similar strategy, appreciate if has elegant solution if they've thought done before). here problem: "because strings immutable, not possible (without using unsafe code) modify value of string object after has been created." msdn official website. i'm wondering now, if strings immutable, can't (shouldn't) alter string after has been made. how can make sure i'm planning safe? string immutability not problem normal usage -- means member functions "replace", instead of modifying existing string object, return new one. in practical t

javascript - Color picker set individual attribute in JQuery each -

i have 3 buttons on page i've set array. i'm using $.each iterate through them , inside color picker function. i'm trying have (last) clicked button change background color, right now, if click 3 before using color picker, change color. need button last clicked change color. jsfiddle var test1 = $('#test1'); var test2 = $('#test2'); var test3 = $('#test3'); var elements = [test1, test2, test3] $.each(elements, function(i) { function handler() { $('#color').change(function(){ $(elements[i]).unbind('click', handler); elements[i].css('background-color', this.value); }); } $(elements[i]).bind('click', handler) }); your solution seems overly complex. simpler solution might this: add click handlers buttons. when button clicked, add "active" class button , remove others. bind change handler color picker. when happens, change background color of active but

android - NullPointerException when initializing NavigationDrawer -

i'm trying use navagation drawer in application , keep running nullpointerexceptions , don't understand why. current code based largely off of this developer link is: public class mainactivity extends activity { private string[] mpages; private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle; private charsequence mdrawertitle; private charsequence mtitle; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mpages = getresources().getstringarray(r.array.page_titles); mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrawerlist = (listview) findviewbyid(r.id.left_drawer); mdrawerlist.setadapter(new arrayadapter<string>(this, r.layout.drawer_list_item, mpages)); mtitle = mdrawertitle = gettitle(); mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); m

Can I disable all compilation in Visual Studio? -

this new 1 me. have been asked, legal reasons, setup laptop visual studio, disable ability compile projects/solutions. purpose enable browsing of source code, not allow building or executing it. yes, know stupid question , unfortunately can't many details. i've asked using alternative text editors, have been told no. until can prove isn't possible (or have @ least made reasonable effort), have try , make work. notepad++ excellent alternative, has been rejected. this in visual studio 2010 or later. there way can this? update after trying marius bancila's suggestion of removing compilers , msbuild, surprised find out vs continued work fine (except building, of course). did not expect functionality f12 (go definition) continue work. this may mean there still remains ability build somewhere somehow. stands msbuild permanently deleted , visual studio build command not working, it'll take effort around (if way in fact exist). you didn't proje

html - display an asp menu consistenly when content page changes? -

i have treeview menu on master page remains on screen when main placeholder directed page. however, boss wants me remove master page , put in own aspx file. however, once no longer visible once content page changes. how can make sure menu stays on page if not on main master page? thanks

deployment - Access to only one OpenShift application? -

the simplest openshift account offers 3 applications. how give access third party, restricted application? need able deploy code 1 app. i create second set of ssh keys - seems keys account level access: i.e. applications on account. i create authorization token - that's @ account level. i share ssh details of application - when want close access, how change details? feel i'm missing obvious here. thanks in advance pointers. ssh keys way go. third party can provide public key can add them account. then, can give them uuid , app url (or git url) 1 app. potentially have access gears within account, realistically, safe assume can't guess uuid of other apps. to revoke access, delete public key account.

string - Converting to binary in MATLAB and Python -

i have matlab code trying convert python. in matlab code takes string , converts double, binary. x = dec2bin(double(string), 8); now, string has numbers, letters, decimal points, , commas. matlab has no problems converting this. is there in python can this? i've tried using bin() , changing string float first, various numpy options like: x = numpy.base_repr(string, 2, 8) and numpy.binary_repr() you can with: >>> string = "foo" >>> res = [bin(ord(i)) in string] ['0b1100110', '0b1101111', '0b1101111'] the same example in matlab gives same result: >>> dec2bin(double('foo'), 8) 01100110 01101111 01101111

Cognos Double Counting -

Image
i have following table: billing account number credit alert number account balance full date 00005884 1-400wha 13111.80 2013-08-12 00005884 1-4wtv4e 13111.80 2013-08-12 00005884 1-4tg3wj 13111.80 2013-08-12 00005884 1-43gbo9 13111.80 2013-08-12 00005884 1-5x817t 13111.80 2013-08-12 00005884 1-4afo7s 13111.80 2013-08-12 00005884 1-50pjwy 13111.80 2013-08-12 00017988 null 105.86 2013-08-12 00018713 null 118.00 2013-08-12 00020032 null 7316.06 2013-08-12 as can see have repeating billing account number account balance . when in cognos bring in billing account number , account balance automatically sums account balance wrong . how setup

PHP MVC Routing -> How do I convert uri array elements to a string useful for routing? -

summary of issues i'm having minor issues routing in mvc framework making. code looks should work, somewhere there wrong way i've split requested uri array , assigned string variable. eliminated of errors popped up, moved on instancialize controller , get: error log class name must valid object or string in /home2/canforce/public_html/index.php on line 23 index.php //analyze request $request = new request(); //breaks uri array //routing $router = new router(array($request)); //routes requested uri $router->route(); //instancialize , execute controller $controller = new $router->getcontroller(); $method = $router->getmethod(); $controller->$method(); request.php class request { public function __construct() { //separates uri array $uri = explode('/',$_server['request_uri']); $uri = array_filter($uri); //stores requested controller uri if($uri[0]!="") { $request['controller'] = $uri[0];

objective c - Get A Number From NSString that may have grouping separator, (comma, decimal, space) -

i have several text fields user enters number , various calculations number. since these numbers can quite large, have feeling users might put grouping separators (commas, spaces, decimals) in entered value. is there way check if user has put grouping separator in textfield , delete grouping separator can store entered value nsnumber? from can tell, nsnumberformatter not provide method , of solutions seem inefficient. wondering if guys had ways deal this. nsnumberformatter provide ways deal commas, dots , spaces, in fact, well. there's "leniency" tries guess best formatting: nsnumberformatter *formatter = [[nsnumberformatter alloc] init]; [formatter setnumberstyle:nsnumberformatterdecimalstyle]; [formatter setlenient:yes]; nslog(@"%@", [formatter numberfromstring:@"123,456.78"]); nslog(@"%@", [formatter numberfromstring:@"123 456 78"]); output: 123456.78 12345678 it works, if user starts mixing things (e.

c++ - English and Greek UTF characters difference -

i have defined same char array english , greek characters. char mytext[]="ΗΤΙΑ ΗΤΙΑΑΑ ΛΟΥΛΟΥΔΙΑΣΜΕΝΗ!!!1234567890"; // char mytext[]="htia htiaaa louloudiasmenh!!!1234567890"; when print length strlen(mytext); of char array first 1 has greek utf8 characters has length of 63 characters second has 39. why happened? can fix or proper question how syntax greek unicode greek character program understand them correctly? i send char array led matrix , message not display on screen when chars english. seems greek characters or non-ascii characters bigger 1 byte. i have switch function check characters , returns appropriate byte array each letter.i have set default case of switch character ! instead of getting htia htia !h!t!i!a! . switch understands greek character more 1 byte , returns first default case witch ! , correct character. also when try print text error on serial monitor(the characters not display correctly). since utf-8 characters can

Include Iverson Bracket in R documentation -

Image
i wanting include iverson bracket in r documentation (unless there's better way represent information; i'm no mathematician). looks this. here have valid latex code such expression w_{neg}=\left\{\begin{matrix} 1 & \sum{(x_i^{n})}>0 \\ 0 & \sum{(x_i^{n}})=0 \end{matrix}\right. i tried include code below: #' w_{neg}=\left\{\begin{matrix} #' 1 & \sum{(x_i^{n})}>0 \\ #' 0 & \sum{(x_i^{n}})=0 #' \end{matrix}\right. in details section of roxygen2 produces error seen below when compiling pdf documentation: creating pdf output latex ... warning: running command '"c:\progra~2\miktex~1.9\miktex\bin\texi2dvi.exe" --pdf "rd2.tex" -i "c:/r/r-30~1.1/share/texmf/tex/latex" -i "c:/r/r-30~1.1/share/texmf/bibtex/bst"' had status 1 error : running 'texi2dvi' on 'rd2.tex' failed latex errors: ! misplaced alignment tab character &. <argument> \left \{\begin {mat

html - Facebook Like Box not working for FB Page -

i trying create box facebook page: https://www.facebook.com/westierescue.austin put on website. unable page work in facebook developers site. can please test , advise how generate box page? thats not facebook "page", facebook "user", users dosn't have liks, need convert "user" "page" first. https://www.facebook.com/help/175644189234902/

css - Difficulties when positioning DIV tags -

i'm pretty new css styling , need postioning divs in layout. if div tag declared bottom of page, when browser width reduced (to simulate in mobile phone), require div displayed on top. know achieved assigning minus value, isn't there better way of doing this? please have @ http://2010.dconstruct.org/speakers/tom-coates , notice content inside right column displayed before main content when browser width reduced. i'm unable find solution through firebug. thanks. they use media queries: @media , (max-device-width: 767px), , (max-width: 449px){ // code } if want know more them, can read, e.g., http://mobile.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/

validation - Trying to attach a keydown handler to an input element that doesn't break in ie7 -

i trying attach keydown handler input[type=text/password/email] elements within validation group won't break in ie7. here's i've tried: $(function() { $('.validationgroup input[type=text],\ .validationgroup input[type=password],\ .validationgroup input[type=email],\ .validationgroup input[type=tel],\ .validationgroup .causesvalidation\ ').keydown(ucp.validation.keydowneventhandler); }); any ideas? i added keydown event on document , worked. $(document).keydown(function () { $('.validationgroup input[type=text],\ .validationgroup input[type=password],\ .validationgroup input[type=email],\ .validationgroup input[type=tel],\ .validationgroup .causesvalidation\ ').on(ucp.validation.keydowneventhandler); });

Android Activity onCreate Being Called Twice When Navigated Back From Another Activity -

i have app generates music after user authenticates oauth on webview activity, looking this: main player activity-oauth activity-back main player activity. however, oncreate method being called twice when going oauth activity, resulting in 2 audio tracks generated , played @ same time. here's part of code mainactivity: public class mainactivity extends activity { int pitch=60; private static final float visualizer_height_dip = 50f; random rn; boolean isrunning = true; boolean isplaying=false; seekbar fslider; double sliderval; mediaplayer mediaplayer=new mediaplayer(); imagebutton startstopbutton; imagebutton stopbutton; seekbar vslider; visualizerview mvisualizerview; private visualizer mvisualizer; imagebutton connectbutton; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // point slider gui widget rn = new random(); fslider = (seekbar) findviewbyid(r.id.frequency)

PHP: Emailing echo results -

i'm on homestretch of project have been working on 2 weeks. html form created , fully, , functionally, compatible php. currently, after submitting form echo's results back. @ point, don't know go next. i able take information page, , add numerical digital signature (much pin) , submit final results email using php. i can 2 separately. ie - can create form echo results, , can create form e-mails results, don't understand how them in conjunction each other. how can submit form's echo results e-mail, while adding digital signature? (since offer no code, i'm new php, don't expect -do- me, i'm struggling find relevant information via google searches, pointing me in right direction incredibly helpful.) thanks and know better. code: html <form action="echo_form_email.php" method="get"> <p> <div id="cheddar">cashier: <input id="cashier" name="cashier" type="text&quo

gdb - emacs fail on cygwin -

when try launch emacs on win7/cygwin got error memory-error : [4856]: gslice: failed allocate 504 bytes (alignment: 512): function not implemented i have googled error , appear gdb causing source: http://webapp5.rrz.uni-hamburg.de/suse-dokumentation/packages/emacs/doc/problems i have installed gdb might cause, have tried uninstall gdb cygwin using setup/"gdb"/uninstall dont seem uninstall gdb idea on how fix emacs problem or uninstalling gdb ?

c# - Is StringBuilder only preferred in looping scenarios? -

i understand stringbuilder choice concatenating strings in loop, this: list<string> mylistofstring = getstringsfromdatabase(); var thestringbuilder = new stringbuilder(); foreach(string mystring in mylistofstring) { thestringbuilder.append(mystring); } var result = thestringbuilder.tostring(); but scenarios stringbuilder outperforms string.join() or vice versa? var thestringbuilder = new stringbuilder(); thestringbuilder.append("is "); thestringbuilder.append("ever "); thestringbuilder.append("idea?"); var result = thestringbuilder.tostring(); or string result = string.join(" ", new string[] { "or", "is", "this", "a", "better", "solution", "?" }); any guidance appreciated. edit: there threshold creation overhead of stringbuilder not worth it? it seems string.join uses stringbuilder under hood

algorithm - Implementing Text Justification with Dynamic Programming -

i'm trying understand concept of dynamic programming, via course on mit ocw here . explanation on ocw video great , all, feel don't understand until implemented explanation code. while implementiing, refer notes lecture note here , particularly page 3 of note. the problem is, have no idea how translate of mathematical notation code. here's part of solution i've implemented (and think it's implemented right): import math paragraph = "some long lorem ipsum text." words = paragraph.split(" ") # count total length strings in list of strings. # function used badness function below. def total_length(str_arr): total = 0 string in str_arr: total = total + len(string) total = total + len(str_arr) # spaces return total # calculate badness score word. # str_arr assumed send word[i:j] in notes # don't make , j argument since require # global vars then. def badness(str_arr, page_width): line_len = total_length(str_

jsf - Pushing a value from inside <ui:repeat> in a map, set or list -

i know if possible push value inside map, set or list? i pass value of inputtext set. code: <ui:repeat var="_par" value="#{cmsfilterparameterhandler.normalesuchparameter()}"> <p:outputlabel value="#{_par.bezeichnung}" /> <p:spacer width="5px" /> <p:inputtext id="me" value="#{??? push me set ???}"/> <br /><br /> </ui:repeat> regards markus with set , not possible doesn't allow referencing items index or key. it's possible list , map specifying list index , map key in input value. with list : private list<string> list; // +getter (no setter necessary) @postconstruct public void init() { list = createandfillitsomehow(); } <ui:repeat value="#{bean.list}" varstatus="loop"> <h:inputtext value="#{bean.list[loop.index]}" /> </ui:repeat> with map (only if e

php - Text box value instant show calling method -

script <script type="text/javascript"> function keyhandler() { var result = document.getelementbyid('result'); result.innerhtml=document.getelementbyid('txtinput').value; } </script> html <input type="text" id="inputfield" /> <div id="screen"></div> this code work in html want <a href="#?call=limit.lim&amp;height=400&amp;width=400&amp;id={$id}&amp;team= {$name}&amp;val={'**********'}&amp;name={$name2}&amp;catname={$cat}" class="inlinepopup" title="{'namer'}">{$single}</a> val={' * *** '} ever type in text box that's want here in star position how val={'<div id="screen"></div>'} not work example : type value 123 in text box means that's instant like val = 123 you change href attribute of link

jax ws - Resteasy Jackson POST -

i trying post on webservice using resteasy , jackson json bindings. my client interface looks @produces("application/json") @consumes(value = mediatype.application_json) public interface myclientproxy { @post @path("/messages/send") clientresponse<fooresponse> send(@queryparam("foo") foo foo); } and object foo like: @jsonignoreproperties(ignoreunknown = true) public class foo implements serializable { @jsonproperty string bar; public string getbar() { return bar; } public void setbar(string bar) { this.bar = bar; } } but when run test, can see server post looking like: { "foo": "com.x.y.foo@1d75249c" } how come object foo not being serialized json? i think need default constructor public foo() {} : @jsonignoreproperties(ignoreunknown = true) public class foo implements serializable { @jsonproperty string bar; public foo() {}

html - Using Meiryo font causes input field to stretch -

i using famous japanese font called "meiryo" on japanese website. however, usage of font causes input fields stretch. strange bug, if replace font else, input fields normal. anybody can explain me why bug occurs please? tested on major browsers it’s not bug. <input type=text> element has visible size set size attribute (defaulted 20), sets width in “characters”. means “average width” characters according html 4, whereas html5 drafts “the user agent should ensure @ least many characters visible”. reality varies across browsers. in case, visible width of element should depend , depends on properties of font – on widths of glyphs in it. the following simple test (which assumes common default font used input ) illustrates this: <input value="hello world"><br> <input value="hello world" style="font-family: meiryo"> the latter element considerably wider, , looking @ appearance of initial text, set can se

c++ - Hadoop on Mac OS X - How to get pipes to work if i installed Hadoop using brew? -

i installed hadoop on os x using brew install hadoop . however, seems need compile source files in order use pipes. http://cxwangyi.blogspot.jp/2010/04/running-hadoop-on-mac-os-x-single-node.html http://hadoop.illecker.at/?cat=4 how source files brew installation? need uninstall brew version , re-install manually explained here? http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/

Powershell script write to one file simultaneously Out-File -FilePath -InputObject -Append -

i made powershell script writes data 1 text file. script being executed 3rd party software deploying program. thing waits when computer online , executes job, bad thing when script being executed on 100+ online computers got information 8 computers , 2 empty lines. most happened because powershell script running simultaneously on 100+ computers , file in use. no way use "wait script being executed on first computer" in 3rd party software deployment program. the problem line - $srvpath = [path text file] $computer = "name of computer" $data = "some data not more ~30 characters" out-file -filepath $srvpath -inputobject "$computer - $data" -append my current solution make temporary file each computer separately , later launch 2nd script read files write 1 file (sort alphabetically) , delete temporary files. but stick 1 script possible check if data written file or check if text file in use , wait? nice avoid empty lines well, that&

objective c - UIButton image with custom icon size -

if have uibutton in xib file. possible set per icon button custom icon size in xib file? es. have 40x40 image mia_immagine.png set icon of button size (image) 20x20 use resize image: + (uiimage*)imagewithimage:(uiimage*)image scaledtosize:(cgsize)newsize { uigraphicsbeginimagecontext( newsize ); [image drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; uiimage* newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage; } and use in button: [btn setbackgroundimage:[yourclass imagewithimage:[uiimage imagenamed:@"your_imag.png"] scaledtosize:cgsizemake:(20,20)]; and set content mode centered

c# - XMLDocument to xml file -

in web services sending xml document using code, xmldocument doc = new xmldocument(); doc.loadxml(mybigdata.serialize()); return result = doc.documentelement; now in c# console app calling web method using, xmlelement returneddatafromwebmethod = mywbsercvices.webmethod(); now how can convert xml element xml file e.g. in c drive can see if xml document document, instead of going through using foreach(xmlnode) you may try this: var doc = new xmldocument(); var node = doc.importnode(returneddatafromwebmethod, true); doc.appendchild(node); doc.save("output.xml");

python - How to check a remote path is a file or a directory? -

i using sftpclient download files remote server. cann't know remote path file or directoty. if remote path directory need handle directory recursive. this code: def downloadfile(sftp, remotepath, localpath): file in sftp.listdir(remotepath): if os.path.isfile(os.path.join(remotepath, file)): # file, try: sftp.get(file, os.path.join(localpath, file)) except: pass elif os.path.isdir(os.path.join(remotepath, file)): # dir, need handle recursive os.mkdir(os.path.join(localpath, file)) downloadfile(sftp, os.path.join(remotepath, file), os.path.join(localpath, file)) if __name__ == '__main__': paramiko.util.log_to_file('demo_sftp.log') t = paramiko.transport((hostname, port)) t.connect(username=username, password=password) sftp = paramiko.sftpclient.from_transport(t) i find problem: function os.path.isfile or os.path.isdir return false , think these function cann't work rem

How to limit the speed (or flow control) of http request in JMeter -

i want simulate end user accessing http urls jmeter. possible limit connect speed each http request flow control? saying limit jmeter fetch response in max speed of 1m bps each http request. following parameters in jmeter.properties should trying achieve it. # define characters per second > 0 emulate slow connections #httpclient.socket.http.cps=0 #httpclient.socket.https.cps=0 another option use traffic shaper, tc if on linux.

css - rgba(0,0,255,0.5) as hexadecimal color value? -

with following can make background semi transparent css contense not semi transparent. background-color: rgba(0,0,255,0.5); can same thing hexadecimal color values? no, you cannot : unlike rgb values, there no hexadecimal notation rgba value.

c# - Data not displayed in jQuery multiselect plugin -

i'm trying populate drop-down using jquery multiselect plugin. when use simple drop-downs have hard coded value, works properly. however, when fetch records database populate drop-down, records not displayed in drop-down in ie (it works fine in chrome). javascript <script> function fill(u, f, d, c) { $.ajax({ type: "post", url: u + '/' + f, data: d, contenttype: "application/json; charset=utf-8", datatype: "json", async: false, cache: false, success: function (r) { var i; //$('#' + c + '').length = 0; var myitem = r.d.split('#'); $('#' + c + '').empty(); (i = 0; < myitem.length; = + 2) { $('#' + c).append(new option('' + myitem[i + 1] + '','' + myitem[i] + '')); } } }); } $(document).ready(f

Eclipse stops me from adding superfluous tabs -

i editing extensive ant xml build file file , tried add in tab thought appropriate. happens, tab shouldn't have been there (if following "rules" on looks pretty in xml). and happened, eclipse refused let me put tab there. tried few times, , "allow" one tab, v. either ignore tab remove tab i know eclipse doing "right", (in byzantine sense, because isn't python, ant xml build file, way "right" aesthetics point of view) think "stupid". how can disable "feature" in eclipse? i assume mean tabulator key (as opposed sub-windows, called tabs). look editor preferences. things might settings "insert spaces tabs", "displayed tab width" , "smart caret positioning @ line start , end". if doesn't help, try avoid xml editor not opening double-click, using "open .." -> "text editor"

c# - Getting a dropdown to interact with a gridview -

i have gridview looks this: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" pagesize="10" datakeynames="id" onrowediting="gridview1_rowediting" onrowcancelingedit="gridview1_rowcancelingedit" onrowupdating="gridview1_rowupdating" onpageindexchanging="gridview1_pageindexchanging" onpageindexchanged="gridview1_pageindexchanged" allowpaging="true"> works fine. want add dropdown box above gridview act filter database results: <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true"> <asp:listitem value="0">show all</asp:listitem> <asp:listitem value="1">in queue</asp:listitem> <asp:listitem value="2">being worked on</asp:listitem> <asp:listitem value=

file io - WinRT No mapping for the Unicode character exists in the target multi-byte code page -

i trying read file in windows 8 store app. here fragment of code use achieve this: if(file != null) { var stream = await file.openasync(fileaccessmode.read); var size = stream.size; using(var inputstream = stream.getinputstreamat(0)) { datareader datareader = new datareader(inputstream); uint numbytes = await datareader.loadasync((uint)size); string text = datareader.readstring(numbytes); } } however, exeption thrown @ line: string text = datareader.readstring(numbytes); exeption message: no mapping unicode character exists in target multi-byte code page. how this? i managed read file correctly using similar approach suggested dude: if(file != null) { ibuffer buffer = await fileio.readbufferasync(file); datareader reader = datareader.frombuffer(buffer); byte[] filecontent = new

How to apply Scale animation After Translate animation in android -

hi doing 1 app here need apply rotate,move scale animation imageview..i tried using below code rotate , scale animation working in scale animation image not scaling in translate animation stoped postion coming original postion there scaling..but need scale image image stoped using translate animation..where did mistake 1 suggest me thanks public class mainactivity extends activity { imageview i1; translateanimation movelefttoright1; animation logomoveanimation; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); i1=(imageview)findviewbyid(r.id.img); final animation myrotation = animationutils.loadanimation(getapplicationcontext(), r.anim.rotate1); i1.startanimation(myrotation); movelefttoright1 = new translateanimation(0, 0, 0, 200); movelefttoright1.setduration(2000); movelefttoright1.setfillafter(true);

scala - Editable Boolean Columns in ScalaFX TableView -

i'm new scalafx , want create tableview containing editable boolean column checkbox s (as editable string , int columns textfields). assume i'll need use checkboxtablecell . i'm using jdk 7u25, scalafx 1.0.0-m4/m5 , scala 2.10.2-final. (i'm not scalafx version, it's definately @ least 1.0.0-m5. in case it's snapshot jarek uploaded on august 1 https://oss.sonatype.org/index.html#nexus-search;quick~scalafx . jarek compiles scala 2.9.x, i've downloaded source code , recompiled it.) i've managed halfway working based on integer columns in scalafx tableview , http://foofighter2146.blogspot.com/2013/06/tutorial-scalafx-slick.html , scalafx-demo: simpletableview. however, can't use checkbox's in tableview , use values. in stead, can work in such way need type in "true" or "false" edit value in table. here's have managed working far: class person(firstname_ : string, age_ : int, cool_ : boolean) { val name = new strin