Posts

Showing posts from June, 2012

javascript - Convert set date to user's local time automatically -

i creating application have pretty big set of dates , times, , need display these in user's local time , date. set dates , times in bst; example 08-24-2014 16:00 bst = 08-24-2014 11:00 est . now, before coming here spent 3-4 hours looking answer if anything, got more confused. is there way, convert set of bst dates , times user's local settings automatically without them setting time zone etc? p.s.: have 2 ideas in mind don't know if work nor how execute them. 1) , change bst date , time , convert unit of measurement; , change user's local date , time , covert same unit of measurement above, calculate difference in new measurement, , convert user's local time. 2) use geolocation find user's date , time/ time zone and; convert bst whatever geolocation spits out. you can users machine timezone in javascript: var currentdate = new date(); var currenttimezoneoffsetinhours = currentdate.gettimezoneoffset() / 60; see documentation here: https:

r - Reshaping panel data -

i need reshape data panel data analysis. searched internet , found out how desired results using stata; supposed use r , excel. my initial , final data(the desired result) looks similar given in first page of example of reshaping data stata. http://spot.colorado.edu/~moonhawk/technical/c1912567120/e220703361/media/reshape.pdf is attainable r or excel? tried using melt function reshape2 library, yet get countryname productname unit years value 1 belarus databasehouseholds '000 y1977 2942.702 2 belarus databasepopulation '000 y1977 9434.200 3 belarus databaseurbanpopulation '000 y1977 4946.882 4 belarus databaseruralpopulation '000 y1977 4487.318 5 belarus originalhouseholds '000 y1977 na 6 belarus originalurban households '000 y1977 na 7 poland .............................................. ........................................................... when this: countryname years databasehouseholds d

android - Couldn't read row 0, col -1 from CursorWindow, Cursor initialization error -

i getting error while executing code. couldn't read row 0, col -1 cursorwindow. make sure cursor initialized correctly before accessing data it. my db code follows package com.routecounselor; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; public class project_db extends sqliteopenhelper { public project_db(context context) { super(context, "mydb.db", null, 1); // todo auto-generated constructor stub } @override public void oncreate(sqlitedatabase db) { // todo auto-generated method stub db.execsql("create table route(routeid integer primary key autoincrement,routenumber varchar(5))"); db.execsql("create table stop(stopid integer primary key autoincrement,stopname varchar(40),lat double,lon double)");

regex - Lines with 10 columns to be modified into lines with 3 columns -

i have huge data file containing 10 columns per line. must rearranged such contains 3 columns per line. can sed or awk or perl me? example, following lines -6.222 -5.809 43.663 3.778 -5.809 43.663 7.784 5.483 -14.013 6.873 5.197 -13.865 5.648 -0.107 -14.156 5.485 -1.058 -14.103 -0.809 7.565 -11.708 -1.157 6.740 -11.343 -0.687 -7.913 -15.833 -0.823 -8.865 -15.733 must become -6.222 -5.809 43.663 3.778 -5.809 43.663 7.784 5.483 -14.013 6.873 5.197 -13.865 5.648 -0.107 -14.156 5.485 -1.058 -14.103 -0.809 7.565 -11.708 -1.157 6.740 -11.343 -0.687 -7.913 -15.833 -0.823 -8.865 -15.733 i appreciate help. thanks! an alternate solution using command line utilities tr , fold $ tr '\n' ' ' < file | fold -w24 -6.222 -5.809 43.663 3.778 -5.809 43.663 7.784 5.483 -14.013 6.873 5.197 -13.865 5.648 -0.107 -14.156 5.485 -1.058 -14.103 -0.809 7.565 -11.708 -1.157 6.740

java - Use cases for ServletContextAttributeListener -

i understand can use javax.servlet.servletcontextattributelistener if want know attribute in web app context has been added, removed or replaced. practical use cases listener? (i googled around while, not find practical examples listener.) the javax.servlet.servletcontext interface represents view of web application filters , servlets belongs to. through servletcontext interface, servlet or filter can access raw input streams of web application resources, mechanism logging information, virtual directory translation, , application scope binding objects. the application scope binding objects consists common objects servlets , filters. objects should consistent rules, change should checked. , 1 of cases javax.servlet.servletcontextattributelistener can used.

Updating called data within ajax embedded php pages via mysql(no errors appearing) -

so attempting have page via drop down menu populated database(working) calls desired data set modified. have sql injection protection implemented, drop down menu populates , desired dataset displayed. how ever can not figure out how submit data has been changed. there no error appears, nothing appears happen. have checked within database ensure data values not in fact being changed , not. appreciated! table8.php <html> <head> <script> function showuser(str) { if (str=="") { document.getelementbyid("txtdisp").innerhtml=""; return; } if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("txtdisp").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get",&

php - Deprecated: mysql_connect() Error Code -

this question has answer here: the mysql extension deprecated , removed in future: use mysqli or pdo instead [duplicate] 1 answer my host upgrade php version , part of website shows following error: deprecated: mysql_connect(): mysql extension deprecated , removed in future: use mysqli or pdo instead in url/structure/here on line 49 that referencing below code: function dbconnect() { $this->connectcount ++; //echo "$this->connectcount<br>"; if ($this->dbtype == 'mysql') { $dbconnect = mysql_connect($this->dbhost, $this->dbuser, $this->dbpasswd) or die ("mysql connection failed: " . mysql_error()); mysql_select_db($this->dbname, $dbconnect); } if ($this->dbtype == 'postgresql') { $dbconnect = pg_connect("host=$this->dbhost port=$this->dbpo

c - Creating referenced table element -

i created more or less complex table in c. want create reference on lower level of tree. possible? idea: elem000 +--> elem010 +--> elem020 +--> elem120 | +--> **elem121** | +--> elem122 +--> elem030 +--> elem130 | +--> elem131 | +--> elem132 +--> **elem121** the elem121 should visible 1 level above, i.e. reference i added example of wanted to.. void pushl(lua_state *l, const char * str) { char s[255]; strcpy(s, "elem"); strcat(s, str); lua_pushstring(l, s); // key strcpy(s, "value"); strcat(s, str); lua_pushstring(l, s); // value lua_settable(l, -3); } void maketable( lua_state *l ) { lua_pushstring(l, "tbl0"); // name of sub-table lua_createtable(l, 0, 0); lua_checkstack(l, 3); { pushl(l, "000"); lua_pushstring(l, "tbl1"); lua_createtable(l, 0, 0); lua_checkstack(l, 3); { pushl(l, &

javascript - Google Maps API: Combining Directions Service with watchPosition Geolocation -

i'm trying display map using google's directions service origin, destination, , blue directions line connecting two. however, trying use watchposition origin lat/lng. so far displays correctly, except green origin marker doesn't move watchposition updates new lat/lng coordinates. i'm trying possible? or have create third marker follows user's coordinates? here have in script: var directionsdisplay; var directionsservice = new google.maps.directionsservice(); var map; function initialize() { directionsdisplay = new google.maps.directionsrenderer(); var mapoptions = { zoom:7, center: new google.maps.latlng(38.5815719, -121.4943996) } map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); directionsdisplay.setmap(map); calcroute(); } function handlenogeolocation(errorflag) { if (errorflag) { var content = 'error: geolocation service failed.'; } e

r - divide list into vectors -

i have list : list <- list(a=1, b=1:3, c=4) if unlist returns following: > unlist(list) b1 b2 b3 c 1 1 2 3 4 is there way pull list apart can get: a <- 1 b <- 1:3 c <- 4 thanks following rawr's advice, avoid naming objects "list", "dataframe", etc a non-optimal solution using for-loop data list: for (i in 1:length(data)) { assign (names(data)[i],data[[i]]) } checking objects created: > ls() "a" "b" "c" "data" "i" > [1] 1 > b [1] 1 2 3 > c [1] 4

python - PyQT - referencing a widget within a specific tab -

for example, want button in tab clear textedit box in tab, (i know can directly want know how widget function) can't figure out how reference textedit: (indentation messed here fine @ end) #!/usr/bin/python import sys pyqt4 import qtgui, qtcore class cc(qtgui.qwidget): def __init__(self): super(cc, self).__init__() self.initui() def initui(self): tab_widget = qtgui.qtabwidget(self) ################## tab1 tab1 = qtgui.qwidget() layout = qtgui.qvboxlayout(tab1) ###### add widgets layout clear = qtgui.qpushbutton('clear results box', tab1) clear.resize(clear.sizehint()) clear.move(50, 50) clear.clicked.connect(self.clearit) results = qtgui.qtextedit(tab1) results.move(250, 50) results.setfixedwidth(450) results.setfixedheight(350) ###################### tab_widget.addtab(tab1, "tab 1") mainlayout =

python - itertools aparent bug with pygraphviz and return chain to flask -

i finding possible bug chaining several methods in return statement in flask. wanted see if had suggestions on how around problem. here code: #!/usr/bin/env python import flask import time itertools import chain pygraphviz import agraph class testclass(object): def __init__(self): g = '' def worker(self): a='1234' b=a + '45\n' yield b time.sleep(3) yield def worker2(self): time.sleep(3) c = '\n9876' yield c def graph(self): g = agraph(overlap='false') tc = testclass() app = flask.flask(__name__) @app.route('/') def test_method_get_stuff(): return flask.render_template('index.html') @app.route('/', methods=['post']) def test_method_post_stuff(): def test_method_sub_function(): return chain(tc.worker(), tc.worker2(),tc.graph()) return flask.response(test_method_sub_function(),mimetype= 't

git - Avoid merging issues on developers's feature branches from messing up master branch's history -

we migrated svn -> git (using stash) . after migration , have started seeing issues during merge developers messing merge on feature branch. **our workflow model:-** master 1---2----3------------4----5 | | | | | | | | m | | | feature1 | a--------b--- | | | m | feature2 c-----------------d------- in above figure lets developer1 has feature branch feature1 , has done changes , merged develop. developer2 has branch created before developer1's branch going around longer time. once changes done, pulls in changes master branch , resolves conflicts , merges in. the problem when developer2 merges changes local branch resolving merge conflicts preferring own files. however, overriding of files has not changed . when creates pull request , merges master, rolls changes of developer1 previous version. can fire out because file rolls previous commit (sha) id the questi

javascript regex test() not recognising danish characters -

i have made search-function, facebooks searchfield autocomplete, using javascript , regex. works fine, when search danish letters Æ, Ø, Å, .test() function won't recognize , nothing returned. this how search part working: var regxsearch = "\\b"+sterm; //sterm value of search field var regx = new regexp(regxsearch,"gi"); var namecheck = regx.test(users[i]["user"]["name"]); imagine usernames asbjørn, østergård , jason: if search "asbjør", "asb" or "ørn" return true. if search "øster" or "østergård" return false. if search "stergård", "ård" or "rd" return true if search "j", "jas", "jaso" etc return true if search "ason" or "son" return false i found fiddle able search æøå, works when search entire word. i'm not enough decode how works, maybe can use find possible fix problem: http://jsf

Multiple font sizes - Javascript/jQuery typing effect -

i have created simple typing effect, illustrated here: http://jsfiddle.net/kitsonbroadhurst/fzf70ttg/9/ my issue large text typed moves whole line , down. is possible keep text on same level multiple fonts styles , sizes added? (i.e. large fonts added smaller text not move vertically) i have tried use position: relative wrapper div , position: absolute keep on same line, did not work. .wrapper { position: relative; } .text-box { position: absolute; bottom: 0; } i rather not use type of plugin , prefer coded solution. set line height won't jump: p { line-height: 75px; } with box model, browser calculate height dynamically according text size. putting hard size on element prevent this.

Imacros - Invitation code missing 3 letters/numbers -

imacros. have find out invitation code site, it's code contains letters(a-z) , numbers(0-9). there 3 missing, xxx exemple. but, how make "for" considerate letters , numbers on imacros? have use javascript? this code have: version build=8820413 recorder=fx tab t=1 tab closeallothers url goto=(url site) tag pos=1 type=input:text form=action:confirmcod.php attr=name:cod content=123xxxabc tag pos=1 type=input:submit form=action:confirmcod.php attr=* one way without using javascript preload datasource of possible combinations link. iterate on document until find proper link. version build=8820413 recorder=fx tab t=1 tab closeallothers set !datasource c:\mysource set !datasource_columns 1 set !datasource_line {{!loop}} url goto=(url site) tag pos=1 type=input:text form=action:confirmcod.php attr=name:cod content={{!col1}} tag pos=1 type=input:submit form=action:confirmcod.php attr=* wiki page imacro datasource. if want use javascript need use iimplay

php - newsletter blast out script fail to blast out letter -

every time i'm try run script keep getting these error messages (warning: mysql_num_rows(): supplied argument not valid mysql result resource in /home/a9016774/public_html/cronjob/blast_script.php on line 9) and (warning: mysql_fetch_array(): supplied argument not valid mysql result resource in /home/a9016774/public_html/cronjob/blast_script.php on line 21). here code: <?php /* ------------------------------------------------------------------- script written adam khoury @ www.developphp.com january 1, 2010 please retain credit when displaying code online ---------------------------------------------------------------------- */ include_once "../connect_to_mysql.php"; $sql = mysql_query("select * newsletter received='0' limit 20"); $numrows = mysql_num_rows($sql); // added "end campaign check" @ bottom of file(not shown on video) $mail_body = ''; while($row = mysql_fetch_array($

javascript - Scale ScrollView without breaking scrolling -

short question. how can add size modifier using transitionable scrollview, without breaking scrolling ? seems it's blocking events in way. code: define('main', function (require, exports, module) { var engine = require('famous/core/engine'); var surface = require('famous/core/surface'); var transform = require('famous/core/transform'); var scrollview = require('famous/views/scrollview'); var modifier = require("famous/core/modifier"); var transitionable = require("famous/transitions/transitionable"); var context = engine.createcontext(); var sizetrans = new transitionable(0); var sizemodifier = new modifier({ transform : function(){ var s = sizetrans.get() + 1; return transform.scale(s, s, 0); } }); var scrollview = new scrollview(); var surfaces = []; scrollview.sequencefrom(surfaces)

java - hibernate proxy object after system.out -

i'm new hibernate , have problem. if this: session sesion = hibernateutil.getsessionfactory().opensession(); transaction tx = sesion.begintransaction(); obj = (a) session.load(a.class,id); system.out.println(obj); tx.commit(); session.close(); return obj; there no problem , gui shows object's data. but if this: session sesion = hibernateutil.getsessionfactory().opensession(); transaction tx = sesion.begintransaction(); obj = (a) session.load(a.class,id); // don't use system.out.println(obj); tx.commit(); session.close(); return obj; the gui doesn't show , got following exception. org.hibernate.lazyinitializationexception: not initialize proxy - no session i've been reading api it's whole new world me. knows what's going on? instead of using session.load(..) , need use session.get(..) a obj = (a) session.get(a.class,id); the session.load(..) lazy loads object using proxy, hence if object not accessed (in example using s

ruby on rails - How does rolify keep track of roles? -

rolify has join table called user_roles keeps track of relationships: user_id role_id but here's what's weird. when empty table of data each user still has role remembered. i'm trying manipulate database in specs, , it's impossible because of spookiness. look @ console: user = user.save irb(main):022:0> user.roles # nothing weird, have before filter make every new user guest => #<activerecord::associations::collectionproxy [#<role id: 1, name: "guest", resource_id: nil, resource_type: nil, created_at: "2014-08-17 10:04:57", updated_at: "2014-08-17 10:04:57">]> irb(main):023:0> usersrole.all.each |role| puts role.inspect end => [#<usersrole user_id: 2, role_id: 1, id: 4>, #<usersrole user_id: 2, role_id: 1, id: 5>] irb(main):024:0> usersrole.all.each |role| role.delete end => [] # empty! irb(main):026:0> user.roles # no way should => #<activerecord::associations::collectionprox

c - timer_settime calling handler function in pthread on uClinux -

i've got following function gets called pthread_create. function work, sets timer, other work , waits timer expire before doing loop again. however, on first run of timer, after expires program quits , i'm not totally sure why. should never leave infinite while loop. main thread accesses nothing thread , vice versa (for now). my guess might not have setup correctly thread, or timer not calling handler function correctly. perhaps changing idle global variable thread causes problem. i call handler without signals, hence use of sigev_thread_id. i'm using sigusrx signals in main thread anyway. thoughts i've started here wrong? #ifndef sigev_notify_thread_id #define sigev_notify_thread_id _sigev_un._tid #endif volatile sig_atomic_t idle = 0; timer_t timer_id; struct sigevent sev; void handler() { printf("timer expired.\n"); idle = 0; } void *thread_worker() { struct itimerspec ts; /* setup handler timer event */ memset (&sev,

OpenGL glFramebufferRenderbuffer() get error: GL_INVALID_OPERATION, status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT -

i'm trying texture rendering using cocos2d , opengl. after called glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, _depthrenderbufffer) i checked status, using: glenum status = glcheckframebufferstatus(gl_framebuffer); and turned out status gl_framebuffer_incomplete_attachment i checked error using glenum error = glgeterror(); and result gl_invalid_operation according the documentation cause of gl_invalid_operation because: the default framebuffer object name 0 bound. or if renderbuffer neither 0 nor name of existing renderbuffer object i checked framebuffer , renderbuffer, neither of them 0, not sure wheather there other rederbuffer object has same name. does 1 know how fix issue? the detailed code using: ..... glint oldrbo; glgetintegerv(gl_renderbuffer_binding, &oldrbo); // generate fbo glgenframebuffers(1, &_fbo); glbindframebuffer(gl_framebuffer, _fbo); // associate texture fbo glframebuffertexture

Python:How to determine whether the dictionary contains multiple keys? -

d={'a':1, 'b':2, ...} if 'a' in d , 'b' in d , ...: pass is there simple way determine multiple keys @ once? like: if ['a', 'b'] in d: you can do if all(key in d key in ['a', 'b', 'c', ...]): this may longer writing them out separately if you're testing couple, list of keys tested grows longer, way quicker, since have add key list , not write additional in d and .

python - Sort a linked list in O(n log n) time using merge sort -

this algorithm practice of leetcode. , below code: class listnode: def __init__(self, x, next=none): self.val = x self.next = next class solution: # @param head, listnode # @return listnode def sortlist(self, head): if head none or head.next none: return head first, second = self.divide_list(head) self.sortlist(first) self.sortlist(second) return self.merge_sort(first, second) def merge_sort(self, first, second): if first none: return second if second none: return first left, right = first, second if left.val <= right.val: current, head = left, first left = left.next else: current, head = right, second right = right.next while left , right: if left.val <= right.val: current.next = left left = left.next else:

How to put marker on android map location? -

after find location mcurrentlocation = mlocationclient.getlastlocation(); how can add marker that location? making marker markeroptions marker = new markeroptions().position(new latlng(latitude, longitude)) requires position object, there way can retrieve position location object? or done in other way? you can use getlatitude() , getlongitude() of location class return double can pass in new latlong constructor. sample: markeroptions marker = new markeroptions().position(new latlng(mcurrentlocation.getlatitude(), mcurrentlocation.getlongitude()))

How to use where and or_where in ignited datatables with codeigniter -

it's not working @ ->or_where('text like',"%dog%") . i'm using make json format view in datatable please me! $this->datatables->select('id,name,text,profile_image_url') //ignited datatables ->unset_column('id') ->unset_column('profile_image_url') ->unset_column('name') ->unset_column('text') ->add_column('profile_image_url', '<img src="$1"/>', 'profile_image_url') ->add_column('name','$1','name') ->add_column('text','$1','text') ->where('text like',"%cat%") ->or_where('text like',"%dog%") ->from('posts'); echo $this->datatables->generate(); it's not working cause have invalide syntax, using ->where means comparing if column equal se

python - When using urllib2, getting HTTPError 404 -

so i'm using following code: allargs = ['subway.py', '1b8d465e-b217-46f9-87a7-e9e48aaccb0f', 'b38'] httpcookieprocessor() bus = urllib2.urlopen("http://api.prod.obanyc.com/api/siri/ \ vehicle-monitoring.json?key=" + allargs[1] + \ "&vehiclemonitoringdetaillevel=calls&lineref=" + allargs[2]) and getting httperror 404. tried reading other documentation , questions on various forums error, can't understand it. answering similar question mentioned making cookie opener, again don't understand means. tried looking @ examples of other people making cookie openers, seemed involve lot of things don't appear relevant i'm trying here, , i'm not sure need. help appreciated, thank you. try instead: import urllib import json url = "http://api.prod.obanyc.com/api/siri/vehicle-monitoring.json?" args = {'vehiclemonitoringdetaillevel': 'calls'} args['key'] = &

Will OSGI equinox install copy jar to its own folder -

i curious of installing bundle equinox supposed do: will copy jar somewhere inside equinox folder when delete jar, not affect installed bundle? when bundle installed (in osgi framework), persisted in bundle cache. yes, can delete jar after installing it. framework remember bundles installed (and started) across restarts of framework.

bash - Running ssh remote command and grep for a string -

i want write script remotely run ssh remote commands. need grep output of executed command special string mean command executed successfully. example when run this: ssh user@host "sudo /etc/init.d/haproxy stop" i output: stopping haproxy: [ ok ] all need find "ok" string ensure command executed successfully. how can this? add grep , check exit status: ssh user@host "sudo /etc/init.d/haproxy stop | grep -fq '[ ok ]'" if [ "$#" -eq 0 ]; echo "command ran successfully." else echo "command failed." fi you may place grep outside. ssh user@host "sudo /etc/init.d/haproxy stop" | grep -fq '[ ok ]' other ways check exit status: command && { echo "command ran successfully."; } command || { echo "command failed."; } if command; echo "command ran successfully."; else echo "command failed."; fi you can capture output ,

javascript - lastindexof and substring js confusion in my case -

i try id value in path using js below code: var path = 'http://storecoupon.in/store/amazon-promo-codes/?id=212'; var n = path.lastindexof('/'); var getparams = path.substring(n+5, path.length); console.log(getparams); why console display blank? here's nice approach found in https://gist.github.com/jlong/2428561 parse url: var parser = document.createelement('a'); parser.href = "http://example.com:3000/pathname/?search=test#hash"; parser.protocol; // => "http:" parser.hostname; // => "example.com" parser.port; // => "3000" parser.pathname; // => "/pathname/" parser.search; // => "?search=test" parser.hash; // => "#hash" parser.host; // => "example.com:3000" further can fetch parameters search this: // if i'm not mistaken, search doesn't contain "?" prefix in browsers var search = parser.search.replace(

java - Struts IndexOutOfBoundsException when assign one entity list value to another -

list<entitylist> listentitylists = new arraylist<entitylist>(); list<matcheventlevel2> eventlevel2s = new arraylist<matcheventlevel2>(); public string createview() { eventlevel2s = getdaofactory().getmatcheventlevel2dao().findallactive(); (int = 0; < eventlevel2s.size(); i++) { listentitylists.get(i).settname( eventlevel2s.get(i).getteama().getteamid().gettname() + "v/s" + eventlevel2s.get(i).getteamb().getteamid() .gettname()); } return create_view; } catch (exception e) { e.printstacktrace(); return error; } } i fetching 1 list matchevent , assign property of list listentitylists has 2 property id , tname , setting 2 property. debugg code bebugg pointer moves in loop , throws indexoutofboundsexception : index

javascript - How to call functions defined in parent document from an svg referenced by an <object> element? -

i used embed svg file webpage: <object id="svgmap" width="100%" height="100%" data="<%=path %>/svg/map.svg" type="image/svg+xml" style=""> </object> and added images tags svg file using external javascript file called "support.js": var marker = document.createelementns(xmlns, 'image'); marker.setattributens(null, 'id', "img_0123"); marker.setattributens('http://www.w3.org/1999/xlink', 'href', iconurl); marker.setattributens(null, 'x', posx); marker.setattributens(null, 'y', posy); marker.setattributens(null, 'visibility', 'visible'); marker.setattribute("onclick", "onsel('0123')"); this "onsel" function defined in support.js well, when clicked on image, changes image. when viewed page in browsers (opera, mozilla , chrome), didn't swap im

php - show the mysql Select query results -

i using php , mysql wanted bring results of select statement. i tried use code implementation <head> <meta http-equiv = "content-type" content = "text/html" charset = "utf-8"> </head> <?php $conn = mysqli_connect("hostname","user","password","dbname"); // check connection if (mysqli_connect_errno()){ echo "mysql error : " . mysqli_connect_error(); } $result = mysqli_query($conn,"select kind,abs(sum(money)) money account userid = 't@t.t' , date_format(adate,'%y/%c') ='2014/8' , checkio = 'out' group kind;"); echo "<table border='1'> <tr> <th>no</th> <th>kind</th> <th>money</th> </tr>"; $no = 1; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td>" . $no . "</td>"; echo "<td>" . $row[

Postgresql hmac-sha1 signature differs from python signature -

postgres : code: select encode( hmac( e'put\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1', '1sf235123', 'sha1' ), 'base64' ); result: "h9wrl15mxgwrxxjqlqhbybnfj7i=" python 3 code: base64.encodestring( hmac.new( 'put\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1'.encode(), '1sf235123'.encode(), sha1 ).digest() ) result: "cru1v93ggf3qe0ovq686ir/i1ss=\n" i want signed s3 upload request in postgres, can't right signature, have tried whole day t_t. can give me help??? lot. you swapping 2 first hmac parameters in python. hmac constructor takes secret first >>> base64.encodestring( ... hmac.new( ... '1sf235123'.encode(), ... 'put\n\n1\n1408355972\nx-amz-acl:bucket-owner-full-control\n/1/1'.encode(), ... sha1 ... ).digest() ... ) b'

java - Passing list of boxed primitives to Google Cloud Endpoint -

i struggling lists method parameters @ google cloud endpoints. the documentations says the supported parameter types following: java.util.collection of parameter type i tried way, not work. basic endpoint method: @apimethod(name = "testmethod", httpmethod = httpmethod.post) public void testmethod(@named("longlist") list<long> longlist) { (long along : longlist) { if (along < 5) { throw new illegalargumentexception("you can't it"); } } } when execute method using api exploler generated url is: post http://localhost:8080/_ah/api/billendpoint/v1/testmethod?longlist=5&longlist=6 and method executed correctly. but when android library used url changed to: http://app_engine_backend:8080/_ah/api/billendpoint/v1/testmethod/5,6 and endpoint return 404 code. it possible have list method parameter , if doing wrong? please add @nullable annotation method, turn colle

android - finish or close an application from another application -

i want know, possible finish or close running application application? if yes how ? i googled regarding not found solution. tried using killbackgroundprocesses not worked me. functionality expecting task manager doing. please suggest me thing. in advance. no 1 can kill process except android os itself. most of task killer in android market don't kill app restart process by using public void restartpackage (string packagename) when method called activity operating system called savedinstancestate , save state of activity want kill. process is removed memory , os saved state.now when next time user start activity it will start killed or in other words restarted. can verify any task manager don't kill process because no 1 can so. method also work in ics. for above method can @ here . far know killbackgroundprocesses (string packagename) api 8 , above.

Converting CLI array to std::string without for-cycle -

i want convert array<unsigned char>^ std::string . possible conversion without iterating on array , assigning each character in string? this "best" solution (and don't assigning in for-cycle): std::string cliarray2string(array<unsigned char>^ asource) { std::string strresult(""); if (asource != nullptr) { int ilength = asource->getlength(0); strresult.reserve(ilength + 1); (int = 0; < ilength; i++) strresult[i] = asource[i]; } return strresult; } thanks opinions. you can use string range constructor , , pin managed array. pin_ptr<unsigned char> p = &asource[0]; unsigned char *unmanagedp = p; std::string str(unmanagedp , unmanagedp + asource->getlength(0)); or sequence constructor: std::string str(unmanagedp , asource->getlength(0));

android - Resource not found exception on imageclick -

i trying inflate custom dialog on image click program shows following exception. on image click following code gets act iv1.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { final dialog d = new dialog(about.this); d.setcontentview(r.layout.abtdial); d.settitle("about developer"); button dbt = (button) d.findviewbyid(r.id.button1); dbt.setonclicklistener(new onclicklistener() { public void onclick(view v) { d.dismiss(); } }); d.show(); } }); the xml custom dialog is <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout1" android:layout_width="match_parent"