Posts

Showing posts from September, 2010

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - Call to a member function bind_param() on a non-object -

this question has answer here: how mysqli error in different environments? 1 answer i trying bind variable in prepared statement, keep receiving error: call member function bind_param() on non-object the function called, , variables passed it. when change function echo variable, variable prints on page fine, if try bind here receive error. can help? //call page 1 check($username); //function on page 2 function check($username){ $dbh = getdbh(); $qselect = $dbh->prepare("select * users username = ?"); $qselect->bind_param("s", $username); } i know function not written here, shouldn't problem. don't understand why receiving error. as error-message says, $qselect seems not object. try debug using var_dump($qselect); right after prepare-call. check if getdbh() returns need. sounds prepare-call fails (don't know

Is there a limit on how many wall posts(from the past) can I get of a Facebook page using the Graph API? -

i think there cut-off on number of posts, or cut-off in time period after won't able posts. few test runs, unable form idea pages returns posts till beginning whereas stops midway. neither number of posts hinting towards constant limit, nor first post time hinting @ time cut-off. documentation(http://developers.facebook.com/d...) doesn't talk limit, out of ideas. can throw light on , provide credible information? time. the documentation https://developers.facebook.com/docs/reference/api/user/ updated show 25 posts.

javascript - How to retrieve a form using AJAX, JSON and PHP onchange of value in a select box? -

i have select box, on selectinga value in have display form in there date field include javascript calendar functionalty. tried normal ajax , php combination, dont calendar in it, need know how can make happen using json , ajax , php? thanks every appreciated.... the code this javascript using ajax function: <script> function inint_ajax() { try { return new activexobject("msxml2.xmlhttp"); } catch(e) {} //ie try { return new activexobject("microsoft.xmlhttp"); } catch(e) {} //ie try { return new xmlhttprequest(); } catch(e) {} //native javascript alert("xmlhttprequest not supported"); return null; }; function dochange(path,val) { var req = inint_ajax(); req.onreadystatechange = function () { if (req.readystate==4) { if (req.status==200) { document.getelementbyid('docfields').innerhtml=""; if(req.responsetext != ''){ document.getelementbyid('docfields')

mysql - SQL filtering by multiple columns -

i have mysql table, want query rows in pairs of columns in specific set. example, table looks this: id | f1 | f2 ------------- 1 | 'a' | 20 2 | 'b' | 20 3 | 'a' | 30 4 | 'b' | 20 5 | 'c' | 20 now, wish extract rows in pair (f1, f2) either ('a',30) or ('b', 20), namely rows 2,3,4. wish using 'in' style filter, may have many pairs fetch. if try like: select * my_table f1 in ('a','b') , f2 in (30, 20) i cartesian product of values specified f1 , f2 in in clauses, i.e. rows possible combinations f1 = 'a' or 'b', , f2 = 30, 20, hence row 1 selected. in short, i'm need like: select * my_table (f1,f2) in (('a',30), ('b',20)) only valid sql syntax :-) any ideas? that is valid syntax. if don't other alternatives are: select * my_table (f1, f2) = ('a', 30) or (f1, f2) = ('b', 20) or using join: select * my_t

convert text to image in php -

this question has answer here: how convert text images on fly? 5 answers i style text string taken form field , convert transparent .png (alpha bg). is possible php? if so, kindly show me how achieved yes, possible, going follow same technique while generating captcha image. requirement: gd library should enabled in php. code (taken php file ;) <?php // set content-type header('content-type: image/png'); // create image $im = imagecreatetruecolor(400, 30); // create colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // text draw $text = 'testing...'; // replace path own font path $font = 'arial.ttf'; // add shadow text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); //

firefox - Is it possible (with user permission) to do cross site requests with JavaScript in a webpage in the same way as you would do in an extension? -

google release pc , os. you'll able code machine browser technologies - i.e. javascript. expect tools available already. on web javascript has same origin policy prevent xss attacks. in extensions free wander around. so question is: can write page or (if prefer) online app authorized (after user confirmation, of course) cross site requests feels needed? know possible when write extension, i'd prefer doesn't stick in user's browser. [edit] know there solutions if have control of both sites involved. i'm asking if possible access, instance, google or yahoo apis: sites i've no control over. for instance want write frontend api (rest, json, xml: not script tag, cross-site compatible api): need host somewhere (a different host api provider) need make unrestricted calls domain , read responses too. understand security risks, i'm talking asking user's permission first (as when install extensions). if need have browser , server agree access da

Javascript match -

suppose code var str="abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;"; var patt1=/abc=([\d]+)/g; document.write(str.match(patt1)); i want output 1234587,19855284 this doesnt return number instead returns complete string in pattern if remove 'g' pattern returns abcd=1234578,1234578 doing wrong?? if want 1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284,1234587,19855284 then try var str="abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;abc=1234587;abc=19855284;

Are there any DBMS-specific SQL client Java libraries out there (not necessarily JDBC related nor compliant) -

this scenario: i need replace mysql, oracle , sql server sql clients java code i need run sql script files dbms-specific statements java code i've been searching , found jdbc drivers have prepare statements , such. so, more specific: there java libraries replace of dbms clients? there's no need based on jdbc, i'd manage call proper library. you can try sql squirrel. think it's great looking client, written entirely in swing. can use client database has jdbc driver.

android - How to get the facebook id from a user through the ContactsContracts API? -

i synced address book facebook , can access facebook profile through addressbook. want read facebook data connected account application , facebook id of synced user. i can't find mimetype or datafield in contactcontracts.data table contains related facebook. has anybode done successfully? it seems facebook somehow restricts permissions data. how done , permissions need access facebook contact informations synced in address book? if user has info in contacts, friends person on facebook. use graph api , list of friends , filter them contact name selected or let user select listview made returned names of facebook api query. try { jsonobject response = util.parsejson(facebook.request( "/me/friends", new bundle(), "get")); jsonarray jarray = response.getjsonarray("data"); (int = 0; < jarray.length(); i++) { jsonobject json_data = jarray.getjsonobject(i); tempmap = new hashmap<string, object>();

jquery - Best way to use special keys like [CTRL]+[UP] with onkeyup in all browsers -

how can use jquery onkeyup use these (multi) keys in new browsers? ctrl + down ctrl + up alt + down alt + up down up have @ hotkeys plugin jquery ! edit: working hotkey plugion version (its pretty short): (function(jquery){jquery.hotkeys={version:"0.8",specialkeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:&qu

Twitter API Protected User Rate Limit -

i mixed results when try thought i'd ask if else knows of documentation, etc explains happens - problem when access protected users feed on twitter, count towards api rate limit? thanks, based on twitter's documentation page user_timeline , counted towards rate limit. regardless of whether user protected or public. rate limited true

rubygems - Rails 3: Using a gem as my main app -

i want use code of gem main application code instead of installing "bundle install". how can create entire rails app based on gem , using gem app? thank you. you looking rails engines instead believe. if not, can explain problem further?

vb.net - How to show javascript alertbox on button click event in asp.net webpage if textbox1.text=""? -

how show javascript alertbox on button click event in asp.net webpage if textbox1.text="" ? what must attach script button's client click event. in script, check value of textbox1. if it's empty, show alert , return false prevent form submitting (prevent postback). to so, in page_load, insert following: if (!page.ispostback) { string script = string.format("if (document.getelementbyid('{0}').value == '') {{ alert('textbox empty'); return false; }}", textbox1.clientid); btnmybutton.attributes.add("onclick", script); } of course, encapsulate script in reusable method, use jquery check value, big idea.

objective c - CGImage, NSArray and Memory -

this multiple part question, because ignorance on matter has multiple layers. first, put caching system caching cgimageref objects. keep @ cgimageref level (rather uiimage ) loading images in background threads. when image loaded put nsmutabledictionary . had bit of arm twisting cgimageref 's array: //bunch of stuff drawing context cgimageref imageref = cgbitmapcontextcreateimage(context); cgcontextrelease(context); [(id)imageref autorelease]; [self.cache setobject:(id)imageref forkey:@"somekey"]; so, can see, i'm trying treat image ref nsobject , setting autorelease placing in dictionary. expectation allow image cleaned after being removed dictionary. now, beginning have doubts. my application clears cache array when user "restarts" play different images. running application in instruments shows memory not dropping "start" level on restart, instead remains steady. gut tells me when array has objects removed cgimageref not being cl

mysql - Ways of managing the data in a database -

i'm new databases , web servers , kind of thing. looking information can begin figure out starting point , options open me. i need have database can accessed iphone app. logically hosted on webserver somewhere. to get/insert data from/into database app make http connection php file on same server db insert/return relevant data. stop random hackers messing db app have validation code inside send php file check not hacker trying mess database. making sense or not secure enough. now confusing part head around : need check every minute has data in database become old , remove if so. needs running on server checking/manageing database. be? commonly used kinda of thing? there somekey word can start searching , reading see options there are? thanks advise, -code sounds me need cron job. cron standard scheduling task application unix type systems. you have sort of script connects database , performs cleanup query, , schedule script via cron. http://en.wikipedia.org

asp.net - Is setting the value of Server.ScriptTimeout enough to prevent page timeouts? -

on administrative page long running process we're setting following: protected void page_load(object sender, eventargs e) { this.server.scripttimeout = 300; //other code } is enough should prevent page timing out needs to? have no control on process , how long runs we've found 5 minutes more enough time, yet we're still getting intermittent errors of: system.web.httpexception: request timed out. we've tried upping value 600 no difference , in testing we've done can never actual process run long. there elsewhere need setting timeout values won't affect entire application , specific page need longer timeout value on? i think should never have "script" can take 5 min run in web app ,expecially page load! why don't create web service or somethig wrap process? can use async pattern invoke avoiding make page stack on 1 same call anyway have @ link below more detail default server time out http://msdn.microsoft.com

shell - What is the internal processing of $* and $@ -

actually, understand use of $* , $@. for example, if run script using: my_script * then, one_file in $@ each file one_file processing. there space(s) in filenames, one_file correct filename. if, however, using one_file in $*, story different. think guys understand difference , not need go further. now, interested how. how kornshell (ksh) interprets my_scrpt * , pass filenames $@ correctly , pass filenames $*. for example, when ksh see my_script * , put filenames 1 one array, , put array[1][2][3]... $@ processing ? and, when seeing $*, concat filename1+space+filename2+space+... ? i know may relate more internal coding of ksh. any insight? for example, when korn shell see my_script *, put filenames 1 one array, , put array[1][2][3]... $@ processing ? and, when seeing $*, concat filename1+space+filename2+space+... ? yes, pretty much. one important thing realize here there 2 separate processes involved: calling shell, expands my_scri

php - Date range question -

if have 2 dates, 21/05/2010 , 23/05/2010 , how can find out if 22/05/2006 7:16 am exists in between them? i using following code calculate min/max date , select records in table clear update them. $today = date('l'); if($today == 'wednesday'){ $min = date('d/m/y', strtotime('0 days')); $max = date('d/m/y', strtotime('+6 days')); }else if($today == 'thursday'){ $min = date('d/m/y', strtotime('-1 days')); $max = date('d/m/y', strtotime('+5 days')); }else if($today == 'friday'){ $min = date('d/m/y', strtotime('-2 days')); $max = date('d/m/y', strtotime('+4 days')); }else if($today == 'saturday'){ $min = date('d/m/y', strtotime('-3 days')); $max = date('d/m/y', strtotime('+3 days')); }else if($today == 'sunday'){

c# - Update using ajax in asp.net mvc -

hi can tell me problem please, , how fix it. i'm trying update part of page using ajax, i'm using basic code comes new mvc project. the logon page has this: <span id="error"/> @using (ajax.beginform("logon", "account", new ajaxoptions { updatetargetid="error"})) { <div> <fieldset> <legend>account information</legend> <div class="editor-label"> @html.labelfor(m => m.username) </div> <div class="editor-field"> @html.textboxfor(m => m.username) @html.validationmessagefor(m => m.username) </div> <div class="editor-label"> @html.labelfor(m => m.password) </div> <div class="editor-field"> @html.passwordfor(m => m.password)

ruby - How to disable ActiveRecord callbacks in Rails 3? -

i skip/disable activerecord callbacks in, specifically, rails 3. following example solution thought of -- creating attribute defined create object without callbacks. product = product.new(title: 'smth') product.send(:create_without_callbacks) the above example similar in this answer , author said specifically rails 2. there similar, or better, way for rails 3 ? see question: how can avoid running activerecord callbacks? this blog post has explanation example.

vb.net - Visual Basic format number to hower many number on left of decimal and 1 decimal without rounding -

i acutally using ssrs expression vb code. wondering how number such 236.4723423 appear @ 236.4 instead of 236.5, jsut want truncate after 1 decimal. i tried format = "n1" rounds tried formate = "#######.0" , "######.#" , rounds well. any ideas? value = math.floor(value * 10) / 10

windows phone 7 - Silverlight context menu: how to determine which menu was clicked? -

i have following context menu: <listbox x:name="sectionlist" margin="56,8,15,0" fontsize="64" selectionchanged="sectionlist_selectionchanged"> <listbox.itemtemplate> <datatemplate> <stackpanel> <toolkit:contextmenuservice.contextmenu> <toolkit:contextmenu> <toolkit:menuitem header="hide section list" click="contextmenuitem_click" /> </toolkit:contextmenu> </toolkit:contextmenuservice.contextmenu> <textblock text="{binding displayname}" /> </stackpanel> </datatemplate> </listbo

parallel processing - how do i include BSP library in a c++ program? -

im trying compile c++ parellel program using bsplib , on platfrom has bsp compile ( bsp++). nevertheless , doesnt seem recognize of bsp functions. what should in order include / import/ tell compiler im using bsp? include bsplib? bsplib.h ? thanks #include "bsplib.h" then add bsplib link library list.

silverlight - C#: Properties that may require a network call? -

i know in c#, properties supposed quick operations (not reading data network or file system, etc.) however, building silverlight app , need bind xaml element network data on viewmodel. far aware, binding can done properties, not methods. should break guideline here, or there way around that's not occurring me? <listbox itemssource="{binding users}" /> public ienumerable<user> users { { // may cached return expensivenetworkcall(); } } i break rule , bind property. although, @tom states, can bind method, not make difference user-experience wise. use observablecollection (instead of ienumerable ) , load users on thread. maybe explicit command bound button initiate expensive call.

How to get Excel 2010 to automatically change the row numbers in a function -

i computing final report , need compute value of specific column in spreadsheet of 150 rows the function wrote =((sum(i6:w6)/75)*.35*4)+(y6*.1)+(z6*.15)+(aa6*.3)+((ab6*4)/10 *.1) is working fine forced copy each row of specific column , update row numbers correct answer. for example ,if wanted calculate value row number 16 column,i have manually enter : =((sum(i16:w16)/75)*.35*4)+(y16*.1)+(z16*.15)+(aa16*.3)+((ab16*4)/10 *.1) this process going take lot of time if records,any inputs on how automatically excel update row numbers ? thanks !! just double-click lower-right-little-black-square appear on cell containing formula

google chrome - Object passing in chromium extension -

my extension creates object in background page , stores all configuration variables in object. object common for content scripts , hence background page sends the content scripts after connection request received: // in background.html timobject = { property1 : "hello", property2 : "mmmmmm", property3 : ["mmm", 2, 3, 6, "kkk"], method1 : function(){alert("method had been called" + this.property1)} }; chrome.extension.onconnect.addlistener(function(port) { console.assert(port.name == "fortimobject"); port.postmessage({object:timobject}); }); // in content script: var extensionobject = null; var port = chrome.extension.connect({name: "fortimobject"}); port.onmessage.addlistener( function(msg) { if (msg.object != null) extensionobject = msg.object; else alert("object null"); } );

Reading PDF metadata in PHP -

i'm trying read metadata attached arbitrary pdfs: title, author, subject, , keywords. is there php library, preferably open-source, can read pdf metadata? if so, or if there isn't, how 1 use library (or lack thereof) extract metadata? to clear, i'm not interested in creating or modifying pdfs or metadata, , don't care pdf bodies. i've looked @ number of libraries, including fpdf (which seems recommend), appears pdf creation, not metadata extraction. the zend framework includes zend_pdf , makes easy: $pdf = zend_pdf::load($pdfpath); echo $pdf->properties['title'] . "\n"; echo $pdf->properties['author'] . "\n"; limitations: works on files without encryption smaller 16mb.

flex - Is there a way to show the errorTip (error ToolTip) to the left of the target? -

i'm creating errortip gets displayed when user mouses on image. popup appear left of image, properties can pass create tooltip "errortipright", "errortipabove" , "errortipbelow". any thoughts? sample code: <?xml version="1.0" encoding="utf-8"?> <mx:hbox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:script> <![cdata[ import mx.controls.tooltip; import mx.managers.tooltipmanager; [embed(source="assets/some_image.png")] [bindable] private var myicon:class; private var mytooltip:tooltip; private function showtooltip(evt:mouseevent, text:string):void { var pt:point = new point(evt.currenttarget.x, evt.currenttarget.y); pt

How would I use JSP to write directly to a separate HTML page? -

i requested built project in jsp , 1 stipulation project cannot have database. trying write jsp form allow users add, remove , edit links on separate html page. have very, limited jsp experience , hoping point me decent tutorial. appreciate direction. relatively comfortable javascript, jquery , dom in general. if fullworthy sql database server not option reason, can use embedded sql database server, javadb , h2 or sqlite . not option, can head textbased file in predefinied format csv, xml or json. there lot of tools available can convert between java objects , csv, xml , json. more, it's relatively easy homegrow it. if not option odd reason, can last resort use java serialization . at least, html not suitable format "data storage".

python - Regex question about parsing method signature -

i'm trying parse method signature in format: 'function_name(foo=<str>, bar=<array>)' from this, want name of method, , each argument , it's type. don't want < , > characters, etc. number of parameters variable. my question is: how possible parameters when using regex? i'm using python, i'm looking general idea. need named groups and, if so, how can use them capture multiple parameters, each it's type, in 1 regex? you can't match variable number of groups python regular expressions (see this ). instead can use combination of regex , split() . >>> name, args = re.match(r'(\w+)\((.*)\)', 'function_name(foo=<str>, bar=<array>, baz=<int>)').groups() >>> args = [re.match(r'(\w+)=<(\w+)>', arg).groups() arg in args.split(', ')] >>> name, args ('function_name', [('foo', 'str'), ('bar', 'array'), (&

ruby on rails - Anyone know how to turn off will_paginate in Spree? -

deleting lines of <% if paginated_products.is_a?(willpaginate::collection) params.delete(:search) params.delete(:taxon) %><div class="clear"></div><%= will_paginate(paginated_products, :previous_label => "&#171; #{t('previous')}", :next_label => "#{t('next')} &#187;") %> <% end -%> only makes pagination nav disappears not pagination whole. it's bit hackey set per_page setting 1,000 wouldn't ever have paginate results. throwing in config/initializers/will_paginate.rb should work. activerecord::base.instance_eval def per_page 1000 end end

ado.net - Accessing SQL Server in parallel -

i'm trying use task-parallel-library offload expensive ado.net database access ui thread (formerly program i'm re-writing freeze, updating vb6 text box progress, until data in database loaded). have complex dependency structure (26 individual tasks), , i'm trying figure out how of worth parallelizing. i'd know whether or not io access can parallelized @ performance bonuses. if not i'll sequentially load data , update ui whenever enough information loaded perform task, it'd nice boost loading maybe 2 things @ time instead of 1 (even if don't double speedup). it's possible parallelizing increase performance, not guaranteed. depends on bottleneck is. for example, if request expensive because loads lots of data, consumes of clients network bandwith. parallelizing in case wouldn't much, if @ all. if, on other hand, bottleneck sql processing and sql request leaves sql server spare capacity in own bottleneck, can profit sql servers (v

asp.net mvc - Register .net MVC3 ControllerContext into windsor container -

with asp.net mvc3 best way register requests controllercontext castle windsor container? i'd able say container.resolve<controllercontext>(); and have requests controller context returned. thanks in advance suggestions. edit - in answer mauricio. the vast majority of actions going validation, authentication, etc.. before sending message nservicebus work. avoid having copy/paste these 20/30 lines of code on place have put them handler class controllers take dependency on in constructor, actions call class leaves actions containing 1 line of code. 1 of child classes makes handler needs know route taken, pass controller handler , onto class seems bit messy. nice if there way windsor registered provide me. i don't think can register controllercontext without ugly hacks, , imho it's not idea anyway. controllercontext belongs controller, it's not meant shared around. however, if need routing information, can register (untested!): container.

in one class run many class, PHP OOP -

i have class "user_registration" , in class need use many class: "location", "links", "mail", "module". i create include class in file: include 'class/location.php'; include 'class/links.php'; include 'class/mail.php'; include 'class/modules.php'; now create "user_registration" class. <?php class user_registration{ public function insert_to_db($name, $country_code, $home_page) { //work data return id; } public function show_info($id) { //work data } } $reg_u = new user_registration; $res = $reg_u->insert_to_db($name, $country_code, $home_page); if($res){ $reg_u->show_info($res); } ?> i need in method "insert_to_db" run class: "location", "links", "mail" methods , in "show_info" run methods of "location", "links", "module" class. how?

binaryfiles - how do you write java statements that opens a new binary file named binout.txt and assigns a reference to the connection to binobj -

can please me this: how write java statements opens new binary file named binout.txt , assigns reference connection binobj. it appreciated try fileoutputstream binobj = new fileoutputstream("binout.txt"); is homework/

Java reflection not agreeing with method declaration -

sorry length of question. i'm new java , i've come across stumping me. i'm new java don't know terminology yet, please bear me; have 3 years of php experience (mostly procedural, not oo), little java. i'm aware debugging system.out.println wrong way it, works , it's i'm used (insert joke php programmers here if must). i'm still trying figure out how use netbeans debugger. i'm working on adding feature web application uses struts (1.x). problem i'm having seems method declared want string passed it, doing reflection on method says wants string[] (a string array). i'm constrained in can't make major structural changes app, , of course have make sure don't break in app working, i'm trying make changes in context of what's there. so, problem... here method declared (many many lines cut these show hope relevant bits): aereportbean.java: public class aereportbean { private string selecteddownloadfields = null;

"Object Library invalid or contains references..." in Excel VBA with DatePicker -

i have been working on excel workbook lots of vba code while , have send file colleagues testing , not work in computer. work in same company , have windows xp sp2 office 2003. the workbook has form opens when clicking on shape , contains controls. when click on shape form show following error appears: "object library invalid or contains references object defintions not found" in form there datepicker , think there lies problem. if delete datepicker form , send them file again not error message. i tried deleting mscomct2.exd file mentioned in 2 sites " microsoft " , " lessanvaezi " error stil pops. checked , new .exd file generated. some additional info: i check system , have file mscomct2.ocx in correct location(c:\winxp\system32). if open empty excel file, go vba editor go tools->reference, not see option register "microsoft common control-2 6.0 (sp6)" (mscomct2.ocx). instead see "microsoft windows common con

ms word - Import doc and docx files in .Net and C# -

i'm writing text editor , want add possibility import .doc , .docx files. know use ole automation, if use recent ole library, won't work people older version of word, , if instead use older version, won't able read .docx files. ideas? thanks edit: solution that, application works html , rtf, convert .doc , .docx files command line 1 of these formats, this: http://www.snee.com/bobdc.blog/ 2007/09/using-word-for-command-line-co.html it's works office 2003 pia, tested in computer running office 2010: using system.io; using system.reflection; using microsoft.office.interop.word; public string gethtmlfromdoc(string path) var wordapp = new application {visible = false}; //cargar documento object srcpath = path; var worddoc = wordapp.documents.open(ref srcpath); //guardarlo en html string destpath = path.combine(path.gettemppath(), "word" + (new random().next()) + ".html");

javascript - Documentation for ActiveX Excel Object? -

i'm using activex interface excel in javascript. wondering if there definitive source of documentation properties/methods/etc.? can't seem find if 1 indeed exists. see msdn .

json - Why is this except being called? - Python -

i have method checks json payload json decoding errors, , keyerrors. reason, except statement keyerror getting called, shows there in fact, no keyerror object none . here code: try: test_data = simplejson.loads(self.raw_data) # loads data in dict test right fields test_data["test"] except simplejson.decoder.jsondecodeerror jsonerr: print 'json malform error: ', jsonerr pass return false except keyerror keyerr: print 'json validation error: ', keyerr pass the keyerror raised simplejson.loads , offending key may none . not enough context more. if give traceback asked, greatly.

c# - How can I run IE with different users and specify a url? -

i'm trying create console application replace batch file. batch file prompted user , ran following code... runas /user:usa\%usr% "c:\program files\internet explorer\iexplore.exe %serverpath%/%appname%" how can translate c# code? i'm using code below. declare user name , path, launches ie windows login. using verb incorrectly? need include password, , if so, how? string spath = serverpath processstartinfo startinfo = new processstartinfo(@"c:\program files\internet explorer\iexplore.exe"); startinfo.verb = @"runas /user:usa\" + suser; startinfo.arguments = spath; startinfo.useshellexecute = false; process.start(startinfo); function securestring makesecurestring(string text) { securestring secure = new securestring(); foreach (char c in text) { secure.appendchar(c); } return secure; } function void runas(string path, string username, string password) { processstartinfo myprocess = new processstartinfo(path); myp

c++ - Why did boost regex run out of stack space? -

#include <boost/regex.hpp> #include <string> #include <iostream> using namespace boost; static const regex regexp( "std::vector<" "(std::map<" "(std::pair<((\\w+)(::)?)+, (\\w+)>,?)+" ">,?)+" ">"); std::string errormsg = "std::vector<" "std::map<" "std::pair<test::test, int>," "std::pair<test::test, int>," "std::pair<test::test, int>" ">," "std::map<" "std::pair<test::test, int>," "std::pair<test::test, int>," "std::pair<test::test, int>" ">" ">"; int main() { smatch result; if(regex_match(errormsg, result, regexp)) {

javascript - Performing a count on an item that never has focus -

using either javascript or jquery, possible capture count on item on page never focus user , used store values item has user focus? i require means of counting total number of entries going item item gets populated. hope makes sense. can pls assist code sample. thanks. hidden field within form should work <html> <head> <title>my page</title> <script type="text/javascript"> function getvar1() { var x=document.getelementbyid("var1") return x; } </script> </head> <body> <form name="myform" action="http://www.address.com/" method="post"> <input type="hidden" id="var1" value="myvariable"> </form> </body> </html> i dont know mean trying this.. count text in box? <html> <head> <title>my page</title> </head> <body> <input type='text' id='var1' onkeypress=

regex - How to stop .+ at the first instance of a character and not the last with regular expressions in perl? -

i want replace: '''<font size="3"><font color="blue"> summer/winter configuration files</font></font>''' with: ='''<font color="blue"> summer/winter configuration files</font>'''= now existing code is: $html =~ s/\n(.+)<font size=\".+?\">(.+)<\/font>(.+)\n/\n=$1$2$3=\n/gm however ends result: =''' summer/winter configuration files</font>'''= now can see happening, matching <font size ="..... way end of <font colour blue"> not want, want stop @ first instance of " not last, thought putting ? mark there do, i've tried .+ .+? .* , .*? same result each time. anyone got ideas doing wrong? as mark said, use cpan this. #!/usr/bin/env perl use strict; use warnings; use html::treebuilder; $s = q{<font size="3"><font color="blue"> summe

iphone - using UIImage drawInRect still renders it upside down -

i have read posts on website using drawinrect instead of cgcontext draw methods. still draws upside down? thought using drawinrect print right side coordinate system originating @ top left? -(void) drawimage:(uiimage*) image atx:(float) x andy:(float) y withwidth:(float) width andheight:(float) height oncontext:(cgcontextref) context{ uigraphicspushcontext(context); [image drawinrect:cgrectmake(x, size.height-y-height, width, height)]; uigraphicspopcontext(); } notice i'm doing size.height-y-height , if don't doesn't go expect (assuming drawinrect using topleft coordinate system). renders in correct spot above code still upside down. help!!!!!! update thanks answer below working method -(void) drawimage:(uiimage*) image atx:(float) x andy:(float) y withwidth:(float) width andheight:(float) height oncontext:(cgcontextref) context{ uigraphicspushcontext(context); cgcontextsavegstate(context); cgcontexttranslatectm(context, 0, size.height); cgcontextscalectm(c

django - gzip - questions about performance -

firstly, i'm using django. django provides gzip middleware works fine. nginx provides gzip module. make more sense use nginx's gzip module because implemented purely in c, or there other performance considerations i'm missing. secondly, django doesn't gzip under 200 bytes. because gzipping expensive have value when compressing output smaller that? thirdly, api i'm building purely dynamic little caching. gzipping expensive enough make unpractical use in situation (vs situation cache gzipped output on webserver)? 1) imagine 1 gzip compression enough , nginx faster, although haven't benchmarked yet. gzipmiddleware utilizes few built-ins, might optimized, too. # http://www.xhaus.com/alan/python/httpcomp.html#gzip # used permission. def compress_string(s): import cstringio, gzip zbuf = cstringio.stringio() zfile = gzip.gzipfile(mode='wb', compresslevel=6, fileobj=zbuf) zfile.write(s) zfile.close() return zbuf.getval

javascript - IOS safari : clipping of iframe when using transform3d -

Image
people have found means make div scrollable on ios devices using css transforms. have issue iframes on ios safari, whereby if try , use css3 transforms scroll content in iframe, resulting content clipped rendered first on screen. works fine on android devices, , works on divs on ios, not iframes. appears bug in safari webkit implementation. i've tried increasing height of iframe larger content contained within, , ensured overflow enabled on iframe. has been able come workaround? i'm absolutely in-need of iframe remote content, last resort proxy content through server sided page, , inject javascript in order perform translate3d on child's body tag: seems work. images - after translate 3d (notice clipping) : sadly don't have answer you, general opinion seems to stay away iframes in ios safari; support buggy. second approach of using server side proxy remote content, assuming lock down trusted third party content. also aware of apparent width limit

javascript - How to pass dynamic parameters to .pde file -

class shape contains 2 methods drawcircle() , drawtriangle(). each function takes different set of arguments. @ present, invoke calling pde file directly. how pass these arguments html file directly if have control arguments being passed draw function? 1) example.html has (current version) <script src="processing-1.0.0.min.js"></script> <canvas data-processing-sources="example.pde"></canvas> 2) example.pde has class shape { void drawcircle(intx, int y, int radius) { ellipse(x, y, radius, radius); } void drawtriangle(int x1, int y1, int x2, int y2, int x3, int y3) { rect(x1, y1, x2, y2, x3, y3); } } shape shape = new shape(); shape.drawcircle(10, 40, 70); i looking in html file, can move functions separate file , call them different arguments draw different shapes (much similar how in java) a.html <script> shape shape = new sh

regex - how to grep part of the content from a string in bash -

for example when filtering html file, if every line in kind of pattern: <a href="xxxxxx" style="xxxx"><i>some text</i></a> how can content of href , , how can text between <i> , </i> ? cat file | cut -f2 -d\" fyi: every other html/regexp post on stackoverflow explains why getting values html using other html parsing bad idea. may want read of those. this 1 example.

mysql persistent connection -

how close mysql persistent connection? what language using? php? persistent connects timeout if on non-interactive session based on wait_timeout variable in my.cnf. see http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_wait_timeout if using php (just guessing here) take @ http://php.net/manual/en/function.mysql-pconnect.php , http://www.php.net/manual/en/features.persistent-connections.php there interesting discussions on use of persistent connections - http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/

How to declare a generic type Multi-Dimensional array in java -

i want store array of 100 int elements in rows ie 1 row of 100 int datatypes.and every single element contains array of 100 objects.how in java or android. use collection, "list of list": list<list<yourtype>> matrix2d = new arraylist<list<yourtype>>(); this structure can store table 200 rows , 100 columns each element of type yourtype . otherwise - if size fixed , want store yourtype values, theres no need generics: int rows = 200; int columns = 200; yourtype[][] matrix2d = new yourtype[rows][columns];

multithreading - Python threads all executing on a single core -

i have python program spawns many threads, runs 4 @ time, , each performs expensive operation. pseudocode: for object in list: t = thread(target=process, args=(object)) # if fewer 4 threads running, t.start(). otherwise, add t queue but when program run, activity monitor in os x shows 1 of 4 logical cores @ 100% , others @ 0. can't force os i've never had pay attention performance in multi-threaded code before wondering if i'm missing or misunderstanding something. thanks. note in many cases (and virtually cases "expensive operation" calculation implemented in python), multiple threads not run concurrently due python's global interpreter lock (gil) . the gil interpreter-level lock. lock prevents execution of multiple threads @ once in python interpreter. each thread wants run must wait gil released other thread, means multi-threaded python application single threaded, right? yes. not exactly. sort of. cpy

Jquery slider with gradescales values -

Image
i using jquery ui slider.here want gradescales in image jquery-ui-slider...how modify script? how in script? <script src="../../scripts/jquery.ui.core.js" type="text/javascript"></script> <script src="../../scripts/jquery.ui.widget.js" type="text/javascript"></script> <script src="../../scripts/jquery.ui.mouse.js" type="text/javascript"></script> <script src="../../scripts/jquery.ui.slider.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#slider").slider(); }); </script> html: <div id="wrap"> <div id="slider"></div> <div id="slider-text"> <div id="0">zero</div> <div id="1">one</div> <div id="2">two</div>

c# - Make new row dirty programmatically and insert a new row after it in DataGridView -

i've editable unbounded datagridview. i'm changing value of new row programmatically. normally, when user types in field of new row, becomes dirty , new row inserted below it. but in case, when user comes in field of new row, i'm trapping function key , changing cell value programmatically. mygrid.currentcell.value = "xyz"; and doesn't insert new row below it. now work around tried on cellvaluechanged event handler. if (mygrid.newrowindex == e.rowindex) { mygrid.rows.insert(e.rowindex + 1, 1); } but throws error saying no row can inserted after uncommitted new row. . how tell mygrid i've made current row (which new row) dirty , there need of new row after it? i working on winforms datagridview. in case tried @isid solution, here aid in that, tried mygrid.notifycurrentcelldirty(true); mygrid.notifycurrentcelldirty(false); by making current cell dirty in not working, have commit cell also. in next command flaggi

algorithm - how to find the maximum L sum in a matrix? -

here dynamic programming problem find maximum l(chess horse - 4 item) sum in given matrix (m x n) for example : 1 2 3 4 5 6 7 8 9 l : (1,2,3,6), (1,4,5,6), (1,2,5,8), (4,5,6,9) ... and biggest sum sum(l) = sum(7,8,9,6) = 30 what o(complexity) of optimal solution ? it looks problem (submatrix maximum sum) say items positive both positive , negative any ideas welcome! if l constant size (4 elements, say), compute sum on < n*m positions , find maximum one. repeat 8 different orientations have. that's o(nm) overall.

performance - How many requests per second does libmemcached can handle? -

i hava linux server has 2g memory/ intel core 2 duo 2.4 ghz cpu, developing networking system. use libmemcached/memcache store , access packet info, want know how many requests libmemcached can handle in plain linux server ? thanks! there many things affect request rate (cpu speed, other hardware drivers, exact kernel version, request size, cache hit rate, etc ad infinitum). there's no such thing "plain linux server." since sounds you've got fixed hardware, best bet test hardware you've got, , see how performs under desired load.

javascript - jQuery drag and drop -

i'm using jquery draggable. if table in div can move div table. when there input-button in div doesnt move. why? $(".multidraggable").draggable(); doesnt work: <div class="multidraggable" style="display: inline-block;"> <input type="button" value="Отчет за &#10; контрактные сутки &#10; без ТГК &rdquo;УрГРЭС&rdquo;" id="button1" style="font-family:arial; width: 200px; height: 80px;max-height:80px;max-width:200px; font-size:15" /> </div> works: <div class="multidraggable" style="display: inline-block;"> <table id="maintable" frame="box" border="1" style="height: 565px" cellspacing="0" cellpadding="1"> <thead> <tr style="background-color:#ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png);">

PHP CodeIgniter translating special characters -

is there helper class available codeigniter translate german characters pass thme in url? for example ä = ae, ü = ue, ß=ss, ö=oe thanks in advance. pyrocms has basic character conversion improved upon: if ( ! function_exists('url_title')) { function url_title($str, $separator = 'dash', $lowercase = false) { $ci =& get_instance(); $foreign_characters = array( '/ä|æ|ǽ/' => 'ae', '/ö|œ/' => 'oe', '/ü/' => 'ue', '/Ä/' => 'ae', '/Ü/' => 'ue', '/Ö/' => 'oe', '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|А/' => 'a', '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|а/' => 'a', '/Б/' => 'b', '/б/' => 'b', '/Ç|Ć|Ĉ|Ċ|Č|Ц/' => 'c',

Restart Delphi Application Programmatically -

it should not possible run multiple instances of application. therefore project source contains: createmutex (nil, false, pchar (id)); if (getlasterror = error_already_exists) halt; now want restart application programmatically. usual way be: appname := pchar(application.exename) ; shellexecute(handle,'open', appname, nil, nil, sw_shownormal) ; application.terminate; but won't work in case because of mutex. if release mutex before starting second instace won't work because shutdown takes time , 2 instance cannot run in parallel (because of common resources , other effects). is there way restart application such characteristics? (if possible without additional executable) thanks in advance. perhaps should think outside box. instead of futzing mutex / instance logic, create another executable waits app close starts again. added bonus, can later use mechanism to, example, update of main app's binaries. it's easier run elevated instead of

android - Database to create a database -

i'm using sqlite android develop , app can customizable (for dev) in future. have created database data used create database application. if changes need made in future or write app else in future have change original database. idea behind dev's database set ui , app. i stuck on next have database need in app dev populated. idea create dbhelper class , within reference original dbhelper class , query within new db class. second dbhelper class i'm trying create database previous database: public class appdbhelper extends sqliteopenhelper { private static final string database_name = "library.db"; //database name cursor all, tables, options, ui_type; sqlitedatabase database; public appdbhelper(context context) { super(context, database_name, null, 1); dbhandler databasehelper = new dbhandler(context); database = databasehelper.getreadabledatabase(); = database.rawquery("select * config", null);