Posts

Showing posts from May, 2010

qt - Error in using created custom widget in designer -

i having problem on using created custom widget. have created custom widget produces .dll file. placed .dll file under bin/designer. recognized in designer. used , placed on ui. when tried build it, error occurred. debug\moc_scribblearea.cpp(44) : warning c4273: 'staticmetaobject' : inconsistent dll linkage d:\project\qt\workspace\sample-build-desktop\debug../../oep/scribblearea.h(53) : see previous definition of 'public: static qmetaobject const scribblearea::staticmetaobject' debug\moc_scribblearea.cpp(44) : error c2491: 'scribblearea::staticmetaobject' : definition of dllimport static data member not allowed debug\moc_scribblearea.cpp(54) : warning c4273: 'scribblearea::metaobject' : inconsistent dll linkage d:\project\qt\workspace\sample-build-desktop\debug../../sample/scribblearea.h(53) : see previous definition of 'metaobject' debug\moc_scribblearea.cpp(59) : warning c4273: 'scribblearea::qt_metacast...

c# - Opensource alternative to postSharp that supports easy custom attributes -

does know opensource alternative postsharp thats easy use , supports attribute based stuff? i've seen aspectdng similar creating attributes c++ code , requires different form of compilation i know windsor,ninject,spring.net,etc none of them have custom attributes postsharp. i'm looking program lets me use own custom attributes before,after events. i appreciate suggestions. thank you edit: question describing these points should support attributes has not been asked before. so,please don't close question. it's not duplicate. edit: why afraid of postsharp? postsharp has far been best,but it's commercial , looks uncertain / risky use free version large project.we never know when might discontinue free version. edit: votes , favorite adds. far,i've found : http://zinject.codeplex.com/ it's in french. please provide more suggestions if of find else. have @ http://www.sharpcrafters.com/postsharp/alternatives list of alternatives ...

Basic difference among PayPal payment methods -

what difference among these paypal payment methods. want integrate oscommerce. paypal website payments pro (us) direct payments paypal express checkout paypal ipn paypal website payments standard paypal website payments pro (uk) direct payments paypal website payments pro (uk) express checkout paypal website payments pro (us) direct payments paypal api-based solution allows take card payments directly on site. in addition, has $30 monthly fee , account needs checked paypal. lastly, need pci dss compliant. paypal express checkout api-based solution doesn't require buyer enter details on site, allowing them quick checkout through paypal site. (although it's not required. can still request address on cart if wish). there no monthly fee , free use it. paypal ipn instant payment notification. in basic terms, paypal notify script on site via post whenever payment has gone through. great sending out customized 'thank you' emails, updating order database...

xml - In a Schematron rule, how do i access the parent element of the current element? -

i using iso schematron validate xml document. rule have set works required, want report name of parent element context of assertion fired. sample document might contain xml fragment: <name>alan smith<br/></name> my schematron rule tests <br/> element allowed occur child of <title> element. rule follows: <rule context="br"> <assert test="parent::title" >the "br" element not allowed child of '<iso:value-of select=".."/>' element.'</assert> </rule> when run rule against fragment, assertion correctly fired, want message tell me "the "br" element not allowed child of 'name' element". instead shows "the "br" element not allowed child of 'alan smith' element". <iso:value-of select=".."/> expression selecting text node , not parent element expected? can explain xppath expression should usi...

PostgreSQL slow COUNT() - is trigger the only solution? -

i have table posts, categorized by: type tag language all of "categories" stored in next tables (posts_types) , connected via next tables (posts_types_assignment). counting in postgresql slow (i have more 500k records in table) , need number of posts categorized combination of type/tag/lang. if solve through triggers, full of many multi-level loops, doesn't nice , hard maintenance. is there other solution how actual number of posts categorized in type/tag/language? let me straight. you have table posts . have table posts_types . 2 have many many join on posts_types_assignment . , have query slow: select count(*) posts p join posts_types_assigment pta1 on p.id = pta1.post_id join posts_types pt1 on pt1.id = pta1.post_type_id , pt1.type = 'language' , pt1.name = 'english' join posts_types_assigment pta2 on p.id = pta2.post_id join posts_types pt2 on pt2.id = pta2.post_type_id , pt2....

c# - Dynamically changing an asp.net control's property -

i'm using 2 components essential objects namely downloader , file explorer. doesn't matter. the file explore (similar window's file explorer) has client api can fire event when select file using it. event fire uses javascript function: function file_selected(fe) { var filename = fe.getselectedfile(); foo(filename); } the downloader has property want update using filename. how can client side? in code-behind it's easy: downloader.filepath = ""; event fires client side. heard ajax have no experience it, i'm struggling find solution. this depends on control , not general question asp.net controls. there documentation if there api. ajax nothing more asynchronous javascript , xml, doesn't feel relevant problem.

Question about data compression algorithms parameters -

i have question - can share information, compressions algorithms , parameters, affects compression rate ( time not important)? for example, googled command line arguments winrar, find complete list of parameters. mb have usefull links, listed parameters actualy affects compression quality? not win-rar, compression algorithms in general. thank time. according http://daily-it.blogspot.com/2007/11/rar-command-line-with-real-world.html , command line option -m5 give highest compression level winrar. lowest -m0 . some compression tools have such parameters , others don't. gzip , example lets specify --fast, --best, or in between. you'll have search around , maybe download other tools documentation in order see parameters are.

c# - How to parse an HTML node's attributes -

i use c# , need parse html read attributes key value pairs. e.g given following html snippet <div myattribute style="border-bottom: medium none; background-color: transparent; border-top: medium none" id=my_id anotherattribnameddiv class="someclass"> please note attributes can be 1. key="value" pairs e.g class="someclass" 2. key=value pairs e.g id=my_id (no quotes values) 3. plain attributes e.g myattribute , doesn't have "value" i need store them dictionary key value pairs follows key=myattribute value="" key=style value="border-bottom: medium none; background-color: transparent; border-top: medium none" key=id value="my_id" key=anotherattribnameddiv value="" key=class value="someclass" i looking regular expressions this. you can htmlagilitypack on codeplex string mydiv = @"<div myattribute style=""border-bottom: medium none; ...

android - Logcat data not displaying in the Log Tab of DDMS Eclipse -

the log tab visible in ddms , have been logging data using log.v(...) many week without problems. today, log data longer being displayed in log window. worked, did programming change track bug , log data no longer showing. have tried running app on external android phone, on android simulator , makes no difference. have closed down eclipse, reloaded , still no change. the console displays activity point of starting activity. the external phone set debugging - not problem since have same problem simulator it looks have inadvertantly set incorrectly can't remember changing :-( anyone come across problem before - have looked @ previous posts none seem relevant. regards, oliver i had same problem while back. using emulator , device debugging. apparently have select device listed in ddms view logs want see. logs blank because device expecting logs not 1 selected. hope helps

java - Why can't Bouncycastle's PEMReader read this M2Crypto-generated PEM? -

i use following python code, using m2crypto, generate rsa key pair in pem format: bio = bio.memorybuffer() key_pair = rsa.gen_key(1024, 65537) key_pair.save_key_bio(bio, cipher=none) return bio.read() and following java code, using bouncycastle, try read it: string signpem = ...; pemreader pemreader = new pemreader(new stringreader(signpem)); object signingkey = pemreader.readobject(); the signpem string same bio.read() returned; no data can see getting munged between 2 programs; it's -----begin rsa private key-----\n etc. however, readobject() call throws classcastexception: java.lang.classcastexception: org.bouncycastle.asn1.dersequence @ org.bouncycastle.asn1.asn1object.frombytearray(unknown source) @ org.bouncycastle.openssl.pemreader.readkeypair(unknown source) @ org.bouncycastle.openssl.pemreader.readobject(unknown source) so bc misidentifies data in pem not key pair reason - why? after taking debugger bouncycastle, have discovered ...

cocoa touch - How to parse a web page source to get the values for an array -

i trying implement lotto game on ipod , need parse actual lotto page winning numbers , put them in array compare them numbers user had entered , find out if winner or not. can me because stuck it? thanks in advance! :) what need dom parser , such apple's nsxmlparser . specifically you'd want use xpath parsing read value of specific dom node on lotto page's dom tree. as ios not come nsxmldocument (which supports xpath), you'd need described here : using libxml2 xml parsing , xpath queries in cocoa other solutions parsing xml/html: how choose best xml parser iphone project

how to cancel a delete in django signal -

is there way cancel deletion of record using django pre_delete signal? example: def on_delete(sender,**kwargs): if not <some condition>: #cancel deletion # else continue deletion pre_delete.connect(on_delete,sender=mymodel) and question there way model " that before changing file delete first original file " because right do(see code below) , i'm not sure if best way it. def on_save(sender,**kwargs): obj = kwargs['instance'] try: id = obj.pk # find file original_file = sender.objects.get(pk=id) # delete original file before uploading new file original_file.file.delete() except .... pre_save.connect(on_save,sender=modelwithfileupload) (in django 1.2 automatically delete file on change or on delete in django 1.3 removed feature) thanks in advance i try little hack workaround: def on_delete(sender,**kwargs): if not <some condition>: raise exception('do not delete')#cancel deletion ...

c++ - C++0x issue on ICC compilation -

for each (auto obs in observers) *obs = true; i have problem compiling icc. error : cannot deduce "auto" type (initializer required) please solve above issue. thanks. this syntax not valid in c++. try instead: for (auto obs_iter=observers.begin(); obs_iter != observers.end(); ++obs_iter) **obs_iter = true; (this assumes observers store pointers objects) if compiler supports range-based loops, can following: for (auto &obs: observers) *obs = true;

sql server - how to override 'public' privileges -

as there databases on server available public role, how can close access database sqlserver login directly? login not using database has access under public privileges. need keep access public deny user. a deny take precedence on grant. in order able deny permission, need principal apply deny to. therefore sequence of actions is: create user login in database (so have principal) explicitly deny permission user created above note that, rule, cannot deny permissions on securable owner of securable. members of sysadmin mapped dbo, hence cannot denied permission.

c++ - What is the meaning of "... ..." token? i.e. double ellipsis operator on parameter pack -

while browsing through gcc's current implementation of new c++11 headers, stumbled upon "......" token. can check, following code compiles fine [via ideone.com]. template <typename t> struct x { /* ... */ }; template <typename t, typename ... u> struct x<t(u......)> // line important 1 { /* ... */ }; so, meaning of token? edit: looks trimmed "......" in question title "...", did mean "......" . :) every instance of oddity paired case of regular single ellipsis. template<typename _res, typename... _argtypes> struct _weak_result_type_impl<_res(_argtypes...)> { typedef _res result_type; }; template<typename _res, typename... _argtypes> struct _weak_result_type_impl<_res(_argtypes......)> { typedef _res result_type; }; template<typename _res, typename... _argtypes> struct _weak_result_type_impl<_res(_argtypes...) const> { typedef _res resu...

listview - Android: How to change drawable depending on list item selected -

my problem: listview presented user displaying list of animals, , depending on item chosen, next activity present user image of animal chosen. my approach far has been pass position of list item selected: intent.putextra("position_on_list", position) and extras in next activity. this confused. how can display picture dynamically depending on animal selected?i have tried if statement approach; if(position == 0){ imageview icon = (imageview)view.findviewbyid(r.id.animalimg) icon.setimageresource(r.drawable.tiger) } but leads error when run app.could point me in right direction on how might go doing correctly. thank you. as far error, without details error anything... i think if statement fine, might want switch statement default: alternative. switch (position){ case 0: break; default: break; } another option putting images in arrays.xml resource file , creating typedarray, it's little cleaner , more android friendly. the arrays.x...

java - How do I prevent Selenium RC from stealing window focus while my tests are running? -

i know i'm in small minority, have use machine @ same time tests running. thing gets in way browser window stealing focus when run test cases using selenium rc. prevents me running tests more once day, @ end of day right before log out. tried selenium grid, can't listen requests on localhost, not 0.0.0.0 (a requirement network admin). i've dug through selenium documentation, , tons of selenium sites, haven't been able find definitive answer. can prevent selenium rc tests stealing windows focus while test running? i'm using firefox 3.6.13. on linux, can start vncserver on different display (say, :8 or something) , have selenium , firefox instances use display. works work.

nusoap wsdl problem when moving to new server? -

i trying move file calls wsdl service nusoap class. on new server following error: wsdl error: http error: couldn't open socket connection server http://ip...:xxxx/service.asmx?wsdl, error (13): permission denied is incorrect server setting? if setting common issue? kind of firewall? should ask hosting company enable something?? any tips, suggestions?? fyi $nusoapclient->debug_str get soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme http, host xxx.xxx.xxx, port xxxx soap_transport_http: calling fsockopen host xxx.xxx.xxxx connection_timeout 0 soap_transport_http: couldn't open socket connection server ok running same issue, check if php/apache config permissive vs enforced. might solve problem

performance - How can I improve the speed of XML parsing in VBA -

i have large xml file needs parsed in vba (excel 2003 & 2007). there upwards of 11,000 'rows' of data in xml file each 'row' having between 10 , 20 'columns'. ends being huge task parse through , grab data (5 - 7 minutes). tried reading xml , placing each 'row' dictionary (key = row number, value = row attributes), takes long. it taking forever traverse dom. there more efficient way? dim xmldict sub parsexml(byref rootnode ixmldomnode) dim counter long dim rowlist ixmldomnodelist dim columnlist ixmldomnodelist dim rownode ixmldomnode dim columnnode ixmldomnode counter = 1 set rowlist = rootnode.selectnodes("row") each rownode in rowlist set columnlist = rownode.selectnodes("col") dim nodevalues string each columnnode in columnlist nodevalues = nodevalues & "|" & columnnode.attributes...

android - Take whole available hight for a TableRow -

i use tablelayout 2 tablerows. 1 row contains 3 buttons. other should take remaining space output. how can accomplished? either in xml or onmeasure method. i'm not familiar using tables, know when you're laying out forms, if want that, lay out things going normal size. lay out thing going take remainder of screen , set it's height property "fill_parent". if you'll paste code in i'd happy take @ , fix you. :-) -jared

security - A working .NET example using SetEntriesInAcl interop in action -

does has working example of invoking setentriesinacl method in .net using p/invoke? i keep getting error 87 when invoking , cannot doing wrong. here definitions: private enum fileaccessrights { file_read_data = 0x0001, } private enum accessmode { grant_access = 1, revoke_access = 4, } private enum inheritanceflags { no_inheritance = 0x0, } private enum trusteeform { trustee_is_sid = 0, } private enum trusteetype { trustee_is_user = 1, } private struct explicitaccess { public fileaccessrights accesspermissions; public accessmode accessmode; public inheritanceflags inheritance; public trustee trustee; } private struct trustee { public intptr multipletrustee; public int multipletrusteeoperation; public trusteeform trusteeform; public trusteetype trusteetype; [marshalas(unmanagedtype.lpwstr)] public string name; } [dllimport("advapi32.dll", setlasterror = true)] static extern int setentriesinacl(int countofexplicitentries, ref explici...

ruby - How to magically supply Active Record scopes with arguments? -

i'm not sure possible, let's see if 1 of comes solution. more or less code quality in terms of readability , not actual problem because have solution. have friendship model , user model. friendship model used model friendships between 2 users: class friendship def self.requested(user) where(:user_id => user).where(:status => 'requested') end def self.pending(user) where(:user_id => user).where(:status => 'pending') end def self.accepted(user) where(:user_id => user).where(:status => 'accepted') end # ... end class user has_many :friendships # ... end is somehow possible call requested, pending or accepted scope through user model without providing argument? a_user.friendships.pending # not work, there way working? a_user.friendships.pending(a_user) # works of course! i think should work if take argument off. calling pending off of user object should scope friendships appropri...

iphone - How to play combined sound as if emanating from a crowd of sound-producing objects -

consider have 100 instances of "squeaker" class. each "squeaker" object capable of individually emitting squeak sound. each squeaker entity uses same .mp3 resource. when squeakers presented on screen (for example little characters), want them squeak @ approximately (but not exactly) same time combined squeaks heard crowd of squeakers. targeting ios, approach (and audio/sound framework) recommend? has done before? code samples? it might best build "laugh track", use audio editor combine multiple squeaks 1 mp3 file, play in loop (this file , should longer single squeak). by trying render 100 sounds separate sound-playing instances of whatever, you'd running same sort of voice , latency problems encountered developers of software synthesizers. maintaining voice count of 100 overall latency of less 25 milliseconds or difficult on modern pc, , more difficult (or impossible) on iphone/ipad. generally speaking, voice , latency represent fu...

android - Is using ProGuard worth the trouble? -

from i've seen , read, if wants reverse-engineer software or decompile it, proguard not going stop them. @ least modest deterrent? i'm not sure if it's worth hassle of translating stack traces later on. i recommend proguard. without obfuscation (which can shorten names used in constant pool) can remove "dead code" (unused methods) of used libraries, etc. (it can used conveniently merge together). it takes little bit of fiddling "get correct", esp. if there dynamically loaded classes -- recommended. actual benefit space-saving, however, "depends" on can eliminated , goes more external libraries. now, obfuscation -- as obfuscator: makes "decompiling" code things with meaningful names impossible. obfuscation won't save super-secret-algorithm or hide private keys, though: if jvm (or dalvik after transformation) must understand it, can decompiler , really wants access can. code lifted in bytecode-form , used via. r...

android - Moving from bitmap to OpenGL -

ok, time use opengl (gulp!) render sprites in apps (games), , forgetting bitmap.draw etc. after trawling through hundreds of sites/blogs (well maybe) 'explaining' how code using opengl, have hit brick wall. the problem apps functional , on market @ moment, latest app developed on htc desire hd, , getting many reports of bad performance on less powerful devices. the obvious route move opengl. tutorial sites geared towards developing scratch. great starting new project, need 'retro-fit' apps. don't fancy rewriting scratch! has had experience of this? thoughts hugely appreciated. i did similar app , did receive large performance benefit. lot of 'should change' depends on how application structured. for me hardest thing translating ui elements because had re-generate entire 'which control got touched' logic , setup text rendering. neither of these problems tough enough deal beakers i'd avoid them if can. fortunately there s...

c# - My website could possibly receive both Unicode and Non-Unicode characters -

a user on website possibly add comment on item contains both arabic , english characters. maybe arabic, others english, , others french! it's international website can't expect characters being stored in application. website has nothing facebook need comments' textboxes able accept , show characters language! ...so how think achieve ? all strings in .net unicode strings (see documentation of string class more information). taking input user in mix of languages shouldn't problem. if plan store information in database need make sure database columns of type nchar or nvarchar . others pointed out, when run queries against these columns out of ssms need prefix unicode strings n make sure handled properly . when executing queries code should use parameterized queries (or orm , better) , ado.net take care of constructing queries you.

adobe flex extreme components -

in project, using adobe flex extreme components show grids. see grid below in jsp( filters) <ec:table items="searchresults" var="searchresults" imagepath="${pagecontext.request.contextpath}/static/images/table/*.gif" view="buttonsonbottom" retrieverowscallback="limit" filterrowscallback="limit" sortrowscallback="limit" ... > .. what function of these three: retrieverowscallback,filterrowscallback,sortrowscallback. want this: when grid loads, show prefiltered list(e.g. records status = 'active'). server side can return filtered list, on grid , filter value shown 'blank' instead of 'active'. thank you. "adobe flex extreme components" doesn't exist, or says google. 3rd party library , not standard flex component. should 3rd party documentation see do.

Get the date of one week from today with PHP -

how date, 1 week today, in following format: yyyy-mm-dd ? thanks. try: date("y-m-d", strtotime("+1 week")); this output: 2015-12-31 if today 2015-12-24

flex - Weird behaviour on Numeric Stepper decimals -

i making editor field numbers. tried text field, since it's number datatype coming in, didn't go smoothly -- despite recasting strings numbers etc.. kept giving me nan value. decided best go numeric stepper. when loaded drop decimals , display numbers integers. changed stepincrement 0.1 , show decimals (a weird requirement imo).. when step gives me value '17.700000000000003' when expect 17.7. of numbers in data have single decimal place. know can write dataformatter, seems shouldn't necessary in situation. is there way deal this? you've stumbled upon compromise of trying represent decimal numbers in floating point binary formats ieee 754. not decimal numbers can represented. can read on issue in great detail here: http://en.wikipedia.org/wiki/floating_point#representable_numbers.2c_conversion_and_rounding you can use number.tofixed(fractiondigits:uint) display arbitrary number of decimal places.

html - JavaScript Mimics of the iPad's UI (specifically, UIDatePicker and UIPicker) -

Image
does know way mimic uidatepicker , more general uipicker ios controls in html & javascript? does know of solution this? i've seen javascript mimics of other iphone/ipad controls, such uipopovercontroller. able offer way of entering dates (compared solutions jquery ui's datepicker). looks easy use both on mouse scroll-wheel , on ipad. so, advice? one reason these strange widgets exist because typing on touchscreens annoying. wouldn't want use sort of widget on desktop same reason few people draw pictures mice: control mouse isn't same control touchscreen. for reason, libraries have implemented functionality mobile, , not ensure compatibility older browsers such ie6. if need support webkit browsers, , don't mind using large framework purpose, sencha touch's picker works ( see page example ). sencha's doesn't offer mousewheel support. i don't know if has implemented 1 outside of large framework, wouldn't hurt around. --- ...

How can I make SQL case sensitive string comparison on MySQL? -

i have function returns 5 characters mixed case. if query on string return value regardless of case. how can make mysql string queries case sensitive? http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html the default character set , collation latin1 , latin1_swedish_ci, nonbinary string comparisons case insensitive default. means if search col_name 'a%', column values start or a. make search case sensitive, make sure 1 of operands has case sensitive or binary collation. example, if comparing column , string both have latin1 character set, can use collate operator cause either operand have latin1_general_cs or latin1_bin collation: col_name collate latin1_general_cs 'a%' col_name 'a%' collate latin1_general_cs col_name collate latin1_bin 'a%' col_name 'a%' collate latin1_bin if want column treated in case-sensitive fashion, declare case sensitive or binary collation.

Which thread-safe collection in the .Net Framework has a “Contains” as one of its API? -

i know concurrentdictionary has api called containskey, dictionary not i’m looking for. now, using “contains” extension method enumerable, method not thread-safe. there thread-safe collection has “contains” method? thanks. in general, contains operation not useful in concurrent collection. problem that, determine collection "contains" or doesn't contain object, logic result of check no longer valid, thread may have added or removed item following. the concurrentdictionary class contains method implement idictionary, intended usage use addorupdate , getoradd , , similar atomic methods.

mysql - PHP CRON jobs vs. calling functions on a user login -

i'm hoping can advice. i have accounting ledgers in php/mysql system, invoices hit ledger @ intervals (for example, let's once month). have late fees need applied after date. "posting" date of invoice, "this late" date in db already. i'm wondering better method run script applies ledger item automatically (once month) - , enters late fee automatically (will once month, if needed). users of system, these dates different - , said, stored in db. options see are: have cron job runs once day (i.e. 12:00am each day) - , goes through every item, doing work if date conditions met. i think method, because takes care of @ once, @ same time every day. i worried method because: (1) if server down when cron job scheduled, cpanel skip day now? , (2) if have 100k or 100million entries sift through, unbearable load on server whenever ran? call script "do work" if date conditions met, only when related user logs in. the reason why don...

Database Relational Homework help -

the problem "consider relation r 5 attributes abcde. given following dependancies a->b bc->e ed->a list keys r. the teacher gave keys, acd,bcd,cde and need show work them. the first 2 solved. for bcd, transitive of 2 3 (bc->e)d->a => bcd->a. and acd id the transitive of 1 4 (bcd), (a->b)cd->a => acd->a but can't figure out how cde. so seems did wrong, after googling found answer methodology find keys: consider attribute sets α containing: a. determinant attributes of f (i.e. a, bc, ed) , b. attributes not contained in determined ones (i.e. c,d). attribute closure algorithm: if α+ superset r α -> r 3 keys: cde, acd, bcd source from can tell, since c,d not on left side of dependencies. keys left sides cd pre-appended them. can explain me in better detail why? to keys , start one of dependencies , using inference extend set. let me have go simple english, can find formal definition net easily. e....

using svn://localhost/repos works fine. using svn+ssh://localhost/repos: got No repository found -

i setting svn repository. got ready. when typed svn list svn://localhost/repos/, showed repository correctly. when typed svn list svn+ssh://localhost/repos, said svn: no repository found in 'svn+ssh://localhost/repos/ktbdbms' user account , password correct. do miss anything? thanks you need read bit more using svn:// vs svn+ssh://, here in svn book. connecting localhost, on machine, svnserve relatively easy, setting svn+ssh:// bit more complicated , requires careful planning. read book , set up, if want to.

c++ - How to read UTF-8 text from file using Qt? -

i have problems reading utf-8 encoded text file. version reads ascii characters. #include <qtcore> int main() { qfile file("s.txt"); if (!file.open(qiodevice::readonly | qiodevice::text)) { return -1; } qtextstream in(&file); while(!in.atend()) { qstring line = in.readline(); qdebug() << line; } } s.txt: jąkać się ślimak śnieżyca output: "jka si" "limak" "nieyca" what should use? see qtextstream::setcodec() : in.setcodec("utf-8");

java - How does the socket connect timeout work? -

to understanding, socket connection timeout controlled tcp transport, uses retransmission timeouts (rtos). if the ack not come before timer expires, connect request (sync) retransmitted, , rto doubled. so functionality of connection timeout in java socket when call socket.connect(endpoint, connecttimeout) so functionality of connection timeout in java socket when call socket.connect(endpoint, connecttimeout) it sets overall timeout connection have been established; i.e. says how long application prepared wait of packet-level timeouts, retransmissions, etc succeed (or not) before giving up.

building hello-jni sample in Android NDK causes error "Default target help does not exist in this project" -

trying build hello-jni sample in android ndk. followed instructions per http://developer.android.com/sdk/ndk/overview.html#samples create build .xml, android update project -p . -s trying run under eclipse helios sr2. error: description resource path location type default target not exist in project build.xml /hellojni line 2 ant buildfile problem in build.xml, <project name="hellojni" default="help"> any suggestions appreciated. suppose install paths of sdk , ndk are ~/android-sdk-mac_x86/ , ~/android-ndk-r5c if don't use eclipse , use ant export path=${path}:~/android-sdk-mac_x86/tools:~/android-ndk-r5c cd ~/android-ndk-r5c/samples/hello-jni ndk-build assume target 1 project target android update project -t 1 -p ~/android-ndk-r5c/samples/hello-jni or android update project -t 1 -p . debug build ant debug emulator started or device connected ant install

How to emulate a HTML multiselect of inputs in Ruby tests -

how can input multiple values 1 field ruby functional test, multiselect box? code below thought work, doesn't. post :create, :post => { :multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] } unless trying post "post[multiselect1][]" , "post[multiselect2][]" should try this: post :create, {:multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] } this submit "multiselect1[]" , "multiselect2[]" let me know if assumption wrong cheers!

c++ - Find two elements in an array that sum to k -

possible duplicate: given 2 arrays , b .find pairs of elements (a1,b1) such a1 belongs array , b1 belongs array b sum a1+b1 = k . given : unsorted array a of integers input : integer k output : 2 element set sum of elements in each set equal k in o(n). example: a = {3,4,5,1,4,2} input : 6 output : {3,3}, {5,1}, {4,2} note : know o(n logn) solution require have array sorted. there way problem can solved in o(n). non-trivial c++ data structure can used i.e there's no bound on space make constant-time lookup table (hash) can see if particular integer included in array (o(n)). then, each element in array, see if k-a[i] included. takes constant time each element, total of o(n) time. assumes elements distinct; not difficult make work repeating elements.

android - How to flush the shown text in marquee? -

i have created marquee text using textview in android. requirement flush shown text in marquee , append new text it. how flush shown text? @hanry right think marquee if gains focus.. had problem earlier.. did replaced textview webview , used marquee tag make text scroll. edit : response sangita webview = (webview) findviewbyid(r.id.webview); webview.getsettings().setdefaultfontsize(26); webview.setbackgroundcolor(r.color.black); webview.setontouchlistener(new ontouchlistener() { public boolean ontouch(view v, motionevent event) { //do actions here } }); string content = "marquee test"; string summary = "<html><font color='#fdb728' face='courier'><marquee behavior='scroll' direction='left' scrollamount=10>" + content + "</marquee></font></html>"; webvi...

iphone - making map coordinates(lan,& long)storing in sqlite database -

how created application records series of longitude , latitude values in sqlite database , display them coloured track on mapactivity. i need help. how can store map coordinates in sqlite database , display journey details in table .for example have done 1 journey mumbai pune .then how can store data database can available future reference .when user click on journey name should give details if new sqlite class data base create 2 database file following ---->>>> database.h write following code in file #import <foundation/foundation.h> #import <sqlite3.h> @interface database : nsobject { sqlite3 *database; } +(database *) sharedatabase; -(bool) createdatabase:(nsstring *)databasename; -(nsstring*) getdatabasepath:(nsstring *)database; -(nsmutablearray *) getalldataforquery:(nsstring *)sql fordatabase:(nsstring *)database; -(void) inseryquery:(nsstring *) insertsql fordatabase:(nsstring *)database1; -(void) deletequery:(nsstri...

Is there Android Intent concept in iPhone SDK -

just switching android iphone. in android can make several apps , use tabview call each app intent. in iphone, can make several apps. need tab call each apps or app views. there similar concept intent in iphone? switched iphone, copying other projects tabbar not work out. if have other methods solve, appreciate. thanks, android , ios different in regard. android open letting use intents mix , match activities other apps. ios isn't that; each app runs in own private space , cannot see other apps' data, let alone use services. is possible cause other apps run via custom urls, that's not same thing. what you'll need copy or move code view controllers, views, etc. of various ios apps tab bar app project. you'll build them single application, , tab bar switch between view controllers.

json - JQuery autocomplete returning odd values -

my jquery autocomplete kinda works - returns list 1 line <-- gt ie 9 or that, , otherwise empty! is wrong input json, how? $(document).ready(function(){ $("#field").autocomplete("page.html", { extraparams: { search: function() { return $("#field").val(); } } }); @requestmapping(value="page.html", params = "search", method = requestmethod.get) public @responsebody string getuseraccounts(httpservletrequest request, @requestparam("search") string search) { if (search==null||search.matches(tuhaconstants.badstr)||search.length()<2||search.contains("*")) { // logger.debug("ajax.html getuseraccounts() bad parameters"); return ""; } logger.debug("page.html getuseraccounts() search param "+search); details use...

Android :: DRM for video content -

did not want revive old thread. oma drm v1 & v2 support on android we trying implement drm solution video content both streaming , offline. , have searched both high , low, these few repeats every time. http://www.irdeto.com/documents/hl_cw_oma_drm_android_en_h.pdf http://www.discretix.com/android_security.html http://www.haihaisoft.com/customize_android_media_player.aspx http://www.authentec.com/a/production/home.aspx we targeting phones & tabs android 3.0 can helpful, went through sdk docs, still couldn't make out how use them. also read somewhere android 2.4 (for phones) support drm framework, in meantime market targeting may not upgrade android 2.4 soon. requires find custom implementation. have been hitting wall on sides. please give invaluable insights. if have missed obvious, correct me well. security through obscurity. it's way drm can work on device owned else. obsfucate code , require updates latest version, changes every wee...

iphone - How to get a data from an URL -

an api http://www.yourwebservice.com/pip.jsp?request=aaa&param=2 lets consider above api gives json value. use below coding json: nsurl *url =[nsurl urlwithstring:@"http://www.yourwebservice.com/pip.jsp?request=aaa&param=2"]; nsstring *resultedstring=[[nsstring alloc] initwithcontentsofurl:url]; it returns json resultedstring variable. small amount of data. if api has large amount of data in 100's of kb's whether coding work fine, or crash? many apis limit responses - example, twitter api not return more 1500 results. http://dev.twitter.com/doc/get/search

c# - Caching architecture advise for a specific scenario -

setup: we have .net application distributed on 6 local servers each local database(oracle), 1 main server , 1 load balance machine. requests come load balancer redirects incoming requests 1 of 6 local servers. in time intervals data gathered in main server , redistributed 6 local servers able make decisions complete data. each local server has cache component caches incoming requests based on different parameters (location, incoming parameters, etc). each request local server decides whether go database (oracle) or response cache. in both cases local server has goto database 1 insert , 1 update per request. problem: on peak day each local server receives 2000 requests per second , system starts slowing down (cpu: 90% ). trying increase capacity before adding local server mix. after running benchmarks bottleneck is, seems inevitable 1 insert , 1 update per request database. tried methods to able decrease frequency have created windows service sits between db , .net appli...

ide - Automating Eclipse tasks -

i'm looking ways automate tasks in eclipse. for instance, let's have couple of ant files i'll want run couple of times per hour. being able assign hot key each 1 of them, run them without having click, bring context menu , click again bring joy life. other example build/run configurations. have couple of them on project , i'd love have way of running each 1 of them different hot key configuration. moreover, nature of project i'm working on involves lot of experimentation , trying, having click , use mouse lot driving me insane. there other similar things automated (for example, each time commit i'd run command on project's folder, etc). is there tool eclipse(or outside it) that'll somehow allow me automate these kinds of tasks? vim eclipse me anyhow? after years coding feel have hit stone wall. came conclusion losing way time mouse. yes, know lot of eclipse actions have correspondent hot keys, lot of others don't. want ultimate solutio...

c# - LINQ side effects -

is possible substitute foreach loop lambda expression in linq ( .select) )? list<int> l = {1, 2, 3, 4, 5}; foreach (int in l) console.writeline(i); to: list<int> l = {1, 2, 3, 4, 5}; l.select(/* print console */); there no linq equivalent of foreach, although easy implement 1 yourself. eric lippert gives description here of why not implemented in linq itself. however, if collection list (which appears in example), can use list.foreach : mylist.foreach(item => console.writeline(item));

vbscript - Running an application as a different user (.bat / .vbs) -

i need restart application using service running on system account. problem application started under system account. various reasons beyond control restart system bit complicated result of complicatedness(c) i'm sure there must @ least 1 stage possible specify account app run on. the service calls bounce.bat contains following: @echo off cscript "c:\program files\myapp\bounce.vbs" the relevant section of bounce.vbs is: set oprocess = owmiservice.get("win32_process") set oprogram = oprocess.methods_("create").inparameters.spawninstance_ oprogram.commandline = spath & sexe set sshell = owmiservice.execmethod("win32_process", "create", oprogram) if there no clever suggestions i'll try this approach, i'm sure there must cleaner way.

javascript - Error shows when reading JSON using JQuery -

dear all, try use jquery read json file disk, simple shows below, shows me error, can't find out why... when check "var jqxhr" in dom, have value of json, when open web page, return error. thank u help <html> <head> <script src="http://code.jquery.com/jquery-1.5.js"></script> <script> //i check "jqxhr" in dom, have test.json's content, // why there error? .... var jqxhr = $.getjson('test.json', function(data) { alert("success"); var items = []; $.each(data, function(key, val) { items.push('<li id="' + key + '">' + val + '</li>');}); $('<ul/>', { 'class': 'my-new-list', html: items.join('') }).appendto('body'); }) .success(function() { alert("second success"); }) .error(function() { alert("error"); }) .comple...

java - One EBJ project include another EJB project, then javax.naming.NameAlreadyBoundException -

i have deployed ejb project (named a, having ejb , war modules) on server (glassfish 3.0 on redhat). ejb project (named b) needs use functions of a's xxx-ejb module, included a's ejb module. while deployed b on server, exceptions came: exception while invoking class org.glassfish.ejb.startup.ejbdeployer load method java.lang.runtimeexception: ejb container initialization error @ org.glassfish.ejb.startup.ejbapplication.loadcontainers(ejbapplication.java:219) @ org.glassfish.ejb.startup.ejbdeployer.load(ejbdeployer.java:197) @ org.glassfish.ejb.startup.ejbdeployer.load(ejbdeployer.java:63) @ org.glassfish.internal.data.moduleinfo.load(moduleinfo.java:175) @ org.glassfish.internal.data.applicationinfo.load(applicationinfo.java:216) @ com.sun.enterprise.v3.server.applicationlifecycle.deploy(applicationlifecycle.java:338) @ com.sun.enterprise.v3.server.applicationlifecycle.deploy(applicationlifecycle.java:183) @ org.glassfish.deployment.admin....