Posts

Showing posts from June, 2010

I was wondering how to create several rows in a box using the fbox command in latex -

this basic question, cant find answer question.... create box looks like: ___________________ |hello1 | |hello2 | |hello3 | |__________________| i have tried fbox command in latex. text on 1 line , not several. \fbox puts frame round content, not paragraph box. need \parbox inside \fbox \documentclass{article} \begin{document} \fbox{\parbox{\textwidth}{% hello1\\ hello2\\ hello3 }} \end{document}

c++ - How to properly interrupt a QThread infinite loop -

i'm done implementing go program human can interrupt @ time software order play. basically, i've got algorithm running in thread has @ every moment "best move" available, keeps on improving. my question : how correctly interrupt thread in infinite loop? i've tried few things, , resolved : class myworker : public qobject { q_object public: myworker(); ~myworker(); public: threadcontrol * getthreadcontrol(); public slots: void work(); private: void endofcomputation(); private: threadcontrol * threadcontrol; } notice don't subclass qthread : class threadcontrol : public qobject { q_object public: threadcontrol(); public: bool getabort(); parameter getparameter(); void setparameter(parameter & param); public slots: void setabort(bool b); private: qmutex mutex; bool abort; parameter param; }; and, finally, infinite loop coded : void myworker::work() { // ... forever...

user interface - How to use a CTabCtrl in a MFC dialog based application? -

i need expected simple - create tab control has 2 tabs, implying 2 modes of operation app. when user clicks on tab1, he'll presented buttons , textboxes, , when clicks tab2, other input method. noticed there ctabctrl class thats used in mfc add tabs. however, once added tab ctrl using ui designer, couldn't specify how many tabs there'll using property window. searching on net, found examples of them required derive ctabctrl , create 2 or more child dialogs etc , write own custom class. question is, since want basic, why couldn't using familiar add event handler/add member variable wizard , handle else inside app's class ? surely, default ctabctrl class can useful without needing derive ? the mfc tab control pretty thin wrapper on win32 tab control, works in pretty way describe. window, provides switching between child windows using tabs. happens, in straight win32 useful way work. if want more sophisticated switching between individual windows, using...

.htaccess - setting up 301 redirects: dynamic urls to static urls -

we using template-based website , hoping move site static urls. our domain stay same. understand using 301 redirects in .htaccess file preferred method -- , 1 has highest chance of preserving our google rankings. i still new @ , having hard time figuring out proper way code all. over hundred of our pages indexed. have similar url different pageids: http://www.realestate-bigbear.com/nav.aspx/page=%2fpagemanager%2fdefault.aspx%2fpageid%3d2020765 some link out provided content, ex. /realestatenews/default.aspx then there many flow main featured listings page: /listnow/default.aspx down specific properties.. propertyid changes /listnow/property.aspx?propertyid=2048098 would simple set of codes work... following.... redirect 301 /nav.aspx/page=%2fpagemanager%2fdefault.aspx%2fpageid%3d2020765 www.realestate.bigbear.com/searchbigbearmls.htm or need entirely different? this depends on trying do. example posted, of unique pages going go sing...

Running WatiN using Scheduled task or Windows service -

my watin automation doing file download working fine when executed in command window normally. failing timeout exceptions or filedownload dialog not found exception when executed scheduled task. is possible execute watin exe (with filedownload dialog handler) scheduled task. if no there other way execute schedule task. note: have seen blogs referring running watin using cc.net. so, possible run above scenario using cc.net pointers cc.ent documentation , working let me know if u require more informations.. for work, have enable desktop interaction , have user logged in. if running on server, here's a clever way start process , make sure has desktop access.

vb.net - How can i get the DomainName\AccountName with the .NET Framework? -

how can domainname\accountname as string .net framework? system.security.principal.windowsidentity.getcurrent().name.tostring()

tsql - Dynamic SQL, sp_executesql, and rebuilding the dynamic sql statement - Part 1 -

part 1: in article, "dynamic search conditions in t-sql...for sql 2005 , earlier", erland sommarskog gives example of how use dynamic sql sp_executesql. http://www.sommarskog.se/dyn-search-2005.html#sp_executesql select @sql = -- 19 'select o.orderid, o.orderdate, od.unitprice, od.quantity, -- 20 c.customerid, c.companyname, c.address, c.city, -- 21 c.region, c.postalcode, c.country, c.phone, -- 22 p.productid, p.productname, p.unitsinstock, -- 23 p.unitsonorder -- 24 dbo.orders o -- 25 join dbo.[order details] od on o.orderid = od.orderid -- 26 join dbo.customers c on o.customerid = c.customerid -- 27 join dbo.products p on p.productid = od.productid -- 28 1 = 1' -- 29 ...

asp.net - render text file and change object's properties -

i want generate output of asp.net page reading text file, controls out of text, change te properties of these controls, render , displaying it. so example, text file may contain: <head> <title></title> </head> <body> <form id="form1" runat="server"> <div> <sys:label id="label1" runat="server" text="empty1"></sys:label> <sys:label id="label2" runat="server" text="empty2"></sys:label> </div> </form> </body> </html> after reading text, change properties of sys:label controls. after that, text rendered, , displayed. problem is, how can reach these controls ? you create text files ascx files, load them page.loadcontrol , reach it's inner controls page.findcontrol .

iphone - Code is exectuting but the view is not loading when called form a function? -

i doing book kinda application using viewbased application. mainview acts backgroundview loading pages. each page different view , have own nib. when swipe on page(actually on mainview have loaded current view/page), page removed , next/previous page added. [currentpage.view removefromsuperview]; [self.view insertsubview:nextpage.view atindex:0]; i have added popovercontroller barbutton in mainview. intialized tableviewcontroller class named popclass. popclass uitableviewcontroller class act parent popviewcontroller. self.mypopcontroller = [[popcontroller alloc] initwithstyle:uitableviewstyleplain]; self.mypopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:mypopcontroller]; when select row in popover, want backgroundview(mainview) load page corresponding number of row. for have written function in bookview(mainview) controller class. , calling popover's parent class when select row. - (void)tableview:(uitableview *)tableview didselectrowa...

wpf - Should I use DTOs as my data models in MVVM? -

i'm working on first real foray using mvvm , have been reading various articles on how best implement it. my current thoughts use data models data transfer objects, make them serializable , have them exist on both client , server sides. seems logical step given both object types collections of property getters , setters , layer in between seems complete overkill. obviously there issues inotifypropertychanged not working correctly on server side there no viewmodel communicate, long careful constructing our proper domain model objects data models in service layer , not dealing the data models on server side don't think should big issue. i haven't found info approach in reading, know if pretty standard thing, assumed de facto way of doing mvvm in multi-tier environment? if i've got wrong idea things thoughts on other approaches appreciated too. i'm no expert on this. had same scenario. agree that quite overkill. i've been using solution quite tim...

CakePHP and SQL Server 2008, Group By not working -

whenever a: $this->job->find('all', array( 'group' => array('job.some_field'), 'recursive' => -1 )); i : sql error: column 'jobs.id' invalid in select list because not contained in either aggregate function or group clause. with mysql works fine sql server 2008 seems group doesn't work anymore. how fix this? in advance sql gurus the query translated this: select * job group some_field this not valid query according sql standards, however, works in mysql because of mysql 's group by extensions. you need leave grouped columns or aggregates in select clause: select some_field, count(*) job group some_field with this: $this->job->find('all', array( 'fields' => array('job.some_field', 'count(*)'), 'group' => array('job.some_field'), 'recursive' => -1 )); ...

mongodb - Clojure and NoSQL databases -

i trying pick between different nosql databases project. project being written in clojure , javascript. looking @ 3 candidates storage. relative strengths , weaknesses of mongodb, fleetdb , couchdb? 1 better supported in clojure? 1 better supported under linux? did miss better product (has free , oss)? we using clojure + mongodb, , worked well. because of json data model, provided mongodb, transformed to/from clojure internal structures.

html - valid order for attributes of input type tag -

i know it's basic question , hope not important, want know answer, please don't suggest refer links. we daily face <input> type tag , attributes ( type, class, id, value, name, size, maxlength, tabindex etc.. ), want know is there specific order required attributes in <input> tag or can use order? if there order it? you can use sequence

hibernate - Second level cache for entities with where clause -

i wondering hibernate second level cache works expected if put clause in hbm.xml class definition: <hibernate-mapping> <class name="com.clazzes.a" table="table_a" mutable="false" where="xyz=5" > <cache usage="read-only"/> <id name="id" /> ... will hibernate still put id key cache, or have enable query cache? e.g. when execute hql query from id=2 results in sql similar select * table_a id=2 , (xyz=5) . if execute query twice, consider second level cache, or nevertheless execute sql twice? yes, have enable query cache. per query setting, have enough control on it.

c# - Using Linq to group by multiple columns in a list and mark all duplicate items -

using linq i'd query list , find duplicate persons (a duplicate defined having same first, last name , date of birth) , mark each of duplicate person's stateofdata property string "duplicate" , each unique person's stateofdata property string "unique". public class person { public string personfirstname { get; set; } public string personlastname { get; set; } public datetime persondateofbirth { get; set; } public string stateofdata{ get; set } public person (string firstname, string lastname, datetime dateofbirth,string state) { this.personfirstname = firstname; this.personlastname = lastname; this.persondateofbirth = dateofbirth; this.stateofdata = state; } } ilist<person> personslist = new list<person>(); person pers = new person("diane","jones","1967-01-01",""); personslist.add(pers); person pers = new person("diane","jones","1967-01-01...

Where to begin in PHP? -

what resources learning fundamentals of php language , overview of frameworks available? i've been working entire career in javascript, c# and, in older days, vbscript. find myself needing use php project due requirements. don't want pick php dummies want better information rather learning build stupid mistakes. my main points of inquiry are: zend framework - why? akin jquery javascript making regular tasks simple? variable declaration - i've read php loose language pitfalls? how take advantage of fact? general practice structure guidelines. in c# can create multiple classes , reference in code behind using statements. should apply same principle php , include php files on pages needed or there better method? i'm looking answers questions reliable resources good, detailed information. i'd rather able fish dinner if know mean. the resource need consume (and should) php manual . it's complete, though it's low on practical recommendations. ,...

java - Configuring authentication for Google App Engine application -

i have basic question caused either lack of experience or lack of documentation (or both). i'm developing application gae/j. want users can log in , gmail accounts (i.e. admin should have possibility list gmail accounts , users can work application). so, have doubts in: 1) should implement functionality admin appointment or google has done me , i'll able configure after deployment? 2) same doubts users: should provide functionality (web interface) adding/removing users or google has done me , it's configurable somewhere in configuration console after deployment? thanks! upd: know userservice class , method isuseradmin() can't figure out should happen user become admin? a few points answer question(s): when create application can specify types of accounts want. can choose google accounts or set googleapps specific. in application configuration, can specify if route accessible admins, authenticated user, or anyone. there no pre-built in ad...

POST from Flash (AS2) to PHP, outputs ??? when non-english characters are used -

i trying use post in flash (actionscript 2), post values php mail script. tried php mail script html form, , worked fine. but when post flash , input non-english characters, "????" in mail. i tried utf8_encode($_post["name"]) , doesn't help. edit: i tried utf8_decode($_post["name"]) , didn't work. update: (so wont have go through comments) i checked variables in flash, values stored correctly. the html page flash embedded utf-8 encoded. i watched post headers firebug, post messed up, showing "????" instead of real value. the messed "????" value, url-encoded flash, , decoded php, resulting in $_post["name"] == "???"; i suspect sendandload method creates mess. update: here flash code: system.usecodepage = true; send_btn.onrelease = function() { my_vars = new loadvars(); my_vars.email = email_box.text; my_vars.name = name_box.text; my_vars.family_box = comment.text; ...

Simple VHDL Problem with synchronous/asynchronous logic -

i stuck now. following module working fine in simulation not work in hardware. simple, can't figure out why not working. essentially, module gets 2 input operands (op1, op2), 2 comand signals (fu_op, fu_imm) , clock. following 2 evaluations executed in consecutive clock cycles: s0 (x) tx <= x; r <= simple xor, or, , input x f0(tx, x, y) r <= simple xor, or, , input x, y , tx! i guess somehow passing of tx f0 not working. there wrong how try handle case of tx, might have forgotten in sensitivity list? many input! entity test_module port ( op1 : in std_logic_vector(31 downto 0); -- first input operand op2 : in std_logic_vector(31 downto 0); -- second input operand fu_op : fu_op_type; -- opcode fu_imm : in std_logic_vector(7 downto 0); -- immediate clk : in std_logic; -- clock res : out std_logic_vector(31 downto 0) -- result...

What's the non brute force way to filter a Python dictionary? -

i can filter following dictionary like: data = { 1: {'name': 'stackoverflow', 'traffic': 'high'}, 2: {'name': 'serverfault', 'traffic': 'low'}, 3: {'name': 'superuser', 'traffic': 'low'}, 4: {'name': 'mathoverflow', 'traffic': 'low'}, } traffic = 'low' k, v in data.items(): if v['traffic'] == traffic: print k, v is there alternate way above filtering? at level filter have describe. if you're going filter on values, you'll have process each one, one-by-one.

python - slicing arrays in numpy/scipy -

i have array like: a = array([[1,2,3],[3,4,5],[4,5,6]]) what's efficient way slice out 1x2 array out of has first 2 columns of "a"? i.e., array([[2,3],[4,5],[5,6]]) in case. thanks. two dimensional numpy arrays indexed using a[i,j] (not a[i][j] ), can use same slicing notation numpy arrays , matrices can ordinary matrices in python (just put them in single [] ): >>> numpy import array >>> = array([[1,2,3],[3,4,5],[4,5,6]]) >>> a[:,1:] array([[2, 3], [4, 5], [5, 6]])

INNER JOIN vs LEFT JOIN performance in SQL Server -

i've created sql command use inner join 9 tables, anyway command take long time (more 5 minutes). folk suggest me change inner join left join because performance of left join better, @ first time despite know. after changed, speed of query improve. i know why left join faster inner join? my sql command below: select * inner join b on ... inner join c on ... inner join d , on update: brief of schema. from sidisaleshdrmly -- not have pk , fk inner join sidisalesdetmly b -- table have no pk , fk on a.companycd = b.companycd , a.sprno = b.sprno , a.suffixno = b.suffixno , a.dnno = b.dnno inner join exfslipdet h -- pk = companycd, fslipno, fslipsuffix, fslipline on a.companycd = h.companycd , a.sprno = h.acctsprno inner join exfsliphdr c -- pk = companycd, fslipno, fslipsuffix on c.companycd = h.companycd , c.fslipno = h.fslipno , c.fslipsuffix = h.fslipsuffix inn...

c++ - write() in sys/uio.h returns -1 -

i'm using ubuntu server 9.10 amd phenom 2 cpu g++ (ubuntu 4.4.1-4ubuntu9) 4.4.1 trying run application pftp-shit v 1.11, runs until remote file list going saved (into .pftp//pftpfxp--). the following code in tcp.cc executed successfully: int outfile_fd = open(name, o_creat | o_trunc | o_rdwr | o_binary) which returns file descriptor int (in case 6) - name char array containing valid path file created. , running: fchmod(outfile_fd, s_irusr | s_iwusr); and access(name, w_ok) the issue occurs during running function (from sys/uio.h) write(outfile_fd, this->control_buffer, read_length) which returns -1. -1 of returned if nothing written , otherwise non-negative integer returned equal number of bytes written. anyone having clue how can write function work? on error, -1 returned, , errno set appropriately. perhaps errno give hints what's wrong. write(outfile_fd, this->control_buffer, read_length); does read_length contain correct n...

Dealing with infinite loops when constructing states for LR(1) parsing -

i'm constructing lr(1) states following grammar. s->as s->c a->aa a->b a,s nonterminals , a,b,c terminals. this construction of i0 i0: s' -> .s, epsilon --------------- s -> .as, epsilon s -> .c, epsilon --------------- s -> .as, s -> .c, c -> .aa, -> .b, b and i1. from s, i1: s' -> s., epsilon //done and on. when constructing i4... from a, i4: -> a.a, ----------- -> .aa, -> .b, b the problem -> .aa when attempt construct next state a, i'm going once again exact same content of i4, , continues infinitely. similar loop occurs with s -> .as so, doing wrong? there has detail i'm missing, i've browsed notes , book , either can't find or don't understand what's wrong here. help? i'm pretty sure figured out answer. obviously, states can point each other, eliminates need create new ones if it's content...

android - BaseAdapter.notifyDataSetChanged inverts order of elements -

for navigation in android app using listview , create , set baseadapter in oncreate method of activity. the baseadapter accesses arraylist retrieve elements (cache.getnavigation()): public class navigationadapter extends baseadapter { context mcontext; public navigationadapter(context c) { mcontext = c; } @override public int getcount() { return cache.getnavigation() != null ? cache.getnavigation().size() : 0; } @override public object getitem(int position) { return cache.getnavigation() != null ? cache.getnavigation().get( position) : 0; } @override public long getitemid(int position) { return cache.getnavigation() != null ? cache.getnavigation().get( position).getid() : 0; } @override public view getview(int position, view convertview, viewgroup parent) { view v; if (convertview == null) { layoutinflater li = ...

sql server - Can you make SQLCMD immediately run each statement in a script without the use of "GO"? -

when running script in sqlcmd, there setting, parameter or other way of making run go command @ end of each sql statement? this prevent need insert periodic go commands large scripts. no. sqlcmd have implement full t-sql parser in order determine statement boundaries are. whereas exists, has find lines "go" on them. determining statement boundaries can quite tricky, given ";" terminators still optional statements.

c# - Indexed properties with Linq? -

in database create indexes on columns want query joins. linq objects facilitate in way? i imagine search performance (much) improved when somehow list's can supported binary trees (indexes) in memory mapped specific properties of t. i thinking of lists not have optimized inserts or deletes. 1 turn off index optimization. no; linq not use indexes. instead, can use i4o , does. note many linq operations, such distinct , join , groupby , , others, build hasttable (or hashset, appropriate) avoid o(n 2 ) performance. more information, see jon skeet's edulinq series .

ruby on rails - Cake PHP Routing issue -

i need special routing in cake, can't life of me figure out. i have shop controller @ /shop , format of url be: /shop/:category/:sub_category/:product_slug in routing need send each part of url different action, example if url /shop/cakes go category action of shop. however if url /shop/cakes/macaroons or /shop/cakes/fairy go sub category action on shop controller. and the same again /shop/cakes/macaroons/pistachio go product action on shop controller. how go in routing? starting router::connect('/shop/:category/:sub_category/:product_slug' ... or way off mark? thanks. you'll need 3 routes, in order: router::connect( '/shop/:category/:sub_category/:product_slug', array('controller'=>'shops','action'=>'product'), array('pass'=>array('product_slug')) ); // dispatches shopscontroller::product( $product_slug ) /* * reverse route: * array( * 'co...

visual studio - Auto-Deploy SSRS reports with TFS -

can explain how create custom build deploy reporting services reports tfs? possible? if how... samples or articles appreciated. thanks i don't use tfs deploy i'm pretty sure build execute batch script. check out post here reporting services deployment example .rss script , batch file. this doesn't sound you're looking hope helps some.

m2crypto - verify data signature generated with openssl, using crypto++ -

i have server, running under python, signing message sha256 digest using m2crypto use public , private rsa key generated openssl cli. on server side everythgin ok python code : privatekey = m2crypto.rsa.load_key(sys.argv[2]) signeddigest = privatekey.sign(digest, 'sha256') i double check signature : pubkey = m2crypto.rsa.load_pub_key("key.pub.pem") if pubkey.verify(digest, signeddigest, 'sha256') (etc....) i store signed sha256 digest in file , send original message client. on client side, running under c++ vc6, load signed sha256 digest (as binary), , message signed. aim verify message , signed sha256. have cryptopp static link, , know works fine, because can compute sha256, , compare sha256 python having same result. here code : rsa::publickey pubkey; pubkey.load( filesource(licensecontrol::pubkeypath, true)); rsass< pkcs1v15, sha >::verifier verifier(pubkey); //shadigest newly computed sha256, signaturebyte...

msbuild - How do you make a WiX project build when dependent files have changes? -

i've adopted visual studio solution contains number wix projects. build solution msbuild script generate product's installer msi. the problem i'm experiencing if build (and don't rebuild), if exe's , dll's updated need put in installer, wix build system doesn't seem detect , skips building installer thinks it's date. how work out dependencies are needed build wix project, , how tell wix build system watch out them changing knows build instead of skip? thanks. this facility added wix 3.6 little fanfare - in wix 3.6 release notes says ".wixproj msbuild projects support incremental build."

ruby on rails - Using RDiscount, where should I do the actual formatting? -

i'm using rdiscount ruby on rails skills limited. rdiscount has .to_html function converts markdown text html. here's scenario: <% @posts.each |post| %> <h3><%= post.title %></h3> <%= post.content %> <% end %> post.content want convert html. 1) should create method convert string html? 2) how stop ror escaping html rdiscount.to_html returns? 1) preferably, in helper 2) calling html_safe on resulting string i have not used markdown in rails 3 app, escapes content default, created helper similar h method prior rails 3, converted markdown html. approach rails 3 like module helper def m(string) rdiscount.new(string).to_html.html_safe end end in view <% @posts.each |post| %> <h3><%= post.title %></h3> <%= m post.content %> <% end %>

.net - md5 hash for file without File Attributes -

using following code compute md5 hashs of files: private _md5hash string dim _binarydata byte() = new byte(fileupload1.postedfile.inputstream.length) {} fileupload1.postedfile.inputstream.read(_binarydata, 0, _binarydata.length) dim md5 new system.security.cryptography.md5cryptoserviceprovider dim md5hash() byte md5hash = md5.computehash(me._binarydata) me._md5hash = bytearraytostring(md5hash) private function bytearraytostring(byval arrinput() byte) string dim sb new system.text.stringbuilder(arrinput.length * 2) integer = 0 arrinput.length - 1 sb.append(arrinput(i).tostring("x2")) next return sb.tostring().tolower end function we getting different hashes depending on create-date , modify-date of file. storing hash , binary file in sql db. works fine when upload same instance of file. when save new instance of file db (with today's date create/modify) on file-system , check new hash versus md5 stored in db not match, , t...

c# - Keep order while columns.AddRange() in datagridview -

this code userdynamicsetscontrol this.datagridview1.columns.addrange(new system.windows.forms.datagridviewcolumn[] { this.columnsa,this.columnb,this.columnsc,this.columnd}); and second solution (i use interchangeably) var list= new system.windows.forms.datagridviewcolumn[] { this.columnsa,this.columnb,this.columnsc,this.columnd}; foreach (datagridviewcolumn datagridviewcolumn in list) { datagridview1.columns.add(datagridviewcolumn); } those codes works, add columns in wrong order , e.g. columnb,columnc,columna,columnd. how make sure column in order? have checked displayindexs on columns adding? ensure columna has displayindex of 0, , column b 1 etc. link msdn regarding displayindex http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.displayindex.aspx not 100% sure though, im used working xceed datagrid not micorsoft one.

c# - Where can I find simple beta cdf implementation -

i need use beta distribution , inverse beta distribution in project. there quite complicated implementation in gsl , don't want use such big library 1 function. i either, implement on own or link simple library. know sources me? i'm looking books/articles numerical approximation of beta cdf and inverse , libraries implemented. other suggestions appreciated. programming language, c++/c# preffered. here managed c++ library has beta cdf , inverse: dcdflib . it's port of popular fortran/c library of same name. if have questions how use code, i'm familiar , can help. you take dcdflib , delete don't use, it's still going big. implementing beta cdf , inverse accurately wide range of parameters complicated.

c++ - What does enabling STL iterator debugging really do? -

i've enabled iterator debugging in application defining _has_iterator_debugging = 1 i expecting check vector bounds, have feeling it's doing lot more that. checks, etc being performed? dinkumware stl, way. there number of operations iterators lead undefined behavior, goal of trigger activate runtime checks prevent occuring (using asserts). the issue the obvious operation use invalid iterator, invalidity may arise various reasons: unitialized iterator iterator element has been erased iterator element physical location has changed (reallocation vector ) iterator outside of [begin, end) the standard precise in excruciating details each container operation invalidates iterator. there somehow less obvious reason people tend forget: mixing iterators different containers: std::vector<animal> cats, dogs; for_each(cats.begin(), dogs.end(), /**/); // obvious bug this pertain more general issue: validity of ranges passed algorithms. [cats.be...

java - cast a String to sql time -

how cast string time type mysql in java string------->java.sql.time thanks. it depends entirely on format of string , use simpledateformat parse string java.util.date ; can extract millisecond time value date , pass java.sql.time() . this: string s = /* date string here */; simpledateformat sdf = new simpledateformat(/* date format string here */); long ms = sdf.parse(s).gettime(); time t = new time(ms);

Properly declare delegation in Objective C (iPhone) -

ok, has been explained few times (i got of way there using this post on so ), missing something. able compile cleanly, , able set delegate call methods delegate, i'm getting warning on build: no definition of protocol 'detailviewcontrollerdelegate' found i have detailviewcontroller , rootviewcontroller only. calling method in rootviewcontroller detailviewcontroller. have delegate set so: in rootviewcontroller.h : #import "detailviewcontroller.h" @interface rootviewcontroller : uitableviewcontroller <nsfetchedresultscontrollerdelegate, detailviewcontrollerdelegate> //error shows here { //some stuff here } //some other stuff here @end in rootviewcontroller.m define delegate when create view using detailviewcontroller.delegate = self in detailviewcontroller.h : @protocol detailviewcontrollerdelegate; #import "rootviewcontroller.h" @interface detailviewcontroller : uitableviewcontroller <uitextfielddelegate> { id <det...

c# - Creating FedEx Shipping Documnents using FedEx ship service WSDL -

i in process of integrating fedex international ship service. stuck on 1 part. trying create certificate of origin using test environment. have followed xml schema , have come code below private static void setcustominvoice(processshipmentrequest request) { request.requestedshipment.shippingdocumentspecification = new shippingdocumentspecification(); request.requestedshipment.shippingdocumentspecification.shippingdocumenttypes = new requestedshippingdocumenttype[1] { new requestedshippingdocumenttype() }; request.requestedshipment.shippingdocumentspecification.shippingdocumenttypes[0] = requestedshippingdocumenttype.certificate_of_origin; request.requestedshipment.shippingdocumentspecification.certificateoforigin = new certificateoforigindetail(); request.requestedshipment.shippingdocumentspecification.certificateoforigin.documentformat = new shippingdocumentformat { stocktype = shippingdocumentstocktype.stock_4x6, imagetype = shippingd...

java - runtime error. Problem with SMTP server -

hi running following program getting run time error.i have pasted below. import java.util.properties; import javax.mail.message; import javax.mail.messagingexception; import javax.mail.passwordauthentication; import javax.mail.session; import javax.mail.transport; import javax.mail.internet.internetaddress; import javax.mail.internet.mimemessage; import javax.mail.internet.mimemessage.recipienttype; public class mailwithpasswordauthentication { public static void main(string[] args) throws messagingexception { new mailwithpasswordauthentication().run(); } private void run() throws messagingexception { message message = new mimemessage(getsession()); message.addrecipient(recipienttype.to, new internetaddress("abc@yahoo.co.in")); message.addfrom(new internetaddress[] { new internetaddress("xyz@gmail.com") }); message.setsubject("the subject"); message.setcontent("the body", "text/plain"); transport.send(messag...

MySQL Drop Constraint Syntax Error -

i'm using mysql 5.1.36 i'm trying drop constraint named chk1 mysql reports syntactical error. looked unable find it. error? mysql> create database house; query ok, 1 row affected (0.01 sec) mysql> use house; database changed mysql> create table member(age integer); query ok, 0 rows affected (0.05 sec) mysql> alter table member add constraint chk1 check(age>0); query ok, 0 rows affected (0.08 sec) records: 0 duplicates: 0 warnings: 0 mysql> alter table member drop constraint chk1; error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'constraint chk1' @ line 1 mysql> alter table member drop check chk1; error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'check chk1' @ line 1 check constraint parsed ignored in mysql. don't need remove it. can use enum or triggers implement desired functionality. in...

user interface - Is there a multi-column listbox widget in FLTK? -

i'm evaluating cross-platform gui toolkits c++ development. use qt in case lgpl restrictive (i need link statically). now fltk excellent library purposes, because seems fast , lightweight. however, haven't been able figure out whether has multi-column listbox widget. know, 1 of grids rows , columns of strings , headers can clicked sort column---preferably native look-and-feel. is there such thing in fltk? how called? or should use wxwidgets instead? fl_table. comes 1.3 release candidate. there example in 1.3 /test of sortable table have modified , used. feels lot lower level qt can it. also, if close parts of wxwidgets has licensing similar qt. table.html">http://www.fltk.org/doc-1.3/classfl_table.html

vb.net - serializing type definitions? -

i'm not positive i'm going right way. i've got suite of applications have varying types of output (custom defined types). for example, might have type called widget: class widget public name string end class throughout course of operation, when user experiences condition, application take output instance of widget user received, serialize it, , log database noting name of type. now, have other applications similar, instead of dealing widget, totally random other type different attributes, again serialize instance, log db, , note name of type. have maybe half dozen different types , don't anticipate many additional ones in future. after said , done, have admin interface looks through these logs, , has ability user view contents of data thats been logged. admin app has reference types involved, , basic switch case logic hinged upon name of type, cast original types, , pass on handlers have basic display logic spit data out in readable format (one di...

Custom button template in WPF -

i want create simple button template image , text inside it. want keep system button's , feel. how create it, step step? p.s.: have tried customcontrol in wpf , basedon property. you can style , attached property: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ap="clr-namespace:myproject.namespace.path.to.buttonproperties"> ... <style x:key="imagebutton" targettype="button"> <setter property="contenttemplate"> <setter.value> <datatemplate> <stackpanel orientation="horizontal"> <image source="{binding path=(ap:buttonproperties.image), relativesource={relativesource findancestor, ancestortype={x:type button}}}"></image> ...

iphone - How can i make bold a single character in the lable without using UIWebView? -

i have uilabel contains textvalue , want bold particular character in whole string please let me inform possible? , yes please give me example important me.please me. it's possible single-line label if create custom uiview subclass, , implement -drawrect: this: -(void)drawrect:(cgrect)rect { nsstring* stringbefore; nsstring* boldpart; nsstring* stringafter; uifont* normalfont; uifont* boldfont; ... cgsize sizebefore = [stringbefore drawatpoint:cgpointzero withfont:normalfont]; cgsize sizebold = [boldpart drawatpoint:cgpointmake(sizebefore.width, 0) withfont:boldfont]; [stringafter drawatpoint:cgpointmake(sizebefore.width+sizebold.width, 0) withfont:normalfont]; }

c# - Silverlight Gallery -

the silverlight toolkit comes great gallery showing of widgets along code samples. there available core widgets? java had 1 of these , found extremely helpful see available. there's 1 here it's bit old (sl 2)

python - Print Difference Between Time in Ms -

i reading log file in python script, , have got list of tuples of starttimes , endtimes - ('[19:49:40:680]', '[19:49:49:128]') ('[11:29:10:837]', '[11:29:15:698]') ('[11:30:18:291]', '[11:30:21:025]') ('[11:37:44:293]', '[11:38:02:008]') ('[11:39:14:897]', '[11:39:21:572]') ('[11:42:19:968]', '[11:42:22:036]') ('[11:43:18:887]', '[11:43:19:633]') ('[11:44:26:533]', '[11:49:29:274]') ('[11:55:03:974]', '[11:55:06:372]') ('[11:56:14:096]', '[11:56:14:493]') ('[11:57:08:372]', '[11:57:08:767]') ('[11:59:26:201]', '[11:59:27:438]') how can take difference of times in milliseconds? >>> import datetime >>> = ('[19:49:40:680]', '[19:49:49:128]') >>> start = datetime.datetime.strptime(a[0][:-1]+"000", "[%h:%m:%s:%f") >...

How to get the size of a string in Python? -

for example, string: str = "please answer question" i want write file. but need know size of string before writing string file. function can use calculate size of string? if talking length of string, can use len() : >>> s = 'please answer question' >>> len(s) # number of characters in s 25 if need size of string in bytes, need sys.getsizeof() : >>> import sys >>> sys.getsizeof(s) 58 also, don't call string str . shadows built-in str() function.

I want to know how to deploy the war file in apache tomcat and make it to run -

i create war file using apache ant , wanted deploy .war file in tomcat , make run can u people me steps.. m not clear abt it stop tomcat move war [tomcat install dir]/webapps start tomcat tomcat deploy war on startup

SQLite in android -

my android application uses sqlite database , during first run deletes rows . next time runs tries same , because rows deleted fails . use sqlite database browser inspect database ,after first run (when rows deleted) , observe rows no longer should exist still in database , if ehwn running app again rows no longer visible ! cause behavior ? i have overcome throwing cursor , checking size of cursor object using getcount() method; if comes out zero, branch off , stop attempting db actions other creating rows/tables.

arrays - ArrayCollection error in Flex does not accept single XML nodes - alternatives? -

i error when retrieve xml has 1 node (no repeating nodes) , try store in arraycollection. -when have more 1 "name" nodes...i not error. typeerror: error #1034: type coercion failed: cannot convert "xxxxxx" mx.collections.arraycollection. this error occurs line of code: mylist= e.result.list.name; why can't arraycollection work single node? i'm using arraycollection dataprovider component -is there alternative can use take both single , repeating nodes work dataprovider? in advance! code: [bindable] private var mylist:arraycollection= new arraycollection(); private function getlist(e:event):void{ var getstudyloungesservice:httpservice = new httpservice(); getstuffservice.url = "website.com/asdf.php"; getstuffservice.addeventlistener(resultevent.result, ongetlist); getstuffservice.send(); } private function ongetlist(e:resultevent):void{ mylist= ...

android - Getting Json data into a list view -

i have been searching way json data url (for example: http://search.twitter.com/trends.json ) , display in listview. couldnt perfect example done. can plz me out getting solution , providing example of how it... android comes json-lib parsing json easy. need use httpclient classes retrieve data url, , can use jsonobject class parse json. , write listadapter pull data jsonobject.

c# - How to merge elements from two XML files? -

i need c# lang code merge 2 xml files one, specified content. xml file 1 : <exchange-documents> <documentlegal> <bibliographic-data> <applicants> <applicant-name> <name>century products co [us]</name> </applicant-name> </applicants> </bibliographic-data> </documentlegal> </exchange-documents> xml file 2: <exchange-documents> <documentpatent> <bibliographic-data> <applicants> <applicant-name> <name>century products co [us]</name> </applicant-name> </applicants> </bibliographic-data> </documentpatent> </exchange-documents> i need read above 2 xml files , write new xml files selected...

c# - Why does the synchronized wrapper for ArrayList not work? -

i have generated proxy classes web service in vusual studio 'add web reference'. generated rtwebservice class has method setvalueasync . extended class , added setvaluerequest keeps track of requests , cancels pending requests when error occurs. every request store userstate object in arraylist created follows: requests = arraylist.synchronized(new arraylist()); i created method: public void cancelpendingrequests() { lock (requests.syncroot) { if (requests.count > 0) { foreach (object request in requests) { this.cancelasync(request); } requests.clear(); } } } i call method when request returns on setvaluecompleted event: private void onrequestcomplete( object sender, service.setvaluecompletedeventargs args ) { lock (syncresponse) { if (args.cancelled) { return; } if (args.userstate != null) { requests.remove(args.userstate); } if (args.error != null) { cancelpendingrequ...

javascript - Watching setTimeout loops so that only one is running at a time -

i'm creating content rotator in jquery. 5 items total. item 1 fades in, pauses 10 seconds, fades out, item 2 fades in. repeat. simple enough. using settimeout can call set of functions create loop , repeat process indefinitely. i want add ability interrupt rotator @ time clicking on navigation element jump directly 1 of content items. i started going down path of pinging variable (say every half second) check see if navigation element clicked and, if so, abandon loop, restart loop based on item clicked. the challenge ran how ping variable via timer. solution dive javascript closures...which little on head need delve more. however, in process of that, came alternative option seems better performance-wise (theoretically, @ least). have sample running here: http://jsbin.com/uxupi/14 (it's using console.log have firebug running) sample script: $(document).ready(function(){ var loopcount = 0; $('p#hello').click(function(){ loopcount++; dothatthing...

What WPF frameworks should I use? -

i'm newbie wpf , i'm developing brand new windows desktop application , opinion on wpf framework should use. know question has been asked before, last question asked @ least several months ago. lot has changed since then. right now, i'm using mvvm light more of library actual framework, name suggests. i’m looking more comprehensive. prefer framework can use on future wpf projects. consequently, should general purpose , productive. any insights or suggestions? it's on heavy weight end, , plenty of people warn it, seem asking cag http://compositewpf.codeplex.com/ it's pattern comes sample implementation can bend own. example, comes unity ioc, should able put in ioc container. the download comes lot of samples both silverlight , wpf.

ruby on rails - Add record to a has_and_belongs_to_many relationship -

i have 2 models, users , promotions. idea promotion can have many users, , user can have many promotions. class user < activerecord::base has_and_belongs_to_many :promotions end class promotion < activerecord::base has_and_belongs_to_many :users end i have promotions_users table/model, no id of own. references user_id , promotions_id class promotionsusers < activerecord::base end so, how add user promotion? i've tried this: user = user.find(params[:id]) promotion = promotion.find(params[:promo_id]) promo = user.promotions.new(promo) this results in following error: nomethoderror: undefined method `stringify_keys!' #<promotion:0x10514d420> if try line instead: promo= user.promotions.new(promo.id) i error: typeerror: can't dup fixnum i'm sure there easy solution problem, , i'm not searching solution right way. user = user.find(params[:id]) promotion = promotion.find(params[:promo_id]) user.promotions << pr...