Posts

Showing posts from August, 2014

integer - JAVA: [-255...255] int to 2 bytes array -

i have integer can contains values between - 255 , 255. know can represented 2 bytes (i'm right?) how can convert int 2 bytes array? many rather store in 2 distinct bytes , implement own custom encoding , decoding, easiest store these values in short . 16 bit signed integer sufficient range values.

Apply a function multiple times in Haskell -

this question has answer here: how call same function 'n' times? [duplicate] 4 answers library function compose function n times 8 answers learn haskell great good (section "higher order functions", subsection "some higher-orderism in order" ) describes example function applytwice calls function on argument twice: applytwice :: (a -> a) -> -> applytwice f x = f (f x) but need function applies function on argument arbitrary amount of times. example applyn 3 f x equivalent f $ f $ f x . how write function of repeated application in haskell? please post possible solutions, using recursion, higher-order functions or else. i did iterate f x !! n .

debugging - Is there a Python 3.x debugger for embedded interpreter? -

i've embedded python in c++ application. there graphical debugger can attach debug scrips run in embedded console python 3.4? previously (when using python 2.7) i've used winpdb , attached debugger with import rpdb2; rpdb2.start_embedded_debugger(password) but winpdb doesn't work wxpython phoenix needed python 3.x. i must load debugger inside embedded interpreter since lot of modules available there, scripts can't run outside environment. what alternatives there winpdb embedded debugging gui? or there updated version of winpdb works wxpython phoenix? thanks! you can use ptvs (python tools visual studio) or pydev on eclipse remote debugging.

jquery - Adding scripts in MVC -

i starting first mvc application. here have basic confusion. default _layout.cshtml file created below <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>@viewbag.title</title> @styles.render("~/content/css") @scripts.render("~/bundles/modernizr") </head> <body> <script> </script> @renderbody() @scripts.render("~/bundles/jquery") @rendersection("scripts", required: false) </body> </html> i used basic template not have template. check '@scripts.render("~/bundles/jquery")' line. after @renderbody(). adds after body section. i think best practice. if add $.(document).ready shows following error microsoft jscript runtime error: '$' undefined based on error, because of script tag. moved '@script...

rest - SoapUI WADL authentication -

in order view wadl file server in internet browser it's necessary authenticate. test webservices using soapui when add new project , in initial wadl/wsdl enter path wadl file on server project created operations not listed. how authenticate user , password in order valid wadl? if using soapui version 4.6.4, there bug importing authentication protected wsdl provokes basic credentials prompt not showed up. can see more details here . there maintenance build soapui pro bug solved: http://www.soapui.org/downloads/soapui-pro-nightly-builds.html .

Update destination directory with new files (if modified) using ant -

i'm facing problem ant "copy". here requirement: want sync 2 dirs(dir1 , dir2) want keep files/dirs present in dir2. aim want copy dir1 contents(if modified ) dir2 want keep additional files/dirs present in dir2. i tried ant's sync task, trying keep both dirs in sync ie., deleting contents present in dir2. don't find flag disable feature: <sync todir="dir2" failonerror="true" verbose="true"> <fileset dir="dir1" excludes="*.svn" /> </sync> i tried ant's copy "modified" selector, doing same: :( <copy todir="dir2" failonerror="true"> <fileset dir="dir1" excludes="*.svn" > <modified/> <!-- copies modified files --> </fileset> can 1 suggest, how can achieve requirement ant? by default, ant copy task not overwrite files: <copy t...

html - How to pointing skrollr-menu from other site? -

i have 2 sites: main-site , blog site. both of them have same navigation. main-site parallax site using skrollr , skrollr-menu. blog, used wordpress. the code in main-site navigation , related div : <ul> <li> <a href="#about" data-menu-top="2114">about us</a> <ul class="clearfix"> <li><a href="#lin" data-menu-top="2334">lin</a></li> <li><a href="#young" data-menu-top="5080">young</a></li> </ul> </li> </ul> <div class="clearfix" id="about scroll-3"> <div class="about-us"> <h2 data-500-top="opacity:1;" data-anchor-target="#scroll-3 .about-us h2" data-top="opacity: 1">about us</h2> <div class="col-3" data-436-top="opacity:0;top:-100px...

android - Log.d(String, String) crashes my program? -

if add code of methods check fragment being null or not; program crashes. if comment out log.d(), program not crash? what wrong here? if(cyclefragment.equals(null)){ log.d("testing cyclefrag null", "cyclefrag null"); }else{ log.d("testing cyclefrag null", "cyclefrag not null"); } if(cyclefragment.a1.equals(null)){ log.d("testing a1 null", "a1 null"); }else{ log.d("testing a1 null", "a1 not null"); } logcat: 03-24 03:37:27.461: e/trace(13979): error opening trace file: no such file or directory (2) 03-24 03:37:27.928: e/androidruntime(13979): fatal exception: main 03-24 03:37:27.928: e/androidruntime(13979): java.lang.runtimeexception: unable start activity componentinfo{com.nanospark.upcdemo/com.nanospark.upcdemo.mainactivity}: java.lang.nullpointerexception 03-24 03:37:27.928: e/androidruntime(13979): @ andr...

html - The divs overlapping when minimizing the browser -

Image
this 2 divs: this screen: when minimuse browser, overlapping happens what should please? to make clear the left div size keep static when mimizie browser, why right div becoems on left div edit2 when tried ruddy's solution, got this: well can solved via responsive design 1 thing can try use percentages(%) of html elements manage element overlapping problem may upto extend otherwise responsive web design necessary solution !

regex - Shell script to rename multiple files from their parent folders -

i'm looking script below structure: before : /description/testcvin/opencvin/namecv/..... /description/blacvin/baka/namecv_hubala/...... /description/cvintere/oldcvimg/namecv_add/..... after: /description/testaplcvin/openaplcvin/nameaplcv/..... /description/blaapcvlin/baka/nameaplcv_hubala/...... /description/aplcvintere/oldaplcvimg/nameaplcv_add/..... i want rename " cv or cv or cv " >> "aplcv or aplcv or aplcv" in folder regular expression... my script like: #!/bin/sh printf "input directory path: -> " read dir cd "$dir" filecase=$(find . -iname "*cv*") last_dir_name="" fdir in $filecase if [[ -d $fdir ]]; last_dir_name=$fdir fi file=$(echo $fdir | sed -e "s/\([cc][vv]\)/arpl\1/g") echo "la file $file" if ([[ -f $fdir ]] && [[ "$fdir" =~ "$last_dir_name" ]]); fil...

android - SharedPreferences is Safe for saving highscores -

well using google play service , have leaderboard. putting highscores sharedpreferences. is safe prevent changing highscores external? i publishing highscores this: sharedpreferences sp= mcontext.getsharedpreferences( "com.example", context.mode_private); string highscore= (sp.getlong("highscore", 0)); and updating leaderboard on google play service: games.leaderboards.submitscore(getapiclient(), getstring(r.string.leaderboard_example), highscore); you can use approach, add encryption on data. simplest make string base64. or strong way aes or other want , save shared prefrences. its little overhead on app security aspect covered fulfills gap. if want can add code of baase64 & aes here.

javascript - alternative method instead $watch in angularjs -

i have scope variable, when returns true, need trigger events or something. case, every first time, scope variable returns undefined , later returns true. in case used $watch method expected funcionality. there alternative approach same instead using $watch ? scope.$watch () -> scope.initiatechild , (value) -> if value true $timeout -> scope.buildonboarding() , 1000 you can try using angularjs $on() , $emit() , $broadcast() . here example: http://www.binaryintellect.net/articles/5d8be0b6-e294-457e-82b0-ba7cc10cae0e.aspx

algorithm - Bucket sort---why's the input range important? -

i'm doing algorithms course @ uni, , read following sentence on introduction algorithms 3ed, p200: ...bucket sort fast because assumes input. whereas counting sort assumes input consists of integers in small range, bucket sort assumes input generated random process distributes elements uniformly , independently on interval [0,1) why input has in [0,1)? why can't uniformly distributed sequence sorted using bucket sort? i imagine interval [0, 1) used in order obtain theoretical result. notice, interval can converted given interval there no loss of generality. is, in practice uniformly distributed sequence can sorted using bucket sort.

mysql - creating routine table for given array -

i have follwing data: [[subject1,day1,time 1]],[subject2,day1,time2]] and want table structure as time 1 time 2 sunday subject1 subject 2 monday subject1 subject 2 <table id="routineclasstable" class="table table-condensed"> <thead><tr> <td></td> <g:each in="${routinetime}" var="r"> <td class='${r.id}'>${r.timetable.starttime.format("hh:mm")}-${r.timetable.endtime.format("hh:mm")}</td> </g:each> </tr> </thead> <g:each var='d' in='${day}'> <tr> <td class='${d}'>${d}</td> <g:each in="${routinetime}" var="rt"> <g:each in="${subject}" var="sub"> <g:if test="${sub[1]!=''}"><g:se...

Blank screen while fetching JSON data from url android -

i fetching json response url. url returns huge json response. while response application shows blank(black) screen. want show progressdialog while data loads. unable think can place dialog box. here code: jsonarray mydataitems = null; arraylist<hashmap<string, string>> mydatalist = new arraylist<hashmap<string,string>>(); textview txttitle; textview txtbody; imageview imgthumbnail; hashmap<string, string> map ; //url json array private static string url = "someurl"; progressdialog pdialog; jsonarray newsarray = null; private listadapter itemsadapter; //details detail = new details(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home); txttitle = (textview)findviewbyid(r.id.title); txtbody = (textview)findviewbyid(r.id.desc); imgthumbnail = ...

Using RazorEngine for Text and Html emails -

i'm using razorengine v3.3 create emails using template files (emails sent using sendgrid web api). implemented base template can use own html helpers overriding writeto() method shown here . my problem emails part html , part text. html templates, use razor's default implementation html-encodes @model values. because of data comes user input. however, can't use same implementation text part html not interpreted when being read. so way see have 3 options: use @raw(model) in text based templates ignore html encoding create other base template text templates doesn't encode html modify html base template writeto() method doesn't encode anything the 1st solution seems safest, have 50 text based templates go through, , reduces readability. the 2nd solution seems cleanest me, prevent use of cache, doing razor.settemplateservice() reassign right base template ? what recommend doing ? thanks

xcode - Objective C Pointer to pointer in method memory error -

i want return 2 objects method set method return nsdictionary , nsindexpath reference, shouldn't hard reason exc_bad_access error after method finished , returned. - (nsmutabledictionary *)sortedmessagesunreadindexpath:(nsindexpath **)indexpathforunreadmessage { ... if (indexpathforunreadmessage != null) *indexpathforunreadmessage = [nsindexpath indexpathforrow:array.count-1 insection:dict.count-1]; ... return dict; } // call nsindexpath *unreadindexpath = null; self.messages = [self.conversation sortedmessagesunreadindexpath:&unreadindexpath]; // exc_bad_access error here after method return self.unreadindexpath = unreadindexpath; edit using arc, ios 7 sdk, xcode 5

Javascript: indexOf -

i using following code search value in string. if (myvalue.indexof("call") > -1) { //dosomething } how can , or? (myvalue.indexof("call" || "data") > -1) the following works; if (myvalue.indexof("call") > -1 || (myvalue.indexof("data") > -1) ) { //dosomething } but thought there easier way? this way : myvalue.match(/(call)|(data)/ig)

How to generate a PDF file from jasperserver report using java -

am displaying jasper report through application using iframe tag inside jsp this <%string url="http://192.168.0.117:8081/jasperserver/flow.html?_flowid=viewreportflow&standalone=true&_flowid=viewreportflow&parentfolderuri=%2freports%2fsamples&reportunit=%2freports%2fsamples%2fallaccounts&decorate=no&j_username=jasperadmin&j_password=jasperadmin"; %> <iframe frameborder="1" class=repframe id="filteriframe" name="filteriframe" scrolling="no" src='<%=url %>' height=700px width=1500px> </iframe> now when user clicks on button should generate pdf file. tried many links showing sample code if .jasper or .jrxml files stored in web server can pick file , save pdf. me should pick jasper server location through url or report path , should stored in application server. suggest me how go about. append " &output=pdf " in report url downloading in pdf ...

asp.net mvc - Unhandled exception in jquery-ui-1.10.0.js. 0x800a138f - Microsoft JScript runtime error: Object expected -

i developing asp-mvc application in ie9, , when load first login page error; unhandled exception @ line 6953, column 7 in .../scripts/jquery-ui-1.10.0.js 0x800a138f - microsoft jscript runtime error: object expected i inside jquery-ui-1.10.0.js file , find code; _search: function( value ) { this.pending++; this.element.addclass( "ui-autocomplete-loading" ); this.cancelsearch = false; this.source( { term: value }, this._response() ); }, i find reason happens because; this.source set null. but haven't been able find out why , how fix it. i have tried locate this.source set. found code in jquery-ui; _initsource: function() { var array, url, = this; if ( $.isarray(this.options.source) ) { array = this.options.source; this.source = function( request, response ) { response( $.ui.autocomplete.filter( array, request.term ) ); };...

jquery - How do dynamically add an J Query onclick event to a carousel banner -

i have dynamic carousel banner on homepage (i have no control on html expect can add href, image ref , can add id link each carousel banner) can add an event first carousel banner not others. think it's because html doesn't exist banners when document loaded execpt first 1 carousel banner dynamic , changes every couple of seconds. i've added id second banner of testid , tried below code: $(document).ready(function(){ $('#testid').click(function(){ _gaq.push(['_trackevent', 'cbanner', 'idtest',$(this).attr('href'),0,true]); }); }); but onclick event still not working. thanks since buttons created dynamically dom, click event not available these buttons. in case, event delegation attach event. try this $(document).on('click','#yourdynamicbuttonid',function(){ });

Removing duplicates on subset of columns in R -

i have table [,1] [,2] [,3] [,4] [,5] [1,] 1 5 10 0.00040803 0.00255277 [2,] 1 11 3 0.01765470 0.01584580 [3,] 1 6 2 0.15514850 0.15509000 [4,] 1 8 14 0.02100531 0.02572320 [5,] 1 9 4 0.04748648 0.00843252 [6,] 2 5 10 0.00040760 0.06782680 [7,] 2 11 3 0.01765480 0.01584580 [8,] 2 6 2 0.15514810 0.15509000 [9,] 2 8 14 0.02100491 0.02572320 [10,] 2 9 4 0.04748608 0.00843252 [11,] 3 5 10 0.00040760 0.06782680 [12,] 3 11 3 0.01765480 0.01584580 [13,] 3 8 14 0.02100391 0.02572320 [14,] 3 9 4 0.04748508 0.00843252 [15,] 4 5 10 0.00040760 0.06782680 [16,] 4 11 3 0.01765480 0.01584580 [17,] 4 8 14 0.02100391 0.02572320 [18,] 4 9 4 0.04748508 0.00843252 [19,] 5 8 14 0.02100391 0.02572320 [20,] 5 9 4 0.04748508 0.00843252 i want remove duplicates table. however, colums 2,3,4 matter. example: rows 1...

c# - Regular Expression that having atleast two / any where -

i need 1 regular expression c# must have first letter w or w , whole textbox value must have 2 / . whole text can alphanumeric or digit must have 2 / , first letter w or w . ^[ww].*?\/.*?\/*[0-9]$ live demo

php - Declaring two namespaces in the one file -

as said in php reference namespaces declared using namespace keyword. file containing namespace must declare namespace @ top of file before other code - 1 exception: declare keyword. but further we've following code snippet in reference: <?php namespace myproject; const connect_ok = 1; class connection { /* ... */ } function connect() { /* ... */ } namespace anotherproject; //this namespace declaration doesn't located @ top of file. it's unclear. const connect_ok = 1; class connection { /* ... */ } function connect() { /* ... */ } ?> one declared @ top first 3 lines under myproject referes myproject namespace whereas other 3 under anotherproject refers anotherproject namespace. if @ least 1 namespace declared top, file correctly parsed (namespace switched dinamically) just more clear, can that <?php namespace myproject { const connect_ok = 1; class connection { /* ... */ } function connect() { /* ... */ } } namespace anot...

java - Logging debug messages -

out of curiosity, there benefit when logging (using log4j) use above approach: if (logger.isdebugenabled()) { logger.debug("new session created"); } rather just: logger.debug("new session created"); is merely (potential) performance enhancement , still relevant? should used wrap debug output? thanks thoughts! in use case, no, there's no benefit whatsoever. however, if constructing new string, example, "new session create" + sessionid, you'd want avoid string construction , rather use boolean check. it's small difference, in large application, string construction, , associated garbage collection, become point of performance impact. if pass static strings, however, creating duplicate check, which, while small, has possible performance impact.

visual studio - Are git bare repositories on network drives a bad idea for collaboration? -

we small team of 3-5 developers use around 20-30 visual studio projects. until didn't use source control method. we decided give git try. we have been playing success locally having our personal repositories track our development. now want start real use develop things in parallel using git properly. i wanted create bare repository each project , store local file server. i dont want go online on github or other system, nor want create git *nix box act server. is terrible idea?

php - An error in SQL syntax -

the sql statement follows: $sql = " insert usertable ( userid,, name, username, password, typeofuser, dateofaddition, createdby, status ) values ( $userid, '$empname', '$username', '$password', '$usertype', '$doa', '$createdby', '$radiobt' ) "; remove comma after userid , correctly include variables $sql = "insert usertable ( userid, name, username, password, typeofuser, dateofaddition, createdby, status ) values ( ".$userid.", ".$empname.", ".$username.", ".$password.", ".$usertype.", ".$doa.", ".$createdby.", ".$radiobt." )"; make sure prepare statement before getting db! (more info: prepared statement (wik...

itext - MakeSignature.signDetached throws No Such Algorithm exception (SUN provider & SHA-256) -

i trying digitally sign pdf document itext. since using hardware encryptor jce provider trying test getting rid of bountycastle in unit test , instead use default sun implementation time being (until hardware encryptor arrives). however, following exception when run program: exception in thread "main" java.security.nosuchalgorithmexception: no such algorithm: sha256 provider sun @ sun.security.jca.getinstance.getservice(getinstance.java:87) @ sun.security.jca.getinstance.getinstance(getinstance.java:206) @ java.security.security.getimpl(security.java:698) @ java.security.messagedigest.getinstance(messagedigest.java:215) @ com.itextpdf.text.pdf.security.digestalgorithms.getmessagedigest(digestalgorithms.java:159) @ com.itextpdf.text.pdf.security.providerdigest.getmessagedigest(providerdigest.java:61) @ com.itextpdf.text.pdf.security.makesignature.signdetached(makesignature.java:130) @ signdoc.signpdf(signdoc.java:142) @ signdoc.main(...

java - Parcelling complex objects b/w activities in android -

i have complex class "class11" containing socket,printwriter class references. getting exception while trying pass between activities. public interface interface11 extends parcelable{ ........... } public class class11 implements interface11 { socket clientsocket; serversocket serversocket; printwriter writer; bufferedreader reader; private jchatconnection(parcel in) { object [] objects= in.readarray(object.class.getclassloader()); clientsocket=(socket) objects[0]; serversocket=(serversocket) objects[1]; writer=(printwriter) objects[2]; reader=(bufferedreader) objects[3]; } @override public int describecontents() { return 0; } @override public void writetoparcel(parcel dest, int flags) { object objects[] = new object[4]; objects[0]=clientsocket; objects[1]=serverso...

f# - FSharp.Data 'System.MissingMethodException' when calling Freebase Provider from C# -

hi have piece of code on f#, if test f# interactive editor both ispalindrome , extract methods work well: namespace portable3 open fsharp open fsharp.data open microsoft.fsharp.linq open fsharp.data.freebaseoperators open mytrip.model.mytrip open mytrip.model.freebase open system.runtime open system.linq module math = let ispalindrome (str : string) = let rec check(s : int, e : int) = if s = e true elif str.[s] <> str.[e] false else check(s + 1, e - 1) check(0, str.length - 1) [<autoopen>] module extractor = [<literal>] let freebaseapikey = "aizasyco31ls" type freebasedatawithkey = freebasedataprovider<key=freebaseapikey> let extract mid = let datawithkey = freebasedatawithkey.getdatacontext() let place = datawithkey.commons.travel.``travel destinations``.where( fun x-> x.machineid = mid) |> seq.tolist let result = new place() let fir...

Rails - ActiveRecord Dirty - Getting associated objects from the changes hash -

i'm working on audit trail of sorts app user can see being changed throughout system. i have hash of changes activerecord dirty, follows: {"ingredient_type_id"=>[nil, 199575006], "name"=>[nil, "asdfg"], "amount"=>[nil, 3.0], "unit"=>[nil, "x"], "notes"=>[nil, "asdf"]} this works great , can parse need output , create database records info. i have 1 question - how can associated objects this? in case, ingredient_type? want output like: "ingredient type changed #{ingredienttype.find(199575006).name}." but i'm not sure how parse hash on dynamic basis that. pretty way you've suggested i'd have thought, don't need parse hash changes, dirty gives more that if ingredient_type_id_changed? unless ingredient_type_id.blank? ingredient_name = ingredienttype.find(ingredient_type_id).name else ingredient_name = 'blank' ...

visual c++ - Setting Cedit Text -

i have following code in trying set text in cedit text box: class cmetadlg : public cdialogex { public: cmetadlg(); // dialog data enum { idd = idd_meta }; protected: virtual void dodataexchange(cdataexchange* pdx); // ddx/ddv support // implementation protected: declare_message_map() public: cedit m_author; cedit m_sources; afx_msg void onbnclickedok(); }; cmetadlg::cmetadlg() : cdialogex(cmetadlg::idd) { } void cmetadlg::dodataexchange(cdataexchange* pdx) { cdialogex::dodataexchange(pdx); ddx_control(pdx, idc_author, m_author); ddx_control(pdx, idc_sources, m_sources); } begin_message_map(cmetadlg, cdialogex) on_bn_clicked(idok, &cmetadlg::onbnclickedok) end_message_map() void cemergenceapp::onfilemeta() { cmetadlg md; md.domodal(); md.m_author.setwindowtextw(cemergenceview::getdoc()->author); md.m_sources.setwindowtextw(cemergenceview::getdoc()->sources); } this gives me debug assertion error. assuming problem lies in lines: md.m_author.setwindowt...

Keep track of workflow change in OpenERP 7.0 -

is there way keep track of changes made on workflow status users can follow through process i'm implementing. ex: created on march 1st, user 1. submitted on march 1st, user 1. reviewing on march 2nd, admin. evaluating on march 4th, superuser. accepted on march 6th, megauser. so, fists record inserted when request created, second when workflow button "submit" clicked; third when workflow button "review" clicked , on. any thoughts or sugestions more welcome! using records of audit trail not option this. thanks in advance. -fc. i've solved using self.pool.get('obj_name').create(cr, uid,values) create new entries in second table. used function: def insert_trace(self, cr, uid, id_request, context=none): request = self.browse(cr, uid, id_request, context) values = { 'generic_request_id': id_request[0], 'executor': self._get_user(cr, uid, context), 'state': request[0].state...

c# - List Box item container style , Data Template with Convertor -

i have list box data template , convertor embedded it. <datatemplate x:key="datatemplate"> <border x:name="listitemborder" margin="0,2,0,0" verticalalignment="stretch" horizontalalignment="stretch" background="{binding converter={staticresource backgroundconvertor}}"> <grid horizontalalignment="center" verticalalignment="center"> <textblock... <image ... </grid> </border> </datatemplate> the convertor backgroundconvertor in above code add green background 2 items among 4 item in list box. i have applied style list box when tap on item well. <style x:key="listitemselectorstyle" targettype="listboxitem"> <setter property="bac...

ios - NSLayoutConstraint - I want to create side margins -

Image
i have view in container in of view controllers place in container, want have global side margins but don't know how add them container. i mean don't know how define nslayoutconstraint want. i want side margins of 20pts each side, left , right of container, in regards superview it should that: // view , bind uiview * view = childviewcontroller.view; nsdictionary *views = nsdictionaryofvariablebindings(view); // @"view" : view // add constraint view margins - -value- supertview - | in horizontal axis [view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|-20.0-[view]-20.0-|" options:0 metrics:metrics views:views]]; // same vertical axis [view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:|-20.0-[view]-20.0-|" options:0 metrics:metrics views:views]]; also, take @ tutorial: http://commandshift.co.uk/blog/2013/01/31/visual-format-language-for-autolayout/ . looks nice. good luck! ...

java - Self interruption of a thread -

the task make free thread interrupted when definite period of time expires. code doesn't work @ all. @ break points have irrelevant threads. well, have come end of wit. me? public class hotthread implements runnable { public hotthread() { this.file = null; } } public class freethread extends hotthread { private final int timeout; timer timer; interruptbytimer task; public freethread(int timeout) { super(); this.timeout = timeout; timer = new timer(); task = new interruptbytimer(timer); timer.schedule(task, timeout); } private class interruptbytimer extends timertask { timer timer; public interruptbytimer(timer timer){ this.timer = timer; } @override public void run(){ interruptthisthread(timer); } } public void interruptthisthread(timer timer){ timer.cancel(); thread.currentthr...

The ) is missing Crystal Report formula -

i trying write simple formula in crystal reports. created parameter , evaluating field. here example of formula: if {coatsendassignment.end_date} = " / / : : am" cstr (?custenddate,"mm/dd/yyyy") i know {coatsendassignment.end_date} = " / / : : am" true expression. ?custenddate in date format , convert string in format of "mm/dd/yyyy" . when type formula above, error "the ) missing." when try save formula. have read there possibility missing dll crystal reports, no can find dll missing. i using crystal reports 2011 , passing ?custenddate parameter in visual studio 2010 , value is: #03/21/2014# . can tell me wrong formula, or tell me dll missing? curly braces ( {} ) required fields: if {coatsendassignment.end_date} = " / / : : am" cstr({?custenddate},"mm/dd/yyyy")

android - getDrawingCache always returns the same Bitmap -

i'm working on project needs display dialog grayout (black/white) background. achieve i'm taking screenshot , of whole app, place screenshot on background of fullscreen dialog , put colorfilter on have grayed out. this works perfect first time, if scroll in underlaying content , request dialog again, shows same background 1 before. i use code: bitmap bitmap; view rootview = getactivity().getwindow().getdecorview().findviewbyid(android.r.id.content); rootview.setdrawingcacheenabled(true); bitmap = bitmap.createbitmap(rootview.getdrawingcache()); rootview.setdrawingcacheenabled(false); imageview.setimagebitmap(bitmap); in other words, getdrawingcache() returns same screenshot of app. i think that's because old bitmap still in drawing cache. because of this, first need delete cache , put new image in cache. take @ question, seems on same topic: deletion of drawing cache edit: so, here code working me. use button save bitmap , set bitmap image view: ...

ajax - AngularsJS POST JSON data to Symfony2 -

i know why not working , have angularjs app witch sends trough ajax data symfony2 application. can see, data sent in network console <?php namespace supbox\cloudbundle\controller; use symfony\bundle\frameworkbundle\controller\controller; use symfony\component\httpfoundation\jsonresponse; class foldercontroller extends controller { public function createaction(){ $post = $this->getrequest()->request; $name = $post->get("name"); $folder = $post->get("folder"); var_dump($post); die; } } angularjs code $http({ method: 'post', url: route.folder.create, data: { folder: $scope.id, name: name } }) opera network console output request url:http://localhost/supbox/web/box/folder/create request method:post status code:200 ok request headersview source accept-encoding:gzip,deflate,lzma,sdch accept-la...

ruby on rails - drop down select switches to first value in list in edit mode -

i have drop down select set below: <%= select_tag :city_id, option_groups_from_collection_for_select(@regions, :cities, :name, :id, :name) %> it works fine, except when load edit view list loads first item in select, not saved value. there parameter i'm missing? on rails 4. according documentation on option_groups_from_collection_for_select found here: http://apidock.com/rails/actionview/helpers/formoptionshelper/option_groups_from_collection_for_select has sixth parameter selected value, add last parameter value want , work: <%= select_tag :city_id, option_groups_from_collection_for_select(@regions, :cities, :name, :id, :name, "your_city") %>

Android - Split the paragraphs in a string -

i have long string holds tags p /p paragraphs. html string placed in web view. i need split paragraphs 2 , assign each 1 string. example: string a: <p> have orange <\p> <p> have apple <\p> <p> have banana <\p> <p> have fruit <\p> <p> love go bike riding<\p> <p> hello how <\p> need split paragraphs 2 , assign 2 different strings: string b should have: <p> have orange <\p> <p> have apple <\p> <p> have banana <\p> string c should have: <p> have fruit <\p> <p> love go bike riding<\p> <p> hello how <\p> how can achieve it? this code. note added § character in stra, in order split string: final string stra = "<p> have orange </p><p> have apple </p><p> have banana </p>§<p> have fruit </p><p> love go bike riding</p><p> hello how </p>"; final str...

Android options do not show in eclipse on updating from ADT 22.3 to 22.6 -

i downloaded android development toolkit (adt) google , ran it. i updated of android sdk packages android versions, repository etc. when restarted eclipse got message saying had update adt 22.3 22.6 after doing following normal procedure of install new software > select google repo > select packages > install > ... > click ok on unsupported message etc. when restarted eclipse, adt options gone , see normal java perspective. adt 22.6 options in install new software show installed. thank in advance help. cheers! gavin. download , extract adt. not change folder name first update adt version 22.3.x 22.6.x in following way: > install new software > work (android developer tools update site - https://dl-ssl.google.com/android/eclipse/ ) [note "https"] > select developer tools > next ... now open sdk manager , install android libraries require. this worked me. no problems @ all.

python - MySQL SELECT DISTINCT is case insensitive? -

i trying cleanup data imported mysql pandas dataframe. some appears as: variable others as: variable when use select distinct it seems mysql treats variable equivilent variable. when import r though r sees variable , variable different. , running as.factor gives me 2 factors. how can make mysql's select distinct case sensitive can detect , fix data import r analyse? if wanna detect lower , upper cases in table use this select name //this select lower names yourtable name = binary lower(name) union select name //this select upper names yourtable name = binary upper(name) union // select not lower , not upper select name yourtable name != binary upper(name) , name != binary lower(name) demo here

algorithm - String matching for anagrams -

i have data, (x,y,text) , representation of strings put out on screen @ given (x,y) position. text contains control characters color , font data, , other control characters (ignored now). parse out control characters color, font, size , other , remain alphanumeric stuff @ end. this data generated application scene (using nice gui that's not concern now), there more 1 entries compose final scene. such as: (6, 1, "berlin") , (10,2 , "hauptbahnhof") give final scene, looking more or less (imagine graphics below information screen): 0123456789.... 0+----------------+ 1| berlin | 2| hauptbahnhof | 3+----------------+ now, application generates objects final scene in totally unpredictable (and uncontrollable, closed source app) order, final scene either first or second. (6, 1, "berlin") (10, 2, "hauptbahnhof") . end -> berlinhauptbahnhof (10, 2, "hauptbahnhof") (6, 1, "berlin") . end ->...

bash - How the get the length of a vector in a makefile and use it in a for loop? -

how can dimension of vector in makefile? want have simple loop goes through each element of 2 same-sized vectors. example doesn't work in terms of loop nor size of vectors give idea of thinking about. loop notation taken this : v1=one 2 3 4 v2=bird stones parks bears print: size={#$(v1)} <- invented notation, doesn't work. i=0 while [[ $$i -le $$size ]] ; \ echo $(v1)[i] $(v2)[i] ; \ ((i = + 1)) ; \ done output: one bird 2 stones 3 parks 4 bears i not sure structure fit makefile. think best put loop inside perl script , call perl script makefile. said, here's how write if had write in make + linux way : v=one:bird two:stones three:parks four:bears print: @for vv in $(v) ; echo $${vv} | sed 's/:/ /' ; done which generates one bird 2 stones 3 parks 4 bears also afaik, line v1=one 2 3 four not create vector . creates string "one 2 3 four" .

identify HTML page using PHP -

is there way identify different html pages using php, example want know page data submitted can make logic using php, if had example.html & example2.html pages both submitting logic.php, if data comes example.html $data = array(); $data['template'] $_post['example']; $data['template'] $_post['example2']; so logic if(logic){ $data['template'] $_post['example']; }else{ $data['template'] $_post['example2']; } but not sure how identyfie particular pages either include hidden field form <input type="hidden" name="hiddenfield" value="example1"> and if($_post['hiddenfield']=="example1") { } else { } or use referer if(substr_count($_server['http_referer'],"example.htm")) { } else } http://www.php.net/manual/en/reserved.variables.server.php 'http_referer' address of page (if any) referred user...

php - Why doesn't it delete the post? -

i wrote code delete per click post out of database table 'community_posts'. when click on button, doesn't delete it, url do=delete&key=theid doesn't work, why? can me, please! // php code if($do == "delete" && is_numeric($key)){ $check = mysql_query("select id community_posts id = '".$key."' limit 1") or die(mysql_error()); if(mysql_num_rows($check) > 0){ mysql_query("delete community_posts id = '".$key."' limit 1") or die(mysql_error()); $msg = "<center>neuigkeit wurde erfolgreich gelöscht...</center>"; } else { $msg = "<center>neuigkeit konnte nicht entfernt werden, versuche es erneut...</center>"; } } // html code und ausgabe der datenbank <form action='' method='post'> <?php $getcomments = mysql_query("select * community_posts order id desc limit 100...