Posts

Showing posts from August, 2010

Has Ruby a keyword `define`? -

where can find documentation define (see snippet below) in ruby? define :brew package @name, :ensure => :present, :provider => :homebrew, :require => "vcsrepo[/usr/local]" end i not sure whether ruby keyword actually. wouldn't make sense tell people where saw snippet, provide context? it's you're looking @ puppet script: http://docs.puppetlabs.com/puppet/3/reference/index.html the place find definition of define , then, in puppet source .

upload - Script to Specify the FTP File Path -

anyone know if can specify file path ftp upload or script if there isnt ftp option in program? i'm using screenpresso screenshot software ftp upload doesnt have option send file path there scripting option program supports. have no idea coding used. ideas? when specify ftp address include subfolders ftp://foo/bar/baz/qux other try asking support.

objective c - Why would subclassing NSFormatter prevent me from editing NSTextField's input? -

i'm trying format 2 nstextfields smpte time codes, have format: hh:mm:ss:ff . however, when user switches smpte code drop-frame, delimiter between ss , ff needs switch ; ( hh:mm:ss;ff ). this, i've subclassed nsformatter, , have working except 1 stubborn problem. the text field accepts input fine, if highlight-replace, backspace, delete, or insert new characters text field, nsbeep , can't switch focus away text field. can input new text if delete whole text field first, not if try edit existing input. here implemented methods/overrides: - (nsstring*)stringforobjectvalue:(id)obj { if ( ! [obj iskindofclass:[nsnumber class]]) { return nil; } nsmutablestring *string = [nsmutablestring stringwithstring:@"00:00:00:00"]; int length = (int)[[obj stringvalue] length]; int insertlocation = 9; if (length == 1) { [string replacecharactersinrange:nsmakerange(10, 1) withstring:[obj stringvalue]]; } else ...

html5 - Why does the color of my lines gradually change in html 5 canvas? -

i wondering why vertical lines(strokes) slowing changing color being gradiented towards end below example of mean, using html5 canvas http://jsfiddle.net/yyhxv/ thanks help aiden the problem code stroke each time add line path. your line bit thin. values below 1 valid - activate sub-pixeling (as non-integer co-ordinates). the fading result of previous lines being drawn on top of each other. sub-pixel'ed give "fading" effect older lines have more "mixed" information newer lines makes them "stronger" in appearance. try modification: ( http://jsfiddle.net/yyhxv/2/ ) //... context.linewidth= 0.2; //0.1 bit thin, try cranking bit //... for(var interval = 0; interval < 24; interval++) { context.moveto(interval*spacing+0.5,50); context.lineto(interval*spacing+0.5,42); } //move stroke outside context.stroke();

how to solve "Undefined symbols for architecture armv7" when I add OpenCV in ARDrone ios? -

when add opencv project, happens "undefined symbols architecture armv7". it won't compile when remove opencv code. opengl can work before adding opencv. i have read this question didn't work me. 1 knows this? undefined symbols architecture armv7: "opengl_texture_destroy(ardroneopengltexture*)", referenced from: -[openglsprite dealloc] in openglsprite.o "opengl_texture_draw(ardroneopengltexture*, unsigned int)", referenced from: -[openglsprite drawself] in openglsprite.o "opengl_texture_init(ardroneopengltexture*)", referenced from: -[openglsprite initwithframe:withscaling:withprogram:withdrone:withdelegate:] in openglsprite.o "opengl_texture_scale_compute(ardroneopengltexture*, ardronesize, ardronescaling)", referenced from: -[openglsprite initwithframe:withscaling:withprogram:withdrone:withdelegate:] in openglsprite.o -[openglsprite checknewresolution] in openglsprite.o ...

Django forms can't find my template -

i'm trying make use of first django form, following this example . need provide explicit html form myself, or django's form class me? if so, how? here's current error: internal server error: /showcrime/query traceback (most recent call last): file "/library/python/2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) file "/users/rik/code/eclipse/djoakdata/showcrime/views.py", line 43, in getquery return render(request, 'getquery.html', {'form': qform}) file "/library/python/2.7/site-packages/django/shortcuts/__init__.py", line 53, in render return httpresponse(loader.render_to_string(*args, **kwargs), file "/library/python/2.7/site-packages/django/template/loader.py", line 170, in render_to_string t = get_template(template_name) file "/library/python/2.7/site-packages/django/template/loader.py...

multithreading - How can I ensure that NSOperationQueue uses only one thread? -

abaddressbookref can accessed 1 thread. think model having thread abaddressbookref in background, besides main thread. how can ensure there's 1 thread while using nsoperationqueue ? setting max concurrency 1 won't guarantee run on same thread. should use other unique threads web threads? you can manually create thread , redirect address book access it. you create thread ( adapted documentation ): nsthread* mythread = [[nsthread alloc] initwithtarget:[mythread new] selector:@selector(mythreadmainmethod) object:nil]; [mythread start]; // create thread note thread useful, have implement run loop in thread's main method. see example implementation of run loop in answer . you able do stuff on thread using nsobject 's method performselector:onthread:withobject:waituntildone: . here's wrapper library abaddressbookref implements concept – rhaddressbook .

c# - Non-Existant Ambiguous Reference Exception -

i @ end of sanity. have been trying incorporate archive , post pages of blogengine.net different site actual blogging site. of works, exception of post page 2 controls on ambiguous reference errors on them. i have tried cleaning, creating different web controls, referencing under different names, changing namespaces, changing controls, adding new controls, no matter do, ambiguous reference. trying go definition of control, presented 2 class paths, both of resolve same class. code sample on .ascx control, upon attempting select different web control, see exact duplicates of class. code sample everything duplicated , losing mind why. in visual studio 2012, using c#. compiles clean, app crashes on page references these ambiguous controls. control i'm trying use: <blog:simplecaptchacontrol id="simplecaptchax" runat="server" tabindex="6" /> also, simplecaptchacontrol class inherits webcontrol. have reference in web.config this: ...

Java BigDecimal : How to fortmat BigDecimal -

i'm using bigdecimal counting big real number. although have try 2 method : bigdecimal.tostring() or bigdecimal.striptrailingzeros().tostring() , still not sasitfy requirement. for example if use striptrailingzeros : 4.3000 becomes 4.3 4.0 becomes 4.0 not 4 . both above methods cannot sastisty conditions. so, question : how done in java ? thanks :) you can use decimalformat follows: bigdecimal = new bigdecimal("4.3000"); bigdecimal b = new bigdecimal("4.0"); decimalformat f = new decimalformat("#.#"); f.setdecimalseparatoralwaysshown(false) f.setmaximumfractiondigits(340); system.out.println(f.format(a)); system.out.println(f.format(b)); which prints 4.3 4 as bhashit pointed out, default number of fractional digits 3, can set maximum of 340. wasn't aware of behaviour of decimalformat . means if need more 340 fractional digits, you'll have manipulate string given tostring() yourself.

ios - Programatic NSLayoutConstraint animation issues -

so trying animate layout constraints , having miserable luck, dont see , error message saying how can't simultaneously satisfy constrains etc. i using class called pullableview animation using old style [uiview commitanimation] subclassed , added in code believe animating constraints...no such luck , attempting animate or of proving difficult "unable simultaneously satisfy constraints".. problem new constraint business not know start. here error other 1 pretty same centery. "<nslayoutconstraint:0x7c8a3a0 styledpullableview:0x905a9b0.centerx == uiview:0x9054680.centerx>", "<nslayoutconstraint:0x7c6b480 styledpullableview:0x905a9b0.centerx == uiview:0x9054680.centerx + 128>" i of course [pullrightview settranslatesautoresizingmaskintoconstraints:no]; before calling this any appreciated. - (void)setopenedforconstraints:(bool)op animated:(bool)anim { opened = op; if (anim) { nslayoutconstraint...

How to rename phpmyadmin? -

to access database use localhost/phpmyadmin want rename phpmyadmin i.e. want access database typing localhost/phpmyadmin_renamed. how can done? try this: on httpd.conf file find <ifmodule alias_module> must contains alias /phpmyadmin "${path}/phpmyadmin" now, change to: alias /phpmyadmin_renamed "${path}/phpmyadmin" note: "$(path)/phpmyadmin" can else depending upon server. alternative approach: or, can download phpmyadmin , extract phpmyadmin_renamed.

How to display RelativeLayout and ImageView on Android? -

i have added relativelayout , imageview dynamically, it's not displaying in emulator when run application. why? my code: relativelayout relativelayout = new relativelayout(this); relativelayout.layoutparams lp = new relativelayout.layoutparams( relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); imageview iv = new imageview(this); iv.setimageresource(r.drawable.freshface_mmm); relativelayout.addview(iv,lp); you need add relative layout activity using: setcontentview(view, params);

Javascript : How to increase a fraction value in a textbox ? example: 0.10 to 0.11 -

this question has answer here: how add 2 strings if numbers? 15 answers how sum 2 numbers input tag? [duplicate] 2 answers i need increase fraction in text box using javascript. the goal add 1 penny until 0.99 , 1.00 , 1.01 how can done in javascript? this not working. var a; = document.getelementbyid('a1').value; = a+a; alert(a); alert returns 0.100.10 additional info var a; = parsefloat(document.getelementbyid('b13').value); = a+a; alert(a); returns 0.2 i rather see 0.20 but importantly, how increase 0.01 @ time ? solved: both var a; = parsefloat(document.getelementbyid('a1').value); = a+0.01; alert(a); } and ... document.getelementbyid('a1').value = +document.getelementbyid('a1').value + 0.01 worked...

iphone - How combine UIImageViews and and save as Single in Gallery as Single Image -

in new iphone project, want combine 5 uiimageviews , and save single in gallery single image.. 5 images in same view possible..? this combining 2 images 1, you'll need tweak 5. - (uiimage*)imagebycombiningimage:(uiimage*)firstimage withimage:(uiimage*)secondimage { uiimage *image = nil; cgsize newimagesize = cgsizemake(max(firstimage.size.width, secondimage.size.width), max(firstimage.size.height, secondimage.size.height)); if (uigraphicsbeginimagecontextwithoptions != null) { uigraphicsbeginimagecontextwithoptions(newimagesize, no, [[uiscreen mainscreen] scale]); } else { uigraphicsbeginimagecontext(newimagesize); } [firstimage drawatpoint:cgpointmake(roundf((newimagesize.width-firstimage.size.width)/2), roundf((newimagesize.height-firstimage.size.height)/2))]; [secondimage drawatpoint:cgpointmake(roundf((newimagesize.width-secondimage.size.width)/2), ...

heroku - Attempted to Rename Transaction to "..." After Transaction Name Was Already Frozen -

i'm getting following warning on every request: attempted rename transaction controller/sessions/new after transaction name frozen. i'm running on cedar on heroku ruby 2.0.0p195 , rails 4.0.0.rc , unicorn 4.6.2 , rpm 3.6.2.96 . i've traced exception following file (line 108) i'm unsure of fix: https://github.com/newrelic/rpm/blob/master/lib/new_relic/agent/transaction.rb i work @ new relic. when message this, it's due component of our app known real user monitoring (rum), attempts monitor page load time in customer's browser. why should affect ability rename transactions? base timing capture in user's browser on transaction id--which tied transaction name on server--and information goes footer we've created web page. time create footer, whatever transaction name continue case through end of transaction. in case have slow page load corresponds slow app server transaction , captured both traces, in our ui you'll able click...

c++ - boolean variables for loops vs conditions -

here code: int main() { int input; bool iszero = false; while (!iszero) { ... if (0 == input) { iszero = true; } else { iszero = false; } } return 0; } the program supposed to, feel !iszero expression not foolproof. is bool iszero = false; while(!iszero); { .... } the same thing as bool iszero = false; while(iszero == false) { ... } why or why not? also, in cases true represent 1, , in cases represent nonzero number? while requires condition boolean , !iszero boolean. equality operator generates boolean, again iszero == false boolean. thing changed adding operator , (possibly) slowing down loop little (afair comparison slower bit operators). operations on boolean values similar operations on integer values. concerns can translated integers: "hey, x == 1 not foolproof, have check, whether x - 1 == 0 ". the bottomline is, !iszero absolutely foolproof enough. as int bool conversions, s...

Wordpress Meta Query two values to compare -

is possible compare 2 values meta_query? if value equals date earlier todays date or null 'meta_query' => array( $private_check, array( 'key' => 'event_date', 'value' => date('y-m-d'), 'type' => 'date', 'compare' => '<' // past posts. ) so compare '<' or null cheers after quick google search, came across this , seems dealing similar (but not quite) looking at. i don't have experience this, quick @ wordpress meta-query codex showed following accepted arguments exist: the following arguments can passed in key=>value paired array. meta_compare (string) - operator test 'meta_value'. possible values '!=', '>', '>=', '<', or '<='. default value '='.

ant contrib - ant - Need to get only file name without extension and entire path -

i have couple of .xml files in folder.i want loop on each .xml file.it getting fine. want take .xml file name without entire path. how can achieve that.? i using below piece of code file name. <target name="createapplicationdaa"> <for param="program"> <path> <fileset dir="${soaprojectname}/composites" includes="**/*.xml"/> </path> <sequential> <propertyregex override="yes" property="file" input="@{program}" regexp=".*/([^\.]*)\.xml" replace="\1"/> <echo>@{program}</echo> </sequential> </for> </target> the folder name c:/abc/bcd/cde first.xml,second.xml,third.xml,fourth.xml .xml files in cde folder. when execute above code getting entire path c:/abc/bcd/cde/first.xml ..etc want first first.xml , second second.xml. please me out achieve file name. edit after further inve...

elasticsearch - Stored field in elastic search -

in documentation, types, such numbers , dates, specifies store defaults no. field can still retrieved json. its confusing. mean _source? is there way not store field @ all, , have indexed , searchable? none of field types stored default. _source field is. means can sent search engine. if ask specific fields, elasticsearch going parse _source field , give fields. you can disable _source if want retrieve fields explicitly stored, according mapping.

What is the openssl command line to decrypt text encrypted by this php snippet? -

what openssl command line decrypting text encrypted using following php code? function encrypt($text, $key) { return trim(base64_encode(mcrypt_encrypt(mcrypt_rijndael_256, $key, $text, mcrypt_mode_ecb, mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_rijndael_256, mcrypt_mode_ecb), mcrypt_rand)))); } this how far got: "blah blah" encrypted "password" becomes: whsklkp6+wjdbgpiacavfp8biaz6b1lzmj0d7nqx2nc= i try , decrypt with: openssl base64 -d -in test.b64 > test.bin openssl enc -d -aes-256-ecb -pass pass:password -in test.bin -out test.txt and get: bad magic number

Casting date in Talend Data Integration -

Image
in data flow 1 table another, cast date. the date leaves source table string in format: "2009-01-05 00:00:00:000 + 01:00". i tried convert date using tconverttype, not allowed apparently. second option cast string date using formula in tmap component. at moment tried these formulas: - talenddate.formatdate("yyyy-mm-dd",row3.rafw_dz_begi); - talenddate.formatdate("yyyy-mm-dd hh:mm:ss",row3.rafw_dz_begi); - return talenddate.formatdate("yyyy-mm-dd hh:mm:ss",row3.rafw_dz_begi); none of these worked. when inserting result target-table (mysql, innodb) receive error message date not valid. format of target field mysql date field. how can cast date desired format? talend offers nice way of handling date formats. can change date format in schema editor tab @ tmap window. it works both tmap input , output flows. i've added picture better illustration.

actionscript 3 - What is wrong with this as3 piece of code? -

i'm as3 newbie , i'm trying send message through netstream function handle it. here line sends public function _attachlocalvideoandaudio(mutecam:boolean = false, mutemic:boolean = false):void { ... _outgoingstream.send("flagvideo",true); ... } public function flagv():boolean { var client:object; client.flagvideo=function(flag:boolean):void{ check=flag; } return check; } *check defined i'm using monster debugger debug , seems there problem inner function handles flag. there isn't tutorials on web on netstream.send() wrote code based on saw online.

c - Printing int values with a user determined padding? -

this question has answer here: set variable text column width in printf 2 answers i'm pretty sure there's no way this, wondering, here goes... say several int values user, , know fact 1st value largest. way can use length of first int value padding when printing rest of numbers? browsing forum found can determine length of int (n) this: l = (int) log10(n) + 1; using padding of 5 print like: printf("%5d", n); so want know whether or not there's way use l instead of 5... thank you! do so: int n = <some value>; int = (int) log10(n) + 1; printf("%*d", i, n); the * serves placeholder width being passed argument printf() .

html5 - Canvas zoom with contast/brightness -

can post links related html5 canvas zoomin , zoomout functionalities along contrast , brightness this link might you...... http://html5doctor.com/video-canvas-magic/

Python tkinter label widget mouse over -

my objective change text of label widget when mouse move on label.for 1 label this: import tkinter tk def fun1(event): label.config(text="haha") def fun2(event): label.config(text="label1") root=tk.tk() label=tk.label(root,text="label1") label.grid(row=1,column=1) label.bind("<enter>", fun1) label.bind("<leave>", fun2) root.mainloop() but now, have bunch of labels generated loop , list contains text want change. mylist=['a','b','c','d','e'] in range(5): tk.label(root,text="label"+str(i)).grid(row=i+1,column=1) this generate 5 labels numbers. possible add mouse on event each individual label when mouse on over label 1, changes 'a', when mouse on label 2, changes 'b', etc? fyi, number of items in mylist same number used in loop. import tkinter tk root = tk.tk() mylist = ['a','b','c','d','e...

resizable - jquery resisizable not working when wrapInner is used -

i have span nested within jquery resizable div, nested within jquery draggable div. i using wrapinner add textarea span when span clicked editing purposes. for reason, resizable not working. i dont know if missing obvious. any appreciated heres jsfiddle http://jsfiddle.net/vxfhd/ and code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> <script> $(document).on('click', '#span22', function (event) { $('#span22').wrapinner('<textarea style=...

r - Reduce PDF file size of plots by filtering hidden objects -

Image
while producing scatter plots of many points in r (using ggplot() example), there might many points behind others , not visible @ all. instance see plot below: this scatter plot of several hundreds of thousands points, of them behind other points. problem when casting output vector file (a pdf file example), invisible points make file size big, , increase memory , cpu usage while viewing file. a simple solution cast output bitmap picture (tiff or png example), lose vector quality , can larger in size. tried online pdf compressors, result same size original file. is there solution? example way filter points not visible, possibly during generating plot or after editing pdf file? as start can this: set.seed(42) df <- data.frame(x=x<-runif(1e6),y=x+rnorm(1e6,sd=0.1)) plot(y~x,data=df,pch=".",cex=4) pdf size: 6334 kb df2 <- data.frame(x=round(df$x,3),y=round(df$y,3)) df2 <- df[!duplicated(df2),] nrow(df2) #[1] 373429 plot(y~x,data=df2,pch=...

expressionengine endless redirect loop since upgrading to 2.6.1 -

since upgrading expressionengine site version 2.6.1 when go admin.php stuck in endless redirect loop. problem because url redirected missing ampersand: /admin.php?s=0&d=cpc=homepage should be: /admin.php?s=0&d=cp&c=homepage anyone know why happening if there fix? this bug in expressionengine 2.6 , 2.6.1. have modify system/expressionengine/libraries/core.php line 407 change ee()->functions->redirect(base.'c=homepage'); to be ee()->functions->redirect(base.amp.'c=homepage');

Checklist while upgrading Access to SQL Server Database -

i have 4 ms access database needs upgraded ms sql server database. 4 ms access database contains 10 tables each, comprising of 40 tables in total. hence, should develop 1 sql server database contain 40 tables or should have 4 different sql server database contain respective tables? in broader sense, things should sql developer should keep in mind while upgrading sql server ms access (or other database)? depends, 4 access databases functionally different? if interrelate, put 40 tables in same database. if need separation, security or otherwise, 4 databases 10 tables each.

Sync local Database (sqlce) to remote sql server -

i trying built following have no idea start. i want build windowsphone 8 app has local database contents can edited input fields. now, once user finnished editing database, , app has saved edits want app check wifi connection. once app has confirmed this, data local database has synced remote sql server. most of pretty plain simple question have is, how sync local database 1 on remote server? see if can use microsoft sync framework on windows phone: http://msdn.microsoft.com/en-us/sync/bb736753.aspx i had used in desktop applications results.

Facebook Key Hash on Android -

Image
i'm developing phonegap, created hash key test app using facebook features, app works fine on work computer. i want have development environment on laptop, again, went generate hash key... time, app won't run fb features, "something went wrong" whenever call fb.login (fb.init on other hand loads fine). i've been trying generate keys on laptop, , seems i'm getting different results depending on command line, giving me idea i'm not generating right keys @ all, both these machines run windows 8 , had no issues first one, command lines i've tried: note key generated. different line, different key! i using openssl-0.9.8e x64 (supposedly recent version no 64 bit systems - although in desperation tried new version). i've read generating key via java code - https://stackoverflow.com/a/9600642/1087947 , i'm not java person (phonegap guy), use this. a little late response, came across same issue , thought have write answer h...

blackberry 10 - how to add multiple markers on the google map just by url? -

i have android application, want convert blackberry 10 , google map needed in app,but blackberry 10 not support googlemap , blackberry developer web site supply way replace it.the sample below: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); webview webview = (webview) findviewbyid(r.id.mywebview); webview.getsettings().setjavascriptenabled(true); webview.loadurl("http://maps.google.com/?ll=36.97, -122&lci=bike&z=13&t=p"); } i cannot understand it,i not know how add multiple markers on googlemap via url? can me? this worked me map shown in webview.

iphone - Storyboard: Condition segue transition for navigation (push) -

i new storyboard , xcode (using 4.6) m using navigation storyboard push segue. implement select snap view, if have minimum 1 snap selected - segue work. otherwise, user should stay on same view. i created 2 uiview: selectsnapsviewcontroller , shippingdetailviewcontroller. in selectsnapsviewcontroller.m added following: - (ibaction)nextbuttonpressed:(id)sender { loosedataalert = no; [okkkbtn setframe:cgrectmake(116, 272, 72, 37)]; if ([appdelegate.selimagedetails count] == 0) { label1.text = @"to proceed need add snaps."; [self openalertview]; } else{ [self performseguewithidentifier:@"mysegue" sender:self]; } } when debug code - see fall in else case of condition, segue (transition new view) still happens. how can prevent user transferred new view? there 2 ways implement conditional segues. 1) configure segues 'manual' viewcontroller , invoke performseguewithidentifier conditionall...

android - Why can't I use relativeLayout as the parentView? -

this have setcontentview(r.layout.activity_main); , don't understand why every time run app crashes. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainbody" android:layout_width= "wrap_content" android:layout_height= "wrap_content" > <linearlayout android:id="@+id/boss" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> </linearlayout> </relativelayout> but if use <linearlayou> main parent instead, won't crashes! <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainbody" android:layout_width= "wrap_content" android:layout_height= ...

jackson - jackson2.2.0 can not work on android2.2 -

when using jackson2.2.0 on android2.2(api8), got error: could not find class java.util.concurrent.concurrentnavigablemap , referenced method com.fasterxml.jackson.databind.deser.basicdeserializerfactory.<clinit> i've tested code on android2.3.3(api10) , android4.0.3(api15), both works. does 1 knows how fix this? or have use jason parser instead. this has been reported on jackson's issue tracker . fix due in 2.2.2 next week or so.

Only one browser running with selenium Grid while other are launched inactive -

i running tests on selenium grid.i facing problem 1 browser(firefox) fed commands b server.other browsers launched load url , stay still.no activity happens in other browsers. similar posts figured out using static selenium instance . public static selenium selenium=null; public webdriver driver; and obtaining webdriverbackedselenium intance, scripts coded work selenium rc years back. driver= new remotewebdriver(new url(nodeurl.concat(port).concat("/wd/hub")), selenium = new webdriverbackedselenium(driver, url); now, have lot of static methods,as make selenium instance non-static,my tests flooded java errors.what possible solution can here.

c# - Add value to Many to Many relationship with EF 5 & ASP.NET MVC 4 -

using code first / mvc 4 / ef 5 i have place object: public class place { public virtual int placeid { get; set; } public virtual icollection<tag> tags { get; set; } public virtual datetime dateadded { get; set; } public virtual string name { get; set; } public virtual string url { get; set; } } and tag object - many many relationship between them public class tag { public virtual int tagid { get; set; } public virtual string name { get; set; } public virtual string nameplural { get; set; } public virtual icollection<place> places { get; set; } } i have tags in database - eg "pub", "bakery". when try , assign tag place - says "object reference not set instance of object." example, tags "bakery" & "pub" in database - run this: place myplace = new place { placeid = 1, name = "shoreditch grind", ...

Directory listing using PHP -

<?php function directory_listing($directory_name) { if ($handle = opendir($directory_name)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { if(is_dir($entry)) { **//program avoiding block echo $entry.'--<br/>';** } else { echo $entry.'<br/>'; } } } closedir($handle); } } directory_listing('go'); ?> i have directory listing above code. program avoiding mentioned if block . thanks foysal to list directories can use directoryiterator $iterator = new directoryiterator('pathtoyourdir/'); foreach ($iterator $fileinfo) { if ($fileinfo->isdir()) { echo $fileinfo->getfilename() . "\n...

core graphics - Rendering a gradient in a UIBezierPath -

how 1 render gradient inside uibezierpath , possible store state bezierpath faster re-rendering in drawrect? i render bezierpaths inside drawrect cannot add gradient. when call method cgcontextdrawlineargradient (ctx, gradient, gradientstartpoint, gradientendpoint, 0); dont have endpoint. i tried using bezierpath.currentpoint dont expected results.

java - Jetty Maven plugin reload ignores web.xml listeners -

i have spring mvc java web application using 2 spring contexts. root application context, loaded via contextloaderlistener, , servlet context. i'm loading application jetty maven plugin without problems (9.0.0.rc2), when try reload app manually console scanner (just hitting enter in console), application gets loaded again, contextloaderlistener not called, , servlet context fails not find beans in root context. the log in initial load goes this: 2013-05-21 12:13:32.676:info:oejw.webinfconfiguration:main: adding virtual project first in resource base list 2013-05-21 12:13:33.149:info:oejpw.plusconfiguration:main: no transaction manager found - if webapp requires one, please configure one. 2013-05-21 12:13:34.879:info:/:main: no spring webapplicationinitializer types detected on classpath 2013-05-21 12:13:36.241:info:/:main: initializing log4j [classpath:log4j.properties] slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/c:/users/j.caler...

ruby on rails - Problems with custom submit in FormBuilder -

i'm writing custom formbuilder, , don't understand why output of method below def submit(label = "save changes", *args) options = args.extract_options! new_class = options[:class] || "btn btn-small btn-success" @template.content_tag(:div, :class => "form-actions left") @template.content_tag(:button, :class => new_class, :name => 'commit', :type => 'submit', :value => label) @template.content_tag(:i, :class => 'icon-arrow-right icon-on-right') end end end is: <div class="form-actions left"> <button class="btn btn-small btn-success" name="commit" type="submit" value="salvar"> <i>{:class=&gt;&quot;icon-arrow-right icon-on-right&quot;} </i> </button> </div> especially "i" tag. how can fix it? thanks. so if content_tag gets block, block r...

visual studio 2010 - C++/CLI "could not import member" warning when using shared_ptr as argument -

i have following interface in c++/cli: public interface class isharedptrinterface { void printsharedptr(std::shared_ptr<std::wstring> ptr); }; which implemented follows: public ref class sharedptrclass : public isharedptrinterface { public: virtual void printsharedptr(std::shared_ptr<std::wstring> ptr) { system::console::writeline(gcnew system::string(ptr->c_str())); }; }; compiling in visual studio 2010, following warning: 1>testsharedptrinterface.cpp(8): warning c4679: 'isharedptrinterface::printsharedptr' : not import member 1> diagnostic occurred while importing type 'isharedptrinterface ' assembly 'anotherclrproject, version=0.0.0.0, culture=neutral, publickeytoken=null'. if run compiled method, following runtime error: method 'printsharedptr' in type 'sharedptrclass' assembly 'clrproject, version=0.0.0.0, culture=neutral, publickeytoken=null' not have implemen...

asp.net - How Authenticate by WebMethod -

i passed username , pass webmethod in .aspx page ajax in json format, want authenticate users , redirect user same page , update loginview logedin state; how can it? here's webmethod [webmethod] // [ [system.web.script.services.scriptmethod(responseformat = responseformat.json, usehttpget=false)] public static void login(object mydata) { javascriptserializer js = new javascriptserializer(); list<nameval> myfrm = js.deserialize<list<nameval>>(mydata.tostring()); // membershipuser u = membership.getuser(myfrm.singleordefault(rs=>rs.name=="username").value); if ( membership.validateuser(myfrm[0].value,myfrm[1].value)) { formsauthentication.authenticate(myfrm[0].value, myfrm[1].value); //formsauthentication.redirectfromloginpage(myfrm[0].value, false); formsauthenticationticket tkt; string cookiestr; httpcookie ck; tkt = n...

php - mysql post from html table -

i trying sql post information html form database keep getting: ( ! ) scream: error suppression ignored ( ! ) notice: undefined index: firstname in c:\wamp\www\insert.php on line 29 call stack # time memory function location 1 0.0005 247624 {main}( ) ..\insert.php:0 the code using is: <form action="insert.php" method="post"> name: <input type="text" name="firstname"> <input type="submit" value="submit"> </form> <?php // connection database $con = mysql_connect('127.0.0.1', 'shane', 'diamond89'); if (!$con){ die('could not connect: ' . mysql_error()); } // selects database want connect $selected = mysql_select_db("shane",$con); if (!$con){ die("could not select data"); } // inserts new information database $name = $_post['name']; $query = "insert test1 values('id', '$name')"; m...

java - NullPointerException in put method of HashMap -

i know been asked many times before still cant understand mistake.. this normal code writing counting number of repetitions in array( :) might long method doing this, kindly suggest smaller way if can think of) public int find(int[] sequence) { arrays.sort(sequence); int temp=0,count=0,j=0; hashmap<integer,integer> data = new hashmap<integer,integer>(); for(int i:sequence){ integer c = new integer(count); integer d = new integer(j); if(i!=temp) { if(count!=0) data.put(c,d); count++; j=1; temp=i; } else j++; } count++;//this 1 causes error //system.out.println(count); integer c = new integer(count); integer d = new integer(j); data.put(c,d); long ans = theswapsdivtwo.factorial(sequence.length); for(int i=1;i<=data.size();i++){ ans /= theswapsdivtwo.factorial(data.get(...

php - /bin/sh: 0: command not found -

i have following problem guys, php script this: #!/usr/bin/php <?php // define path file $file = 'mydb.sql'; if(!file) { // file doesn't exist, output error die('file not found'); } else { // set headers header("cache-control: public"); header("content-description: file transfer"); header("content-disposition: inline; filename=$file"); header("content-type: application/x-sql "); header("content-transfer-encoding: binary"); // read file disk readfile($file); } ?> now want call php script via crontab, , cron command is: 0 0 * * * /web/conf/ -q /home/content/81/10928381/html/dumper/work/backup/pr_download.php but why, every time run script, it's sent me error message : /bin/sh: 0: command not found can me guys? thanks what /web/conf/ ? missing executable command here... did want wget ? if want use php executable instead, exe...

java - Convert HTML to PDF and add it to a paragraph -

i want add paragraph, containing html, document. far know, itext supports adding html document directly via xmlworkerhelper. furthermore want change font of html, can done css-file. my approach similar code: xmlworkerhelper worker = xmlworkerhelper.getinstance(); worker.parsexhtml(pdfwriter, document, fis); but solution writing document directly. want add html paragraph, may add additional formatting section. go parsing html step step . in example, final pipeline pdfwriterpipeline isn't want (because pipeline writes stuff document). want replace final pipeline elementhandlerpipeline , converting html tags encountered elementlist . once have list of element instances, it's decide (adding them paragraph 1 option).

java - Simplifying an if-statment -

i have program few if -statements similar 1 i'm present you. wondering if guys me simplify equation in way. reason why ask because in notepad++, continues on 443 columns , it's frustrating edit if needed, , keeps getting longer keep adding variables. basically, example of 1 of many similar if statements, want action when of sliderbars try raise in value when int ( rpg.statisticpoints ) equal to, or less 0. method i'm using find out if sliders rising in value compare current value int associated slider, , check if result positive. if (rpg.statisticpoints <= 0 && ((rpg.willslider.getvalue() - rpg.will) < 0) && ((rpg.perceptionslider.getvalue() - rpg.perception) < 0) && ((rpg.strengthslider.getvalue() - rpg.strength) < 0) && ((rpg.dexterityslider.getvalue() - rpg.dexterity) < 0) && ((rpg.constitutionslider.getvalue() - rpg.constitution) < 0) && ((rpg.charismaslider.getvalue() - rpg.charisma) < ...

static - Extensions method replaces the standard method in C# -

there ways use extension methods signatures of standard methods extension (without explicit appeal static class)? example: public class foo { public override string tostring() { return "own"; } } public static class extensionsmethods { public static string tostring(this foo foo) { return "extensions"; } } class program { static void main() { var foo = new foo(); console.writeline(foo.tostring()); // "own" printed } } can use extensions- tostring version without explicit appeal class extensionsmethods no, cannot this. extension method not used if method same signature available: you can use extension methods extend class or interface, not override them. extension method same name , signature interface or class method never called. see extension methods (c# programming guide) binding extension methods @ compile time details. there might inherit...

ajax - Referring to parent loop from a nested loop -

here's i'm trying achieve: have 2 tables in db - 'regions' , 'distributors', both have region_id column. want, to: 1) iterate through 'regions' table, each region create div region_id div id, append region_name div. 2) have nested loop, iterate through 'distributors' table, pull distributors has same region_id , append same div stage 1. so tried code: $(function(){ $.getjson("inc/api.php", {command:"get_regions"}, function(result){ var div_length = 786/result.length; for(var i=0; i<result.length; i++){ var div_name = "div_region_"+result[i].region_id; $("<div id='"+div_name+"' class='div_region' style='width:"+div_length+"px; float:right;'></div>").appendto("#content"); $("<b>"+result[i].region_name+"...

jquery - dynamically positioning a absolute element related to another element -

i have particular reason position logo on banner , logo has postion:absolute , when resize browser window have alignment problem, far figured out solution jquery goes this: $(document).ready(function(){ alert($(document).height()); var lopos = $('.banner1').children('img').height()/2; $('.logo').children('img').css('top', lopos); }); the banner image has max-width:100% , using jquery's height() height , divide 2 can use position logo on top. sucessful far problem happens on time, , when rezize browser dont see values change. is there way can make code work on window size change? i not sure understand question correctly, may suggest 'javascript free' solution. provided html looks this: <div id='banner'> <img src='http://placehold.it/1500x300'/> <div id='logo'>logo</div> </div> you position logo on top of banner img this: #banner {...

async.js - RequireJS does not accept URL`s in the config`s paths declaration -

i want inject google way can inject own google mock in runner.js unit testing not want http calls. paths: { lib: 'lib', async: 'lib/async', google: 'async!http://maps.google.com/maps/api/js?sensor=false' }, define(['google'], function(google) { }); google undefined. when use define works: define(['async!http://maps.google.com/maps/api/js?sensor=false'], function(google) { }); but can not use way because goodle hardcoded string in production code. way can not inject own google mock in unit test in runner.js path definition... why first way not work? google libraries not implement module pattern. expose functionality global google variable. in mock library mock on globally accessible google variable. workaround include shim configuration when loaded, requirejs knows pass module: requirejs.config({ // ... shim: { 'google': { exports: 'googl...

java - difference between Hibernate Session and EntityManager -

this question has answer here: jpa - hibernate 3 answers what difference between hibernate session class , entitymanager class? know entitymanager implements java persistence api, not sure relation session . related @ all? session hibernate-specific api, entitymanager standardized api jpa. can think of entitymanager adapter class wraps session (you can session object entitymanager object via getdelegate() function). this not dissimilar other java apis around (for example, jdbc standard api, each vendor adapts product api via driver implements standard functions).

ios - Open one App from another programmaticaly -

this question has answer here: launch app within (iphone) 12 answers we have standard sap bi app , don't have code , our company purchased our internal use , pm has asked me open sap bi app our custom app programmatically , have done using url scheme's , facing problem wants me open our custom app automatically when ever user clicks on specific button in standard sap bi app don't have code. is possible open custom app sap bi app. the way open app other app enable in code of app want opened. if app dones't provide url scheme open it, can't' read more here: launch app within (iphone)

internet explorer 10 - IE10 oninput event repeatedly triggered on redirection -

i've been experiencing odd problem ie10 when redirecting page on 'oninput' event (with no equivalent issue when using chrome). i've produced pared-down version of code still exhibits problem, follows: <html> <head> <script type="text/javascript"> function onchangeinputtext() { window.location.href = "oninput_problem.html"; // page. } </script> </head> <body> <input type="text" oninput="onchangeinputtext()" value="£" /> </body> </html> on windows 7 pc using ie10, code when browsed (either double clicking or via apache) repeatedly redirects if act of initialising value of input text box generating immediate 'oninput' event. however, when change initial input text box value '£' symbol letter 'a', repeated redirection doesn't occur. i first noticed problem part of project i'm working on. in case, user's ...

android - Can I catch resizing of the window (entering to multi window mode), when I use Multi Window feature? -

i implement application wich uses multi window feature. want know, can cath entering multi window mode? there listeners it? thanks. i don't think there listener multi-window mode. what try add callback window, , detect when window size changed (through onwindowattributeschanged).

excel - Complex Macro- Creating tree relations -

i need creating macro perform following function, or similar (i not sure whether possible create such macro) : i have 60,000 + rows of data 2 columns, assemblies , components. assembly has multiple components ex: assembly/comps image however, assembly can component. i need make tree of relationships between assemblies , components, find highest level , children assemblies , children of children. please let me know if there way can make things easier! ok, 2nd approach think set following: sheet 1 - existing data table 60,000 rows sheet 2 - "goes into" analysis, specific part number in cell a1 (or wherever want it), , cell a1 selected a "goes into" macro following: starts in current cell , increments row number , sets indent level of 1 gets list of matches in data table assemblies selected component goes (see http://office.microsoft.com/en-us/excel-help/how-to-look-up-a-value-in-a-list-and-return-multiple-corresponding-values-ha00122603...

multithreading - Log4Net C# logging issue with multi-thread code execution -

i using log4net log exception in .net windows service application. i want mention that, windows service application running multi-threading execution , means each task being processed on each different thread , have used delegate - (begininvoke) pattern. importantly, using dynamic properties generate multiple log files dynamically log4net based on application's different scenarios. now, on every logging/ exception scenarios (in c# method), have used logger.log method log info/ exception log4net . code (dynamic file generation) globalcontext.properties[filenameparameter] = directoryname + filename; logmanager.info(logmessage); config settings <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file type="log4net.util.patternstring" value="d:\data\%property{filename}_info.log"/> </appender> the problem (i believe), due multi-threaded code execution, getting foll...

javascript - HTTP GET not working in AngularJS? -

here controller, being served localhost port 80: function listctrl($scope, $http) { $http.get('/api/moz').success(function (data) { $scope.moz = data; }); } and output curl: curl -i localhost/api/moz http/1.0 302 found date: tue, 21 may 2013 13:35:43 gmt server: wsgiserver/0.1 python/2.7.4 content-type: application/json [{"sid": 0, "sname": "sa"},{"sid": 0, "sname": "ab"},{"sid": 0, "sname": "ds a"}] unfortunately output {{moz}} [] . been working on many hours now, , have no clue how work. scaffold identical step5 of angularjs tutorial. you're retrieving array, , need iterate on it. try in template: <ul> <li ng-repeat="m in moz">{{m.sname}}</li> </ul>

html - Responsive website not responding over multiple browsers -

okay having serious issue have never come across ever before. cant figure out issue. i made website both fluid , responsive. make websites first on chrome , fix issues in ie , firefox, along other browsers aswell. my website functional on chrome. see responding change in browser width. when site complete , time shift check issues on other browsers. shocked see not responding on browser other chrome. any appreciated. you can check out website, http://demos.affixy.com/travelagents/ i sorry forgetting include link demo site. possibilities based off limited information... you have 2 declarations ipad media query in css, 1 portrait, 1 landscape, yet values of media query same. despite that, there typo on media query of both: you have: @media ((max-width: 1024px) { should be: @media (max-width: 1024px) { these on lines 612 , 675 of style.css likely guy chrome detecting error , fixing you, other browsers detecting error , well.. erroring out.

post - How to use JMeter to test encoding in HTTP Request? Burp Suite? -

i have develop security testing framework make sure output in our application encoded. i have many post & http requests each request may have 1 or many parameters what wanted jmeter: i need test each parameter individualy changing value string. if have 2 requests, 5 parameters each have run 5 times. in addition have assertion point validate response data. some ideas had record http requests.from jmx file create spreadsheet request details, parameter & value. go through list , modify each value string value canary123!@#$%^& (. verify response data not contain canary123!@#$%^& ( , in fact came encoded. run test each data row. also thought these might useful: counters, reg expression, user variables... should use jmeter task? if so, how? should use burp suite? i'd recommend using security tool specialises in sort of thing - check more encoding. burp good, free version doesnt include automated scanning. i'd recommend looking @ owasp ...

php - How to distinguish accents in sfValidatorDoctrineUnique? -

i have field domain_name in form must unique. have unique validator : $this->validatorschema->setpostvalidator( new sfvalidatordoctrineunique( array( 'model' => 'domain', 'column' => array('domain_name') ), array('invalid' => 'this domain exist.'))); but validator not recognize accents. instance, both domain names, example.fr , éxample.fr , same him, , throws error. how can make difference between both (with accents , without accents) ? if, j0k says it's not sql issue, may want build own validator following guideline: http://symfony.com/legacy/doc/more-with-symfony/1_4/en/05-custom-widgets-and-validators#chapter_05_building_a_simple_widget_and_validator , using regex catch accents.

Javascript - how to display a given text as string -

i learning javascript during free time. part of small project, wanted users youtube video id, width , height using html form , use write in below format. for example, if user inputs width = 640, height = 360 , video id = ibogovrkfje, final output below: <iframe width="input_width" height="input_height" src="http://www.youtube.com/embed/input_videoid?rel=0" frameborder="0" allowfullscreen></iframe> when used document.write below not processed since 2 double quotes come together. document.write "<iframe width=""; so, used html ascii " double quotes document.write "<iframe width=&#34;"; now problem ; the ascii ; &#59; i totally @ loss, don't know how proceed, have been working on week. sorry not point question , or alternative in regard appreciated. thanks! either escape doublequote: document.write("<iframe width=\""); or use differe...

auto increment - change auto_increment within same table using subquery mysql -

i using mysql. have database table auto_increment counter set. because of requirement need leave starting 100 ids free , move existing records starting 101, current id 1 go 101 , id 2 become 102 , on. i able move records 101 problem how change auto_increment counter max(id)+1. main constraint here me need in single sql statement. can not save value using @counter , use later. i tried using below query alter table role auto_increment = (select rd.counter (select (max(id) + 1) counter role r) rd); but not working. the parser not support subquery in place trying use it. here's excerpt mysql source, sql/sql_yacc.yy: create_table_option: . . . | auto_inc opt_equal ulonglong_num what should read there auto_increment table option accepts single literal number, not expression or subquery or variable or else. can't set auto_increment in same statement in select max(id)+1 . but don't have to. mysql never allocate auto-increment id less than ...