Posts

Showing posts from March, 2013

java - Can "Export to JAR in Eclipse" be as smart as javac? -

java - Can "Export to JAR in Eclipse" be as smart as javac? - i want export part of java project jar file while including class files necessary run main class. project contains other main classes similar not identical dependencies. can run custom script accomplish it, this: mkdir temp cd temp javac -sourcepath "../" -d . ../mainclass_a.java jar cmf mainclass_a.manifest ../mainclass_a.jar * for elegance , more share others i'd run straight eclipse instead of custom script. however, when export jar file, or runnable jar file, every class file in project included. know can set manual filters exclude files, seems there should smarter option. how can configure eclipse include class files main class depends on? i think want impossible in general case. yes, theoretically javac can find (and finds) dependencies between classes. right if these dependencies hard coded within project, i.e. not utilize dynamic class loading , reflection either straig...

String class e char in C++ -

String class e char in C++ - when have char anything[20]; cout << sizeof anything; it prints 20. however string anymore; cout << sizeof anymore; // prints 4 getline(cin, anymore); // let's suppose type more 1 hundred characters cout << sizeof anymore; // still prints 4 ! i understand how c++ manages this. thanks sizeof compile-time construct. has nil runtime, rather gives fixed result based on type passed (or type of value passed it). char[20] 20 bytes, string might 4 or 8 bytes or whatever depending on implementation. sizeof isn't telling how much storage string allocated dynamically hold contents. c++

android - How to handle the Web service exception -

android - How to handle the Web service exception - in application getting exceptions when calling web service. exceptions 07-11 18:46:54.942: info/system.out(1180): webservice calling error ->java.net.unknownhostexception: host unresolved: www.roadbrake.com:80 07-11 18:46:54.942: info/system.out(1180): soap method error ->java.lang.nullpointerexception is code problem or web service problem. if coding problem how can handle it? please can help me. thanks you should check network connection before calling web service.. here code check network connection... connectivitymanager conmgr = (connectivitymanager)getsystemservice(context.connectivity_service); if ( conmgr.getnetworkinfo(0).getstate() == networkinfo.state.connected || conmgr.getnetworkinfo(1).getstate() == networkinfo.state.connecting ) { //notify user online } else if ( conmgr.getnetworkinfo(0).getstate() == networkinfo.state.disconnected || conmgr.getnetworkinfo(1).getsta...

android - Date object not returning correct time value -

android - Date object not returning correct time value - i using below code current time in specific format , want print time stamp. simpledateformat dateformat = new simpledateformat("mm-dd hh:mm:ss.ms"); string formatteddate = dateformat.format(new date()); date curdate = null; seek { curdate = dateformat.parse(formatteddate); } grab (parseexception e) { // todo auto-generated grab block e.printstacktrace(); } log.i(config.tag,"curdate...... "+curdate); but when see logcat output "curdate....." showing "mon jul 13 04:11:51 edt 1970" in above statement minutes wrong. in android device, time showing "04:40 am". i unable figure out why above method capturing "29" minutes delay.?? pl. allow me know proper way this. allow me know if missed something. i suspect it's "ms" part of format string confusing things. think mean "ss" ins...

java - (a)Smack returns "service-unavailable (503)" error at login() -

java - (a)Smack returns "service-unavailable (503)" error at login() - i'm trying implement simple jabber messenger on android using asmack library. here's code: public boolean login() { if (connection != null && connection.isconnected()) { log.i("xmpp", connection.gethost()); seek { connection.login(username, password); } grab (xmppexception e) { e.printstacktrace(); homecoming false; } homecoming true; } homecoming false; } exception after connection.login() (connection looks fine): service-unavailable(503) @ org.jivesoftware.smack.nonsaslauthentication.authenticate(nonsaslauthentication.java:77) @ org.jivesoftware.smack.xmppconnection.login(xmppconnection.java:239) @ org.jivesoftware.smack.connection.login(connection.java:353) @ com.someapp.networking.xmppmessenger.login(xmppmessenger.java:60) @ com.someapp.xmpp...

java - Generating JLabels on demand -

java - Generating JLabels on demand - i able generate map, of sorts, places little jlabels @ coordinate locations on panel. problem need them randomly generated, don't know in advance how many have. there way that? i hope isn't breaking java coding taboos - i'm self-taught. *edit: know vague - programme huge , cumbersome , have developed own conventions (which i'm sure raise hackles of real java coders :-p) should have specified have class location, , can generate random locations. problem have in creating new jlabel each of locations. here's have: //method called after new location has been created, add together map public void addlocation(location newlocation) { int xx = newlocation.getxloc(); int yy = newlocation.getyloc(); (int i=0;i<1;i++) { jlabel templabel = new jlabel(); //templabel instantiated elsewhere (is problem?) templabel.setbackground(color.black); templabel.setbounds(xx,yy,3,3); ma...

php - Facebook API - Authenticate Specific User..? -

php - Facebook API - Authenticate Specific User..? - i'm connecting facebook api via simple examples posted in facebook developers' documentation $code = $_get["code"]; if(empty($code)) { // long scope, i've tested it, , there aren't errors here. $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . '&scope=email,read_stream,publish_stream,read_mailbox,read_requests,create_event, manage_pages,publish_checkins,manage_friendlists,read_friendlists,user_about_me, user_activities,user_birthday,user_checkins,user_education_history,user_events, user_hometown,user_interests,user_likes,user_location,user_photo_video_tags, user_photos,user_relationship_details,user_relationships,user_religion_politics, user_status,user_videos,user_website,user_work_history'; echo "<script> ...

Adding device data structures and registration for Linux driver -

Adding device data structures and registration for Linux driver - i adding gyro/accel driver (invensense mpu3050), available here kernel (lpc linux). utilize ltib building image , rootfs. i manage in adding files , driver available , compiles perfectly! need add together mpu3050_platform_data construction in i2c_board_info_structure in "board-generic.c" file (readme) , register adding lines in same "board-generic.c" file. problem is, cannot locate this/these file/s. name depending on linux distribution? same info written somewhere else? you need add together file supporting tegra board using. in current 3.0-rc3 kernel (last tag have checked out), see these tegra board files (in arch/arm/mach-tegra): board-harmony.c board-paz00.c board-seaboard.c board-trimslice.c these files configure static devices given tegra board. config file selects ones built. here corresponding config options (from arch/arm/mach-tegra/kconfig): comment "tegra ...

c# - MS Build Import Question Path -

c# - MS Build Import Question Path - quick question msbuild. have next msbuild file in directory d:\mydirectory <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" > <import project="d:\mydirectory\buildtest\buildtest\buildtest.csproj"></import> </project> when run build fails because buildtest.csproj can't find .cs source files , seems looking in d:\mydirectory. expecting working directory set of buildtest.csproj , able resolve references. doing wrong? i think ,the import element used import other msbuild projects 1 (see here). if want specify c# projects build, should this: <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" > <itemgroup> <projectreferences include="d:\mydirectory\buildtest\buildtest\buildtest.csproj" /> <!--more--> </itemgroup> then if want build referenced projects, can illustrati...

iphone - How to hide the segments button and display other segments button -

iphone - How to hide the segments button and display other segments button - i having problem in displaying segment button on navigation bar. programme flow this: login page > details page > map page. want display 2 segments button on details page , when goto map page user sees 3 segments button. how possible? more info project: in app have tabbar create other class it's name tabbar class. , calling page. ttabbar *tabbar=[[ttabbar alloc] init]; [self.navigationcontroller pushviewcontroller:tabbar animated:yes]; tabbar.selectedindex = 0; you can seek adding segments code using following segmentedcontrol = [[uisegmentedcontrol alloc]initwithframe:cgrectmake(115, 210, 190, 30)]; segmentedcontrol.segmentedcontrolstyle = uisegmentedcontrolstylebar; [segmentedcontrol insertsegmentwithimage:[uiimage imagenamed:@"bus.png"] atindex:0 animated:yes]; [segmentedcontrol insertsegmentwithimage:[uiimage imagenamed:@"car.png"] atin...

Uninstalling Entity Framework 4.1 June CTP -

Uninstalling Entity Framework 4.1 June CTP - how can uninstall ef 4.1 june ctp? don't see in windows 7's programs , features list. pom it must in features list - if not found bug , should study here. i think meant june 2011 ctp - ef 4.2. follow instructions on this site. aware if installed new designer tools ctp lose ado.net tools vs after uninstalling them , have reinstall old version 1 time again (also described on mentioned site). entity-framework entity-framework-4.1

javascript - A better test for base64 URI support (can I create a large base64-encoded image in JS?) -

javascript - A better test for base64 URI support (can I create a large base64-encoded image in JS?) - i'm using modernizr observe features supported in browser our users running, far good. i've come against theoretical problem when testing base64 compatibility. patch back upwards detailed here, , works- except weird case ie8- it allows base64 encoded images of 32kb. i don't want embed 32kb long base64 string within js file, it'll add together crazy amount of bloat. so, create 32kb- valid- image using js? i'm thinking repeating kind of pattern within string until reaches 32kb in length, sort of thing. or maybe taking existing tiny string (like 1 in modernizr patch) , adding junk info @ end still results in valid image. i know next nil base64 encoding, other how manipulate existing image. have ideas? i think have answer. tried sorts of techniques (repeated text chunks in png source manually add, etc) until found adding line breaks appears job:...

iphone - How to change appstore application icon -

iphone - How to change appstore application icon - hi can 1 suggest me possible or not , if possible how? the premise user pays app via website , gets access code send guests via website. user downloads free app iphone store , enters code. we're trying figure out if can enable each user customize app icon can appear different image or text on user phone. you can't. application's icon (and application's property list file) in application bundle, cannot modified. this violate ios sdk terms of utilize , itunes store terms of service; cannot have third-party receive payment access free ios application. iphone ios sdk

How to use PostgreSQL Foreign Data Wrapper to join 2 different postgresql databases -

How to use PostgreSQL Foreign Data Wrapper to join 2 different postgresql databases - can provide illustration (with various sql statements involved) on how utilize foreign info wrappers in postgresql enable table postgresql database joined table postgresql database b? it unclear docs grade fdw functionality available in pgsql 9.0 versus 9.1. docs not have examples shows how bring together between 2 different postgresql databases (with qualifier push-down) using fdw. http://www.postgresql.org/docs/9.0/static/sql-createforeigndatawrapper.html http://www.postgresql.org/docs/9.1/static/ddl-foreign-data.html http://www.depesz.com/index.php/2011/03/14/waiting-for-9-1-foreign-data-wrapper/ you manipulate table. per depesz' post: create foreign table passwd ( username text, pass text, uid int4, gid int4, gecos text, home text, shell text ) server file_server options (format 'text', filename '/etc/passwd', delimiter ...

c - filesystem shared by multiprecoesses with multithreads -

c - filesystem shared by multiprecoesses with multithreads - here case: i talking general linux concurrent programming environment definition: node: machine processor. file system: can accessed both locally , remotely. includes big set of files varied in random size. node i: process multithreads access a's file system, operations include read , write. process b, similar a. think more similar processes c,d,etc. then, thinking scaling. same fs scheme located on separate node. operated processes e,f,g etc on node ii, , processes a,b,c,d on node i. thinking similar node iii,iv,v, etc. this both practical , interview question. here solution: i can utilize mutex , signal resolve multi reader , author of same file within process. , using ipc resolve multiprocesses communication , synchronization. code work single node multiprocesses. but, when dealing multi node. need similar more complicated mechanism observe there node writting on fs, if ye...

java - Select distinct elements in listview when click item -

java - Select distinct elements in listview when click item - i have list view custom adapter, image button , text view. i want open context menu when press made on image button, , open context menu if press text view. how can this?? this onclicklistener lv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { if (id == view.findviewbyid(r.id.label).getid()) //label press { textview text = (textview) view.findviewbyid(r.id.label); registerforcontextmenu(text); opencontextmenu(text); } else //imagebutton press { imagebutton ib= (imagebutton) view.findviewbyid(r.id.image); registerforcontextmenu(ib); opencontextmenu(ib); } } }); add oncreatecontextmenulistener view: text.setoncreatecon...

Writing numbers to a file with more precision - C++ -

Writing numbers to a file with more precision - C++ - i wrote parameters (all of type double ) file utilize in performing complex computations. write parameters files so: refstatsout << "someparam:" << value_of_type_double << endl; refstatsout ofstream parameter. there 4 such parameters, each of type double . see written file different actual value (in terms of loss of precision). example, if value_of_type_double had value -28.07270379934792, see written in file -28.0727. also, 1 time these stats have been computed , written run different programs utilize these statistics. files read , values stored std::strings , converted double via atof functions. results in values have shown above , ruins computations farther down. my question this: 1. there way increment resolution 1 can write values (of type double , like) file not lose precision? 2. problem of std::string double conversion atof ? if so, other function utilize solve this? ...

apache - Virtual hosts WAMP 2.1 -

apache - Virtual hosts WAMP 2.1 - i'm trying set virtual host project need do. many tutorials define activated virtual host file include conf/extra/httpd-vhosts.conf placed virtual host in te file <virtualhost *80> documentroot "c:\users\jeroen\work\ba\cms\trunk" servername local.ba-check.be </virtualhost> the hosts file got line extr 127.0.0.1 local.ba-check.be my localhost works, returns document root. error log gives me error. [thu jul 07 14:22:55 2011] [error] [client 127.0.0.1] client denied server configuration: c:/httpd-2.2-x64, referer: http://local.ba-check.be/ i hope help me. thanks problems solved after time reinstalled wamp , worked great. apache http wamp virtualhost

mysql - SQL Syntax help -- FOREIGN KEY -

mysql - SQL Syntax help -- FOREIGN KEY - i have 2 tables, t1 , t2. t1 has fields id, key_id, title. (id primary key, key_id , title obtained t2.) and t2 has fields id, key_id, title , f4. (id obtained t1 , key_id primary key in t2) can help in writing syntax above using foreign key , primary key please comment if not clear. you can't create foreign key constraint t1 t2 before t2 defined, , vice versa. trick create 1 table without fk constraint, create sec table, , utilize alter table add together fk constraint first table. mysql

Using Facebook Javascript SDK to get Graph Data -

Using Facebook Javascript SDK to get Graph Data - fixed now! can't reply own question yet. see comment below. , helping. i've searched , searched , read docs , still can't figure out. i have web page event. there's public facebook "event" event. i'm trying utilize fb javascript sdk number of attendees facebook event , add together number of people who've registered through website. i've created app , have appid , secret string. can access token from: https://graph.facebook.com/oauth/access_token?client_id=xxxx&client_secret=xxxxx&grant_type=client_credentials and can utilize access token attendees public event: https://graph.facebook.com/331218348435/attending?access_token=xxxxxxxxx that's fine. i'm trying same thing using javascript sdk. i've loaded sdk , done init: fb.init({ appid : 'xxxxxxxx', status : true, // check login status cookie : true, // enable cookies allow server a...

arrays - php Undefined Offset in simple function() -

arrays - php Undefined Offset in simple function() - i'm not sure why getting undefined offset notice on this: <?php $numbers = array('1','2','3'); $total = 0; for($i=0;$i<=sizeof($numbers); $i++) { $total += $numbers[$i]; echo $total; } ?> output: 136 notice: undefined offset: 3 in e:\php\arrays\array_1.php on line 17 6 your array has 3 elements @ index 0, 1 , 2. there no element index 3. your loop should stop before hits that... for($i=0;$i<sizeof($numbers); $i++) { } also, checkout array_sum, might you're wanting anyway... $total=array_sum($numbers); php arrays for-loop sizeof

ios - To check wifi is on but no internet connectivity -

ios - To check wifi is on but no internet connectivity - i m using reachability classes check wifi connectivity in code. problem arise wifi on there no or low net connectivity, here code runs in loop waiting response called webservice , hangsup , crashes sometimes. below code executed when nail ok on alertview pulls info webservice here code : reachability *reachobj = [reachability reachabilityforinternetconnection]; [reachobj startnotifier]; networkstatus remotehoststatus = [reachobj currentreachabilitystatus]; if (remotehoststatus==reachableviawifi) { secondview *objsecview=[[secondview alloc]init]; [self presentmodalviewcontroller:objsecview animated:yes]; } else if (remotehoststatus==notreachable) { firstview *objfrstview=[[feedbackpopoverviewcontroller alloc]init]; [self presentmodalviewcontroller:objfrstview animated:yes]; } guys m new objective c. plz help me out, in advance. ...

javascript - Hyperlink and fragment ID Vertical Offset Problem -

javascript - Hyperlink and fragment ID Vertical Offset Problem - at top of page statically positioned menu strip follows screen during scrolling. when using fragment linking scroll position needs offset height of menu strip. how can achieved? <a href="#fragment">go fragment</a> <div id="fragment">...</div> html { padding-top: 38px; } /* offset page allow menu strip */ .menu-strip { position: fixed; top: 0; right: 0; left: 0; height: 38px; } is there simple css alter can made accomplish this? otherwise, there generic way offset scrolling 200px when fragment specified? what want create handle own hash linking. thought grouping of a hash linking. example $(".ahashlink").click( function() { var location = $(this).attr("href"); var offset = $(location).offset().top; $("body").scrolltop(offset+38); homecoming false; }); this scroll right place plus 38 more pixels ...

c++ - How do I find the memory address of a string? -

c++ - How do I find the memory address of a string? - i having mental block , know should know need little help. if declare string variable this: string word = "hello"; how find memory address of "hello"? edit: trying do... write function takes 1 argument, address of string, , prints string once. (note: need utilize pointer finish part.) however, if sec argument, type int, provided , nonzero, function should print string number of times equal number of times function has been called @ point. (note number of times string printed not equal value of sec argument; equal number of times function has been called far.) use either: std::string::data() if info isn't null-terminated c-string like. or std::string::c_str() if want info , guaranteed null-termination. note pointer returned either of these calls doesn't have underlying info std::string object manipulating. c++ string memory-address

javascript - Greasemonkey- Picking random word(s) out of search engine results page -

javascript - Greasemonkey- Picking random word(s) out of search engine results page - i working on little project seem stuck @ point. hopefully, of great people able help me out on this. i trying figure out simple , efficient way of pick out random word or words page of search engine results. part stuck on. after picking out, store word(s) in variable. the search results this: http://i54.tinypic.com/34fllw1.png thanks in advance. tips/help appreciated! edit: there way able pick out string of consecutive words of random length? here illustration works google.com //get text var text=document.getelementbyid('rso').textcontent; //find words var words=text.match(/\b([a-z]{3,})\b/gi); //pick word alert(words[math.floor(words.length*math.random())]); the searchresults listed in element id "rso". regexp matches strings consisting of @ to the lowest degree 3 chars a-z javascript greasemonkey userscripts

algorithm - PHP beginner palindrome script -

algorithm - PHP beginner palindrome script - i working on (for fun) writing script recognize palindromes. far, i'm successful "kayak", "racecar", "anna", "a man plan canal panama": yet variations on latter phrase such "amanaplana canalpan ama" gives me problems. as side note: understand using pcre create things lot easier me, i'm not fluent in , 1 of major aims understand algorithm behind checking palindromes. <?php $word = "amanaplana canalpan ama"; $space = " "; $word_smallcase = strtolower($word); $word_array = str_split($word_smallcase); if(in_array($space, $word_array)){ for($m = 0; $m<count($word_array); $m = $m + 1){ if($word_array[$m] == $space) unset($word_array[$m]); } } $count = 0; $scan_count = -1; for($i = 0; $i < (count($word_array)/2); $i = $i + 1){ for($j = count($word_array); $j > (count($word_array)/2); $j = $j - 1...

c# - get value Session -

c# - get value Session - dataclassesdatacontext dc = new dataclassesdatacontext(); var summaryfielddb = b in dc.propertycompanies (b.summaryfield.contains(txtsearch)) select b; session["summaryfield"] = summaryfielddb; now how can access field summaryfileddb??? if utilize system.data.linq.table<propertycompany> result = (system.data.linq.table<propertycompany>)session["summaryfield"]; this line when run programme error:unable cast object of type 'system.data.linq.dataquery 1[propertycompany]' type 'system.data.linq.table 1[propertycompany] if utilize store procedure fullsearch session["search"] = dc.fullsearch("anv", true, true, true, true, true, true, true, true, true, true, true); system.data.linq.isingleresult<fullsearchresult> b = (system.data.linq.isingleresult<fullsearchresult>)session["search"]; foreach(var item in b) { //work fields } this work fine!!!...

silverlight - How to bind to stackpanel children? -

silverlight - How to bind to stackpanel children? - i define stackpanel 4 textblock within , define object holds 4 strings properties. class { public string str1; public string str2; public string str3; public string str4; } <stackpanel> <textblock x:name="txt1" /> <textblock x:name="txt2" /> <textblock x:name="txt3" /> <textblock x:name="txt4" /> </stackpanel> i want define binding between object instance of class , stackpanel textblock.text how can ? to bind str1-4 have get/set properties @ minimum (and notify properties if alter after view connected instance of class a). class { public string str1 { get; set; } public string str2 { get; set; } public string str3 { get; set; } public string str4 { get; set; } } <stackpanel> <textblock x:name="txt1" text={binding str1}...

c# - Why IEnumerable becomes empty after adding elements to a collection? -

c# - Why IEnumerable<T> becomes empty after adding elements to a collection? - i have ienumerable<t> when iterate through , add together it's element list becomes empty? is there wrong expect code? public class apple { private icollection<fruit> _fruits = new list<fruit>(); public void addfruits(ienumerable<fruit> fruits) { if (fruits == null) throw new argumentnullexception("fruits"); foreach (var fruit in fruits) { _fruits.add(fruit); } } } the caller code: public void addfruits(ienumerable<fruit> fruitstoadd) { foreach (var apple in apples) { // here fruitstoadd has elements, fruitstoadd.tolist() has 2 fruits. apple.addfruits(fruitstoadd); // here fruitstoadd has no element!!, fruitstoadd.tolist() empty! // next iteration not add together fruit next apple since fruitstoadd empty. } } update the tolist() so...

c# - Using Moq for Generic methods -

c# - Using Moq for Generic methods - totally simple situation, can't create work. running issue using moq mock generic method (in case, on ninject kernel interface): t get<t>(); i set mock object: mock<ikernel> mockkernel = new mock<ikernel>(); mockkernel.setup(x => x.get<igetuserquery>()).returns(new getuserquery()); at runtime next exception: expression references method not belong mocked object: x => x.get<igetuserquery>(new[] { }) any thought why it's throwing this? i've mocked generics in moq before without problem... there cases in generic mocking isn't supported? seems straightforward case. wrinkle igetuserquery in turn inherits genericized type: igetuserquery : icommand<userqueryinput, userqueryoutput> i don't see creating problem because generic types implementation of icommand staticly defined igetuserquery, uncertainty confusing moq. thanks in advance the pro...

c# - protobuf-net does not deserialize DateTime.Kind correctly -

c# - protobuf-net does not deserialize DateTime.Kind correctly - using protobuf-net.dll version 1.0.0.280 when deserialize datetime (wrapped in object) date/time ok datetime.kind property 'unspecified' consider test case serialize/deserialize datetime. [testmethod] public void testdatetimeserialization() { var obj = new datetimewrapper {date = datetime.utcnow}; obj.date = datetime.specifykind(obj.date, datetimekind.utc); var serialized = obj.serializeproto(); var deserialized = serialized.deserializeproto<datetimewrapper>(); assert.areequal(datetimekind.utc, deserialized.date.kind); } public static byte[] serializeproto<t>(this t item) t : class { using (var ms = new memorystream()) { serializer.serialize(ms, item); homecoming ms.toarray(); } } public static t deserializeproto<t>(this byte[] raw) t : class, new() { using (var ms = new memorystream(raw)) { homecoming serializer.de...

css height 80% not working -

css height 80% not working - i want create table take 80% of screen, right size of content in table. #ecom-mainarea .center { margin-left: 10%; position: relative; width: 80%; height: 80%; /* when 500px works fine, % doesn't work */ border: 1px solid; border-bottom-color: teal; border-top-color: gray; border-left-color: gray; border-right-color: teal; background-color: white; voice-family: "\"}\""; voice-family: inherit; vertical-align: text-top; } you need create sure html and body elements have 100% height. need stretch top bottom. if not html , body element high table. here have working sample: <!doctype html> <html> <head> <title>table height</title> <style> html, body { padding: 0; margin: 0; height: 100%; } </style> </head> <body> <table style="background: cyan; height: 80%;"> ...

java - Releasing a lock as soon as it is passed -

java - Releasing a lock as soon as it is passed - i have client-server architecture server has clients work in turns, passing parameter each time client supposed work. client work parameter, , when done, parameter becomes "invalid" , can no longer used work. i'd avoid running garbage collector while going on, , i'm avoiding object allocations. plan server associate single parameter object each client, , pass same parameter every time client asked work. however, creates problem parameter have re-set "valid" while ensuring client (who may have kept reference parameter lastly time around) can't start using (say, in different thread) before asked begin doing work. so of parameter's public methods synchronized, , "valid" state set, followed (synchronous) beginwork phone call client, within synchronized block. creates problem client unknowingly hold parameter's lock, cause problems if client wants split work multiple threads. in...

inheritance - Objective-C: Cast super instance variable in subclass? -

inheritance - Objective-C: Cast super instance variable in subclass? - in objective-c, in definition of subclass (perhaps in interface file), possible cast instance variable (ivar) that's inherited super class? i want because i've defined superclass's ivar nsobject *session , , want cast subclasse's ivar facebook *session , don't have cast every time i'm sending message facebook instances respond nsobject instances don't. there no way alter type of superclass interface variable, 1 thing add together getter method, such as - (facebook *) getsession { homecoming (facebook *)[self session]; } objective-c inheritance casting instance-variables ivar

c# - OnDataBound not fired for asp:DropDownList with static asp:ListItems -

c# - OnDataBound not fired for asp:DropDownList with static asp:ListItems - i have <asp:dropdownlist> witch gets filled static list items. <asp:dropdownlist ... ondatabound="handlermethod"> <asp:listitem value="..." text="..." /> <asp:listitem value="..." text="..." /> <asp:listitem value="..." text="..." /> </asp:dropdownlist> the problem ondatabound event not triggered when list filled. need trigger fill other info list items in dropdown. the documentation says: this method notifies server command info binding logic associated command has completed. my eyes on "logic" word makes me thing missed point on when event triggered but if case, how can event triggered or other event can utilize know when list has finished beeing filled? normally means have deleted autoeventwireup="true" or set false, , that's why...

regex - matching a multiline make-line variable assignment with a python regexp -

regex - matching a multiline make-line variable assignment with a python regexp - i trying extract multiline make-line variable assignment multiline value. next testcase fails find match in input string , have confess fail see why. help on making sample code print "a \ b" on stdout welcome. #!/usr/bin/env python def test(): s = r""" foo=a \ b """ import re print type(s),s regex = re.compile(r'^foo=(.+)(?<!\\)$', re.m) m = regex.search(s) print m.group(1) if __name__ == '__m...

regex - Jmeter Regular Expression Extractor -

regex - Jmeter Regular Expression Extractor - i new jmeter's regular look extractor. http request, getting html response. want extract e-mail address hidden value in response utilize in subsequent request. the string is: <input type="hidden" name="login" id="login" value="abs12.test@test.com" > how can this? you may maybe more effective xpath extractor, used same way regex extractor. xpath query like: //input[@type='hidden'][@name='login']/@value and extractor itself: regex xpath jmeter

PHP: file() each character is preceded by "\0" -

PHP: file() each character is preceded by "\0" - i have ini file has been created autohotkey programme written fellow member of team working on. trying read file php array. using built in file() function. when read in file , display using var_dump($file) ( $file name of array file beingness read into) each character preceded "\0"(which null character). each has seen happen before? remove null characters after read in file, prefer find solution. when open ini file in text editors opens fine. read in using file() function desktop.ini file created windows , read in expected, characters not preceded "\0" it has encoding of file. (most) unicode encodings require 2 bytes per character. means each single byte character prefixed \0. file still valid, if seek read windows-1252 type single byte encoding odd. can seek feeding through utf8_decode , see if clears up. utf 8 potential multibyte encoding 1 4 bytes (with minimum of 1). text edi...

actionscript 3 - Convert PHP Explode String to AS3 -

actionscript 3 - Convert PHP Explode String to AS3 - how convert form php as3? $arr = explode(" | ", $str); foreach($arr $item) { $arr2 = explode(": ", $item); $finalarray[$arr2[0]] = $arr2[1]; } the function turn string array: title: murk | tags: hello | nachr: lorem | quelle: ipsum | thanks it won't associative array, can object. like: var str:string = "title: murk | tags: hello | nachr: lorem | quelle: ipsum"; var arr:array = str.split(" | "); var obj:object = new object(); each (var s:string in arr) { var a:array = s.split(": "); obj[a[0]] = a[1]; } trace(obj.title); // murk php actionscript-3

Combine filesets using Ant -

Combine filesets using Ant - i have 2 different filesets defined in ant follows: <fileset id="fileset1" dir="${classes.dir}"> </fileset> <zipfileset id="fileset2" src="myarchive.zip" includes="**/*.class"> </zipfileset> i want create 3rd fileset union of both above filesets <fileset id="merged"> </fileset> can tell me how ? possible ? in advance! one way ant resource collections, in particular union . <fileset id="fileset1" dir="${classes.dir}" /> <zipfileset id="fileset2" src="myarchive.zip" includes="**/*.class" /> <union id="onion"> <resources refid="fileset1" /> <resources refid="fileset2" /> </union> then can refer 'onion' anywhere might utilize fileset, e.g. <copy todir="dest"> <resources refid=...

android - Securing media files in the mobile -

android - Securing media files in the mobile - i thinking developing birds catalog android. contain many pictures , sound files. files come 3rd party company copyrights. my application should assure (as much possible) media files not accessible, copied or manipulated. which strategies follow? crypt files in file scheme , decrypt in memory before showing or playing them? maintain them sql lite clobs? sql lite accessible other apps or hidden rest of apps? other ideas? haven't found much info "issue" on web. thanks in advance, chemi. i suggest saving these files sd card, not private file of activity, images/audio files quite big (i have seen in discussion planning handle 400 mb, same app?). crypting should fine, , more straightforward sqlite. the class below allows encrypting bytes binary files: import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.security.securerandom; imp...

mysql - Sum totals of two queries -

mysql - Sum totals of two queries - i have 2 basic queries need sum totals of: select hours, sum(hours) table name='xxx' , description='worked' select hours2, sum(hours2) table name='xxx' , description2='worked' i've tried union , me totals of each query not combine them. table setup is: id name hours description hours2 description2 i need correlate hours description , hours2 description2 why have 2 different queries. need sum totals of hours , hours2. first of all, missed group by , though mysql doesn't complain it, hours , hours2 values meaningless. secondly, result of union can set in derived subquery, have desired total : select sum(hr) ( select sum(hours) hr table name='xxx' , description='worked' union select sum(hours2) hr table name='xxx' , description2='worked' )a mysql sql aggregate-functions

javascript - Make ul-li navigation dynamically -

javascript - Make ul-li navigation dynamically - i have next html: <div id="nav"> <ul> <li class="keyitem">keyitem 1</li> <li>item</li> <li>item</li> <li>item</li> <li class="keyitem">keyitem 2</li> <li>item</li> <li>item</li> <li class="keyitem"></li> <li>item</li> <li>item</li> </ul> </div> but want create above following: <div id="nav"> <ul> <li class="keyitem">one <ul> <li class="child_one">item</li> <li class="child_one">item</li> <li class="child_one">item</li> </ul> </li> <li class="keyitem">two <ul>...

scala - scalatest and SBT issue -- Class is not an accessible org.scalatest.Suite -

scala - scalatest and SBT issue -- Class is not an accessible org.scalatest.Suite - revision 5 of code has error when running tests using sbt: https://www.assembla.com/code/opyate-scala-graph-fork-sbt/subversion/changesets/5 i've searched interwebs "class not accessible org.scalatest.suite", but results message in scalatest framework code. please help me figure out wrong , if it's dependency version issue, compatibility issue, or if tests coded incorrectly. the details (one example): suites @runwith(classof[junitrunner]) class tdegreeroottest extends suites( new tdegree[immutable.graph](immutable.graph), new tdegree[ mutable.graph]( mutable.graph)) shouldmatchers { } test class class tdegree[+cc[n,e[x] <: edgelikein[x]] <: graph[n,e] graphlike[n,e,cc[n,e]]] (val factory: graphcompanion[cc]) extends suite shouldmatchers { ... } the exception [error] not run test scalax.collection.tdegree: java.lan...

python - How do I turn every value in my dictionary to a float? (recursively) -

python - How do I turn every value in my dictionary to a float? (recursively) - d = { 'scores': 4, 'teams': { 'yellow': 11, 'blue': 4 } } how take dictionary, , turn every integer float? recursively, every value max deep. def float_dict(d): new_dict = {} k,v in d.iteritems(): if type(v) == dict: new_dict[k] = float_dict(v) else: new_dict[k] = float(v) homecoming new_dict >>> d = { 'scores': 4, 'teams': { 'yellow': 11, 'blue': 4 } } >>> print float_dict(d) {'scores': 4.0, 'teams': {'blue': 4.0, 'yellow': 11.0}} python dictionary

continuous integration - TFS gate overrides auditing -

continuous integration - TFS gate overrides auditing - i believe read there's way can't seem find it. i want see check-ins , users have overridden gated build, or other policies. can look? the tfs powerfulness tools has alert explorer allows setup emails if policy overridden. i believe allows setup phone call webpage information. continuous-integration tfs2010

javascript - Putting elements in an array? -

javascript - Putting elements in an array? - i have question. i'll post html first, know shouldn't utilize tables designing , stuff that. it's learning purposes only. <table id="placeholder"> <tr> <td><img src="img/1.jpg"/></td> <td><img src="img/2.jpg"/></td> <td><img src="img/3.jpg"/></td> </tr> <tr> <td><img src="img/4.jpg"/></td> <td><img src="img/5.jpg"/></td> <td><img src="img/6.jpg"/></td> </tr> <tr> <td><img src="img/7.jpg"/></td> <td><img src="img/8.jpg"/></td> <td><img src="img/9.jpg"/></td> </tr> <tr> <td><img src="img/10.jpg"/></td> <td><img src="img/11.jpg"/...

c# - Dealing with Dependcy Properties/Columns in GridControl? -

c# - Dealing with Dependcy Properties/Columns in GridControl? - i working devexpress gridview , have object i'm trying populate in grid. e.g lets have product. first column repositoryeditorlookupedit contains list of products. want if specific product selected coke, want columns populated product's other properties, such color, price, description etc... tricky bit gridcontrol bound object type 'transactionitem' has relationship product {many-to-many} , of cause have interreship 'transactionproduct'. i have tried using unbound columns grid loses values after rowchange. is there way overcome or design wrong. basically, want columns populate based on object selected in column. do want initialize column default values? if so, should handle gridview's cellvaluechanged event , update other cell values in row using gridview.setrowcellvalue(gridview.focusedrowhandle, gridview.columns["price"], someprice); method. also, if using unbound ...

java - Memory problem in android at run time -

java - Memory problem in android at run time - i need display many rows in listview in android application . there more 2500 rows each row contains tow images , 11 labels . getting memory error @ run time "vm not lets utilize more 120000 bytes" . how can solved problem ? can help me ? there no point in holding info in memory @ once. user can't see 2500 rows @ moment, should think dynamically loading , unloading rows. maintain info in xml file , load dynamically while user scrolls list. java android

How do I detect for a specific character in a string in VB.NET? -

How do I detect for a specific character in a string in VB.NET? - okay, in programme i'm working on in vb.net i'm trying create can take in list of strings (each on different line). each line want take in line, , break 3 parts. first part goes origin of string first colon in string, sec part goes first colon @ symbol, , lastly part goes @ symbol end of string. for example, i'd take in line of series of lines: hello:world@yay i'd want break 3 separate strings of "hello", "world", , "yay". how such thing in vb.net? you can accomplish split . illustration purposes, re-splitting string have saved off, wouldn't have split again. however, it's simpler understand way: dim s string = "hello:world@yay" 'this can string loop. dim hello string = s.split(":")(0) 'get before colon. dim world string = s.split(":")(1).split("@")(0) 'get after colon, , split result a...

objective c - Protocol method not being recognized when called via delegate -

objective c - Protocol method not being recognized when called via delegate - my problem when calling protocol method dataloading via delegate, doesn't recognize - giving expected identifier error. here protocol/interface file: #import <foundation/foundation.h> @class loaderview; @protocol dataloaderprotocol <nsobject> @required - (void) dataloading; - (void) doneloading; @end @interface dataloader : nsobject { } @property (retain) id <dataloaderprotocol> delegate; @property (retain, nonatomic) loaderview *loader; - (id) initwithdelegate: (id <dataloaderprotocol>) delegate; - (void) start; @end and here implementation file: #import "dataloader.h" #import "loaderview.h" @implementation dataloader @synthesize delegate = _delegate; @synthesize loader = _loader; - (id) initwithdelegate: (id <dataloaderprotocol>) delegate { self.delegate = delegate; homecoming self; } - (void) start { nsopera...

iphone - Can't upload application to App Store? -

iphone - Can't upload application to App Store? - i trying add together latest game iphone app store, setup binary , looked fine. apple had me download "application loader" through itunes connect did, , opened , uploaded binary. after uploading, confronted next message: "there no embedded java executable. please reinstall xcode developer tools." installed xcode on 1 time again , nil happened. should do? i'm running 10.7 lion on macbook pro if helps. thanks! downgrade 10.6. solve issue. :) iphone ios osx app-store

python - What does this error message mean? -

python - What does this error message mean? - it appears after did reconfigruation gae / django project namely using appengine_config.py select django 1.2 error message mean i'm running wrong version of python? if so, version should running? used latest available preinstalled python version @ ubuntu 11. --> --> --> traceback (most recent phone call last): file "/media/lexar/project/google/appengine/tools/dev_appserver.py", line 4113, in _handlerequest self._dispatch(dispatcher, self.rfile, outfile, env_dict) file "/media/lexar/project/google/appengine/tools/dev_appserver.py", line 4022, in _dispatch base_env_dict=env_dict) file "/media/lexar/project/google/appengine/tools/dev_appserver.py", line 596, in dispatch base_env_dict=base_env_dict) file "/media/lexar/project/google/appengine/tools/dev_appserver.py", line 3095, in dispatch self._module_dict) file "/media/lexar/project/google/appengine/...

php - Include a js and css file only in a specific view -

php - Include a js and css file only in a specific view - in codeigniter application have mutual header , footer view, include in different views. header_view simple as: <!doctype html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title><?php echo $page_title;?></title> <link rel="stylesheet" href="<?php echo base_url();?>/css/master.css" type="text/css" media="screen" /> <script src="<?php echo base_url();?>js/common.js" type="text/javascript"></script> </head> <body> <!-- end of header --> now lets suppose have view called form_view , include css file form.css , javascript file form.js . since these files used in form_view, don't want add together them in header_view, because included in of views in application. so quest...

nosql - Matching items with multiple foreign keys in RavenDB -

nosql - Matching items with multiple foreign keys in RavenDB - i asked question regarding sql server: complicated sql query--finding items matching multiple diferent foreign keys basically, need able find products match multiple criteria. have scenario need find products match each of multiple categories , found in multiple invoices. the solution rather complex set of unions, amounts counting number times product matched criteria , filtering items count matched count of criteria. ; info (id, count) ( select pc.productid, count(*) productcategories pc (nolock) inner bring together @categoryids /*table valued param*/ c on c.id = pc.categoryid union select ip.productid, count(*) invoiceproducts ip (nolock) inner bring together @invoiceids on i.id = ip.invoiceid ) select d.id info d grouping d.id having sum(d.count) = @matchcount but now, considering nosql provider. question is, how create index...

php - My App's permission blocked -

php - My App's permission blocked - when want post wall via graph api error: oauthexception (#200) feed story publishing disabled application. please help me solve problem. php api graph

html5 - Problem with Jquery toggle / animate -

html5 - Problem with Jquery toggle / animate - my website: http://www.daysofthedead.net i have made 2 sliding panels on right side of screen. 1 facebook, other twitter. click facebook tab , opens, if click twitter tab while facebook panel still open facebook close , twitter open, , vice-versa. my problem: click 1 time open facebook open twitter. after have click each tab twice unless close panel before open sec panel. can take @ code below , help me figure out why this? take @ code here: http://jsfiddle.net/draven/4bqas/ i think toggle creating problems, in case can utilize click: $('.panel-tab').click(function(event) { var = this; if ($('.active').length > 0) { $('.active').animate({ marginright: '0' }, 1000,'linear', function() { var targetclosed = $(this).find('a').data('target'); var targetopen = $(that).data('target'); ...

c++ - Access Violation while using _tcstok -

c++ - Access Violation while using _tcstok - i trying tokenize lines in file using _tcstok. able tokenize line once, when seek tokenize sec time, access violation. sense has not accessing values, locations instead. i'm not sure how else though. thanks, dave p.s. i'm using tchar , _tcstok because file utf-8. this error i'm getting: first-chance exception @ 0x63e866b4 (msvcr90d.dll) in testing.exe: 0xc0000005: access violation reading location 0x0000006c. vector<tchar> tabdelimitedsource::getnext() { // returns next document (a given cell) file(s) tchar row[256]; // homecoming null if no more documents/rows vector<tchar> document; try{ //read each line in file, corresponding , individual document buff_reader->getline(row,10000); } grab (ifstream::failure e){ ; // ignore , fall through } if (_tcslen(row)>0){ this->current_row += 1; vector<tchar> cells; //separate line on tabs (id 'ta...

php - Inserting commas between city, state, country input depending on which locations are submitted -

php - Inserting commas between city, state, country input depending on which locations are submitted - i have 3 (optionally entered) post variables: city, state, , country. i'm unsure how check see 3 not empty , insert commas between them accordingly. might come in city, come in city , state, city , country, etc. know there's easy way of doing i'm having problem doing without making many more lines of code need. example: <?php $country = $_post['country']; $state = $_post['state']; $city = $_post['city']; if (!empty($city)){ $location = $city; } if (!empty($state) && !empty($city)){ $location .= ', ' . $state; } if (!empty($ state) ** !empty$country)){ $location .= ', '. $country; } echo $location; ?> $location = array(); if(!empty($_post['country'])) $location['country'] = $_post['country']; if(!empty($_post[...

perl - How to find how many bytes of data array holding -

perl - How to find how many bytes of data array holding - how find how many bytes of info array holding? @aead=("ansfl;ahslhfalkhf aklshfakl;"); i find array how many bytes of info has. devel::size has tools measure memory usage. use devel::size qw( total_size ); $memory_usage = total_size(\@a); if trying find total of number of characters in each string in array, use list::util qw( sum ); $total = sum 0, map length, @a; or my $total = 0; $total += length @a; perl

Want Applescript to change a Keynote presentation to a particular slide -

Want Applescript to change a Keynote presentation to a particular slide - i'm newbie applescript, can applescript tell keynote display specific slide out of order during presentation? don't want advance in sequence, want specify specific slide in random order. i tried apple documentation, nil there. not of similar questions here answers question. macscripters site suggestion (below) didn't work. not working (this, after having applescript start keynote , launch slideshow presentation: tell application "keynote" show (slide 22 of "/users/me/documents/keynote_slides.key") end tell also tried, not working tell application "system events" tell process "keynote" jump 22 end tell end tell so, missing? something should work think: tell application "keynote" tell slideshow 1 show slide 22 end tell end tell applescript

JQuery UISortable gets fine on Ipad, but normal links on listing fail now -

JQuery UISortable gets fine on Ipad, but normal links on listing fail now - i had problem jquery ui sortable not working on ipad/iphone record list. have [edit] , [delete] links in front end of each record, problem of ui-sortable fixed http://furf.com/exp/touch-punch/sortable.html, include 1 js file remap touch events mouse events.now works fine, new problem can't click [edit] or [delete] links in front end of each record in listing. can 1 help please? var fixhelper = function (e, ui) { ui.children().each(function () { $(this).width($(this).width()); }); homecoming ui; }; $(document).ready(function () { $(function () { $("#dynamicsortlists tbody").sortable({ opacity: 0.6, helper: fixhelper, cursor: 'move', update: function () { var order = $(this).sortable("serialize") + '&action=updaterecordslistings'; $.post("_changesortorde...

android - Silent crash occures in the thread. NotificationManager, timer and threads "magic". Non-trivial problem, as it seems -

android - Silent crash occures in the thread. NotificationManager, timer and threads "magic". Non-trivial problem, as it seems - i've stucked next funny problem: private object lock=new object(); public void letssaymain(){ timer=new timer(); task=new requestmessages(); timer.schedule(task, first_delay, period*60*1000); //period = 10, first_delay=10*1000 } private class requestmessages extends timertask{ public void run() { synchronized(lock){ foo(); log.d(applicationconstants.application_class_name, "yay, we've exited method!"); } } private void foo(){ . . //notification initialization . . log.d(applicationconstants.application_class_name, "we've show notification."); mnotificationmanager.notify(z, notificationtransactions); //z unique int, starting 1. notificationtransaction - forged notification. lo...