Posts

Showing posts from July, 2010

python - Check for open text file -

i'm writing python application opens several text files in different threads. want each thread make operations on file while open. when external text editor closes file processing of corresponding thread should stop. need check on whether text file still opened or not. class mythread (thread): def __init__(self, sf): thread.__init__(self) self.sf = sf # sourcefile def run (self): subprocess.popen([editor, self.sf]) the problem subprocess opens file in editor , run() terminates. how can keep run() open until close file externally? did try subprocess.call method? subprocess.call('notepad') this waits command complete before process terminates , returns control program. this wrote: import subprocess threading import thread class mythread(thread): def __init__(self, sf): thread.__init__(self) self.sf = sf def run(self): subprocess.call('notepad ' + self.sf) def main(): mythread = mythr...

javascript - Ajax calls in jquery getting error:0 -

i making ajax call used in jquerymobile. working fine in local host , when uploaded in server, ajax call returned error:0 code: $(document).on('pageinit', '#joblist', function(){ if (navigator.online) { $.ajax({ type: "get", url: "http://sample.com/jobs", headers:{authorization:authheader}, datatype: "xml", success: function(xml) { xmljoblist=xml; localstorage.removeitem("joblist"); var xmlstring = (new xmlserializer()).serializetostring(xml); window.localstorage.setitem("joblist", xmlstring); viewjoblist(xml); }, error: function(result) { alert("an error occurred while processing xml file."); console.log("error" + result.status + result.statustext); //result.status:0 } }); } });

mysql - Error with creating table -

this statement, i'm getting error on customer_t. error states: "01:22:05 drop table customer_t error code: 1051. unknown table 'energyefficient.customer_t' 0.016 sec" create table customer_t (customerid int not null, name varchar(45) not null, address varchar(256) , email varchar(100) , phone varchar(16) , constraint pk_customerid primary key (customerid)); create table order_t (orderid int not null, orderdate date null, customerid int not null, constraint pk_orderid primary key (orderid), constraint fk_customerid foreign key (customerid) references customer_t(customerid)); create table equipment (equipmentid int not null, equipmenttype varbinary(12) ...

mysql - finding date and time of last 5 days -

i trying find out date , time of last 5 days database,the data inserted table in form of date("y-m-d h:i:s"); when try retrieving values not show until time table removed query : select key,date_format(lastupdated, '%d %m %y') table lastupdated between now() - interval 5 day , now() order key desc; i believe want compare date() of lastupdated select key,date_format(lastupdated, '%d %m %y') table date(lastupdated) between now() - interval 5 day , now() order key desc;

binary - Get RegBinary Value as its Hex Equivalent using (Delphi XE5 ) -

for reason need registry binary value hex equivalent. found 2 guide not make work. hear registry key : [hkey_local_machine\software\testingsoft\test path\testkey] "title"=hex:32,d6,bb,e9,b3,f0,9a,f2,37,64,65,ad,d6,c8,6a,75,9f,31 i need exact hex char shown above. i tried read binary , convert : procedure tform3.button22click(sender: tobject); var titleregistry: tregistry; hexstringofbinaryvalue : string; binaryvalue : array[0..200] of char; begin titleregistry:= tregistry.create(key_write or key_wow64_64key); titleregistry.rootkey := hkey_local_machine; titleregistry.openkeyreadonly('software\testingsoft\test path\testkey'); titleregistry.readbinarydata('title',binaryvalue,sizeof(binaryvalue)); hexstringofbinaryvalue := convertbinertohex(binaryvalue); showmessage( hexstringofbinaryvalue ); end; how can make convertbinertohex function returns me string 32,d6,bb,e9,b3,f0,9a,f2,37,64,65,ad,d6,c8,6a,75,9f,31 ? ...

javascript - Bootstrap code preview/snippet -

im busy project in bootstrap, new , all. i've come point client wants code preview / snippet whatever want call inside bootstrap. if put code preview html code rendered normal html. hope can me out how make preview window. pretty similar have on here @ stack overflow. thanks in advance! cheers

ruby - Adding Role dynamically through Form USing Rolify along with Devise and Cancan -

i followed tutorial " https://github.com/eppo/rolify/wiki/tutorial " nice , working fine. question can't add role through form out using rails console. <div class="field"><%= user_form.label :email %><br /> <%= user_form.email_field :email %></div> <div class="field"><%= user_form.label :password %><br /> <%= user_form.password_field :password %></div> <div class="field"><%= user_form.label :password_confirmation %><br /> <%= user_form.password_field :password_confirmation %></div> <div class="field"> <%= f.label :roles %> <div class="controls"> <% role.all.each |role| %> <%= check_box_tag "user[role_ids][]", role.id, @user.role_ids.include?(role.id) %> <%= role.name %><br /> <% end %> </div> </div> <% end %> the role colum...

android - Do I need to check in versionCode auto-incremented by build script? -

my android app, source controlled git, 2 branches, dev , master (for release). added ant task auto increment versioncode. need build dev quick verification , build master release properly. if every build increments versioncode, necessary push change git? i'm confused now, because believe versioncode should got version controlled along source code. if so, branch dev , master may different versioncode , can cause further conflict while doing code merging. if let build machine cache versioncode , incremente based on that, looks it's simple solution, versioncode in source never changed. i want know how manage versioncode in common case development , production environment. versioncode updates build script noise in version control. there's no point in versioning them. instead, consider creating tag in version control each build tag name , version code / version name can mapped. way there's less noise in version history , can still know code went build. ...

Making changes in the hadoop source code -

i've tried importing apache hadoop source code in eclipse. possible can debug how hadoop works running eclipse project itself? once modification complete, how should deploy , check?what procedure followed? you first need download hadoop source code(version want). install maven 3.0, protocolbuffer 2.5.0, cmake 2.6 or newer (if compiling native code) there "building.txt" file in source code. requirements needed building code given. follow it. read complete file. understand more things run following commands after installing above $ mvn install -dskiptests $ mvn eclipse:eclipse -ddownloadsources=true -ddownloadjavadocs=true now project eclipse ready. 1.file -> import... 2.choose "existing projects workspace". 3.select hadoop src folder root 4. click "finish" check out link howtocontribute

Android, use Mediacodec with libstreaming -

i've problem library https://github.com/fyhertz/libstreaming it allows send via wireless streaming of photocamera, use 3 methods: 2 mediacodec , 1 mediarecorder. modify it, , have use mediacodec;however first of tried code of example 2 of library, i've found same error: log tell me device can use mediacodec, set encoder , when test decoder fall , buffer filled -1. this method in encoderdebugger class exception occurs, kind soul can me please? private long decode(boolean withprefix) { int n =3, = 0, j = 0; long elapsed = 0, = timestamp(); int decinputindex = 0, decoutputindex = 0; bytebuffer[] decinputbuffers = mdecoder.getinputbuffers(); bytebuffer[] decoutputbuffers = mdecoder.getoutputbuffers(); bufferinfo info = new bufferinfo(); while (elapsed<3000000) { // feeds decoder nal unit if (i<nb_encoded) { decinputindex = mdecoder.dequeueinputbuffer(1000000/framerate); if (decinputindex...

javascript - Mustache js output mustache js code -

i'm trying make mustache js output content without parsing variables. example: {{block.type}}-{{block.id}}-label-{{element.id}} i want parse block, , why giving following json: { block: { type: 'news', id: 23 } } the end result should be news-23-label-{{element.id}} but instead is news-23-label- how should make not parse part of code? i'm new in mustache js , not find in documentation (comments understood, if , foreach understood, not find this). would workaround you? click fiddle. html: <div id="output"></div> <script type="text/html" id="test1"> {{block.type}}-{{block.id}}-label-{{block.elid}} </script> js: var output = $("#output"), template = $("#test1").html(), data = '{ "block": { "type": "news", "id": 23, "elid": "{{element.id}}" } }', html = mustache.render(template, j...

android - mobile-chrome-apps using cordova plugin -

i'm trying polyfill issue input[type=file] on android 4.4. chrome.filesystem.chooseentry shows dialog not callback. anyhow look(s)/(ed) promising: https://github.com/cdibened/filechooser but using "cca plugin add..." instead of "cordova plugin add..." fails. other posts recommend doing through cca toolchain. what best approach? what other developers doing issue input[type=file] on android 4.4? thanks, nic cca plugin add forwards off cordova plugin add , making sure paths, versions, etc correct, right use that. the reason plugin fails install because bundling android-support-v4.jar library, install. the resolution simple: plugins should not bundle external libraries, , should instead use plugin.xml <dependency> tag on single common plugin add these external libraries. we provide bunch of these plugins google libraries, including android-support-v4 . i've filed issue better handle error , resolution reach out plu...

sql server 2008 - MS SQL Insert from multiple rows -

i´m trying insert values database several tables: insert dbo.table1 (id, idtable2, idcounter) select s.id o.idtable2 o.idcounter dbo.table3 o, dbo.table2 s but above code leads situation duplicate values values table 3, want 1 value table3 per value table 2. (the tables don´t have relationship info) thanks in advance. edit: thanks everyone. managed solve adding reference id table2 , using inner join. you forgot clause joining tables table2 , table3, building cartesian product. there must linking tables; otherwise makes no sense combine them do. my advice: stay away old join syntax list tables comma-separated. use up-to-date join syntax (inner join on etc.) instead. having said this, don't see how select make sense anyhow. id become id of table2 , idtable2 become id of table2, too?

php - OpenCart : Extract Orders Details in Database -

i know can extract sales order data in opencart database, in table shop_order , shop_order_product . is possible differentiate user creates sales order? i don't think there's option identify admin user created order. may need code yourself. below steps may you. add 2 new fields created_user_id , updated_user_id in order table - default value 0. update admin/model/sale/order.php insert values fields $this->user->getid(); ( addorder , editorder functions ). add new field user_id in order_history table - default value 0. update admin/model/sale/order.php insert value field $this->user->getid(); (function: addorderhistory ). you can these directly modifying files or using vqmod. if it's done via vqmod it'll easier make changes during opencart version upgrade. opencart: vqmod tutorial have nice day!!

c# - Change backcolor of ToolstripSeparator in submenue? -

Image
this question has answer here: change backcolor of toolstripseparator control 4 answers i have contextmenustrip has 4 items. 1 of items has submenu 4 items, o 1 separator. changed color items separator's backcolor not change why , how change it? i've faced problem today , found it's pretty simple solve it. having same situation: solution: create class inherits toolstripseparator class , add method paint eventhandler draw separator: public class extendedtoolstripseparator : toolstripseparator { public extendedtoolstripseparator() { this.paint += extendedtoolstripseparator_paint; } private void extendedtoolstripseparator_paint(object sender, painteventargs e) { // separator's width , height. toolstripseparator toolstripseparator = (toolstripseparator)sender; int width = tool...

c# - WCF Service . Setting response type to XML/JSON using the Accept HTTP Header? -

i want wcf service accept , respond requests in json or xml. thought wcf supposed automatically interpret response type based on accept header client specifies. in client request specify accept header application/json receive xml response. this service definition: [operationcontract] [webinvoke(method = "post", uritemplate = "/getchecks", bodystyle = webmessagebodystyle.bare)] check[] getchecks(mycustomobj object); im making request here : using (webclient client = new webclient()) { client.headers["content-type"] = "application/json"; client.headers["accept"] = "application/json"; string response = client.uploadstring(endpoint, jsonrequeststring); // response xml } i know can make 2 endpoints , specify 1 xml , other json id rather not this. any ideas? for have on server set property automaticformatselectionenabled true you can either in config <webhttpendpoint> ...

asp.net mvc - Using PagedList with ViewModel -

hi guys need in solving problem while using pagedlist viewmodel(works domain model). i mvc beginner, here have tried far. / **********i have 1 model*********** / public class property { public int id { get; set; } public int userid { get; set; } public datetime created { get; set; } public datetime edited { get; set; } } created viewmodel out of (will add more properties other domain model time being using 1 domain model public class searchresultsvm { public pagedlist.ipagedlist<property> basicdetails { get; set; } } controller action method: public actionresult searchresults(string sortorder, string searchkeyword, string currentfilter, int? page) { viewbag.currentsort = sortorder; viewbag.titlesortparm = string.isnullorempty(sortorder) ? "title_desc" : ""; viewbag.datesortparm = sortorder == "date" ? "date_desc" : "date"; if (searchkeyword != null){page = 1;} els...

Rexster + Bulbs: Unicode node property - node created but not found -

i using bulbs , rexster , trying store nodes unicode properties (see example below). apparently, creating nodes in graph works can see nodes in web interface comes rexster (rexster dog house) retrieving same node not work - none . everything works expected when create , nodes non-unicode-specific letters in properties. e.g. in following example node name = u'university of cambridge' retrievable expected. rexster version: [info] application - rexster version [2.4.0] example code: # -*- coding: utf-8 -*- bulbs.rexster import graph bulbs.model import node bulbs.property import string bulbs.config import debug import bulbs class university(node): element_type = 'university' name = string(nullable=false, indexed=true) g = graph() g.add_proxy('university', university) g.config.set_logger(debug) name = u'université de montréal' g.university.create(name=name) print g.university.index.lookup(name=name) print bulbs.__version__ g...

c++ - Using minGW not in PATH with eclipse CDT -

in professional computer, have mingw 4.5.2 installed. eclipse cdt works it. want test c++11 features. copied mingw 4.8.x folder personal pc. my problem eclipse uses libraries old mingw (witch path). i'd want set eclipse use new version of mingw. know how change g++ used compiling/linking not include libraries. any idea ? thanks lot. ps : can't change path in professional computer. run windows 7 you can try creating batch file following code, assuming mingw want use in c:\mingw : set path=c:\mingw\bin;%path% start eclipse.exe

sql - MySQL table with key/value pairs, get keys as column names -

i have mysql database can following query: mysql> select name, value info id = 110506; +-------+-----------+ | name | value | +-------+-----------+ | start | 228196 | | stop | 228318 | | fwd | 0 | +-------+-----------+ 3 rows in set (0.00 sec) i trying construct query result be +--------+--------+-----+ | start | stop | fwd | +--------+--------+-----+ | 228196 | 228318 | 0 | +------- +--------+-----+ 1 row in set (0.00 sec) i not know in advance names in name column be, need somehow dynamically set them result of select query. how do that? try this select max(case when name = 'start' value end) `start`, max(case when name = 'stop' value end) `stop`, max(case when name = 'fwd' value end) `fwd` info id = 110506;

xslt - Remove XML elements based on set of rules with logical conditions -

i need remove particular xml elements following xml input file based on set of rules: <?xml version="1.0" encoding="utf-8"?> <root> <nodex> <value key="a">0815</value> <value key="b">xyz</value> <value key="c">12345</value> <value key="d">abc</value> </nodex> <description> <section01> <subsection key="keya">some text</subsection> <subsection key="keyb">some text</subsection> </section01> <section02> <subsection key="keyc">some text</subsection> </section02> <section03> <subsection key="keyd">some text</subsection> </section03> </description> </root> the problem th...

reporting services - LookUpSet - Group By -

Image
i have 2 databases: database1 on server1 database2 on server2 i create table gives me small example result below: name | date | total name1 10/04/2014 125,101 name1 11/04/2014 125,101 name2 10/04/2014 2,5 name2 11/04/2014 2,5 so database1 on server1 date , name values. i total column using following expression on 'total' textbox field looksup total database2 on server2: =join(lookupset(fields!col1.value, fields!col1a.value, fields!totalcol.value, "datasetserver2"),",") obviously want following results: name | date | total name1 10/04/2014 125 name1 11/04/2014 101 name2 10/04/2014 2 name2 11/04/2014 5 is possible? if further information needed let me know, apologies have never used lookupset. additional info: dataset2 used query database1 on server1 create table , example data is: date | col1 | name 10/04/20...

Regarding GPU driver in Linux kernel -

i've found i915_drm drm driver intel gpus. far know, gpu drivers not open public. my question is: i915 typically called "gpu driver" intel gpu? if not (i suspect not), tell me relationship between drm driver , gpu driver? the drm driver arbitrates access gpu, while actual gpu driver prepares command stream. former relevant security , needs performed in kernel, while latter highly complex , better implemented user process. the kernel driver sets address ranges, both cpu->gpu accesses (bar mappings), , gpu->memory accesses (dma regions). this ensures gpu can access dedicated dma memory, in order stop gpu programs reading out sensitive data passwords, and, depending on capabilities of gpu dma engine, can set multiple contexts further limiting gpu dma buffers submitted along program. the full gpu driver uses functionality request device context , dma memory mappings, compiles programs such shaders or opencl kernels, , submits them via low-level driv...

Convert Javascript into jQuery ajax? -

Image
i new in jquery , having trouble in converting javascript jquery ajax tried did not if can me shall thankful him/her. how code works: when click on edit button popup displayed showing record of person , can edit in popup , save it. how looks like: this javascript ajax code: function update(str) { if (str=="") { document.getelementbyid("txthint").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("dialog").innerhtml=xmlhttp.responsetext; $( "#dialog" ).dialog(); } } xmlhttp.open("get","updateattendence.php?q="+str,true); xmlhttp.send(); } here html code: <div id=...

java - How do I get rid of escape sequences when using SSHTools? -

i using sshtools / j2ssh connect server via ssh. works fine, problem is, output contains strange escape sequences / characters. read somewhere, these color codes , not encoding issue. question is: how rid of them? seems need sort of terminal emulation, interprets or strips off these codes. here output of ls : [0m[01;34msketchbook[0m sketchbook.tar sketchbook.tar.tar [01;32msshsudo[0m [01;34mtmp[0m tmp.tar (note: there other commands need call, ls --color=never won’t job.) i tried library jsch before, there can use ((channelshell)channel).setpty(false); rid of these characters, did not find similar sshtools. okay, found out myself. download terminal components library. then following work (based on this blogpost): iostreamconnector input = new iostreamconnector(); iostreamconnector error = new iostreamconnector(); input.setcloseinput(false); error.setcloseoutput(false); input.connect(system.in, session.getoutputstream()); ...

java - arabic query expansion - Lucene -

using lucene, there way expand arabic query term synonyms ? found wordnet there no code arabic language. sample code please .... thanks in advance arabic analysis funcitonality can found in org.apache.lucene.analysis.ar package . if looking arabic language stemming , such, should use arabicanalyzer . roll components of own analyzer, in case, arabicstemfilter , arabicnormalizationfilter key pieces. if looking synonym replacement, synonymfilter should work fine in whatever language please.

c - How to validate Email address to check RFC822 compliance using libCurl -

i trying implement email smtp notifications in application using libcurl in c. before sending notification, want check rfc 822 compliance on both , addresses. currently able using jni (java javax.mail.internet.internetaddress class) http://www.w3.org/protocols/rfc822/

jquery - What are good ways for creating JSON to store checked checkbox options? -

the code below creates json string checked response options. wanted link checked response options ids question ids , allow several response options included. if 2 options chosen json string looks {"question0":["options0","options1"]}. code below works, however, i'd know whether there more compact, cleaner ways want. code style ok or can improved? thanks html layout <div id="survey"> <div id="question0" class="question">enter question <br> <input id="options0" class="options-ready" type="checkbox"> <label class="opt-label">yes</label> <br> <input id="options1" class="options-ready" type="checkbox"> <label class="opt-label">no</label> <br> </div> <div id="question1" class="question...

Delete rows based on first occurence of value in R -

so have issue row deletion. i'm after delete rows after first occurrence of value 1 in df$c. needs happen every value in df$a , every value in df$b, if that's clear. below example of df. appreciated! a b c 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 2 0 1 2 1 2 1 0 2 1 1 2 1 0 an alternative answer problem using statement... new.df=my.df[1:which(my.df$c==1)[1],] in way can check logical operations on data

html - CSS - Styling small details with <p> -

Image
i need make this: i made this: demo: http://jsfiddle.net/slck9/2/ it looks problem right put button , text "4x reakce" on same line , right positions, can't self, there chance can me it? my html: <span id="article-container"> <ul> <li><a href="#"><img src="images/foto.jpg" width="109" height="109" alt="popis"></a> <h2><a href="#">název článku</a></h2> <p><span><strong>28. 2. 2014 8:29</strong> od dwandy</span><br> ahoj, jak se máš? já úplně úžasně úpe nejvíc. závidíš, he? </p> <p class="more"><a href="#" class="links">přečíst</a><br> <a href="#">4 reakce</a></p> <hr> </li> <li><a href="#...

html5 - Long-running JavaScript Web -

i making website contains html5 , javascript, website requires few user interactions (only @ start), after web display kind of informations (text, time, pictures, etc) in website use timer (setinterval) @ specified intervals (3seconds or 20seconds), first 2 hours, runs fine, after that, crash browser or make hang, wonder if using setinterval idea i clear interval (with clearinterval) if want change interval activate again. need web run days or weeks, if it's not hang, cause browser(not whole pc) run slow, so idea use setinterval , clearinterval in long run? or should switch settimeout instead (or same)? if cause memory leak, cause? var element=document.getelementbyid("image1"); //it div element var image=new image(); image.src=url; // url path specific image(blob or external source) image.onload=function(){ //basically element.style.backgroundimage = "url(" + url + ")"; element.style.width=image.width.tostring()+"px"; //set or...

css - Position fixed not working as expected in some browsers -

i have small "feedback" button on left bottom of page. positioned fixed . however on browsers (old versions of webkit mainly) isn't displayed expected @ bottom of page. here screenshots (the error visible on xp chrome 25, win 8 firefox 18, win 7 firefox 3.6, etc.): http://www.browserstack.com/screenshots/0d783c572a3da30c4ad2482b86cdce92dcf0788b how can fix wrong behavior? i not interested in overcomplicated solutions sticky footers, because if button hides text not problem. css: #support { position: fixed; left: 20px; bottom: 0; } #support { display: block; padding: 5px 10px; ... } html inside many other nested div s: <div id="support"><a href="#">…</a></div> it issue related way screenshots taken. code correct , button positioned correctly in browsers.

c# - Need Explaination: plug in method with delegates -

i'm new @ c# , i've been studying month now. , code giving me headache. please explain me how works, how can void method in util class change int array in test class? ( http://msdn.microsoft.com/en-us/library/orm-9780596527570-03-04.aspx ) i don't understand how line values[i] = t(values[1]) can change mainvalues[] eventhough it's void without ref or out? if it's possible please explain c# beginner. thanks time! public delegate int transformer (int x); public class util { public static void transform (int[] values,transformer t) { (int = 0; < values.length; i++) values[i] = t(values[i]); } } class test { static void main( ) { int[] mainvalues = new int[] {1, 2, 3}; util.transform(mainvalues, square); // dynamically hook in square foreach (int in mainvalues) console.write (i + " "); // 1 4 9 } static int square (int x) { return x * x; } } because arrays reference types.eve...

html - Center a <ul> list -

Image
i've been trying find solution problem, nothing has worked me far. hope help. i'm trying normal <ul> list center on page. way i've been thinking solve embedding list inside div, , center div using margin: 0 auto; . problem list seems take, default, 100% width of parent. how can adjust actual list width long longest list-item? here illustration of trying do: or, alternatively (i'm okay either solution): thanks. to adjust width longest item add display: inline-block; ul element jsfiddle

swing - Java Fontrendering with JEditorPane -

i want font rendering using java html2image-classes . works fine - there issues cannot resolve. the code use following: import gui.ava.html.image.generator.htmlimagegenerator; import java.awt.color; import java.awt.font; import java.awt.fontmetrics; import java.awt.graphics2d; import java.awt.graphicsenvironment; import java.awt.renderinghints; import java.awt.font.linemetrics; import java.awt.image.bufferedimage; import java.io.file; import java.io.fileinputstream; import javax.imageio.imageio; public class fonttest { public static void main(string[] args) throws throwable { htmlimagegenerator imagegenerator = new htmlimagegenerator(); imagegenerator.loadhtml("<html>\n" + "<body bgcolor=green>\n" + "\n" + "<span style=\"font-family:'times new roman',times,serif; font-size:200%\">" + "gro&szlig;er beispieltext $ in times new roman</span>" + "</body>\n...

java - object is not an instance of declaring class -Hibernate -

i new hibernate , practicing examples on one-to-many mapping not getting why throwing error. 1)employee.java package com.common.pojo; import java.util.set; public class employee { private int id; private string name; private set certificate; public employee (){} public employee(string name) { this.name = name; } public int getid() { return id; } public void setid(int id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } public set getcertificate() { return certificate; } public void setcertificate(set certificate) { this.certificate = certificate; } } 2) certificate.java package com.common.pojo; public class certificate { private int id; private string name; public certificate(){} public certificate(string name) { this.name = name; } public int getid() { return id; } public void setid(int id) { this.id = ...

php - Take the last primary key id enter in the database to var -

i need select last id entered in database , put in var. create var in php: $timid = "" ; but tried this: $requete = $bdd->prepare('select last(`timid`) `timesheets` '); $requete->execute(array('timid'=> $_post['timid'])) or die(print_r($requete->errorinfo())); $resultat = $requete->fetch(); $timid = $resultat['timid']; echo($timid); i know syntax of sql wrong how it? use order id desc , using limit clause can achieve

c# - Azure Architecture for Casino type game -

i'm creating casino type game allows users bet on event, , plan use microsoft azure back-end processing , data storage (table storage). i'm looking ideas on how validate information , notify users of updated. the idea: application allows users place bets on event, e.g. online bookies (paddypower, ladbrokes etc). the workflow: the user places bet on event after event finished bet settled , user notified of winnings goto step 1 the scenario (simplified): a user shouldn't able place bet after event has started a user should notified of problems , winnings the process: solution 1 - using queues: when bet placed user, message put queue(used users) , processed worker role. if happens placed bet late event, or player wins bet, need notified of result. so each active user has it's own queue client application polls updates. allow client application pick notifications , display them user. solution 2 - using wcf & queues: when bet placed us...

extjs4 - ExtJs store getModifiedRecords() -

i have grid in view gets populated store. update store records calculating numbers. therefore, method getmodifiedrecords() returns 1 have been modified. question comes @ point. is possible tell when start getting modified records? example, want make calculations , update store. app requires @ point getmodifiedrecords() should return nothing. if make changes store later, should return modified records. getmodifiedrecords return records are: new: item.phantom === true && item.isvalid() updated: item.dirty === true && item.phantom !== true && item.isvalid() so if create record or set record field these returned function.

python - How to detect if a file has changed in a model save function -

when updating record existing file if file has changed need remove old file s3 bucket. how in django can detect if file has changed? this have tried (not tested) django have magic build in this? def save(self, *args, **kwargs): existing_file = asset.objects.get(pk=self.pk) if existing_file != self.file: # remove s3 before saving new file == , != compare primary keys of model instances (look @ __eq__() , __ne__() methods implementation ). one way compare fields of model instances call model_to_dict() on both: from django.forms.models import model_to_dict if model_to_dict(existing_file) != model_to_dict(self.file): you can specify fields , exclude arguments control fields dump dictionary, in case, fields compare. hope helps.

ajax - jQuery: weird behavior - XHTTPResponses vs promises/wrappers -

having code: (function($) { $(function(){ $("div.cotizador ul > li > a.cotizador").click(function(){ var data = { concesionaria: $(this).data("concesionaria"), modelo: $(this).data("modelo") }; var promise = $.get("ir-a-concesionaria", data, function(data){ if ("success" in data) { window.location.href = data.success.redirect; } else { alert("no se puede seleccionar el modelo especificado. consulte con el administrador del sitio."); } }, "application/json"); console.log(data); console.log(promise); promise.fail(function(xhr, errortype, errordescription){ alert("ocurrió un error interno. intente nuevamente más tarde"); }); }); }); })(jquery);...

android - Error Landroid/support/v7/widget/SearchView$5 when using Action Bar compat library -

ok, ive imported v7-appcompat library(yes have unchecked dependencies),on using in project list of errors in log cat. the application works fine on , android moto g i.e on android 4.4.2 , not on lg p500 2.2.2, i followed instructions importing android resource library official website http://developer.android.com/tools/support-library/setup.html i starting think android bug , please - 04-14 19:59:22.223: w/dalvikvm(12718): vfy: unable resolve virtual method 318: landroid/content/pm/packagemanager;.getactivitylogo (landroid/content/componentname;)landroid/graphics/drawable/drawable; - 04-14 19:59:22.223: w/dalvikvm(12718): vfy: unable resolve virtual method 314: landroid/content/pm/applicationinfo;.loadlogo (landroid/content/pm/packagemanager;)landroid/graphics/drawable/drawable; 04-14 19:59:22.463: w/dalvikvm(12718): link of class 'landroid/support/v7/widget/searchview$5;' failed 04-14 19:59:22.463: e/dalvikvm(12718): not find class 'android.su...

java - How can I set the native library for a dependency using maven? -

i using microsoft tfs sdk jar requires native library. can set native library using : system.setproperty("com.microsoft.tfs.jni.native.base-directory","c:\path\"); i using maven project , tfs sdk jar maven dependeny how can set native library dependency using maven ? you need use "native lib loader" helper. the source 1 here: https://github.com/scijava/native-lib-loader best via maven/gradle or similar: http://mvnrepository.com/artifact/org.scijava/native-lib-loader/ where need add natives project , required naming convention ca found in "org.scijava.nativelib.nativelibraryutil"

postgresql - How to subtract seconds from postgres datetime without having to add it in group by clause? -

say have column of type datetime value "2014-04-14 12:17:55.772" & need subtract seconds "2" seconds o/p "12:17:53". userid enddate seconds -------------------------------------------------------- 1 "2014-04-14 12:17:14.295" 512 1 "2014-04-14 12:31:14.295" 12 2 "2014-04-14 12:48:14.295" 2 2 "2014-04-14 13:22:14.295" 12 & query is select (enddate::timestamp - (seconds* interval '1 second')) seconds, userid user group userid now need group userid enddate & seconds added select query asking me add in group clause not give me correct o/p. i expecting data in format need calculate start_time end_time & total seconds spent. user : 1 start_time end_time total (seconds) "12:17" "12:17" 1 "12:22" "12:31" 512 ...

comments - TYPO3 6.1 : config.disablePrefixComment=1 not working -

Image
hello i'm wondering why setting not working in typo3 6.1 i'm trying remove typo3's automatic comments <!-- header end--> <!--###main zerogrid### end --></div> <!--###body2### end --></div> <!--###body1### end --></div> <div class="body3"><!--###body3### begin --> <div class="main zerogrid"><!--###main zerogrid### begin --> and on. fyi, wrote config.disableprefixcomment=1 in main ts template setup. i read typo3 latest reference docs it's simple boolean setting. here ts setup: config.disableprefixcomment = 1 config.no_cache = 1 config.baseurl = http://xxxx.yyyy.net # main template cobject body temp.maintemplate = template temp.maintemplate { # feeding content auto-parser template cobject: template =< plugin.tx_automaketemplate_pi1 # select content between <body>-tags workonsubpart = document_body subparts.content < styles.c...