Posts

Showing posts from May, 2014

Mysql find max column value based on array list -

Image
hi have following mysql table id item_name user_id wishlist item_url id_category cost 30 kiko 76 1 70 10 31 test1 76 1 70 20 32 test12 76 1 68,67 30 how can max cost item. means need max cost item based on category id. my attempt of using select max(cost),id item_tbl (find_in_set('68','70,68,67')) not return correct output thought gives max(cost) of 30. this might give desired output. select id_category, max(cost) item_tbl group id_category;

mysql - SPLIT_STR not working with the foreign languages -

i got function split_str blog.fedecarg.com here code create function split_str( x varchar(255), delim varchar(12), pos int ) returns varchar(255) return replace(substring(substring_index(x, delim, pos), length(substring_index(x, delim, pos -1)) + 1), delim, ''); if try select like select split_str('accountname;โอมtest;no.454646;i;2013-8-23', ';' , 2) 'res'; the result is _________________ | res | | ------------- | | โอมtest | _________________ if change index 3 select split_str('accountname;โอมtest;no.454646;i;2013-8-23', ';' , 3) 'res'; the expected value no.454646 but result is _________________ | res | | ------------- | | 4646 | _________________ is function split_str has bug? note : if cut foreign languages( โอม ) out. problem solved. how can use function working foreign languages, please help. thanks. length returns string le...

java - UNION operator with QueryBuilder -

i want create select statement, union of 2 sub-queries. there way in ormlite create 2 queries querybuilder , , concatenate them , create union third querybuilder : select * ( first select union second select) isdefault = 0 order somerow; somerow changes dinamically. as know querybuilder not support union directly, somehow should inject concatenated union statement. result want list<myobject> querybuilder.query() returns it.

How do I get my HTML file from a text file to the web? -

i new programming , have learned lots of html, css , javascript i'd practice with. have put test pages in textwrangler, cannot work out way publish them free can practice. working on 2010 mac. i have looked @ various youtube videos, far have not been able work out how text file on computer @ least preview of page. appreciate advice on free publishing method. many thanks, rachael there several ways publish files: create file ending .html , doubleclick it. standard browser open. (e.g. php not available.) install apache server localhost on pc. php, mysql db, etc. available. create free account @ e.g. lima-city.de or anywhere else. upload files , test it.

html - Change certain <ul> and <li> (jQuery) -

i'm starting learn how code jquery, javascript , on , wanted ask if it's possible change few <ul> , <li> <div> , <p> . i heard plugins used , 1 of biggest advantages of jquery thought i'd try build 1 myself. unfortunately i'm new programming don't know important stuff. at moment plugin turns every <div> <ul> , goal change menu not moveable box. @ moment script changes , moveable div turns ul buttons dissapear. my html file has menu , box moveable 2 buttons inside. <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>list</title> <script type="text/javascript" src="jquery-1.10.2.js"> ...

Splash Screen In Windows 7 using cordova -

i'm using visual stdio 2010 , phone gap 2.9.0 version . i want change default splash screen new image in windows 7 mobile app. how ...? you can replace image same name (i.e splashscreenimage.jpg) same dimensions i.e 480x800. hope helps

android - Receiving in app SMS messages only from certain specified numbers -

i've set app receive sms messages , display them toast on main activity. once app has received sms abort broadcast , stop message going inbox. currently messages phone receives carry out job , display toast when sms received specific number. know case of putting if statement receiver code i'm not sure abouts should placed. smsreceiver.java: public class smsreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { bundle extras = intent.getextras(); if (extras ==null) return; //toast toast.maketext(context, "received", toast.length_long).show(); object[] pdus = (object[]) extras.get("pdus"); (int = 0; < pdus.length; i++) { smsmessage smessage = smsmessage.createfrompdu((byte[]) pdus[i]); string sender = smessage.getoriginatingaddress(); string body = smessage.getmessagebody().tostring(); intent in = new intent("smsmessage.intent....

c - Better have one long or multiple short UDP sockets? -

i want send regularly udp messages through sockets. is better use 1 socket, or recreate socket each message , close them after? since udp stateless, change anything? if you're expecting receive on socket, had better exist entire time on you're expecting receive. if you're expecting send multiple messages without receiving replies have design mistake, there doesn't seem reason why keep opening , closing udp sockets purpose. surely makes more sense keep socket open long necessary?

c# - How to convert a list into data table -

this question has answer here: convert generic list/enumerable datatable? 17 answers i have data list property. want convert list data data table. how convert list datable. just add function , call it, convert list datatable . public static datatable todatatable<t>(list<t> items) { datatable datatable = new datatable(typeof(t).name); //get properties propertyinfo[] props = typeof(t).getproperties(bindingflags.public | bindingflags.instance); foreach (propertyinfo prop in props) { //defining type of data column gives proper data table var type = (prop.propertytype.isgenerictype && prop.propertytype.getgenerictypedefinition() == typeof(nullable<>) ? nullable.getunderlyingtype(prop.propertytype) : prop.propertytype); //setting column names property names ...

git - How to undo pull deleted local files which have never been committed? -

i have worked on project 3 days. when finished first function, wanted put files git repo. so, used git init. , set remote repo. had pull readme file first. when process finished, in local repo gone. :( my github repository has readme file. the command used following: git init work repo git add * git remote add origin https://github.com/username/repositoryname.git git pull origin master after that, got readme file , local files gone! there ways them back?

Neo4j Cypher must all nodes have relation to root -

i totally new on graph databases , neo4j. study have implement friend structures relational , graph databases. finished relational database , hang on neo4j because find hard beginners. quick question: must (or graph style) have nodes relation root node? must implement search friends of friend, relations between user not friends , on. using webadmin/neoclipse , neo4j 1.9.2. thank you. the short answer nope, can ignore root node, or in fact event delete it. there no restrictions on node connectivities; 1 thing enforced, though, each relationship must have start , end node @ times (can same node).

xml - Change Node name of an XSLT based on an include file -

hi have xslt file need transform xml file. sample xslt <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <document> <customer> <header> <message> <xsl:value-of select="//header/message"/> </message> </header> </customer> </document> </xsl:template> <xsl:include href="inc1.xsl" /> </xsl:stylesheet> now need change node name customer supplier depending on include filename @ bottom , 1 more thing, have specific attributes document node depending on include file. thanks , hope can me out. the viable mechanism have included stylesheet handle specific element names , <document> attributes: this: <?xml version="1.0"?> <xsl:stylesheet version="1.0...

what is the sms drafts box uri in android? -

i want read sms in draft box of android write app can read sms in inbox sent box dont know uri path of draft box in android should replace uri path of draft box inbox read sms in drafts it? sms objsms = new sms(); uri message = uri.parse("content://sms/sent"); contentresolver cr = context.getcontentresolver(); cursor c = cr.query(message, null, null, null, null); int totalsms = c.getcount(); log.i("readdddddddd inbox",totalsms+"***************************" ); if (c.movetofirst()) { (int = 0; < totalsms; i++) { objsms = new sms(); objsms.setphone(c.getstring(c .getcolumnindexorthrow("address"))); objsms.setmessage(c.getstring(c.getcolumnindexorthrow("body"))); objsms.setdate_time(c.getstring(c.getcolumnindexorthrow("date"))); ars.add(objsms); ...

Submit 'int' and 'string' arrays using ctypes (Python->C++) -

i've simple working program submits int ( num_piezas in example) python function c++ function. foo.cpp #include <iostream> class foo{ public: void bar(int number){ printf("number is: %d\n", number); } }; extern "c" { foo* foo_new(){ return new foo(); } void foo_bar(foo* foo, int number){ foo->bar(number); } } foowrapper.py from ctypes import cdll lib = cdll.loadlibrary('./libfoo.so') class foo(object): def __init__(self): self.obj = lib.foo_new() def bar(self, num_piezas): lib.foo_bar(self.obj, num_piezas) num_piezas = 5 f = foo() f.bar(num_piezas) the thing want send int array , char array along number. tried: foo.cpp #include <iostream> #include <string.h> class foo{ public: void bar(int number, int piezas[3], char prioridades[3][20]){ printf("number is: %d\n", number); for(int i=0;i<3;i+...

Continuously add and remove class to a random element with jQuery -

let's have unordered list of ten elements. i'd class added 1 of them @ random, , remove class after couple of seconds , start again randomly chosen element indefinitely. what cleanest way achieve that? edit: i've got far: <ul id="hideandseek"> <li>...</li> <li>...</li> <li>...</li> <li>...</li> ... </ul> and jquery: var random = math.floor(math.random() * 1000); var shownelement = $("#hideandseek li"); shownelement.eq(random % shownelement.length).addclass("shown"); however, not run continuously, , don't know how set delay before removing class. you need use setinterval create timer, , can choose random number , set class item index. something this: html <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> <li>six</li...

php - PDO MySQL get records with previous date -

i've got table columns. want filter records using 2 of them, 1 int type , second datetime type. i'm using php pdo extension connect database , make queries. i'm trying records table datetime field lower given date, f.e. <?php $date = date("y-m-d"); $this->db->query("select * `" . db_prefix . "fanpage` `flag_warning` = ? , date(`update_date`) < ?", array(1, $date)); ?> this returns null, when paste same query phpmyadmin window shows me proper records. problem? edit: fragment query function: public function query($sql, $params = array()) { $result = array(); $result['query'] = $this->pdo->prepare($sql); $result['query']->execute($params); $this->lastresult = $result['query']; unset($result['query']); } no need prepared statements @ all where flag_warning = 1 , update_date < curdate()

c# - Reordering columns in DataGridView -

i'm populating datagridview (winforms) through code , biding rows datatable . property reordering columns set true. if reorder columns , want new order of columns order same. means if first columns named "id" , last columns named "price" , moving id in place of price , price in place of id , if want list columns using piece of code: (int = 0; <= dganalyse.columns.count - 1; i++) { if (dganalyse.columns[i].visible == true) { console.writeline(dganalyse.columns[i].headertext); } } i get: id, price not price, id. is possible list of new order of columns? if reorder columns , want new order of columns order same. when change order of columns @ runtime using datagridview.allowusertoordercolumns functionality, it won't change order of datagridview.columns collection . displayindex property of columns change. if want ite...

Neo4j: GraphDatabaseService.registerTransactionEventHandler() does not seem to work -

regarding my previous question : i have problem graphdatabaseservice.registertransactioneventhandler() . when try run this test against this handler , don't calls beforecommit method when running 1.9.2 , once new database 2.0.0-m03, , transactiondata.creatednodes() returns empty iterator though a node has been created. test fails org.neo4j.kernel.api.exceptions.propertykeynotfoundexception: property key 'uuid' not found these reasons. am doing wrong, or there bug in registertransactioneventhandler? you're lacking tx.finish() on first transaction after https://github.com/ttiurani/neo4j-uuid/blob/master/src/test/java/org/neo4j/extension/uuid/uuidtransactioneventhandlertest.java#l2 . therefore transaction not committed , transactioneventhandler not called, see http://docs.neo4j.org/chunked/stable/transactions-interaction.html .

ios - sorting array with block does not return the right result -

this question has answer here: stringfromdate returning wrong year 1 answer so have array of strings (monthsarray) looks this: months array before :( "november 2012", "january 2013", "september 2013", "december 2012", "august 2013" ) and use sort : nsdateformatter * formatter=[[nsdateformatter alloc]init]; [formatter setdateformat:@"mmmm yyyy"]; monthsarray = [nsmutablearray arraywitharray:[tempmonthsarray sortedarrayusingcomparator:^nscomparisonresult(id a, id b) { nstimeinterval firsttime=[[formatter datefromstring:(nsstring*)a]timeintervalsince1970]; nstimeinterval secondtime=[[formatter datefromstring:(nsstring*)b]timeintervalsince1970]; return [[nsnumber numberwithdouble:firsttime]compare:[nsnumber numberwithdouble:secondtime]]; }]]; after sort it looks : months array after ...

javascript - New properties to Kinetic objects? -

how can add / extend properties kinetic objects through function? let me explain further. can create new kinetic object this var car = new kinetic.rect({ width: 15, height: 10}); // , later add custom properties . notation car.brand = "bmw"; but if want make kinectic objects through function this var car1 = new car(15, 10, "bmw"); var car2 = new car(10, 10, "volvo"); function car(width, height, brand) { this.width = width; this.height = height; this.brand = brand; } that of course not kinetic object. how can it? possible extend base class able hold custom values? it considered relatively ugly out of box yes var car = (function() { var _super = kinetic.rect.prototype, method = car.prototype = object.create(_super); method.constructor = car; function car(opts, brand) { _super.constructor.apply(this, arguments); this.brand = brand; } method.drive = function() { //l...

How to generate an image number of times in android -

i have image rotates on screen. problem is, want generate image again , again on screen, after 10 seconds. tried lot using loop. not working. want generate same rotating image again , again on screen. please help. in advance. here code. @override public void ondraw(canvas canvas) { // todo auto-generated method stub super.ondraw(canvas); int draw_x = math.round(system.currenttimemillis() % (this.getwidth() * 2)); int draw_y = math.round(system.currenttimemillis() % (this.getheight() * 2)); (int = 0; < 10; i++) { if (draw_x > this.getwidth()) draw_x = (this.getwidth() * (2)) - draw_x; if (draw_y > this.getheight()) draw_y = (this.getheight() * (2)) - draw_y; if (draw_x > this.getwidth()) draw_x = (this.getwidth() * (2)) - draw_x; if (draw_y > this.getheight()) draw_y = (this.getheight() * (2)) - draw_y; canvas.drawbitmap(eball, draw...

asp.net - aspxGridView disappears when showing javascript alert but reappears when alert is closed -

i have usercontrol aspxgridview inside it. use usercontrol in page in separate updatepanel (named updlistview). in update panel (updform) have button , code checks conditions raise javascript alert message. when alert message pops up, user control stays gridview temporarily disappears long alert message showing up. close alert, grid view appears. bug need fix not find solution. any appreciated. i using server side alert message string strscript = string.format("javascript:alert('{0}');", "my message"); scriptmanager.registerstartupscript(this.page, this.gettype(), "alertmessage", strscript, true); i used above code achieve desired result if (!string.isnullorempty(message.trim())) { message = message.replace("\\n", "\\\\n"); string script = "settimeout(\"alert('" + message + "');\",0);"; system.web.ui.scriptmanager.registerstartupscript(this, this.gettype(), guid.ne...

forms - How to include blank value in Former::select -

i'm using former package laravel 4, along twigbridge . have select field i'm populating model: {{ former_select('parent_id').fromquery(sections, 'title', 'id') }} however, i'd add blank value default option. i've looked through docs not see mentioned this. can help? thanks for former version 2.6.0 had use 'placeholder' method {{ former::select('author_id')->placeholder('please select')->label('author')->fromquery(author::get(), 'username', 'id') }}

python - Is it possible in tkinter to have two columns of labels with one label below and in the middle of them? -

Image
while picture shows want do, however: all labels supposed perfect squares of same size labels in 2 columns should aligned the label @ bottom should below , in middle of other two. the actual labels should solid , there should little space around text of label(text shouldn't take whole label). grid should used if possible. i'll use python3 yes, of course possible. tkinter arguably has flexible , easy use geometry managers of gui toolkit. pack , place , , grid there no layout can't do. start piece of paper. seriously. until able visualize this, use paper. draw 4 equal width columns. divide columns 3 equal-height rows. you'll use lay out. now, draw labels on top of that. notice on first 2 rows labels occupy columns 1 , 2, , columns 3 , 4. notice on third row label occupies columns 2 , 3. now, transfer code. tkinter numbers rows , columns starting @ zero, first label row 0, column 0, , spans 2 columns. next label @ row 0, column 2, , spans ...

qemu - How to create a new storage pool with virt-manager? -

in virt-manager see default storage pool full. when create new storage pool, doesn't help, because has same usage percentage default. as see, don't understand it. must do? thanks, eric j. you can refer fedora's documentation creating new storage pool. it's pretty straightforward , simple. http://docs.fedoraproject.org/en-us/fedora/18/html/virtualization_administration_guide/sect-partbased-storage-pool.html

java - How to pass the image as a structure parameter to C function of libfprint using JNI -

i working biometric finger print scanning device, , have developed java application finger print image data. want process image , fingerprint matching. have found 1 open source library, libfprint . this library provides functions process image , functions matching images. application written in java image passed java code through jni c code. example function image binarization in library shown below struct fp_img *fp_img_binarize(struct fp_img *img) what should pass java code such functions in c code takes structure data parameter? or how pass values java code c functions if take structure parameter? or how write jni layer in case? you have write jni function take image java , converts fp_img structure libfprint (you can't call c-library function java). the structure in libfprint looks this struct fp_img { int width; int height; size_t length; uint16_t flags; struct fp_minutiae *minutiae; unsigned char *binarized; unsigned char da...

wordpress - Disabling Disqus reactions count -

i'm developing theme wordpress i'm using disqus. how can disable reactions link next comments? instructions on internet saying should disable reactions in disqus settings, there not such thing reactions option in settings tab. i'm looking help! we removed feature, dhaulagiri mentioned, why can't edit text did before - removed shortly. since text served disqus globally, won't require plugin update take effect. if need done sooner week, can contact , can disable it: http://disqus.com/support/

html - Using dependent fields without Javascript -

i wondering if possible make "dependent" field in web form without using javascript ? my code consists in : <select> <option value="1">value 1</option> <option value="2">value 2</option> <option value="3">value 3</option> </select> and when select value, select populated, via jquery's $.post(), data fetched database. but how can keep if browser has js disabled, or not support javascript ? thanks in advance there no way trigger event this. need reload document , pass data through server code. (php or else)

mpdf - Codeigniter: Unable to locate the specified class: Exceptions.php -

here's controller: $html = $this->load->view('print_po', $po, true); $this->load->library('pdf'); $pdf = $this->pdf->load(); now i've tried , comment each line , 1 shows error is: $pdf = $this->pdf->load(); here's library class in application/libraries : <?php if (!defined('basepath')) exit('no direct script access allowed'); class pdf { function pdf() { $ci = & get_instance(); log_message('debug', 'mpdf class loaded.'); } function load($param=null) { include_once apppath.'/third_party/mpdf/mpdf.php'; if ($params == null) { $param = '"en-gb-x","a4","","",10,10,10,10,6,3'; } return new mpdf($param); } } the error comes after moving code 1 server another(the error happens on centos server bet case sensitive). question here be: shoul...

java - Accessing a managed bean from a JSP tag file -

i have following minimal test case: not_working.jsp: <%@page contenttype="text/html" pageencoding="utf-8"%> <%@taglib prefix="t" tagdir="/web-inf/tags" %> <t:not_working_tag> hello </t:not_working_tag> web-inf/tags/not_working_tag.tag <%@tag description="main page template" pageencoding="utf-8"%> <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <html> <head></head> <f:view> <h:outputtext value="#{userbean.test}"/> <jsp:dobody/> </f:view> </html> src/java/userbean.java @managedbean(name="userbean") @sessionscoped public class userbean { public string gettest() { return "hello!"; } } now i'd expect when access not_working.jsp through browser, i'd see "hello!...

nginx - ngix and php5-fpm blank page -

iam trying include php5-fpm nginx. blank page. , dont know why. installed ngix-portable ( https://github.com/moezzie/nginx-portable/blob/master/readme.md ) , config file is: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8080; server_name localhost; #charse...

CKEditor is duplicating a field -

so original problem needed rid of img style attribute on images in ckeditor. i found code trick: if (ckeditor.instances['field_id_4']) { ckeditor.remove(ckeditor.instances['field_id_4']); } ckeditor.replace('field_id_4',{ allowedcontent: 'img[!src,alt,width,height]{float};' + 'h1 h2 div' }); but when top condition there. now see though, ckeditor duplicated... anyone know how fix this? you should use editor.destroy() instead of ckeditor.remove private method. something like: if (ckeditor.instances['field_id_4']) { ckeditor.instances['field_id_4'].destroy(); } ckeditor.replace('field_id_4',{ allowedcontent: 'img[!src,alt,width,height]{float};' + 'h1 h2 div' });

jquery - How to restrict user input character length of HTML5 input type="number"? -

how restrict user input given length in html5 input[type=number] textbox? the answers how can limit possible inputs in html5 "number" element? do not handle illegal inputs <input class="quantity" type="number" min="0" max="99999" maxlength="5" /> $("quantity").keyup(function(){ var $field = $(this); if ($field.val().length > number($field.attr("maxlength"))) { var value = $field.val().slice(0, 5); $field.val(value); } }); i know maxlength attribute not supported, use obtain given length. the above code works fine in firefox, in chrome , safari works if input 5 "valid" characters. when start typing invalid characters, e.g. "a", "b" etc., able type in more letters , textbox color changes red. i found when input becomes invalid $field.val() returns empty string , $field.val().length returns 0 . i tried converting keycode...

javascript - Randomly rotate content of a span -

i'm trying change <span> of text 1 of 7 chunks of text. i've found tutorial can me using javascript below, however, relies on selections being kept in <ul> . don't think can that, because need changed text appear within pre-existing paragraph. i'm thinking there might way give span id, , then, within javascript, set different options content be. i want change happen randomly page loads or refreshed, nothing complicated having happen on user input or on timer. below script found on tutorial, maybe it's case of simple amendment. i'm such newbie, though, don't know start unless it's spelt out. <script type="text/javascript"> this.randomtip = function(){ var length = $("#tips li").length; var ran = math.floor(math.random()*length) + 1; $("#tips li:nth-child(" + ran + ")").show(); }; $(document).ready(function(){ randomtip(); }); </script> something wor...

visual studio 2012 - Coded UI - How to prevent Debug mode from enabling LAN proxy server settings and clearing previous proxy settings -

when running web test in debug mode using vs2012(premium)/coded ui, every time use debug breakpoint in code, internet options->connections->lan settings->"use proxy server lan(these settings not apply dial-up or vpn connections)." checkbox becomes enabled. if don't have breakpoints in code, executes fine , not change internet option settings. i've tried running "automatically detect settings" both enabled , disabled, adding exception "*" in proxy server settings advanced menu, adding specific servers exceptions in proxy server settings advanced menu. overridden , once test hits breakpoint, changes proxy settings overridden , "use proxy server lan..." still checked. how prevent vs12/codedui changing these proxy settings? i found answer right here on stackoverflow.com! thank ja' stackoverflow.com see: what overriding windows proxy settings (inserting “vsts-proxy-installed-indicator”) , how turn off? wh...

python rq - How to clear Django RQ jobs from a queue? -

i feel bit stupid asking, doesn't appear in documentation rq . have 'failed' queue thousands of items in , want clear using django admin interface. admin interface lists them , allows me delete , re-queue them individually can't believe have dive django shell in bulk. what have missed? the queue class has empty() method can accessed like: import django_rq q = django_rq.get_failed_queue() q.empty() however, in tests, cleared failed list key in redis, not job keys itself. thousands of jobs still occupy redis memory. prevent happening, must remove jobs individually: import django_rq q = django_rq.get_failed_queue() while true: job = q.dequeue() if not job: break job.delete() # delete key redis as having button in admin interface, you'd have change django-rq/templates/django-rq/jobs.html template, extends admin/base_site.html , , doesn't seem give room customizing.

Memory management scenario with MongoDB & Node.JS -

i'm implementing medium scale marketing e-commerce affiliation site, has following estimates, total size of data: 5 - 10 gb indexes on data: 1 gb approx (which wanted in memory) disk size (fast i/o): 20-25 gb memory: 2 gb app development: node.js working set estimation of query: average 1-2 kb, maximum 20-30 kb of text base article i'm trying understand whether mongodb right choice database or not. index going downsize of memory have noticed after querying mongodb, has occupied memory (size of result set) caching query. in 8 hours i'm expecting queries' depth cover 95% of data, in scenario how mongodb manage limited memory scenario app instance of node.js running on same server. would mongodb right choice scenario or should go other json based no-sql databases.

XML dynamic validation with Java -

infrastructure: i'm using java 1.5 , mandatory. can load external lib no problem. problem: i have xml file recived via "an external channel" , can use inputstream if need same, use: inputstream = new fileinputstream(file); i need validate xml against xsd has neasted xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:body="urn:cbi:xsd:cbibdysddreq.00.00.06" xmlns:htrt="urn:cbi:xsd:cbihdrtrt.001.07" xmlns:he2e="urn:cbi:xsd:cbihdrsrv.001.07" xmlns:sgnt="urn:cbi:xsd:cbisgninf.001.04" xmlns:lmsg="urn:cbi:xsd:cbisddreqlogmsg.00.00.06" xmlns="urn:cbi:xsd:cbisddreqphymsg.00.00.06" targetnamespace="urn:cbi:xsd:cbisddreqphymsg.00.00.06" elementformdefault="qualified"> <xs:import namespace=...

linq - OrderBy multiple properties in Razor and Umbraco 4.11.8 -

during update of our website umbraco, upgraded 4.7.2 4.11.8. in cshtml-file had code: foreach(var item in model.ancestororself("master") .items.first() .publicationfolder.first() .children.where("visible") .orderby("publicationtype, date desc")) it worked fine , sorted collection first publicationtype , newest date . in new version (4.11.8) doesn't work anymore. gives me exception: at least 1 object must implement icomparable. and if write .orderby("publicationtype", "date desc") , doesn't affect collection. so bug or doing wrong? there workaround? i found solution need cast collection list<dynamicnode> works. foreach (var item in ((list<dynamicnode>)@model.ancestororself("master") .items.first() .publicationfolder.first() .children.where("visible").items) ...

xslt 1.0 - Sorting from multiple nodes by alphanumeric format -

<?xml version="1.0" encoding="utf-8"?> <accountlist> <previousaccount> <account> <lastname>nash</lastname> <accountstatus>removed</accountstatus> <accno>8d</accno> </account> <account> <lastname>adoga</lastname> <accountstatus>removed</accountstatus> <accno>8a</accno> </account> <account> <lastname>lucas</lastname> <accountstatus>hold</accountstatus> <accno>9a</accno> </account> <account> <lastname>donald</lastname> <accountstatus>hold</accountstatus> <accno>10d</accno> </account> <account> <accountstatus>hol...

mongodb - Retrieving document from collection by id -

my object have in collection: type room struct { id bson.objectid `json:"id" bson:"_id"` name string `json:"name" bson:"name"` } inserting collection: room = &room{id: bson.newobjectid(), name: "test"} roomcollection.insert(room) retrieving collection (any): roomx := &room{} if err := roomcollection.find(bson.m{}).one(roomx); err != nil { panic(err) } fmt.printf("roomx %s:\n%+v\n\n", roomx.id, roomx) this outputs: roomx objectidhex("52024f457a7ea6334d000001"): &{id:objectidhex("52024f457a7ea6334d000001") name:test} retrieving collection (by id): roomz := &room{} if err := roomcollection.find(bson.m{"_id": room.id}).one(roomz); err != nil { panic(err) // throws "not found" } this throws "not found" , can't figure out why. the different key-value tags fi...

visual studio - Using c# property DHCPLeaseLifetime -

i looking way find out , use how lifetime left in dhcp lease , ms has documentation here, guess not sure how use property. haven't been able find much. here's link you might want consider the msdn example . illustrates how lease lifetime. the (condensed) version of example future reference: each adapter in net.networkinformation.networkinterface.getallnetworkinterfaces() each uni in adapter.getipproperties().unicastaddresses console.writeline(" unicast address ......................... : {0}", uni.address) console.writeline(" dhcp leased life time ................ : {0}", uni.dhcpleaselifetime) next uni next adapter

r - adding labels to 2D scatter plot (kmeans clustering) -

Image
i calculated pca on samples of dataset , retained first 2 components vectors .i calculated k-means clustering on these first 2 components k=3. need plot 2d scatter plot first 2 eigenfunctions (from pca) , color based on cluster group. accomplished scatter plot when @ plot cannot differentiate samples clustered want add sample labels points in scatter plot. can suggest me how go this? tdata<-t(subdata) pca <- prcomp((tdata),cor=f) dat.loadings <-pca$x[,1:2] cl <- kmeans(dat.loadings, centers=3) pca1 <-pca$x[,1] pca2 <-pca$x[,2] plot(pca1, pca2,xlab="pca-1",ylab="pca-2",col=cl$cluster) thank you this can done using ggplot. use mtcars data since don't have access dataset using. idea should pretty clear anyway. library(ggplot2) pca <- prcomp((mtcars),cor=f) dat.loadings <-pca$x[,1:2] cl <- kmeans(dat.loadings, centers=3) pca1 <-pca$x[,1] pca2 <-pca$x[,2] #plot(pca1, pca2,xlab="pca-1",ylab="pca-2...

templates - Reuse form in actions "New" and "Edit" -

i have actions "new" , "edit". want reuse same template in both actions. problem is, when i'm creating new entity, want show "new entity" in page title. when i'm editing entity want "editing entity title". i pass variable in each action indicating action don't feel right doing ... there way detect if it's creation or edition in twig? how solve common issue? you can pass entity view , create variable in twig {% set isnew = not entity.id > 0 %} easy? if want pass form view can entity directly form {% set entity = form.get('value') %}

c# - Observing NotifyPropertyChanged and responding to it -

i have collection of field objects , each field object implements inotifypropertychanged . field object has various properties inside it, have 1 property called isapproved need listen changes. interest if boolean flag set or unset, need notified or need respond event(the property set or unset ui via wpf binding). can use reactive extensions this, or overkill? if not recommend? code: public class field : inotifypropertychanged { private bool _isapproved; public bool isapproved { { return _isapproved; } set { if (_isapproved == value) return; _isapproved = value; raisepropertychanged(() => isapproved); } } ///has lots of other properties. } in viewmodel, have collection of field s, , need observe on see when isapproved property set or unset on or of them. how can that? edit: have fields collection an observable collection, boun...

clojure: how to get values from lazy seq? -

iam new clojure , need value out of lazy sequence. you can have @ full data structure here: http://pastebin.com/ynljalap need content of title: {: _content albumtitel2} i managed list of _content values: (def albumtitle (map #(str (get % :title)) photosets)) (println albumtitle) and result is: ({:_content albumtitel2} {:_content test} {:_content albumtitel} {:_content album123} {:_content speciale} {:_content neues b5 album} {:_content album nr 2}) but how can value of every :_content? any appreciated! thanks! you this (map (comp :_content :title) photosets) keywords work functions, composition comp first retrieve :title value of each photoset , further retrieve :_content value of value. alternatively written as (map #(get-in % [:title :_content]) photosets)

mysql query to move unique rows to temp table -

i want create query move every unique entry 1 table temporary table. created following query unique entrys: select date, messagetype, zcampaignid, issenderpolicy, sender, recipient, policy, operator, country, znumber topcampaigns_hour group date, messagetype, zcampaignid, issenderpolicy, sender, recipient, policy, operator, country, znumber having count(*) = 1; and returns lots of results: /* affected rows: 0 found rows: 473 warnings: 0 duration 1 query: 0.000 sec. (+ 0.016 sec. network) */ however when put update cant seem tmp table updated: update topcampaigns_hour_tmp b inner join ( select date, messagetype, zcampaignid, issenderpolicy, sender, recipient, policy, operator, country, znumber topcampaigns_hour group date, messagetype, zcampaignid, issenderpolicy, sender, recipient, policy, operator, country, znumber having count(*) = 1) set b.date=a.date, b.messagetype=a.messagetype, b.zcampaignid=a.zcampaignid, b.issenderpolicy=a.issenderpolicy...

Sitecore Event Queue - Can I delay events? -

sitecore has nice event queueing system persisted database. can define custom events . i need able raise event has delay before it's processed. possible? i use other queueing system ( apachemq ?), nice use built in sitecore 1 if possible. as far know not possible delay event directly. there way custom code want executed delay. you create custom event. in custom event handler use sitecore jobmanager execute specific method want start delay. using sitecore jobmanager able delay execution of method passing additional parameter "initialdelay". var options = new joboptions("jobname", "category", "sitename", "object instance contains method execute", "methodname") { initialdelay = timespan.fromminutes(5.0) }; jobmanager.start(options); you can use execute method on cd server delay, after triggering cms server using remote events. see this link more info sitecore jobs.

getPrice() fatal error in magento customs product -

when try price attribute customs product, fatal error being thrown. $_product->getprice(); fatal error: call member function getprice() on non-object in /opt/lampp/htdocs/sve279/app/code/core/mage/catalog/model/product.php on line 211 when checked in core file, found this: public function getpricemodel() { return mage::getsingleton(‘catalog/product_type’)->pricefactory($this->gettypeid()); } so problem out customs product. know solution problem? you got error when $_product object not loaded. example: load product "sku" $product = mage::getmodel('catalog/product')->loadbyattribute('sku',$row['sku']); echo $product->getprice();

windows server 2008 - Remote PowerShell script doesn't apply Hyper-V Snapshot -

i'm attempting remotely apply hyper-v snapshot through powershell. i'm following ben armstrong's guide this. i'm in server 2008 r2, way. in nutshell: connecting remote server: $password = convertto-securestring "password" -asplaintext -force $cred = new-object system.management.automation.pscredential ("domain\user", $password) enter-pssession -computer computername -credential $cred this works fine. i've tested remote connection creating folder on machine. applying snapshot: $hypervserver = read-host "specify hyper-v server use (enter '.' local computer)" # prompt virtual machine use $vmname = read-host "specify name of virtual machine" # prompt name of snapshot apply $snapshotname = read-host "specify name of snapshot apply" # management service $vmms = gwmi -namespace root\virtualization msvm_virtualsystemmanagementservice -computername $hypervserver # virtual machine object $vm = gw...

c# - SQL Server XPath Query to Extract ArrayOfString -

how write xpath query return object that'll have array of string? can't seem value or string work. <info> <emailaddresses> <string>email1</string> <string>email2</string> <string>email3</string> </emailaddresses> </info> select table.[object].value('(//info/emailaddresses)[1]','nvarchar(max)') 'emailaddresses' table ... leads cannot implicitly atomize or apply 'fn:data()' complex content elements, found type 'arrayofstring' within inferred type 'element( select table.[object].query('(/info/emailaddresses)[1]') 'emailaddresses' table ... will return whole <emailaddresses> <string>email1</string> <string>email2</string> <string>email3</string> </emailaddresses> which makes odd parse in code since it'll have transferred object instead of list of string in c# ...

python - Foreign Key to get many instances of a class -

Image
so, code looks right now: and when click on products ideally this: so, right code allowing me 1 product, option of adding unlimited amount of products. here's code: class purchaseorder(models.model): product = models.foreignkey('product') vendor = models.foreignkey('vendorprofile') dollar_amount = models.floatfield(verbose_name='price') class product(models.model): products = models.charfield(max_length=256) def __unicode__(self): return self.products how can this? or, rather, possible? use manytomanyfield instead of foreignkey.

MYSQL Stored Procedure Issues -

i writing mysql stored procedure first time, , running issue - think handler code. basically, want code update rows in pps_users table, reason hitting 'finished condition' handler after 2 rows fetched. i tried same thing repeat syntax , got same result. if run cursor query correctly 10,000 records expect, when run whole thing is, hit finished code after 1 or 2 records. delimiter $$ create definer=`root`@`localhost` procedure `changenflfavteams`() begin declare favnflteam varchar(100) default ""; declare favncaateam varchar(100) default ""; declare v_finished integer default 0; declare user_id bigint(20); declare fullnameofteam varchar(100) default ""; declare update_favs cursor select id, favorite_nfl_team pps_users favorite_nfl_team not null; declare continue handler not found set v_finished = 1; open update_favs; updaterecord: loop fetch update_favs user_id, favnflteam; se...

javascript - What is the difference between `this` and `var` in a function. -

this question has answer here: difference between var , in javascript functions? 2 answers i have following javascript code project @ school. (this code provided me.) can explain difference between var setdatarequest , this.setdatarequest understand happening in functions, not why functions created in fashion. similar overloading? tele.forms.controller = new function () { var _requestdata; this.setrequestdata = function (requestdata) { _requestdata = requestdata; }; var setrequestdata = function () { var fields = $('.formsmaintable'); var reqdata = ['request_record_id', 'date_submitted', 'requester_id']; .... .... }; .... .... }; this.setrequestdata available @ tele.forms.controller.setrequestdata , while var setrequestdata available internals of function. think of this.set...