Posts

Showing posts from June, 2010

javascript - Changing div using links -

javascript - Changing div using links - i got code uses links alter divs when paste these codes dreamweaver , open html file on firefox or google chrome don't work. work flawlessly on fiddle though. help appreciated. here jsfiddle. firefox google chrome css / html / jquery / demo class="snippet-code-js lang-js prettyprint-override"> $(document).ready( function () { // optional code hide divs $("div").hide(); $("#one").show(); // show chosen div, , hide others $("a").click(function (e) { e.preventdefault(); $("#" + $(this).attr("class")).show().siblings('div').hide(); }); }); class="snippet-code-css lang-css prettyprint-override"> .divstyle { height:300px; width:300px; border:1px solid #000; } .liststyle li { display:inline-block; } class="snippet-code-html lang-html prettyprin...

algorithm - C Program to detect right angled triangles -

algorithm - C Program to detect right angled triangles - if given 100 points in coordinate system, , have find if there exist right angled triangle in vertices. there way can observe right angled triangle among vertices without having take pairs of 3 vertices , applying pythagoras theorem on them?? can there improve algorithm this? help. :) here's o(n^2 log n)-time algorithm two dimensions only. i'll describe goes wrong in higher dimensions. let s set of points, have integer coordinates. each point o in s, build set of nonzero vectors v(o) = {p - o | p in s - {o}} , test whether v(o) contains 2 orthogonal vectors in linear time follows. method 1: canonize each vector (x, y) (x/gcd(x, y), y/gcd(x, y)), |gcd(x, y)| largest integer divides both x , y, , gcd(x, y) negative if y negative, positive if y positive, , |x| if y zero. (this similar putting fraction in lowest terms.) key fact 2 dimensions that, each nonzero vector, there exists 1 canonical vector orthog...

numpy - how can the string convert to int in python? -

numpy - how can the string convert to int in python? - in machine learning in action chapter 2, 1 illustration reads records file, each line like: 124 110 223 largedoses (forget actual meaning) one function in knn.py is: def file2matrix(filename): fr = open(filename) numberoflines = len(fr.readlines()) returnmat = zeros((numberoflines,3)) classlabelvector = [] fr = open(filename) index = 0 line in fr.readlines(): line = line.strip() listfromline = line.split('\t') returnmat[index,:] = listfromline[0:3] classlabelvector.append(int(listfromline[-1])) index += 1 homecoming returnmat,classlabelvector the problem listfromline[-1] string ( 'largedoses' , etc.), how can convert int ? in book, says numpy can handle this. (from book : you have explicitly tell interpreter you’d integer version of lastly item in list, ...

Is it possible to join a hive table with oracle table? -

Is it possible to join a hive table with oracle table? - i have problem in writing query using hiveql. is possible bring together hive table oracle table? if yes how? if no why? to access info stored in hive tables, including joining on them, need oracle big info connector. from documentation: using oracle sql connector hdfs, can utilize oracle database access , analyze info residing in hdfs files or hive table. can query , bring together info in hdfs or hive table other database-resident data. if required, can load info database using sql. oracle join hadoop hive

php - Scheduling push notifications with symfony2 -

php - Scheduling push notifications with symfony2 - i have been tasked implement force notification scheme mobile apps of commercial web app using symfony2. i have used rmspushnotificationsbundle(https://github.com/richsage/rmspushnotificationsbundle) creating , sending messages , implemented event-listeners send on-the-fly notifications clientele list. due fact need have scheduled notifications, have created couple of symfony commands executed through cron jobs. code behind commands checks scheduled notifications every 30 minutes , if notification sent in current time interval, sents it. currently works fine. main concern regards scalability of current implementations user-base expected grow lot. is there improve way go regarding scheduled notifications? know bit generic question appreciate kind of insight/ advice. cheers i think not question of scheduling of scaling. gcm (google cloud messaging) can force multiple devices @ 1 time (up 1000): https://developer...

javascript - Multiple Google Gauges with different option sets -

javascript - Multiple Google Gauges with different option sets - i'm trying insert multiple instances of google gauges (or highchart gauges) on page. want utilize different alternative sets , place them apart. cannot utilize solution presented here, think: google charts multiple gauges i've given effort here: http://jsfiddle.net/tcmsu475/1/ i'm missing fundamental. it's same highchart charts. cannot seem draw 1 chart in 1 div , in div. the code (for future reference): ... <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['gauge']}]}"></script> <div id="chart1_div" /> <div id="chart2_div" /> ... $(function () { var chart1_dat...

verilog - The difference between @(a==1) and @(posedge a) -

verilog - The difference between @(a==1) and @(posedge a) - in non-synthesizable code, difference between: @(a==1); and @(posedge a); are behaving same? the next illustration (on eda playground) shows not same : module test; logic = 1'b0; initial begin #100ns <= 1'b1; #100ns <= 1'b0; #100ns <= 1'b1; #1000ns $finish; end initial begin @(a == 1'b1) $display("%t : == 1 (1) %b",$realtime, a); @(a == 1'b1) $display("%t : == 1 (2) %b",$realtime, a); @(a == 1'b1) $display("%t : == 1 (3) %b",$realtime, a); end initial begin @(posedge a) $display("%t : posedge (1)",$realtime); @(posedge a) $display("%t : posedge (2)",$realtime); @(posedge a) $display("%t : posedge (3)",$realtime); end endmodule which displays 100 : posedge (1) 100 : == 1 (1) 1 200 : == 1 (2) 0 300 : ==...

java - Is this the case of method hiding? -

java - Is this the case of method hiding? - i have next code in base of operations class employee have static method meth1() able phone call kid class (pro) object . case of method hiding or ? , not sure because haven't implemented meth1() method in pro class, still able phone call emplyee static method pro object. class employee { string s; public string gets() { homecoming s; } public void sets(string s) { this.s = s; } protected static void meth1() { system.out.println("inside emp-meth1"); } } public class pro extends employee { /* * public void meth1() { system.out.println("inside encapsulation-meth1"); } */ public static void main(string as[]) { pro e = new pro(); // e.s ="jay"; e.meth1(); } } output: inside emp-meth1 thanks jayendra what trying hide? seek below code emp.meth1() phone call method...

Converting .htaccess (PHP) line to web.config line (IIS) -

Converting .htaccess (PHP) line to web.config line (IIS) - i have these lines in .htaccess file , have moved site iis environment. i'm pretty sure needs go web.config file in root i'm totally lost , tried no luck. directs .php, .htm, or .html index.php page in root can command displayed , create things modular. tack on filename in query string can direct content there. anyways heres have .htaccess: rewritecond %{request_filename} (\.php|.htm|.html)$ rewriterule ^(.*)$ index.php?q=$1 [l,qsa] you can import , convert mod_rewrite rules iis url rewrite rules using microsoft supported url rewrite iis manager module web.config <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="rule 1" stopprocessing="true"> <match url="^(.*)$" ignorecase="false" /...

css - Warning: copy(): Unable to find the wrapper "..file" -

css - Warning: copy(): Unable to find the wrapper &quot;..file&quot; - here fiddle of list im working on. workd fin, display drops right hand side borders. i dont know why. fiddle ive tried set margin on right of container, nothing... .notifycontainer{ clear:both; width:400px; } i'm not understand problem right, if set .content , .header clear:both rows displayed 1 below other. .header, .content { clear:both; } you don't need float:left on them... modified jsfiddle css

Connect to mysql in CLI - distinguish db name and password -

Connect to mysql in CLI - distinguish db name and password - i trying next mysql command: zcat ***.sql.gz | mysql -u root -p dbname maybe question applies as following, simpler command: mysql -u root -p dbname you can find kind of snippet on internet, , works. should prompt db user's password (in case, db root pw), , utilize "dbname" database name. today did not inquire me root pw, , instead said access denied user 'root'@'localhost' (using password: yes) i assume in case mysql thought "dbname" password. don't understand why in usual case understands "dbname" database name. i have seen variation: mysql -u root -pthepassword dbname here interesting thing -u followed space, -p not. the question: how mysql distinguish dbname password? mysql

java - AspectJ - Child Classes Getting Lost -

java - AspectJ - Child Classes Getting Lost - i'm sure amounts newbie question aspectj reviewing books , web sites, i'm not seeing reply in terms recognize. summary: in client jar, getting compilation errors complaining methods added part of "aspect b" not present. i have setup similar : +---------------------+ | | | client jar | | | +--+---------------+--+ | | | | +----------+----+ +-------v-------+ | json serial / | | other aspect | | deser aspect | +---------------+ +-------------+-+ +-------v-------+ | | potential | | | other jar | | +---------------+ | +----v-----------+ | javabean | | aspects | ...

Grails - Control the order of Database Columns -

Grails - Control the order of Database Columns - how command order of database columns in domain classes? i utilize domain objects create database tables fields in database in order. is there way can command order in domain classes. you can command creation of database schema using database migration plugin. can read more how utilize plugin in documentation. grails

Polymer: Binding paper-tabs to core-pages inside core-scaffold -

Polymer: Binding paper-tabs to core-pages inside core-scaffold - i have issue here, need bind paper-tab selection core-pages selection within core-scaffold . i have tried binding paper-tabs core-pages polymer , not working: tabs.addeventlistener('core-select',function() { pages.selected = tabs.selected; console.log("selected: " + tabs.selected); }); returns error on console: tab not found! index.html:147 uncaught typeerror: cannot read property 'addeventlistener' of null here entire code page: <!doctype html> <html> <head> <title>test page</title> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> <script src="../components/platform/platform.js"></script> <link rel="import" href="../components/polymer/polymer.html"...

java - How do I specify different (PMD, Checkstyle, Findbugs) rulesets for test and production code using Gradle? -

java - How do I specify different (PMD, Checkstyle, Findbugs) rulesets for test and production code using Gradle? - i building java project gradle. separate tasks: i utilize strict rules (i.e. pmd, checkstyle, findbugs) production code more relaxed rules (i.e. allowing duplicate strings , magic numbers) tests . i have done ant (quite simple), , though know phone call ant tasks gradle, rather utilize respective plugins. how go this? my current build script pmd follows: apply plugin: 'pmd' pmd { ignorefailures = true rulesetfiles = files("$staticanalysiscfgdir/pmd/pmdruleset.xml") toolversion = '5.1.3' sourcesets = [sourcesets.main, sourcesets.test] } instead of configuring rule sets on pmd extension, configure them on pmdmain , pmdtest tasks (same syntax). likewise checkstyle , findbugs. java gradle checkstyle findbugs pmd

c# - .net 4.5 Correct Windows Service Start Method -

c# - .net 4.5 Correct Windows Service Start Method - now tasks seem accepted way of implementing multi-threading, "correct" way write windows service start method? the start method finish i'm new tasks , want create sure right way implement service work. i've tested , seems work want know if there side effects approach. protected override void onstart(string[] args) { task.run(() => myservicethingstodo()); } private void myservicethingstodo() { // stuff want read database, send alerts // start other tasks } i've looked around @ usual sources , can't find source (msdn or otherwise) states right way build service now. i've used in enterprise applications , works without issue: _messagequeuewatcher = new task(_engineservice.startmessagequeuewatcher, _canceltokensource.token, taskcreationoptions.longrunning); _messagequeuewatcher.start(); i run asynchronous phone call off of onstart(string[] args){} c# .ne...

angularjs - Ionic angular js -

angularjs - Ionic angular js - hello guys im struggeling ionic , angular build news site view menu points ionic menu points wrote news in array for illustration http://plnkr.co/edit/zwohlcmzdxukd4lawn4t?p=catalogue .controller('newsctrl', function($scope) { var items = [ {id: 1, news_item: 'news example'} ]; }); how can route right path news_item.html site klicked on. if click on first 1 tempalte 'news example' i couldn't test reply because plunker not working. think forgot index.html file. but believe should add together items list url redirect page : .controller('newsctrl', function($scope) { var items = [ {id: 1, news_item: 'news example', template_url : '/path/to/template'} ]; }); then can add together path href in <a></a> block. hope help angularjs getelementbyid ionic-framework

actionscript 3 - how to convert seconds to minutes:seconds in as3 -

actionscript 3 - how to convert seconds to minutes:seconds in as3 - hi new in action script 3 in flash cs6 im creating game timer i want create seconds minutes:seconds format example: 120 seconds 2:00 this code: var countdowndec:number = 1; var totalsecs = 120; var countdownsecs = totalsecs; counter.text = countdownsecs; var time:timer = new timer(countdowndec*1000); time.addeventlistener(timerevent.timer, tick); time.reset(); countdownsecs = totalsecs; counter.text = countdownsecs; time.start(); var framelbl:framelabel; function tick(e:timerevent):void { time.start(); if(countdownsecs == 0){ time.stop(); countdownsecs = totalsecs; gotoandplay('timesup'); timesup.play(); } else{ countdownsecs = countdownsecs - countdowndec; counter.text = countdownsecs; } } please help me problem ...

ios - Using SKScene as a loading screen -

ios - Using SKScene as a loading screen - in game making, wanted create animation every time game opened. thinking of using skscene loading scene able show animation. think thought or there improve way go going this? skscenes building blocks sprite kit. can animate, delay , transition scene using functionality scenes have built in. basically, create sequence ends scene transitioning next scene. // here transitioning code covers bulk of tasks. sktransition *reveal = [sktransition fliphorizontalwithduration:0.5]; skscene * gameoverscene = [[gameoverscene alloc] initwithsize:self.size won:yes]; [self.view presentscene:gameoverscene transition: reveal]; ios sprite-kit skscene

asp.net web api - multiple self-hosted webapi on same server -

asp.net web api - multiple self-hosted webapi on same server - i want host, mutiple self-hosted webapi's along web-site on same machine / windows 2k8 server. hosting website using iis. , webapi's using self-hosted webapi 2. how configure using self-hosted webapi, can work in sync on same server. so lets host website @ http://example.com/mysite , hosting webapi @ http://example.com/apiws , http://example.com/apiui i using windows service configuration. how web-api self hosting looks of - first webapi. protected override void onstart(string[] args) { _config = new httpselfhostconfiguration(serviceaddress); _config.maphttpattributeroutes(); _config.routes.maphttproute("defaultapi", "apiws/{controller}/{id}", new { id = routeparameter.optional }); _server = new httpselfhostserver(_config); _server.openasync().wait(); } the configuration same sec server well. my ques...

python - OpenERP / Odoo Unexpected View Parsing error -

python - OpenERP / Odoo Unexpected View Parsing error - hy all, i'm doing update openerp 6.1 odoo8. have self written modul, adapted python code , everthings seems fine, can install modul, if load view next error: file "./openerp/models.py", line 1295, in _validate_fields raise validationerror('\n'.join(errors)) parseerror: "validateerror field(s) `arch` failed against constraint: invalid view definition error details: element '<xpath expr="//footer">' cannot located in parent view error context: view `mail.compose.message.form` [view_id: 248, xml_id: email_template.email_compose_message_wizard_inherit_form, model: mail.compose.message, parent_id: 216]" while parsing /home/gsatter/dokumente /odoo/odoo/seekda_addons/seekda_mail_extension/wizard/mail_compose_view.xml:4, near <record model="ir.ui.view" id="mail.email_compose_message_wizard_form"> <field name="...

can't send messages over websocket with pusher and rails -

can't send messages over websocket with pusher and rails - i tried send test-data websocketserver, can't work :( my firebug console says this: pusher : state changed : initialized -> connecting pusher : connecting : ws://192.168.56.101:8080/app/123?protocol=5&client=js&version=1.12.5&flash=false pusher : state changed : connecting -> connected pusher : event sent : {"event":"pusher:subscribe","data":{"channel":"test"}} pusher : event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"test"} pusher : no callbacks on test pusher:subscription_succeeded my controller looks this: pusher.trigger('test', 'my_event', {:message => 'hello world'}) my developement.rb this: # pusher settings require 'pusher' pusher.app_id = '123' pusher.key = '123' pusher.secret = ...

html - How to set background across this bar -

html - How to set background across this bar - i trying set background go horizontally across bar behind logo , nav here html <!--nav--> <div class="header"> <div class="title"> <img src="img/logo.png"> </div><!--/.title--> <nav class="nav"> <ul> <li>home</li> <li>services</li> <li>contact</li> </ul> </nav> </div> and here css .title { display:inline; float:left; margin:0 auto; } .nav { font-size:20px; color:#0f3; display:inline; float:right; margin:0 1.7%; padding:1% 4% 0; } ul { display:inline; float:right; list-style:none; } li { display:inline; } you can modify .header class. keep in mind floating divs don't impact size of surrounding element. can utilize overflow: auto; in header class create surrounding...

javascript - Insert select element using innerHTML (JS) -

javascript - Insert select element using innerHTML (JS) - i'm trying replace content in td tag id "row2". can tell me why innerhtml line not working? var e = document.getelementbyid("location"); //location <select> id var area = e.options.selectedindex; if (area == 1) { var myrow = document.getelementbyid("row1"); var array = ["item1", "item2", "item3"]; var selectlist = document.createelement("select"); selectlist.setattribute("id", "myselect"); document.getelementbyid("row2").innerhtml = selectlist (var = 0; < array.length; i++) { var alternative = document.createelement("option"); option.setattribute("value", array[i]); option.text = array[i]; selectlist.appendchild(option); } } you need utilize appendchild insert new element kid of element. innerhtml html text wi...

python - Post Object or array of Objects to API -

python - Post Object or array of Objects to API - i have rest api endpoint can post json object or json array of objects. i managed redefining create method of modelviewset: def create(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data, many=false) if serializer.is_valid(): serializer.save() headers = self.get_success_headers(serializer.data) homecoming response(serializer.data, status=status.http_201_created, headers=headers) else: serializer = self.get_serializer(data=request.data, many=true) if serializer.is_valid(): serializer.save() headers = self.get_success_headers(serializer.data) homecoming response(serializer.data, status=status.http_201_created, headers=headers) homecoming response(serializer.errors, status=status.http_400_bad_request) i used is_valid() serializer know if info conta...

JNI shared object compatibility on different JVM versions -

JNI shared object compatibility on different JVM versions - the getenv method jni sdk accepts 2 parameters. struct javavm_ { jint getenv(void **penv, jint version) { homecoming functions->getenv(this, penv, version); } }; here possible values 2nd parameter. #define jni_version_1_1 0x00010001 #define jni_version_1_2 0x00010002 #define jni_version_1_4 0x00010004 #define jni_version_1_6 0x00010006 #define jni_version_1_8 0x00010008 if indicate jni_version_1_6 shared object loaded jvm 1.8, happen? there method query jvm version? jvm backward compatible previous jni libraries. should specify minumum required jni version. jni_version_1_4 should ok cases. jvm jni

Android LocationManager encapsulation issue -

Android LocationManager encapsulation issue - i'm trying phone call requestlocationupdates method eclipse says arguments wrong. the main activity set : public class mainactivity extends activity implements locationlistener{... } and code errors : final locationmanager locationmanager = (locationmanager) getsystemservice(context.location_service); tracklocation.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { boolean tracking = false; if (!tracking){ locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, this); } else { // } } }); the locationmanager.... line works fine outside onclicklistener. what should right parameter fix? thanks in advance replace "this" "mainactivity.this". if have "this", passing in onclicklistener instead of activity. android encapsul...

html - jquery ui tabs in to selected option -

html - jquery ui tabs in to selected option - how create jquery ui tabs in selected alternative in mobile version. can help me prepare issue. have responsive design. desktop version jquery tab , mobile select option. http://jqueryui.com/tabs/ <div id="tabs"> <ul> <li><a href="#tabs-1">nunc tincidunt</a></li> <li><a href="#tabs-2">proin dolor</a></li> <li><a href="#tabs-3">aenean lacinia</a></li> </ul> <div id="tabs-1"> <p>tabs-1</p> </div> <div id="tabs-2"> <p>tabs-2</p> </div> <div id="tabs-3"> <p>tabs-3</p> </div> </div> here updated code hope help u class="snippet-code-js lang-js prettyprint-override"> $(".tabs-menu a").click(function(event) { event.p...

javascript - Create a hierarchical object from HTML outline -

javascript - Create a hierarchical object from HTML outline - i'm wanting create jquery plugin loops through top level of dom , adds elements object until gets heading, @ point pushes object text of heading. the next sibling elements added new object until new heading encountered — if heading @ same level, new object created sibling of parent object before, , dom siblings added instead of first object; if heading @ lower level, that's added kid of first object, , sibling dom elements added children heading object; if it's higher level headline, new object added 1 level above lastly heading object , cycle continues. example: <p>wooo</p> <h1>stuff</h1> <p>stuff</p> <p>more stuff</p> <h2>yet more stuff</h2> <p>still more stuff</p> <h3>even still more stuff</h3> <p>yep — stuff!</p> <h1>still yet more stuff</h1> <p>stuff stuff stuff</p> <p>...

hikaricp - Behaviour of Hikari setConnectionTimeout -

hikaricp - Behaviour of Hikari setConnectionTimeout - just looking explanation of rationale bit of code (poolutiltites:293 in version 2.2.4): datasource.setlogintimeout((int) timeunit.milliseconds.toseconds(math.min(1000l, connectiontimeout))); this code , setconnectiontimeout method means behaviour: connectiontimeout == 0, logintimeout = integer.max_value connectiontimeout > 0 && < 100, hikariconfig throws illegalargumentexception connectiontimeout >= 100 && <= 1000, logintimeout = connectiontimeout connectionteimout > 1000, logintimeout = 1000 that looks weird me! it's math.min should math.max ??? in current project i'd fail connections after 30s, impossible in current setup. i'm using 4.1 postgres jdbc driver, think not relevant issue above. many - , cool pooling library!!! ok, there couple of moving parts here. first, math.min() bug, should math.max() . in lite of (it fixed) consider following: it of i...

java - My label is not displaying with the correct combination -

java - My label is not displaying with the correct combination - when run program, right message not display after entering right combination. reason, error message displays no matter combination entered. code below. please help me if can. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; public class program3 extends jframe { // jlabel displays header on application window private jlabel instructionsjlabel; // jspinners combination lock private jspinner onejspinner; private jspinner twojspinner; private jspinner threejspinner; private jspinner fourjspinner; private jspinner fivejspinner; // jlabel buttons private jbutton openjbutton; private jbutton resetjbutton; // message area private jlabel displayjlabel; // no-argument constructor public program3() { createuserinterface(); } // create , position gui components; register event handlers p...

android - Dynamically arrange the margins of TextView -

android - Dynamically arrange the margins of TextView - i working on custom array adapter. using extended textview shrinks if text larger. listview item layout follows <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:orientation="horizontal" android:weightsum="3" > <linearlayout android:id="@+id/textlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.8" android:orientation="horizontal" > <linearlayout android:id="@+id/textlabellayout" android:layout_width="wrap_content" an...

javascript - AngularJS - Finding width of changing DOM elements -

javascript - AngularJS - Finding width of changing DOM elements - i sense of angular questions inquire me missing incredibly dumb, let's hope too. i'm building directive command scrolling of wide list of thumbnails. in jquery, had working perfectly, jquery wasn't comfortable grabbing dynamically loaded list angular, i'm rewriting code. basically, i've got gallery exists in ng-repeat: <div id="gallery"> <ul id="gallery_img"> <li class="thumb" ng-repeat="image in thumbnails"> <img ng-src="{{image.thumbnail}}" alt="{{image.description}}" /> </li> </ul> </div> and when click on further-down buttons, <slider class="mover" style="left:0;">&laquo;</slider> <slider class="mover" style="right:0;">&raquo;</slider> the list supposed animate/slide ...

c# - oledbcommand executenonquery access update error -

c# - oledbcommand executenonquery access update error - when run code shows error, please help me! `int code = int.parse(tbxcode.text); string name = tbxname.text; string description = tbxdescription.text; bool active = true; int idcompany = cbxcompany.selectedindex; string kala = cbxkala.selectedvalue.tostring(); int id = int.parse(kala); oledbcommand1.parameters.clear(); oledbcommand1.commandtext = "update kala set code=" + code + ", name=" + name + ", description=" + description + ", active=" + active + ", idcompany=" + idcompany + " id=" + id; oledbconnection1.open(); oledbcommand1.executenonquery(); oledbconnection1.close(); oledbcommand1.parameters.clear();` maybe should add together "'" text column oledbcommand1.commandtext = "update kala set code=" + code + ", name='" + name + "', description='" + description + "', active=" + ac...

sql server - SQL performance of count with where clause vs select -

sql server - SQL performance of count with where clause vs select - i updating code (which did not write) first runs query such as select count(*) dbo.app_person person person._pk > 0 , person.last_name 'lname%' , person.first_name 'fname%' , person._pk in (select _pk dbo.app_personview ) if resulting count not large, later runs much same query, select person._pk in place of select count(*). otherwise user told refine set of selections , seek again. (the fields checked, , values compare to, user input.) is there reason not run sec form , @ size of result, don't need run query twice? select count(*) much faster select person._pk (the primary key)? this run under sqlserver 2005 or later, 2008 or later. table large. yes, there reason not run sec form , @ size of result: can't get size of result without scanning through whole result set. you process results if there few plenty until there prove many, if processing exp...

d3.js - How to select multiple svg texts in a single customized zoom function -

d3.js - How to select multiple svg texts in a single customized zoom function - i working on zoom function of d3 not able zoom on 2 different text(labels). text code: (they working) var texts = canvas.selectall("text") .data(nodes) .enter(); texts.append("text") .attr("class", function(d) { homecoming d.children ? "parent" : "child"; }) .attr("x", function(d) { homecoming d.x; }) .attr("y", function(d) { homecoming d.y; }) .attr("dy", ".35em") .attr("text-anchor", "middle") .style("opacity", function(d) { homecoming d.r > 20 ? 1 : 0; }) .text(function(d) {return d.children ? "" : d.name;; }); texts.append("text") .attr("class", function(d) { homecoming d.children ? "parent" : "child"; }) .att...

ElasticSearch average aggregation in results -

ElasticSearch average aggregation in results - i want average cost in top 10 sale products, next query: { "aggs": { "top_sale_avg_price": { "avg": {"field": "price"}, "aggs": { "top_sale_hits": { "top_hits": { "sort": [{"buy_count": {"order": "desc"}}], "size": 10 } } } } } } then error, says "aggregationinitializationexception[aggregator [top_sale_avg_price] of type [avg] cannot take sub-aggregations]" top hits find 10 documents best match query (i.e. score highest). sort performed on result set - top hits won't work you. you can't nest top_hits , avg within each other - can nest within bucket (e.g. terms, histogram, range, etc.) to m...

Android videoview causes blocking UI elements -

Android videoview causes blocking UI elements - hi in android application using videoview streaming videos. face unwanted behaviour videoview. scenario this. have activity , activity b. activity has 1 simple button , on click of button starting activity b contains videoview , starts playing video start activity. observation this: 1 time start activity b phone call setvideouri , start() . there few callback methods 1 of them setonpreparedlistener . when phone call start() after time executing setonpreparedlistener , after start playing video. in between before executing setonpreparedlistener if come activity block activity ui time. if wait till setonpreparedlistener executes , come activity working properly. not happening devices google devices moto g , nexus. tried htc or intel device working properly. code looks : videoview mvideoview =(videoview)findviewbyid(r.id.myvideo); //creating mediacontroller mediacontroller mediacontroller= new media...

c++ - QGraphicsItem setPos() not triggered -

c++ - QGraphicsItem setPos() not triggered - and again, trying implement bezier curves redactor. there class beziernode : public qgraphicsitem beziernode::beziernode(qpointf point, type type) : qgraphicsitem() { setpos(point); setflags(itemismovable | itemsendsscenepositionchanges | itemsendsgeometrychanges); } it moves around in scene on mousepress + mousemove, , can grab events in itemchange() additional acting command points. in qgraphicsitem::mousemoveevent() (according qt source on gitorious) there phone call item->setpos(...) . however, if seek reimplement beziernode::setpos(..) , it's never triggered on moving object. void beziernode::setpos(const qpointf &pos) { qdebug() << "setpos " << pos; m_point = pos; qgraphicsitem::setpos(pos); } in case setpos() triggers in constructor (there phone call manually). yes, moves in scene properly, can position pos() , utilize everywhere instead of m_point, w...