Posts

Showing posts from June, 2015

java - MainActivity is not public -

i getting weird error in androidmanifest.xml file saying "mainactivity not public. validate resource reference inside android xml files." not know how solve error. can me here? androidmanifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pixalstudio.javaclasses" > <uses-permission android:name="android.permission.access_network_state" > </uses-permission> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.

Java API for Google Analytics -

i've found great example here: https://developers.google.com/analytics/solutions/articles/data_over_time uses google.gdata, not google.api. credentials asking following: private static final string username = "username"; private static final string password = "password"; private static final string table_id = "table_id"; whereas in google.api, credentials needed following: private static final string key_file_location = "yourfile.p12"; private static final string service_account_email = "something@developer.gserviceaccount.com"; these 2 libraries (google.api , google.gdata) seem able similar things in fact different. meant username, password , table_id in first scenario? recommended java api google analytics? it recommended use google analytics java client libraries . example have pointed uses deprecated client login . you should use updated hello analytics api tutorial better example of using java api googl

R: reading in .csv file removes leading zeros -

i realize reading .csv file removes leading zeros, of files, maintains leading zeros without having explicitly set colclasses in read.csv. on other hand, what's confusing me in other cases, remove leading zeros. question is: in cases read.csv remove leading zeros? the read.csv , read.table , , related functions read in character strings, depending on arguments function (specifically colclasses , others) , options function try "simplify" columns. if enough of column looks numeric , have not told function otherwise, convert numeric column, drop leading 0's (and trailing 0's after decimal). if there in column not number not convert numeric , either keep character or convert factor, keeps leading 0's. function not @ entire column make decision, may obvious not being numeric may still converted. the safest approach (and quickest) specify colclasses r not need guess (and not need guess r going guess).

javascript - MVC 4 display/hide a textbox based on a checkbox check -

Image
new mvc--was never of front-end web developer (mostly backend), i'm not privy design on front-end. now, i'm trying use mvc without original webform knowledge...that being said, please give me pointers/links/good ideas on how handle following: i have textbox field want show/hide based on checkbox. have these fields in view @using (html.beginform()... should change attribute on text box in javascript or controller action? if use javascript, i'm having hard time getting values in beginform, if use controller action, i'm not sure how/what pass to/from in controller action. i using jquery if want manipulate dom. here example - view @using (html.beginform()) { @html.checkboxfor(model => model.mybooleanvalue) <br /> @html.textboxfor(model => model.mytextvalue) <br /> <input type="submit" value="submit" /> } <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.j

C# XML Serialization Not working -

i have following code supposed deserialize xml string class has of items in xml file, may not have them fine should assume null. when run following code using xml below leaves each value null. any pointers i'm going wrong thanks serviceresponse returnval = new serviceresponse(); try { xmlserializer serializer = new xmlserializer(typeof(serviceresponse)); stringreader sr = new stringreader(xmlresponse); namespaceignorantxmltextreader xmlwithoutnamespace = new namespaceignorantxmltextreader(sr); returnval = (serviceresponse)serializer.deserialize(xmlwithoutnamespace); } catch (exception ex) { throw ex; } [xmlroot("serviceresponse")] public class serviceresponse { public string requesttype { get; set; } public string applicationsender { get; set; } public string workstationid { get; set; } public string popid { get; set; } public string requestid { get; set; } public string referencenumber { get; set; }

windows 7 x64 - How to add 64 bit target platform in Delphi XE8? -

the files right click on target platform in project manager , select "add platform", when "add platform" item greyed out. is there way add 64 bit platform? this happen when migrating projects previous versions of delphi. try deleting dproj file , open dpr file. way handles upgrade process. if not, need create new project , add existing source files it. or can try editing dproj file enable win64 platform. <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup> ... <targetedplatforms>3</targetedplatforms> ... </propertygroup> ... <propertygroup condition="('$(platform)'=='win64' , '$(base)'=='true') or '$(base_win64)'!=''"> <base_win64>true</base_win64> <cfgparent>base</cfgparent> <base>true</base> </propert

Loading instance variables form a file in Typescript -

here's code: import fs = require('fs'); export interface answer { order: number, text: string } export class config { responses:answer[]; timestamp_column: string; name_column: string fromjsonfile(filename: string) { var filestring = fs.readfilesync(filename); var parsedfile = json.parse(filestring.tostring()); this.responses = parsedfile.responses; this.timestamp_column = parsedfile.timestamp_column; this.name_column = parsedfile.name_column; } mapanswertonum(answer:string):number { (var of this.responses) { if (a.text == answer) { return a.order;} } throw new error(`invalid response string ${answer}`); } } it reads in file: { "responses": [ { "value": 0, "text": "at loss explain it..."}, { "value": 1, "text": "have vague sense..."}, { "value": 2, "text": "pretty handle on it..."}, { &quo

python - How to stop a running function without exiting the Tkinter window entirely? -

i'm using python 2.7, , i'm trying write gui, having issues buttons. have running properly, assuming i've made mistake inputs or something, i'd way stop running function after hitting "go" button. code way long post here, simple example below. how make "stop" button break start function, not quit window entirely? maybe threading? i'm sort of new writing guis, , i'm not programmer, isn't area of expertise. the gui totally unresponsive while main function running. there must way simultaneously run function while allowing me change things in gui , hit buttons, i'm not sure how works. updates don't have implemented until next time "go" button hit though. import time tkinter import * class example: def __init__(self,master): self.startbutton = button(master,text='start',command=self.start) self.startbutton.grid(row=0,column=0) self.stopbutton = button(master,text='stop'

asp.net - Is using XSP4 from Mono behind Nginx as a reverse proxy production proof? -

when reading mono docs , says xsp not suited production: for getting started, familiar mono , asp.net, xsp ideal solution. keep in mind xsp limited server , useful acquainted asp.net , mono, support http 1.0 , not provide extensibility or configuration. we developing rest api, , thinking of following setup: linux server asp.net mono run in xsp4 nginx reverse proxy (which can handle load balancing, caching, static files, etc.) but i'm wondering whether remarks xsp not suited production apply configuration part, or performance? our performance demands large requests, not processing high number of requests (but if necessary, scale multiple instances of application in xsp4).

machine learning - What type of neural network would work best for credit scoring? -

let me start saying took undergrad ai class @ school know enough dangerous. here's problem i'm looking solve...accurate credit scoring key part success of business. rely on team of actuaries , statistical analysis suss out patterns in few dozen variables track each individual indicate may low or high credit risk. understand type of job neural nets great @ solving, is, finding high order relationships across many inputs human never spot , rendering decision or output on average more accurate trained human do. in short, want able input name, address, marital status, car drive, work, hair color, favorite food, etc in , credit score back. my question type or architecture neural network best particular problem. i've done bit of research , seems i'm generating questions faster i'm finding answers @ point. best i've been able come kind of generative deep neural network multiple hidden layers each layer able abstract 1 level beyond previous one. im assuming it&#

ipv6 - Find and set IP version within nginx configuration -

from can tell from list , there no dedicated nginx variable check if client connecting via ipv4 or ipv6, since server supports both. i'd set variable pass php within fastcgi.conf so: fastcgi_param ip_version $ip_version is there way determine ip version without using evil ifs , pass along? i'm aware can perform check within php, we'd use nginx if possible, while still maintaining stellar performance.

Best way to render two dimensional table in grails -

i need table displayed , headings, have 2 lists: list1 = [a, b, c, d, e, f, g] and list2 list of maps list2 = [ [from: a, to: a, val:20], [from: a, to: b, val:10], [from: a, to: c, val:30], [from: b, to: a, val:10], [from: b, to: b, val:40] ] the result should be from b c d e f g 20 10 30 - - - - b 10 40 - - - - - c - - - - - - - d - - - - - - - e - - - - - - - f - - - - - - - g - - - - - - - how can that? <table> <tr> <th>from</th> <th>to</th> <g:each in="${list1}" var="item"> <th>${item}</th> </g:each> </tr> <g:each in="${list1}" var="fromitem"> <tr> <td>${fromitem}</td> <td></td> <g:each in="${list1}" var

java - JDBC is throwing grammar error when the query is working in php myadmin -

i working on java website using jdbc mysql. here simple function fetch data sql, @override public list fetchmusic(string _uname, string _chnl_name) throws sqlexception { string sql = "select * `channel_songs` `uid` = " + " (select `id` `user` binary `uname` = ?)"+ " , `chnl_id` = (select `id` `channel` binary `chnl_name` = ?);"; connection conn = datasource.getconnection(); preparedstatement ps = conn.preparestatement(sql); ps.setstring(1, _uname); ps.setstring(2, _chnl_name); list<map<string, object>> musiclistsbychnl = jdbctemplate.queryforlist(string.valueof(ps)); return musiclistsbychnl; } so, when running this, getting error says, org.springframework.jdbc.badsqlgrammarexception: statementcallback; bad sql grammar [com.mysql.jdbc.jdbc4preparedstatement@3a4eb50a: select * `channel_songs`]; nested exception com.mysql.jdb

javascript - What it the right way to be noticed when an element with specific directive attribute has been removed from DOM? -

i'm trying find way noticed in case element added , removed dom. in case element removed need ng-model value of element. for example: <div tell-me-when-removed ng-model="sometitle"></div> <a ng-click="removethedivabove()"></a> i'm trying "sometitle" you can use scope.$on('$destroy', function() { //your stuff here });

Block users using their ip addresses in php -

actually have no practical experience using php other in locally hosted server. following video tutorial learn php , , there code block specific ip web site. thing want know here if works users have dynamic ip addresses or not? and, proper way block user? i'm glad if can explain more practical side of blocking users. thank you! <?php $http_client_ip = $_server['http_client_ip']; $http_x_forwarded_for = $server['http_x_forwarded_for']; $remote_address = $server['remote_addr']; if (!empty($http_client_ip)){ $ip_address = $http_client_ip; } elseif (!empty($http_x_forwarded_for)) { $ip_address = $http_x_forwarded_for; } else { $ip_address = $remote_address; } //block list contains ips should blocked. foreach ($block_list $block) { if ($block == $ip_address){ die(); } } ?> visitors can restricted accessing site using ip deny manager in cpanel or adding allow or deny code in .htaccess file. syntax follows: allows ip 1

php - Javascript alternative of jQuery.ajax() - facing errors -

this js object var datas = { name: "xyz", age:21, } var datas2 = json.stringify(datas); the below ajax request passing datas correctly $(function(){ $.ajax({ url:'two.php', type:'post', datatype:'html', data:{data:datas2} }); }); response in developer tools: array ( [data] => {"name":"xyz","age":21} ) now tried javascript ajax reuest var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { } } xmlhttp.open("post","two.php",true); xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded"); // xmlhtt

ruby on rails 4 - Can't output log in console with foreman -

i got rails 4.2.1 app running foreman 0.78.0 whenever try use "puts" log value in console, nothing append. try googling bit found no working solution. i tried add $stdout.sync = true in development.rb no result far (and yes restarted foreman) since app run angularjs, tend hard debug when append on server side without log. is there ways output log in console , fix this? know must config problem since of coworker can in same project. don't see difference between them , mine. here output i'm able see when start foreman. 09:53:15 web.1 | started pid 68370 09:53:15 worker.1 | started pid 68371 09:53:17 web.1 | [68370] puma starting in cluster mode... 09:53:17 web.1 | [68370] * version 2.11.2 (ruby 2.2.2-p95), codename: intrepid squirrel 09:53:17 web.1 | [68370] * min threads: 1, max threads: 4 09:53:17 web.1 | [68370] * environment: development 09:53:17 web.1 | [68370] * process workers: 2 09:53:17 web.1 | [68370] * phased restart avail

html - Jquery .click event handler not working for class selector in CHROME -

when try set same opacity mouseover when .click event occurs, doesn't work. what i've tried: -different selectors (li, menu:li, li:a, .li-navclass, nav-text) help appreciated. thank in advance! .container { position: absolute; background:url('../images/bgpic.png'); background-repeat: no-repeat; background-size: cover; margin: 0px; padding: 0px; height: 100%; width: 100%; } .wrapper { position: relative; margin: auto; padding: auto; height: 655px; width: 900px; } .titlehdr { margin: 0px; padding: 0px; display: inline-block; width: 897px; height: 110px; } .title-div { display: inline-block; position: relative; height: 100%; width: 90px; margin: 0px; padding: 0px; } .title { position: relative; top: 40px; margin: 0px; padding: 0px; font-size: 70px; color: white; font-family: mesquite std; letter-spacing: 1.2px; } .barandgrill-div { display: inline-block; ver

nfc - Writing NDEF message as raw binary -

i want write ndef message (containing text ndef record) nfc tag (mifare ultralight type 2) using apdu commands. tag has 4 byte memory banks starting form 0x00 0x2b. memory location should write raw binary representation of ndef message?

python - boundaries target-mouse walking pygame -

i have move player mouse. i'll explain better: when click screen , have target , hero moves actual position new one. have put boundaries , , i'm having problems. tried solution i'm posting here, when player hits boundaries gets stuck these boundaries. hero(player) class: def get_direction(self, target): ''' function: takes total distance sprite.center sprites target (gets direction move) returns: normalized vector parameters: - self - target x,y coordinates of sprites target can x,y coorinate pair in brackets [x,y] or parentheses (x,y) ''' if self.target: # if square has target position = vector(self.rect.centerx, self.rect.centery) # create vector center x,y value target = vector(target[0], target[1]) # , 1 target x,y self.dist = target - position # total distance between target , position

python - Can't build two dictionaries -

i want build 2 similar dictionaries same csv file (one mapping row[0] row[5], 1 row[0] row[6]. reason, can build one. whichever of these 2 lines run first, dictionary exists , want. other empty. no idea what's going wrong. mydict = {row[0]:row[5] row in csv.reader(g)} mydict1 = {row[0]:row[6] row in csv.reader(g)} i using python 3, , tried changing dictionary name , few other things. you cannot iterate on file twice without rewinding start. doing not efficient either; better not use dictionary comprehensions here: mydict1, mydict2 = {}, {} row in csv.reader(g): mydict1[row[0]] = row[5] mydict2[row[0]] = row[6] if insist, can use file.seek(0) put file pointer start; don't need re-create reader here: reader = csv.reader(g) mydict1 = {row[0]:row[5] row in reader} g.seek(0) mydict2 = {row[0]:row[6] row in reader}

angularjs - Call a controller -

i know it's possible "extend" controller in module controller in module using $controller() -service . but how extend controller in another module ?

interface - Input Signal Edge Detection on FPGA -

i trying interface virtex 4 (ml401) fpga , tiva c series board using 4 wire spi (cs, sclk, miso, mosi). tiva acts master , fpga slave. able receive spi data master , display data on leds present on fpga (method 2). however, need find rising , falling transitions of chip select signal (required application synchronization purposes). have tried many methods fifo's (that work in simulation) don't work on fpga, shown: note: spi_cs asynchronous spi chip select signal input fpga tiva board, while other signals (spi_cs_s, spi_cs_ss, spi_cs_h2l, spi_cs_l2h, etc) created internally on fpga. method 1) prc_sync_cs: process(clk) begin if (clk'event , clk = '1') spi_cs_s <= spi_cs; end if; end process prc_sync_cs; spi_cs_l2h <= not (spi_cs_s) , spi_cs; spi_cs_h2l <= not (spi_cs) , spi_cs_s; method 2)

java - IntelliJ IDEA javadoc F1 -

i want create javadoc code. android sdk showed in second line added in api level 3 (with link). how can or can't done normal javadoc? this example original source : public static final string android_id added in api level 3 64-bit number (as hex string) randomly generated when user first sets device , should remain constant lifetime of user's device. value may change if factory reset performed on device. note: when device has multiple users (available on devices running android 4.2 or higher), each user appears separate device, android_id value unique each user. constant value: "android_id" but can't see added information. need special javadoc generator it? refer oracle's link writing javadoc here so post pretty helpful

html5 - How can I make a HTML/CSS Slideshow Fill the screen as a background when pictures are different sizes? -

i have tried many ways keep running problem of have small pictures want cover page without replicating. images in simple cross fading slideshow made of html , css. if knows solution please help. code here https://www.codecademy.com/bytesurfer77914/codebits/lg1o3g/edit body { font-family: "helveticaneue-light", "helvetica neue light", "helvetica neue", helvetica, arial, "lucida grande", sans-serif; font-weight: 300; } .css-slideshow { min-width: 1024px; min-height: 100%; width: 100%; height: auto; } .css-slideshow figure { margin: 0; width: 100%; min-height: 100%; background: #; position: fixed; } .css-slideshow img { box-shadow: 0 0 2px #666; width: 100%; height: 100%; } .css-slideshow figcaption { position: absolute; top: 0; color: #fff; background: rgba(0, 0, 0, .3); font-size: .8em; padding: 8px 12px; opacity: 0; transition:

c++ - How to make a console inventory system dynamic -

i have inventory system stores "item" types abstract class. have derived class called "skates". program allows user add "skates" vector of "item" pointers. user input model , id of skates , create "skates" object parameters. use "item" pointer point "skates" object , add vector. when user wants edit "skates" object have dynamic_cast "skates" object , edit it. std::vector<item*> itemcollection; item * item = new skates("model1", 1); itemcollection.push_back(item); //to retrieve skates * skatestoedit = dynamic_cast<skates*>(itemcollection[0]); the problem facing account new derived class, "skateboard" class example. don't want create new method handle editing of "skateboard" class like: skateboard * skateboardtoedit = dynamic_cast<skateboard*>(itemcollection[0]); since mean everytime make new derived class need write same style of code

Is there a difference between PhoneGap and Cordova commands? -

i installed phonegap first time , browsed through docs. confuses me fact docs using command "phonegap" , "cordova". android platform guide: $ cordova create hello com.example.hello "helloworld" command line interface guide tells: $ phonegap create hello com.example.hello helloworld is there difference between 2 commands (resulting in different files , folder structures) or aliases same thing? http://phonegap.com/blog/2012/03/19/phonegap-cordova-and-whate28099s-in-a-name/ i think url explains need. phonegap built on apache cordova nothing else. can think of apache cordova engine powers phonegap. on time, phonegap distribution may contain additional tools , thats why differ in command same thing. edit: info added command difference , phonegap can while apache cordova can't or viceversa first of command line option of phonegap http://docs.phonegap.com/en/edge/guide_cli_index.md.html apache cordova options http://cordova.a

javascript - How to add on-click events to D3 axis ticks -

i want make y axis ticks clickable, can request data in background depending on tick clicked. my axis <g class="y axis" id="yaxis"> , inside there ticks this: <g class="tick" transform="translate(0,0)" style="opacity: 1;"> <line x2="-6" y2="0"></line> <text dy=".32em" x="-9" y="0" style="text-anchor: end;">1547</text> </g> i want able click text (ok if whole tick registers click) , able use value of ("1547" here) in function. i looked through previous questions without luck used them base: d3.js make axis ticks clickable how make axis ticks clickable in d3.js/dimple.js what tried so far have been successful in adding click event listener whole y axis not want. have not managed add listener each tick. idea might doing wrong? these work apply 1 listener whole axis svg.select(".y.axis").on(&qu

permissions - Plesk 12 does not create IUSR_site_name user -

in our plesk 9.5 installation plesk automatically created user iusr_site_name , example, subscription username afl , plesk created iusr_afl user . then, when need web users have read , write permissions server directory, example /httpdocs/data, give iusr_afl user read , write permissions. how can accomplish same plesk 12? how can give web user read , write permissions in order create , modify files in specific directories? have tried, plesk 12 not create iusr_afl user. thank help! plesk creates sites working in application pools working under iwpg_<user name> user. there setting on domain > hosting settings > "additional write/modify permissions" provide write permissions app pool's user.

javascript - Show or Hide html content with java script -

i want show or hide html java script if (condition) want able hide html when users use example firefox , show content when use browser. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> var nver = navigator.appversion; var nagt = navigator.useragent; var browsername = navigator.appname; var fullversion = ''+parsefloat(navigator.appversion); var majorversion = parseint(navigator.appversion,10); var nameoffset,veroffset,ix; // in opera, true version after "opera" or after "version" if ((veroffset=nagt.indexof("opera"))!=-1) { browsername = "opera"; fullversion = nagt.substring(veroffset+6); if ((veroffset=nagt.indexof("version"))!=-1) fullversion = nagt.substring(veroffset+8);

c# - Generate a polygon from an image mask? -

i have image mask (could format let's keep simple, let's represented 256x256 array of bools false means masked , true means not masked) containing single shape, way started go polygon outline of said shape? shape guaranteed closed (not on edges of picture) , guaranteed non masked region. so far i'm thinking of tackling way seems pretty naive i'm wondering if there's better solution (a third party library not option, i'm looking alternative / better algorithms, not dependencies). find masked pixels for each of those, ignore if doesn't have non masked pixel neightboor else pick point outline (i need outline "outside" area of interest, pick pixel in masked area , not in shape) is best 1 can assumine no other properties known shape? (shape complex , detailed, trying find lines isn't option). note in cases shape human.

Closing FrameLayout for a Fragment in Android App -

i'm working on simple android app self-learning project. i've got lot of functioning, , have main activity has framelayout , recyclerview , floatingactionbutton stuff going on inside of it. however, want make 1 of buttons in navigationdrawer open different view in framelayout using fragments . there way this, sort of making new fragment recyclerview , other stuff , putting recyclerview , floatingactionbutton in there? i tried doing (when appropriate navigationdrawer button clicked): statsfragment = new statsfragment(); fragmenttransaction transaction = getsupportfragmentmanager().begintransaction(); transaction.replace(r.id.rootlayout, statsfragment); transaction.addtobackstack(null); transaction.commit(); but caused app crash. pointers? is r.id.rootlayout layout or fragment component? if main activity has hard coded fragment (by hard coded mean declared in xml), no , can't change hard-coded fragment conte

printing - Run silent print via Chrome App in Kiosk mode -

does know way silent print via chrome app? i'm developing chrome app kiosk system runs chromium os. need print receipt via chrome app, did. problem print dialog box appears once print process started. is there way around this? if you're targeting kiosk mode apps, need set flag. specifically, --kiosk-printing i'm not 100% sure how on chrome os device in kiosk mode. maybe need set @ chrome://flags before switching kiosk mode.

Javascript object losing attribute -

i'm having bit of problem function: function create_enemies(rows, columns) { var i, j; var x_position = 0; var y_position = 0; var id = 0; enemies_array = new array(rows); (i = rows - 1; >= 0; i--) { enemies_array[i] = new array(columns); (j = columns - 1; j >= 0; j--) { x_position = j * (enemy_squadron_width / 4) + (ship_width / 2); y_position = * (enemy_squadron_height / 4); enemies_array[i, j] = { x : x_position, y : y_position, width : ship_width, height : ship_height, speed : 2, id : id }; id++; console.log("this one's fine: " + enemies_array[i, j].y); } } (i = rows - 1; >= 0; i--) { (j = columns - 1; j >= 0; j--) { console.log("this one's not fine: " + enemies_array[i, j].y);

I want to use hashmap in a java class which produces XML format, but I am getting JAXB exceptions -

Image
this java class have use hash map getting key-value: @xmlrootelement public class combo { private map<combo, list<combo>> businessdomainandbusinesssubdomainspair = new hashmap<combo, list<combo>>(); public map<combo, list<combo>> getbusinessdomainandbusinesssubdomainspair() { return businessdomainandbusinesssubdomainspair; } public void setbusinessdomainandbusinesssubdomainspair( map<combo, list<combo>> businessdomainandbusinesssubdomainspair) { this.businessdomainandbusinesssubdomainspair = businessdomainandbusinesssubdomainspair; } } but in angular code getting error on debug: i tried using linkedhashmap still getting error. can 1 please suggest solution this.

python - Retrieve SQLite result as ndarray -

i retrieving set of latitude , longitudinal points sqlite database this: cur = con.execute("select distinct latitude, longitude messagetype1 latitude>{bottomlat} , latitude<={toplat} , longitude>{bottomlong} , longitude<={toplong}".format(bottomlat = bottomlat, toplat = toplat, bottomlong = bottomlong, toplong = toplong)) however, supposed make convexhull ( http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.convexhull.html#scipy.spatial.convexhull ) has ndarray input, need save results cur ndarray. how that? right fetch values : positions = [[floats(x[0]) floats(x[1])] x in cur] is correct? you don't need convert positions ndarray. scipy.spatial.convexhull can accept list of lists well: import scipy.spatial spatial hull = spatial.convexhull(positions) also, if messagetype1 table has latitude, longitude fields of type float, should not need call float explicitly. instead of positions = [[floats(x[0]) float

java - Restore the previous session, when browser back button is clicked, Wicket -

let's there int x = 10 in session, when click link, change it's value x++ in link click event. is there way, in which, if hit browser button, session restored previous version. meaning, in case, x 's value 10, initial value. you talking history, not different sessions. history implemented history tokens. check out guide gwt: http://www.gwtproject.org/doc/latest/devguidecodingbasicshistory.html

regex - javascript regexp both character is optional but merely one is invalid -

i have string checking regular expression in javascript. string can contain +8 or 8 or can empty string. cannot contain merely + sign. these valid: +8 or 8 or ( 3rd 1 indicates empty string) this invalid: + the code have tried: var x=/^\+?(8)?$/.test("+8")? 'ok':'not'; document.write(x); everything ok code. problem that, code returns true if string contains only + sign , should false. how implement have wanted? try - ^(\+?8)?$ testing - > /^(\+?8)?$/.test("+")? 'ok':'not'; "not" > /^(\+?8)?$/.test("+8")? 'ok':'not'; "ok" > /^(\+?8)?$/.test("")? 'ok':'not'; "ok"

java - Android - Create a instance of a class and calling from String -

i trying create instance of class fragment activity in android. the main fragment (what calling adapter) this- import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; public class tab3 extends fragment { @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view v = inflater.inflate(r.layout.tab_3,container,false); return v; } } and doing in fragment adapter calling class. so if calling it- tab3 tab3 = new tab3(); return (fragment) tab3; and working fine. need dynamic, because need have dynamic tabs names stored in string. so, found solution question answer- creating instance string in java and trying this- string classname = "tab3";

workflow - Different combination of Spring batch steps -

i working on project going use spring batch , spring integration creating workflow system. workflow system should able read messages queues job requests clients , depending on job requests type need call 7-8 systems. each system reads input files location (usually centralized storage system input files stored submitted clients), process , pass next system , should able give response clients, success if processed systems , failed if system fails process file , if fails client should able restart failed job step failed. i going add each system step in spring batch , using spring integration going model systems particular flow - e.g. ftp files, send jms/smapi request, receive jms response, ftp files back. etc. my questions are: is correct approach? if "yes", performance tuning considerations while using spring batch , spring integration? since systems not going called in same order time, how write possible combinations using spring batch potential spring batch job

r - Is there an elegant way of having uniform font size for the whole plot in ggplot2 -

i read online size of fonts in plot plotted ggplot2 relative base_size specified in theme() . i found size of specific elements can modified doing like: theme(axis.title.y = element_text(size = rel(1.5) ) i using theme_bw() , of text in plot: labels of axis, title of legend, items in legend, breaks in axis, have same font size. how can done? edit: i (almost) achieve want using theme_tufte() suggester @lawyer. g + theme_tufte() + theme(axis.rect=element_line() ) gives me plot x , y axis drawn lines. have plot x , y axis form box. how can draw box x , y axis? i solved problem creating theme of own, combines theme_bw() basic theme + suggestion form @lukea, + custom stuff need. theme_my <- function(base_size = 14, base_family = "palatino") { txt <- element_text(size = 14, colour = "black", face = "plain") bold_txt <- element_text(size = 14, colour = "black", face = "bold") theme_bw(base_siz

python - selecting secondary index by tuple of labels -

i have sales data indexed on ('dt', 'product_id') this: in [43]: sub.head() out[43]: income dt product_id 2015-01-15 10016 23 2015-01-15 10017 188 2015-01-15 10018 nan 2015-01-16 10016 188 2015-01-17 10025 1000 # goes on , on... how can view income of product 10016 , 10025 in between 2015-01-15 , 2015-01-16 ? tried learn pandas slicers here couldn't right: in [44]: sub.loc[idx[start:end,[10016,10018]]] keyerror: 'none of [[10055, 10158]] in [columns]' raw data import pandas pd product_order = pd.dataframe.from_csv('order.csv') odr = product_order.set_index(['dt','product_id']) dt,product_id,subsidy 2015-03-03 00:39:08+08:00,10029,50.00 2015-03-09 00:47:00+08:00,10016,55.00 2015-03-13 01:00:12+08:00,10029,23.00 2015-03-15 01:03:40+08:00,10016,21.00 2015-03-16 02:18:45+08:00,10016,52.00 assuming here gp groupby object ca

ios - Displaying UIActivityViewController in GameScene.swift -

i have developed little game consists of main menu, game , there game on label. problem have added programmatically in gamescene.swift file. now can present uiactivityviewcontroller using lines of code: class gamescene: skscene, skphysicscontactdelegate { var gameviewcontroller: gameviewcontroller! in gameviewcontroller.swift put code in viewdidload() function: scene.gameviewcontroller = self and added following function gamescene.swift file: func share() { if gameviewcontroller != nil { let mytext = "some text" let activityvc:uiactivityviewcontroller = uiactivityviewcontroller(activityitems: [mytext], applicationactivities: nil) gameviewcontroller.presentviewcontroller(activityvc, animated: true, completion: nil) } } this function executed button added programmatically , works when launch app. when play game , hit replay button , gamescene gets reloaded following message when hit share button: fatal error: unexpected

javascript - When or How should we pass the params to the URL? -

using php, html , javascript. php using mvc framework. i have fundamental question regarding web communication, perhaps clear things here. rest apart, , taking "post" , "get": let's that, if do: http://blabla.com/companya/income/ list income of given company. if do: http://blabla.com/companya/income/2010/ list income on 2010 company. and on. now, wish allow user to, html form , select values, , according values, return, server, appropriate data. how work? a) should concatenate url string on client side , ( form action ) , send server side? b) our, should send params server side, , returns url? anyway work? 1 way work? consequences of paths? there third possibility? a) should concatenate url string on client side, (form action) , send server side? that's how it's been done historically , still works fine. it's equivalent of constructing complete html hand, using php (or server side language) remove manual la