Posts

wpf - XAML - MergedDictionaries throwing XmlParseException "item has already been added". Why? -

i have following, easy reproduce problem: i'm creating xaml application uses resources file. way go create mergeddictionaries-tag merge local , global resources, this: <window> <window.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="path.to.xaml.file"/> <resourcedictionary> <style targettype="{x:type border}" x:key="typeblock"> </style> <style targettype="{x:type border}" x:key="setblock"> </style> </resourcedictionary> </resourcedictionary.mergeddictionaries> </resourcedictionary> </window.resources> .... </window> this little piece of code crash if run it: item has been added. key in dictionary: 'system.windows.controls.border' key being added: ...

python - Scripting HTTP more effeciently -

often times want automate http queries. use java(and commons http client), prefer scripting based approach. quick , simple. can set header, go page , not worry setting entire oo lifecycle, setting each header, calling html parser... looking solution in language, preferable scripting have @ selenium . generates code c#, java, perl, php, python, , ruby if need customize script.

performance - What is the fastest way to remove nodes from a large XML file using .net -

i working working large xml files (100s of mbs). tree simple <items> <item> <column1>abc</column1> <column2>def</column2> </item> <item> <column1>ghi</column1> <column2>klm</column2> </item> </items> i need parse document, , remove <item> elements. far, best peerformance achieved using xmlreader, caching each <item> in memory , writing using xmlwriter out if meets criteria, , ignoring if doesn't. there anyting can make faster? you might able save step implementing subclass of xmlreader read method skips on item elements you're not interested in. right now, seem have 2 steps: reading , filtering document xmlreader , using xmlwriter write presumably read from. subclassing xmlreader eliminates second step; use subclassed xmlreader input xslt transform or xmldocument or whatever, , never builds intermediate representation of filtered x...

java - How much data can a List can hold at the maximum? -

how data can added in java.util.list in java @ maximum? is there default size of arraylist? it depends on list implementation. since index arrays int s, arraylist can't hold more integer.max_value elements. linkedlist isn't limited in same way, though, , can contain amount of elements.

performance - what mysql query is better? -

i got 2 mysql queries, retrieve same data?, 1 think better use , why? taking account standards, , better code etc. sorry if stupid question, im curious cat! here goes: query 1: select * (( select u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt relationships r join notes m on m.user_id = r.leader join user u on r.leader = u.user_id r.listener ='2' ) union ( select u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt notes m join user u on m.user_id = u.user_id u.user_id ='2' )) d d.dt < '2010-09-20_131830' order d.dt desc query 2: select u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt notes m inner join user u on m.user_id = u.user_id (m.user_id = '2' or m.user_id in ( select r.leader relationships r r.listener ='2')) , dt < '2010-09-20_131830' order dt desc i find union all version easier understand (...

cakephp swiftmailer config -

hi using swiftmailer component in app , looking way have separate config (perhaps in config folder?) swiftmailer checks debug mode using , uses different settings? case 1: on production mode use simple smtp server without auth. case 2: on debug mode use gmail settings or other settings since developing locally is possible? the settings code case 1: $this->swiftmailer->smtphost = ''; the settings code case 2: $this->swiftmailer->smtptype = ''; $this->swiftmailer->smtphost = ''; $this->swiftmailer->smtpport =; $this->swiftmailer->smtpusername = ''; $this->swiftmailer->smtppassword = ''; i think quickest way be: <?php configure::load('swiftmailer'); $this->swiftmailer->smtptype = configure::read('swiftmailer.'.configure::read().'.smtptype'); $this->swiftmailer->smtphost = configu...

switch statement - Switching activities back and forth in Android -

i'm starting on android , got beginner question on switching between multiple activities. i understand can go between 2 activities invoking intent , returning setresult(). want know how jump between multiple activities. want learn process life-cycle. understand how every activity started ar oncreated(), i'm not sure how implement onresume() or onrestart() when want come back. so have 3 activities: activity1, activity2 , anctivity3. i start activity1 , invoke activity2 intent, , activity2 invokes activity3. using buttons. want come activity1 activity3. same thing here too. make intent , call startactivity(activity1_intent). gives runtime error. i think need implement onresume() or onrestart(), i'm not sure how this. in oncreate() make gridview, when come back, need make gridview again? if give small explanation of refer tutorial great. thank much. in manifest file set android:launchmode="singletop" activity1. then call activity1 use: int...