Posts

Showing posts from September, 2015

java - Make an image's background transparent or white programmatically -

java - Make an image's background transparent or white programmatically - if 1 creating application in 1 create "background" of image transparent or white, there way this? for illustration : in image, http://upload.wikimedia.org/wikipedia/commons/b/b9/bronze_statuette_of_a_veiled_and_masked_dancer_1.jpg , transform image programmatically, such statue remains, , background (i.e. rest of image) white, or transparent. also, user might point out part of image should "remain", , rest should white or transparent. how can done? also, if there suitable java library or piece of code, helpful. regards for particular image there several methods solve part of problem. maybe if combine several methods and offer user interactive choices develop software in reasonably short period of time. i'd utilize it! you , misha discussed first 2 items: edge detection using canny or other means. suggest should work on "raw" border strength ima...

build - Bullet Physics, CMake->CodeBlocks - MinGW: Doesn't find GL/glut.h? -

build - Bullet Physics, CMake->CodeBlocks - MinGW: Doesn't find GL/glut.h? - statistics... my system: windows vista 64 bit library: bullet physics v2.78 makefile generator: cmake build system: mingw command line, mingw + codeblocks makefiles implemented command line , through cmake-generated code::blocks project in both cases, build fails near 30%. note: did have switch build executable in code::blocks project make.exe mingw32-make.exe first failure: demos\opengl\gldebugfont.cpp -> gl/glut.h: no such file or directory second failure (after commenting out #include first) -> demos/opengl/glutstuff.h: same error these failures happen when build command-line or through generated c::b project. why can't find gl/glut.h? "bullet-2.78\glut\gl\glut.h" exists. maybe there's way can tell find glut there? note: during cmake makefile generation, cmake did tell me "you using obsolete glu package, please utilize opengl instead." con...

textview - What's wrong with this Android program? -

textview - What's wrong with this Android program? - i writing test application consists of: 2 buttons 1 edittext 1 textview the first button "random" writes random name both in edittext box , textview (i have class called randomname returns string random name) the sec button "print" writes whatver in edittext textview the programme crashes when run , can't figure out why. help appreciated layout image here: http://img824.imageshack.us/img824/3046/rndname.jpg public class randomnametesteactivity extends activity implements onclicklistener { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } public edittext nomeedt = (edittext)findviewbyid(r.id.edittext1); public string nomestr = nomeedt.tostring(); public textview nometest = (textview) findviewbyid(r.id.textview1); public void onclick(view v) { // todo ...

jquery - Is there a way to detect when code is pasted into an input? -

jquery - Is there a way to detect when code is pasted into an input? - using jquery there way capture user's paste event , determine if user has pasted code snippet? (ruby,php,html,css,js etc...)? thanks bind paste input. something like: $("selector").bind('paste', function(e) { //get pasted text, need little timeout var element = $(this); settimeout(function() { var text = $(element).val(); alert(text); }, 100); }); jquery

sql - SSAS -> MDX -> How to create a query that returns a topcount by a date period i.e. week? -

sql - SSAS -> MDX -> How to create a query that returns a topcount by a date period i.e. week? - i have received recent request create query returns top 100 customers revenue per week. can , homecoming top 100 customers whole when add together in week attribute, query times out. wondering if out there has run or has been able produce comparable query? my query works without week present. : select non empty { [measures].[revenue] } on columns, non empty topcount ( { ([customer].[customer id].[customer id].allmembers * [customer].[name].[name].allmembers ) }, 100, [measures].[revenue]) on rows [dw] my query week nowadays times out completely. : select non empty { [measures].[revenue] } on columns, non empty topcount ( { ([customer].[customer id].[customer id].allmembers * [customer].[name].[name].allmembers * [date link].[week].[week].allmembers ) }, 100, [measures].[revenue]) on rows [dw] wouldn't give top 100 customers , week top in? ...

c# - Random number generation for multiple objects -

c# - Random number generation for multiple objects - so i'm trying create matrix-like programme "raining greenish code". has been going until decided throw of string instances list , draw/update it. in order acheive proper effect need randomize few things. all strings created , stored in list see here in loop. interval , dropspeed random numbers alter how fast string falls, , @ speed individual characters rotate through sprite sheet. for reason though i'm getting wall of text falls @ 1 time , sprites rotating @ equal pace. classes , respective functions work...so question doing wrong random number initialization? for (int = 0; < (wwidth / 30); i++) { random random = new random(new system.datetime().millisecond); float randinterval = nextfloat(random); int dropspeed = random.next(1, 7); _mslist.add(new matrixstring(chinese, randinterval, dropspeed, dropspeed, 1.0f, xoff, 10)); xoff = * 32; } you need create random i...

deployment - XamlParseException after deploying WPF project -

deployment - XamlParseException after deploying WPF project - i have been trying deploy wpf app, created setup project using setup wizard.the project output added primary. after building , installing program, click exe on desktop pop says "'my program' has stopped working", click debug programme , see an unhandled exception of type 'system.windows.markup.xamlparseexception' occurred in presentationframework.dll additional information: 'set connectionid threw exception.' line number '10' , line position '9'. this exception not point me in direction fix. there no 'connectionid' anywhere in app. i had ran xamlparseexception because of notifyicon scheme tray, fixed adding icon path of exe. thought may problem added icon setup project, along other project outputs. still not working. i know vague error help @ appreciated, app won't run @ all. thanks! this caused not having dependencies copied outpu...

sql - SSIS Multiple expressions separated by Pipe (|) -

sql - SSIS Multiple expressions separated by Pipe (|) - currently have next expression: @[tms_dest] + "\\" + @[tms_rename] + (dt_wstr,4)datepart("yyyy", getdate()) + right("0" + (dt_wstr,2)datepart("mm", getdate()), 2) + right("0" + (dt_wstr,2)datepart("dd", getdate()), 2) + ".xls" which gives me location , filename attach outgoing email using send mail service task. issue want task send 2 files, when trying separate expressions using pipe | next casting error: the info type "dt_wstr" cannot used binary operator "|". type of 1 or both of operands not supported operation. perform operation, 1 or both operands need explicitly cast cast operator. am using pipe wrong, if not, causing this? perhaps need include pipe in string? sounds pipe trying interpreted look editor. "file1.xls" + "|" + "file2.xls" sql sql-server-2005 ssis

.net - In a C# console app, how could I generate a Google Charts API request and save the result as an image? -

.net - In a C# console app, how could I generate a Google Charts API request and save the result as an image? - is possible create phone call google charts api in console app , save result jpeg or png file? can in web app, not quite sure how in c#. many thanks- https://chart.googleapis.com/chart you utilize googlechartsharp wrapper charts api url @ can view chart. using httpwebrequest , httpwebresponse classes (or webclient class per joey's answer), capture response stream byte array (the image) , write file proper extension (a *.png file). like: string charturl = chart.geturl(); byte[] chartbytes = null; webclient client = new webclient(); chartbytes = client.downloaddata(charturl); using (var memstream = new memorystream()) { memstream.write(chartbytes, 0, chartbytes.length); } file.writeallbytes("c:\temp\mychart.png", chartbytes); c# .net google-visualization

find values inside a matrix matlab -

find values inside a matrix matlab - i have vector (or matrix) want print out values of it. i explain: let have complex array. want find values within array between 2 5. how do that? dont want find indices of these values! want print out (create new array) want values. let's denote a input matrix. a complex, there 2 cases: a(real(a)>=2 & real(a)<=5) %% real values between 2 , 5 a(abs(a)>=2 & abs(a)<=5) %% modulus between 2 , 5 matlab

shell - Editing bash commands? -

shell - Editing bash commands? - i utilize "putty connection manager" in windows, , wondering how following. often, find myself editing larger bash commands have many characters on single line; nested loops, etc...which quite long! while create utilize of "home" , "end" keys go origin , end of line, i'd more efficient way move through line pressing right , left arrow keys. vi , instance, can move forwards "by word" if press w key (which moves way next word) i'd similar in bash shell. know of one? if you're using emacs keybindings bash (i believe that's default) seek using m-f , m-b move forwards , words m "meta" key, alt you. can utilize c-a (ctrl+a) , c-e jump origin of lines, though seems have keys that. alt+bksp handy delete whole words. bash shell putty

c# 4.0 - Parsing a "complex" XML file -

c# 4.0 - Parsing a "complex" XML file - i'm working on code read , parse nodes of xml file, , layout of file kind complex (at least, seems way me - having not done , xml parsing until project). the format xml files similar this: <parameters> <general> <name>name of parameter</name> <caption>information parameter</caption> <groupname>a little grouping of parameters</groupname> <value>1</value> <type>boolean</type> <description>some description</description> <dependencies> <and> <groupname>some other grouping of parameters</groupname> <name>the parameter 1 dependent on</name> </and> <or> <groupname>some other grouping of parameters</groupname> <name>the parameter 1 might dependent on</name> </or> </dependencie...

ios - GKSession - kill and renew session -

ios - GKSession - kill and renew session - in order read new display name of peer need kill , renew gksession. setting nil , initiate anew not work. in code below, nslog in for-loop show available peers not called (there's no error message): -(ibaction) btnrefresh:(id) sender { self.currentsession = nil; self.currentsession = [[gksession alloc] initwithsessionid:@"anything" displayname:name sessionmode:gksessionmodepeer]; self.currentsession.delegate = self; self.currentsession.available = yes; self.currentsession.disconnecttimeout = 0; [self.currentsession setdatareceivehandler:self withcontext:nil]; peerlistavailable = [[nsmutablearray alloc] initwitharray:[currentsession peerswithconnectionstate:gkpeerstateavailable]]; (nsstring *peer in peerlistavailable) { nslog(@"found available peer; checking name , id... %@, %@",[currentsession displaynameforpeer:peer], peer); } what wrong setting currentsession n...

performance - Fastest algorithm to calculate the Normalized and Engineering Scientific notation of a number -

performance - Fastest algorithm to calculate the Normalized and Engineering Scientific notation of a number - test case : 35000 -> normalized scientific notation of number 3.5 * 10e4 -> engineering science notation 35 * 10e3 a simple algorithm maintain dividing number 10 until notations required. mean algorithm o(number of zeros). can better? the classic paper on subject of printing human-friendly representations of floating point numbers can read here. it's much complex discussed code in reply here. performance algorithm scientific-notation numerical-analysis

Like-Box social plugin not working -

Like-Box social plugin not working - i have facebook page , want utilize like-box social plugin on it. https://developers.facebook.com/docs/reference/plugins/like-box/ however code doesn't want pull page: <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/all.js#xfbml=1&appid="; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like-box" data-href="{pagename}" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div> like facebook-social-plugins facebook-page

WPF FlowDocument List Control -

WPF FlowDocument List Control - i need display list bullets , horizontal alignment of items. in flowdocument.. i did not see itemspannel in flowlayout list.. there workarround ? thanks & regards, dinesh wpf flowdocument

video - Fix YouTube black sidebars in iframe 853 by 480 -

video - Fix YouTube black sidebars in iframe 853 by 480 - when embeding hd video youtube using generated iframe, notice 2 black sidebars added player when utilize preset. <iframe width="853" height="480" src="http://www.youtube... for excample in; http://www.villagedurable.org/tv if insert iframe dimensions 640*360 or utilize hd size 1280x720 2 sidebars desappear allowing beautiful layout. it's true both 640*360 , 1280x720 utilize aspect ration of 1.777777777777778, multiplying 480 1.777777777777778 gives 853.3333333333333 which, think makes youtube add together nasty black bars :( after much fuss found solution. apparently because 853x480 not same ratio 16/9, player doesn't have controls automatically fade away. video controls take 30 pixels of wide, leaving 450 pixels height. maintain aspect ratio, video shrunk , hence black borders (or black sidebars, whatever phone call them). the solution utilize 853x510 dimensio...

c# - in random number generator -

c# - in random number generator - for reason, code works fine when don't utilize seed in random class, if seek utilize datetime.now more random number, stackoverflowexception! class simple. tell me i'm doing wrong here? see makeuniquefilename. public class temputil { private int strcmp(string s1, string s2) { seek { (int = 0; < s1.length; i++) if (s1[i] != s2[i]) homecoming 0; homecoming 1; } grab (indexoutofrangeexception) { homecoming 0; } } private int uniqueness(object randomobj) { switch (randomobj.tostring()) { case "system.object": case "system.string": homecoming randomobj.tostring()[0]; case "system.int32": homecoming int.parse(randomobj.tostring()); case "system.boolean": homec...

mysql - Set up PHP development environment in Eclipse -

mysql - Set up PHP development environment in Eclipse - i've started developing in php, i've had various issues environment: mysql server won't start, can't debug php code (even after defining php executables), installed apache2 , didn't work, installed lamp , still nothing, etc. overall, it's been mess, decided start over(or other prepare might pop up). said, how can set near-perfect php environment in eclipse in can debug, run , not have hassle? i'm running eclipse indigo pdt , php 5.3. well...you can start reading this: how setup local php development environment in linux ubuntu 11.04 eclipse indigo 3.7, lamp & xdebug in add-on suggest installing: eclipse web tools platform (wtp) html/css development eclipse info tools platform db development. can utilize phpmyadmin. php mysql eclipse apache lamp

bitbucket - Why does git complain about an empty repository or a folder with existing files? -

bitbucket - Why does git complain about an empty repository or a folder with existing files? - in bitbucket if seek , create repository existing folder error complaining not empty directory. if go empty folder complains empty folder. what steps involved in adding existing project in development repo using git , bitbucket? the quick-start steps not quite right on bitbucket page: $ git clone git@bitbucket.org:myname/myproject.git ... $ git pull # fetch changes $ git force -u origin master # force changes first time instead of cloning, have to: git init . # in project repo git remote add together origin git@bitbucket.org:myname/myproject.git git force -u origin master # assuming newly created repo on bitbucket git bitbucket

html - Get Iframe to fill to bottom of page -

html - Get Iframe to fill to bottom of page - this seems should simple question cannot seem find solution anywhere. on website making have navigation bar @ top of page 43px in height , in effort not have edit each individual page create did set iframe below @ 100% width navigation buttons targeting source of iframe. now run issue want iframe extend bottom of navigation bar bottom of page cannot tell iframed in if set height 100% set height of entire page , adds 2nd scrollbar compensate 43px @ bottom, how can fit iframe remaining space below nav bar ? i have tried setting different % not work different res monitors. , need work cross browser (in ie, chrome, safari, , mozilla, preferably in opera that's not necessity). sorry little wordy, can help? pretty simple. need subtract height of navigation current viewport height , set iframe's height. utilize javascript method: function resizeiframe() { var nnavigationheight = 43; // assuming 43px stated a...

iphone - StackScrollView used inside main view? -

iphone - StackScrollView used inside main view? - i have seen stackscrollview made rafeeq want add together in main view. have "album " button , after cliking on want open stackscrollview screen can show album. plz help me . thanx in advace all have declare stackscrollviewcontroller , add together current view stackscrollviewcontroller stackview=[[stackscrollviewcontroller alloc] init]; [self.view addsubview:stackview.view]; of course of study in button click event iphone objective-c xcode4

android - how to accessing sqlite database from java class -

android - how to accessing sqlite database from java class - i have created sqlite database using phonegap. able access databse within javascript. want access sqlitedatabase java class. possible? thanks in andvance.. for phonegap --sqlite can utilize pluggin available on git hub. there javafile also.please check out link:sqlite database android

MySQL COALESCE alternative for selecting both result sets for an insert, not either / or? -

MySQL COALESCE alternative for selecting both result sets for an insert, not either / or? - so i'm having problem next query.. so, query selecting either comment.author_id or stream.author_id insertion, whereas need select both meets conditions inserts notifications both stream items author id, , author id comments associated target stream id. help appreciated insert notification (text, type, target_id, sender_id, recipient_id, data, timestamp, is_unread) select distinct '$text', 'comment', '$id', '$senderid', coalesce(comment.author_id, stream.author_id), '$dataarray','$timestamp', '1' stream left bring together comment on comment.target_id = stream.id (comment.target_id = '$id' or stream.id = '$id') , comment.author_id != '$senderid'" , stream.author_id != '$senderid' i agree gbn. if reason have concatenate them can utilize concat() or c...

java - Unable to display result from DB with @ManagedProperty -

java - Unable to display result from DB with @ManagedProperty - the question asking simple one. want display user details 1 time login successfull. my logincontroller public logincontroller() { } public string getpassword() { homecoming password; } public string getusername() { homecoming username; } public void setpassword(string password) { this.password = password; } public void setusername(string username) { this.username = username; } public string isvaliduser() { string isvalid="invalid user"; entitymanager em = null; seek { em = getentitymanager(); query query = em.createnamedquery("clientdetails.findbyclientid"); query.setparameter("clientid", username); //hashpassword(password); clientdetails record = (clientdetails) query.getsingleresult(); system.out.print(record); string passwordhash=hashpassword(password); if (record.getpassword()....

android - Why keyboard appear after the TabBar? -

android - Why keyboard appear after the TabBar? - in application there tabbar , edittext. see below image: normal screen: and image after press on edittext: now why tabbar goes keyboard. want remain prepare @ bottom if user open keyboard pressing on edittext. so should have ? please help e ? my xml layout tabbarmain activity below: <?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:id="@+id/ll1" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" > <framelayout android:id="@android:id/tabcontent" androi...

Nested LINQ IQueryable and WCF WebApi -

Nested LINQ IQueryable and WCF WebApi - i have method works expected. class="lang-cs prettyprint-override"> [webget] public iqueryable<buildjobmodel> getcustomers() { var context = new mydatacontext(); // ado.net entity info model var query = c in context.customers select new customermodel { id = c.id, name = c.name }; homecoming query; } but when seek create more complex query this, doesn't work. class="lang-cs prettyprint-override"> [webget] public iqueryable<buildjobmodel> getcustomers() { var context = new mydatacontext(); // ado.net entity info model var query = c in context.customers select new customermodel { customerid = c.customerid, name = c.name, orders = o in c.orders select new ordermodel { ...

c++ - Something wrong with enum -

c++ - Something wrong with enum - i've like: enum direction{forward,backward}; template<direction dir = forward> class x { private: direction my_direction_; public: void set_direction(direction dir)//here i'm getting error { my_direction_ = dir; } }; error: declaration of 'direction dir' reason why? btw, compile vs2010. change: template<direction dir = forward> to template<direction direction = forward> the error on gcc more descriptive: prog.cpp: in fellow member function ‘void x<dir>::set_direction(direction)’: prog.cpp:11: error: declaration of ‘direction dir’ prog.cpp:3: error: shadows template parm ‘direction dir’ c++

database - Pivot Tables for Linked Tables in MS Access 2007 -

database - Pivot Tables for Linked Tables in MS Access 2007 - i have 6 ms access databases (size: 1.8gb each). 1 table in each database , every table has same fields. since, limit 2gb linked these tables 1 new database. i created new ms access database same field names. table name is: table1 my question is: how create pivot table in order info 6 linked tables? create pivot table under 'table1' , automatically info other linked tables? guidance appreciated. thanks! database ms-access ms-access-2007

python - Getting pointer instead of string -

python - Getting pointer instead of string - in script, have following: file = '%s/data.txt' % (thedirectory) text = open(file) thestring = text.read print 'hello, %s' % (thestring) it returns this: hello, <built-in method read of file object @ 0x100534a48> what's causing this? you need call method using parentheses: thestring = text.read() without parentheses, python assigns reference method thestring (which isn't string @ all, @ point). python file pointers filesystems

c# - How do you close a partial view opened in a pop up and refresh the main page? -

c# - How do you close a partial view opened in a pop up and refresh the main page? - i using partial view displayed in pop edit details of record clicked on in main window. on view, user can edit, delete or cancel. when detail record edited or deleted successfully, want close partial view , update main window. right now, on delete, main view reloading in pop on success. any help getting work appreciated. the html: `<a href="javascript:popup('@url.action("editcaseemployer/" + item.id, "caseoptions")')">@item.startdate.toshortdatestring()</a>` here custom javascript functions popup window: function popup(url) { window.open(url, 'notes', 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); } function popup(url, windowname) { window.open(url, windowname, 'width=900,height=600,scrollbars=yes,resizable=yes,toolbar=no,directories=n...

Dynamic Data Site with XML file -

Dynamic Data Site with XML file - i need create dynamic info site, info stored in xml file rather database. info consists of single series of records, each 2 fields. want create dynamic info site provide ability create new records, delete records, , update records (crud) on internet. know best store records in database, in case that's not alternative - info needs sit down in xml file. how can generate dynamic info site based on xml file rather sql server database? there should not difference. need implement 4 dao methods (crud) work xml , else transparent rest of application. there libraries many languages can convert xml object , need update object properties , serialize xml. java utilize jaxb example. bad thing have lock file during updates. i.e. if 1 user updates xml file, others must wait. means site not able serve many users @ same time. xml dynamic-data

How to analyze a ruby error? -

How to analyze a ruby error? - c:\users\vlad\desktop>rake routes (in c:/users/vlad/desktop) rake aborted! uninitialized constant rake::dsl c:/ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing' c:/ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:tasklib>' c:/ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:rake>' c:/ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top (required)>' c:/ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `require' c:/ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top (required)>' c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `require' c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_unit/testing.rake:2:in `<top (required)>' c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_uni...

php - array_sum() expects parameter 1 to be array -

php - array_sum() expects parameter 1 to be array - need help me crack following. on local machine, i'm running mamp on mac. have next code: $x=0; ($i=0; $i<=30; $i++) { $votevalue[$x] = $i; $x++; } $total = array_sum($votevalue); echo "<br /><br />total vote = $total <br />"; the above code works , run fine on local machine. but, when uploaded production server, next warning prompts: warning: array_sum() expects parameter 1 array, null given in /home/rip/public_html/ripvote.php on line 7 and doesn't homecoming , show output value due warning error. how rid of this? please advice , looking forwards hear guys soon. appreciate , thanks. hmm, weird, dont know error in code, seek out : $votevalue = array(); ($i=0; $i<=30; $i++) { $votevalue[] = $i; } $total = array_sum($votevalue); echo "<br /><br />total vote = $total <br />...

vb.net - Add several .jpg's from file to image array -

vb.net - Add several .jpg's from file to image array - i'll maintain short , simple... asked question before, wasn't answered. i'd several images folder, , add together them array. not working, can explicitly tell me how it? thanks! on form load: private sub button1_add(byval sender system.object, byval e system.eventargs) handles button1.click dim picturearray new list(of image) each item string in directory.getfiles("c:\users\turcotd\desktop\itlpers", "*.jpg", io.searchoption.alldirectories) dim _image image = image.fromfile(item) picturearray.add(_image) next if (i < 6) dim pb new picturebox me.flowlayoutpanel1.controls.add(pb) pb.image = picturearray(i) = + 1 thanks!!! first, i've showed how images of directoryinfo not fileinfo above! i've used strong typed list(of fileinfo) in my reply on previous question instead of array because it's lot ...

java - Eclipse console window that respects cursor position calls allowing a progress bar -

java - Eclipse console window that respects cursor position calls allowing a progress bar - i'm using code this website (nurullah akkaya): public static void main(string[] args) { (int = 0; < 100; i++) { seek { thread.sleep(100); } grab (exception e) { } printprogbar(i); } } public static void printprogbar(int percent){ stringbuilder bar = new stringbuilder("["); for(int = 0; < 50; i++){ if( < (percent/2)){ bar.append("="); }else if( == (percent/2)){ bar.append(">"); }else{ bar.append(" "); } } bar.append("] " + percent + "% "); system.out.print("\r" + bar.tostring()); } for whatever reason outputted line line so: [> ] 0% [=====> ...

image - How to undo a change in only a certain part of a picture in Gimp -

image - How to undo a change in only a certain part of a picture in Gimp - i've been cleaning image in gimp, deleting things in several places. i later realized deleted shouldn't have deleted. i want undo change, don't want lose other changes in other areas of picture. how can done? edit -> re-create file -> create clipboard edit -> undo @ will and copy/paste backup image created on step above. image gimp

How to POST cross-domain form data using DOJO -

How to POST cross-domain form data using DOJO - i want send form info using post method remote url using dojo. dojo.xhrpost works local domain & dojo.io.script.get method. can suggest me method this? shiji i believe can utilize dojo.io.iframe accomplish this: dojo.io.iframe.send({ url: 'www.myawesome.server', form: form, content: content }); but apparently need set method on form post: dojo.attr(form, 'method', 'post'); (or straight on form: <form method="post" ...> ) i haven't tried this, here article describing (i believe) trying do: http://www.mikejuniper.com/2009/03/fun-with-dojoioiframesend/ dojo cross-domain

validation - JAXB-ElipseLink: Marshaller not validating -

validation - JAXB-ElipseLink: Marshaller not validating - i eclipselink 2.3 marshaller perform validation upon marshalling. have made sure schema correctly created schemafactory , passing marshaller.setschema , have registered handler via marshaller.seteventhandler() . the marshal result not valid acc. schema (verified in eclipse), nevertheless can see breakpoint in handleevent(validationevent event) never hit. i marshalling xml-fragments using marshal(object, xmlstreamwriter) , expect marshaller perform validation on these fragments according schema passed. anybody thought why not happening? edit: the validation error should occur: 2 missing attributes on element. the element corresponds java-object contained in list<>. marshalling list using: <xml-element java-attribute="listinstance" xml-path="listwrapperelement/listelement" type="foo.elementtype" container-type="java.util.arraylist"/> the mapping elemen...

java - How to sort dates in a List -

java - How to sort dates in a List - how can sort dates within list? i have read can achieved using treemap, sorted , navigable map organizes elements in self-balancing binary tree. expensive. my question - best , efficient way accomplish result? it depends. if want have "always sorted" container treeset friend. adding element treemap o(log(n)) - (very good, faster linear). if need sort 1 time (no adding elements later), set arraylist , utilize sort() method. optimal - o(n log(n)) update: as jb nizet mentioned in comment, set (treeset) cannot contain duplicates. list (arraylist) can. if performance of import , there lot of elements , need store sorted elements allowing duplicates, can store in treeset, need implement counting ( add() element.count++ , , remove() element.count-- example). java sorting date

OSGi Console not showing in Glassfish 3.1.1 admin pages -

OSGi Console not showing in Glassfish 3.1.1 admin pages - i installed fresh new glassfish 3.1.1 instance. reasons, needed alter default http port 9081 , admin port 9049. then admin interface used update tool install osgi console. i have new "osgi console" tab in server admin page, when click on it, contents don't load. turns out, tab trying load page standard http port (8080), whereas configured http port 9081. when seek access osgi console straight browser admin port (http://localhost:9049/osgi/system/console/bundles/), everything's showing fine, installation in ok. so question is, how setup glassfish request redirected? thanks. file bug in osgi category in glassfish jira. osgi console plugin should have intelligence know port server configured hear http requests. console glassfish osgi

Setting a locale for an ajax request in Rails 3 -

Setting a locale for an ajax request in Rails 3 - i'm wondering there elegant way pass locale in ajax request. have autocopmlete field, should take values given language. the coffeescript like: ... $('#post_name').autocomplete source: "/ajax/posts" ... i'd source like: "/en/ajax/posts" or "/he/ajax/posts" or whatever. sure can maintain variable in session, or (worse) pass through hidden input. please suggest? you can rename file coffee.erb processed ruby before coffee (enclose ruby code <% %> ruby-on-rails ajax autocomplete internationalization locale

asp.net mvc - How to send model object in Html.RenderAction (MVC3) -

asp.net mvc - How to send model object in Html.RenderAction (MVC3) - i'm using mvc3 razor, , i'm trying pass object partial view, , it's not working. this works fine without sending object model partial view: html.renderaction("index", "viewname"); trying doesn't sent model object, i'm getting nulls instead (the object has data, , view expects it):' html.renderaction("index", "viewname", objectmodel); is possible using renderaction? thanks! edit: found error, there error controller's action didn't pick sent object. help! say want pass foo model, create first public class foo { public string name { get; set; } public int age { get; set; } } now create actionresult public actionresult foobar(foo _foo){ homecoming partialview(_foo); } call @html.renderaction("foobar", "controller", new { name = "john", age=20 }); asp.net-...

wifi - how can i check net connection in android? -

wifi - how can i check net connection in android? - i have developed 1 application in have check whether net connected or not utilize next code not working. can 1 resolve problem. code is public class abcactivity extends activity { button b; private static final string tag = null; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); b=(button)findviewbyid(r.id.button1); b.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub netcheckin(); } }); } private void netcheckin() { seek { connectivitymanager ninfo = (connectivitymanager) getsystemservice(context.connectivity_service); ninfo.getactivenetworkinfo().isconnec...

web services - Why server returned wrong data types from Yii webserver? -

web services - Why server returned wrong data types from Yii webserver? - i seek organize soap web service. if official docs, ok , server returns float data. when seek send model types, server returns "float 1". why? wsdl generated see. [addition] that works http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice i seek resolve http://www.yiiframework.com/forum/index.php?/topic/23496-soap-class-mapping/ link post #2 but "1" result. web-services soap yii

asp.net - How to convert Object to List in c#? -

asp.net - How to convert Object to List<string> in c#? - i have list<string> in model. when write html helper, can info metadata.model , object // mvc3 (namespace system.web.mvc -> modelmetadata), did not write // summary: // gets value of model. // // returns: // value of model. more info system.web.mvc.modelmetadata, // see entry asp.net mvc 2 templates, part 2: modelmetadata on brad wilson's // blog public object model { get; set; } my question is: how list<string> object ? if underlying type of object variable list<string> , simple cast do: // throws exception if model not of type list<string> list<string> mymodel = (list<string>)model; or // homecoming null if model not of type list<string> list<string> mymodel = model list<string>; c# asp.net list object

localization - Django L10N: Making the Flat Model of 'po' File Not Flat -

localization - Django L10N: Making the Flat Model of 'po' File Not Flat - the problem is: .po files flat. so, don't have convenient hierarchy. example: msgid "site_title" msgstr "this title of site" msgid "about_site_title" msgstr "and now... site" problem occurs when have lot of messages in our .po file. it's hard find specific message want change. we need bind our .po messages specific templates (html templates). the obvious solution utilize custom prefix (for illustration name of template file). if have home.html , about.html our message strings be: msgid "home:site_title" msgstr "this title of site" msgid "about:site_title" msgstr "and now... site" could offer more convenient solution please? basically .po files ordinary text files entries separated empty line. writing simple parser split 1 .po multiple files based on prefix msgid "something: seem...

Map Markers Not Displaying (JavaScript/Google Maps API V3) -

Map Markers Not Displaying (JavaScript/Google Maps API V3) - i'm having problem getting map markers display using google maps api v3. i'm attempting maintain them in single array, create displaying big amount relatively simple. currently, map loads fine, throws error uncaught typeerror: object #<object> has no method 'setvalues' when attempting draw markers. error repeats each iteration run settimeout() . recommendations appreciated. this javascript used: var map; var markers = [ [ 45.768366, -108.5975760, 'fitness 19' ], [ 45.785684, -108.6144625, 'granite fitness' ], ... (more, syntactically correct) [ 45.7920092, -108.4886232, 'steepworld' ] ]; function mapinit() { var conf = { zoom: 11, center: new google.maps.latlng(45.7832856,-108.5006904), maptypeid: google.maps.maptypeid.roadmap } ...

hp ux - List files modified on a particular date in hp unix -

hp ux - List files modified on a particular date in hp unix - how list files modified on 24th dec in folder in hp unix. i have folder containing huge number of files, want filter files modified on particular date. dec 15th.. try (not sure if need): ll | grep 'dec 15' unix hp-ux

functional testing - how to test playframework's tag and do I need do that -

functional testing - how to test playframework's tag and do I need do that - when create new playframewor's tag. need create test (assuming utilize tdd)? , how possible , best practice doing tests tags in general? for illustration there piece of code utilize tag "my_tag": #{my_tag param1:value1, param2:value2 } if think tag little.. piece of presentation renders on page use. should test how handle parameters , how render html? how my_tag implemented? html/tag file or in code fasttag? if my_tag defined in html/tag file general guidance don't want set lot of logic in them. maybe improve testing/validating source of value1 , value2 , making sure my_tag never gets bad value1 or value2 (assuming have pretty tight command of using my_tag. if my_tag implemented in code fasttag, code can complex want. in case, want write tests exercise execution paths in fasttag logic. having test page of: #{my_tag param1:badvalue1, param2:value2 } #{my_...

select within loop in Rails 3, taking only first option -

select within loop in Rails 3, taking only first option - guys have form this <%= form_tag({:action => 'update_survey_list_status') do%> <table id="survey_form"> <tr> <th>beneficiary details</th> <th>hfi details</th> <th style="vertical-align: middle"> <input type='checkbox' name='checkall' onclick='checkedall();'></th> </tr> <% @to_be_registred_list.each |b| %> <tr> <td style="vertical-align: middle"><b> <%= b.name %></b><br /> <span><%= b.age %>, <%= b.sex %><br /><%= b.address %></span> </td> <td style="vertical-align: middle"> <%= select("beneficiaryloans","hfi_id", beneficiary.find(b.beneficiary_id).beneficiaryloans.collect { |h| [user.find(h.hfi_i...

How to check 20,000 Twitter Accounts for activity? (are inactive) -

How to check 20,000 Twitter Accounts for activity? (are inactive) - i'm writing little app remove inactive twitter accounts follow list. i follow 20,000 people. i'm looking @ the statuses/public_timeline api call, utilize timeline of each person follow , if lastly post > 30 days ago, "unfollow" them. however, rate-limited call, believe run afoul of twitter's api limit. there improve / more clever way implement this? different call? you can utilize streaming api: https://dev.twitter.com/docs/streaming-api you filter query userid , check date of lastly post. plus, not rate limited. twitter

c++ - Pointers and assignment -

c++ - Pointers and assignment - why is int *a = new int[10]; written as int *a; = new int[10]; instead of int *a; *a = new int[10]; ? the way see it, in sec block of code you're saying a, pointer variable, array. in 3rd block of code you're saying thing points array. why sec create more sense third? new int[10] returns pointer first element in array (which of type int* ). not homecoming pointer array (which of type int(*)[10] ). a = new int[10] means make a point first element of dynamically allocated array. *a not pointer @ all. the object pointed pointer a (which of type int ). note if had named array object, syntax still same: int x[10]; int* = x; why? in c++, in cases, whenever utilize array, implicitly converted pointer initial element. here, int* = x same int* = &x[0]; . (there several cases array-to-pointer decay not occur, notably when array operand of & or sizeof operators; allow address of arra...

php - MySQL "REPLACE INTO" using a SELECT to pull one field -

php - MySQL "REPLACE INTO" using a SELECT to pull one field - i've got mysql database has 2 tables (actually many more). first table links product's sku number arbitrary id. there sec table records end of day inventory each item based on id. when inventory changed reasons other sales, there record placed in sec table boolean set false. allows me new number not valid vector sales previous, next day's sales. there syntax error in code. i'm still student, , appreciate help in explaining how kind of update work. know first value needs come select statement? here current mysql statement: replace sales (`itemid`, `date`, `qty`, `price`) values ([itemid], curdate(), [qty], 0.00) select itemid item `sku` = [sku] replace works insert, except if there row same key trying insert, deleted on replace instead of giving error. you can either specify arguments directly: replace sales( `item_id`, `date`, `qty`, `price` ) values( 15, '2012...

android - Camera.setPreviewCallback( PreviewCallback ) not working -

android - Camera.setPreviewCallback( PreviewCallback ) not working - i'm trying photographic camera preview data, don't want show preview. unfortunatelly setpreviewcallback( previewcallback ) doesn't work unless call setpreviewdisplay(surfaceholder) is possible pass in way - start callbacks without setting preview display, or way of hiding display? well, it's not ideal solution, can seek hiding view in. made have width , height of 1, barely visible, still valid surfaceholder phone call need make. android camera

c# - Detect mobile device minimizing -

c# - Detect mobile device minimizing - windows mobile 6.5.3 professional .net framework 3.5 c# visual studio 2008 windows 7 professional sp1 when app runs on mc75a, little icon x (or ok if form's minimizebox property set false) nowadays @ top right in "title bar". have been advised app must terminate when icon pressed. found event handler trigger on press event, perform wrapup, , terminate app (application.exit). i not know how observe icon press. further, there suggestions on best method accomplish shutdown? tia the (x) minimize. should minimize, not exit app. follow expected platform behavior. clicking (ok) close form, returning command whomever showed form. if caller application.run(), app terminate , pattern should striving achieve. closing sub-form or dialog 1 time again not expected behavior. if must close app, add together form code: protected override void onclosed(eventargs e) { base.onclosed(e); appli...

VSTO 2005 Add-in fails to start if .NET framework 4 is installed -

VSTO 2005 Add-in fails to start if .NET framework 4 is installed - i have vsto 2005 office add-in office 2003, built against .net 2, runs fine, works if .net framework 4 not installed. if install .net framework 4, won't start. i've enabled debugging setting environment variable vsto_suppressdisplayalerts 0 , can see error during startup of office applications: the type initializer 'microsoft.visualstudio.tools.applications.runtime.domainfactory' threw exception. ************** exception text ************** system.typeinitializationexception: type initializer 'microsoft.visualstudio.tools.applications.runtime.domainfactory' threw exception. ---> system.notsupportedexception: microsoft .net framework 2.0 or later not correctly installed. microsoft visual studio 2005 tools microsoft office scheme requires microsoft .net framework 2.0 or later." @ microsoft.visualstudio.tools.applications.runtime.policyinfo.initializefromconfigurationfiles(p...

How to put my DB SQLite in Android app? -

How to put my DB SQLite in Android app? - hello first of all. making application android, need have database information. database management computer mailbox. need take database , included in application android's select generally. i've been testing on this website, can not work. not think either db re-create memory, , perform query, says can not find table. have been debugged , saw open works, unusual happens ... if have method or way of doing this, appreciate it. everything. check out these resources this tutorial lars vogel this reference article android website android

Dynamic variable in Flow in MULE..? -

Dynamic variable in Flow in MULE..? - i have flow in mule contains http inbound , component class below : <flow name="metaservice"> <http:inbound-endpoint address="http://localhost:8000/jcore/meta/user" transformer-refs="httpparams" responsetransformer-refs="javaobjecttojson"> </http:inbound-endpoint> <component class = "com.jcore.meta" /> </flow> now if have take request url, "localhost:8000/jcore/meta/user2", have create flow..!! is there alternative in mule "localhost:8000/jcore/meta/{variable}" , in can read variable , phone call appropriate component class according that..?? consider creating jax-rs annotated resources , jersey module url-based dispatching done automatically you. otherwise, bind metaservice "http://localhost:8000/jcore/meta", have selection router looks @ actual request path ("/jcore/meta/user" or "/jco...

Java String encoding (UTF-8) -

Java String encoding (UTF-8) - i have come across line of legacy code, trying figure out: string newstring = new string(oldstring.getbytes("utf-8"), "utf-8")); as far can understand, encoding & decoding using same charset. how different following? string newstring = oldstring; is there scenario in 2 lines have different outputs? p.s.: clarify, yes aware of excellent article on encoding joel spolsky ! this complicated way of doing string newstring = new string(oldstring); this shortens string underlying char[] used much longer. however more checking every character can utf-8 encoded. there "characters" can have in string cannot encoded , these turned ? any character between \ud800 , \udfff cannot encoded , turned '?' string oldstring = "\ud800"; string newstring = new string(oldstring.getbytes("utf-8"), "utf-8"); system.out.println(newstring.equals(oldstring)); prints ...

php - HTML dynamic cropping -

php - HTML dynamic cropping - i'm having problem showing images in table. the images have different aspect ratios. different aspect ratios of images create table of images cluttered. to solve crop part needs cropping have image square. have scaling downwards php script. the tricky part can utilize html, css , php serverside, else not supported. so there way can dynamically, without knowing size of image crop square? have div specified width , height (the size of desired square), it's background-image set image of unknown size centered. seem image "cropped", meaning everyting outside of div's size not visible. php javascript html5 css3

How to get a rectangle around the target object using the features extracted by SIFT in OpenCV -

How to get a rectangle around the target object using the features extracted by SIFT in OpenCV - i'm doing project in opencv on object detection consists of matching object in template image reference image. using sift algorithm features acurately detected , matched want rectagle around matched features algorithm uses kd-tree est ean first technique matches if want rectangle around detected object, here have code illustration that. need draw rectangle around homography h. hope helps. luck. opencv sift object-detection

xml - XPath - extract value from parent with highest node value -

xml - XPath - extract value from parent with highest node value - this xml snippet <financialsummary> <summarydate format="yyyymmdd">20111231</summarydate> <revenue currency="eur">1249164523</revenue> </financialsummary> <financialsummary> <summarydate format="yyyymmdd">20101231</summarydate> <revenue currency="eur">1242344523</revenue> </financialsummary> <financialsummary> <summarydate format="yyyymmdd">20091231</summarydate> <revenue currency="eur">324900932</revenue> </financialsummary> im trying extract node content revenue node within financialsummary tag highest numeric summarydate value. /financialsummary[summarydate = '20111231']/revenue this xpath returns right = 1249164523 max(/financial...

wordpress - Apache index.php redirect for base and sub directory -

wordpress - Apache index.php redirect for base and sub directory - i looking run wordpress , magento on same domain. wordpress installed @ root of site , magento installed @ /store/. i have had apache config setup wordpress (having requests redirect index.php), apache configuration logic need requests /store/* goto /store/index.php ? you should able maintain default magento .htaccess file in store directory along other magento files, exclude path wordpress rewrites. i'm not date on wordpress .htaccess files may like, should case of adding rewritecond. i guess rewrite wordpress along lines of... rewritecond %{request_uri} !-f rewritecond %{request_uri} !-d rewriterule (.*) /index.php?$1 [qsa,l] if case add together rewritecond should trick... rewritecond %{request_uri !^store/ posting wordpress .htaccess file may lead more accurate advice. apache wordpress magento

linq - Optimizing away OrderBy() when using Any() -

linq - Optimizing away OrderBy() when using Any() - so have standard linq-to-object setup. var query = expensivesrc.where(x=> x.hasfoo) .orderby(y => y.bar.count()) .select(z => z.frobbername); // ... if (!condition && !query.any()) return; // seems enumerate , sort entire enumerable // ... foreach (var item in query) // ... this enumerates twice. bad. var queryfiltered = expensivesrc.where(x=> x.hasfoo); var query = queryfiltered.orderby(y => y.bar.count()) .select(z => z.frobbername); if (!condition && !queryfiltered.any()) return; // ... foreach (var item in query) // ... works, there improve way? would there non-insane way "enlighten" any() bypass non-required operations? think remember sort of optimisation going edulinq. there not much info can extracted enumerable, maybe it's improve turn query iqueryable? an...