Posts

Showing posts from April, 2011

android - Add custom image to Dialog -

Image
what trying app read qr-codes (referred images) , after reading, showing dialog image related qr-code , description taken database. any advice on how that? what find on internet how create dialog custom layout. nothing more. i assume need t o display image in custom dialog define dialog.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> </relativelayout> in activity on button click display dialog button b= (button) findviewbyid(r.id.button1); b.setonclicklistener(new onclicklistener() { ...

wcf - What could be the consequences of declaring method as AsyncPattern on caller side, and OneWay on implementation side -

i have service implementing following contract: [operationcontract(isoneway = true)] void execute(ilist<someobject> someobjects); in order avoid stalling on caller side (which taking few seconds when latency high) want change contract async pattern: [operationcontract] void execute(ilist<someobject> someobjects); [operationcontract(asyncpattern = true)] iasyncresult beginexecute(ilist<someobject> someobjects, asynccallback asynccallback, object state); void endexecute(iasyncresult asyncresult); the problem : won't able upgrade implementation side, due production limitation. i ran , found behave expected, except end callback being called when channel closed. the question is: suffer performance issues, memory leaks, or other issues haven't thought of?

winforms - C# Windows Forms, Combobox MouseClick event getting fired multiple times -

i have windows form many controls. tiny part of logging in sql server , fetching list of database names , assigning collection combobox. private void initializecomponent() { //... //... this.servertb = new system.windows.forms.textbox(); this.usernametb = new system.windows.forms.textbox(); this.passwordtb = new system.windows.forms.textbox(); //... //... this.servertb.textchanged += new system.eventhandler(this.onsqlserverchanged); this.usernametb.textchanged += new system.eventhandler(this.onsqlserverchanged); this.passwordtb.textchanged += new system.eventhandler(this.onsqlserverchanged); this.databasecmbbox = new system.windows.forms.combobox(); //... //... this.databasecmbbox.mouseclick += new system.windows.forms.mouseeventhandler(this.databasecmbbox_click); //.... } private void databasecmbbox_click(object sender, mouseev...

tkinter - Python 3.3 invalid literal for int() with base 10 -

this first question here on stackoverflow. have been learning python time now, don't wrong code. everytime run program, error: traceback (most recent call last): file "d:\python\guess number gui.py", line 63, in <module> app = application(root) file "d:\python\guess number gui.py", line 14, in __init__ self.create_widgets() file "d:\python\guess number gui.py", line 37, in create_widgets command = self.check_number() file "d:\python\guess number gui.py", line 44, in check_number guess = int(self.guess.get()) valueerror: invalid literal int() base 10: '' this code: from tkinter import * import random class application(frame): """ gui application "guess number" game""" def __init__(self, master): """initialize frame. """ super(application, self).__init__(master) self.the_number = random.randint(1,100) self.grid...

postgresql - Is there a way to query for an integer value or NULL without using OR? -

i'd query (list of) values or null not use or. reasoning behind trying not use or is, need use index on field speed query. a simple example illustrate question: create table fruits ( name text, quantity integer ); (the real table has lots of additional integer columns.) the query i'm not happy is select * fruits quantity in (1,2,3,4) or quantity null; the query i'm hoping like select * fruits quantity magic (1,2,3,4,null); i'm using postgresql 9.1. as far can tell docs (e.g. http://www.postgresql.org/docs/9.1/static/functions-comparisons.html ) , tests there no way this. i'm hoping 1 of has magic insight. test table 100k rows: create table fruits (name text, quantity integer); insert fruits (name, quantity) select left(md5(i::text), 6), generate_series(1, 10000) s(i); with plain index on quantity: create index fruits_index on fruits(quantity); analyze fruits; the query or : explain analyze select * fruits quantity in (1,2...

css - Bootstrap Customization: Why should I use LESS? -

i'm considering integrating less in bootstrap editor ( bootply.com ) conform bootstrap customization best practices , , support mixins. however, i've yet determine specific advantages (performance , otherwise) of using less on simple css overrides. seems in end less compiled css. seems less introduce more maintainence/recompiling tasks new versions of bootstrap introduced. currently bootstrap customization bootply done adding custom 'theme.css' after 'bootstrap.css'. if want change .navbar color add few lines 'theme.css' like.. .navbar-custom .navbar-inner { background-color:#444444; } and markup looks like: <div class="navbar navbar-custom navbar-fixed-top">.. if not best practice customization, how less improve on it? less abstracts away css messes this: background: #45484d; /* old browsers */ background: -moz-linear-gradient(top, #45484d 0%, #000000 100%); /* ff3.6+ */ background: -webkit-gradient(linear,...

use jquery dialog to handle asp.net onclick -

my asp.net sqldatareader:(admin.aspx.cs) while(dr.read()){ l += "<a onclick='hello("; l += dr["cid"].tostring(); l += ");'>"; l += "</a>"; } javascript function:(admin.aspx) <script language="javascript" type="text/javascript"> function hello(id) { window.open("webform1.aspx?id=" + id, "", "height=50,width=100,scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no"); } </script> webform1.aspx <asp:button id="btn_ok" runat="server" onclick="btn_ok_click" text="ok" /> i want use jquery dialog in admin.aspx handle button onclick function of webform1.aspx instead of using the javascript window $(function () { $("#del-dialog").dialog({ autoopen: false, width: 300, height: 100, ...

apache - serve 404 page from a folder with static files when using Joomla -

i have joomla site running on apache , ubuntu 12.04. wanted show custom 404 pages shown when 404 error occure. have made necessary changes error.php file in template directory redirect '/404' directory have index.html file many images,css , java script. now when accessing non-existent page, joomla redirecting me root/404 there 403 forbidden error appache. 404 directory located inside 'htdocs' directory of joomla installation. additional info: 1. don't want convert 404 page joomla template or article. 2. using joomla ami bitnami on amazon web service if redirect 404 page, corrupt error mechanism. client never 404 status, 200 on successful redirect error page. instead, should modify template's error.php to send 404 not found header directly send error page using readfile() you might have adjust asset paths within error page.

javascript - jquery return false not Working in Function called from onclientclick button event -

in aspx page have declared jquery function , called in button's onclientclick function return false not occuring in it <asp:button id="btnremove" text="remove" runat="server" causesvalidation="true" cssclass="submitbutton" onclientclick="checkconfirm();" onclick="btnremove_click" /> function checkconfirm() { if ($("['txtservername']").val() != "") { var r = confirm("the selected server deleted database!!"); if (r == true) { return true; } else { return false; } } } i new jquery. please let me know why return false not stopping hte event proceeding. try this: <asp:button id="btnremove" text="remove" runat="server" causesvalidation="true" cssclass="submit...

php - Displayind data in a codeigniter view using a table -

hi having problem in sorting correct <td> display subject results students. have 11 subjects offered in school , senior students take 8 subjects because 4 electives @ level. when fetching results senior students , displaying when student not take subject still echoes result in wrong field.my code below not distinguish e.g if <td> physics or biology. i want echo (-) student not take subject.thanks in advance <table border='1'> <tr><th>position</th><th>students</th><th>english</th><th>kiswahili</th><th>maths</th><th>biology</th><th>physics</th><th>chemistry</th><th>history</th><th>geography</th><th>cre</th><th>agriculture</th><th>business</th><th>total marks</th><th>mean grade</th><th>aggregate points</th><th>action</th> </tr>...

javascript - How to use website search bar function in code -

while user can type in search term in onsite search bar directly, how can same thing in code, when there no known api? want know whether macy's carry "baby shoes", how in code? suggestions great! it sounds want like: http://docs.seleniumhq.org/ it lets automate browser behavior, entering text search bar , clicking search. if service interested in has no api, way go, might considered rude (or against site's terms of use), , wouldn't surprised if script gets blocked search provider. if expect running searches in kind of appreciable volume, should contact search provider , talk them use case. maybe can provide api. since question tagged javascript, might http://thechangelog.com/soda-selenium-node-js-adapter/ , node adapter selenium.

mysql - Why SQL error "unknown column" in JOIN query? -

i'm querying 3 tables using join , need use twice same table. i'm getting "unknown column" error message. have tried various ways using aliases can't resolve problem. ideas? select distinct jos_easypaypalbuttons_ipn.atendente , jos_easypaypalbuttons_ipn.btn_name , pagseguro.atendente , pagseguro.produto jos_easypaypalbuttons_ipn, pagseguro inner join produtos pp on jos_easypaypalbuttons_ipn.btn_name = pp.cod_produto inner join produtos ps on pagseguro.produto = ps.cod_produto jos_easypaypalbuttons_ipn.payer_email = '$email' or pagseguro.email = '$email' , pp.modo_consulta = 'imediata' or ps.modo_consulta = 'imediata' messsage: unknown column 'jos_easypaypalbuttons_ipn.btn_name' in 'on clause' structure of tables: create table produtos ( id int auto_increment primary key, produto varchar(20), modo_consulta varchar(30) ); create table jos_easypa...

php - Else If block and curly brackets -

knowing in php ignore curly brackets in conditional blocks 1 function / line after "if", "else if" or "else" tag, : if (myval == "1") dothis(); else if (myval == "2") dothat(); else donothing(); i asking myself if : if (myval == "1") dothis(); else if (myval2 == true) dothat(); else donothing(); was seen php either : if (myval == "1") { dothis(); } else { if (myval2 == true) { dothat(); } else { donothing(); } } or : if (myval == "1") { dothis(); } else if(myval2 == true) { dothat(); } else { donothing(); } short version : "line break" after 1 else enough separate 1 "if" statement or seen 1 "else if" editing own question confirmation guess : if(false) echo "1"; else if (false) echo "2"; else echo "3"; is displaying "3" while following throwing error becaus...

java - Set off a scheduled event at a given time? -

i'm writing java-based shell-type... erm.. thing . anyway, 1 of commands implementing schedule command, can tell time want run command , waits time, runs command once, , exits. however, can't figure out how check time - implemented 1 checks if dates equal, did little research see if better solution existed, found apparently date not thing use. should do? mcve: import java.util.date; public class scheduler extends thread { private date goat; private string command; public scheduler(date goat, string command) { this.goat = goat; this.command = command; } public void start() { super.start(); } public void run() { while (!goat.equals(new date())) {} //wait until dates equal runcommand(command); //in real thing, runs command. } public void runcommand(string command) { system.out.println("command: " + command); } public static void main(string[] args) { scheduler t...

Python Django "ImportError: No module named hashcompat" -

i'm learning python + django reading 《beginning django e-commerce》, after have installed django-db-log, when running $python manage.py runserver, there problem. unhandled exception in thread started <function wrapper @ 0x02c28db0> traceback (most recent call last): file "d:\python27\lib\site-packages\django\utils\autoreload.py", line 93, in wrapper fn(*args, **kwargs) file "d:\python27\lib\site-packages\django\core\management\commands\runserver.py", line 92, in inner_run self.validate(display_num_errors=true) file "d:\python27\lib\site-packages\django\core\management\base.py", line 308, in validate num_errors = get_validation_errors(s, app) file "d:\python27\lib\site-packages\django\core\management\validation.py", line 34, in get_validation_errors (app_name, error) in get_app_errors().items(): file "d:\python27\lib\site-packages\django\db\models\loading.py", line 166, in get_app_errors self._populate() f...

Excel Pivot Chart Help - Pulling names that contributed to count (VBA?) -

i looking develop pivotchart of meaningful data related employees. lets it's graph of employees infractions month. we have graph graphs based on count of employees got infraction month. looking make easy management see graph , see names contributed large count month. however, upon selecting pivot chart cell (lets march had lot of infractions on chart , want know part of it). upon double clicking cell, brings "show detail" window, select cell name since want know names - doesn't because puts names part of legend , screws chart. what ways display names contributed count month? thinking along these lines: -upon mousing on data point of pivot chart, tooltip list of names -upon clicking on it, displays table @ bottom shows data table contributed month (including names). anything along lines. appreciated, have experience vba - sadly not in excel yet.e the best solution check pivottable associated pivotchart. when show detail on chart change mirrored ...

c# - WriteConcern.Acknowledged vs new WriteConcern { Journal = true, W = 1 } -

i'm bit confiused writeconcern settings in mongodb c# driver. does writeconcern.acknowledged means journal= true , fsynced =true? if want sure writes primary, writeconcern.acknowledged enough? i no c# programmer semantics alone - no, not. journal , fysncing write different acknowledging existance in mongod , both set @ same time pointless since waiting write disk twice :/ . you better go journal; if need journaled writes is. again journaled writes different acknowledged writes, journaled gives sense of persistance on disk before response returned, however, acknowledged write merely requires received in order return, not written disk. so no, writeconcern.acknowledged not same old setting of journal= true , fsynced =true enough , going overkill settings. edit i noticed title has setting w = 1 in it. not fsync instead acknowledged . need same writes did before add journal option write concern along writeconcern.acknowledged , should give same write conce...

Transforming numbers in R -

i have specific need "transform" number in r. example, a "floor" operation behave as: 138 -> 100 1233 -> 1000 a "ceiling" operation behave as: 138 -> 200 1233 -> 2000 is there easy way accomplish in r? you extract exponent separatly: floorex <- function(x) { ex <- 10^trunc(log10(x)) return(trunc(x/ex)*ex) } ceilingex <- function(x) { ex <- 10^trunc(log10(x)) return(ceiling(x/ex)*ex) } examples: floorex(123) # [1] 100 ceilingex(123) # [1] 200 ceilingex(c(123, 1234, 12345)) # [1] 200 2000 20000 edit : using trunc instead of floor , integrate old ex function ( ex <- function(x)floor(log10(x)) ) speedup calculation little bit add benchmark compare against @eddi's floorr benchmark: ## provided @eddi floorr <- function(x) {r <- signif(x, 1); r - (r > x) * 10^trunc(log10(x))} library("microbenchmark") x <- 123; microbenchmark(floorex(x), floorr(x), si...

sql server - How to formulate a TSQL CTE expression for total counts? -

i have table raw data want return distinct people_id counts from. how can in cte if counts have different groupings? here have far: ;with cte (select program_modifier_id, program_modifier, people_id, group_profile_id, current_status, license_number, is_managing_office, program_info, program_name, program_code, group_profile_type_id #enrollments en (nolock) ) select 'tn - level 4', case when (program_modifier_id = 'e1aa7a36-0500-4bae-a0aa-d9e0bc91a6f3' ) count(distinct people_id) end 'total ct' cte group program_modifier_id union select 'tn - level 3 ce - rtc', case when (program_modifier_id = '213d080f-e340-44b6-ac8c-4233d1193602' , license_number '%-rtc-%') count(distinct people_id) end 'total ct' cte group program_modifier_id, license_number the output is: tn - level 3 ce - rtc 49 tn - level 3 ce - rtc 38 tn - le...

java - Regular expression to get characters before brackets or comma -

i'm pulling hair out bit this. say have string 7f8hd::;;8843fdj fls "": ] fjisla;vofje]]} fd)fds,f,f i want extract 7f8hd::;;8843fdj fls "": string based on premise string ends either } or ] or , or ) characters present need first one. i have tried without success create regular expression matcher , pattern class can't seem right. the best come below reg exp doesn't seem work think should. string line = "7f8hd::;;8843fdj fls "": ] fjisla;vofje]]} fd)fds,f,f"; matcher m = pattern.compile("(.*?)\\}|(.*?)\\]|(.*?)\\)|(.*?),").matcher(line); while (matcher.find()) { system.out.println(matcher.group()); } i'm not understanding reg exp correctly. great. ^[^\]}),]* matches start of string until (but excluding) first ] , } , ) or , . in java: pattern regex = pattern.compile("^[^\\]}),]*"); matcher regexmatcher = regex.matcher(line); if (regexmatcher.find()) { system.out.prin...

Django: Insert choice is neglected in form init -

in model, have charfield few choices: surface_choices = ( ('as', _('asphalt')), ('co', _('concrete')), ('ot', _('other')), ) surface = models.charfield(choices = roof_surface_choices, max_length = 2, blank = true, null = true,) i avoid ------- choice in dropdown boxes in form, , replace more descriptive text. i used following line in __init__ method of forms.py def __init__(self, auto_id='%s', *args, **kwargs): super(surfaceupdateform, self).__init__(*args, **kwargs) self.fields['surface'].choices.insert(0,('', _('please choose surface'))) however, in current app, first line remains ------- , not replaced stated text above. there better way set blank values? the ------- appears because field has blank=true , is, optional. django mechanics kinda hard understand, can override choices: def __init__(self, auto_id='%s', *args, **kwa...

c# - How do I determine if one value is almost like another value (e.g. street abbreviations)? -

i have question elements in datarow. have array of datarow elments so: datarow[] rows = dt.rows.cast<datarow>().toarray(); i using loop loop through elements so: ( int = 0; < rows.count(); i++) { if (rows[i].itemarray.elementat(0).tostring().equals("order")) { ...do stuff... } } in "do stuff" section need check address see if same previous order person. address can change, same, or similiar. by similiar mean this: 11555 old oregon tr 11555 old oregon trail 11555 old oregon trl. all 3 same address, variations. now, question. there way run operation on element of datarow array? want check if address other previous order. i've been looking around little , haven't found proof can wanted ask question see if knew of solution, or workaround per say. i may dinged because doesn't technically answer question directly, consider sqlfiddle . leverages so...

Reading an Image file from a mysql database using php -

i trying display image, webpage displays encoding stuff instead. below code: <?php ob_start();?> // html markups goes here <?php include 'login.php'; if(isset($_get['productid'])){ $productid = $_get['productid']; $sql = "select tyre_image tyres product_id = '$productid'"; $result = mysql_query($sql) or die(mysql_error()); header("content-type :image/jpg"); echo mysql_result($result,0); } ob_end_flush(); ?> i using $_get associative array($_get['variable']) product id via link on page. how fix this? i had no idea content-type header picky, change spacing around colon (and image/jpg should image/jpeg ): header("content-type: image/jpeg"); per answer below, agree - fix assumes script used displaying image in html, ala <img src="path/to/your/image.php?productid=123" /> . further light reading on image/jpeg mime type spec here .

Actual and estimated execution plan in SQL Server 2008 -

Image
i testing query processing in sql server 2008. query select * student; i checked estimated query plan , actual query plan. both same. below tool-tip got select node of actual execution plan. shows estimated values. how find actual values.

Calling inline function in .cu file from C++ class -

i'm trying call kernel wrapper foo c++ class. i've tried suggested here below: // in cpp.h: class cls { extern "c" inline void foo(); } // in kernels.cu: #include "cpp.h" extern "c" inline void cls::foo() { // call kernels here } but has not worked - compiler errors: cpp.h: invalid storage class class member cpp.h: "cls::foo" referenced not defined kernels.cu: label "cls" declared never referenced what's going wrong? you shouldn't mark class method extern "c" . make wrapper non-member function extern "c" specifier, , let function call class's method (you need specify instance also).

reporting services - SSRS 2008 R2 - Export as PDF - Save/Cancel, No Open Dialog -

hopefully pretty simple! i've googled around apparently i'm person in existence issue. when go export report pdf, dialog box opens has options save , cancel. want either: an open option on window report opens in whatever pdf viewer the report open automatically after user saves whatever filename want. note don't want save automatically, provide them option open after they've saved it. this based on users browser, , has little or nothing ssrs.

c# - Custom Command Windows Services on HIGH Priority -

i have work tracker wpf application deployed in windows server 2008 , tracker application communicating (tracker)windows service via wcf service. user can create work entry/edit/add/delete/cancel work entry worker tracker gui application. internally send request windows service. windows service work request , process in multithreading. each workrequest entry create n number of work files (based on work priority) in output folder location. so each work request take complete work addition process. now question if cancel creating work entry. want to stop current windows service work in runtime. current thread creating output files work should stopped. thread should killed. thread resources should removed once user requested cancel. my workaround: i use windows service on custom command method send custom values windows service on runtime. achieving here is processing current work or current thread (ie creating output files work item recieved).and coming custom command cancel...

linux - printk() doesn't print in /var/log/messages -

my os ubuntu 12.04. wrote kernel module , use insmod , rmmod command there isn't in /var/log messages. how can fix problem? /* * hello-1.c - simplest kernel module. */ #include <linux/module.h> /* needed modules */ #include <linux/kernel.h> /* needed kern_info */ int init_module(void) { printk(kern_info "hello world 1.\n"); /* * non 0 return means init_module failed; module can't loaded. */ return 0; } void cleanup_module(void) { printk(kern_info "goodbye world 1.\n"); } check whether syslog daemon process running, since process copies printk messages kernel ring/log message buffer /var/log/messages if correct. printk messages can seen using dmesg utility/command or messages in /var/log/messages. if correct loglevel set printk messages displayed on console right away, no need use dmesg or no need check in /var/log/messages. printk debug messages can part of /var/log/syslog .

jquery - Display dynamically generated text LTR or RTL depending on language? -

i have tricky scenario i'm dealing while working on site client. website building has english version , arabic version. arabic version of site, of course, displayed right-to-left, since arabic read right-to-left. i have built jquery twitter app index page of both english , arabic versions. requirement client wants able use 1 twitter account , tweet in both english , arabic. creates problem because in twitter ul , need simultaneously display english , arabic text, without knowing language expect. therefore need way detect language of tweets (retrieved jsonp) , adjust text direction of each li . can think of way this? suggestions. the twitter api ( https://dev.twitter.com/docs/api/1.1/get/search/tweets ) shows metadata contains "iso_language_code": "metadata": { "iso_language_code": "en", "result_type": "recent" }, with this, can check "iso_language_code" "en" or "ar...

sql server - Linking on 0 or more missing data fields -

i have huge master table (1tb of data), , on 20 columns. have source data comming in 0 or more missing data fields. have fill in missing data matching available fields in master table. please consider following example: incoming data: create table #t1 ( f3 varchar(50), f1 int, f2 int ) insert #t1 select 'row1',1, null union select 'row2', 1, 2 master table: create table #t2 ( f1 int, f2 int, f3 int, f4 varchar(255) ) insert #t2 select 1, 2, 3, 'a' union select 1, 2, 4, 'b' union select 1, 3, 3, 'c' union select 1, 3, 4, 'd' union select 2, 3, 4, 'e' i want output link row1 rows a,b,c , d , row2 rows , b. can achieve by: select a.f3, b.* #t2 b cross join #t1 patindex(isnull(convert(char(1), a.f1), '_') + isnull(convert(char(1), a.f2), '_') , convert(char(1), b.f1) + convert(char(1), b.f2)) != 0 drop table #t1 drop table #t2 th...

command line interface - PHP CLI - Ask for User Input or Perform Action after a Period of Time -

i trying create php script, ask user select option: like: echo "type number of choice below:"; echo " 1. perform action 1"; echo " 2. perform action 2"; echo " 3. perform action 3 (default)"; $menuchoice = read_stdin(); if ( $menuchoice == 1) { echo "you picked 1"; } elseif ( $menuchoice == 2) { echo "you picked 2"; } elseif ( $menuchoice == 3) { echo "you picked 3"; } this works nicely 1 can perform actions based on user input. but expand if user does not type within 5 seconds, default action run automatically without further action user. is @ possible php...? unfortunately beginner on subject. any guidance appreciated. thanks, hernando you can use stream_select() that. here comes example. echo "input ... (5 sec)\n"; // file descriptor stdin $fd = fopen('php://stdin', 'r'); // prepare arguments stream_select() $read = array($fd...

ibm mobilefirst - IBM WorkLight :Failed connect with offline data store -

i create application, have use json store offline data storage. so, please let me know how work json store. read ibm information center jsonstore documentation . read @ least following ibm worklight getting started modules : jsonstore – client-side json-based database overview jsonstore – api basics jsonstore – synchronizing client , server databases (if using worklight adapters) jsonstore – encrypting sensitive data (if using data encryption) adapter framework overview (if using worklight adapters) http adapter – communicating http back-end systems (if using http data) sql adapter – communicating sql database (if using sql data) jms adapter – communicating jms (if using jms data) invoking adapter procedures client applications (if using worklight adapters) advanced adapter usage , mashup (if using worklight adapters) using java in adapters (if using java inside adapters) read answer on debugging worklight/jsonstore ask specific questions. provide @ least...

java - Writing attributes on a text file -

i'm using java servlets class redirect inputs in new table , in same time writing them in text file. i've got stuck in writing them on text file. i've got parameters main page using this: string nume = request.getparameter("nume"); string prenume = request.getparameter("prenume"); string varsta = request.getparameter("data_nasterii"); string pozitie = request.getparameter("pozitie"); string echipa = request.getparameter("selectechipa"); and every "pozitie" means "player's position" i've got different parameters: string portar =request.getparameter("putere") + request.getparameter("respingere") + request.getparameter("sut") + request.getparameter("agilitate") + request.getparameter("forta")+request.getparameter("reactie") + request.getparameter("anticipare"); string fundas = request.getparameter("put...

jquery - How do I trigger something only when batch of getJSON instructions completes? -

here's of code: for (var = 0; < recordlist.length; i++) { var recordid = recordlist[i]; populatedatarow(i, recordid, columns) }; console.log("done"); here populatedatarow function uses $.getjson problem (in google chrome @ least), console.log statement triggered long before populatedatarow cycles completed yes, console.log happens first because getjson asynchronous . code starts it, finishes later, after subsequent code runs. to handle that, you'll need use "completion" callback on getjson . code above remember how many calls it's started, , wait many completions before continuing. you can have populatedatarow function return return value of getjson , save objects, , use jquery.when notification when they've finished. here's example: live copy | live source var deferreds = [], index; (index = 0; index < 4; ++index) { deferreds.push($.getjson("http://jsbin.com/agidot/1", function() { ...

Java char comparison does not seem to work -

i know can compare chars in java normal operators, example anysinglechar == y . however, have problem particular code: do{ system.out.print("would again? y/n\n"); looper = inputter.getchar(); system.out.print(looper); if(looper != 'y' || looper != 'y' || looper != 'n' || looper != 'n') system.out.print("no valid input. please try again.\n"); }while(looper != 'y' || looper != 'y' || looper != 'n' || looper != 'n'); the problem should not other method, inputter.getchar(), i'll dump anyway: private static bufferedreader read = new bufferedreader(new inputstreamreader(system.in)); public static char getchar() throws ioexception{ int buf= read.read(); char chr = (char) buf; while(!character.isletter(chr)){ buf= read.read(); chr = (char) buf; } return chr; } the output i'm getting follows: would again? y/n n nno valid input. pl...

c# fastest way to get a subset of integer list -

i 5 list , need subset of all. i) 200.000 integer values ii) 30.000 integer values iii) 10.000 integer values iv) 200 integer values in math terms n b n c n d. need 1.000 concurrent users. what fastest way c# ? how many concurrent operations can 1 2 mhz cpu ? 2 billion cycle speed the fastest way of dealing finding intersection of multiple sets language-agnostic: create hashset<int> , initialize data shortest list, , sequentially call intersectwith on remaining lists. need start shortest list, because complexity of operation o(n+m) , n number of items in hashset<int> , , m number of items in other list. since intersectwith called 4 times, , complexity of setting initial hashset<int> o(n) , overall complexity be o( n + n+m1 + n+m2 + n+m3 + n+m4) // ^ ^ ^ ^ ^ // | | | | | // | intersecting lists 2..5 // | // setting initial hashset<int> since total o(5*n+m1+m2+m3+m4) , best approa...

html - Twitter Bootstrap Nav-pills with "notification" not placing as desired -

i trying put "notification" icons in top corner of nav pills, cannot seem them place correctly. when place span in li element makes element larger, , not want behavior. if try put between li elements adds blank space. the nav pills have styling in addition html , css markup put in jsbin. in end able place "notification" span in corner(adjustable) html <ul id="contentfirstmenu" class="nav nav-pills"> <li><a href="#viewfulltext">something</a></li> <span class="notification">5</span> <li><a href="#inthelibrary">something</a><span class="notification">20</span></li> <li><a href="#requestacopy">another</a></li> <li><a href="#requestacopy">another</a></li> </ul> notification css .notification { color: #222; positio...

How to set the default column for the search box in jqGrid? -

i have specified columns searchable through colmodel , can't find way specify default column when search box opened. any appreciated. there option columns not documented in the list of searching options . wrote the answer , the demo demonstrate how can implement requirement. updated : if use multiplesearch: true option can follow referenced answer , specify columns option described. corresponding demo find here . if don't multiplesearch: true option don't display searching rule per default can add default rule in filters property of postdata . example the next demo identical previous 1 uses additionally postdata: { filters: {groupop: "and", rules: [{field: "amount", op: "eq", data: ""}]} } option. if don't want use multiplesearch: true option 1 have fix small bug in jqgrid able use columns option. 1 have modify the lines (see line 7009 in jquery.jqgrid.src.js ) from } else { columns = p....

ios - UIDatePicker Event Changed -

i write simple ios app learning, in case need use uidatepicker and, after user change date, need write date uitextfield , here's code: .h file @interface expenseviewcontroller: uiviewcontroller<uitextfielddelegate> @property (strong,nonatomic) iboutlet uitextfield *edittextdate; - (void) updatetextfielddate:(uidatepicker *)pickerl; @end .m @implementation expenseviewcontroller @synthesize editextdate; - (void) viewdidload { [super viewdidload] uidatepicker *datepicker; datepicker = [[uidatepicker alloc]init]; [datepicker setdate:[nsdate date]]; [datepicker setdatepickermode:uidatepickermodedate]; [datepicker removetarget:self action:nil forcontrolevents:uicontroleventvaluechanged]; [datepicker addtarget:self action:@selector(updatetextfielddate:) forcontrolevents:uicontroleventvaluechanged]; [edittextdate setinputview:datepicker]; } - (void) updatetextfielddate:(uidatepicker *)pickerl{ uidatepicker *picker=(uidatepic...

php - Join Multiple Rows in Multiple Columns -

i've got multiple rows in result query: for example, table "extras": id_extras - id_order - id_size - name_extra - price 1 1 3 teddy 4 2 2 8 balloon 8 3 2 9 wine 2 4 2 1 choco 9 5 6 1 bag 4 what want is: id_extras - id_order - id_size - name_extra - price - name_extra1 - name_extra2 - price1 - price2 1 1 3 teddy 4 2 2 8 balloon 8 wine choco 2 9 3 6 1 bag 4 so need name_extra , price in columns instead of rows, have now. select * , max(case when id_order = id_order name_extra else null end) name_extra1, max(case when id_order = id_order name_extra else null end) name_extra2, max(case when id_order = id_order price e...

html - Feature Detect proper handling of Content-Disposition: attachment? -

there known issue ios safari ignore content-disposition: attachment headers. big problem when trying trigger downloads single page application (i'm using iframe hack open suggestions if has others). i can test ios directly: var iosmobile = (function(useragent){ return !!(useragent.match(/ipad/i) || useragent.match(/iphone/i) ); })(window.navigator.useragent); but i'd rather not browser-sniff. know how can feature detect whether content-disposition handled properly??

java - Thread delays during termination -

//main.java public static boolean isend() { return end; } public static void main(string[] args) { execproductnumber.execute(new productnumber(allbuffer)); end = true; system.out.println("leaving main"); //execproductnumber.shutdown(); } //productnumber.java public void run() { while(!main.isend()) { //something } system.out.println("leaving thread"); } i starting program, gets output: leaving main leaving thread and program not terminate (i need wait 1,5 min successful end of program). when tried stop thread shutdown() (comment) stopped right after. while trying debug found delays on that(threadpoolexecutor.java): final void runworker(worker w) { thread wt = thread.currentthread(); runnable task = w.firsttask; w.firsttask = null; w.unlock(); // allow interrupts boolean completedabruptly = true; try { while (task != null || (task = gettask()) != null) {...

protocol buffers - Differences between various protobuf implementations -

what trade-offs, advantages , disadvantages of each of these implementations ? different @ ? want achieve store vector of box'es, protobuf. impl 1 : package foo; message boxes { message box { required int32 w = 1; required int32 h = 2; } repeated box boxes = 1; } impl 2: package foo; message box { required int32 w = 1; required int32 h = 2; } message boxes { repeated box boxes = 1; } impl 3 : stream multiple of these messages same file. package foo; message box { required int32 w = 1; required int32 h = 2; } 1 & 2 change / how types declared. work identical. 3 more interesting: can't just stream box after box after box , because root object in protobuf not terminated (to allow concat === merge). if only write box es, when deserialize have 1 box last w , h written. need add length-prefix; arbitrarily, but: if happen choose "varint"-encode length, you're close repeated gives - except repeated i...

defining different cases for function im matlab (symfun) -

i want create function (symfun), , want divide cases, i.e if t> then answer , if t<0 answer b. thing is, matlab wont allow me put if statements after sym function. >> l = symfun(0, [m]); >> l(m) = if m>0 3 also tried create function: function [x1] = xt_otot_q3(t) and tried connect between 2 functions: >> l(m) = xt_otot_q3(m) conversion logical sym not possible. is there way break symfun cases? not sure understand want. code 'combines' functions symfun , xt+otot_q3 defined below: function test; m=randn(4); % n(0,1) random numbers l=xtotot_q3(symfun(0,m)) % combine xt_otot_q3 , symfun l=symfun(0,xtotot_q3(m)) % combine symfun , xt_otot_q3 return function lval=symfun(thr,rval); lval=ones(size(rval)); % output, size of input, = 1 lval(rval<thr)=-1; % output = -1 if input < thr return function lval=xtotot_q3(rval); lval=3*rval+1; % function, in case 3 * input + 1 re...

typescript - Reference .ts file for type check only -

i'd reference .ts file in .ts file. in real project, need type safety (overriding inherited member correct compilation). my sample: test1.ts: export class test1 { } test2.ts: /// <reference path="test1.ts" /> export class test2 { abc: test1; // error: test1 not found } is not possible? i'd avoid importing overhead don't need in outputted javascript file. update: use test1 amd module class test1 instanciated , injected instance of class test2 underlying framework. why need export keyword don't want directly import module type1 - need reference class avoid compiler errors , have type safety etc.. without using module loader the export keyword @ root level of file relevant if using module pattern (amd / commonjs). if not following work: test1.ts: class test1 { // not use export } test2.ts: /// <reference path="test1.ts" /> class test2 { abc: test1; // no error } however if responsible ensur...

Can i mix normal OpenGL ES 2.0 with Kobol2D / cocos2d on iOS? -

i making 2d game ios using kobold2d/cocos2d. i've decided try , add 3d buildings (think gta1/2 2d except buildings). i know how opengl works im getting sorts of errors when try implement this. my questions is: cocos2d prevent me using normal opengl calls ?,or should work fine if done correctly? every tutorial/example i've found uses cocos2d wrapper mixing opengl , cocos.. if have done before (mix own opengl es 2.0 code cocos2d) point me in right direction? as long you're using cocos2d/kobold2d v2.x can use opengl es 2.0. can override/implement ccnode class' -(void) draw method , hack away. there's 1 caveat: should prefer use cocos2d provided "ccstuffstuff" methods (for example ccdrawcolor) instead of opengl es methods because wrap behind scenes stuff performance reasons , compatibility. check existing cocos2d drawing code examples. 1 such example gles-render.cpp cocos2d+box2d projects, or ccdrawingprimitives.m file.

sql - Can't find trigger even though it exists? -

so given database , im trying solve trigger bug (it's pretty small change) i've looked @ every function/trigger did a: select * sys.triggers name = 'name' and returned this: name 1181247263 1 object_or_column 2053582354 tr sql_trigger 2012-11-13 09:41:13.707 2013-03-19 14:08:22.583 0 0 0 0 what mean? there literally folder/function called object_or_column because can't see it? im doing in sql server management studio btw. this tell associated table... select t.name triggername, ss.name schemaname, so2.name tablename sys.triggers t join sysobjects on t.object_id = so.id join sysobjects so2 on so.parent_obj = so2.id join sys.schemas ss on so2.uid = ss.schema_id t.name = 'name'