Posts

Showing posts from February, 2013

javascript - How to add more than 2 views to a view stack? -

i have been having problems adding more 2 views stack through dashcode gui interface. have seen how programmatically, there way statically keep views within stack? i okay using different stack, problem there have add browser area , get's ugly , messy in editor. thanks help, connor you've figured out now, there subviews section of stacklayout's inspector. click on + button add view. (or click on - button remove view.) can move view order , down in order dragging , dropping them in inspector panel. hope helps!

c - Fastest way to find out minimum of 3 numbers? -

in program wrote, 20% of time being spent on finding out minimum of 3 numbers in inner loop, in routine: static inline unsigned int min(unsigned int a, unsigned int b, unsigned int c) { unsigned int m = a; if (m > b) m = b; if (m > c) m = c; return m; } is there way speed up? ok assembly code x86/x86_64. edit: in reply of comments: * compiler being used gcc 4.3.3 * far assembly concerned, beginner there. asked assembly here, learn how this. :) * have quad-core intel 64 running, mmx/sse etc. supported. * it's hard post loop here, can tell it's heavily optimized implementation of levenshtein algorithm. this compiler giving me non-inlined version of min: .globl min .type min, @function min: pushl %ebp movl %esp, %ebp movl 8(%ebp), %edx movl 12(%ebp), %eax movl 16(%ebp), %ecx cmpl %edx, %eax jbe .l2 movl %edx, %eax .l2: cmpl %ecx, %eax jbe .l3 movl %ecx, %eax .l3: ...

continuous integration - How to add revision numbers in the title of e-mail published by cruisecontrol.NET? -

this question should ask year earlier. back day, setup cruisecontrol.net 1.4.2.14 our continuous integration system. wanted add source revision number , revision number of binary built. however, since restarted automatically if of external files , environment variable including ccnet.config modified, can't find way edit title of build informing e-mail while not making cruisecontrol.net restart. somehow solved problem in crapy way, not worth mention. time make things right. any appreciated. in advance. it not totally clear want do, can extract revision information xml (here subversion): <!-- extract subversion revision information xml. --> <target name="revisionstamp"> <property name="_target" value="${tmpdir}/svn.xml"/> <exec program="${svn}" output="${_target}"> <arg value="info"/> <arg value="--xml"/> <ar...

vb.net - When catching a general exception, how can I determine the original exception type? -

when catching exception in .net, can have many type-specific exception blocks needed. try have @ least 1 "general" exception catch block. there way type of "real" exception thrown caught generic exception handler, perhaps using reflection? for example, if have catch ex system.servicemodel.faultexception(of invaliduser) processmoduleloadexception(me, ex) catch ex system.servicemodel.faultexception(of sqlexceptions) processmoduleloadexception(me, ex) catch ex system.servicemodel.faultexception(of datanullreference) processmoduleloadexception(me, ex) catch ex system.servicemodel.faultexception processmoduleloadexception(me, ex) catch ex exception processmoduleloadexception(me, ex) (i have broken them out debugging, though same thing each exception). in short, in "catch ex system.servicemodel.faultexception" want examine "ex" , base "real" type of exception, either type (mostly debugging can add catch bl...

java - Missing start boundary Exception when reading messages with an attachment file -

i don't know why i'm getting following exception when reading mail attachment file mail server: exception in thread "main" javax.mail.messagingexception: missing start boundary @ javax.mail.internet.mimemultipart.parsebm<mimemultipart.java:872) @ javax.mail.internet.mimemultipart.parse<mimemultipart.java:493) @ javax.mail.internet.mimemultipart.getcount<mimemultipart.java:240) @ getparts.handlemultipart(getparts.java:57) @ getparts.main(getparts.java:42) the file i'm using read messages is: import java.io.*; import java.util.properties; import javax.mail.*; import javax.mail.internet.*; public class getparts { public static void main (string args[]) throws exception { string host = args[0]; string username = args[1]; string password = args[2]; // session properties props=new properties(); props.put("mail.mime.multipart.ignoremissingboundaryparamete",true); ...

objective c - regarding iTunes & iPhone simulator -

this question has answer here: how load photos , videos iphone simulator 4.0 3 answers i want know how can synchronize images, music & videos through itunes iphone simulator. if search forum you'll find more 1 discussion this. this post comprehensive. ultimately, media stored in ~/library/application support/iphone simulator/user/media. there not seem way of syncing itunes, various people have written scripts transfer files.

Rails Search Across Multiple Models -

i have issue. have show view acts dashboard , brings in records other models , models associated that. have simple search form working fine search through 1 model, don't know how have through associated models well. don't think full text search necessary , not sure how work because don't want going search across whole site. thanks companies/show/1 <div id="form"> <div class="search"> <% form_tag battalion_company_path, :method => :get %> <p> <%= text_field_tag :search, params[:search] %> <%= submit_tag "search", :name => nil %> </p> <% end %> </div> </div> <div id="bc_box"> <% @soldiers.each |soldier| %> <div id="bc_focus"> <div class="right"> <%= link_to image_tag("../images/buttons/info.png", :border=>0), battalion_company_soldier_path(@battalion, @company,soldier) %>...

Subclassing Decimal in Python -

i want use decimal class in python program doing financial calculations. decimals not work floats - need explicit conversion strings first. decided subclass decimal able work floats without explicit conversions. m_decimal.py: # -*- coding: utf-8 -*- import decimal decimal = decimal.decimal def floatcheck ( obj ) : # decimal not work floats return repr ( obj ) if isinstance ( obj, float ) else obj # automatically converts floats decimal class m_decimal ( decimal ) : __integral = decimal ( 1 ) def __new__ ( cls, value = 0 ) : return decimal.__new__ ( cls, floatcheck ( value ) ) def __str__ ( self ) : return str ( self.quantize ( self.__integral ) if self == self.to_integral () else self.normalize () ) # http://docs.python.org/library/decimal.html#decimal-faq def __mul__ ( self, other ) : print (type(other)) decimal.__mul__ ( self, other ) d = m_decimal print ( d(5000000)*d(2.2)) so instead of writing d(5000000)*d(2.2)...

e commerce - programming a very simple way to buy an item off a website? -

i dont want program shopping cart. want simple way people able click buy on site , able pay credit card , download software bought. i know there third party merchants make super complicated process. what easiest way yourself? is there third-party service heavily simplifies buying process? if want pay else, there bewildering array of ecommerce packages kinds of snazzy things, don't tell if support simple "pay , download" system want. spent ages looking , decided did far (shopping carts etc), opted roll own. if you're happy write code, "simple" approach go provider paypal , implement basic ipn handler releases download when transaction complete. can of worms - there's huge learning curve , lot of poor (well, misleading) documentation/information on net, once figure out how works, it's rather simple. for example, paypal... the buy part easy: paypal's website generate button you, whack in form , bob's uncle. sets off tra...

sql - How to create a new column in a select query -

in ms access, want insert new column returned result of select query. new column has same value every row. example, select returns columns a, b , want c new column created select query: a b c ---------- a1 b1 c a2 b2 c a3 b3 c select a, b, 'c' c mytable

guava - MapMaker and ReferenceMap - Google Collections -

i understand referencemap alpha version of google collections has been replaced mapmaker. i used referencemap constructor backing map: public referencemap(referencetype keyreferencetype, referencetype valuereferencetype, concurrentmap<object, object> backingmap) { this(keyreferencetype, valuereferencetype, backingmap, true); } my backing map concurrentmap ability collect statistics (hit/miss etc). what can use in place of above referencemap constructor? thanks, grace we not able continue offer ability pass own backing map. mapmaker works using customized map implementation of own. but, gather hit/miss statistics, can wrap returned concurrentmap in forwardingconcurrentmap count get invocations (using atomiclong), , have function count misses in similar way. (hits being, of course, equal request minus misses.)

android layout like this one -

i make layout 1 displayed on this link. image , 2 simple buttons on button of screen, trying using code: <merge xmlns:android="http://schemas.android.com/apk/res/android"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:id="@+id/maxsapimg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:scaletype="center" android:src="@drawable/golden_gate"> </imageview> <relativelayout android:id="@+id/innerrelativelayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true"> <button android:text="@string/camera" ...

java - Interaction with a cell renderer in JTable -

is there way cell renderer respond mouse events, such mouseovers? never tried guess need to: a) create custom renderer paint cell in 2 states b) need keep track of cell should painted in "mouse over" state c) add mouse listener track mouse entered/exited , mousemoved. each event need update variable tracks cell mouse positioned over. can use columnatpoint() , rowatpoint() methods of jtable d) when mouse leaves cell need invoke repaint() on cell. can use getcellrect() method determine cell repaint e) when mouse enters cell need reset cell value "mouse over" state , repaint cell.

iphone - UIImageView and UIImage of equal size -

i came across weird scenario in code other day: i have uiimageview loads image setimage:. uiimageview prior initialized frame having exact size of image (41*41 px). set content mode uiviewcontentmodecenter, should ensure image never scaled. now when @ image view see image bit cropped horizontally , appears little blurred (this telltale sign rescaling happening in background). if instead initialize image view 1 pixel in width, works (however image view 1 pixel wider image). also if initialize uiimageview initwithimage: seems work fine too. checked view's frame after initialization , found of same size: 41*41. so bottom line have few workarounds issue, i'm trying understand what's happening here. explanations can think of are: there bug in framework the rendering of images doesn't work images of particular size. know examples textures powers of 2, though doubt has significance uiimageview. for record i'm compiling os 3.0 , issue happens on both simu...

python - PyQt4 signals and slots -

i writing first python app pyqt4. have mainwindow , dialog class, part of mainwindow class: self.logindialog = logindialog(); i use slots , signals. here's connection made in mainwindow: qtcore.qobject.connect(self.logindialog, qtcore.signal("aa(str)"), self.login) and try emit signal inside dialog class (i'm sure emitted): self.emit(qtcore.signal("aa"), "jacek") unfortunately, slot not invoked. tried no arguments well, different styles of emitting signal. no errors, no warnings in code. might problem? you don't use same signal, when emitting , connecting. qtcore.signal("aa(str)") not same qtcore.signal("aa") . signals must have same signature. way, if defining own signals, don't define parametres. write signal('aa'), because defining parametres thing c++ , python version of qt doesn't need this. so should this: qtcore.qobject.connect(self.logindialog, qtcore.signal("aa...

android - Magic behind R.java file -

recently have been having quite problems r.java file. have decided backup , delete file see happens. nothing happened, created empty r.java file , hoped best. eclipse seems figure out file tampered , issues warning: r.java modified manually! reverting generated version! and that's there is. tried building manually got no results. so, have 2 questions: what should force eclipse regenerate file what happening here? how file created, code generating file? i appreciate help. usual problem occurred few days before deadline :) i had problem getting android app compile, seemingly inexplicable errors failure generate r.java. the problem caused killing android emulator during build. don't that! clue appearance of several left on *.out.xml files. the solution select project, click project->clean, , manually delete *.out.xml files . click run->run , have successful build. one more thing: i'm using eclipse. had make sure project selected in ...

iphone - if else in nsdictionary -

i have dictionary of array: array3 = [[nsdictionary dictionarywithcontentsoffile:docpath2] retain]; no problem here. have nsstring *temp contains numbers. check whether number exist in dictionary, not each array. if([array3 valueforkey:temp]) is right? doesn't if loop execute if true? <dict> <key>123456</key> <array> <string>low</string> <string>high</string> </array> <key>78910</key> <array> <string>low</string> <string>high</string> </array> </dict> for example temp = 78910, found. thks in adv not sure question, i'll give shot. first, objectforkey: method use valueforkey: key-value coding , give strange results should key start @. then, if objectforkey: return pointer (i.e. return value not nil / null / 0 ) key exists , has value (which returned). yes, can do: ...

jQuery return the first match in a select list -

i want select first option in select list matches value, last match selected, so: jquery('.edit-item').click(function(){ var id = jquery(this).attr('id'); var assignee = jquery('#assignee-'+id).text(); jquery('#edit-form-'+id+' select[name=item[responsible]]').val(assignee); return false; }); <select name="item[responsible]"> <option value="*">anyone</option> <option value="'+$user+'">me ('+$user+')</option>') -- here loop groups -- <option value="">----------</option> <option value="'+$group+'">'+$group+'</option>') -- here loop usernames within $group <option value="'+$username+'">'+$username+'</option>') -- end loop -- -- end loop -- </select>') now if enduser assignee user selected in group in, , n...

jquery - track the value o textbox -

hi have textbox hidden. and chenge value based on clicks inside page. i want track somehow value when value 0 call ajax. i tried using .change not working does have idea you need hook click events changing hidden field's value. in handler events, call function checks hidden value , call ajax function if it's 0.

sql - How to change time part of a datetime value with doctrine? -

i need change time part of datetime in database. what got in database: '2010-01-01 01:00:00' need update '2010-01-01 03:00:00' thing have '03:00:00' as i'm using doctrine iterate through objects decrease perfomance. tried was: $q = doctrine_query::create() ->update('something s') ->set('start_at', 'dateadd(datesub(start_at,hour_second time(start_at)), hour_second ?)', $doctrine_article->start_time) ->set('start_at', 'dateadd(datesub(end_at,hour_second time(end_at)), hour_second ?)', $doctrine_article->end_time) ->where('s.some_id = ?',$doctrine_article->id) ->andwhere('s.start_at > ?',$current_date) ->execute(); ( update ) explain bit more: tried remove time part of current datetime, '2010-01-01 00:00:00' , add given time ('03:00:00') @ end should wa...

testing - Know of any Firebird profilers and/or stress tester app's? -

i'm looking som testing programs firebird db server, stress-test , find bottlenecks. something db-optimizer , firebird nice. can separate programs, 1 stress-testing , 1 profiling. you may : sinatica monitor ibsurgeon tools ibexpert and can request monitoring tables (firebird 2.1)

asp.net - Why does my WebPage Change When I put it on IIS -

i write asp.net applications living. @ page through debug (localhost) , looks fine, once put files on iis , view page: things different. controls shifted, , widths changed. exact same css , html. is asp server issue or iis or what? uncheck "display intranet sites in compatibility view" under "compatibility view settings"

objective c - Why does my array stay empty? -

hi i'm objc noob. have problem filling nsmutablearray objects. for(id p in tmparray){ person *person = [[person alloc] init]; person.usrname = p; [persons addobject:person]; // after line persons // array still empty [person release]; } persons property nsmutablearray , problem it's empty. release of person object or have instanciated wrong? you need initialize array in -init method, this: nsmutablearray *array = [[nsmutablearray alloc] init]; self.persons = array; // automatically retained // because you're using property [array release]; // alloced - release don't forget release it: -(void)dealloc { self.persons = nil; // previous value of property 'persons' released [super dealloc]; }

actionscript 3 - Actionscript3: add and remove EventListeners (with dynamic name and dynamic variables) -

picture: http://yfrog.com/1rcheckerboardflashvraagjg hey all! i making boardgame in flash action script 3 each position on board buttons this: button_1_1, button_1_2 etc. whenever character selected want move script has add event listeners positions around selected unit // function adds or deletes event listener function listentobutton (istrue:int, position_x:int, position_y:int):void { var myfunction:function = new function; myfunction = function ():void {userclickedposition(position_x, position_y)}; if (istrue == 1) { this["button_position_"+(position_x)+"_"+(position_y)].addeventlistener(mouseevent.click, myfunction); } else { this["button_position_"+(position_x)+"_"+(position_y)].removeeventlistener(mouseevent.click, myfunction); } } in rest of code have: function userclickedposition(position_x:int, position_y:int) selects or deselect unit function selectunit(position_x:int, positi...

Android: java.lang.IllegalMonitorStateException: object not locked by thread before wait() -

i have this code android stuck @ synchronized statement. if remove process1.wait() catch exception.any appreciated? private class longoperation extends asynctask<string, void, string> { @override protected string doinbackground(string... params) { try { process process1 = new processbuilder("sh", "/data/local/bin/tcpdump.sh").start(); synchronized(process1){ process1.wait(); } } catch (exception e) { log.e("tcpdump function error", "unable capture packets buffer"); } return null; } /* (non-javadoc) * @see android.os.asynctask#onpostexecute(java.lang.object) */ @override protected void onpostexecute(string result) { try { stringbuffer output = new stringbuffer(); file file = new file("/data/...

sql server - How do you get to limits of 8060 bytes per row and 8000 per (varchar, nvarchar) value? -

comining question " 8078 bytes in 8060 b datapage (sql server)? " explained me how derive 8078 bytes of data per page in ms sql server. if calculate number of bytes per page used data storage (without overhead) of 1 row 1 column of non-indexed fixed-size type record (as per msdn article estimating size of heap ), come 8087 bytes (per page). how to limits of 8060 bytes per row (mentioned in other question's answers) , 8000 bytes per (varchar, nvarchar) without buying , studying 1000+ page books? i missing in storage allocation: fewer chunks manage, more overhead... inside storage engine: anatomy of record this sql server 2005 record header 4 bytes long two bytes of record metadata (record type) two bytes pointing forward in record null bitmap fixed length portion of record, containing columns storing data types have fixed lengths (e.g. bigint, char(10), datetime) null bitmap two bytes count of columns in record variable number of bytes ...

.net - Using http request on Yahoo Map Service C# -

i'm using yahoo map service display static image of location latitude , longitude suppiled, , work fine. but wondering if possible send url request service return image multiple markers on image? (ie. more 1 locations marked). if know how this, please help! thank much! ps. developing application windows mobile using .net cf 3.5 windows mobile 6 professional target platform. httpwebrequest ought able provide capability

wcf - Host .svc file on ASP.NET Development Server -

is possible host .svc file on asp.net development server? how? yes. if project type regular library project 1 way create website project , copy svc file + corresponding service dll's bin folder project. then, when run solution (f5), find website hosted in cassini (asp.net development server) the catch virtual port different everytime run solution. however, can specify project run on specific virtual port well. refer link on how can that

algorithm - Transmitting hand-written information over a network -

a teacher writing on blackboard , want pass information on blackboard on low-bandwidth network in real-time. how it? in 1 interview, faced question. i have feeling question worded such no other computers used. if had guess, interviewer wanted interviewee realize sending snapshot of entire board 20 times second bandwidth intensive. instead, maybe realize piece of chalk can write on 1 section of board @ time, , relatively write - write bunch of stuff before erasing. our low bandwidth, might want send current position of chalk several times second, , on our receiving end, keep drawing pixels wherever chalk is. way sending 20 x,y pairs second rather 20 entire bitmaps.

jquery ajax call for asp.net mvc application getting two unauthorized reponses then Ok -

i executing following jquery ajax call asp.net mvc controller works, on firebug console seems getting executed 3 times. first 2 times returns 401 unauthorized , final time return 200 ok. shed light on happening when make request , how stop inital calls failing. $.ajax({ type: 'post', url: '/core/getvariableset', datatype: 'json', data: {}, success: function(response) { thisobject.date = new date(response.date); thisobject.userid = response.userid; thisobject.username = response.username; }, error: function(xmlhttprequest, textstatus, errorthrown) { util.errorhandling.ajaxerror($('#main'), 'error getting variables', xmlhttprequest, textstatus, errorthrown); } }); i noticed happening me when debugging in firefox. fix found add site 'network.automatic-ntlm-auth.trusted-uris...

iphone - IBOutlet keyword strictly required? -

i pretty new iphone programming therefore apologize if question result trivial or obscure. in many examples , tutorials have seen in declaration of outlets within xcode (interface section of view controller) keyword "iboutlet" used or not, in conjunction class outlet belongs to, apparently without relevant difference. e.g. iboutlet uibutton * mybutton; or uibutton *mybutton; i have seen myself in experiments both ways seem work same (provided in both cases set proper connections in ib, , declare property , synthesize it) anyone tell me if there relevant difference , different behavior between 2 statements? thank you iboutlet defined following way: #define iboutlet so has no impact on running code, , purpose allow interface builder automatically determine while parsing class header. without iboutlet keyword in header need declare in ib inspector's identity tab make avaliable connected interface elements.

css div height setting to zero -

i have problem hidding div container... there attribut called "visibility" can set "hidden". div container hides, container ... there white space... there possibility remove space? because belong container, theres text .... if container hides, there's gap.... need remove gap thx responding :) try display:none the difference described here

actionscript 3 - Draw shadow without filter on Graphics object -

i have complex graphics data on sprite or shape (no matter exactly). want draw shadow (inner too) 1 rect ( [10, 10, 240, 25] example) or path. /// code before grobj.graphics.drawrect( 10, 10, 240, 25); /// -> draw inner shadow on objcect somehow /// code after is possible perform w\o filters? ps. http://ipicture.ru/uploads/100927/rhzf1k6exu.png solving: bitmapdata(*).applyfilter( *,*,*,*); // play function :) also http://help.adobe.com/ru_ru/as3lcr/flash_10.0/flash/display/bitmapdata.html#applyfilter () i'm assuming don't want add filters object because plan on adding colortransform , not want filters change color. if that's case can separate filter creating sprite of same size original, add drop shadow filter new sprite hideobject parameter set true. //display object var grobj:sprite = new sprite(); grobj.graphics.beginfill(0xff0000, 1); grobj.graphics.drawrect(0, 0, 240, 25); grobj.graphics.endfill(); //filter object var dsfi...

jquery - jqGrid prevent pager navigation? -

we use custom formatter output html form text boxes. in case user has entered in data , hit next/prev button, want tell them "you've edited data, hit ok stay on page , save data". how can this? the ' onpaging ' event fires when use pager doesn't seem let prevent pagination occuring. update: current workaround: var currpg = 1; var dirty = 'false'; $("#list").jqgrid({ ... onpaging: function (b) { var nextpg = $("#list").getgridparam("page"); if (dirty == 'false') { currpg = nextpg; return; } $( "#dialog-confirm" ).dialog({ modal: true, buttons: { "stay on current page": function() { $( ).dialog( "close" ); }, "change page": function() { $( ).dialog( "close" ); reloadgrid($("#list...

Bit Array in C++ -

when working project euler problems need large (> 10**7) bit array's. my normal approach 1 of: bool* sieve = new bool[n]; bool sieve[n]; when n = 1,000,000 program uses 1 megabyte (8 * 1,000,000 bits). is there more efficient way use store bit arrays bool in c++? use std::bitset (if n constant) otherwise use std::vector<bool> others have mentioned (but dont forget reading this excellent article herb sutter) a bitset special container class designed store bits (elements 2 possible values: 0 or 1, true or false, ...). the class similar regular array, but optimizing space allocation : each element occupies 1 bit (which 8 times less smallest elemental type in c++: char). edit : herb sutter (in article) mentions that the reason std::vector< bool > nonconforming pulls tricks under covers in attempt optimize space: instead of storing full char or int every bool[1] (taking @ least 8 times space, on platforms 8-bit chars), it pac...

Is there a function to find the absolute root path in php? -

for example: /home/mydomain.co.uk/public_html/ something generic windows or linux? id produce root path regardless of call script from. not absolute root path script. sorry hard understand. $_server['document_root']; work on both

iis - What's the best way to redirect an entire classic ASP website to a new domain? -

i need redirect entire classic asp based website new domain whilst still maintaining search engine ranking of old site. i think 301 redirect required not sure best way of doing don't think .htaccess works on iis windows based server. i prefer not have change existing asp files individually there quite few. any suggestions great. thanks in advance. i not know if there better method, using iis permanent redirect: go "home directory" tab of site properties select option "a redirection url" enter " http://yournewurl $s$q" in "redirect to" text box check both options "the exact url entered above", , "a permanent redirection resource" so requests http://youroldurl/path/page?querystring permanently redirected http://yournewurl/path/page?querystring more details can found here . ps: above steps ii6, iis 7 might differ, can't recall. update: using 404 direct following in default page , 404...

.net - Generating fake instances at runtime -

i'm looking utility class generate fake entity instances @ runtime. i'm implementing asp.net mvc3 website using ef4 code-first approach, i'd run site before creating database. fake instances should contain valid data (hopefully reflecting various dataannotation attributes used in each class definition). are looking framework fakeiteasy ? description taken website: a .net dynamic fake framework creating types of fake objects, mocks, stubs etc. * easier semantics, fake objects - fakes - use of fakes determines whether they're mocks or stubs. * context aware fluent interface guides developer. * full vb.net support. designed ease of use , compatibility both c# , vb.net.

Do I need to grab a PHP class object in every method in a class? -

i working on php classes, have session class used set , values session variables, need have access session class object in every other class made singleton method in session class , in other class's methods can call session object this.... $session = session::getinstance(); this return session object me use or else start new session object if 1 has not been started yet. so question, if have user class , database class , each class had 10 methods in each needs access session object, need run code above inside each , every method or 1 time inside class , methods have it? new not sure??? thanks in singleton pattern, indeed have that. an alternative might add session object protected member $session of class in constructor, , accessing each method $this->session . if want read broader discussion how arrange , use helper , library objects in php, asked related question once yielded interesting answers.

iphone - Question about changing the first view my app loads -

starting top, making application in new project section of xcode, new view based application, using core data storage. xcode awesome job of populating lots of useful code me when click build, have bar @ top edit , add buttons, , plain uitableview blank. question concerns how might go making simple view first 1 loads. have editable uitableview second view in drill down sequence, more user friendly welcome tableview doesn't have edit , add buttons on bar, launch first. user can click on row in first view, lead them screen first. have tried making new class corresponding .xib file, , referencing in mainwindow.xib file referencing rootscreen.xib, didn't work. thoughts or suggestions appreciated, thanks! there number of useful tutorials started. one simple approach create new view using interface builder - class have created. now in first tableview, need place code in the didselectrowatindexpath call next tableview. if class subview you along lines of... subv...

iphone - Xode build warning and "method not found in protocol" when method signature does exist -

when try invoke instance of class implements particular protocol, warnings method not being found in protocol's signature. warning: '-requestcompleted:requesttype:' not found in protocol(s) warning: 'nsobject' may not respond '-requestcompleted:requesttype:' i couldn't see reason warning copied these classes no changes separate project. when build new project, no warnings generated. when execute code in original project, works fine -- it's warnings shown during build , want them go away. i've tried cleaning build targets , removing files in build directory. not seeing that's causing warning? // file one @protocol responseprotocol - (void)requestcompleted:(nsdictionary *)responsedata requesttype:(connrequesttype)lastrequesttype; @end how i'm calling it: @interface baseclass : nsobject __weak nsobject <responseprotocol> *delegate; } - (void)dosomething; @end @implementation baseclass ...

c# - Linq OrderBy Attribute Value and Group -

i have table headers read in db using linq in c#. of these headers, there @ least 1 same; total , want on right. so here sort of how data laid out: data { label, value, age //not used } sample data: {"dog", 7} {"cat", 3} {"other", 4} {"total", 14} i'd order labels in order; actual animal names sorted value in descending order , total appended end: "dog", "other", "cat", "total" how do in linq. how order attribute based upon value of attribute? once have order of headers, there easy way order future rows based upon determined order. if want find headers where(x=>x.age > 20) how can sort labels in where(x=>x.age <= 20) based upon same ordering >20 set? this query should work: var query = row in table let ignore = row.label == "total" orderby ignore, row.value descending select row.label; //and corresp...

mysql - How can I simultaneously query all blog options table in a Wordpress multisite installation (3.0)? -

in our wordpress 3.0 multi-site installation, have custom option of our blogs called 'platform'. admins can enter in value platform when creating or editing blog. blogs may have no platform. we need able create list of platforms, , associated blogs. problem is, dynamically create , delete blogs through other site mechanisms, have lots of blog options tables numbers not contiguous. (ie wp_2_options, wp_4_options, wp_12_options, etc.) my question this, there way in wordpress grab option across blogs? conversely, there query run manually? i've tried no effect: select * (select table_name information_schema.tables table_name 'wp_%_options') t option_name='platform' does make sense i'm trying do? again, apologize lack of mysql knowledge, haven't been able find answers how this. query these table names first, , query each table separately, thats not option because have many blogs, , may need run query many page requests simultaneously, , ...

What should an XML post request look like for WCF RESTful service with a single parameter? -

i having trouble working out xml should when performing post request through wcf rest services. when using datacontract have no problem @ when want send across 1 parameter example int, following error - "the remote server returned error: (405) method not allowed. " [operationcontract] [webinvoke(uritemplate = "/deleteuser", method= "post")] bool deleteuser(int userid); what should xml like? thanks in advance dj -- way i've found asking swipe example link. uses stream class bring in post parameters in body of http request. have slog through manually... hope this helps.

asp.net - What is the difference b/n Session and Application objects? -

i know session single user , , application multi user purpose.the data in application object shared. right? how can access application data client. if concept wrong what's right? a client cannot access directly application object. server need send data client (the way depend entirely on scenario). application same static dictionary thread safe.

dynamic html buttons in javascript code -

so using javascript, jquery, , html here. have dynamic number of buttons being created, , each call function using unique variables. variables held in json variable. here code is: var box = "<font size=\"2\">the following assassins in current location:<br/><table width = \"100%\">"; (var i=0; i<info.length; i++) { if(userid != info[i].playerid){ box += "<tr><td>"+info[i].name+" | rank: "+info[i].rank+"</td><td align=\"right\"><input id='attack' type='button' onclick='loadattack(userid, info[i].playerid, info[i].name, info[i].rank, location)' value='attack'/></td></tr>"; } } box += "</table></font>"; $("#assassinbox").html(box); the box looks fine, proper names, ranks, , buttons. problem when button pushed, info undefined. ...

asp.net - How to vertically stack two HTML buttons without a table? -

what easiest way vertically stack 2 html buttons without table? doesn't easier than <input type='button' ... /> <br /> <input type='button' ... />

performance - WCF connections close very slowly with SSL -

we have wcf services operate on multiple protocols different customers. work fine, when use ssl connections take long time close. opening connection no problem, closing slow. the strangest behavior close time proportional amount of data transmitted on connection. if few bytes sent server client connection close instantly, search returns several hundred rows takes long close connection original search. close time seems directly proportional amount of data transmitted. seems results retransmitted server verification before connection close. an error never thrown, connection close time doubles required time execute call. here basic settings: custom binding binary encoding reliable session, ordered=true binding element httpstransportbindingelement using remotecertificatevalidationcallback all of proxies constructed programmatically channelfactory. we found problem reliablesession. reliablesession tries verify sent in next connection. sounds idea, worthless because if f...

python - More pythonic way to write this? -

i have code here: import re def get_attr(str, attr): m = re.search(attr + r'=(\w+)', str) return none if not m else m.group(1) str = 'type=greeting hello=world' print get_attr(str, 'type') # greeting print get_attr(str, 'hello') # world print get_attr(str, 'attr') # none which works, not particularly fond of line: return none if not m else m.group(1) in opinion cleaner if use ternary operator: return (m ? m.group(1) : none) but of course isn't there. suggest? python has ternary operator. you're using it. it's in x if y else z form. that said, i'm prone writing these things out. fitting things on 1 line isn't great if sacrifice clarity. def get_attr(str, attr): m = re.search(attr + r'=(\w+)', str) if m: return m.group(1) return none

jquery - How do you completely unload a swf (sounds and all) using javascript? -

so, have web page uses javascript let user select different audio files listen (using player: http://www.macloo.com/examples/audio_player/ ) works great in every browser except version of ie. after audio starts playing can't figure out programmatic way make audio stop playing after user clicks on item listen to. don't have access source of swf i'm trying use javascript this. went far replace entire body of page - $("body").html("blank") - still played audio loaded swf in it's entirety. is there way can remove swf page (sound , all) using javascript? you try location.href = location.href; that reload page.

Why does my server keep creating new files with 0640 permissions in my PHP fwrite? -

i'm using simple fopen("w") , fwrite setup write new file on server. recently, has been arbitrarily assigning 0640 permissions these files, means can't view them browser. it's not happening every time. can tell me why? i'm missing here? here's code: if ($file=fopen("$filesdir/$yr/$mo/{$tempfile[0]}.xml","wb")) { if(fwrite($file,$output,strlen($output))) { $success="yes"; $message="file built."; } else { $message="could not write xml file."; } } else { $message="could not open file."; } i venture guess might have umask, or current permissions of directory creating file in. try adding sticky groups directory , keeping group www-data or apache (depending on install)

arrays - Zend_Soap : How to define return type struct in doc block? -

i have web service set using zend_soap, , public methods in web service. fact want return complex type. for instance, if want return bidimensional array, rowset of table how should specify doc block? 1 of cases. want return array each element having int , 2 strings. like: [0] = {1 , namea, stringa } [1] = {4 , nameb, stringb } [2] = {6 , namec, stringc } [3] = {9 , named, stringd } how can achieve this? how can make more complex by, say, replace 3rd field array of int , string? tia use zend_soap_autodiscover http://framework.zend.com/manual/en/zend.soap.autodiscovery.html with have define complex type class complextype { /*put definitions of class here*/ } and put in phpdoc this /** * * @param int $id * @return complextype */ public function getsomething($id) {

lex - where to find a real example on flex and bison? -

i need n example on flex , bison , can learn how build ast tree , symbol table , semantic analysis postgresql: http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/

java - problem about socket!(client/server) -

i can not why uses 2 different socket please me thanks. the client request file through socket 9123 server, server send file client through socket 8123 on every client listening once requests file. you need explain better that... does each client listen on udp port 8123 , server supposed communicate @ once - if so, that's udp socket , don't have guarantee clients receive file. does each client listen on tcp port 8123 (so server has connect again client asked file in first place?) - not idea, because have client-server connection established (on port 9123 - technically though, once accept() connection in server, communication moves 9123 open high port) - need spawn thread send file , server socket can keep accepting connections other clients. if must receive requests on 1 port , send files on (why?), create new socket after receiving request, connect client, , send file through - need consider why implementing that.

python - Where is the function 'real_ugettext' in django? -

in django.utils.translations.__init__.py : def ugettext(message): return real_ugettext(message) i can't find it. read that file little closer: def delayed_loader(*args, **kwargs): """ replace each real_* function corresponding function either trans_real or trans_null (e.g. real_gettext replaced trans_real.gettext or trans_null.gettext). function run once, first time i18n method called. replaces i18n methods @ once @ time. """ #...

asp.net - Theme a site based on Hostname -

my site has few skins, repsent ui. these skins based on hostname connecting with. as such, each css file, image, etc needs prepended correct folder location. so, thought should put session of user. so, earliest place can/should this. secondly, should remembering in session, or handling per request comes in? (please don't mention app_themes - know them, etc.) why put in session? doesn't make sense me. if needed modify every url came in, create httpmodule. or alternately, create httphandler handling requests of type css, jpg, etc. also... realize default, iis not hand off requests css, images, etc. asp.net process?

Python structure always stuck at 0 no matter what value you assign to it? -

i writing module compact bits passed c program, keep getting errors. after tests, found out field of class blah stuck @ 0 no matter what. know if bug or if i'm doing wrong here? sorry, forgot mention i'm using python 3.1.2 http://www.python.org/download/releases/3.1.2/ >>> import ctypes >>> class blah(ctypes.structure): ... _fields_ = [("a", ctypes.c_uint64, 64), ... ("b", ctypes.c_uint16, 16), ... ("c", ctypes.c_uint8, 8), ... ("d", ctypes.c_uint8, 8)] ... >>> x = blah(0xdead,0xbeef,0x44,0x12) >>> print (hex(x.a) ) 0x0 >>> print (hex(x.b )) 0xbeef >>> print (hex(x.c )) 0x44 >>> print (hex(x.d )) 0x12 >>> >>> g = blah(0x2bad,0xbeef,0x55,0x12) >>> print (hex(g.a )) 0x0 >>> print (hex(g.b )) 0xbeef >>> print (hex(g.c )) 0x55 >>> print (hex(g.d )) 0x12 >>> ...

.net - Error using oracle.dataaccess.dll -

i have web application uses oracle.dataaccess.dll communicate oracle db. web application deployed on 32 bit windows system works not on windows server 2008 64 bit. installed 10204_vista_win2k8_x64_production_db package, referenced installed dll (version 2.102.4.0) project following error: could not load file or assembly 'oracle.dataaccess, version=2.102.4.0, culture=neutral, publickeytoken=89b483f429c47342' or 1 of dependencies. system cannot find file specified. same here. oracle.dataaccess assembly doesn't run in 64 bit mode. you should set application pool site 32 bit mode (go application pool's advanced settings , set allow 32 bit applications "true") if doesn't work, make sure oracle directory (the directory containing oracle dlls) in system path. if forget that, same cryptic error not finding oracle.dataaccess. edit : installing oracle client can major pain. using oracle instant client easier installing full client, do: d...

actionscript 3 - Flash AS3 error when importing 3D-tweened movieclip -

i've been working on as3 application , it's nearing completion. @ same time, 1 of designers work has been building movieclip in separate .fla acts intro animation application. intro uses 3d motion tweening capabilities of flash cs4 / player 10, , runs fine in .fla in built. the problem when import movieclip main .fla application, when dynamically instantiate movieclip , add stage, barrage of following runtime error: referenceerror: error #1069: property null not found on fl.motion.keyframebase , there no default value. at fl.motion::keyframebase/getvalue() at fl.motion::motionbase/getvalue() at fl.motion::animator3d/settime3d() at fl.motion::animatorbase/set time() at fl.motion::animatorbase$/processcurrentframe() at fl.motion::animatorbase$/parententerframehandler() i'm guessing based on number of errors receive there's 1 per keyframe in tweening movieclip. i've checked ensure flash publish settings identical ac...

c++ cli - ...array<Object^>^ args -

i'm reading c++/cli. see stuff: object^ createinstancefromtypename(string^ type, ...array<object^>^ args) { if (!type) throw gcnew argumentnullexception("type"); type^ t = type::gettype(type); if (!t) throw gcnew argumentexception("invalid type name"); object^ obj = activator::createinstance(t, args); return obj; } when calling it: object^ o = createinstancefromtypename( "system.uri, system, version=2.0.0.0, " "culture=neutral, publickeytoken=b77a5c561934e089", "http://www.heege.net" ); what ...array^ args? if remove ... ,there's complied-error: error c2665: 'createinstancefromtypename' : none of 2 overloads convert argument types 1> .\myfourthcplus.cpp(12): 'system::object ^createinstancefromtypename(system::string ^,cli::array<type> ^)' 1> 1> [ 1> type=system::object ^ 1> ] 1> while trying match argument list '(const c...

actionscript 3 - Progress bar in a Flash MP3 Player -

i have coded simple xml driven mp3 player. have used sound , soundchannel objects , method can´t find way of make progress bar. i don´t need loading progress need song progress status bar. canbd me? thanks. update: theres code. var musicreq: urlrequest; var thumbreq: urlrequest; var music:sound = new sound(); var sndc:soundchannel; var currentsnd:sound = music; var position:number; var currentindex:number = 0; var songpaused:boolean; var songstopped:boolean; var lineclr:uint; var changeclr:boolean; var xml:xml; var songlist:xmllist; var loader:urlloader = new urlloader(); loader.addeventlistener(event.complete, loaded); loader.load(new urlrequest("musiclist.xml")); var thumbhd:movieclip = new movieclip(); thumbhd.x = 50; thumbhd.y = 70; addchild(thumbhd); function loaded(e:event):void{ xml = new xml(e.target.data); songlist = xml.song; musicreq = new urlrequest(songlist[0].url); thumbreq = new urlrequest(songlist[0].thumb); music.load(...

cmsmadesimple - Equivalent of ModX chunks -

i'm looking equivalent of modx's chunks in cmsms. i've found global content doesn't appear want. i want able define html, have hidden end user editors using cms edit site, , insert various templates can modx's chunks. you looking user defined tags . they php code blocks can use in templates/global content blocks/content pages.

java - GridBagLayout: how to keep invisible components from collapsing -

when making individual components of layout managed gridbaglayout invisible, arrangement of remaining components in layout keeps changing. gridbaglayout appears "collapse" cells invisible components, causing other components change positions. highly annoying behaviour, , i've been looking way keep doing that. one method i've tried adding spacer same cell, fixed size equal preferred size of component may hidden, if preferred size ever change, lot of trouble keep spacer in sync. there better way? actually, wouldn't bad if gridbaglayout disregard cells invisible components, still takes cell's insets account, if have layout of input fields , used insets neatly arrange them regular gaps in between, hiding 1 component in middle removes layout leaves gap, means surrounding components flow together, ugly double-wide gap between them... what using jpanel (or box) placeholder? put jpanel each cell , add components panels. if turn component invisible,...

android - How to bind more then one column to a textview -

i curious if there way bind more 1 db column resource. need bind more information r.id.secondline difficulty column. i'm unsure how go this? i'm subclassing simplecursoradapter. should subclass adapter? if how go it? cursor activityhikes = mdbadapter.fetchallhikes(false); startmanagingcursor(activityhikes); string[] = new string[] { activityhike.name, activityhike.difficulty, activityhike.thumbnail}; int[] = new int[]{r.id.maintext, r.id.secondline, r.id.icon}; hikeadapter hikes = new hikeadapter(this, r.layout.hike_row, activityhikes, from, to); listview list = (listview) this.findviewbyid(r.id.hikelist); list.setadapter(hikes); thanks for has same problem link helped me alot too. android: binding data database checkbox in listview? i don't think can bind more 1 column view using simplecursoradapter . best bet subclass cursoradapter , implement bindview special formatting want text field.

sql - What GUID can I use as a placeholder -

i have database table has non null column of type uniqueidentifier . put in place use in near future. now, need use placeholder. can use: 00000000-0000-0000-0000-000000000000 for rows until real guid used when new rows inserted in future? sql server enforce uniqueness on column? sql server enforce uniqueness, if , if you put unique constraint or unique index on field. otherwise, sql server enforce value must not null.

java - why doesn't my client read correctly the outputStream sent by the Server? -

it's simple client-server server using bufferedwriter object send client receiving in object bufferedreader . when use outputstream , printwriter server , inputstream , scanner client works well. what happens client in buffered way reads -1 if i'm sending int , null string . i hope english makes sense. ;p that's code: server : import java.io.*; import java.net.*; public class server { public static void main(string[] args) throws ioexception { serversocket server = new serversocket(8189); socket incoming; incoming = server.accept(); try { // outputstream output = incoming.getoutputstream(); // printwriter outstream = new printwriter(output, true /*autoflush*/); // outstream.println("enter"); bufferedwriter output = new bufferedwriter(new outputstreamwriter(incoming.getoutputstream())); output...