Posts

Showing posts from April, 2015

git push(or pull) along with local history -

i svn user , thought try out git. created repository act central repository, staging repo testing , moving central repo , many clone of staging repo. made few commits clone. now make commit history in clone available in staging repo did git pull --rebase and have changes happened on clone. wonder why want it. may (or many times) 1 of the small commits may have screwed software , easy testing staging repo go 1 small step rather 1 sift through changes looking bug. 1 thing stopping me adopting git central or staging repo have big jumps rather incremental changes. incremental changes happen in clones of developers. way dvcs works or have got arrangement wrong? thanks i think might on complicating things multiple repo's. think workflow work using branches instead of repo's. see: http://nvie.com/posts/a-successful-git-branching-model/

rest - Restful Mass-Action -

i'm working on restful-api existing product, , come quite tricky problem: existing application supports several mass actions, i.e. mass-delete or grids mass-setting properties of records. using usual restful-pattern, i`d have send api-call each record, (delete or update), large amounts of records quite slow. wondering, if found solution this, regarding usage existing restful-technology (like extjs restful store). far if come these possible solutions: making restful controllers use reserved parameter ("_requests" or something) array , mapping each item single call internally. using seperate controller each mass-action want. seems cleaner, way more work, both on backend , application using api. any thoughts? restful things act on resources, perhaps have uri refer collection (even describing collection if needed), , post delete uri. in restful terms, you're passing collection resource in deleted state uri. so: delete -> stub/collections/ids=141,

java - how do I set the loggers in netbeans to print exceptions information to files? -

i'm using netbeans ide develop project senior year. project has handed jar. the project works fine within netbeans ( when im using "run project"). , created executeable jar file . unfortunately , jar file doesnt work , , throws execeptions cant see . goal print exceptions file , see whats happing on jar , , debug . i know netbeans using deafult logging mode . code 1 genereted when try catch exceptions : try { manipulate.adapt.adaption(tclass); } catch (exception ex) { logger.getlogger(peppernewanalysis.class.getname()).log(level.severe, null, ex); } i'm not fimilair java logging methodlogy. read information in here , , not enough needs. so , question - how tied logger - 1 there peppernewanalysis file ? is possible inform global logger logging should outputed file? again , want print debug info trace of exception file , every exception can check in project. please me , im running out of time. thanks ! netbe

theming - theme switching, template and css file layout on a django site -

in django site want offer several themes our best clients , boss. created following. - glad got along present there few dirty hacks want eliminate nice solutions ask for. here's hack base.html says (take care - ugly!) {% ifequal theme "0" %} {% include "base_d0.html" %} {% endifequal %} {% ifequal theme "1" %} {% include "base_d1.html" %} {% endifequal %} {% ifequal theme "2" %} {% include "base_d2.html" %} {% endifequal %} then kept in media dir subdirs common css , js and created subdirs static/ d0/ ( theme 0 stuff ) css/ js/ d1/ ( theme 1 stuff ) css/ js/ ... css/ (all common css) js/ (all common js) my controller has method switch design, current 1 stored in cookie. checked on every request , in template prefix_static context variable accordingly /mypathto/static/d0 resp. +d1 +d2 , of course had invent common_static var. , theme var set base.

microsoft dynamics - filter axapta report based on display method -

i want filter axapta report display records qty !=0 . field qty based on display method . acheive overriding send method. problem if last record in section has qty=0, subtotal not displayed. you can calculate , display subtotals in same way you've been recommended deal grand totals 4 hours ago - calculate , display them in programmablesection manually.

Setting particular registry value in Windows 7 with WiX -

the following code works in windows 7 x86, not x64. what's difference , how go setting key? works when install on windows xp having changed feature install on windows xp. <component id="wallpaperpermw7" guid="{c6427f8f-ce18-4675-9ea4-3292c18c897f}" feature="w7feature"> <registryvalue id="wallpaperregw7" root="hklm" key="software\microsoft\windows\currentversion\authentication\logonui\background" name="oembackground" value="1" type="integer" keypath="yes"> </component> edit thanks yan, can see registry going wow folder now, but, want install in same path both 64 , 32 bit systems if add win64="yes" attribute won't install on 32 bit systems it? is there way around not having 2 packages? i take package 32-bit, , hence on 64-bit systems path specify in "key" attribute of registryvalue element mapped different hive:

objective c - How to use NSPointArray? -

so want use method appendbezierpathwithpoints:count: in nsbezierpath. method requires me use nspointarray. documentary doesn't talk , it's array of nspoints , i'm not sure how it. think uses c array mechanism, i'm not sure. thanks. yes, need c-style array of points pass appendbezierpathwithpoints:count: . example might this: nspoint pointarray[3]; pointarray[0] = nsmakepoint(0, 0); pointarray[1] = nsmakepoint(0.5, 0.25); pointarray[2] = nsmakepoint(1, 1); [lines appendbezierpathwithpoints:pointarray count:3]; where lines instance of nsbezierpath . in more complicated case you'll use variable number of points say.

visual c++ - Application crashes in mfc71u.dll -

my application uses vc++ 2003. while executing in unicode release mode crashes at cmdiframewnd* pframe = new cmainframe; in initinstance() of startup project. error message shows application crashes @ mfc71u.dll click link see error message   the same application runs on other systems. please suggest me reason crash.   thanks shyam it if posted more information such as: a stack trace fault. the source code around crash. the exception generated. this bare minimum information should automatically include crash.

Equivalent function of R's "%in%" for Stata -

is there equivalent function of "%in%" r stata? as mentioned, it's hard tell need question. inlist() might work, or might not depending on setting. i find stata's macro lists functions invaluable. store list in macro (local or global) , suite of useful commands available: local list b c d d e local search c local search_in_list : list search in list di `search_in_list' these can calculated on fly: if `: list search in list' { actions if true }

web applications - Best way to design UI for java webapps -

i understand there lots of web frameworks available developing ui of java web applications. not @ designing ui; require framework gives me ui designer well. there utility/tool/framework/eclipse-plugin lets me design ui? google plugin might - http://code.google.com/eclipse/

java - Synchronizing local database with remote database and vice versa -

i developing web application php needs synchronize local mysql database java desktop version of web application interacting with. @ same time need local db synchronize remote db. how do without using other software mysql compare. appreciate help. thanx guys. you have significant architecture issue. needs planned well. two-way replication isn't going work unless have thought out , understand how conflict resolution , impact have on application. in particular, can forget using auto_increment. for one-way replication, can use mk-table-sync, or use mysql replication in way (there variety of possiblities). you can run mysql instance on server, use mk-table-sync periodically synchronise locally, , use mysql replication on that. has benefits, particularly if there tables don't want replicate. you need think how it's going work, if plan two-way synchronisation. possible may end writing custom code it, conflict resolution mechanism may mandate it.

flash - delay in as3 while loop -

i using as3. sprites not working correctly on hittestpoint in while loop. think because going fast before can update display. add delay while loop. easiest way this? like: while (condition){ main code here code delay of 20ms } how can delay in as3? you use timer instead of loop.

xml - Java SAX Parse Exception: Content is not allowed in trailing section -

i'm trying parse simple xml document sax, , following error: org.xml.sax.saxparseexception: content not allowed in trailing section. i've checked xml , seems fine, there nothing (not white space) after closing tag. how i'm starting parsing (although don't think there should probleme that...): saxparserfactory spf = saxparserfactory.newinstance(); saxparser sp = spf.newsaxparser(); xmlreader xr = sp.getxmlreader(); xr.setcontenthandler(new slatemplateparsinghandler(this, xr)); inputsource = new inputsource(); is.setcharacterstream(new stringreader(xml.trim())); xr.parse(is); any ideas wrong? thanks, ivan edit: i've used w3schools xml validator check xml , says has no errors. here xml: <?xml version='1.0' encoding='utf-8' ?> <sla xmlns="http://www.ibm.com/wsla" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.ibm.com/wsla wsla.xsd" name="sample ws

visual studio - nuget - determine the project type before they try to install my package -

how can determine project type before try install package. wanna show them cancelation message if project type not , mvc application , cancel installation process? do need add ps1 script file tools folder of package? if so, should write inside script? currently seems pre-installation checks aborting install not possible. see answer david fowler here . scott hanselman has an example on how check pre-requisites using install.ps1 script. mentions it's not possible stop installation process, "in future there pre-install or dependency check".

Problem with running PHP file with the Release of Flex project -

problem: i call php file using httpservice. set result of httpservice function populates testtextarea whatever php file has returned (echoed). work fine when run application flash builder i.e. strings in testtextarea, echoed php file. not work fine when make release of project , testtextarea gets populated whole code of php file. code: private function adduserservicehandler(event:resultevent):void{ testtextarea.text = event.result.tostring(); //this outputs whole php file in textarea if string } private function savebuttonclicked():void{ adduserservice.send(); } ]]> </fx:script> <fx:declarations> <mx:httpservice id="adduserservice" url="adduser.php" resultformat="text" method="post" result="adduserservicehandler(event)" > <mx:request xmlns=""> <firstname>{firstnametextinput.text}</firstname>

symfony1 - Symfony : I get a 500 instead of a 404 -

i've created custom 404 error pages symfony application, don't seem work. in dev see : this request has been forwarded 404 error page action "blabla". but in prod, page blank; 500 error. in logs, error : php parse error: syntax error, unexpected t_public in /var/www/myproject/apps/myapp/modules/default/actions/actions.class.php on line 7 default/actions/actions.class.php following : <?php /** * error page page not found (404) error * */ public function executeerror404() { } public function executesecure() { } ?> i followed this tutorial on symfony-check.org i found answer myself :d i'd forgotten part of file : class defaultactions extends sfactions { public function executeerror404() {} }

visual studio 2005 - Sending an email to user input email, in a form. ASP.NET -

i new asp.net. have aspx page, takes in user data (name, number & email) after information gets submitted me, i need send email input email, message of confirmation. can please me, if broad question can please point me in right direction of solution problem. in advance. it's covered in system.net.mail namespace documentation here: http://msdn.microsoft.com/en-us/library/system.net.mail.aspx with code sample on documentaiton mailmessage class here: http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx just sure you're following can-spam act guidelines. http://business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business so can avoid getting blacklisted. there's general informaiton found here: http://systemnetmail.com/

Expected specifier-qualifier-list before -

i have following objective-c headers: // menu.h #import <uikit/uikit.h> #import "gamecontroller.h" @interface menu : uiimageview { gamecontroller *gamecontroller; // "expected specifier-qualifier-list // before gamecontroller" } - (void)appear; @end and // gamecontroller.h #import <uikit/uikit.h> #import "menu.h" @interface gamecontroller : uiview { menu *menu; // "unknown type name 'menu'" } - (void)startlevel0; - (void)startlevel1; - (void)startlevel2; @end when try build project, xcode (v4) yells @ me, saying expected specifier-qualifier-list before gamecontroller , unknown type name 'menu' . i'm sure somehow related, have no idea how? it's not practice have mutually-including header files. instead of importing menu.h, use @class directive. try removing #import "menu.h" , adding @class menu in pla

jquery - Move to another url -

i inherited code moves page, page url. $('body').html(page); works there no way use ie button move previous page. i'm looking better ways move url preserve pages in ie button. ideas? use javascript function window.location.replace()

emacs 23 python.el auto-indent style -- can this be configured? -

i have been using emacs 23 (python.el) on month , i'm unhappy default auto-indentation settings. currently, python files auto-indented follows: x = a_function_with_dict_parameter({ 'test' : 'here value', 'second' : 'another value', }) a_function_with_multiline_parameters(on='first', line='line', now_on='second', next_line='line', next='third', finally='line') i prefer if set auto-indentation settings same code formatted: x = a_function_with_dict_parameter({ 'test' : 'here value', 'second' : 'another value', }) a_function_with_multiline_parameters(on='first', line='line', now_on='second', next_line='line', next='third', finally='l

Java abstract class and interface -

in interview have been asked following question. tried answer question want exact answer of question. if can simulate abstract class interface, why java provided interface? this mean if in abstract class can mark methods abstract , abstract class work interface, why need interface. can explain me in brief. that's standard interview question. answer is: because can implement multiple interfaces, can't extend multiple abstract classes. example jre: linkedlist both list , deque . these interfaces define behaviour of class. not provide implementation details. while abstract classes could provide some. related questions: this , this . latter not directly related, shows why interfaces needed, in cases when abstract class suffice.

javascript - loop is too slow for IE7/8 -

i have loop execution needs run in browsers. in chrome/ff etc execution runs fast , fine. in ie it's slow , end's dispatching prompt saying script running slow (no good). any ideas on how around this? need rid of ie prompt 7/8 ** edit ** here's code: if(this.handicap()) { while(this.hasgraphchanged()) { this.gravity(this.separate()); } } this large project, instead of listing code, i'll go quick explanation. this.handicap: returns true if browser if ie7/8 this.haschanged: returns true/false depending if there change after draw update this.gravity: processes drawing algorithm based on p1(array) you can use asynchronous iteration technique instead of loops. watch asynchronous iteration patterns pedro teixeira nice introduction. uses node.js can use same patterns in browser.

stored procedures - Dynamically Update Crosstab View from MySQL Trigger -

i'm attempting de-normalize data in crosstab view dynamically generated on mysql server. due helpful answer here , i've created stored procedure generates crosstab view. this procedure: delimiter $$ create procedure `partflow`.`dimmattab` () begin set @cols = ( select group_concat(distinct concat( '\nsum(if(dimension_id = ', dimension_id, ', value, null)) ', name ) ) column_list partflow.tdimmatmap join partflow.tdimension on tdimension.id_dimension = tdimmatmap.dimension_id ); set @sql = concat( 'create or replace view `partflow`.`vdimmattab` ' 'select material_id, ', @cols, ' tdimmatmap ', 'group material_id;'); prepare stmt @sql; execute stmt; end which produces view containing query: select `material_id` ,sum(if((`dimension_id` = 2),`value`,null)) `width` ,sum(if

if statement - Best way to write a simple boolean method with good C# syntax -

hey all, seem have these types of methods everywhere. the method below wants these simple tasks: open db connection (intlmpdb object) read simple record off small db table (the db table keyed strings, because each string name of method, want 1 row of each in table), rest of row series of timestamps tell me when things happned. if can't find record, return exception because there's nothing can done. if find record, @ second date if it's plain missing, set true because first ever run. or meat, if first date greater second set true because it's been updated , it's time run. else if not, set false because there's no update yet. so here's code... trying pare down best , quickest way run through these checks. not concerned db connection issues or that. private static bool islastintervalnewerthandb(string muimethod) { using (var db = new intlmpdb()) { // try load matching record. lastintervalupdated l

flash - How to convert a local image file to a dataurl for use in image src -

i building flash widget uploading files, want display thumbnail html/js, once have file loaded via browse flash , have access raw data, there way convert base64 encoded dataurl can send out js create thumbnail ? thanks! take @ this article , describes how convert bytearray png image. ps: pngencoder class part of as3corelib .

Integrate Quartz .NET with NHibernate -

i have installed quartz .net , have created quartz database. need extend quartz job store own custom data. example, when add job through quartz api, need add additional information own custom tables within same database transaction. know there class called jobstorecmt in quartz, have not been able find concise examples showing how provide quartz transaction nhibernate creates. my understanding of jobstorecmt declare of transactions using classes in system.transactions namespace introduced in .net 2.0. fortunately nhibernate operates these transactions well, put quartz operations , nhibernate operations in single transactionscope, following: using (var ts = new transactionscope()) { // scheduler here, eg _scheduler.schedulejob(somejobdetail, sometrigger); // create nhibernate session part of same transaction using (var session = _sessionfactory.opensession()) { // perform actions on session here, *not* make use of // nhibernate transa

c# - What does "o" mean as a variable prefix? -

in ocn? rule? using(sqlconnection ocn = new sqlconnection( "server=(local);database=pubs;user id=testuser1;password=foo1;")) { ocn.open(); ... } i found type of naming in article http://msdn.microsoft.com/en-us/magazine/cc163799.aspx an entirely obsolete way of saying "cn" * o *bject.

Testing signed cookies in rails -

i'm using signed cookies in rails 3 enable "remember-me" feature in application. works except i'm not able functional test cookies, since comparing cookies['remember_id'] gives me encrypted cookie, , cookies.signed not defined. any clues? the problem (at least on surface) in context of functional test (actioncontroller::testcase), "cookies" object hash, whereas when work controllers, it's actiondispatch::cookies::cookiejar object. need convert cookiejar object can use "signed" method on convert signedcookiejar. you can put following functional tests (after request) convert cookies hash cookiejar object @request.cookies.merge!(cookies) cookies = actiondispatch::cookies::cookiejar.build(@request)

sql - Function / criteria to give me records from the last 90 minutes -

i have time/date field in select query , want set criteria return records last 90 minutes. criteria should use? you'll want use datediff function comparison. like: ... datediff("n", recorddate, currentdate) <= 90 ...

unit testing - Emulating an app with models in a django unittest -

i m writing code retrieves info installed apps, defined models, , stuff based on information, i m having problems writing clean, nice unittest. there way emulate or add app in unittests without have run manage.py startproject, manage.py startapp in testsfolder have test app available unittests? sure, try on size: from django.conf import settings django.core.management import call_command django.test.testcases import testcase django.db.models import loading class apptestcase(testcase): ''' adds apps specified in `self.apps` `installed_apps` , performs `syncdb` @ runtime. ''' apps = () _source_installed_apps = () def _pre_setup(self): super(apptestcase, self)._pre_setup() if self.apps: self._source_installed_apps = settings.installed_apps settings.installed_apps = settings.installed_apps + self.apps loading.cache.loaded = false call_command('syncdb

asp.net mvc 3 - How do I group implementations under interfaces in Visual Studio? -

Image
i downloaded example code github , saw bookrepository.cs class grouped beneath ibookrepository.cs interface. maybe newbie question, how that? they might have used custom generator tool : and here's blog post on topic. or they might have grouped in corresponding .csproj file : <compile include="code\bookrepository.cs"> <dependentupon>ibookrepository.cs</dependentupon> </compile> <compile include="code\ibookrepository.cs" />

c - Is there a list of minimum gcc version supporting each __attribute__? -

the official documentation here lists minimum required version small number of attributes: http://gcc.gnu.org/onlinedocs/gcc/function-attributes.html is there complete list of version each attribute added in? better list shows ones compatible pcc , tcc. for gcc versions: http://www.ohse.de/uwe/articles/gcc-attributes.html for pcc: http://pcc.ludd.ltu.se/fisheye/browse/~raw,r=head/pcc/pcc/cc/ccom/gcc_compat.c for tcc: ??

java - Developing traditional style webapps with GWT -

in many jvm web frameworks survies , indeed.com trends graphs, gwt looks (or among top) popular jvm framework. afaik, gwt excels when application 1 page app -to degree of course- (like gmail, google reader ..) does mean new developed java webapps 1 page apps (not traditional request-new page response)? possible develop springmvc or struts2 style webapps gwt? or not recommended? absolutely, possible build struts apps gwt; @ level gwt is, convenient way of writing javascript (in perl days, called 'syntactic sugar'). you can still use gwt-rpc, json, or html forms communicate server. you can attach arbitrary html element using rootpanel.get("id"); add javascript widgets. almost every javascripty component on employer's website written in gwt: http://www.cohomefinder.com/ . backend old fork of struts. and here's nice, though bit dated, article building 'normal' websites in gwt: http://www.canoo.com/blog/2007/03/13/building-a-

c# - TfsConfigurationServer.GetService<VersionControlServer>() always returns null -

i'm trying connect tfs 2010 using tfs sdk, can't versioncontrolserver service. var servers = registeredtfsconnections.getconfigurationservers(); // ok then var tfs = new tfsconfigurationserver(servers.first().uri, credentialcache.defaultnetworkcredentials); // or var tfs = new tfsconfigurationserver(servers.first()); both returns null: var vc = (versioncontrolserver)tfs.getservice<versioncontrolserver>(); // null! what should do? you don't want configuration server, want project collection. version control service scoped team project collection. example: var projectcollection = tfsteamprojectcollectionfactory.getteamprojectcollection(registeredprojectcollection); var versioncontrol = projectcollection.getservice<versioncontrolserver>(); see also: connect project collection

Redirect based on selected checkbox with JavaScript -

i have several checkboxes in switch statement 1 below: function whatschecked(obj) { var indx = obj.id.substring(obj.id.length-1, obj.id.length); switch ( indx ) { case '9': if (document.sport.soccer_9.checked) { //window.open.href = "../google.com";; window.open("../google.com"); } break; } } } how can use continue button determine checkbox clicked , redirect me correct page (instead of giving each checkbox it's own onclick event)? also @ http://jsfiddle.net/amelvin/ykfza/ in example change events of checkboxes register themselves, , if check 1 of boxes value of checkbox alerted out. if change alert(this.value) location.href(this.value) have redirect. <form> google: <input type="checkbox" name="google" value="http://google.com" /> yahoo: <input type="checkbox" name="yahoo&quo

android - Problem implementing vertical swipe in Gallery -

i asked similar question in android developers group haven't received response yet, figured i'd try luck here. i want implement vertical swipe on gallery , have working... sort of. subclassed gallery override onfling , ondown methods. here code used override these methods: @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { if (m_curtouchpos == no_current_touch_pos || m_callback == null) return super.onfling(e1, e2, velocityx, velocityy); float e1x = e1.getx(); float e1y = e1.gety(); float e2x = e2.getx(); float e2y = e2.gety(); float offpath = math.abs(e1x - e2x); float distance = math.abs(e1y - e2y); if (offpath < s_swipemaxoffpath && //math.abs(velocityy) >= s_swipeminvelocity && distance >= s_swipemindistance) { if (e1y > e2y) { m_callback.onswipeup(m_curtouchpos); //return true;

t4 - modify a TT template to add required html element -

i trying create t4 template speed create form template. is possible add html depending if model's property required? e.g. [required] [display(name = "contact email address:")] public string contactemailaddress { get; set; } now in tt file like foreach (modelproperty property in getmodelproperties(mvchost.viewdatatype)) { if (!property.isprimarykey && !property.isreadonly) { #> <div> @html.labelfor(model => model.<#= property.name #>) @html.editorfor(model => model.<#= property.name #>) @html.validationmessagefor(model => model.<#= property.name #>) if(this.required==true){<span class="required-field"></span>} </div> <# } or not possible? 1,open file: c:\program files (x86)\microsoft visual studio 12.0\common7\ide\extensions\microsoft\web\mvc\scaffolding\templates\mvcviewwithcontextscaffolder\modelpropertyfunctions.include.t4

PHP ZipArchive not unzipping on CentOS 4.8 -

i've been doing work phps ziparchive. on local windows machine using wamp able select zip file, upload , unzip desired destination. when attempt same on centos server, .zip file uploaded desired destination not being unzipped. i've done research , see ziparchive available if php compiled --enable-zip. if case, shouldn't upload fail? don't understand why .zip file still being placed in desired destination. i did class_exists(ziparchive) , returned false on centos server. find weird file still uploaded know why isn't working. thanks anyways.

objective c - Iphone SQLite problems -

i'm developing iphone application read data through sqlite. created database through terminal , added xcode project. i went terminal , includes new table in file. sql. problem because new queries not see new tables. kind cache? how solve problem? where sqlite file? in application bundle? make sure modify version that's been copied iphone simulator folder ( ~/library/application support/iphone simulator/ ) if you’re trying modify version running in simulator.

wpf - How to get content in webBrowser control -

assume type uri in textbox , click button load, web page loaded webbrowswer control, highlight piece of text in webbroswer control. , now, how can hightlighted text , display in textbox? (no copy/paste) thanks! retrieving selected text webbrowser control in .net(c#) ihtmldocument2 htmldocument = webbrowser1.document.domdocument ihtmldocument2; ihtmlselectionobject currentselection= htmldocument.selection; if (currentselection!=null) { ihtmltxtrange range= currentselection.createrange() ihtmltxtrange; if (range != null) { messagebox.show(range.text); } }

android: Identify individual items in row of ListView? -

i have listview in listactivity populated database table. each row of listview relativelayout 3 textviews named rowid, date, , name in order. able select individual rows programmatically using .setselection(int position) method of listview. here i'm trying do: when push button on interface, rowid selected list row, , perform db query using rowid. can't figure out how rowid list itself. rowid may not same id or position on list rowid in database. i suspect require working adapter, i've been trying/searching web week , haven't been able figure out. can provide. you know list position of selected item, have button outside listview should trigger action on item, , you're not making listview rows (or child view within each row) clickable. right? you can information list's adapter. getitem(int position) returns object represented list item @ position, can retrieve information need directly if it's stored in object. getview(int position)

iphone - How can I avoid changing image view to rotate when device is rotated -

how can avoid changing image view rotate when device rotated. have image view don't want rotate when device orientation changed. if mean want whole view autorotate, except image view, can manually rotate image view normal whilst else autorotates. you can in willanimaterotationtointerfaceorientation:duration: . apply transform view want rotated. - (void) willanimaterotationtointerfaceorientation:(uiinterfaceorientation)interfaceorientation duration:(nstimeinterval)duration { [uiview beginanimations:@"controlmovement" context:nil]; [uiview setanimationduration:duration]; if( interfaceorientation == uiinterfaceorientationportrait || interfaceorientation == uiinterfaceorientationportraitupsidedown ) { myimageview.transform = cgaffinetransformidentity; } else { myimageview.transform = cgaffinetransformmakerotation( m_pi / 2 ); } [uiview commitanimations]; }

python - Django Page Caching (Trouble with db)? -

i'm having bit of odd issue in django 1.2.4. i have page lets user declare front end settings. these settings represented in following models: class setting(models.model): """ maintains key-value pair front-end editable setting. """ class meta: abstract = true name = models.charfield(max_length=120, primary_key=true) description = models.charfield(max_length=300, blank=true) class integersetting(setting): value = models.integerfield() class listsetting(setting): value = pickledobjectfield(default=lambda: list(), editable=true) these settings reflected in admin change form. have overridden template, , make setting available page follows: {% extends 'admin/change_form.html' %} {% block extrahead %} <script type="application/javascript"> var global= {}; global.min_slider = {{min_slider}}; global.max_slider = {{max_slider}}; </script> {{ block.super }} {% end

html - Auto Refresh a page in Rails 3 -

how periodically auto refresh page paramaters in rails 3? place following html within <head> of applicable views. should not used when page had post parameters sent, parameters. change 5 interval, in seconds, want page refresh at. <meta http-equiv="refresh" content="5" /> though works, i'd recommend considering using ajax refresh needed content not faster less jolting user , have lower impact on server's load. this not specific rails , applies webpage. since rails server-side, , server cannot control browser, rails has no control on page refreshing.

Pass JSON from php to javascript -

i want localize webapp. since localization through javascript not recommended thought using php alternative. so php read messages.json file stores localization data. $json = file_get_contents("_locales/en/messages.json"); in header of webapp generate javascript php according user's browser language. echo "var localeobj = " . $json . ";"; so var holds data m essages.json file looks that { "exttitle": { "message": "test1" }, "extname":{ "message": "test2" } } now want able access each item json like var title = getitem("exttitle"); and returns test1 . idea how that? i not familar json if alert localeobj gives me [object object]. var getitem = function(item) { return localobj[item].message; }; you encapsulate i18n strings too... (function() { var localobj = { ... }; window.getitem = function(item) {

iphone - view terminates when scrolling -

my problem is, if scroll table view fast, screen freazes. following: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiviewcontrollerwrapperview isequaltostring:]: unrecognized perhaps can me! thx you're over-releasing (or under-retaining) object.

ruby on rails - Logic and code help -

here models , associations: user has many awards award belongs user prize has many awards award belongs prize let's pretend there 4 prizes (captured records): pony toy gum awesomestatus every day user can awarded 1 or more of these prizes. user can receive each prize once per day. if user wins awesomestatus, ex, record added awards table fk user , prize. obviously, if user doesn't win awesomestatus day, no record added. at end of day (before midnight, let's say), want return list of users lost awesomestatus. (of course, lose awesomestatus, had have day before.) unfortunately, in case, don't think observers work , have rely on script. regardless, how go determining users lost awesomestatus? note: don't make solution overly dependent on period of time -- in case day. want maintain flexibility in how many times per whatever period users have opportunity win prize (and lose it). i this: the class award should have column awarde

ruby on rails - Tweets exclusion -

let's pretend have site users create topics , write threads on fruit. to keep users informed of fruit conversations on entire web, collect tweets related specific topic , create threads based on contents of tweet. it's important tweets relevant topic, obviously. let's user creates topic called apples , oranges. pull tweets contains keywords apples an/or oranges. the problem i'm having twitter users write tweet includes keywords apples, oranges, pears, example, , gets collected , posted thread apples , oranges discussion topic. makes users angry! so need way filter out tweet includes fruit words other apples and/or oranges. for example, if twitter user writes "i love apples, oranges, pears, , grapes" tweet should not included. now can make twitter search query sophisticated. exclusion logic have performed in ruby after tweets collected. programmatically, how go solving this? determine words related topic name. pears, grapes, etc

how to change values of a dropdown on key press using jquery -

i need change values of "focused" dropdown on keypress using jquery. i need, how foucsed drop down or how can check whether drop down has focus. how change drop down values in key press 1,2,3 etc. using jquery. thanks in advance. to see if object selected: if($(".foo").is(':focus')){ // } to change values on keypress: $(".foo").bind("keypress", function(e){ $(this).attr('value', 'bar'); }) though not sure mean changing values of drop down, or why you'd want that.

How to escape character '.' in python string replacement via the operator % -

i want following "@file %(unitname).c" % {'unitname':'test'} but complains '.c'. how can escape '.' character? you don't. fix format specifier. "@file %(unitname)s.c" % {'unitname':'test'}

deploying the web application to server for android -

i developed web application using phone gap framework android platform. have single file called index.html, copied both index.html , phonegap.js(from framework) files server , ran them emulator. i'm getting error below 02-24 10:46:42.540: warn/browser(277): console: error: referenceerror: can't find variable: pluginmanager http://192.168.1.25:8084/web2/phonegap.js:552 in index.html file wrote code play stream internet using media class, have seen in documentation of phonegap , worked in emulator installing apk. guess error not because of media or code, guess i'm not deploying web app correctly because left phonepap.0.9.4.jar because don't know include file in server. use tomcat , i'm deploying in webroot folder.. please me in deploying project(the procedure how deploy , how user can view page in device browser).. thank you.. the phonegap framework not work in way, should put both phonegap.0.9.4.jar , phonegap.js on mobile device, instead of on rem

python - shell with django environment in eclipse,pydev giving syntax error -

``>>>python manage.py syncdb file "<console>", line 1 python manage.py syncdb syntaxerror: invalid syntax ^`` what problem be? extra info if might - python - 2.6 django - 1.2.5 eclipse - 3.6.0 pydev - 1.6.5 it seems you're in python shell already, command won't work. have use command line in project folder. in this question you'll find how run syncdb python shell.

How to access internal web services from windows azure with restriction IP and port -

we have existing application migrated windows azure. currently, access web services in other network, , firewall in front of web service, trust ip of , open port application. which ip should trust after migrated windows azure? or other approach suggested? thanks lot. currently windows azure not offer fixed ip address, ip based filter subject potential risk if ip address should change (which can without notice). i recommend explore either leveraging service bus create peer-to-peer connection between services, or possibly azure connect (an ipsec based vpn style connection).

join - Mysql Query that requires subtraction of fields that cannot be referenced -

our db stores customer orders in 2 tables: customerorders , customerorderlines. amongst other fields, there customerorders.type field determines (being = 1 or = 2) if customerorder invoice or creditnote. we have report lists amount of units sold, profits etc current query, displays total units sold on period, ie, doesnt subtract number of credits, if any. here sql , example of results generates: (apologies massive query follows :)) select l.name locationname , sr.name salesrepname , ct.name customertypename , c.name customername , c.id customer_id , c.code , s.name suppliername , p.description productname , p.id product_id , p.unitofmeasure , sum(col.vatableprice) totalsales , sum(col.vatprice) vat , sum(col.quantity) totalitems , sum(col.quantity * col.costprice) totalsalecost , sum(col.vatableprice) - sum(col.quantity * col.costprice) totalprofit ,( select sum(col2.vatableprice) totalsales customerorders co2 left join customerorderlines col2 on col2.custom