Posts

Showing posts from March, 2014

Is it possible to define a function with more than one set amount of parameters in Python? -

this question has answer here: is there way pass optional parameters function? 5 answers i define function takes 2 arguments, possibility of third. i'm isn't possible, considering built-in range function has: range(stop) -> range object range(start, stop[, step]) -> range object maybe it's possible? or maybe have wrong idea because range immutable sequence type? for clarity's sake, same function example(x,y) run example(x,y,z) def example(x, y, z=none): if z none: return x + y else: return x + y + z then >>> example(3, 4) 7 >>> example(3, 4, 5) 12

r - Index values from a matrix using row, col indicies -

this simple solve. have 2d matrix mat 500 rows × 335 columns, , data.frame dat 120425 rows. data.frame dat has 2 columns i , j , integers index row, column mat . add values mat rows of dat . here conceptual fail: > dat$matval <- mat[dat$i, dat$j] error: cannot allocate vector of length 1617278737 (i using r 2.13.1 on win32). digging bit deeper, see i'm misusing matrix indexing, appears i'm getting sub-matrix of mat , , not single-dimension array of values expected, i.e.: > str(mat[dat$i[1:100], dat$j[1:100]]) int [1:100, 1:100] 20 1 1 1 20 1 1 1 1 1 ... i expecting int [1:100] 20 1 1 1 20 1 1 1 1 1 ... . correct way index 2d matrix using indices of row, column values? almost. needs offered "[" 2 column matrix: dat$matval <- mat[ cbind(dat$i, dat$j) ] # should it. there caveat: although works dataframes, first coerced matrix-class , if non-numeric, entire matrix becomes "lowest denominator" class.

java - Read data from multiple text files -

i have text files in folder. contains letters , numbers. example 1 of tex file contains: db: localhost data created: 2016-01-18 user: root pass: usbw so want scan files in folder. , print info inside every text file screen. far trying use code: class filehandle { int i; string a; string b; public void openfile() throws filenotfoundexception { file dir = new file("c:/folder/db"); if (dir.isdirectory()) { (file file : dir.listfiles()) { scanner s = new scanner(file); string f = file.getname(); system.out.println("file name:" + f); while (s.hasnext()) { if (s.hasnextint()) { = s.nextint(); system.out.println("int: " + i); } = s.next(); b = s.next(); system.out.printf("%s", a);

c++ - How to set an application icon in Qt -

i have trouble trying set icon qt application. the icon named "room.ico" , on same directory source file. here code : #include <qapplication> #include <qwidget> int main( int argc, char *argv[ ] ) { qapplication app( argc, argv) ; qwidget fenetre; fenetre.setwindowicon(qicon("room.ico")); // nothing happens fenetre.setwindowtitle("heloo"); fenetre.show(); return app.exec() ; } i have tried add win32:rc_icons += room.ico in .pro file didn't work. have tried "./room.ico" still no icon. i have tried use : qpixmap pixmap = qpixmap ("room.ico"); fenetre.setwindowicon(qicon(pixmap)); and guess !!! didn't work ... i'm newbie qt :p any suggestions appreciated , thanks qt's documentation qwindow::setwindowicon should need. make icon file (you appear have done already: room.ico add icon file qt resource file ( .qrc or .rc ) should add project (the documentat

Android Wear: Unable to connect to GmsClient com.google.android.gms.LIGHTWEIGHT_INDEX -

i working data layer on android wear, trying send dataitem (using data api) wearable (moto 360 gen1) mobile devices. however, there no sign of error or connection failed, , data not sent. message error received is e/gms client: unable connect service: com.google.android.gms.icing.lightweight index service' in mobile: i have created wearable listener service receive data in ondatachanged(dataeventbuffer dataevents) android manifest <service android:name=".listenerservice"> <intent-filter> <action android:name="com.google.android.gms.wearable.bind_listener" /> </intent-filter> </service> in wear activity: header of activity looks like public class mainactivity extends wearableactivity implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener{ i have googleapiclient in oncreate(..) function: mgoogleapiclient = new googleapiclient.builder(thi

php - Laravel form action parameter -

i'm trying call controller method form object, increment given item. the problem when adding parameter, form action add question mark, instead of slash. <form method="post" action="http://localhost/admin/pages?1"> how define parameter? {!! form::open([ 'action'=>['admin\\pagescontroller@increment', $item->id], 'style' => 'display:inline' ]) !!} {!! form::submit('move up', ['class' => 'btn btn-danger btn-xs']) !!} {!! form::close() !!} in code sample, sending item id http parameter. can access item id in controller giving name parameter follows. {!! form::open([ 'action'=>['admin\\pagescontroller@increment','itemid='.$item->id], 'style' => 'display:inline' ]) !!} then access item id in controller by input:get('itemid')

java - Is invocation of exception.fillInStacktrace useful? -

i found explicit invocation of e.fillinstacktrace() directly after creation of exception exception e = new exception() . i think redundant, because constructor of throwable invoke fillinstacktrace() . but maybe overlooked , lines useful: exception e = new exception(); e.fillinstacktrace(); creationinfo = new creationinfo(e.getstacktrace()); ( public creationinfo(stacktraceelement[] astacktrace){...} ) i think the additional invocation of e.fillinstacktrace(); directly after creation exception redundant , wast lot of resource, because method expensive. it seams construct needed obtain current stacktrace, therefore: creationinfo = thread.currentthread().getstacktrace(); is better way. before filling issue report want ask if have overlooked something? you correct on both counts: biggest reason why fillinstacktrace available let override in own exceptions you'd save costs of providing stack trace information, or need hide information location excep

function - MySQL: Query not always returning lowest most recent price across multiple stores -

the below sql returning lowest recent price each product if there price information single store, if there price information more 1 store recent lowest price isn't returned!? wanted outcome return lowest price product recent price information across stores if there 6 stores display lowest price recent price record each of 6 stores. if recent price same across store price records , updated date same records can ordered store select price product in question. {product id} value passed in depending product being displayed. sql select `vsp`.`prod_id` , `vsp`.`price` , `vsp`.`store` , `vsp`.`updated` `price` `vsp` not exists ( select * `price` `vsp2` `vsp2`.`prod_id` = `vsp`.`prod_id` , `vsp`.`prod_id` = {product id} , (`vsp2`.`updated` > `vsp`.`updated` or (`vsp2`.`updated` = `vsp`.`updated` , `vsp2`.`price` < `vsp`.`price`)) ) , `vsp`.`prod_id` = {product id} price prod_id | price | store | updated -------------------------------

arcgis - ArchGIS Javascript Application , the TemplatePicker shows text "No information available" when I zoom in. -

Image
the template picker editing looks when zoom levels minimum (expanded or zoomed out) but when zoom in , start editing, template picker not work expected. the reason why may occurring because have defined feature layer, @ zoom level template not function expected, follows, featurelayer = new featurelayer(featurelayerurls[2], { mode: featurelayer.mode_ondemand, infotemplate: infotemplate, outfields: ["*"] }); this may conflicting template picker. is there work around problem? solutions tried: disabled info window @ zoomed in level template picker info window functions. did not work. clearly. idea: i planning disable zoom extent if nothing works out. cannot find function esri.map enables me fix max zoom level outside constructor. let me know if can thing of way? the link application is: http://carto.gis.gatech.edu/gttree-viewer how reproduce issue: select "edit" , click on existing shape

php DAL - separate entity and database? -

i've been researching , reading lot working separate layers in php create maintainable , readable code. however, see lot of code entity , database access placed in 1 class. example: class user{ public $id; public $username; public $database; function add(){ $database->query .... } } i find rather strange because here mixing user class database elements makes more difficult maintain. i working this: a separate database class a user class a userdata class this works this: $database = new database(); $database->openconnection(); $datauser = new datauser($db); $user = new user(1,"myname"); $datauser->saveuser($user); so i'm wondering, working right way or first way better way create code? find may way easy maintain because have separate entity , separate database class handle database actions. easy maintain because have separate entity , separate database class it appears you're sayin

c# - ASP.NET: How to create a search function just using a textbox? -

i have suggestions regards having search function in website. find registered customers easier admin specific customer. can give sample code snippets can accomplish specific search function? thank you. here .aspx code <asp:textbox id="txtsearch" runat="server" borderstyle="solid" width="218px" ontextchanged="txtsearch_textchanged"></asp:textbox> &nbsp;<asp:button id="btnsearch" runat="server" text="search" /> </p> <div style="overflow-x:auto; width:1200px"> <asp:gridview id="gvcustomer" runat="server" autogeneratecolumns="false" backcolor="#cccccc" bordercolor="#999999" borderstyle="solid" borderwidth="3px" caption="customer profile" cellpadding="4" cellspacing="2" datasourceid="sqldatasourcebm" forecol

javascript - Quarter-circle in top right corner -

i looking make quarter-circle place in top right corner of website (fixed) , want animate towards center when user scrolls ( have code working shrinking element not element or center) i have header shrinking following code: html (script) $(function(){ var shrinkheader = 50; $(window).scroll(function() { var scroll = getcurrentscroll(); if ( scroll >= shrinkheader ) { $('header').addclass('shrink'); } else { $('header').removeclass('shrink'); } }); with shrink class applied header when user scrolls. switch on quarter circle when figure out. note: white filled icon in middle (acting nav toggle button) edit: asking how make quarter-circle sits top right of screen (fixed) , can animated top right corner (circle's center) i looking make quarter-circle place in top right corner of website (fixed) want animate towards center when user scrolls i asking how make quarter-circle sits top righ

Excel - Find Highest Value of Text String in Group/Array (Pic) -

Image
so head hurts trying make work after researching , through trial , error (mostly error). simple i'm missing. i have column displays text string letters , numbers. value total of 13 characters last 2 numerical digits (i.e. 01, 02, 03, etc.). adjacent column indicate row contains largest value (based on last 2 numerical values) in group (see image). i found similar example can't working in application ( excel - find highest value of column in matching rows (with screenshot) ). not sure if because of cell formatting. please help--it appreciated! you can array formula: =if(numbervalue(right(a2,2))=max(if(left($a$2:$a$10,11)=left(a2,11),numbervalue(right($a$2:$a$10,2)))),true) you need hit ctrl+shift+enter after entering formula. assumes 13-character strings 2 digits @ end.

java - JPA Annotation/Metadata mapping for GAE -

i trying finish modeling application plan deploy on google app engine. i have base class, account abstract, annotated follows: @entity @mappedsuperclass public abstract class account { @id private key id; ..... i have 2 concrete classes, administratoraccount: @entity public class administratoraccount extends account { and customeraccount: @entity public class customeraccount extends account { i have 3 declared in persistence.xml file. when try persist customeraccount, 500 error: org.datanucleus.exceptions.nopersistenceinformationexception: class "com.nucleus.entitymodel.account" required persistable yet no meta-data/annotations can found class. please check meta-data/annotations defined in valid file location. any ideas on problem may be? tried follow documentation on gae site jpa inheritance. note google's warning jpa, consider moving objectify or low level datastore. what warning says jpa entity classes not enhanced. goog

android - Gradle version 2.10 is required, try editing distributionUrl -

i getting following error when trying build. warning:gradle version 2.10 required. current version 2.8. if using gradle wrapper, try editing distributionurl in c:\users\dylan\dropbox\work\persdev\tutame\androidstudio\gradle\wrapper\gradle-wrapper.properties gradle-2.10-all.zip as can see in distribution url. have edited version 2-10 how can force android studio update gradle? you need update gradle version in distributionurl latest versions distributionurl=https\://services.gradle.org/distributions/gradle-2.10-all.zip instead of: distributionurl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

ios - Async With Parse -

i'm building app based around pictures. it's important me retrieve images asyncronously instagram does. understand function... var query = pfquery(classname: "post") query.findobjectsinbackgroundwithblock { (objects, error) -> void in if let objects = objects as! [pfobjects] { object in objects { objectsarray.append(object) } } } ...is asynchronous. want way load images parse table asynchronously loads images while scrolling. you should take @ pfimageview's function loadinbackground() . for example, if using pftableviewcontroller pftableviewcell, can following override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject?) -> pftableviewcell { var cell = tableview.dequeuereusablecellwithidentifier("customcell") as! customtableviewcell! if cell == nil { cell = customtableviewcell(style: uitablevie

Instergrate Google Translate Eclipse plugin to eclipse -

i try use google translate in eclipse. https://code.google.com/p/google-translate-eclipse-plugin/ but don't know how install google translate eclipse plugin eclipse. please me. it's old, abandoned , doesn't work in recent eclipse. people have adopted code own github accounts , haven't seen working. , of github cuts have few or no edits. think imported hoping in better shape was. i took quick @ it, might invalid plugin now. unclear if ever worked. i'll continue work on in spare time, need this, make no promises. [later] as promised, took @ code, , unsalvageable. better start scratch. uses deprecated extensions, , relies on pretty brittle substring match screen-scraping doesn't work anymore, , impossible fix. it's on list of utils write, i'm not actively working on it.

java - Destroying main class object -

public void executerepeat(string s) { this.move = s; storevalue = move; = integer.parseint(move); timer = new timer(1000, new actionlistener() { @override public void actionperformed(actionevent e) { i--; if(i <= 0) { move = "" + i; if (move.trim().equals("0")) { thread th = new thread(new detectimage()); th.start(); } timer.stop(); } jtextfield1.settext("" + i); } }); timer.start(); } private void jbutton1actionperformed(java.awt.event.actionevent evt) { move = jtextfield1.gettext(); executerepeat(move); } public static int stay = 0; class detectimage implements runnable { @override public void run() { while (stay < 3) { try { stay++;

hadoop - How to access configuration xml files of remote HDFS cluster using Java API? -

i have namenode address(ip address , port) , don't know location of configuration files (i.e.core-site.xml, hdfs-site.xml,etc) on local file system. want access configuration details. i know doing following can details, configuration conf = new configuration(); conf.addresource(file path of core-site.xml); conf.addresource(file path of hdfs-site.xml); it working on local machine know file paths. dont know location of files on remote machine. is there way access configuration?

sitecore6 - Sitecore - Rich Text Editor - Create new Paragraphs with class attribute -

Image
i've managed create new paragraph style sitecore rich editor creating new item under: /sitecore/system/settings/html editor profiles/rich text default/paragraphs/ the paragrah value issue: first time when select section on rte , click new selection wraps tag below: <p class="something> paragrah...... </p> however when again select same paragraph , select "normal" style above doesn't replace with: <p>paragraph..... </p> if reverse above doesn't work. reason rte seems think <p class="something> same <p>` could me whether bug within rte/sitecore? i tried , got similar results able resolve think perhaps missing piece of you're looking for. i created new paragraph test class in core db called test. opened rte , applied test class. after, saw had applied class yours above: <p class="test">this test</p> i tried apply 'normal' class on , didn't chang

php - Quickest way to Insert mass data Into Mysql database -

i have list of 100,000 records i'd insert mysql database. i have tried insert them foreach , simple insert into took lot of time insert 100 row. 1 second / row. is there method insert these rows faster? using 1 insert statement multiple rows faster 1 insert statement per row. reduce calls database. example: insert tbl_name (a,b,c) values(1,2,3),(4,5,6),(7,8,9);

jquery - parent() doesn't delete rows -

i'm writing jquery script add 3 elements table. far, haven't been able delete entire row using parent() function. explain i'm doing wrong? $(function(){ $("#dvtable").hide(); $("#btngenerate").click(function(){ var ename = $("#ename").val(); var eid = $("#eid").val(); var desc = $("#desc").val(); var dvtable= $("#display"); $("#formcontainer").hide(); $("#dvtable").show(); var content = dvtable.children(); content.append('<tr>') .append('<td>' + ename + '</td>') .append('<td>' + eid + '</td>') .append('<td>' + desc + '</td>') .append('<td onclick="edit()">edit</td>') .append('<td onclick="remove()">del</t

php - Database time format change -

for database time, have following: date_default_timezone_set('canada/mountain'); $comment_date = date('m/d/y h:i:s a', time()); $data = array( 'comment_date' => $comment_date ); but getting 0000-00-00 00:00:00 results. i trying show time in "1 min" or "20 hr" or "4 days" format. how achieve this? it looks may using mysql. assuming this, change $comment_date = date('m/d/y h:i:s a', time()); to $comment_date = date('y-m-d h:i:s'); and should retain correct date when save database. reason mysql expects datetime in latter format. i'm not sure mean i trying show time in "1 min" or "20 hr" or "4 days" format . can use mysql date_format() function format date when extract database. see http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-format details on how this.

asp.net mvc - Using Dropzone.js in MVC Editor template -

i facing issues in using dropzone.js in mvc 5 editor templates. have partial view complete form, big, , in partial view call editor template, using dropzone.js. on form submit (implemented using custom button , jquery.form.js), model posted , 1 of property of model files. editor template code: <div class="col-md-7 col-lg-7 col-sm-6 col-xs-12"> <div class="dropzone" id="filesdropzone"> @html.textboxfor(model => model.attachmentfiles, new { type = "file", multiple = "true" }) @html.validationmessagefor(model => model.attachmentfiles) </div> </div> js code: dropzone.options.filesdropzone = { url: '@viewbag.actionurl', autodiscover: false, autoprocessqueue: false, paramname: "attachmentfiles", uploadmultiple: true }; now

java - Change timezone of date before sending to MonngoDB -

i querying mongo db below query query: { "modifieddate" : { "$lt" : { "$date" : "2016-01-20t05:08:28.000z"}} this date in modifieddate provided backend ui in long format has value 1453286308000. long date converted date object using below line datetime(value).withzone(datetimezone.forid(timezoneid)).todate() returned date class object of value "2016-01-20 10:38:28" . want date in utc format before querying mongodb. mongo query, criteria.where(modified_date).lt(date) date object coming in query "2016-01-20t05:08:28." not "2016-01-20 10:38:28" expected. this 5.30 hrs difference caused because date considering local timezone. possible avoid it. i tried using calendar cal = gregoriancalendar.getinstance(timezone.gettimezone("utc")); cal.settimeinmillis(value + timezone.getdefault().getrawoffset()); which gives me expected result. there better approach or work in scenarios?

radio group not listening inside of a dialog in android -

i can't listen radiogroup dialogfragment class. don't eny errors, log doesn't show me anything. please me... public class simpledialog extends dialogfragment{ @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); layoutinflater inflater = getactivity().getlayoutinflater(); view view = inflater.inflate(r.layout.radio, null); builder.settitle(r.string.dialog_name) .setview(inflater.inflate(r.layout.radio, null)) .setnegativebutton(r.string.cancel, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { } }); radiogroup radiogroup = (radiogroup) view.findviewbyid(r.id.radiogroup); radiogroup.setoncheckedchangelistener(new oncheckedchangelistener() { public void oncheckedchanged(radiogroup group, int checkedid) { log.v("dialog

algorithm - JavaScript: What does "functions are executable" mean? -

i'm reading john resig javascript ninja book. there writes functions have "super power" of being executable. i don't understand "being executable" means. does mean javascript interpreter takes code exists string , translates machine code? executed cpu? in case of that: other data processed cpu. differentiation? can explain term "executable" in way understandable non computer-science graduate? it means function set of instructions cpu can execute. compared other programing constructs variables , objects, hold data, kind of special.. specialy in languages javascript functions objects. "being executable" preatty special. so imageine this. a variable object, means holds data = 10 the computer knows a has value 10 , not know means, or it. function object on other hand holds instructions function a(){do{...}while(b=10)} this menas computer knows with. can take instructions of a , execute them 1 one..

change swagger UI in wso2 api manager 1.9 -

i new in wso2 api manager 1.x , have set wso2 api manager 1.9 in 1 of our server , looks . so , moving further change ui in api console (api store). example - can see there soap action , want default value api name ,,is there way same .?? i doing changing swagger-ui.js seems not working me , please this thanks

Phantomjs calling functions with variable -

i trying put code variable , call variable phatom , phantom should generate graph eg: save code in var test="code" call test in phantomjs , should generate graph, possible? xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] or can create js file , call variable phantomjs highcharts-convert.js -infile options1.json -outfile chart1.png -scale 2.5 -width 300 -constr chart -callback callback.js it unclear question trying accomplish. if have var test = { xaxis: { ... } }; and trying access variable within webpage (i.e. generate graph in actual dom) have pass variable argument page open method, i.e.: var test = { xaxis: { ... } }; var page = require('webpage').create();

c# - How to concat long SMS in GSMComm Library? -

here code: according page createconcattextmessage method returns array type smssubmitpdu[] but, when try send sendmessages messageserviceerror 500 . missing? smssubmitpdu[] pdu2; try{ pdu2 = smartmessagefactory.createconcattextmessage("my name barry allen. , fastest man alive. when child saw mother killed impossible. father went prison murder.", "+639234597676"); comm.sendmessages(pdu2); } catch (messageserviceerrorexception e500){ messagebox.show(e500.tostring(), "information", messageboxbuttons.ok, messageboxicon.exclamation); } catch (commexception e501){ messagebox.show(e501.tostring(), "information", messageboxbuttons.ok, messageboxicon.exclamation); } your code should looks this: gsmcommmain comm=new gsmcommmain(/*set option here*/); string txtmessage="your long message..."; string txtdestinationnumbers=

python - How to preprocess all calls? -

i use bottle.route() redirect http queries appropriate functions import bottle def hello(): return "hello" def world(): return "world" bottle.route('/hello', 'get', hello) bottle.route('/world', 'get', world) bottle.run() i add preprocessing each call, namely capacity act upon source ip (obtained via bottle.request.remote_addr ). can specify preprocessing in each route import bottle def hello(): preprocessing() return "hello" def world(): preprocessing() return "world" def preprocessing(): print("preprocessing {ip}".format(ip=bottle.request.remote_addr)) bottle.route('/hello', 'get', hello) bottle.route('/world', 'get', world) bottle.run() but looks awkward. is there way plug preprocessing function on global level? (so each call goes though it?) i think can use bottle's plugin doc here: http://bottlepy.org/do

PHP - transform value from XML field to HTML field with elements which is repeating? -

i have xml field $xmlstring value; '<result> <customeraccount xmlns="http://www.ibm.com> <accountstatus xmlns="">due</accountstatus> <componentcustomeraccount xmlns=""> <name>adsl</name> <characteristicvalue> <characteristic> <name>balance</name> </characteristic> <value>0.0</value> </characteristicvalue> <characteristicvalue> <characteristic> <name>date</name> </characteristic> <value>21.10.1990</value> </characteristicvalue> <accountstatus>active</accountstatus> </componentcustomeraccount> <componentcustomeraccount xmlns=""> <name>iptv</name> <characteristicvalue> <characteristic> <name>balance</

php - problems showing the right special characters in email -

i have php file generates automatic email. inside email, there special characters (ä,ö,ü) don't show correctly. replace question mark. can me in this? can change inside php code? this php file: click here thats how email looks set email header utf8 charset mail($to,$subject,utf8_decode($message),$from."\ncontent-type: text/plain; charset=utf-8\ncontent-transfer-encoding: 8bit\n"); this solve problem. this has been posted on stack overflow on below link. php mail special characters utf8 please try search post before post something. there lot of content available here on stackoverflow.

Visual Studio connect to GIT server -

we following error trying connect git server inside our company network. proxy configuration config file added , works. same errors appears when try establish connection github.com error: libgit2. category = net (error). response status code not indicate success: 417 (expectation failed) finally found solution on own. editing “devenv.exe.config” file , adding "expect100continue" parameter solves problem. <settings> <ipv6 enabled="true"/> <servicepointmanager expect100continue="false"/> </settings> connecting github , our local gitserver work fine now.

upload images in Laravel 5.2 -

Image
i'm trying uploads images error exception exist , wrote code validation `$this->validate($request,['title'=>'required|unique:home,title|max:20', 'image'=>'mimes:jpg,jpeg,png,gif|max:2048|']);` uncomment line in php.ini php folder. extension=php_fileinfo.dll and restart server(enter 'php artisan serve' again)

java - How do I check to see if there is space in an array? -

for part of schoolwork need write method goes through array of objects see if there space add object array . if able add object method returns true , if wasn't able add returns false. how check array see if there empty cells in array can add element array? example, have array size of 25 15 cells full , want add object in 1 of ten cells empty or null . add method boolean return value. need know cell can add , need check cell empty or null . public void isspace(string[] array) { (int i=0; i<array.length; i++) { if( (array[i] == null) || (array[i].trim().length() == 0)) { //true on null, empty string, or white space only. here array[i] = "add thing here"; } else { //not null, not empty string, or not white space. here } } }

php - Reload the page if i click on outside the multiple dropdown box using javascript -

i have small query, have multiple dropdown box in form. after selecting multiple value, if click on outside multiple drop down box page should reload. how can make happen using javascript. have used "onmouseout(reload.form)" option not working. please me on this. thanks ranjith in scenario, might need click event rather mouseout(which not on click when mouse loses focus). for more details click outside element refer below link javascript detect click event outside of div so once capture click out event, can trigger page load using window.location.reload(true) or window.location.reload(false) true or false depends on need load cache or server. hope helps!!

c# - What is the proper way to propagate exceptions in continuation chains? -

what proper way propagate exceptions in continuation chains? t.continuewith(t2 => { if(t2.exception != null) throw t2.exception; /* other async code. */ }) .continuewith(/*...*/); t.continuewith(t2 => { if(t2.isfaulted) throw t2.exception; /* other async code. */ }) .continuewith(/*...*/); t.continuewith(t2 => { if(t2.exception != null) return t2; /* other async code. */ }) .continuewith(/*...*/); t.continuewith(t2 => { if(t2.isfaulted) return t2; /* other async code. */ }) .continuewith(/*...*/); t.continuewith(t2 => { t2.wait(); /* other async code. */ }) .continuewith(/*...*/); t.continuewith(t2 => { /* other async code. */ }, taskcontinuationoptions.notonfaulted) // don't think 1 works expected .continuewith(/*...*/); the taskcontinuationoptions.onlyon... can problematic because cause continuation cancelled if condition not me

java - How to integrate two applications using single sign on -

i having .net/java application (application1) in have integrate service have on application (application2) has been designed using java , important thing user logged in application1 should maintained in appliation2. i know cas authentication can used solution not sure how can achieved if idea on kindly share. cas best choice token based single sign on purpose , secured 1 also. cas available .war file format, need deploy server tomcat, cas work centralized authentication system. applications .net/ java have import cas client libraries, , xml configurations login , logout , redirection purpose. same 1 have repeat other application (app2) also. based on requirement may first application parent 1 cas related token tables need implement in parent application db. in case second application level no need check password, cas authenticate token generetd first application. if want cas should parent application in cas user data base should have login details of users usernam

ubuntu 14.04 - Hadoop seem to run on console, but can't login from the browser -

i have been trying use mahout create recommender , in setting environment, have set hadoop on ubuntu 14.04 system. hope has been install successfully. when try hadoop version gives me following response. hadoop 2.6.0 subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r e3496499ecb8d220fba99dc5ed4c99c8f9e33bb1 compiled jenkins on 2014-11-13t21:10z compiled protoc 2.5.0 source checksum 18e43357c8f927c0695f1e9522859d6a command run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.6.0.jar after run start-all.sh script, tried access hadoop using browser url http://localhost:50070/ , response getting web page not available the tutorial have been following suggest web interface checked out followers , mahout installation part mentioned after this. so, there wrong installation or missing something? edit: when access http://localhost:8088/ working kill process running on port 50070 , restart hadoop.next time should open web console.refer link .

tortoisesvn - Tortoise SVN Diff color codes -

Image
could explain color codes when doing diff in svn, i.e. lines marked red, yellow, blue..etc check tortoisesvn manual: http://tortoisesvn.net/docs/nightly/tortoisemerge_en/tmerge-dug-settings.html#tmerge-dug-settings-color . this default color scheme: it makes sense know line status icons meaning.

html - How to make text "Passed" and progress bar appear in line in smaller views? -

Image
i have made following design using bootstrap. <!doctype html> <html> <head> </head> <body> <div class="container-fluid parent-vertical-align"> <div class="container-fluid child-vertical-align" style="width: 99%;"> <div class="row row-centered"> <!-- block 1 --> <div class="col-md-3 center-block"> <div> <!-- thumb-nail image --> <div> <img src="img/a.png" class="img-responsive" /> </div> <!-- status bars --> <br/><br/> <div class="row"> <div class="col-md-3"> passed <br/><br/> failed <br/><br/> ski

bash - How do I link C source files together using headers -

Image
c code on left, bash window on right i trying create new .c file putting #include "name.h" @ beginning of file can see i'm getting error. it's saying cannot find include file. not linking them correctly using bash commands? you use right commands, need have main() function somewhere in code in order program compile. also, not need put #include "name.h" create .c (source) file, .h file (headers) used declare functions can use them in other source files.

sockets - are username and password needed when setting a TCP client connection using sierra wireless modem? -

i using following sequence of commands when trying establish gprs connection sierra wireless modem: at+wipcfg=1 at+wipbr=1,6 at+wipbr=2,6,11,"apn name" at+wipbr=2,6,0,"user name" at+wipbr=2,6,1,"passwd" at+wipbr=4,6,0 at+wipcreate=2,1,"ip addr",80 at+wipdata=2,1,1 my problem don't use username or password, because given me when purchased sim card using. need ask mobile company those? or username , password fields set on server side of communication link? have tried omitting them error when using at+wipbr=4,6,0, or echo modem (no ok, no error). any appreciated. username/password in case of gprs used authentication via radius inside operator's network (on ggsn node). depends on mobile operator if should used or not. days of operators don't care regarding fields username , password.

ios - Autocomplete UITextField Async update UITableView -

i have problem updating tableview. so, know how implement autocomplete textfield tableview. problem keyboard typing not smooth want be. flow goes this: when type 3 characters, async server method called. it's response object returns searched addresses. problem when type, half second, cannot anything, need wait until loads result. wondering solve dispatch_group_t need enter , leave async , in notify method update ui. code: if (string.length == 0 && range.length > 0) { if (newtext.length >= 3) { dispatch_async(dispatch_get_main_queue(), ^{ [address getaddreses:newtext city:[city getdefaultcity] location:self.lockedposition block:^(nserror *error, nsarray *addresses) { self.suggestedaddresses = addresses; if (addresses.count < autocomplete_results_max) { self.sugesstedaddressesmaxresult = self.suggestedaddresses; } else {

c++ - How to create a std::function alike wrapper? -

attempted this: template <class r, class... ts> class myfunction { public: using func_type = r(*)(ts...); myfunction(func_type f) : m_func(f) { } r operator()(ts ... args) { return m_func(args...); } private: func_type m_func; }; int testfn(int a) { std::cout << "value " << a; return 42; } void testing() { myfunction<int(int)> func(testfn); std::cout << "ret " << func(1) << std::endl; } but fails with: error c2064: term not evaluate function taking 1 c2091: function returns function c2091: function returns c2664: 'myfunction<int (int),>::myfunction(const myfunction<int (int),> &)' : cannot convert argument 1 'int (__cdecl *)(int)' 'int (__cdecl *(__cdecl *)(void))' compiler msvc2013. it should this: template <typename t> class myfunction; template<typename r, class... ts>

Logstash fails to connect to rabbitmq -

i trying setup logstash configuration push lines file rabbitmq. installed both logstash 2.1.1 , rabbit 3.6.0 on local machine test it. output configuration is: output { rabbitmq { exchange => "test_exchange" key => "test" exchange_type => "direct" host => "127.0.0.1" port => "15672" user => "logstash" password => "logstashpassword" } } but when start logstash fails startup following error (the output shown when logstash started in debug mode): worker threads expected: 4, worker threads started: 4 {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"186", :method=>"start_filters"} connecting rabbitmq. settings: {:vhost=>"/", :host=>"127.0.0.1", :port=>15672, :user=>"logstash", :automatic_recovery=>true, :p

mysql - How to select a date less than the current one? -

i want load appointment history of customer db, each record have start_datetime , end_datetime , query looks this: $query = $this->db ->select('*') ->from('appointments') ->where('id', 5) 'id of record select ->where('start_datetime' ) 'here's indecision ->get()->result_array(); essentially record load should record previoulsly of current datetime. how can pass condition in clause? try this $now = date('y-m-d h:i:s'); # current time stamp $query = $this->db ->select('*') ->from('appointments') ->where('id', 5) ->where(start_datetime <= $now ) # date($now) ->get()->result_array();

Create h2 database with Spring Boot if it not exists, then don't delete. Desktop application -

i writing desktop applicaiton, requires language dictationary. i want application create h2 database when user first time run application, , load translations db .xdxf dictationary. after quick looking through few articles got common use case create new schema every time when application starts , destroy on exit. did correctly? is there way keep created schema after application stopped? p.s. link suitable tutorial enougth me. thanks. you referring spring boot by default . can configure in many ways, reading documentation should help . h2 can configured in many ways , including file-based persistence (i.e. surviving restart of application). with current setup works h2 in memory, give configuration try , @ doc remaining pieces: spring.datasource.url = jdbc:h2:file:~/testdb we figure out driver based on url. note since took control on setup, hibernate won't configured create schema automatically on startup (if relying on that). check this question more de

android - Google Photos image cropping tool -

Image
how create image cropping tool google photos application image cropping tool? have searched everywhere, didn't found library or code works google photos cropping app. i mean, functionality of app. have found many libraries, problem that, when add seekbar image rotating, rotating hole view (image , cropping frame), want, cropping frame don't rotate. i tried libraries https://android-arsenal.com/tag/45 here rotating code, , library https://github.com/jdamcd/android-crop private void rotateclick(){ seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { imageview.setrotation(progress) } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } }); } and xml <seekbar android:id="@+

php - Comparing String Value -

i trying build hash of sha256 string using hash_hmac $key = chr(hexdec('17')); // value of key blank $test = chr(hexdec('17')) == '' ? true : false // value of test false so want know value of $key how can compare $signature1 = hash_hmac('sha256', "st=1453362060~exp=1453363260~acl=/*", chr(hexdec('17'))); $signature2 = hash_hmac('sha256', "st=1453362060~exp=1453363260~acl=/*", ""); // signature1 == 020cb911b6415b14f6b1f955adf55be3b17bcbd77a3987408cb41406e39bfc82 // signature2 == 9356975e2119102a773dbd45e4f06d124246794a451c4aee320888bd3f857377 why generating different key ? the value of $key not directly printable has length different empty string not supplying same parameters hash_hmac function on both occasions. perhaps $test variable needs used? if( !defined( 'br' ) ) define('br','<br />' ); $key = chr(hexdec('17')); $test = chr(hexdec('

plsql - does VARCHAR increase the capacity of the variable assigned to it? -

city char(10), street varchar(10) one thing understood varchar having variable length . in above case - if name of street more 10 characters - increase size again 10 units default ? . please clarify . no, error if try insert larger string. database sql language reference : varchar2 data type varchar2 data type specifies variable-length character string. when create varchar2 column, supply maximum number of bytes or characters of data can hold. oracle subsequently stores each value in column specify it, provided value not exceed maximum length of column. if try insert value exceeds specified length, oracle returns error.

flex - Adobe AIR file upload response data in complete handler is null while fiddler(web debugger) shows that json is returned as response -

when uploading file adobe air backbone server, response returned not anyway accessible when using file.upload(request) function, while can see json response in fiddler(web debugger , in task manager), working fine when using urlloader.load() instead of file.upload() var url = "api url of backbone server "; request = null; file = null; request = new air.urlrequest(url); request.usecache = false; var authorization = new air.urlrequestheader("authorization", "bearer "+accesstoken); var contenttype = new air.urlrequestheader("content-type", "multipart/form-data; boundary=" + boundary); var accept = new air.urlrequestheader("accept", "application/json;charset=utf-8"); request.requestheaders.push(authorization); request.requestheaders.push(contenttype); request.requestheaders.push(accept); file = new air.file(path); pathnative = file.nativepath; var directory = getdirectoryfrompath(pathnative); params = new

javascript - HTML5 pushstate on angular.js, link to download the file is not working? -

today trying use html5 pushstate in application remove # url. achieve have injected $locationprovider in router , , doing $locationprovider.html5mode(true); have found many online resources. not working removed # urls , added in index.html. tts working fine every url in whole application. in application u can upload file , if file uploaded successfully, file name visible on page , if u click on file name able download it. problem in pushstate, if click on file name nothing happening. tried multiple combination no luck. // router.js angular.module('myapp').config(function ($stateprovider, $urlrouterprovider,$locationprovider) { $stateprovider .state('home', { url: '/', templateurl: 'app/main/main.html', controller: 'mainctrl', controlleras: 'mainctrl' }) $urlrouterprovider.otherwise('/'); $locationprovider.html5mode(true); }); <!--he