Posts

Showing posts from February, 2011

Postgresql function: get id of updated or inserted row -

i have function in postgresql database update row if exist or insert new 1 if doesn't exist: create or replace function insert_or_update(val1 integer, val2 integer) returns void $$ declare begin update my_table set col2 = val2 col1 = val1; if not found insert my_table (col2) values ( val2 ); end if; end; $$ language 'plpgsql'; for it's working perfect want id of row if updated or inserted. how can it? your function declared returns void can't return anything. assuming col1 primary key , defined serial, can this: create or replace function insert_or_update(val1 integer, val2 integer) returns int $$ declare l_id integer; begin l_id := val1; -- initialize local variable. update my_table set col2 = val2 col1 = val1; -- !! important: assumes col1 unique !! if not found insert my_table (col2) values ( val2 ) returning col1 -- makes generated value available l_id; ...

java - Corba Async call issue -

i have following requirements: implement simple pipelined job service (further pjs). client writes simple application form , put pjs. pjs consists of several individual processes handles application in sequential order: verifier responsible verification of application form format. might simple handling mechanism i.e. check matching user individual identity number (id) in database (you can use simple text file). acknowledger receives verified application form , assigns unique identificator (autoincrement id or uuid). hr receives application form acknowledger assigned unique number, put database , generate notification original sender (client) message receives application form. response have piggybacked unique number assigned acknowledger. there should no intermediaries involved in process of forwarding job between servers: i.e. each server should pass application directly next server. stay focus on system architecture , process of passing applications around. don’t imple...

Caching python web requests for offline use -

is there way "cache" requests make python "requests" module in way if go offline module still returns webpage if online? how can achieve this? found caching libraries cache webpage still have online... i think can use request_cache module available. please check http://requests-cache.readthedocs.org/en/latest/user_guide.html once cache using request_cache data available if disconnected.

ios - Do I need to ensure code signing happens on a bundle, within a Framework? -

i have built framework. framework contains bundle. bundle contains assets , xibs. the bundle target (for assets , xibs) has option 'code sign', set 'do not code sign'. what point of code signing bundle, , should doing it? thanks

javascript - How to distinct HTML select options with angularjs? -

i have html select tag, code : <div ng-controller="models"> <select ng-model="mymodel" ng-options="model.name model in models" class="form-control"></select> {{ {selected_model:mymodel.name} }} {{ {selected_model:mymodel.id} }} </div> and want show mymodel.id==1 . how can ? i think question needs bit more of explanation. do mean want display select each model in models if model.id ==1? you can filter, while models being written page in select box filter checks if have .id == 1 , if true allows written select. i imagine means you'll have 1 item in select box duplicate id's in objects bad news bears. angular.module('yourappname', []) .filter('mymodelfilter', function() { return function(mymodel) { if (mymodel.id == 1) { return mymodel; } }; }) <div ng-controller="models"> <select ng-model="mymodel" ng-opti...

python - multilabel classification with OneVsOneClassifier -

is possible 1 multilabel classification onevsoneclassifier? i made classification of onevsrestclassifier follows: lb = preprocessing.multilabelbinarizer() y = lb.fit_transform(y_train) classifier = pipeline([ ('vectorizer',countvectorizer()), ('tfidf',tfidftransformer()), ('clf',onevsrestclassifier(svc(kernel='linear')))]) classifier.fit(x_train,y) predicted = classifier.predict(x_test) all_label = lb.inverse_transform(predicted) print all_label but use onevsoneclassifier returns error indicating excessive number of labels.

sql - Avoid errors when attempting to convert to datetime -

is there way in sql ignore records conversion failed. setting default value work. > select convert(datetime, foo_str) > foo_tbl ------------------------ aug 23 2013 00:00:00.000 aug 17 2013 00:00:00.000 may 06 2015 00:00:00.000 aug 13 2013 00:00:00.000 aug 09 2013 00:00:00.000 sep 05 2007 00:00:00.000 may 06 2015 00:00:00.000 may 06 2015 00:00:00.000 feb 24 2009 00:00:00.000 may 06 2015 00:00:00.000 mar 29 2013 00:00:00.000 may 06 2015 00:00:00.000 jul 24 2010 00:00:00.000 may 06 2015 00:00:00.000 may 06 2015 00:00:00.000 may 03 2015 00:00:00.000 msg 249, level 16, state 1 , line 1 syntax error during explicit conversion of varchar value '10101' datetime field. can error avoided select statements comes completion? something below code should work on sybase select convert(datetime, foo_str) foo_tbl foo_str '[a-z][a-z][a-z] [0-1][0-9] [0-2][0-9][0-9][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9][0-9][0-9]' if 00:00:00.000...

PHP: Counter using Session Variables -

i need som adding value session variable using submit buttons. if define variables 0 won't count up, , if don't says: "notice: undefined index: paperbagcount in /home/saxon/students/20151/chwi15/www/affar3/test.php on line 52" "notice: undefined index: plasticbagcount in /home/saxon/students/20151/chwi15/www/affar3/test.php on line 59" <?php if(!session_status() === php_session_active ) { session_start(); $_session["paperbagcount"] = 0; $_session["plasticbagcount"] = 0; } session_start(); error_reporting(-1); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>startsida</title> </head> <body> <?php if(isset($_post['addpaper'])) { $_session["paperbagcount"]+=1; } if(isset($_post['deletepaper'])) { if ($_session["paperbagcount"] == 0) { $_session["pap...

jquery - Jsf commandbutton call javascript function then refreshing the whole page -

i have jsf page , commandbutton inside form. <h:form> ... <h:commandbutton action="#{mainviewcontroller.showrelatedpayments()}" id="openpay" onclick="openmodal();" value="tst"></h:commandbutton> ... </h:form> at same jsf page have modal div.. <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="mymodallabel">modal titles</h4...

Python: import a file from another directory -

i working in set of directories following structure: master/ subfolder_1/file_1_1.py file_1_2.txt subfolder_2/file_2_1.py i import file_1_1 in file_2_1 follows: import sys sys.path.append('../file_1_1') file_1_1 reading file_1_2.txt in same directory. however, when call function reads file_1_2.txt file_2_1.py, says no such file , directory , gives me path of file_1_2.txt as: master/subfolder_2/file_1_2.txt which wrong path. seems python in case using working directory reference. how can solve error given don't want include absolute path each file read. don't mess sys.path , , don't think of imports working against files , directories. has live in file somewhere, module hierarchy little more subtle "replace dot slash , stick .py @ end". you want in master , run python -m subfolder_1.file_1_1 . can use pkg_resources text file: pkg_resources.resource_string('subfolder_1', 'file_1_1.txt...

'in' operator in JavaScript. String comparison -

this question has answer here: how check whether string contains substring in javascript? 48 answers hi i'm new in javascript , find basic problem: when use piece of code in python: 'a' in 'aaa' i true when same in javascript error: typeerror: cannot use 'in' operator search 'a' in aaa how similar result in python? i think 1 way use string.indexof() 'aaa' .indexof('a') > -1 in javascript in operator used check whether object has property

sql server - how to avoid duplicating value with all fields in sql query -

i have query this: select * v_receipt f_exhibition='11000' order f_exhibitor_name when executed duplicate values, how can resolve this. you need use distinct have explicitly define each field select distinct field1, field2, field3 /* etc etc */ v_receipt f_exhibition = '11000' order f_exhibitor_name desc

elasticsearch - elastic search aggregation on more than one field -

i new elastic search , want implement specific use case on it. want have multi field sum aggregation. try explain on example: have following objects inserted es index: {"a":"aval", "b":"bval", "c":"cval", "aggcount":100} where a,b , strings , aggcount int. let's assume have following records indexed: {"a":"aa", "b":"bb", "c":"cc", "aggcount":10} {"a":"aa", "b":"bb", "c":"cc", "aggcount":11} {"a":"aa", "b":"b", "c":"c", "aggcount":1} {"a":"a", "b":"bb", "c":"cc", "aggcount":12} {"a":"a", "b":"bb", "c":"cc", "aggcount":5} now group records fields a,b , c , sum...

How to use syncfusion report viewer in asp.net webform? -

i using <ej:reportviewer clientidmode="static" id="reportviewer2" runat="server" reportpath="~/dms_metadatareport.rdlc" processingmode="local"> </ej:reportviewer> but ej coming unrecognized server tag. see below link started syncfusion asp.net reportviewer . create first asp.net control: http://help.syncfusion.com/ug/js/index.html#!documents/createmanually1.htm create first reportviewer: http://help.syncfusion.com/ug/js/index.html#!documents/createyourfirstreportviewerinaspnet.htm demo: http://asp.syncfusion.com/demos/web/reportviewer/defaultfunctionalities.aspx class reference: http://help.syncfusion.com/ug/js_cr/ejreportviewer.html from error posted looks syncfusion.ej.web.dll not added properly, please refer above links add dependent dll , script/css files use report viewer.

jquery - How can I lock Html table header row and first column by JavaScript -

i want lock html table header row , first column , example click here ! but have 2 problem 1.i want right scrollbar , bottom scrollbar on top,don't cover 2. when zoom in or zoom out , columns moves ..... please me , everyone! for header row section , first column add css code: position: fixed; it simple really. not sure meant zoom in , zoom out.

c# - Changing the language shown in Route Directions on Windows Phone 8.1 -

i've used below code in previous project, in new project i'm working on, seeing unexpected behaviour. in new project, instead of showing routes in language, routes appear in english. geolocator gl = new geolocator(); geoposition geoposition = await gl.getgeopositionasync(); basicgeoposition startlocation = new basicgeoposition(); startlocation.latitude = geoposition.coordinate.latitude; startlocation.longitude = geoposition.coordinate.longitude; geopoint startpoint = new geopoint(startlocation); basicgeoposition endlocation = new basicgeoposition(); endlocation.latitude = -8.1625026; endlocation.longitude = -34.91712034; geopoint endpoint = new geopoint(endlocation); maproutefinderresult routeresult = await maproutefinder.getdrivingrouteasync( startpoint, endpoint, maprouteoptimization.time, maprouterestrictions.none); ...

javascript - How to Change the Width of the Column in dynamical approach -

i have default width value column in table. want user able change width of column using cursor , dragging header (like how in ms excel). i use jquery , bootstrap. how do it? code: table{ border: 1px solid black; } th, td { border: 1px solid black; } <table> <tr> <th>header 1</th> <th>header 2</th> </tr> <tr> <td>data </td> <td>data 2</td> </tr> <tr> <td>data asdfassdfasdf</td> <td>data 2</td> </tr> <tr> <td>data asdfasdfasdfasdfasdf</td> <td>data 2 sdf sdfsdf</td> </tr> </table> you mean should resizable? if can suggest use jquery ui since use jquery. https://jqueryui.com/resizable/ hope :d

c# lambda reading each row with GROUP BY and SUM -

this working query using in management studio. select top 5 productcode, sum(productsales) sales sellinglog (salesyear = '2014') group productcode order sales desc i want convert query above lambda, can't seems make works. lambda still lacks of order , select productcode var topproducts = sellinglog .where(s => s.salesyear == 2014) .groupby(u => u.productcode) .select(b => b.sum(u => u.productsales)).take(5) .tolist(); foreach(var v in topproduct) { //reading 'productcode' , 'sales' each row } var topproducts = sellinglog .where(s => s.salesyear == 2014) .groupby(u => u.productcode) .select(g => new { productcode = g.key, sales = g.sum(u => u.productsales) }) .orderbydescending(x => x.productcode) .take(5) .tolist();

ios - Adding items to a NSMutableArray - Logic issue -

i have 5 animal objects , trying save in nsmutabledictionary . however, according code below, last animal gets saved in nsmutabledictionary . i don't think looping correctly. for(int = 0; < animalcount; i++) { [allcontacts setobject:name forkey:@"name"]; [allcontacts setobject:age forkey:@"age"]; [allcontacts setobject:gender forkey:@"gender"]; } the output of above displays follows: (only last animal object gets displayed) { name = fish; age = 6; gender = "female"; } how want that, 5 animal objects saved in nsmutabledictionary can display them in uitableview . { name = "cow"; age = 4; gender = "male"; }, { name = "dog"; age = 15; gender = "male"; }, { name = "fish"; age = 6;...

sql - How to get the distinct of multiple fields in MySQL? -

i know there're several existing questions one, mine little bit complicated (for me). for example, have index, data, log , flag these 4 tables. index: id program compiler flag_id data_id data: id machine runtime date index_id log: index_id data_id log flag: id flag_name the flag_id, data_id , index_id indicate corresponding table's main id. main id auto incremental , unique in index , data tables. flag table's id duplicated. example, program may use different flags compile: index: 123 jacobi gcc 11 345 data: 345 host1 3:21 2015-05-13 22:56:12 123 log: 123 345 "pass" flag: 11 "-g" 11 "-mp" 11 "-static" so program compiled like: gcc -g -mp -static jacobi.c and execution time 3'21'' , finished 2015-05-13 22:56:12. the thing is, many people may run p...

python - How to get only logged in user events using django-scheduler package -

i using django-scheduler own calendar , create events. while creating new events getting stored creator logged in. but when displaying events in calendar giving users events want preview logged in user events. there settings in documentation check_event_perm_func , check_calendar_perm_func not satisfying requirement. i practiced packages swingtime, django-calendarium , django-happenings. these not satisfying requirement. if package not suitable achieve this, can 1 suggest me package best or other alternative. please..thanks in advance.

php - How to access a variable defined out side into inside a class function -

my code $var = md5(rand(1,6)); class session{ protected $git; public function __construct($config = array()) { //// code } public function _start_session() { //code again.. } } i want use " $var " value inside class functions globally. please update me how this. you use dependency injection. pass required variables constructor $var = md5(rand(1,6)); $session = new session($var); $session->_start_session(); class session{ public function __construct($var, $config = array()) { $this->var = $var; } public function _start_session() { echo $this->var; //code again.. } }

jsp - Taglib to display java.time.LocalDate formatted -

i display formatted java.time.localdate in jsp. know taglib use this? for java.util.date using <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> . similar java.time.localdate exist? afsun's hints inspired me create quick solution. under /web-inf create directory tags . create tag file localdate.tag inside tags directory. put bellow code tag file: <%@ tag body-content="empty" pageencoding="utf-8" trimdirectivewhitespaces="true" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ attribute name="date" required="true" type="java.time.localdate" %> <%@ attribute name="pattern" required="false" type="java.lang.string" %> <c:if test="${empty pattern}"> <c:...

dajax - Django server in one computer, client in other computer -

i downloaded latest django-dajaxice zip file github unzip it. then enter django-dajaxice-master/examples folder, run 'python manage.py runserver 13.122.241.172:80', (which computer's ip). the server started normally. in server computer, can visit http13.122.241.172/ , page displays normally. click 'hello' button, can right response. problem: in collegue's computer, ip 13.122.242.16, can visit http13.122.241.172/ , but, when click 'hello' button, there no response! debugging: then check command window, see when click button, server never receive " get /dajaxice/simple.hello/?argv=undefined http/1.1 " request! confused problem , have been working on 3 days. me? note: django version 1.4.20 . django settings: debug=true. my colleague can visit http://www.dajaxproject.com/dajaxice/ , if click 'get message server!' can server response. code: this relevant code dajaxice project : index.html (template) {% l...

Get HTML Content without comment lines using jquery -

look @ following code. html: <div> <p>sdfsdfsfsf</p> <!--<p>testing</p>--> </div> jquery $(document).ready(function(){ alert($("div").html()); }); output <p>sdfsdfsfsf</p> <!--<p>testing</p>--> as know give output above only. question is, there anyway can output without commented lines? you can create clone , remove comments nodes it(if don't want modify original dom) $(document).ready(function () { var $clone = $("div").clone(); $clone.contents().contents().addback().filter(function () { return this.nodetype == node.comment_node; }).remove(); console.log($clone.html()); }); demo: fiddle

Why conditional operator not work in java switch case? -

this question has answer here: use relational operators in switch 7 answers i following code int cnt=1; switch(cnt){ case (cnt<=10): system.out.println("less 10"); break; case (cnt<=20): system.out.println("less 20"); break; case (cnt<=30): system.out.println("less 30"); break; } there questions available problem. didn't got proper answer or answer not fulfill needs. got answers problem use multiple if else statements. want know why operators not work in java switch case? that's not how switch/case statements work - in java or in various similar languages (c, c++, c#). it's not point of them. switch/case statements aren't sequence of conditions - they're sequence of constant values (with associated code), along single expression evaluated, , code...

java - Sorting Objects in ArrayList giving unexpected results -

here record arraylist of objects of type employee. trying sort arraylist based on employeename attribute. unfortunately, gives unwanted results. public void sortbyname(){ for(int = 0; < salesdatamanager.n; i++){ for(int j = i+1; j < salesdatamanager.n; j++){ if(record.get(i).getemployeename().comparetoignorecase(record.get(j).getemployeename()) > 0){ employee etemp = record.get(i); record.add(i,record.get(j)); record.add(j,etemp); } } } displayallrecords(); } i have gone through other posts in stackoverflow regarding topic , found out of post suggest same way.am doing wrong here? thanks in advance! you iterating record list , according condition determining add current element. however, aren't emptying list first, approach inevitably lead duplicati...

ios - Application doesn't appear on Application Loader -

i have app prerelease in testflight, have 3 builds in it. have new update prerelease. whenever go application loader, can't find app. gives me other apps made, app wanted update won't appear. turned-off testflight prerelease, still can't find app

javascript - How to make a HTML5 canvas fit dynamic parent/flex box container -

Image
is there way can create canvas inside dynamic re-sizing flex-box container? preferably css solution think javascript required redraw? i think 1 solution listen re-sizing event , scale canvas meet size of flex box parent force redraw preferably use css possible or more clean/less code solution. the current approach css based canvas re-sized according parent flex box element. graphics blurred, re positioned , overflowed canvas in below screenshot. css: html,body{ margin:0; width:100%; height:100%; } body{ display:flex; flex-direction:column; } header{ width:100%; height:40px; background-color:red; } main{ display:flex; flex: 1 1 auto; border: 1px solid blue; width:80vw; } canvas{ flex: 1 1 auto; background-color:black; } html: <header...

javascript output in automator -

i trying create service in automator writes out formatted date string. have written javascript job, cannot figure out output string script. have tried log, console.log, this.console.log, write, , few other commands have found out there. not experienced @ javascript @ all; put piecemeal on couple of hours. here code have: objc.import('cocoa'); rightnow = $.nsdate.date; dtformatter = $.nsdateformatter.alloc.init; dtformatter.datestyle = $.nsdateformatterfullstyle; dtformatter.timestyle = $.nsdateformattermediumstyle; formatteddate = dtformatter.stringfromdate(rightnow); i under impression reading final line of code provide output, not seem case inside of run javascript action in automator. when code run in script editor, console displays formatted date expected. thank counsel. it turns out variable formatteddate needs "unwrapped" objective-c packaging: answered @ macscripter the final code therefore: objc.import('cocoa'); rightnow...

<bound method PolyCollection.get_paths of <matplotlib.collections.PolyCollection object -

is there way @ paths matplotlib1.3.0? i using hexbin , create following output: "hex31mm", a: in [42]: type(hex31mm) out[42]: matplotlib.collections.polycollection my aim use method "get_paths" in "matplotlib 1.1.0" function linked below newer version of "matplotlib 3.0.1" interestingly: "get_paths" under matplotlib 3.0.1, yields "802" distinct paths below: in [41]: len(hex31mm.get_paths()) out[41]: 802 yet "get_paths" under matplotlib 1.3.0, same object "hex31mm" yields 1 path below: in[1] len(hex31mm.get_paths()) out[1]: 1 please check link below more details, appreciated! note: i sure information paths part of object in both cases because hexbin figure plots onto screen same under both matplotlib versions, require hexbin centres, hence insistance of use on "get_path" method linked function. sorry sound repetitive function works fine in matplotlib1.1.0 not under matplotli...

java - Check if character `'a'` is separated from `'b'` by three places -

folks. i'm doing every problem on codebyte.com (i suggest website wants practice coding skills :)) , got stuck @ problem: return true if characters a , b separated ``3 places anywhere in string @ least once; else return false . examples: input = "after badly" output = "false" input = "laura sobs" output = "true" my code giving me false every time write string when in cases should return true . smb please take look? public static void main(string[] args) { scanner kbd = new scanner(system.in); system.out.println("please enter string: "); string mystring = kbd.nextline(); char[] myarray = mystring.tochararray(); boolean result = false; for(int = 0; < myarray.length; i++) { if(myarray[i] == 'a' && myarray[i+4] == 'b') result = true; else resu...

bash - Unix How to check if a specific word is entered in as an argument -

i'm writing script in unix need way check argument entered in command line specific word. so if when using script user types: $ ./script hello my script can tell "hello" entered argument , can display message appropriately. and if user types other "hello" argument script can display message. thanks. this should work: #!/bin/bash if [[ $1 == hello ]];then echo "hello entered" else echo "hello wasn't entered" fi

Retrieving Payment Gateway from Transaction API of Shopify -

we have web hook being enabled on "order creation" event. json response used receive earlier gave parameter "gateway" holding information payment gateway being chosen customer. orders being created last friday 24th april 2015, not getting parameter, instead getting parameter "financial status" value "pending". need payment gateway method ex. "paypal", "cod", "bank transfer", display on on invoice being printed. suggestion shopify team says "gateway" field deprecated in "order creation" , should use following link fetch it. https://spskids.myshopify.com/admin/orders/315026241/transactions.json we created webhook payment gateway on "order payment" event , trying call 3rdy party website. but issue want call third party website, when gives error of unauthorized access. please suggest how fetch payment gateway. gateway parameter has been moved transactions. and, transaction...

PHP redirect form to URL not working -

so i'm trying use http://www.formget.com/how-to-redirect-a-url-php-form/ rsvp form. ideally, entering right code on ( http://baby.engquist.com/invite/ ) lead google form. however, when enter code (right or wrong) , press button, refreshes /invite page. my code follows: <p style="text-align: center;"> <form action="index.php" id="#form" method="post" name="#form"> <div class="row"> <div class="large-3 columns large-centered"> <div class="row collapse"> <div class="small-10 columns"> <input id="code" name="code" placeholder="enter code rsvp." type="text" > </div> <div class="small-2 columns"> <input id='btn' name="submit" type='submit' class="button prefix" value='go...

c# - How can I create a footer for cell in datagridview -

Image
i need create datagridview cells have 2 parts. 1 part content of cell such 0, 1 etc value. , remain part footer of cell, footer of word document, refers ordinal number of cell. i can not enclose images question may ambiguous. anyways in advance. to create datagridview cells content need code cellpainting event. first set cells have enough room content , layout normal content wish..: datagridview dgv = datagridview1; // quick reference font fatfont = new font("arial black", 22f); dgv .defaultcellstyle.font = fatfont; dgv .rowtemplate.height = 70; dgv .defaultcellstyle.alignment = datagridviewcontentalignment.topcenter; next fill in content; add content cells' tags . more complicated things more fonts etc, want create class or stucture hold it, maybe in tags .. dgv.rows.clear(); dgv.rows.add(3); dgv[1, 0].value = "na"; dgv[1, 0].tag = "natrium"; dgv[1, 1].value = "fe"; dgv[1, 1].tag = "ferrum"; dgv[1, 2...

javascript - Radio button value not inserting into database -

i have problem radio button value doesn't inserted database. i'm using ajax in php file request values , 1 of them radio button selected. in external javascript file, variable "gender" assigned correctly according selected radio button. however, query executed in php file not insert radio button's value database @ all. rest of values inserted except radio button appears blank once table displayed. note: i'm not using form. these codes php file: . . other codes . . function insertrow($name, $address, $phone, $gender, $nation){ $table_info = "info"; $query_string = "insert $table_info(name, address, phone, gender, nation) values('$name', '$address', '$phone', '$gender', '$nation');"; $result = @mysql_query($query_string) or die (...

python - Error when replacing documentation on PyPi -

i have pypi project , i'm trying re-upload documentation pythonhosted using zipfile. i'm trying accomplish through pypi web interface of project ( https://pypi.python.org/pypi?name=rabacus&version=0.9.0&:action=display ). when attempt upload file following error, error processing form error unpacking zipfile:cannot create directory, there's file of name: rabacus/_images any ideas on how can clear old documentation or alter zip of html files such pypi accept it? edit: i've removed project see if can create scratch ... see comment below. edit: didn't work 20 minute wait after deleting project , re-uploading both project , docs.

sql - MySQL Subquery / Query Issue -

i'm having mental block query, i'm trying return max date , maximum time , order of identity. appreciate if can add pair of eyes type of query : data set identity, date, time, website 10, 5/10/15, 1, google.com 10, 5/10/15, 3, google.com 10, 5/10/15, 10, google.com 25, 5/11/15, 1, yahoo.com 25, 5/11/15, 15, yahoo.com expected result 10, 5/10/15, 10, google.com 25, 5/11/15, 15, yahoo.com current query select distinct *, max(datetime) maxdate, max(time), identity identity_track group identity order maxdate desc something this? select identity, max(date), max(time), website identity_track group website; demo here: http://sqlfiddle.com/#!9/5cadf/1 you can order of fields want. also, expected output posted doesn't line seems you're attempting do. edit updated query based on additional information. select t.identity, t.date, max(t.time), t.website t inner join (select identity, website, max(date) d t ...

Android comparing strings with == to each objects -

i'm coming c#, typically try relate i'm doing. i cannot figure out why below statement doesn't work. string val = "admin". have if statement, if statement false. i'm sure it's simple. thanks! edittext edt = (edittext) findviewbyid(r.id.email); //string val = edt.gettext().tostring(); string val = "admin"; edittext edt2 = (edittext) findviewbyid(r.id.password); string val2 = edt2.gettext().tostring(); if(val.tostring() == "admin") { string hero = val; } you should use if (val.equals("admin")) { string hero = val; } instead of using equal sign. using equal sign in java asking if they're same object, false if strings same. also, careful you're doing inside of if statement, because variable "hero" won't accessible outside of block.

Allowing all users to create a repo in TFS-GIT -

i have set tfs project in vso using git source control. there way can give members of project ability create git repository? way see make administrator, don't want them able manage members , other settings... create new repos. they must administrator @ version control level, no need team nor project administrators. let me explain did team of mine. i created git admins tfs group ( yourprojecturl /_admin/_security page i.e. security tab) then in version control tab (i.e. yourprojecturl /_admin/_versioncontrol page) root node selected, add git admins tfs group give git admins tfs group allow administer avoid giving rewrite , destroy history (force push) permission except project or better server administrator dangerous

javascript - Django include html without parsing template tags -

i'm creating django based web app server-side rendered. there few pages re-render using javascript feed. i prefer use dry approach , re-use existing django templates, include them onto page inside tags. then can use template library of choice (there many support django templates) jinjajs https://github.com/ericclemmons/jinja.js jinjajs ii https://github.com/sstur/jinja-js swig http://paularmstrong.github.io/swig/ plate https://github.com/chrisdickinson/plate twigjs https://github.com/justjohn/twig.js however i'm stuck on simplest thing, include template without parsing! here attempted approaches don't work expected output <ul> <li>john doe</a></li> <li>sally taylor</a></li> <li>david smith</a></li> </ul> <script type="text/template"> <ul> {% person in people %} <li>{{ person.name }}</a></li> {% endfor %} </ul...

button collapse to the right in Bootstrap -

Image
i trying implement navigation bar can collapse right. i've seen few examples collapses horizontally not want. have attached basic mock below. idea appreciated. going example picture looks might have these placed somewhere in page rather @ top of page. so may if consider using popover. place nav button , have popover come ever side need to. take @ this example in bootstrap here. does help?

mysql - How can I prevent SQL injection in PHP? -

if user input inserted without modification sql query, application becomes vulnerable sql injection , in following example: $unsafe_variable = $_post['user_input']; mysql_query("insert `table` (`column`) values ('$unsafe_variable')"); that's because user can input value'); drop table table;-- , , query becomes: insert `table` (`column`) values('value'); drop table table;--') what can done prevent happening? use prepared statements , parameterized queries. these sql statements sent , parsed database server separately parameters. way impossible attacker inject malicious sql. you have 2 options achieve this: using pdo (for supported database driver): $stmt = $pdo->prepare('select * employees name = :name'); $stmt->execute(array('name' => $name)); foreach ($stmt $row) { // $row } using mysqli (for mysql): $stmt = $dbconnection->prepare('select * employees name = ?'); ...

c# - Can't add strings to listbox -

hi i'm trying collect output of this library listbox. here's part of code test project, i've tried modify: public partial class form1 : form { d.net.clipboard.clipboardmanager manager; public form1() { initializecomponent(); manager = new d.net.clipboard.clipboardmanager(this); manager.type = d.net.clipboard.clipboardmanager.checktype.text; manager.onnewtextfound += (sender, eventarg) => { button1.text = eventarg; //just testing, working correctly listbox1.items.add(eventarg); //does not show neither result nor error messagebox.show(string.format("new text found in clipboard : {0}", eventarg)); }; } private void button1_click(object sender, eventargs e) { listbox1.items.add("test"); //working correctly } } problem when trying add item list nothing, , further lines of code (in function) don...

regex - Java split method -

i trying split inputted number such (123) 456-7890. string [] split = s.split(delimiters); i have been searching web ways of delimiting area code inside set of parentheses haven't found works case. not know if array messing printing either. array not required did not know else since required use split method. import java.util.regex.matcher; import java.util.regex.pattern; public class helloworld{ public static void main(string[] args){ string phonenumber = "(123)-456-7890"; string pattern = "\\((\\d+)\\)-(\\d+)-(\\d+)"; pattern p = pattern.compile(pattern); matcher m = p.matcher(phonenumber); if (m.find()) system.out.println(m.group(1) + " " + m.group(2) + " " + m.group(3)); } } you can try here .

linux - Bash run rsh on multiple servers -

i have server list file this: xxx servername1 xxx xxx servername2 xxx ... now want go each server rename file local. bash scripts this: #!/bin/bash while read line server=`echo $line | awk '{print $2}'` # server name rsh $server mv /a/b/c.txt /a/b/d.txt # rename on server echo "rename file in $server" # print echo done < server.txt however, goes first 1 "severname1", rename file , print echo. never goes rest of servers , doesn't print echo. don't know why works first one. does give me help? don't let rsh eat rest of input stream -- if does, there's nothing left read while read next time loop tries start. easiest way redirect stdin /dev/null : rsh "$server" mv /a/b/c.txt /a/b/d.txt </dev/null alternately, can loop on fd other 0 (note using awk here silly; can tell bash pick out second field each line, in code below): while read -u 3 _ server _; # server name (w...

angularjs - automatic class binding of es6 spread operator to constructor -

i'm working angular, jspm, , es6. i'm working base class inject dependencies onto constructor , automatically register on 'this'. this pattern exists in react when extend base component class. found guy's little shortcut method here: http://www.newmediacampaigns.com/blog/refactoring-react-components-to-es6-classes i looking way angular, using es6 classes bind injected dependencies constructor's "this". class baseclass { constructor(...injections) { this._bind(injections) } _bind(injections) { injections.foreach( (injection) => { this[injection.name] = injection; }); } } class diclass extends baseclass { constructor($q, someangularfactory) { super($q, someangularfactory); } } this doesn't work (injection.name not thing, know)... does. question how "name" of injected function or object. in example, _bind function gives raw object or function... d...

haskell - Generate a list of unique combinations from a list -

i want generate list of unique ways choose 2 list of numbers in haskell. list [1,2,3] [[1,2],[2,3],[1,3]] . order not important want avoid producing both [1,2] , [2,1] example. my current solution is: pairs :: ord => [a] -> [[a]] pairs x = nub $ map sort $ map (take 2) (permutations x) this isn't particularly nice solution , has serious performance issues. there simple , efficient solution problem? pairs xs = [[x1, x2] | (x1:xs1) <- tails xs, x2 <- xs1] ...assuming list starts out unique, or compose nub otherwise.

c - Please help me find error - program which shows prime numbers -

i learning c , me find error in program? retyped code book , still don't know mistake. tried use https://www.diffchecker.com/diff don't see logical difference. give up. me? my code: //ex7_9.c #include <stdio.h> #include <stdbool.h> int main(void){ int num; int limit; int div; bool isprime; printf("please insert number: "); while((scanf("%d", &limit) == 1) && limit > 0){ if(limit > 1) printf("here prime numbers %d limit\n", limit); else printf("change limit - bigger one\n"); for(num=2; num <= limit; num++){ for(div=2, isprime=true; (div*div) <=num; div++){ if(num % div ==0) isprime = false; if(isprime) printf("%d prime \n",num); } } } return 0; } proper code: //ex7_9.c #include <stdio.h...

redirect - header() not working in php when the url contains parameters? -

so i'm using $_get capture url use later when use $_get wont redirect! here's sample code: url : http://localhost/project/active.php/?s=ieugfshd&h=qwuyrbcq&i=1 php code: <?php include 'init.php'; $s = trim($_get['s']); $h = trim($_get['h']); $i = trim($_get['i']); $q = key_check($s,$h,$i); if($q == 1) { header("location:password_active.php"); exit; } if($q == 0) { header("location:login_failed.php"); exit; } ?> edit: key_check( ) function function key_check($k1,$k2,$id) { $query = mysql_query("select key1 users user_id = '$id'"); $key1 =mysql_result($query,0); $query = mysql_query("select key2 users user_id = '$id'"); $key2 =mysql_result($query,0); $y=strcmp($k1,$key1); $z=strcmp($k2,$key2); if($y || $z == 0) { return 1; } else { return 0; } } now when try this, got "1" i'm getting this web page has redirect loop but password_active.ph...

multithreading - Java GUI with Swing, MVC and Ssh threads -

i want code application in java following: connect remote devices through ssh or using ftdi chips (so i'll have thread each ssh connection, , thread each ftdi connection) execute test sequences , output result (either pass or fail): want able create new test sequences different types of devices ultimately goal store results in database there gui using swing i want structure code in way permit great modularity. i've looked @ mvc pattern not sure how apply situation. initially wanted give input , output stream each device instance, give either ssh io or ftdi io. currently app running in console here current attempt structure code (which not satisfactory obviously) main.java package testlib; import java.io.ioexception; import java.util.*; import jd2xx.jd2xx; import jd2xx.jd2xxevent; import jd2xx.jd2xxeventlistener; import jd2xx.jd2xxinputstream; import jd2xx.jd2xxoutputstream; public class main{ public static void main(string[] args) { //ftdiwr...