Posts

c# - String to byte[] and vice versa? -

possible duplicate: .net string byte array c# how convert string byte[] array , vice versa? need strings stored in binary storage. please show example in both directions. , 1 more thing: each string maybe bigger 90kb. if want use utf-8 encoding: // string byte[] byte[] bytes = encoding.utf8.getbytes(somestring); // byte[] string string anotherstring = encoding.utf8.getstring(bytes);

vb.net - Implementing timer states(Available,Busy,Away etc) in a chat application vb8 -

i developing chat application , trying include: various states, msn does, available, busy , away. if user doesn't touch keyboard 1 minute, state of user isto changed away. or similar these. i need program able play sound while running. can community aid me resources me implement , perhaps code if has experience similar application? to manage inactive state, can use timer paired global keyboard hook (the article c#, can translate vb.net). each time application receives keyboard message, timer reset inactivity interval. if timer runs out, can set status of application inactive.

Where to find BitTorrent source code? -

i have looked , looked , cannot seem find source code anywhere. every link find points official bittorrent page, slashdot says took source code down in 2007. believe incredibly widespread, open-source technology not found anywhere except in applications utorrent or transmission? there has place download current source code bittorrent. can point me magical place? fyi archived version of original bittorrent application (also known mainline, particularly developing other bt clients) available here, 3.9.1. http://download.bittorrent.com/dl/archive/ for example, can confirm bittorrent-3.9.1-1.noarch.rpm contains python source. rpm format can opened using common archive utilities. on osx, used keka unarchive cpio, keka again unarchive file structure (i can see python scripts common bt tasks under usr/bin/ , various code under usr/lib/python2.3/site-packages/bittorrent ) when switched utorrent codebase, code became closed. mentioned others, there many open source alterna...

jsp - Empty EntityManager in Java EE bean on JBoss 5.1 -

i'm newbie in java ee. first project i'm trying , have problem can't solve. i've created 3 projects: slowka-beans (ejb), slowka-persistance (jpa) , slowka-web(jsf). after deploying them can't access persistence unit - entitymanager null. works fine - can create beans, inside them instantiate entity classes , show them on jsf page. how can store them in db? have mysql database configured on jboss site. the code have looks following: languagesmanager.java (in slowka-beans) @stateless public class languagesmanager implements languagesmanagerlocal { @persistencecontext(unitname="slowka-persistance") private entitymanager em; public languagesmanager() { system.out.println("languagesmanagerbean constructor"); } public string getworking() { if(em == null) { system.out.println("not working..."); return "not working..."; } else { system.out.pri...

asp.net mvc - When I try to debug the project all the test auto run. How I stop this -

when debug project viewing , fixing design issue see test running well. how stop tests don't run while working on ui project? if have testing project (or project matter) in solution , don't want start up, right-click on solution in solution explorer , choose properties. click on common properties->startup project. you'll see "multiple startup projects" selected. if choose "none" in drop-down in action column test project(s), should stop them starting when debug solution. this vs2008 2005 , 2010 should similar.

validation - Rails 3: how to update only 1 attribute? -

how can update 1 attribute in database without having insert validations? e.g: i have password presence = true. when want edit database, have pass password. want edit 1 field without passing password. i've tried update_attribute, merge, none works. thanks. donald edit: validation, works on console, still puts password there. here's validation: def password_validation_required? encrypted_password.blank? || !@password.blank? end and when submit form without password field, on console: (it puts blank on encrypted_password field) sql (0.3ms) update "wsps" set "about" = 'gfg', "encrypted_password" = 'fcf538f9a588befec4ee2567754a42f05b3cd75f24919d49530426786491c3e1', "updated_at" = '2010-11-30 23:56:45.594168' ("wsps"."id" = 4) maybe controller isn't correct? have this: if @wsp.update_attributes(params[:wsp]) my form: <%= form_for(@wsp, :html => { :...

binding - WCF IncludeExceptionDetailInFaults programmatically? -

i have following in config file, , trying find equivalent bits in c#, have service configured programmatically. class/property/method should for? thanks. <behaviors> <servicebehaviors> <behavior name="servicegatewaybehavior"> <servicemetadata httpgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> </behaviors> if want in cases, use servicebehaviorattribute : [servicebehavior(includeexceptiondetailinfaults=true)] class myserviceimplementation : imyservice { /// ... } if want in cases, determined @ runtime.... //////////////////////////////////// // must include these @ top of file using system.servicemodel; using system.servicemodel.description; // ... ///////////////////////////////////////////////////////////// // inside whichever function initializes service host //...