Posts

Showing posts from June, 2015

blackberry - show indeterminate spinng hourglass when user click in a button -

in application there button field, when user click it, application communicate webserver, want insert dynamic spinning "hour glass" @ time ....if 1 knows solution plz help... i hope u want wait screen feature try these links: http://www.naviina.eu/wp/blackberry/loading-class-for-blackberry/ blackberry - loading/wait screen animation

c# - Simple databinding not working -

i'm new wpf , i'm trying make simple app, stopwatch. works fine if i'm not doing data binding. here's xaml. <window x:class="stopwatch.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:stopwatch" title="mainwindow" height="318" width="233"> <window.resources> <s:stopwatchviewmodel x:key="swviewmodel" x:name="swviewmodel"></s:stopwatchviewmodel> </window.resources> <grid datacontext="{staticresource swviewmodel}"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> <rowdefinition height="128*" /> </grid.rowdefinitions> <textblock grid.row="1" height="49" hori...

How can you get the sample rate frequency of the iphone accelerometer? -

is there function or method iphone's current sampling rate of running accelerometer? i know how set iphone accelerometer frequency, verify running @ frequency it should set accelerometer running... // set accelerometer 30 updates per second filter = [[filterclass alloc] initwithsamplerate:30.0 cutofffrequency:5.0]; filter.adaptive = useadaptive; [[uiaccelerometer sharedaccelerometer] setupdateinterval:1.0 / 30.0]; [[uiaccelerometer sharedaccelerometer] setdelegate:self]; now how can find out sample frequency currently? oops.... found it..! nslog(@"updateinterval: %f", [[uiaccelerometer sharedaccelerometer] updateinterval]); updateinterval: 0.033333 bang on 30 cycles per second set!

silverlight - Creating Popup programmatically in WP7 -

how create popup in program? e.g. need rename file in phone app. how using popup in wp7? take @ input prompt control in coding4fun windows phone toolkit

sql server 2005 - join using two column in sql -

projectmaster projectid itmanagerid developmentmanagerid -------------------------------------------------- 1 1000 1001 usertable userid username ---------------- 1000 sam 1001 ram result project itmanagername devmanagername ------------------------------------------------ 1 sam ram help write query edit: tried select projectid,projectname,projectdescription,startdate,enddate, apsmanagerid,projectmanager,ragstatus,projectstatus,projectpriority, categoryid,inactivedate,comments,it.username itprojectmanagername, dev.username devmanagername pmis_project p,pmis_user it,pmis_user dev p.devprojectmanager = it.userid , p.itmanagerid = dev.userid , p.projectid in (select projectid selectedproject) you can join table many times needed. in case one join users itmanager's name. one join users devmanager's name. sql statement sel...

javascript - How to send php variable from Colorbox iFrame to parent; and how to have a function involving said variable run on parent without reload -

i'm bit new programming bear me here. i'm trying have link clicked within colorbox iframe (each link on parent page opens different colorbox based on mysql variables) execute function in parent frame without having refresh. the link clicked in iframe song, , i'd leave iframe untouched (ie not close), though parent-based player play specific song... is possible? making complicated? solution? any more appreciated. you can call javascript functions defined in parent window of iframe using parent.yourfunction(); so can have in parent: function myfunction(songid) { } and in iframe call this: parent.myfunction(songid)

javascript - Regex to match multiple patterns in any order -

i'm validating password complexity in asp.net mvc3 app. current requirements must contain @ least 1 upper case letter, 1 lower case letter, 1 digit , no more 3 repeated characters. i'd generalise numbers though, , add condition non-alphanumeric characters. at present, i'm validating server-side only, i'm able call regex.ismatch multiple times using 1 regex each condition. want able validate client-side though. because unobtrusive jquery validation allow 1 regex, need combine 5 conditions single pattern. i don't know when comes regular expressions i've been doing bit of reading recently. may missing simple can't find way , multiple patterns way | or them. you can (in .net) several lookahead assertions in single regex: ^(?=.*\p{lu})(?:.*\p{ll})(?=.*\d)(?=.*\w)(?!.*(.).*\1.*\1) will match if conditions true. ^ # match start of string (?=.*\p{lu}) # true if there @ least 1 uppercase letter ahead (?=.*\p{ll}) ...

java - Run application in the background -

Image
i'm trying start groomdroid web server in android when starts, black window shown. i'd start app in background without screen being shown. i'm starting app in following way: intent webserver = new intent(); webserver.setclassname("net.allory.groom","net.allory.groom.groomdroid"); startactivity(webserver); i tried startservice(webserver); doesn't seem work. can me ? you should move background logic service, , when it's running create ongoing notification. selecting notification should start activity (ui), , service can communicate data using handler. also, if specify launchmode of activity singletask : <activity android:name=".activity.youractivity" android:launchmode="singletask" android:alwaysretaintaskstate="true" android:cleartaskonlaunch="false" android:finishontasklaunch="false"> <intent-filter> <action android:name...

java - iText: Setting image interpolation for images on a page -

i want iterate through pages of pdf , write new pdf images have interpolation set false. expecting able following, cannot find method of accessing images or rectangles on pdf page. pdfcopy copy = new pdfcopy(document, new fileoutputstream(outfilename)); copy.newpage(); pdfreader reader = new pdfreader(infilename); for(int = 1; <= reader.getnumberofpages(); i++) { pdfimportedpage importedpage = copy.getimportedpage(reader, i); for(image image : importedpage.images()) image.isinterpolated(false); copy.addpage(importedpage); } reader.close(); there is, however, no pdfimportedpage.images(). suggestions on how might otherwise same? cheers nik it won't easy. there's no high-level way of doing want. you'll have enumerate resources looking xobject images, , clear /interpolate flag. and you'll have before creating pdfimportedpage because there's no public way access resources. grr. void removeinterpolation( int pagenum ) { ...

php - postgresql max execution time -

is there option use postgresql functions in php, can specify maxim execution time query ? don't want enable config file because queries need restricted. run php query before main query like set statement_timeout 5000;

jdbc - soapUI access MS SQL DB from groovy script -

i trying connect ms sql 2005 db soapui using groovy script. import groovy.sql.sql sql = sql.newinstance("jdbc:jtds:sqlserver://servername\\inst1/databasename", "username", "password", "com.microsoft.sqlserver.jdbc.sqlserverdriver") error: no suitable driver found jdbc:jtds:sqlserver://32esx802\inst1/tlmain i have tried use "net.sourceforge.jtds.jdbc.driver" still same error please let me know doing wrong. thanks found answer first remove "jtds" connect string, syntax like sql = sql.newinstance("jdbc:sqlserver://servername\\inst1/databasename", "username", "password", "com.microsoft.sqlserver.jdbc.sqlserverdriver") once fixed error came up. got timeout error. based on the original post there seems weird conflict between groovy sql , ms sql. work around remove databasename , database reference in sql statement. sql syntax like. import groovy...

C# dll which is inter-operable with php and java -

i need create dll in c sharp interoperable php , tomcat/java webservices. will normal c# class library me this? thanks, john will normal c# class library me this? you expose class library wcf service using interoperable basichttpbinding consumed php , java.

php - DBCS not saving properly -

i have edit.php file allow me edit contents of web form. text stored in .txt files. problem comes when try enter characters in japanese, or korean etc. i input this: "たんじょびおめでとう" and once save it, returns this: "%u305f%u3093%u3058%u3087%u3073%u304a%u3081%u3067%u3068%u3046" does 1 have ideas how have characters saved correctly. find if change encoding on .txt files utf-8 , input characters using notepad rather through edit.php tends save fine, though i'd rather not have this. thanks help! edit wasn't sure code put, i'm assuming it's way of saving. here save.php file: $content = $_post['content']; if($content == ''){ echo "you cannot null field, please reload page."; } else { echo $content; $myfile = "text/".$_post['id'].".txt"; $fh = fopen($myfile, 'w') or die("could not update"); fwrite($fh,$content); fclose($fh); } you'l...

How do I use a StringMatchFilter to send logging events to different logs by their message content in log4net? -

This summary is not available. Please click here to view the post.

iphone - Parsing SOAP result using TouchXML in iOS SDK (iPad) -

i'm working on ipad project using functions in webservice. handling webservice connection, data etc works find. i'm not able parse result soap using touchxml. getting nodes out of xml returns 0 length. the output xml: <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <logonresponse xmlns="http://coreservices.org/v1"> <logonresult> <id>1c0e9ad0-a3be-4cd0-8f0d-0616a63a4e28</id> <userid>2</userid> <user> <id>2 <name>beheerder <emailaddress /> <culturename>nl-nl</culturename> </user> ...

javascript - Printing a webpage with varying div sizes -

is there way make divs not cut in half when printing multiple pages? there divs trying print vary in size , print none of them cut off , full div boxes appear on single page. maybe there way calculate height of each div , if 1 puts on height of page, put on next page? know length of text within each div , maybe way, how go designating div printed on page? use css property page-break-inside : http://www.w3.org/tr/css21/page.html#page-break-props

PHP get previous array element knowing current array key -

i have array specific keys: array( 420 => array(...), 430 => array(...), 555 => array(...) ) in application know current key (for example 555 ). , want previous array element. in example array element key 430 . how can in php? tried work prev() , function should know current array element. didn't find function, set current array element. one option: to set internal pointer position , have forward (using key , next , maybe reset before make sure start beginning of array): while(key($array) !== $key) next($array); then can use prev() : $prev_val = prev($array); // , key $prev_key = key($array); depending on going array afterwards, might want reset internal pointer. if key not exist in array, have infinite loop, solved with: while(key($array) !== null && key($array) !== $key) of course prev not give right value anymore assume key searching in array anyway.

Theme and Style in Android -

can 1 tell me how apply theme , style in android. did @ tutorial? http://developer.android.com/guide/topics/ui/themes.html basically, add styles this. <textview style="@style/codefont" android:text="@string/hello" /> and themes this <application android:theme="@style/customtheme">

How to include another XHTML in XHTML using JSF 2.0 Facelets? -

what correct way include xhtml page in xhtml page? have been trying different ways, none of them working. <ui:include> most basic way <ui:include> . included content must placed inside <ui:composition> . kickoff example of master page /page.xhtml : <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> <h:head> <title>include demo</title> </h:head> <h:body> <h1>master page</h1> <p>master page blah blah lorem ipsum</p> <ui:include src="/web-inf/include.xhtml" /> </h:body> </html> the include page /web-inf/include.xhtml (yes, file in entirety, tags outside <ui:composition> unnecessary ignored facelet...

php - JQuery Load functions producing unexpected results -

to follow on previous question here function used determine elements selected radio buttons , checkboxes loaded on right hand sign , elements loaded out via 'blank2.html'. problem is loading wrong elements in @ wrong points in time. here code. function product_analysis_global() { $(':checked').each(function() { var alt = $(this).attr('alt'); var title = $(this).attr('title'); if ($('#product_quantity_pri_' + alt).attr('title') != title) { $('#product_' + alt).load(title); $('#product_quantity_pri_' + alt).attr('title', title); $('#product_quantity_pri_' + alt).val($(this).val()); } else if ($('#product_quantity_pri_' + alt).attr('title') != 'http://www.divethegap.com/update/blank2.html') { $('#product_' + alt).load('http://www.divethegap.com/update/blank2.html'); $('#product_quantity_pri_' + a...

.NET 3.5 C# Bug with System.Timer System.ObjectDisposedException: Cannot access a disposed object -

in windows service app using timers lot. i'm using system.timers. i've never experienced problem before, got exception: system.objectdisposedexception: cannot access disposed object. @ system.threading.timerbase.changetimer(uint32 duetime, uint32 period) @ system.threading.timer.change(int32 duetime, int32 period) @ system.timers.timer.updatetimer() @ system.timers.timer.set_interval(double value) @ myapp.myspace.myspace2.myclasswithtimer.methodchangetimerinterval() in method stopping timer, , changing timer interval. place got exception. i have read bug still passible have bug in .net 3.5? how fix it? should renew timer object after stopping , set interval new object? using gc.keepalive(datatimer); edit: found other questions problem: *i found link http://www.kbalertz.com/kb_842793.aspx stop timer, internal system.threading.timer becomes available garbage collection, causing elapsed event not occur, or causing disposed reference exception. alth...

objective c - How do I inspect and activate other application’s menu? -

is possible inspect main application menu of running application , execute commands menu? example retrieve whole main menu hierarchy of safari , execute file → new tab command (by name, not using keyboard shortcut). i’m interested in objective-c solution. one way using cocoa accessibility api for example, nsaccessibilitypickaction selects object, such menu item

asp.net - What email service provider can I connect a .net mail client to? -

every month have email out links demo music tracks make. have 30 labels , takes me ages write out email each one. dont want purchase own domain name yet there free email provider can sign allow me use .net library automatically send out messages? there plenty. www.gmail.com one. there no real difference between connecting .net mail client , email program such firebird or outlook.

How can I make fixed-length Delphi strings use wide characters? -

under delphi 2010 (and under d2009 also) default string type unicodestring. however if declare... const s :string = 'test'; ss :string[4] = 'test'; ... first string s if declared unicodestring , second 1 ss declared ansistring ! we can check this: sizeof(s[1]); return size 2 , sizeof(ss[1]) ; return size 1. if declare... var s :string; ss :string[4]; ... want ss unicodestring type. how can tell delphi 2010 both strings should unicodestring type? how else can declare ss holds 4 widechars? compiler not accept type declarations widestring[4] or unicodestring[4] . what purpose of 2 different compiler declarations same type name: string ? the answer lies in fact string[n] , shortstring , considered legacy type. embarcadero took decision not convert shortstring have support unicode. since long string introduced, if memory serves correctly, in delphi 2, seems reasonable decision me. if want fixed length arrays of widechar can...

java - Are there good reasons for a public constructor of an abstract class -

it not possible create object directly calling constructor of abstract class. constructor of abstract class can called derived class. therefore seems me constructors of abstract class must either protected or package-private (the latter unusual cases of restricting use of constructor derived classes within package). yet java allows constructor of abstract class public . are there circumstances in useful declare constructor of abstract class public , rather protected or package-private? this not quite duplicate of question " abstract class constructor access modifier ": can declare constructor public ; want know whether there ever good reason so. seems me there not. see c# has similar peculiarity . the answer same java: there's no reason public constructor abstract class. i'd assume reason compiler doesn't complain simple didn't spend time covering since doesn't matter if it's public or protected. ( source ) you can...

android - How to distinguish whether onDestroy will be called after onPause -

is there way how distinguish whether ondestroy() called after onpause() ? in may activity need different action when activity lost focus , when activity going down, when activity going down onpause() called before ondestroy() want different action in onpause() when activity lost focus , when going down , ondestroy() gonna called. yes with: @override protected void onpause() { super.onpause(); if (this.isfinishing()) { // waht want before destroying... } } but of course can't handle if app crashs ;)

Cannot run Xpath queries from JAVA in XML files having <DOCTYPE> tag -

i have made following method runs hard-coded xpath queries in hard-coded xml file. method works perfect 1 exception. xml files contains following tag <!doctype workflowdefinition system "wfdef4.dtd"> when try run query in file following exception: java.io.filenotfoundexception: c:\programfiles\code\other\xpath\wfdef4.dtd(the system cannot find file specified). the question : what can instruct program not take under consideration dtd file? have noted path c:\programfiles\code\other\xpath\wfdef4.dtd 1 run application , not 1 actual xml file located. thank in advace here method: public string evaluate(string expression,file file){ xpathfactory factory = xpathfactory.newinstance(); xpath = xpathfactory.newinstance().newxpath(); stringbuffer strbuffer = new stringbuffer(); try{ inputsource inputsource = new inputsource(new fileinputstream(file)); //evaluates expression nodelist nodelist = (...

php - Is this the Correct way of passing the Single quotes and double quotes in the string -

'<a href="javascript:void(0)" onclick="function(\''.$row['stuid'].'\')">print student details</a>'; is correct way of passing single quotes , double quotes in statement yes, is. first escape single quotes passed output , quote function-argument. inside them have quotes separate string php variable. and not have escape double quotes inside php string because single-quote delimited. $string = "this 'valid' string."; $string = 'this \'valid\' string.'; $string = 'this "valid" string.'; $string = "this \"valid\" string."; $valid = "valid"; $string = "this '".$valid."' string."; $string = 'this \''.$valid.'\' string.'; $string = 'this "'.$valid.'" string.'; $string = "this \"".$valid."\" string."; $string = "this ...

spring mvc radiobuttons -

i have view loops on list of results set in controller. trying achieve display group of radiobuttons per item in results list. field represents status e.g yes | no | maybe if status populated relevant radiobutton selected if not user can select button , save performed (via ajax call) as radiobutton must tied form thinking need multiple mini forms on page each set of radiobuttons? <c:foreach var="myvar" items="${results}" varstatus="status"> <form:form modelattribute="results" method="post"> <form:radiobutton path="" value="yes" label="yes"/> <form:radiobutton path="" value="no" label="no"/> <form:radiobutton path="" value="maybe" label="maybe"/> </form:form> </c:foreach> this render buttons need have them populated actual value in model object

performance - Why is filter in front of foldLeft slow in Scala? -

i wrote answer first project euler question: add natural numbers below 1 thousand multiples of 3 or 5. the first thing came me was: (1 until 1000).filter(i => (i % 3 == 0 || % 5 == 0)).foldleft(0)(_ + _) but it's slow (it takes 125 ms), rewrote it, thinking of 'another way' versus 'the faster way' (1 until 1000).foldleft(0){ (total, x) => x match { case if (i % 3 == 0 || % 5 ==0) => + total // add case _ => total //skip } } this faster (only 2 ms). why? i'm guess second version uses range generator , doesn't manifest realized collection in way, doing in 1 pass, both faster , less memory. right? here code on ideone: http://ideone.com/gbklp the problem, others have said, filter creates new collection. alternative withfilter doesn't, doesn't have foldleft . also, using .view , .iterator or .tostream avoid creating new collection in various ways, slower here first...

iterator - An elegant and fast way to consecutively iterate over two or more containers in Python? -

i have 3 collection.deques , need iterate on each of them , perform same action: for obj in deque1: some_action(obj) obj in deque2: some_action(obj) obj in deque3: some_action(obj) i'm looking function xxx ideally allow me write: for obj in xxx(deque1, deque2, deque3): some_action(obj) the important thing here xxx have efficient enough - without making copy or silently using range(), etc. expecting find in built-in functions, found nothing similar far. is there such thing in python or have write function myself? depending on order want process items: import itertools items in itertools.izip(deque1, deque2, deque3): item in items: some_action(item) item in itertools.chain(deque1, deque2, deque3): some_action(item) i'd recommend doing avoid hard-coding actual deques or number of deques: deques = [deque1, deque2, deque3] item in itertools.chain(*deques): some_action(item) to demonstrate difference in ...

Generating a Call Graph in R -

i've been given big chunk of poorly formatted monolithic r code plenty of functions, , i'd work out functions call functions. i thought use roxygen's @callgraph stuff, a) code needs in package, headache code, , b) doesn't seem work when run on simple package of mine. see posting 1 of roxygen authors saying call graph generation disabled because of rgraphviz dependency, code there. anyway. anyone got better way of working out foo calls bar, baz, , qux, , qux calls quux? edit: solutions based on r's profiling system great, assuming can run code... half stuff in files doesn't run, , don't know does... static analysis hope for, guess. edit 2: roxygen's call graph stuff seems static analysis, based on recursive descent of expression of function , checking is.callable. lovely able run on function... may play tomorrow... you might @ 'foodweb' function 'mvbutils' package on cran. here link article describing usage: http://...

Is there a way to get user's UID on Linux machine using java? -

is there way user's uid on linux machine using java? i'm aware of system.getproperty("user.name"); method, return's user name , i'm looking uid. you can execute id command , read result. for example: $ id -u jigar output: 1000 you can execute command by try { string username = system.getproperty("user.name"); string command = "id -u "+username; process child = runtime.getruntime().exec(command); // input stream , read inputstream in = child.getinputstream(); int c; while ((c = in.read()) != -1) { process((char)c); } in.close(); } catch (ioexception e) { } source

sql - Oracle 10g: column is blank, but is not null or an empty string -

i have column in table blank. weird thing not appear null or empty string. so, if this: select * table column null ...or: select * table column = '' i nothing. thoughts? issue query: select column, dump(column, 1016) table it'll show exact contents. related: oracle not allow empty strings; they're silently converted null .

sharepoint - Unable to create a content type - A duplicate content type was found -

i'm having problem , didnt find answers on web. i have content type named "document x" original "document" parent. (id 0x010100acea2663b318874aa9192ca9af678614) i have content type named "document x 1" "document x" parent. (id 0x010100acea2663b318874aa9192ca9af67861401) when create new content type named "document x 2" parent "document x", error "a duplicate content type 'document x 2' found"... i checked uls , error isn't reported there. can create new content type other content type (out of box or others created "calendar x") cant create new 1 "document x". (and no dont have content type named that.. whatever name use, same error) full error is: a duplicate content type "document x" found. troubleshoot issues microsoft sharepoint foundation. correlation id: b9d36bb8-1a8e-4ef4-bbd0-fbdf8e70d73b date , time: 1/24/2011 3:00:36 pm this error happening on c...

windows - Statically linking libs in Visual Studio -

when choose /mtd static linking in visual studio, try link each lib statically or there exceptions system libs? description: /mtd: defines _debug , _mt. option causes compiler place library name libcmtd.lib .obj file linker use libcmtd.lib resolve external symbols. from can see there no static linking. if want static linking need use ilmerge . , should not attempt merge in required .net framework references reference others may miss. may not possible use gac referencing.

Writing a HTML table to PDF in java -

possible duplicates: converting html files pdf pdf file generation xml or html i have table content in html format , how write table pdf file in java? i kind of working. using faceless pdf library. have doubt related still. since writing data of html format in pdf , how can know @ end of page can print remaining data on next page? right writing incomplete data on 1 pdf page , remaining data not written. i believe can use itext api.

javascript - Jquery checkboxes within containing table selector question -

my current code: <script type="text/javascript"> function checkall(checked) { $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', checked); } </script> <input type="checkbox" id="cbxselectall" onclick="checkall(this.checked);" /> the short version: how modify function call , method above check checkboxes inside table containing checxbox form element. the long version: i creating webusercontrol containing grid view in asp.net going have delete option. delete series of checkboxes 1 box in header select of them. amounts non asp.net people table header row has checkbox , every row has checxbox. i have used above code check boxes on entire page. won't work here though because want have multiple of these on page @ once each working independently. know use selector select boxes if id'd table require coding name table uniquely , put name in scri...

Php curl problem -

<?php set_time_limit(0); $php_userid = "my yahoo id"; $php_password = "my yahoo password"; $agent = "mozilla/5.0 (windows; u; windows nt 5.0; en-us; rv:1.4) gecko/20030624 netscape/7.1 (ax)"; $reffer = "http://mail.yahoo.com/"; $loginurl = "https://login.yahoo.com/config/login?"; $postfields = ".tries=1&.src=ym&.intl=us&.u=3jtlosl6ju4sc.v=0&.challenge=nzyhs1spj7zunovhpd6krnqaf5kz&hasmsgr=0&.chkp=y&.done=http://mail.yahoo.com&.pd=ym_ver=0&c=&ivt=&sg=&pad=3&aad=3&login".$php_userid."&passwd".$php_password.""; $ch = curl_init(); curl_setopt($ch, curlopt_url,$loginurl); curl_setopt($ch, curlopt_useragent, $agent); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields,$postfields); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_s...

mysql: working around implicit transaction commits? -

i wrote tool our project, applying sql update files committed, db. whenever run (on deployment), calculates list of update files need applied, , applies them iniside transaction. recently became aware of issue: mysql implicitly commit transaction, whenever ddl statements (like create) executed. http://dev.mysql.com/doc/refman/5.0/en/implicit-commit.html this issue me, sql update file contains several statements, understand result in committing transaction in middle of executing update file. problem, because whenever subsequent update fail (which happens time time) want able rollback transaction, or @ least track update files applied (completely) , not. is there way around implicit transactions issue? i.e. there way rollback sequence of ddl statements whenever 1 of them fail? any other suggestions how can handle issue? thanks gidi no. mysql not support transactional ddl. either need separate ddl statements dml statements, or perhaps try use migration tool rucku...

php - How do I allow spaces in this regex? -

i'm such amateur @ regex, how allow spaces(doesn't matter how many) in regex? if(preg_match('/[^a-za-z0-9_-]/', $str)) return false; if(preg_match('/[^a-za-z0-9_ -]/', $str)) return false; note put space before hyphen. if space after hyphen, specifying character range underscore space. (issue evadable putting backslash before hyphen escape it.) this assuming mean "allow" is: regex being used validate character string, , if matches , character string disallowed (hence return false ). characters in negated character class ( [^...] ) allowed characters. (this causing general confusion in question.)

sql - Updating database records with unique constraint -

given following simple table structure (sql server 2008), want able maintain uniqueness of numerical sequence column, want able update value given record(s). create table mylist( id int not null identity(1, 1) , title varchar(50) not null , sequence int not null , constraint pk_mylist_id primary key(id) , constraint uq_mylist_sequence unique(sequence) ); my interface allows me jumble order of items , i know prior doing update non-overlapping sequence should in , how perform update without being confronted violation of unique constraint? for instance, have these records: id title sequence 1 apple 1 2 banana 2 3 cherry 3 and want update sequence numbers following: id title sequence 1 apple 3 2 banana 1 3 cherry 2 but dealing couple dozen items. sequence numbers must not overlap. i've thought trying use triggers or temporarily disabling constraint, seem create more issues. using c# , linq-to-sql, open strictly database ...

Calling DLLs with pointers in Delphi -

i new delphi. have dll following exported function in it: bool __stdcall myfunction(char * name, int * index) this code calls dll function in c++ works perfectly: typedef void (winapi * myfunction_t)(char *, int *); void main() { hmodule mydll = loadlibrary(l"c:\\mydll.dll"); myfunction_t myfunction = (myfunction_t)getprocaddress(mydll, "myfunction"); int index = 0; myfunction("mystring", &index); } i need same in delphi. here code, not working (myfunction gets called index variable doesn't receive appropriate value). code excerpt please ignore disorder. input appreciated! type tmyfunction= function(name: pchar; var index_ptr: integer): boolean; stdcall; var fmyfunction : tmyfunction; : integer; h: thandle; begin result := 0; h := loadlibrary('c:\\mydll.dll'); fmyfunction := getprocaddress(h, 'myfunction'); if @fmyfunction <> nil begin fmyfunction('mystring',...

F# Immutable Class Interop -

how f# immutable types interface c#. i'm starting learn f# , i'd mix in c# code have, want f# classes immutable. let's we're making vector class in f#. vector.x , vector.y should re-assignable, returning new vector class. in c# take allot of legwork make .withx(float x) clone existing object , return new one. there easy way in f#? i've been searching time , can't seem find docs on this. great. and finally, if imported class c# interface like? f# code restrict me doing stupid vector.x = 10 ? this similar regardless of whether it's c# or f#. you "in c# take legwork", cmon, think vector withx(float x) { return new vector(x, this.y); } is it, right? in both c# , f#, prevent assignment x property, author property 'getter' no 'setter'. i think you're making of out harder is, or maybe i'm misunderstanding you're asking. edit for (i think rare) case of there 20 field , may want change small arbi...

class - Understanding of the objects creation in c++ -

if have class name app , class name manager. want create inside manager class app class, i've seen 2 options didn't understand difference. choice 1: //..... class app; //writing line outside declaration of func class manager{ //.. private: app *a; //... } or choice 2: class manager{ //.. private: app *a; //.. } the class app; outside class manager { ... } forward declaration. tells compiler, " app class. i'm not going tell looks like, trust me, is." think of compiler only knowing particular file (which assuming .h file) when compiles. have said member class includes pointer " app ". "what heck app ?" compiler wants know. without forward declaration (or perhaps #include app.h or similar), doesn't know, , fail compile. saying @ top, class app; , knows app class. that's needs know allocate space pointer in member class.

Edit ASMX web service landing page wording/information? -

is there way edit/add information asmx web service page? add links external files helpful service. currently, it's displaying this: my web services the following operations supported. formal definition, please review service description. testmethod i add link after " tetsmethod ". thanks. i facing same problem , found wsdlhelpgenerator element in web.config me out. https://msdn.microsoft.com/en-us/library/ycx1yf7k(v=vs.100).aspx i took source code of generated page, hand edited needed it, , saved static html file hooked wsdlhelpgenerator element: <webservices> ... <wsdlhelpgenerator href="help.html"/> ... </webservices> needed add following system.web section: <system.web> ... <compilation> <buildproviders> <add extension=".html" type="system.web.compilation.pagebuildprovider" /> </buildproviders> </...

java - Why is a windowOpened event not fired/captured when my Eclipse plug-in starts? -

i writing eclipse plug-in , 1 of classes implements iwindowlistener. result, have few methods must in class including windowopened(iworkbenchwindow window). understanding of windowopened method should called when eclipse application launched , plug-in starts, have included log statements in method , never gets called. does know why happening? has experienced similar issue? it should noted other iwindowlistener methods seem work fine. instance, windowclosed method called when exit eclipse application plug-in running in. probably because time iwindowlistener registered, window open. remember eclipse plug-ins started lazily; unless you've taken steps have plug-in start early, won't started until first time 1 of classes gets loaded.

a crawler that builds the link tree form a single website -

i want know if there outsource solutions crawler parse links , pages form given website, , output: 1.the link tree 2.the pages (where necessary) thanks! you dont need particular framework achieve task. languages know? if know java can use httpclient or httpunit libs crawling tasks. if python user, there great framework called scrapy ( http://scrapy.org/) . should check out.

iphone - suspending dispatch timers from main_queue when it was created on another one -

can suspend gcd timer queue besides 1 it's schedule run on? i have timer, created on global_queue low priority , when fires, manipulate ui work via main_queue. states in ui, have suspend timer. have switch main_queue low priority queue perform suspend? dispatch_queue_t lowpriq = dispatch_get_global_queue(dispatch_queue_priority_low, 0); mytimer = dispatch_source_create(dispatch_source_type_timer, 0, 0, lowpriq); dispatch_source_set_timer(mytimer, starttime, // interval, // 15 seconds 2000ull); // configure event handler dispatch_source_set_event_handler(mytimer, ^{ nslog(@"timer fired"); // ui work dispatch_async(dispatch_get_main_queue(), ^ { [self dosomebuttonenabledisable] }); }); dispatch_resume(mytimer); // start timer - (void)dosomebuttonenabledisable { if (someparticularstate) { // turn of...

xamarin.ios - MonoTouch.Dialog: AccessoryViews -

i need put check beside row, when using override of course below warning. in monotouch.dialog enable check? public override uitableviewcellaccessory accessoryforrow (uitableview tableview, nsindexpath indexpath) { return uitableviewcellaccessory.checkmark; (for row of course, simplified here) } warning: using legacy cell layout due delegate implementation of tableview:accessorytypeforrowwithindexpath: in please remove implementation of method , set cell properties accessorytype and/or editingaccessorytype move new cell layout behavior. this method deprecated, , instead if need use this, need configure uitableviewcells accordingly setting accessorytype , accessoryview properties on it. just create new element class implements behavior need, check recent blog on patterns building elements: http://tirania.org/monomac/archive/2011/jan-18.html

asp.net mvc 2 - MVC 2.0 Ajax: auto-submit on dropdown list causes normal postback -

i trying add ajax functionality mvc application. want form post asynchronously. here's form code: using (ajax.beginform("setinterviewee", "date", routevalues, new ajaxoptions { updatetargetid = "divinterviewee" })) and want automatically post when dropdown list selected value changes: <%= html.dropdownlist("interviewees", model.interviewees.intervieweelists.intervieweeslist, "-- select employee --", new { @class = "ddltext", style = "width: 200px", onchange = "this.form.submit();" })%> however, when try out, program posts normally, not partial postback expecting. here's think problem is: onchange = "this.form.submit();" in dropdown list. i think somehow causes normal postback instead of asynchronous postback. here's mvc generates html form tag: <form action="/setinterviewee/2011-1-26/2011-1/visit" method="post" onclick="sys.mvc.asyncf...

wpf - Fill the slider control as it progresses -

i have horizontal slider control want fill track color progresses right. i'm looking @ default implementation (the relevant part below): <controltemplate x:key="horizontalslider" targettype="{x:type slider}"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto" minheight="{templatebinding slider.minheight}"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <tickbar name="toptick" snapstodevicepixels="true" placement="top" fill="{staticresource glyphbrush}" height="4" visibility="collapsed" /> <border name="trackbackground" margin="0" cornerradius="2" height="4" grid.row="1" ...

php - How do you use curl within wordpress plugins? -

i'm creating wordpress plugin , i'm having trouble getting curl call function correctly. lets have page www.domain.com/wp-admin/admin.php?page=orders within orders page have function looks see if button clicked , if needs curl call same page (www.domain.com/wp-admin/admin.php?page=orders&dosomething=true) kick off different function. reason i'm doing way can have curl call async. i'm not getting errors, i'm not getting response back. if change url google.com or example.com response. there authentication issue or of nature possibly? my code looks this.. i'm using gets, echos, , not doing async ease of testing. if(isset($_post['somebutton'])) { curlrequest("http://www.domain.com/wp-admin/admin.php?page=orders&dosomething=true"); } if($_get['dosomething'] == "true") { echo("do something"); exit; } function curlrequest($url) { $ch=curl_init(); curl_setopt($ch, curlopt_url, ...

java - How to take a file as argument? -

i realize not descriptive question, wasn't sure how else state it.. i wrote interpreter, tiny_int.java, made language called "tiny". need know how run interpreter specified tiny file so: java tiny_int <sample.tiny it may helpful know using read tiny file filereader filereader = new filereader(file); //file being sample.tiny bufferedreader bufferedreader = new bufferedreader(filereader); you redirecting file java command, therefore should read content standard input stream ( system.in ) using, bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); use br.readline() read each line until returns null.

Android/Java - Random Read line not changing -

my text file contains known number of lines (the first line of file number of lines). want randomly read line file - use linenumberreader . problem is, doesn't generate new string - random number changes string gets linenumberreader doesn't. as title implies android app. textbox output area, testbox debugging (in code displays random number - check has changed) , r random this sample code onclick button in app. string filename = "\\sdcard\\q's.txt"; try { bufferedreader br = new bufferedreader( new inputstreamreader( new datainputstream( new fileinputstream(filename)))); // number of lines in text file numlines = integer.parseint(br.readline().tostring().trim()); // random number , write test text box int rnd = r.nextint(numlines); string tmp = integer.tostring(rnd); testbox.settext(tmp); // random number - go...