Posts

Showing posts from May, 2012

C++ objects in multithreading -

i ask thread safety in c++ (using posix threads c++ wrapper ex.) when single instance/object of class shared between different threads. example member methods of single object of class called within different threads. should/can thread safety? class { private: int n; public: void increment() { ++n; } void decrement() { --n; } }; should protect class member n within increment/decrement methods lock or else? static (class variables) members have such need lock? if member immutable, not have worry it, right? anything cannot foreseen now? in addition scenario single object within multithreads, multiple object multiple threads? each thread owns instance of class. special other static (class variables) members? these things in mind, believe large topic , glad if have resources , refer previous discussions that. regards suggestion: don't try hand. use multithread library 1 boost: http://www.boost.org/doc/li

Grouping PHP Array on 2 or more different values -

i'm creating recent activity section , trying group similar items. want able group activities based on type of activity , did activity. instance: array ( [0] => array ( [user] => bill [type] => photo [id] => 1 [timestamp] => 12345678 ) [1] => array ( [user] => joe [type] => photo [id] => 2 [timestamp] => 12345678 ) [2] => array ( [user] => bill [type] => comment [id] => 1 [timestamp] => 12345678 ) [3] => array ( [user] => bill [type] => photo [id] => 3 [timestamp] => 12345678 ) ) could turn this: array ( [0] => array ( [user] => bill [type] => photo [items] => array (

iphone - Fitting views for Portrait and Landscape for iPad -

i coming onto project looks in landscape view. when switch portrait, looks elements stay , things not resized fit view. of content on pages might not fit in portrait mode @ based on how things laid out in landscape. if want make app in both orientations, best bet play around resizing on size inspector views items fit fine. and views items not fit easily, rethink design , either use ipad functionality popover, or create separate view display data differently instead of resizing? thanks. quite bit can achieved playing resizing controls in ib (especially ones stick control side - may not obvious, "stiking"the control that's on top bottom side). however, more robust solution have method reposition/resize controls depending on screen size (1024x768 or 768x1024). call whenever device rotated. such method quite handy other purposes - e.g. if have view visible (like ad), you'll need resize rest non-full-screen size.

c# - Trying to create a "Fluent" type class using LINQ expressions -

i'd follows, using lambdas , linq expressions in c#. public class foo { private someentity entity; public foo(someentity entity) { this.entity = entity; bar(p => p.firstname); bar(p => p.surname); } public void bar(expression> barexpression) { // here? } } every time call bar(), i'd dig expression, , find out property referring (e.g. firstname or lastname), , someentity object working with. need value of property (this in fact important). eventually i'd extend bar more this, simple can "boil" experiment. thanks! public void bar<t>(expression<func<someentity, t>> expression) { string name = ((memberexpression)expression.body).member.name; } should name; there no instance in p => p.firstname ; this.entity should give want. value t value = expression.compile()(entity)

c# - How to sort depended objects by dependency for maximum concurrency -

i have list of dependencies (or better dag without cycles): input (for example): item depends on nothing item b depends on c, e item c depends on item d depends on e item e depends on what i'm looking is: "what best* parallel order of items?" *best means: maximum concurrency level result (for example): [a], [e, c], [d, b] the best approach seems pseudocode getting order based on dependency think miss basic algorithm on this. this looks lot http://en.wikipedia.org/wiki/program_evaluation_and_review_technique/http://en.wikipedia.org/wiki/critical_path_method assuming want maximum concurrency level thing done possible, once have organised things takes no longer critical path have best possible solution - , if there no limit on amount of parallel tasks can run, can critical path scheduling every action of dependencies have completed.

Google App Engine optional slash redirect -

i have java app running on google app engine... i'd make trailing slash optional directories... navigating www.domain.com/test , www.domain.com/test/ yield same thing. how achieve that? i know app.yaml configuration file running java app not python.. see this post . works me, though looks hack. think worth posting issue google, thee servlet specification requires adding trailing slashes when attempting find proper welcome-file.

C++ simple calculator in QT4 -

i trying create simple calculator in qt4. user inputs 2 numbers , there 4 command buttons calculations. (+ - * /). code is: calculator.h #ifndef calculator_h #define calculator_h #include qwidget #include qgridlayout #include qlineedit #include qlabel #include qpushbutton #include qlcdnumber #include qstring #include qmessagebox #include qerrormessage class calculator : public qwidget { q_object public: //constructor calculator(); public slots: //function add 2 numbers user inputs void addition(); //function subtract 2 numbers user inputs void subtraction(); //function multiply 2 numbers user inputs void multiply(); //function divide 2 numbers user inputs void division(); //function clear widgets void clearfields(); //function close window void close(); private: qlineedit* int1entry; qlineedit* int2entry; qlcdnumber* lineoutput; qerrormessage* error; }; #endif calculator.cpp #include "calculator.h" //constructor calculator::calculator() {

datepicker - Android Date Picker help! -

i need little here. in app user need`s select 1 date interval (when press 1 button), , i'm not know how using date picker! i'm following example: http://developer.android.com/resources/tutorials/views/hello-datepicker.html , have 2 questions tutorial... 1) how can onclick event called datepickerdialog.ondatesetlistener ( in case have 2 edittext when user click in wich one, app shows date picker dialog) 2) how can call onclick 2 times after user press 1 button? tnhx! sorry poor english! so explanation, want create date interval picker 1 click on button. using analogy example have following: // create 2 constants static final int date_dialog_from = 0; static final int date_dialog_to = 1; // create case 2 pickers protected dialog oncreatedialog(int id) { switch (id) { case date_dialog_from: return new datepickerdialog(this, fromdatesetlistener, myear, mmonth,mday); case date_dialog_to: return new datepickerdialog(this, todatese

conditional - How do I create a "just for me" install for an admin user? -

when run install script admin user, puts start menu entries in "all users" profile. want start menu entries placed in current user's profile if admin user , choose install "just me". i can selecting 1 of 2 values #define, can't figure out how create constant conditionally included. have [code] section routine returns true if "just me" install has been chosen. here's scenario: #define startmenulocation = "{somegroup}" ; check justformeinstall #define startmenulocation = "{anothergroup}" ; check allusersinstall ... [icons] name: "{#startmenulocation}\{#myappname}" ; filename: "{app}\{#exename}" ; parameters: "{#commandargs}" ; comment: "starts {#myappname} {#myappversion}" ... [code] function justmeinstall : boolean ; begin result := (installationtype = itjustme) ; end ; function allusersinstall: boolean ; begin result := (installationtype = itallusers) ; end ; wh

regex - expr match problem in shell -

in sh shell script wrote following: opr=+ echo `expr match "$opr" '[+\-x/]'` but error when ran: expr: syntax error what doing wrong? same error when make opr equal - , / . another interesting thing found when wrote this: opr=a echo `expr match "$opr" '[+\-x/]'` it returns this: 1 this means matched string "a" 1 of +, -, x, , /. makes no sense! first case: + + has special meaning expr: + token interpret token string, if keyword `match' or operator `/' second case: a your regexp range operation, matching characters + x , includes alnums. make - matched literally in charclass, must first or last character; backslashing doesn't work.

java - GWT - How to put Widget B on Widget A - help -

i looking someway put widgets on each other (each on layer or something...). swing cardlayout transparent background support. for example i have image img=new image("imagea.png"); html h=new html("<img src=imageb.png>"); how put "h" on "img" left upper corner? any useful comment appreciated you can use absolutepanel . positions it's children @ fixed coordinates can make them overlap.

nhibernate - Castle Automatic Transaction Management Facility persist issues -

regarding castle automatic transaction management facility; i'm having difficulties getting operations save database without flushing session. i'm using following components * nhibernate.dll v3.1.0.4000 * castle.core.dll v2.5.2.0 * castle.windsor.dll v2.5.3.0 * castle.facilities.nhibernateintegration.dll v1.1.0.0 * castle.services.transaction.dll v2.5.0.0 * castle.facilities.autotx.dll v2.5.1.0 i have followed castle documentation closely , have not been able resolve issue. my (web-)application follows mvp pattern. key parts of (transactional) presenter-service shown below: <transactional()> _ public class campuseditpresenter inherits basepresenter(of icampuseditview) public sub new(byval view icampuseditview) mybase.new(view) end sub ... <transaction(transactionmode.requires)> _ public overridable sub save() implements icampuseditpresenter.save ' simplified using session isession = _sessionmanager.

c# - How to parse .Net Webservice on iphone with Authentication -

i trying fetch xml using nsmutablerequest , nsurl connection receiving 0 bytes when passed ?wsdl in link in response schema, want fetch xml , parse using touchxml. code below. nsstring *username = @"username"; nsstring *password = @"pasword"; nsstring *soapmessage = [nsstring stringwithformat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:envelope xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xmlns:xsd=\"http://www.w3.org/2001/xmlschema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:header>\n" "<requestauthenticator xmlns=\"http://tempuri.org/\">\n" "<password>%@</password>\n" "<userna

silverlight - Visifire inquiry -

i making bar graph in visifire , want make custom legend. achieved custom legend want stack vertically. here code: <visifire:chart.plotarea> <visifire:plotarea shadowenabled="false"></visifire:plotarea> </visifire:chart.plotarea> <visifire:chart.legends> <visifire:legend x:name="legend0" height="30" width="50" horizontalalignment="right" verticalalignment="top" entrymargin="5" fontsize="10" fontweight="bold" shadowenabled="false" borderthickness="0" background="transparent" lightingenabled="false" /> </visifire:chart.legends> <visifire:chart.series>

java - To convert current time to utc format in samsung galaxy 5 -

i want convert current phone time utc format while posting message.my code doesnt works in samsung galaxy 5.in samsung current time not converted.below code simpledateformat sdfdatetime = new simpledateformat("yyyy-mm-dd hh:mm:ss"); sdfdatetime.settimezone(timezone.gettimezone("utc")); string newtime = sdfdatetime.format(new date(system.currenttimemillis()));

rubygems - I use the rvm1.8.7,but when i use to install the rails v=2.3.11 it throws the error -

error: not find valid gem 'rails' (= 2.3.11) in repository any 1 me pleace use gem install rails -v=2.3.11 or gem install rails --version=2.3.11

Problem with using importcsv module in yii framework -

i trying use importcsv module in yii framework per documentation here: http://www.yiiframework.com/extension/importcsv/ after installing module, tried using going url http://localhost/index.php?r=importcsv/default/ i got page import csv file. when clicked on import csv button , chose csv file, following error: ============================ object not found! the requested url not found on server. link on referring page seems wrong or outdated. please inform author of page error. if think server error, please contact webmaster. error 404 localhost 21/07/2011 4:26:41 pm apache/2.2.17 (win32) mod_ssl/2.2.17 openssl/0.9.8o php/5.3.4 mod_perl/2.0.4 perl/v5.10.1 ===== i not find error. had used module in yii framework successfully. please let me know clue on have gone wrong. this module has given many horrors install. what worked me going module/importcsv/assets folder , opening download.js file. at line 8 changed action url to: '?r=importcsv/default/upl

iphone - how to stretch a UITextField on begin editng -

i want increase size of uitextfield when editing begins, cant code it. gomathi correct. add answer if want textfield expand when editing begins , shrink again when editing ends , want animate it, might wanna this: - (bool)textfieldshouldbeginediting:(uitextfield *)textfield { [uiview animatewithduration:0.5 animations:^{ textfield.frame = cgrectmake(textfield.frame.origin.x-20, textfield.frame.origin.y, textfield.frame.size.width+40, textfield.frame.size.height); }]; return yes; } - (bool)textfieldshouldreturn:(uitextfield *)textfield { [uiview animatewithduration:0.5 animations:^{ textfield.frame = cgrectmake(textfield.frame.origin.x+20, textfield.frame.origin.y, textfield.frame.size.width-40, textfield.frame.size.height); }]; [textfield resignfirstresponder]; return yes; }

readonly - Why does Linq need a setter for a 'read-only' object property? -

i'm using linq datacontext.executequery("some sql statement") populate list of objects var incomes = db.executequery<incomeaggregate>(sqlincomestatement(timeunit)); the incomeaggregate object made hold result of records of query. one of properties of object yqm: public int year { get; set; } public int quarter { get; set; } public int month { get; set; } public string yqm { { return string.format("y{0}-q{1}-m{2}", year, quarter, month); } } ... more properties everything compiles ok, when executes linq following error: cannot assign value member 'yqm'. not define setter. but clearly, don't want 'set' it. y, q , m provided query database. yqm not provided query. need change definition of object somehow? (i've started using linq , i'm still getting speed, simple) well, wound making setter private public string yqm { { return string.format("y{0}-q{1}-m{2}", y

build - Visual Studio compiles some files every time (even when no changes are made) -

i've been developing application on vs2008 , went well. made alterations, on name of solution , projects, , that's when started going crazy following behavior: i clean solution; every file recompiled (normal here); i make no changes whatsoever in any file , vs compile set of files again; still no changes made, same files recompiled every time. if has idea of might going on, fantastic. if not, kind of tests can investigate further? thanks edit: the language used c++ cuda extensions; the files being compiled every time .cu files probably file had had file modification date in future, , after saved them date became in past.

c# - Ria Services and navigation property issues -

i'm encountering issue using silverlight4, ria services , entity framework. from sl client try data through ria services, in domainservice class method gets called: public iqueryable<lastminutewachtlijstpromotie> getlastminutewachtlijstpromoties(){ iqueryable<lastminutewachtlijstpromotie> list = (iqueryable<lastminutewachtlijstpromotie>)this.objectcontext.lastminutewachtlijstpromoties.include("promotie"); return (from lastminutewachtlijstpromotie lwmp in list lwmp.actief select lwmp); } when check contents of list, in debug mode, it's filled objects of type lastminutewachtlijstpromotie. these objects have navigation property object named promotie. , can access properties of these promotie objects. on silveright client method gets invoked when loading complete: public void onloadentitiescompleted(serviceloadresult<t> result) { } in method requested lastminutewachtlijstpromotie objects expected, property promotie null. i h

java - Fast factoring algorithms? -

how can find factors of number? e.g.: digit: 20 factors: {1*20, 2*10, 4*5, 5*4, 10*2, 20*1} this problem no solution known. reason, rsa encryption depends on computational difficulty of factoring numbers. see: integer factorization however, may able speed algorithms given looking @ numbers square root of n , , checking if factors checking if n % == 0 . if true, can find corresponding factor greater n^(.5) taking n / i .

How to create a mootool tooltip with Ajax response -

how create mootool tooltip ajax response.anybody can please suggest me tutorial same. what have tried far? you way btw: set inside parent tippable elements data-attribute store url (needed retrieve tooltip ajax) i.e.: <div class="tippable" data-tipurl="/some/url/"> when mouseover here, tip appears </div> then, js, create , cache tips i.e.: $$('div.tippable').each(function(tippable){ tippable.addevents({ 'mouseenter' : function(){ if(!this.retrieve('tip')){ //first time, build tip! var tip = new element('div.tip'); tip.set('load',{/* options */}); tip.load(this.get('data-tipurl')); //get through ajax tip.inject(this, 'top').setstyles({ //set tip style position : 'absolute' /* etc... */ }); this.store

MongoDB :How to query the item in a list of itmes that is list type? -

test code: [ { "_id": { "$oid": "4e27f4c0cfdb4a09b8ace1dd" }, "description": "no.000001", "title": "pm:000001", "age": 14, "commentlist": [ { "_id": { "$oid": "4e27f4c0cfdb4a09b8ace1da" }, "content": "hello:00001", "creator": "jack00001", "date": "2011-7-21 0:00:00", "indate": { "$date": 1310400000000 } }, { "_id": { "$oid": "4e27f4c0cfdb4a09b8ace1db" }, "content": "hello:00002", "creator": "jack00002", "date": "2011-7-21 0:00:00", "in

c# - Does using namespaces affect performance or compile time? -

if put classes of project in same namespace classes available everywhere in project. if use different namespaces not classes available everywhere. restriction. does using namespaces affect compile time somehow? since compiler has less classes in each namespace , not namespaces used time may have little less trouble finding right classes. will using namespaces affect applications performance? it won't affect execution-time performance. it may affect compile-time performance, doubt significant @ all, , wouldn't predict way affect it. (do have issue long compile times? if so, may want try , measure difference... otherwise won't know effect. if don't have problem, doesn't matter.)

Formatting Field values using itextsharp -

how can have string format "i fine here" using itextsharp fields.setfield("tgpara2", message2); message "i fine here" want fine word bold. itext has partial support "rich text values" text fields. can , set rich values, itext won't draw values properly. need turn off setgenerateappearances , , open pdf in acrobat/reader see rich text. this means flattening isn't going work (unless open pdf in acrobat, save again... clunky). you might want check out pdf specification (section 12..7.3.4 rich text strings) further information on , isn't legal. <b> legal, font-weight css style

windows - Is the Azure role host actually restarted when a role crashes or is restarted via management API? -

suppose azure role somehow exhausts system-wide resources. example spawns many processes , processes hang , consume virtual memory in system. or creates gazillion of windows api event objects , fails release them , no more such object can created. mean except trashing filesystem . now changes describe cancelled out once normal windows machine restarts - processes terminated, virtual memory "recycled", events , other similar objects "recycled" , on. yet there's concern. if host not restarted, goes through other process when hit "reboot" or "stop", "start"? is host rebooted when restart role or reboot instance? when reboot instance, vm rebooted. when stop , start, vm not rebooted, process restarted.

zend framework - isAllowed() is not taking the parameters value -

class application_plugin_accesscheck extends zend_controller_plugin_abstract { private $_auth=null; private $_acl=null; public function __construct() { $auth = zend_auth::getinstance(); $acl = new zend_acl; $this->_auth = $auth; $this->_acl = $acl; } public function predispatch(zend_controller_request_abstract $request) { $resource = $request->getcontrollername(); $action = $request->getactionname(); $identity = $this->_auth->getstorage()->read(); $role = $identity->role; if(!$this->_acl->isallowed($role,$resource,$action)){ $request->setcontrollername('auth') ->setactionname('login'); } //echo '<pre>';print_r('inside plugins......success');die(); } } acl plugin page usi

apache - change rails app from webrick to passenger -

need moving rails app webrick passenger apache. im new , cant running passenger. have tried bunch of guides , not getting errors apart rails server using webrick instead of passenger. working on mac mini osx server i seen osx comes version of mac installed read online should load newer copy make sure installed apache not running in system preferences/sharing/web sharing. then brew install apachetop . followed gem install passenger , passenger-install-apache2-module . i follow instructions passenger in terminal asks me place code in httpd.conf file. find in /ect/apache2 root. i add virtual host info apache config file /public/mom location of rails app. <virtualhost *> servername localhost:3000 documentroot /public/mom railsenv development <directory /public/mom> allowoverride options -multiviews </directory> </virtualhost> i make sure apache running sudo apachectl start , try running rails server still runs

Telerik Silverlight RadPanelBar Hierarchical Data Template -

Image
i need display following layout telerik panelbar. with code below able achieve except 92% stuff in each panel. xaml: <usercontrol.resources> <datatemplate x:key="panelbaritemtemplate"> <grid x:name="grdcategory" showgridlines="true"> <grid.rowdefinitions> <rowdefinition height="30"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="60*"></columndefinition> <columndefinition width="40*"></columndefinition> </grid.columndefinitions> <grid x:name="grdsubcategory" grid.column="0" style="{staticresource categoryleftstyle}" > <grid.rowdefinitions> <rowdefinition height="20"></rowdefinition>

c# - How to check the particular section or key word exist in appconfig file -

i have added own section <section listeners> in app.config file. how can check, programmatically, if new section exist? section = configurationmanager.getsection("sectionname") sectiontype section null if section isn't there.

branching and merging - How can I recover from "fatal: Out of memory? mmap failed: Cannot allocate memory" in Git? -

let me start context: i had upgrade crucial magento webshop new version. sure existing code still work after upgrade , make post-upgrade changes made git repository entire magento installation (excluding obvious content 4.5gb of images, ./var directory etc.), pushed origin , cloned on dev server. made new branch, performed upgrades, made code changes, committed dev branch , pushed origin. now time has come upgrade 'real' shop, meaning have merge master branch on production server dev branch. , everyhing goes wrong: git fetch - works git branch says: * master git merge origin/dev goes horribly wrong (only output after waiting): fatal: out of memory? mmap failed: cannot allocate memory same goes git checkout dev , git rebase master origin/dev etc. did research here on stackoverflow in existing questions , spent evening of trying suggestions, including (but not limited to): git gc counting objects: 48154, done. delta compression using 2 threads. compres

objective c - iPhone NSURLConnection initialization problem -

what difference between 2 lines, in different apps first 1 seems work , have problems second one; , 1 should choose on another? app receive , send data webservice. nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:therequest delegate:self]; nsurlconnection *theconnection = [nsurlconnection connectionwithrequest:request delegate:self]; and should release connection object, after every didfinishloading? doesn't take time on every request connect? the first 1 instance of nsurlconnection take ownership of object, have responsibility , hence must release it. details on ownership reference . the second 1 auto-released object dont need release it. released automatically when auto-release pool drained.

Android Application vs Activity -

i have written few android apps, , have declared starting activity the: <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> it great scoping global methods, statics, shared prefs, etc if start app using application calls first activity it's oncreate() after setting prefs, etc, haven't been able find examples of design pattern... when try in code, classcastexception : public class myapplication extends application { @override public void oncreate() { super.oncreate(); // stuff (prefs, etc) // start initial activity intent = new intent(this, initialactivity.class); startactivity(i); } } initialactivity.class indeed activity works fine if set main , trying start myapplication declared main generates error. silly question, tackling wrong? thanks, paul you can fix

java - DBCL message on console -

i creating database connection pool following properties. <bean id="complianceccrdatasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close" lazy-init="false" > <property name="driverclassname" value="net.sourceforge.jtds.jdbc.driver" /> <property name="username" value="${deshaw.compliance.ccr.db.username}" /> <property name="password" value="${deshaw.compliance.ccr.db.password}" /> <property name="url" value="${deshaw.compliance.ccr.db.url}" /> <property name="initialsize" value="5" /> <property name="maxactive" value="10" /> <property name="maxwait" value="60000"/> <property name="testonborrow" value="true" /> <property name="validationquery">

CakePHP model belongs to any other model -

i not sure correct title. here problem: there several models such as: company person (not same users) user etc. some of them needs have 1 or more files attached them. so have created uploadedfile model. how link of above models? uploadedfile belongs company . uploadedfile belongs person if uploadedfile belongs company , doesn't belong others person . all uploadedfile belongs user (because upload them , need track uploaded it) does habtm works here? other better ways? thank help. best regards, tony. make uploadedfile belog 3 (user, company , person): var $belongsto = array( 'user' => array('classname' => 'user','foreignkey' => 'user_id'), 'company' => array('classname' => 'company','foreignkey' => 'company_id'), 'person' => array('classname' => 'person','foreignkey' => 'person_id'));

algorithm - JT file format : Building huffman tree -

i trying read jt file. jt file may have information compressed using huffman algorithm. facing problem while building huffman tree. there's ambiguity in implementation occurs when 2 symbols have same frequency, depending on comparison use between nodes, order may different , leads inversion of branches of tree. unable build proper huffman tree. have faced issue earlier? there solution this? i have faced same issue when tried implement parser jt. didn't solution. tried contact guys siemens without getting solution. there ambiguity can't solved without further information siemens. spec alone doesn't help. think huffman dropped out in newest jt spec.

objective c - Programmatically Disable Mouse & keyboard -

i programmatically disable mouse & keyboard input temporarily on mac (using objective c/c/unix) & reenable them. i have made small open source application allows selectively disable keyboards cgeventtap function os x. inside carbon framework, based on corefoundation, works on lion. example can try open sourceapp multilayout, available here on github . basically need if want is: to use it, need add carbon framework: #import <carbon/carbon.h> then create event tap this: void tap_keyboard(void) { cfrunloopsourceref runloopsource; cgeventmask mask = kcgeventmaskforallevents; //cgeventmask mask = cgeventmaskbit(kcgeventkeyup) | cgeventmaskbit(kcgeventkeydown); cfmachportref eventtap = cgeventtapcreate(kcghideventtap, kcgheadinserteventtap, kcgeventtapoptiondefault, mask, mycgeventcallback, null); if (!eventtap) { nslog(@"couldn't create event tap!"); exit(1); } runloopsource = cfmachportcre

ios - Safari mobile plugin development -

i want develop safari plugin using xcode or else, , want access hardware functions camera, possible? also, there nice tutorials out there plugin development under safari mobile? you can't load kind of plugin on mobile safari. (this why flash doesn't exists yet).

html - Question about AJAX Update Panel -

here problem im having. have 5 buttons on form appear next each other (horizontal). 3 out of 5 buttons had put in update panel b/c these buttons have asyncpostback, other 2 buttons need outside postback. works way accept buttons dont appear on same line. there can put these 5 buttons appear on same line, given different functionality of these buttons? the updatepanel renders <div> need style div that displays inline notice style="display:inline" in following code. there's other ways accomplish depending on layout straightforward. <asp:updatepanel id="updatepanel1" runat="server" style="display:inline"> <contenttemplate> <asp:label id="labeltext" runat="server" text="label" /> <asp:button id="button1" runat="server" text="button1" /> <asp:button id="button2" runat="server" text="

After doing append not able to find the element in Jquery -

hi guys have below code in jquery, create new select on fly , and when try find cannot find . please advice var parent = optionelement.parent(); var strhtml = ""; var tempclass = optionelement.attr("class"); strhtml = "<select name='" + optionelement.attr("name") + "' id='" + optionelement.attr("id") + "' class ='" + optionelement.attr("class") + "' >" + getsearchoptionfiltereddata(sopt, true) + "</select>"; optionelement.remove(); parent.append(strhtml); **alert(parent.find(tempclass).length); <-- gives 0** try: alert(parent.find('.'+tempclass).length); in jquery class selector must prefixed dot . (e.g. .classname ), whereas id selector must prefixed hash/pound sign # (e.g. #myid ), otherwise selector won't work.

textview - Text overlaying with a background color hides the image on Android? -

on android, trying create dynamic image viewer flip images , @ bottom of each image display information image,1 or 2 lines of text max. want give area displays text unique background color let stand up. works fine exception of 1 thing, when set color textview let “black” entire screen black covering image image! , not textview area. please bear in mind create dynamically doing below: imageframe = new framelayout(this); viewer = new imageview(this); imageinfo = new textview(this); imageinfo.setheight(imageinfo.getlineheight()); imageinfo.setgravity(gravity.bottom); imageinfo.setbackgroundcolor(color.cyan); imageframe.addview(viewer); imageframe.addview(imageinfo); any appreciated you might want set height , width dynamically well. guess textview width , height set fill_parent. if doesn't work try adding elements imageframe in different order. below how need set widths dynamically each textview. textview tv = (textview) findviewbyid(r.id.yourtextviewname) view

java - how to Override FocusListener - Swing -

the application work override default jcombobox swing. leets call mycombobox. version of combobox implement focuslistener , contains 2 methods focusgained , focuslost. now, in 1 of panel of application, form contains combobox of type: mycombobox amycombobox = new mycombobox(); i want add listener on : amycombobox.addfocuslistener(new focuslistener() { public void focuslost(focusevent e) { //do here } public void focusgained(focusevent e) { //do else } }); but when run code, never pass these method execute focusgained/lost mycombobox class. is there way add listener on object implements focuslistener? additional focuslistener should work unless instance used in mycombobox consumes event ( awt event consumption ). try making example ordinary jcombobox -- narrowing down cause of problem.

c# - make Footer template visible and invisible in button click -

i have grid footer template. consists of text box in add value , after clicking btnadd value present in footer template append main grid. below footer template. want make footer template visible on clicking btnadd. how make visible , invisible on button click. note: button located outside grid. <footertemplate> <asp:textbox id="txtfactor" style="margin-left: 210px" visible='<%# isineditmode %>' runat="server" > </asp:textbox> you set gridview.showfooter = isineditmode codebehind on button-click. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.showfooter.aspx

How to convert JavaScript code to a xml representation of the ast? -

i building xml serializer of javascript abstract syntax trees antlr. generator quite complete know if there conventions issues such as: how handle angle brackets in strings or regular expressions? how translate if-then-else (e.g. else node inside if 1 or not)? more generally: such translator exist? there existing xsd xml-based language? edit i interested in free tools only. parsers perform code generation xml , generate xml code readily available: custom pmd rules - o'reilly media estools/esvalid: confirm spidermonkey format ast represents ecmascript program jantimon/handlebars-to-ecmascript: convert handlebars ecmascript ast estools/estemplate: proper (ast-based) javascript code templating source maps support. estools/esrecurse: ast recursive visitor estools/estraverse: ecmascript js ast traversal functions estools/escope: escope: ecmascript scope analyzer estools/esquery: ecmascript ast query library. you ask, "does such translator ex

can we put an paid application on itunes which is using opensource libraries? -

i confused can put paid application on itunes using open source libraries? like if use xmppframework can make our application paid application? regards. it depends on licenses under you're using/distributing libraries. if license library allows use in commercial product, yes. read licenses. here's page library. click on licensing info in left tool bar read yourself.

image processing - Book with vslam -

i looking book monocular/visual slam described , implemented. can list , recommend some? i'd use opencv not requirement. i don't know of book description of such algorithm, there's complete open source implementation (in c++) of vslam system available part of robot operating system. uses surf descriptors , vocabulary trees place recognition, , bundle adjustment slam. use opencv heavily it's made same people. see website here. can't sure don't mention , haven't looked in great detail, implementation seems based on, or @ least similar to, this paper. edit: paper linked above written people implemented vslam system given above, appears. resource understanding it.

Adding files to Azure cspkg in afterbuild msbuild event? -

i have mvc application have got working on azure apart getting published .cspkg file include css/jscript created in afterbuild process (this works if publish normal server isn't using azure). in afterbuild process minify , merge files add them deploy zip: <packagelocation>..\deploy\website.zip</packagelocation> <propertygroup> <copyallfilestosinglefolderforpackagedependson> customcollectfiles; $(copyallfilestosinglefolderforpackagedependson); </copyallfilestosinglefolderforpackagedependson> </propertygroup> what msbuild code need change in order same task adding cspkg instead? here how did it. in example have .csproj file part of azure solution , dll produced c# project needs particular xml file live right next in deployment. here msbuild fragments .csproj file show technique. can place of code below import of microsoft.csharp.targets in .csproj file. <!-- identify xml input file must deployed next our dll

jquery - Use some CSS only if user has JavaScript enabled -

in order webpage degrade gracefully, have css should loaded if corresponding javascript function. what simplest way load local css if , if browser has javascript enabled? also it's quite big block of css, i'd rather not have write javascript line add each attribute. (oh, , if necessary can use jquery). set class on body tag of "nojs". use javascript remove class. for css rules want used when no js present, use .nojs .myrules {}

xcode - Fixed:Lanscape only not working in iOS5 -

i have updated ipod ios5 , xcode 4.2 none of application views running in landscape have done following: - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return (interfaceorientation == uiinterfaceorientationlandscapeleft); } although default line is: - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return (interfaceorientation != uiinterfaceorientationportraitupsidedown); } in view have set orientation landscape. in summary under 'supported device orientations' have landscape left selected. , lastly in info.plist have added initial interface orientation = landscape (left home button) so when run on ipod & iphone simulator running ios5 device rotes left view not move much. but if run on iphone simulator running 4.2 rotes , becomes landscape. i don't know if doing wrong new io

ruby on rails - Check if a user is a regular user -

i have following code: class user < activerecord::base named_scope :regular_users, :conditions => { :is_developer => false } end how can change code return if specific user regular user (has :is_developer => false ) instead of list of regular users? thanks you can check user.find(1).is_developer? (actually work without ? ) check opposite, use ! user.find(1).is_developer? or not user.find(1).is_developer or put in model method like def is_regular? ! is_developer? end i doubt can boolean value scope. btw, rails3 can use scope instead of named_scope

c# - How to schedule a database task? -

background: created application measures weight scale , saves information in ms sql server database. in database, want save record actual weight every day historical, , don’t know have use accomplish task. can trigger in sql server ?? you don't need try , hack trigger. in sql server type of feature (scheduled execution) managed sql server job . just create sql server job runs once day , executes whatever t-sql need meet biz logic requirement. so don't need code else. configure job , set schedule. not need application. sql server manages scheduled execution sql agent. do note sql server jobs feature not available sql server express editions.

c# - internal relationship between properties -

my issue involves relationships , cascaded effects between properties, , i’m wondering best practices on this. i have class contains list of varying length of numbers. when editing list, user prefer set targetsum, program enforces list add sum. accomplishing programmatically setting final element in list such list sum = targetsum. example, if user chooses usetargetsum, sets targetsum = 10, creates list of length 4, , enters 1, 4, 2 first 3 elements, final element programmatically fixed 3. user cannot change final element themselves. i behind scenes handling necessary events, such list element value change, list length change, , usetargetsum option change. each event trigger, recalculates last element’s value. it works there bug when loading saved data. if list loaded sequentially adding elements, handlers modify each entry. regarding example, when first value of 1 entered, handlers “a value added, sum should 10, there 1 element, needs 10”. first element gets changed

android - Is it possible to add an inderminate progressbar within a TableLayout? -

i have scroll view contains tablelayout child view. while receving data server i'd display progress bar on screen. when data received progress bar must replaced tablerows. i able achieve partially. add progressbar view 3rd row (row 1 , 2 headers) has visibility gone once data received , tablerows created. the issue progress bar appears @ top of screen. consistent app, progress bar must in middle of screen have on listviews. here code snippet progressbar `<tablerow android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal"> <progressbar android:id="@+id/list_progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"/> </tablerow> have tablelayout inside put tablerows hope doing, including 1 progressbar, instead of going replace. you can achieve other way,