Posts

Showing posts from January, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

parent - jquery this child selector? -

hey, quick question, couldn't find on web. have parent div , child div inside of it. select css say: #parent .child {} in jquery have var parent element, how can select child this? know it's easy create new var, i'm curious if it's possible? var parent = $('#parent'); parent.click(function() { $(this > '.child').hide(); thank you the correct syntax is: $(".child", this) if want direct children: $("> .child", this) (credit goes gumbo mentioning this) update, 2 years later : you can use $(this).find('> .child')

testing - How to get text in png file using Java -

i want check if particular string present in image. possible? pngj can that? my file contain graph , legends. want check if legends correct. no, can't pngj. text visible in png image not internally stored text. need ocr software if wish identify text. however much better if data in format easier parse computer.

css - What are the pros and cons of using percentages as your dimension standard for HTML pages -

i've been using pixel defined width , height dimensions html elements far. works out pretty fine except when you're faced bigger screens. what pros , cons of using percentages standard? p.s.also how handle size of fonts? good article read on topic. fixed vs fluid vs elastic layouts

visual c++ - Problems with refreshing a draggable MFC window -

greetings. i have make draggable mfc dialog window, has background - used that: http://www.codeproject.com/kb/graphics/picturewindow.aspx - , has several picturebox controls. have tried 2 approaches, , while work, have problems. first approach "manual" - on lbuttondown message check if it;s on clean area of window, , set flag variable. on mousemove, flag checked , if it's set, movewindow function called, , then, invalidate(1). on lbuttonup, flag unset. approach works correctly , redraws needed, somehow slow - if i'm moving cursor fast, window falls behing , isn't dragged, cursor's not on window anymore. the second approach "automatic" - call defwindowproc(wm_syscommand, sc_move+2,makelparam(point.x,point.y)); on lbuttondown, , handles rest, it's quick , never fall behind, when drag on screen's edge ( part of window gets invisible), when drag back, controls invisible , not refreshed, background okay. suppose that's because

Displaying multilanguage characters in pdf through itext(java) -

i facing problem displaying chinese , russian etc local languages characters.it showing blank there.using itext. there standard encoding , font after converting every character unicode hexadecimal take care. make pdf encoding utf-8 use font supports unicode, here similar question basefont unicode = basefont.createfont("c:/windows/fonts/arialuni.ttf", basefont.identity_h, basefont.embedded); also see: example code

iPhone/iPad HTTP streaming library or server -

is there available open-source (preferred) or commercial library on-fly segmenting , streaming of video iphone / ipad? also, there open-source/commercial server (alternative wowza) supports this? apple offers mediastreamsegmenter: http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/usinghttplivestreaming/usinghttplivestreaming.html you might want peek @ best practices creating , deploying http live streaming media iphone , ipad: http://developer.apple.com/library/ios/#technotes/tn2010/tn2224.html there's darwin streaming server, may not need it.

asp.net - Why can't I debug/step-into FormsAuthentication.Authenticate? -

i having trouble active directory authentication using formsauthentication in asp.net mvc 2 (vs 2010). as understand should able step into/through microsoft source code formsauthentication.authenticate if check 'enable source server support' , 'enable .net framework source stepping' in options->debug->general , specify 'microsoft symbol servers' in options->debug->symbols. i have done , can step whole bunch of ms source code, not formsauthentication.authenticate . debugger simple steps on it. can tell me why is? if step formsauthentication.authenticate make life whole lot easier. thanks. ok, stupid. i should have been using membership.validateuser not formsauthentication.authenticate. my problems solved :) however, never figured out why not step formsauthentication.authenticate. guess remain mystery...

asp.net - JavaScript update field in another UserControl -

i try explain better. have 1 user control in page, , inside have uc2 (modal pop up). , try achieve this: when close uc2(modal) try update fields on uc1. , works fine one(i have uc2(modal) , on button save onclientclick="saveinfoci()"), , in uc1 on top of page function saveinfoci() { document.getelementbyid("<%=frmdata.findcontrol("txtimplementingci").clientid%>").value = document.getelementbyid("<%=uc2.getclientid%>").value; } but because reuse control in place want update field. have 3 js function update 3 fields. , try when click save in uc2(modal) must execute 1 of 3 javascript f, update right field. don't want have 3 same uc difference in onclientclick="saveinfoci(). two problems: first, syntax off, when inside code behind can't use <%= this. second problem, time script executed (on top of page) elements still not exist. have change value in client side page load event. so should work,

objective c - Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 -

while running code getting following errors can me this ld: duplicate symbol _objc_metaclass_$_fbsession in /users/rachit/mobileapps/iphone/xyz copy/build/apostekapp.build/distribution adhoc-iphoneos/appname.build/objects-normal/armv6/fbsession-b9ca0037bd5c5f44.o , /users/rachit/mobileapps/iphone/xyz copy/build/apostekapp.build/distribution adhoc-iphoneos/appname.build/objects-normal/armv6/fbsession-b9ca0037bd5c5f44.o command /developer/platforms/iphoneos.platform/developer/usr/bin/gcc-4.2 failed exit code 1 i've bumped in before. not 100% sure, theory: this may occur when variable declared outside interface in header file. header file included several other classes, conflict. if have such variable, try putting inside @implementation .

c# - populate dropdown list from a list of objects -

in attempt of building 3-tier architecture c# asp.net application, i've started building class database used connecting database, class city has method each column in table cities, , cities class in have getcities method creates list of city objects , use datasource wizard set control use data getcities(). blanks in dropdown list. idea why? public list<city> getcities() { list<city> cities = new list<city>(); database db = new database(); sqlconnection conn = db.getconnection(); string sql = "select * cities"; sqlcommand cmd = new sqlcommand(sql, conn); sqldatareader reader = cmd.executereader(); while (reader.read()) { city c = new city(reader.getint32(0), reader.getstring(1).tostring()); cities.add(c); } db.closeconnection(); return cities; } thanks did set datatextfield, datavaluefield properties, , call d

javascript - Setting Page.IsValid to False -

i've got asp user control using jquery ui datepicker we'd have standard calendar throughout our site. i trying create validation control not have create validation in every page using calendar. possible set page_isvalid false ascx? here's code: <%@ control language="vb" autoeventwireup="false" codefile="jquerycalendar.ascx.vb" inherits="controls_misc_jquerycalendar" %> <style type="text/css"> div.ui-datepicker, div.ui-widget { font-size: 12px !important; } img.ui-datepicker-trigger{ margin-bottom:-5px; } </style> <script type="text/javascript"> $(document).ready(function () { $('.datepicker').datepicker({ showon: 'button', buttonimage: '<%= me.imageurl%>', buttonimageonly: true, changemonth: true,

How to change maven repository folder in windows? -

in windows, maven downloads in c:\documents , settings\myuser\.m2 folder (or c:\users\myuser\.m2 ). there exists way change folder uses? specially want set download anywhere in documents , settings / users folder. look @ settings.xml in m2_home/conf (see this details setting m2_home environment variable). can add (or uncomment) following section: <!-- localrepository | path local repository maven use store artifacts. | | default: ~/.m2/repository --> <localrepository>/path/to/local/repo</localrepository> as suggested commented out section there default. there, should able change path achieve want.

c# - Can I see the relations as well in the Class Diagram of VS? -

is possible see relations in class diagrams inheritance? how? thanks! yes, if have property reference class (in diagram), righ-click property , select "show association" (or name that).

How does akka compare to Erlang? -

i've been looking @ akka , it's pretty impressive. looks has of killer features of erlang - location transparency, supervision hierarchies, , more. there features erlang has akka doesn't? disclaimer: po akka erlang copy-on-send - akka uses shared memory (immutable objects) in-vm sends erlang per-process gc - akka uses jvm gcs erlang has otp - akka integrates entire java ecosystem (apache camel, jax-rs, etc etc) erlang process scheduling - akka allows use many different dispatchers endless configuration opportunities erlang hot code reload - akka can support it, it's less flexible because of jvm classloading those ones top of head. on other hand, using akka means can use scala, java, groovy or jruby write applications.

sql server 2008 - I am getting persistent but intermittent "Violation of PRIMARY KEY constraint" Errors -

i person in company tries solve coldfusion errors , bugs. daily emails full details of coldfusion errors etc, store information in our database. and few different applications in coldfusion, seem sporadically generated "violation of primary key constraint" errors. in code check existence of row in database before try insert, , still generate's error. so thinking is, either need cftransaction around these each of check, insert or update blocks. not sure solve problem. these coded in standard coldfusion style/framework. here example in pseudo-code. cfquery name="check_sometable" datasource="#dsn#" select id sometable /cfquery if check_sometable.recordcount gt 0 -do insert else -do update /endif so why intermittently, cause primary key violations? is sql server problem, missing configuration option? are getting of because not on latest hotfixed version of coldfusion 8 standard? do need upgrade our jdbc/odbc drivers? thank you.

c# - why can't we do Html.ActionLink("Edit Dinner", "Edit", new { dinner=Model })? -

<%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<nerddinner.models.dinner>" %> <asp:content id="content1" contentplaceholderid="titlecontent" runat="server"> details </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <h2> <%:model.title %></h2> <fieldset> <legend> <%: model.hostedby %></legend> <p> <strong>when: </strong> <%: model.eventdate.toshortdatestring() %> <strong>at: </strong> <%: model.eventdate.toshorttimestring() %> </p> <p> <strong>description: </strong> <%: model.description %> </p&

cookies - ASP.NET: How to get FormsAuthenticationTicket object when authentication expired -

i'm trying check expired property of user's current formsauthenticationticket see if authentication period has expired. when period has expired, i'm never able enough information create ticket check. i've tried this: formsidentity id = (formsidentity)user.identity; formsauthenticationticket ticket = id.ticket; but user null when authentication period has expired. won't work. i've tried this: httpcookie authcookie = context.request.cookies[formsauthentication.formscookiename]; formsauthenticationticket authticket = formsauthentication.decrypt(authcookie.value); but forms cookie gone when authentication period has expired, meaning authcookie null. doesn't work. is there way get formsauthenticationticket object when authentication period has expired? there must be, because there's "expired" property in object. missing? thanks. an expired cookie left out of headers client browser. there no code-behind method of retrieving

Performance Comparison of Shell Scripts vs high level interpreted langs (C#/Java/etc.) -

first - not meant 'which better, ignorant nonionic war thread'... rather, need in making architecture decision / argument put forward boss. skipping details - love know , find results of has done performance comparisons of shell vs [insert general purpose programming language (interpreted) here), such c# or java... surprisingly, have spent time on google on searching here not find of data. has ever done these comparisons, in different use-cases; hitting database in xyx # of loops doing different types of sql (oracle pref, mssql do) queries such of crud ops - , not hitting database , regular 50k loop type comparison doing different types of calculations, , things of nature? in particular - right now, need comparison of hitting oracle db shell script vs, lets c# (again, gppl thats interpreted fine, higher level ones python). need know standard programming calculations / instructions/etc... before ask 'why not write quick test yourself? answer is: i've been win

objective c - passing function reference to a C pointer type, C will invoke the function -

i have simple question i.e. how can pass objective-c function reference c function pointer c can invoke function. edit: sorry not providing sample source here is: - (void)init { clibstructure clibobject; clibobject.on_work_done = &cworkdone; } the function point on_work_done have signature in c static void cworkdone(const char *workinfo); whereas in objective-c signature made - (void) workdonewithstatusmessage:(const char *message); now want point clib.on_work_done pointer objective-c function, if point standard c function works. in short, can't. not directly. a method call combination of target, object message, , selector identifies method call. you need bundle somehow. blocks easy enough. pure c apis, can typically done context pointer or it. given posted no code, no examples, none of api used, , none of details c api itself, providing details difficult.

tsql - Convert Varchar to Ascii -

i'm trying convert contents of varchar field unique number can referenced 3rd party. how can convert varchar ascii string equivalent? in tsql? ascii() function converts single character can convert entire string? i've tried using cast(isnull(ascii(substring(rtrim(ltrim(primarycontactregion)),1,1)),'')as varchar(3)) + cast(isnull(ascii(substring(rtrim(ltrim(primarycontactregion)),2,1)),'')as varchar(3)) ....but tedious, stupid looking, , doesn't work if had long strings. or if better how same thing in ssrs? try this: declare @yourstring varchar(500) select @yourstring='hello world!' ;with allnumbers ( select 1 number union select number+1 allnumbers number<len(@yourstring) ) select (select ascii(substring(@yourstring,number,1)) allnumbers order number xml path(''), type ).value('.','varchar(max)') newvalue

ASP.NET MVC: Need to deploy multiple copies of a site -

i have app need white-label , deploy client. functionality identical, pages identical. real difference missing logo/styling , use of sso-like system instead of regular forms auth. authentication part no problem, can injected. what's best way me different master pages / config files site? 'best' means least cause problems , maintenance headaches. attributes good: quick/easy implement, quick/easy maintain. you write own view engine in asp.net loads different theme depending on customer logs in. this way can load different cascading style sheets, master pages, views....etc. about year ago wrote post on this: http://cgeers.com/2010/02/25/asp-net-mvc-themed-view-engine/

mysql - Returning sequential numbers -

assume col contains system name "apple". col b has bunch of id's associated system in col a. these id's mean wrt system. col c has timestamp @ these id's generated system. this query wrote obtain above data: select name, id, time xtable (name='apple') , id in ('1', '2', '3', '4') group name, id, time the problem query returns rows long contains 1 of above numbers (not in sequence) output of above query: apple 3 12/1/2010 11:04 apple 4 12/1/2010 11:58 apple 1 12/1/2010 11:00 apple 1 12/1/2010 11:01 apple 1 12/1/2010 09:05 apple 2 12/1/2010 09:10 apple 3 12/1/2010 09:40 apple 4 12/1/2010 10:00 apple 2 12/4/2010 03:25 pm apple 1 12/4/2010 12:47 pm . . . . . . i want tweak such returns values in 3 columns when ids in column b occur in sequence (1,2,3,4). want information because sequential ids represent set of events i'm using extract information.

iphone - Why do I have to subtract for height of UINavigationBar twice to get UIWebView to be correct size? -

i using uinavigationbar in app 3 different uiviewcontrollers. rootviewcontroller hides navigation bar when view on top of stack implementing following in rootviewcontroller.m: - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [self.navigationcontroller setnavigationbarhidden:true animated:true];} and - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; [self.navigationcontroller setnavigationbarhidden:false animated:true];} when firstviewcontroller pushed top, works fine. in ib, told view has status bar , navigation bar. of subviews (added in ib) laid out expected on simulator , on device. however, when secondviewcontoller pushed top, things weird. in ib, told view there status bar , navigation bar before. added uiwebview fill remainder of screen (verified dimensions of 320 x 416 in ib) , looks correct in ib. ran app on simulator , device, , uiwebview runs behind navigation bar if 320 x 460. to fix problem, added code s

internet explorer - CSS: margin/padding on IE cause floats to be placed incorrectly -

i'm having trouble getting ie7 float elements correctly (ff , chrome work expected). i'd have "delete" buttons (here span class "sbutton") floated way right. on ie sbutton no first line floats way right expected, subsequent lines float left of sbutton above them: something other text ----------------------------------[delete] else other text ---------------------[delete]-------- this related paddings , margins on sbutton: .sbutton { background-color: #2e3239; color: white; border: 1px solid gray; font-family: "trebuchet ms"; font-size: 90%; padding: 1px 3px; margin: 2px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } if remove padding , margin float expected. here's hmtl: <li> <span class="left"><b>something</b> (#1102) other text</span> <span class="right"><a href="#" class="sbutton">delete</a&

javascript - keep values after submit -

i know how can keep form have select list not deleted after submit? this line use fill select list: <% = select: search,: style, [[all, ""]] + proyect.all (: group => "style",: order => "style"). collect {| | [a. style a.estilo]}%> please me thanks in advance yeah. simple. solved folowing parameters added current line: {:selected=>params[:search][:style]} thus leaving <% = select: search,: style, [[all, ""]] + proyect.all (: group => "style",: order => "style"). collect {| | [a. style a.estilo]},{:selected=>params[:search][:style]}%> thanks anyway -------------------annex--------- that's right, solution, half solution, because have problem if parameter still not been created? how this: {: selected => params [: search] [: style] if params [: search] [: style]! = nil}%> being follows: <% = select: search,: style, [[all, ""]] + proyect

ios - Projection Matrix in Apple's iPhone OpenGLES 2.0 Template Project -

background: i trying learn opengles 2.0 iphone , have been stumped template project apple provides in xcode. the default project shows 2d square, want experiment adding vertexes varying depths on z axis. in apple's default opengl project, draw 2d square using x , y coordinates passed vertex shader. in order experiment placing vertices in 3d space, added z value vertex data in sample project. changed size parameter in glvertexattribpointer method 2 3. changed z values on vertices in hope cause square appear tilted backwards when ran program. the problem still shows same 2d square. reading, believe caused projection matrix being set orthographic instead of perspective. question: how change projection matrix orthographic perspective using opengles 2.0 in apple's template opengl project? i have tried: glmatrixmode(gl_projection); glloadidentity(); glfrustumf(-0.5, 0.5, -0.5, 0.5, 1, 10); but didn't change result. i tried adding vertex shader

asp.net - How to setup Silverlight xap caching to work the same in all browsers -

basic requirements i have sl app can run in-browser or out-of-browser. want browser to: cache xap file load xap cache if has not changed or re-download if has changed. more details setting future expires header solves caching problem cannot force user download latest version. add querystring url (eg url?v=1 ) cannot this breaks out-of-browser functionality. eg app thinks not installed when in fact is. no cache if set cache-control no-cache , chrome , firefox correctly send request server xap use cache if 304 returned. ie8 downloads file again safari. must-revalidate setting cache-control must-revalidate again works correctly in chrome , firefox safari downloads xap again while ie8 uses cache. how set work described @ start of question? i'm not sure chrome/firefox strictly "correct", have after not told browser should cache content or content cacheable. instead of no-cache try "cache-control: max-age=15" instead. see if c

open source - Hosting a project on code.google with an Creative Commons licence -

i have project made under creative commons licence (attribution-noncommercial) upload code code.google.com since have other project living there. when create new project asks me opensource licence want choose. choices available are: apache license 2.0 artistic license/gpl eclipse public license 1.0 gnu general public licence v2 gnu general public licence v3 gnu lesser general public license mit licence mozilla public license 1.1 new bsd license "other open source" when select "other open source" there link osi-approved licenses takes me list of licenses. ( link text ) in these lists creative commons license not mentioned while, interestingly enough, content of website (www.opensource.org) seems licensed creative commons license. my question this: what license type should choose in code.google project in order "select" creative commons license (attribution-noncommercial)? creative commons licences not used code. they'

cocoa - How to invoke ical sync service? -

i have application syncs ical through calendar store framework. i've noticed need open ical sync service start , transfer events , tasks added application ipad , iphone. so.. question, there way start ical sync service without opening ical? thank you, jose. i'm not positive pick latest changes made calendarstore, should able trigger ical's sync client launching (nsworkspace do): /system/library/frameworks/calendarstore.framework/resources/icalexternalsync this sync tool ical uses interact sync services.

css - How can I horizontally and vertically center an <img> in a <div>? -

i don't want center div, want contents of div centered. horizontal , vertical alignment. sorry, if easy or whatever, kind of hassle right. grae i using ie7 if know height , width of image, position absolutely, set top/left 50% , margin-top/left negative half height/width of image. #foo { position:relative; /* ensure positioned parent */ } #foo img { width:240px; height:200px; position:absolute; left:50%; top:50%; margin-left:-120px; margin-top:-100px; } live example: http://jsfiddle.net/zd2pz/

windows - Server 2008 EventLog levels -

pre-2008 event log entries (of type eventlogrecord) had eventtype member eventlog_error_type, eventlog_audit_failure, etc. since vista, there level , keyword values instead of eventtype. i've searched high , low values level , keyword hold can't find references. are there official docs on this? i'd hate try , guess looking @ lot of existing event log entries , hoping guess right. thanks! edit: found docs http://msdn.microsoft.com/en-us/library/aa382793(v=vs.85).aspx ms-help://ms.vscc.v90/ms.msdnqtr.v90.en/wes/wes/eventmanifestschema_keywordtype_complextype.htm i don't have sdk header files in front of me, found following information eventlogrecord managed class: eventlogrecord.level eventlogrecord.keywords

c# - Detect the location of AppData\LocalLow -

i'm trying locate path appdata\locallow folder. i have found example uses: string folder = "c:\users\" + environment.username + @"\appdata\locallow"; which 1 tied c: , users seems bit fragile. i tried use environment.getfolderpath(environment.specialfolder.localapplicationdata) but gives me appdata\local , , need locallow due security constraints application running under. returned blank service user (at least when attaching process). any other suggestions? the environment.specialfolder enumeration maps csidl , there no csidl locallow folder. have use knownfolderid instead, shgetknownfolderpath api: void main() { guid locallowid = new guid("a520a1a4-1780-4ff6-bd18-167343c5af16"); getknownfolderpath(locallowid).dump(); } string getknownfolderpath(guid knownfolderid) { intptr pszpath = intptr.zero; try { int hr = shgetknownfolderpath(knownfolderid, 0, intptr.zero, out pszpath); if

Is there a way to empty the session file with PHP? -

i'm wondering if can destroy/modify sessions in native php way doesn't involve file i/o directives. i'm not talking $_session, i mean access session files themselves . for instance, php stores sessions on linux files: @lamp:/var/lib/php5$ ls sess_301dc8935f1775312e9007431782c68b sess_6892f0bec257e646d193adfd91233c40 sess_966909941003dd6fd333727d8862be6e sess_cb7c07117cef89674a686ffff8a730f2 sess_ffb4db1d9002741b7e0fcc02090b9aaa sess_305aeb0fdba7548e389394cb31d77c3b .... etc $_session gives value of what's inside current session, , session_start() , session_destroy() terminate current session identifier. i want know if can destroy or modify sessions globally in native way php doesn't resort me having fopen(/var/lib/php5/sess_whatever) , don't want work current session, want script able either delete or modify sessions outside of $_session , session_start , , session_stop do, force use present session. sounds me can't have both ways.

How can I extract data from OData API to SQL -

i'm wondering community suggests extracting data odata api sql 2008 r2. need create nightly job imports data sql. should create simple console app iterates through odata api , imports sql? or can create type of sql server bi app? or there better way this? this going sooo slow. odata not api bulk operations. designed clients access individual entities , navigate relations between them, @ paginate across filtered lists. extracting entire dump via odata not going make happy. odata api owner have investigate doing these nightly crawls on api , discover , cut off. on other hand discover odata not efficient bulk transport format , marshaling http encoded entities , forth not best way spend bandwidth. , crawling entire database every time, opposed discovering deltagrams last crawl, going work until database reaches critical size s @ update takes longer frequency you're pooling! besides, if not data, extremely use terms odata api explicitly prevent such bulk crawls.

jquery plugins - How to close boxy window on press ESC key? -

i'm using http://onehackoranother.com/projects/jquery/boxy/ how close boxy window on press esc key? if (this.options.closeable) { jquery(document.body).bind('keypress.boxy', function(evt) { var key = evt.which || evt.keycode; if (key == 27) { self.hide(); jquery(document.body).unbind('keypress.boxy'); } }); }

ruby on rails - How much performance do you get out a Heroku dynos/workers? -

how traffic can site 1 or 2 dynos handle on www.heroku.com , increasing workers improve this? on dynos/workers appreciated. this blog entry may of use. great breakdown of kind of bottlenecks heroku can run into, , how increasing dynos can help, , provides links , information official performance guide on heroku tools test own app. worker performance depends on how site built , using them for. background processing (image formatting, account pruning, etc) called delayed jobs how put them work edit // 1 march 2012: here blog entry explored heroku latency , throughput performance variable number dynos. edit // 28 feb 2013: there have been concerns raised in post regarding heroku's random routing algorithm , how metrics may misreported when scaling dynos, provided new relic. still ongoing issue , note in context of previous answer. heroku's responses linked within post. edit // 8 may 2013: a recent post on shelly cloud blog analyses impact of num

iphone - Deploying PhoneGap Applications to Web instead of to App Store -

i've built web platform 1 small feature allows users contribute data system. smartphones common, want build app allows people submit information, along camera photo , gps location. as our users use varying phones, i'd build single universal app accomplish task. found phonegap online purpose, have question: can phonegap applications deployed web instead of app stores? that, i'm asking whether camera , geolocation functionality still work if html , javascript files placed on web server. if not, i've seen jqtouch. can use jqtouch instead such camera , gps functionality? i believe phonegap application running inside "interpreter" let access camera accelerometer , on... means cannot run outside application. no web deployement jqtouch ui framework, no access camera or gps you can use html5 access location via web

c++ - How to use the Meego touch theme -

i'm new qt , meego. know how make use of meego touch theme. have cloned source git://gitorious.org/meego-handset-ux/meegotouch-theme-meego.git . i don't see helpful though on how use it. can give me jumpstart or @ least tell me how make use of it? the meego themes used meegotouch library (which built on-top of qgraphicsview/scene framework), see @ http://meego.gitorious.org/meegotouch/libmeegotouch the latest api docs whole stuff at: http://apidocs.meego.com/git-tip/mtf/ styling specifics e.g. @ http://apidocs.meego.com/git-tip/mtf/styling.html

c++ - How to implement a memory heap -

wasn't sure how phrase title, question is: i've heard of programmers allocating large section of contiguous memory @ start of program , dealing out necessary. in contrast going os every time memory needed. i've heard faster because avoid cost of asking os contiguous blocks of memory constantly. i believe jvm this, maintaining own section of memory , allocating objects that. my question is, how 1 implement this? thanks, dragonwrenn most c , c++ compilers provide heap memory-manager part of standard library, don't need @ in order avoid hitting os every request. if want improve performance, there number of improved allocators around can link , go. e.g. hoard , wheaties mentioned in now-deleted answer (which quite -- wheaties, why'd delete it?). if want write own heap manager learning exercise, here basic things needs do: request big block of memory os keep linked list of free blocks when allocation request comes in: search list block

jquery - how to apply background color to the found text -

hello have following code , works fine finding , replacing string... not working globally..how make work globally , after replacing want highlight string green color.. how..? <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title> new document </title> <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script> <script> $(document).ready(function(){ $('#replace').click(function(){ var oldstr=$('#inputstring').val(); var newstr=$('#newstring').val(); var para=$('#para').html(); var result=$('p:contains('+oldstr+')'); if(result) { var x=para.replace(new regexp(oldstr, 'i','g'), newstr); $('#para').empty().html(x); } }) }) </script> </head> <body> enter string find:<input type="text" id="inputstr

linux - C++: how to build my own utility library? -

i starting proficient enough c++ can write own c++ based scripts (to replace bash , php scripts used write before). i find starting have small collection of utility functions , sub-routines i'd use in several, otherwise unrelated c++ scripts. i know not supposed reinvent wheel , use external libraries of utilities i'm creating myself. however, it's fun create own utility functions, tailored job have in mind, , it's me large part of learning process. i'll see using more polished external libraries when proficient enough work on more serious, long term projects. so, question is: how manage personal utility library in way functions can included in various scripts? i using linux/kubuntu, vim, g++, etc. , coding cli scripts. don't assume in terms of experience! ;) links tutorials or places relevant topics documented welcome. "shared objects object disoriented!" "dissecting shared libraries"

c# - small problem in shifting range please help me out -

i have small concept problem. i working on graph. consider hav point 32 between range 28 , 35 and have bring points between range 28 , 35 within range 1 , 2. how calculate it? actually ll have point 32. , have shift between 1 , 2... please me out. in other words, if 32 between 28 , 35 32 in range 1 , 2 i think is: 1 + [(number - 28) / (35 - 28)], example 32 (1 + 4/7) = 1.57... and in general if want move within [a,b]: a + (b-a) * [(number - 28) / (35 - 28)]

user interface - how to disable a tab in android screen? -

hi can tell me how disable tab in ui of android code.. (eclair code) if mean disable 1 tab button on tabwidget, try code: // tabhost = ... (get tabhost) tabhost.gettabwidget().getchildtabviewat(your_index).setenabled(false); if want disable tab widget in overall, then: // tabwidget = ... (get tabwidget) tabwidget.setenabled(false); read sdk references: tabhost tabwidget

Xcode UIView for every link that is clicked -

hi want create app displays web site , able open link in new session of uiview every time user clicks on link. need act because want create effect whenever uiview loads , don't want create tons of uiview of pages. actually, displayed website uiview cant control how uiview appears after link selected , cant change site code. know how inside tab bar app on xcode? thanks i know if use uiwebviewdelegate , methods appropriately stop link loading , open link in new view.

jpa 2.0 - Execute @PostLoad _after_ eagerly fetching? -

using jpa2/hibernate, i've created entity has uni-directional mapping entity x (see below). inside a, have transient member "t" trying calculate using @postload method. calculation requires access assosiated xs: @entity public class { // ... @transient int t; @onetomany(orphanremoval = false, fetch = fetchtype.eager) private list listofx; @postload public void calculatet() { t = 0; (x x : listofx) t = t + x.somemethod(); } } however, when try load entity, "org.hibernate.lazyinitializationexception: illegal access loading collection" error. @ org.hibernate.collection.abstractpersistentcollection.initialize(abstractpersistentcollection.java:363) @ org.hibernate.collection.abstractpersistentcollection.read(abstractpersistentcollection.java:108) @ org.hibernate.collection.persistentbag.get(persistentbag.java:445) @ java.util.collections$unmodifiablelist.get(collections.java:1154) @

Voodoo Code In Python -

i going through zed shaw's learn python hard way , in chapter 15 struck me. in credit exercises asks delete latter part of code [everything after print txt.read() ] , execute it, interpreter behaves if nothing has happened. yes, saved file , when modified adding print statements changes still showed up, same voodoo code executed. why? what's going on over here? from sys import argv script, filename = argv txt = open(filename) print "here's file %r:" % filename print txt.read() print "i'll ask type again:" file_again = raw_input("> ") txt_again = open(file_again) print txt_again.read() you executing different file 1 editing.

php - Validating/Allowing YouTube Embed Code -

hopefully simple question. have simple custom forum on site written in php. security reasons don't allow html in forum posts. allow bbcode tags. allow embedded youtube videos. so question this: what's best (most secure) way validate youtube embed code? youtube using iframes embed videos, can't allow iframe tag. need ensure src of iframe youtube url, , ensure there's no other malicious bits of code in iframe code. you should allow users use this: [youtube]http://www.youtube.com/watch?v=te-til9yvae[/youtube] and turn embed code using php when displaying message: function bb_youtube($post) { return preg_replace( "#\[youtube].*?v=([^&]+).*?\[/youtube\]#im", '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/$1?fs=1"></param><param name="allowfullscreen" value="true&qu

zip - how to unzip an encrypted ODT OpenDocument in Java -

i have encrypted odt (open document text) file , need unzip it. odt zip file. encrypted odt normal zip file, files inside zip encrypted. using zipfile works okay in test, cannot use zipfile because have stream in memory, don't want work file. therefore use zipinputstream . using zipinputstream.getnextentry() throws dreadful only deflated entries can have ext descriptor exception. from can understand, throws on first encrypted file inside zip package, example on content.xml. because openoffice has encrypted xml file, no point compressing , stored inside zip package uncompressed. but zipinputstream seems have problem , don't see way around. and yes, encrypted odt file created openoffice writer 3.2.1. , yes, stock zipinputstream cannot enumerate through entries in it. anything can suggest? you can have if it's possible odf toolkit library

nsstring - Trouble displaying % in NSRunAlertPanel -

i developing desktop application want show message in alert panel using nsrunalertpanel. doing following things: nsstring *title = @"% test"; nsstring *message = @"% test message"; nsrunalertpanel(title, message, @"ok" ,@"cancel" ,nil); the alert panel show title properly. i.e % test but, message est message; want display % test message. how solve problem? thanks in advance. try : nsstring *title = @"% test"; nsstring *message = @"%% test message"; nsrunalertpanel(title, message, @"ok" ,@"cancel" ,nil); why? nsrunalertpanel uses nsbeginalertsheet . looking @ documentation nsbeginalertsheet can see there more parameters after msg (specified ... ). this tells title string literally displayed message can have format parameters same way [nsstring stringwithformat:] does. the way string specifies there going parameter using % character i.e. %i means ' put integer here '

polymorphism - C++ virtual functions implementation outside the class -

i new c++. while trying sample polymorphism code, found base class virtual function definition in derived class possible when defined within derived class or outside declaration in derived class. following code gives error: class b { public: virtual void f(); }; void b::f() { std::cout<<"b::f"; } class d : public b { public: void f2() {int b;} }; // error: no "void d::f()" member function declared in class "d" void d::f() { std::cout<<"d::f"; } it works if declare f() inside d. wondering why need explicitly declare function again when declared in base class. compiler can signature base class right? thanks in advance.. you can't add members class outside of class definition. if want d have override b::f have declare inside class definition. rules. declaring member in base class doesn't automatically give derived classes identical member. inheriting base gives derived class members of

How to write for .net 3.5 in Visual Studio 2010 -

i have asp mvc 2 project, written in vs 2008 upgraded vs 2010. want, however, remain .net 3.5 since production environment not have .net 4 installed yet. thought possible. when upgraded project answered no question upgrading .net framework version. have checked , .net 3.5 set target framework in advanced compile options project. my problem can write code builds , runs fine in vs doesn't work in .net 3.5 environment. example, added function optional paramater of type integer? (nullable integer). appears allowed in 4 not in 3.5? anyway, works fine in vs 2010. however, when try build , deploy run 1 of 2 problems. (we use custom build/deploy scripts - build uses msbuild on separate build server.) porblem 1 if try use 3.5 version of msbuild. build fails message "error bc31405: optional parameters cannot have structure types." . problem 2 if try use .net 4 version of msbuild on build server (remember target framework still 3.5, change msbuild executable buil

TabControl winform c# -

does know why tabcontrol not display on form? have feeling maybe simple @ moment blank form. thanks using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace test_project_3 { public partial class tabtest : form { public tabtest() { initializecomponent(); webbrowser wb = new webbrowser(); wb.navigate("www.google.com"); tabcontrol tc = new tabcontrol(); tc.dock = dockstyle.fill; tc.show(); tabpage tp = new tabpage(); tp.text = "test"; tp.show(); tp.controls.add(wb); tc.tabpages.add(tp); } } } you need add tabcontrol controls collection: this.controls.add(tc);

iphone - How i solve memory leak problem? -

i developing simple application in design or make code in creating , instance object of uiimage. when swip on ipad screen make image of sreen , image render uiimage object after image set uiimageview object , uiimage object released. every time swipe on screen , above process again , again. give me leak in renderimage = [[uiimage alloc] init]; . code, _renderimage = [[uiimage alloc] init]; _textimagev = [[uiimageview alloc] init]; [self renderintoimage]; -(void)renderintoimage { uigraphicsbeginimagecontext(bgtableview.bounds.size); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; _renderimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); } _textimagev.image = _renderimage; [_renderimage release]; after completing process of swipe releasing _textimagev. how solve memory leak problem in uiimage *_renderimage? on line: _renderimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsgetimagef

php - Which type of path to store in MySQL database? -

when come build simple site using php , mysql, best method storing paths of files , images? inserting paths mysql (system path c:/---- ) inserting paths mysql (http path http://---- ) always save file paths relative web sites directory. consider website's address "foo.com" , want store images in "foo.com/images". better store images address without "http" , without "foo.com". therefore save filename , subfolder if exists.

android mediaplayer bacgroung loading -

how can load file mediaplayer while showing splash screen in foregroung ,i mean after splash sceen want display video on screen directly without wait if you're using videoview, follow these steps: 1) show splash screen 2) videoview.setmediacontroller(new mediacontroller(this)); videoview.setonpreparedlistener(this); 3) turn off splash screen , play video - public void onprepared(mediaplayer mp) { // splash dismiss here videoview.start(); }

filesystems - Perl File::Find duplicate names -

i'm using perl's module file::find traverse across directory. directory nfs share has directory .snapshot. in folder there's snapshot of yesterdays file structure , has directories same name in result. therefore following error: [folder_in_which_find_is_executed].snapshot/sv_daily.0 encountered second time @ /usr/lib/perl5/5.8.8/file/find.pm line 566. is there way prevent happening e.g. removing duplicate entry? this code sub executes find: sub process() { ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $_; $type = (-f _ ? 'f' : (-d _ ? 'd' : '*')); ($md5sum); if (!defined $dev) { if (-l $_) { die "broken symbolic link: $file::find::name"; } else { die "error processing $type '$file::find::name'";

Netezza SQL - Extract Month issue -

how extract month date in netezza sql? the date shows 05dec2010 . i've tried extract( month contact_date) although doesn't work. ideas? dont want extract it seem contact_date field isn't date field. need use: extract(month (contact_date::date))

.net - Does anything like Selenium GRID for Nunit projects exist? -

it nice speed testing able run tests on multiple machines (this acceptance/integration tests, not unit tests...). there existing easy way using nunit? @dotnetwise points out nunitgridrunner dead, , author proposes alternatives: note: i've given on project i've found jetbrain's team city provides viable option. cruise provides grid processing not good. the team city "build grid" feature might you're looking for. think don't want pnunit . while stands "parallel nunit," home page says: pnunit not intended "casual" parallelism merely make tests run faster. rather, it's intended way test applications composed of distributed, communicating components.

c++ - How to use GetLastError() in VC++ 2010 -

making conversion java c++ isn't easy me guys. i want see if i'm getting access_error violation in code: bool didthisfail = false; if (copyfile(l"myapplication.exe", szpath, didthisfail)) cout << "file copied" << endl; if (copyfilew(l"myapplication.exe", szpath, didthisfail)) { std::cout << "file copied" << std::endl; } else if (getlasterror() == error_access_denied) { std::cout << "can't that." << std::endl; } else { dword lasterror = getlasterror(); //you have cache value of last error here, because call //operator<<(std::ostream&, const char *) may cause last error set //to else. std::cout << "general failure. getlasterror returned " << std::hex << lasterror << "."; }

java - Context Param issue in sun-web.xml -

i using netbeans 6.9.1 glassfish 3 create web application consisting of handful of servlets. need store value in config file database connection string. from find, done using web.xml file (sun-web.xml being auto-generated): <context-param> <param-name>connectionstring</param-name> <param-value>connection string value in here</param-value> and subsequently read in during servlet init() using string constring = context.getinitparameter("connectionstring"); however, when netbeans deploys application following error severe: dpl8007: invalid deployment descriptors element param-name value connectionstring severe: dpl8007: invalid deployment descriptors element param-value valu any idea doing wrong here? here full contents of file: <?xml version="1.0" encoding="utf-8"?> <!doctype sun-web-app public "-//sun microsystems, inc.//dtd glassfish application server 3.0 servlet 3.0//en" "http://ww

django admin action without selecting objects -

is possible create custom admin action django admin doesn't require selecting objects run on? if try run action without selecting objects, message: items must selected in order perform actions on them. no items have been changed. is there way override behaviour , let action run anyway? yuji on right track, i've used simpler solution may work you. if override response_action done below can replace empty queryset queryset containing objects before check happens. code checks action you're running make sure it's approved run on objects before changing queryset, can restrict happen in cases. def response_action(self, request, queryset): # override allow exporting of records csv if no chkbox selected selected = request.post.getlist(admin.action_checkbox_name) if request.meta['query_string']: qd = dictify_querystring(request.meta['query_string']) else: qd = none data = request.post.copy() if le

c - How do I fill the screen with a rectangle in OpenGL ortho mode? -

i have single 640x480 texture needs fill screen. far, can make work square texture, not rectangular one. glviewport(0, 0, display->w, display->h); glmatrixmode(gl_projection); glloadidentity(); double aspectratio = (double)display->w / (double)display->h; if (display->w <= display->h) glortho(-1, 1, -1 / aspectratio, 1 / aspectratio, -1, 1); else glortho(-1 * aspectratio, 1 * aspectratio, -1, 1, -1, 1); glmatrixmode(gl_modelview); glloadidentity(); what modifications need make fit texture screen, regardless of aspect ratio? this may have relevance. tiling texture bmp file texture onto rectangle in opengl? you may wish consider arb extension texture rectangle alternative approach (assuming glteximage2d?) http://glprogramming.com/red/chapter09.html

database - Dataset constraints from DB .net 3.5 -

i have stored procedure in db returns different columns different conditions. (dynamic sql). when use sqlhelper class , execute stored proc in business layer, returns possible columns (from if/else conditions in dynamic sql) in dataset returned. other columns should not part of result set blank. columns come db constraints on them. every time use dataset have set "enforceconstraints" false. there better approach, 1) avoid bringing constraints db? or 2) required dynamic columns db? thank you are datatables being generates weakly or using typed datasets? probably not want hear, advice have different sps different result sets. of inference of result sets e.g. datasets works off sp if sp can return different things based on supplied data, you'll start see issues you've seen.

Mobile phones supporting Java Android? -

what mobile phones supporting java android? is there nokia phone supporting technology? what should mobile contain (a framework, plugin.. etc) if want deploy java android application? there comprehensive list on wikipedia comparing devices running android, including forthcoming devices. nokia seems have no interest using android platform devices. if device certified android platform, there nothing 1 needs add deployment.

c# - what is the reason why we can not open a project created in VS2008 using VS2005? -

why microsoft not support forward comparability? what describe forward compatibility . the reason vs 2008 may (hypothetically) include settings in solution file change rules of game how solution should processed, using mechanics not invented @ time of vs 2005. assuming these settings can break solution if not processed correctly, should vs 2005 when encounters them?

windows installer - How to execute Custom Action before RemoveExistingProducts with After="InstallValidate" in WiX -

i have this: <installexecutesequence> <removeexistingproducts after="installvalidate"/> </installexecutesequence> since 1 of uninstallation fails need execute custom action solve problem before removeexistingproducts. in lines of: <customaction id="fixstuff" .. /> <installexecutesequence> <custom action="fixstuff" before="removeexistingproducts" /> <removeexistingproducts after="installvalidate"/> </installexecutesequence> this of course doesn't work since custom action cannot before installinitialize. i'd remove existing products between installvalidate , installinitialize, i'd execute fixstuff before removing existing products. is possible that? unfortunately cannot run elevated custom action before removeexistingproducts current configuration. some possible approaches be: move removeexistingproducts right before installfinalize. solves cus

micro optimization - Java - Declaring variables in for loops -

is declaring variable inside of loop poor practice? seem me doing so, seen in first code block below, use ten times memory second... due creating new string in each iteration of loop. correct? for (int = 0; < 10; i++) { string str = "some string"; } vs. string str; (int = 0; < 10; i++) { str = "some string"; } is declaring variable inside of loop poor practice? not @ all! localizes variable point-of-use. it seem me doing so, seen in first code block below, use ten times memory second the compiler may optimize things keep memory use efficient. fyi: can it, if use final keyword tell variable has fixed reference object. note: if have more complex object executing complex code in constructor, may need worry single vs. multiple executions, , declare object outside of loop.

c - How to add characters to reach the maximum size of a char[] -

i have following part of code : for(int i=0;i<n;i++) { printf("student %d\n",i+1); printf("enter name : "); scanf("%s",&(student+i)->name); fflush(stdin); lengthname = strlen((student+i)->name); while(lengthname !='\0') { }} when length shorter 10, add hyphens until reaching maximum size. ex : john =>> 6 hyphens added i know how in csharp can't figure out in c. of give me lights please? ps : oh yes variable name char name[10+1] , part of structure called student. this simple seems must missing something. lengthname = strlen(student[i].name); while (lengthname < 10) student[i].name[lengthname++] = '-'; student[i].name[lengthname] = '\0'; perhaps confused c#'s (presumed) possession of first-class string type? no such thing in c, bare arrays of characters; @ once tedious (you have memory management yourself) , liberating (as see above).

Delphi: How to assign dynamically an event handler without overwriting the existing event handler? -

i need loop through components , assign event handler (for example dynamically assigning onclick event tbutton to showmessage('you clicked on ' + (sender tbutton).name); the problem in cases assigned tbutton onclick event. is there way solve problem? let's imagine have button1 harcoded onclick event handler is: showmessage('this button1'); after "parsing" full event handler button1 becomes: showmessage('this button1'); // design time event handler code showmessage('you clicked on ' + (sender tbutton).name); // runtime added note: looking soliution allows me use tbutton without inheriting it. you assignment of onclick before overwriting it, persist , use in new handler - chaining events. something this: var original : tnotifyevent; original := component.onclick; component.onclick := newmethod; and in newmethod: if assigned(original) original(sender); you'll not want single original variable

java - Unable to load class for JSP -

exception stack trace org.apache.jasper.jasperexception: unable load class jsp org.apache.jasper.jspcompilationcontext.load(jspcompilationcontext.java:599) org.apache.jasper.servlet.jspservletwrapper.getservlet(jspservletwrapper.java:143) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:321) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:308) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:259) javax.servlet.http.httpservlet.service(httpservlet.java:729) java.lang.classnotfoundexception: org.apache.jsp.redirect_jsp java.net.urlclassloader$1.run(unknown source) java.security.accesscontroller.doprivileged(native method) java.net.urlclassloader.findclass(unknown source) org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:131) org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:63) org.apache.jasper.jspcompilationcontext.load(jspcompilationcontext.java:597) org.apache.jasper.servle

How to get the execution time of a MySQL query from PHP? -

this question has answer here: mysql execution time 3 answers i execute mysql queries php , know how time consuming are. there way execution time of mysql query php? i wonder if execution time depends on how loaded web server. can imagine query take more time execute if server busy other queries. on other hand, can imagine that, if server busy, query wait turn , executed (without queries executed in parallel) , waiting time not included execution time. so, scenarios (out of two) correct? there way via mysql, however, easy (and reliable) way using php's microtime function, returns current time milliseconds. microtime() returns current unix timestamp microseconds. function > available on operating systems support gettimeofday() system call. getasfloat - when called without optional argument, function returns string "msec sec" s

iphone - Objective C: retain vs alloc -

i have singleton class code: manager.h @interface manager : nsobject { nsstring *jobslimit; nsmutabledictionary *jobtitles; } @property (nonatomic, retain) nsstring *jobslimit; @property (nonatomic, assign) nsmutabledictionary *jobtitles; @implementation manager @synthesize jobslimit; @synthesize jobtitles; + (id)sharedmanager { @synchronized(self) { if(shared == nil) shared = [[super allocwithzone:null] init]; } return shared; } - (id)init { if (self = [super init]) { jobslimit = [[nsstring alloc] initwithstring:@"50"]; jobtitles = [[nsmutabledictionary alloc] init]; } return self; } then in code i'm assigning these variables this: self.jobslimit = [nsstring stringwithformat:@"%d", progressasint]; [self.jobtitles addentriesfromdictionary:anotherdictionary]; - (void)dealloc { [super dealloc]; [jobslimit release]; [jobtitles release]; } now question code correct