Posts

Showing posts from September, 2013

Execution of COM files in windows -

just curious how windows handles com executables. reserves first 64kb of physical memory them? if so, segment inaccessible other programs? any material on subject appreciated. you have talking old .com ms-dos executable file format. no, run in virtual machine implemented ntvdm.exe. takes advantage of virtual 8086 mode , implemented processor. execution mode emulates 16-bit 8086 processor. follow link learn more it.

windows phone 7 - How to stop ScrollViewer from Scrolling for Wp7 -

i have following xaml : <scrollviewer horizontalalignment="left" margin="3,226,0,0" name="scv" verticalalignment="top" scrollviewer.horizontalscrollbarvisibility="auto" scrollviewer.verticalscrollbarvisibility="auto" > <canvas height="100" name="canvas1" width="292" > image canvas.left="0" canvas.top="0" height="440" name="image1" stretch="fill" width="730" / > <inkpresenter name="inkpresenter1"></inkpresenter> </canvas> </scrollviewer> the problem : how stop scrollviewer scrolling after have scrolled image point wanted. in above example, use scrollviewer scroll image section want stop can use inkpresenter draw. whenever draw or down, scrollviewer follows action of inkpresenter , down movement. thanks check discussion: how block scrolling in scrollvie

java - Prevent client from overloading server? -

i have java servlet that's getting overloaded client requests during peak hours. clients span concurrent requests. number of requests per second great. should implement application logic restrict number of request client can send per second? need done on application level? the 2 common ways of handling turn away requests when server busy, or handle each request slower. turning away requests easy; run fixed number of instances. os may or may not queue few connection requests, in general users fail connect. more graceful way of doing have service return error code indicating client should try again later. handling requests slower bit more work, because requires separating servlet handling requests class doing work in different thread. can have larger number of servlets worker bees. when request comes in accepts it, waits worker bee, grabs , uses it, frees it, returns results. the 2 can communicate through 1 of classes in java.util.concurrent , linkedblocki

c# - What do you do with your old records? -

many applications accumulate binary dust -- records accumulated on time , never see light of day. our application keeps chat history, , displays last 5 days worth of such records. idea run cleanup operation after while moves old records 'history' table. history table never used, allows run internal statistics, whilst (i assume) enabling better performance on records remaining in main table. also, if build history table need replicate our tables, or there hidden ms sql function create "shadow tables" automatically. there no ms sql function create such shadow tables automagically. comes close partitioning, splits storage (fast/slow) while still keeping data in 1 table. what looking straight archive , purge. simple strategy nightly task to update static lookup tables (that primary table references) move records date < getdate()-6 history table delete records moved if table has foreign key links to other tables, find unlikely tables need pu

clearcase - Whats the easiest way to completely remove a directory element & all its sub-contents from VOB? -

what know is, using rmelem remove folder first, , cause of child elements moved lost+found . then, go lost+found , , repeatedly execute rmelem * until of elements removed. is there better way? the technote lost+found quite clear: if rmelem directory, content indeed moved lost+found , has lost+found . technote adds: note: if directory element deleted lost+found rmelem , contents moved lost+found in same manner described in first section above. that why try rmelem files first, directories , in order avoid trip (or several trips) in lost+found . except rmelem anything , same technote warns: use rmelem when deleting elements or symbolic links lost+found directory. while content of lost+found typically consists of unwanted elements , symbolic links, in circumstances can contain elements cataloged elsewhere in vob (that is, not orphaned) associated symbolic or hard links. reason, not run rmelem recursively in lost+found without first verif

linux - How do I route a packet to use localhost as a gateway? -

i'm trying test gateway wrote(see what's easiest way test gateway? context). due issue i'd rather not into, gateway , "sender" have on same machine. have receiver(let's 9.9.9.9) gateway able reach. so i'll run application ./sendstuff 9.9.9.9 send packets ip address. the problem is: how packets destined 9.9.9.9 go gateway on localhost? i've tried: sudo route add -host 9.9.9.9 gw 127.0.0.1 lo sudo route add -host 9.9.9.9 gw <machine's external ip address> eth0 but neither of pass packets through gateway. i've verified correct ips present in sudo route . can do? per request, here route table, after running second command(ip addresses changed match question. x.y.z.t ip of machine i'm running on): destination gateway genmask flags metric ref use iface 9.9.9.9 x.y.z.t 255.255.255.255 ugh 0 0 0 eth0 x.y.z.0 0.0.0.0 255.255.254.0 u 0 0

facebook - display content using js if function on fbml -

im trying build fbml client has live stream functionality 9-5 only, out of time want image informing user of time come , participate in live stream. i've tried achieve using javascript if function doesnt seem working, appreciated, code below: 9 && time"); } else if (time>18 && timesorry come @ 9 am!"); } //--> i think facebook not alow javascript in fbml application. have use fbjs instead of javascript. from facebook fbml enables build facebook applications integrate user's facebook experience. use javascript within fbml, use fbjs.

How to receive UDP broadcasts with PHP -

i trying receive repeated udp broadcast php , display on webpage on local host. how accomplish this? i have daemon or server process running responsible receiving udp broadcast , appending either file or database (this implemented in language). have php page either reads file or queries database results , echoing results on page. if you're looking live updates, i'd adding jquery/ajax scripting magic.

android - tabStripEnabled for TabWidget in Older API's -

android 2.2 i.e api level 8 has tabstripenabled="true" tabwidget how achieve same in older versions of android? private void setuptabs(tabhost tabhost) { linearlayout ll = (linearlayout) tabhost.getchildat(0); tabwidget tw = (tabwidget) ll.getchildat(0); field mbottomleftstrip; field mbottomrightstrip; try { mbottomleftstrip = tw.getclass().getdeclaredfield("mbottomleftstrip"); mbottomrightstrip = tw.getclass().getdeclaredfield("mbottomrightstrip"); if (!mbottomleftstrip.isaccessible()) { mbottomleftstrip.setaccessible(true); } if (!mbottomrightstrip.isaccessible()) { mbottomrightstrip.setaccessible(true); } mbottomleftstrip.set(tw, getresources().getdrawable(r.drawable.blank)); mbottomrightstrip.set(tw, getresources().getdrawable(r.drawable.blank));// blank name of image in drawable folder } catch (java.lang.nosuchfielde

Select/Case in Crystal Reports -

i'm trying have crystal reports run through select statement keeps on dropping out after hitting first match instead of continuing on through each case. how can evaluate each condition on it's own merits instead of automaticaly breaking after finding first match? example local numbervar varnumber := 0; select 7 case <= 1: varnumber := varnumber + 1 //only gets here case <= 2: varnumber := varnumber + 1 case <= 3: varnumber := varnumber + 1 case <= 4: varnumber := varnumber + 1 case <= 5: varnumber := varnumber + 1 case <= 6: varnumber := varnumber + 1 case <= 7: varnumber := varnumber + 1 end select varnumber value should 7 end of select statement each condition should have evaluated true, stops after hitting first case, resulting in varnumber being 1, have break statement tell stop falling through each case statement, isn't hap

asp.net - Adding Text to Windows Integrated Authentication Dialogue Box -

is there way change content of windows integrated authentication dialogue box? want add text it. afaik there no way change dialog box. might differ among browsers well. use forms authentication if want customize login screen.

entity framework - What is the purpose of .edmx files? -

what purpose of .edmx files? reading csdl, ssdl, , msl specifications, looks me .edmx files used @ design time. meant distribute other edmx? seems need distribute .ssdl and/or .csdl files instead. edmx visual studio's "container" things entity data model. it contains information in csdl, ssdl, msl, plus information visual layout of tables in visual studio designer surface. the edmx file converted csdl, ssdl, msl (typically embedded resources in assembly) during build process. don't have distribute or copy edmx files anywhere app run. update: if more interested in code-based approach, should check out code-first ctp entity framework gets without .edmx, .csdl/ssdl/msl files @ all.

full text search - Java-Counting occurrence of word from huge textfile -

i have text file of size 115mb. consists of 20 million words. have use file word collection, , use search occurrence of each user-given words collection. using process small part in project. need method finding out number of occurrence of given words in faster , correct manner since may use in iterations. in need of suggestion api can make use or other way performs task in quicker manner. recommendations appreciated. this kind of thing typically implemented using lucene , if going restarting application repeatedly or don't have oodles of memory. lucene supports lots of other goodies too. however, if wanted "roll own" code, , have enough memory (probably 1gb), application could: parse file sequence of words, filter out stopwords, build "reverse index" hashmap<string, list<integer>> , string values unique words, , list<integer> objects give offsets of words' occurrences in file. it take few seconds (or minutes)

javascript - Differences between detach(), hide() and remove() - jQuery -

what functional difference between these 3 jquery methods: detach() hide() remove() hide() sets matched elements' css display property none . remove() removes matched elements dom completely. detach() remove() , keeps stored data , events associated matched elements. to re-insert detached element dom, insert returned jquery set detach() : var span = $('span').detach(); ... span.appendto('body');

php - does this code guarantee a Unique id -

i'm trying create unique id that's random. solution suggested, i'm not if it's guaranteed they'll unique. function uid($n) { $id_part = base_convert($n, 10, 36); $rand_part = str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789'); return sprintf("%05s%.15s", $id_part, $rand_part); } the code uses unique id database auto-incremented id (that's $n input i'm guessing), fill characters added. gives supposedly "unique" 5 chars base-36 primary id + 15 rubbish chars. can confirm if result indeed unique ids or not. to answer question, doing exactly. need give users unique id, doesn't directly equal user id in database. way user 1 not know registered before user 2, each user still has have unique "front id". you can try inbuilt functionalities : http://php.net/manual/en/function.uniqid.php http://php.net/manual/en/function.com-create-guid.php depends how uniqueness want have

c# - Unable to create a manifest resource name error in Visual Studio 2008 -

i've created form1.cs in windows forms application, , there's file form1.resx. whenever try run application, i'm getting following error: unable create manifest resource name "....\gg\form1.resx". not find file 'c:\documents , settings\administrator\desktop\gg\form1.cs'. could please tell me reason, , how can overcome problem? your .csproj corrupted. need manually edit it. form, there must 3 entries: <compile include="myform.cs"> <subtype>form</subtype> </compile> <compile include="myform.designer.cs"> <dependentupon>myform.cs</dependentupon> </compile> <embeddedresource include="myform.resx"> <dependentupon>myform.cs</dependentupon> <subtype>designer</subtype> </embeddedresource>

php - How to include excerpt in ul from different pages with the same parent - Wordpress -

i wish title, excerpt , meta 3 different pages have same parent. i not wish specify wich 3 pages show rather show 3 last edited/published. i aim display content 3 blocks on horizontal line. as unable code work: <ul id=""> <?php query_posts("posts_per_page=1&post_type=page&post_parent=4"); the_post(); ?> <li> <img src="<?php echo get_post_meta($post->id, "image", true); ?>" alt="<?php the_title(); ?>" /> <h2><?php the_title(); ?></h2> <?php the_excerpt(); ?> </li> </ul> thank dan, still not work though. excrept of first page not show (the title shows , meta also). tried code below same result except second time content displayed, excerpt of first page shows. <?php get_header(); the_post(); ?> <div id="main-content"> <?php $categoriescf = get_post_meta($post->id, "categories", true); $allcategories = e

ajax - How to assign the value of the variable in JavaScript function into a Mason variable? -

i getting window.location.href property on click of button on client side in javascript variable. requirement send server. how can javascript variable value in mason code? one option (which have implemented currently) dynamically create hidden text field value set window.location.href , , form submit. how can use ajax here? looking ajax solution, how different form.submit() . the whole point of problem javascript variable available js interpreter in browser , not server side script. need somehow variable contents , send server. can done either via form (which @ least reload page) or xhr (main technology behind ajax). i never did xhr directly, using dojo framework can like: dojo.xhrpost( { handleas: "json", url: "http://example.com/whatever", content: { "data_url" : window.location.href } });

c# - How to turn off persistent proxy connections -

this follow on this question on how turn of connection: keep-alive headers on httpwebrequest . i have disabled connection: keep-alive headers web service call, when use proxy sends connect xxx.xxxxx.xx:443 http/1.1 proxy before call sent server. with connect call bunch of headers sent: system.net information: 0 : [5420] connectstream#33166512 - sending headers { proxy-authorization: basic xxxxxxxxxxxxxxx== host: xxx.xxxxx.xx proxy-connection: keep-alive }. i want rid of keep-alive , change close cannot find out how control header. how change or disable proxy-connection header? edit: googleing around figured have set webrequest.connection = "close"; or webrequest.connection = null; , results in argument exception. appareantly not possible change proxy-connection header. the result trying achieve (close tcp connection proxy before load-balancer between client , proxy kills after 2 minutes of inactivity) realized setting servicepointman

php - Finding out the day -

i want find out day of week based on databese date entry. for example: suppose fetch value database 03-03-1988 , want print day monday or tuesday. how can calculate that? thanxx in advance.. you can in mysql like select dayofweek(date) weekday mytable returns weekday index date (1 = sunday, 2 = monday, …, 7 = saturday).

php - Get complete file path from an array -

i have array (which comes specific function : list , filter files of directory on extension) : array ( [dir_test] = array ( [dir_client] = array ( [0] = index.html ) [0] = index.html ) ) and like. note : directory have way more subdirs. array ( [0] = dir_test/dir_client/index.html [1] = dir_test/index.html ) thx ;) assuming input data looks this: $arr = array( 'dir_test' => array ( 'dir_client' => array ( 0 => 'index.html' ), 0 => 'index.html' ) ); the easiest solution recursive one, like: function add_dir($dir) { global $dirs; $dirs[] = $dir; } // pathsofar should end in '/' function process_dir($dirarray, $pathsofar) { foreach ($dirarray $key => $value) { if (is_array($value)) { process_dir($value, $pathsofar . $key . '

embedded - Programmable usb host to host controller -

further this question, i'm looking device allow me connect 2 usb hosts, while still being programmable. can following: masquerade arbitrary usb device take input pc , nothing pass on other host. i've been looking microcontroller (preferably pre-assembled) allow me this, have far come blank. know of controller (preferably cheap) allow me this? take input pc , nothing pass on other host. this non-sensical usb perspective. usb host-based protocol: device never send data unless host requests first. keep in mind here, 'host' , 'device' have specific meanings here within protocol itself; can think of 'host' master , 'device' slave. these roles baked usb controller. there no way convince standard usb controller in given pc or peripheral swap roles. there add-in cards pcs usb device controllers (making pc act device), 'cheap' not word use describe them. what trying create usb device device bridge. so, alright, need hav

xml - HTML form with zend fm -

http://pastebin.com/xrzbvwse so, have textarea input has spaces @ beginning. press submit button, goes through php , echos same stuff again input correction. so, if have had 3 spaces have 2. , if press button again, im getting 1. on each button press, deletes me 1 space. dont trim anywhere. why that? easy solution att "\n" xmldata i'd know problem is. most problem not code. appears how textarea input fields work, i.e. ignore first empty line (have at, e.g. here , here or here ) 1 possible workaround add &nbsp; first empty line, rather have empty, or add \n suggested.

Rails Will Paginate problem -

i´m paginating will_paginate plugin. i have popup adds @products when user clicks button add via ajax request. note: @products paginated in ajax request update product-list : ids = params[:accessories][:id].join(" , id <> ") @products = product.find_by_sql("select * products id <> #{ids}") however if use: @products = product.find_by_sql("select * products id <> #{ids}").paginate it returns identical array. so how paginate array again? why using find_by_sql method? may can write this: ids = params[:accessories][:id].join(",") @products = product.paginate(:page => params[:page], :conditions => ["not (id in (?))", ids]) also conditions can move product model , replace scope(rails 3) or named_scope(rails 2).

jquery - why is the code providing multiple option for the child1 radiobuttons ??? i dont want that -

html: <input type="radio" id="chkmain" name="chkmain"/> <input type="radio" id="chkmain1" name="chkmain" /> <input type="radio" id="chkmain2" name="chkmain" /> <input class="child" type="checkbox" id="chk1" disabled="true" /> <input class="child" type="checkbox" id="chk2" disabled="true" /> <input class="child" type="checkbox" id="chk3" disabled="true" /> <input class="child" type="checkbox" id="chk4" disabled="true" /> <input class="child" type="checkbox" id="chk5" disabled="true" /> <input class="child" type="checkbox" id="chk6" disabled="true" /> <input class="child" type="checkbox

java - How to filter string for unwanted characters using regex? -

basically , wondering if there handy class or method filter string unwanted characters. output of method should 'cleaned' string. ie: string dirtystring = "this contains spaces not allowed" string result = cleaner.getcleanedstring(dirtystring); expecting result be: "thiscontainsspaceswhicharenotallowed" a better example: string reallydirty = " this*is#a*&very_dirty&string" string result = cleaner.getcleanedstring(dirtystring); i expect result be: "thisisaverydirtystring" because, let cleaner know ' ', '*', '#', '&' , '_' dirty characters. can solve using white/black list array of chars. don't want re-invent wheel. i wondering if there such thing can 'clean' strings using regex. instead of writing myself. addition: if think cleaning string done differently/better i'm ears of course another addition: - not spaces, kind of character. edit

c - Left shifting with a negative shift count -

what happens here? a << -5 obviously doesn't right shift. book i'm reading states: on 1 machine, expression left shift of 27 bits my question is; why? causes left shift of 27 bits? , happens when shifting negative shift count? thank you. negative integers on right-hand side undefined behavior in c language. iso 9899:1999 6.5.7 bit-wise shift operators §3 the integer promotions performed on each of operands. type of result of promoted left operand. if value of right operand negative or greater or equal width of promoted left operand, the behavior undefined .

Linq - How to construct this query without the 'join' keyword? -

i have following partial linq query: var query = ri in routeinstance join rir in routeinstancerules on ri.routeinstanceid equals rir.routeinstanceid join rl in routinglocation on rir.routinglocationid equals rl.routinglocationid join rlh in routinglocationhistory on rl.routinglocationid equals rlh.routinglocationid rlh.routetakentime >= new system.datetime(2011,2,4) && rlh.routetakentime <= new system.datetime(2011,2,5) there 1:m relationship between routeinstance , routeinstancerules there 1:m relationship between routeinstancerules , routinglocation there 1:m relationship between routinglocation , routinglocationhistory since these relationships enforced using fks , therefore known l2s, should able construct query without using 'join' keyword. but, stumped how it. thanks. you want routeinstances in end? if so: var query = datacontext.routinglocationhistory .where(rlh => rlh.routetakentime >=

.net - How can a thread use less than 100% wall time? -

when profiling application (using dottrace), noticed strange thing. used "wall time" measurement, should in theory mean threads run same amount of time. but wasn't true: threads (actually interested in) displayed total time 2 times less others. example, profiling ran 230 seconds, most threads report 230 seconds spent in thread, 5 threads show 100-110 seconds. these not threadpool threads, , created , started before profiling started. what going on here? update i'll add more info may or may not relevant. application in question (it game server) has 20-30 running threads. threads follow simple pattern: check incoming queue work, , work if there some. code thread func looks this: while(true){ if(trydequeuework()){ // if queue not empty dowork(); // whatever on top }else{ m_waithandle.waitone(maxtimeout); // m_waithandle gets signaled when work added queue } } the threads display weird times this, except serve multiple q

php - Store value from SELECT statement into variable -

how can store value select mysql statement php variable? example: $myvariable = select * x id = x thanks you need @ php manual mysql/mysqli wrapper functions. http://us3.php.net/manual/en/book.mysql.php http://us3.php.net/manual/en/book.mysqli.php if code provided written proper syntax (you need single/double quotes around string literals in php) variable contain sql query string. need send database via kind of wrapper. you may wont search around general php , php/mysql tutorials.

mysqli - Problem querying MySQL DB with PHP using MAMP (on Mac) -

i'm having problem querying mysql db php i'm using mamp 1.9.4 on mac os 10.6.6 the connections seems work $dbc = mysqli_connect('localhost', 'root', 'password', 'dbname') or die('error connecting mysql server.'); but whenever run query die error... $query = "insert table_name (first_name, last_name) values ('john', 'doe')"; $result = mysqli_query($dbc, $query) or die('error querying database.'); any ideas?? mamp? don't die fixed error message are. that's useless, equivalent of saying "something happened!" instead, try: $result = mysqli_query(...) or die("mysql error: " . mysqli_error()); which spit out exact reason there problem.

jQuery 1.5: Why is Deferred object calling .done() in UNRESOLVED state? -

i've created test page mimics problem getting on actual page. as can see in dosomething2() , dfd object deliberately never resolved. however, when run following code, .done() in dosomething() fires. inspecting console, see dfd.isresolved() false right before .done() runs. any insights? appreciated <!doctype html> <html> <head> <title>testing page</title> <script src="jquery-git-02092011.js" type="text/javascript"></script> </head> <body> <div id="test"> <div ></div> <div ></div> </div> <script> function dosomething() { $('#test div').each(function(){ $(this).append($('<div></div>').load('http://www.google.com',function(){ dosomething2().done(console.log('dosomething2 complete'));

http - nginx upload client_max_body_size issue -

i'm running nginx/ruby-on-rails , have simple multipart form upload files. works fine until decide restrict maximum size of files want uploaded. that, set nginx client_max_body_size 1m (1mb) , expect http 413 (request entity large) status in response when rule breaks. the problem when upload 1.2 mb file, instead of displaying http 413 error page, browser hangs bit , dies "connection reset while page loading" message. i've tried every option there nginx offers, nothing seems work. have ideas this? here's nginx.conf: worker_processes 1; timer_resolution 1000ms; events { worker_connections 1024; } http { passenger_root /the_passenger_root; passenger_ruby /the_ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.x.com; client_max_body_size 1m; passenger_use_global_queue on; root /the_r

python - Which of the three installed PyQt DLL directories do I want? -

i've tried installing python , qt several times keep running same problem: examples included in pyqt4 installation fail run. in latest attempt used instructions found here , , installed python 3.1.3 , pyqt 4.8.3 python 3.1, 32-bit versions. i'm running winxp sp3 on dell m65 (t7200, 2gb ram). my installation directories are: c:\python31 , c:\qt\2010.05 (both of these defaults respective install programs.) after attempting run score.py c:\python31\lib\site-packages\pyqt4\examples\demos\qtdemo directory received following error: traceback (most recent call last): file "c:\python31\lib\site-packages\pyqt4\examples\demos\qtdemo\score.py", line 43, in colors import colors file "c:\python31\lib\site-packages\pyqt4\examples\demos\qtdemo\colors.py", line 45, in pyqt4 import qtgui importerror: dll load failed: specified procedure not found. there several answers provided similar error message in this stackoverflow question , none of

sql - Oracle order by upper(colname) does not give proper results for non string columns -

when there non-string(i.e. : varchar,date) column(col1) in oracle db, if do: select * table order col1 asc it orders properly. (ie. date, orders oldest latest, numeric, lowest highest) if do, select * table order upper(col1) asc ordering not correct. what cause behavior? upper takes string , returns string. if col1 other string, have implicitly cast string before function executed. since output of upper function string, however, sort have use string sorting semantics, not sort semantics of col1 . if col1 numeric, example upper(9) returns string '9' upper(10) returns string '10' the string '9' comes alphabetically after string '10' is, presumably, problem you're seeing. but if col1 not string, why bother converting upper case in order sort?

ruby on rails - Paperclip DB storage: Attachments go in, but don't come out -

irb(main):001:0> e = event.last => #<event id: 7, address: "123 main st", start_date: "2011-02-09", start_time: "2000-01-01 14:49:00", title: "test event", poster_file: "\377���jfif\000\001\002\000\000d\000d\000\000\377�ducky\000\001\000\004\000\000\0002\000\000\377�!adobe\000d�...", poster_thumb_file: nil, created_at: "2011-02-09 14:49:45", updated_at: "2011-02-09 14:49:45", poster_file_name: nil, poster_content_type: "image/jpeg", poster_file_size: 134218, poster_updated_at: "2011-02-09 14:49:44"> irb(main):002:0> e.poster.url => "/posters/original/missing.png?1297262984" i using fork of paperclip gem pat shaughnessy . have tried, , gotten same problem fork found here , pretty sure me doing stupid. app hosted on heroku. followed the instructions of person forked paperclip , tried adapt them rails 3. route poster looks this: resources :events member :pos

ruby on rails - find all that are nil in the association -

so have post , user. post has_many users , user belongs_to post. need find find posts dont have users following: post.first.users => [] post.where("id not in (select post_id users)")

floating point - Scope of MXCSR control register? -

i'm wondering lifetime of value stored in mxcsr control register (including ftz , daz config denormal floating-point numbers): in scope of thread, or common processing on cpu/fpu? what want know if need set (mxcsr) @ needs @ beginning of each thread of thread pool, or once in app, or impact else in app and/or system? thanks help! yes of course, must set mxcsr register @ beginning of each thread. thread can have own mxcsr settings, essential feature.

vb.net - Object variable or With block variable not set -

i trying figure out why of sudden error when trying run program. following code below error is: <global.microsoft.visualbasic.compilerservices.designergenerated()> partial class frmpm the error highlighted on frmpm: error occurred creating form. see exception.innerexception details. error is: object variable or block variable not set. i've made sure there end class @ end of doesn't seem problem. what else cause worked fine 1 run not on down road? thanks! david ah, seems though creating bad object @ run time in sub calling when first started. though odd have type of error after commented out, seemed work fine. :o)

c# - I can only close a form once, InvalidOperation Exception Invoke or BeginInvoke cannot be called on a control until the window handle has been created -

hi i'm opening form main form when user makes selection of menu item. private void commtoolstripmenuitem_click(object sender, eventargs e) { command_form command_form1 = new command_form(); command_form1.showdialog(); // command_form1.dispose(); didn't } inside form "command_form1" close when user clicks on close button private void close_button_click(object sender, eventargs e) { this.close(); //i exception here } this process works fine once on second closing of form (which hope different/new instance of form) error in title of post. output in debug window. a first chance exception of type 'system.invalidoperationexception' occurred in system.windows.forms.dll all topics list error go on not trying form has not been displayed happens when click on button in form. seem me pretty ensures form has been displayed if i'm able click button. the other posts

jrubyonrails - Question testing rails post -

using rails 3.0.3. i have following route in routes.rb: match "user/create_new_password/:reset_password_key" =>"users#create_new_password", :via=>[:get, :post], :as=>:create_new_password when using route in view, form, works ok, i'm not able test it. i'm doing in functional test: test "fail create password invalid key" post :create_new_password, {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user.reset_password_key"} end and i'm getting error: actioncontroller::routingerror: no route matches {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user.reset_password_key", :controller=>"users", :action=>"create_new_password"} what's wrong here? so, problem in parameter value :reset_password_key test &quo

sql server ce - Unable to open SQL CE 4 databases in VS 2010 SP1 -

according "the gu", in vs 2010 sp1 (http://weblogs.asp.net/scottgu/archive/2011/01/11/vs-2010-sp1-and-sql-ce.aspx) should able open sql ce 4 databases. however, when try following error: "the data provider required connect local data file not found. file added project typed dataset associated file not generated" followed error: "the operation not completed" note asp.net mvc project. there limitations in sql compact 4 provider tooling, described here (under scenarios not enabled sql server compact 4.0) - http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx in addition service pack, must install sql server compact 4 tools on top - http://erikej.blogspot.com/2010/12/visual-studio-tools-for-sql-server.html

python - How to wait until MySQLdb cursor finish running all queries -

i trying run following code: with open('file.sql') sqlfile: sql = sqlfile.read() cursor.execute(sql) file.sql contains sql queries initialize db. however code finishes working before queries proceed. proceed in few seconds after script finish working. how can wait until queries proceed? that's case. execute() command waits command executed before passing next line of code in script. that means code won't continue before cursor.execute() finishes execution. your assumptions wrong. assume you're getting error in sql execution, , that's causes sql skipped. for one, cursor.execute() can't run multiple sql statements, have split file multiple statements , call cursor.execute() multiple times, 1 each statement. please remove try / except clauses might hiding errors code above, , provide full error traceback you're getting, if that's not case.

asp.net mvc - How do I manually lookup a route in the RouteTable MVC.Net? -

this question has answer here: how routedata url? 2 answers i have string inside action of 1 of controllers represents referring url. current request's route data not i'm looking (because being called script tag inside view). i want find action , controller referring url. is there way can manually use string "/product/23" find controller , action string url produce? i blogged doing exact thing couple weeks ago: creating routedata instance url

javascript - How to capture html frame as an image -

i need open webpage python , capture see in browser image(or rather should seen, because want execute in background). webpage contains javascript - 1 frame has caption dependent on script evaluation , want captured. it's feasible, @ least, using pyqt + qwebkit (an example here , here ).

jsf 2 - NPE in UIComponentBase#getRenderer() after migration from JSF 1.2 to JSF 2.0 -

i migrated web application jsf 1.2 jsf 2.0. logout page working in previous version throws nullpointerexception in jsf 2.0. rest of things working expected. below stack trace: java.lang.nullpointerexception @ javax.faces.component.uicomponentbase.getrenderer(uicomponentbase.java:1268) @ javax.faces.component.uicomponentbase.decode(uicomponentbase.java:788) @ org.ajax4jsf.component.ajaxviewroot$1.invokeroot(ajaxviewroot.java:396) @ org.ajax4jsf.component.ajaxviewroot.processphase(ajaxviewroot.java:229) @ org.ajax4jsf.component.ajaxviewroot.processdecodes(ajaxviewroot.java:409) @ com.sun.faces.lifecycle.applyrequestvaluesphase.execute(applyrequestvaluesphase.java:78) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118) @ javax.faces.webapp.facesservlet.service(facesservlet.java:312) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilte

silverlight - How do you refresh your ViewModel when navigating back using MVVM -

when navigating using button on phone how can refresh viewmodel? i'm using button on phone believe same calling navigationservice.goback(), navigates previous page on stack constructor not called in view or viewmodel. you can hook in base page class onnavigatingto event , call method on viewmodel. don't have vs me pseudo-code be: in mybasepage : page public void onnavigatingto(object sender, eventargs e) { var vm = this.datacontext baseviewmodel; if(vm != null) { vm.initialize(); } } you can same before leaving page: public void onnavigatingfrom(object sender, eventargs e) { var vm = this.datacontext baseviewmodel; if(vm != null) { vm.save(); } }

sql server - Is there any way to put an invisible character at beginning of a string to change its sort order? -

is there way put non printing or non obtrusive character @ beginning of string of data in sqlserver. when order by performed, string sorted after letter z alphabetically? i have used space @ beginning of string string @ top of sorted list, looking similar put string @ end of list. i rather not put field such "sortorder" in table use order sort, , rather not have sort list in code. added: yes know bad idea, mentioning it, still, curious if asking can done since no 1 venturing answer question properly, here's answer given: adding <space> other data make them appear top solution: add char(160) make appear @ bottom. in reality space, designed computer systems not treat word break (hence name). http://en.wikipedia.org/wiki/non-breaking_space your requirements: without adding field such "sortorder" table without sorting list in code i think fits! create table my(id int,data varchar(100)) insert select 1,'banana'

javascript - Execute stringByEvaluatingJavaScriptFromString before click event -

i using uiwebview in iphone , loaded 1 html page resources. following html page code: <html> <head> <title></title> <script language="javascript"> function callme(id) { var input = 'input'+id; document.getelementbyid(input).value = document.getelementbyid('code').value; } </script> </head> <body> <input type=hidden id='code' name='code'> <a href="#" id="click1" name="click1" onclick='callme(1);'>click1</a> <input type="text" id="input1" name="input1"> </br> <a href="#" id="click2" name="click2" onclick='callme(2);'>click2</a> <input type=text id="input2" name="input2"> </br> <a href="#" id="click3" name="click3" onclick='callme(3);'>click3</a> <in

pdf generation - How to create PDFs from online forms using a service like Wufoo or Formstack? -

i'm developing site multipage forms client needs complete. forms standard legal agreements additional fields concerning height, weight, etc. idea once forms filled out, need printed out of legal information included, not fields themselves. i've found companies (wufoo, formstack, &c.) provide secure online form creation, i'm having trouble finding 1 allows form fields parsed formatted document (be html, pdf, or what-have-you). suggestions? you can use webmerge automatically generate pdf documents data collected online. formstack has direct integration webmerge , can use web hooks other services automatically send data create pdfs.

Javascript: Disable Style Pasting -

i'm building simple wysiwyg editor iframe desig mode on . my problem when paste text in editor brings style of text font size, font family, color etc... is there way disable predefined javascript functions? , what's best solution this? please no libraries, pure javascript! :) i once read editors change focus regular textarea, contents pasted there (format gets lost), , plain text copied editor.

internet explorer - Artifacts when Fading problem with IE and Jquery -

open site in ie8 (not sure 7) http://www.koffeebreak.info/ see how main div fades in gets black artifacts on it? i found fix on stackoverflow question: fading issues in internet explorer 7 when using jquery but when applied it: jquery("#homepagewelcome").children().fadeto('fast', 1, function(){ document.getelementbyid("#homepagewelcomecontent").style.removeattribute("filter"); }); nothing happens. ideas? try $("#homepagewelcomecontent")[0].style.removeattribute("filter");

seam - Default column for sorting in richfaces -

i have following environment: seam 2.2.0 ga default richfaces version. how define default column (field) datatable sort records field? tried setting default value "sort" parameter in .page.xml file didn't help. in addition, entitylist.java returns null when system.out.println(this.getordercolumn()); mean sorting happens @ client side? if so, why entitylist() called each time re-sort list? thank you i think entitylist class must extend entityquery, can add these 2 lines in constructor of entitylist: setordercolumn("yourentity.property"); setorderdirection("asc"); or add 1 line: setorder("yourentity.property asc"); i know hard-coded, bad works. if has better way, please share us. thanks.

html - Why doesn't this DIV expand to the width of the children -

i having issue , wondering why containing div not expand width of big table? <html> <head> <link rel="stylesheet" href="http://www.blueprintcss.org/blueprint/screen.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="http://www.blueprintcss.org/blueprint/print.css" type="text/css" media="print" /> <!--[if lt ie 8]><link rel="stylesheet" href="http://www.blueprintcss.org/blueprint/ie.css" type="text/css" media="screen, projection" /><![endif]--> <style type="text/css"> div.add-padding { padding: 15px; background-color: red; } table { background-color: blue; } </style> </head> <body> <div class="add-padding"> <table>

c# - Cannot Write to the Registry under HKEY_LOCAL_MACHINE\Software -

i'm writing application needs create special user account hidden login screens , control panel users applet. writing dword value of 0 user name registry key below, i'm able accomplish goal: hkey_local_machine\software\microsoft\windows nt\currentversion\winlogon\specialaccounts\userlist the problem under windows 7 uac on, no matter try, cannot programmatically write value key above. it understanding writing keys not allowed on windows 7 uac on, unless running administrative privileges. i've added application manifest requestedexecutionlevel level="requireadministrator" uiaccess="false" , accept uac prompt when program run, account member of administrators, yet still unable write above registry key. what more need do? how possible, in application configuration, write keys , values under hkey_local_machine\software ? further information ... when program runs, no errors thrown , seems write values. guess windows virtualizing location wr

php - Check whether MySQL record exists based on 2 parameters -

i'm creating php system needs check whether record exists. i'm fine checking whether record exist matches single column: mysql_query("select * articles s_id = '$myvar'") however, want see whether there exact match 2 columns in database (a_id , s_id), while ignoring match of 3rd column. any ideas on how check match on 2 parameters exist? thanks taking - feel free ask clarifications. mysql_query("select * articles s_id = '$myvar' , a_id= '$myvar2'")

c++ - std::vector not retaining data? -

i have code: void baseobj::update(baseobj* surround[3][3]) { forces[0]->apply(); //in place of loop cout << forces[0]->getstrength() << endl; //forces std::vector of force* } void baseobj::addforce(float str, int newdir, int lifet, float lifelength) { force newforce; newforce.init(draw, str, newdir, lifet, lifelength); forces.insert(forces.end(), &newforce); cout << forces[0]->getstrength(); } now, when call addforce , make infinite force strength of one, cout's 1. when update called, outputs 0, if force no longer there. you storing pointer force in vector force function local. you must use new create in on heap. force* f = new force; forces.push_back(f);

c# - NEED SUGGESTION: How to write a Microsoft Outlook Add-In that can select multiple GROUPS(folders) of contacts all at once? -

i'm trying write outlook 2007 add-in can let me select multiple groups(folders) of contacts send e-mails recipients @ once. my outlook contacts grouped several folders(groups). default, microsoft outlook not have functionality let users send e-mails groups of contacts choosing “select all” function menu @ once. instead, outlook allows select multiple contacts within 1 folder. any idea how/where can started? have looked msdn site ( outlook solutions visual studio ) not know how begin? or other tutorial/reference website can use reference? after selection groups wish email... in outlook 2007 can use icon "new message contact" ( following delete button in commandbar ). can use menubar (actions->create->new message contact). in outlook 2010, can click "email" under home->communicate ribbon group.

apache - .htaccess rule not catching -

i'm trying catch http://mysite.loc/orders/invoice/?id=asdf , redirect it, it's not catching. have ideas on might've missed? rewriteengine on rewriterule ^orders/invoice?id=([^/]+)$ /store/order/view?hash=$1 [r=301,l,nc] rewrite rules act on request uris. query string (the question mark , after it) not part of uri can't write pattern match it. try this: rewriteengine on rewritecond %{query_string} id=(.*) rewriterule ^orders/invoice /store/order/view?hash=%1 [r=301,l]

Iterate Through Dynamic tags and populate using jquery -

i have far... <script type="text/javascript"> $(document).ready(function () { $('ul').addclass('navmenu'); $('li').addclass('todo').html("<span class='navitemhead'></span>"); $('span.navitemhead').wrap("<a href='/my/website'></a>"); }); </script> i have 4 names want put name tag mary,nick,matt,meg , 1,2,3,4 in span tag, final html should read..... <li class="todo "> <a href="/register/website"><span class="navitemhead">1</span>mary</a> </li> <li class="todo "> <a href="/register/website"><span class="navitemhead">2</span>nick</a> </li> ....etc var names = ['mary', ...]; $('li').addclass('todo').html(function (i) { return "<a

Multiply large numbers in objective-c -

i have tried multiply large integers (also tried double) in xcode. used nslog track errors in calculation (simple calculations) , noticed when multiply variables large values such (i looked them nslog): 31536000 * 91 = 2869776000 1610612736, wrong. do wrong? /d what type of data use numbers? if nsinteger, or that, it's close standard int, has limitation. for example, on standard 64 bits architecture can declare long long int permits have 64 bits integer. if multiplication requires more place, left bits may truncated, changes result. you use long double, permits handle 80 bits numbers extended double precision, still loose precision on big numbers.

php - Drupal's ticketyboo module - limit results -

i'm using ticketyboo module drupal , i'm trying module pick last 3 node items. module doesn't have function built in this. the module php code follows; // build ticker contents switch ($selection) { case 'node': $nodes = explode(',', $nodes); break; case 'type': $r = db_query("select distinct nid {node} type ='%s'", trim($nodes)); $nodes = array(); while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];} break; case 'taxonomy': $r = db_query("select distinct nid {term_node} tid in (%s)", $nodes); $nodes = array(); while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];} break; } $ret = ''; $i=0; foreach ($nodes $nid) { $node = node_load(trim($nid)); if ($i > 0) { $ret .= '<div style="'.$pad_style.'"></div>

asp.net - MVC2 Futures conflicting with existing System.Web.Mvc -

i downloaded mvc2 futures , referenced current mvc2 project. however, if want call htmlhelper mvc2 futures need <%@ import namespace="microsoft.web.mvc" %> so decided add on web.config: <pages> <namespaces> <add namespace="system.web.mvc" /> <add namespace="system.web.mvc.ajax" /> <add namespace="system.web.mvc.html" /> <add namespace="system.web.routing" /> <add namespace="microsoft.web.mvc" /> <add namespace="xpedite.mvc.html" /> </namespaces> </pages> but, caused me errors. assemblies co-exist? if yes, how? i'm pretty sure need mvc3 futures pack: http://aspnet.codeplex.com/releases/view/54306 the mvc2 future made work against mvc1. had same issue , upgrading next futures release solved me.

Silverlight: Is there a way to indicate to the DataContractSerializer that a class is non-Serializable? -

is there way indicate datacontractserializer class non-serializable? you add method throws exception saying "don't serialize me" , decorate onserializingattribute .

arrays - C code to convert hex to int -

i writing code convert hex entry integer equivalent. 10 , b 11 etc. code acts weirdly, in seg. faults @ random locations , including newline character @ times work. trying debug it, can understand doing wrong here. can take , me here ? lot time. /* fixed working code interested */ #include <stdio.h> #include <stdlib.h> unsigned int hextoint(const char temp[]) { int i; int answer = 0; int dec; char hexchar[] = "aabbccddeeff" ; ( i=0; temp[i] != '\0'; i++ ) { if ( temp[i] == '\0') { return ; } if (temp[i] == '0' || temp[i] == 'x' || temp[i] == 'x' ) { printf("0"); answer = temp[i]; } // comp

JavaScript: ActiveXObject MSXML2.XMLHTTP is not returning XML on succesful loads...? -

i trying write internet explorer 8 solution loading xml through 'file' protocol, since site building intended sent packages directly users. have experienced in attempting use xmlhttprequest handle seems support i've read online: ie8's xmlhttprequest implementation dislikes protocol, have use activexobject handle loading. i have experimented various people's suggestions, , have code appears obtaining file, responsetext field filled contents of file. however, responsexml.xml field supposed hold xml (or text representation of it, none of documentation i've read has been clear) empty string. how can configure activexobject load xml properly? as bonus, explain how supposed use loaded xml once loading successfully? have yet find documents explain bit. here javascript: function isie() { return navigator.useragent.lastindexof('trident') > 0; } // block ensures xml request occurs in same domain. var path = document.location.href; path = p

integer arguments for c++ -

i have sort of calculator in c++ should accept arguments when executed. however, when enter 7 argument, might come out 10354 when put variable. here code: #include "stdafx.h" #include <iostream> int main(int argc, int argv[]) { using namespace std; int a; int b; if(argc==3){ a=argv[1]; b=argv[2]; } else{ cout << "please enter number:"; cin >> a; cout << "please enter number:"; cin >> b; } cout << "addition:" << a+b << endl; cout << "subtaction:" << a-b << endl; cout << "multiplycation:" << a*b << endl; cout << "division:" << static_cast<long double>(a)/b << endl; system("pause"); return 0; } wherever did int argv[] ? second argument main char* argv[] . you can convert these command l

python - Import path for decorator-wrapped function? -

assuming have decorator , wrapped function this: def squared(method): def wrapper(x, y): return method(x*x, y*y) return wrapper @squared def sum(x, y): return x+y i have other code call undecorated version of sum function. there import trick can me unwrapped method? if code says from some.module.path import sum then, wrapped version of sum method, not want in case. (yes, know break out helper method, breaks of cleanliness of pattern i'm going here.) i'm okay adding "magic" decorator provide alternate symbol name (like orig_sum ) import, don't know how that. def unwrap(fn): return fn.__wrapped__ def squared(method): def wrapper(x, y): return method(x*x, y*y) wrapper.__wrapped__ = method return wrapper @squared def sum(x, y): return x+y sum(2,3) -> 13 unwrap(sum)(2,3) -> 5

memory management - Is there a way to lower Java heap when not in use? -

Image
i'm working on java application @ moment , working optimize memory usage. i'm following guidelines proper garbage collection far aware. however, seems heap seems sit @ maximum size, though not needed. my program runs resource intensive task once hour, when computer not in use person. task uses decent chunk of memory, frees after task completes. netbeans profiler reveals memory usage looks this: i'd give of heap space os when not in use. there no reason me hog while program won't doing @ least hour. is possible? thanks. you perhaps play around -xx:maxheapfreeratio - maximum percentage (default 70) of heap free before gc shrinks it. perhaps setting bit lower (40 or 50?) , using system.gc() might go lengths desired behaviour? there's no way force happen however, can try , encourage jvm can't yank memory away , when want to. , while above may shrink heap, memory won't handed straight os (though in recent implementations of jvm does.)

Capturing Window's audio in C# -

is possible record window's output sounds programmatically in c#? bit recording "what hear" or "stereo output" feature (without having select them)? this called loopback recording , , is possible in windows. if have soundcard supports loopback (i checked on low-end toshiba laptop, , doesn't) can record straight loopback device using waveinopen etc. api, easy use in c#. note: recording audio in way entails reduction in quality, since audio signal converted analog output , re-digitized support loopback interface. if don't have soundcard, wasapi let this. suppose wasapi can used c#, looks painful.

multithreading - How does mutex or semaphore wake up processes? -

i read mutexes , semaphores maintain list of waiting processes , wake them when current thread completes critical section. how mutexes , semaphores that? doesn't interfere process scheduler decisions? the waiting , waking typically done in cooperation scheduler. mutex implementation forces specific 1 of waiting threads wake typically considered poor implementation. instead, mutex or semaphore notify scheduler thread waiting, , take off "ready run" list. then, when mutex unlocked or semaphore signalled, implementation either ask scheduler wake 1 of waiting threads @ scheduler's discretion, or notify scheduler waiting threads ready run, , have logic on waiting threads first 1 woken scheduler go sleep again. the former preferred implementation choice, not available. second dubbed "thundering herd" approach: if there 1000 threads waiting 1000 woken (a big thundering herd of threads), 999 go sleep. wasteful of cpu resources, , implementatio