Posts

Showing posts from September, 2011

How to make an overlay on top of JavaFX 2 webview? -

is possible to overlay javafx2 widgets or canvas on top of javafx 2 webview? i want generate transparent heatmap means of javafx 2 on top of webview. do mean this: import javafx.application.application; import javafx.scene.scene; import javafx.scene.layout.pane; import javafx.scene.layout.stackpane; import javafx.scene.paint.color; import javafx.scene.shape.rectangle; import javafx.scene.shape.rectanglebuilder; import javafx.scene.text.font; import javafx.scene.text.fontweight; import javafx.scene.text.text; import javafx.scene.text.textbuilder; import javafx.scene.web.webview; import javafx.stage.stage; public class demo extends application { @override public void start(stage primarystage) { webview webview = new webview(); webview.getengine().load("http://www.google.com"); stackpane root = new stackpane(); root.getchildren().addall(webview, getoverlay()); primarystage.setscene(new scene(root, 300, 250)); ...

cocoa - IOS UIButton with animated gif Image -

how add animated gif file default image uibutton. have added gif file button image. not animating. thanks. animated gif won't animate in iphone.. should add uiimageview subview uibutton, extract images gif , animate using uiimageview animation uiimageview* animatedimageview = [[uiimageview alloc] initwithframe:self.view.bounds]; animatedimageview.animationimages = [nsarray arraywithobjects: [uiimage imagenamed:@"image1.gif"], [uiimage imagenamed:@"image2.gif"], [uiimage imagenamed:@"image3.gif"], [uiimage imagenamed:@"image4.gif"], nil]; animatedimageview.animationduration = 1.0f; animatedimageview.animationrepeatcount = 0; [animatedimageview startanimating]; [yourbutton addsubview: animatedimageview];

how to save the the image in folder on disk using java -

i want save image on disk such c:/images captured webcam using java ..and again want display image on jform label... possible using java , netbeans i'm new in java you can save image private static void save(bufferedimage image, string ext) { file file = new file(filename + "." + ext);   bufferedimage image = tobufferedimage(file); try { imageio.write(image, ext, file); // ignore returned boolean } catch(ioexception e) { system.out.println("write error " + file.getpath() + ": " + e.getmessage()); } } and read image disk , show label as file file = new file("image.gif"); image = imageio.read(file); jframe frame = new jframe(); jlabel label = new jlabel(new imageicon(image)); frame.getcontentpane().add(label, borderlayout.center); frame.pack(); frame.setvisible(true);

java - How can I figure out the UTC offset using Joda? -

i'd end string in form of -5:00 (if we're in ny, example). what's best way go doing using joda? not sure if it's best way, here's 1 method: datetimeformatter dtf = datetimeformat.forpattern("zz"); datetimezone zone; zone = datetimezone.forid("america/los_angeles"); system.out.println(dtf.withzone(zone).print(0)); // outputs -08:00 zone = datetimezone.foroffsethoursminutes(-5, 0); system.out.println(dtf.withzone(zone).print(0)); // outputs -05:00 datetime dt = datetime.now(); system.out.println(dtf.print(dt)); // outputs -05:00 (time-zone dependent) the example give doesn't include leading 0 on hours, though. if that's you're asking (how exclude leading zero), i'm no help.

Difference between echo and return in php? -

this confusing me ,what difference between echo , return, in functions echo outputs content console or web browser. example: echo "hey, showing on screen!"; return returns value @ end of function or method. example: function my_function() { return "always returns this"; } echo my_function(); // displays "always returns this"

c++ - OpenGL: How to make light to be independent of rotation? -

i have diffuse lighting shader seems work when object not rotating. however, when apply rotation transform, light seems rotate along object. it's object , light stay still camera 1 moves around object. here's vertex shader code: #version 110 uniform mat4 projectionmatrix; uniform mat4 modelviewmatrix; uniform vec3 lightsource; attribute vec3 vertex; attribute vec3 normal; varying vec2 texcoord; void main() { gl_position = projectionmatrix * modelviewmatrix * vec4( vertex, 1.0 ); vec3 n = gl_normalmatrix * normalize( normal ); vec4 v = modelviewmatrix * vec4( vertex, 1.0 ); vec3 l = normalize( lightsource - v.xyz ); float ndotl = max( 0.0, dot( n, l ) ); gl_frontcolor = vec4( gl_color.xyz * ndotl, 1.0 ); gl_texcoord[0] = gl_multitexcoord0; } and here's code rotation: scene.loadidentity(); scene.translate( 0.0f, -5.0f, -20.0f ); scene.rotate( angle, 0.0f, 1.0f, 0.0f ); object->draw(); i sent eye-space light position through...

Why does ",,," == Array(4) in Javascript? -

boot interpreter/console , try comparison > ",,," == array(4) true why? @ first thought maybe since think of ",,," array of 4 characters '\0' terminating slice, might why, but > "..." == array(4) returns "false". so... why? know it's idiosyncratic bit of duck typing in javascript, curious underlines behavior. gleaned zed shaw's excellent presentation here btw . because right hand operand converted string , string representation of array(4) ,,, : > array(4).tostring() ",,," if use array constructor function , pass number, sets length of array number. can have 4 empty indexes (same [,,,] ) , default string representation of arrays comma-separated list of elements: > ['a','b','c'].tostring() "a,b,c" how comparison works described in section 11.9.3 of specification . there see ( x == y ): 8. if type( x ) either string or number , type...

sql - finding the difference of the sum of a column values based on an indicator(a/b) column in a table -

select ca.cust_ac_no, ca.ccy, ah.trn_dt, (select sum(coalesce(hi.lcy_amount,0)) actb_history hi hi.ac_no='0013001600038' , hi.drcr_ind = 'c' , ah.trn_dt = hi.trn_dt group hi.ac_no,hi.drcr_ind) total_credits, (select sum(coalesce(hi.lcy_amount,0)) actb_history hi hi.ac_no='0013001600038' , hi.drcr_ind = 'd'and ah.trn_dt = hi.trn_dt group hi.ac_no,hi.drcr_ind) total_debits, ((select sum( coalesce(hi.lcy_amount,0)) actb_history hi hi.ac_no='0013001600038' , hi.drcr_ind = 'c' , ah.trn_dt = hi.trn_dt group hi.ac_no,hi.drcr_ind) - (select sum(coalesce(hi.lcy_amount,0)) actb_history hi hi.ac_no='0013001600038' , hi.drcr_ind = 'd'and ah.trn_dt = hi.trn_dt group hi.drcr_ind,hi.drcr_ind )) difference actb_hist...

css - Retrieve width of embedded video using javascript -

i have simple page embedded video. below example. want retrieve width of embedded video's iframe, can vary ( example if video youtube or vimeo ). can put div next it, text, , adjust width of latter accordingly <html> <head> </head> <body onload = "resizeelements()"> <iframe width="420" height="315" src="http://www.youtube.com/embed/a34qtcpnkww" frameborder="0" allowfullscreen> </iframe> </body> <script language="javascript" type="text/javascript"> function resizeelements() { var iframevideos = document.getelementsbytagname("iframe"); ( var = 0; < iframevideos.length; i++) { video = iframevideos[i]; alert ( ">" + video.style.width+ "<" ); video.style.width = "112px"; video.style.height = "63px"; alert ( ...

php - How to submit a Form without using Submit event on Button. -

i've made simple calendar can select year , month through dropdown list. <form name=calenderselect method='post' action='calendar.php'> <select name='month' id='month'> <option>january</option> <option>februari</option> <option>march</option> .... </select> <input type='submit' name='submit' value='change' /> </form> i find abit annoying have press submit button every time want change month. change moment click month in list. you need client-side event achieve (maybe "onchanged" select?) 1.listen event: add onchange="submitform() select tag 2.define submitform() javascript function. simple form submit, nothing long done! look in google: "how submit form through javascript":

java - JSF + Hibernate: Collection is not associated with any session -

first of all, use java ee, hibernate entitymanager , primefaces. i have 1 ejb module (business logic , domain) , 2 war modules (jersey ws , jsf primefaces). i decided initialize lazy collections in jsf war module avoid lazy initialization exception. don't use extended entity manager. @managedbean(name = "company") @sessionscoped public class companybean { @ejb private companyfacade cf; ... public string showdetails(long id) { company = cf.find(id); hibernate.initialize(company.getcompanytypes()); hibernate.initialize(company.getprimaryuser()); hibernate.initialize(company.getblocked()); hibernate.initialize(company.getaddresses()); hibernate.initialize(company.getcontacts()); return "details"; } ... } and get: caused by: org.hibernate.hibernateexception: collection not associated session @ org.hibernate.collection.abstractpersistentcollection.forceinitializatio...

algorithm - inverse task of tessellation -

Image
as input have set of triangles form concave mesh holes. each triangle consist of 3 vertices: (vi,vj,vk),... no adjacency information provided. algorithm have "union" set of triangles same normal polygon. output (pi,pj,pk,...,ps),... for example(see picture below), let have mesh consist of triangles (v0,v1,v4), (v1,v3,v4), (v1,v2,v3) (v2,v6,v4), (v6,v5,v4). as output have: (p0,p1,p4) (p1,p2,p3,p4) i'm looking efficient algorithm solves problem described above. suggestion, tips or articles appreciated. look @ adaptive mesh coarsening algorithms. these typically used in advanced software computational fluid dynamics ( ansys cfx , cd-adapco star ccm+ etc.) / structural dynamics (anasys et al.). automatic refinement , coarsening of given mesh advantageous. some free papers @ on subject, give strong starting point are: https://cfwebprod.sandia.gov/cfdocs/ccim/docs/coarsening.pdf http://tetra.mech.ubc.ca/anslab/publications/coarsen.pdf http:...

sql server - MSSQL Selecting top 10 but include columns with duplicate values -

hi i'm trying top ten winners of competition using score. problem when there 2 users same score example i'm getting top 9 in effect (should eleven records returned if there 2 top 3 scores , rest unique example)... i'm not sure how tackle , appreciate guidance. thanks in advance, ian should eleven records returned if there 2 top 3 scores sounds want use dense_rank . this give rows in top 10 scores. select t.score ( select score, dense_rank() over(order score) rn yourtable ) t t.rn <= 10 se-data

iphone - How to record liveStream Audio and save to Documents directory while playing? -

i have implemented code livestream playing. , need record audio local resources after pressing stop recording button. i have code recording audio the link : any suggestions please....

c# - Event handler when Application bugs -

what event can handle when application shuts down due bug ? thanks update : point want excute code in case of bug due unhandled exception in whole application. you can put exception handler around application.run : using system; using system.windows.forms; namespace testapp { static class program { [stathread] static void main() { try { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new mainform()); } catch (exception exception) { messagebox.show( exception.message + exception.stacktrace, "error", messageboxbuttons.ok, messageboxicon.error ); } } } } however, wouldn't leave in production app.

database - Multiple "details" sections under a group in Access -

my data organized so: root task subtask1 root task2 subtask2 root task3 when creating report in access, grouping root task , adding subtask under details seems work, roottask3 not show because there no subtask refers it. how organize report/grouping such shows root tasks if not have subtasks? the default inner join shows rows there matching record in other table, left join in query used select data give row main table, if there no matching record in secondary table. if @ sql view of query, see join . if looking @ query in default design mode, right click , select join properties choose records returned.

javascript - if user is already logged-in and clicked on share button in wesite facebook asking log-in credentials in IE8 ..! -

i using javascript sdk implement feed functionality. here problem, if user logged-in , clicked on share button facebook asking log-in credentials in ie8 . in ie9 working fine i using code fb.init({appid: "416595358373189",show_error:true, status: true, cookie: true}); function posttofeed() { // calling api ... var obj = { method: 'feed', link: 'https://developers.facebook.com/docs/reference/dialogs/', picture: 'http://fbrell.com/f8.jpg', name: 'facebook dialogs', caption: 'reference documentation', description: 'using dialogs interact users.' }; fb.ui(obj, callback); } function callback(response) { }

iphone - iPad : Crash because of add more than three CCSpriteFrameCache file -

in cocos2d application have used 5 ccspriteframecache(.plist) file. when load more 3 .plist file app getting crash. just printing that 2012-06-08 16:45:08.575 voicechangingbowtie[5611:707] cocos2d: ccspriteframecache: trying use file 'windowanimationsipad.png' texture 2012-06-08 16:45:13.089 voicechangingbowtie[5611:707] cocos2d: ccspriteframecache: trying use file 'ipadshark.png' texture 2012-06-08 16:45:14.297 voicechangingbowtie[5611:707] cocos2d: ccspriteframecache: trying use file 'ipadsharksecond.png' texture ... then app crashed crash no message in cases mean have troubles memory. how big textures trying load? check memory usage instruments tool.

tsql - How to looping trough a Table, find a value and insert if exists? -

i've 2 table: table id field1 .... table b id field2 field3 ... i loop through table b , if a record same id exits in table a, add value field2 , field3 in table a. i don't know how in t-sql! can me ? thanks using loop construction not necessary update, can solve in neater way using set operations. if understand question correctly want update table values table b. use query this: update tablea set tablea.field2 = tableb.field2, tablea.field3 = tableb.field3 tableb tablea.id = tableb.id you might wanna check in query see values in field 2 , 3 in table before replacing them. (to test first results of query be, build select query update query above!)

android - How to move the custom dialog box? -

i beginner in android. creating custom dialog box, working fine. dialog box not moved. how move custom dialog box. example in windows contains notepad, paint, etc. when click (notepad, paint, etc) title bar can move position. if possible please send information how move dialog box. otherwise if not possible send reason. please reply answers , comments valuable me. thanks. dialog doesn't have touch event listeners might possibly create activity, implement ontouchlistener on it, , in manifest file <activity android:theme="@android:style/theme.dialog"> now activity dialogbox, , can implement view's setontouchlistener() , write required code in listener.

memory management - Does a page fault occur whenever we have a segmentation fault? -

whenever segmentation fault occurs, have page fault? anyone linux kernel code experience can pleas point code here too? i have seen: segmentation fault vs page fault segmentation fault can occur under following circumstances: a) buggy program / command, can fixed applying patch. b) can appear when try access array beyond end of array under c programming. c) inside chrooted jail can occur when critical shared libs, config file or /dev/ entry missing. d) sometime hardware or faulty memory or driver can create problem. e) maintain suggested environment computer equipment (overheating can generate problem). why page fault occur: a)trying access virtual memory-address b)instruction-operand / instruction-address c)read-data/write-data, or fetch-instruction d)maybe page ‘not present’ e)maybe page ‘not readable’ f)maybe page ‘not writable’ g)maybe page ‘not visible’

.net - get cell value in gridview -

i want text literal inside gridview, but when run program, exception through unable cast object of type system.web.ui.literalcontrol type system.web.ui.databoundliteralcontrol. .aspx code: <asp:gridview id="gridview3" runat="server" onrowdatabound="rowdatabound" datakeynames="qno" autogeneratecolumns="false" showfooter="true" onrowcancelingedit="cancel" onrowcommand="create" onrowdeleting="delete" onrowediting="edit" onrowupdating="update"> <columns> <asp:templatefield headertext="selection"> <itemtemplate> <asp:checkbox id="check1" runat="server"/> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="id" visible="true"> <itemtemplate> ...

set - Understanding A bit of Haskell -

i have quick question haskell. i've been following learn haskell , , bit confused execution order / logic of following snippet, used calculate side lengths of triangle, when sides equal or less 10 , total perimeter of triangle 24: [(a,b,c) | c <- [1..10], b <- [1..c], <- [1..b], a^2 + b^2 == c^2, a+b+c==24] the part confusing me upper expansion bound on b , a binding. gather, ..c , ..b used remove additional permutations (combinations?) of same set of triangle sides. when run ..c/b , answer: [(6,8,10)] when don't have ..c/b : [(a,b,c) | c <- [1..10], b <- [1..10], <- [1..10], a^2 + b^2 == c^2, a+b+c==24] as didn't when typed in, got: [(8,6,10),(6,8,10)] which representative of same triangle, save a , b values have been swapped. so, can walk me through logic / execution / evaluation of what's going on here? the original version considers triplets (a,b,c) c number between 1 , 10, b number between 1 , c , number betw...

asp.net mvc - Should this be done with multiple or a single MVC Package? -

currently there multiple (about 15-30) independent web applications written in language. each 1 independent files, images, headers, users, databases etc. etc. whole 9yards, except exist under same domain , should have same style (but don't). converted c# asp.net mvc 2. share same ldap authentication. the question has come in mind whether these should setup multiple mvc solutions or done within single mvc application. have same styles, same images, , nice them share basic functions. the reason isn't simple cut , dry solution me, of these applications quite large , throwing them might hard manage. not mention development of new applications continue new features added existing ones. making possibly extremely large solution. i new mvc , though have understanding of now, i'm still trying rewire brain here , there work methodology , design. i guess i'm asking for, of have more experience mvc share incite , wisdom mvc in practical use give me direction start thi...

How can I display the company name and company logo in OpenCart -

how display store name along logo in front end? actually, want display company name along logo whatever write in system->settings->general (store name) . if update this, logo displays not storename. how can this? you need edit code file: upload/catalog/view/theme/default/template/common/header.tpl locate: <?php if ($logo) { ?> <div id="logo"><a href="<?php echo $home; ?>"><img src="<?php echo $logo; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" /></a></div> <?php } ?> replace: <?php if ($logo) { ?> <div id="logo"><a href="<?php echo $home; ?>"><?php echo $this->config->get('config_name'); ?><img src="<?php echo $logo; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" /></a></div> <?php...

apache - Resolve chroot problems with php5-fpm -

i using apache (and can't switch nginx or lighttpd because of customers), , many others, have problems following variables: $_server["script_filename"] $_server["path_translated"] $_server["document_root"] because of chroot, variables passed apache's mod_fastcgi php5-fpm screwed , don't match proper ones. let me show example: $_server["document_root"] = /home/vhosts/h0001/home/domains/test.com $_server["script_filename"] = /home/vhosts/h0001/php-fpm $_server["path_translated"] = /home/vhosts/h0001/home/domains/test.com/phpinfo.php instead of: $_server["document_root"] = /home/domains/test.com $_server["script_filename"] = /php-fpm $_server["path_translated"] = /home/domains/test.com/phpinfo.php so, seems easy do, since need remove "/home/vhosts/hxxxx" variables. i've thought of using auto_prepend_file directive inside php.ini , add this: <?php ...

ajax error with javascript -

i using following function has worked fine until now, getting following error: [exception... "component returned failure code: 0x80004005 (ns_error_failure) [nsixmlhttprequest.send]" nsresult: "0x80004005 (ns_error_failure)" location: "js frame :: http://www.myurl.info/manage/sharedlibrary.js :: getfile :: line 406" data: no] note error line indicated below directly after comment in code block. additional research apparently common issue firefox. have cleaner way [this]? 1 the function has worked until , follows: function getfile(url){ var ajax = null; try{ if(window.xmlhttprequest){ ajax = new xmlhttprequest(); }else{ ajax = new activexobject("microsoft.xmlhttp"); } if(ajax){ ajax.open("get", url, false); //the line below line 406 in error code. ajax.send(null); return ajax.responsetext; }else...

How to create image of currently installed ubuntu (on my laptop)? -

requirement: i want copy whole ubuntu (currently using) laptop one. my idea create image of ubuntu using, install laptop image. question: any tools or steps should take ? you can use remastersys, that's typically used when know you're resintalling many machines same customizations. can find info here: http://debianhelp.wordpress.com/2012/04/20/how-to-install-and-use-remastersys-in-ubuntu-os/ if want clone partition , move new disk, should clonezilla. http://clonezilla.org/ if disks same size , don't want use clonezilla, i've used 'dd' command. convenience, used usb disk docking station 1 http://j.mp/kvmjue . you'll need put image on disk there (since large fit on laptop itself), boot new laptop off live cd, command prompt, , copy image new laptop drive. for reference, i'd check these places: http://www.debianhelp.co.uk/ddcommand.htm http://www.backuphowto.info/linux-backup-hard-disk-clone-dd here's quote: making ...

jQuery UI Auto Complete : Issue with Custom Data fetching -

i trying demo jquery ui on own project , found 1 essential modification in need it. see on below demo : http://jqueryui.com/demos/autocomplete/#custom-data in example, when type "j" , select 1 option, fetch text , logo related it. working fine. here, lets select "jquery" auto-suggestions given. load text , jquery logo on left side. suppose after doing this, if delete characters of word "jquery" textbox should reset , display blank outputs. remains same text , logo loaded previously. in general, want is, user must select autosuggestion , not write not in auto suggestions give. how can that? thanks in advance. you can override select , change event achieve this: $(".combobox").autocomplete({ minlength: 0, source: function (request, respond) { //some source }, change: function (event, ui) { //if no value inside li, reset input -> uses custom selector if ($(".ui-autocomplete li...

android - How to get a string back from AsyncTask? -

i have following class: public class geturldata extends asynctask<string, integer, string>{ @override protected string doinbackground(string... params) { string line; try { defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(params[0]); httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); line = entityutils.tostring(httpentity); } catch (unsupportedencodingexception e) { line = "<results status=\"error\"><msg>can't connect server</msg></results>"; } catch (malformedurlexception e) { line = "<results status=\"error\"><msg>can't connect server</msg></results>"; } catch (ioexception e) { line = "<results status=\"error\"><msg>can't connect server</msg></results>...

c# - ASP.Net WebAPI RC ILogger -

i upgraded rc of webapi , found whole lot of things no longer were. we using ilogger ( http://msdn.microsoft.com/en-us/library/system.web.http.common.ilogger(v=vs.108).aspx ) interface log events/exceptions inside our api. after upgrading no longer seems exist. know has gone/what has turned into? with new webapi ilogger interface has been removed , should using itracewriter instead described below: monitoring , diagnostics: can enable tracing providing itracewriter implementation , configuring service using dependency resolver. ilogger interface has been removed. here official documentation , here example start itracewriter

mod rewrite - How to get back-reference variables in multiple RewriteCond with .htaccess -

these rewrite rules don't seem work. not possible or missing something the problematic rule second one, notice back-reference %1 rewritecond %{request_uri} ^/([a-za-z\.]+)/.*$ [nc] rewritecond %{http_cookie} route_controller_%1=([^;]+) [nc] rewriterule ^(.*)$ http://example2.com/%1/_/$1 [l] this expecting happen. given url http://example.com/abc/home the first rule should store abc in %1 want second rule cookie called route_controller_abc , if found third rule rewite to http://example2.com/thevalueofthecookie/_/home but seconf rule doesn't seem using %1 back-reference. any ideas? the reason string substitution occurs in first parameter on cond , not on rexexp. have hack simulate parameters in regexps using \1 etc. you can pick directory in rule regexp, since execution order rule regexp, cond1, cond2,... rule substitution. eg. ^(*.?)/.*$ abc/home will set $1 abc , $0 abc/home . hence try like: rewritecond $1:%{http_cookie} ^(.*?):.*\broute_...

mysql - How can i run a insert query script(.sql) to create tables and columns or pre populate few datas -

i need create tables , columns default data run java web application in cloudfoundry. i not able use mysql client connect database ip received. java.lang.system.getenv("vcap_services"); is possible connect db sts or eclipse, or there client published vmware? you can use vmc cli tool create tunnel mysql service. when tunnel connected can opt start mysql client automatically connect instance. please see http://docs.cloudfoundry.com/tools/vmc/caldecott.html example of connecting mysql service on cloudfoundry.

java - add BigDecimal in order to have a running total -

i pick brians bigdecimal.. have method supposed have add running total amount due. here is: private bigdecimal adduptotal(billrec bill, bigdecimal runningtotal) { bigdecimal result = new bigdecimal(0); if (bill.getbillinfo().getbillsummamtsize() > 0) { (int x = 0; x < bill.getbillinfo().getbillsummamtsize(); x++) { if ("totalamtdue".equals(bill.getbillinfo().getbillsummamt(x).getbillsummamtcode().getcode().tostring())) { result = runningtotal.add(bill.getbillinfo().getbillsummamt(x).getamt()); } } } return result; } the problem how call this? meaning when call how keep track of total? note can see passing runningtotal param not sure how keep value in method call from. i suspect meant this: private bigdecimal adduptotal(billrec bill, bigdecimal runningtotal) { if (bill.getbillinfo().getbillsummamtsize() > 0) { (int x = 0; x < bill.getbill...

java - Troubleshooting JSONException: End of input at character 0 -

i doing search on active.com using api , search getting stuck @ error : org.json.jsonexception: end of input @ character 0. newbie,any appreciated. mainactivity private class searchtask extends asynctask<string, integer, string> { progressdialog dialog; @override protected void onpreexecute() { dialog = progressdialog.show(stayactiveactivity.this,"","please wait..."); super.onpreexecute(); } @override protected string doinbackground(string... params) { try { string result = activehelper.download(params [0]); return result; } catch (apiexception e) { e.printstacktrace(); log.e("alatta", "problem making search request"); } return ""; } @override protected void onpostexecute(string result) { try { ...

oop - How to deal with Lack of Multiple Inheritance in C# -

i working on mini-framework "runnable" things. (they experiments, tests, tasks, etc.) // "runs" (in coordinated way) multiple "runnable" things. interface irunnableof<t> : irunnable // provide base-class functionality "runner" abstract class runnerbase<t> : irunnableof<t> class sequentialrunner<t> : runnerbase<t> // same interface, different behavior. class concurrentrunner<t> : runnerbase<t> // other types of runners. class concurrentblockrunner : sequentialrunner<block> class sequentialblockrunner : concurrentrunner<block> now, how can reconcile concurrentblockrunner , sequentialblockrunner ? mean: refer them common ancestor, use in collection. ( ienuerable<t> t = ??) provide additional base class functionality. (add property, example). i remedied #1 adding interface specified type parameter ia<t> : interface iblockrunner : irunnableof<block> { } ...

php - How to deal with ftp password in web application in a secure manner -

i'm working on script (php+mysql) let edit file on ftp. i'm trying when user logged in , connects server want memorize ftp password can reused reconnect server transparently (for example when browsing files). don't want store raw password in database security reasons. thinking storing password in cookie reference connection id in database. doesn't sound secure enough either. how storing temporary password entry in database? any ideas how approach problem? you try asymmetric key system . generate public/private pair give private key user use public key encrypt password , store in database each time user action, supply private key gave them you use private key decrypt password, action, , destroy private key in memory should more secure relying on server encrypt/decrypt on it's own. it's not 100% foolproof (if root server, can sniff private keys) it's way prevent one-sided attack. @ least, old passwords not vulnerable if compromised ...

testing - Rails asset pipeline tests pass production broken -

i had following problem asset pipeline. i have html email image inside. i have tests covering case in email sent successfully. all tests pass. when going production, feature requiring email sent broken, because html layout referencing non existent image. this applies precompiled assets. it seems me tests no longer reliable. there way avoid situation happen again? i found perfect solution form own case. if set config.assets.compile = false config.assets.digest = true in test environment, tests rely on precompiled assets. since annoying precompile assets every time during quick development , testing phases, in case it's enough have configuration on ci only. you can setup initializer called ci_config.rb following: if env['ci'] class yourapp::application config.assets.compile = false config.assets.digest = true end end and configure ci run rake assets:precompile on start , rake assets:clean on end.

c# - Reproducable bug in Visual studio -

Image
i think found reproducable bug in visual studio. when try adding "testcontrol" project, visual studio crashes. maybe it's fault, , i'm doing wrong. build, , add control form: here's project (11kb): https://www.dropbox.com/s/dk62j347zmwbll8/visualstudiocrash.zip i haven't included binary files. if want test it, build , add "testcontrol" form. if somehow manage, click on control , see if crashes then. thanks help. the cause obvious: public string description { { return description; } set { // lbldescription.text = value; } } you're making recursive call accessor description property. visual studio going infinite loop when place control on designer.

mysql - table join, associates one row of one table with all rows of other table -

i have code , want show customers respective card numbers,, 1 of customers associated cards of cards table.. what's wrong?? in advance select `customers.idcustomer`, `customers.emri`, `customers.mbiemri`, `customers.kontakt`, `customers.vendbanimi`, `customers.adresa`, `customers.email1`, `customers.tel1`, `xts_cards.card_no`, `xts_cards.card_type`, xts_cards.mer_id customers inner join `xts_cards` on `customers.idcustomer` = `xts_cards.mer_id_owned_by`

asp.net - Linq lambda expression throwing error if result set is null -

in project need select 1 row values using linq try { return database.employees.where(x => id.equals(x.id)).single(); } catch (invalidoperationexception ix) { throw; } using corresponding row values through entity object.but throwing error if result set empty.the problem in project exception must logged. how can manage code out going exception. you're using single() documented throw exception if there no results. if don't want behaviour, don't use method :) if use singleordefault() return null if there no results. still throw exception if there multiple results, however. alternatively use firstordefault avoid this. note can specify predicate in single / singleordefault well, don't need where call first: return database.employees.singleordefault(x => id.equals(x.id));

git - How can I cache untracked (binary) files associated to a branch? -

assume 1 of many developers working git on huge code project, has incredibly long compilation time . now, personal day-to-day changes limited, , codebase decently modular, means far personal work concerned, compiling scratch price has paid once . afterwards, can recompile modules modified. on other hand, i have fix bugs in (at least two) branches reflect states of codebase distinct branch work on . 2 branches indeed result of work entire development team, , have entire modules rewritten or added. having compiled before pushing bugfix mandatory . my first approach switch development branch every time bugfix needed, clean, bugfix, recompile scratch, push, switch original branch, clean again, recompile - the delay doing intolerable . i moved keeping 3 separate checkouts of codebase on machine . solves " costly recompilation " problem (my changes in every branch incremental again), makes question "what developing on right ?" more complex answer (since depe...

Openssl convert .PEM containing only RSA Private Key to .PKCS12 -

currently have .pem file containing private key. need convert file .pkcs12 file. i'm trying use openssl achieve , i'm running problems. the .pem file i'm using of form: -----begin rsa private key----- some key -----end rsa private key----- i use following openssl command attempt convert .pem file .pkcs12: openssl pkcs12 -export -inkey file.pem -out file.p12 the console hangs message: loading 'screen' random state -done what im doing wrong? any appriciated. i ran problem , resolved adding -nocerts option after export. guess regarding cause of "freeze up" openssl trying read additional input console. openssl pkcs12 -export -nocerts -inkey your.private.key.pem -out your.private.key.p12

Image resizing for image gallery on Tridion 2011 -

i'm working on web site show kind image gallery on detail pages. must show navigation @ bottom small thumbnail images , must show per each element basic information , big image. the big image must resized too, because there maximun size allowed them. the point use source image per multimedia component , being able resize images on publishing time so, source image sent client browser thumbnail , big image. it's possible show small , big images using styles or html, quite uneficient because source (some of them heavy) image sent customer. my first thought custom code fragment, written in c# find complicated resize images size , resize them again size too. don't find way replace src on final html appropiate paths neither. another idea create old-style publishbinary method find complex because looks current tridion architecture not meant @ all... and important point, in case can resizing succesfully (somehow) it's tridion 2011 issue publish twice same image. b...

c# - Login View appears as logged but I'm not logged -

Image
i have problem login view on master page. when login works fine, if close tab while or rebuild application session closed login view still showing session :/. i have code in site.master <div class="logindisplay"> <asp:loginview id="headloginview" runat="server" enableviewstate="false"> <anonymoustemplate> [ <a href="~/login.aspx" id="headloginstatus" runat="server">log in</a> ] </anonymoustemplate> <loggedintemplate> bienvenido <span class="bold"> <%-- headloginname--%> <asp:loginname id="membername" runat="server" /> </span>! [ <asp:loginstatus id="memberloginstatus" runat="server" logout...

java - Set publisher name in JWS application using given certificate -

i have obtained certificate trusted authority (have been given .pfx file). i signed .jar files jarsigner this: jarsigner -storetype pkcs12 -keystore my_pfx_file.pfx -storepass my_store_pwd -signedjar smy_jar.jar my_jar.jar then exported certificate keystore create .cer file. what else have don't message "unknown publisher" , instead has company name? i figured out. problem .pfx file. see certificate chain in mmc console, when used: keytool -list -storetype pkcs12 -keystore my_pfx_file.pfx , saw certificate chain length 1. so exported certificate mmc console. time, check box says "include certificates in certification path if possible". got new .pfx file signed jars , works perfectly. post helped me lot figure out going on: how sign java applet .pfx file?

Java: Increment by 2 the two inputted integer -

can me please.. starting java..:( how can display possible values based on given minimum input value, maximum input value , incrementing value? for example: min value: 1 max value: 10 increment value: 2 the result be: 1, 3, 5, 7, 9 this got far.. public class displayincrement { public static void main(string []args){ int min, max, increment; scanner in = new scanner(system.in); system.out.println("enter min value: "); in.nextint(); system.out.println("enter max value: "); in.nextint(); system.out.println("enter increment value: "); in.nextint(); int i; for(i=0; i<=10; i+=2){ system.out.println(i); } } } some notes: 1- in.nextint(); reads integer user, blocks until user enters integer console , presses enter . result integer has saved in order use later on, , save variable, this: int value = in.nextint(); in code, need assign 3 integers user enters corresponding variabl...

ios - NSRangeException when searching for bytes near end of NSData -

i want check last 2 bytes of files in app make sure not corrupt .jpg's rangeofdata:options:range: looks option, having hard time figuring out how proper nsrange . range looking starting near end of nsdata , end. here have far: nsdata *imagedata = [nsdata datawithcontentsoffile:filepath]; nsrange range = {([imagedata length]-8),[imagedata length]}; nsstring *str = @"ffd9"; nsdata *jpgtest = [str datausingencoding:nsutf8stringencoding]; nsrange found = [imagedata rangeofdata:jpgtest options:nsdatasearchbackwards range:range]; here error get: ** terminating app due uncaught exception 'nsrangeexception', reason: '*** -[nsconcretedata rangeofdata:options:range:]: range {14954, 14962} enxceeds data length 14962' how range search last few bytes of nsdata ? the second member of nsrange not end point of range length. in case should be: nsrange range = {([imagedata length]-8), 8};

android - ViewFlipper causing null pointer exception -

i have program uses view flipper getting nullpointerexception follows when activity called. wish cycle through set of images long activity being run. 06-13 18:52:05.358: e/androidruntime(368): caused by: java.lang.nullpointerexception activity: import android.app.activity; import android.os.bundle; import android.os.handler; import android.view.view; import android.view.viewgroup.layoutparams; import android.view.animation.animationutils; import android.widget.imageview; import android.widget.viewflipper; public class mainmenuactivity extends activity{ handler handler; runnable runnable; viewflipper imageswitcher; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.menupage); imageswitcher= (viewflipper) new viewflipper(this).findviewbyid(r.id.sportspersons); this.viewchanger(); } public void viewchanger() { ...

performance - Analyst Capability (ACAP) calculation in COCOMO -

i see following information in cocomo documentation: analysts personnel work on requirements, high level design , detailed design. major attributes should considered in rating analysis , design ability, efficiency , thoroughness, , ability communicate , cooperate. rating should not consider level of experience of analyst; rated aexp. analysts fall in 15th percentile rated low , fall in 95th percentile rated high 15th percentile - low 35th percentile - low 55th percentile - normal 75th percentile high 90th percentile - high i don't know, how calculate percentiles. maybe there example. i think answer subjective, , changes company company. measure "analysis , design ability, efficiency , thoroughness, , ability communicate , cooperate" takes combination of self , peer reviews , performance evaluations , expert judgement . can use kind of development ladder assess in percentile scale should be. @ this one example. ...

"The control has not been licensed for this machine" error while using True DB grid control pro 6.0 in vb6 project -

i using true db grid control pro 6.0 in vb6 project on xp machine , facing no issues. trying use same control in vb6 project on windows 7 while acccessing tool getting error control has not been lecensed machine. please in issue. did run install truegrid package? look in control panel, add/remove programs, should see "apex true dbgrid pro 6.0" listed.

android - How to disable button as soon as its clicked -

i have button on click loads activity, before loads activity if tap continuously, launches activity same activity loaded 2 times or more. have tried button.setenabled(false) after button.setonclicklistener...onclick not disabling button, logging text button tapped, depending on taps logs text 2 or 3 times if had tapped 10 times. feel here before button can listen tap events, tapping fast listens events many times tap it. thus need button can listen 1 tap , disable it. please help its known issue.basically u can set flag. int flag=1; @override public void onclick(view v) { if(flag) { button.setenabled(false); log.d("ins", "called"); } flag=0; }

machine learning - Adding new terms to a bag-of-words model -

i'm using k-means clustering group set of news items. i'm using bag-of-words model represent documents, more specifically, each document represented term frequency vector. my question: how can add new documents without having recalculate term frequency vectors (seen vocabulary containing terms docs change)? the easy solution use vocabulary documents you've seen, ignoring new terms; customary in document classification. another solution, that's become popular in recent years, ditch vocabulary altogether , use feature hashing . a third possibility reserve space in feature vectors future terms. e.g., let's you're vectorizing bunch of documents vocabulary of size n , turn them vectors of size n + k final k set zero, can add k terms vocabulary later on. (what not solution compute dot products, means, etc. on hash tables directly. flexible approach, it's very slow.)

arrays - Explode string in PHP that contain brackets and semicolon -

problem: i have string looks this: [1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18] question: how can string this? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 $str = "[1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18]"; $str = explode("]", $str); $finalresult = array(); foreach ($str $element) { if (!empty($element)) { $element = substr($element, 1); $element = explode("=>", $element); // element[0] contains key $element[1] = explode(",", $element[1]); $finalresult[$element[0]] = $element[1]; } } print_r($finalresult);

windows - What does "Wbem" and "SWbem" mean in the WMI Scripting API? -

in windows management instrumentation (wmi) scripting api, constant names start "wbem", , object names start "swbem". these abbreviations stand for? web-based enterprise management , believe s means scripting... some other terms: wmi=windows management instrumentation cim=common information model dmtf=distributed management task force

ruby - Can a Sinatra or Rack application find out if it is running with Apache or Thin? -

i trying silly automatic configuration of sinatra application allow use different sub uri depending whether run apache , passenger, or thin web server. so question is: possible find out inside sinatra application web server runs it? you can't (as far know) see if it's running on apache, can check if it's running on passenger: if defined?(phusionpassenger) # running passenger! end you should able same thin: if defined?(thin) # running thin! end

Javascript: simply cannot get the actual width of the document (jsfiddle provided) -

edited: i want actual of document js. i created fiddle know 1160px width, works in google chrome, not in ie: document.body.clientwidth+document.body.scrollleft http://jsfiddle.net/w36fg/18/ (just scroll fiddle , hover div); any ideas? window.innerwidth, window.innerheight in browsers. or ie specific, document.documentelement.offsetwidth, document.documentelement.offsetheight or document.documentelement.clientwidth as per comment, window.innerwidth || document.documentelement.clientwidth should work. and here's wanted (took while there, hey, got it) document.body.scrollwidth

javascript - How are Tab IDs generate in Chrome? -

are created incrementally? integers, i'm wondering if generated in particular way. knowing useful me application writing. edit: need keep in memory ids , thinking if can order them able search. if created increasing number easy implement search binary search, that's why asking the thing can find in documentation pertaining id following excerpt: id ( integer ) id of tab. tab ids unique within browser session. so can glean no 2 tabs ever same id in same session. there's no information in docs how they're generated. ultimately think approach predictive in sense doomed bugs & failure, should building responsive application vs. predictive one. instead of assuming next tab opened id # 12, capture creation of tab, you'll know id , can perform operations based on that. what need tab oncreated event . when tab created you'll tab object can tabid , windowid , perform whatever actions desire. since didn't tell ultimate goal, can...