Posts

Showing posts from May, 2015

c++ - linked list with unique pointers being used as type -

i'm having problem getting linked list (it's square list) passing tests have been given professor, , i'm not sure i'm supposed do. here's code: /** linkedlist class declaration. */ template <typename t> class linkedlist; template <class tnode> class iterator { /* helper class provide pointer facilities around node */ friend class linkedlist<typename tnode::value_type>; tnode* pnode; //the node oriented instance of iterator. //iterator(tnode* _pnode) : pnode(_pnode) {} public: iterator(tnode* _pnode) : pnode(_pnode) {} using value_type = typename tnode::value_type; //using size_type = std::size_type; using pointer = tnode*; using difference_type = std::ptrdiff_t; using reference = value_type&; using iterator = iterator<tnode>; using iterator_category = std::bidirectional_iterator_tag; .............removed unneeded code............... value_type get() { retur...

c++ - Can you explain this overload resolution behavior? -

this code snippet not compile using vs2013 or icc 16: class c2; class c1 { public: float x, y; template<typename t> c1 (t x, t y) : x(static_cast<float>(x)), y(static_cast<float>(y)) {}; c1 (const c2 &a, int i) : x(0), y(0) {}; }; void main() { c1 p(1.5, 2); } because no instance of c1 constructor matches argument list (double, int) , when replace c2 polyline compile , 1.5 somehow cast polyline . test inside large project many dependencies, can fit fragment of header here: class polyline { protected: enum {init_length = 16}; public: typedef float (polyline::*fit)(point2d&, point2d&, const int, const int, const float) const; vector<float> x; ///< vector x axis coordinates of polyline nodes. vector<float> y; ///< vector y axis coordinates of polyline nodes. polyline (int initlength = init_length); polyline (const polyline &poly, int firstnode = -1, int lastnode = -1); polyline...

javascript - AngularJs - Adding Custom class on UI-Bootstrap's Tab -

how can replace or add new class on ui-bootsrap's tab nav. i'm expecting like, <ul class="my-custom-class" ng-class="{'nav-stacked': vertical, 'nav-justified': justified}" ng-transclude=""> <li ng-class="{active: active, disabled: disabled}" heading="justified" class="ng-isolate-scope"> <a href="" ng-click="select()" tab-heading-transclude="" class="ng-binding">justified</a> </li> ..... </ul> i've tried following but, it's adding class parent, <tabset justified="true" class="tab-nav"> <tab heading="justified">justified content</tab> <tab heading="sj">short labeled justified content</tab> <tab heading="long justified">long labeled justified content</tab> ...

java - Vastly Overzealous GC on Android -

i'm developing game android, , having huge (and unpredictable) issues garbage collector. during 1 phase of loading, allocate 18,000 1616 byte arrays (some chunked level data). sometimes, not always, garbage collector decide run sweep after every single allocation, increasing heap size: 06-13 13:51:59.362 16941-17640/com.lp.aeronautical.android d/dalvikvm﹕ gc_for_alloc freed 0k, 17% free 41923k/50472k, paused 191ms, total 191ms 06-13 13:51:59.362 16941-17640/com.lp.aeronautical.android i/dalvikvm-heap﹕ grow heap (frag case) 43.037mb 1616-byte allocation 06-13 13:51:59.536 16941-17640/com.lp.aeronautical.android d/dalvikvm﹕ gc_for_alloc freed 0k, 17% free 41926k/50476k, paused 174ms, total 174ms 06-13 13:51:59.536 16941-17640/com.lp.aeronautical.android i/dalvikvm-heap﹕ grow heap (frag case) 43.040mb 1616-byte allocation 06-13 13:51:59.765 16941-17640/com.lp.aeronautical.android d/dalvikvm﹕ gc_for_alloc freed 0k, 17% free 41931k/50480k, paused 179ms, total 179ms repeat...

jquery - Does Google not accept ajax in Spreadsheets? -

i'm trying data both jquery .get , xmlhttprequest , seems both of them fail. i'm trying in modal dialog created in spreadsheet. is there wrong, or procedure must before trying? details: 1 - modal dialog working (the messages put before ajax code shown fine, messages after .get fine. 2 - know google urlfetch in server-side, i'm interested in client-side now. code: 1 - jquery get: alert("test"); $.get("http://www.w3schools.com/jquery/demo_test.asp", function(data,status){ alert(status + " /// " + data); //never shown }); alert("after get"); //shown 2 - httprequest: var req = new xmlhttprequest(); var url2 = "http://www.w3schools.com/ajax/ajax_info.txt"; req.open('get', url2, false); alert("got2"); req.send(); alert("sent2"); //never shown alert(req.responsetext); //never shown i assume using custom html code in modal dialogs? ther...

algorithm - Maximum xor of a range of numbers -

i grappling problem codeforces 276d . used brute force approach failed large inputs(it started when inputs 10000000000 20000000000). in tutorials fcdkbear (turtor contest) talks dp solution state d[p][fl1][fr1][fl2][fr2] . further in tutorial need know, bits can place binary representation of number Π° in p-th position. can place 0 if following condition true: p-th bit of l equal 0, or p-th bit of l equal 1 , variable fl1 shows current value of strictly greater l. similarly, can place 1 if following condition true: p-th bit of r equal 1, or p-th bit of r equal 0 , variable fr1 shows current value of strictly less r. similarly, can obtain, bits can place binary representation of number b in p-th position. this going on head when ith bit of l 0 how come can place 0 in a's ith bit. if l , r both in same bucket(2^i'th boundary 16 , 24) place 0 @ 4th whereas can place 1 if = 20 because i-th bit of r 0 , > r . wondering use of checking if > l or not. in essence no...

search - How to skip a row with file exists condition in laravel -

this search query based on many input fields, i'm doing if statements inside query based on inputs, example : $query = model::all(); if($field = input::get('field')) $query->where('column_name', $field); but want condition skip row if there no image name of row id, : if( file_exists('/img/'.$this_query->id) ) $query->skip(); option 1: make array of filenames, utilize wherein query builder method, checks occurrence of column value in array. $query = model::query(); $filenames = scandir('/img'); // following excludes id's not in $filenames array $query = $query->wherein('id', $filenames); option 2: run query , filter resulting collection in laravel. $query = model::query(); // ... build query // following gets query results , filters them out $collection = $query->get()->filter( function($item) { return file_exists('/img/'.$item->id); } rationale : database ca...

vb.net - Visual Basic Custom Progress Bar Not Moving -

i beginner in vb, , tried making progress bar 2 panels, front 1 isn't moving. code: public class startup private sub timer1_tick(byval sender object, byval e system.eventargs) handles timer1.tick if front.width < me.width front.width = front.width + 10 end if if front.width = "1366" timer1.stop() login.show() me.close() end if end sub what index said absolutely correct! you should testing against number not string if front.width = 1366 then then note his/her second point! incrementing in steps of 10, pass 1366 without hitting it! therefore should change if statement to if front.width >= 1366 then

ios - Which takes higher priority? Code or Storyboard? -

i've been messing uinavigationbar color in ios app written in swift. when doing this, know there 2 ways set color - either in storyboard or in appdelegate code. of 2 takes higher priority? this applies more uinavigationbars of course, thought helpful many newbies me. if example set color in interface builder uinavigationbar , change color in code same uinavigationbar, color defined in code used.

javascript - Change part of link with jquery -

i using ransack sorting. couldn't find way change sorting links when search , sorting uses ajax. developing own solution change link , other stuff. so far have this ruby <%= search_form_for @search, :class=>"search",:id=>"search-menio",:remote=>"true", url: advertisements_path, :method => :get |f| %> <div class="sort-link-css"> <%= sort_link(@search, :price,"cena", {},{ :remote => true, :method => :get }) %> </div> <%end%> that generates : <div class="sort-link-css"> <a class="sort_link asc" data-method="get" data-remote="true" href="/lv/advertisements?q%5bs%5d=price+desc">cena&nbsp;▲</a> </div> my goal: when user clicks on link change link class represents sorting order , end of link repres...

python - Dropbox /delta ignoring cursor -

i'm trying list files on dropbox business . the dropbox python sdk not support dropbox business i'm using python requests module send post requests https://api.dropbox.com/1/delta directly. in following function there repeated calls dropbox /delta, each of should list of files along cursor. the new cursor sent next request next list of files. but same list. though dropbox ignoring cursor sending. how can dropbox recognise cursor? def get_paths(headers, paths, member_id, response=none): """add eligible file paths list of paths. paths queue of files download later member_id dropbox member id response example response payload unit testing """ headers['x-dropbox-perform-as-team-member'] = member_id url = 'https://api.dropbox.com/1/delta' has_more = true post_data = {} while has_more: # if ready-made response not supplied, poll dropbox if response none: ...

php - How to remove a number enclosed between html tags -

i have string, below string: $var = 'it text<nobr><font color="#176200">﴿3﴾</font></nobr>'; now want below output: $var = 'it text'; note: number of 3 changeable. how can ? instead of replacing number , tags null can first part (the string) following regex : ^[^<]* see demo edit: and can replace result of above code in main string, this: $var = 'it text<nobr><font color="#176200">﴿3﴾</font></nobr>'; $sec_part = preg_replace('/^[^<]*/','', $var); $result = str_replace($sec_part,'',$var); echo $result; output: it text

entity framework - ASP.NET MVC are two foreign fields in dependent class of One to Many relationship legal -

i have problem relationships in asp.net mvc. have 2 models have 1 many relationship. on dependent class), other class has 2 fields. know dependent class applies foreign attribute establish relationship. in dependent class, unsure if should use foreignkey attributes point other class. per this tutorial on mvc site here simplified example of problem. public class location { //other fields here. public list<link> links{get; set;} } // dependent class public class link { //other fields here... [foreignkey("location")] public string startinglocation { get; set;} [foreignkey("location")] public string endinglocation { get; set;} public location location { get; set;} } is doing on dependent class legal , if recommended? thanks , regards. if link entity going have 2 foreign keys pointing same parent, need 2 navigational properties , use inverseproperty attribute tell ef belongs which. https://msdn.microsoft.co...

Verilog simulation x's in output -

i have problem verilog , cannot resolve it. tried different changes still no solution. the code: module perpetual_calender(); reg [3:0] year[277:0]; //14 different calendars can exist 2033-1755 = 288 years reg [2:0] month[3:0][3:0]; //different calenders combination of year , month reg [2:0] day [2:0][4:0]; //different days combination of calender , day of month. reg error; reg[0:3] c; reg[0:2] f, g; integer i,j; // fot year 0 = a, 1 = b... 13 = n task show_corresponding_day; input integer m; input integer d; input integer y; begin error = 0; $display("# (m/d/y) %d/%d/%d = ",m,d,y); if(y<1755 || y>2033 || m<1 || m>12 || d<1 || d>31) error = 1; if(!error) begin c = year[y-1755]; f = month[c][m]; $display("c = %d, f = %d", c, f); if(d > 29 + month[c][m+1] - (f+1)%7) error = 1; if(!error) g = day[f][d]; $display("g = %d...

Java find all the key with specific value -

this question has answer here: java hashmap: how key value? 29 answers is there way find out key having same value in map. like map.put("a","abc"); map.put("b","abc"); map.put("c","abc"); map.put("d","bcd"); here want find out key having value "abc". you use guava filter. map<string, string> map = maps.newhashmap(); map.put("a", "abc"); map.put("b", "abc"); map.put("c", "a3c"); map.put("d", "abc"); final string str = "a3c"; map<string, string> filteredmap = maps.filterentries(map, new predicate<map.entry<string, string>>() { @override public boolean apply(final map.entry<string, string> stringstringentry) { return stringstringen...

gulp - Vulcanize: inlineCss not working on Polymer 1.0 project -

i have polymer 1.0 project, want vulcanize production. use gulp gulp-vulcanize in order so. my gulpfile.js file: var gulp = require('gulp'); var vulcanize = require('gulp-vulcanize'); gulp.task('vulcanize', function () { return gulp.src('./src/app.html') .pipe(vulcanize({ inlinecss: true })) .pipe(gulp.dest('./dist')); }); the content of src/app.html following: <!-- polymer elements --> <link rel="import" href="../bower_components/google-map/google-map.html" /> <link rel="import" href="../bower_components/iron-icons/iron-icons.html" /> <link rel="import" href="../bower_components/paper-button/paper-button.html" /> <link rel="import" href="../bower_components/paper-drawer-panel/paper-drawer-panel.html" /> <link rel="import" href="../bower_components/paper-icon-button...

android - How to start a method with a button click -

i trying start method clicking button. idea, , please tell me if there better way, put code calculations method called calculateratios. once button clicked run through if statements check , see if of textfields empty. if none empty runs method calculateratios. otherwise display toast saying "enter data". have following java. java file package com.th3ramr0d.poundforpound; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import org.w3c.dom.text; public class mainactivity extends appcompatactivity { button calculate; button reset; edittext inputname1; edittext inputname2; edittext inputbodyweight1; edittext inputweightlifted1; edittext inputbodyweight2; edittext inputweightlifted2; textview out...

php - Distinguish between not set at all AND null? -

$record['field'] = null; if (isset($record['field']) || is_null($record['field'])) { // when $record['field'] set , not null, or, when $record['field'] = null // basically, when $record['field'] defined $record['field'] = whatever, null. } else { // when $record['field'] not defined @ all, not null } my intention check if $record['field'] defined @ all, null . however every time $record['field'] not set @ (e.g. comment out $record['field'] = null;), gives me error: undefined index: field in case ask, when null values become meaningful, such in sql query assigning null value timestamp column make mysql update current timestamp. any way can this? since have here not variable associative array, can use array_key_exists() check array contains field name, regardless of value.

Use of findstr to seach regular expression in a batch file -

i create batch file check if file name has been written following rules. file name contains parameters (letters , numbers) splitted hyphen character : fin73-inv-2015-ann i check first 2 parameters (department name , document type) , above check if hypen has been written more 1 time mistake . e.g. fin73--inv-2015-ann i have tried command findstr seems doesn't work because if there 2 hyphens errorlevel 0 in case: echo fin73--inv-2015-ann|findstr /i "^[a-z] -[a-z] " do have more suggestions ? thank you for <startofstring><letter><letter><letter><number><number><hyphen><letter> use findstr /i "^[a-z][a-z][a-z][0-9][0-9]-[a-z]" if count of letters/numbers not known: findstr /i "^[a-z]*[0-9]*-[a-z]"

javascript - HTML: How to set up web page head and body with external file references -

i new html , programming , hope can me this. i have written code first pages of website , upload these server test. therefore know if basic structure of documents correct , comments on following: should add or change regarding document's head ? do include external style sheets right way , @ right position + correct start href "/" here ? (i read css should included before js better performance.) do include external js , jquery references right way , @ right position ? (i read js should included @ end of body better performance.) notes: php / html pages of website saved separate files in same folder. folder contains sub folder "includes" stylesheet , functions file saved. my html structure: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta na...

amazon web services - How to read a csv file from an s3 bucket using Pandas in Python -

i trying read csv file located in aws s3 bucket memory pandas dataframe using following code: import pandas pd import boto data = pd.read_csv('s3:/example_bucket.s3-website-ap-southeast-2.amazonaws.com/data_1.csv') in order give complete access have set bucket policy on s3 bucket follows: { "version": "2012-10-17", "id": "statement1", "statement": [ { "sid": "statement1", "effect": "allow", "principal": "*", "action": "s3:*", "resource": "arn:aws:s3:::example_bucket" } ] } unfortunately still following error in python: boto.exception.s3responseerror: s3responseerror: 405 method not allowed wondering if explain how either correctly set permissions in aws s3 or configure pandas correctly import file. thanks! i realised need set permissions on each individual...

java - Log4j2 rc 1 DefaultRolloverStrategy overwrites after 7 files -

i using lo4j2 rc1 rollingfile holding timebasedtriggeringpolicy, sizebasedtriggeringpolicy , defaultrolloverstrategy having max files 50. rolled files overwritten after 7 files. below configuration <appenders> <routing name="serverlogs"> <routes pattern="$${ctx:logrouter}/"> <route> <rollingfile name="serverlogs" immediateflush="false" append="false" filename="${loghome}/${ctx:logrouter}/serverlogs.log" filepattern="${loghome}/${ctx:logrouter}/%d{dd-mm-yyyy}-serverlogs-%i.log.gz"> <patternlayout> <pattern>%d %p %-40c{1.} [%t] %m %ex%n</pattern> </patternlayout> <policies> <timebasedtriggeringpolicy interval="1" modulate="t...

Hashmap in UML diagram? -

Image
i want write class diagram class contains hashmap. normally, this: but map looks this: private map<beacon, string> beaconroute; the key custom class. how can describe in uml diagram? use beacon : beacon inside qualifier rectangle , use string data type target type (instead of employee ). property beaconroute association end name. don't have literal have map class in uml--doing loses sight of problem domain. not understand why beacon map string , though. did reverse key , value mistake?

Passing Rails variable to JavaScript -

i want pass variable rails controller javascript file. found solutions , have: # controller def index @coords = map.all end #view <%= content_tag 'div', id: 'coords', data: {coords: @coords } %> <% end %> #javascript alert($('#coords').data(coords)); edit: $('#coords').data(coords) returns object object . how access particular attribute of coords such coord.lat etc. in javascript ? also, @coords converted json automatically? note: couldn't use gon gem. think not supported in rails 4.2. need solution without gems. when retrieving data attribute values jquery .data(key) , key use should string . , yeah data: { coords: @coords} converts @coords json string automatically. think should work if call : $('#coords').data('coords'); # returns array of javascript coord objects. $('#coords').data('coords')[0].id; # returns first coord's id.

excel - VBA vlookup formula error -

i newbie in excel macro vba. have problem on vlookup code refers workbook selected user. here's code: private sub vlookups() dim data_file_new string dim integer dim string, b string, path string data_file_new = cstr(application.getopenfilename(filefilter:="excel workbooks (*.xls*),*.xls*", title:="select new data file vlookup")) path = data_file_new = "=vlookup(a:a,'[" & path & "]source'!$a:$ab,28,0)" b = "=vlookup(a:a,'[" & path & "]source'!$a:$aj,36,0)" = 7 until sheets("macro template").cells(i, 1) = "" sheets("macro template").cells(i, 37) = sheets("macro template").cells(i, 38) = b = + 1 loop end sub my problem code doesn't give correct formula vlookup. instead, gives formula: =vlookup(a:a,'[e:\ap no approval\[no approval monitoring log_june 2015 xlsx.xlsx]source]no approval monitoring log_june'!$a:$ab,...

dojo - Using jsonRest with filteringSelect widget -

i start working onchanging widgets can rebuild using jsonrest rather memory, filteringselect , dgrid in app. after fixed filteringselect, replaced memory jsonrest , tested works well, tried use store/cache it. testing showed caching not happening, , when searched web, got someone's answer: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-filteringselect-with-a-jsonrest-store-and-a-cache-store-td3994386.html this issue tells cache not working filteringselect, need use request. on other hand, "request" requests data it's not option. can give right answer: 1. cache work jsonrest on filteringselect? 2. can use dgrid jsonrest , cache also? thanks while jsonrest can used cache fine (regardless of widget consumes it), important thing consider (which mailing list post points out) dojo/store/cache not cache query calls store, get calls, since query calls can include variety of range, filter, , sort parameters. don't think you'd effect...

insert responsive gmail html signature -

my html signature in browser quite following design: [ ] name [img] company [ ] email but when copy gmail signature, seems broken! image stands in wrong position! [ ] [img] [ ] name company email please me resolve problem! ps: have not enough reputations post image. <div class = "col-lg-12 col-md-12" style ="display:inline"> <div class = "col-xs-1 col-sm-1" style = "padding:0 0 0 0;display:inline"> <img src="http://i.imgur.com/8wclwry.png" width="65px" height="65px" id="sigphoto"> </div> <div class = "col-lg-11 col-md-10" style = "padding:0 0 0 0; display:inline"> <p class = "col-lg-11 col-md-10" style = "padding:0 0 0 0"> <span id = "name"> ta quynh giang <!-- name here--> </span> </p> <p class = "col-lg-11 col-md-1...

sonarqube - Sonar qube is not getting started -

while running startsonar.bat command line getting following error contineously.sonarqube log file showing below messages. any appreciated! --> wrapper started console launching jvm... wrapper (version 3.2.3) http://wrapper.tanukisoftware.org copyright 1999-2006 tanuki software, inc. rights reserved. 2015.06.13 15:04:41 info app[o.s.p.m.javaprocesslauncher] launch process[search]: c:\program files\java\jdk1.8.0_45\jre\bin\java - djava.awt.headless=true -xmx1g -xms256m -xss256k -djava.net.preferipv4stack=true -xx:+useparnewgc -xx:+useconcmarksweepgc -xx:cmsinitiatingoccupancyfraction=75 -xx:+usecmsinitiatingoccupancyonly -xx:+heapdumponoutofmemoryerror -djava.io.tmpdir=d:\sonarqube-5.1\sonarqube-5.1\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.searchserver c:\users\rkutchar\appdata\local\temp\sq-process3411693551115002418properties 2015.06.13 15:04:42 info es[o.s.p.processentrypoint] starting search 2015.06.13 15:04:42 info ...

java - ANDROID STUDIO: Take picture with Camera API -> Send this picture to another activity -

after take picture camera api, picture displays on screen/this activity. want send picture covers whole screen activity called pictureeditor. there add functionality can edit picture. // code in mainactivity mcamera.takepicture(null, null, mpicture); intent = new intent(getapplicationcontext(), pictureeditor.class); bitmap b = getbitmapfromview(mpreview); bytearrayoutputstream bs = new bytearrayoutputstream(); b.compress(bitmap.compressformat.png, 50, bs); i.putextra("bytearray", bs.tobytearray()); startactivity(i); in pictureeditor have code in oncreate. // code in pictureeditor if(getintent().hasextra("bytearray")) { imageview previewthumbnail = new imageview(this); bitmap b = bitmapfactory.decodebytearray( getintent().getbytearrayextra("bytearray"),0,getintent().getbytearrayextra("bytearray").length); previewthumbnail.setimagebitmap(b); } what can retrive picture in pictureeditor, ...

design - Not mutating trees in Haskell -

i'm teaching myself haskell; let say, purely sake of argument, i'm writing compiler in haskell. have ast, defined like: data node = block { contents :: [node], vars :: map string variable } | vardecl { name :: string } | varassign { name :: string, value :: node, var :: variable } | varref { name :: string, var :: variable } | literal { value :: int } each block stack frame. wish resolve variable references. in world mutable data, way i'd is: walk tree keeping track of recent block looking vardecl nodes; @ each one, i'd add variable closest block . walk tree again, looking varassign , varref nodes. each time see one, i'd variable in stack frame chain , annotate ast node corresponding variable . now, whenever i'm doing work on tree, , come across varref , know precisely variable being referred to. of course, in haskell i'd need different approach, due tree not being mutable. naive approach rewrite tree. declar...

php - RecursiveIteratorIterator return . and .. for each directory -

i used recursiveiteratoriterator recursive directory lists in linux when try directories have tow version of each directory . , .. : 'dirs' => array (size=13) 0 => string './..' (length=4) 1 => string './..' (length=4) 2 => string './.' (length=3) 3 => string './.idea/..' (length=10) 4 => string './.idea/.' (length=9) 5 => string './.idea/scopes/..' (length=17) 6 => string './.idea/scopes/.' (length=16) 7 => string './images/..' (length=11) 8 => string './images/.' (length=10) 9 => string './test/..' (length=9) 10 => string './test/.' (length=8) 11 => string './test/test2/..' (length=15) 12 => string './test/test2/.' (length=14) my code : $files = [ 'files' => [ ], 'dirs' => [ ] ]; $directories = new recursiveiterat...

server - my wampserver 2.5. Projects was not opening projects -

i have installed wampserver 2.5 in windows 8. when click on project in local host is redirecting project name. lets take project name project1 , when click on folder in local host directing project1 supposed direct localhost/project1 that. i have seen answerers here , changed line 30 in index.php file in www directory. haven't changed port @ all. , still not opening. directing localhost/project1 index.php file in project1 nt displaying. saying internal server error. if changed line 30 in index.php $suppress_localhost = true; to $suppress_localhost = false; it should ok, bring contents of project1/index.php ? check /wamp/logs/apache_error.log details.

javascript - How to fill an <input type="text"> with the value of the absolute filepath, chosen with a file upload dialog? -

this question has answer here: directory chooser in html page 5 answers i'm working on django app (web). have awesome page form on it. want let user select file on local machine via nice file upload button <input type="file"> . i don't care file content. care absolute path, i'd text field (or whatever) , submit html form. my other option (unacceptable actually) let users write filepath in input field themselves... that's not cool @ all. does sound doable? most modern browsers don't give access filesystem. , when choose upload file, replace real path. try: <input type="file" onchange="alert(this.value)"/> will give c:\fakepath\myfile.txt

sql - Sqlite Get counts of all distinct values across a row -

for personal end of year project i've scraped attendance off school website hoping form of visualization of data. i've gotten stuck transforming data form need in. currently database looks this date,one,two,three,four,five,six,seven,eight,nine,dee 2014-09-03,p,p,p,p,au,au,p,t*,au,p 2014-09-04,p,p,p,p,n/a,au,p,t*,n/a,p 2014-09-05,p,p,p,p,au,au,p,p,p,p 2014-09-09,p,p,p,p,au,au,p,p,au,p 2014-09-11,au,au,p,au,au,p,au,au,au,p 2014-09-15,p,p,p,p,au,p,p,p,au,p 2014-09-17,p,p,p,p,au,au,p,p,au,p the columns each period,and each 1 has indicator of presence. question is, possible turn using sqlite? date,p,au,t*,n/a 2014-09-03,6,3,1,0 2014-09-04,6,1,1,2 2014-09-05,8,2,0,0 2014-09-09,7,3,0,0 2014-09-11,3,7,0,0 2014-09-15,8,2,0,0 2014-09-17,7,3,0,0 2014-09-19,9,1,0,0 counting each occurence of value across row. something this: select date, case when 1 = 'p' 1 else 0 end + case when 2 = 'p' 1 else 0 end + ... case when dee =...

r - How to pass an expression "from higher level" to mutate? -

i create higher level function wrap mutate. want give expression parameter function , being able use expression in mutate : datas <- data.frame(x = sample(100)) fn <- function(datas, expr) { mutate(datas, flag = eval(substitute(expr), datas)) } fn(datas[1], x > 50) error in mutate_impl(.data, dots) : object 'x' not found but don't understand why fails since mutate(datas, flag = eval(substitute(x > 50), datas)) works. what doing wrong ? thanks try this: fn <- function(df, expr) eval(substitute(mutate(df, expr), list(expr=substitute(expr)))) or (preferably) this: fn <- function(df, expr) mutate_(df, .dots= list(flag=substitute(expr)))

java - android-Volley JSONObjectRequest return 401 error -

i'm trying send post request paramteres server. post params null. i've tried few solutions stackoverflow didn't work. i unexpected response code 401 11.urlname map<string, string> jsonparams = new hashmap<string, string>(); jsonparams.put("username", "test@mail.com"); jsonparams.put("usertype", "usertype"); jsonparams.put("apikey", "key"); jsonobjectrequest myrequest = new jsonobjectrequest(request.method.post,apiurl, new jsonobject(jsonparams), new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { try { string status=response.getstring("status"); if (status.equals("success")) { txtresponse.settext("valid user"); } else { txtresponse.settext("invalid user...

AES encryption in java / decrypt in C# -

i'm using below code encrypt email address using own key in java: byte[] key = "testkeymaster123".getbytes("utf-8"); secretkeyspec _secretkey = new secretkeyspec(key, "aes"); string input = "some.email.m@gmail.com"; cipher cipher = cipher.getinstance("aes"); byte[] bytes = input.getbytes("utf-8"); cipher.init(cipher.encrypt_mode, _secretkey); byte[] output = cipher.dofinal(bytes); result = base64.encodetostring(output, base64.default); and result is: 9�Ѹ��m�g���m�`7<z��je�g�l and encoded result is: i8pwv9ev5n5l0f5w/pzarrc7g8hjiac8v/lefv0vaeq= and in c# i'm using below code decrypt it: var text = "i8pwv9ev5n5l0f5w/pzarrc7g8hjiac8v/lefv0vaeq="; text = util.decodebase64(text); rijndaelmanaged rijndaelcipher = new rijndaelmanaged(); rijndaelcipher.mode = ciphermode.ecb; rijndaelcipher.padding = paddingmode.none; rijndaelcipher.keysize = 128; rijndaelcipher.blocksize = 128; byte[] encryptedda...