Posts

Showing posts from August, 2015

Using Robocopy to exclude a file extension from the root directory -

i have directory want copy directory using robocopy.exe. my plan exclude few files root of source directory. in fact, i'd exclude .html files root of directory. the trick i'm using /e causing subfolders processed too. therefore, current outcome of operation if use: /e /xf "*.html" i'm going exclude html files site-wide. is there way can keep copying sub-folders, use xf exclude .html files root? something like: /e /xf "c:\releases\website_source\*.html" my solution indecent easy understand. perform task 2 line batch file. robocopy root folder (but not subdirectories) - including .html files. next line robocopy including subs (excluding *.html)

Java regex to extract date format out into month and year -

hi have following date string format: june-2008 july-2008 march-2010 may enquire java regex extract out whatever month , year value separate string each. delimeter here "-" sign any values start end of "-" sign month, after "-" sign year value. the following achieve string m = march string y = 2010 thank help! don't use regex. use string#split() : string[] parts = "june-2008".split("-", 2); // or .split("-") string m = parts[0]; // "june" string y = parts[1]; // "2008" even better, use simpledateformat , , you'll have proper date work with: dateformat df = new simpledateformat("m-y"); date mydate = df.parse("june-2008");

Nokogiri XML Builder Newlines -

nokogiri xml builder randomly adding new lines outputted xml. how can nokogiri output new line after each tag. for example, output getting <books> <book> <title>foobar</title><author>me </author> <book> </books> but want <books> <book> <title>foobar</title> <author>me</author> <book> </books> what wrong!!!!??? the problem in code, but, because said "no, can't. need explanation." can't fix it. this generates output want. you'll need figure out how make apply situation: require 'nokogiri' builder = nokogiri::xml::builder.new |xml| xml.books { xml.book { xml.title { xml.text 'foobar' } xml.author { xml.text 'me' } } } end puts builder.to_xml # >> <?xml version="1.0"?> # >> <books> # >> <book> # >> <t...

MVVM gridview binding to datatable WPF -

i new mvvm , databinding , having trouble binding gridview datatable dynamically. able column headers bind, no data being displayed in grid itself. my model returns data table result of sql string passed it. viewmodel wraps datatable , gets bound view. right trying display data populating gridview main window, headers being displayed. i know there data in model.results datatable though. my viewmodel: public class resultsviewmodel { private datatable _dt; public resultsviewmodel() { datasource _ds = new datasource(); _dt = _ds.execute("select * tbl_users"); } public datatable results { { return _dt; } set { _dt = value; } } } my code populate gridview mainwindow: public mainwindow() { initializecomponent(); resultsview view = new resultsview(); resultsviewmodel model = new resultsviewmodel(); gridview grid = new gridview(); foreach (datacolumn col in ...

How to toggle elements with jQuery? -

i building website page has 16 items of apparel. i want simple text navigation has option show , hide products either men, women, , all. navigation <ul class="sortnav"> <li class="first">view:</li> <li class="men button">men</li> <li class="women button">women</li> <li class="all button active">all</li> </ul> products code <span class="prod men">guys shirt</span> <span class="prod men">guys pant </span> <span class="prod women">girls pant</span> <span class="prod women">girls pant</span> tricky part 1 button can "active". , class visible (one or two) triggered. thanks in advance. thanks! kinda combined 2 responses. check out... $('.products li.prod').toggle(true); $('.sortnav li.button').click(function () { $('.sortnav li.button')...

jquery - Expanding td width problem -

i can't figure out how expand td width beyond size of container. see mean, check out this jsfiddle. once table fills container width, can't make cells wider. provided need after page has loaded, how go doing this? i don't want resize containing div. thanks! you can expand size of table (not outer div): http://jsfiddle.net/maniator/dkxtw/15/ $("#testtable").width($("#testtable").width() + 100 );

datetime - Groovy - idiomatic way of coding The Last Weekday - First of Month -

what groovy idiomatic way of asking last past weekday (ex. monday)? (or current week, first day of week)? also there similar asking current month, first of month? static date firstdayinweek(date day) { day.cleartime() return day - day.calendardate.dayofweek }

java - Help with a Swing JFrame with 3 comboboxes and a vector variable -

i created swing jframe 3 comboboxes , vector variable populate them, comboboxes empty on execution of code. can tell me wrong. public class notes extends jframe { jframe jf; jpanel jp = new jpanel(); vector<integer> v = new vector<integer>(); int i; integer x; dimension d = new dimension(40, 12); notes() { jf = new jframe("combobox demo"); (i = 1; <= 31; i++) { x = new integer(i); v.add(x); } jcombobox date = new jcombobox(v); v.removeallelements(); (i = 1; <= 12; i++) { x = new integer(i); v.add(x); } jcombobox month = new jcombobox(v); v.removeallelements(); (i = 2011; <= 2020; i++) { x = new integer(i); v.add(x); } jcombobox year = new jcombobox(v); v.removeallelements(); date.setsize(d); month.setsize(d); y...

.net - Regex for a string of n characters -

i want use .net's regex.ismatch function determine if string 8 characters long , matches expression ak-\d\d\d\d[ff] . so, ak-9442f match not ak-9442f2 nor ak-9442 . how construct expression? using static regex.ismatch , can do: if (regex.ismatch(myteststring, @"^ak-\d{4}[ff]$")) { // passed } should work purpose. broken down, it's: ^ # must match beginning of string ak- # string literal, "ak-" \d{4} # \d digit, {4} means must repeated 4 times [ff] # either upper or lowercase f $ # must match end of string gskinner test

java - Stateful EJB Lifecycle question -

i have following bean declaration: @stateful @transactionattribute(transactionattributetype.not_supported) public class interuptbean implements interrupt { private boolean interrupt = false; @override public boolean check() { return interrupt; } @override public void interrupt() { interrupt = true; } } i'm trying understand stateful ejb lifecycle. once state of ejb permanently modified using interrupt() method, , references instance set null, bean instance put in eligible pool or discarded? what makes me question judgement transactionattributetype.not_supported. hope container spec says somewhere stateful ejb reset somehow how it's initial state before being used again, not matter transactionattributetype is. thanks! read http://download.oracle.com/javaee/6/tutorial/doc/giplj.html#gipln . at end of lifecycle, client invokes method annotated @remove, , ejb container calls method annotated @predestroy, if any. bean’s instance ready garbage col...

sql server - Declare a Table Variable Based on Select Statement -

i want declare table variable , fill select, without having explicitly define columns. t-sql allow this: declare @people table() select * persons; hypothetically, above statement match column types identically, , fill @people table variable @ same time. :) you can't table variable since variable has declared before can used, use temp table instead. select * #people persons;

sql - Get active rows between from and to date range inclusive of boundary -

table testtable has 4 columns sessionid int started datetime ended datetime sessionisrunning bool - true if last session has not yet ended. max 1 record can true @ anytime since @ 1 session can running. if no session running records have false. given 2 dates fromdate , todate , how first session started on or after fromdate , last session ended on or before todate . tricky condition if session in progress , it's start date >= fromdate need this. guessing might not possible both min , max session id in 1 sql statement , keep code readable , easy maintain. 2 separate sql statements ok. 1 min , 1 max. can query rows using between min , max. this last statement explains in different way. sessions started or running , ended or running between from/to dates thank you after considering edits , comments regarding between, should give result set need. pull record sessionisrunning = true sessions thats started , ended in date range. select * testtable tt (...

iphone - How to display some part of the string in One TextView and reaming in Other -

in application have iboutlet uitextview *newsfirstpart; iboutlet uitextview *newssecondpart; iboutlet uilabel *newstitle; iboutlet uiimageview *newsimgview; iboutlet uibutton *sendbtn; i displaying string content in textviews programmically .the following design of scrollview. means here parsing string content xml file . string length should vary in every case . i want display part of string content in first textview , means should depend height of *newsfirstpart , remaining string in second *newssecondpart. also want place uibutton 'send' after second textview programmically. depending height of second textview , have set scrollview content size. how can display part of string in 1 textview , remaining in other? !------------------------------! !---------------!--------------! ! newstitle ! !------------------------------! ! ! ! ! ! ! ! newsfirstpart ! newsimgview ! ! ! ...

c# - Is there a simple way to determine what font is being used in the user's title bar? -

i'd find out font user has defined window. if using ms sans serif, there characters cannot display. i'm assuming people using tahoma or segoe ui that's assumption i'm not prepared make within program. can , safely query user's type of font title bar (non-client area)? system.drawing.systemfonts.captionfont

android - How to put a List in intent -

i have list in 1 of activities , need pass next activity. private list<item> selecteddata; i tried putting in intent : intent.putextra("selecteddata", selecteddata); but not working. can done? you have instantiate list concrete type first. list interface. if implement parcelable interface in object can use putparcelablearraylistextra() method add intent .

objective c - Accessing NSDocumentDirectory on iPad Simulator -

i've added simple .csv file app's nsdocumentdirectory using: -(ibaction)exportmodule:(id)sender{ nsstring *filename = @"exportedfile.csv"; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *exportstring = @"i've,been,exported"; nsdata *testdata=[exportstring datausingencoding:nsutf8stringencoding]; nsstring *docdir = documentsdirectory; nsstring *completepath = [docdir stringbyappendingpathcomponent:filename]; [testdata writetofile:completepath atomically:yes]; if ([[nsfilemanager defaultmanager] fileexistsatpath:completepath]) { nslog(@"theres file here!"); } } the app gets if statement printing "theres file here!" , open file , see if there problems in formatting .csv. if running on physical device, i'd able open in itunes , take there, there way examine .csv ...

c# - How Can I change A Graph Result on the fly -

i'm drawing graph c# windows .net framework 3.5 base on data receive serial port, need change part of graph on fly when i'm watching graph result on screen. mean how can change graph dragging peace of graph mouse , when change part of graph, in behind code can realize changing , change data received before according changing well. there tools or component can change graph on fly in c# .net 3.5 or 4, if there not how can c#. in advance wish thank kind consideration, prompt response highly appreciated.

Erlang rr() returns missing_chunk -

newbie question on erlang using wings 3d shell (windows 7 pro, wings 3d 1.4.1). when write command read records definitons: rr(wings). i error: {error,beam_lib, {missing_chunk,'d:/temp/erlang/lib/wings/ebin/wings.beam',"abst"}} what doing wrong? rr/1 "reads record definitions module's beam file. if there no record definitions in beam file, source file located , read instead." my guess abstract form hasn't been included in .beam file , in installation source files not available. update: digging shell:read_file_records/2 function, i've found following: read_file_records(file, opts) -> case filename:extension(file) of ".beam" -> case beam_lib:chunks(file, [abstract_code,"cinf"]) of {ok,{_mod,[{abstract_code,{version,forms}},{"cinf",cb}]}} -> case record_attrs(forms) of [] when version =...

sockets - Writing a console-based C++ IRC-client -

i'm learning c++ , i've decided begin coding irc-client. i want consolebased, , i've looked in libraries such ncurses, don't know whether or not best approach. i imagine ui being divided 1 part whatever messages written appear, , 1 part users input goes. ncurses seemed able this, i've discovered issue. because want message-part event driven (whenever sends message, should appear in message-part) message-part of ui should run independently input-part. also, sockets have non-blocking well. i've looked around on internet , haven't found tutorials on this, either really, old, poorly written or long. anyways, questions are, how done using ncurses , socket libraries? c++ wrappers (one thing i've learned reading ncurses tutorials oop wonderful...)? using ncurses interface sounds idea. can single-threaded select-based network , terminal client -- check out beej's guide . alternatively, boost.asio, single-or-multithreaded, should solid ...

java - Where to Enable the asserions -

i junior developer , developing web application using eclipse , server jboss 6. i want know how , enable "assertion", can put assertions in code, , there assertion errors while developing , testing. i want know if have configuration in jboss, or other place. any sort of leading int right direction appreciated. regards adofo i have not tried , googled https://docs.jboss.org/author/display/arq/enabling+assertions also @ worked me netbeans 7.1 https://stackoverflow.com/a/18046315/2194456 and in jboss 7 , if want start in cmd line. go bin folder of jboss , in standalone.conf file add java_opts="$java_opts -enableassertions"

c# - Factory Pattern, Another Pattern or no pattern at all? -

i have 2 cases wheter method can considered factory design pattern, example in c#, altought, can apply other programming languages: enum ninjatypes { generic, katanna, starthrower, invisible, flyer } public class ninja { public string name { get; set; } public void jump() { ... } public void kickass() { ... } } public class katannaninja: ninja { public void usekatanna() { ... } } public class starninja: ninja { public void throwstar() { ... } } public class invisibleninja: ninja { public void becomeinvisible() {...} public void becomevisible() {...} } public class flyninja: ninja { public void fly() {...} public void land() {...} } public class ninjaschool { // return generic type public ninja standardstudent() {...} // may return other types public ninja specialitystudent(ninjatypes whichtype) {...} } the method standardstudent() return new object of same type, specialitystudent(...) , may return new objects different classes share sa...

java - I'm Using Camick's ListTableModel and RowTableModel, NO DATA IN JTABLE -

i trying use listtablemodel , tried following examples online , still finding difficult show 'resultset' data in jtable. im using model-view-controller method building gui application in netbeans. of gui components placed in views , controller handling updates visibility view. model class has queries , responsible accessing database directly using jdbc. the "jtable" "searchtable" created , initialized inside view class , being accessed controller via method (getsearchtable()). public jtable getsearchtable(){ // view class return searchtable; } i have "listtablemodel" being created inside controller class , following camick's tutorial. private product_view productview; private product_model productmodel; private product product; public product_controller(product_model model, product_view view){ this.productmodel = model; this.productview = view; view.addsavelistener(new savelistener()); view.addcloselistener(ne...

java - mail validation suggestions -

i using thing signup page, after user finishes registeration form email send him including link when pressed redirect him page confirm registration , suggestions how google app engine (even concept) create guid - java.util.uuid. put guid database table along timestamp generate confirmation link guid parameter , email user once link hit user, check passed guid exist in db (and valid, not expired), complete registration , delete guid record database

c - How does the OS know how much to increment different pointers? -

with 32-bit os, know pointer size 4 bytes, sizeof(char*) 4 , sizeof(int*) 4, etc. know when increment char* , byte address (offset) changes sizeof(char) ; when increment int* , byte address changes sizeof(int) . my question is: how os know how increment byte address sizeof(yourtype) ? the compiler knows how increment pointer of type yourtype * if knows size of yourtype , case if , if complete definition of yourtype known compiler @ point. for example, if have: struct yourtype *a; struct yourothertype *b; struct yourtype { int x; char y; }; then allowed this: a++; but not allowed this: b++; ..since struct yourtype complete type, struct yourothertype incomplete type. the error given gcc line b++; is: error: arithmetic on pointer incomplete type

iphone - Provisioning profile install problem -

i used development provisioning assistant get: - mobile provisioning profile - developer_identifier.cer i did said "step 3: verify private , public keys in keychain" not showing keys (public , private keys). how keys ? thx (also note loading onto laptop has been done on macmini) once download keys ios dev center, double-click on .cer files, , should loaded keychain.

iphone - Multiple requests in one TTURLRequestModel -

i using facebook example code of three20 basis project, , want have 2 url requests in tturlrequestmodel class, use 1 ttlistdatasource render objects.. for example, url request post details... , url request comments of post.. you need open tt code , make own modifications. don't think it's supported. 1 solution can think of create 2 models , when model finishes add cellitems in datasource.

how can I declare java interface field that implement class should refine that field -

how can declare java interface field implement class should refine field ? for example public interface iworkflow{ public static final string example;// interface field public void reject(); } // , implement class public class abstworkflow implements iworkflow { public static final string example = "abcd"; /*must have*/ public void reject(){} ... } thank you. see section 9.3 of the specification . there no overriding of fields in interfaces - hidden in contexts, , ambiguous in others. i'd stay away. instead put getter in interface (getexample())

c# - NHibernate Repository -

does has proper , simplified write on nhibernate repository? i've used java, hibernate, lcds dataservice repositories flexbuilder (using rtmp channelling) , want implement exact fundamental c#.net. i've gone through lots of online documentation nothing reflecting exact use flexbuilder. if has small example application share. helpful. regards nitin see these: data access nhibernate repository pattern in nhibernate first create interface irepository : public interface irepository<t> { int add(t entity); void delete(t entity); void update(t entity); t getbyid(int id); ienumerable<t> findall(detachedcriteria criteria); ... . . // } then implement interface following: public class repository<t> : irepository<t> { readonly iactivesessionmanager _activesessionmanager; protected isession session { { return _activesessionmanager.getactivesession(); } } public reposito...

java - Sending array of string as a parameter to web service method using JAXRPC -

i've got problem sending array of string parameter web service method, given in specific wsdl. when trying send array of strings, following error. error: axisfault faultcode: {http://schemas.xmlsoap.org/soap/envelope/}server.userexception faultsubcode: faultstring: org.xml.sax.saxexception: bad types (class java.util.arraylist &gt; class usdjws65.arrayofstring) faultactor: faultnode: faultdetail: {http://xml.apache.org/axis/}hostname:sslspsd001 org.xml.sax.saxexception: bad types (class java.util.arraylist -> class usdjws65.arrayofstring) @ org.apache.axis.message.soapfaultbuilder.createfault(soapfaultbuilder.java:222) @ org.apache.axis.message.soapfaultbuilder.endelement(soapfaultbuilder.java:129) @ org.apache.axis.encoding.deserializationcontext.endelement(deserializationcontext.java:1087) code written: call call1 = objservice1.createcall(port1); call1.settargetendpointaddress(targetendpoint); call1.addparameter("int_1", xmltype.xsd...

php - session_start() -

i have page just: <?php session_start(); ?> the server response headers showing: http/1.1 200 ok date: fri, 01 jul 2011 03:30:07 gmt server: apache x-powered-by: php/5.2.11 expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache set-cookie: phpsessid=zok****************; path=/ content-type: text/html i expecting file in start/run/cookies like: user@mysite[1] but there none. why not? my end point have usual logged in / not logged in test each page including splash page ... session data stored on server , not on client side. store session data on client have enable session.use_only_cookies . have @ php manual @ http://php.net/manual/session.security.php

c++ - Regarding empty initialisation of static array of class types -

when ran static code analyzer qacpp, got warning. according qacpp documentation, initializing {0} works built in types. initialize array of objects of type a , {} must used. below: int i[5] = {0}; // works built-in types. a[5] = {}; // ok, works both built-in , class types is standard c++ rule? according this, array of pointers class type must initialized {} , right? does statement: a* ap[5] = {} initialise 5 pointers null ? qacpp throws me warning when used a* ap[5] = {null} , though code compiles , works otherwise. additional i think warning more because array static. and here explanation found in documentation: there many problems use of objects static storage duration, particularly declared outside of functions. if many functions can access static object situation may become difficult maintain. also, in case of multi-threaded applications becomes necessary protect mutex each static object can accessed concurrently. therefore ...

Visual Studio 2010 extension that does code expansion -

i want build visual studio 2010 vsix extension expands text based on call method (using zen coding selector-based syntax ). ideally, user type string of text, hit hotkey, , string of text expanded. i've looked @ lot of samples, focus either on full-blown language services or on simple adornments. ideally, i'd find full working sample, i'd happy interfaces / classes , code. some references looked at: http://msdn.microsoft.com/en-us/library/bb165336.aspx http://msdn.microsoft.com/en-us/vstudio/ff718165.aspx http://msdn.microsoft.com/en-us/library/ee372314.aspx update: know resharper , coderush kind of thing. i'd stand-alone plugin if possible. it sounds you're looking example / reference on how keyboard handling drive text insertion visual studio buffer. unfortunately not question has straight forward answer. keyboard handling in visual studio complex @ best , hair pulling frustrating @ times. i've tried keep answer simple possible un...

java - How to catch an Exception from a thread -

i have java main class, in class, start new thread, in main, waits until thread dies. @ moment, throw runtime exception thread, can't catch exception thrown thread in main class. here code: public class test extends thread { public static void main(string[] args) throws interruptedexception { test t = new test(); try { t.start(); t.join(); } catch(runtimeexception e) { system.out.println("** runtimeexception main"); } system.out.println("main stoped"); } @override public void run() { try { while(true) { system.out.println("** started"); sleep(2000); throw new runtimeexception("exception thread"); } } catch (runtimeexception e) { system.out.println("** runtimeexception thread"); throw e; } catch (interruptedexception e) { } } } anybody knows why? use threa...

c# - How do you maintain code with InvalidEnumArgumentException? -

i curious how maintain code once throw system.componentmodel.invalidenumargumentexception . basically have switch statement this: switch (enumvalue) { case myenum.value1: break; case myenum.value2: break; default: throw new invalidenumargumentexception(); } what if decide add more values myenum in future, example, value3 , value4 ? mean end throwing misleading exception. how prevent this? should use reflection before throwing? exception should throw in case? i'm looking suggestions. i discovered exception couple minutes ago maybe looking @ in wrong context. exception thrown when enum argument not supported (in case value3 , value4 not supported)? the problem state depends on context, if method receives enumeration argument must specify values support , unknown enumeration value. if add more enumeration options need decide if not throwing exception in default case. be reminded exception special helpful since can ...

Rails 3. Where NOT query. How to? -

i developing api in rails 3 , let users search user table find friends not want them find them self in search results. how can alter below query make sure users id not among query results. user.where("lower (firstname) ? or lower (lastname) ?", "%#{@query}%" , "%#{@query}%") thankful input! you can add condition query: user.where("(lower (firstname) ? or lower (lastname) ?) , (id != ?)", "%#{@query}%" , "%#{@query}%", current_user.id)

ios - Read a .txt file inside documents directory -

how can read .txt file inside documents directory? can show me code? nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [documentsdirectory stringbyappendingpathcomponent:@"txtfile.txt"]; nsstring *content = [nsstring stringwithcontentsoffile:filepath encoding:nsutf8stringencoding error:null];

sql - MySQL: How to select a preferred value from multiple rows (and fall back to a default)? -

i have following query returns list of group ids attached product ids specified in in clause. select t1.product_id, t2.group_id table_1 t1 left join table_2 t2 on t1.product_id = t2.product_id t1.product_id in(1,2,3,4,5) , t2.group_id = -1 or t2.group_id = 2 this returning this: +------------+----------+ | product_id | group_id | +------------+----------+ | 1 | -1 | | 1 | 2 | | 2 | -1 | | 3 | -1 | | 4 | -1 | | 5 | -1 | +------------+----------+ the group_id have default value of -1 in cases there may more 1 value (eg, product_id '1' has group_id of '-1' , '2'). want ignore '-1' value when there alternative end this: +------------+----------+ | product_id | group_id | +------------+----------+ | 1 | 2 | | 2 | -1 | | 3 | -1 | | 4 | -1 | | 5 | -1 | +------------+--...

design patterns - Implementing undo in Java for state changes -

i starting implementing command pattern in hope useful solution problem of providing undo operation. facing issue: implementing undo when operations involved rather easy: when i've added 5 number subtract 5. when i've added object list, remove it, , on. if have total state , not list? an example: model information thread in class: public class threadinfo implements comparable<threadinfo> { final int id; string name; int priority; string state; int waitcount; // ... } certain information not change, instance id. undoing waitcount easy described above, subtract. priority or state ? not clear how undo these information. the idea came with: when initializing command object, preserve old state in it's object: passing relevant data constructor: public mycommand(int priority, string state) { previouspriority = priority; previousstate = state; } or better let threadinfo have list of states , priorities being first elements c...

php - How can hide my combobox with JAvascript? -

i have combobox id name option , id name "chk" , checkbox name "chk" and script ;i put script onclick not work ;i check script loading ;i not understand why not work ?can me? function checkall() { //do stuff need here document.getelementbyid('option').style="none"; } <input type=\"checkbox\" name=\"chk\" value=\"chk\" onclick=\"checkall()\"> you need use display property: document.getelementbyid('option').style.display = "none"; this should work if have assigned element id="option" if want check checkbox (as function name suggests), need use checked property instead: document.getelementbyid('option').checked = true;

flex - How to dynamically add attributes to an object and convert that object to xml -

how dynamically add attributes object , convert object xml in flex/actionscript? you must denote object dynamic, can add properties want. can fall on the for (var i:string in myarray) { trace(myarray[i]); } to create xml.

making custom component in android -

i new in android, dont have of experience. want know making custom component. followed http://developer.android.com/guide/topics/ui/custom-components.html . many things not getting cleared. visited link http://code.google.com/p/android-wheel/source/browse/trunk/wheel/src/kankan/wheel/widget/wheelview.java?r=4 . there have made custom component. please suggest me documented tutorial clear picture making custom component onmeasure(int,int), ondraw(canvas) methods used , things documented well, why using this? please suggest me such link or tutorial. want confident in it. the question unclear. kind of custom components want make. regular views? viewgroups or perhaps custom adapters? find plenty of material if search more precise. but start of some: http://www.anddev.org/creating_custom_views_-_the_togglebutton-t310.html http://www.anddev.org/advanced-tutorials-f21/custom-views-t1891.html since new user can't post more links.

php - Parse Nested JSON With JQuery -

i'm new json , struggling this. i've read countless other posts , web pages can't seem figure out. i'm using php output json (from data database) code: header('content-type: application/json'); echo json_encode($data); here json: { "x0": { "id": "1", "name": "rob", "online": "1", "gender": "m", "age": "29", "height": "5'8''", "build": "average", "ethnicity": "white", "description": "art geek person", "looking_for": "anything", "image": "4fs5d43f5s4d3f544sdf.jpg", "last_active": "29-06-11-1810", "town": "manchester", "country": "uk",...

css - How widely supported are background-size and background-origin? -

and browsers require prefix: -moz-background-size , -webkit-background-size , , similar? thanks! see caniuse.com table showing browser support feature browsers , versions in common use. short answer: ie6/7/8 don't support it. firefox 3.6 requires -moz- prefix. older versions of safari might have issues. everywhere else should work fine.

Audio Android.Mixing a song and a voice recorded! -

i developing karaoke app , have been dealing audio android.i want opinion on how can save single song voice recorded , song playing in background. thanks unfortunately, don't think there's "on device" way combine 2 audio files one. best can play both @ same time i've read. see sound pool documentation

javascript - How to handle the ENTER keypressed to trigger an onBlur() event? -

i have ipad webapp big <form> @ point. every input in has functions controlling values, both on keyup , blur events. thing is, if user accidentaly hits "go" button while typing (considered "enter" keypress), form submitted. intercept comportment , trigger onblur() event of focused element instead. for have this: load(){ document.addeventlistener("keydown",logpressedkeys,false); } /** * logs keys hit in console, trigger onblur event */ function logpressedkeys(e) { console.log(e.keycode); if (e.keycode==13) { console.log('enter spotted: prevent!'); e.preventdefault();//shall prevent submitting return false;//hoping prevents default if above fails } } do guys have advice/idea/improvement that? nota bene: there has @ least 1 input focused ipad's keyboard pop. found out document.activeelement works out in ipad's safari. function logpressedkeys(e) { console.log(e.keycode); ...

c# - Avoiding too many if else, else if statement for multiple(9) conditions -

Image
i have got 9 condition if else statement , thinking there other alternative solution make code clean , short. 9 condition perform different calculations asp.net mvc view . have included code , image shows view of conditions, hope make sense , looking better , robust solution scenario.. thanks //condition 1 //when no selection made 2 dropdownlist (garages & helmets) if (formvalues["helmets"] == "" && formvalues["garages"] == "") { viewbag.hidehelmet = 1;//for jquery, value passed jquery script decides field hide/show viewbag.hidegarages = 1;//for jquery, value passed jquery script decides field hide/show viewbag.selectedhelmets = 1;// viewbag.selectedgarages = 1;// viewbag.totalhelmets = 1; viewbag.totalgarages = 1; viewbag.totalamount = 1; viewbag.totalamount = trackeventcost.unitcost; } //condition 2 //when garages selected dropdown & helmets not selected else if ((formvalues["helmets...

multithreading - Good or bad idea: Multiple threads in a multi-user servlet-based web application with Java -

i building java-servlet-based web application should offer service quite lot of users (don't ask me how "a lot" :-) - don't know yet). however, while application being used, there might occur long-taking processing on serverside. in order avoid bad ui responsiveness, decided move these processing operations own threads. means once user logged in, can happen 1-10 threads run in background ( per user! ). i once heard using multiple threads in web application "bad idea". is true , if yes: why? update: forgot mention application heavily relies on ajax calls. every user action causes new ajax call. so, when main servlet thread busy, ajax call takes long process. that's why want use multiple threads. it bad idea manually create threads yourself. has been discussed lot here in so. see this question example. another question discusses alternative solutions.

iphone - Combining animations on UIView and subiview's CALayer? -

i'm animating uiview transition so: uiview *areaview = areacontroller.view; [areacontroller viewwillappear:yes]; uiview *subview = self.customview.subview; uibutton *button = customview.button; // button subview of customview.subview [uiview beginanimations:nil context:null]; [uiview setanimationduration:1]; [uiview setanimationtransition:uiviewanimationtransitionflipfromright forview:subview cache:yes]; [button removefromsuperview]; [subview addsubview:areaview]; [areacontroller viewdidappear:yes]; [uiview commitanimations]; [self.areacontroller start]; // areacontroller starts animation of calayer, see below this flips new view, areaview "behind" button fine, in areaview there's subview animating it's calayer: catransform3d rotate = catransform3dmakerotation(angle, 1, 0, 0); cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"transform"]; animation.tovalue = [nsvalue valuewithcatransform3d:rotate]; animation.durat...

c# - IIS6 App Pool state -

i wondering if there way capture state of iis6 app pool using directoryentry in c#? i have seen people use apppoolstate iis7 there equivalent work iis6? or need use different namespace? edit: there display string status? apppoolstate looks accepts integers. looks you'd use same property: check status of application pool (iis 6) c#

database - Grails keep deleting my tables -

i have table structure like: create table test_two_tabel . t1 ( t1_id int not null auto_increment , a1 int null , b1 varchar(45) null , c1 varchar(45) null , d1 datetime null , primary key ( t1_id ) ); in grails: package twotables class t1 { integer string b string c date d static mapping = { table "t1" version false id column:"t1_id" a1 column:"a1" b1 column:"b1" c1 column:"c1" d1 column:"d1" } static constraints = { id() a1() b1() c1() d1() } } every time execute program... grails deletes tables in db, know what's happening? you need change value of dbcreate 'create-drop' 'update' @ grails-app/conf/datasource.groovy you current value is: development { datasource { dbcreate = "create-drop" // 1 of 'create', ...

c# - Cannot access a non-static member of outer type 'FormMain' via nested type 'FormMain.ImageDelegateClass' -

i need update c# winforms picturebox memorystream input. able accomplish using picturebox.image = new bitmap(new memorystream(payload)); in thread parses stream [ rxthread() ] advised use delegate avoid undesirable effects. i've implemented this: private void rxthread() { ... var imagedelegateclass = new imagedelegateclass(); var imagedelegate = new imagedelegate(imagedelegateclass.setimage); imagedelegate(payload); ... } delegate void imagedelegate(byte[] payload); class imagedelegateclass { public void setimage(byte[] payload) { picturebox.image = new bitmap(new memorystream(payload)); } } but following error code when try compile: cannot access non-static member of outer type 'formmain' via nested type 'formmain.imagedelegateclass' i sure bad idea make picturebox static since winforms generated. know repair simple bit new c#. have read chapter on delegates in jon skeets c# in depth 2nd edition mult...

algorithm - How to round currency values -

i have several ways solve this, interested in whether there better solution problem. please respond pure numeric algorithm. string manipulation not acceptable. looking elegant , efficient solution. given currency value (ie $251.03), split value 2 half , round 2 decimal places. key first half should round , second should round down. outcome in scenario should $125.52 , $125.51. divide two, round 2 d.p. (in c# decimal.round(value, 2) ), subtract rounded value original, , sort them using if. library may support control on rounding can save if - c# can using 3-parameter overload of decimal.round .

c# - Advice simplifying my Architecture... asp.net mvc -

i have ui layer/ domainservice layer (domain logic , services reside here) , repo layer persistance, use ninject decouple things. i have kept ui layer simple - delegate tasks service layer, have complex application depends on loggedonuser, therefore crud can quite complex. my problem though is: have service , connects onto genericrepository. for example iorder communicates idbrepo order info depending on client accesses order, have ishipping - connects idbrepoand retireves info... gets complicated when 1 service needs call service, both connected idbrepo. i have managed pull out iusersession , can give each service - seems complicated me... when setting test have like: var db = new dbrepo(); var s1 = new orderservice(db); var s2 = new shippingservice(s1,db); then extend some/most of services have add iloggingservice , inotificationservice - both need access database too... note: not looking pure ddd, trying take best of things , make work guess has been problem....

php - nl2br() creates an extra new line -

i trying insert description text field database. i doing this: $group_description = mysql_real_escape_string($_post['group_description']); but creating problems because when taking things out of database, being displayed \n\r strings instead of new lines. here example of page problem: http://www.comehike.com/hikes/hiking_group.php?hiking_group_id=48 so tried fix adding nl2br this: $group_description = mysql_real_escape_string(nl2br($_post['group_description'])); but inserted line :( here example of current problem: http://www.comehike.com/hikes/hiking_group.php?hiking_group_id=50 here example of insert statement use: $insert_group_sql = 'insert hiking_groups( title , group_description ) values ( "'.$group_name.'" , "'.$group_description.'" ) '; what proper way this? here code use display $group_description //convert urls links $group_description = preg_replace('#([\s|^])...

emacs - Adjusting shell mode color schemes -

Image
the color schemes in emacs shell mode appear primary colors (high saturation) , primitive, , colors, example, purple, not appear: i want adjust colors use more intermediate colors , more soft in gnome-terminal: how can change color schemes in shell mode? couldn't find shell-mode related font assignments in emacs, , because color given shell , different other font assignmets in emacs. when program run inside shell-mode issues ansi escape characters set display color to, say, magenta, emacs intercepts escape characters , creates colored overlay using exact foreground color "magenta". there's no color theme interaction going on here, , no shell-specific customizations for. the interception made functions in ansi-color.el , though, , looks customize ansi-color-names-vector , use "paleblue" "blue", either m-x customize ret ansi-color-names-vector , or try putting following in emacs config: (setq ansi-color-names-vector [...

how to kill process and child processes from python? -

for example bash: kill -9 -pid os.kill(pid, signal.sigkill) kill parent process. when pass negative pid kill , sends signal process group (absolute) number. equivalent os.killpg() in python.

How can I count the current people in a group from a list of start and end dates in R -

or rather, how can better have fudged. i have dataframe names , start , end dates in group. want produce dataframe number of people in group on time. note, people haven't left yet (end date na) here's example dataset foo<-data.frame(name=c("bob","sue", "richard", "jane"), start=as.posixct(c("2006-03-23 gmt", "2007-01-20 gmt", "2007-01-20 gmt", "2006-03-23 gmt")), end=as.posixct(c("2009-01-20 gmt", "na", "2006-03-23 gmt", "na"))) here create dataframe dates covering range want. feels dirty. daterange<-data.frame(date=as.posixct( paste( rep(2006:2009, each=12), "-", rep(01:12, times=4), "-", 1, " gmt", sep=...

vb.net - Screen resolution issue -

i have written application. works fine on resolutions of controls on lapped when run on other computers. there way of setting application automatically when run on different computers? thanks furqan you might want take @ this: http://msdn.microsoft.com/en-us/library/ms229649.aspx (assuming not wpf) you can lot docking , anchoring form maintain it's usability @ different sizes. but, there practical limits. can enforce minimum size , ensure controls resize appropriately down limit.

java - Google Calendar API and OAuth problem -

i error com.google.gdata.util.authenticationexception: unknown authorization header @ com.google.gdata.client.http.httpgdatarequest.handleerrorresponse(httpgdatarequest.java:600) ~[gdata-core-1.0.jar:na] @ com.google.gdata.client.http.googlegdatarequest.handleerrorresponse(googlegdatarequest.java:563) ~[gdata-core-1.0.jar:na] @ com.google.gdata.client.http.httpgdatarequest.checkresponse(httpgdatarequest.java:552) ~[gdata-core-1.0.jar:na] @ com.google.gdata.client.http.httpgdatarequest.execute(httpgdatarequest.java:530) ~[gdata-core-1.0.jar:na] @ com.google.gdata.client.http.googlegdatarequest.execute(googlegdatarequest.java:535) ~[gdata-core-1.0.jar:na] when trying access google calendar data via api. here happens before error. 1) authenticate google: final accesstokenresponse response = new googleauthorizationcodegrant(httptransport, jsonfactory, clientid, clientsecret, authorizationcode, ...