Posts

Showing posts from July, 2013

javascript - include external java script file in jsp page -

i have external javascript file named paging.js. following contents of file: function pager(tablename,itemperpage){ this.tablename = tablename; this.itemperpage = itemperpage; this.currentpage = 1; this.pages = 0; this.init()= function(){ alert("init called "); var rows = document.getelementbyid(tablename).rows; var records = (rows.length - 1); this.pages = math.ceil(records / itemperpage); } this.showpagenav = function(pagername,positionid){ alert("show page navi call"); var element = document.getelementbyid(positionid); var pagerhtml = '<input src = "next.jpg" type="image">'; pagerhtml += '<input src = "next.jpg" type="image">' ; element.innerhtml = pagerhtml; } } now tried call init jsp page . <script type="text/javascript"> var pager = new pa...

c# - how to convert sequence of jpeg image into video format? -

hi developing video capture application using c#.net. captured video through webcam , saved jpeg images want make wmv file images. how can basic steps needed can body help i working on myself. have found 2 ways may possible - both require purchase of outside library. the first 1 looks easiest costs most, although allow use free have deal pop telling purchase library: http://bytescout.com/products/developer/imagetovideosdk/imagetovideosdk_convert_jpg_to_video.html the other involves using microsoft encoder 4. still working on one. can free version here: http://www.microsoft.com/download/en/details.aspx?id=18974 c# doesn't natively support in way of sound or video outside reference assemblies seem necessity. right best can offer until figure out.

.net - Programatically create faded 30-second MP3 samples -

is there .net library (or interop runtime) create shorter, 30-second samples full length mp3 tracks fade-in , out effects? related question suggests sox , command-line tool. i'm looking .net interface.

c# - Problem calling string manipulation method within linq-to-sql query -

i'm having frustrating issue trying use linq call string manipulation method. i've done lots of searching , have tried various method line noted 'fails' below work. throws exception. some things i've tried: a) creation of concatenated key in same query, didn't change anything b) converting non-string fields strings (another whole can of works .tostring not working in linq. string.concat , string.format tried, work ok in cases not when try refer value later on) c) using concat etc instead of '+' join things together. as can see seems tolerant of appending strings non-strings, not when method invoked. there lots of rows i'd prefer not convert data list/array etc, if that's option suggestions appreciated. many thanks! - mark var vouchers = v in db.vouchers select new { v.amount, v.due_date, v.invoice_date, ...

java - Taskbar icon with lwjgl? -

i want add taskbar icon running lwjgl process on windows 7. display.seticon changes icon in topleft of window, not in taskbar. what to? my code, like: arraylist bytebuffers = new arraylist(); bytebuffers.add( imagehelper.loadimageasiconimage("stickmanicon32x32.png") ); bytebuffers.add( imagehelper.loadimageasiconimage("stickmanicon16x16.png") ); system.out.println( "taskbaricon result: " + display.seticon(bytebuffers.toarray(new bytebuffer[]{})) ); i tried adding 40x40 image too, no change. this code worked fine me. no need of libs. bytebuffer[] list = new bytebuffer[2]; list[0] = createbuffer(imageio.read(new file("src/images/tests/icon16.png"))); list[1] = createbuffer(imageio.read(new file("src/images/tests/icon32.png"))); display.seticon(list);

wpf c# load user control in a separate thread -

when user clicks on 1 of available items (modules) available in list use following code create new instance of selected item (user control) , add tabgrouparea . object uc = activator.createinstance(type.gettype("mynamespace." + selecteditem.parameter1value), selecteditem); infragistics.windows.dockmanager.contentpane contentpane = new infragistics.windows.dockmanager.contentpane(); contentpane.content = uc; tabgrouparea.items.add(contentpane); the problem have when selecteditem has usercontrols inside initializecomponent() take while complete meanwhile application freeze , user can't thing ,i tried different ways put object uc = activator.createinstance(type.gettype("mynamespace." + selecteditem.parameter1value), selecteditem); in separate thread (backgroundworker,thread , delegate) able show user loadin page .but couldn't find anyway . appreciated . thanks. see this blog post . catel uses approach pleasewaitwindow .

c# - Client to send SOAP request and received response -

trying create c# client (will developed windows service) sends soap requests web service (and gets results). from question saw code: protected virtual webrequest createrequest(isoapmessage soapmessage) { var wr = webrequest.create(soapmessage.uri); wr.contenttype = "text/xml;charset=utf-8"; wr.contentlength = soapmessage.contentxml.length; wr.headers.add("soapaction", soapmessage.soapaction); wr.credentials = soapmessage.credentials; wr.method = "post"; wr.getrequeststream().write(encoding.utf8.getbytes(soapmessage.contentxml), 0, soapmessage.contentxml.length); return wr; } public interface isoapmessage { string uri { get; } string contentxml { get; } string soapaction { get; } icredentials credentials { get; } } looks nice, knows how use , if best practice? however, use way same using system.xml; using system.net; using system.io; public static void callwebservice() { var _url ...

css - child divs extending out of parent div -

i want place 2 images in top banner. second image showing outside "banner" parent div. i've tried tables too, not getting results. 2 images should not fold when resize browser. what's right way this? 1 way join images in photoshop don't want do. <div id="banner"> <div><img src=".." alt="utilities logo" height="105" width="406" /></div> <div> <img src=".." alt="!" height="105" width="467"> </div> </div> this seems easiest way. images inline-block, align nice (#banner should not smaller 406+467 though). <div id="banner"> <img src=".." alt="utilities logo" height="105" width="406" /><img src=".." alt="!" height="105" width="467"> </div> an way might play float cs...

Why doesn't this ruby regex work? -

i have simple regex task has left me confused (and when thought starting hang of them too). want check string consists of 11 digits. regex have used /\d{11}/ . understanding give match if there (no more , no less than) 11 numeric characters (but understanding wrong). here happens in irb: ruby-1.9.2-p136 :018 > "33333333333" =~ /\d{11}/ => 0 ruby-1.9.2-p136 :019 > "3333333333" =~ /\d{11}/ => nil ruby-1.9.2-p136 :020 > "333333333333" =~ /\d{11}/ => 0 so while appropriate match 11 digit string , appropriate no-match 10 digit string, getting match on 12 digit string! have thought /\d{11,}/ regex this. can explain misunderstanding? without anchors , assumption "no more, no less" incorrect. /\d{5}/ matches foo12345bar ^ +---here and s123456yargh13337 ^^ ^ |+---here | +----here | here--+ so, instead use: /^\d{5}$/

Script to check if all files are under the same root SVN -

hi guys, i have method of working branches , times happens of files under checked out directory point wrong root i.e pointing file in 1 of branch instead of actual branch. i wondering if there script can verify if files in checked out folder under same root.. thanks lot in advance. this should trick: suppose expected root https://svn.server.local/trunk/ , execute following in local copy's root folder: svn info -r | grep "url:" | grep -v "url: https://svn.server.local/trunk/" or, on windows: svn info -r | find "url:" | find /v "url: https://svn.server.local/trunk/" the output url list of files not under root repository.

How to get Richtext Box in Java Applet? -

i need display richtextbox in applet window. if know answer me... im waiting ur answers. you can use jeditorpane provides basic rtf support. all information might need can found on sun's tutorial @ http://java.sun.com/docs/books/tutorial/uiswing/components/text.html

automation - Calling VBA-Macros with user-defined Types from C#? -

i've got word document vba module contains user defined types (public type xxx) , public subs take type arguments. possible call these subs c# via application's run()? greetings, steven i don't know if have flexibility this, here's how solved this. create assembly (i called mine "xx.common") add structs in there, make them com-visible reference assembly both vba , c# projects add new vba sub structs arguments you can pass in structured, user-defined data. if generalize idea, can use any com-visible type (i.e. not structs). long both projects reference assembly defines these types, should ok.

objective c - NSTableView Changing Text Color for a row -

i need change following properties nstable view 1 -- change color:row color , text color when selected 2 -- change text color , each row depends upon input parameter, for changing textcolor each row, should override delegate method willdisplaycell, have done , till now, -- creating table ---- pmytableview = [[[customtableview alloc] initwithframe:clipviewbounds] autorelease]; nstablecolumn* firstcolumn = [[[nstablecolumn alloc] initwithidentifier:@"firstcolumn"] autorelease]; [firstcolumn setwidth:35]; [pmytableview addtablecolumn:firstcolumn]; nstablecolumn* secondcolumn = [[[nstablecolumn alloc] initwithidentifier:@"secondcolumn"] autorelease]; [secondcolumn setwidth:180]; [pmytableview addtablecolumn:secondcolumn]; [pmytableview setrowheight:30]; [self setcontacttabledisplayattribute]; [pmytableview setdatasource:self]; [scrollview setdocumentview:ponlinectview]; [pmytableview setdelegate:self] ; --- other...

php - Search function that provides synonyms in results or provides corrections -

i'll start have no idea proper keywords find this, therefore, please excuse me for, probably, misleading title and/or repeated question. for example, when search "potat" in google, automaticly points potato. how achieve in application? nuance: has multilingual, since application primary oriented non-english people. thanks in advance! edit: uhm, there alternatives or sphinx? because looks on destination server application hosted when published, won't have it. there's fine library called sphinx can installed mysql or run separated deamon, includes api different languages (including php) it build indexes 'potat','potato' , 'potatoes' treated same word. and "did mean.." has option when indexing information saves list of words , frequency on documents, list if no results found good luck

php - How difficult is it act as a domain reseller from with a social network app? -

i'm thinking of creating social network niche hobbyist network , know there's appetite people have own unique domain name (www.myfoowebsite.com) opposed whatever unique url on platform of choice (www.opensourcesocial/124/ghyu.php) i guess best comparision http://flavours.me/ allows hook own domain.. how approach this? know people need point nameservers towards app i'm rather @ loss need end.. any guidance appreciated.. you want register domains (so called top level domains - .at, .de, .com, .org ...?)? need: a nameserver (or provides name service you) - dns server responsible e.g. yourdomain.com / configure nameserver appropriately yourdomain.com (with needed records -> soa, mx, a, aaaa (if server ipv6 capable), ns ... - important @ end a or/and aaaa records need contain ip of server content: example need a record www.yourdomain.com content of servers ipv4 address (e.g.) 127.0.0.1 , aaaa record content of servers ipv6 address (e.g. - i...

tomcat6 - Tomcat memory settings -

i getting out of memory exception in tomcat,could 1 explain how settings , best values have set based on calculation of total memory.thanks in advance. regards, chaitu tomcat uses java startup flags set memory configuration. you'll want set java_opts environment variable include -xmx512m ( or heap space think you'll need ). export java_opts="-xmx512m" if permgen memory exceptions may need set maxpermsize: export java_opts="-xmx512m -xx:maxpermsize=128m" the normal catalina startup scripts incorporate java_opts environment variable normal startup process.

objective c - How to integrate Google credentials in an iPhone application? -

i want make application run using google credentials. i'm doing application user can list of events server giving local credentials. want make application run when user enters google credentials. how can integrate application. you can give try on google data objective c api.. handles google service. guess can handle google credentials here..

c# - Items in Datagrid not updating on all clients once ObservableCollection has been updated -

i using sl4, mvvm toolkit, entity framework 4 & wcf ria services. have grid datasource observablecollection<ticket> . ticket oc populated ria service: private void loadtickets() { isbusy = true; _context.load(_context.getopenticketsforuserquery(session.userid), getticketscallback, null); } private void getticketscallback(loadoperation<ticket> lo) { listoftickets = (observablecollection<ticket>)lo.entities; } when add new ticket object oc grid shows new item on clients once refreh grid ( every 30 seconds refresh grid each client calling loadtickets() ). works if remove item grid well. however, when update property in ticket object , save ( call submitchanges() on datacontext ) change not show on other clients after refresh grid. have refresh whole page in browser see changes. have read many similar questions on here , must implement inotifypropertychanged on object properties observablecollection. but, afaik e...

.net - Setup Project in VS2010 migration problems -

i have migrated vs2008 vs2010. installing windows service used breeze , procedure stinks. 1st of all, upgraded setup project result in msi not compatible msi built 2008. 2 reasons actually: component guids changed somewhere, somehow, results in dll's being removed if run msi update (not fresh install, works...sometimes, read on). hey, use postbuild script alter msi, todo installexecutesequence table , no sweat...right. second, 'service allready exists' error, because windows service installing not stopped or removed during update, installer try register service in registry. but, hey, no problem, changed custom action stop service , remove registry entries (last part done ugly starting new process, call sc.exe parameters, without showing console...nice). no errors during upgrade of windows service. yeay, close ticket, move on. not fast: because service not stopped before files copied, system has rebooted finish install when service allready running. our customers have r...

coldfusion - How to access a excel file in CF8? -

how read excel file cfm page? that depends on want do. if need upload file, can use cffile tag (cf8 documentation here ). if want extract data it, may want @ ben nadel's poi utility cfc . (note it's not been updated since release of cf9 because of introduction of cfspreadsheet tag in version of coldfusion.)

arrays - PHP Insert at particular index -

i want move element of array present @ 1st index 5th index in array. how can that? if mean "move", can this $from = 1; $to = 5; $el = $array[$from]; unset($array[$from]); $array = array_merge ( array_slice($array,0,$to), array($el), array_slice($array,$to)); cant test it, idea is: take , remove element @ $from original array, split rest @ $to , merge together. maybe index in array_slice() not match exactly;)

symfony1 - Symfony - search table by month, year for datetime fields -

i trying create search filter on frontend module, filter 2 fields, months , years i have items in db table, have datetime field. i'd able create search, if select january , 2010 2 drop downs, items have datetimes like: 2010-01-24 10:50:52 2010-01-25 10:50:52 will listed i using symfony 1.4 , propel orm thank you why dont try create 2 date , check if date between them, example (2010-01-01 >= $date && 2010-01-31 <= $date ). if so, in range , coincidences appear. if absolutely have check month , year recommend using functions year(date) = $yourdate , month(date) = $yourmonth, functions should go along custom criteria , like: $criterias->addcriteria(tablepeer::date_attribute,"year(". tablepeer::date_attribute .") = $year",criteria::custom); $criterias->addcriteria(tablepeer::date_attribute,"month(". tablepeer::date_attribute .") = $month",criteria::custom); here link mysqldatefunctions

java - Why should I use Spring Android? -

anyone out here use spring android? if so, why think it's worth while? thanks spring android useful if need access restful web services android application. common in real-time data applications such news , weather tickers, stock tickers, etc. for now, there 2 benefits using spring android project: commons logging , resttemplate. http://static.springsource.org/spring-android/docs/1.0.x/reference/htmlsingle/

.net - Saving SQL results into a Lst? -

in database 1 user can have multiple order. want orders user , save in list. this i'm doing now public function getuserorders(byval userid integer) dataset dim sqlda new sqldataadapter dim ds new dataset dim mycommand new data.sqlclient.sqlcommand("sp_getuserorders", myconnection) ' mark command sproc mycommand.commandtype = commandtype.storedprocedure dim muserid new sqlparameter("@userid", sqldbtype.int) muserid.value = userid mycommand.parameters.add(muserid) try ' open connection , execute command myconnection.open() sqlda.selectcommand = mycommand sqlda.fill(ds) catch ex exception myconnection.close() end try return ds end function but can't seem figure out how assign results list. dim orderlist new listitemcollection() orderlist = getuserorders() does not work, p...

.net - REST service URI design -

i creating restful service needs return collection of items, needs allow filtering several indexes (location, company, , category). these filters can applied individually or in combination. situation using filters applied in query string make sense? (some like: /items?company={}&location={}&category={} ) there better way pass filters resource? the preferred way pass search parameters use query string (indeed, that's why it's called query string). path identifies particular resource want (an index of items). query string may include, e.g., filter conditions, used alter how resource represented - still same resource (an index of items), path should same.

jquery - Toggle same table-row with 2 different toggle functions -

i attempting toggle details row via 2 different sources. if user clicks on either name or addressalert, specific detail row gets shown or hidden if user clicks on "toggle all" details rows shown or hidden. the issue 2 separate toggle functions don't know other 1 to. so, example, if "toggle all" clicked, , details rows shown, clicking on individual name should hide details row. however, since individual toggle function "show", takes 2 clicks hide details row. the html: <div id="toggleall"></div> <table> <tr class="inforow"><td class="addressalert"></td><td class="name"></td></tr> <tr class="details"></tr> <tr class="inforow"><td class="addressalert"></td><td class="name"></td></tr> <tr class="details"></tr> <tr cla...

.net - C# - Show PowerPoint Presentations continous -

i want play ppt files in continuous loop, when open new file after first has reached last slide, new powerpoint window opens , starts slide. how can solve problem? public microsoft.office.interop.powerpoint.slideshowwindow startppt(string pptdatei) { watchinglabel.text = "präsentation läuft..."; started = true; ende = false; objpres = ppapp.presentations.open(pptdatei, microsoft.office.core.msotristate.msofalse, microsoft.office.core.msotristate.msotrue, microsoft.office.core.msotristate.msotrue); objpres.slideshowsettings.showwithanimation = microsoft.office.core.msotristate.msotrue; preswin = objpres.slideshowsettings.run(); return preswin; } private void timer1_tick(object sender, eventargs e) { watchinglabel.text = "watching..."; if (system.io.directory.exists(ordner)) { pptdatei.clear(); pptdatei.addrange(system.io.directory...

sql - mysql where IN on large dataset or Looping? -

i have following scenario: table 1: articles id article_text category author_id 1 "hello world" 4 1 2 "hi" 5 2 3 "wasup" 4 3 table 2 authors id name friends_with 1 "joe" "bob" 2 "sue" "joe" 3 "fred" "bob" i want know total number of authors friends "bob" given category. so example, category 4 how many authors there friends "bob". the authors table quite large, in cases have million authors friends "bob" so have tried: get list of authors friends bob, , loop through them , count each of them of given category , sum in code. the issue approach can generate million queries, though fast, seems there should better way. i thinking of trying list of authors friends bob , building in clause list, fear blow out amt of memory allowed in qu...

GWT + eclipse, which files are part of my source? -

i created gwt project in eclipse, , it's time put code source control. i'm not sure @ point files generated , can left out of source control, a. under war/myapp/gwt/... see many, many files related standard gwt themes. b. under war/myapp, -rw-r--r-- 1 10102022 1602597546 1876 jan 24 16:41 0182de3cc529e42da72bbd969a44841e.gwt.rpc -rw-r--r-- 1 10102022 1602597546 1456 jan 24 14:09 4f701266a6e52e1e409583ea9aec39e2.gwt.rpc -rw-r--r-- 1 10102022 1602597546 1876 jan 25 08:38 d98fd8fe56b70659e9608109bcf8b3c1.gwt.rpc -rw-r--r-- 1 10102022 1602597546 43 dec 16 16:01 clear.cache.gif drwxr-xr-x 6 10102022 1602597546 204 jan 25 08:26 gwt -rw-r--r-- 1 10102022 1602597546 11289 dec 17 01:33 hosted.html -rw-r--r-- 1 10102022 1602597546 5232 jan 25 08:31 photodrop_web_gwt.nocache.js normally i'd rely on eclipse build > clean rid of build time artifacts. however, did that, , still see web-inf/classes full of class files, know clean isn't work...

header - PHP Forward to next Page -

i have form that, on submit, going php file. here form processed , sent mysql database storage. after done want page to, automatically, send me next page wich contains form has filled in (this continues few times). i know can use header('location: here youre link '); sending next page, doesn't work. in php file have basic stuff: request form, process data, insert database.... when put "header....."-code after these php commands returns error, , same thing happens when place in front of php commands. keeps returning error: cannot modify header information - headers sent .... on line 17 i hope can me, , have given information need me. i've been searching day still haven't found solution. thanks in advance! milaan the "headers sent" error caused having white space before or after opening , closing php tags (<?php . . . ?>) . use of ob_start() helps. this function turn output buffering on. while output buff...

javascript - Why would this code work in IE and fail in Firefox and Chrome? -

so loading our new web application in firefox , chrome had alert subtly tell me tabstrip couldn't found. following through code found function: function initializetabstrip() { var tbllist = document.getelementsbytagname("table"); var tabstrip = null; (var = 0; < tbllist.length; ++i) { if (typeof (tbllist[i].tabstriproot) != "undefined") { tabstrip = tbllist[i]; break; } } if (tabstrip) { window.tabstrip = new tabstrip(tabstrip); } else { alert("couldn't find tabstrip"); } } in both firefox , chrome, typeof (tbllist[i].tabstriproot) comes undefined, whereas in internet explorer same section of code find item, , follow through correctly. i've tried using firebug , ie's developer toolbar script debugging tool follow through , attempt discover 'tabstriproot' is, haven't had luck. would of javascript guru's able give me directi...

Joining Sybase stored proc output in a query -

i have sybase stored proc following interface: mystoredproc @vara int, @varb int output i run proc against table (tablea) within query, follows: select tablea.id, proc.@result tablea left join (mystoredproc tablea.id, @result output) proc i know won't work, idea of i'm trying return. note id values tablea passed in arg proc, , result set contain id column , output result stored proc. is possible? or need loop on proc? i suppose have sybase ase. i can't check far remember connect same ase external server through component interation server , create remote procedure proxy table. find "remote procedures proxy tables" in "component integration services users guide". also think no solution performance.

sml - Output is truncated with #-signs in the REPL -

i wrote function works expected don't understand why output that. function: datatype prop = atom of string | not of prop | , of prop*prop | or of prop*prop; (* xor = (a , not b) or (not or b) *) local fun do_xor (alpha,beta) = or( and( alpha, not(beta) ), or(not(alpha), beta)) in fun xor (alpha,beta) = do_xor(alpha,beta); end; test: val result = xor(atom "a",atom "b"); output: val result = or (and (atom #,not #),or (not #,atom #)) : prop this output restriction (yes, it's confusing) - default depth of value printouts in top-level (interactive shell) limited small number (i.e. 5). skipped parts printed #. you can override depth - @ least, in sml-nj - printdepth variable: control.print.printdepth := 1024; p.s. way, don't need separate do_xor , local function here - just fun xor(alpha, beta) = or(...); will do.

sockets - limitation of the reception buffer -

i established connection client way: gen_tcp:listen(1234,[binary,{packet,0},{reuseaddr,true},{active,false},{recbuf,2048}]). this code performs message processing: loop(socket)-> inet:setops(socket,[{active,once}], receive {tcp,socket,data}-> handle(data), loop(socket); {pid,cmd}-> gen_tcp:send(socket,cmd), loop(socket); {tcp_close,socket}-> % ... end. my os windows. when size of message 1024 bytes, lose bytes in data . server sends ack + fin client. i believe erlang limited 1024 bytes, therefore defined recbuf . where problem is: erlang, windows, hardware? thanks. you may setting receive buffer far small. erlang isn't limited 1024 byte buffer. can check doing following in shell: {ok, s} = gen_tcp:connect("www.google.com", 80, [{active,false}]), o = inet:getopts(s, [recbuf]), gen_tcp:close(s), o. on mac os x default receive buffer size of ...

java - Alternative to thread for small tasks without freezing the GUI -

i'm writing small application, composed gui , couple of buttons. when user clicks 1 of them, program must download webpage, couple of matching , return value gui. question is, must start new thread every time user clicks on button, or there's alternative threads kind of small tasks ( mainly, download contents web)? you have use different threads. how use different threads can you. @ producer/consumer method there idle thread sitting in background waiting work queued. seems fit job well. should use swingworker when possible because helps lot gui updates , refreshes. finally, @ java.concurrency package useful. days, don't think there reason start thread manually without using library locking , threading you.

Streaming live video to iPhone -

i mobile application developer, , around 2 weeks have been researching how live streaming iphone via server, haven't had success yet. have iphone application ready receive live streaming using mpmovieplayercontroller class. here requirements: i have live .flv streaming feed url news video channels. want pass server software encode iphone-supported format stream iphone program. i used vlc stream iphone, doesn't work. used nightly build version 1.2 of vlc advertise has iphone streaming, still doesn't work. i tried using vlc wowza , iphone. somehow worked after encoding via vlc , segmentation , streaming via wowza iphone, trial version supports 3 minutes streaming, useless giving demo customer. or i bought tv tuner card , have analog cable connection network. want input cable connection tv tuner card , use software vlc stream channel's feed iphone of channels get. i want stream through either method above iphone, android, , blackberry devices. blackberry...

ExternalInterface not linking javascript and actionscript 3 -

none of similar answered questions fixed problem, here goes. want call actionscript 3 function javascript in ff error console says function i'm calling js not exist. says functions mover , mout not defined. here js functions in js file function getflashmovieobject(moviename) { var isie = navigator.appname.indexof("microsoft") != -1; return (isie) ? window[moviename] : document[moviename]; } function playf() { getflashmovieobject("button2").mover(); } function playb() { getflashmovieobject("button2").mout(); } here's code in html <object style="width: 413px; height: 76px;" id="button2" onmouseover="playf()" onmouseout="playb()"> <param name="movie" value="homepage/flash/button2.swf"> <param value="transparent" name="wmode"/> <param value="false" name="loop"/> <embed wmode=...

sockets - VB.NET 1.1 Winsock Replacement -

i'm trying update application vb6 vb.net. orig app used winsock control. unfortunately can't nor want use in re-write. there decent public classes events wrap socket class? i've found few on google buggy , think may little on head write own scratch. sockets built in now: http://msdn.microsoft.com/en-us/library/system.net.sockets(vs.71).aspx if doing web related tasks should @ system.net.webclient or system.net.httpwebrequest .

multithreading - How can I profile memory of multithread program in Python? -

is there way profile memory of multithread program in python? for cpu profiling, using cprofile create seperate profiler stats each thread , later combine them. however, couldn't find way memory profilers. using heapy. is there way combine stats in heapy cprofile? or other memory profilers suggest more suitable task. a related question asked profiling cpu usage on multi-thread program: how can profile multithread program in python? also question regarding memory profiler: python memory profiler if happy profile objects rather raw memory, can use gc.get_objects() function don't need custom metaclass. in more recent python versions, sys.getsizeof() let take shot @ figuring out how underlying memory in use objects.

Maximum of two number in C using bitwise operators -

possible duplicate: find maximum of 2 numbers without using if-else or other comparison operator isgreater: if x > y return 1, else return 0 example: isgreater(4,5) = 0 isgreater(5,4) = 1 legal operators: ! ~ & ^ | + << >> isgreater function.. i tried: int isgreater(int x, int y) { return (y+(~x+1)) >> 31 & 1; } but not working.. :(( let me know else can do? given x, y try x + -y if < 0 y greater, if > 0 x greater. -y = binary complement of y: -y = (~(y-1)) <==> -y = (~y)+1 from see, binary complement (~y +1)), same. then bitshift >> 31 msb, , equal 1. make sure set parantheses, operator precedence ! (y+-x) >> (31 & 1); != ((y+-x) >> 31) & 1;

c++ - New Operator With Vectors -

these questions relatively straight forward. when using vectors, should use new operator when pushing new element? , release method should call? here's mean: // release method: 1. void releasemethodone( vector< int * > &thisvector ) { // clear out vector. thisvector.clear( ); return; } // release method: 2. void releasemethodtwo( vector< int * > &thisvector ) { // clear out vector. for( unsigned uindex( 0 ); uindex < thisvector.size( ); uindex++ ) { delete thisvector.at( uindex ); } return; } int main( ) { vector< int * > vector; // add new element. vector.push_back( new int( 2 ) ); // more code... // free elements before exiting. method should call here? releasemethodone( vector ); // one? releasemethodtwo( vector ); // or one? return 0; } i've started learning vectors not long ago , book learning said vector's clear( ) method called each of elements destruc...

Is it possible to set the source of an image using the javascript: pseudo-protocol? -

basically, have context i'm allowed create image, want run script before decide on source, i'm wondering if possible: <img src="javascript:{load remote script , run figure out source}" /> the work-around i've come is: <img src="any-old-image.gif" onload="document.write('<scr' + 'ipt src=\"http://mysite-script.js\"'></scr' + 'pt>');" /> but i'm hoping little cleaner possible. p.s. i'm aware "javascript:" quote-unquote evil. special situation. create function gathers whatever data need , sends server (via xmlhttprequest, or whatever method prefer). create function examines response server , decides image use. can set url image directly: document.getelementbyid("myimage").src = myimagesrc; edit: addressing comment. if can muck img element itself, right, img.onload want. , if there's more couple of lines of script, impor...

uitableview - How can I use the Top Bar setting of a UITableViewController in IB? -

i have .xib controller, uitableviewcontroller . contains uitableview , controlled right .h, .m files , iboutlets . works fine, want navigation bar on top of view. saw setting in interface builder, in attributes window of uitableviewcontroller : "top bar". set navigation bar, nicely renders empty navigation bar above table view. but don't see on iphone! how can access navigation bar, set title , edit button? have connect outlet somewhere? tried add navigation bar manually, doesn't work since uitableview . can me out? advice appreciated. the "top bar" option in ib simulate ui navigation bar. see navigation bar, you'll have embed uiviewcontroller within uinavigationcontroller. to find out how works, check out "navigation-based application" template in xcode , check out: http://www.matthewcasey.co.uk/2010/05/23/tutorial-introducing-uinavigationcontroller-part-1/

debugging - How do i tell if i'm in the debugger under android? -

i need way check whether or not android app being debugged (there's condition check on startup -not- want check when debugger running). such beast exist? you need @ isdebuggerconnected . but considered bad practice make application's behavior dependent on whether debugger connected or not. may lead hard catch bugs. careful.

mutex - VB6: Single-instance application across all user sessions -

i have application needs single-instance app across user sessions on windows pc. research far has centered around using mutex accomplish this, having issue not sure issue, best-practice question believe. here's code first of all: private const appver = "global\uniquename" ' not using name unique public sub main() dim mutexvalue long mutexvalue = createmutex(byval 0&, 1, appver) if (err.lastdllerror = error_already_exists) savetitle$ = app.title app.title = "... duplicate instance." msgbox "a duplicate instance of program exists." closehandle mutexvalue exit sub end if ' else keep on truckin' now, based on this article believe understand passing null pointer createmutex function above i'm assigning whatever security descriptor associated logged in user. if means think (i may need more guidance here) tells me other users log in not able "see" mutex ...

Git with centralized workflow -

i'm new git, , using centralized workflow, similar svn. i'd periodically know status compared central repo. example, if run following commands... $ git clone git@github.com:centralrepo/test.git $ cd test; <make changes inside test/> $ git commit -a $ git pull ...git pull says "already up-to-date". why doesn't git pull report changes, , if that's correct behavior, there way know local out of sync remote? git pull fetch changes made in remote repository yours, equivalent svn update . however, not mention if there changes made @ end not on remote. can git fetch fetch updates remote without applying them workspace. with recent versions of git (e.g. 1.7.2.3 here) git status print information see this, e.g.: # on branch master # branch behind 'origin/master' 20 commits, , can fast-forwarded. this showing after did git fetch , means there changes waiting go workspace (applied doing git pull ) by contrast, if pull in , ma...

c# - Cannot Place User Control on Form -

i've created c# winforms application using vs2010. i'm new creating user controls created new user control (as part of same project). when rebuild project, new control appears in toolbox. , when drag control toolbox onto form, following error. failed load toolbox item 'taggroup'. removed toolbox. this happened other time created user control well. i've searched web answers found seemed related having control in separate assembly. (note found plenty of questions same problem i'm having.) can suggest should next? i figured 1 out. the project i'm working uses 2 class-library assemblies. although these have nothing control i'm discussing, looked , saw both libraries have platform target in properties|build tab set "any cpu". on other hand, application had setting set "x64". changing application's setting "any cpu", can place user controls onto forms. go figure...

python regex [:alpha:] -

i'm using regex in python: import re >>> er = re.compile('^\w{0,30}$', re.u) >>> er.sub('.', 'maçã') >>>.... but wanna catch letters, [a-z] not work me, because need letters accent . there way use posix? [:alpha:], or solution? thanks! modified regex - how about er = re.compile(u'^[^\w\d_]{1,30}$', re.u) s = er.sub(u'.', u'maçã') matches u'maçã' not u'maçã01'.

database - BDB, How to get primary keys in specified order? -

i have asked same question days on oracle forums, no answer came:( link is:http://forums.oracle.com/forums/thread.jspa?threadid=2162345&tstart=0 hi, build bbs using bdb backend database, forum database, topic database , post database share 1 environment. bbs web application multi-thread program. if user selects 1 forum, topics listed in order of last reply time;selecting 1 topic, posts listed in order of reply time well. struct forum { uint16 forumid; string forumname; string _lastposter; // last 1 replied in forum }; struct topic { uint32 topicid; uint16 forumid; // topic comes forum string title; // topic title uint64 dateoflastreply; // when last reply topic happen }; struct post { uint64 postid; uint32 topicid; // post comes topic string title; // post title of topic uint64 dateofpost; // when post created }; i create 1 primary database , 2 secondary databases topic, primary key topicid, secondary keys forumid , dateoflastreply respectively, , want show 1st 25 topic...

Java: Are chars " and \" the same? -

given: char x = '"'; char y = '\"'; are x , y equal? they equal. (the link executes following test) class foo{ public static void main(string[] a){ system.out.println('"' == '\"'); // prints true } }

c++ - Forward declaration of std::wstring -

// header file. class myclass; // can forward declared because function uses reference. // however, how can forward declaraion std::wstring? // class std::wstring; doesn't work. void boo(const myclass& c); void foo(const std::wstring& s); you can't. #include <string> , have (almost) no choice. the reason wstring defined in namespace std , typedef'd std::basic_string<wchar_t> . more elaborately, std::wstring std::basic_string<wchar_t, std::char_traits<wchar_t> > . means in order forward-declare std::wstring you'd have forward-declare std::char_traits<> , std::basic_string<> inside namespace std . because (apart few exceptions) standard forbids adding definitions or declarations namespace std (17.4.3.1/1) can't forward-declare standard template or type in standard-conforming way. specifically, means can't forward-declare std::wstring . and yes, agree convenient have <stringfwd> header, ...

iphone - Is it allowed to change the background of an UISearchBar? -

i have been searching thru web cant find confirmed answer. there ways removing subview within searchbar.subviews allowed? if not then, aside changing tintcolor of searchbar, or use textfield instead, there way wont break apple's rule , still being able customize background of searchbar? thanks! i worked on shipping app made background of search bar transparent. there no problems this.

java - Is there a way using BigInteger for iteration? -

does biginteger have equals comparison? there substitutes math notation < (greater than) or < (less than)? ^answered! now want know, there way using biginteger in iteration such while , for ? you can use compareto method.

mysql - How to get the total sum for a column -

i have following query gives me data want, however, need total sum of cash, credit , check columns inside case statements. how can achieve this? i'd use procedure if possible. also, me, query doesn't seem @ efficient. can improve upon this? seems me should able set variables , use them inside case statements not sure how it's done. select t1.order_id, t3.price * sum( t1.quantity ) subtotal, ( sum( t1.discount ) + t3.discount ) / 100 disc, t3.price * sum( t1.quantity ) * ( t3.tax_state + t3.tax_fed ) /100 tax, t3.price * sum( t1.quantity ) - ( sum( t1.discount ) + t3.discount ) / 100 + t3.price * sum( t1.quantity ) * ( t3.tax_state + t3.tax_fed ) /100 total, case t2.payment_type when 'cash' t3.price * sum( t1.quantity ) - ( sum( t1.discount ) + t3.discount ) / 100 + t3.price * sum( t1.quantity ) * ( t3.tax_state + t3.tax_fed ) /100 else 0.00 end cash, case t2.payment_type when 'card' t3.price * sum( t1.quantity ) - ( sum( t1.discount ) + t3.discount...

curl - Implement version checking in a bash script -

i implement version checking in bash script, verify file on website, , if version of script not match last version, opens web page. heard use curl, didnt find tuto case. i'm gonna write do: #configuration version=1.0.0 url='http://example.com/version' dl_url='http://example.com/download' #later on whenever want # assume url displays current version number check_version=$(wget -o- "$url") # if remove periods, works way # lexicorigraphically compare version numbers numbers current_number=$(echo "$version" | tr -d '.') new_number=$(echo "$check_version" | tr -d '.') test "$current_number" -gt "$new_number" || x-www-browser "$dl_url"

lucene - how do i get all the similar documents without any search terms -

i need develop search application , many documents indexed different fields , id field unique each of document . fields not stored indexed except id field i need find out each document , documents similar this, here have unique id field of current document , dont have other fields of current document form terms , query index finding similar documents current one. how do ? appreciated . i believe simplest way use solr, , use solr's morelikethishandler . can use query like http://localhost:8983/solr/select?q=unique_id:2722&mlt=true&mlt.fl=manu,cat&mlt.mindf=1&mlt.mintf=1&fl=id,score

windows phone 7 - Use what to represent apostrophe,Greater,Less Than Sign in Silverlight for SMS -

it seems run out of ideas of use represent in silveright textblock below send out sms. for these characters greater , less sign ----i use &#60 , &#62; apostrophe ----- use &#39; or &apos; they fine in silverlight textblock , textbox, when send them out in sms, dont work, apper in form of code &amp;apos; &amp;#60 or &amp;#62; 1)say silverlight textblock contain greater , less sign , apostrophe 2) textbox1.text = txtblk.text smscomposetask sms = new smscomposetask(); sms.body = textbox1.text sms.show(); any1 can on this? ----update-------this code use : 1) in xaml <textblock name="txtblkchar" textwrapping="wrap"> &#160;&lt;&#39;&gt;|||-&lt;&#39;&gt;<linebreak/> </textblock> refer &#160; space 2) in code behind : smscomposetask sms = new smscomposetask(); sms.body = txtblkchar.text; sms.show(); when send out sms. there chars re...

Intercept control of UIWebView video on external screen -

i'm adding external display capability ipad , having trouble uiwebview based video controls. whenever uiwebview based video played, external screen automatically taken on display video fullscreen. unfortunately, have no way close video , return external screen previous webview. fullscreen video on external screen appears cleared once webview content unloaded. when uiwebview video played , fullscreen video controller created, controller exist? there way detect or otherwise manage it? how can manually force dismissal of controller? see post: how receive nsnotifications uiwebview embedded youtube video playback otherwise, have used workaround level of success: listen uiwindowdidbecomekeynotification check class of window becoming key against mptvoutwindow like: -(void)windowdidbecomekeynotification:(nsnotification*)notification { bool tvout = [[notification description] rangeofstring:@"mptvoutwindow"].length > 0; ... }

javascript - Adding or Replacing a new Panel to inside a Window in Ext JS -

problem has been solved already, anyways :) i've got ext.window object. like: var mypanel= new ext.panel({title:'placeholder'}); var cwin = new ext.window({ layout:'fit', width:screen.width-200, x:200, y:150, draggable: false, closable: false, resizable: false, plain: true, border: false, items: [mypanel] }); i'm trying replace 'mypanel' ext.panel object when user triggers specific event. figured remove mypanel , add new panel it. got removing working. adding different story, i've tried stuff in direction of: mypanel= new ext.panel({title:'my new panel'}); cwin.add(mypanel); //dit nothing cwin.items.add(mypanel); //dit nothing cwin.insert(0,mypanel); //dit nothing cwin.items.insert(0,mypanel); //dit nothing i'll happy answer either replacing existing panel or adding new panel. thank you. after adding items, should call dolayout() on container. // remove actual contents...

php - How to properly use imap_mail_compose -

i'm programming webmail script , don't know how use imap_mail_compose function. the documentations , examples not explicit , there no examples on google. my question : how should use function data obtain form (to,cc,bcc,subject,content,attachements) ? how send message : imap_mail or mail ? thanks time. consider looking @ likes of phpmailer worx tech. used few times , it's proven useful in past proving easy use , stable. project site (sourceforge) (php 5.x.x): http://sourceforge.net/projects/phpmailer/ , project site google code: http://code.google.com/a/apache-extras.org/p/phpmailer/ the basic tutorial can found visiting phpmailer page searching 'phpmailer' in google , goto products > phpmailer > support - tutorial. don't let site put off, classes excellent.

xml - xsl performance issue -

i having trouble performance of xsl mapper. here example xsl (note: real xsl goes on 10 000 lines) <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/biztalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns3="http://microsoft.com/healthcare/hl7/2x/2.3.1/tables" xmlns:ns4="http://microsoft.com/healthcare/hl7/2x/2.3.1/datatypes" xmlns:ns0="http://microsoft.com/healthcare/hl7/2x/2.3.1/segments" xmlns:ns2="http://microsoft.com/healthcare/hl7/2x" xmlns:ns1="http://cegeka.c2m.accelerator.schemas.segments_c2m"> <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" /> <xsl:template match="/"> <xsl:apply-templates select="/ns2:adt_...

c# - How to hide static method -

let's have classes, that: class { public static int count() } class b : { } class c : { } how can hide static method class b not c? you can't, basically. heck, if it's public anyone can call it. you make protected allow called within b or c not elsewhere... still couldn't differentiate between b , c.

VBA loop to replace all characters in a string and writing the result to a single cell (Excel) -

what i'm trying take user-inserted text cell , convert morse code, write result different cell. can't figure out how write result, current code saves last character in morse code array changed in output string (if exists in input string). m number of characters in both arrays. for = 1 m output = replace(input, a$(i), b$(i)) next range("output") = output if understand question correctly think problem you're overwriting output in each iteration of loop. try changing code to: for = 1 m output = output & replace(input, a$(i), b$(i)) next range("output") = input note added output & tells append new value output rather overwriting it.

javascript - What is the correct term for moving the mouse in some certain pattern? -

i'm working on script registers movement patterns, such left-right-left or 540 degree circle, user may perform mouse, have no idea name it. what best term this? i think they're commonly known mouse 'gestures' http://en.wikipedia.org/wiki/pointing_device_gesture

keyboard shortcuts - alt+ctrl+f4 not working on visual studio 2005? but it did work previously -

in visualstudio .net (say 2005) have shortcut alt + ctrl + f4 closes opened windows. (already mapped window.closealldocuments) , 1 alt + ctrl + shift + f4 close window. now both shortcuts used work on previous workstation. both having winxp 32.and work on sv 2005 on both. on new machine, alt + ctrl + f4 not seem propagate visual studio, there's other application or explorer mapping key else, , it's not propagating event vs process. know 'tools -> options...keyboard' in vs, when press combination in 'press shortcut keys:' field.. receive these combinations: alt + ctrl + f5->f10 won't receive these: alt + ctrl + f1->f4 . it's didn't press nothing. now... ideas? the problem process receiving key combination , not propagating rest of applications. in case hkcmd.exe (intel's graphic ) captures key combinations things display rotation , such. anyway hans passant comment.

client closed prematurely connection while sending to client, in nginx -

i have error in nginx error.log: 2010/12/05 17:11:49 [info] 7736#0: *1108 client closed prematurely connection while sending client, client: 188.72.80.201, server:***.biz, request: "get /forum/ http/1.1", upstream:"http://***:3000/forum/", host: "***.biz" i have 500 response code on site everytime. how can fix this? thank you. i tackled problem myself long hours today , found solution: please note fix affects when using load balancer(s) check load balancer idle timeout. had elb idle timeout set 60 seconds (default) , request hanging, closed connection after given time. elb before nginx, nginx logging "client" (in case elb), closing connection. so if using elb, go to: ec2 -> load balancers -> select correct 1 -> scroll down in description , change idle timeout if using other load balancers, check configuration , timeouts. also keep in mind still might needing change proxy timeouts etc.

mysql - Strategy on synchronizing database from multiple locations to a central database and vice versa -

i have several databases located in different locations , central database in data center. have same schema. of them changed(insert/update/delete) in each location different data including central database. i synchronise data in central database. data in central database synchronise locations. mean database change in location 1 should reflected in location 2 database. any ideas on how go this? just @ symmetricds . data replication software supports multiple subscribers , bi-directional synchronization.

asp.net - ASP MVC passing form data with ActionLink -

i able pass data text box on page tan action using actionlink. i specify actionlink follows in view @ajax.actionlink( "utc", "gettime", { zone="bst" }, new ajaxoptions { insertionmode = insertionmode.replace, updatetargetid = "targetelementid", onbegin = "gettime_onbegin", } ) since cannot see way specify in helper thought implement onbegin event , there. noted onbegin receives xmlhttprequest, containing details of request performed , object, whos purpose escapes me, contains url property object.url object.context.url, thought add property need pass action url, thinking resolve same-named parameter of action. function gettime_onbegin(xmlhttprequest, object) { object.context.url = object.context.url + "&text=" + $('textboxid').val(); } my controller action public string gettime(string zone, string text) { datetime time = datetime.utcnow; ...

sql - MySQL query performance -

i have following table structure: event_id(int) event_name(varchar) event_date(datetime) event_owner(int) i need add field event_comments should text field or big varchar . i have 2 places query table, 1 on page lists events (in page not need display event_comments field). and page loads details specific events, need display event_comments field on. should create table event_id , event_comments event? or should add field on current table? in other words, i'm asking is, if have text field in table, don't select it, affect performance of queries table? adding field table makes larger. this means that: table scans take more time less records fit page , hence cache, increasing risk of cache misses selecting field join, however, take more time. so adding field table make queries don't select run slower, , select run faster.

c++ - Whether there is a UDT backend for boost::asio? -

please, tell me whether exist udt protocol backend boost::asio? udt reliable udp based application level data transport protocol distributed data intensive applications on wide area high-speed networks. ( http://udt.sourceforge.net/index.html ) tcp, udp, , icmp supported boost.asio. other protocols can implemented extending protocol type requirements . there several threads on asio-users mailing list discussing adding support sctp, may able use example.