Posts

Showing posts from May, 2015

java - How to get the table whose cell is currently being clicked? -

i've 2 tables in panels. when click on first table on cell, row getting selected. , when click on second table on cell, row getting selected. now, how come know, table last clicked. tried isrowselected on both tables, both returning, i'm not able find last clicked table? can me? you have read how jtable listselectionlistener works, you have understand both concepts, simple example here , here

javascript - jsp pass variables between two pages -

in main jsp page, have <%@ include file="../customparametershorizontal.jsp" %> <tr> <td align="center" class="reportparamsgeneratebuttoncell"> <html:submit onclick="if(pregeneratecriteria()){return true;} else {return false;}">generate</html:submit> </td> </tr> within customparametershorizontal.jsp, there include dateselection1.jsp, validates date , time set on form. <script> function validatehhmm(inputfield, message) { var isvalid = /^(0?[1-9]|1[012])(:[0-5]\d) [apap][mm]$/.test(inputfield); if (isvalid) { }else { alert("time must entered in format hh:mm am/pm"); } return isvalid; } </script> so, within dateselection1.jsp, tried disable button in main jsp using : document.form1.reportparamsgeneratebuttoncell.disabled= true; but, error saying object null or not defined. is there anyway, can set var, can chacked main form , disable ...

internet explorer - InputDate popup not work IE 9 -

i have problem working <tr:inputdate> , internet explorer 9. calendar picking date it's not showing. chrome/firefox , previous versions of ie , ie compatibility mode works fine. disabled pop-up blocker still not working. suggestion? i'm working with: myfaces v2.1.1 trinidad v2.0.0 thanks... either used wrong doctype , or it's bug in html/css generated <tr:inputdate> . i've never used trinidad, can't confirm either of possible causes. after you've reported issue trinidad guys, in meanwhile best bet force ie9 render in ie8 compatibility mode adding following meta tag html head: <meta http-equiv="x-ua-compatible" content="ie=emulateie8" />

Rails 3.1 Database should be a Mongo::DB, not String. (Mongoid::Errors::InvalidDatabase) -

i passenger error. full error page: https://dl.dropbox.com/u/1725428/stackoverflow/mongoid-errors-invaliddatabase.html my setup is: - mac osx lion - rvm ruby v1.9.3p194 - passenger - mongodb local server - rails 3.1.1 - mongoid 2.4.10 this setup worked well, until tried changing rails version in gemfile 3.1.1 3.2. broke "database should mongo::db, not string. (mongoid::errors::invaliddatabase)" tried use previous rails 3.1.1., error persisted. tried reinstall rvm , gems. still occur. tried use latest mongoid instead of previous working 2.4.5, not helping though. database server running. any ideas on cause this? okay, bug in mongoid gem, used current 3.0rc right github , working. https://github.com/mongoid/mongoid.git

spotify - libspotify API: image ID format? -

is image id returned sp_album_cover , sp_artist_portrait 0 terminated? or length fixed? thanks. it's opaque struct: i.e., contents undefined. if want sane way of printing or storing image, convert link string: sp_link_create_from_image() followed sp_link_as_string() .

reporting services - SSRS - How to continue data to next column? -

i need report "employee name" , "age", not need continue names next page; need continue next column. it should : _________________________________________________ | employee name | age | employee name | age | |_______________|_____|_______________|_________| can send report manages this? using microsoft report service. you want multi-column report sound of it. on layout tab, right-click somewhere there aren't report objects , choose properties. click on layout tab , set number of columns how many columns want on page - in example 2. give column lay out report objects on left , greyed-out column on right column on left repeat. however, there couple of tricks here: your columns must fit on page or won't columns. example, if layout settings @ default of 1cm spacing , 2.5cm left , right margins, column must less 7.5cm on a4 (21cm wide) page. otherwise 1 column 2 columns don't fit on page. the report renderer in designer doesn...

global variables - no of records in a store are not returning in extjs -

i new extjs , working on creating dynamic screen depending on no of records ext.data.store(); gettotalcount/getcount used no of records store. need store total no of records in var , return it i trying this function get_count() { var num; cachestore.on({ 'load':{ fn : function(store,records,options){ num = gettotalcount(); //console.info('store count = ', tsize); //console.info(' count = ', getcount()); }, scope: }, 'loadexception' : { fn : function (obj,options,response,e){ //console.info('error = ', e); }, scope : } }); // wrong logic have similar //return num; //return num }; tsize = get_count(); i null in tsize. tried getcount() instead of gettotalcount() buti getting same problem. dont know going wron...

Merge four CMYK images into one RGB Image Java -

thanks in advance provide me, , sorry bad english. i know there's lot of questions topic, have looked lot on internet (and stackoverflow too) haven't found answer this... i have 4 images; each 1 of them in type_byte_gray color model. have loaded these 4 images using code: int numelems = 4; bufferedimage[] img = new bufferedimage[numelems]; for(int i=0;i<numelems;i++){ fileinputstream in = new fileinputstream(args[i]); img[i] = imageio.read(in); in.close(); } just imageio read... need "merge" 4 images 1 rgb image... each 1 of images 1 channel cmyk image. these images have equal dimensions. have converted 4 images 1 cmyk image using code: for(int j=0;j<img[0].getheight();j++){ //read current point color... for(int k=0;k<numelems;k++){ colpunto[k] = (img[k].getrgb(i, j) & 0xff); } int colorpunto = convertcomponentsrgb(colpunto); //now, set point... out.setrgb(i, j, colorpunto); } } this func...

javascript - Jquery/Jquerymobile populate <select> dynamically - ERROR -

i've database containing options add dynamically, after button click, in <select> tag. html looks like, inside div data-role="page" (for jquerymobile) <div id="endsessionpagecontent" data-role="content"> <div data-role='fieldcontain' id="endsessionform"> </div> </div> basically, values sqlite database, , i'd put them inside "endsessionform" div. data should displayed both <inputs> , <select> elements. function looks (no sql interaction here, simplicity): function buildpage(divid){ $("#endsessionform").empty(); var div = "<div><label>aaa</label><input></input></div>"; div += "<div><label>bbb</label><input></input></div>"; div += "<div><select><option>1</option><option>2</option><option>3</option></se...

PHP's date usage results in 2 hours error -

i'm using date('h:i:s', (time() - $start['time'])) displa time passed since start of script. whatever result of time() - $start['time'] - 0, 17 or whatever date prints out 02:00:00, 02:00:17 etc. what may reason? time returns absolute numeric timestamp, numeric value 2012-06-04 16:35:12 . start time similar numeric, absolute timestamp. subtracting 1 other result in small number, is, again, absolute timestamp. time around beginning of 1970. when format timestamp using date('h:i:s') , display time portion of timestamp 1970-01-01 02:00:00 . read unix timestamps represent . the time difference you're looking result of time() - $start['time'] , in seconds, can't format using date() . more along lines of: $diff = time() - $start['time']; echo 'difference in seconds: ' . $diff; echo 'difference in minutes: ' . $diff / 60; echo 'difference in hours: ' . $diff / 60 / 60;

python - App Engine's UnindexedProperty contains strange code -

please me understand this: on v1.6.6 it's in line 2744 of google/appengine/ext/db/__init__.py : class unindexedproperty(property): """a property isn't indexed either built-in or composite indices. textproperty , blobproperty derive class. """ def __init__(self, *args, **kwds): """construct property. see property class details. raises: configurationerror if indexed=true. """ self._require_parameter(kwds, 'indexed', false) kwds['indexed'] = true super(unindexedproperty, self).__init__(*args, **kwds) . . . after constrained indexed parameter false - set true! before 1.2.2, filter queries property type, text , blob. did return empty lists, worked. version 1.2.2 introduced indexed attribute properties allows disable indexing of selected properties[1]. since then, property want query on must indexed or throw exception. we know text , blob pro...

powerpoint - How to use php read ppt on the web -

i have simple question, question how upload ppt file , display ppt on web. have try google question, , have read page use google doc , use url read ppt file url link. so, question not achieve? thanks! one google search of "php ppt" yields this . edit: supports .pptx .

Regex to match filename in a url -

i'm wanting remove filenames url path (which doesn't contain domain) in javascript. the path this: /something/myfile.html?d=var or /something/myfile.html and desired output: /something/ sometimes urls passed in this: /something/else i don't want 'else' stripped out. in other words regex strips after last slash not work in case. edit : clarify, consider filename . after forward slash seen above. remove matches following regex pattern: [^/?]*\.[^/?]*(\?.*)?$ or really [^/?#]*\.[^/?#]*(\?.*)?(\#.*)?$ don't forget use decodeuricomponent on what's left.

Concurrent mutiuser access php+mysql -

im going develop stock maintaining system using php+mysql. runs on server machine, many users can update stock data. (in/out) im working on system. have following problems. user opens record “a”. ex- val=10 user b opens record “a”. ex - val=10 user saves changes record “a”. ex - val=10+2=12 (add 3 items, stock should 12) user b saves changes record “a”. ex - here need record "a" value = 12, b update val=12+3=15. (then add 3 items final stock 15) in example, user a’s changes lost – replaced user b’s changes. i know mysql innodb facilitate row level locking. question , is innodb engine concurrent control ; , enough (innodb) avoid "lost update" problem. or need coding avoid problem. is enough please tell me how innodb works previous example. (lost update) (sorry bad english) thanks innodb allows concurrent access, user a , user b handling same data. user a update row based on his/her data, user b can same -- resulting in user a 's lo...

garbage collection - Weak Tables in lua - What are the practical uses? -

i understand weak tables are. i'd know weak tables can used practically? the docs say weak tables used in situations wish annotate values without altering them. i don't understand that. mean? posted answer comments... since lua doesn't know consider garbage, won't collect isn't sure garbage. in situations (one of debugging) want specify value variable without causing considered "not trash" lua. understanding, weak tables allow you'd variables/objects/etc, if they're weak referenced (or in weak table), still considered garbage lua , collected when garbage collection function called. example: think if wanted use associative array, key/value pairs in 2 separate private tables. if wanted use key table 1 specific use, once done using it, locked existence in lua. if use weak table, however, you'd able collect garbage done using it, freeing resources using. to explain 1 cryptic sentence annotating, when "alter...

javascript - Pass in For Loop Parameter into Each Statement -

i have json feed pulling each statement. loop var i value used in each statement. in example below loop run 0, 1, 2. if i == 1 run json feed i = 1 value. when if statement gets triggered json each statement runs through items b/c it's i value starts @ 0. console.log have in place returns 0, 1, 2. return 1. thank help. edit focus make $.each(data.data, function(i, item) { i within each statement use number i equal in loop statement. if there 3 items in json file, item 1 ran. for (var = 0; < 2; i++) { if (i == 1) { $.getjson("/json/v2_ilt_map.cfm?feedtype=iltmap_scheduled&customerid=1&trainingobjectparent=3", {}, function(data, i) { $.each(data.data, function(i, item) { console.log(i); } }): } }​ you'll need introduce additional function scope make work. function checkonly(i) { return function(data) { $.each(data.data, function(ii, item) { if (ii ==...

jquery - AJAX not showing up in Firebug Console -

disclaimer: not sure wordpress related or not. i'm following simple tutorial check if ajax works in wordpress localhost. my ajax-test.js : jquery(document).ready( function($){ $(".ajax-link").click( function(){ var data = { action: 'test_response', post_var: 'this echoed back' }; $.post(the_ajax_script.ajaxurl, data, function(response) { alert(response); }); return false; }); }); in plugin, add script wp_print_scripts() , add processing function: function test_ajax_load_scripts(){ wp_enqueue_script("ajax-test", plugin_dir_url( __file__ ) . 'ajax-test.js', array( 'jquery' ) ); wp_localize_script('ajax-test', 'the_ajax_script', array( 'ajaxurl' => admin_url('admin-ajax.php') ) ); } add_action('wp_prin...

asp.net mvc - Cannot resolve symbol 'ViewBag' -

Image
i'm using vs2010 sp1, mvc3 , resharper 6.1. in 1 of projects have following issue(). cannot resolve symbol 'viewbag' i have in controllers. in views works fine. i have check similar issue , try suggested solution didn't work. can please me this. make sure controller derived public class yourcontroller : controller

Java error, Scanner cannot find symbol -

system.out.print("are sure want quit? (y or n)"); char selection; selction = sc.nextchar(); if(selection == 'y' || 'y'){ close = 1; }else if(selcetion == 'n' || 'n'){ break; }else{ system.out.println("invalid input"); } what wrong part of program. scanner initialized correctly in method on top. here screenshot of errors. http://i.stack.imgur.com/6na3l.png change following(please notice spelling mistakes have committed): char selection; selection = sc.next().charat(0); if(selection == 'y' || selection == 'y'){ close = 1; }else if(selection == 'n' || selection == 'n'){ break; }else{ system.out.println("invalid input"); }

asp.net mvc - ScriptBundle not including other script depending on the ordering -

i'm trying combine scripts one.. have 2 folders, main folder 'scripts' , other 'scripts/other'. when try: bundletable.bundles.add(new scriptbundle("~/scripts/all").include("~/scripts/*.js", "~/scripts/other/*.js")); scripts 'scripts/other' not included. when invert order: bundletable.bundles.add(new scriptbundle("~/scripts/all").include("~/scripts/other/*.js", "~/scripts/*.js")); it works!! can tell me why? can try calling includedirectory methods directly , seeing if see same issue? scriptbundle("~/scripts/all").includedirectory("~/scripts", "*.js").includedirectory("~/scripts/other", "*.js")); if works, it's possible have bug here.

How can I give access to a private GitHub repository? -

i have private git repository , extend access member of team. able through github website? have username of member. i have tried going through admin page of repository there isn't such option not owner. if owner simple: go repo , click settings button. in left menu click collaborators then add name. source: github docs .

string - How to limit scanf function in C to print error when input is too long? -

i want limit scanf function when enter example char* array <string...> has more 30 characters, not , output error. i got hint use [^n] or don't understand how it? know can use scanf("%30s"..) don't want input valid , error. any great. if must use scanf believe best can use width specifier like: "%31s" , you've mentioned, use strlen check length of input, , discard string , report error if input longer limit. or possibly skip strlen additionally using %n in format string, e.g. "%31s%n" . a format string using %[^\n] in place of %s instructs function continue reading until newline, consuming other whitespace characters along way. useful if want allow input include whitespace characters. review docs scanf ( here's copy of man page).

frame - Web page Embedded in a webpage, interacting with Watir elements -

Image
i having problems accessing text field on web site. code write input data input field txtuser ? you have explicitly text field in frame: browser.frame(:name => "content").text_field(:name => "txtuser").set "lorem ipsum"

sql server - Under what circumstances does an update Join table work without a FROM statement in T-SQL? -

i trying figure out cases these 2 statements work or not work. able use statement 1 couple times project; cannot decipher difference. statement 1 update tbl1 inner join tbl2 b a.clm = b.clm set a.clm1 = case when b.clm2 = 1 11 else 2 end, b.clm2 = case when b.clm4 = 2 3 else 100 end; compared statement 2 update set a.clm1 = case when b.clm2 = 1 11 else 2 end, b.clm2 = case when b.clm4 = 2 3 else 100 end tbl1 inner join tbl2 b a.clm = b.clm; your statement 1 should throw error on compile. update syntax update has followed object being updated. otherwise, sql server have no idea table in join 1 needs updated. if refer link msdn article, you'll see syntax requires following: update [alias or object name] set statement from (if used alias) where statement as jonnygold said, second example ideal way update join or complex queries. simple querie...

jquery - Why is responseText returning blank? -

i have database table fields contain latitude , longitude coordinates of positions. want create markers google map view using information database. i've implmented query function function getcords(){ $link = connectdb(); $query = "select * tour"; $results = mysqli_query($link, $query); $jsonarray = array(); while ($row = mysqli_fetch_assoc($results)){ $jsonarray[] = array('filename' => $row['filename'], 'lat' => $row['lat'], 'lon' => $row['lon']); } return json_encode($jsonarray); } when call function php page, returns usual json format. my issue executing ajax query. have query function above in php scripts file containing 6 or utility functions controlling login, logout, registration , like. query database via jquery, tried var request = $.ajax({ type:"get", url: "includes/phpscripts.php?action=cords", type: "json" }); var response = request....

javascript - Issue with getLastRow() -

i have issue getlastrow(). thought function supposed return last row has data. since worksheet working on has lot more vacant rows below rows filled data, functions seems go in , select last vacant row on execution instead of selecting last row has data, may not same. can 1 tell me how fix anomaly. google script bug or not understanding do? please ask further questions if didn't make myself clear. do have "whole-column" formulae in sheet? either array formulae, or formulae copied way down? if these formulae designed return blank cells down bottom, getlastrow() still catch them. if case, try: function getlastpopulatedrow(sheet) { var data = sheet.getdatarange().getvalues(); (var = data.length-1; > 0; i--) { (var j = 0; j < data[0].length; j++) { if (data[i][j]) return i+1; } } return 0; // or 1 depending on needs }

for loop - Execute a local bash variable inside double quotes -

hypothetically have 4 webservers need add line of html file. can see need integer appear after cluster= for in 01 02 03 04; ssh web.${i}.domain.com 'echo "<img src=beacon.gif?cluster=${i}>" >> /var/www/index.html'; done how can accomplished? in advance. please note ' before , after ${i} : for in 01 02 03 04; ssh web.${i}.domain.com 'echo "<img src=beacon.gif?cluster='${i}'>" >> /var/www/index.html' done edit: there huge difference between quoting in shell , string literals in programming languages. in shell, "quoting used remove special meaning of characters or words shell" (bash manual). following lines identical bash: 'foo bar' foo' 'bar there no need quote alphabetic characters - enhances readability. in case, special characters " , < must quoted. variable $i contains digits, , substitution can safely done outside of quotes.

javascript - Easiest way to mask characters in HTML(5) text input -

does html5 have kind of text field masking or still have trap onkeydown etc.? jbabey right--"masking" in blocking illegal characters, not hiding what's typed. the best (as in simplest , reliable) way i've found trap onkeyup , run regex replace on value of textfield, removing illegal characters. this has few advantages: it's easy implement (one function, 2 lines of code). it's reliable , covers cases i've thought of. it doesn't block key commands copy/paste, select or arrow keys. but major disadvantage shows typed character(s) briefly before removing them, makes hackish , unprofessional. look new html5 input types . these instruct browsers perform client-side filtering of data, implementation incomplete across different browsers. pattern attribute regex-style filtering, but, again, browsers don't (or @ all) support it. however, these won't block input itself, prevent submitting form invalid data. you'll st...

iphone - Efficiency of CALayer and how many is the limit -

in iphone app, need show large number (max 150) of small dots of 10x10 pixels move around screen individually. don't need move smoothly in way, need updated every second or so. have implemented single calayer redraw every second. but understand calayers efficient because mapped gpu hardware. wondered if more efficient (in terms of battery usage) create separate calayer each dot , move setting position properties. so wonder whether have experience that. cpu have less do, gpu more. how many calayers can still handled gpu hardware? if make them separate calayers, animate them, better. lot more energy intensive? what makes worse in case, use catiledlayer them, maximum of 4 tiles exposed. means need redraw them 4 times each update. there. have met similar problem did. in case, drawing 80 or bar risers in bar chart. previously, use uiview (with drawrect implemented) each riser, , later decided use calayer (without implementing drawlayerincontext) each of them animati...

sqlite - Search two or more DB columns with Android Search Dialog -

i have 3 column db android search dialog working correctly. i'd able type in work or phrase 2 different columns , have return results searched phrase either in 1 or other column, or both columns. i'm using below method: //--- records search public cursor searchdb(string query) { return db.query(true, db_table, new string[] { key_rowid, key_column1, key_column2, key_column3 }, key_column1 + " like" + "'%" + query + "%' or " + key_column2 + " like" + "'%" + query + "%' or " + key_column3 + " like" + "'%" + query + "%'", null, null, null, null, null); } //--- end records search so works fine if have db this: col1 col2 col3 ______________________ hi there guys how and searched on "hi" return "hi there guys". want search on "hi there" , have return whole row of 3 columns - "hi the...

c# - Razor View Race Condition -

in custom razor engine, derived razorviewengine, i've spotted think unstable code: public override viewengineresult findview(controllercontext controllercontext, string viewname, string mastername, bool usecache) { viewlocationformats = addviewdynamicformat(controllercontext, viewname).toarray(); areaviewlocationformats = addareaviewdynamicformat(controllercontext, viewname).toarray(); return base.findview(controllercontext, viewname, mastername, usecache); } my concern when 2 requests being processed "at same time," first set location formats needs, before can use them - second threaded request might have chance set location formats different way. rest gets ugly. is valid concern? said differently, asp.net mvc guarantee razor view engine handle 1 request @ time? doubt case. likewise, if there 1 razor view engine object per request, ok. don't believe case. update have confirmed race condition. have found article...

javascript - Variable names and character encodings -

i have checked π valid javascript variable name. also, when try writing var π = math.pi in chrome console, fine. however, when include line var π = math.pi inside .js file written sublime text 2 on mac, chrome complains: uncaught syntaxerror: unexpected token illegal i have tried encodings utf-8, utf-16 le , utf-16 be, none work. when execute line console.log('π') , written inside sublime text 2 utf-8, chrome prints: Ï€ how can use javascript variable name π in sublime text 2, chrome understands it? check make sure setting <meta charset="utf-8"> in head of html or if charset different can set charset attribute on script tag: <script src="script.js" charset="utf-8">

eclipse - ALT+CMD+R stopped working -

i using mac , eclipse. used use alt + cmd + r name refactoring. unfortunatelly key stopped working , using key write ® (only in eclipse). alt + cmd + r still correctly defined in keys section of eclipse preferences. cause strange behaviour? perhaps there conflict other keybindings. open binding view , in unbinded command press alt + cmd + r . check conflicts section. if can see "rename-refactoring /in windows" fine. else search "refactor" , in bind section of "renaming-refactoring" when "in windows" clear , press alt + cmd + r . check conflicts, clear them if , save. voila! should ready.

How to batch in MSBuild? -

i can't figure out how pass values msbuild task method. take following project file... <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" toolsversion="4.0" defaulttargets="main"> <propertygroup> <var1>foo</var1> <var2>bar</var2> </propertygroup> <target name="main"> <message text="$(var1)" importance="high" /> <message text="$(var2)" importance="high" /> </target> </project> i want refactor message task target , pass on var1 , var2 same output. simplified example concept same. i think want this: <itemgroup> <messages include="message1"> <text>hello message1</text> </messages> <messages include="message2"> <text>hello message2</text> </messages> </itemgroup> <target name=...

Windows batch looping through subfolders and running a command -

i'm trying have nested loop in windows command prompt go each subfolder in specified folder concatenate text files in there 1 text file. i'm trying use for /f in (.) (for %f in (*.dat) type “%f” >> aggregate.txt) but not working. me! i'm not sure if want concatenate .txt or .dat files, should work .dat (for /r %f in (*.dat) @type "%f")>aggregate.txt type help for command line more info on many forms of statement. it more efficient enclose whole command in parentheses , redirection once instead of doing append redirection each file. edit - solution refined requirement in comment: 1 aggregate per folder if needed, first delete existing aggregate.txt files del /s aggregate.txt then following should give desired result for /r %f in (*.dat) @type "%f" >>"%~dpf\aggregate.txt" note if put commands in batch file must double percents before variables. example, %f on command line need %%f in batch fi...

Facebook api - user still logged after close browser -

i have problem facebook connect in application. use php sdk , js sdk. when user log in facebook web-app (without remember me function on facebook), close browser , start again. still logged when call ->getuser() , ->api('/me') , shouldn't. searched , try possible solution, , nothing works. problem problem because of facebook cookies fbm_appid fbsr_appid, set facebook , expire after 2 hours. when destroy cookies, recreate automaticly... do have idea?

Getting Sphider to output JSON -

i've added sphider crawler site in order add search functionality. default search.php comes distribution of sphider downloaded plain , doesn't integrate rest of site. have little navigation bar @ top of site has search box in it, , i'd able access sphider's search results through search field using ajax. this, figure need sphider return results in json format. the way did used "theme" outputs json (sphider supposts "theming" output). found theme on this thread on sphider's site. seems work, more strict json parsers not parse it. here's example json output: {"result_report":"displaying results 1 - 1 of 1 match (0 seconds) ", "results":[ { "idented":"false", "num":"1", "weight":"[100.00%]", "link":"http://www.avtainsys.com/articles/triple_contraints", "title":"triple contraints", "description":...

ASP.NET C#: DropDownList SelectedIndexChanged Event Not FIring -

my setup follows: in pageload event, initialize dropdownlist follows: sonumlist = new dropdownlist(); sonumlist.datasource = solist; sonumlist.databind(); sonumlist.height = new unit("19px"); sonumlist.selectedindexchanged += (choosesodropdown); sonumlist.autopostback = true; panel1.controls.add(sonumlist); in choosesodropdown event fires when selectedindex on sonumlist changed, create dropdownlist called pnum: pnumlist = new dropdownlist(); pnumlist.datasource = datasource2; pnumlist.datatextfield = "part"; pnumlist.datavaluefield = "part"; pnumlist.databind(); pnumlist.height = new unit("19px"); pnumlist.selectedindexchanged += choosepnumdropdown; pnumlist.autopostback = true; panel1.controls.add(pnumlist); although pnum box displays , has data appropriately bound, choosepnumdropdown event never fires, though page postback. i've tried breakpoint @ beginning of function , doesn't fire @ all. is there reason why unable bind ...

php - How do I count rows in a table according to ID column (prepared statements)? -

i have array populated records 1 table , want count corresponding records table , insert array. when try code keep getting error warning: mysqli::prepare() [mysqli.prepare]: data must fetched before new statement prepare takes place foreach ($persons $i=>$person) { $stmt = $mysqli->prepare("select count(*) order personid = ?"); $stmt->bind_param("i", $person['personid']); $stmt->execute(); $stmt->bind_result($totalorders); $stmt->fetch(); $stmt->close; $persons[$i]['totalorders'] = $totalorders; } it's though $stmt->close; being ignored. you need add parentheses call close method: $stmt->close();

Regex doesn't recognize underscore as special character -

/(?=^.{8,}$)(?=.*[_!@#$%^&*-])(?=.*\d)(?=.*\w+)(?![.\n])(?=.*[a-z])(?=.*[a-z]).*$/ i'm trying make regex password validation such password must @ least 8 chars , include 1 uppercase, 1 lowercase, 1 number, , 1 special char. works fine except won't recognize underscore (_) special character. i.e., pa$$w0rd matches, pass_w0rd doesn't. thoughts? this portion of regex seems looking special characters: (?=.*[!@#$%^&*-]) note character class not include underscore, try changing following: (?=.*[_!@#$%^&*-]) you need modify or remove portion of regex: (?=.*\w+) \w equivalent [^a-za-z0-9_] , if underscore special character portion of regex cause fail. instead, change following (or remove it, redundant since check special characters earlier): (?=.*[^\w_]) complete regex: /(?=^.{8,}$)(?=.*[_!@#$%^&*-])(?=.*\d)(?=.*[^\w_])(?![.\n])(?=.*[a-z])(?=.*[a-z]).*$/

redirect - Wordpress Mobile - Change Part of the URL Instead of Redirecting to the Front Page? -

i've been called maintenance work on client site didn't build. site built wordpress, , user on mobile device redirected more mobile-friendly version of site. problem if mobile user clicks link original site (home page, inner page, etc), no matter link is, redirected front page of mobile site. trying replace part of current url .ca .mobi mobile users redirected straight mobile version of original page instead of mobile home page. i looked @ how replace part of url javascript? , tried matt , juan's suggestions, neither of them worked , instead cause errors. i'm hoping can me here. currently, code in header.php detects if user on mobile device, /* --- detect mobile browser ---*/ $useragent=$_server['http_user_agent']; if(preg_match('/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|voda...

http - Youtube gdata playlist httprequest -

hey have program performs request youtube json list of videos. whats working: perform request youtube json list of videos specific user. example url usings : username variable have set up. httpurirequest request = new httpget("http://gdata.youtube.com/feeds/api/videos?orderby=published&author="+username+"&v=2&alt=jsonc"); what not working: perform request youtube json list of videos specific playlist. httpurirequest request = new httpget("http://gdata.youtube.com/feeds/api/playlist/pl827bc9167705bbab?alt=jsonc&v=2"); what wrong playlist request ?

javascript - jquery autocomplete. tracking values instead of labels -

i have jquery autocomplete field want add multiple values in same input field. in example see here, http://jqueryui.com/demos/autocomplete/#multiple value , label same things work fine whats in select event. however, in case, when user chooses name, want input box show labels, want post values when submit form. try around it, added hidden field in form , have separate array gets value, problem when user backspaces out of value. still in array. ideas how fix that? or perhaps better solutions? var friend_data = [{"label":"john doe","value":"12345"},{"label":"jane doe","value":"123456"}]; $( "#friends" ) // don't navigate away field on tab when selecting item .bind( "keydown", function( event ) { if ( event.keycode === $.ui.keycode.tab && $( ).data( "autocomplete" ).menu.active ) { event.preventdefault(); } }).au...

javascript - Youtube video on load through Jquery/JS -

my goal display youtube video through javascript function read embedded code , load video automatically in div assigned. not getting shown in div assigned video. because has triggered button click? <script type="text/javascript"> var last_cnad_text_1 = ''; var options_cnad_text_1 = { embedmethod:'fill', maxwidth:320, maxheight: 320 }; function loadvideo() { val = $('#cnad_text_1').val(); if ( val != '' && val != last_cnad_text_1 ) { last_cnad_text_1 = val; $("#embed_cnad_text_1").oembed(val,options_cnad_text_1); } ...

c# - Compress small strings, with what to create external dictionary? -

i want compress small strings (about 75-100 length c# string). @ time dictionary created know short strings (nearly trillion). there no additional short strings in future. need 1 string without decompress other strings. now looking library or best way following: create dictionary using strings have using dictionary compress each string a way compress 1 string using dictionary 1. i found good related question , not c# specific. maybe there c# not know, or fancy library or has done that. reason ask question. edit: with dictionary talking things this: http://en.wikipedia.org/wiki/dictionary_coder helps strings shorter. strings short text messages in various languages , urls (30%/70%). there no need compressed strings human readable. stored in binary files. if there trillion strings , no more, each can represented in 40 bits (5 bytes). need way use 5-bytes index trillion strings. how know trillion strings? if compressor , decompressor both have access trilli...

android - Combine Multiple string-array Resources -

i have multiple different categories , in each category use 1 string resource populate listview so: <string-array name="list"> <item>item1</item> <item>item2</item> <item>item3</item> </string-array> i call them so: string[] list = getresources().getstringarray(r.array.list); how can combine these 1 string[] use "all" list. you can combine 2 array list single 1 this: arraylist<string> first; arraylist<string> second; second.addall(first); since use simple array there multiple way change arrays arraylist, can fetch on net. why not storing them on single array in xml file call global_content exemple. waisting time , memory this!!

node.js - How to configure Bliss Templating in express js? -

i trying i've seen in other questions no luck: express.js custom template engine (plate) node.js + express.js + dust.js issues i tried override default engine configuration app.register('.js.html', { compiler: function(str,options){...} }); but register undefined in express js. i got bliss working way exports.index = function(req, res){ //res.render('index', {}); res.send(bliss.render(__dirname+"/index",{})); }; but i'd use res.render('index',output) instead. you have set way: var bliss = new require('bliss'); var bliss = new bliss(); app.engine('.bliss',function(path,options,fn){ fn(null,bliss.render(path, options)); }); then call this: exports.index = function(req, res){ res.render('user.bliss', { title: 'express' }); }; you need file called user.bliss under views directory

How to automatically load data in an R package? -

this easy answer that's been answered numerous times. lack terminology search answer. i'm creating package. when package loads want have instant access data sets. so lets dictionary data set. i want able dictionary rather data(dictionary) load. how go doing this? from r-exts.pdf the ‘data’ subdirectory data files, either made available via lazy-loading or loading using data(). (the choice made ‘lazydata’ field in ‘description’ file: default not so.) adding following description file should it: lazydata: true

winforms - C# combobox with lines -

this different approach doing earlier. in combo owner drawn combo box draw 3 lines(solid,dash,dashdot) drawn color selected earlier colpr picker drop down this.drawmode = drawmode.ownerdrawvariable; this.dropdownstyle = comboboxstyle.dropdownlist; protected override void ondrawitem(drawitemeventargs e) { e.drawbackground(); int startx = e.bounds.left + 5; int starty = (e.bounds.y); point p1=new point(startx,starty); int endx = e.bounds.right - 5; int endy = (e.bounds.y); comboboxitem item = (comboboxitem)this.items[e.index]; point p2=new point(endx,endy); base.ondrawitem(e); pen solidmypen = new pen(item.forecolor, 1); pen dashedpen = new pen(item.forecolor, 1); dashedpen.dashstyle = system.drawing.drawing2d.dashstyle.dash; pen dashdot = new pen(item.forecolor, 1); dashdot.dashstyle = ...

paint - Changing specific colors in a bitmap , Android -

suppose have 3 bitmaps 2 colors on them. red , white blue , white green , white now want change red , blue , green colours in 3 images respectively colour. ex :black. what approach take ? i read replacing colours , successful in replacing particular colours. ex: able replace red , blue , green individually specifying colour want change. but how make generic ? can suggest approach towards ? you can use approach here: replace black color in bitmap red , add more tests inside if statement. int [] allpixels = new int [ mybitmap.getheight()*mybitmap.getwidth()]; mybitmap.getpixels(pixels, 0, mybitmap.getwidth(), 0, 0,mybitmap.getwidth(),mybitmap.getheight()); for(int =0; i<mybitmap.getheight()*mybitmap.getwidth();i++){ if( allpixels[i] == color.red || allpixels[i] == color.blue || allpixels[i] == color.green) allpixels[i] = color.black; } mybitmap.setpixels(allpixels, 0, mybitmap.getwidth(), 0, 0, mybitmap.getwidth(), mybitmap.getheight());...

objective c - How to get X-Scale and Y-Scale in UIView? -

if have many subviews in myview (all views instance of uiview) , set transform of each subview, may setscale, rotation or etc. how know xscale , yscale of each subview have set it? for example: subview1.transform = cgaffinetransformmakescale(xscale1, yscale1); subview1.transform = cgaffinetransformrotate(subview1.transform, angle1); subview2.transform = cgaffinetransformmakescale(xscale2, yscale2); subview2.transform = cgaffinetransformrotate(subview2.transform, angle2); . . subviewx.transform = cgaffinetransformmakescale(xscalex, yscalex); subviewx.transform = cgaffinetransformrotate(subviewx.transform, angle3); from example user set in subview.transform, need know xscale , yscale after user set it. think it's equation solve, please me. ^_^ thanks you from documentation cgaffinetransform make note of function cgaffinetransform cgaffinetransformmakescale ( cgfloat sx, cgfloat sy ); . can scale of view view.transform = cgaffinetrans...

qt4 - how to Fit QGraphicsScene in a QGraphicsView -

i want to fit qgraphicsscene in qgraphicsview different dimensions, such shrink or expand according size of view, , there should no scrollbar. scaling view bellow doing required: view->scale(framewidth / scenewidth, frameheight / sceneheight);

Inheritance security rules violated while overriding member in Silverlight -

i working on web application in silverlight. have overloaded webclient.getwebrequest method given below:- public class webclientwithcookies : webclient { [securitycritical] protected override webrequest getwebrequest(uri address) { string cookiecontent = htmlpage.document.cookies; webrequest request = base.getwebrequest(address); httpwebrequest webrequest = request httpwebrequest; if (webrequest != null && cookiecontent != null && cookiecontent != string.empty) { cookiecontainer cookiecontainer = new cookiecontainer(); cookiecontainer.add(address, new cookie() { value = htmlpage.document.cookies }); webrequest.cookiecontainer = cookiecontainer; } return request; } } but getting following exception: system.typeinitializationexception unhandled user code message=the type initializer ...

c# - Getting error while writing output to Microsoft Excel programmatically -

i developed winforms application using c# in .net 4.0, in end user selects input excel file. program generates output excel file cells based on business logic of application. after selecting input file , run application, if open other excel sheets on machine, see output excel file being still written in read mode , if close opened excel file application throwing error. how stop read excel sheet getting opened before entire output written?

php - using json object data in jquery select -

{"names": [ {"patientname": "ratna"}, {"patientname": "raju" }, {"patientname": "krishna"}, {"patientname": "kishore"}, {"patientname": "kishore1"}, {"patientname": "mahesh"} ]} this json object i'm getting ajax call want add patientname values select box through jquery can 1 tell me how accomplish ?? here i'm using $.ajax() function ajax call thanks in advance var select = $('#selectid'); $.each(data.names, function(i, v){ select.append('<option value="'+v.patientname+'">'+v.patientname+'</option>'); } doc - $.each() , .append() fiddle

Android fading/dimming like menu option -

i have layout icons. when touch 1 icon on bottom, in 1/4 of screen on bottom wil become option menu created myself. my goal fade / dimm rest of screen, except 1/4 on bottom. make part of screen inactive, optionmenu in android. do have idea how this? shuld create 2 separate layouts, 1 icons , menu? thank you. here ma initial layout: <?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:background="@drawable/bg" > <relativelayout android:id="@+id/mainrelativelayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layou...

storage - How computer distinguish an integer is signed or unsigned? -

two's complements set make easier computer compute substraction of 2 numbers. how computer distinguish integer signed integer or unsigned integer? it's 0 , 1 in memory. for exmaple, 1111 1111 in computer memory may represent number 255 can represent -1. signed , unsigned use same data, different instructions. the computer stores signed , unsigned integers same data. i.e. 255 , -1 same bits. however, tell compiler type variable has. if signed, compiler uses signed operators manipulating variables (e.g. idiv) , when unsigned, uses instruction (e.g. div). compiler makes program tells cpu how interpret data.

vb6 - Get some unique hardware info from user's system -

i want application available 1 system, , want 1 of hardware informations consistent, unique , available in systems... . in opinion, info best? , how can visual basic 6? thank you mac addresses , hard drive serial numbers available unique hardware id know of. cpus going introduce serial number feature years ago, idea squashed due privacy concerns. vb6 code mac example vb6 hard drive serial number exmaple

jquery - How to set Request Headers before it being loaded in an iframe -

i need download file ' content-disposition ' header being set " attachment " server. using jquery.ajax get , on success setting hidden iframe src url , gives me pop-up file download. , working fine in browsers. want change custom request headers encrypt file before & download. used jquery.ajax pre-request callback function beforesend it. i able encrypted file can observe in firebug iframe still shows non encrypted file download. after inspecting can iframe requesting new . code $.ajax({ url: "/tutorial.text", beforesend: function(xhr) { xhr.setrequestheader("password_header", userpwd); }, success: function() { $("#hidden_iframe").attr("src", this.url); } }); and working on internet explorer. how can force iframe use available resource rather requesting new get. or how can setrequestheader in iframe or need jquery.ajax task there best way download content-dispo...