Posts

Showing posts from April, 2012

javascript - Need an example of Streaming mySql module with Node & Express -

can provide example of streaming large data sets 'mysql' module, node , express? there documentation, don't understand how query data in smaller segments because don't see examples. appreciated. query works, takes long time because table huge. query works, want request return lets 1,000 rows @ time can start populating data. link streaming queries documentation here. here code: const mysql = require('mysql'); const express = require('express'); const app = express(); const connection = mysql.createconnection({ host: 'us-cdbr-azure-east-a.cloudapp.net', database: 'eagertobp', user: ******, password: *******, port: '3306' }); connection.connect(function(err) { if(err) { console.log('error') } else { console.log('connected'); } }); app.get('/', function(req,resp) { connection.query("select * submissionanalytics"); console.log('test'); connection .

android - appending values each time when calling JNI method -

i using jni fetch signature of apk , getting well. when calling method java first time getting exact value. calling again getting appended values exact value (eg 1234456123456). pfb code using char* getsignaturemd5(jnienv* env, jobject obj) { char* sign = loadsignature(env, obj); md5_ctx context = { 0 }; md5init(&context); md5update(&context, (unsigned char*)sign, strlen(sign)); unsigned char dest[16] = { 0 }; md5final(dest, &context); int i; static char destination[32]={0}; (i = 0; < 16; i++) { sprintf(destination, "%s%02x", destination, dest[i]); } return destination; } gettoken jni method jniexport jstring jnicall java_com_sign_signaturecapturesbi_myadapter_gettoken(jnienv *env, jobject obj) { char* signvalue = getsignaturemd5(env, obj); __android_log_print(android_log_verbose, "myapp", "signvalue %s&q

c++ - Initializing a static const for a template specialization -

i have created class template static const element. intent each specialization of template have own version / value of static element. here sample code: template < typename t > class c { public: static const std::string name; t something; void printname() { std::cout << name << std::endl; } }; class c1 : public c< int >{}; class c2 : public c< char >{}; template<> const std::string c< int >::name{ "my int" }; // compiles template<> const std::string c< char >::name{ "my char" }; // compiles //template<> const std::string c1::name{ "my int" }; // doesn't compile //template<> const std::string c2::name{ "my char" }; // doesn't compile //const std::string c1::name{ "my int" }; // doesn't compile //const std::string c2::name{ "my char" }; // doesn't compile int main() { c1 c1; c2 c2; c1.printname();

c# - Leave open socket with ssl stream -

i'm using ssl stream , make https soap request each action need. can leave channel open, , not send certificate each time, , wait hand shake? this code i'm using: static void runclient(string hostname, int port, x509certificate2collection certificates) { // create tcp/ip client socket. // machinename host running server application. tcpclient client = new tcpclient(hostname, port); console.writeline("client connected."); // create ssl stream close client's stream. sslstream sslstream = new sslstream( client.getstream(), false, validateservercertificate); // server name must match name on server certificate. try { sslstream.authenticateasclient(hostname, certificates, sslprotocols.default, true); displaysecuritylevel(sslstream); displaysecurityservices(sslstream); displaycertificateinformation(sslstream); displaystreamproperties(sslstream); } catch

ios - how to use my location(latitude,longitude) of CLLocation at viewdidload() -

func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { let userlocation: cllocation = locations[0] let center = cllocationcoordinate2d(latitude: userlocation.coordinate.latitude, longitude: userlocation.coordinate.longitude) mylat = userlocation.coordinate.latitude mylong = userlocation.coordinate.longitude let region = mkcoordinateregion(center: center, span: mkcoordinatespan(latitudedelta: 0.04, longitudedelta: 0.04)) totalmap.setregion(region, animated: true) } first.. i'm sorry english writning... i used mylat , mylong in func .. want add user location global variable , use user location in viewdidload .. actually need user location(lat,long) , many other location, , use comparing opration 2 location, , need of location .. help me the cllocationmanager works asynchronously. can use in viewdidload() not might think. you can register callback this: var onloc

printing html entities using lxml in python -

i'm trying make div element below string html entities. since string contains html entities, & reserved char in html entity being escaped &amp; in output. html entities displayed plain text. how can avoid html entities rendered properly? s = 'actress adamari l&#243;pez , amgen launch spanish-language chemotherapy: myths or facts&#8482; website , resources' div = etree.element("div") div.text = s lxml.html.tostring(div) output: <div>actress adamari l&amp;#243;pez , amgen launch spanish-language chemotherapy: myths or facts&amp;#8482; website , resources</div> you can specify encoding while calling tostring() : >>> lxml.html import fromstring, tostring >>> s = 'actress adamari l&#243;pez , amgen launch spanish-language chemotherapy: myths or facts&#8482; website , resources' >>> div = fromstring(s) >>> print tostring(div, encoding='unicode') <p

excel formula: sum elements in column a where column b has an even number -

Image
i'm trying come excel formula sum elements in column corresponding element in column b number. i've tried various permutations of sumif() without luck far. specifically, i'm not sure how specify criteria match numbers in cells in range. or maybe there's way entirely. thanks in advance! you can use mod , sumifs functions in way: the result in cell d1. note have semicolons (;) instead of commas in formula.

arrays - unique ip visit redirect in php without mysql -

i'm sorry if request seems silly . i've looked long time no luck. i'm trying : want when visitor visits link'http:/ /mysite. com/redirect .php' , php script gets ip address, checks if exists in array of ips stored in file 'hits.txt', if redirect him page say'google.com' if doesn't store ip address in file redirect him page 'yahoo.com'. later when comes visit again gets redirected google.com. ofcourse purpose make unique ip visits script. if have idea how without database , sql i'll grateful, if u think can done sql please suggest me easiest way. code far doesn't work : <?php // unique hits php script // ----------- march 2004 // contact author: uniquehits@sizzly.com $log = 'hits.txt'; $ip = getenv (remote_addr); $add = true; $hits = 0; if (!file_exists ($log)) { echo "error: $log not exist."; exit; } $h = fopen ($log, 'r'); if (in_array($ip, array($h))){ header("

ios - How to convert Any to Int in swift? -

before asking question have searched stackoverflow's related questions, , found similar one: how convert int in swift . my requirement not less: let tresult = result as? [string:anyobject] let statecode = tresult?["result"] as? int my need if tresult?["result"] string class, want convert int too, rather nil . in objective-c , wrote class method converted int : + (nsinteger)getintegerfromidvalue:(id)value { nsstring *strvalue; nsinteger ret = 0; if(value != nil){ strvalue = [nsstring stringwithformat:@"%@", value]; if(![strvalue isequaltostring:@""] && ![strvalue isequaltostring:@"null"]){ ret = [strvalue intvalue]; } } return ret; } is possible write similar class method using swift3? less verbose answer: let key = "result" let statecode = tresult?[key] as? int ?? int(tresult?[key] as? string ?? "") results: let tr

Python `sympy` module equation solving multiplication in expression -

Image
i have code below simple test of sympy.solve : #!/usr/bin/python sympy import * x = symbol('x', real=true) #expr = sympify('exp(1 - 10*x) - 15') expr = exp(1 - x) - 15 print "expressiong:", expr out = solve(expr) item in out: print "answer:", item expr = exp(1 - 10*x) - 15 print expr out = solve(expr) item in out: print "answer:", item output follows: expressiong: exp(-x + 1) - 15 answer: -log(15) + 1 exp(-10*x + 1) - 15 answer: log(15**(9/10)*exp(1/10)/15) the equation exp(1 - x) = 15 solved correctly ( x = -15log(15) + 1 ). but when change x 10*x , result weird. why there lot of complex answers if initialize symbol x without real=true ? even real=true when initializing symbol x , answer still not correct. comparing first equation, result should -3/2*log(15) + 1/10 . did write equation wrong? thanks in advance. i can confirm solve output equation exp(1 - 10*x) - 15 == 0 appears unecessarily c

angular - Angular2 - How to access value stored in data attributes -

this may have been asked, i've tried googling sometime without having getting solution. i have following select field in angular2, how access stored value in data attribute of attr.data-thisdata ? <select #dial"> <option *ngfor="let of somethings" [value]="something.value" [attr.data-thisdata]="something.data" >{{something.text}}</option> </select> i have tried following not getting values: <select (change)="readdata($event.target.dataset)>...<select> <select (change)="readdata($event.target.dataset.thisdata)>...<select> my readdata simply: readdata(data:any){ console.log(data) } edit 1 : added plunker ease of reference edit 2 : included plunker günter's answer with [ngvalue] instead of value can assign object instead of string. <select #dial" ngmodel (ngmodelchange)="$event.data"> <option *ngfor="l

r - Detect alphabetical order in character vector -

i have several character vectors this: lastname <- c("smith" ,"johnson" , "williams" , "moore" , "taylor", "jones" , "brown" , "davis" , "miller" , "wilson" ) lastname's last 4 elements in alphabetical order. want split vector alphabetical order starts. thus, result like: lastname1 <- c("smith" ,"johnson" , "williams" , "moore" , "taylor", "jones") lastname2 <- c("brown" , "davis" , "miller" , "wilson" ) the part in alphabetical order located @ end it's length may differ. any appreciated! we can create logical index , split vector index create list of vector s. i1 <- rev(cumsum(c(true, diff(rank(rev(lastname))) >0))==1) split(lastname, i1) #$`false` #[1] "smith" "johnson" "williams" "moore"

What is the default response timeout in JMeter? -

can know default response time in jmeter if not set timeout in 'http request' sampler? thanks. it defaults 0 (no timeout) the recommended way of setting timeout using gui. if reason doesn't play you can use following properties: user.properties file: httpclient.timeout httpclient.parameters file: http.socket.timeout$integer both files live under jmeter's "bin" folder, jmeter restart required pick properties after change. references: timeouts http requests apache jmeter properties customization guide

c# - How can I get a Color from a list of KeyValuePair? -

i have button: btn, , i'm trying private list<keyvaluepair<string,color>> mylistkeyvaluepair = new list<keyvaluepair<string,color>> btn.backcolor = color.(mylistkeyvaluepair[i].value); but says, 'identificator expected'. if have color in name/value pair, set color value. btn.backcolor = mylistkeyvaluepair[i].value;

When do you use a block statement in a VHDL design and when do you not? -

i come sw world , i've started create fpga designs in vhdl. i've read block concurrent statement , principal uses organize architecture grouping concurrent code , guard signals, not recommendable. but 1 of many possibilities in order implement same functionality. instance, i've been implemented crc frame checker vhdl function. has 1 bit value input, , return register cumulative crc value of bit inputs. i think same functionality can implemented block . best option resource utilization? when use block , when not? best case implement block ? thanks,

html - Angular2- Object as Radio Input Value -

is possible bind json object radio input in angular2? i have json object named object , tried <input type="radio" [(ngmodel)]="selectedobject" [ngvalue]="object"> but gives ngvalue not known property of input error. tried <input type="radio" [(ngmodel)]="selectedobject" value="{{object}}"> but selectedobject becomes [object object] . i wrote code in angular 1, without testing converted angular 2 you <span *ngfor="let list in object.lists"> <input type="radio" name="{{list.id}}" value="{{list.value}}"> </span>

angularjs - Vertical scroll bar with Ionic multiple views -

Image
i'm using multiple named views build ionic app screen. the problem is, have verticle scroll bar spans enitre screen, though there no scrollable content. the scroll bar covers header, content , footer sections. content section contains list, i'd scroll bar section, if there enough content need one. here code..... index.html <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- if using sass (run gulp sass first), uncomment below , remove css includes above <link href="css/ionic.app.css" rel="stylesheet"> --> <!--for users deploying apps windows 8.1 or

sql - How to update column from same column in similiar table -

i need copy column 1 table new column in table, following error. single-row subquery returns more 1 row this statement: update order set name2 = (select name old order); you have set join condition betwwen 2 tables; select return rows table; example: create table zzztemp1 (id1 integer, name1 varchar2(100)); create table zzztemp2 (id2 integer, name2 varchar2(100)); insert zzztemp1 values(1, 'joe'); insert zzztemp1 values(2, 'albert'); insert zzztemp1 values(3, 'jack'); insert zzztemp2 values(1, null); insert zzztemp2 values(2, null); insert zzztemp2 values(3, null); update zzztemp2 set name2=(select name1 zzztemp1 zzztemp2.id2=zzztemp1.id1); select * zzztemp2; rollback; drop table zzztemp1; drop table zzztemp2;

php - display data from the array using foreach -

having 3 columns in table column values stored in array. table id bill_id description quantity amount 16 16 ["item1","item2","item3"] ["2","1","2"] ["100","100","150"] and code view result <?php $description=json_decode($result->description)?> <?php $amount=json_decode($result->amount)?> <?php $quantity=json_decode($result->quantity);?> <?php foreach($description $row){?> <tr class="item-row"> <td class="description"><textarea class="textarea" name="description[]"><?php echo $row;?></textarea></td> <td><textarea name="amount[]" class="cost textarea"><?php echo $amount;?></textarea></td> <td><textarea name="quant

Logic of beforeValidate() in sails.js -

i new sails.js, , after works find beforevalidate() hard use. i have model user 2 attributes nickname , age . both attributes marked required sails check validation. when creating user, if client not specify nickname, assign random nickname it, following: beforevalidate: function(user, next){ if (!user.nickname) user.nickname = randomstring(5); next(); } this assigning should applied before sails validates required tag of nickname , beforevalidate() seems reasonable place it. however, when want update user's age like: user.update(user.id, {age: 40}); it trigger beforevalidate() and, sadly, new nickname assigned , replace origin one, since parameter user in beforevalidate() {age: 40} . what expect parameter user in beforevalidate(user, callback) should updated user, combination of both changed , unchanged attributes (e.g. user old id, old nickname , new age), instead of changed attributes specify in user.update() (e.g. {age: 40} ). do misunder

html - HMTL/CSS border on variable content for PDF problems with page break -

i making .erb html document pdf. have header, content , footer. pdfs created rails gem wickedpdf. my content generated via embedded ruby code, meaning there isn't fixed length of content or fixed number of lines. want border around page/my content. right now, border go around whole content, bad page breaks, since box have not close @ end of page instead closes @ end of content , don't want that. my code pdf creation of content looks this: <div style="border: 1px solid #000"> srohfs.each |srohf| content = getbodyfromhtml(srohf.content.to_s).gsub(/\s+/, " ").strip content = '<p>' + content + '</p>' if(!content.include?('<p>')) %> <div style="page-break-inside:avoid; display:block;margin: 0px 40px 0 40px;"> <%= content %> </div> <% end %> </div> if place border style in inner div, every piece of con

javascript - Set only one node (root) note to be draggable in d3 force layout -

i'm working on d3 force layout graph, looks pretty this . want root node fixed not draggable. fixed root node in json file adding "fixed": true but still draggable. in js file there code var nodeenter = node.enter().append("g") .attr("class", "node") .on("click", click) .call(force.drag); if remove last line of code, whole graph isn't draggable anymore. think 'force' global variable , determines, whole graph draggable. want root node not draggable , should draggable. how can that? you have remove drag event node wish stay fixed. here example : http://jsfiddle.net/qvco2ljy/112/ i have looped through data give first element fixed attribute , donotmove attribute when drag , let go, perhaps want node stay fixed (for children mean), using d.fixed here cause conflict : graph.nodes.foreach(function(d, i) { d.donotmove = false; if (i == 0) {d.donotmove = true; d.fixed = true;} }) and

data binding - UWP - bind element to main window size AND also update the value as window size changes -

i want bind text block current size of window. in current implementation size of main window set @ run time if resize window after application has launched new size not updated in text block. <grid x:name="grid" background="#ffe8e8e8"> <textbox x:name="textboxsample" width="300" height="200" text="{binding actualwidth, elementname=grid}"></textbox> </grid> in uwp, grid controls automatically resize fit parent container. your textbox has set height , width, prevent resizing when parent grid resized. in scenario described, workaround i've implemented adding screenheight , screenwidth properties view model updated when screen size changed. then, can bind height/width of whatever control wanting resized properies. here sample implementation: your xaml file: <page x:name="mainpage" x:class="yourapp.mainpage" xmlns="http://schemas.microsoft.com

apache camel - bundle stays in GracePeriod status -

i trying instantiate "cxf:cxfendpoint" in camel route. bundle stays in "graceperiod" status following log: 2016-11-10 11:03:07,598 | info | rint extender: 1 | blueprintcontainerimpl | ? ? | 21 - org.apache.aries.blueprint.core - 1.4.2 | bundle com.entreprise.example waiting namespace handlers [http://camel.apache.org/schema/blueprint] and camelcontext.xml file : <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0" xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:cxf="http://cxf.apache.org/blueprint/core" xmlns:camel="http://camel.apache.org/schema/blueprint" xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf" xsi:schemalocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blue

haproxy multiple backend ports -

i have ha proxy configuration in backend 3 clusters of application servers. backend servers using port http->80, socket.io->3000, , redis->6379 so created following backend , frontend. first application added socket.io en redis. not second. not sure , if best way of doing it. frontend http-in bind *:80 name port80 mode http # define hosts acl host_appl3 hdr(host) -i im.test.com acl host_appl4 hdr(host) -i appl4.test.com acl websocket_appl3 hdr(upgrade) -i websocket # figure out 1 use use_backend appl3_cluster if host_appl3 use_backend appl4_cluster if host_appl4 use_backend appl3_websocket if appl3_websocket frontend redis bind *:6379 name port6379 #define hosts acl redis_appl3 hdr(host) -i im.test.com #figure out 1 use use_backend appl3_redis if redis_appl3 backend appl3_cluster mode http balance leastconn option httpclose option forwardfor cookie jsessionid prefix # private addr

javascript - Building dropdown list from JSON, getting blank option items -

i'm getting blank options in dropdown list while creating 2 select input json object. code below: <form> <div class="form-group"> <label for="countries">countries: </label> <select class="select2" id="countries" name="countries" multiple="multiple" style="width: 50%"> <option></option> </select> </div> <div class="form-group"> <label for="cities">cities: </label> <select class="select2" id="cities" name="cities" multiple="multiple" style="width: 50%"> </select> </div> <button type="submit" class="btn btn-default">submit</button> </form> var selectdata = [{ "id": "1", "name": "united states&

python - How can I change the decorator function name dynamically to be able to understand cProfile reports? -

Image
my problem following, 1 - created functools.wraps decorator function log runtime information. i choose use functools.wraps because supposed update wrapper function wrapped function . so, decorator this: def log_execution(logger): def _log_execution(method): @functools.wraps(method) def _logged_execution(*args, **kwargs): logger.log('log info') return method(*args, **kwargs) return _logged_execution return _log_execution 2 - then, considering decorated of functions that: # create logger current_logger = create_logger('logger test') # function func_a , sub functions def func_a(): func_a1() func_a2() @log_execution(current_logger) def func_a1(): ... @log_execution(current_logger) def func_a2(): ... # function func_b , sub functions def func_b(): func_b1() func_b2() @log_execution(current_logger) def func_b1(): ... @log_execution(current_logger) def func_b2():

c# - Project oxford vision API ocr exception -

got problem project oxford vision api. example project oxford git works fine , recognise text on images. code throws exception: exception of type 'microsoft.projectoxford.vision.clientexception' thrown. @ microsoft.projectoxford.vision.visionserviceclient.handleexception(exception exception) @ microsoft.projectoxford.vision.visionserviceclient.b__39_1[trequest,tresponse](exception e) @ system.aggregateexception.handle(func 2 predicate) @ microsoft.projectoxford.vision.visionserviceclient.<sendasync>d__39 2.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.projectoxford.vision.visionserviceclient.d__32.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.

dynamic - On viewPager in Android is there way show large number of fragments? -

i have viewpager using fragmentpageadapter page count 3. in application have list of numbers. suppose numbers 99, 33, 44, 12, 7, 55, 77, 88, 45 i populate 3 numbers onto 3 fragments, 12, 7, 55. @ present, @ app start, number 12 shows up. user swipes right , 7 shows , 55. is there way on further swipe right fragment appears showing next number 77, , if user swipes left goes 55, 7, 12. if user swipes left again, starts seeing next fragment 44, 33, etc. in way manage data window 3 numbers. fragments should appear if animated left or right when not there. is possible in android? also, please note more data dynamically generated, not have count on overall number display. let me make question bit clearer. initial list has 12, 7, 55. these shown in viewpager. if 12 showing up, , user swipes right, gets see 7, , 55 (ok far). now, if user swipes right 1 more time, app gets more data (77, 88, 45) , shows up. if now, user swipes left, sees 77, 55, 7, 12. beyond 12, if swipe

javascript - Add more input fields when user press button in jquery -

Image
i new in jquery need help. have modal user enters title. when user enters title new div display div contains 1 input filed or 1 addmore button when user click on addmore button new input fields open. want user add upto 18 more fileds after user shows alert message. here html code:- enter code here <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">add category</h4> </div> <div class="modal-body"> <h4>enter title</h4> <input type="text" name="title" class="getvalue"> <button type="submi

javascript - How validate input field in jquery function? -

i have input field not in form <input type="text" class="form-control" id="ruling-value" required> and button <button id="addbutton" type="button" class="btn btn-primary">add</button> and $('#addbutton').click(function () { var values = $("#ruling-value").val().split(','); //some code } }); i want validate ruling-value field when button onclick method getting called. if field empty, want show tool-tip or message it. how can it? simple add if() validate both null , empty .i updated answer bootstrap alert box updated bootstrap $('#addbutton').click(function () { $(".alert").hide() if($("#ruling-value").val()) { $(".alert-success").show() } else{$(".alert-warning").show()} }); .alert{display:none} <link rel="styleshe

PHP session NOT captured -

i developed own login.php, however, login success session not being captured. every time proceed link, bring me login.php , demand me re-login again. did try using $_session (as commented) come out login page unable login entirely. thank in advance below code <?php error_reporting(e_all); ini_set("display_errors", 1); if ($_server["request_method"] == "post") { $uid = $_post["uid"]; $password = $_post["password"]; } include("src/db.php"); session_start(); if(!isset($uid)) { //if(!isset($_session['$uid'])){ ?> <my html code -- let me know if need check html well> <?php exit; } dbconnect("mydb"); $sql = "select * sys_user username = '$uid' , password = '$password'"; $result = pg_exec($sql); $dept_id = pg_result($result,0,"dept_id"); if (pg_num_rows($result) == 1) { $_session['uid'] = $uid; $_session['password

angular - How to view child in angular2 and what it is for? -

Image
have been using jqgrid angular2 while following thier document. 2: found code, here , copied thier in file have come across type error in screen shot , not sure that.can suggest supress please.thanks.

python 2.7 - How can I make ensure caffe using GPU? -

is there way ensure caffe using gpu? compiled caffe after installing cuda driver , without cpu_only flag in cmake , while compiling cmake logged detection of cuda 8.0. but while train sample, doubt using gpu according nvidia-smi result. how can ensure? the surest way know configure solver.prototxt file. include line solver_mode: gpu if have specifications engine use in each layer of model, you'll want make sure refer gpu software.

c# - Closing channel drops the queue: how to avoid it -

in rabbitmq, using c# client, when close imodel.close() (i.e. a channel ), target queue gets dropped. i can't figure out how can prevent behavior after trial-errors. the whole queue durable , server isn't restarted. queue dropped... it easy solve: channels should both durable , have autodelete set false when they're declared. same goes queues.

Serial number to timestamp in excel -

i have numbers 20160715082219000000000 , want convert timestamp 2016-07-15 08:22:19 , delete remaining 0 's.please suggest how conversion in excel? use following formula number in cell a1 =date(left(a1*10^-9&"",4),mid(a1*10^-9&"",5,2),mid(a1*10^-9&"",7,2))+time(mid(a1*10^-9&"",9,2),mid(a1*10^-9&"",11,2),mid(a1*10^-9&"",13,2)) this output number represents date , time, 20160715082219 represented 42566.34883 . apply custom formatting cell (right click>format cells>custom) , type following string in type: field yyyy-mm-dd hh:mm:ss and result: 2016-07-15 08:22:19 as required

batch file - How to get Visual Studio to recognise a network drive mapping -

i have following post-build event defined in project: if "$(configurationname)"=="release" ("$(projectdir)postbuildrelease.bat" "$(targetdir)") so when build project in release mode, following .bat file executed: postbuildrelease.bat cmd set parameter=%1 cd %1 echo "copying temporary file..." copy filedeleter.exe temp.exe echo "merging dependancies..." "..\..\ilmerge.exe" /out:"filedeleter.exe" /targetplatform:"v4" "temp.exe" "microsoft.windowsapicodepack.dll" "microsoft.windowsapicodepack.extendedlinguisticservices.dll" "microsoft.windowsapicodepack.sensors.dll" "microsoft.windowsapicodepack.shell.dll" "microsoft.windowsapicodepack.shellextensions.dll" echo "removing temporary file..." del temp.exe all copy assembly temporary location, merge required dependancies final executable filedeleter.exe , , removes tempo

rest - Using yeoman (generator-loopback-angular-ui-router) to build new project -

Image
i used yeoman (generator-loopback-angular-ui-router) build new project. when run node . start /api routes, grunt server review on server error: now how config connect rest api?

JavaScript Automation -

i using code change color of traffic lights on button click, how can change run sequence automatically once button clicked , repeat indefinitely? var lightstates = {red:0,amber:1,green:2}; var currentstate = lightstates.red; document.getelementbyid('changebtn').onclick=function(){ changestate(); }; function changestate() { clear(); switch(currentstate) { case lightstates.red: { document.getelementbyid("red").classname ="light red"; currentstate = lightstates.amber; } break; case lightstates.amber: { document.getelementbyid("amber").classname ="light amber"; currentstate = lightstates.green; } break; case lightstates.green: { document.getelementbyid("green").classname ="light green"; currentstate = lightstates.red; } break

php - TYPO3 & MAX_JOIN_SIZE error via Shared Server - Possible Workaround? -

i have multiple joins work fine. combined them , following error: sqlstate[42000]: syntax error or access violation: 1104 select examine more max_join_size rows; check , use set sql_big_selects=1 or set max_join_size=# if select okay i'm on hosted shared server ... there way set sql_big_selects=1 in typo3? e.g. in localconfiguration.php <?php return array( ... 'db' => array( 'database' => 'database', 'exttablesdefinitionscript' => 'exttables.php', 'host' => 'password', 'password' => 'password', 'port' => port, 'username' => 'port', 'init_commands' => array( 'big_selects' => 'set sql_big_selects=1', ), ), ... ); ?>

operating system - Python thinks file is still a .py when it is .exe -

got weird behavior here. using import os find path of exe file , use path in batch file move exe file. i've used pyinstaller make program exe. now here issue occurs. os commands works well, thinks file still .py odd because made variable: dirname = os.path.abspath(__file__) now, finds correct directory , correct file name(but not file type) use variable write down directory file in this: move.write('move /y "' + str(dirname) + '" (code continues here, not important) this works when file .py not when .exe i hope makes sense, feel free ask and/or edit if unclear. current output: system cannot find file specified. wanted output: 1 file(s) moved. you can specify extension want way: files = os.listdir('/your/directory') filename in files: if filename.endswith(".exe"):#or extension want #copy file want

jquery - combining removing of numbers and underscores regex javascript -

i awful @ regex, , have been trying teach myself. in order practice trying remove numbers , underscores string. i have been able remove numbers following, combination of both bamboozling me. var name = $(this).attr('id').replace(/\d+/g, ''); i not sure how combine two. following 1 of many efforts no avail. var name = $(this).attr('id').replace(/\d+/\/_/g, ''); you need use character class [\d_] match digit or underscore. here small demo: console.log("some_1234_6789 demo.".replace(/[\d_]+/g, ''))

android - Center TextView in custom ActionBar horizontally -

a want create custom actionbar app name in center of still aligned left. here xml of custom_actionbar.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:background="@color/transparent"> <textview android:id="@+id/nav_bar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@color/transparent" android:singleline="true" android:textcolor="@color/sue_green" android:text="@string/app_name" an

javascript - Interpolating the chart data -

im using following code create chart using high charts. function loadgroup() { $(function() { $('#container').highcharts({ colors: ['#f32d2b', '#f0f468', '#f58835', '#a5d17a', ], chart: { type: 'bar', options3d: { enabled: true, alpha: 15, beta: 15, depth: 50, viewdistance: 25 }, backgroundcolor: 'rgba(255, 255, 255, 0.9)', renderto: 'histogram', }, title: { text: 'country' }, xaxis: { categories: ['uk', 'us', 'brazil', 'brunei', 'indonesoa'], labels: { usehtml: true, formatter: function() { var name

javascript - Changing interval of setInterval and all animations are run together -

i dealing following jquery contains multiple image animations.my query is, through setinterval , animation not run step step , doesn't maintain interval sometimes. 1st animation , 2nd animation runs together. how can resolve , run 3 animation step step in specific interval? can use settimeout ? if yes how? please excuse me if wrote incorrect interval time in following jquery beginner in jquery. $(document).ready(function() { var runanimate1 = true; var runanimate2 = false; var runanimate3 = false; setinterval(function() { if (runanimate1) { $("#animate1").fadein('slow').animate({ 'display': 'inline-block', 'margin-left': '220px', 'margin-bottom': '20px' }, 500, function() { $('.1st').animate({ 'opacity': '0' }, 1000, function() { $('.1st').animate({

node.js - Firing server-sent events on page load in NodeJS (ExpressJS) -

i have code: index.js: var express = require('express'); var router = express.router(); router.get('/', function(req, res, next) { res.writehead(200, { 'connection': 'keep-alive', 'content-type': 'text/event-stream', 'cache-control': 'no-cache' }); res.write('event: proba\ndata: ' + json.stringify({ msg: "asdqqqq" }) + '\n\n'); }); and ejs file rendered (not index.js) script within app: testing.ejs: <!doctype html> <html> <head> </head> <body> <script> var source = new eventsource('/'); source.addeventlistener("proba", function(e) { var jsondata = json.parse(e.data); alert("my message: " + jsondata.msg); }, false); </script> </html> my problem that, load ejs file in browser, message "asdqqqq" shows in alert, without loading "/

android - Set drawable for DividerItemDecoration -

divideritemdecoration divideritemdecoration = new divideritemdecoration(getcontext(), linearlayoutmanager.vertical); divideritemdecoration.setdrawable(getcontext().getresources().getdrawable(r.drawable.sk_line_divider)); hi all! trying set custom drawable (line) divideritemdecoration, no success. mistake? <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:width="1dp" android:color="#000000"> </stroke> </shape> change shape rectangle. ex: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:width="1dp" android:height="1dp" /> <solid android:color="@color/primary" /> </shape>

python - Argparse: Required argument 'y' if 'x' is present -

i have requirement follows: ./xyifier --prox --lport lport --rport rport for argument prox , use action='store_true' check if present or not. not require of arguments. but, if --prox set require rport , lport well. there easy way of doing argparse without writing custom conditional coding. more code: non_int.add_argument('--prox', action='store_true', help='flag turn on proxy') non_int.add_argument('--lport', type=int, help='listen port.') non_int.add_argument('--rport', type=int, help='proxy port.') no, there isn't option in argparse make mutually inclusive sets of options. the simplest way deal be: if args.prox , args.lport none , args.rport none: parser.error("--prox requires --lport , --rport.")

Spotfire Property Controls for color bars -

i trying use property controls on change values on graph associated color bar in spotfire. have no issues creating , using property control when apply color bar, automatically adds "sum" aggregation method - not want - , can't find way remove. has found way around this?

c# - Cannot compile project when declaring a XAML Resource Dictionary in code -

i've got resource dictionary called editorresources.xaml , contains following code: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:editors="clr-namespace:mycompany.editors"> <datatemplate x:key="passwordeditordatatemplate"> </datatemplate> </resourcedictionary> but when include line of code in class: private editorresources res = new editorresources(); it doesn't compile project. doesn't display errors list view in .net ide when @ output view, displays following error: error cs0246: type or namespace name 'editorresources' not found (are missing using directive or assembly reference?) but, don't believe reference missing both resource dictionary , class in same project (same level) , can see editorresources type highlighted type

spring integration - sftp:outbound-gateway moving file not working -

i new spring-integration. request me issue. i using sftp:outbound-gateway move file 1 folder folder. folder structure is: top-dir - module-dir - output-dir filexyz.txt - archive-dir i want move filexyz.txt output archive folder. configuration is: <int-sftp:outbound-gateway session-factory="ftpsessionfactory" expression="payload.remotedirectory + '/' + payload.filename" request-channel="inchannel" command="mv" rename-expression="payload.remotedirectory + '/' + payload.filename.replacefirst('output-dir','archive-dir')" reply-channel="outchannel"/> java code: directchannel movechannel = context.getbean("inchannel",directchannel.class); movechannel.send(new genericmessage<file>(new file("top-dir\module-dir\output-dir\filexyz.txt"))); i referred issue @ how replace string in spel expression? not solve problem. i getting

Google Analytics version 4 API java maximum results -

in google analytics api version 3 java there setmaxresults method: private static gadata executedataquery(analytics analytics, string profileid) throws ioexception { return analytics.data().ga().get("ga:" + profileid, // table id. ga: + profile id. "2012-01-01", // start date. "2012-01-14", // end date. "ga:visits") // metrics. .setdimensions("ga:source,ga:keyword") .setsort("-ga:visits,ga:source") .setfilters("ga:medium==organic") .setmaxresults(25) .execute(); } how can maxresults using google analytics api version 4? had brief scan through javadocs here , cannot find method this. i found answer question: request.setpagesize(6) gives max result needed.

android - GCM - Old Server key -

i have weird issue in android app uses gcm sending notifications user. initially, created new project on google console , activated gcm api. added json file app , server sending notification provided api key. few days back, created new project under new account. got new json file , new api key server. added new json file in app , added new api key in server script. issue is, devices notifications new key devices, still need send notification using old api key. these devices have updated application installed on them. i not able figure why happening. planning migrate fcm still figure out reason behind such behavior if in case repeats in future.

c# - How can we assign length for the regex Code in WPF XAML Code -

how can input length in regex code following code. can insert more 15 digits if use regex mask <dxe:buttonedit x:name="txtedtmobile" width="auto" maxlength="15" grid.column="2" grid.row="7" margin="2,2,2,2" validateontextinput="true" tooltip="searchcountrycode" mask="[+ 0-9]+" masktype="regex" /> see below lines, may you. in place of 256 can add digits want add. ^(?!^.{256})([a-za-z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-za-z0-9-]+.)+))([a-za-z]{2,4}|[0-9]{1,3})(]?)