Posts

Showing posts from July, 2012

how to display iphone addressbook in indexed table view -

i writing iphone application accessing contacts addressbook. i've displayed contacts using abpeoplepickernavigationcontroller. want display contacts in alphabetically separate sections, , alphabetic index on right side in this imag e. http://www.isoaxis.com/temp/peoplepicker.png how should that??? best regards i believe abpeoplepickernavigationcontroller has alphabet index default. don't have enough contacts in phonebook. have tried increase number of contacts?

What is Unit testing in Android , iPhone , Symbian and windows phone? -

what unit testing in framework android ,iphone, symbian, wp7? can please give path solution, implement unit testing? what unit testing? see http://en.wikipedia.org/wiki/unit_testing

css - BASE64 in HTML is not working -

i had tried possible way display image using base64 string. none of them working. tested on ie6,7, firefox 3. please tell me wrong below code. <head> <style type="text/css"> div.image { width:100px; height:100px; background-image:url(data:image/png;base64,ivborw0kggoaaaansuheugaaadia...); } </style> </head> <body> <img src="data:image/jpg;base64,968" /> <img alt="embedded image" src="data:image/png;base64,ivborw0kggoaaaansuheugaaadia..." /> <script type="text/javascript" src="data:text/javascript;base64,dmfyihnjt2jqmsa9ig5ldybzy3jv..."></script> <div class="image"></div> </body> i tested on ie6,7, firefox 3 it happens none of these support data uris (well, firefox 3 think, not well). you're doing nothing wrong. if need background image display in these browsers, use traditional image files , url() instead. ...

c# - Building a .net application on classic ASP -

we have big classic asp website, , want start writing new code in .net, (the website way big rewrite 100% @ stage). the old website uses session variables, these still accessible in .net pages, , if not (which suspect) there can make them accessible? the new section detachable, is pretty independent rest of site should fine write in .net, it's sessions important us. need login page? how bad practise ajax local .net page sets session info when login old site? can copy session data way? how share session state between classic asp , asp.net (msdn) so topics: classic asp asp.net one-off session data copy classic asp , asp.net integration

Specific RSS & Sharepoint scenario -

i have special scenario in sharepoint im trying working im stuck. what i'm trying do, listen rss feed, , when new pops send email user listed in sharepoint list column. any ideas how working? create custom spjobdefinition set run frequency every 5 mins in execute method download rss check new items send email store last (rss poll time/last rss item) in list

c - What is the difference between static int a and int a? -

possible duplicate: difference between 'global' , 'static global' what difference between statements 1 , 2 :- #include <stdio.h> //in global declaration area static int a; // 1. int b; // 2. thanks help. a static global variable local translation unit defined in. so, if define static int a; in 2 different translation units, create 2 independent variables. if define non-static global variable int b; in 2 translation units, experience linker error (but can use extern int b; in 1 of 2 translation units tell linker should use global variable other translation unit).

java - How to handle custom autowired objects in Spring 2.5? -

i have old project need integrate spring 2.5.x (3.0 not possible). i have created bean, have initializate field usersession itself: public class somebean { usersession usersession; @postcontrust public void init() { httpsession session = webcontext.current().getsession(); usersession = (usersession) session.getattribute("usersession"); } } is possible write kind of autowiring handler resolve usersession , pass autowiring spring, bean looks like: public class somebean { @autowire usersession usersession; } and handler like: public class autowirehanlder { public boolean iscandidate(class<?> type) { return type.equals(usersession.class); } public object resolve(class<?> type) { httpsession session = webcontext.current().getsession(); return (usersession) session.getattribute("usersession"); } } i using session-scoped factorybean : public class usersessio...

c# - Print in Arial Font or any other font by sending raw data to the printer -

private void printfunction(string cmd) { string command = cmd; // create buffer command byte[] buffer = new byte[command.length]; buffer = system.text.encoding.ascii.getbytes(command); // use createfile external functo connect lpt1 port safefilehandle printer = createfile("lpt1:", fileaccess.readwrite, 0, intptr.zero, filemode.open, 0, intptr.zero); // aqui verifico se impressora é válida if (printer.isinvalid == true) { messagebox.show("printer not found!", "error", messageboxbuttons.ok, messageboxicon.error); return; } // open filestream lpt1 port , send command filestream lpt1 = new filestream(printer, fileaccess.readwrite); lpt1.write(buffer, 0, buffer.length); // close filestream connection lpt1.close(); } i've been using code function above send raw data esc/pos supported epson tm88iii printer. i've 3 sent of fonts default in printer. wan't print in arial font. how can ...

sql - How to select overlapping value pairs from DB -

in postgres db have table 3 columns this: start | end | sorce 17 | 23 | 150 | 188 | 200 | 260 | 19 | 30 | b 105 | 149 | b 199 | 220 | b ... i select row regions (start end) differed sources , b overlapping. update: from postgres version 8.4 posible solve problem window functions . more faster join or subselect methodes. link postgres wiki . this works brute-force approach (i renamed columns range_start , range_end avoid conflict reserved word "end"): select * t cross join t t2 t2.source <> t.source , box(point(t2.range_start,t2.range_start),point(t2.range_end,t2.range_end)) && box(point(t.range_start,t.range_start),point(t.range_end,t.range_end)) or select * t exists (select 1 t t2 t2.source <> t.source , box(point(t2.range_start,t2.range_start),point(t2.range_end,t2.range_end)) && box(point(t.range_start,t.range_start),point(t.range_end,t.range_end)...

C++ newbie question--basic error handling using try, throw, catch -

i'm trying understand error handling in c++. i have read using try, throw, catch better style , less complicated using if statements return values. i'm not sure understand how try, throw, catch works. made simple example below , great feedback problems or bad style. goal make function out of example checks results of calculation. here questions have try, throw, catch: (1) should catch statement included in function? or should somewhere else, in main() or in function initial calculation done? (2) overkill use try, catch, throw simple (i improve style)? (3) if there error, terminate program. how that? or "catch" mean that done automatically? (4) don't understand use of cerr. why not use cout? have used cerr correctly here? should have used in if/else statements? thanks lot help. here's example made: double calculated = 10.2; // previous calculation double tolerance = 0.3; // can set in function double valuewanted = 10.0; // previous calculati...

aptana - Choosing rails version in RadRails 2.0.5 -

i've created rails application using rails 3.0.3 after adding radrails still recognize project rails 2 application , searching "scripts/server" how , can change settings of default rails version? radrails 2.x isn't date , doesn't handle rails 3. please try studio 3: http://aptana.com/products/studio3/download it contains embedded ruby/rails support.

winforms - Two UI Thread in C# windows Application -

how can implement 2 ui threads in c# windows application? you need call thread.setapartmentstate() switch thread sta before starting it. , pump message loop keep windows created on thread alive, application.run(). application.exitthread() terminate message loop , cause thread exit. using run(form) makes automatic, on main thread. beware user may have hard time dealing windows create on thread. have no z-order relationship windows in main thread, desktop parent. tends make them lost behind window, including own. awkward workarounds topmost , pinvoking setparent().

dom - How to do insert After() in JavaScript without using a library? -

there's insertbefore() in javascript, how insert after element without using jquery or other library? referencenode.parentnode.insertbefore(newnode, referencenode.nextsibling); where referencenode node want put newnode after. if referencenode last child within parent element, that's fine, because referencenode.nextsibling null , insertbefore handles case adding end of list. so: function insertafter(newnode, referencenode) { referencenode.parentnode.insertbefore(newnode, referencenode.nextsibling); } try here.

jquery - background Images -

Image
i developing app using jquerymobile framework. have set background image in screen. image size differ mobile mobile. have image based on iphone screen size. how set width , height of images ,controls based on browsers resoultion ? how detect screen resolution of browser @ run time? i tried did not work. dont want use repeat attribute please me.. please refer attachment. thanks in advance -webkit-background-size: 100% auto; should trick

c++ - Returning array -

how return pointer array , values that? int * getchange(int first[], int second[], int size) { int = 0; int * change = new int[2]; (i = 0; < size; i++) { if (first[i] != second[i]) { change[0] = first[i]; change[1] = second[i]; } break; } return change; } function main() { int mynumbers[] = {1, 0, 2, 3}; int possibilities[] = {0, 1, 2, 3}; int * change; change = getchange(possibilities, mynumbers, 4); printf("%i / %i\n", (change), (change+1)); } unfortunately function seems return addresses, not values... try change printf("%i / %i\n", (change), (change+1)); to printf("%i / %i\n", *(change), *(change+1)); in printf function need use int parameters, not int* . change variable pointer. must use *change and, using pointers arithmetics, *(change + 1) obviously, don't forget free allocated memory.

windows - strftime codes vs GetLocaleInfo codes -

i need format date based on locale in windows. purpose use getlocaleinfo locale_sshortdate parameter. get localeinfo returns m/d/yyyy. cannot pass strftime because strftime codes different. %m/%d/%y. is there quicker way achieve this? assume not using mfc. you can use getdateformatex function getlocaleinfoex if needed. in way can format data better mfc.

c# - Could not load type 'newVersion_Default' -

upon trying build page default.aspx error: error 5 not load type 'newversion_default'. \server1\d$\newversion\default.aspx the content page is: <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="newversion_default" masterpagefile="main.master" %> <%@ mastertype virtualpath="main.master" %> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <h1>welcome page</h1> <div class="tabwrapper"> <div class="tab"><a href="#">home</a></div> <div class="tab"><a href="#">tab 2</a></div> <div class="tab tabselected"><a href="#">something els wef wef w efe</a></div> <div class="tab"><a href=...

java - Communicate with web pages -

i want create application uses shipping calculator on external web page ( http://www.bring.no/page?id=4994 ) calculate shipping. the scenario user fill out fields, have submit, use page's shipping calculator, value (the shipping fee). so want make swing application looks similar existing shipping calculator, pass arguments it, , retrieve result. i have no idea how this. tips or hints highly appreciated! :) look @ apache httpclient communicating websites , webservices java swing application. you have http post field names on web page.

Problem with implicit declaration of function in objective c -

i trying learn bit more objective-c, , @ moment i'm stuck. got 4 errors, same. "implicit declaration of function", googled didn't find solution. radiostation .h #import <cocoa/cocoa.h> @interface radiostation : nsobject { nsstring* name; double frequency; char band; } +(double)minamfrequency; +(double)maxamfrequency; +(double)minfmfrequency; +(double)maxfmfrequency; -(id)initwithname:(nsstring*)newname atfrequency:(double)newfrequency withband:(char)newband; -(nsstring*)name; -(double)frequency; -(char)band; -(void)setname:(nsstring*)newname; -(void)setfrequency:(double)newfrequency; -(void)setband:(char)newband; @end radiostation .m #import "radiostation.h" @implementation radiostation +(double)minamfrequency{ return 520.0; }; +(double)maxamfrequency{ return 1610.0; }; +(double)minfmfrequency{ return 88.3; }; +(double)maxfmfrequency{ return 107.9; }; -(id)initwithname:(nsstring*)newname atfrequency:(double)newfrequency withb...

asp classic - ASP vbscript fail to detect JSON object -

strjson= getcontent(url) data return below {"error":{"type":"oauthexception","message":"error validating access token."}} then can retrieve set return= json.parse(strjson) from here can retrive values inside via below response.write return.error.type response.write return.error.message but if response.write return.error.otherobjectnotexist it return error saying object doesn't support property or method: 'otherobjectnotexist' this fine when know objects in return. in real life scenario, won't know returned, not. when json return 3rd party website. example, use facebook connect retrieve open graph value of user , return json. some user filled in "gender", facebook return object. user never fill in "gender", facebook never return object. my program default response.write return.gender if don't have way detect whether object exist or not, , asp directly throw error m...

c++ - StlSoft - how to use their file system functionality? -

i'm trying add portability file system in application wrote. end, i'm using stlsoft , can't figure out how use anything. there tutorial somewhere, or relevant example? have samples on site, far can see none relating filesystem module. well, boost.filesystem good, heavy (boost.filesystem + boost.system). here simple "ls" utility example: #include <algorithm> #include <iostream> #include <platformstl/platformstl.hpp> #include <platformstl/filesystem/readdir_sequence.hpp> using platformstl::readdir_sequence; int main(int argc, char *argv[]) { readdir_sequence entries(argc > 1 ? argv[1] : ".", readdir_sequence::files|readdir_sequence::directories); std::copy(entries.begin(), entries.end(), std::ostream_iterator<char const*>(std::cout, "\n")); return 0; } also can check recls (recursive ls) project on sourceforge more details.

python - selecting the earliest entry in a list -

if have list people's names , dates, , want keep entry earliest date per person how do that? want final list alphabetical last name, first name , contain entry earliest date @ end. here example of list , tried, gave me same list again. l1=['smith, john, 1994', 'smith, john, 1996', 'smith, john, 1998', 'smith, joan, 1993', 'smith, joan, 1995', 'smith, jack, 1989', 'smith, jack, 1991', 'jones, adam, 2000', 'jones, adam, 1998', 'jones, sarah, 2002', 'jones, sarah, 2005', 'brady, tom, 2001', 'brady, tonya, 2002'] l1.sort() l2= [] item in l1: if item.split(',')[:2] not in l2: l2.append(item) the final product should like: l2=['brady, tom, 2001', 'brady, tonya, 2002', 'jones, adam, 1998', 'jones, sarah, 2002', 'smith, jack, 1989', 'smith, joan, 1993', 'smith, john, 1994'] any or insight apprec...

javascript - Replacing text of nested span -

i have innerhtml of 1 span (outer) collected in 1 varaiable. now there 1 nested span inside span inner, can set innerhtml of span text follows? var outertext = document.getelementbyid("outer"); now outertext has inner span, , want replace text of inner span. how can it? get span ;) outertext.getelementsbytagname('span')[0].innerhtml = 'o_o' replace 0 whatever suits needs.

javascript - To display div dynamically -

i had 10 div name sample <div name="sample">div1</div> <div name="sample">div2</div> <div name="sample">div3</div> <div name="sample">div4</div> <div name="sample">div5</div> <div name="sample">div6</div> <div name="sample">div7</div> <div name="sample">div8</div> <div name="sample">div9</div> <div name="sample">div10</div> <input type="button" id="display" value="display"> once display button in clicked need display 2 div first click : display div1 , div2 [other div none] second click : display div3 , div4 [other div none] etc... how jquery $('#display').bind('click', function() { var $divs = $('div'), offset = 0; return function() { $divs.hide().slice(offset, ...

byte - Java stripping zeros from function -

i'm trying flip bytes around in java , function have working correctly bytes , failing others. the function using this: public static int foldinbyte(int m, int pos, byte b) { int tempint = (b << (pos * 8)); tempint = tempint & (0x000000ff << (pos * 8)); m = m | tempint; return m; } and code implements is: byte[] bitmaskarray = new byte[]{ bytebuffer.get(inputindex), bytebuffer.get(inputindex + 1), bytebuffer.get(inputindex + 2), bytebuffer.get(inputindex + 3)}; int tempint = 0; tempint = foldinbyte(0, 3, bitmaskarray[3]); tempint = foldinbyte(tempint, 2, bitmaskarray[2]); tempint = foldinbyte(tempint, 1, bitmaskarray[1]); tempint = foldinbyte(tempint, 0, bitmaskarray[0]); bitmask = tem...

jQuery events .live() wierdness -

i have page toolbar menu @ bottom. have function checks display property of block contains menu items , sets "none" if it's "block" or sets "block" if it's "none". i'm using jquery bind event object. want use live() method because may dynamically add items toolbar , want event automatically attached new menu elements. the problem i'm experiencing when bind event element live(), css display property of element i'm checking "none". so, menu never closes. if use bind() instead of live(), works expect to. what's causing strange behavior live()? the demo page reproducing problem http://www.ghodmode.com/tbdemo thank you. -- ghodmode because callbacks bound using .live() executed through event delegation, handlers between target of .live() , document called. looking @ code can see self.hide_menu bound body element. when event bubbles target has class .j_has_menu, click handler on body (self...

Robotic Applications In Erlang -

i want use erlang implementing robotic application. current real world applications implemented in erlang web based . robot implemented prof. corrado didn't utilize concurrency of erlang heart of erlang , concentrated on artificial intelligence more(according understanding of project). some ideas come mind soccor robots, multiple robots cleaning room in such systems robots can programmed in c (or other programming language) can controlled using matlab. matlab helps in image processing(vision system) , solving complex array calculations, point of using erlang?.(please correct me if wrong) can suggest me robotic application can utilize erlang's feature concurrency , 1 can argue erlang best suited such application on other languages. little bit detailed answer me lot. but erlang might not the best approach any robot application @ all. can go less ambitious thesis of demonstrating erlang supports computing model important in many robotics applications . po...

ios - Weird iPhone error when running on device -

i've run app on iphone before, , have no idea how randomly started not working, i'm getting following error: unable read symbols /developer/platforms/iphoneos.platform/devicesupport/4.2.1 (8c148)/symbols/developer/usr/lib/libxcodedebuggersupport.dylib (file not found). so, cleaned targets , deleted app on device , reinstalled , ran it, , i'm getting error: warning: unable read symbols /developer/platforms/iphoneos.platform/devicesupport/4.2.1 (8c148)/symbols/usr/lib/info/dns.so (file not found). what , how fix it? well, have same problem disables debugging (doesn't find debugger symbols of version installed on device). except debugging, installs app normally. know few people got rid of these warnings doing of following 2 : 1) copy 4.2.1 symbols folder /developer/platforms/iphoneos.platform/devicesupport/ path symbols fodler in 4.2.1 (8c148) folder 2) @ one

.net - Team Foundation Server: Cloning a Collection's Project into a new Collection -

we looking create new team foundation server collection next version of our application development. source our current version largely not apply, except few dlls should more or less remain unchanged. wanted make new collection wondering if able clone dll projects our existing collection retain history. is possible? realize bring "dual maintenance" issues if there bugfixes needed dlls, not concerned scenario. so far, have come few resources. msdn posts pointing people towards splitting team project collection . issue there, however, can have 1 project in each collection. states: a project cannot exist in more 1 collection. until delete duplicated projects between split collections, not able start renamed collection. that not want. maintain both projects history in each collection. otherwise, saw tfsconfig command. contains /clone option, not quite sure of usage (additional examples hard come by) , mentions used splitting well. are looking isnt po...

php - Customer wants a Relate button like a Facebook Like button -

a customer wants button says "relate" kind of like button in facebook. show how many people clicked button inside article. there easier way besides creating table in mysql , use php? i suppose use cgi script written in bash read/writes plain text file stores click count. 1 way or you're going have have kind of server-side handling , data storage. doesn't have php/mysql, you'll have use something.

android - drawBitmap() and setPixels(): what's the stride? -

could please explain me (ascii welcome) stride argument stands in canvas.drawbitmap() , in bitmap.setpixels()/getpixels() ? understand it's way skip elements in colors array, how? in cases stride same width. stride useful if trying copy/draw sub-region of bitmap. instance, if have 100x100 bitmap , want draw 50x50 top-right corner, can use width of 50px , stride of 100px.

cross-platform, open libraries for C#/Silverlight/.NET audio/video real time streaming -

i'm looking library conference a/v streaming server, multicasts other clients. i've looked @ sip , openh323, , both seem specialized voip telephony. i want app cross platform silverlight application (mac , windows), don't think can use directsound, right? thanks in advance. you may mixing apples , oranges in question. directsound provides api accessing sound cards; h.323 , sip standards making call out. silverlight 4 natively provides couple of simplified apis equivalent directsound, can access microphone, sound card , webcams. see http://msdn.microsoft.com/en-us/library/ff602282(vs.95).aspx details. but once you've got sound, still need encode it, transmit it, mix it, distribute it, , receive it. that's gets complicated. flash has support natively; silverlight doesn't. best open source implementation right doing put socketcoder , available on codeplex , uses proprietary signaling/streaming protocol, proprietary , inefficient video cod...

jquery binding same event to 2 selectors -

i have 2 classes: class1 , class2. for now, have 2 function calls calling same myfunction function: $('.class1').click(function () { myfunction() }); $('.class2').click(function () { myfunction() }); how rewrite "when there's click on class1 , on class2 call myfunction". thanks. $('.class1, .class2').click(function () { myfunction() })

forms - Can't validate phone number -

i'm trying validate phone number without success. when submit form following model, accepts phone number put in, whether it's valid or not. why happening? class client < activerecord::base belongs_to :salon belongs_to :address accepts_nested_attributes_for :address attr_accessible :address_attributes, :name, :phone, :email validates_presence_of :name validates_presence_of :email validates_presence_of :phone, :unless => proc.new { |c| c.phone.gsub(/[^0-9]/, "").length != 10 } end - <%= form_for(@client) |f| %> <% if @client.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@client.errors.count, "error") %> prohibited client being saved:</h2> <ul> <% @client.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <%= f.hidden_fie...

events - Flex: set another state in the currentStateChange handler? -

i have currentstatechange handler. in handler. want set state based on variable. currentstatechange handler fires in handler function won't change next state. know when gets handler point state has changed. i'm hoping i'm missing , not flex limitation... * state > state2 > can't change state 3 inside state change handler * private function onstatechange(e:event):void { //this fires if(applicationviewmodel.eremndr_mode == applicationviewmodel.ermndr_mode_login) { //it gets here won't change signup state! prescreenviewmodel.prescreen_state ='signup'; } } i believe issue effect attached transition still playing ignored request change state

osx - How to keep track of a class's objects in Objective C -

i'm new c , objective-c, , implement class method return nsdictionary of objects meeting criteria, such starred articles in example: article.h: @interface article : nsobject { nsstring *title; bool starred; } ... + (nsmutabledictionary*) starredarticles; @end how approach this? static global nsmutablearray inside article.m file, insert/delete in constructor , destructor? this isn't way go--there must object containing articles in application. that's object should return starred articles--this class method might seem idea now, it's inflexible. so, have object storing articles in nsmutablearray . use predicate (see the predicate programming guide ) find starred articles , return desired dictionary.

design - Service as Mediator in SOA -

i know "usual" mediator design pattern (some description in wikipedia: http://en.wikipedia.org/wiki/mediator_pattern ). in soa have notification service: should broadcast messages 1 service other subscribed particular service. actually, service can source of such messaging. my vision of such service implementation causes circular dependency between services. here ( circular dependency in soa ) i've asked how resolve , received advice use 'mediator' pattern purpose. if correctly understand, notification service should have contract: interface imediator { void publishmessage(imessage message); } service should implement (host) interface , expose service outside. any subscriber should: implement (host) same interface on own side; be registered on notification service side. actually subscribers can use interface meaning, example: interface ireceiver { void processmessage(imessage message); } in case see following communications flow: ...

silverlight 4.0 - Is it possible to Enter editmode to a list box in Grid without double click on the cell? -

i following example in following link try out listbox in grid http://forums.silverlight.net/forums/t/53435.aspx works except that, need double click on cell enter edit mode switch listbox. there other way can enable list box on getting focus? thanks, the simple way enter cell in edit mode without using mouse. first, need row in have cell. cell, change edit mode true. if don't have row, can find using itemcontainergenerator on grid business object used in row (from itemsource collection). here example of code : gridviewrow myrow = mygrid.itemcontainergenerator.containerfromitem( yourbusinessobject ); gridviewcell mycell = myrow.cells( yourcellindex ); mycell.isineditmode = true; hope !

php - checking javascript is enabled -

i building html page. make quick 1 line test which, if user has javascript enabled says "javascript on" otherwise says "javascript off" let them know. how can this? <div id="js_onoff">javascript off :(</div> <script> document.getelementbyid("js_onoff").innerhtml = "javascript on, yeah! :)"; </script>

c# - IXmlSerializable Raise Event UnknownElement in XmlSerializer -

is possible raise events xmlserializer on class implements ixmlserializable ? i implementing on ixmlserializable classes, however, raise event such unknown element or unknown attribute . i have considered throwing exception rather raise event rather halt deserialization. the xml serializer not support events.

python - twisted.pair.ethernet vs iptables -

i need implement low-level ip filtering/tracking. typically use iptables this, since using twisted in few projects i'd consider using it's ethernet library, if it's possible. actually, prefer (it's easier deploy iptables rules). is possible use twisted python's twisted.pair.ethernet implement partial analog of iptables? twisted.pair.ethernet give little bit of parsing, doesn't getting data in first place, nor putting on network (if don't filter out). need talk tuntap system, twisted doesn't with.

i need to replace only the last occurrence of anything in parenthesis using preg_replace in PHP -

i need replace occurrence of in parenthesis @ end of string nothing. dont want same happen inside string. example if have string "special (not) value (sv)" preg_replace should replace end parenthesis result should "special (not) value" have tryed using explode function? can define pattern, , can concatenate arrays afterwards... http://php.net/manual/en/function.explode.php

unit testing - Android Test Monkey - Set Verbosity? -

how can change verbosity level when running test monkey command line? these 2 commands work: adb shell monkey -p com.my.package 5000 adb shell monkey -p com.my.package -v 5000 the developer docs say, "each -v on command line increment verbosity level. level 0 (the default) provides little information beyond startup notification, test completion, , final results. level 1 provides more details test runs, such individual events being sent activities. level 2 provides more detailed setup information such activities selected or not selected testing." however, when try adb shell monkey -p com.my.package -v -v 5000 segmentation fault monkey -p com.my... . i tried adb shell monkey -p com.my.package -v 2 5000 , monkey reads 2 count, rather value -v . help? :) it should be: adb shell monkey -p com.my.package -vvv 5000

When adding Facebook integration to a web app, how do you handle OAuth token expiration and what user data should be saved? -

i'm planning out adding facebook integration web app i'm working on. part, it's proceeding smoothly, confused on proper way handle oauth token. the sequence of events presented facebook here is: ask user authorize application, sends them facebook window. this return authorization code generated facebook you hit https://graph.facebook.com/oauth/access_token authorization code, give time-limited oauth token. using oauth token, can make requests access user's facebook profile. facebook's documentation has following token expiration: in addition access token (the access_token parameter), response contains number of seconds until token expires (the expires parameter). once token expires, need re-run steps above generate new code , access_token, although if user has authorized app, not prompted again. if app needs access token infinite expiry time (perhaps take actions on user's behalf after not using app), can request offline_access permission...

.net - Can guids be trusted for security, or are they predictable if the system can be forced to generate many known guids? -

to start, , define guid, using .net framework guid hypothetical situation users when preforming specific action have guids generated. each user can see own guids. if user know 1 of user's guid there security compromise. how safe system if asume user has no way steal user's guid , can guess it? i understand blindly guessing guids impossible. if had million success values, still have 10^20 chance of successful guess where afraid problem may exist guid prediction. can user generate large number of requests, @ guids got, , knowing .net guid generation formula improve odds of guessing? can these odds reduced point security concern? in case how should keys generated in unique non guessable way? i ask mentions odds of guesses/collisions add hard meaning it. either exact number define odds, or like, "it can used store account data, not sensitive data" edit this question seems go territory sought explore question is guid key (temporary) encryption? ...

sql - How do I transform table- see example? -

if suggests better question title, change it, that's best come with. i using sql server 2005 is there way transform table 'table_1' 'table_2' using sql. edit: don't want create new table, want represent in query 'table_2' table_1: b 1 true 2 false 4 true 7 false 9 true 10 false table_2: x y z 1 2 true 2 4 false 4 7 true 7 9 false 9 10 true the reason want if have table_3: table_3: id m 3 b 4 c 8 i query against table_2 (transformed table_1) this: select table_3.id table_3 table_2 m between x , y , z = true i'll answer following questions head of time: 1. can not change table design, nor did design table. 3. have reason not process on client side c# or language. thanks try self-join: select t1.a, min(t2.a), t1.b table_1 t1 inner join table_1 t2 on t2.a > t1.a group t1.a, t1.b

mysql - Adding an Column Populated by an Arbitrary Value in SQL -

basically, have query returns 2 columns: select action_log_id, communications_id consumer_action_log comm_type_id=4 to every row in result set query, want add value 234 titled customer_id. here best attempt: select action_log_id, communications_id consumer_action_log comm_type_id=4 union select consumer_id,consumer_first_name consumer_profile consumer_id=234; note: result of second half of query 234. using mysql. try this: select 234 consumer_id, action_log_id, communications_id consumer_action_log comm_type_id=4

Is there any way to incrementally build commit messages in git? -

i'm wondering if possible build git commit messages incrementally, documenting i'm doing make code changes: check out , begin work enter commit message title (i.e. summary) make code change update commit message describe change repeat 3 , 4 until commit ready is there mechanism built git this? git commit can take commit message file using -f option. so, can this: # work $ echo 'did work' > commit-msg.txt # more work $ echo 'did more work' >> commit-msg.txt $ git commit -f commit-msg.txt

sqlite - Android: Knowing when all items in a database have their field set to the same value? -

i have app lets user select every item in list , set "favorite". thought neat if, when items set favorite, button switched "unselect all". the way i'm thinking doing registering contentobserver, whenever change made checked if items set favorite. realized may not efficient. can't think of other way, though, hints? how can know items in database have 1 of fields set same value (field favorite = 1, in case)? here solution should (i believe) "abort fast" if difference found. it avoids sorting/distinct phase select distinct or group by. approach may slower in situations and/or negligibly faster in others. sqlite darn fast! remember indexes play role in rdmbs performance . the inner select replaced literal value reduce complexity. in case, amusement. select exists (select * t val != (select val t limit 1))

logging - how to change the rails logger to use standard out from rake tasks (rails2) -

when rails.logger.debug "hello world" within rake tasks want log standard out. how set rails logger logger.new(stdout) within rake task? i want app log file when coming through controllers etc, want rake tasks go std out because of way monitoring setup. i thinking define environment , use config, overkill, want same environment vars in each env, want change location of log destination. for have log helper uses puts, want take advantage of formatting of rails logs , buffering. i did rails.logger = logger.new(stdout) , worked (rails3)

perl - Dereferencing a scalar reference in a hashref -

i have hashref arrayrefs , scalarrefs values. can access values of arrayrefs, not scalar refs. foreach (keys %$data) { if (ref $data->{$_} eq 'array') { push @values, $data->{$_}[0]; } elsif (ref $data->{$_} eq 'scalar') { push @values, $data->??? } } how do that? to dereference scalar reference, preface value scalar sigil, $ : if (ref $data->{$_} eq 'scalar') { push @values, ${$data->{$_}}; } your arrayref case isn't quite right, dereferencing first arrayref element , rather getting elements of array. however, since storing scalar, can't store arrayref's values, unless transformed them scalar in fashion -- say, getting number of elements in arrayref (which when evaluate array in scalar context), or concatenating array elements string. see perldoc perlref : using references anywhere you'd put identifier (or chain of identifiers) part of variable or subroutine name, can...

internet explorer - How do I force IE 7 to render my web page by standards mode? -

interface of website breaked in ie 7, reason can ie 7 render website in quirks mode how force ie 7 render web page standards mode? i appended tag didn't make change. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> is doctype first thing in page? (no whitespace, etc) can provide link live website?

multi query - "Commands out of sync; you can't run this command now" - Caused by mysqli::multi_query -

i running multiple deletes through mysqli::multi_query , messing next query in line.the following error being thrown. error - sqlstate hy000. sql error: commands out of sync; can't run command do need somehow clear multiquery doesn't mess next query? cause of error? and how running multiquery function deletesometables($args){ $sql = 'delete 1;delete another;'; if($database->multi_query($sql)){ return true; }else{ return false; } } i using recent version of xampp on windows 7 by using mysqli::multi_query firing off queries, need handle results of queries before move on. documentation page describes various ways of handling results. once handled, able perform other queries fine. the error message encountering explained little better on page mysqli::query (although bear in mind mysqli::query not return result object in instance, doing delete). you of course change multi_query multiple single queries, don't kno...

asp.net - How to Add Text Box to RDLC 2010 Report -

i casual user of rdlc report control in vs 2005 web application, seemed straightforward. set report data source, drag field report body text box. in vs 2010, dragging field onto report not seem work. can drag field cell in table i've added report, when drag field onto report body, rather show field name in text box, see <> there. in expression box, field looks =first(fields!state.value, "testdataset"), there squiggly red line under field!stata, , no problem is. fields in table right next seem ok. in text box can pick field drop down, still error. there 1 data set, containing 1 table connected report, don't see how there can ambiguity or how field out of scope.. it must simple. thanks mike thomas assuming passing correct dataset name (found in report's report data tab if aren't sure), sure passing ienumerable (such list) data component of reportdatasource. if passing single object instead of list, sure wrap in anonymous array, t...

matlab - Operation returns a scalar value when a vector of values is expected -

i'm evaluating simple function: y = (2*x)/sqrt( 1 + x.^2 ); where x vector 100 values in it. however, matlab makes y equal single scalar value in instance. if do: y = 2*x; i vector of values in y expected. if do: y = x.^2; i also vector of values in y expected. why above equation y = (2*x)/sqrt( 1 + x.^2 ); giving single value , not vector of values? the operation b/a (given b = 2*x , a = sqrt(1+x.^2) ) attempt perform matrix right division , row vector x solution in least squares sense system of equations ya = b , results in scalar value y . for element-wise array division , perform operation b./a instead (note . ).

Are idempotent functions the same as pure functions? -

i read wikipedia's explanation of idempotence. know means function's output determined it's input. remember heard similar concept: pure function. google them can't find difference... are equivalent? an idempotent function can cause idempotent side-effects. a pure function cannot. for example, function sets text of textbox idempotent (because multiple calls display same text), not pure. similarly, deleting record guid (not count) idempotent, because row stays deleted after subsequent calls. (additional calls nothing)

python - My settings.py file in Django is getting too long. How do I split it into two? -

how do that? split 2 files? although solution not complex ones above, fit simple needs: have imports in settings.py file: try: settings_local import * except importerror: pass try: settings_production import * except importerror: pass and have settings_local.py file in local development folder (which don't upload server) , overwrite local settings. have settings_production.py server keep settings needed production environment. you can use technique import other settings files well.

dependency injection - When using the IObjectFactory in TestNG, do all my test classes need to be created up front? -

i'm running selenium 2 tests through testng , i'm trying use guice modules automatically inject configured browser (driver) tests. i'm using iobjectfactory method described in testng book, , implemented testnguice , i've run issue. it seems test classes being created, , browser instance initialized, tests suite starts. wouldn't such problem if classes had lightweight objects, in case means i've got half dozen browsers being fired , sitting around until test run. is possible tell testng create test class right before test run? for reference here's testng.xml used start tests. i'm running inside eclipse. <suite name="suite1" verbose="1" object-factory="com.corp.testing.objectfactory.localfirefox"> localfirefox equally unremarkable package com.corp.testing.objectfactory; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; public class localfir...

objective c - best JSON parser up to now in iPhone -

i know there's bunch of question already, know best json parser out there easy use objective-c? know apple pretty strict accepting codes third-party code (like json parser), want know accept? i use this: http://code.google.com/p/json-framework/ i think apple has accepted many apps uses framework. btw, think third party codes ok long license says so. if it's bsd or mit license you're go. framework linked uses bsd.

vb.net - Creating arrays and resizing them -

lets want create array 20 elements set default value (let's say, 0) but later, during runtime, might want resize array. might make larger, support 30 elements. 10 new elements have default value of 0. or might want make array smaller, 5. delete complete existence of last 15 elements of array. thanks. redim preserve it, , if array declared @ module level, code referencing not lose reference. believe specific vb, however, , there performance penalty, in this, too, creating copy of array. i haven't checked, suspect method user274204 describes above clr-compliant way . . public class form1 private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load 'initialize array: dim integers(20) integer 'output console, , see 20 elements of value 0 me.outputarrayvalues(integers) 'iterate through each element , assign integer value: = 0 ubound(integers) integers(i) = next 'o...

file - I'm using ftools in a ruby 1.8 application, how can I make this compatible with ruby 1.9 -

what best way make code using ftools compatible 1.9? use fileutils . apis aren't totally compatible, they're close, , fileutils available pre 1.9. i'd update code using ftools use fileutils, iron out discrepancies. it'll worth it, fileutils here stay.

javascript - Flash message fade effect -

i'm trying use flash message fade in , out effect using jquery . can please suggest best way of doing this? sure: $(function() { $('#flash').delay(500).fadein('normal', function() { $(this).delay(2500).fadeout(); }); }); jsfiddle example

In Rails 3: Can a template image be associated with the view that's being displayed? -

sorry, i'm new @ rails i'll try specific can be. in template have large "header" style image. swap image out image associated view being displayed. maybe can done using helper? don't know begin this. i know make bunch of template pages , load each of them desired view, think thats lot of repeated lines of code load when want swap 1 image. have idea? there few options depending on needs. first thing comes head create couple of helper methods. 1 call custom views , 1 call global layout. for example, create file app/helpers/layout_helper.rb module layouthelper def header_image_tag @header_image ||= 'whatever-my-default-image-is.png' image_tag @header_image end def header_image(image_path) @header_image = image_path end end in layout file... e.g app/views/application.html.erb . like: <div id='banner'> <%= header_image_tag %> </div> in individual view files don't want default image:...

linux - How to see top processes by actual memory usage? -

i have server 12g of memory. fragment of top shown below: pid user pr ni virt res shr s %cpu %mem time+ command 12979 frank 20 0 206m 21m 12m s 11 0.2 26667:24 krfb 13 root 15 -5 0 0 0 s 1 0.0 36:25.04 ksoftirqd/3 ...

sql server - I need to join two tables to get all the records from the student_info table -

i need join 2 tables records student_info table , records student_activities table student_id's equal. as there can multiple records in student activities table single student_id i'm getting duplicates when print output using left join. select * student_info left join student_activities on student_info.student_id=student_activities.student _id it suggested use following errors saying specific fields not part of aggregate function. select student_info.student_id, student_info.student_name, student_info.phone, student_info.age, count (student_activities.student_id) coa student_info left outer join student_activities on student_info.student_id=student_activities.student_id group student_info.student_id select student_info.student_id, student_info.student_name, student_info.phone, student_info.age, isnull(t.coa, 0) coa student_info left join (select student_id, count(*) coa student_activities group student_id) t on student_info.student_id =...

java - GUI with fluid resizing behaviour -

is possible using swing, build gui elements, when gui resized, keep te proportion between themself? or should fire "resize every gui component" function when resize event occurs? i'm using netbeans 6.9 long ago, there interesting article series on javaworld " transmogrifying widgets " allen hollub . serie explain how, using different widgets sho same information, calcoulator can have different styles when viewed different dimensions. however, far simpler (but far less powerful) approach, should take in-depth gridbaglayout , (now famous) gbc class. give fast, , quite elegant, method resize whole ui interesting resizing behaviours (oh , don't forget associated tutorial ).

Fluent Nhibernate AutoMapping Inheritance and Ignoring an Abstract Property -

i have inheritance structure have succesfully mapped product (base) pdfproduct (inherits product) & otherproduct(inherits product) these working fine , have done simmilar thing before hmb.xml files. in previous project had problem when trying find out type product couldnt proxy (product pdfprodcut). to solve this, added abstract property base product , overrided in other classes returning enumerator. when did xml mappings didnt map type column , well. now trying auto map inherited relationship, automatically maps abstract property child classes, not needed isnt in database. any ideas how tell ignore these? child relationships dont mapping generated im not sure put ignore statement. any greatfully received. fluent nhibernate has ignore proprty method can use in setup: .fortypesthatderivefrom<product>(p => p.ignoreproperty(x => x.type)) by way, solved problem adding self property base class. property return correct (non-proxy) type: ...

mysql - Encoding problem: ucs2_bin collate does not support cyrillic and greek languages -

i need store , compare text in several language in field of mysql database. actually, set uc2 character set , ucs_bin collate, , find not work cyrillic , greek characters. how can solve problem? suggestion? in advance teodoro use utf8 character set, collation utf8_unicode_ci -- robust combination (although slower using utf8_general_ci ).

java - Server side equivalent of Window.Location.getParameter() in GWT -

on client side able retrieve url parameters in gwt string parametername = window.location.getparameter("parametername"); doing same server side gives me exeption: [...] threw unexpected exception: java.lang.exceptionininitializererror [...] caused by: java.lang.exceptionininitializererror @ com.google.gwt.user.client.window$location.getquerystring(window.java:262) @ com.google.gwt.user.client.window$location.ensureparametermap(window.java:321) @ com.google.gwt.user.client.window$location.getparameter(window.java:211) @ com.icada.idea.server.currentuser.getuser(currentuser.java:31) where line 31 in currentuser reads: string nologin= window.location.getparameter("nologin"); so how url parameter server side? or way pass parameter method calling? on server side, don't have window. client request - , request may contain parameters (get parameters or post parameters). you can retrieve them using request.getparameter("parametername...

design patterns - Domain objects encapsulation: static methods vs Service classes -

i've read in ddd book (eric evans) procedures require used in presentation should moved services classes. instance bankaccountmanagementservice has changebankaccount, getbyaccountid ... methods. however need encapsulate setters of properties forbid assigning them other business objects. c# doesn't have friendly classes impossible use type of encapsulation in case of services. possible using static methods of bankaccount business object. (1) how solve limitation in case of using services mentioned above reason? edit: additional question (2) why bad use static method instead of services? can place them in separate partial class file not mix proc code entity code. thanks in advance :) if properties of domain object should not set (immutable), make them private (or protected). the service method responsible altering private properties of domain object perform necessary validation , or permissions checks , create new object via 1 of constructors (including i...

c# - Spring.net to structuremap dependency injection conversion -

good day, how convert spring configuration structuremap configuration. have spring.net config. <db:provider id="dbprovider" provider="system.data.sqlclient" connectionstring="data source=(local);database=spring;user id=springqa;password=springqa;trusted_connection=false"/> <object id="adotemplate" type="spring.data.core.adotemplate, spring.data"> <property name="dbprovider" ref="dbprovider"/> </object> </objects> my conversion this, for<spring.data.core.adotemplate>().use<spring.data.core.adotemplate>().configure.withproperty("dbprovider").equalto(??????); how/where instance of dbprovider property? in spring .net defined in xml tag not know how done on structure map. has encountered same problem , found solution? please help. not i've ever used structuremap spring.net providername "system.d...

php - curl_exec printing results when I don't want to -

i using following code: $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, 12); $result = curl_exec($ch); curl_close ($ch); however it's printing results straight away. possible put json result variable can print out when want to? set curlopt_returntransfer option: // ... curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch); per the docs : curlopt_returntransfer - true return transfer string of return value of curl_exec() instead of outputting out directly.

linq to sql concurrency issue! -

i have windows service deletes table rows. dont want delete rows , if rows loaded(to opertion) wcf service . seems should put locking mechanism , cant find on how . in regard ? thanks jamal. you shouldn't hold long term database locks. use kind of marking technique, such table of ids each loaded row foreign key original table. prevent deletions until wcf service deletes entries in auxiliary table. enable safe deletion appending where not exists (select * loaded_rows id = outer.id) delete statements. this model allows multiple "loaders", adding "loader_id" column auxiliary table. the main problem suggested approach wcf service must delete rows when it's done them. if neglects due bug or crash, rows permanently locked (or @ least until dba wanders by). there numerous ways work around this, revolving around kind of expiry mechanism.