Posts

Showing posts from April, 2010

How to connect to WbLogic JMS queue using t3s via full client with two way SSL authentication? -

i have struggled on 1 several days now. using weblogic 11g (10.3.4.0) on windows (linux behaves same). have setup 2 way ssl authentication following details http://emo.sourceforge.net/cert-login-howto.html , http://middlewareforum.com/weblogic/?p=312 . used jmeter client following jvm parameters. standalone java client behaves same. -djavax.net.ssl.keystoretype=pkcs12 -djavax.net.ssl.truststoretype=jks -djavax.net.ssl.keystore=c:/users/sli/keys/browser.p12 -djavax.net.debug=ssl -djavax.net.ssl.keystorepassword=password-djavax.net.ssl.truststorepassword=changeit -dweblogic.security.ssl.ignorehostnameverification=true it works fine t3 thin client (wlthint3client.jar), not work when switch full client (wlfullclient.jar). 1 of applications somehow stuck full client. different problem own. btw, full client not full needs webserviceclient+ssl.jar , cryptoj.jar ssl. complains following @ client. javax.naming.communicationexception [root exception java.net.connectexception:

database - Storing Hash Data Externally in Perl -

i'm working refactor script has reliance on 3 hashes (simple hashes), initialized @ beginning of script. in total, these hash values take on hundred lines in script. in order improve overall readability , cleanliness of code, should store information outside of script , read in information @ start? data should static (individual entries may have changed on occasion). if yes, how go storing in database/suggested storage medium? (i'm noob when comes sql). sounds have configuration data. mastering perl book has chapter discussing several choices.

Cannot connect anymore to local SQL Server 2008 database -

today went connect local database cannot connect anymore unknown reasons. typed in (local) , used windows authentication yet error. cannot connect localhost. a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: named pipes provider, error: 40 - not open connection sql server) (.net sqlclient data provider) is sql server service running? check, right-click on "my computer" , choose "manage..." tree on left side of window, choose "services , applications", "services". "sql server" service , see if in "started" status. if not, right-click on service , choose "start".

emulation - Has anyone every done any integration with the M.A.M.E. arcade ROM emulator? -

i'm looking write application grab basic information mame emulator. i wondering if on here had experience that. i've done little searching , can't seem find information. i'm hoping make few hooks running emulator find out things when game starts, game starts, how many players, when player stops playing, game scores, etc. has ever heard of being done? have no idea how of possible, i'm looking explore possibilities here , pointers welcome. building mame sources doable, , result modifying sources , building doable. adding hooks application can monitor going on in particular game in mame easier task, creating sort of app app communication , having new app monitor information. mame may have these sorts of things build in there or @ least 1 gui launcher mame.

programming languages - Bash: check if element is in an array -

im trying make work next bash code, seems im doing things wrong: hostname=`hostname -s` qaiservers={'v-qai01' 'v-qai02'} in ${qaiservers[@]} if [[ $i = ${hostname} ]]; echo 1 else echo 0 fi done the current hostname v-qai01 supposed match verification, doesnt: ./run.sh: line 14: v-qai02}: command not found ./run.sh: line 15: }: command not found thank you fixed: made work with: hostname=`hostname -s` qaiservers=("v-qai01" "v-qai02") #portales={'t1wsyellar01' } in "${qaiservers[@]}" if [ "$i" == "${hostname}" ] ; echo "found" fi done made work link qaiservers=('v-qai01' 'v-qai02')

c - Simulating Circuits and Programming Micro-controllers over Linux -

i'm go through micro-controller project controls robotic arm. problem @ ms windows there mikroelectronica (ide: microc) compile .c hex put hex in proteus , simulate. using special (pcb) kit cd (carries windows software) put microchip , install hex file or ever. first respect ms hate it! adore ubuntu/linux , open-source need experts tell me in "steps" how mentioned in linux minimal complications. the electrical , mechanical engineers along me brag ms easy. want show them how computer science guy uses open-source technology , how strong , reliable is. please ! you wish demonstrate power of linux trying run products designed operating system on it? chances tools may work in wine . or maybe can use hi-tech c compiler , try geda simulation. possible compile microchip c30 on linux if working on 16-bit pic:s. in case, may not easy using out-of the-box windows tools. more educational, nevertheless.

Android StrictMode InstanceCountViolation -

i running app strictmode activated in development documented here strictmode lower platform versions , noticed error message not know think nor can find reference. i android.os.strictmode$instancecountviolation values instances , limit e.g. instances=3; limit=2 now wondering: a) how limit calculated b) how can such violation happen , evasive actions. any ideas? it's in code the key strictmode.sexpectedactivityinstancecount , incrementexpectedactivitycount , decrementexpectedactivitycount : increment called in activitythread.performlaunchactivity after creating activity instance. decrement called in activitythread.performdestroyactivity after activity has been removed application. so limit less each time activity destroyed, if instance leaked real instance count bigger limit, detect if it's leaked gc magic (in decrementexpectedactivitycount ): system.gc(); system.runfinalization(); // added in https://github.com/android/

javascript - Local variable naming convention with JS Lint -

industry standard locally scoped variables '_' js lint complains mightily these _'s. does else have naming convention locally scoped variables in javascript file we develop in .net here, , made simple decision standardize on simple convention. c# , javascript code should close 1 possible. hence, camelcase local variables, titlecase types, , on. it's worked out pretty well, since there's no jarring transition between 2 languages, , great job of distinguishing our code native js code , of 3rd party libraries. my 2 cents. p.s. use stylecop standards, fwiw. , won't make jslint happier.

vb.net - Implement IReportServerCredentials error -

i took sample code implement ireportservercredentials send login information retrieve report remotely reason implementation error prone. imports system.net imports microsoft.reporting.webforms imports system.security.principal <serializable()> _ public notinheritable class reportservernetworkcredentials implements ireportservercredentials #region "ireportservercredentials members" ''' <summary> ''' specifies user impersonate when connecting report server. ''' </summary> ''' <value></value> ''' <returns>a windowsidentity object representing user impersonate.</returns> public readonly property impersonationuser() windowsidentity implements ireportservercredentials.impersonationuser return nothing end end property ''' <summary> ''' returns network credentials used authentication report server. '''

jquery dialogs in quirks mode doesn't set height correctly -

i writing jquery based widget go on company's website. when try set height of dialog via $('#dialog').height(450), sets dialog shorter. i'm able 450px high using 300 (i know, makes no sense). i've determine bug happens in ie8 in quirks mode. yes, know jquery doesn't support quirks mode. can't change doctype, since it's not website. even though did worked, need understand why. there definitive guide how jquery works in quirks mode? have applied padding dialog? the box model rendered differently if you're using quirks mode. see http://www.quirksmode.org/css/box.html

c - Strim a line in a text file (Windows) -

i have several hundred file path in lines in txt file need strim e.g. report2011510222820.html: <td width="60%" bgcolor="#f4f4f4" class="tablebody" valign="top">c:\users\administrator\desktop\calc.exe</td> how take out " report2011510222820.html: &lt;td width="60%" bgcolor="#f4f4f4" class="tablebody" valign="top"&gt;" , "&lt;/td&gt; ", left with: c:\users\administrator\desktop\calc.exe the current code have: #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[2048]; while (fgets(s, sizeof(s), stdin)) { char *pos = strpbrk(s, "|\r\n"); if (pos != 0) fputs(pos+1, stdout); } return 0; } to posted code working given example, following changes made. change strpbrk call check angle bracket instead of vertical bar (not sure if typo in op c

ruby on rails - Rails3 + jQuery: Ajax response messed up -

i'm trying along rails 3 , ajaxification of app jquery. therefore, when user writing comment, comment should inserted via ajax after hitting submit button. problem is: ajax response contains whole generated html of application.haml. i'm having no clue, how rid of html , intended response written in related create.js.erb file. here's comments controller: class commentscontroller < applicationcontroller def new @comment = comment.new end def create @article = article.find(params[:article_id]) @comment = current_user.comments.build(params[:comment]) @comment.article_id = @article.id respond_to |format| if @comment.save format.html format.js else format.html format.js end end end end the form (in haml) comments looking this: #article_write_comment %h2 write comment #article_write_comment_form %p comments limited 1000 chars. = form_for([@article, @article.

java - Repeating application in the Droid menu -

just wondering if has seen problem , knows might wrong. i've constructed of library has on main page select a, b, c ... etc. , opens page buttons whichever choice is. problem when load app onto phone has 1 app button whole app , has 1 button each a, b, c... etc .classes in can click on of , opens directly phones menu. menu has been spammed , don't think people appreciate that. have idea might be. ive made application has library type thing in before , problem never occurred. remove main , launcher intents other activities. http://developer.android.com/guide/topics/intents/intents-filters.html activities can initiate applications have filters "android.intent.action.main" specified action. if represented in application launcher, specify "android.intent.category.launcher" category: <intent-filter . . . > <action android:name="code android.intent.action.main" /> <category android:name=&quo

php - How to update two mySQL tables and input primary key from first table into second table? -

my first table contains sorts of info videos such as: video title, video thumbnail, video category, etc. second table store key points of each video.. 1 video may have 3 key points example. these fields added or deleted dynamically using jquery. i'd submit information @ once, , i'd link videos , key points using video's primary key. alternatively link them using video's file name or that. seems sloppy way. here code: if (isset($_post['submit'])) { $myvideo->addvideo ($sequence, $_files['filename']['name'], $_post['vidtitle'], $_post['vidcat'], $_files['thumbname']['name']); } else { echo $myvideo->error; } } this method adding video database. i introduce method adds key points database so:` $myvideo->addpoints($keypoint, $minutes, $seconds); i want go inside same if statement "addvideo" , want updated primary key first insert foreign key. how can accomplish th

c# - does final static automatically employ lazy instantiation? -

the page @ http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html?page=5 says code this: public final static singleton instance = new singleton(); automatically employs lazy instantiation. i want verify if 1) compilers this, or compiler free whatever wishes to 2) , since c# not have "final" keyword, what's best way translate c# (and @ same time should automatically employ lazy instantiation too) yes. static initializer guaranteed run before able access instance . there 2 negatives approach: if error occurs within singleton's construction, error little harder debug ("error in initializer"). on first use of class, object instantiated. if did locking approach, not instantiated until needed. however, being example singleton, not problem at all , drag on unused, yet lazily instantiated piece of code elsewhere not singleton. the translation c# readonly instead of final . in opinion, still vastly preferable seco

c# - Error while saving the workbook : System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC -

i creating excel file asp.net application. hosting site on iis7 . when run server, giving error while saving workbook. my code workbook.saveas(server.mappath("folder") + "\\" + filename + ".xls" , excel.xlfileformat.xlhtml, objopt, objopt, false, false ,excel.xlsaveasaccessmode.xlshared, false, false, objopt, objopt); i have been trying solve week. hope ll find here this error system.runtime.interopservices.comexception: exception hresult: 0x800a03ec i using office 2000,iis7 . have set authorizations. suggestions highly appreciated. interop not supported in sever-scenarios (like iis) ms . there many options read/edit/create excel files without interop/installing excel on server: ms provides free openxml sdk v 2.0 - see http://msdn.microsoft.com/en-us/library/bb448854%28office.14%29.aspx (xlsx only) this can read+write ms office files (including excel). another free option see http://www.codeproject.com/kb/office/open

unix - How to run the "screen" command from NSTask? -

i want monitor virtual com port (arduino rfid ) on mac. can run "screen /dev/tty.serialnumber" terminal, , outputs rfid serial number when swipe it. as try xcode nstask following output. must connected terminal. here's code: nstask *cd = [[nstask alloc] init]; [cd setlaunchpath:@"/usr/bin/screen"]; [cd setarguments:[nsarray arraywithobjects:@"-l",@"/dev/tty.usbserial-a800509k",nil]]; nspipe *pipe; pipe = [nspipe pipe]; [cd setstandardoutput: pipe]; [cd setstandardinput:[nspipe pipe]]; nsfilehandle *file; file = [pipe filehandleforreading]; [cd launch]; nsdata *data; data = [file readdatatoendoffile]; nsstring *string; string = [[nsstring alloc] initwithdata: data encoding: nsutf8stringencoding]; nslog (@"%@", string); [cd waituntilexit]; [cd release]; i think you'd better directly access com port, either using foundation libraries, or using third party obj-c libs (for example, https://github.com

vb.net - AutoNumber per group box in crystal report -

Image
i'd add auto number per group box in crystal report. here use record number increases group box. report view the autonumber @ front of barcode column. how set per group box? to incremental number each record displayed in group need use running total field. create new running total field give suitable name the field summarize can field, in case barcode the type of summary should count in evaluate section need select for each record in reset section need select on change of group , select group name drop down. place running total field next barcode field. this should give incremental number each record in group.

java - File opens before printing? -

hi m using program print files bt opens file before printing?i want remove that.any suggestions? import java.awt.desktop; import java.io.file; import java.io.ioexception; public class printfile { public static void filetoprint(file fis) { try { desktop desktop = null; if (desktop.isdesktopsupported()) { desktop = desktop.getdesktop(); } desktop.print(fis); system.out.print("printing document"); } catch (ioexception ioe) { ioe.printstacktrace(); } } } the desktop api in awt uses native functionality of system (in case windows.) jvm invoking shellexecute/shellexecuteex on file "print" command. way windows handles command search registry file type's print command, , run that. file types, result in application handles opening, , executing print command automatically. in short, don't think you'll able use desktop api without having applications open. n

Create directories and write files using PHP from a sendmail pipe to program -

i have script reads emails (with attachments) pipe , i'm trying save attachment(s) disk further processing. i've cobbled code few sites , life of me cannot files save. i'm using 777 chmod value permissions don't seem problem wanted know if maybe i'm limited php commands when using command line processor rather browser. also, i've hardcoded "include" directories in event file not executed directory located. appreciated! #!/usr/bin/php <?php //debug #ini_set ("display_errors", "1"); #error_reporting(e_all); include('/var/www/simple_html_dom.php'); //include email parser require_once('/var/www/rfc822_addresses.php'); require_once('/var/www/mime_parser.php'); // read email in stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); //create email parser class $mime=new mime_parser_class; $mime->ignore_

iphone - Any webdav or ftp server source code for iOS? -

i need implement webdav or ftp server in ios. can suggest webdav or ftp server open source project? how touchhttpd ? touchhttpd / projects / iphone webdav server touchwebdav caveats basic auth (digest auth coming soon) no ssl not optimised caching headers (if-*) cannot use finder webdav , touchwebdav server on same machine! webdav locking totally fake. set attribute operations unsupported (so chmod, touch not work)

jQuery javascript regex Replace <br> with \n -

how write regex replace <br /> or <br> \n . i'm trying move text div textarea, don't want <br> 's show in textarea, want replace \n . var str = document.getelementbyid('mydiv').innerhtml; document.getelementbyid('mytextarea').innerhtml = str.replace(/<br\s*[\/]?>/gi, "\n"); or using jquery: var str = $("#mydiv").html(); var regex = /<br\s*[\/]?>/gi; $("#mydiv").html(str.replace(regex, "\n")); example edit: added i flag edit2: can use /<br[^>]*>/gi match between br , slash if have example <br class="clear" />

ios - Adding Core Data to existing iPhone project -

i'd add core data existing iphone project, still lot of compile errors: - nsmanagedobjectcontext undeclared - expected specifier-qualifier-list before 'nsmanagedobjectmodel' - ... i added core data framework target (right click on project under "targets", "add" - "existing frameworks", "coredata.framework"). my header-file: nsmanagedobjectmodel *managedobjectmodel; nsmanagedobjectcontext *managedobjectcontext; nspersistentstorecoordinator *persistentstorecoordinator; [...] @property (nonatomic, retain, readonly) nsmanagedobjectmodel *managedobjectmodel; @property (nonatomic, retain, readonly) nsmanagedobjectcontext *managedobjectcontext; @property (nonatomic, retain, readonly) nspersistentstorecoordinator *persistentstorecoordinator; what missing? starting new project not option... thanks lot! edit sorry, have implementations... seems library missing... implementation methods full compile error " m

jqgrid table export as example -

1.can use jqgrid html form , want xml(output) give input after updating updated values in xml same signature give input. 2.it possible use lov inside table. you can data grid example respect of getrowdata . if use method without additional parameters (see the documentation ) whole grid data returned. in case of usage of local data or loadonce:true usage of getgridparam 'data' parameter better. after have data in an javascript object can use xmljsonclass.json2xml convert data xml. (see this answer code example). see additionally this , this answers questions can't find.

Is it possible to use Timers in java? -

iwant built server continuously keeps on checking database updates available notify every 5 minutes. possible use timer checking database in java v can in dot net. if has idea implement please share me. thanks in advance. yes sure possible. hope asking scheduling jobs timer timer = new timer(); timer.schedule(new yourtask(), seconds * 1000); take @ quartz scheduler more sophisticated approach.

javascript - reset forms inside an iframe from same domain -

i using 3rd party chat service makes use iframe host own chat. allow place html , javascript wondering how can add button clear forms in "formsframe" iframe main frame <iframe src="http://www.chat.com/529552/?main" name="mainframe" id="mainframe"></iframe> forms frame <iframe src="http://www.chat.com/529552/?forms" name="formframe" id="formframe"></iframe> forms names : name, email, message $(document).ready(function() { $('#formframe').ready(function() { $('#formframe').content().find('form').append('<input type="reset" value="reset" />'); }); });

iphone - Activity Indicator show and hide in splash Image & UITableView -

i want add activity indicator & show @ when select didselectrowatindexpath , hide @ while detailview page displayed...plz anyone.... , give sample code. -(void)showactivityviewer { self.activityview = [[[uiview alloc] initwithframe: cgrectmake(0, 0, self.view.window.bounds.size.width, self.view.window.bounds.size.height)] autorelease]; activityview.backgroundcolor = [uicolor blackcolor]; activityview.alpha = 0.5; self.activitywheel = [[[uiactivityindicatorview alloc] initwithframe: cgrectmake(self.view.window.bounds.size.width / 2 - 12, self.view.window.bounds.size.height / 2 - 12, 24, 24)] autorelease]; activitywheel.activityindicatorviewstyle = uiactivityindicatorviewstylewhitelarge; activitywheel.autoresizingmask = (uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblebottomm

language agnostic - COMEFROM control flow -

according wikipedia comefrom flow control considered joke, unreadable or downright harmful. i'd imagine such feature useful in aop scenarios (ie. adding logger methods without adding logger calls methods). does downside of non-obviousness of such control structure outweigh potential usefulness? there other downsides consider? prompted ask question because of this . for starters useless in modern language because need either: reference position jump line number, , these volatile. place marker or label in code denote position can jumped from, destroying possible benefits of not needing this. also: makes kind of debugging inspection useless. can't capture context jumped unless keep variables persistant, asking trouble. a better idea instead: write hooking api. call function!

iphone - Save Video and Sequence of Images while recording video using Camera -

i need save video sequence of images while recording video using iphone/ipod camera , need save video. please direct me... hope following help: how capture video frames camera images using av foundation

php - Can't put IP-address in database -

i'm trying put ip-address in database. if echo this: echo $_server['remote_addr']; but if i'm trying put in variable or in database gives nothing, in database says: null commands used that: $ip = $_server['remote_addr']; mysql_query("update users set last_ip='".$ip."' id=".$row['id']) or die(mysql_error()); i don't know i'm doing wrong. can me please? thanks! you want make last_ip column int(10) unsigned , change update be: $sql = "update users set last_ip = inet_aton('$ip') id='{$row['id']}'"; then when selecting use: $sql = "select inet_ntoa(last_ip) last_ip users"; this converts ip address integer efficient storage. more information please see mysql manual pages inet_aton() , inet_ntoa() . otherwise if want stored text rather in efficient way can set last_ip column char(16) , continue use update query poste

iphone - App crashing on deleting a row -

my table used list rows core data. works fine, have used 2 types of data load on same table view. data types change on account of scope button change. 2 scope buttons 1 displays completed tasks while other displays pending taks. can search, update on table. while completed list of datas editable , can deleted, works fine , gives error such, serious application error. exception caught delegate of nsfetchedresultscontroller during call -controllerdidchangecontent:. *** - [nsmutablearray insertobject:atindex:]: index 4 beyond bounds empty array userinfo (null) the fetch result controller initialised as, - (nsfetchedresultscontroller *)fetchedresultscontrollerwithpredicate:(nspredicate *)predicate{ if (self.fetchedresultscontrol != nil) { nslog(@"here outside"); return self.fetchedresultscontrol; } the code load cell tableview : - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring

eclipse - Getting information from index in ArrayList depending on what Google Maps OverlayItem is being tapped (Android) -

i have user class in have arraylist of bar objects. create bunch of overlayitem objects google map using arraylist , i.e. arraylist holds latitude, longitude, name, , on. want able tap overlayitem , more information specific bar, such address, owner name, website url, etc. overlayitem holds latitude, longitude, title, , text snippet, i.e. not enough info want. how tell ontap() function bar object specific overlayitem i'm tapping on corresponds to? i haven't used api can offer general advice. 1 option create map allow convert overlayitem reference bar object created from. depending on how ontap supplied may possible access outer variables inside give information without map. option may subclass overlayitem own version includes data need, provided api allows create , pass in own overlayitem s.

html - How to change headers level by XSLT based on depth in XML -

my xsl-file: ... <div> <xsl:choose> <xsl:when test="count(ancestor::node()) = 1"> <h2> </xsl:when> <xsl:when test="count(ancestor::node()) = 2"> <h3> </xsl:when> </xsl:choose> <xsl:attribute name="id"> <xsl:value-of select="@id" /> </xsl:attribute> <xsl:copy-of select="title/node()"/> <xsl:choose> <xsl:when test="count(ancestor::node()) = 1"> </h2> </xsl:when> <xsl:when test="count(ancestor::node()) = 2"> </h3> </xsl:when> </xsl:choose> </div> i know not allowed split tags h2.../h2, h3.../h3 this. but how corre

php - Select different network interface for Zend_Service_Amazon_S3 -

i wondered if it's possible set network interface (i.e. eth0:1 or eth0:2 ) zend_http_client , used in zend_service_amazon_s3 . use socket bindto , enter ip of eth0:2 see example #2 on page: http://framework.zend.com/manual/en/zend.http.client.adapters.html

application pool - Get List of AppPools from IIS -

i'm using vb.net 3.5 asp.net , need list apppools names iis , show them in dropdownlist. please ? thanks finally found solution , here methods .. public function getapppoolnames() list(of string) dim root system.directoryservices.directoryentry = getdirectoryentry("iis://localhost/w3svc/apppools") 'directoryentry root = new directoryentry("iis://localhost/w3svc/1/root"); dim applist new list(of string) if root nothing else each dir directoryentry in root.children dim pr system.directoryservices.propertycollection = dir.properties 'applicationpool pool = new applicationpool(); 'pool.name = dir.name; 'dropdownlist1.items.add(pool.name); applist.add(dir.name) next end if return applist end function private function getdirectoryentry(byval path string) directoryentry dim root directoryentry = nothing try root = n

php - Header redirect after download -

i new php , learning step step. i've download page want redirected after download has been completed. header('content-type: application/octet-stream'); header('content-disposition: attachment; filename="dlink.pdf"'); header("cache-control: must-revalidate, post-check=0, pre-check=0"); readfile('dlink.pdf'); header("refresh: 2; auto_works.html"); exit; this download code enclosed within php tag. how can achieve directive ? please help. mention me supposed write line of code thanks you can't redirect after download complete. webserver (which redirect) doesn't know when download complete. there ofcourse ways, they're difficult , not worth it. you 'should' redirect after download started.

javascript - Intercept selection in window.onbeforeunload dialog -

in web application if user leaves current page without having saved changes in form pop window opened alert him that. for pop use scripts code injected codebehind (c#): var confirm = true; window.onbeforeunload = confirmclose; function confirmclose() { if (!confirm) return; if(/*check change condition true*/) { return " + warn_message + "; } } i need intercept whether user click on cancel or ok button. i tried like: var button_pressed = window.onbeforeunload = confirmclose; but returns true. how can button pressed? thanks not possible. there no event associated buttons. might able see if user came setting value or perhaps cookie in page in onbeforeunload , test if there after time has passed but see duplicate way know if user clicked cancel on javascript onbeforeunload dialog?

regex - HTML5 Form Input Pattern Currency Format -

using html5 have input field should validate against dollar amount entered. have following markup: <input type="number" pattern="(\d{3})([\.])(\d{2})"> this works great amount greater 100.00 , less 1,000.00. trying write pattern (regex) accept amount less dollar , greater dollar. maybe upwards of 100,000.00. possible? any appreciated! :) regards, ben if want allow comma delimiter pass following test cases: 0,00 => true 0.00 => true 01,00 => true 01.00 => true 0.000 => false 0-01 => false then use this: ^\d+(\.|\,)\d{2}$

java - Text overlaping problem using itext for generating a pdf -

hi have header text(artist biography(continue)) in pdf file generated using itext(java).where 'artist' , '(continue)' static text 'biography' dynamic text varied respect content fetched xml.my problem while dynamic text length long overlap '(continue)' text.how can set dynamic text length respect nearest static text'(continue)'.please reply in advance my code displaying header text (artist biography(continue)) written bellow pdfcontentbyte cb = writer.getdirectcontent(); basefont bf = basefont.createfont(basefont.helvetica, basefont.cp1252, basefont.not_embedded); cb.setfontandsize(bf, 18); cb.begintext(); cb.setcolorfill(color.black); cb.showtextaligned(pdfcontentbyte.align_left,"artist", document.left(), document.top() + 20 , 0); cb.resetrgbcolorfill(); cb.endtext(); cb.begintext(); cb.setcolorfill(color.red); cb.showtextaligned(pdfcontentbyt

ruby on rails - How to generate array for grouped_options_for_select based on models -

a product belogs_to category. category has_many products i need select tag includes optgroup tag. so basically, need html markup similar pseudo code: <select name="product" class="products"> <option value=""></option> <optgroup label="cheese"> <option value="1">cheese 1</option> <option value="2">cheese 2</option> <option value="3">cheese 3</option> </optgroup> <optgroup label="juices"> <option value="3">juice 1</option> <option value="4">juice 2</option> <option value="5">juice 3</option> </optgroup> </select> based on models, how generate array put grouped_options_for_select ? example, best approach generate grouped_options ? <%= select_tag 'product', grouped_options_for_select(grouped_options), :inc

shell - command line sftp: email address as username -

i need connect sftp server mac os x , username given email address (someone@example.com) so connection string looks like: sftp someone@example.com@ftp.example.com the connection not accept password assume confused double "@". i tried escape first "@" "\@" crashed sftp server , have effect shell i'd think. what proper way escape in order work. unfortunately sftp command on mac os x not allow me option interactive username prompt. add entry host in ~/.ssh/config has desired name. host stupidadminhost hostname ssh.example.com user somewhere@outthere.com then sftp stupidadminhost instead, no given username.

java - Android location aware chat application -

i need kind of application.i don't know how 2 devices communicate on internet. think should create database store users information, , create sockets communication. there better way this? most mobile networks use form of nat, inbound connections mobile devices not possible. you'll need intermediate server. p2p possible, setup connection still need server. don't reinvent wheel: there lot of servers/libraries/protocols chat. pick one. notable 1 xmpp, open protocol, multiple free oss server implementations , libraries (including android). additionally can create own server app, login/authentication , location-aware stuff. once 2 users authenticated , location-paired, can hand-off chat part xmpp server.

javascript - Is using Amazon s3 as a database (of sorts) for a PHP app a bad decision? -

i'm teaching myself javascript , php building app, , decided use amazon ec2 , s3 platform. question using s3 "database", i'll start bit of background. the app uses class interact s3 buckets: http://undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation#getobject when user logs app, app download file s3 bucket. every user has own file. using json, bring data client side, , of "interaction" client side (using javascript) , bit of php. once user done (probably after 30 minutes or so), app save/upload , replace s3 file. my reasoning behind of think app scalable. hope can use load balancing, each instance being able interact directly s3. if lots of users log on, can create lots of "micro" or "small" instances handle them all. 1 of drawbacks of ec2 if instance crashes or goes offline, data lost, thoughts instead of having - why not build app around s3 in first place? my question: make sense? there reason haven't seen ma

android - Got hit by an UnsupportedOperationException -

i have following code: private static arrayadapter<string> adapter; private static list<chapter> chapters; public void update(book book) { adapter.clear(); if (chapters != null) { chapters.clear(); } chapters = databaseconnector.getchaptersfrombook(book.getid()); (chapter chapter : chapters) { adapter.add(chapter.gettitle()); } header.settext(book.getabbreviation()); subheader.settext(book.getname() + " (" + book.getnumber() + ")"); subheader.setvisibility(view.visible); } if call method update(book book) , variable chapters not null , hit unsupportedoperationexception in line chapters.clear() . hints how solve problem? i have @ api documentation, presumably databaseconnector.getchaptersfrombook(book.getid()) call returning immutable list, can't modify it. seems have make local copy.

jquery - Template formatting -

i'm trying figure out how can format value jquery templates . one of values bool convert string. tried: {isvisible?'x':'-'} which didn't work. how can it? that should work fine (provided it's prefixed $ ): ${isvisible ? 'x' : '-'} working demo .

python - custom views within Djangocms? -

i haven't found satisfactory way of doing this: have djangocms setup working fine. need add content table outside cms homepage , render content on template. can this, editing urls.py within cms use views so... url(r'^', 'myapp.views.slideshow_info'), ... excludes content cms. understand custom views accommodate cms' views doing, how achieve this? at moment app's views says: from myapp.models import model1, model2 def slideshow_info(request): return render_to_response('index.html', {'slideshow_list' : model1.objects.all()}) many thanks you can hook custom app instance django-cms page. here's documentation on how so: http://docs.django-cms.org/en/2.1.3/extending_cms/app_integration.html#app-hooks shouldn't need alter base url patterns re-route / view. before custom app-hooks available, accomplish you're trying template tags. hope helps out. followup ok, in completed site, had hook app titled &qu

redirect - Tcl/Tk - Memchan - fifo - how to rename fifo as stdout in a tcl/tk application which has Memchan statically linked? -

i cross posted question on comp.lang.tcl. i developing tcl/tk application (call rs ) , want redirect stdout , stderr text box in tcl/tk application. using memchan achieve (i statically linked memchan application). unable rename fifo channel created stderr . (the same thing holds true stdout too) for example, in following snippet, closing stderr , opening fifo stderr fifo channel remains named fifo0 not stderr . $ rs rs> package require memchan 2.3 rs> chan names stdin stdout stderr rs> close stderr rs> chan names stdin stdout rs> set stderr [fifo] fifo0 rs> chan names fifo0 stdin stdout i expected stderr instead of fifo0 when typed in last of chan names command. but when use tclsh8.5 above sequence produces desired effect i.e fifo renamed stderr $ tclsh8.5 % package req memchan 2.3 % chan names stdin stdout stderr % close stderr % chan names stdin stdout % set stderr [fifo] fifo0 % chan names stderr stdin stdout

java - Writing Stax XML to ObjectOutputStream(socket.getOutputStream) getting MalformedByteSequenceException -

i'm trying send xml message server client app using sockets in java don't know how write stream: string user = "oscar" string pass = "1234" objectoutputstream oos = new objectoutputstream( socket.getoutputstream()); // create xmloutputfactory xmloutputfactory outputfactory = xmloutputfactory.newinstance(); // create xmleventwriter xmleventwriter eventwriter = outputfactory .createxmleventwriter(oos); // create eventfactory xmleventfactory eventfactory = xmleventfactory.newinstance(); xmlevent end = eventfactory.createdtd("\n"); // create , write start tag eventwriter.add(eventfactory.createstartdocument()); eventwriter.add(end); //se crean los atributos del tag arraylist<attribute> attributes = new arraylist<attribute>(); attributes.add(eventfactory.createatt

android - How to keep background image size when software keyboard show -

when software keyboard shows, resizes layout , squeezes background image together. question duplicate of question, explained in way: software keyboard resizes background image on android however, question closed when found hack solve it. cannot use hack. entire layout inside scrollview, , need able use scrollview @ times. using android:windowsoftinputmode="statevisible|adjustpan" user not able scroll down , see bottom of screen while keyboard showing, since layout partly exist behind keyboard. solution unacceptable me. there better solutions out there? cheers, i ran similar problem not long ago. stumbled upon correct answer bit of work, though. in android manifest project, attached specific activity using, use line android:windowsoftinputmode="adjustpan|statevisible" in activity tag. adjustpan means activity not resize fit soft keyboard, , statevisible means soft keyboard show when requested (this can statealwaysvisible , etc if necessary)

redirect - apache2 vhost redirection -

i have defined differents hosts in windows host file, 1 every project release (rc1, rc2 etc..) create 1 vhost per release can redirect directly subdir, example : pp15.mv => http://localhost/mv/pp15/ ..... pp16.mv => http://localhost/mv/pp16/ ..... moreover, need redirect host ppx.mv autologin url, looks /mv_dbname.php?login=testlogin&mdp=202cb962ac59075b964b07152d234b70 so, finally, want type in urlbar : http://pp15.mv , redirected to http://pp15.mv/mv_dbname.php?login=testlogin&mdp=202cb962ac59075b964b07152d234b70 in virtual host file have : <virtualhost *:80> servername pp15.mv documentroot "d:\apache\htdocs\mv\pp15" <directory "d:\apache\htdocs\mv\pp15"> allowoverride allow </directory> rewriteengine on rewriterule ^/index.php /myvisitv3_dbname.php?login=johsmi&mdp=202cb962ac59075b964b07152d234b70 [r] rewriterule ^(/)?$ /myvisitv3_dbname.php?login=johsmi&mdp=202c

Custom jquery validate messages for all errors -

how can specify custom error message each error type, required , date. want different message depending on error type. i have field looks this <input type="text" id="dateofbirth" name="dateofbirth" class="required date" /> my error messages this this field required or please enter valid date how can make following date of birth required , please enter valid date date of birth i'm using var validator = $("form:first").validate({ errorclass: 'input_state_error', rules: { dateofbirth: "required date" }, messages: { dateofbirth: "please enter date of birth" }, // errorplacement has take table layout account errorplacement: function(error, element) { error.appendto($('#ctl00_lblmessage')); }, // specifying submithandler prevents default submit, demo submithandler: function() { alert(&qu

java - Android Bluetooth sending file problem -

i writing small program send file between android , pc through bluetooth. read bluetooth chat example in google android site. currently, version works sending text message via bluetooth, when send files, around >= 20 kb, stops working , throwing eofexception below: java.io.eofexception @ java.io.objectinputstream$blockdatainputstream.readfully(objectinputstream.java:2716) @ java.io.objectinputstream.readarray(objectinputstream.java:1665) @ java.io.objectinputstream.readobject0(objectinputstream.java:1340) @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1963) @ java.io.objectinputstream.readserialdata(objectinputstream.java:1887) @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1770) @ java.io.objectinputstream.readobject0(objectinputstream.java:1346) @ java.io.objectinputstream.readobject(objectinputstream.java:368) @ com.test.pcserver.bluetoothserverlistener.run(bluetoothserverlistener.java:74) @

java - Does JMX needs a web app to connect to it? -

would jmx work java applications no way web related, act game servers? or need have web app run , connect jmx , able monitor java application? [check question case] confusing.. jconsole , visualvm use jmx , can connect java process. a web server make no difference.

c# - Database included in an application -

i have winform application in c#on visual studio, connected database in sql server 2008 , have done deployment use must install sql server management studio , restore database backup, can when doing deployment , setup project include or take database backup not need install sql server management studio on pc use application , application take backup updated database has new records how make deployment , setup project , embedded in database used i'll not needed install sql server in pc act server , clients pcs want use application in network? if database trivial, should accessible single computer , used store local data the. http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx . sure need read additional articles how use , deploy it, should starting point. note: not have stored procedures , advanced sql server features, use same code now.

c++ - MSXML2: How can I get value of a node? -

i have node msxml2::ixmldomnodeptr node; node->getxml() returns "<level3>333<level4 atribute="444"><level5>555<level6>666</level6></level5></level4></level3>" node->gettext(); returns "333555666" node->getnodevalue() throws exception if node not attribute. how can value 333 ??? you have walk children of node have in hand - can list using childnodes after checking node has children of course, can use gettext() extract individual element texts. it's quite painful code msxml dom, in experience. glad see using built-in smart pointers, anyway.

java - Running multiple JPA transactions in parallel -

i have 2 (or more) java threads creating, updating , deleting entities mysql database using jpa. achieve have persistencelayer class creating entitymanager , providing save, update , delete methods entities looking like: public void saveentity(entity entity) { manager.gettransaction().begin(); manager.persist(entity); manager.gettransaction().commit(); } public void saveentity2(entity2 entity) { manager.gettransaction().begin(); manager.persist(entity); manager.gettransaction().commit(); } if 1 thread enters operation saveentity , other saveentity2 @ same time, both try transaction entitymanager wich fail. thought underlying database able manage multiple transactions, if both working on different rows or different tables. of course synchronize blocks, mean 1 db connection possible @ time not scale multiple users creating several threads. what wrong assumption doing here? possible submit multiple transactions database via jpa , let db handle concurrenc