Posts

Showing posts from March, 2013

excel - How to specify all columns as "Text" in Text to Columns function in Data tab? -

Image
i have data in column needs split multiple columns using text columns in data tab. however, there variable amount of columns created each row, variable 1 - 1000. in text columns wizard step 3, defaults 'general' format columns. data involves big numbers, , not want them trailed (rounded), need set format text. this problem manually because have go through every column , click text, , wizard doesn't show columns unless scroll. ideas? although not want (and see don't idea of scrolling), when presented data preview showing each column general. you can select first column header , holding shift key scroll right , select of columns @ once. then select text data format. not best, better selecting each individually.

sql - Query not working1 -

hey trying select data 3 different tables based on data found. it's not working. trying display selected in grid-view. ideas? select bossid, status, couponnumber, fk_prizeid, fk_winnerid bountyprizes union select prizename prizes prizeid=fk_prizeid union select firstname, lastname, dob players playerid=fk_winnerid error: msg 207, level 16, state 1, line 6 invalid column name 'fk_prizeid'. msg 207, level 16, state 1, line 8 invalid column name 'fk_winnerid'. joins want take more other tables. unions want take 2 congruent tables , show combined result here code need: select bossid, status, couponnumber, fk_prizeid, fk_winnerid bountyprizes join prizes on prizeid=fk_prizeid join players on playerid=fk_winnerid

forms - php exec change password in file -

i'm trying make simple input form change password in config file. believe pretty close after trying hour exec line below correct believe need help. # password in conf file # $password = '12345'; <?php if(isset($_request['new_pass'])){ exec('sed -i '.escapeshellarg('s/\$password=.*/\$password=\'".$_request['new_pass'].'\'/g')." include/conf.php"); echo 'password changed'; } ?> <form method="get" action="<?php echo $_server['php_self']; ?>"> <input type="text" name="new_pass" maxlength="59"> <input type="submit" name="submit" value="submit" /> </form> i'm ' quotations tripping me up. when in doubt, @ syntax highlighting. exec('sed -i ' . escapeshellarg('s/\$password=.*/\$password=\''.$_request['new_pass'].'\

sql - INNER JOIN Where Clause -

this question has answer here: sql join: clause vs. on clause 13 answers is there difference between doing like select * table1 inner join table2 on table2.objectid = table1.table2objectid table2.value = 'foo' vs select * table1 inner join table2 on table2.objectid = table1.table2objectid , table2.value = 'foo' not inner join. outer join placement make difference.

sql - Joining tables back to themselves in MySql -

let's have 3 tables: user table: create table `user` ( `id` int(11) unsigned not null auto_increment, `name` varchar(50) default null, `loc` int(11) default null, `doc` int(11) default null, primary key (`id`) ) engine=myisam auto_increment=3 default charset=latin1; location table: create table `location` ( `id` int(11) unsigned not null auto_increment, `name` varchar(50) default null, primary key (`id`) ) engine=myisam auto_increment=4 default charset=latin1; and document table: create table `document` ( `id` int(11) unsigned not null auto_increment, `maintainer` int(11) default null, primary key (`id`) ) engine=myisam auto_increment=2 default charset=latin1; i can pull user info , it's corresponding location , document info following query: select * `user` left join `location` on user.loc = location.id left join `document` on user.doc = document.id; the location info referenced information doesn't refer other rows in other

css - Footer is not being shown properly on different device heights -

Image
i having problem footer. have page content , on devices (like mobile - in zoomed out view) page content not fill parent device height while on devices, does. footer creating problem these different heights. when content doesn't fill parent device height, footer shown correctly @ bottom of page when content fills parent device height , overflows, footer show on content. may not clear english, these screen snaps make clear. footer content not filling parent height(showing correctly) footer overflown content (footer not shown correctly) picture quality not clear still can seen. this css code, have been using till now. #footer{ display:block; margin-right:auto; margin-left:auto; position:absolute; bottom:0; height:100px; width: 60%; text-align:center; color:green; font-size:18px; font-family:times; } can fixed? want show footer @ end of page, when content overflown. appreciated. on #main element right

c# - How to add a separator to a WPF combobox that is databound? -

is there way can add seprator wpf combobox databound? ie in xaml, combobox's itemssource="{binding thelist}". list observable collection of objects, 1 of want separated rest. list generated sql, not hard-coded or anything. wouldn't want seaprator selectable, either. thanks! check this solution. uses style change template of comboboxitem objects

rss reader - Parse custom rss tags using Rome API -

i trying use rome parsing rss feeds. 1 of rss feeds says specifies 0.91 version , no custom xml namespace defined entries still have custom element in them. can use rome parse such custom tags without defined namespace? thanks. yes. need write custom parser it. let's want handle elements customstring , customdate . start extending item class store custom elements. package com.example; import com.sun.syndication.feed.rss.item; import java.util.date; public class customitem extends item { private string _customstring; private date _customdate; public string getcustomstring() { return _customstring; } public void setcustomstring(string customstring) { _customstring = customstring; } public date getcustomdate() { return _customdate; } public void setcustomdate(date customdate) { _customdate = customdate; } } then write parser. need handle standard elements want parse. package com.exa

java - Type The nested type CubeRanks cannot hide an enclosing type -

this question has answer here: nested type cannot hide enclosing type 5 answers i have problem java plugin. never had before. normal went good. here code: package me.brian.cuberanks; import me.brian.cuberanks.cuberanks; import org.bukkit.plugin.java.javaplugin; import java.util.arraylist; import java.util.logging.logger; import org.bukkit.chatcolor; import org.bukkit.command.command; import org.bukkit.command.commandsender; import org.bukkit.entity.player; import org.bukkit.plugin.pluginmanager; public class cuberanks { public class cuberanks extends javaplugin { public static cuberanks plugin; public final logger log = logger.getlogger("minecraft"); public boolean enabled = false; public final playerlistener pl = new playerlistener(this); public final arraylist<player> orehunterusers = new arraylis

java - JsonIgnore not working -

this question has answer here: jackson: how prevent field serialization 6 answers i trying make these properties don't serialized, reason no matter still getting serialized , sent down client. have tried using @jsonignoreproperties({"dobefore","doafter","doaftercomplete"}) , have tried using @jsonignore on getters, , have tried both , doesn't seem make difference. here's class looks like: @jsonignoreproperties({"dobefore","doafter","doaftercomplete"}) public class action { //for reordering actions default actions private string dobefore; private string doafter; private string doaftercomplete; private string eventid; private list<actionargument> arguments; //action perform when action done private list<action> oncompleteactions; public action()

eclipse - Is it possible for multiple users to edit the same Javadoc through egit? -

i working on project team. want have inlined documentation our project can edited multiple users. can done through github -- make java doc comments, commit github person can check out version of code along javadoc generated ? if there way this, please let me know. thanks since git not care type of file check in - have no doubt doable. nothing needs changed in workflow also.

Python List of Strings created from a list of one string -

say have list ['dogs, cats'] . how can 1 turn ['dogs', 'cats'] arbitrary number of ['x, y, z'] just split first element on ', ' : >>> ['dogs, cats'][0].split(', ') ['dogs', 'cats'] >>> >>> ['x, y, z'][0].split(', ') ['x', 'y', 'z'] if can have multiple comma separated string in list, can use list comprehension: >>> li = ['x, y, z', 'dogs, cats'] >>> >>> li2 = [elem.split(', ') elem in li] >>> [v val in li2 v in val] ['x', 'y', 'z', 'dogs', 'cats'] or using sum() on list comprehension: >>> li = ['x, y, z', 'dogs, cats'] >>> >>> sum([elem.split(', ') elem in li], []) ['x', 'y', 'z', 'dogs', 'cats'] and itertools : >>> list(i

css - Fluid-width nav in IE7 -

working on revamping client's site, , 1 of requests change nav accommodate text of size. here's trick: i can't change html, css , javascript . oh, , version of jquery on site 1.4.4 - can't change either. i've got javascript-based solution in place, , it's working across modern browsers - can't seem function in ie7. solution relies on nav elements rendering in native width (i.e. wrapping instead of resizing), in order calculate necessary width changes. in ie7, nav items don't clear - last 1 shrinks tiny size fit first row, , javascript can't tell resizing needs calculated. the javascript should work fine, main issue need know css isn't doing force last element wrap instead of resize in ie7. i've tried exhaustive number of combinations of display: inline-block; , white-space: nowrap; , , float: left; no avail. i isolated nav in question , put in fiddle right here . if has ideas, or knows better way can implement, let me know - sugges

C++ See If Argument Is Numeric -

i'm creating encryption/decryption program in c++, , use 3 user-provided numbers customize encryption. read isdigit() on cplusplus.com, , made function based on that: bool is_numeric(char *string) { int sizeofstring = sizeof(string); int iteration = 0; bool isnumeric = true; while(iteration < sizeofstring) { if(!isdigit(string[iteration])) { isnumeric = false; break; } iteration++; } return isnumeric; } however, doesn't seem work. whether give number, or non-numeric character, still returns false. wrong approach. you computing sizeofstring wrong. try instead. bool is_numeric(char *string) { int sizeofstring = strlen(string); int iteration = 0; bool isnumeric = true; while(iteration < sizeofstring) { if(!isdigit(string[iteration])) { isnumeric = false; break; } iteration++; } ret

javascript - EDITED: I'm having issues with a button and its function -

-----edited----- story not being presented properly, again, due code error. need fresh eyes! function story() { //collect users input data var transport = ""; var name = document.getelementsbyname("name")[0].value var title = document.getelementsbyname("title")[0].value var noun = document.getelementsbyname("noun")[0].value var num1 = document.getelementsbyname("num1")[0].value var num2 = document.getelementsbyname("num2")[0].value var travelmeasure = document.getelementsbyname("measureravel").value //write new html page display story document.write("<h1>"+title+"</h1>"); document.write("<p>once upon time,</p>"); document.write("<p>"+name+" trying make way "+noun+" in "+transport+".</p>"); document.write("<p>unfortunately "+name+"

ruby - How do I post/upload multiple files at once using HttpClient? -

def test_post_with_file filename = 'test01.xml' file.open(filename) |file| response = @http_client.post(url, {'documents'=>file}) end end how modify above method handle multi-file-array post/upload? file_array = ['test01.xml', 'test02.xml'] you mean this? def test_post_with_file(file_array=[]) file_array.each |filename| file.open(filename) |file| response = @http_client.post(url, {'documents'=>file}) end end end

database - Java EclipseLink EntityManger: Way to Ensure Connection Can be Established? -

i'm using eclipselink 2.4 in jax-rs (jersey) application. in base controller, connect database, since entity manager really connects when query executed, exception thrown. is there way determine if can connect database after entitymanager object can handle exception myself (and fail on manually database). edit: assume cannot change underlying dbms @ all. you create servletcontextlistener , run query on startup application. if fails out of luck error handling guess. you should clustered ha database.

php - Facebook textarea functions -

i know how add function clears contents in textarea if typed. example, standard message in textarea say: "type something...", if typed, textarea cleared. basically, same function facebook uses in wallpost-textarea. and how make height of textarea automatically follow amount of text, no scrollbar needed. again, same function facebook uses in wallpost-textarea. actually, i've noticed function clears contents in textarea/input field used on site's signup page, when entering e-mail, password etc. i hope of can me. i've tried find script without luck! the first thing (html5) placeholder attribute. message there default , when start typing goes away. http://www.w3.org/html/wg/drafts/html/master/forms.html#the-placeholder-attribute for second 1 need javascript. $('textarea').on('keyup',function(e){ $(this).css('height',$(this).get(0).scrollheight); });

Why BDD focuses on validation while TDD focuses on verification -

i've read tdd , bdd differences , what primary differences between tdd , bdd? . here (part of) answer : bdd tdd different words. if tdd right, doing bdd. difference – provided believe @ least in weak form of sapir-whorf hypothesis – different words make easier right. but still haven't been able understand why bdd focuses on validation while tdd focuses on verification. the question bdd vs. tdd (and validation , verification) came in quiz problem: what main difference between bdd , tdd? bdd focuses on validation while tdd focuses on verification bdd focuses on verification while tdd focuses on validation bdd better tdd @ testing methods independently bdd uses mocks , stubs more tdd the answer question (1) . elaborate on why "bdd focuses on validation while tdd focuses on verification"?

html - Divs don't collapse as they should - media queries -

i'm working tutorial responsive website design don't have idea why code isn't working properly. link tutorial and here demo , code. problem? how make right div go under left when resize window? html <body> <div id="containter"> <img src="http://cf.badassdigest.com/_uploads/images/28150/alternate_oscars_header__index.jp"/> <div id="left-column"> left column. staphp dap trap dap tyryt staphp dap trap dap</div> <div id="right-column"> make blablabala , kitcat staphp dap trap dap tyryt staphp dap trap dap tyryt </div> </div> css #container { width: 600px; margin-right: auto; margin-left: auto; } #left-column { width: 400px; float: left; background: red; } #right-column { width: 200px; float: right; background: green; } @media screen , (max-width: 590px) { #container { width:100% } #left-column { width: 70%; float: left; background: red; } #right-column { widt

java - Where can I find the source code for the com.sun.jdi package? -

i wanna see how debug java code using jdi, don't know source code it. in jdk? have used eclipse import src.zip in jdk seems doesn't contain infomation jdi, can find it? you can source openjdk implementation of package here . use tree view on left select package want.

objective c - Bringing up the iPad keyboard which is predominantly symbols -

apologies in advance if answered genuinely couldn't find it. i'm trying bring keyboard type on ipad appears when pressing "#+=" button. i've tried going through types on docs , i'm sure wasn't successful. missing or user have click button every time? edit: question closed "off-topic" because didn't include code or ideas or i've tried already... therefore bit of detail, used every keyboard type available on docs e.g. thetextfield.keyboardtype = uikeyboardtypenumberpad; this did not yield results require, keyboard plane appears when press #+= button because wanted users go straight one. you have no ability affect built-in keyboards. you can create own custom input view set on inputview of text editing view before make first responder. ios show view instead. have @ project of mine implemented "morse keyboard" (april fool's joke), demonstrates how achieve custom keyboard still interacts text field you&

Uploading MySQL database to server? -

Image
i have created website has mysql database. i'm using phpmyadmin , xampp. have website upload files (using filezilla). how upload mysql database server , connect website? i'm guessing there tutorial somewhere couldn't find it. if have database file ready upload in phpmyadmin there import option shown in image below: in order connect website depend on server side language choice... example php connect website database (using pdo ): <?php $dsn = 'mysql:dbname=name_here;host=127.0.0.1'; $user = 'root'; //change username $password = '******'; //change password try { $pdo = new pdo($dsn, $user, $password); } catch (pdoexception $e) { echo 'connection failed: ' . $e->getmessage(); exit; } $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); ?> once have @ top of php file can connect. 1 way via php.

ZF2 - Database transactions with updating multiple tables -

i want use zf2 db transaction update multiple tables. transaction single table: $connection = null; try { $connection = $this->tablegateway->getadapter()->getdriver()->getconnection(); $connection->begintransaction(); $this->tablegateway->insert($data); $connection->commit(); } catch (exception $e) { if ($connection instanceof \zend\db\adapter\driver\connectioninterface) { $connection->rollback(); } } now want update 2 tables inside 1 transaction. in zf1 did creating instance of table2 class , calling appropriate method inside same transaction. since don't know method call model class inside model, cannot zf1. need simple task adding new rows tbl_invoice , updating tbl_runno table's running number invoices when entering new bill(invoice). use datamapper design pattern. pattern tablegateway serves project data single table. http://akrabat.com/development/objects-in-t

dom - Are all HTML elements unique? -

i busy making javascript code allows me make gui page elements have custom context menus, when thought checking see if element exists in order make context menu it. function element_exists(el){ var tagname=el.tagname; var exists=0; for(var a=0;a<document.getelementsbytagname(tagname).length;a++){ if(document.getelementsbytagname(tagname)[a]==el){ exists=1; } } return exists; } in code, pass reference dom element object (which stored earlier). let's stored, since removed element document. i'm using chrome canary, , if edit page through console , make new element exact same tag name , id, returns false. return true if had same innertext , innerhtml? if not, standard in web browsers (old , new)? curious because eliminate unnecessary code if they're unique. i'm pretty sure answer no; each element unique, regardless of whether have similar values (including "id"). this might provide insight how element garbage collection wo

javascript - Error on external jquery js script when uploaded to a server -

i have test site doing on localhost when try upload on free hosting server firebug says these. uncaught syntaxerror: unexpected end of input jquery.js:3 uncaught typeerror: undefined not function bootstrap.min.js:6 uncaught typeerror: cannot read property 'fn' of undefined bootstrap-tooltip.js:252 uncaught syntaxerror: unexpected end of input ckeditor.js:57 uncaught referenceerror: jquery not defined jquery.fancybox.pack.js:45 uncaught referenceerror: $ not defined why happening? the 3 common causes unexpected end error in experience: the file upload not completed successfully. though tools filezilla may give successful message, not mean server stored file correctly. better download file , check against original sure. malfunctioning/badly configured servers may cut response or error out before serving whole file. you may have syntax error in js. (for example an unmatched brace thrown error ). as can see, #3 actual reason why error thrown, while #1 , #

How to setup Android Studio to work completely offline? -

i have slow bandwidth, i'm trying keep required files on local machine set android studio offline. when click on create new project tries download file named gradle-1.6-bin.zip downloaded , tried install locally via plugin manager gives me error: fail load plugin descriptor file gradle-1.6-bin.zip so other files need download , how install them work offline android studio. android studio 0.4.0 includes support offline: http://tools.android.com/recent/androidstudio040released "you can open compiler > gradle options , enable offline mode, tell gradle ignore update-to-date checks"

.net - Get Word After String -

i want word following "from " part in db query. following code works, doesn't. seems depend on table name length. private function gettablename(q string) string 'select * _table column '%test%' dim frompos integer = q.tolower.indexof("from".tolower) if frompos > -1 dim firstspacepos integer = q.tolower.indexof(chr(32), frompos) if firstspacepos > -1 dim endspacepos integer = q.tolower.indexof(chr(32), firstspacepos + 1) if endspacepos > -1 'msgbox(q.substring(firstspacepos + 1, endspacepos - firstspacepos)) return q.substring(firstspacepos + 1, endspacepos - firstspacepos) else return "" end if else return "" end if else return "" end if end function sometimes regex need (tested in linqpad, hence .dump() call). dim quer

c++ - Pop up dialog to save file in seperate thread -

i have function gets called in separate thread main 1 when button gets clicked , calls qfiledialog::getsavefilename() function file handle file user saved,but can't on separate thread because modifies gui , you're not allowed that. how can around this? qfiledialog::getsavefilename() returns file name, not try open file nor return file handle. it's not clear question, assume button starts thread execute lengthy task , store results file. call qfiledialog::getsavefilename() right there in button click slot, obtain file name , provide name thread. thread read file name, there no need synchronization. , then, open file provided file name in non-gui thread.

html - Browser Javascript security warnings and errors -

i have iframe ( https://example.com/iframe ) runs within http , https protocols (ie. http://example.com , https://example.com/login ). this iframe has conditional forces page refresh window.top.location.reload(); when on https://example.com/login reload works fine. when on http://example.com reload doesn't work (as expected due same origin). ok. iframe doing other background activities user experience in both instances. this error chrome gives, sure others same: unsafe javascript attempt access frame url http://example.com frame url https://example.com/iframe . frame requesting access has protocol of 'https', frame being accessed has protocol of 'http'. protocols must match. my question: ok have error? doesn't bother me, impact user experience, stop browser activities, etc? this doesn't effect functionality of page. seeing error because main page https:// , iframe loading in page http:// , reason. try using relat

java - Moving an inner class to another outer class using bcel -

i want move inner class outer class outer class. possible using bcel? e.g: class outer1{ --- class inner{ ---- } } will converted to: class outer2{ --- class inner{ ---- } } and class outer1{ ---- } thanks.

java - Connecting to multiple databases using same JDBC drivers performance -

i have requirement write java application (web based) connect oracle 11g databases (currently connecting 10-12 different oracle databases), read data (all select queries). after iterating arraylist, connecting each database, fire select query (same query firing databases), record , put in 1 global collection list , close connection , continuing same process on loop. currently "executors" connect multiple databases. again using executorservice executor = executors.newfixedthreadpool(20); give 1 surprise me. creting first database connection, shows immediate log, subsequent database connection, prints logs after 60 seconds, not getting why taking 60 secs or more connections? logically, should take time connections one. please suggest performance improvement application. opening database connection expensive operation; if possible should connect each database once , reuse connection queries made database (also known connection pooling). it's not clear i

validation - Struts 2 @RequiredStringValidator messageParams -

in message resources file have following lines: error.required={0} required labels.email=e-mail to validate e-mail field using annotation validators, this: @requiredstringvalidator(key="error.required") public string getemail() { return email; } my question is: how can pass labels.email resource value {0} param message using requiredstringvalidator annotation? trying messageparam property without success. try this @requiredstringvalidator(message = "${gettext('error.required', new java.lang.string[] {gettext('labels.email')})}") the gettext() used if action extends actionsupport resource messages key specified parameter. applied 2 times in same expression build message. first time without parameter, second parameter , used overloaded gettext() implementation.

php - magento layered navigation links doesn't work on cms pages -

i'm trying magento layered navigation work on cms pages, links go error page, works fine on category pages, not on cms pages , result pages. please take @ understand question test site and if click on of links on right side goes error page don't understand, any appreciated. your error come "joomlart_jmproducts" extension. firstly, should try run reindex data. hope help. updated: here sql make error. should run sql in mysql using phpmyadmin or somthing else know error. select 1 status , e . entity_id , e . type_id , e . attribute_set_id , e . name , e . short_description , e . price , e . special_price , e . special_from_date , e . special_to_date , e . small_image , e . thumbnail , e . news_from_date , e . news_to_date , e . tax_class_id , e . url_key , e . required_options , e . image_label , e . small_image_label , e . thumbnail_label , e . price_type , e . weight_type , e . price_view , e . shipment_type , e . links_purchased_separatel

c++ - Qt 5 cannot deploy on SnowLeopard -

i have issue app doesn't run on 10.6 snow leopard. i compile these parameters: qmake lspro.pro -r -spec macx-clang config+=release config+=x86_64 in pro file, have these elements: template = app headers = \ mainwindow.h \ app_mediamanager.h \ api.h \ tool_htmleditor.h \ tool_videoencoder.h \ tool_thumbnaileditor.h sources = \ main.cpp \ mainwindow.cpp \ app_mediamanager.cpp \ api.cpp \ tool_htmleditor.cpp \ tool_videoencoder.cpp \ tool_thumbnaileditor.cpp qt += network webkitwidgets widgets concurrent sql qmake_cxxflags_x86_64 += -mmacosx-version-min=10.6 qmake_macosx_deployment_target = 10.6 icon = icon.icns resources = lspro.qrc but simple hello world or example files, doesn't work... i add libraries macdeployqt script. when running on 10.6 error in report: dyld error message: library not loaded: /usr/lib/libc++.1.dylib referenced from: /users/username/desktop/lspro.app/contents/macos/../frameworks/

Get the data that is being loaded by jquery in PHP CodeIgniter -

i have dropdown menu using form_helper in codeigniter: <?php if($materialtype): ?> <?php $material_options = array(); foreach($materialtype $rows){ $material_options[$rows->id] = $rows->category; } echo form_dropdown('materialtype',$material_options,'','id="materialtype"'); ?> <?php endif; ?> <div id="materials"></div> the code above inside <form> tag , have script: <script type="text/javascript"> var base_url = "<?php echo base_url(); ?>"; </script> <script> $(document).ready(function(){ $(document).on('change','#materialtype',function(){ loadthis(); }); function loadthis(){ var id = $('#materialtype').val(); var datastring = &#

python adding list inside list unexpected behavior -

python 2.7.3 - debian 7 - 32 bits i trying add lists( listado ) inside list( tabla ), when tabla printed elements in tabla same , besides last list added !!!! tabla = [] listado = [0,0,0] lista_base = range(100) elemento in lista_base: listado[0] = elemento listado[1] = elemento+1 listado[2] = elemento+2 tabla.append(listado) # <--- wrong here ?? print(listado) # <--- works fine. print each *listado*. print(tabla) you changing content of same list, , adding reference in tabla . so, lists in tabla same last list added. you should create new list each time in loop. try changing loop to: for elemento in lista_base: listado = [elemento, elemento+1, elemento+2] tabla.append(listado)

c - Controlled infinite loop uses too much resources -

i'm working in part of bigger project, has read lot of fifos , redirect them properly, depending on commands. achieve this, fifos read in order, in infinite loop. the problem consumes resources. can understand process doing operations , waking processor, i'd avoid overload. an option using signals, makes processing lot more chaotic, , it's difficult avoid cutting execution while processing 1 of commands. another option using blocking read, need process each fifo, because don't know , when send command. another option sleeping, don't think best option, , sleeping few milliseconds not lot of difference (i haven't tried yet). do have other ideas avoid overloading? would thread pool appropriate? http://en.wikipedia.org/wiki/thread_pool_pattern you can have 1 process checks new work. when queue has something, thread can dispatched deal it. when finished, thread returns pool of available threads (thus name). model works dealing many small task

php - fputcsv prints result to screen instead into csv -

i trying export database data .csv via php. after length of data doesn't save query .csv file displays on screen. looks it's independent on records queried, , seems independent of special characters. $handle = fopen("php://output", "w"); fputcsv($handle, array('name','text','link','category','price','package', 'date of upload','date of verification','date of expiry','status','clk')); ($c=0; $c<$num_rows; $c++) { $row2[$c][0] = iconv("utf-8","windows-1257",html_entity_decode( $row2[$c][0] ,ent_compat,'utf-8')); $row2[$c][1] = iconv("utf-8","windows-1257",html_entity_decode( $row2[$c][1] ,ent_compat,'utf-8')); fputcsv($handle, array($row2[$c][0], $row2[$c][1], $row2[$c][2], $row2[$c][3], $row2[$c][4], $row2[$c][5], $row2[$c][6], $row2[$c][7], $row2[$c][8], $row2[$c][9], $row2[$c][10])); } fclose($h

html - css drop down menu :: sub menu is appearing within main menu after hover -

i have written css code drop down menu problems drop down menu :: when hover on main menu item(i.e. in exapmle 2nd 1 "bbbbb") displays submenu...thats ok..but appearing in main menu increaing height the background of main menu becomes background of sub menu too,obviously dont want that in main menu list items starts lot of text-inedent,i dont want that text aligned right in submenu i want content width sub menu not more that my html :: <div class="menu"> <ul> <li><a href="#">aaaaaaaaaa</a></li> <li><a href="#">bbbbbbbbbb</a> <ul> <li><a href="#">aaaaaaaaaa</a></li> <li><a href="#">bbbbbbbbbb</a></li> </ul> </li> </ul> </div> my css:: .menu{ width:70%; overflow:hidden; background:green; position:relative; } .menu ul{list-s

html - Regular expressions in javascript and replace method -

i have string var: some text...<div class=example><pre><ul><li>item</li></ul></pre><div class=showexample></div></div>some text... i want replace < , > chars in pre tag html entity = &lt; , &gt; wrote script: text = text.replace(new regexp("(?=(<pre>.*))<(?=(.*</pre>))","ig"),"&lt;"); text = text.replace(new regexp("(?=(<pre>.*))>(?=(.*</pre>))","ig"),"&gt;"); i result: <p>some text...<div class=example>&lt;pre><ul><li>item</li></ul></pre><div class=showexample></div></div>some text...</p> why??? it's because of first lookahead: (?=(<pre>.*)) . when cursor of regex right before <pre> , matches since have < , there <pre> ahead. you intended have lookbehind there (?<= ... ) instead, javas

html - Auto-play sound on iphone -

i have developed html countdown timer in web. when timer reaches 0 should play sound buzz user. need auto-play sound, figured out auto-play method removed on iphone , ipad can do? how can play sound? you can play , pause sound on user click. can play time. 1 sound or video.

php - Query not inserting string data into table -

i trying insert data mysql database using php. code have works fine on localhost, when try on server reg_user_id, reg_user_access_level , reg_user_status inserted while other fields not. please help, i've wasted day trying sort out. everything here fine the php is: else { //sort data $reg_user_name = mysql_real_escape_string($_post['reg_user_name']); //create salt password before encryption, use same when retrieving password! $salt = 'mysalt';//not //first encryption $reg_user_password = sha1($_post['reg_user_password']); //second encryption salt $reg_user_password = sha1($salt.$reg_user_password); $reg_user_password = mysql_real_escape_string($reg_user_password); /*** strip injection chars email ***/ $reg_user_email = preg_replace( '((?:\n|\r|\t|%0a|%0d|%08|%09)+)i','',$_post['reg_user_email']); $reg_user_email = mysql_real_escape_string($reg_user_email); //connect db

java - Getting error while opening PDF in jsp -

i'm getting error while opening pdf in java code : <%@ page language="java" import="java.util.*, java.io.*, java.lang.*, com.eb.util.propertyutil, javax.portlet.*, com.ub.ac.aeans.*, com.ub.pm.wob,com.eb.ac.aservice, javax.xml.bind.datatypeconverter,com.eb.patientchecklist.portlets.*;" pageencoding="iso-8859-1"%><%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%><portlet:defineobjects /> <% response.reset(); response.setcontenttype("application/pdf"); string wobid = resourcerequest.getparameter("wobid"); string filename = resourcerequest.getparameter("filename"); string dir = propertyutil.getpropertyvalue("doc_base") + wobid + "/" + filename; int count = new file(dir).list().length-1; system.

c# - How to search through multiple sets with one linq statement -

consider 3 different lists of strings, 1 of list of lists. need search them find particular one. in sample, result achieved, in 1 linq statement. note not want change existing collections, nor create new ones. var collectiona = new list<string>() {"item1", "item2"}; var collectionb = new list<string>() { "item3", "item4" }; var listoflists = new list<list<string>>() {new list<string>() {"item5", "item6"}, new list<string>(){ "item7", "item8"}}; //is there better linq way this? var searchstring = "item5"; var item = collectiona.firstordefault(i => == searchstring); if (item == null) { item = collectionb.firstordefault(i => == searchstring); if (item == null) { foreach (var listoflist in listoflists) {