Posts

Showing posts from February, 2012

ios - iMessage Extensions: How to specify the Email Subject or Add Text to the body of the email? -

i sending imessage imessage extension app contact has gmail address specified. here sample piece of code reflects parameters passed: msmessagetemplatelayout* layout = [msmessagetemplatelayout new]; layout.caption = @"my caption"; layout.trailingsubcaption = @"trailing subcaption"; layout.subcaption = @"sub caption"; layout.imagetitle = @"image title"; layout.image = image; // now, let's make message msmessage* message = [msmessage new]; message.url = myurl; message.layout = layout; [self.conversation insertmessage:message completionhandler:^(nserror * _nullable handler) { // continue ui actions }]; now, fields specified, show up, if receiving on iphone in imessage. however, if send message email contact (no phone numbers specified in contact profile), email has: 1. no subject. 2. none of fields above, except: image , url below image. so person unlikely click on link, because suspicious, n...

r - aggregate function fails in knitr but succeeds in console -

i have following r code: cleandata <- aggregate(x = stormdata[c("fatalities", "injuries")], = list(tolower(stormdata$evtype)), sum) it runs fine in r studio console, when copy/paste in chunk in knitr generates error: error in `$<-.data.frame`(`*tmp*`, "harm", value = c(15, 0, 2, 2, 2, 6, : replacement has 902297 rows, data has 898 calls: <anonymous> ... withvisible -> eval -> eval -> $<- -> $<-.data.frame i'm not sure why happening.

debian - Sensu does not seem to make a connection to a client -

i installed sensu 0.18.1 on debian 7.8.0 using chef. installation seems completed successfully, reason client not appear on uchiwa dashboard. the server log says "unsubscribing keepalive , result queues" warning. i'm not sure message means... and found message rabbitmq fails connection. seems connection once succeeded, fails in minute. doesn't make sense message means. /var/log/rabbitmq/rabbit@debiansensuserver.log =info report==== 24-aug-2015::20:01:30 === accepting amqp connection <0.9084.0> (127.0.0.1:59174 -> 127.0.0.1:5672) =error report==== 24-aug-2015::20:01:30 === closing amqp connection <0.9084.0> (127.0.0.1:59174 -> 127.0.0.1:5672): {bad_header,<<129,15,1,3,3,0,246,0>>} how fix problem , show client on uchiwa dashboard? i have poor knowledge field, suggestions highly appreciated. /var/log/sensu/sensu-server.log {"timestamp":"2015-08-24t19:38:15.089922-0400","level":"warn...

io - How to create a .txt file in Python? (Pycharm) -

in previous post, asked how create new file written in if didn't exist. however, i've tried in pycharm, , it's not working. don't see sign of file lookhere.txt my_list = [i**2 in range(1,11)] openfile = open('lookhere.txt', 'w') item in my_list: openfile.write(str(item) + "\n") openfile.close() what doing wrong? have pycharm's use of projects? the text file created in pycharm project folder, suggested. if want go elsewhere, desktop instance, this: f = open('path_to_desktop/file.txt', 'w') note: tested on own system. able project path right-clicking folder in project window(on right), , clicking 'copy path' menu pops up. edit: assume since accepted answer, worked out eventually(though please, other questions, comment). wanted add, @thaneplummer mentioned, it's better practice use statement when opening files. 1 reason being files auto-closed you! google ;)

javascript - Loading Angular from another file -

i have js code this: switch(sc.article.type) { case articletypes.text: template = "<div class='form-group'><div class='input-group' ng-show='article.suffix'><input class='form-control' type='text' ng-model='article.response'/><div class='input-group-addon'>{{ article.suffix }}</div></div><input class='form-control' type='text' ng-model='article.response' ng-show='!article.suffix'/></div><p class='help-block'>{{article.help}}</p>"; break; case articletypes.number: ... etc i think structured more nicely. example, each sc.article.type put html code template in own html file rather trying define in-line. but how can that? $templatecache service of angularjs helpful you. first put possible templates in $...

X-Forwarded-Proto for Rails behind nginx behind ELB -

Image
i'm pretty stuck thing couple of hours. no way make working. tried can think of and/or found online. so, application pointed elb (web). elb listens 80 , 443 , sends traffic 80 (ssl terminated here) member instance(s) nginx. nginx proxies app requests elb (app) in front of multiple instances. these instances run puma. everything works fine except when try visiting url (where used force_ssl controller) https scheme, redirection loop. here nginx configs like location @{{app_name}} { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-forwarded-proto $scheme; proxy_redirect off; proxy_pass http://{{app_name}}; # limit_req zone=one; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; } (obviously app_name gets substituted ansible.) instead of $scheme , tried hardcoding https , $proxy_add_x_forwarded_proto none worked me. still loop. then starte...

Can't Integrate Maven Into Eclipse via Plugin for Eclipse Luna 4.4.2 -

i'm @ wits end trying eclipse luna 4.4.2.20150219-0708 integrate maven. it's standard ee edition find on eclipse.org site. i have following repos listed "software sites" in "install new software wizard", in addition standard ones. http://download.eclipse.org/technology/m2e/releases http://ifedorenko.github.com/m2e-extras/ http://download.eclipse.org/m2e-wtp/releases/luna/1.1 i didn't cherry pick plugin install, instead installed every single thing came entering "maven" search box. "contact update sites during install find required software" tick box checked. i try uninstall these, things wizard tells me can't uninstall them because "other parts of system need them". think of these part of core install or something. uninstalling , reinstalling "maven" in name doesn't help. i have restarted eclipse, multiple times. maven installed on system, , have variables exported on system , maven works ...

Some BizTalk Receive Locations are disabled after server reboot -

it found biztalk receive locations disabled after server reboot (biztalk server , sql server separately installed different physical servers) is there idea on scenario? due boot sequence or other issues? i assume that, once enable receive locations manually, working correctly. typically, when file receive locations fail while pointing external server/share, because no longer available. make sure that, during night, there no network issues, planned/unplanned downtime of share (= here sql server). biztalk receive location retry access share quite while before disabling itself. check event log(s) more information. want errors/warnings there indicating issue connectivity between biztalk , sql. another issue might there many connections between biztalk server , sql server. can provide maximum number of connections in file share properties. also, try link: https://serverfault.com/questions/235032/intermittent-connection-to-windows-7-shared-folder-from-windows-xp-workst...

SAS DDE write multiple line in cell -

i want insert multiple line 1 cell, dde does't work directly put '0a'x. filename xlsheet1 dde "excel|c:\test.xlsx.report!r1.c1:r1.c3" notab; data _null_; file xlsheet1; = "test"; b = cat("&sysdate","-", "&systime"); c = translate("hello world", '0a'x, " ",); put '09'x b '09'x c ; run; only first part write in cell. any advice? hmm, thought there easier way, simplest thing working: filename xlsheet1 dde "excel|sheet1!r1c1:r1c1" notab; data _null_; file xlsheet1; = cat('="line1 " & char(10) & "line2"'); put a; run; basically convert value formula. use formula append text , use excel create carriage return. for work cell needs formatted 'wrap text' option. in fact, if go cell in excel , use alt-enter manually create carraige return, notice automatically t...

android - java.lang.UnsatisfiedLinkError: dlopen failed has no loadable segments -

i getting error when installing/debugging-->launching app in android studio system.loadlibrary(lib_name); error msg: w/system.err﹕ java.lang.unsatisfiedlinkerror: dlopen failed: "/data/app-lib/xxx/libmylib.so" has no loadable segments my lib folder: $ tree . ├── armeabi │   ├── libmylib.so │   └── libqp.so └── x86 └── libqp.so 2 directories, 3 files

node.js - Different database for production and development in nodejs -

i know ruby on rails has feature, , in railstutorial encourages it. however, have not found such thing in nodejs. if want run sqlite3 on machine can have easy use database access, postgres in production on heroku, how in nodejs? can't see find tutorials on it. thank you! edit: meant include node.js + express. it's possible of course, aware bad idea: http://12factor.net/dev-prod-parity if don't want go through hassle of setting postgres locally, instead use free postgres plan on heroku , connect local machine: database_url=url node server.j a .env file can make easier: https://devcenter.heroku.com/articles/heroku-local#copy-heroku-config-vars-to-your-local-env-file

SBT 0.13.0 - can't expand macros compiled by previous versions of Scala -

given following: src/main/scala/net/equals5.scala package net import scala.language.experimental.macros import scala.reflect.macros.context case class equals5(value: int) { require(value == 5) } object equals5 { implicit def wrapint(n: int): equals5 = macro verifyintequals5 def verifyintequals5(c: context)(n: c.expr[int]): c.expr[equals5] = { import c.universe._ val tree = n.tree match { case literal(constant(x: int)) if x == 5 => q"_root_.net.equals5($n)" case literal(constant(x: int)) => c.abort(c.enclosingposition, s"$x != 0") case _ => q"_root_.net.equals5($n)" } c.expr(tree) } } build.sbt val paradiseversion = "2.1.0-m5" scalaversion := "2.11.7" librarydependencies += "org.scala-lang" % "scala-reflect" % "2.11.7" librarydependencies += "org.scalatest" % "scalatest_2.10" % "3.0....

How to sort MySQL results and then get the ID of the latest 10 datetimes in PHP -

how can take id , timestamp results mysql $row[id] , $row[timestamp] , sort results , array of id's latest matching timestamps? if mysql database has data in it, 3,2015-08-24 10:38:31 , 34,2015-08-24 10:38:16 , 8,2015-08-24 10:38:51 i end array, of id's in order newest oldest timestamps. 8,3,34 here code information omitted. $servername = "ip:port"; $username = "username"; $password = "password"; $dbname = "db"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection database failed. please try again. error: " . $conn >connect_error); } $sql = "select id, timestamp posts order timestamp desc limit 1,10;"; $result = $conn->query($sql); $arrays = array(); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $arrays[] = $row[id]; } } foreach ($arrays $key => $id) { $servername = "ip:port...

javascript - looping with handlebar.js -

this question has answer here: how return response asynchronous call? 24 answers hi have following issue. i'm trying loop through each chapter output verse nothing display. <div class="content-placeholder"></div> <script id="built-in-helpers-template" type="text/x-handlebars-template"> {{#each chapter}} <ol> <li> {{ verse}}</li> </ol> {{/each}} </script> <script type="text/javascript"> $(function () { // grab template script var thetemplatescript = $("#built-in-helpers-template").html(); // compile template var thetemplate = handlebars.compile(thetemplatescript); // call template on array of objects var content = ""; jquery.ajax({ url:'https://getbible.net/json', datatype: 'jsonp', ...

Import Excel (xls) into SQL Server 2012 using SSIS -

i have issue in importing data excel sql server using ssis issue works when run package again (supposingly append more records in table shows error) could let me know need do? need configure package again or set on database ? here see on first run of package http://i.stack.imgur.com/ylnbx.jpg data have been imported correctly in sql http://i.stack.imgur.com/lwdgi.jpg but when run again show error, until truncate table. http://i.stack.imgur.com/bx4t7.jpg basically sqlite database used save data.android provides several ways store user , app data. sqlite 1 way of storing user data. sqlite light weight database comes android os. you can see link here.which contains code import exel sheet sqlite database . and code that: fileinputstream = new fileinputstream("excel file path in sdcard"); hssfworkbook wb = new hssfworkbook(is); hssfsheet sheet = wb.getsheet("test"); iterator<?> rowiterator = sheet.rowiterator(); int index = 0; ...

WINSOCK transmission in C++ loop -

i running server client winsock software transmit data in loop client server. there no problem in first transmission , perfect. second transmission , on corrupted , don't know if keep alive or else. spent 2 days trying figure out. server side #include"stdafx.h" #include <stdio.h> #include <stdlib.h> #include <winsock2.h> #include<windows.h> #include <time.h> #include"iostream" #include"string" #define maxline 1000 int main() { // initialize winsock wsadata wsadata; std::string message; int iresult = wsastartup(makeword(2, 2), &wsadata); if (iresult != no_error) printf("server: error @ wsastartup().\n"); // create socket listening incoming connection requests. socket socklisten; socklisten = socket(af_inet, sock_stream, 0); if (socklisten == invalid_socket) { printf("server: error @ socket(): %ld\n", wsagetlasterror()); wsacleanu...

sql server - Stored procedure execution is too slow -

i have stored procedure refer multiple tables (four specific i.e refurbref , activationdetailrefurb , activationdetailreplaced , replaceddata ) of approx 1 lac of data on each table. i need bind data stored procedure ui on front end. when tried executing stored procedure on sql server 2008 took 20 minutes execute , fetch result. there's no way user's going wait long gazing @ "please wait loading" user interface. this procedure: create procedure [dbo].[usplotfailuredetail] @fromdate varchar(50), @todate varchar(50), @vendorname varchar(50), @modelname varchar(50) begin select d.lotqty, approvedqty = count(distinct d.serialnumber), d.dispatchdate, installed = count(a.serialnumber) + count(r.serialnumber), doa = sum(case when datediff(day, coalesce(a.activationdate,r.activationdate), f.recorddate) between 0 , 10 1 else 0 end), bounce = sum(case when datediff(day, coalesce(a.activationda...

c# - Behaviour of nullable boolean -

why 2nd case not compile? there way make work overloading or sth? bool b1 = true; bool? b2 = false; if (b1) //does compile { //do sth. } if (b2) //doesn't compile { //do sth. } if (b2 == true) //does compile { //do sth. } the reason why third example works because of lifted operators . so: for equality operators == != a lifted form of operator exists if operand types both non-nullable value types , if result type bool. lifted form constructed adding single ? modifier each operand type. lifted operator considers 2 null values equal, , null value unequal non-null value. if both operands non-null, lifted operator unwraps operands , applies underlying operator produce bool result. so, that's why third example works - because of machinery has been invented , works all nullable types. your second example could have been made work have required compiler perform special work one nullable type - bool? . it's not appropriate, in...

Volley send JSONObject to server with POST method -

i want send jsonobject below format server using volley library { "user_id": 12, "answers": { "11": 3, "12": 4, "13": 5 } } jsonobject object = new jsonobject(); try { object.put("user_id", user_id); jsonobject answers = new jsonobject(); (int = 0; < questions.size(); i++) { jsonobject answer = new jsonobject(); answer.put(questions.get(i).getid(),questions.get(i).getanswer()); answers.put("answers", answer); object.put("answers", answer); } } catch (jsonexception e) { e.printstacktrace(); } if want use stringrequest how should send jsonobject server using post method you can use following working samp...

android - Does uses-feature limit App Store Downloads -

i can seem find on google, if add setting manifest uses-feature android:name="android.hardware.bluetooth_le" android:required="true" will non ble devices such less 4.3 able still download app off store? regards if set android:required="true" devices without feature not able see or download application play store. if app available devices without ble feature declare feature android:required="false" . in case have check manually if feature available or not. please check http://developer.android.com/guide/topics/manifest/uses-feature-element.html#market-feature-filtering , https://developer.android.com/guide/topics/connectivity/bluetooth-le.html more details.

.net - javascript [].some() in c# -

does equivalent of javascript array.some() function exist in c#? yes there is: any var foo = new object[10]; var = foo.any(x => x != null);

c++ - undeclared identifier using arrayfire -

i write function using arrayfire that: int abc() { static const int q = 5; double a[] = { 0.0, 1.0, 0.0, 1.0, 1.0}; double b[] = { 0.0, -1.0, -1.0, 1.0, 0.0 }; array c (q, 1, a); array d (q, 1, b); return 0; } when try call function as: abc() in main program , try extract variables c , d , want print them using af_print(c) , gives error: error c2065: 'c' : undeclared identifier error c2065: 'd' : undeclared identifier intellisense: identifier "c" undefined intellisense: identifier "d" undefined the main function is: #include <cstdio> #include <math.h> #include <cstdlib> #include "test.h" // test.h contains function abc() , // arrayfire.h , // using namespace af; int main(int argc, char *argv[]) { abc(); // function // here calling variables defined in abc() af_print(c); af_print(d); #ifdef win32 // pause in windows if (!(argc == 2 && argv[1][0] == '-')) { printf("hit [e...

php - password_verify() is not working with simple code -

here code have used , similar code used login works perfectly. $password=$get_data[0]['password']; $pass=$this->input->post('password'); if (password_verify($pass, $password)) { $get_data_count=1; $this->session->set_userdata('user_name',$get_data[0]['contact_name']); $this->session->set_userdata('user_email',$get_data[0]['contact_email']); $this->session->set_userdata('user_id',$get_data[0]['id']); } else { $get_data_count=0; } it never enters in if loop.but login section have used similar code , work perfectly.and 1 more thing have used option $options = array('cost' => 11); password hash please help.

node.js - mongoose update : $inc is not working in upsert -

i trying update document if exist or insert if not exist.i have 1 field $inc,( want increment previous value one). code var appuser = new appusers({ imei: req.body.imei, $inc : {user_count:1}, install_flag : 1 }); var upsertdata = appuser.toobject(); delete upsertdata._id; appusers.update({imei: appuser.imei}, upsertdata, {upsert: true}, function(err, data){ if(err) return console.log(err); res.send(data); }); only $inc not working. in schema have user_count : { type:number, default:0} i'd suggest this: appusers.update({imei: appuser.imei}, {$set: {imei: req.body.imei, install_flag : 1}, $inc : {user_count:1}}, {upsert: true}, function(err, data){ if(err) return console.log(err); res.send(data); }); or if want use object: var upsertdata = { $set: {imei: req.body.imei, install_flag : 1}, $inc: {user_count: 1} }; appusers.update({imei: appuser.imei}, upsertdata, {upsert: true}, function(err, data){ if(err) return con...

javascript - Popup window inside php code -

i'm trying table pressing on id, opens popup window, menu, example, change row values, add comments.. have problem generating link each row: foreach ($results $row) { // each $row row query $rowid = $row->id; echo '<tr><td>'; echo '<a href="#" onclick="javascript:window.open("http://192.168.210.140/todolist/controls-menu?funnelid="'.$rowid.',"controls menu","width= 700,height= 500,toolbar= no,location= no,directories= 0,status= no,menubar= no,scrollbars= no,resizable= yes,left= 400,top= 150,screenx= 400,screeny= 150");">'.$rowid.'</a>'; maybe it's need add <script type="text/javascript> ... script when pressing <a href="#"> </script> but have no idea, how detect script link pressed, example http://192.168.210.140/todolist/controls-menu?funnelid=999 or http://192.168.210.140/todolist/controls-menu?funnelid=1100 p.s. i...

python - Pandas IndexError for large dataframe -

when try add new column large dataframe indexerror. can me error? >vec 0 1 2 3 4 5 6 v1.uc8.0 0 0 0 0 0 0 0 v1.uc48.0 0 0 0 0 0 0 0 7 8 9 ... 2546531 2546532 2546533 v1.uc8.0 0 0 0 ... 0 0 0 v1.uc48.0 0 0 0 ... 0 0 0 2546534 2546535 2546536 2546537 2546538 2546539 2546540 v1.uc8.0 0 0 0 0 0 0 0 v1.uc48.0 0 0 0 0 0 0 0 [2 rows x 2546541 columns] > vec['todrop']=0 indexerror traceback (most recent call last) <ipython-input-40-9868611037ed> in <module>() ----> 1 vec['todrop'...

How do you estimate the scale parameter for a random parameter logit using mlogit in R -

i trying estimate random parameter logit/mixed logit model using mlogit package in r. model looks this, wlsq.obese_conf.model <- mlogit(formula = choice ~ noadveff + tab + infreq_1 + weightloss + i(weightloss^2) + optout + cost| -1 | 0, data = mlogit.obese_conf, rpar = c(noadveff = 'n', tab = 'n', infreq_1 = 'n', weightloss = 'n', optout1 = "n"), r = 100, halton = na, print.level = 0, panel = true, estimate = true, weights = weighting.x ) i running same model on different subsample, , need compare scale parameters between 2 subsamples. however, have not been able identify method extracting parameter - know how can in mlogit ?

c# - Get wwwroot folder path from ASP.NET 5 controller VS 2015 -

sorry noob question, seems can't server.mappath controller. need output json file list images folder @ wwwroot. @ wwwroot/images. how can reliable wwwroot path? using system; using system.collections.generic; using system.linq; using system.threading.tasks; using microsoft.aspnet.mvc; using www.classes; using system.web; namespace www.controllers { [route("api/[controller]")] public class productscontroller : controller { [httpget] public ienumerable<string> get() { folderscanner scanner = new folderscanner(server.mappath("/")); return scanner.scan(); } } } server.mappath seems not available system.web namespace. project using asp.net 5 , dotnet 4.6 framework you need inject ihostingenvironment class have access applicationbasepath property value: read dependency injection . after injecting dependency, wwwroot path should available you. example: private readonl...

email - Does the Win 10 UWP EmailMessage API support having an HTML body? -

i have tried following code send email universal windows platform app. works fine when use emailmessagebodykind::plaintext . however, indicated in code below, emailmessagebodykind::html seems launch email client no content. know else needs set work - documentation sparse 8 ( using namespace windows::storage::streams; using namespace windows::applicationmodel::email; using namespace windows::security::cryptography; auto bin = cryptographicbuffer::convertstringtobinary( l"<html><body>this <b>is</b> text</body></html>", binarystringencoding::utf16le); auto memstream = ref new inmemoryrandomaccessstream(); concurrency::create_task(memstream->writeasync(bin)).then( [memstream](unsigned) { auto email = ref new emailmessage(); email->to->append(ref new emailrecipient(l"test@gmail.com")); email->subject = l"email report"; auto randomaccessstreamreference = random...

php - radio button cannot empty -

this code radio button. want add condition, when 1 radio button not selected user, come out warning there data empty. when complete, count sum. <form action="" method="post"> player 1: male <input type="radio" name="gender[1]" value="1"> female <input type="radio" name="gender[1]" value="2"> <br> player 2: male <input type="radio" name="gender[2]" value="1"> female <input type="radio" name="gender[2]" value="2"> <br> player 3: male <input type="radio" name="gender[3]" value="1"> female <input type="radio" name="gender[3]" value="2"> <br> <input type="submit" name="submit" value="submit"> </form> <?php if (isset($_post['submit'])) { $sum=0; if (isset($_post['g...

html - When will a div collapse when applying CSS style? -

sometimes div collapses when styling. i've known floating children make parent div collapsed , same margins shared 2 divs . some demos is there other case make div collapsed when using css? by collapsed mean want make parent div visually contain children? second box in example. if so, solution clear elements after float. just add: .container{ clear:both; } .children { float:left; }

android - LatLang value of the physical center in the visible GoogleMap region considering mercator projection -

Image
i want calculate center , radius of circle in middle of screen radius being half of width of visible region. visibleregion.latlngbounds.getcenter() or cameraposition.target values center has offset physical center when zoom out lot. in following picture calculated black shaded circle follow: visibleregion visibleregion = mmap.getprojection().getvisibleregion(); latlng nearleft = visibleregion.nearleft; latlng nearright = visibleregion.nearright; mcircle.setcenter(visibleregion.latlngbounds.getcenter()); mcircle.setradius(distancefrom(nearleft.latitude, nearleft.longitude, nearright.latitude, nearright.longitude) / 4); public double distancefrom(double lat1, double lng1, double lat2, double lng2) { // return distance between 2 points, stored 2 pair location; double dlat = math.toradians(lat2 - lat1); double dlng = math.toradians(lng2 - lng1); double = math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.toradians...

java - Is it more efficient to use the class, e.g. Hashtable than the interface, e.g. Map? -

will compiler generate better code if knows actual class working vs interface? for example, refer actual class so: hashtable<string,string> foo() { hashtable<string,string> table = new hashtable<string,string>(100); .... return table; } ... hashtable<string,string> tbl = foo(); vs map<string,string> foo() { map<string,string> table = new hashtable<string,string>(100); .... return table; } ... map<string,string> tbl = foo(); will first form more efficient? ok, summarizing answers now. wish mark both thomas , tagir correct, can't. thomas correct in "correct" behavior use abstract interface (map) rather concrete implementation (hashtable). proper abstraction of data , allows underlying implementation changed @ will. tagir correct in exposing concrete class allows compiler optimizations -- possibly highly significant optimizations. however, knowing if work or not requires...

java - Error when trying to create a Hive table using a custom SerDe -

i have file containing data needs uploaded hive table. wrote custom serde (which modification of regex serde available hive) me upload data. this serde wrote package my.hive.customserde; public class fiasc2 extends abstractserde { public static final log log = logfactory.getlog(fiasc2.class.getname()); int colwidths[] = {1, 10, 6, 12, 8, 14, 16, 6, 6, 2, 10, 10, 19, 2, 2, 6, 8, 1}; string outputformat = "%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s %10$s %11$s %12$s %13$s %14$s %15$s " + "%16$s %17$s %18$s"; int datetimecols[] = {5}; int datecols[] = {17}; string cols; int numcolumns; int totalcolwidth = 0; list<string> columnnames; list<typeinfo> columntypes; arraylist<string> row; structobjectinspector rowoi; object[] outputfields; text outputrowtext; @override public void initialize(configuration conf, properties tbl) throws serdeexception { log.debug(...

java - why jstack not working when the /tmp/.java_pid<num> socket file has been deleted -

usually, use jstack check if java process working normally. while found, when /tmp/java_pid<num> (the num pid of java process) socket file has been deleted, jstack not work. this: [xxx]$ jstack -l 5509 5509: unable open socket file: target process not responding or hotspot vm not loaded -f option can used when target process not responding (ps. didn't want use "-f", there may other problems) is there way change socket file location(not /tmp)? or generate socket file again when found not existed? did restart java process again, bad solution. thanks! /tmp/.java_pid socket used hotspot dynamic attach mechanism. way how jstack , other utilities communicate jvm. you cannot change path - hardcoded in jvm source code. neither can force jvm regenerate it, because attach listener initialized once in hotspot lifetime. jstack -f works in quite different way . in order check whether java process works fine, suggest using jmx remote .

osx - How to access Redis running in Vagrant Virtual Machine -

Image
we trying use vagrant run redis server on mac (using ubuntu guest os) vagrantfile sadly unable access redis database inside vagrant box. we error: error: redis connection 127.0.0.1:6379 failed - read econnreset this network configuration in virtualbox vm: what else need add vagrantfile expose redis mac? (note: reason using vagrant both let people try redis without having install on main os, more importantly ensure other elements of app run expected) this may helpful https://serverfault.com/questions/248248/cannot-connect-to-redis-installed-on-virtualbox-running-ubuntu-from-windows-7 . know question connecting windows, solution modifications redis config within vm in order not bind redis local port in redis.conf can accessed on host machine(mac in case). also, depending on how trying access redis may able configure ssh tunnel on host machine(mac) in order gain access redis server within vagrant vm. ended going route case connect redis inside of vagrant vm ...

recursion - Most elegant way to save only primitive properties of a Javascript object -

i have object lots of own , inherited methods. need make simple snapshot of primitive properties. what's elegant way how it? javascript snippet function copy(source) { var target; if (source) { target = {}; (var key in source) { var prop = source[key], type = typeof prop; if (type === "string" || type === "number" || type === "boolean") { target[key] = prop; } if (type == "object") { target[key] = copy(prop); } } } return target; } with underscore.js function copy(source) { var target; if (source) { target = {}; _.filter( _.keys(source), function( key ) { var prop = source[key]; if (!_.isfunction(prop) && !_.isobject(prop)) { target[key] = prop; } if (_.isobject(prop)) { ta...

c# - Localization of dynamic rendered user control -

im using following code load page dynamically javascript [webmethod] [scriptmethod(responseformat = responseformat.json)] public string getsimplecontrol(string usercontrolname) { page page = new page(); usercontrol ctl = (usercontrol)page.loadcontrol(usercontrolname); page.controls.add(ctl); stringwriter writer = new stringwriter(); httpcontext.current.server.execute(page, writer, false); return writer.tostring(); } my problem is, it's not localized, uses default language. in user control i'm loading, try call initializeculture , set culture: system.threading.thread.currentthread.currentuiculture = cultureinfo how accomplish this? got work setting uiculture , culture of page. getsimplecontrol looks this [webmethod] [scriptmethod(responseformat = responseformat.json)] public string getsimplecontrol(string usercontrolname) { page page = new page(); page.culture = "en"; page.uiculture = "en"; use...

Differantiate devices with similar model and os version connected to computer with android studio -

Image
i have 3 tablets same model same android version. want able differ between devices quickly. show problem, is way differentiate them on combo box? thanks, ilan update : i have posted bug google this. problem to, vote bug here . try in device, homescreen -> press menu -> system settings -> applications -> development -> device name here can change devices name shown in android studio .

jquery - Responsive navbar toggle doesn't work properly -

i'd ask help. want make responsive navbar similar bootstrap's navbar doesn't work expected. here demo http://codepen.io/anon/pen/voodmg jquery: $(document).ready(function() { // toggle $("#navbar-btn").click(function() { $("#navbar-nav").toggle(2000); }); }); any suggestions? edit: previous issue fixed there responsive issue. if click button expand links click again hide , resize screen links don't appear. should do? remove ms $(document).ready(function() { // toggle $("#navbar-btn").click(function() { $("#navbar-nav").toggle(2000); }); }); http://codepen.io/anon/pen/lvwdzw

c# - How to specify SSTP usage in DotRas? -

i trying specify sstp connection in dotras - have found sample how - rasdevice device = rasdevice.getdevicebyname("(sstp)", rasdevicetype.vpn, false); if (device == null) throw new exception("cannot rasdevice"); rasentry entry = rasentry.createvpnentry(connectionname, serveraddress, rasvpnstrategy.sstponly, device); but in rasvpnstrategy there default , l2tpfirst , l2tponly , pptpfirst , pptponly fields availble. i have found : /// <summary> /// defines vpn strategies. /// </summary> public enum rasvpnstrategy { /// <summary> /// dials pptp first. if pptp fails, l2tp attempted. /// </summary> default = 0, /// <summary> /// dial pptp only. /// </summary> pptponly = 1, /// <summary> /// dial pptp first. /// </summary> pptpfirst = 2, /// <summary> /...

c# - IBodyModelValidator Are you missing a type mapping? -

i getting below error, reason. i have created 1 new controller, other controllers working fine. error: resolution of dependency failed, type = "system.web.http.validation.ibodymodelvalidator", name = "(none)". exception occurred while: while resolving. exception is: invalidoperationexception - current type, system.web.http.validation.ibodymodelvalidator, interface , cannot constructed. missing type mapping? ----------------------------------------------- @ time of exception, container was: resolving system.web.http.validation.ibodymodelvalidator,(none) and falling @ below line. public object getservice(type servicetype) { if (this.container == null) { throw new objectdisposedexception("this", "this scope has been disposed."); } try { return this.container.resolve(servicetype); } cat...

mysql - Get last_inserted_id - PHP - Wordpress -

is there way insert data in 2 tables @ same time , @ same moment id first table , insert second table in field named user_id let's say. tried it's not working. missing something? want because need have same ids of same records in 2 tables make update. thanks. global $current_user; get_currentuserinfo(); $user_id = $current_user->id; $table = 'tst_test'; $data = array( 'user_id' => $user_id, 'username' => $_post['fname'], 'email' => $_post['email'], 'telefon' => $_post['phone_number'] ); $format = array('%s','%s', '%s', '%s'); $send_data = $wpdb->insert($table, $data, $format); you can call $wpdb->insert_id after $wpdb->insert(_) , return last inserted id of the object, can use same second record. for more information on db operations of wordpress

I get this message when running my python in cmd "Indentation error expected an indented block expected" -

import random import time name=input("welcome game name") print(("this numbers game"),(name), ("you playing against computer")) print ("the idea of game closer computer 21 without going on 21") ,ready="n" ready = input("are ready play game?").lower if ready == "yes" or ready =="y": score=0 the error coming , saying line above while(score)<21 and(ready=="y" or ready == "yes" or ready =="yes" or ready == "yes" or ready =="y"): player1=random.randint(1,21) score=(score+player1) time.sleep(3) print(("you have scored"),(score)) if score<21: ready=input("do want add more score") if score>21: print("sorry on 21 went bust computer wins") else: print("ok done lets see computer gets") (ignore line please) computerscore=0 while(computerscore)<21 , (computerscore)<(score): computer...

javascript - how to multiply price with quantity -

i know question has been asked many times not find 1 fits contition. far have dynamically created table checkbox. rows checked put array futher processing , table generated conformation issue here unable multiply quantity price. (note - rows have same id's , names dynamic) code - <table class="table" id="mytable"> <thead class="text-danger"> <th>name</th> <th>price</th> <th>quantity</th> <th>select</th> </thead> <tbody> <?php while($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><?php echo $row["name"]; ?> <input type="hidden" name="proname" value="<?php echo $row["name"]; >" /> </td> <td class="text-warning"><?php echo $row["price"]; ?> <input type="hidden...

javascript - When should I used Douglas Crockfords implementation of "that"? -

in douglas crockford's article, private members in javascript , uses variable "that" refer "this" use in privileged method of class. have been using "this.publicmember" in code , seems work right. think time need use "that" if calling function "this" different, i.e. calling settimeout. when should use / not use "that" ? function container(param) { function dec() { if (secret > 0) { secret -= 1; return true; } else { return false; } } this.member = param; var secret = 3; var = this; this.service = function () { return dec() ? that.member : null; }; } versus: this.service = function () { return dec() ? this.member : null; }; he writes in article: by convention, make private that variable. used make object available private methods. then uses that everywhere, avoid issues unbound fu...

algorithm - Big-O analysis for a loop -

i've got analyze loop, among others, , determine running time using big-o notation. for ( int = 0; < n; += 4 ) ( int j = 0; j < n; j++ ) ( int k = 1; k < j*j; k *= 2 )` here's have far: for ( int = 0; < n; += 4 ) = n for ( int j = 0; j < n; j++ ) = n for ( int k = 1; k < j*j; k *= 2 ) = log^2 n now problem i'm coming final running time of loop. best guess o(n^2), uncertain if correct. can help? edit: sorry oh -> o thing. textbook uses "big-oh" first note outer loop independent remaining 2 - adds (n/4)* multiplier. consider later. now let's consider complexity of for ( int j = 0; j < n; j++ ) ( int k = 1; k < j*j; k *= 2 ) we have following sum: 0 + log 2 (1) + log 2 (2 * 2) + ... + log 2 (n*n) it note log 2 (n^2) = 2 * log 2 (n). re-factor sum to: 2 * (0 + log 2 (1) + log 2 (2) + ... + log 2 (n)) it not easy analyze sum take @ this post . using sterling's approximati...

hive - The type org.apache.spark.sql.SchemaRDD cannot be resolved -

i getting error when try below code in eclipse. sparkconf sparkconf = new sparkconf().setappname("simple hive app").setmaster("local"); javasparkcontext javasparkctx = new javasparkcontext(sparkconf); hivecontext hivecontext = new hivecontext(javasparkctx.sc()); //hivecontext.sql("show tables").collect(); i using below dependencies. <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-core_2.10</artifactid> <version>1.4.0</version> </dependency> <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-sql_2.10</artifactid> <version>1.4.0</version> </dependency> <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-hive_2.10</artifactid> <version...

Regex to Match All Whitespace After Word -

Image
i have strings this: "2015/08/this filename has whitespace .jpg" i need match whitespace characters in strings. have "2015/08/ , end " . i'm using sublime text 2 search , replace in sql db dump. i'm @ loss on how match. know can match whitespace \s , have no clue how contain groups. as per comment, expression should work for string has same number of opening/closing double quotes : \s+(?=(?:(?:[^"]*"){2})*[^"]*"[^"]*$) see demo here . look-ahead checking odd number of double quotes until end of file. another approach define boundary \g , trim beginning of match \k : (?:"\d{4}\/\d{2}\/|(?!^)\g)[^"\s]*\k\s(?=[^"]*") see demo the regex finds match: (?:"\d{4}\/\d{2}\/|(?!^)\g) - when substring starts numbers 2015/12/ or after successful match [^"\s]*\k - matches characters not whitespace or " , omits them due \k operator \s - here matches whitespace sy...