Posts

Showing posts from July, 2015

mysql - Drupal 7 PDOException: SQLState[42S22], unknown field -

i don't know start error: pdoexception: sqlstate[42s22]: column not found: 1054 unknown column 'created' in 'field list': select created {counter} created<>0 order created desc limit 1; array ( ) in counter_block_view() (line 143 /customers/6/8/3/lmtc.be/httpd.www/drupal/sites/all/modules/counter/counter.module). the error happens on login! the file counter.module looks this: 127 // counter_insert_delay 128 $db_types = db_driver(); 129 switch ($db_types) { 130 case 'mssql': 131 $sql = " select top 1 created {counter} created<>0 order created desc"; 132 break; 133 134 case 'oracle': 135 $sql = " select created {counter} rownum=1 , created<>0 order created desc"; 136 break; 137 138 // mysql, mysqli, pgsql. 139 default: 140 $sql = " select created {counter} created<>0 order created desc limit 1"; 141 } 142 143 $

angularjs - Kendo UI + Angular - v2014.2.903 vs v2014.3.1119 JSFiddle Issues -

i working on upgrading 1 of angular/kendo ui projects v2014.2.903 v2014.3.1119. have encountered few instances v2014.3.1119 breaks functionality worked fine in v2014.2.903. decided create couple jsfiddles illustrate issues, unfortunately, jsfiddle points v2014.2.903 doesn't seem recognize kendo ui. v2014.3.1119 jsfiddle (this works) ... http://jsfiddle.net/lejuan5150/w0711rdg/ v2014.2.903 jsfiddle (this doesn't work) ... http://jsfiddle.net/lejuan5150/4svqnaz6/ both contain same code , configuration aside version of kendo ui referencing. here code: html: <div> <div data-ng-controller="personcontroller"> <div kendo-grid="persongrid" k-options="persongridoptions" k-ng-delay="persongridoptions"> </div> <br /> first name combo box: <select kendo-combo-box="firstnamecombobox" k-options="firstnamecomboboxop

How to Improve a MySQL Query on a 1 Million Record Table -

i have 1 million record mysql table 7 columns. have primary key , fulltext index column. table stands dictionary (size on disk ~300 mb). the columns are: 'id', 'int(11)', 'no', 'pri', null, 'auto_increment' 'writtenform', 'varchar(255)' - fulltext index 'languageidentifier', 'varchar(255)' 'partofspeech', 'varchar(255)' '_index', 'int(11)' 'writtentext', 'longtext' 'lexiconid', 'varchar(255)' when run query: select * tablename writtenform = 'herstellen' i results in 4,5 seconds. me way much, table simple, query has no joins , run locally on pc. i have noticed fulltext index has no collation. might problem? if yes, please let me know how add collation index. i have noticed alteration bring table (add column, drop column) takes more 5 minutes (last column drop took around 15). since you'r

How to upload image from iOS using Swift to a Ruby/Rails server -

i have ruby/rails application want accept image upload in base64 format inside of json request payload. basic app structure follows: import uikit import mapkit class newcafedetailstableviewcontroller: uitableviewcontroller, nsurlconnectiondatadelegate { @iboutlet weak var submitbutton: uibutton! @iboutlet weak var mainimagecell: addimagecell! var submitdata: dictionary<string, anyobject>! override func viewdidload() { submitdata = ["name": "brian"] submitbutton.addtarget(self, action: selector("submit"), forcontrolevents: uicontrolevents.touchupinside) } func submit() { // i\'ve tried submit dynamic image, switched // hard-coded 1x1 gif grip on how on // backend before attempting more submitdata["thumbnail_data"] = "data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7" var error: nserror? var submitjso

Matlab: Assigning same value to (different) fields in the same position of a struct array -

suppose have 1x10 struct my_struct 2 fields: fielda , fieldb . how should assign scalar number (or other entity) on specific position fields in more direct form? in other words, there way this: my_struct(5).fielda = pi; my_struct(5).fieldb = pi; in way this: my_struct(5).* = pi or my_struct(5) = deal(pi) ? you can use combination of fieldnames , cell2struct programmatically build struct same value in fields, , full-struct assignment. function out = setallfields(s, value) %setallfields build scalar struct template, replacing field values % s template struct, , value value desired in fields out = cell2struct(repmat({value}, [numel(fieldnames(s)) 1]), fieldnames(s)); with function defined, can assignment this, using single or multiple target indexes. my_struct(5) = setallfields(my_struct, pi); my_struct([2 4:6]) = setallfields(my_struct, 'foo');

asp.net - Can I pass both the ViewBag AND a Model to a View -

can use hybrid approach passes information in viewbag (c#) / viewdata (vb) includes model for example, started passing simple title through error controller error view: function notfound() actionresult response.statuscode = 404 viewdata.add("title", "404 error") return view("error") end function this worked fine , view had access property @viewdata("title") then wanted include of exception information automatically routed custom errors in handleerrorinfo object this: function notfound( exception handleerrorinfo ) actionresult response.statuscode = 404 viewdata.add("title", "404 error") viewdata.add("message", "sorry, requested page not found.") return view("error" , exception ) end function then, on view, declared model this: @modeltype system.web.mvc.handleerrorinfo now can access properties @model.exception.message @viewdata("title") h

What is the Hadoop ecosystem and how does Apache Spark fit in? -

i'm having lot of trouble grasping 'hadoop ecosystem' conceptually. understand have data processing tasks want run , use mapreduce split job smaller pieces i'm unsure people mean when 'hadoop ecosystem'. i'm unclear benefits of apache spark , why seen revolutionary? if it's in-memory calculation, wouldn't mean need higher ram machines run spark jobs? how spark different writing parallelized python code or of nature. your question rather broad - hadoop ecosystem wide range of technologies either support hadoop mapreduce, make easier apply, or otherwise interact stuff done. examples: the hadoop distributed filesystem ( hdfs ) stores data processed mapreduce jobs, in scalable redundant distributed fashion. apache pig provides language, pig latin, expressing data flows compiled down mapreduce jobs apache hive provides sql-like language querying huge datasets stored in hdfs there many, many others - see example https://hadoopecosy

windows - Pre-multiply pixels after WIC 'Copy Pixels' call -

i have been looking @ creating pargb32 bitmaps. seems necessary produce images work post-xp menu-items. this example http://msdn.microsoft.com/en-us/library/bb757020.aspx?s=6 interesting rather complicated have if ever used ole interfaces before. however, after studying piece of code uses wic , ole think understand how works. 1 thing confuses me comment user 'david hellerman'. summarize, states example function not complete. not take in account potential alpha information in source icon - , if there alpha data must pre-multiplied on pixel pixel basis while scanning through ppvbuffer variable. my question has 2 parts. how detect presence of alpha data in icons while using wic instead of gdi , how go pre-multiplying in pixels if exist? technically, sample code wrong because not account or check format of iwicbitmap object when calling copypixels. createbitmapfromhicon presumably uses specific format (that sample suggests it's 32-bit pbgra comments sugge

How to find a frequent character in a string written in pseudocode. Thanks -

most frequent character design program prompts user enter string, , displays character appears in string. it homework question, teacher wasn't helpful , driving me crazy can't figure out. thank in advance. this have far! declare string str declare integer maxchar declare integer index set maxchar = 0 display “enter want.” input str index = 0 length(str) – 1 if str[index] = and im stuck. dont think right , dont know go it! it seems me way want is: "go through every character in string , remember character we've seen times". however, won't work. if remember count single character, "the character we've seen times 'a' 5 occurrences", can't know if perhaps character in 2nd place doesn't jump ahead. so, have this: go through every character of string. for every character, increase occurrence count character. yes, have save count every single character encounter. simple variables string or int not

node.js - Running UI5 on Node JS server -

Image
i'm trying run ui5 pages on node.js server. i've done till created ui5 project simple index.html file calling other ui5 views showing text message. when run without node js runs fine , shows me message. what i'm trying achieve run on top of node server. i've configured server.js file node , starts fine. in there i'm calling above index.html file. calls fine gives error inside saying sap undefined meaning not able find ui5 resources sap-ui-core.js , error. i'm not sure why not able find it. i've created ui5 project using eclipse provides me ui5 resources under below directory if try put resources directory under web content directory not able find it. after manually putting resources directory: below how index.html looks like: has got resource root define or please if can suggest how can working. awaiting responses eagerly. thanks, aw adding cschuff response: hello, taking time me out. yes apps namespace different , not sap.ui. tho

sql insert - Postgresql not truncating overlength strings -

according documentation , strings longer specified character varying or varchar should truncated: if 1 explicitly casts value character varying(n) or character(n), over-length value truncated n characters without raising error. (this required sql standard.) but can not work. documentation 1 has "explicitly" cast value character varying maybe missing that. below simple test table: create table test1( tval character varying(20)); where following fails error: value long type character varying(20) insert test1 values ('this super long string want see if truncated'); how can work? this won't truncate, because it's assignment: create table test1(tval character varying(20)); insert test1 values ('this super long string want see if truncated'); but will, because it's explicit cast : insert test1 values (cast('this super long string want see if truncated' varchar(20))); to truncation behaviour must use explici

user interface - Mono - Native UI on each platform? -

Image
is possible have 1 core dll written in mono , 3 separated native uis on linux, mac , windows? if yes, options have? let's assume have written gui wpf (windows) , want connect mono dll wpf form can use it's exported functions , classes. same on mac os x: gui written in cocoa , connected mono core dll? do guys know example projects, uses approach? well, can use pcl library contains logic, combined xamarin.mac framework on osx, gtksharp on linux, , wpf on windows. using raw cocoa, that'd tougher; you'd have host mono runtime (which not impossible not easy). edit: should add could try "write once" ui , use gtksharp three.

Calling Google Apps Script as webapp from AppEngine returns 405 -

i have issues when try call gapps script published webapp. trying call service appengine. doing post method script json payload. urlfetch options set follow redirects , timeout of 30 secs. script publicly available , open anonymous users. on local gae development machine , urlfetch response script 200, , fine. when move production , script gets executed returns errors , html page. have follow redirects on on urlfetch , have set deadline 30secs. status response : 405 response text : <!doctype html><html lang="en" ><head><meta name="description" content="web word processing, presentations , spreadsheets"><link rel="shortcut icon" href="//ssl.gstatic.com/docs/common/drive_favicon1.ico"><title>google drive -- page not found</title><link href="//fonts.googleapis.com/css?family=open+sans:300" rel="stylesheet" type="text/css"><style>/* copyright 20

Meteor: Tracker.autorun and dep.changed causing infinite loop -

i using new tracker.dependency tracking several things, causes autorun in code below run infinitely. wrong? code below okay once separate getsong , getsongid depend on dep , dep2, instead of dep. songmanager = { dep: new tracker.dependency, dep2: new tracker.dependency, init: function(songid) { var self = this; this.setsongid(songid); meteor.subscribe('song', songid); tracker.autorun(function(){ var songs = self.getsongcursor().fetch(); if (songs.length > 0) { self.song = songs[0]; self.dep.changed(); } }) }, getsongcursor: function(){ return songs.find({_id: this.getsongid()}); }, getsong: function(){ this.dep.depend(); return this.song; }, getsongid: function(){ this.dep2.depend(); return this.songid; }, setsongid: function(arg){ this.songid = arg; this.dep2.changed(); }, }; the problem you're creating circular dependency. recommend using reactivevar

sql server - Using cursor to loop in SQL -

i have written sql code below return following result set. code allows user select datalibrary (parent) , find underlying datalibraries (child). classification || dlgroup || datalibraryname || usedby || entityname || subentityname inuse || mo || singleorall || mdl || dashboarda || inuse || mo || singleorall || mdl || dashboardb || inuse || mo || singleorall || mdl || dashboardc || -- begin code -- set nocount on declare @selecteddl varchar(50) set @selecteddl = '1264' --begin try --create clustered index [clusteredindex-20130828-063538] on [dbo].[tblrpt_view] --( -- [view_type_id] asc --) --end try --begin catch -- there --end catch declare @pptreports table ( rpt_id integer ) insert @pptreports select rpt.rpt_id dbo.tblrpt_main rpt join dbo.tblrpt_view v on v.rpt_id = rpt.rpt_id , v.view_type_id = 1999 if isnull(@selecteddl,'') = '' set @selecteddl = '0' s

javascript - Sorting a threaded conversation -

not sure how frame one, here goes. it's sorting algorithm question tools have play postgressql , python (2.6) on server , javascript/jquery @ browser end i need move data describes threaded conversation postgres db web page. data starts off in chronological order, want display in threads record numbers small - should never more 100 messages returned so, simple example, imagine table: id reply_to text === ======== ============================= 1 0 hello world 2 0 make me sandwich 3 1 hello 4 2 no chance 5 1 you? 6 5 me of course the end point want reach is hello world hello back who you? me of course make me sandwich no chance or, put way... id reply_to text === ======== ============================= 1 0 hello world 3 1 hello 5 1 you? 6 5 me of

java - How to escape dynamically generated String values in a JCR SQL2 query? -

let's pretend have jcr 2 query string made this: string sql2query = "select * [cq:pagecontent] " + "where [aproperty] <> \" + avalue + "\""; are there helper methods using can escape avalue ? by way, know in sql2 can use placeholders queries , let framework take care of escaping of values us, if create query dynamically, how can escape avalue prevent sql injection construction of broken queries? yes, can use placeholders. dynamically created queries can use placeholders. as sql-2, need use single quotes, not double quotes. example: select * [cq:pagecontent] [aproperty] <> 'joe''s taxi' you need escape single quotes, using single quote escape character: string avalue = "joe's taxi"; string sql2query = "select * [cq:pagecontent] " + "where [aproperty] <> '" + avalue.replaceall("'", "''") + "&

ios - The Left Slide Menu is not working (PFAirViewController) -

i developing ios app left sliding menu . use template link : (btw, coded left sliding menu demo), , prefer use storyboard design ui. thus, transplant api github link. follow instruction still got fatal errors. here link copy of project. me solve issue please. here exception output displayed in console: 2014-12-01 16:08:21.654 fitness main framework[10757:504122] *** terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarrayi objectatindex:]: index 0 beyond bounds empty array' *** first throw call stack: ( 0 corefoundation 0x0000000104e8fb75 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x000000010477fbb7 objc_exception_throw + 45 2 corefoundation 0x0000000104d8772e -[__nsarrayi objectatindex:] + 190 3 fitness main framework 0x0000000103fd196f -[phairviewcontroller savethumbnailimage:atindexpath:] + 159 4 fitness main framework

how to format printing in PYTHON without object length -

so have data i'm trying print file within columns. this current formatting: print_to_file = open('best_and_worst.txt', "w") print("category {:>25s} best {:>25s} worst".format('',''), file=print_to_file) print("heart disease:{0:21s}".format(best_hd_state), file = print_to_file) what want print spaces distance category (in case "heart disease:") until it's aligned "best", print 1 space , value , after print spaces until aligned "worst" print state, space, , value. the problem encounter don't know how deal varying length of objects , further don't know how have variable formatting. (i.e. adjusting number of spaces according length of object , distance between , next column want align with.) whole point of program organize state data csv file , print information new file. can't use single value while formatting because if state data changes things fall out of line. pl

php - Digital Ocean droplet MySQL fails -

from time time goes wrong mysql on server using digital ocean, connections database on server fail , cant log phpmyadmin. see error... "connection controluser defined in configuration failed". restarting using following solves issue sudo shutdown -r but has happened twice , i've no idea how prevent happening again. i found thread no luck there... https://www.digitalocean.com/community/questions/can-t-connect-to-mysql-connection-for-controluser-as-defined-in-your-configuration-failed im running ubuntu 14.04 thank you

Trying to access certain directories in Linux Amazon AWS instance -

my specific problem (and lot of others). i trying access: /etc/sysconfig/iptables-config in aws linux instance. i'm using winscp , able upload/download files in home directory, can't seem in other directory. not having permissions. don't know how change permission settings in instance? or if it's key problem? or else? thanks help! p.s. tips on how text editor onto instance appreciated well. it turns out, needed add word sudo. (face palm)

How to use the stack in x86-64 Assembly? -

i'm having bit of trouble how access variables in stack. here i'm doing: .data .text input: .string "%ld" #format input output: .string "%ld.\n" #format output .global main pushq %rbp #push base pointer, known frame pointer movq %rsp, %rbp #set base pointer stack pointer, reference off of rbp locals subq $8, %rsp #allocate 16 bytes local use movq $input, %rdi #calls scanf in format of input movq %rsp, %rsi movq $0, %rax call scanf subq $8, %rsp movq $input, %rdi #calls scanf in format of input movq %rsp, %rsi movq $0, %rax call scanf movq -8(%rsp), %rbx #stores first number reg rbx movq (%rbx),%rbx movq -16(%rsp), %rcx #stores second number reg rcx movq (%rcx),%rcx movq $output,%rdi #prints in format input movq $0, %rax movq %rcx, %rsi call printf addq $16, %rsp popq %rbp ret

angularjs - Angular ng-repeat dependent on prior ng-repeat -

ive been stuck on problem 2 days , havent been able find right question/example me solve problem. basically im trying generate list of categories using ng-repeat , categories have subcategories. when subcategory present should appear, , when there not 1 should not appear. also, need these generated <%tr%> tags. (i able work needed 'groupby' directive, couldnt work <%tr%> tags). http://plnkr.co/edit/0yjp4b9y0stsm6nzqgbk <table ng-table="tableparams" class="table"> <tbody > <tr ng-repeat-start="user in steps | filter:categoryfilter" ng-class="{subcategory:user.subcategory==1}"> <td data-title="'step name'" ng-class="{textcolorpink:user.subcategory==1,textcolorblue:user.subcategory==0}"> {{user.categoryname}} </td> <td data-title="'substep'" ng-class="{textcolorwhite:user.subcategory==0}"> {{user.ca

html5 - why are table cells different size despite same content? -

i have table 2 rows , 3 columns. 2 right cells smaller in width 2 left ones. why this? content same in both. thx help. <div id="tablecontain"> <div id="tabrow1"> <div id="tabcell">the gibberish (nonsense text) presented here </div> <div id="tabcell"> <img src="images/flora/tree-of-life.jpg" /> </div> <div id="tabcell">the gibberish (nonsense text) presented here </div> </div> <div id="tabrow2"> <div id="tabcell">the gibberish (nonsense text) presented here </div> <div id="tabcell"> <img src="images/flora/tree-of-life.jpg" /> </div> <div id="tabcell">the gibberish (nonsense text) presented here </div> </div> </div> #tablecontain { display: table; width: 600px; margin: auto;

string - Displaying complex numbers in java -

my goal today able add, subtract, multiply , divide complex numbers (a+bi) , show data somehow. knew difficult arise when tried create method divides complex numbers. should display approximately 0.39189-.1486i if math correct or ((29-11i)/74). output is: -0.041666666666666664+0.4583333333333333i , incorrect. can me find error in complexdiv method? here code: public string complexdiv(complexnumbers other) { string r = double.tostring(((real*other.real)-(complex*other.complex)) / ((other.real * other.real)-(other.complex * other.complex))); string c = double.tostring((-(real*other.complex)+(other.real*complex)) / ((other.real * other.real)-(other.complex * other.complex))); return r + "+" + c + "i"; } here testing class call method: public class complextest { public static void main(string[] args) { complexnumbers c1 = new complexnumbers(); complexnumbers c2 = new comple

python - raise dict keys to the power of their value and multipy together quickly -

i'm trying take dictionary , (1) raise each key power of value, , (2) multiply results of (1). this needs done several million rows of data. thoughts on how speed process? using pandas data frame's map function apply function totheexp column of data already. step still pretty slow though. i'm trying like: import ast numpy import array functools import reduce import operator def totheexp(d): return reduce(operator.mul, array(d.keys())**array(d.values()), 1) totheexp({2:3,4:5,6:7}) >>> 2293235712 what using comprehension, example: from functools import reduce operator import mul print(reduce(mul,(k**v k,v in {2:3,4:5,6:7}.items()),1) #2293235712

Golang sql database open and close -

in go database/sql package says rare close database db.close because meant shared many go routines. 1 better when given 100 functions queries same data: open database inside each function open database 1 time , use same connection every 100 function. 1 easier because if 1 fails other 99 can still working. , no need pass database connection arguments. in performance wise 1 better? you missed important part of documentation says: the returned db safe concurrent use multiple goroutines , maintains own pool of idle connections . thus, open function should called once. necessary close db. (emphasis mine) so, option #2 doesn't make sense. connections pooled - use same connection every 100 function doesn't apply. also, option #1 waste of time - once documentation states, call ping after make sure fine (and have attempt connect database - regardless of driver).

java - JButton array ActionListener value -

for(gbc.gridy = 3; gbc.gridy > 0; gbc.gridy--) for(gbc.gridx = 0; gbc.gridx < 3;gbc.gridx++) { grid[btnnum] = new jbutton("" + (btnnum+1)); grid[btnnum].setpreferredsize(new dimension(75,75)); frame.add(grid[btnnum], gbc); grid[btnnum].addactionlistener(this); grid[btnnum].addkeylistener(this); btnnum++; } i have array of buttons displayed in 3x3 grid , each 1 has action listener. public void actionperformed(actionevent e){ string output = ""; if(e.getsource() == grid[0]){ system.out.println("button 1"); } } is not correct? complete example in context: public class buttongrid implements actionlistener, keylistener{ jframe frame=new jframe(); //creates frame jbutton[] grid; //names grid of buttons public buttongrid(){ //constructor frame.settitle("mpc");

applet - How to "disable a method" in java and make it active in an actionPerformed method if that makes any sense -

situation: calling method draw paint method. however, want draw if convert button clicked. how tell java not draw3drectangle unless (ae.getsource==convert)?? new gui can tell, simple answers please. appreciate help. code: public class simpgui extends applet implements actionlistener { button convert; label celsius; label farenheit; textfield cels; textfield fare; string message = ""; public void init() { convert = new button("convert"); celsius = new label("celsius"); farenheit = new label("farenheit"); cels = new textfield(15); fare = new textfield(15); add(convert); add(celsius); add(cels); add(farenheit); add(fare); convert.addactionlistener(this); } public void paint(graphics g) { fare.setlocation(160,50); farenheit.setlocation(90,50); convert.setlocation(310,5); draw(g); } public void actionperformed (actionevent ae)

Opening an existing siaqodb instance on Windows Phone -

i manage create database , use it, exception when trying initiate existing one. var store = new siaqodb("storageplace"); additional information: genericarguments[0], 'system.nullable`1[system.double]', on '#=qestot0z3wa12drpji9vycgxf14qudof1q8lag3hgemk=[#=qcmb_qbvbwsh22$$jqwsgoa==]' violates constraint of type '#=qcmb_qbvbwsh22$$jqwsgoa=='. any suggestions? you added index on nullable types. indexes on nullable types not supported.

c# - If Statement for Floats? -

how make if statements using floats? code have follows: {float p1 = float.parse(textbox1.text); if (p1 == ""){messagebox.show("home");}} the p1 if statement on second line not work. how make proper if statement this? edit: should explain. goal check empty box. can't use string command since want interpret numbers. thanks in advance help. float values cannot "empty". if try parsing empty string float , runtime error. you need check string being empty before parsing, , parse more "conservative" tryparse method not throw exception. if (string.isnullorwhitespace(textbox1.text)) { messagebox.show("home"); } float p1; if (!float.tryparse(textbox1.text, out p1)) { messagebox.show("textbox1 not float"); } note: in general, comparing float s equality == operator not idea, because float not exact representation. this q&a discusses problem in java, issue relevant in languages use floating

php - how to only show some of the fields in an INNER JOIN -

i have following results.. problem want 1 field balances table , 2 fields userinfo table... if replace * user,avatar error... $result = mysql_query("select * userinfo inner join balances on userinfo.user = balances.user order balance desc,avatar"); if (!$result) { die("query show fields table failed"); i not know proper form , cant find anywhere tia john as user column exists in both joined tables userinfo , balances need prefix table name while accessing column try select userinfo.user, userinfo.avatar, balances.balance userinfo inner join balances on userinfo.user = balances.user order balance desc,avatar

python - how to make a pandas dataframe column into a datetime object showing just the date to correctly sort -

when sort on month_date in dataframe (df) contains [2014-06-01, 2014-07-01, 2014-08-01,2014-09-01,2014-10-01] following: result = df.sort(['month_date'], ascending=true) however result (in order): 10, 6, 7, 8, 9, whereas expected 6, 7, 8, 9, 10 maybe because didn't specify month_date column should datetime object (and contain date , no time component. how make month_date column in dataframe datetime object contains date pandas understands sorted in following order: 6, 7, 8, 9, 10, update - ys-l correct answer below df = pd.dataframe({'month_date': ['2014-06-01', '2014-01-01', '2014-08-01','2014-09-01','2014-10-01']}) df['month_date'] = pd.to_datetime(df['month_date']) print df.sort(['month_date'], ascending=true) you can use pandas.to_datetime convert column datetime type, , perform sorting: df = pd.dataframe({'month_date': ['2014-06-01', '2

triggers - How to let MySQL NOW() function return the user time -

i ran tricky mysql issue.. our db using type datetime updated_at column, , late change timestamp . i'm trying add trigger update updated_at column on table changing. following did: create trigger foo_schema.bar_datetime_trigger before update on foo_schema.bar each row set new.updated_at = now(); the now() function here returns db time; however, want set udpated_at user time (meaning time of user made changes table bar ). possible handle in mysql?

c++ - How to joing window group on QNX using QT platform native interface? -

in qquickitem got window group name follows: qplatformnativeinterface* interface = qcoreapplication::instance()->platformnativeinterface(); char* groupname = (char*) interface->nativeresourceforwindow( "windowgroup", window() ); i trying figure out how join window group. there little if documentation on qt platform native interface. found following via google search: https://qt.gitorious.org/qt/qtbase/source/b08cc0ec6f096d0e6764486c81264c24a406bee1:src/plugins/platforms/qnx/qqnxwindow.cpp at point following creation of qqnxwindow object, application can change window group has joined. done using \e setwindowproperty function of native interface set \e qnxwindowgroup property desired value, example: \code qquickview *view = new qquickview(parent); view->create(); qguiapplication::platformnativeinterface()->setwindowproperty(view->handle(), "qnxwindowgroup", group); so question &

c++ - Arduino can't get my boolean to work -

i cant boolean work don't know i'm doing wrong it. take @ code , give me hint on wrong it? have tested different ways write without success. time boolean worked when put code under void loop. can't use there. #include <remotereceiver.h> boolean statusled1 = false; void setup() { serial.begin(115200); // initialize receiver on interrupt 0 (= digital pin 2), calls callback "showcode" // after 3 identical codes have been received in row. (thus, keep button pressed // moment) // // see interrupt-parameter of attachinterrupt possible values (and pins) // connect receiver. remotereceiver::init(0, 3, showcode); } void loop() { } // callback function called when valid code received. void showcode(unsigned long receivedcode, unsigned int period) { // note: interrupts disabled. can re-enable them if needed. // print received code. serial.print("code: "); serial.print(receivedcode); serial.print(", period duration

c# - How to use Delegate actions as a parameter? -

i used delegate action parameter in method follows: private ienumerable<sc.serverpathservices.gafpfileinfo> startprojectarchive(int32 projectid, int32 sourceserverpathid, action uirefresh,action<ienumerable<projectfile>> popupfiles) here have 2 delegates. have problem popupfiles delegate. i calling in method passing list of files parameter popupfiles follows: if(popupfiles!=null) popupfiles(filesmodifiedinsourceserver); here filesmodifiedinsourceserver contains list of files. calling in code behind file follows: archiveresponse = projectmanager.startprojectarchive(projectid, 0, () => { foreach (control control in tdfilelist.controls.cast<control>()) { if (control dell.afp.usercontrol.projectfilelistbasecontrol) { ((projectfilelistbasecontrol)control).refresh();

Analyzing MongoDb aggregation performance -

i trying millisecond (< second) response time aggregation collection. however, takes 3-5 seconds small data size (~200mb). expected data in production collection around 100gb per shard. checked following already - response time same when tried query individually on each shard. - checked profiling output , see high timelockedmicros , numyield. - couldn't find unusual in mms charts too. feel overloooking silly here. analyze further highly appreciated. cluster , collection details provided below cluster - 6 nodes of 34 gb, 4 core machines (aws m2.2xlarge) data size 1,285 mb (213 mb per shard) no of records = 5.5 million (~1 m per shard) records sample { "_id" : { "itemid" : 105182, "devicetype" : 16, "itemversionid" : 117971, "timestamp" : isodate("2014-11-14t00:00:00z"), "recordtype" : 1 }, "dim1id" : 102260, "dim2id" :

Delayed Jobs with Action Mailer using Mailjet API on a Heroku Rails App -

looking send delayed jobs mailer mailjet's api, emails not being sent. works locally foreman, again, on development on heroku not sending. delayed jobs table created. here's gemfile gem 'mailjet' gem 'delayed_job_active_record' the controller def create @article = article.new(article_params) if @article.save # send email referral email all_users = user.all all_users.each |user| articlemailer.delay.article_confirmation(user,@article) end redirect_to @article else render 'new' end end the mailer class articlemailer < actionmailer::base def article_confirmation(user,article) @user = user @article = article mailjet::messagedelivery.create( to: user.email, from: "[email]@gmail", subject: "[html]", html: "[html] end end the /environments/development.rb file config.action_mailer.delivery_method = :mailjet config.actio

python - Android: Playing a sound from Kivy background service -

i trying create simple alarm clock in kivy android. i've got communication between background app , user interface (ui): background app sending data ui @ specified hour. but can't generate sound or vibration service. works ui, not service. i did try sound.play() kivy.core.audio . logcat: attributeerror: 'nonetype' object has no attribute 'play' the same if use jnius vibrate: attributeerror: 'nonetype' object has no attribute 'getsystemservice' i did try vibrations pyjnius this way , sound sound, which, said works on ui, this: from kivy.core.audio import soundloader sound = soundloader.load('sound.wav') and then: sound.play() update: after lafadas' update sound still not play, function continues after error , not break instantly. in logcat see this, if relevant: kivy service log: [info ] logger: record log in /storage/emulated/0/org.alkowatch/service/.kivy/logs/kivy_14-12-02_3.txt [

asp.net - Task scheduling in Vb.net -

my requirement schedule reports @ particular time , frequency, i.e. weekly, monthly or daily. this reports should mailed @ specified time attachment @ scheduled. thanks in advance there great framework called hangfire can use schedule tasks in .net: http://hangfire.io/ you'll need create method running report , sending email can schedule task hangfire framework. for other alternatives take @ blog entry hanselman: http://www.hanselman.com/blog/howtorunbackgroundtasksinaspnet.aspx

groovy - HTTPBuilder query parameters -

i trying understand simplified of http builder. succeeded simple request similar rest request. def client = new httpbuilder('http://pokeapi.co') def resp = client.get(path: '/api/v1/pokemon/1') static void main(string[] args){ def h = new http() print h.resp.name } what trying next adding parameters query. def client = new httpbuilder('http://svcs.sandbox.ebay.com') def resp = client.get(path: '/services/search/findingservice/v1', contenttype: text, query:[ 'security-appname': app_id, 'operation-name':'finditemsbykeywords', 'service_version':'1.0.0', 'response-data-format':'json', 'callback':'_cb_finditemsbykeywords', 'rest-payload': '',

Android studio SDK manager disabled in configuration window -

Image
i have installed android studio , open, went configure section configure sdk manager, not active in here below image have updated latest version of android studio, how fix this it disables sdk manager if don't have sdk set manage. screen, go project defaults > project structure > sdk location , point android studio android sdk , jdk.

objective c - retain (or strong) attribute does not match the property inherited from nswindowcontroller -

when made app (non arc) 10.10 os x compatible getting warning property @property (nonatomic, retain) masterdocument *document ; where masterdocument of type nsdocument . and getting warning as retain (or strong)' attribute on property 'document' not match property inherited nswindowcontroller. also getting warning same property : 'atomic' attribute on property 'document' not match property inherited nswindowcontroller.** can suggest me reason warning , how clear this. you've created subclass of nswindowcontroller , you're adding property exists on parent class. you're getting warning because you're changing definition of existing property, fact you're changing memory management assign retain. the second warning because you're changing access atomic nonatomic . the original property (according docs) is: @property(assign) id document you omit redeclaring property , use existing one, or, @