Posts

Showing posts from February, 2015

android - Signing apk by gradle - invalid encoding for special chars -

according many topics configuring gradle sign apk used solution . seems takes proper values, cannot success whole operation. problem letter "Å‚" showing wrong in terminal. need help, because don't know now. i've spent 4 hours on it... this main project app gradle properites file: apply plugin: 'android' android { compilesdkversion 19 buildtoolsversion "19.1.0" defaultconfig { minsdkversion 10 targetsdkversion 19 } signingconfigs { release { storefile file(release_store_file) storepassword release_key_alias keyalias release_key_alias keypassword release_key_password } } buildtypes { release { signingconfig signingconfigs.release } } } dependencies { //... } this file takes data ~/.gradle/gradle.properties file in window's user dir. org.gradle.parallel=true org.gradle.daemon=false

Laravel Eloquent - Eager loading -

i have 3 tables: client , user , position . client user many-to-many, client position one-to-many , user position many-to-many. now, user can part of 2 different clients , , each, user assigned positions. want client, , of users, , position. when use: client::whereid($id) ->with(array( 'users', 'users.positions' )) ->firstorfail() then, users client, positions user has, of clients part of. what can do? example ->say have 2 clients: sony , microsoft, , 2 users john , mike. ->say microsoft has positions: developer , engineer. ->say sony has positions: marketing , finance. john works @ microsoft developer, while mike works @ microsoft engineer , @ sony finance guy. if want microsoft's employees , positions, expect john (and position being developer) , mike (and position being finance). however, code above run gives me john (with developer), , mike (with engineer , finance. pivot table fi

How do I use multiple for loops C++ while obtaining the sum of income and expense? -

i'm uber new c++ , learning loops. this homework problem: the sales manager @ mystore wants program allows enter company's income , expense amounts, integers. number of income , expense amounts may vary each time program run. example, sales manager may need enter 5 income amounts , 3 expense amounts. or, may need enter 20 income amounts , 30 expense amounts. program should calculate , display company's total income, total expenses, , profit (or loss). i trying use 2 loops sum of expense , income keep getting wrong sum second loop. i'm not sure if should use multiple loops or different together. appreciate help. thanks! here part of i've got far: if (incnum > 0) { // income items , calculate sum total. (int count = 1; count <= incnum; count++) { cout << "enter income items: " << count << ": "; cin >> income; sumincome += income; // calculate sum total. } } // display total i

python - Key binding does not work in tkinter -

i made simple script: from tkinter import * class myframe(frame): def __init__(self, parent = none): frame.__init__(self, parent, bg = 'red') self.pack(fill=both, expand=yes) self.bind('<key>', lambda e: print("pressed key")) root = tk() root.geometry("300x200") f = myframe(root) root.mainloop() but binding pressing key not work. nothing happens whey press key. know why? you need call bind method of parent , reference tkinter.tk instance represents main window: parent.bind('<key>', lambda e: print("pressed key")) self.bind calling bind method of tkinter.frame instance created when did: frame.__init__(self, parent, bg = 'red')

More then 7 characters and encyption's dont match C# and PHP -

i have password hashing method in c# i'm trying port php website, allow both website , application use passwords same database (application requires website account use). problem is, once password gets on 7 characters in length, result different in php i'm getting in c#, password less 8 characters, matches c# encryption exactly. here method in c# public static byte[] passencode(byte[] pass) { int = 0; int num = 0x79707367; // starting num (int = 0; < pass.length; i++) { num = passlame(num); = num % 0xff; pass[i] ^= (byte)a; } return pass; } private static int passlame(int num) { int c = (num >> 16) & 0xffff; int = num & 0xffff; c *= 0x41a7; *= 0x41a7; += ((c & 0x7fff) << 16); if (a < 0) { &= 0x7fffffff; a++; } += (c >> 15);

iOS Google Maps API Key Invalid for Account -

i having issues api key ios google maps sdk. currently have multiple applications 1 using javascript api, , android 1 , , ios app. web , android app works fine receive , invalid api key. bundles matching , ios sdk enabled under services. i created api key on personal gmail account , linked bundle , worked fine. removed , create api key on console other api's , fails. has come across problem before?

Javascript array element indexOf is -1 after swap of element positions with splice -

our array has 2 elements of type object this: array = [{member1: "value1"},{member2: "value2"}]; when index of second object this: var index = array.indexof(obj); i 1 result, fine. when swap 2 elements shift object right left , other 0 index object left right: var new_index = index - 1; array.splice(index, 0, array.splice(new_index, 1)[0]); and try index of same object (which know present in array , index 0 now) -1 (not found) result. whats problem here? as want swap, rather splicing may better use temporary variable. var array = [{member1: "value1"},{member2: "value2"}], obj = array[1]; function swap(arr, i, j) { var t = arr[i]; arr[i] = arr[j]; arr[j] = t; return arr; } console.log('before swap', array.indexof(obj)); // 1 swap(array, 0, 1); console.log('after swap', array.indexof(obj)); // 0 edit tried code though , expected result of 0 , maybe you've done reference obj

php - Laravel not executing queries with 'having' clause -

i have manually built large query using various eloquent functions (i.e. $this->newquery()->join....), can't run. when call echo $query->tosql(); it shows me query. can copy , paste command line mysql client, , runs fine, , returns several rows. when call echo $query->count(); or echo $query->get()->count(); it's showing 0. i enabled mysql general log see happening. see laravel runs, executes several queries - each has prepare line in log, followed execute line. 1 doesn't. it appears laravel preparing statement, never executing it. why not? after testing, have identified line causes problem: $query->having('book_author_author_id', 'not in', db::raw('('.implode(',',$author_ids).')')); it appears queries contain 'having' clause not executed laravel, instead pretends execute them , returns empty collection. going on? the problems turns out laravel not correctly resolving

domain driven design - DDD and avoiding CRUD -

it seems on articles read, crud avoided in ddd dealing modeling business process , not data. however, find hard see not have crud operations on entities. example, in school grading system, before teachers can grade students, schoolyear has present or perhaps gradingperiod. can't see how can manage gradingperiods without crud. enlighten me on this? a important part of ddd bounded contexts. a bounded context delimited part of application terminology consistent. ddd seldom correct approach entire application. therefor divide application in separate bounded contexts. within each bounded context can have different pattern. crud bc has little domain complexity , ddd area high complexity. crud not avoided per sé. crud avoided when there complex business rules in play. ddd avoided when you're providing forms on data little rules. so, possible have application parts doing simple crud , other parts richer domain model. that's 1 part of equation, original question

iframe - jQuery hiding an <li> title when using a slideToggle -

i have created iframe show login area or register area. used .slidetoggle show 1 frame while hiding other. trouble i'm having is, how hide 'register' title when login frame shown. right title shows below frame. thinking of doing if/else, don't know how word it. need title not show @ bottom of iframe. here code. in head of page. <script type="text/javascript"> $(document).ready(function() { $('.open').click(function() { $('#login iframe#register').slidetoggle(300); $(this).toggleclass(close); }); $('.open2').click(function() { $('#login iframe#log').slidetoggle(300); $(this).toggleclass(close); }); }); </script> and here of page navs. <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="c

javascript - Ember Needs API; ReferenceError: controllers is not defined -

i'm working on ember project. display list of books , descriptions passed down server. user can click on particular book, links comment page. but, want display book description on comments page. learned use needs api grab information book controller. however, tried displaying {{controllers.book.description}} amidst html , wouldn't display anything. added below action print out console , received error: uncaught referenceerror: controllers not defined . using needs wrong? help. app.bookcommentcontroller = ember.objectcontroller.extend({ needs: ["book"], actions: { getdescription: function() { console.log(controllers.book.description); } } }); got it! turns out using wrong, difficult diagnose there's no documentation anywhere. in order print out console, ended using: this.get('controllers') //i.e. console.log(this.get('controllers')) in order access controllers variable.

ios - IOS7 Table view cell touching delay with cell property UITableViewCellSelectionStyleNone -

i want make custom table view cell this. if cell.selectionstyle = uitableviewcellselectionstyledefault , there's no delay when touching title label's background color disappeared. if cell.selectionstyle = uitableviewcellselectionstylenone , title label's background color fine, there's touching delay present modal vc. in advance! you can implement this, under uitableviewdelegate method - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; switch (cell.selectionstyle) { case uitableviewcellselectionstylenone: // making delay nstimer [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(trigger:) userinfo:cell repeats:no]; break; case uitableviewcellselectionstyledefault: // changing labels color [cell.textlabel setbackgroundcolor:[uico

fileparsing - Process huge text file in java web application via UI upload or read from directory -

my web application needs process text file (size close 200mb) reading relevant data. text file needs processed monthly once, means contents of text file varies monthly. know best practice implement processing of text file. shall allow user upload 200mb file via application , process it? configure java webapplication read file predefined directory in tomcat server.(still present ui user initiate processing, e.g.'start processing') i using jsapar library processing text file flat file fixed positions. let me answer question myself. a pointed out vikeng21 prefer 2nd option. implemented in such way that, have made folder in files placed configurable via property file. added options in gui displays files available system process, reading pre-configured folder property file. if there no files available in folder, gui displays absolute folder path customer needs place files, app can read , render file info. process link rendered against each file name, upon clic

python - Adding falcon application routes on a root directory -

i writing falcon application serving webpages. have js, css files under /js, /css under root dir. these /js , /css directories can have multiple subdirectories , files may located inside 1 of sub directories. i want have falcon apps route added such webpage requests /js/subdir1/subdir2/temp.js /js/subdir1/temp2.js can satisfied same responder method. but when tried, having route added like app.add_route("/js/{filename}", resourceclass()) the request /js/subdir1/subdir2/temp.js not reach responder. the responder have below, class resourceclass(object): def on_get(self, request, response, filename): file_path = os.path.join(path_to_js,filename) serve_file(response, file_path) serve_file create appropriate response , return it. i want filename populated "subdir1/subdir2/temp.js" "/js/subdir1/subdir2/temp.js" , "subdir1/temp2.js" "/js/subdir1/temp2.js " how can add route , add responder ?

url - You are registering the following domain name -> Forward this domain to.. what? -

Image
i've register domain don't know why ask me valid existing url domain. i'm trying register www.mysite.tk @ dot.tk , should provide url of hosting provider (hostinghood.com)? if don't want forward website, think should check "use dns" options , follow instructions there.

javascript - how to overlap sections in html body while scrolling? -

i want make design in html has sections , while scrolling 1 section falls on top of previous section stack. how implement using css, javascript, jquery? example of such design is: https://www.mozilla.org/en-us/firefox/os/?icn=tabz the simplest trick use position:fixed; content. here jsfiddle demo . full blog post here .

javascript - Change items in a drop-down list depending on the selected option in another drop-down list -

i have following code: <select name="trec"> <? $d -> gettreatment(); ?> </select> <select name="treratment"> <? $d -> gettreat(); ?> </select> the <? $d -> gettreatment(); ?> will display echo "<option value='$r[id]'>$r[cat]</option>"; and <? $d -> gettreat(); ?> will display echo "<option value='$r[id]'>$r[treatment]</option>"; how dynamically narrow down (or limit) items in second drop down list based on selected item first selected item? example if have 1 list of countries in first drop down list , have list of states in second list once usa selected country list second list should change list states of usa <script type="text/javascript"> $(function() { $("#form_process").click(function() { //$("#choice").val(); //you cannot use same id more 1 tag var choice =

javascript - Using jQuery event handlers - jQuery newbie -

i'm in process of learning jquery , feel must missing something. have super simple form set below: <form name="testform" id="testform" method="post"> <select type="select" id="searchid"> <option value="1">option 1</option> <option value="2">option 2</option> </select> <input type="text" id="searchtext" value="$_post['value']"> </form> i'd use jquery automatically submit form when #searchid changed. understand how basic javascript, need jquery other things , need learn how these things work. below jquery snippet seems me should work, it's not working. ideas why? $( "#searchid" ).change( function() { $( "#testform" ).submit(); }) this how can submit form: $(function() { $( "#searchid" ).change( function() { $( "#testf

ruby on rails - Incorrect association in fixtures -

i'm following guide http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures rails 4.1.1 , using named fixtures within 1 in https://github.com/codetriage/codetriage project. when try reference 1 fixture doesn't work: # fixtures/issues.rb issue_triage_sandbox_issue: id: 4 comment_count: url: https://api.github.com/repos/bemurphy/issue_triage_sandbox/issues/1 last_touched_at: 2012-11-10 22:20:24.000000000 z number: 1 created_at: 2012-11-10 23:23:45.281189000 z updated_at: 2012-11-10 23:23:45.281189000 z repo: issue_triage_sandbox title: first test issue in sinatra html_url: https://github.com/sinatra/sinatra/issues/1 state: open and # fixtures/users.rb issue_triage_sandbox: id: 1 user_name: bemurphy name: issue_triage_sandbox full_name: bemurphy/issue_triage_sandbox language: ruby created_at: 2012-11-10 21:50:48.351554000 z updated_at: 2012-11-10 21:50:48.351554000 z issues_count: 1 you can see issue should loading

javascript - Call function anytime a link is moused over on an arbitrary page? -

i apologize possibly naive nature of question not web developer day. is possible write script such that, arbitrary web page, function have written called if url moused over? thinking use document.links assemble array of of hrefs in document , add onmouseover event attribute each of them but, unless i'm mistaken, overwrite existing onmouseover attributes present in page. not ideal. i'm not sure if arbitrary web page mean pages on domains or pages of own domain, latter put following in pages: $(function () { $(document).on('mouseenter', 'a', function () { console.log(this, 'hovered'); }); }); if mean page browse on net, have write browser extension browser using. chrome have @ this .

How do I build/deploy a Java program so that anyone can open it without an IDE or Command Line? -

this question has answer here: how make executable jar file? 2 answers i built game in java, , want make can opened on other computer without using ide or command line or of like. basically, want computer games download internet , start playing. i'm sorry if stupid question (or impossible question), english second language , don't know other way put it. basically, i've gotten pretty @ making video games, , i'm done game, don't know how make game can run without ide. namely, want little brother able double click on icon cause game start up. now, approaching logically, i'd assume whatever computer game running on need have java downloaded (like jdk) or something, , i'm ok that. want able give doesn't speak or read english simple icon double click on , play game. if impossible without industry grade developers, please let me know, s

java - How do I get and select a treeItem that is not visible by index in JavaFX? -

i'm saving index of current select treeitem using treeview.getselectionmodel().getselectedindex(); . goal able reselect treeview item once treeview rebuild. there doesn't seem method in api allow me , select treeview item isn't under expanded node. i've tried treeview.getselectionmodel().select(index); seem work when treeitem's parent expanded. api doesn't mention item selected must under node expanded. tried treeview.gettreeitem(index).getparent().setexpanded(true); expand item's parent node seem work if item visible , under expanded node. so question is, how store current selected treeitem , re-select when treeview rebuilded. try sir, int i; = treeview.getselectionmodel().getselectedindex(); treeview.gettreeitem(i).setexpanded(true); treeview.getselectionmodel().select(i);

curl - PHP curl_exec times out, from command line I get instant answer -

i'm developing script i'm using php , curl fetch data rest web service. my problem curl_exec times out in php script, when try same request command line curl client instant answer. it seems php curl somehow caches timeout time , decides it's going fetch data need. multiple reloads produces same result: timeout. , after few minutes works fine. command line curl client has been getting data time. what can wrong? try use curl setting: curl_setopt($curl_handler, curlopt_fresh_connect, true); also setting useful, forces connection close after request completed: curl_setopt($curl_handler, curlopt_forbid_reuse, true);

How to insert a buffer in a ostream with c++ -

what i'm trying insert stream ( std::ostream ) buffer . this buffer attribute of class "acquisample" i made example simple understand problem. here definition of class : class acquisample { public: iqsample * buffer; } here's definition of struct iqsample : struct iqsample { struct { short val; }i; struct { short val; }q; } what want put buffer known size stream that: std::ostream stream; acquisample obj; stream << obj.buffer->i.val << obj.buffer->i.val; i think it's not working because it's not copying data pointer adress, want put entire buffer stream because i'm sending stream on computer. if know how i'd thankful. the idiomatic way achieve overload insertion operator: struct iqsample { struct { short val; }i; struct { short val; }q; }; std::ostream& operator<<( std::ostream& os, iqsample iqs ) { return os << iqs.i.val << ' ' <&

jquery - Why is the value of my input appearing blank? -

i writing script finds value of text input it's typed. whatever reason, in console, value blank. $('[rel^="livesearch"]').ready(function(){ var fieldname = $(this).attr("name"); $(this).on('keydown', function(){ console.log('a key pressed... value '+$(this).val()); if($(this).length > 3){ $.ajax({ url: $(this).attr("rel") + $(this).val(), datatype: "xml", statuscode: { 404: function(){alert("404 not found!")} } }) .done(function(xml){ $(xml).find('member').each(function(){ var memberid = $(this).attr("id"); var membername = $(this).find('content').text(); suggestionmenu.

java vm options having + and - symbols -

what "+" , "-" sign refer in vm options java -xx:+useparallelgc -xx:-useparalleloldgc testgc java -xx:+useconcmarksweepgc -xx:+explicitgcinvokesconcurrent -xx:-useparnewgc testgc we can see "+useparallelgc" , "-useparalleloldgc" having + , - sign, these signify directly documentation : boolean options turned on -xx:+<option> , turned off -xx:-<option> please note + option on , - option off

ios - Sharing information in application -

i working on new app, , i'm trying figure out how can implement next thing on iphone programming. iphone writes list of names in application iphone b notified , came application , see list of names my question is: how share things between iphones. server connects iphone or what? , how need work. send data iphone server, server send push notification iphone b, user start app on iphone b , download new data. if app running on iphone b should observer push notificating , don't forget download new data...

actionscript 3 - File browse and open dialogs not working(opening) on AIR Windows -

Image
we have many customers using our air application on mac , windows, 1 customer has issue, no file popup dialogs, opening, browse open, open button click handlers on air not on flash in browser there should not restrictions, unable find on google similar issues , not sure cause on machine , how fix it(if fix in code or tell customer configure) edit, here sample code var browsefile:file = file.documentsdirectory; browsefile.addeventlistener(event.select, fileselected); browsefile.browsefordirectory("select local folder"); edit2 exception error: error #2014: feature not available @ time. @ flash.filesystem::file$/initdocumentsdir() @ flash.filesystem::file$/get documentsdirectorypath() @ flash.filesystem::file$/get documentsdirectory() my problem use .swc uses code don't have source work around this. not aware functionality not work

asp.net mvc 3 - Auto complete Shouldn't take new value as a value -

i using autocomplete contacts , contacts can suggested based user enter text these suggests come elastic search.if contact not within system ,autocomplete shouldnot take value autocomplete,it should not take or raise error. how handle scenario. using knockout kendo. in .cshtml page code : <div class="people-tags"> <input id="notecontacts" class="display-inline form-control tagsinput-info-round" data-bind="value:contactfullnames, valueupdate: 'afterkeydown'" /> </div> in .js file : selfnote.contactfullnames = ko.computed({ read: function () { var contactfullnames = ""; if (selfnote.contacts() != null) { $.each(selfnote.contacts(), function (index, value) { console.log(value); if (contactfullnames != null && contactfullnames != "") contactfullnames = contactfullnames + "

regex - Batch rename files by adding +1 to prefix number in a filename -

so, question is: how add +1 prefix number in filename? the goal go rename multiple files go this: 1_loremipsum_and_stuff_2013.pdf 2_loremipsum_and_stuff_2013.pdf 3_loremipsum_and_stuff_2013.pdf 4_loremipsum_and_stuff_2013.pdf 13_loremipsum_and_stuff_2013.pdf 18_loremipsum_and_stuff_2013.pdf 19_loremipsum_and_stuff_2013.pdf 20_loremipsum_and_stuff_2013.pdf to this: 2_loremipsum_and_stuff_2013.pdf 3_loremipsum_and_stuff_2013.pdf 4_loremipsum_and_stuff_2013.pdf 5_loremipsum_and_stuff_2013.pdf 14_loremipsum_and_stuff_2013.pdf 19_loremipsum_and_stuff_2013.pdf 20_loremipsum_and_stuff_2013.pdf 21_loremipsum_and_stuff_2013.pdf i'm not experienced terminal @ all. able find examples removing prefix number . works fine, when try replace using regex, can't close. so after first trying , failing horribly @ correctly regexing in terminal, thought i'd give try in javascript. i able working in javascript /[0-9]*(?=_)/ . so, best guess terminal this, except doesn

html - Number validation in JavaScript -

i have created external javascript validate form created in html. of validation works, when use same code validate other fields not work. e.g. postcode must contain numbers - if not, postcode invalid. i tried using same code credit card, i.e. credit card must have 16 digits - if not, credit card number invalid. wrote code postcode , worked, when tried reaarrange suit credit card function, did not work. not sure why? should have used different function? here external javascript: function validateform() { if (isnan(document.getelementbyid("postcode").value)) { alert ("your postcode not valid"); } else { alert ("you have entered postcode correctly"); } if (document.getelementbyid ("email").value.length < 5 || document.getelementbyid ("email").value.indexof("@")== -1) { alert("please enter email min 5 chars , include @ symbol"

entity framework - Returning fields from multiple entities from ASP.NET Web API v2 -

i building asp.net web api v2 project using entity framework v6 model database. far have been able return collection of objects when collection of 1 object type. i.e. <customer> or <order> . i return collection of objects include field (or property) related entity (an association present). think have linq entity query setup not sure how return resultant anonymous type jquery method calls api. [route("api/clients/getallclientswithpaymentmethod")] [httpget] public not-sure-what-return-type-should-be getallclientswithpaymentmethod() { using (var context = new myentities()) { context.configuration.proxycreationenabled = false; var query = client in context.clients select new { clientid = client.id, companyname = client.companyname, phone = client.phone, email = client.email paymentmethod = client.payments.paymentmethod

PROLOG:How to exclude an option -

Image
i have piece of code suggests animal other animals can coexist under circumstances: suggest(x) :- biganimal(x),biganimal(y),coexist(x,y),write(y),nl,fail. this loops until fail.my issue prints out variable x how can exclude output, thx in adcavance. suggest(x) :- biganimal(x), biganimal(y), x \== y, coexist(x,y), write(y), nl, fail.

arm - Dis-assembly of same binaries showing different instrucions -

Image
i using at91sam4e16e micro-controller in application , bootloader example asf(xdk-1.15.0) bootloader named starter_kit_bootloader_demo. now haev customized project sam4e-ek trying update binary using bootloader. after updating compared both binary files 1) updated and 2)standalone both binaries same when debug in iar disassembly shows instructions different. why different? i added debug information original .out file new bootloader project. both disassembly of similar binaries similar. interpreting binary of vector table nonsense instructions per notlikethat 's suggestion.

java - Adding/cumulating "line chart components" -

Image
i can imagine there algorithmic problem describes problem not find any. want is: let's say, have data structure object of type line contains 2 (or more, in case 2 enough) objects of type point(x, y). a line represents line in line chart 1 point a(x, y) point b(x, y). now have list of such lines. note, may overlap in x-coordinates. example have line (0, 0) (3, 1) , line (2, 0) (3, 2). want "cumulate" list of lines , have list of points result (to draw line chart later). for above example mean want {(0, 0); (2, 0,67); (3, 2)}. here beautiful image makes issue more clear: background: programming blood alcohol content level calculator. have several drinks attributes like: volume, percent, start time, end time. i want assume linear rise of blood alcohol content level start time end time minus alcohol reduction during time period. in thoughts, easy calculate single "lines" of each drinks, full line chart representing blood alcohol content level on w

python - How to streamline file moving script? -

i wrote clunky script move specific files located in 1 folder 3 different folders. 3 lists specify files should grouped , moved new folder. although script works, ugly , inefficient. how can improve on structure of script make file-moving process more elegant , streamlined? import os, shutil # location of input files os.chdir = r'c:\path\to\input_imagery' ws = os.chdir # lists of file sets need moved area1 = ["4111201_ne.tif", "4111201_nw.tif"] area2 = ["4111202_ne.tif", "4111202_nw.tif"] area3 = ["4111207_nw.tif", "4111301_ne.tif"] # output folders folder_area1 = r'c:\out\area1' folder_area2 = r'c:\out\area2' folder_area3 = r'c:\out\area3' area in area1: input1 = os.path.join(ws, area) output1 = os.path.join(folder_area1, area) shutil.move(input1, output1) area in area2: input1 = os.path.join(ws, area) output1 = os.path.join(folder_area2, area) shutil.move(

python - How do I keep the focus on the command prompt when calling pylab.show? -

i calling python script comandline (bash under ubuntu): > python myscript.py within script, create figure, show (nonblocking) pylab , wait user entry: import matplotlib mpl mpl.use('tkagg') import pylab pl fig = pylab.figure() # figure gets content here pl.show(block=false) inp = raw_input('please enter choice: ') # prompt window has no focus now problem is, figure window, poping up, has focus. want focus stay @ or return command line window interaction raw_input... any suggestions how achieve this? thanks in advance! some other lower level backends tend not it, try: import matplotlib mpl mpl.use('agg')

java - Garbage value in jtable after adding row dynamically -

Image
i have jtable has few columns.in have jcombobox . @ program start want them empty.i have 1 jbutton on click action of button have code add row dynamically in table. but after adding row garbage value in cell having jcombobox . shown in below figure : and here code : code add jcombobox in table // create columns names string columnnames[] = { "item", "sun item", "required quantity","price","gross amount" }; // create data final string datavalues[][] = { { "", "", "","","", }, }; tablemodel = new defaulttablemodel(datavalues, columnnames); // create new table instance table = new jtable( tablemodel ); updateitemcombo(); tablecolumn itemcolumn = table.getcolumnmodel().getcolumn(0); itemcolumn.setcelleditor(new defaultcelleditor(comboitem)); public void updateitemcombo(){ vector<string> s = new vector<string>(); try{

css - Build colour gradation into html -

this top row (banner) on website: #toprow {position: static;top:0px} i have found following code, believe enable me grade color dark blue light blue. despite many attempts, have yet find way build banner: #grad { background: -webkit-linear-gradient(rgb(0,102,255), rgb(153,204,255)); /* safari 5.1 6.0 */ background: -o-linear-gradient(rgb(0,102,255), rgb(153,204,255)); /* opera 11.1 12.0 */ background: -moz-linear-gradient(rgb(0,102,255), rgb(153,204,255)); /* firefox 3.6 15 */ background: linear-gradient(rgb(0,102,255), rgb(153,204,255)); /* standard syntax (must last) */ } using this tool , can achieve want. give cross browsers solution also. see below colour gradation given colorzilla: background: #0066ff; /* old browsers */ background: -moz-linear-gradient(top, #0066ff 0%, #99ccff 100%); /* ff3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0066ff), color- stop(100%,#99ccff)); /* chrome,safari4+ */ background: -webkit-li

scala - Simple destructuring extractor for command line args -

the preferred approach use similar commented out line below. def main(args: array[string]) { // val (dbpropsfile, tsvfile, dbtable) = args val dbpropsfile = args(0) val tsvfile = args(1) val dbtable = args(2) however having little quarrel compiler on it: error:(13, 9) constructor cannot instantiated expected type; found : (t1, t2, t3) required: array[string] val (dbpropsfile, tsvfile, dbtable) = args ^ so told should easy few points out there. use val array(dbpropsfile, tsvfile, dbtable) = args scala> val array(a,b,c) = array(1,2,3) a: int = 1 b: int = 2 c: int = 3 scala> res0: int = 1

Using PowerShell to import data properly into an array -

i trying put powershell script read data csv (it tab separated , not csv so, we'll use commas) , import data powershell multidimensional array. csv has following data: empid,name,dept 12345,john,service 56789,sarah,sales 98765,chris,director my script follows: $temp=gc "temp.csv" $array=@() $temp | foreach{ $elements=$_.split(",") $array+= ,@($elements[0],$elements[1],$elements[2]) } foreach($value in $array) { write-host "empid =" $value[0] "and name =" $value[1] "and dept =" $value[2] } the above works, able refer array elements more proper name because there lot more elements shown above , gets confusing. this, i’ve tried use hash tables, defining new objects, members, types, etc. never seem work properly. may wrong feel i’m running in circle , may lost. basically, want is, instead of using: write-host "empid =" $value[0] "and name =" $value[1] "and dept =" $value[2]

Facebook Graph Api Fan page photo upload (IOS) -

i have app uploaded photos on fly , i'm trying add ability upload users facebook fan page (that administer). the problem i'm having can sucessfully upload photo fan page it's not showing on fan page timeline, it's showing under "recent posts others" section of fan page. i'm not uploading these images properly. here's code: acaccounttype * accounttype = [_accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; [_accountstore requestaccesstoaccountswithtype:accounttype options:@{acfacebookappidkey: @"xxxxxxxxxxxx", acfacebookpermissionskey : @[@"photo_upload",@"publish_stream", @"publish_actions", @"manage_pages"], acfacebookaudiencekey : acfacebookaudienceeveryone} completion:^(bool granted, nserror *error) { if (granted) { nsarray * accounts = [_accountstore accountswithaccounttype:accounttype]; nsdictionary *fan

google analytics page titile can't have '+' or '&' characters -

when have '+' or '&' character in page title. words after '+'/'&' characters either truncated or '+'/'&' filtered page title. behavior seem random after experimenting few different combinations. length of title shouldn't issue because short of 40 characters. does google analytics have limitation or restriction on use of '+' , '&' characters in page title? thanks.

swift - Why create "Implicitly Unwrapped Optionals"? -

why create "implicitly unwrapped optional" vs creating regular variable or constant. if know can unwrapped why create optional in first place? example, why this: let somestring : string! = "this string" going more useful vs: let somestring : string = "this string" if “optional indicate constant or variable allowed have 'no value'” , “sometimes clear program’s structure optional have value after value first set” , point of making optional in first place? if know optional going have value... doesn't make it.... not optional? consider case of object may have nil properties while it's being constructed , configured, immutable , non-nil afterwards (nsimage treated way, though in case it's still useful mutate sometimes). implicitly unwrapped optionals clean code deal, relatively low loss of safety (as long 1 guarantee held, safe). (edit) clear though: regular optionals preferable.

android - downloadUrl returns null Stream -

i'm trying parse rss feed. it's returning null value. debugged & checked. in onpostexecute() - value of result null. here tried code: here rssfragment.java package com.example.samplerssfeed; import java.io.ioexception; import java.io.inputstream; import java.net.httpurlconnection; import java.net.url; import java.util.arraylist; import java.util.list; import org.xmlpull.v1.xmlpullparserexception; import android.os.asynctask; import android.os.bundle; import android.support.v4.app.fragment; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.listview; import android.widget.toast; public class rssfragment extends fragment { private listview mlistview; private static final string url = "https://news.google.com/?output=rss"; @override public vie

vb.net - Test while running two functions at the same time -

i running these 2 simple functions using background workers, (write test file) , (read text file) shouldn't give errors getting these exceptions a first chance exception of type 'system.io.ioexception' occurred in mscorlib.dll any idea how prevent that? option explicit on option strict on public class form1 dim istring string dim worker1 boolean = false dim worker2 boolean = false private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click timer1.enabled = true end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick try if worker1 = false worker1 = true backgroundworker1.runworkerasync() end if if worker2 = false worker2 = true backgroundworker2.runworkerasync() end if catch ex exception debug.print("timer1_tick erro