Posts

Showing posts from January, 2011

How to store a process in rust -

i'd store std::io::process::process inside struct in rust. however, program goes defunct pass process instance struct. why that? code: use std::io::process::{command, process}; use std::rc::rc; use std::cell::refcell; struct dzeninst { process: rc<refcell<process>> //stdin: std::io::pipe::pipestream } impl dzeninst { // write string stdin of dzen fn write(&mut self, s : string) { let mut stdin = self.process.borrow_mut().stdin.take().unwrap(); println!("writing dzen inst"); match stdin.write_str((s + "\n").as_slice()) { err(why) => panic!("couldn't write dzen stdin: {}", why.desc), ok(_) => println!("wrote string dzen"), }; } } fn createdzen() -> dzeninst { dzeninst {process: rc::new(refcell::new( match command::new("dzen2").spawn() { err(why) => panic!("couldn't spawn

asp.net mvc - Limit Value of a text field -

i new mvc i have employee poco this [petapoco.tablename("tblemployee")] [petapoco.primarykey("employeeid")] public class employee { public int employeeid { get; set; } public string name { get; set; } public string gender { get; set; } public string city { get; set; } public int departmentid { get; set; } } department id foreign key coming table tbldepartment. want limit value of departmentid in creating new employee values existing in table tbldepartment(column : id ).how this? existing code in create view @html.editorfor(model => model.departmentid) usually reference integrity managed @ database level. make relationship on database between employees , departments enforce reference integrity, if try save employee department id don't exist on department table should return integrity error. capture error on saving controller , return user. also, if allow users load data limited list loaded existing data on dat

php - Select data from the most recent row, with a particular ID -

i have database looks this: id | account_id | date_time | followers -------------------------------------------------------------- 1 | 1813 | 2014-11-16 09:31:52 | 1527 -------------------------------------------------------------- 2 | 1826 | 2014-11-16 09:31:52 | 900 -------------------------------------------------------------- 3 | 1854 | 2014-11-16 09:32:25 | 15342 -------------------------------------------------------------- 4 | 1813 | 2014-11-16 16:31:52 | 1539 -------------------------------------------------------------- 5 | 1826 | 2014-11-16 16:31:52 | 905 -------------------------------------------------------------- 6 | 1854 | 2014-11-16 15:32:25 | 15349 -------------------------------------------------------------- the database repeats same sort of entries twice-daily. each day there 2 new entries account_id 1813, 1

Correct usage of C++ template template parameters -

i've trouble make use of template template parameters. here simplified example: template <typename t> struct foo { t t; }; template <template <class x> class t> struct bar { t<x> data; x x; }; int main() { bar<foo<int>> a; } the compiler (g++ (ubuntu 4.8.2-19ubuntu1) 4.8.2) reports following error: main.cpp:8:5: error: ‘x’ not declared in scope t<x> data; ^ main.cpp:8:6: error: template argument 1 invalid t<x> data; ^ any idea what's wrong? so make use of bar<foo<>> template <typename t = int> struct foo { t t; }; template <typename t> struct baz { t t; }; template <typename t> struct bar; template <template <typename> class t, typename x> struct bar<t<x>> { t<x> data; x x; }; int main() { bar<foo<>> a; bar<baz<float>> b; }

python - Pandas read_csv reading time offset strings -

i have text file data columns '10:15.3' meaning 10 minutes 15.3 seconds after canonical event. when read read_csv, i'm getting strings: >>> df.time.head() 0 08:32.0 1 08:38.0 2 08:39.0 3 08:43.0 4 09:15.0 name: time, dtype: object >>> df.time.head()[:1][0] '08:32.0' >>> i feel should able seconds enough within pandas, either specifying conversion in read_csv or (probably better, have both) appending new column, i'm not seeing how it. i'm pretty sure me being dense. can offer tip me unstuck? you can use datetime.time object. provide: hours, minutes, seconds, microseconds. these provided integers, need int cast relevant part of each string datetime.date constructor. so in case: import datetime df = pd.read_csv('your_csv.csv') df.time = pd.series([datetime.time(0, int(val[:2]), int(val[3:5]), int(val[6:])*100000) val in df.time], index = df.index)

MySQL Update with derived tables and ORDER BY -

this question follow question link . have table person (id) , 1 characteristic (var0) @ different timepoints t. @ timepoints characteristic missing , fill gaps former value. here example of table: +---+---+----+ +----+---+------+------+------------------+ |id | t |var0| | id | t | var0 | var1 | @prev_id := id | +---+---+----+ +----+---+------+------+------------------+ | 1 | 1 | | | 1 | 1 | | | 1 | | 1 | 3 | \n | | 1 | 3 | \n | | 1 | | 1 | 7 | \n | | 1 | 7 | \n | | 1 | | 1 | 8 | b | | 1 | 8 | b | b | 1 | | 1 | 9 | \n | | 1 | 9 | \n | b | 1 | | 2 | 2 | \n | | 2 | 2 | \n | \n | 2 | | 2 | 4 | u | | 2 | 4 | u | u | 2 | | 2 | 5 | u | | 2 | 5 | u | u | 2 | | 2 | 6 | \n | | 2 | 6 |

Android Facebook app open link in fb webview and I can't login into my own web app -

i have big problem android native facebook app webview browser. when i'm trying click on mine cta facebook login button (own website) - nothing happened. there's problem android webview, can't open facebook modal login window. i tried use target="_blank" open new window, thats not right way. is there solution fix it? thanks much, jacob. it's simple easy solution fix it. must have special own oauthserver comunicate api, , sent app credentials.

java - What does "Could not find or load main class" mean? -

a common problem new java developers experience programs fail run error message: could not find or load main class ... what mean, causes it, , how should fix it? the java <class-name> command syntax first of all, need understand correct way launch program using java (or javaw ) command. the normal syntax 1 this: java [ <option> ... ] <class-name> [<argument> ...] where <option> command line option (starting "-" character), <class-name> qualified java class name, , <argument> arbitrary command line argument gets passed application. 1 - there second syntax "executable" jar files describe @ bottom. the qualified name (fqn) class conventionally written in java source code; e.g. packagename.packagename2.packagename3.classname however versions of java command allow use slashes instead of periods; e.g. packagename/packagename2/packagename3/classname which (confusingly) looks fil

javascript - Geting bike paths coordinates from Google Maps API -

introduction: google maps allows show bicycling route on map point x point y. google can show bike paths on given map 4 different types: trails, dedicated lanes, bicycly-friendly roads, dirt/unpaved trails. different bike paths painted different colours. what need do: need write application (when given start point x, , endpoint y) retrieve information of how big percentage of 4 types of bike paths route contain, result should that, ex. trails: 20% dedicated lanes: 15% bicycly-friendly roads: 40% dirt/unpaved trails: 25% is possible fetch such information google maps api? my research: have figured out there bicyclinglayer object ( https://developers.google.com/maps/documentation/javascript/examples/layer-bicycling ) allows paint bike paths on map, , documentation says bicycling layer painted on map directionsrenderer when bicycling chosen travelmode. have tested can show bicycling paths on map. wonder if possible coordinates of bike paths google map (after got painted), o

regex - Perl regexp matching -

edit : have difficult express myself. let me start again. have loop read string file : gigabitethernet0/0 gigabitethernet0/1 gigabitethernet0/2 serial0/0/0:0 serial0/0/0:0.100 and i'm trying regexp interface serial0/0/0:0 if ($linesplitter[2] =~ /serial0(.*):0[^(.\d)](.*)/ && $interfacebool eq "false"){ $interfaceneeded = $linesplitter[2] ; } but not working. tried several things on online regexp simulator still.. without result... want main interface (serial0/0/0:0), not sub-interface (serial0/0/0:0.100) expected variable: serial0/0/0:0 i don't want replace, or part of sub-interface. want regexp match main interface without matching sub-one sorry misunderstanding. if want restrict match, use anchors, ^ match beginning of string, , $ match end of string: /^serial0(.*):0$/ this match serial strings end :0 .

Characters with accents not interpreted correctly during update on sql server -

i'm trying update records romanian text have characters 'ă, ț, î' they working fine if copy text manually using 'edit rows' option on sql management studio when write update statement ă gets interpreted a , ț gets interpreted ? however, î interpreted correctly. i've set column data type nvarchar(255) , current collation set database default. i've tried romanian still no luck. below example query. update dbo.tbl_romanian_test set title = 'ă ț î' id = 1 eventually want done app using entity framework. appreciate help. thanks try add n before 'ă ț î' in query trying update nvarchar column update dbo.tbl_romanian_test set title = n'ă ț î' id = 1

asp.net - User in docusign -

i have integrate docusign asp.net web application.in our application there many companies , each company has administrators , users.i want clarify related integrator key required in below mentioned scenarios. 1)if administrators allowed send documents signing other users. in case,do administrators need have separate integrator key sending documents signing? 2)if users allowed send documents signing other users. in case users of application required have separate integrator key? in short want know how users can managed integrator key? 1 such account per company, or 1 per initiator within company? please suggest. it's none of above. docusign integrator key similar other apis call api key (google instance). used identify given docusign integration, need 1 integrator key entire integration. can think of "per app" or "per integration" key, not per user. see this page in docusign dev center more information.

php - Unable to localy open file after successfull upload -

$name = input::file('csv')->getclientoriginalname(); $upload_success = input::file('csv')->move('uploads', $name); i have file created on public/uploads directory correct ext. i'm on win7 zend apache. when want open .txt file, got "access denied". when open nodepad admin , open .txt, ok... why have open admin ?

Meaning of :: in Java syntax -

this question has answer here: :: (double colon) operator in java 8 13 answers what meaning of :: in following code? set<string> set = people.stream() .map(person::getname) .collect(collectors.tocollection(treeset::new)); this method reference. added in java 8. treeset::new refers default constructor of treeset . in general a::b refers method b in class a .

c# - HTTP Error 404.0 - Not Found in MVC 5 -

my project in mvc 5.i wanted handel 404 . did problem when access view using following url, works fine , expected: http://localhost/hotels/index30701000000 but when access view using following url, 404.0 error message (error shown below) http://localhost/hotels/edit/09099999dfdfb http://localhost/hotels/edit/090/20130701000000 error: http error 404.0 - not found resource looking has been removed, had name changed, or temporarily unavailable. my code is controller public class errorcontroller : controller { // get: error public actionresult unauthorized() { response.statuscode = 404; response.tryskipiiscustomerrors = true; return view(); } } routeconfig routes.maproute( name: "unauthorized", url: "unauthorized/{action}/{id}", defaults: new { controller = "error", action = "unauthorized", id

angularjs - Multiple Angular-isotopes on one page -

is there way initialise two jquery-isotope containers on same page using angular-isotope ? 1 works me http://plnkr.co/edit/rlarpyvf8kslj6hyazrm?p=preview var app = angular.module('plunker', ['iso.directives']); app.controller('isoctrl', function($scope, listservice) { $scope.xlist = listservice.xlist; $scope.xlist2 = listservice.xlist2; }); app.factory('listservice', function() { return { xlist: [ {name:'a', number:'1', date:'1360413309421', class:'purple'} ,{name:'b', number:'5', date:'1360213309421', class:'orange'} ,{name:'c', number:'10', date:'1360113309421', class:'blue'} ,{name:'d', number:'2', date:'1360113309421', class:'green'} ], xlist2: [ {name:'a2', number:'1', date:'1360413309421', class:'pur

rubymotion - ViewController for an iOS quiz app -

maybe stupid question cannt find solution. i'm newbie developer , develop ios apps using rubymotion. i'm creating quiz app: when user start quiz init uiviewcontroller first question , 3 buttons possible answers. user select answer , go next question increasing progress bar. now have doubt: can use uiviewcontroller or have use uipageviewcontroller? if use uiviewcontroller 50 questions have init 50 controller: not dangerous resources? or better destroy controller when create controller next question? thank (and sorry if question obvious) no can use 1 viewcontroller object because have same ui 1 every page progressbar, question label , 3 buttons. if user select answer need update new question label , 3 buttons options progress on progressbar , display activityindicatorview refresh page new question or custom animation.

Use other image as thumbnail for Sparkling Theme Polular Post Widget in wordpress -

Image
i have installed sparking theme. tried use sparkling polular post widget display popular posts in side bar. default shows thumbnail shows featured image. want show other image thumbnail, first image found in post thumbnail. beacuse if post doesn't have featured image, shows blank, want show first image of post thumbnail. is possible somehow achieve it? new wordpress , may missing something. please help. thanks manish you can try using plugin https://wordpress.org/plugins/autoset-featured-image/ or https://wordpress.org/plugins/easy-add-thumbnail/ .the second 1 works out of box .when publish post checks featured image. if not find one, looks first image attached post , sets featured image

html - Background image not showing up on the website -

i trying place background image not appear. please guide. <header style=" background-image: url("header.png")"; "><p>test</p> </header> it's have typo mistake or missing image. can use code snippet: inline css: <header style="width: 360px; height: 150px; background-image: url('http://placehold.it/360x150');"> <p>test</p> </header> external css: header { width: 360px; height: 150px; background: url("http://placehold.it/360x150"); } <header> <p>test</p> </header>

android - how to keep RecyclerView always scroll bottom -

i use recyclerview replace list view want keep recyclerview scroll bottom. listview can use method settranscriptmode(abslistview.transcript_mode_always_scroll) recyclerview use method smoothscrolltoposition(myadapter.getitemcount() - 1) but when soft keyboard pop ,its replace recyclerview content. this because rv thinks reference point top , when keyboard comes up, rv's size updated parent , rv keeps reference point stable. (thus keeps top position @ same location) you can set layoutmanager#reverselayout true in case rv layout items end of adapter. e.g. adapter position 0 @ bottom, 1 above etc... this of course require reverse order of adapter. i'm not sure setting stack end may give same result w/o reordering adapter.

android - Shutting down genymotion properly via terminal -

i'm running problem automating tests , use help: i starting emulator via shell script on macos player -n {vm_id} & the emulator loads , testing works fine. unfortunately after first test, emulator doesn't shut down. killing player with: ps -ef | grep "player" | awk '{print $2}' | xargs kill results in not being able open genymotion second test in same script. (an android 4.4. test , android 4.3 test afterwards) is there way shut down emulator in other way via shell script?

c# - How do I bind an ObservableCollection to an AvalonDock DocumentPaneGroup? -

i need load collection of items documents in avalondock 2.0. these objects inherit abstract class, want render frame inside document depending on subclass are. this xaml: <ad:dockingmanager background="gray" documentssource="{binding path=openprojects}" activecontent="{binding path=currentproject, mode=twoway}"> <ad:dockingmanager.documentheadertemplate> <datatemplate> <textblock text="{binding path=openprojects/name}" /> </datatemplate> </ad:dockingmanager.documentheadertemplate> <ad:dockingmanager.layoutitemtemplate> <datatemplate> <grid> <grid.resources> <datatemplate datatype="{x:type vm:subclassaviewmodel}"> <frame source="pages/subclassaproject.xaml" /> </datatemplate> &

c# - Force two ActionFilter attributes to be used in conjunction with one another -

i had 3 authorization attributes contained code check content being requested exists. decided avoid repeating myself in each, creating new attribute called quizexistsattribute . i wish run before other authorization attributes. now have attribute, wish ensure original attributes using, aren't used without new attribute - because want check made before else. my other authorization attributes rely on logic of quizexistsattribute being performed are: activequiztakersessionatrribute authorizequizadminattribute so in code using them so: /// <summary> /// start of quiz /// </summary> /// <param name="urlid"></param> /// <returns></returns> [quizexists] // check quiz exists [activequiztakersession] // check have active session quiz [httpget] public actionresult quizquestion(string urlid) { // code here after checks } is there way enforce activequiztakersession used injunction (and following) quizexists attribute?

How to Switch On or Switch Off a PC using android application -

can know how switch on or switch off pc remotely using android application.also can open or close pc applications like(paint,notepad,etc..,)using android application. though have voted close question, here basic knowledge need consider trying do: if pc off, in no power, there no chance turn on remotely. you use wake on lan . details on how works , why pc (understood complete hardware) not "off" you need kind of "host" application started when os boots up. when have contact pc on application might able start applications (depends heavily on os pc runs). a free (for private usage) application teamviewer allows control pc android device. takes on control of input , therefore have remote access everything.

sql - How to find the default location in which Oracle DBF files are created? -

during creation of new tablespace in oracle database, user has enter dbf file name (or she) want use. dbf file created in specific location. the user may specify path in dbf file should created. i need find way default location of dbf file. i know how in ms sql using sql query: select substring(physical_name, 1, charindex(n'master.mdf', lower(physical_name)) - 1) master.sys.master_files database_id = 1 , file_id = 1; but have no idea how in oracle. i've tried several things: ran query on all_directories - didn't find information there looked @ v$datafile view - realized view , others accesible database administrators only there several limitations: the oracle database may installed on machine different operating system. my application may connect database user not admin. it should done preferably sql query. any appreciated. db_create_file_dest specifies default location oracle-managed datafiles (see its entry in database refere

performance - JMeter Issue in VLAN enabled system -

once machine vlan enabled, i'm neither able prepare new scripts using jmeter-2.9 tool nor able execute old scripts used run earlier on same machine. please find below error message got while running old scripts: *thread name: 46_drug issue 1-1 sample start: 2014-11-19 16:22:40 ist load time: 1001 latency: 0 size in bytes: 1720 headers size in bytes: 0 body size in bytes: 1720 sample count: 1 error count: 1 response code: non http response code: java.net.connectexception response message: non http response message: connection refused: connect response headers: httpsampleresult fields: contenttype: dataencoding: null* while recording new test plan in windows machine, i'm able navigate different pages http proxy server enabled in jmeter tool, no http request getting recorded in transaction controller. can please suggest, how overcome issue ? according me issue related proxy. jmeter sits between machine , proxy , thats how records requests coming , going mac

.net - C# infinitive task loop using Task<> class + cancellation -

i`m trying make small class multithreading usage in winform projects. tried threads(problems ui), backgroundworker(smth went wrong ui too, leave now:)), trying task class. now, can`t understand, how make infinitive loop , cancelling method (in class) running tasks. examples found used in 1 method. so, here structure & code of working part (worker.css , methonds used in winform code). worker.css class worker { public static int threadcount { get; set; } public void dowork(parameterizedthreadstart method) { task[] tasks = enumerable.range(0, 4).select(i => task.factory.startnew(() => method(i))).toarray(); } } usage on form1.cs private void start_btn_click(object sender, eventargs e) { worker.threadcount = 1; //actually doesn`t using now, number of tasks declared in class temporaly worker worker = new worker(); worker.dowork(job); string logstring_1 = string.format("starting {0} threads...&q

apache - Changing a REST service response content-type with mod_rewrite -

to work around ie8 compatibility issue, change content-type of rest service response without changing application source code. i'm trying mod_rewrite rule: rewritecond %{http_user_agent} .*msie\s8.* rewriterule /app/name(.*) - [t=application/new.content.type+xml] this rule works static content, not rest service responses. i'm using apache 2.2.3 jboss 5.1. on apache, i've configured rewriterule in httpd.conf file , in log file see: (3) applying pattern '/app/name(.*)' uri '/app/name/events/service' (4) rewritecond: input='mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0; .net clr 2.0.50727)' pattern='.*msie\\s8.*' => matched (2) remember /app/name/events/service have mime-type 'new.content.type' (1) pass through /app/name/events/service (1) force filename service have mime-type 'new.content.type' on jboss, i've tried configuring rewritevalve @ engine , server level, , in log file can s

c# - Newbie WPF: Does the animation remove the attached property? -

i trying learn wpf , animations. have simple program allows user move ellipse using mouse. when mouse button released, ellipse's position animated towards top of screen. this works fine first time grab ellipse. second time grab ellipse can not change it's y-position anymore (but can still change x-position). does animation somehow remove attached canvas.top property? how can correct problem? here code starts animation (located in mouseup handler) duration duration = new duration(timespan.fromseconds(5.0*oldy/1000)); doubleanimation anim = new doubleanimation(oldy, 0, duration); // move top of canvas _shapeselected.beginanimation(canvas.topproperty, anim); and here mouse move handler private void canvas_mousemove_1(object sender, mouseeventargs e) { if (_shapeselected != null) { point pt = e.getposition(thecanvas); canvas.setleft(_shapeselected, (pt.x-_posofmouseonhit.x) + _posofshapeonhit.x ); canv

c# - Acces denied error when trying to save a distribution group -

when running code shown below, getting error states: an unhandled exception of type 'system.unauthorizedaccessexception' occurred in system.directoryservices.dll. additional information: access denied. it happens on line : group.save(); i have used username , password in other scripts relating active directory have sufficient access need do. although, haven't tried in relation system.directoryservices.accountmanagement library before. i using visual studio 2013 running in admin mode, there shouldn't problem command prompt not running in it. if can give me heads why wouldn't using credentials when saving, appreciated. try { using (principalcontext pc = new principalcontext(contexttype.domain, "domain", "username", "password")) { groupprincipal group = groupprincipal.findbyidentity(pc, "groupname"); dbaccessman

docker - Node.js Koa app and CouchDB in single container -

i have koa.js app want run in docker container. loa app requires couchdb run, want ship in same container. know not best practise indeed best way users started. dockerfile: # docker-version 1.2.0 centos:centos6 # enable epel couchdb , node.js run yum -y update; yum clean run yum -y install epel-release; yum clean run yum -y install tar # install node.js , couchdb run yum -y install couchdb; yum clean run service couchdb start run yum install -y nodejs run yum install -y npm # bundle app source add . . # install app dependencies run npm install run npm install -g n run n 0.11.12 # expose port , run expose 8080 cmd ["npm", "start"] which works fine, app gets launched can't connect couchdb. throwing in a run service couchdb start response ok, seems work, but curl -x 127.0.0.1:5984 response with curl: (7) couldn't connect host same koa.js app: error: error stack=error: connect econnrefused @ exports._errnoexception (util.js:745:11)

string split - Getting Python to read a text file in chunks of 3 (codons) and give me an output -

i have text file containing 3 columns - stop codon, skipping context , sequence of 102 bases come after skipping context looks bit tag gttagct ctcgtggtcctcaaggactcagaaaccaggctcgaggcctatcccagcaagtgctgctctgctctgcccaccctgggttctgcattcctatgggtgaccc tag gttagct cttattcccagtgccagctttctctcctcacatcctcataatggatgctgactgtgttgggggacagaagggacttggcagagctttgctcatgccactc tag gttagct ctattgtgtaactgagcaattcttttcactcttgtgactatctcagtcctctgctgttttgtaactggtttacctctatagtttatttatttttaaatta etc... i want know how can write program read 3rd column of text file (i.e. 102 base sequence) , need read in chunks of threes , pick out stop codons sequence - 'tag', 'tga', or 'taa' , create list or table or similar tell me if each sequence contains of these stop codons , if so, how many. so far have done python read 3rd column of text file: infile = open('test stop codon plus 102.txt', 'ru') outfile = open('tag plus 102 reading inframe.txt', 'w') line

types - Is there a way to demonstrate uniqueness of false-elim -

i can't remember if i've read somewhere, tempting assume ⊥ initial object. must possible construct proofs based on uniqueness of ⊥-elim arrows. like this: false-elim : forall {a : set} -> false -> false-elim () false-iso : forall {a b : set} -> (g : -> false) -> (f : -> b) -> f == (f o false-elim o g) that is, if there arrow ⊥, isomorphic ⊥. ok, if assumption (a -> ⊥) isomorphism wrong, @ least must possible show uniqueness of ⊥-elim: false-elim-uniq : forall {a b : set} -> (f : -> b) -> false-elim == (f o false-elim) but not obvious, too. so, ⊥-elim meant unique in (flavour of) intuitionistic type theory (agda based on)? it possible construct proof if element of can constructed: false-iso : forall {a b : set} -> (g : -> false) -> (f : -> b) -> -> f == (f o false-elim o g) but that's not quite same stateme

postgresql - How to get unique records from Active Record rails 4 based on a column -

i have following models customer payments: customer_id, customer_sign_up, :more_columns now want 1 payment per customer_id.. please remember have many records, , need performance / best way this. this gets me customer_ids: payment.unscoped.where(:customer_sign_up => 1.year.ago..date.today).uniq.pluk(:customer_id) this did not work either: # #payment.unscoped.where(params[:type].to_sym => # date.parse(params[:start])..date.parse(params[:end]) # ).group(["customer_id", "payments.id"]).order("customer_id desc").select("distinct(customer_id), payments.*") i want entire rows of payment. added comment: dont want 1 payment. 1 payment per customer_id: payments: amount, sign_up, customer_id each customer can have many payments. , each customer have many payments sure. and dont want search on customer rather on payments , filter out records there. customer.payments.where(:cus

java - Proper way to handle properties files in spring code base configuration -

i started writing application wanted include spring configuration in java code can. problem encounter properties file. take have writen far: file containing beans declaration: @configuration @importresource("classpath:properties-configuration.xml") public class contextconfigutarion { @value("${database.url}") private string database_url; @value("${database.user}") private string database_user; @value("${database.password}") private string database_password; @value("${database.default.shema}") private string database_default_shema; @bean public basicdatasource datasource() { basicdatasource datasource = new basicdatasource(); datasource.setdriverclassname(com.mysql.jdbc.driver.class.getname()); datasource.seturl(database_url); datasource.setusername(database_user); datasource.setpassword(database_password); return datasource; } @

javascript - google visualization query can't run maximum and sum query -

i'm trying data fusion tables. when use select query data show successfull. when i'm using sum , maximum query firebug show error : "syntaxerror: syntax error error 500 (there's p" when test query fusion query query works. when search based firebug error, it's because i'm not specify script tag script type="text/javascript" . but think it's not actualy error get, because yesterday code works. , today don't know why code doesn't works. can me? help. <!doctype html> <html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> // fusion table data id var ft_tableid = '1j1ag2s_ignbqmm0qp9yyghfg2_rnszoeh4ee80in'; var ft_tableidsp = '1o5aipnhbcimwsyg0goxierh6el-6byd95nd2pdxr'; google.load('visualization', '1', {'packages':['core

php - How can I sold my software? -

i don't know if can ask here well. i have created software, it's developed in php 5.4, laravel 4, xampp v3.2.1, , work software local (localhost/public/something). so question is: if want sell software, how can install in pc of user? i dont know servers, think it's better have data in free server isn't it? recommended tutorial? i don't want install xampp server client , stuff of developer, install software , have easy user. any grateful. you can't sell php software expectation user installs it. functionally possible involves setup you'd never guarantee user able use on small range of systems. they'd have setup web server, database server, various connections etc. or you'd have write installer did them. you're disclosing entire code base user buys software, means there no mechanisms use prevent both software , code being shared freely - nice if you're writing open source, not if plan make money. the best way sell sof

How can I terminate a process with install4j (5.1.11) -

Image
i found link (look " support windows processes "), can't find out how screen in install4j ui. that? just found it: right click , select " add action " , select " miscellaneous " -> " check running processes on indows "

javascript - How to dynamically add script tag in HEAD with AngularJS -

i trying dynamically add script tag in angular application. wrote function: var injectsocketiolib = function (serveraddress) { var wf = document.createelement('script'); wf.src = serveraddress + '/socket.io/socket.io.js'; wf.type = 'text/javascript'; wf.async = 'false'; document.head.appendchild(wf); }; the script injected head tag, in console following error: referenceerror: io not defined how can correctly inject script in head ? edit: if manually add script head dont error , application works correctly resolved code script injection: loadscript = function (src) { var deferred = $q.defer(); var script = $document[0].createelement('script'); script.onload = script.onreadystatechange = function (e) { $timeout(function () { deferred.resolve(e); }); }; script.onerror = function (e) {

performance - Is recursion ever faster than looping? -

i know recursion lot cleaner looping, , i'm not asking when should use recursion on iteration, know there lots of questions already. what i'm asking is, recursion ever faster loop? me seems like, able refine loop , perform more recursive function because loop absent setting new stack frames. i'm looking whether recursion faster in applications recursion right way handle data, such in sorting functions, in binary trees, etc. this depends on language being used. wrote 'language-agnostic', i'll give examples. in java, c, , python, recursion expensive compared iteration (in general) because requires allocation of new stack frame. in c compilers, 1 can use compiler flag eliminate overhead, transforms types of recursion (actually, types of tail calls) jumps instead of function calls. in functional programming language implementations, sometimes, iteration can expensive , recursion can cheap. in many, recursion transformed simple jump, changing

PHP & MYSQL: Get all columns, select * from row and json encode the results -

i trying fetch array mysql , print each column value. this have far: get columns: $query = "show columns user_settings"; $resultx = mysql_query($query);$temp=0;$p = array(); while ($row = mysql_fetch_array($resultx)) { $p[$temp] = $row["field"];$temp++; } foreach column name fetch data user id = $session['id'] foreach ($p $f) { $json = array(); $newquery = "select * user_settings uid = '" . $_session['id'] ."'"; $newresult = mysql_query($newquery); while($newrow = mysql_fetch_array($newresult)) { $json[$f] = $newrow[$f]; } print json_encode($json); } this works fine. problem array printed such: {"column1":"data"}{"column2":"data"}{"column3":"data"} instead i json encode print : [{"column1":"data","column2":"data","colum

php - Unable to resolve leap seconds miscalculation on calendar -

i have calendar showing me wrong days of date day of week. more specifically, 1 day behind actual date. i've done bunch of research , used following question ( php date('d') calculates same output 2 consecutive days ) can't work on script. it's displaying 26th of october twice, there on dates go wrong. $firstday = mktime(0,0,0,$month,1,$year); $day = date('y-m-d',$firstday); $fday = strtotime($day." last sunday ",$firstday); $currday_timestamp = mktime(0,0,0,date('m'),date('d'),date('y')); for($i=0;$i<7;$i++) { $firstweek[$i]['id'] = date("y-m-d",$fday+(86400 * $i)); $firstweek[$i]['val'] = date("d",$fday+(86400 * $i)); if($currday_timestamp > $fday+(86400 * $i)) { $firstweek[$i]['flag'] = 1; } $secondweek[$i]['id'] = date("y-m-d",$fday+(86400 * ($i+7))); $

objective c - iOS & SwipeView: not key value coding compliant -

i'm more or less new ios development. i downloaded following repository include in project: https://github.com/nicklockwood/swipeview it includes horizontal paging view , bases on xib file (exampleviewcontroller) being loaded in mainwindow.xib file (hopefully have understood right!). want incorporate in app , without xib, since i'm using storyboard. view should activated upon button push. now figured suffice transfer viewcontroller class, include in storyboard viewcontroller , include swipeview in it. (the same logic, understanding, applied xibs.) the other change applied transferring contents of awakefromnib in viewdidload. building project yields error: this class not key value coding-compliant key delegate. the first stackoverflow results haven't been useful me - have input maybe? that error means, have property (delegate in case) present in storyboard, not in code of class. right click on controller in storyboard open black info window, , s

Multiple constructors with inheritance c# -

i have base class b multiple constructors. have derived class d has additional fields set in constructor(s), implemented shown below. b(args1) {...} b(args2) {...} ... b(argsn) {...} d(args1, additional) : b(args1) {...} d(args2, additional) : b(args2) {...} ... d(argsn, additional) : b(argsn) {...} problem is, every time new b constructor added new args have make new d constructor. way around this? you have define constructor in derived class if want in base class , expect them identical. could, however, use default values suggested. or, have dictionary-based constructor, derived classes grab values from. could use alternative design pattern factory method, factory, or simplify constructor approach? if want constructors , want add complicated solution, use following. not recommending it, use code sharing/generation technique combination of partial classes (define 1 partial class constructors, , other has of properties/members/etc.) , in partial class has cons

python 2.7 - How to get image Type and size when uploading it ? google app engine -

i using code upload image cloud storage: class uploadimagetocloudstorage(webapp2.requesthandler): def post(self): image = self.request.get("file") gcs_file=gcs.open(gcs_bucket_name+'testimage.png', 'w') gcs_file.write(image.encod('utf-8')) gcs_file.close() self.response.write("succeed !") and form send image: <form action="http://myappid.appspot.com/test/uploadimage" method="post"> <input type="file" name="file" value='file'><br> <input type="submit" value="submit"> </form how check size , type of image before saving in cloud storage ? > if add enctype="multipart/form-data" form element, can use image data instantiate image object using code following: (pay particular attention way mime-type extracted , split detect valid image formats, , fact we're using google

r - Barplot show only specific names (dates) in x axis -

Image
i new in using r , have issue x-axis in barplots. some example t<-seq(as.date("2014-04-09"), as.date("2014-10-09"), by="days") c<-sample(0:100,184, rep=true) x<-data.frame(t,c) rownames(x)<-x[,c(1)] x<-subset(x,select=c(2)) par(las=2) barplot(t(x)) as can see, date on x-axis not nice. want display dates true las=1 orientation of las=2. tried create new object dates names that, not able so. maybe there way in barplot or in making new object names. thanks help solution 1: plot(t,x$c,type="h") edit: plot() solution works fine. if need have stacked bars in new example? t<-seq(as.date("2014-04-09"), as.date("2014-10-09"), by="days") c<-sample(0:100,184, rep=true) f<-sample(0:100,184, rep=true) x<-data.frame(t,c,f) rownames(x)<-x[,c(1)] x<-subset(x,select=c(2,3)) par(las=2) barplot(t(x)) welcome stackoverflow! does want? plot(t,x$c,type="

sql server - Select IN using varchar string with comma delimited values -

i trying search several tables list of phones. the problem converting single string valid comma delimited string use in conjunction in clause. i tried using replace fix problem. declare @phonenumber varchar(3000) set @phonenumber = '6725556666,2124444444' set @phonenumber = '''' + @phonenumber + '''' select @phonenumber '6725556666','2124444444' finally sample sql not recognize string expected: select provider ,phonenumber ,changetype ,changedate dbo.phonelog phonenumber in (@phonenumber) there several ways handle this. 1 option use dynamic sql , inject phone number string variable containing statement , executing this: declare @phonenumber varchar(3000) set @phonenumber = '6725556666,2124444444' declare @sql nvarchar(max) set @sql = n' select provider, phonenumber, changetype, changedate dbo.phonelog phonenumber in (' + @phonenumber + ')&

sql server - In sql, can you join to a select statement that references the outer tables in other joins? -

what want transform following sql select x y left join z on y.id=z.id y.fld='p' into select y y left join (select top 1 id z z.id=y.id order z.primarykey desc) on 1=1 y.fld='p' the reason want because z has multiple rows can joined y, not unique in distinguishable way, other 1 need latest one, , need 1 record. possible? tried mssql complained cannot reference y.id within sub query. how cte approach: ;with cte ( select id, primarykey, row_number() on (partition id, order primarykey desc) rn z ) select x y left join cte on cte.id = y.id cte.rn = 1

authentication - For Grails Spring Security Core, what is the purpose of the VERSION fields in the USER, GROUP and ROLES tables? -

i using grails spring security core plugin 2.0-rc4, , noticed version field created in each of user, groups , roles tables. database expert asking me version field , not find explanation of field. can tell me version field used for, , how used? the version property on gorm managed classes used optimistic locking. can read more in documentation .

sql - Why does the HAVING clause need to come after the GROUP-BY? -

i want understand logically why need having clause after group-by ? select name actor id in ( select actorid casting ord = 1 group actorid having count(*) > 29 ) order name asc it hasn't clicked yet me, why following incorrect : having count(*) > 29 group actorid the reason because sql group records before evaluates having clause. it sql syntax, makes intuitive sense, jeroen points out : having applies result of grouping, in particular, unusual case, sql following chronological order of query steps. 10 tips sorting sql - techrepublic

c# - Determine whether Console Application is run from command line or Powershell -

how determine whether console application being run powershell or standard command line within application? something might more reliable checking window title: using system; using system.diagnostics; process p = process.getcurrentprocess(); performancecounter parent = new performancecounter("process", "creating process id", p.processname); int ppid = (int)parent.nextvalue(); if (process.getprocessbyid(ppid).processname == "powershell") { console.writeline("running in powershell"); } else { console.writeline("not running in powershell"); } [ source ]

css - Sass/Susy mixin issue -

i wanted make mixin column spanning containers in sass using susy framework use include in div , use span-columns such this: @mixin container($columns, $ofcolumns) { @include span-columns($columns,$ofcolumns); } then in css use this: #foo { @include container(4,12); } but error in output css 'mixin container missing argument $columns.' doing wrong here?

html - CSS hover isn't working for my divs -

i can't hover css effect work on divs. here html: <!doctype html><!--html5--> <html lang="en"> <head> <meta charset="utf-8"/> <link rel="stylesheet" type="text/css" href="chaosmain.css"/> </head> <body> <div id="featuredcontent1"></div> </body> </html> here css it: html{ margin:0px; padding:0px; height:100%; width:100% } body{ margin:0px; padding:0px; height:100%; width:100%; background-color:#f0f0f0; color:#f0f0f0; } div{ position:fixed; } #featuredcontent1{ margin-left:8.5%; margin-top:11.7%; width:23%; height:40%; background-color:#f26e24; z-index:-1; border-radius:2px; } #featuredcontent1:hover { width:25%; heig

Hadoop hdfs unable to locate file -

im trying copy file hdfs using below command. filename googlebooks-eng.... etc.... when try list file within hdfs don't see filename being listed.what actual filename? hadoop-user@hadoop-desk:~/hadoop$ bin/hadoop dfs -put /home/hadoop-user/googlebooks-eng-all-1gram-20120701-0 /user/prema hadoop-user@hadoop-desk:~/hadoop$ bin/hadoop dfs -ls /user/prema found 1 items -rw-r--r-- 1 hadoop-user supergroup 192403080 2014-11-19 02:43 /user/prema almost hadoop dfs utilies follows unix style. syntax of hadoop dfs -put hadoop dfs -put <source_file> <destination> . here destination can directory or file. in case /user directory exists directory prema doesn't exist, when copy files local hdfs prema used name of file. googlebooks-eng-all-1gram-20120701-0 , /user/prema same file. if wanted persist file name. need delete existing file , create new directory /user/prema before copying; bin/hadoop dfs -rm /user/prema; bin/hadoop dfs -mkdir /user/prema; b