Posts

Showing posts from August, 2010

sql server - SQL Get results back from every items in IN() -

hi can 1 me this? i have made query: select distinct(campaign), count(status) c18_101 inner join client_10 on c18_101.id = client_10.id campaign in ('batch 1','batch 2','batch 3','batch 4','batch 5') , status = 'pending' group campaign,status the result looks this: batch 2 241 batch 3 321 batch 4 575 batch 5 429 i need result batch1 when there none. select x.campaign, count(status) (select distinct campaign c18_101) x left join client_10 c on x.id = c.id , c.status = 'pending' group x.campaign you either group or aggregate, not both you distinct before join ensure counts correct per campaign do need campaign filter? if so, add derived table x

android - Blank subscribers view in nexus 7 and Galaxy S3 (Opentok Face 2 Face Live Video chat) -

i testing opentok helloworld application( https://github.com/opentok/android-hello-world ) face 2 face live video streaming. have tested in nexus 7 , samsung galaxy s3. in both devices able see publisher view not able see subscribers view. in logcat got following exception: w/system.err(14796): java.net.socketexception: recvfrom failed: econnreset (connection reset peer) i/opentok-rtsp(14796): rstp client channel closed. disconnecting. for creating keys, have created project in https://dashboard.tokbox.com , 1. enabled peer 2 peer connection , created session id there 2. created token id session id. 3. copied project api key, session id, token in code. i have installed same app in above 2 devices. 05-08 18:05:48.908: d/dalvikvm(14796): gc_concurrent freed 565k, 9% free 7900k/8632k, paused 6ms+3ms, total 36ms 05-08 18:05:48.908: d/dalvikvm(14796): wait_for_concurrent_gc blocked 19ms 05-08 18:05:48.928: d/dalvikvm(14796): gc_for_alloc freed 128k, 7% free 8110k/8632k, pause

sqlite database practice in android -

i have made application simple in android database practice,as have no idea sqlite database i've gone through many links it,but of them complex,i have created 4 activities 1st (mainactivity) contains 3 buttons "add","edit", , "view" in 2nd activity (addactivity) have made 3 edittexts entered values should stored in database.so can please tell me easy steps doing same? mainactivity.java package com.example.db; import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button add=(button)findviewbyid(r.id.button1); button edit=(button)findviewbyid(r.id.button2); bu

javascript - How can I fix this array table? -

i have written simple array table using 3 values defined user. these 3 values determine value of variable. have written similar code before reason can not figure out why 1 not working. table large sorry size... var ssridgeqty=document.getelementbyid("ssridgetrim").value; var ssridgewidth=document.getelementbyid("ssridgewidth").value; var ssridgecolorup; if (sscolorchoice=="galvalume") { ssridgecolorup="1"; } else if (sscolorchoice=="dark gray" || sscolorchoice=="antique bronze" || sscolorchoice=="rural red" || sscolorchoice=="dark green" || sscolorchoice=="fern green") { ssridgecolorup="2"; } else if (sscolorchoice=="metallic copper") { ssridgecolorup="3"; } else if (sscolorchoice=="none" && ssridgeqty>0) { ssridgecolorup=0; alert ("please choose ss color"); } else { ssridgecolorup="4"; } va

c# - How to avoid screen flickering? -

i making windows form application , screen divided between 3 parts like =========================================================================== top panel (it doesn't flicker) =========================================================================== || || 'it has panel & panel contains table layout,this tabble layout' || || 'has picture box , label, picture & text of label is' || ||'changed on click of side bar menu' (prob: flickers lot) ||side bar ||============================================================== ||(doesn't ||'this part has panel , panel contains different table' ||flicker) ||'layouts , on click of menu, related table layout shown and' || ||'some of parts of table layout created dynamically.' || || || || (prob: flickers lot) || || i searched lot , found solution everywhere , tried

c# - Can't fill my model with a grouped list of a table using LINQ -

i'm working on new project using .net mvc4 , entity framework. have products table , i'm trying select products grouping. my model: public class cart { public long index { get; set; } public list<products> productlist = new list<products>(); public int itemcount { get; set; } public decimal total { get; set; } } my query: var result = p in productlist group p p.id grp select new { index = grp.key, productlist = grp.tolist<products>(), itemcount = grp.count(), total = grp.sum(w => w.price) }; and wanted apply result list of cart. failed @ point. please can me that. you need specify type returned select var result = p in productlist group p p.id grp select new cart //<-- here { index = grp.key, productlist = grp.tolist<pro

Numerical integration by the Romberg method using CUDA -

i tried searching libraries on google numerical integration on cuda couldn't find any. 1) want ask, there libraries available perform integration (of function) on cuda? 2) if write own code on cuda, e.g. implementing romberg integration, how shall proceed? suppose have function, f(x) ; need calculate integrals of function different intervals e.g. 0.0 - 0.1 , ..., 0.2 - 0.3 , ..., 1.3 - 2.3 ? how calculate of them in parallel? in mind, strategy if have perform, e.g., 1000 integrations, generate 1000 threads, each thread calculates trapzoids error estimates. in case when want calculate trapzoids 1 of integration interval in parallel along other integrals, don't have idea how approach programatically. as noticed above tera in comment, point of view of parallel programming, integration reduction, simple way implement integration in cuda exploiting primitives of thrust library (see answer simpson's method integrate real valued functions cuda ). below simp

java ee - When adding book values to @Entity values turn out null JavaEE -

i have done stupid , have tried , tried 4 hours , can't figure out wrong. when try add book database, mysql increments values set in mysqltable columns "null". im running eclipse, , glassfish 3.1.1, maven 2.1 , mysql. i have mixed something, or annotations wrong or stupid. please help! books entity package se.andolf.entities; import java.io.serializable; import javax.faces.bean.requestscoped; import javax.faces.bean.sessionscoped; import javax.inject.named; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.table; @entity @sessionscoped @named @table(name = "books") public class books implements serializable { private static final long serialversionuid = 1l; @id //private key @column (name = "book_id") private long bookid; @column (name = "title"

oauth 2.0 - second step in creating google plus login button -

i'm having page google+ sign in button in page www.mawk3y.net/glogin , here's code head code : <script type="text/javascript"> (function() { var po = document.createelement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(po, s); })(); function signincallback(authresult) { if (authresult['access_token']) { alert("done"); // authorized // hide sign-in button user authorized, example: document.getelementbyid('signinbutton').setattribute('style', 'display: none'); } else if (authresult['error']) { // there error. // possible error codes: // "access_denied" - user denied access app // "immediate_failed" - not automatically log in user // console.log('there error: ' + authresult['error']); } } <

javascript - JQuery UI buttonset misbehaving -

i building ui app using jquery ui elements. need radio buttons part of functionality. while using jquery buttonset works, once try incorporate rest of ui elements don't align properly: http://jsfiddle.net/seuns/2/ including code here: $(document).ready(function() { $("button").button(); $("#tdidir").buttonset(); $("#acqmode").buttonset(); }); <div id='primarylatestcontrol' class="ui-corner-top pacontainer" style='padding: 4px; display: inline-block; '> <button id="setgain" class="button">set</button> <span class="label">gain value</span> <input type="text" id="gainvalue" class="value" value="2"></input> <button id="setlinerate" class="button">set</button> <span class="label">line rate, hz</span> <input type=&quo

axis2 - why pwcb.getPassword is null in this code -

i try add rampart security axis2 web service using rampart module. so here have made: i have stored in database hashed value of "bobwww" password , salt in pwcbhandler.java class •i select stored in database password , hash •i try hash same algorithm pwcb.getpassword() same stored salt •check if new hashed password equal stored password but receiving nullpointerexception decide check , wrote code if(pwcb.getpassword()==null) { try { throw new exception ("passwordget pass null" +pwcb.getpassword()); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } and see pwcb.getpassword() empty. here code of pwcbhandler.java public void handle(callback[] callbacks) throws ioexception, unsupportedcallbackexception { (int = 0; < callbacks.length; i++) { wspasswordcallback pwcb = (wspasswordcallback)callbacks[i];

java - "Inline" list of checkboxes - auto line break -

i have jpanel (extended generaloptions class) implemented as: public generaloptions() { setlayout(new miglayout("", "[grow]", "[][][][]")); jlabel lblwyzywienie = new jlabel("food"); add(lblwyzywienie, "cell 0 0"); jcheckbox chckbxhb = new jcheckbox("hb"); add(chckbxhb, "cell 0 1"); jcheckbox chckbxbb = new jcheckbox("bb"); add(chckbxbb, "cell 0 1,alignx trailing"); jcheckbox chckbxall = new jcheckbox("all inclusive"); add(chckbxall, "cell 0 1,alignx trailing"); } as can see, there list of checkboxes in 1 cell of miglayout. jpanel in placed left panel of splitpanel component, width resizable. what want achieve force list of checkboxes act "inline" html list of checkboxes. means, should break line when width of panel not enough show them in single line. now can't resize panel below width of whole list , if init wid

ajax - fullcalendar dayclick mysqli php -

so have jquery (fullcalendar) , showing records through database query. fine until here :) now want add event when person clicks on date (only start(date) required) person must choose combobox (and combobox populate through database too) title. from understanding have ajax(?) don't know how because don't know ajax.. i have in fullcalendar: dayclick: function(date, allday, jsevent, view) { if (allday) { alert('clicked on entire day: ' + date); }else{ alert('clicked on slot: ' + date); } } so assume have call ajax function after "if (allday){" , prepare php file query, don't know how can put select option in there.. after selection when user click add run script add database.. the combobox database query have title. calendar shows month(all days month). sorry if english bad! you can open dialog on dayclick event ( http://api.jqueryui.com/di

running Procedure by Trigger on new data in OracleDB -

i wrote procedure update table deriving data 4 other tables. procedure works fine, need table date time, call procedure triggers fire, whenever 1 of 4 tables ist altered. works fine except 1 detail. procedure derives data tables before changes, update/delete/insert, fired trigger. trigger rowlevel after u/d/i changing after statement did not help. not using trigger not option, because of need being in sync. changing materialized view seems idea, neede calculations disallowed in , nonmaterialized views slow, why want change nonmaterialized view table. handing information changed in way on procedure possible, make procedure more complicated, refrain writing code. is there way derive table based on new values directly triggered change in 4 tables? regards ramin

html - css button : button horizontal align and size stretch with text size -

Image
i'm trying make button left , middle (repeating) , right background: <div class="horizontal"> <div class="mybutton"> <div class="left" ></div> <div class="middle" > text </div> <div class="right" ></div> </div> </div> my css following: .horizontal { width: 100%; } .mybutton { width: 120px; height: 30px; } .left { background-image: url("http://i.stack.imgur.com/r5gpp.png"); /*border: 1px solid red;*/ float: left; height: 30px; width: 4px; } .middle { background-image: url("http://i.stack.imgur.com/yxpke.png"); /* border: 1px solid yellow;*/ float: left; height: 30px; padding-left: 5px; padding-right: 5px; text-align: center; width: 100px; } .right { background-image: url("http://i.stack.imgur.com/oaple.png"

ios - Using AFNetworking with authentication fails with correct credentials -

i'm trying download .sqlite file companies ftp site using afnetworking. each ftp user has own folder on server. found this question handle authentication, , this question handle download. believe have meshed 2 correctly i'm looking (or atleast i'm not getting far enough able test yet). i've attached code here anyway. afhttpclient subclass.h #import "afhttpclient.h" @interface afnetworkinghelper : afhttpclient - (void) setusername:(nsstring *)username andpassword:(nsstring *)password; + (afnetworkinghelper *)sharedmanager; @end afhttpclient subclass.m #import "afnetworkinghelper.h" @implementation afnetworkinghelper #pragma mark - methods - (void)setusername:(nsstring *)username andpassword:(nsstring *)password { [self clearauthorizationheader]; [self setauthorizationheaderwithusername:username password:password]; } #pragma mark - initialization - (id) initwithbaseurl:(nsurl *)url { self = [super initwithbaseurl:url

Jquery Mobile select box onchange redirect is not working -

i using latest version of jquery mobile (1.3.1) there language select box on page. need redirect page when new language selected used below code this <select onchange="window.location.href=this.value" data-native-menu='false' name="lang" id='lang'> <option value='home.php?&lang=en' >english</option> <option value='home.php?&lang=pr' >portuguese</option> <option value='home.php?&lang=it' >italian</option> </select> but page not redirected when new option selected. working in older version of jquery mobile (1.0.6) missing? please help use $.mobile.changepage() in case. $('select').on('change', function () { var lang = $(this).val(); $.mobile.changepage(lang); }); reference: http://api.jquerymobile.com/jquery.mobile.changepage/

c# - How to convert List of objects with JSON string to Excel -

there job history management class structured follows: public class jobhistory { public int subjobid { get; set; } public string data { get; set; } public int code { get; set; } public string message { get; set; } } data json string. can control logic have same schema of json in set of list. now wish convert list excel file extract json excel columns same level of code , message. how can design part? json string has 1 layer data. if has excel file format suggest using library npoi create file, can serialize object , produce excel files. other wise suggested use csv.

python - Using pyUSB to read data from ELM327 OBDII to USB device -

i having problems using pyusb library read data elm327 obdii usb device. know need write command device on write endpoint , read received data on read endpoint. doesn't seem want work me though. i wrote own class obdusb this: import usb.core class obdusb: def __init__(self,_vend,_prod): '''handle usb device''' self.idvendor = _vend self.idproduct = _prod self._dev = usb.core.find(idvendor=_vend, idproduct=_prod) return none def getdevice(self): '''must called after constructor''' return self._dev def setupendpoint(self): '''must called after constructor''' try: self._dev.set_configuration() except usb.core.usberror e: sys.exit("could not set configuration") self._endpointwrite = self._dev[0][(0,0)][1] self._endpointread = self._dev[0][(0,0)][0] #resetting device , setting vehicle protocol (auto) #20ms re

user interface - Printing of Java GUI -

i have created gui in java , have 1 button name print....on printing gui print takes long time print....please me of how reduce waiting time...thank you i using following code printing public void actionperformed(actionevent ae) { if (ae.getsource() == bprint) { printerjob job = printerjob.getprinterjob(); job.setprintable(this); boolean ok = job.printdialog(); system.out.println("here"); if (ok) { try { job.print(); } catch (printerexception ex) { system.out.println(ex); } } } } public int print(graphics g, pageformat pf, int page) throws printerexception { if (page > 0) { return no_such_page; } graphics2d g2d = (graphics2d)g; g2d.translate(pf.getimageablex(), pf.getimageabley()); p1.printall(g); return page_exists; } it takes long time print.

ios - Implement my own a custom GKTurnBasedMatchmakerViewController -

i'm sure there questions similar this, couldn't find example. i'm trying recreate apple gkturnbasedmatchmakerviewcontroller turn based game own custom interface turn based iphone game. i'm having trouble getting options display correctly hoping had working example. current code this: -(void)getcurrentgamesfromserver { [gkturnbasedmatch loadmatcheswithcompletionhandler:^(nsarray *matches, nserror *error) { if(matches){ (gkturnbasedmatch *mymatch in matches) { //this is, believe, need consider invitations. available instance methods provided gc are: acceptinvitewithcompletionhandler , declineinvitewithcompletionhandler if(mymatch.status == 1){ //ongoing game if([mymatch.currentparticipant.playerid isequaltostring:[gklocalplayer localplayer].playerid]){ //if it's turn //here need populate table adding our matches mcurrentgamesarray. after matches have been added, reload tableview

asp.net web api - How to transform OData filter to a LINQ expression? -

i'm trying extract filter expression odataqueryoptions can use in business logic class. public pageresult<poco> get(odataqueryoptions odataqueryoptions) { expression<func<poco, bool>> myexpression = ... // do here? var result = _mybusinesslogic.search(myexpression); return new pageresult<poco>(result, null, null); } i took @ blog describing translating query hql here , think (at least hope) that's overkill i'm trying do. i need filter expression in expression<func<poco, bool>> form. tried playing applyto() can't quite it. appreciated. we have filterbinder class suits needs internal unfortunately. nevertheless simple trick hold of $filter expression, public static class odataqueryoptionsextensions { public static expression toexpression<telement>(this filterqueryoption filter) { iqueryable queryable = enumerable.empty<telement>().asqueryable(); queryable = filter

javascript - Error while saving a lot of data to CouchDB -

i using couchapp couchdb store information connections between nodes. trying save array of json data. if number of items in array less 2000, works fine. unfortunately, bigger amounts of data cause errors: post http://localhost:5984/graph_project/ jquery.js:8240 send jquery.js:8240 jquery.extend.ajax jquery.js:7719 savedoc jquery.couch.js:627 writejsontodb main.js:185 csvarraytojson main.js:335 (anonymous function) uncaught typeerror: cannot read property 'error' of null jquery.couch.js:649 $.ajax.complete jquery.couch.js:649 fire jquery.js:1075 self.firewith jquery.js:1193 done jquery.js:7553 callback and part of data saved correctly. the code looks this: function writejsontodb(datatosave) { db = $.couch.db(database_name); for(var in datatosave){ db.savedoc(datatosave[i], { success: function(data) { console.log("node added succesfully"); }, error: function(data){ console.log("problem data