Posts

Showing posts from August, 2014

.net - Using WebClient to login and download files -

i've found different examples of doing this, haven't been able combination of them work. basically, have intranet system can generate documents web link, , know ones want download. able generate list of links want download, run problems authenticating system within program. keep getting 401 error this: public shared sub downloadfiles(_tool tool) dim links list(of string) = getjiralinks(_tool) dim downloader new webclient ' initialize client dim reqparm new specialized.namevaluecollection reqparm.add("os_username", "user") reqparm.add("os_password", "pass") reqparm.add("os_destination", "/secure/") downloader.credentials = new networkcredential("user", "pass") dim uploadlocation string = my.settings.jiralocation & "login.jsp" 'downloader.headers.add("content-type", "application/x-www-form-urlencoded") ...

c# - Tips on generating dynamic form fields from a string of data? -

so here's want do. want take list of phrases, , in parts of phrases, indicate user input required.. dropdown list, textbox, date field, etc. kind of madlibs in way.. option of selecting things list. for example: i own ?list_of_cars? , purchased on ?date? . has ?freetext? miles on it. this string gets broken apart mixture of text , html form fields/asp.net controls. ?list_of_cars? gets turned dropdown list few options choose from. ?date? gets turned date field (custom user control created) ?freetext? textbox user can enter information into. i have 50 of these phrases need work with. end result end being plain text in textbox after user fills out required input. no lists need large number of options.. cars kind of bad example. options list contain 5 probably. at point, started storing entire string number of delimiters , placeholders database table. for example, 1 row looks this: i own {list^nissan,ford,chevy} , purchased on {date} . has {t...

Python: Can a 3d plot made from a list of data points have a gradient color scheme? -

Image
i have list of points plotted in 3d, , have gradient color scheme plot. possible? if so, how can done? tried of examples on matplotlib site none of them worked. datagrid.txt made of 3 columns of numbers x,t,u 3 column vectors respected columns in txt file. from mpl_toolkits.mplot3d import axes3d import numpy np import pylab x, t, u = np.loadtxt("datagrid.txt", unpack = true) fig = pylab.figure() ax = fig.add_subplot(111, projection = '3d') ax.plot(x, t, u) pylab.show() instead of ax.plot , try ax.plot_surface . edit after discussions op, found out data given in 1d column vectors, plot_surface expects 2d arrays. data grouped x values, each x value has 701 increasing values of t . data had reshaped 2d arrays so: x = x.reshape((-1, 701)) t = t.reshape((-1, 701)) u = u.reshape((-1, 701)) then, gradient requires specifying colormap: ax.plot_surface(x, t, u, cmap=pylab.get_cmap('jet')) where 'jet' colormap requested....

php - wkhtmltopdf not supporting data uri -

i have created report generating library project using php domdocument create html file , save temporary file. html includes javascript part takes parameter , renders shape using canvas , saves data uri, shows blank in pdf. <div style="width:100%;height:200px"> <img id="overview" style="width:170px;height:170px;float:left;padding:10px" src="data:image/png;base64,ivborw0kggoaaaansuheugaaamgaaadicayaaactwk6eaaacxkleqvr4no2dexhu5b3hxxattba4uvu xinvp771pe3ulxw5re6oxyg3n/z0qda56w1t722jrxuq1rbzupwuvympgcepcjcejs0ggjagebmiwejjaco0 57wkhijhl9swswxpuh5neezlzz37ntn7p83yep545pnpe3/fnmbo9hxboxghpt7+pxrcmywcpmkp/l4gwmigqiwety5qezealbkkxdnqua7uzob4gvphp+xi50mwasozsgzkl2ywgjgmexyzs38saj7ylw vs2mtnvxn5edmdutojilbio/oijwku+bmhiqf1+yu+q4bz6/xzygk/l9oegcft0z+ppt6ccurtssrkdkgylohwoxmgiae9k/hgcnszmkcrdmlz7yiwvtylztl2ohksiooiei8k0hclolsv+xmkvt0m6a4m0ueoi+i92opl0ri k...+i6pwtsevhsscskn4quzovvnuvzhpiylvtc86an7/bsmrvn7hrxe...

python - Difference between plt.close() and plt.clf() -

in python, difference between plt.clf() , plt.close() ? will function same way? plt.close() close figure window entirely, plt.clf() clear figure - can still paint plot onto it. it sounds like, needs, should preferring plt.clf() , or better yet keep handle on line objects (they returned in lists plot calls) , use .set_data on in subsequent iterations.

objective c - Index of a character from the NSString in iOS -

i have nsstring example "this question" .i want find indices of character/substring "i" ie in case if index starts 0 ,then want 2,5,16 answer. the other answer bit of overkill. why don't iterate on characters this: nsstring *x = @"this question"; (nsuinteger i=0;i<[x length];i++) { if ([x characteratindex:i]=='i') { nslog(@"found: %d", i); } } it outputs positions: found: 2 found: 5 found: 16

java - JSF + Quartz scheduler with sleep function -

i need create scheuler job1 conditions 1) when condition fail in job1 need sleep job time ? queries 1) how can in jsf quartz 2.1.x or above public class schedulerjob implements job { int i= 1 ; @override public void execute(jobexecutioncontext context) throws jobexecutionexception { dateformat dateformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); date date = new date(); system.out.println("scheduler wotking jsf , hibernate "+ dateformat.format(date)); i=i+1; system.out.println(i); if (i==2) { system.out.println(i); try { // 15*60 =900 sec = 15 min thread.sleep( 900l * 1000l); system.out.println("after 65 sec"); system.out.println(""); // executing... } catch (exception e) { e.printstacktrace(); } } } } quart...

jsp - Two JQGrid in one page -

i new in ajax, jquery. right using 2 jqgrid rendering data. jquery('#oldlocations').jqgrid( { url:"/", datatype : 'json', width:400, height:120, colnames:['customer'], colmodel:[ {name:'custid',index:'custid',align:'center',hidden:true,sortable:false,editable:true,edittype:"text",editrules:{required:true,number:true}}, ], pager: '#pager1', viewrecords: false, editurl:'donothing', emptyrecords: "nothing display", multiselect:false, rownum : 5, rowlist : [ 5, 10, 15 ], loadonce:true, imgpath : "themes/basic/images", caption : "" }); jquery(...

java - regarding the changes done in code to achieve the excel outcome -

i stuck in issue of excel generation through poi want achieve shown in picture on row 6 header should aaa , row 7 should blank , on row 8 there should header bbb , rest row 9 existing data should continue adjustments need made i using below code hssfrow abcrow = worksheet.createrow((short) rownumber++); hssfcell ghjcell = abc.createcell((short)0); ghj.setcellstyle(cellstylereportname); ghj.setcellvalue("aaa"); rownumber++; hssfrow abcdrow = worksheet.createrow((short) rownumber++); hssfcell ghjj = abcdrow.createcell((short)0); ghjj.setcellstyle(cellstyle00); please advise how can achieve 6th row --->aaa 7th row --->should blank 8th row ---->bbb 9th row ---> noral exisiting data , changes need done in code please advise if understanding problem, can solved easily. use following:- worksheet1.createrow(6).createcell(0).setcellvalue("aaa"); worksheet1.cre...

Using SQL Between Query and Showing all results in ASP.NET C# -

this sample code check data on table1 using 2 filters, column1 , between data in column2. code have working getting 1 result. example. enter "1" in textbox1, "3" in textbox2 , "6" in textbox3. select * table1 column1 = '1' , column2 between '3' , '6' -- when run in sql result 3,4,5,6 in c# getting "6". can me "3,4,5,6" result. thank you. public partial class webform1 : system.web.ui.page { sqlconnection sc; sqlcommand cmd; sqldatareader dr; protected void page_load(object sender, eventargs e) { } protected void button1_click(object sender, eventargs e) { sc = new sqlconnection(configurationmanager.connectionstrings["babbler"].connectionstring); sc.open(); cmd = new sqlcommand("select * table1 column1= '" + textbox1.text + "' , column2 between '" + textbox2.text + "'" + " , "...

Share Workbook getting checked on exporting excel from asp.net c# -

how uncheck "allow changes more 1 user @ same time." in share workbook in excel while exporting excel c# i using "microsoft.office.interop.excel" exporting excel i not 100% sure works. have test it. create new class inherits excel.worksheet. class myexcelworksheet : excel.worksheet { public bool multiuserediting { get; set; } } then can create instace of myexcelworksheet instead of standard one. in example above added set; multiuserediting. allow change property. myexcelworksheet myworksheet = new myexcelworksheet(); myworksheet.multiuserediting = false; xlworkbook.sheets.add(myworksheet); while allow change property not if property used when file saved. have check yourself.

javascript - find third sunday of the month in JQuery -

in jquery, want take string such "first sunday" or "third wednesday" , unix timestamp of day current month. i've seen done before in php strtotime() or datetime class, can't find out how in jquery. edit: not duplicate of javascript equivalent of php's strtotime()? i needed handle passing in "first" or "second" etc ... unless i'm mistaken, can't javascripts date, , have accepted answer on page referring me on datejs. datejs make date operations snap. answer question, finding 3rd sunday of month : date.today().third().sunday();

c# - Form1_KeyDown NOT WORKING -

private void form1_keydown(object sender, keyeventargs e) { if (listbox1.items.contains(e.keycode)) { listbox1.items.remove(e.keycode); listbox1.refresh(); timer1.interval -= 10; difficultyprogessbar.value = 800 - timer1.interval; stats.update(true); } else { stats.update(false); } correctlabel.text = stats.correct.tostring(); missedlabel.text = stats.missed.tostring(); totallabel.text = stats.total.tostring(); accuracylabel.text = stats.accuracy.tostring(); } private void timer1_tick(object sender, eventargs e) { //add random key listbox listbox1.items.add((keys)random.next(65, 90)); application.doevents(); if (listbox1.items.count > 7) { listbox1.items.clear(); listbox1.items.add("game over"); timer1.stop(); } } when run application, timer1_tick event working fine, form1_keydown event doesn't execute when press key. missin...

uilabel - Ensuring the symbol th in iOS appears correctly -

Image
i need have 19th century in uilabel. should appear 19th century th symbol superscript. entering label using plist. how ensure appears correctly in ui? need guidance on this. image attached: use unicode characters áµ— (u+1d57) , Ê° (u+02b0). you can enter these literally as: nsstring *num = @"19 áµ—Ê°"; or: nsstring *num = @"19\u1d57\u02b0"; if don't nice enough, using nsattributedstring best.

ios - UITableViewCell preserve selected on UITableView scrolling -

i have uitableview on ipad. when cell selected , cell scrolled off screen, , scrolled screen, selected cell blank. problem occurs on device , not on simulator. have tried various of proposed solutions manage selected index - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { self.selectedindexpath = indexpath; } and use setselected/selectrowatindexpath on cellforrowatindexpath like - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"desktop row"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell =[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } ... if(self.selectedindexpath!=nil){ if ((indexpath.row == self.selectedindexpath.row) && (indexpath.section == self.selectedindexpa...

how to modify the local file in unity3D for mobile using Json -

i trying find how modify content of existing local file in unity 3d. content json using key variable, can modify. can't find local file modification on internet. can me out modification of file? if possible, using json too? thank btw i'm using minijson. thank you mono has entire library of file manipulation functions. question not specific unity 3d. minijson supports both serialization , deserialization , strings. if have specific question have tried , failed, perhaps rephrase original question , include code sample of not working , can change answer.

URL rewriting via Wordpress Rewrite or .htaccess -

jump edit8 see how solved this let's have wordpress blog: www.animals.com . have php file in theme directory: www.animals.com/wp-content/themes/mytheme/db.php . also, have custom template page, create new page in wordpress administration panel show db.php : www.animals.com/database . so if want read lions, go to: www.animals.com/database/?animal=lion (because that's way decided write php, inserting value $_get['animal'] query, using pdo etc.). now, access www.animals.com/database/?animal=lion www.animals.com/lion . should use .htaccess or wordpress rewrite? should place .htaccess, in root of wordpress folder (with wp-config.php , files) or in theme directory? the 1 root has rewritebase / , stuff wordpress default. should write achieve want? should put before or after existing code? edit : public_html .htaccess , really want do: have website: www.domain.com , when type http://www.domain.com/dios/?dios=agni shows info god agni. type www.domain.com...

Google maps update jquery mobile problems -

i want use latest version of jquery mobile , have problems because google maps doesn't works now... with version 1.0a2 google maps works fine version 1.3.1 have blank page ! in html code, use div id="map" : div id="map" style="width: 100%; height: 78%;" the header : newest code : link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> script src="http://code.jquery.com/jquery-1.9.1.min.js"> script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"> older code : link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> script src="http://code.jquery.com/jquery-1.4.4.min.js"> script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"> does can tell me problem ? thank you. you can try downloading jquery file , give...

performance - IntentService is hanging UI in android -

in intentservice using threadpoolexecutor poolsize 8 , maxpoolsize 10. when ever service started effect on ui. in runtask() method add tasks thread pool. private threadpoolexecutor threadpool = null; private final linkedblockingqueue<runnable> threadsqueue = new linkedblockingqueue<runnable>(); private collection<future<?>> futures = new linkedlist<future<?>>(); public myservice(string name) { super(name); threadpool = new threadpoolexecutor(poolsize, maxpoolsize, keepalivetime, timeunit.seconds, threadsqueue); } public void runtask(runnable task) { futures.add(threadpool.submit(task)); } /** * when ever call method hold main thread untill tasks * in thread pool completed. */ public void waitforthreadpool() { (future<?> future : futures) { try { future.get(); } catch (interruptedexception e) { e.printstacktrace(); } catch (executionexception e) { e.printstacktrace(); } catch (exception e) { ...

Android R files from external libraries Intellij (not as jar!) -

i have problem of being use resoure file external library on intellij. on runtime when tried view resource external library layout , wrote "class not loaded : packege_name.lib.r". this problem goes on runtime on intellij when call activity external library added decleration on main project manifest file. any help? thanks.

database - SQL Server referencing a foreign key to a non-primary key column -

recently ran situation following: we designing database , predicting data grow millions records within 6 months. , want each row should have guid unique id allows move data olap/archive databases later, after many arguments on identity , guid key, came guid unique id. however, guid primary key bad idea, therefore have primary key of table identity column. design looks below users : | id (pk, identity) | | userid (guid, unique-constraint, non-clustered index) | | name | | email | | ... | notes : | id (pk, identity) | | noteid (guid, unique-constraint, non-clustered index) | | userid (guid, foreign key users(userid) | | title ...

Web based solution for team with no Server or database -

my team part of university needs me develop web based application them can accessed team member. university doesn't provide database. we have portion in server that's our public website. if put application on server, need have database. can't use excel sheet storing data cause huge. looking optimal solution. choose: http://www.sqlite.org/ http://www.db4o.com/ both give database ability no prior machine configuration or setup package.

cordova - Capture functionality on HTML mode, what's missing? -

getting acquainted phonegap, stumbled error cannot assess (or can, sort of). so want make html page button allows capture image (with mobile) using device camera, nothing fancy suppose. i took essential of code phonegap's documentation, , here's page looks : <!doctype html> <html> <head> <title>capture image</title> <script type="text/javascript" charset="utf-8" src="plugin_loader.js"></script> <script type="text/javascript" charset="utf-8" src="json2.js"></script> <script type="text/javascript" charset="utf-8"> // called when capture operation finished // function capturesuccess(mediafiles) { var i, len; (i = 0, len = mediafiles.length; < len; += 1) { uploadfile(mediafiles[i]); } } // called if bad happens. // function captureerror(err...

powershell - How can I get the file with the oldest LastWriteTime in a directory? -

if have full-path wildcard, how can file oldest lastwritetime? $fullpath = "myfolder:\fooobar*.txt" $theoldestfile = # write among #foobar*.txt has max lastwritetime? like this: $fullpath = "myfolder:\fooobar*.txt" $theoldestfile = dir $fullpath | sort lastwritetime | select -first 1

c# - System.NotSupportedException:The entity or complex type Model.APPLICANT cannot be constructed in a LINQ to Entities query -

currently fixing codes until exception occured system.notsupportedexception: entity or complex type model.applicant' cannot constructed in linq entities query this controller : public ienumerable<applicant> getapplicant() { ienumerable<applicant> applicantdata = cache.get("applicants") ienumerable<applicant>; if (applicantdata == null) { var applicantlist = (from app in context.applicants join in context.profiles on app.profile_id equals a.profile_id output j in output.defaultifempty() select new applicant() { applicant_id = app.applicant_id, applicant_lastname = (j == null ? app.applicant_lastname : j.applicant_lastname) }).take(1000).asenumerable().asqueryable(); applicantdata = applicantlist.where(v => !string.isnullorempty(v.applicant_lastname)).asenumerable(); if (applicantdata.an...

regex - Regexp performancing in different languages -

if in php , regex pattern better performancing second pattern, means pattern better in java's or in javascript's or in postgresql's regex? that is, in different language/db, regexp working same or differently ? there not same perfomace. i've found article benchmarking regex on various languages. may find useful. http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=regexdna&sort=elapsed http://lh3lh3.users.sourceforge.net/reb.shtml and here find information handling regexs in various languages http://www.regular-expressions.info/refflavors.html also may want read this: regex performances between languages or libraries

Download file in Windows phone 8 -

i need download file website iso storage. i found 3 ways, backgroundtransfer , webclient , httpwebrequest , none of these 3 ways can pause , resume downloading. on other hand, 3 ways write stream downloaded after download complete. how achieve breakpoint resume download? i dont know on platform working, mean working on windows phone 8/7 or desktop applications. in senario if working on windows phone 8 can use transfercontrol on ui , backgroundtransferrequst in xaml.cs. backgroundtransferrequest has capability resume or pause download. read following link. click here transfercontrol in windows phone 8 , backgroundtransferrequest. use httpclient inplace of webclient, httpclient can pause , resume during download file.

vb6 - How to read the content of the URL in vb 6.0 -

this question has answer here: download file - vb6 7 answers how query website in vb6? 3 answers alternative inet & webbrowser control retrieve html only? 4 answers i have command button in vb 6.0 ,now on clicking command button want read content of url(means url writing there). code: private sub command2_click() dim obj object set obj = createobject("internetexplorer.application") obj.navigate2 "http://10.0.0.13/tuvrandom" obj.visible = true end sub it display content of page eg:"google" want read whole thing page writing. private sub command2_click() dim obj object set obj = createobject("internetexplorer.application")...

c - How to use SIGUSR1 alternate values -

in man 7 signal shows sigusr1 sigusr1 30,10,16 term user-defined signal 1 . if use sigusr1 in c code, value 10. there way access other values 30 & 16? okay use them explicitly in signal handler if(signo == 16) { printf("sigusr1 type 2 received\n"); } edit:in code , there case statement uses sigusr1 already. need 1 more custom signal . know there rtsignals , other options. wanted know why specify 16,30 in man page , never provide way use it. the manual says several signal numbers architecture dependent, indicated in "value" column. (where 3 values given, first 1 valid alpha , sparc, middle 1 i386, ppc , sh, , last 1 mips. - denotes signal absent on corresponding architecture.) the sigusr1 have 1 value on whatever machine you're running on ... there no alternate values; use defined constant sigusr1. using 16 give wrong signal ... further in table , see sigstkflt. i need 1 more custom signal what's wrong s...

c# - Customize DatePicker by PerpetuumSoft -

i use ui controls windows 8 perpetuum software. there datepicker. need customizations: how change available range of date use can select? month names in date selector pop-up in english, other text in system language. how change month name? as such control doesn't support such behavior. thing possible monitor date changes using datechanged event or monitoring changes of dependencyproperty date. the localization issue fixed in latest version. make sure have latest version, else can downloaded perpetuumsoft's download page: http://www.perpetuumsoft.com/downloads.aspx?lang=en . getting month name value can use datetimeformatinfo.currentinfo.getabbreviatedmonthname.

symfony - Updating the composer.phar on Symfony2 -

i have started symfony2 project. need install new bundle , , saw need add new line composer.json , execute update command. the thing is, composer.phar file , .json on different folders. /httpdocs/composer.json /bin/composer.phar so after add line .json file: "doctrine/mongodb-odm-bundle": "3.0.*@dev" if try /bin/php composer.phar update doctrine/mongodb-odm-bundle got error saying composer.json not there , correct of course. doubt why thoose files in different folders? previous developer make mistake? should move files same folder? bin or httpdocs ? it doesn't matter composer.phar lives. relevant part, current working directory in symfony project (where composer.json lives). simple execute composer (if execute bit set, no call php required). /bin/composer.phar update doctrine/mongodb-odm-bundle

Chrome dev tools on all tabs -

i'm trying see post request browser making on form. my problem form opened in popup window (js initiated) , when form submitted automatically closes popup. when i'm trying use developer tools' networking tab can see post request don't have enough time since window closing fast. even if choose 'preserve log on navigation' doesn't appear anywhere since entire window closing on submit. is there way of opening developer tools in context of entire chrome application instead of tab? i don't believe there is. best 2 solutions can think of (that don't answer question think achieve aim) are: use tool fiddler - http://fiddler2.com/ it's available windows :( it's messy workaround comment out line closes window while carry out debugging , reinstate once issue fixed.

java - Copy the folder along with parent folder -

i have simple question, unable figure out way it. have folder called edsdk , internally contains sub-folders. in ant wish copy files. i.e. edsdk headers dlls i wish copy whole above (including edsdk). doing: <fx:fileset dir="." type="data" includes="edsdk/**"/> copies internal of edsdk folder not edsdk folder itself. should do? ps: above fx:fileset similar fileset doing: <fx:fileset dir="." type="data" includes="edsdk/"/> does trick.

asp.net - How validate for domain name of email address -

i have form in user enters email address.i validating through java script.i want validate domain name of email address best way validate domain name of email address in .net ? best way check domain name in email address use regular expression expression use validation email \w+([-+.']\w+) @\w+([-.]\w+) .\w+([-.]\w+)* can edit domain part in expression \w+([-.]\w+)*\

PHP/MYSQL issue - query search failing randomly -

i have php script designed scrape data websites. script checks locally-hosted mysql database each time finds new item see whether or not item has been downloaded , exists in mysql database. if sees item exists in database, should ignore , move on. code using that: $result = mysql_query("select * web_media sourceforum '%$forumtograb%' , titlethreadnum=$threadtitleexists"); if((!mysql_num_rows($result)) && (mysql_num_rows($result) !== false)) {} in other words, if comes 0 results, item considered new. script ran fine on old hosting company several months. have moved new hosting provider, , i'm running strange issue. every 12 hours or so, expression seems randomly fail , script finds bunch of "new" data exists in mysql database. i've tried running query manually, , code appears have no problem finding pre-existing entry no problem. does have idea what's going on here? checked hosting provider, , number of aborted mysql con...

sql server 2008 - sql query with create command -

this question has answer here: try create table select - sql server 2008 throws error 4 answers i having problem in creating table table. using query: create table new_table ( select distinct * old-table) its giving error incorrect syntax near keyword 'as'. select distinct * new_table old-table group whatever want group by edit: can cast rows varchar, comparable, or can group column values want distinct.

Convert a string to a javascript code -

i have folowing string variable returned textarea : jtext = $('#putjs').val(); the result of string following: ctx.beginpath(); ctx.moveto(172 + xoff, 29 + yoff); ctx.beziercurveto(183 + xoff, 33 + yoff, 199 + xoff, 36 + yoff, 201 + xoff, 74 + yoff); ctx.beziercurveto(191 + xoff, 91 + yoff, 197 + xoff, 130 + yoff, 196 + xoff, 110 + yoff); ctx.beziercurveto(195 + xoff, 95 + yoff, 200 + xoff, 230 + yoff, 200 + xoff, 248 + yoff); ctx.beziercurveto(200 + xoff, 256 + yoff, 85 + xoff, 251 + yoff, 70 + xoff, 251 + yoff); ctx.beziercurveto(65 + xoff, 251 + yoff, 74 + xoff, 122 + yoff, 71 + xoff, 106 + yoff); ctx.beziercurveto(68 + xoff, 88 + yoff, 65 + xoff, 87 + yoff, 65 + xoff, 73 + yoff); ctx.beziercurveto(65 + xoff, 52 + yoff, 70 + xoff, 35 + yoff, 95 + xoff, 28 + yoff); ctx.beziercurveto(99 + xoff, 37 + yoff, 130 + xoff, 72 + yoff, 171 + xoff, 29 + yoff); ctx.stroke(); the question is, how put string javascript code design canvas...

Application using PowerShell System.Management.Automation compiled on Windows 8 not working on Windows 7 -

i built powershell script runner on windows 8 using vs2012 , framework 4.0 , when launch runner on windows 7 gives me error because powershell version older 1 on windows 8. (win7: ps2, win8 ps3). (system.management.automation) are there solutions besides recompiling application on windows 7 or installing powershell 3 on windows 7? (or upgrading windows 7 machine :p) thanks! you can reference powershell 2.0 version of assembly (v1) project on windows 8. compiling version make work on windows 7 (powershell 2.0) , windows 8 (powershell 3.0). to powershell v2.0 version of assembly pull gac or install powershell 2.0 sdk , use that. also make sure project targets .net 3.5 work on windows 7 without having install .net 4.5.

metadata - including rails object in meta tags keywords -

i'd include rails object in keywords straight text code not right way it...how can this? set_meta_tags :keywords => %w[keyword1 keyword2 #{params[:hospital]}] you might want have @ 2 plug-ins including rails object in meta tags: meta magic: https://github.com/lassebunk/metamagic head liner: https://github.com/mokolabs/headliner edit: meta tag gem what write meta helper stick in applicationhelper , looks this: def meta(field = nil, list = []) field = field.to_s @meta ||= { 'robots' => ['all'], 'copyright' => ['my copyright'], 'content-language' => ['en'], 'title' => [], 'keywords' => [] } if field.present? @meta[field] ||= [] case list.class when array @meta[field] += list when string @meta[field] += [list] else @meta[field] += [list] end case field when 'description' c...

It is possible to do this kind of conversion with msbuild -

it possible kind of conversion msbuild? transforming metadata items? this: <itemgroup> <group include="g1"> <a>1</a> <b>1</b> </group> <group include="g2"> <a>2</a> <b>2</b> </group> </itemgroup> to this: <itemgroup> <a>1</a> <a>2</a> <b>1</b> <b>2</b> </itemgroup> you can use batching : this creates new item groups abd b based on group. new item groups don't have use same name metadata. set itemname in createitem/output use different name. <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" toolsversion="4.0" defaulttargets="default"> <itemgroup> <group include="g1"> ...

winapi - What is the maximum size of an integer (x86)? -

i'm going upgrade vc++ 2008 vc++ 2010 or 2012. before upgrading have questions: my compiler supports largest __int64 integers. __int128 supported in version vc++ 2010, 2012 , on? my current compiler doesn't support _win64 or _win32 check windows platform. doubt _integral_max_bits solution; 64 if it's run in win32, or 128 otherwise. true? for of compilers mention, 64 bit integer types exist both 32 , 64 bit targets. however, there no 128 bit integer types. so, _integral_max_bits evaluates 64 of listed compilers, , both 32 , 64 bit targets. the best can use sse2 intrinsic __m128i depends on presence of sse2 unit on processor. don't need upgrade able use that. it's available in vs2008 also.

Tastypie get latest record -

instead of returning multiple objects when id isn't set. i'd return one, latest. # return latest entry /api/entry/ {'id': 2, 'foo': 'bar', ...} # return specified entry /api/entry/1/ {'id': 1, 'foo': 'bar', ...} i've tried overriding both obj_get_list , get_object_list , neither worked me. do need create view this? using aniav's solution, , adding necessary modifications: resource class meta: max_limit=1 get_object_list(self,request): return super(self, resource).get_object_list(request).filter(user=request.user).order_by('-date') where of course date replaced field want latest of.

objective c - iOS: Find out if an image is used in some xib -

Image
i want find out images in project used. when try find names of images set programaticly, can see them in relevant classes when searching. not case images set in xib. there workaround find if image used in xib? try using utility app unused jeff hodnett. i've used before , had success it.

Apache add Content of a Link to response -

i want know if possible let apache substitue link in html return client html of site behind link. instead of <html> <head> </head> <body> <a href="<some link>">link</a> </body> </html> want this: <html> <head> </head> <body> // html of page behind link </body> </html> i can´t use javascript or php or anything, let´s assume have html. iframes no solution problem. just comes similar situation, ulrich schwarz gave hint ssis, in scenario way work. however, due cancelling project, not able validate usage of ssi scenario.

node.js - nodeunit test and trace.gl -

Image
how trace nodeunit test using trace.gl i tried in 3 ways: $ node ~/dropbox/tracegl.js ./path/to/my/nodeunittests . , run unit test directory in console. $ node ~/dropbox/tracegl.js `which nodeunit` /path/to/test/nodeunittestfile_test.coffee $ node ~/dropbox/tracegl.js `which nodeunit` refrence/to/teset/nodeunittestfile_test.coffee -nolib all 3 ways gives output: [trace.gl] see code. product has commercial license. [trace.gl] webgl trace ui: http://localhost:2000 [trace.gl] checking update...[trace.gl] serving browser js: http://localhost:2080 date. but when open url http://localhost:2000 dont see tracing information there. initial tracegl state. i had same issue code , using tracegl. had use -nolib options working. give try.

ios6 - UISplitViewController does not recognize device rotation when covered by modal movie player -

[this posted on apple developer forums has not been answered, i'll try here.] my application uses uisplitviewcontroller ipad master/detail views , runs on ios 6. split view controller root view controller window. detail view consists of uiwebview embedded in uinavigationcontroller. other elements in detail view toolbar , navigation bar offered navigation controller. when web view displaying page embedded youtube video, user can make video full screen. done uiwebview---i not responsible creating full-screen video player. in case matters, once video player placed in full-screen view, keywindow of uiapplication shared instance not main application window during video playback, instead instance of mpfullscreentransitionviewcontroller. if user rotates device during full-screen playback, , ends playback, uisplitviewcontroller not place children. methods splitviewcontroller:willhideviewcontroller:withbarbuttonitem:forpopovercontroller: and splitviewcontroller:willshowviewco...

heap - C: how to manage a large structure? -

in c: i trying use structure containing large array, , have stack overflow error while declaring it. guess (correctly?) don't have enough memory in stack, , therefore, should use heap (i don't want change stack memory size, code used others). show me way simply? or should use else structure? my code - definitions.h: #define a_large_number 100000 struct std_calibrations{ double e[a_large_number]; }; my code - main.c: int main(int argc, char *argv[]) { /* ... */ // stack overflows here: struct std_calibrations calibration; /* ... */ return (0); } thank help! a couple of options: use malloc(3) , free(3) dynamically allocate structure @ runtime. option you're talking when "should use heap." struct std_calibrations *calibration = malloc(sizeof *calibration); and later, free(calibration); give structure static storage duration. either add static keyword or make global. option may change semant...

linux - Process killed with -9 aborts? -

i'm sending sig_kill process on linux, during exit encounters memory bug , aborts generating core dump. don't think possible on unix system, observe. possible process killed signal 9 die other signal , leave core dump? no, process can't catch sigkill there option "process watcher" or wrapper. sure not other processes spawned watch process?

c# - how to correctly sign an executable -

Image
so made little tool, console application, when running on win7 brings security box (uac). tried sign exe file in vs 2010 using following steps: 1- project properties 2- signing 3- create new key, shown below the key file created, can see in capture below. issues: file still blocked security box, , when check file whether signed or not using signtool.exe, tells me, no signature found. please correct me if i'm following wrong steps. assembly signing != authenticode signing. to authenticode sign assembly signtool, you'll need code signing certificate trusted issuing authority. you can issue following post-build command sign executable: "signtool.exe" sign /f "$(solutiondir)mycertificate.pfx" /p certpassword /d "description" /du "http://myinfourl" /t "http://timeserver.from.cert.authority/" $(targetpath) everything need know authenticode code signing

android - childIndex in full ExpandableListView? -

i have expandablelistview like; category1 | |__ subcategory1 -> index 0 | |__ subcategory2 -> index 1 category2 | |__ subcategory1 -> index 2 | |__ subcategory2 -> index 3 | |__ subcategory3 -> index 4 category3 | |__ subcategory1 -> index 5 i want index values shown @ right side , link them arraylist arraylist.get(indexvalue) how must indexvalues above?

Twilio Using Rest API -without library -

i'm trying send sms without using library, can't add dll's project. i've formatted following url correctly api , don't seem sms. https://api.twilio.com/2010-04-01/accounts/acd4311678edb1e37c3a67a86c5fc94593/sms/messages?from=+441183100455&to=+447792825508&body= 'hello_world' ricky twilio here. one quick way generate api request use api explorer . for example, explorer give code show how make http request using curl api: curl -x post 'https://api.twilio.com/2010-04-01/accounts/[accountsid]/messages.json' \ --data-urlencode 'to=555-555-5555' \ --data-urlencode 'from=+15555551234' \ --data-urlencode 'body=brooklyn's in house!' \ -u [accountsid]:[authtoken] hope helps.

r - Converting from a Formula object to a list -

in r, iterate on formula object. r automatically converts formula parse tree, see no reason why shouldn't able iterate. for example, f <- ~x + y has elements f[[1]] = ~ , f[[2]] = x + y . however, for(v in f) print(tostring(v)) not output [1] "~" [1] "+, x, y" as expect to. instead, gives error invalid for() loop sequence . if need manually, use for(i in 1:length(f)) print(tostring(f[[i]])) produce correct output. however, know why first method not work.

html - Sublevels in Drop Down Menu Stack on top of One Another Instead of Displaying Verticly -

recently few months ago had add sublevel functionality drop down menu on 1 of our sites. tactic took before worked 1 column in navigation, asked add sublevel column before didn't work because using relative positioning (see example below): <style type="text/css"> #div#mycontent { overflow: visible; } #nav ul { font-family: arial, verdana; font-size: 10px; margin: 0; padding: 0; list-style: none; font-weight: bold; } #nav ul li { display: block; float: left; margin: 0;} #nav li ul { display: none; } #nav ul li { display: block; text-decoration: none; color: #3c1c4e; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #f0e8d8; margin-left: 1px; white-space: nowrap; } #nav ul li a:hover { background: #f0e8d8; } #nav li:hover ul { display: block; position: absolute; } #nav li:hover li { float: none; font-size: 11px; } #nav li:hover { background: #f0e8d8; } #nav li:hover li a:hover { background: #fff7e7; } /* sublevels in drop down */ #nav ...

merge - combine two dataframes in R based on common columns -

i have combine 2 data-frames want take common column among data-frames , join them together. rows in 2 data-frames different. b c row1 1 0 1 row2 1 0 1 another dataframe d c f row3 1 0 1 1 row4 1 1 0 0 i want final dataset this c row1 1 1 row2 1 1 row3 0 1 row4 1 0 here dput 2 dataframes dput(x1) structure(list(d = c(1l, 1l), = 0:1, c = c(1l, 0l), f = c(1l, 0l)), .names = c("d", "a", "c", "f"), row.names = c("row3", "row4" ), class = "data.frame") dput(x2) structure(list(a = c(1l, 1l), b = c(0l, 0l), c = c(1l, 1l)), .names = c("a", "b", "c"), row.names = c("row1", "row2"), class = "data.frame") you common names , use row bind: common <- intersect(names(x1), names(x2)) rbind(x1[,common], x2[,common]) c row3 0 1 row4 1 0 row1 1 1 row2 1 1 edit: match expected output rbind...

ruby on rails - Is there a way to get coordinates of cropping via Rmagick after cropping? -

i have rubyonrails application. use carrierwave images uploading , jcrop cropping. i have 2 images: original , cropped image. have no saved coordinates of cropping ( crop_z , crop_y , crop_w , crop_h ) is there way cropping coordinates via rmagick or solution? thanks in general don't think crop coordinates recorded in image metadata. (they're saved in metadata in magick format few people save images in format.) however, may have luck detecting position of cropped image in original using find_similar_region method. pass cropped image target argument. if method finds region in original matches target returns x- , y-offset of region. width , height of region, of course, width , height of cropped image.

How do I sandbox a web browser control in C#? -

i using web browser control view cached web pages "offline". problem running when load page, links want fetch data internet. i not interested in "filling in blanks" allowing page fulfill requests. interested in viewing web page "as is" without downloading missing pieces. the existing events in web browser control not provide simple way block these requests. did try using "progresschanged" event has arguments number of bytes being downloaded (eg: e.currentprogress, e.maximumprogess). if place "mybrowser.stop()" statement in there, works no means 100%. i looking event handler or api allow me block outgoing requests altogether -- or -- @ least prevent downloaded affecting original html document. i found 1 suggestion of using shdocvw's filedownload event handler use test see if activedocument = true. if false, cancel event. got pretty close implementing along lines when came writing event handler, not find relevant fil...

Using OpenSSL with Contiki -

i use openssl library contiki. have installed , header files in /usr/include/openssl , including headers doesn't work. i've tried passing -lcrypto flag compiler, still no success. there flag need use or cannot use openssl library @ all? you have installed host version of openssl, not possible use host libraries cross-compiling binaries microcontroller targets or targets of architecture different host compiling on (strictly speaking). it using openssl of contiki platform rather impossible. library far big microcontroller, there chance 1 may able hack support "native" platform. you may wish take @ cyassl alternative solution know fit on microcontrollers. there other ssl libraries may wish consider trying (e.g. matrixssl , sharkssl ). of these commercial or free non-commercial use. there various other partial solutions securing network traffic: use http(s) proxy (such nginx ) terminate ssl connection between local end-device network , internet...

sap - Looking for Non-Printable characters inside internal table ABAP -

i have internal table written file , pulled bw datasource. non printable character makes file output , breaks import process bw. below sample of code. since itab not type c or string unable use find/replace regex on it. has else had solve type of problem before? form eliminate_non_print_char tables p_shiptab structure shiptab. loop @ p_shiptab wa_shiptab. find regex '[^[:print:]]+(?!$)' in wa_shiptab ignoring case. "results result. if sy-subrc = 0. replace regex '[^[:print:]]+(?!$)' in wa_shiptab '' ignoring case. endif. endloop. data: begin of shiptab occurs 2000. include structure ship1. include structure ship2. data: landtx vbrk-landtx, bl_konwa vbak-waerk. include structure ship3. include structure ship4. data: frght_amnt_usd konv-kwert, revenue_amnt_usd vbap-netwr, ...

java - Get full URL and query string in Servlet for both HTTP and HTTPS requests -

i writing code task retrieve requested url or full path. i've written code: httpservletrequest request;//obtained other functions string uri = request.getrequesturi(); if (request.getquerystring() != null) uri += "?" + request.getquerystring(); so, when browse http://google.com?q=abc ok (correct). there problem when browse https://google.com . value of uri http://google.com:443google.com:443 , program doesn't when https used. and output same request.getrequesturl().tostring() . what solution? by design, getrequesturl() gives full url, missing query string. in httpservletrequest , can individual parts of uri using methods below: // example: http://myhost:8080/people?lastname=fox&age=30 string uri = request.getscheme() + "://" + // "http" + ":// request.getservername() + // "myhost" ":" + // ":" request.g...

Warning: Invalid argument supplied for foreach() in mpdf.php on line 11008 -

i using mpdf in web application. i have create invoice documents of mpdf.. html table large number of rows (ie: if exists single page) rise error: warning: invalid argument supplied foreach() in mpdf56/mpdf.php on line 11008 i using following code generate pdf: require_once(mpdf_path); $mpdf=new mpdf('c','a4','0','',2,2,2,2,1,1); $stylesheet = file_get_contents(dirname(__file__).'/invoice_print.css'); $mpdf->writehtml($stylesheet,1); $html .=""; $mpdf->writehtml($html); $mpdf->output("$filename",'d'); i have tried with/without arguments in constructor of mpdf. , found mpdf works first 4 params without problem... $mpdf=new mpdf('c','a4','0','') but when add "margins" (ie: 5-8) params, throws error described above. have has fix this??? i have tried mpdf 5.3 , 5.6 yep... got fix mpdf forum... here link: http://www.mpdf1.com/mpdf/for...

jsf 2 - Some questions about view duration/life time -

Image
in web project, of pages using view scoped managed beans. it's working great, sometimes, notice if away page time, like, 10 minutes, when return page, in page stops working, , no console errors shown in server. think due life of view, have found nothing it. can find info it? there way configure life time of view? i'm using apache tomcat 7. below web.xml configuration file: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>atualygestao</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</w...

my custom PHP stdev function VS mysql's STDDEV_POP -

so have code: $arr = array( 1,2,3,4,5,6 ); $num = count($arr); $sum = array_sum($arr); $average = $sum/$num; foreach($arr $val) { $sum += pow(($val - $average), 2); } $stdev = sqrt($sum / ($num - 1)); versus select stddev_pop(something) table; whereby table something '1' '2' '3' '4' '5' '6' and yet $stdev returns 2.7748873851023 whereas select returns 1.707825127659933 what's wrong stdev code? this gave me 1.70 $arr = array( 1,2,3,4,5,6 ); $num = count($arr); $sum2 = 0; $sum = array_sum($arr); $average = $sum/$num; foreach($arr $val) { $sum2 += pow(($val - $average), 2); } $stdev = sqrt($sum2 / ($num)); echo $stdev;exit;

android - Get ID from Photo when saving -

in application, catch photo , save on mobile phone then. this how that: private void takepic() { contentvalues values = new contentvalues(); string title = null; values.put(mediacolumns.title, title); string description = null; values.put(imagecolumns.description, description); values.put(mediacolumns.mime_type, "image/jpeg"); imageuri = getcontentresolver().insert(mediastore.images.media.external_content_uri, values); intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.extra_output, imageuri); intent.putextra(mediastore.extra_video_quality, 1); startactivityforresult(intent, image_capture); } my problem is, later want thumbnail of picture show thumbnail in listview. there way id of photo took , save intent or this? you can try quering mediastore.images.media.data media uri have instead in mediastore content provider protected void onactivityresult(int requestcode, int res...

linux - SQL or filesystem for FAST storing files/BLOBs? -

i have app stores quite lot of publications files on filesystem, using nested dirs "6/0/3/6/....". files not huge (.jpg, .pdf, similar documents), there's "just" lot of them, running gb hundreds. once stored in fs, typically never rewritten, served on http. searching, versioning through such files painfully slow. copying such dirs rather cumbersome. this got me thinking: not better store such data blobs in db (my app using postgres various purposes anyway). which 1 -- fs or scalable sql db -- perform better around? or pg collapse under weight? incremental backup much easier filesystem. recovering partial damage. versioning pretty easy on top of file system long don't need atomic change sets, individual file versioning. on other hand, using db gets transactional behaviour - atomic commit, multiple concurrent consistent snapshots, etc. costs disk storage efficiency , adds overhead access. means can't sendfile() data directly file s...