Posts

Showing posts from August, 2015

java - Swing: How do i create an east hugging component that will not move over western components -

i've tried several ways render correctly. want logo area hug east window resized, not overlap western components. following code not hug east, think makes sense because the logoarea box not know should take rest of horizontal space. if add logoarea directly 'area' hugs east, overlap western components if window shrinks much. ideas? box box = box.createhorizontalbox(); box.add( main ); for( jcomponent item : items ) //western stuff { box.add( box.createhorizontalstrut( 8 ) ); box.add( item ); } //eastern stuff box logoarea= box.createhorizontalbox(); logoarea.add( new jlabel( laf.icon.png( "companylogo" ) ), borderlayout.east ); box.add( box.createhorizontalstrut( 8 ) ); box.add( logoarea, borderlayout.east ); jpanel area = new jpanel( new borderlayout() ); area.setborder( borderfactory.createemptyborder( 2, 2, 2, 2 ) ); area.add( box, borderlayout.west ); return area; //dashboard built edit to answer @nitin i'd move lef...

eclipse - Setting up Aspectj tools -

the problem must have simple answer cannot it. i need use org.eclipse.core.resources , org.eclipse.core.runtime libraries iresources,iproject,iworkspace,... classes. have downloaded aspectjtools.jar contains them. have added aspectjtools.jar project classpath in eclipse project. the project consists on simple jsp page imports org.eclipse.core.resources , org.eclipse.core.runtime libraries, when try use example iworkspace class exception (iworkspace cannot resolved type) class iworkspace not exist. i have read step needed. editing aspectjtools.jar/meta-inf/manifest.mf, don't know write in it. ask more details if needed. i have resolved problem problem viktor stolbin answer. put .jar files project subdirectory. add .jar files classpath: project>properties>java build path>add jar>project subdirectory of jar files follow instructions in: adding 3rd party jars web-inf/lib automatically using eclipse/tomcat

python - Parachute Segmentation Fault Error - pygame to py2exe -

i using gui2exe compile python/pygame, game .exe i have problem font module. using python 2.7 , py2exe option in gui2exe have updated python, pygame , py2exe 2.7 versions. program runs fine after compile py2exe this. here error get: fatal python error: (pygame parachute) segmentation fault application has requested runtime terminate in unusual way. please contact application's support team more information. my game starts off console , part runs. display starts crash. thanks had similar problems , 1 too. found way solve them: after few weeks (had problem before) i'm happy solved problem! :) 1st part of problem ( http://i.stack.imgur.com/wpkjr.png ): solved editing setup.py script adding "excludes" part in it. resulted in successful making of executable file! modified setup.py script: from distutils.core import setup import py2exe setup(windows=['source_static.py'], options={ "py2exe": { ...

Indexing composite types with Lucene -

currently i'm building search tool project index objects created multiple database tables (i.e. people , things do). wondering if there better way of going other creating objects corresponding each of combination of people/things (there thousands of each). e.g. creating object corresponds person 1 - thing 1, , person 1 - thing 2 n things person 1 does. then, indexing collection of objects. doing same thing person 2. you might use join functionality if dont want denormalize records. @ this article starters. performance worse denormalizing enough.

php - Mapping groups of constant values -

i have lists strings correspond values. example, in company list have microsoft correspond letters ms. obviously, transposed table in mysql make list extensible but, curiosity, how express in constant form in php ? p.s: there class-with-constants approach (see accepted answer here: php , enumerations ) act enumeration of use seeing enumerations map integer values ? how using define define("ms","microsoft"); echo ms; this echo microsoft. http://php.net/manual/en/function.define.php also link gave possible solution used strings instead. reason acts enum other languages because define values 0 n, instead of doing use string instead. class companies { const ms = 'microsoft'; const ibm = 'international business machines'; } echo companies::ms; i think work.

email - Attaching an uploaded image in PHP mail -

hi ladies , gentlemen hoping able me this. i have created web form people can enter registration information , upload image our server photo contest. uploader works great , email gets sent registration information having hard time getting uploaded image attach email. hoping able me figure out. form , processor page located in same directory , image placed in subfolder called upload. here have far not work attaching image. give me error: <?php if ((($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/pjpeg")) && ($_files["file"]["size"] < 2000000)) { if ($_files["file"]["error"] > 0) { echo "error: " . $_files["file"]["error"] . "<br />"; } else { echo "upload: " . $_files["file"]["name"] . "<br />"; echo "type: " . $_files[...

repository pattern - Can't help but see Domain entities as wasteful. Why? -

i've got question on mind has been stirring months i've read ddd, patterns , many other topics of application architecture. i'm going frame in terms of mvc web application question is, i'm sure, broader. , this:  does adherence domain entities  create rigidity , inefficiency in application?  the ddd approach makes complete sense managing business logic of application , way of working stakeholders. me falls apart in context of multi-tiered application. namely there few scenarios when view needs data of entity or when 2 repositories have all. in , of that's not bad means make multiple queries returning bunch of properties don't need few do. , once done extraneous information either gets passed view or there overhead of discarding, merging , mapping data dto or view model. have need generate lot of reports , problem seems magnified there. each requires unique slicing or aggregating of information sql can repositories can't they're expected return full...

c# - JavaScript setTimeout not firing after Window.Open -

i have asp.net web page works on ios4 not on ios5. on parent web page have button opens child window. , settimeout refresh thing in parent window right after open window call. i noticed on iphone ios5 when opens child window, settimeout function in parent page not called until go parent window , child window see update. here's snippet of code in parent page , think problem windowmanager.openwindow('...') t = settimeout(function() { handles[0].testfx(); }, 1000); this runs on ios4 not on ios5. any ideas? ios5 indeed pause javascript when window not active window. there nothing can this, best can try alter setup javascript not need run when window in background. you said doing settimeout refresh thing in parent window . why doing this? frankly, sounds little bit odd -- why want refreshing when user can't see page? line handles[0].testfx(); you?

c++ - GCC __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) -

pursuant post, standalone functions/data in c++ , proceeded put "common data" in anonymous namespace below , worked great on windows (vista 64 bit) on vs 2005/2008/2010 namespace { ... static std::string mystrings[] = { str1, str2, ..., strn }; ... } namespace mynamesp { ... use mystrings[] here.. ... } but on linux (so far tested rhel5 built gcc-4.1.2) promptly got segmentation fault. $>myprog segmentation fault $>gdb myprog gnu gdb fedora (6.8-27.el5) copyright (c) 2008 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb configured "x86_64-redhat-linux-gnu"... (gdb) r starting program: <path/to>/myprog [thread debugging using libthread_db enabled] [new thread 0x2b8901a9da60 (lwp 32710...

c# - Escape double quotes in SQL 2005/2008 -

i have international company has been added, named "bla "blahblah" ltd. (the double quotes part of name. ) whenever user tries search company, entering "blah, or affect, search fails syntax error in sql server. how can escape search not fail? sample sql: select c.companyid, c.companyname, c.dateadded, count(cm.maxid) numdirect russoundgeneral.dbo.company c left join russoundgeneral.dbo.companymax cm on (cm.companyid = c.companyid , cm.maxid not null) contains ( companyname, '"blah*' ) group c.companyid, c.companyname, c.dateadded order c.companyname asc unfortunately, double-quotes have special meaning inside fti, if parameterize it, fti engine treats phrase delimiter. not sure there easy way include double-quotes in fti search. brackets special character, can encased in quotes treat query term - not afaik double-quotes. update a bit of searching suggests doubling quote "...

Find best matching writeMethod with Java reflection -

commons beanutils getmatchingaccessiblemethod finds match, not best possible match. consider simple example: public class testreflection extends testcase { public static class beana { private datax data; public beana setdata(datax x) { system.out.println("setdata x"); return this; } public beana setdata(datay y) { system.out.println("setdata y"); return this; } } static class datax { } static class datay extends datax { } static class dataz extends datay { } public void testpropertyutils() { try { beana = new beana(); system.out.println("--- setters:"); a.setdata(new datax()); a.setdata(new datay()); a.setdata(new dataz()); system.out.println("--- invokemethod"); methodutils.invokemethod(a, "setdata", new dataz()); } catch (exception e) { e.printstacktrace(); } } } (hint: invokemethod uses getmatchinga...

Puppet: disable echo of notify commands -

i print messages , variable values while configuration applied. separate output of different configuration blocks visually. use notify {"\n\ninstall tomcat $target_folder":} as described in puppet tutorials , documentation . unfortunately output not add readability whole log: notice: install tomcat /opt/example/uiserver notice: /stage[main]//node[dev-xyz.example.com]/tomcat[uiserver_tomcat]/notify[ install tomcat /opt/example/uiserver] install tomcat /opt/example/uiserver' problem - instead of printing message, puppet outputs annoying echo /message: defined 'message' ' . there way eliminate it? using withpath => false did not help. puppet 2.7.17. set --logdest syslog . it's console default. --logdest: send messages. choose between syslog, console, , log file. defaults sending messages console.

Decimal validation in JavaScript -

i use following script decimal validate.i need enter numbers , dot symbol 123.00 only.the following function not support letters fine.but not allow enter dot(.) symbol also?how enter dot symbol using function? function isnumberkey(evt) { var charcode = (evt.which) ? evt.which : event.keycode if (charcode > 31 && (charcode < 48 || charcode > 57)) return false; else return true; } function isnumberkey(evt) { var charcode = (evt.which) ? evt.which : event.keycode if (charcode != 46 && charcode > 31 && (charcode < 48 || charcode > 57)) return false; return true; }

css - How to forcefully print background image in HTML? -

i need print report page has couple of background images on it. these images not printable. these images logos graph , hence important in report. i have option can crop them , include in page tag last option. hence before know if there way forcefully print these images? can me out? by default, browser ignore background css rules when printing page, , can't overcome using css. the user need change browser settings. therefore, image need print should rendered inline image rather css background. can use css display inline image print though. this. html <div class"graph-image graph-7"> <img src="graph-7.jpg" alt="graph description" /> </div> css .graph-7{background: url(../img/graphs/graph-7.jpg) no-repeat;} .graph-image img{display: none;} @media print{ .graph-image img{display:inline;} } using code, or similar code, means image used once in html , once in css. html version hidden using css, , print di...

database - Need to understand the Logic of Playframework -

i have simple question. if use play.db.ebean.model have model extend model, how can save db? more clearly: in django, database file created , save object, saved db file , dont sql statements retrieving or saving objects.. how work in playframework? lets have configured database file in application.conf file this: db.default.driver=org.h2.driver db.default.url="jdbc:h2:tcp://localhost/~/microblogdb" db.default.user="sa" db.default.password="" now have database file somewhere in system. now have class user extends model stated above. want save 1 user object db. this: user user = new user(); user.username = "testusername"; user.fullname = "userfullname"; user.save(); what happen after save() call? can directly see user object in database file? appreciate help! many thanks yes will, if didn't mistakes. make sure in application.conf uncommented line: ebean.default="models.*" check sample ap...

gem - Simple ruby guard watcher -

is there way create simple guard watch? want run rake task when file changes in specific directory , going through of these steps 1 off task. https://github.com/guard/guard/wiki/create-a-guard i tried adding in guardfile doesn't work. guard :doc watch(%r{^documentation}) { "rake doc:build" } end watch("/documentation") { "rake doc:build" } so know of simple way run rake task when file updated guard ? the straightforward way use guard-rake run rake task on file modification. a more generic solution use guard-shell run command line tool on file modification. more complex use cases should solved creating own guard plugin . don't need create gem, since can define them inline guard avdi shows in a guardfile redis blog post. when want share guard, have @ more advanced guard plugins guard-rspec or guard-jasmine examples.

css - jQuery. fadeIn() "inline-block" elements sets them to block -

this question has answer here: how fade display: inline-block 5 answers i need fade in hidden divs hidden display:none. when faded in, need display "inline-block" not "block" can display inline each other rather drop below each other. possible? .sectionblock{ width:163px; height: 261px; padding:5px 5px; position: relative; /*display: inline-block;*/ display: none; overflow: hidden; margin: 0 6px 11px 6px; } . ... $('.sectionblock').fadein('slow'); ... try using .fadeto() instead. far i'm aware, doesn't affect display property.

.net - Draggable text or shapes on an image in C# or VB.NET -

i'm trying create winforms application using either c# or vb.net allow me place text or shape on top of existing image inside picturebox , have text or shape draggable mouse. example, if want place 90x90 square on image, enter 90 in 'width' textbox, 90 in 'height' textbox , click on image , drawn on top of existing image. can position moving mouse want exactly. there other steps if required (like clicking 'insert rectangle' button starts process). i've tried few ideas calling routine resets picturebox it's original image , draws shape when 'mouse move' event raised, slow. should done in paint event of picturebox, , if so, point me in right direction of how it? possible, or oversimplifying idea? thanks in advance help. below naive example of how paint draggable rectangle inside parent control. public class draggable : picturebox { rectangle shapebounds; bool isdragging; point dragpoint; public draggable(...

javascript - how to access object property using variable -

i have object var messages = { 'fullname' : 'tell cool name dude..! e.g. yousuf iqbal', 'username' : 'choose catchy username. remember! should available :)', 'password' : 'choose top secret password special chars, numbers , alphabets', 'repassword' : 'retype password typed. but, don\'t try copy!', 'byear' : 'tell year, in bomb blasted' }; and variable.. var attribute = $('#userinfo form input').attr('name'); now want select messages object property using variable this.. var message = messages.attribute; but not working.. , have tried following.. var message = messages+'.'+attribute; square brackets: message = messages[ attribute ];

submission - How to Codesign and Sandbox Helper Application in Xcode 4? -

this problem: have mainapp contains helperapp. helper app used login items need differentiate mainapp , helperapp bundle ids. copied helperapp mainapp buildphase copy. if codesign , sandbox helperapp upload phase stops... error related provisioning profile. if don't code sign/sandbox helperapp upload works after 2 minutes receive invalid binary" warns me "app sandbox not enabled" on helper app. do know correct practice sandbox , app helper app in it? can't find nothing in documentation! i had same scenario: mainapp contains helperapp, used launch mainapp @ login. the "invalid binary - app sandbox not enabled" problem got resolved making sure code signing identity both apps in xcode set " 3rd party mac developer application ". then, after submitting review, got "waiting review" notification , no more "invalid binary" errors.

c++ - Exceptions Specifications and std input iterators -

i have input iterator makes use of 2 methods getfirst , getnext. both of these function part of api , theoretically these functions can fail in operation whatever reason. in case i'm casting runtime exception. i've never used exception specifications in c++ thinking might time start. constructor , operator++ functions specify can throw runtime error. then did quick search in vector.h file (std::vector) dont see throw used there. how come? if have reached end of iterator , *(i++) should there exception? if have reached end of iterator , *(i++) should there exception? yes thats error. about exception specification better specify when method not throw. , not opposite. take @ this question.

jquery - Getting total count of JSON response -

can done in jquery before start looping through them? or need setup separate group in response of data total count lets say.. first variable? the common response looks this: [ {"name":"tu\u011frul","surname":"topuz","message":"hello world"} ,{"name":"tu\u011frul","surname":"topuz","message":"hello world"} ] but use jquery return 2 total count (before loop through them all?) or need this? [ {"total":"2"} ,{"name":"tu\u011frul","surname":"topuz","message":"hello world"} ,{"name":"tu\u011frul","surname":"topuz","message":"hello world"} ] whats efficient/common (optimization-wise) way of doing this? as after json decoding getting array of objects(from have posted). can access length propert...

wcf - How to avoid block IO operation when responding a user's request in asp.net -

i working on wcf project hosted asp.net/iis. wcf service has method called searchimage, looks this: string searchimage(string query) { //call bing service images //it time-consuming return result. } the call bing service time consuming. can impact service much. async call doesn't here: string searchimage(string query) { //async call bing service images waitforcomplete(); return result. } you can see, still need wait until bing returns result. my question is, there technology avoid kind of block io issue? ideally, want tell asp.net response when bing result back. no. have return complete web page, javascript embedded (jquery popular, though atlas can integrate asp.net better) perform async call after page rendered, , replace relevant dom section (usually tagged css id) contents loaded. way, user sees loaded throbber, replaced final text, image, or whatever you're loading once it's ready. you can make async call go server, can massaging se...

Chrome IOS - Is it just a UIWebView? -

i'm not sure suitable question here new chrome app ios uiwebview? if safe assume there shouldn't rendering differences between , mobile safari? as of version 48, chrome ios uses wkwebview, same view used in safari. source: ars technica

javascript - Setting the icons of a node in TreePanel -

extjs 4: i've created treepanel. wanted set own icons node used iconcls property every node. working. when expand node, returns normal 'open folder' icon. var treeobject = { text: "bank of america 1", cls: "enterprise", children: [ { text: "core outputs", cls: "businessunit", iconcls: 'abc' } ], iconcls: 'abc', leaf: "false", expanded: true, type: "enterprise" } treepanel.setrootnode(treeobject); please suggest avoid problem. try specify css class prevent override default classes of extjs .x-grid-tree-node-expanded .x-tree-icon-parent.abc{ background: url(abc) x y no-repat !important; }

php - affliate window csv to drupal node via batch api -

i have affliate window csv has 1 lac rows, want save nodes, , tried batch api. but still getting php timeout error ..please help function module_aw_batch(){ $operations = array(); $csv = file_directory_path().'/aw/datafeed_134642.csv'; $file = fopen($csv, 'r'); while (($data = fgetcsv($file)) !== false) { $operations[] = array('module_aw_op', array($data)); } $batch = array( 'title' => t('generating feeds'), // title display while running. 'operations' => $operations, 'finished' => 'module_aw_finished', // last function call. 'init_message' => t('importing...it may take 4-5 hours'), 'progress_message' => t('processed @current out of @total.'), 'error_message' => t('import feeds has encountered error.'), ); batch_set($batch); batch_process('admin/content/node/overview'); } update (solved) i...

security - Only the owner can delete his/her books? -

my problem other users not own book can delete book if know book id , it's easy book id. look here (zf manual) see "writing conditional acl rules assertions". need find way pass book id assert() method, on it's easy.

How to delete all data for one app in Django 1.4 now that reset is gone? -

how delete data in database on django app? in previous version manage.py reset appname did job, that's been deprecated. what supposed if want delete data app using command line? reset , sqlreset both wrappers around other management commands. sqlreset in particular can duplicate running: python manage.py sqlclear myapp python manage.py sqlall myapp reset served automatically run result of sqlreset on database. personally, think removing fantastic idea. still, if want similar functionality, can pipe output database's shell commands. for postgresql, example: python manage.py sqlclear myapp | psql mydatabase python manage.py sqlall myapp | psql mydatabase

Alter "Default" in SQL Server -

i have custom default value in sql server 2008 table. similar create default [dbo].[default_timestamp] getdate() now want change value in default. create default [dbo].[default_timestamp] getutcdate() before can edit existing one, need drop first 1 , recreate it. drop default [dbo].[default_timestamp] it gives following error. msg 3716, level 16, state 3, line 4 default 'dbo.default_timestamp' cannot dropped because bound 1 or more column. since default use few tables cannot drop , recreate new one. i know need unbind tables default before can recreate it. can provide script list table , columns bound default? it's multi-step process: 1) find object_id default : declare @defaultobjectid int select @defaultobjectid = object_id('default_timestamp') 2) find columns reference default: select columnname = c.name, tablename = t.name, unbindcmd = 'exec sp_unbindefault ''' + t.name + ...

python - Selecting columns in a pandas dataframe -

i have data in different columns don't know how extract save in variable. index b c 1 2 3 4 2 3 4 5 how select 'b' , 'c' , save in df1? i tried df1 = df['a':'b'] df1 = df.ix[:, 'a':'b'] none seem work. ideas thanks. the column names (which strings) cannot sliced in manner tried. here have couple of options. if know context variables want slice out, can return view of columns passing list __getitem__ syntax (the []'s). df1 = df[['a','b']] alternatively, if matters index them numerically , not name (say code should automatically without knowing names of first 2 columns) can instead: df1 = df.iloc[:,0:2] # remember python not slice inclusive of ending index. additionally, should familiarize idea of view pandas object vs. copy of object. first of above methods return new copy in memory of desired sub-object (the desired slices). sometimes, however, there index...

What does this git log mean? -

Image
this recent log of git. commit 608991c merge: 5c0c062 1fe65f9 author: foo date: mon jul 2 merge branch 'mybranch' of xxx.xxx.xxx.xxx:/myproject mybranch conflicts: bar.c does log mean user foo merge operation? as described in " merging conflict: conflicts , resolutions ", automatic log message generated after resolution of merge conflicts. you can see message built in git source file builtin/merge.c , in suggest_conflicts() function static int suggest_conflicts(int renormalizing) { const char *filename; file *fp; int pos; filename = git_path("merge_msg"); fp = fopen(filename, "a"); if (!fp) die_errno(_("could not open '%s' writing"), filename); fprintf(fp, "\nconflicts:\n"); from user point of view: resolve conflict after have resolved conflict (by changing readme file way want git merge), have tell git conflict resolved addin...

Magento: don't send tax to paypal/don't show tax in paypal emails -

i'm using magento 1.7, , 1 of payment options paypal (uk) express checkout. the problem don't want paypal send out emails tax breakdown on, there more straightforward way of solving (at magento or paypal end) rather hacking core module pass sub+tax sub , 0 tax? i can see lot of fields mapped in model/api/nvp.php, can't see i'd modify these values. as far investigated, there no easy configurable way prevent taxes submitted paypal. but indeed there core hack if don't mind total amount submitted (no line items, no taxes). go system/config/paypal , set transfer cart line items no . in code go function _validate() in class mage_paypal_model_cart . @ end of function add following lines: $this->_areitemsvalid = false; $this->_aretotalsvalid = false; of course nicer to rewrite class in app/code/local folder.

android - catch asynctask ANR -

my downloadfile asynctask may need quite time in case of concurrent downloads on 2g networks. suspect killed off not sure. my question is: timeout on asynctask , function called when android kills task? if exception thrown, catch it? android shouldn't kill task. asynctask that, asynchronous, android not throw anrs it. if want test exceptions within doinbackground, wrap code in relevent try catch blocks , throw or handle exceptions if , when arise. you can cancel asynctask must check @ relavent intervals within task iscancelled flag. once have cancelled task, onpostexecute() not called. further reading of course available here: http://developer.android.com/reference/android/os/asynctask.html addition: note, perhaps importantly android ice cream sandwich, , perhaps honeycomb shifted away thread pool execution default , use instead serialised approach. if find on ics tasks appear never executed, or executed after significant wait, should execute using execut...

ios - Sleep Command Not Working -

i have modal options on ipad app. when option selected want remove modal segue new screen. i want original screen (that launched modal) seen 2 seconds before new segue happens. why code not work? [self dismissmodalviewcontrolleranimated:yes]; sleep(2.0); [self performseguewithidentifier:@"normalpushsegue" sender:self]; this happens: when button on modal pressed freezes 2 seconds transitions extremely normalpushsegue screen. if put sleep command prepareforsegue still same thing. any ideas? there other ways delay segue? use performselector:afterdelay: instead: [self performselector:@selector(performseguewithidentifier::) withobject:@"normalpushsegue" withobject:self afterdelay:2];

android - adding values to listView -

i trying populate listview ....but cant add 2 string values database used in simplecursoradapter .... one, me code listview.java public class listview extends listactivity { sqlitedatabase messagedb; list<string> senderarray = new arraylist<string>(); list<string> bodyarray = new arraylist<string>(); string[] simplesenderarray = new string[ senderarray.size() ]; string[] simplebodyarray = new string[ bodyarray.size() ]; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_list); senderarray.toarray( simplesenderarray ); bodyarray.toarray( simplebodyarray ); messagedb=listview.this.openorcreatedatabase("message",0, null); //this database created , add sender , body values...here open database cursor cur=messagedb.rawquery("select sender, body tab2", null); while(cur.movetonext()) { string sender = cur.g...

c# - Watin, selecting html option list, generated by Javascript -

i'm having trouble selecting list mixed javascript. original code on page this: <select id="list_1" name="list_1"> <option value="">select..</option> <option value="val_1" >orange</option> <option value="val_2" >apple</option> <option value="val_3" >peach</option> </select> but when js file loads, modifies list , when view generated source, this: <div tabindex="0" style="-moz-user-select: none;" role="listbox" title="fruit" class="fruit-box k-select">select..</div> and watin cannot find listbox anymore.. i tried: browser.element(find.byid("fruit")).focus(); browser.element(find.byid("fruit")).click(); but didn't trigger dropdown list go down. tried request page gotonowait(); , use loop find list, before js loaded, modifies it: while ...

java - android event after landscape calculation -

i enabled onconfigchanges event , handling when device turns portrait lanscape. however, after onconfigchanges, when page calculated again , finishes it, event fired? thank you it says in documentation "some device configurations can change during runtime (such screen orientation, keyboard availability, , language). when such change occurs, android restarts running activity ( ondestroy() called, followed oncreate() ). restart behavior designed application adapt new configurations automatically reloading application alternative resources match new device configuration." [emphasis mine] however, if handle changes method gets called onconfigurationchanged() . changes wish make must in method, none of onx methods called. handling config changes you've told not destroy , reload app - thus, page doesn't calculated again. things happen define in onconfigurationchanged() method. "now, when 1 of these configurations change, myactivity not restart. inste...

IOS Facebook apprequests, without using the Facebook dialog -

i user user apprequests using: [facebook dialog:@"apprequests" andparams:params anddelegate:self]; this working, work around facebook dialog display custom view, , send nsurlrequest access token, uids , other parameters embedded in request. i have been trying debug sdk sent request, send via uiwebview, cannot debug it. i tried use web proxy debugger "charles" see http call request, encrypted, , if work around requesting @"http://m.facebook.com/dialog/" instead of https, following json response. {"error":{"message":"you must use https:// when passing access token","type":"oauthexception","code":1}} is there way directly send app request without using dialog? is there way directly send app request without using dialog? only app-to-user-requests, , these work if target user connected app.

debugging - Visual Studio 2010 - Debug DLL - Debug Command using rundll32 doesn't work -

i have problem debugging c++ dll project in visual studio 2010. while debuging want dll loaded rundll32.exe automatically. follow these steps (like here http://msdn.microsoft.com/en-us/library/c91k1xcf.aspx ): in solution explorer, select project creates dll. from view menu, choose property pages. in property pages dialog box, open configuration properties folder , select debugging category. in command box, type: "c:\windows\system32\rundll32.exe" in command arguments box type (main function executed): output.dll, main in working directory type: $(solutiondir)$(configuration) attach -> yes after following these steps, try debug dll, error: "unable attach. process "c:/windows/system32\rundll32.exe" not running on "my-pc", refresh process list before attempting attach." anyone know how debug dll, without manually starting rundll32.exe command prompt , manually attaching process? you should set: "attach -> n...

Jquery and asp.net masterpages -

i thought saw example allow use jquery asp.net , master pages didn't have have full name of object. for example, had label in master page. when view source name might "ct100_lblname". if reference in jquery, need use full ct100_lblname. thinking saw put in jquery made reference , use jquery magic , lblname. am way off here. shannon you can use "ends" selector: $("span[id$=lblname]") but should use "context" argument more accurate result, otherwise selector may return more objects expect. $("span[id$=lblname]", "#mydiv") http://api.jquery.com/attribute-ends-with-selector/

bash - Mount shares on a mac from batch files using net use -

i in mixed env , have been tasked mounting shares mac users using created batch scripts windows login. i have 2 main problems. trying read netlogon share in script on mac trying convert net use commands in scripts mac can use. i've spent of time working on part convert whole net use command usable mac. i started with: ifs=' ' arr=($(grep '\\' /users/tjguidry/desktop/tjguidry.bat | tr "[a-z]" "[a-z]")) with expected array being (based on file have): net use n: \\domain\dfs1\share1 /persistent:no net use r: \\domain\dfs1\share2 /persistent:no rem net use o: \\domain\dfs1\share3 /persistent:no rem net use p: "\\domain\dfs1\share4" /persistent:no the grep command supposed alone in terminal when output array, first slash in \domain gets cut off , shares start letter "a" (ie \domain\dfs1\admin) cuts off "\a" in output. instead get: net use n: \domain\dfs1\share1 /persistent:no net use r: \domain\d...

Perl convert image to base64 -

i using service send picture server , require image converted base64 format before sent. tried mime::base64 code: use mime::base64 (); open (image, "c:\\wamp\\www\\image.png") or die "$!"; $base64_string = image; $encoded = encode_base64($base64_string); print "encode $encoded"; and got error message undefined subroutine &mqin::encode_base64 called @ line 6. when specify empty import list, this: use mime::base64 (); you no imports. change line to: use mime::base64; the () parens specifying mime::base64 exports nothing namespace. default behavior (without parens) export encode_base64 , decode_base64 . you're overriding convenient default. if don't want functions polluting main namespace retain original use mime::base64 () line, , fully-qualify subroutine call: $encoded = mime::base64::encode_base64($base64_string); but it's whole lot easier, , satisfactory allow default export list processed removing...

shell - Parsing the required field from an URL in awk -

i have requirement parse required field url. purpose need traverse url letter letter since there no space separation between words . not able . have tried below awk '{fs = "";for (i = 2; <= nf; i++) {print $i}}' file the file contains https://stackoverflow.com/questions/ask/submit?s=sddasdsadsomefield=8171 wantedfield=121212 somefield=1201212... so idea traverse url letter letter , reach required field .. not able that. suggestions please this work, assuming pattern = , *. echo "http://stackoverflow.com/questions/ask/submit?s=sddasdsadsomefield=8171*wantedfield=121212*somefield=1201212..." |awk -f "[*=]" -vfieldname="wantedfield" '{for (i=1;i<=nf;i++){if(match($i,fieldname)){printf "%s\t", $(i+1)}};printf "\n"}' output: 121212 changing somefield target field: echo "http://stackoverflow.com/questions/ask/submit?s=sddasdsadsomefield=8171*wantedfield=121212*somefield=12...

validation - Javascript: Need help validating two aspects of a form, which will then enable the SUBMIT button -

my name romano , i'm looking guidance on form validation process. have registration form has validation process against username field , terms , conditions checkbox. the validation have against checkbox easy: <script type="text/javascript"> function apply() { document.frm.sub.disabled=true; if(document.frm.chk.checked==true) { document.frm.sub.disabled=false; } if(document.frm.chk.checked==false) { document.frm.sub.enabled=false; } } </script> and form field calls function: this works fine. i have block of javascript code validates username meets minimum requirements , ensures not exist in database. block of code larger, , looks this: <script type="text/javascript"> $(document).ready(function() { $("#username").change(function() { var username = $("#username").val(); if(username.length > 5)//if lenght greater 5 characters { $("#availability_status").html('<img src=...

How is a pointer stored in memory? -

i working on os project , wondering how pointer stored in memory? understand pointer 4 bytes, how pointer spread amongst 4 bytes? my issue is, trying store pointer 4 byte slot of memory. lets pointer 0x7fffffff. stored @ each of 4 bytes? the way pointer stored same other multi-byte values. 4 bytes stored according endianness of system. let's address of 4 bytes below: big endian (most significant byte first): address byte 0x1000 0x7f 0x1001 0xff 0x1002 0xff 0x1003 0xff small endian (least significant byte first): address byte 0x1000 0xff 0x1001 0xff 0x1002 0xff 0x1003 0x7f btw, 4 byte address 32-bit system. 64-bit system has 8 bytes addresses. edit: reference each individual part of pointer, need use pointer. :) have: int = 0; int *pi = &i; // pi == 0x7fffffff int **ppi = &pi; // above example, int ppi == 0x1000 simple pointer arithmetic pointer each byte.

google apps script - Automatically Redirecting to a Page -

inside button click handler, i'm creating new web page so: var page = sitesapp.getpagebyurl(url).createpagefromtemplate(title, name, template); and want redirect user automatically page. i wasn't able find information, can done? this cannot done in uiapp it's doable in htmlservice: function doget() { return htmlservice.createhtmloutput( "<form action='http://www.google.com' method='get' id='foo'></form>" + "<script>document.getelementbyid('foo').submit();</script>"); } this should easier; please file feature request in issue tracker , see how can make more pleasant. (edit: clear, there's no way uiapp callback; entire app have using htmlservice work.)

Create Parent Thread in java -

often create child threads within main() thread thread = new thread(new runnable(){public void run(){}}); likewise, possible create parent threads ? runtime.exec() ? see: how create process in java i think we're not sure mean "parent thread" though... from coderanch.com: http://www.coderanch.com/t/475322/threads/java/parent-thread-id except thread created jvm start application, every thread created other thread. have decided call "parent thread"; isn't concept of java language, though.

Is there a simple C or C++ library for transcoding FLAC to MP3? -

right now, i'm taking easy way out in command line program calling on flac , metaflac , lame binaries, , of course, requiring installed. i prefer use library avoid dependency. find documentation of libflac, lame, , ffmpeg insufficient , programming them not intuitive. related questions here @ stackoverflow receive terse answers referring libraries. are there other options? take @ gstreamer library. may have want.

javascript - Appcelorator Titanium Studio won't run iOS simulator or allow me to select iOS as target OS -

Image
i having trouble developing ios titanium studio. (i working on mac running snowleopard.) tried follow tutorial ( https://wiki.appcelerator.org/display/guides/quick+start#quickstart-helloworld%21 ) , can stage: under "deployment targets" ipad, iphone, andriod, , blackberry grayed out , option mobile web. (basically opposite of picture). then when go run app instructed (see image below) option "mobile web preview in browser", opens firefox, or "run configurations" ios still unavailable. on titanium dashboard, there icons ios , android have question marks on top of them. when click on ios, says can't find ios sdk , prompts me download xcode app store. however, when go this, unable because system old new xcode. also, if turns out ios simulator can't work on machine, still cant figure out how export project mobile app. (lol) thanks help. hope made sense. quinn you have specify ios sdk located on machine in order titanium ...

replace plain-text with html using jQuery -

i'm trying write replacewith function in jquery replace specific words html. basically i'm trying replace [this] <span class='myclass'> document loaded. i've looked around couple samples couple things saw unable work. i'm still learning jquery i'm hoping give me couple suggestions try. thanks in advance, steven. html/text: [this]hello world![/this]​ javascript: $(document).ready(function() { // using replace $("body").text().replace(/[this]/g,'<b>') });​ --edit-- i've made few changes function using nir's demo below. heres few more details i'm doing. i'm trying make inline fraction, have the appropriate classes , whatnot made. works when in html, when run jquery function doesn't seem work. it's obvious tags replaced, css doesnt seem working mentioned. heres link html here and heres link jsfiddle here $(document).ready(function() { // using replace var text ...

Can't get templates to work in Django -

i'm following tutorial (http://lightbird.net/dbe/cal1.html) build calendar app, can't templates work correctly. i made directory named cal in project/templates , copied base.html there. extended template cal/main.html following: {% extends "cal/base.html" %} <!-- ... --> <a href="{% url cal.views.main year|add:'-3' %}">&lt;&lt; prev</a> <a href="{% url cal.views.main year|add:'3' %}">next &gt;&gt;</a> {% year, months in years %} <div class="clear"></div> <h4>{{ year }}</h4> {% month in months %} <div class= {% if month.current %}"current"{% endif %} {% if not month.current %}"month"{% endif %} > {% if month.entry %}<b>{% endif %} <a href="{% url cal.views.month year month.n %}">{{ month.name }}</...

r - Transpose / reshape dataframe without "timevar" from long to wide format -

i have data frame follows below long pattern: name medname name1 atenolol 25mg name1 aspirin 81mg name1 sildenafil 100mg name2 atenolol 50mg name2 enalapril 20mg and below (i not care if can columns named way, want data in format): name medication1 medication2 medication3 name1 atenolol 25mg aspirin 81mg sildenafil 100mg name2 atenolol 50mg enalapril 20mg na through site have become familiarish reshape/reshape2 package, , have went through several attempts try work have far failed. when try dcast(dataframe, name ~ medname, value.var='medname') bunch of columns flags of medication names (values transposed 1 or 0) example: name atenolol 25mg aspirin 81mg name1 1 1 name2 0 0 i tried dcast(dataset, name ~ variable) after melted dataset, spits out following (just counts how many meds each person has): name medname name1 3 name2 ...