Posts

Showing posts from February, 2014

windows - regarding the itunes com sdk, is there a way to load files to an application -

example - there free application called stanza - when idevice connected, can load files application through itunes makes them accessible in application after disconnecting. enable automated upload of documents, example, using itunes com interface on windows have been unable find way in sdk documentation. thoughts, hints, or clues welcome. open xcode select info.plist of project add new entry , write application support itunes file sharing autocomplete feature when begin write , set bool value yes build , run!! now every time connect device itunes able upload files app , download files app good luck

ms access - How do you overwrite a table created in VBA? -

i'm creating table in vba within loop , when run code table created. next time run it, error comes telling me table exists , remainder of code not executed. how can have overwrite existing table (from previous run)? here code: option compare database public function createtables() dim db dao.database dim tdf dao.tabledef dim rst dao.recordset dim fld dao.field dim strsql string strsql = "select skus skus" set db = currentdb() set rst = db.openrecordset(strsql) set fld = rst.fields("skus") 'msgbox fld.value rst.movefirst while not rst.eof set tdf = db.createtabledef(fld.value) set fld = tdf.createfield("skus", dbtext, 30) tdf.fields.append fld set fld = tdf.createfield("count", dbinteger) tdf.fields.append fld db.tabledefs.append tdf rst.movenext loop end function can me out please? thanks! i delete table

iis - Sitecore crashing application pool when using Security Editor on a specific role -

starting today, whenever try , use security editor on either of 2 similar roles timeout. if try again iis reaches error threshold of kind , stops application pool. of our users receive "service unavailable" message iis. i can edit other roles. error can recreated. i assume have kind of database corruption, can't find error helps me in event viewer or sitecore logs. else can more detail? iis6, windows server 2003, sitecore 6.2 it sounds me you've got circular reference in roles. are using default role provider, asp.net membership? if so, try using default microsoft security tools (you can @ 'em via visual studio). if doesn't work, can programmatically modify these roles using api. also, believe there known issue may fixed in 6.2.x update. check change list @ sdn. here: http://sdn.sitecore.net/products/sitecore%20v5/sitecore%20cms%206/releasenotes/changelog.aspx yep... take @ 6.2.0 rev 100701 update list.

Rewriting my app from ruby/rails to javascript/express. Will mongodb suit my needs? -

my rails 3 database schema.rb looks this: activerecord::schema.define(:version => 20110504034934) create_table "comments", :force => true |t| t.string "name" t.text "content" t.integer "post_id" t.datetime "created_at" t.datetime "updated_at" t.string "ancestry" end add_index "comments", ["ancestry"], :name => "index_comments_on_ancestry" create_table "posts", :force => true |t| t.string "name" t.string "title" t.text "content" t.integer "topic_id" t.datetime "created_at" t.datetime "updated_at" end create_table "topics", :force => true |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end end the additions database user-related via openid. ca

c# - VS2010 Extensibility: Custom document formatting -

good afternoon, i've created visual studio package registers verilog language valid content type. i've got syntax highlighting, outlining, smart indenting, etc working. however, able visual studio automatically format entire document via edit->advanced->format document/selection . these options invisible, , expect have let vs2010 know (somehow) these methods can called, , provide correct methods formatting. i can't seem find reference formatting in vs2010 sdk , documentation. hoping ismartindent solution looking for, seems code runs on empty line, or when enter key pressed. does have tips or ideas on how can solve problem? thanks, giawa edit: i'm using managed extension framework introduced vs2010 accomplish this. i'm writing in c# (and added c# tag question). thanks mef not right way accomplish task of creating language service. instead, managed package framework (mpf) should used register language service , perform task

windows 7 - Dropping Packets By IP With C++ -

i'm writing program in c++ sniffs packets , compares them table ip address. ike know how "drop packet" if not meet criteria setup. done, sniffer, criteria. need know how drop packet... windows 7, visual studio 2010. in general, packet sniffers don't modify underlying stream, observe it. it sound want sort of transparent proxy. however, should post sample code or more details on doing, since have no idea how implemented anything, , can't offer suggestions.

vb.net - Merging data from dataset into existing DataGridView formatted Column Schema? -

i have setup datagridview in visual basic 2010 express text , buttons. buttons different functions. 1 button give user action , other button provide pop-up list select additional items stored out other datatables. i'm interacting sql server database retrieve data populating datagridview. way bulid data cycle through rows in returned dataset , explicitly add rows datagridview rather binding? when try set datasource , datamember, end additional columns tacked on ones formatted. in other words, have "sample type", "qty", , "packages" setup on 1 datagridview. packages button causes popup list show available packages. qty text entry box user enter quantity of samples. "sample types" list populated external data source. the next datagridview more complex, if can 1 figured out, feel can tackle 1 no problem, since similar. thanks!

php - Need Help Formatting with the code -

ok have been dying on page...the code below...if can visit , see not formatting right...i wanting format in way in line , not jumbled is...what change in code below... where 1 properity below other...u see when @ site http://ampmproperties.com/listing-of-properties-available <style> #para1{ text-align:center;} .bdr_blb{ border:#000000 solid 4px; height:70px; background:#cccccc; text-align:center; font-size:14px; font-weight:700;} .light32{ font-size:32px;} .bggrey{ background:#cccccc;} .light18{ font-size:18px;} #bedroom4{ background:#cccccc; } .heading_div{float:left;} .entry-content{float:left;} .thumnail_col ul li { float: left; list-style: none outside none; margin-right: 15px; } .thumnail_col ul li img{background:none; border:none;} </style> ?> <div id="container"> <div id="" role=&quo

dependencies - Points-to analysis - A definition -

i'm looking perform dependence analysis using call-graph build using soot framework. read in guide using 'points-to' analysis can improve precision of call graph. 'points-to' analysis , how improve accuracy of call-graph? a key problem in understanding data flow know date each pointer can reference. if know nothing pointer object, , object updated via pointer (e.g., p.=3) possible object in entire system might modified. if know p references specific object o1, know o1 might modified. knowledge of p can point to, important in understand side effects , scope of such effects. now, imagine have pointers functions. if don't know function pointer p points to, , function call made indirectly through p, function might called, , side effects side effect function. if know p can point foo, side effects foo might cause can occur. when computing call graph, function calls go 1 place. function calls can go variety of places because in fact function call

html - javascript form validation, before submitting help? -

i have following form: <select name="size"> <option value="">please select</option> <option value="1">medium</option> <option value="2">large</option> </select> <select name="material"> <option value="">please select</option> <option value="9">wood</option> <option value="8">metal</option> </select> <input type="submit" value="submit"> i creating javascript, when above form submitted form verified values have been selected, , gets submitted. if values have not been selected alert popups saying either of following: "size needs selected , material needs selected", "size needs selected", or "material needs selected" thanks $("form").submit(function(){ if ($("#size").val() == "&quo

ajax - How can I make h:inputText appear only after button clicked in JSF2.0? -

in jsf2.0 how can make <h:inputtext> appear after specific button clicked? want <h:inputtext> hidden, , appear after click button could use css "display: none" attribute on inputtext and, in button onclick attribute, change "display: block". more simple solution.

html - Text on top of lines -

i trying text show above horizontal lines. try might text show underneath. here code http://jsfiddle.net/mrchin/utsxz/ can see need do? i've done layout in flash , still learning css. appreciated. positioning text relatively seems work: #txt_projects { position: relative; }

xml - Update iPhone app info without going through apple -

i wondering, have little experience making iphone apps no coding background in , wondering.... there way update iphone app new text, pictures, colors, links, etc. without manually doing xcode having new version approved apple. i hoping able update possibly website. easy way this? preferably easiest solution. in advance there is, have design application start. instead of reading app itself, app reads content management system (cms) or text file stored on website. many apps work way, need design app in mind.

android - Drawing lines between to points on a map? -

i have 2 markers on map. code found on the developer site here. want draw line in between 2 points. have no idea done here. if example or tutorial site on great -thanks this question looks answers question drawing line between 2 points since markers set using geopoints assume work you

html - When "viewing source", some sites have neat markup, some sites don't. Why? (pic attached) -

Image
notice how in 'ugly' side, doctype way indented , of meta lines extend past left indent. how can markup looking neat when viewing source in browser? there way encode code while using editor? use notepad++ way. large blocks of unindented code see in left hand side being written out server side, , although tag creates them nicely indented in html erver script output not honour that.

oop - PHP private const -

i have class benefits use of constants in internal implementation, limit visibility of these constants. why doesn't php permit private constants? there way achieve or php trying discourage type of design misstep ignorant of? use private static properties. in case have same variable throughout objects , if want extend it's scope nested can expose getter method value , restrict variables settings.

JQuery // After delete id event not trigger -

i have datagrid have cell quantity , 1 price label @ end showing result (price * qty). that's work perfectly. can delete row , thats when stop working. this code http://jsfiddle.net/bizonbytes/sywpy/24/ to replicate problem: enter numbers in each rows (you see result of price * qty) then delete row 2 now go row 1 , change value , see result if on row 3 won't work so question why row 3 stop working. as business req need rename id's 1 , 2 , not leaving them 1 , 3 html is: <div class="row_table row_service_table" id="service_row_1"> <div class="cell celldata cell_service_data"><input type="text" class="quantity_row" id="quantity_row_1" rel="1"/></div> <div class="cell celldata cell_service_data"><input type="text" class="price_row" id="price_row_1" rel="1"/></div> <div class=&qu

javascript - How to process groups of duplicate fields and organize by common field key - PHP / Array -

looking mimic what's going on on website can add multiple field groups: when click "add card", duplicates field -- i've got covered jquery , clone() . however, if input 2 gift cards same amount, on next step they've combined quantities gift cards 1 group. here's scenario i'm facing , output see: user input: field group 1 -- amount: $100 quantity: 1 field group 2 -- amount: $75 quantity: 2 field group 3 -- amount: $100 quantity: 1 desired output on next page: $100 gift card group: 2 $75 gift card group: 2 i've been searching different ways , can't find anything, please help!! for inputs, use names denomination[], quantity[], since processing arrays. on next page, print_r() on $_post, , can foreach() loop combine quantities of same denomination. now, suppose $foo our (cleaned up) $_post. please perform pre-processing loop clean inputs; e.g. discarding invalid denominations/quantities required. once done, end $foo like:

email - amazon ec2, postfix, SES set up? -

i'm trying set ses(simple email service) aws. (followed instruction on http://pandali.com/cgi-bin/pforum/pforum.pl?num=1297885604/2 ) in nutshell, seems i've sent request email amazon.(no error msgs) amazon supposed send email abc@example.com. check /var/mail, nothing there. i suspect it's because domain name (example.com) not set correctly? or postfix not set correctly my postfix's main.cf : smtpd_banner = $myhostname esmtp $mail_name (ubuntu) biff = no append_dot_mydomain = no readme_directory = no smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache myhostname = a.example.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = example.com mydestination = example.com, ip-10-212-82-**.ec2.internal,

Error creating Java Date in php -

im trying create php function converts string date java date pass java. need use java.sql.date not java.util.date application. simple function giving odd result: function makestrjavadate($date){ $date = date_parse($date); $date = new java("java.sql.date",$date['year'], $date['month']-1, $date['day']); return $date; } the date java returned has wrong year: php (for 2011-07-01), java(jul 1, 3911). any pointers whats wrong? fyi, php parsing correctly: array ( [year] => 2011 [month] => 7 [day] => 1 [hour] => [minute] => [second] => [fraction] => [warning_count] => 0 [warnings] => array ( ) [error_count] => 0 [errors] => array ( ) [is_localtime] => ) evidently, it's considering year start @ 1900. subtract 1900 when pass year.

haskell - xmonad help. Which is my Mod key? -

i'm using config file https://github.com/artificialbeing/xmonad-conf/blob/master/xmonad.hs i've recompiled haskell doing xmonad --recompile then did m-q (where m alt) restart xmonad. there no errors , i'm pretty sure config set up. however, alt doesn't seem mod key anymore. when press alt+shift+return, don't new terminal screen. can me figure out key mod? the relevant bit modmask = mod4mask ; on setups, mod 4 "windows" key.

objective c - iPhone: Where is my Sqlite database? -

i can't find sqlite db. i'm using 4.1 simulator. all tutorials it's @ /users/<username>/library/application support/iphone simulator/4.1/applications/<app>/documents . there's nothing there. how create new 1 code? see .sqlite file here? in code doing this: int result = sqlite3_open("/myapp.db", &database); if(result != sqlite_ok) { sqlite3_close(database); nslog(@"failed open db"); return; } else { nslog(@"opened db"); } i proceed create table, , query , both of them succeed. yet, can't find sqlite file it's putting data at. where possibly be? below there 2 function first 1 copy database if not in app during installing in ur emulator. 2.second function path of database. these 2 functions must call in - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions delegate function in yourappdelegate.m database copy application folder

c# - How do I integrate Fedex into my asp.net application? -

how integrate fedex asp.net application. there dll available fedex. googled couldn't find dll. new @ integrating payment gateway, shipping etc. initial steps should take? thanks in advance:) fedex's development gateway should have resources need. if trying create payment gateway though, not beginner's stuff. i'd suggest serious googling on how that.

How can I do OCR in Java? -

we have taken .jpg file of text. , want create separate .jpg segment files of each character in text. how possible in java? you can start these 2 links: http://www.roncemer.com/software-development/java-ocr and http://code.google.com/p/tesseract-ocr/

check if an input field is selected using javascript or jquery -

how can check if input field selected or not, using javascript or jquery ? any appreciated! thanks! some googleing found quick solution. from http://forums.digitalpoint.com/showthread.php?t=77983 there's no built-in way; have use onfocus , onblur events set form of flag each element read. this script automates process number of forms: code: <script type='text/javascript' > /* (c)2006 stephen chalmers * * appends 'hasfocus' flag text/textarea form * elements. * insert script anywhere below last form in document. read current focus state of specified element, use: if( document.forms.myform.myelement.hasfocus ) ... ***/ for(var i=0, df=document.forms, len=df.length; i<len; i++) for(j=0, els=df[i].elements; j<els.length; j++) if( /^text/.test( els[j].type ) ) { els[j].hasfocus=false; els[j].onfocus=function(){this.hasfocus=true;}; els[j].onblur =function(){this.hasfocus=false;}; } </script>

error handling - sql select string coming before space dash space -

select string coming before space dash space say table 1 id | name 1 | poo - sr 2 | s-h-r - sr 3 | sdr - mj 4 | srk - kl i want like id | name 1 | poo 2 | s-h-r 3 | sdr 4 | srk use replace function in sql? example :select replace('abcdefghicde','cde','xxx');

Communication methodology to connect Desktop to Android with out internet connection -

i wanted communication between desktop android device out internet connection. kindly 1 suggest me possible , best methodology so. as per knowledge please find below : 1) wifi 2) blutooth 3) socket programming but dont know best methodolog. thanks , regards, dhaval

php - Check if number is decimal -

i need check in php if user entered decimal number (us way, decimal point: x.xxx) any reliable way this? you can of want is_float , if really need know whether has decimal in it, function above isn't terribly far (albeit wrong language): function is_decimal( $val ) { return is_numeric( $val ) && floor( $val ) != $val; }

java - making a method thread safe even when method is called by makeing multiple instances of class -

i want have thread save method returns unique current timestamp.even when method called same time want unique current datetime.even if method called making multiple instances of myclass want be thread safe always class myclass{ date getuniquetimestam(){ synchronized(myclass.class){ //return date here } } now if make 2 instances of myclass , call getuniquestam @ same ,is gaurented return uniue date time. no, not guaranteed. if computer fast enough both method calls can happen in same millisecond , produce identical date object. you have 2 options here: use uuid instead of date. read more here . uuid specification guaranteed unique each time generate - it's safest , easiest option can get. store date object, synchronize on it, , check if it's same. here's example: . class myclass { //static make possible synchronize between instances of myclass static date lastdate; date getuniquetimestamp() { synchronized (mycl

asp.net mvc 3 - IgnoreRoute not working for PIE.htc -

i've been search long time , can't seem find mistake. mvc 3 website, need buttons rounded edges, in ie stylesheet register pie.htc. problem when button clicked, pie.htc offered user download when redirecting urlreferr view. implemented pie described here: css3pie in mvc, place pie.htc file? the following routes should ignored: routes.ignoreroute("pie.htc"); routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.ignoreroute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); resource , favicon work, pie.htc seems ignored. ideas why?

silverlight - Visifire inquiry -

i created pie chart using visifire in silverlight. there way customize size of pie itself? here code: <visifire:chart.titles> <visifire:title fontsize="12" text="{binding graphname}" margin="0,10,0,0" /> </visifire:chart.titles> <visifire:chart.series> <visifire:dataseries renderas="pie" labelenabled="false" bevel="true" shadowenabled="true" cursor="hand" yvalueformatstring="'$'######.## " lightingenabled="false" bordercolor="darkblue" borderthickness=".24" showinlegend="true" includepercentageinlegend=&q

Determine current position of element positioned with jQuery Sortable plug-in -

Image
i use jquery ui sortable plug-in move elements on page. elements divided 3 columns , 3 rows. when move object, want know position of element (first row-first column, first row third column, etc.). here's example: jquery ui sortable plug-in when move element, sortchange event fired. second parameter of event contains information element moved. property you're looking .offset , gives position of element moved. row, divide ui.position.top height of the element , add one. column, divide ui.position.left width of the element, , add one. demo: http://jsfiddle.net/thinkingstiff/bfzsj/ script: $( "#sortable" ).sortable(); $( '#sortable' ).bind( 'sortchange', function( event, ui ) { var width = event.target.clientwidth, height = event.target.clientheight, top = this.offsettop, left = this.offsetleft; document.getelementbyid( 'position' ).textcontent = ' row: ' + math.floor( (

python - parameter transferring in the wmi -

hello have problem understanding piece of code: import wmi c = wmi.wmi () process_id, return_value = c.win32_process.create (commandline="notepad.exe") process in c.win32_process (processid=process_id): print process.processid, process.name result = process.terminate () i can't understand (commandline="notepad.exe") how mechanism working? , can find definition of commandline in advance help it sent part of **kwargs of def new (self, **kwargs): can see in wmi.py . convention microsoft has defined process creation , can find in msdn documentation .

Git merge/cherry-pick issue -

i using git large legacy project has 2 branches - v1.0 , v2.0. source each branch different in places, identical in others. when make bug fixes v1.0 branch have add them v2.0 branch using git cherry-pick git merge 1.0 trash large parts of v2.0 source. however, new development has stopped on v1.0 , using git cherry-pick copy fixes v2.0 branch cumbersome. prefer somehow able tell git when git merge 1.0 -> 2.0 merge starting specific point in 1.0 commit history (i.e. when new development stopped). possible? allow me make multiple fixes v1.0 source , merge changes v2.0 in 1 hit instead of using multiple cherry-picks. from 2.0 branch execute git merge --strategy=ours v1.0 i didn't tested myself try first on not important, docs need. from documentation: this resolves number of heads, resulting tree of merge of current branch head, ignoring changes other branches. meant used supersede old development history of side branches. note different -x

configuration - Cruise Control Build report formatting -

i have setup cruise control build server , working fine. it's in build report shows warnings "red" color meaningless project. is there way configure report generation logic , format color of warnings "grey", or other "red". more intuitive users of build report. please suggest. thanks interest. closing issue. achieve modifying cruise control style sheet warning.

jquery - Why this event is not fired on fiddle? -

this code! don't know why addtrack not recognized : <input type="submit" onclick="addtrack(this);return false" value=" add "> function addtrack(param) { alert("ciao"); } error : uncaught referenceerror: addtrack not defined set script insertion mode no wrap (head) instead of onload , work expected. updated fiddle here .

java - How can I place limits on my canvas's translation matrix? -

so i'm extending custom surfaceview , attempting make have pinch-zoom , scrolling capability. how scroll: @override public boolean onscroll(motionevent e1, motionevent e2, float distancex, float distancey) { // subtract scrolled amount matrix.posttranslate(-distancex, -distancey); rebound(); invalidate(); // handled return true; } how zoom: @override public boolean onscale(scalegesturedetector detector) { if (detector.isinprogress()) { // scale float factor = detector.getscalefactor(); // don't let object small or large. if (factor * scale > 1f) { factor = 1f / scale; } else if (factor * scale < minscale) { factor = minscale / scale; } // store local scale scale *= factor; // scale matrix.prescale(factor, factor, de

c# - Expired session on a website using callbacks -

i have aspx.cs page use callback connect server side. after website starts running, if work on page several minutes, session has been expired. have used callback , haven't used postback. think session has expired because it's not arising postback, web site callback based , never use postback. how can resolve expired session problem? by callback assume mean ajax calls page. these normal http calls , carry browser session cookie normal postback. therefore session should stay alive. however, in debug mode appdomain recycle after 15 dynamic compiles, , if using inproc session state, session lost. you can increase number of compiles before appdomain recycle using <compilation numrecompilesbeforeapprestart="1000" /> element in web.config . i recommend use sqlserver mode session state, sql-stored sessions survive appdomain recycles / server reboots / load-balanced server switching etc.

mvvm - Best way to Windows application development using C# + WPF + MVVC + prism 4? -

i little bit new in .net + c# + wpf + mvvc + prism 4 . i going create 1 windows application using c# , wpf. i think it's using mvvm + prism 4. but be-four start working, want know few think which best project solution structure c# + wpf + mvvc + prism 4 . can give reference this. which best way create project solution structure. which best way exception handling if 1 know linq, is linq suitable wpf + mvvc + prism 4. linq extended library development. any existing or 3'rd party library development microsoft enterprise library any suggestions different tool,framework,design patterns. ...etc any reference/help site links thanks in advance i suggest path followed. download prism, go through samples (quickstarts in zip file) , read documentation (prism4.chm). once graduate samples, have @ "stocktrader ri" comes prism itself. once settled little bit, can start working on structure of solutions suits best

winforms - Combo box is not displaying default value in DataGridView in C# -

i'm trying allow user select value datagridviewcomboboxcolumn each new row. i've bound combobox in gridview database, whenever enter new row see datagridviewcomboboxcolumn no initial value. have set value first. how can let default value appear in datagridviewcomboboxcolumn whenever enter new row in datagridview ? this how i'm binding datagridview combobox database : bindingsource1.datasource = itembal.gettable(); datagridview1.datasource = bindingsource1; itemname.datasource = bindingsource1; //where itemname instance ofdatagridviewcomboboxcolumn itemname.displaymember = "name"; itemname.valuemember = "itemid"; you can use defaultcellstyle.nullvalue , defaultcellstyle.datasourcenullvalue properties of combo box column. there quite comprehensive msdn article on here . i've given code example below: // let's have list of cars want add datagridview list<car> cars = new list<car>(); cars.add(new car() {

android - I have problem in a emulator -

i have problem in emulator. when start application says: panic: not open: c:\users\administrator\.android/avd/monodroid.ini what can solve this? create environment variable called: android_sdk_home , set c:\users\administrator open eclipse > window > preferences , click in run/debug , string substitution add new variable called: user.home , set c:\users\administrator restart eclipse. create avd , run it. it should work now.

ios - IPAD xml parsing with attributes deal -

<category name="local"> … … … <category name="business"> … … … <category name="politics"> … … … this xml file, i'm not sure how deal attribute using nsxmlparser. question how deal above attributes in nsxmlparser. please me. in advance. you should have @ parser:didstartelement:namespaceuri:qualifiedname:attributes: . names in attributes dictionary. edit: if following doesn't you, should read introduction stuff. - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict { if ([[attributedict objectforkey: @"name"] isequaltostring: @"local"]) { nslog(@"found category name local"); } }

stdout - bash - redirect specific output from 2nd script back to stdin of 1st program? -

i have little program, let's call "program" simplicity has "normal" behaviour. takes information stdin (normally typed in user in keyboard) , prints out via stdout/stderr. want automate process , therefore redirect stdout/stderr "my little bash script" (which program in c/c++). takes it's standard input , filters it. means leaving out unimportant information.. , adding further information generated bash script itself. output shown on sreen (printed out echo command). this working far: program --verbose 2>&1 | ./mylittlebashscript.sh scheme: stdin +---------------+ +---------------+ --------->| |--stdout--+-->| |-->screen | program | | | little | | |--stderr--| | bash script | +---------------+ +---------------+ now want go 1 step further: program expects input user want give automatically

php - Getting flickr thumbnail -

i'm trying thumbnail of flickr pictures in php. all saw in api: http://www.flickr.com/services/api/misc.urls.html which overkill. in instagr.am/twitpic , others found easy way of doing (just adding url request). is there option flickr i'm missing? if have url flickr image, have modify suffix different size of photo. example: http://farm1.staticflickr.com/2/1418878_1e92283336_m.jpg this url loads medium sized photo. if change _m _t , thumbnail: http://farm1.staticflickr.com/2/1418878_1e92283336_t.jpg you can use s small, z medium, , b large.

php - Copy an Image with Drop Shadow and Tranparent Background -

i tried duplicate png image, has drop shadow (i.e. alpha channel) , transparent background. however, resulting image paints shadow , transparent background black. tried imagecopy , imagecopymerge ; neither yielded valid results, aren't same original image. preview of images. $src = imagecreatefrompng('img_box3-bg.png'); /* using imagecopy. */ $dest = imagecreatetruecolor(116, 100); imagecopy($dest, $src, 0, 0, 0, 0, 116, 100); imagepng($dest, 'img_box3-bg.imagecopy.png'); imagedestroy($dest); /* using imagecopymerge. */ $dest2 = imagecreatetruecolor(116, 100); imagecopymerge($dest2, $src, 0, 0, 0, 0, 116, 100, 100); imagepng($dest2, 'img_box3-bg.imagecopymerge.png'); imagedestroy($dest2); imagedestroy($src); help? beforehand. something this: $src = imagecreatefrompng('img_box3-bg.png'); /* using imagecopy. */ $dest = imagecreatetruecolor(116, 100); // new imagesavealpha($dest, true); $transparent = imagecolorallocatealpha($

selenium - Not able to click the button after entering value in textarea Options -

code used is: webelement desc=driver.findelementbyxpath(".//*[@label='description']"); desc.sendkeys("testing"); desc.sendkeys(keys.enter); list<webelement> button=driver.findelementsbyxpath("(//div[@id='sv'])[1]"); (webelement buttonname : button) { system.out.println("buttonname: "+buttonname.getattribute("id")); string = buttonname.getattribute("id"); driver.findelementbyid(but).click(); } below html code of textarea , button . <td> <textarea id="1992800000" label="description" ft="12" mand="false"class="ic" maxlength="120" cols="13" rows="2"/> </td> ...... <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 40px; "> <td class="pdl"> <div class="tbut" onclick=&q

python - psycopg - Get formatted sql instead of executing -

i have piece of python code, interacts postgresql database via psycopg. all literature warns against doing sql formatting oneself, , recommends letting driver it. e.g.: cur.execute('select name, age people name = %s;', ('ann',) ) the driver formats sql string. let's don't want execute anything, want formatted sql string. there functionality getting formatted sql in psycopg module? you wold use function curs.mogrify(): sqlstring = curs.mogrify('select name, age people name = %s;', ('ann',) )

asp.net - C# listview paging question -

in listview, if want use paging feature, how can increase amount of rows shown each page? increase current rows form 10 35. if talking asp.net use datapager control allows set common paging properties(pagesize,etc) http://thibautvs.com/blog/?p=718 http://www.4guysfromrolla.com/articles/021308-1.aspx

IE9 control keyboard buttons -

i trying make form submit tab button. it working on ff, ie8, on ie9 cannot stop default action. i found answer here: how convert enter tab (with focus change) in ie9? worked in ie8 but cannot implement it. could explain "fix" ie9 should add script work. thank you function checkcode(e) { var keycode; if(!e) e = window.event; if(e.keycode) keycode = e.keycode; else keycode = e.charcode; if(keycode == 9 || keycode == 13) { e.preventdefault(); //problem here alert(keycode); return false; } else return true; } problem in ie onkeypress not return keycodes ctrl, shift or tab, onkeydown done trick.

php array index extraction -

i created array dynamic like: $tmp = array ( array("name" > "rob"), array("name" => "bla")); now wand search "index" in array (with elemnt) name = "rob" like : give me index array key "rob", answer should 0, index key "bla" sould 1... is possible to without or foreach function ? standard php function ? thanks answer. $index = array_search($key, array_map(function ($item) { return $item['name']; }, $tmp)); requires php5.3 or can use array_keys() (works in pre-5.3 too) $indexs = array_keys($tmp, array('name' => $key)); $indexs array now, because there can of course more 1 index value array('name' => $key) within $tmp

ios - iPhone: duplicate symbol _SBJSONErrorDomain -

i want use brightcove library , layar library in 1 application, both have sbjson files. these try murder each other dead. do have extract files , rebuild archives? i'm on tight deadline. just remove 1 of duplicate files target

Loop over GqlQuery Fields, App Engine, Python -

i want output attributes , values of following gqlquery: benchmarks = db.gqlquery("select * benchmarks") what's easiest way loop on gqlquery , output names , values generically? to more precise, not want this: benchmarks = db.gqlquery("select * benchmarks") b in benchmarks: self.response.out.write("<td>name:%s</td>" % b.name) self.response.out.write("<td>id:%s</td>" % b.id) but rather have properties of benchmark displayed, independent of name. thanks advice!

Print invoice pdf of pending orders in magento -

i want print invoice of both pending , complete status orders in pdf.but right prints complete status orders invoice only. how can change it. this line line found under app/code/core/mage/adminhtml/controllers/sales/ordercontroller.php function name pdfinvoicesaction $invoices = mage::getresourcemodel('sales/order_invoice_collection') ->setorderfilter($orderid) ->load(); this 1 collects completed order invoices. how can make collect both pending , complete status orders any appreciated. thanks "i want print invoice of both pending , complete status orders"... problem is, if order in pending status means payment pending , logically there can not invoice if payment not cleared. in order change need change whole magento logic , order state machine!

c# - How can I extract 3 random values from an array? -

i build myobject array : myobject[] myobject = (from myobject varobj in myobjects select varobj).toarray(); and now, i'd extract 3 random myobject array! how can on c#? of course, if array lenght <3 need extract objects! myobject[] myobject = ...; int upper = 1; if (myobject.length > 1) { random r = new random(); upper = math.min(3, myobject.length); (int = 0; < upper; i++) { int randind = r.next(i, myobject.length); myobject temp = myobject[i]; myobject[i] = myobject[randind]; myobject[randind] = temp; } } now take elements of array 0 upper .

algorithm - Lowest Internal Node - Suffix Trees -

finding lowest internal node in case of suffix trees used in many applications. example, lowest common internal node of strings in generalized suffix tree give longest common substring. but not think of way lowest internal node in method better o(n*k) n = number of keys , k= average length of keys . there easier way keep track of node ? http://en.wikipedia.org/wiki/longest_common_substring_problem#suffix_tree says o(n*k) indeed best can normal suffix tree. can preprocessed in way makes answering question easier. leads http://en.wikipedia.org/wiki/lowest_common_ancestor has multiple links external algorithms. i suggest starting there.

asp.net - CoffeeScript or plain JavaScript? -

when average asp.net c# programmer (with poor javascript knowledge other scripting hide() show() effects) have switch building asp.net webforms apps ria javascript application (client-server architecture like). what less pain him: learn coffeescript , use "coding javascript"?? properly learn javascript , use directly?? i'm thinking proper debugging coding syntax ... does have experiences in similar scenario?? we had pretty long discussion topic in stackoverflow javascript chat on past days. general conclusion was, coffeescript nice tool might create "ok" javascript code. however, if know you're doing want code directly in javascript without 'higher level' language semi compiles down it. i'm not experienced coffeescript if i'm saying wrong i'd happy corrected. instance, can't tell how coffeescript reacts on ecmascript3 5 (maybe 6) differences. coffeescript automatically create fallback code each or pro

flash - TileLayout in ButtonBar skin -

in buttonbar skin use tilelayout: <s:datagroup id="datagroup" width="100%" height="100%"> <s:layout> <s:tilelayout /> </s:layout> </s:datagroup> but layout set max width buttonbarbuttons. dont want same width, want behavior in horizontallayout. how solve problem? maybe this flowlayout or this layout can solve problem?

How to undo a wordpress site from Multi-site to stand-alone Wordpress site? -

i considering creating new wordpress multi-site network. my question is... down road, need separate site multi-site network become stand-alone site can moved server, etc. how feasible , give quick rundown how involved accomplish? obstacles? thank in advance help- export site, single site. see tools export screen « wordpress codex

Android webView shouldOverrideUrlLoading for iframes -

i have local website javascript controlled , loading in webview. website 1 main page iframe content changes based on user input. there "next" button on main page runs javascript functions , decides page load in iframe (via document.getelement(...).src = ) in android 2.1 things working fine - simulated , on phone. webview loading pages properly. tested on 2.2 phone , whenever click next page (that should loaded in iframe) loaded in default browser. i defined intent filter <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="file" android:host="*" android:pathprefix="sdcard/android/data/android.website/files/pages" /> </intent-filter> hoping redirect page reques

64bit - Referencing an executable from F# -

i've used f# quick data-analysis using datastructures project. so, needs access project; i.e. needs assembly reference - project executable. i've tried in f# interactive, , works*; can #i appropriate path , #r executable , few support dll's - can't use em. , whatever do, can't reference compiled f# program: vs lets me add reference fine, , appropriate compiler option -r:x:full\path\here.exe correctly generated project, none of datastructures present , compiler complains of non-existent namespaces; it's if reference didn't exist. application 64-bit, may relevant. 64-bit dll's work fine. (*) after setting fsi.exe run in 64-bit mode thinks can load it, using returns fs0193: internal error. how can reference managed 64-bit executable f# project? to others same issue: workaround, i'm compiling executable cpu (which executed in 64-bit mode, behaves same). allows fsi , compiler reference it. based on questions referenced in comm

ruby - Rails 3: Polymorphic liking of Entities by User, how? -

background: i followed tutorial here setup polymorphic user favorites data model in application. allows me let user make pretty entity in system add ' has_many :favorites, :as => :favorable ' line model favorite. plan on using implement facebook style 'like' system several other similar systems. to start off added favoritability post model (each user can create status updates on facebook). have done , unit tested know data model sound , functioning either side of relationship (user , post). details: i have home controller single index method , view. on index view render out posts user , user's friends i want user able posts friends the posts controller has create , destroy method associated routes (not full fledged resource) , through post method via ajax posts created , deleted without issue where stuck how add link or button add post user's favorites? according tutorial way create new favorite through polymorphic association post.

android fragment reuse layout created in onCreateView again -

i create layout in oncreateview of fragment (say fraga) first time called , store in member variable (say viewa). push fragment (say fragb) on top of , after work press button. causes fraga'a oncreateview called again. if return saved member variable (viewa) exception thrown saying 'the specified child has parent. must call removeview() on child's parent first'. question that, there no other way re-use layout without inflating new instance i think yes, need create new instance, because save context in fragment. illegalestateexception,for example same exception if called twice setcontentview() method. maybe call removeview() or removeallviews() works.

google play - Workaround to Android Market Cache Limits on Some Devices -

we released game on android market , it's 41mb in size. received reports users of devices unable install app (though sadly still allows them purchase it.) researching issue found these devices have sort of cache limit applied downloads google market , our app larger limit. based on reports these limits we've far determined: samsung galaxy s1, galaxy tab 7, , captivate running android 2.2 have 30mb limit htc desire/s/hd running android 2.2 has 40mb limit apparently restriction applies google market because amazon users can download game without issue , runs fine on devices (tested no problems.) looking solution barrier. suggestion keep hearing split assets , download them separately after install. seems messy i'll forced go route unless has better idea. on huawey device limit caused /cache "partition" size. market downloads entire apk /cache before installing them. has 30mb, market refuses download larger apk, claiming out of space, wit

javascript - Titanium Desktop - Get Menubar icon Position -

i trying create app main window shown when menubar icon clicked. have create menubar icon can't figure out how position window underneath it. there way x position? this javascript menubar icon: var win = titanium.ui.getcurrentwindow(); var tray = titanium.ui.addtray( "app://images/menubar.png", function(){ win.show(); } ); this shows window when menubar icon clicked, shows in center of screen.

objective c - Convert NSData to a NSURL -

i have seen done other way. have nsdata object returned suppose url of image file. how do convert nsdata object nsurl? thanks you first need convert nsdata object nsstring object , can create nsurl new string. nsstring *urlstring = [[nsstring alloc] initwithdata:mydata encoding:nsutf8stringencoding]; // or other appropriate encoding nsurl *url = [[nsurl alloc] initwithstring:[urlstring autorelease]];

User managed security in Java EE -

i want protect jsf pages in java ee 6 app. i want store users , roles in db , have privileged users administer them via web tool. privileged users add users roles , set pages require roles access. it seems me container managed security won't let me that. jaas way forward? any suggestions , links examples appreciated. the short answer yes. jaas allow manage security against database use loginmodule(many container implementations jboss offer these pre-canned out of box) , can check out article( http://weblogs.java.net/blog/2006/03/07/repost-using-jaas-jsf ) or book( http://www.java.net/external?url=http://purl.oclc.org/net/jsfbook/ ) more specifics how authenticate users , determine authorization parameters jaas , jsf. for second requirement, can't see reason why can create separate tool has access tables modify credential information. though seems problem has been solved using ldap provider 1 of number of free , open source web interfaces. another nifty

c# - Syncing program clock with website clock -

got question on how can create clock program writing , sync clock on website: grand prix racing online will working on .net 4.0 , c#. know basics want syncing bit especially. intention of syncing actions on site @ precise (within 1 second) intervals. given any time server should report same time (after all, time globally same consistently!), doesn't matter time server targeting. see this codeproject article example.

visual studio - How (practically) to reuse an existing .NET library in MonoTouch -

let's i've got existing .net assembly built in visual studio 2010, consumed in other winforms product. has no third-party dependencies. i want reuse library directly in monotouch solution. as stands, able add reference library within monotouch ui project, have create new csproj file , create links of source files within it. this works maintenance burden. there must better way? thanks in advance. as of today need rebuild assemblies. that's because they'll linked monotouch bcl (e.g. different mscorlib.dll) superset of base class libraries (bcl) shipped silverlight. hopefully newer release of monotouch (and mono, mono android...) support new "portable library" make easier share compiled binaries across frameworks. http://blogs.msdn.com/b/bclteam/archive/2011/01/19/announcing-portable-library-tools-ctp-justin-van-patten.aspx

ruby - Failover solution for Email Service Providers (ESPs)? -

we looking library, project, or service lets transparently use multiple email service providers ("esps", e.g. constantcontact, jangomail, sailthru, sendgrid, verticalresponse, etc). esp choose have problems time time, , because of requirements of our business need have failover solution in place avoid delivery failures . basic features we're looking for: delegation of email delivery esps automatic failover 1 esp (only delivering one email given subscriber, not duplicates) ability check delivery status (open rates, bounce rates, list size, etc.) across configured esps in other words, want layer provides failure tolerance , recovery using multiple esps. if library, written in ruby (but might open considering other languages). is there existing project or service provides this? our use case: send many time-sensitive emails day subscribers. however, esp use can go down, still need send emails in timely manner (within seconds of publication). if initi

jquery - Using dataTables with another plugin for ajax -

okay have few things ask about. i've included jsfiddle version of working page. have implemented datatables jconfirmaction plugin written. example user clicks on delete icon 1 of contentpages bring confirm question , when user clicks yes go ahead , ajax somehow datatables deletes out of database when comes removes datatable , refilters it'll update table instead it'd 1 less row mean restructuring pagination. http://jsfiddle.net/xtremer360/9hreh/ once you've done ajax call need call function: http://datatables.net/plug-ins/api#fnreloadajax

javascript - Protovis Jquery Tooltip problem -

i display data using jquery tooltip in web application. i have followed example on website http://flowplayer.org/tools/demos/tooltip/index.html , have managed display out tooltip on picture on application. however, generating bulletchart using protovis , display out data when mouse on over bullet chart. i want know how edit make tooltip appear? able display using html tags, want display tooltip using javascript code. below codes bullet chart: var vis = new pv.panel() .data(patientdata) .width(140) .height(20) .right(10) .bottom(20) .left(5); var bullet = vis.add(pv.layout.bullet) .orient("left") .ranges(function(d) d.ranges) .measures(function(d) d.measures) .markers(function(d) d.markers); bullet.range.add(pv.bar); bullet.measure.add(pv.bar) .fillstyle("black") .text(func

java - Preventing Prepared Statement Leaks using Checkstyles -

lets have following code : preparedstatement ps = null; resultset rs = null; try {   ps = conn.createstatement(myquerystring);   rs = ps.executequery();   // process results... } catch (java.sql.sqlexception e) {   log.error("an error!", e);   throw new exception("i'm sorry. query did not work."); } {   ps.close();   // if forgot leak   rs.close();   // if forgot leak } and wished catch scenario forget close preparedstatement or resultset using checkstyles. possible, , if so, how go it? pmd , findbugs both have warnings preparedstatements (and resultsets , connections). i'd suggest using them type of warning, since checkstyle has more code style finding data-flow bugs such this.

javascript - Remove Browser Window toolbar and menubar without window.open? -

this may oddball request, curious if there way remove browser window's menubar , toolbar without using window.open? thanks in advance! nope, not anymore. if had secured applet running on page, or flash, might able hijack user's system done, both sketchy @ best.

asp.net mvc 3 - Propogate Changes to Nested Entities in MVC 3 -

i have 2 poco classes user , address. address complex object, , user has 1 address. want create single user view allows create/edit of address on same form via mvc scaffolding + entity framework + repository pattern. create user view works correctly, when try make changes address in user edit view, changes don't propagated. how force changes propogated down address object user view? else auto generated. poco classes public class testdb : dbcontext { protected override void onmodelcreating(dbmodelbuilder modelbuilder) { } public dbset<address> addresses { get; set; } public dbset<user> users { get; set; } } public class address { public int id { get; set; } public string street1 { get; set; } public string street2 { get; set; } public string city { get; set; } public string state { get; set; } public string postalcode { get; set; } public string country { get; set; } } public class user { public int id {