Posts

Showing posts from July, 2012

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.

iphone - Deleting all objects from a section in a Core Data backed UITableView doesn't trigger the selection to delete? -

i'm having problem managing sections in core data backed uitableview, using nsfetchedresultscontroller. my table view can have 2 sections, first static section , displayed conditionally. second section being populated fetched results controller. i'm using following determine how many sections display. if delete of fetched objects in second section, expect section deleted well. - (nsinteger)numberofsectionsintableview:(uitableview *)atableview { nsinteger numberofsections = 0; if (self.locationenabled) numberofsections++; if ([[[self.fetchedresultscontroller sections] lastobject] numberofobjects]) numberofsections++; return numberofsections; } the problem approach datasource method informing table should displaying 1 section because there no fetched objects remaining, removing last object never triggered deletion of section through fetched results manager delegate methods. how trigger section deletion avoid receiving uikit inconsistency errors? edit : should po

Passing Location string as parameter to google places from iphone sdk -

i working on google places list local interest points particular location. not able set particular location right in link. following link trying use. http://www.google.com/m/local/lstr=bryn+mawr http://www.google.com/m/places/lstr=bryn+mawr https://maps.googleapis.com/maps/api/place/details/json?reference=reference_id&client=clientid&sensor=true_or_false&signature=signature https://maps.googleapis.com/maps/api/place/details/xml?reference=reference_id&client=clientid&sensor=true_or_false&signature=signature please suggest solution regarding this. take @ api . makes pretty clear have include. see required parameters: location ( required ) — textual latitude/longitude value wish retrieve place information. example: location=-33.8670522,151.1957362 -- query not have location. radius ( required ) — distance (in meters) within return place results. recommended best practice set radius based on accuracy of location signal given

Java default constructor -

what default constructor — can tell me 1 of following default constructor , differentiates other constructor? public module() { this.name = ""; this.credits = 0; this.hours = 0; } public module(string name, int credits, int hours) { this.name = name; this.credits = credits; this.hours = hours; } neither of them. if define it, it's not default. the default constructor no-argument constructor automatically generated unless define constructor. initialises uninitialised fields default values. example, assuming types string , int , int : public module() { super(); this.name = null; this.credits = 0; this.hours = 0; } this same as public module() {} and same having no constructors @ all. however, if define @ least 1 constructor, default constructor not generated. reference: java language specification clarification technically not constructor (default or otherwise) default-initialises fields. however, leaving in answer

.net - Custom skin and flicker -

i created custom skin overlaying transparent images , transparencykey. http://jesconsultancy.nl/vb.rar (only right bottom corner works resize) i have written custom code resize , drag application. when resize application flickers. there wil become space between borders of image/panels. how solve this? i can't make screenshot of problem because on screenshot there no flicker effect :/ are redrawing on every resize event? if so, might redrawing often, , might need decouple render resize event (e.g. while resizing , mouse down, don't render). i've had similar problems before, on dragging objects in window ...

python - BeautifulSoup: get contents[] as a single string -

anyone know elegant way entire contents of soup object single string? at moment i'm getting contents , of course list, , iterating on it: notices = soup.find("div", {"class" : "middlecontent"}) con = "" content in notices.contents: con += str(content) print con thanks! what contents = str(notices) ? or maybe contents = notices.rendercontents() , hide div tag.

asp.net - MSSQL Query Error: "Cannot insert the value NULL into column <X>." -

Image
following error occurs in /// coding " cannot insert value null column 'boarding', table 'c:\users\vbi server\documents\visual studio 2008\websites\volvo\app_data\aspnetdb.mdf.dbo.boardingpt'; column not allow nulls. insert fails. statement has been terminated. protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click dim con new sqlconnection dim cmd new sqlcommand con.connectionstring = "data source=.\sqlexpress;attachdbfilename=|datadirectory|\aspnetdb.mdf;integrated security=true;user instance=true" con.open() cmd.connection = con cmd.commandtext = "insert boardingpt (service, travelid, bdpt_name, time) values('" & trim(textbox3.text.tostring) & "', '" & trim(textbox4.text.tostring) & "', '" & trim(textbox1.text.tostring) & "','" & trim(textbox2.text.tostring) &

terminology - what is PAT (Pre Acceptance Testing)? -

what pat, when pre acceptance testing? i don't think it's widely-used term or part of standard. therefore, means organization-specific , should defined in glossary somewhere. more though you'll have ask people means.

sql server - MS SQL apotrophe in prompt in WHERE clause -

i trying deal apostrophe in prompt field in sql statement. example below : where propertyfieldintable=@promptfromuser the problem there addresses ' eg. wood's therefore sql works other addresses except '. i have tried use replace(@promptfromuser,"'","''") keep getting error (missing right '). propertyfieldintable text field assuming needs text input prompt. i appreciate straightforward suggestions query not in database sits within reporting tool can't take functions. you need use parameters.

Auto Populate CTE in SQL Server -

how can auto populate cte contain first day of every month eg: 1-1-2010 2-1-2010 3-1-2010 4-1-2010 and on. looking query so, rather using union operator. have @ like declare @startdate datetime, @enddate datetime select @startdate = '01 jan 2010', @enddate = '01 jan 2011' ;with dates ( select @startdate startofmonth union select dateadd(month,1,startofmonth) startofmonth dates dateadd(month,1,startofmonth) <= @enddate ) select * dates output startofmonth ----------------------- 2010-01-01 00:00:00.000 2010-02-01 00:00:00.000 2010-03-01 00:00:00.000 2010-04-01 00:00:00.000 2010-05-01 00:00:00.000 2010-06-01 00:00:00.000 2010-07-01 00:00:00.000 2010-08-01 00:00:00.000 2010-09-01 00:00:00.000 2010-10-01 00:00:00.000 2010-11-01 00:00:00.000 2010-12-01 00:00:00.000 2011-01-01 00:00:00.000 edit with column name supplied declare @startdate datetime, @enddate datetime

What's the right way to add haml to a rails application? -

while looking way add haml templating engine rails app came upon 2 distinct ways it. the first 1 add 'gem "haml-rails"' gemfile. the second 1 add code config/application.rb: config.generators |g| g.template_engine :haml end is there reason prefer 1 on other? i prefer gem because adds generators. update: 'haml-rails' gem provides generators. you'll still need set template_engine haml if want haml templates default.

Python: split on two different expressions? -

possible duplicate: python strings split multiple separators is there way in python split string on 2 different keys? say have string this: mystr = "wketjwlektjwltjkw<br/>wwwweltjwetlkwjww" + \ "wwetlwjtwlet<strong>wwwwketjwlektjwlk</strong" i'd split on either <br/>wwww or <strong>wwww . how should this? thanks! import re re.split(r'<(br\/|strong)>wwww', mystr)[::2]

ios - Access apps with AppleScript -

is there anyway programmatically list of ios apps itunes? applescript not seem able this. the way can think of looking in 'itunes media/mobile applications' folder. way lose metadata. any suggestions list of ios apps including metadata? thanks i went solution scan 'mobile applications' folder. in order metadata had following: the *.ipa archives unzip/extract 'itunesmetadata.plist' inside parse plist voila got metadata this whole process pretty straightforward in python have both zipfile , plistlib. one thing lookout though plistlib in python can not handle new binary plist files. first have convert them corresponding xml format. (only *.ipa seem in binary form). this can done quite following line of code: os.system("/usr/bin/plutil -convert xml1 %s" % file_name ) now thing still have figure out how installed apps on device...

android - Creating an App that Contains a Group of Applications -

hello , in advance help i have series of android apps using. whenever recommend these apps someone, have go on each 1 individually. i wanted know if possible create single application will: download of individual apps @ once , install them create app icon when launched creates submenu of related apps , file walk user through each one. is possible? if so, how difficult do? thanks again help dave for download , installation, it's not difficult. you'll have market url of apps want include, , use custom intent download , install them (something using action_view should trick for second part, create launcher, , have screen buttons , screen. shouldn't hard do.

reporting services - SSRS Report Builder and Firefox -

i have chosen ssrs deliver ad-hoc reports via report models user. did not consider how work in different browsers. i have found report builder download (which click once application) not work on firefox. instead of running , installing application gives option "save file". puts file reportbuilder.application download list. when select install install starts (the "verifying application requirements" dialogue displays) there error. details of error are: - error summary below summary of errors, details of these errors listed later in log. * activation of c:\users\hobsong\downloads\reportbuilder(5).application resulted in exception. following failure messages detected: + downloading file:///c:/users/hobsong/downloads/reportbuilder.exe.manifest did not succeed. + not find file 'c:\users\hobsong\downloads\reportbuilder.exe.manifest'. + not find file 'c:\users\hobsong\downloads\reportbuilder.exe.manifest'. + n

javascript - Jsmin on folder with subfolders -

i running jsmin compress javascript files of asp.net web application postbuild event in csproj file this: "jsmin.exe" "$(projectdir)script" "$(projectdir)script\minified.js" this working fine when kept js files in root of script folder. starting become alot of files in folder, decided divide files subfolders. seems jsmin fetches js files in root folder, , cannot see has option include files in sub-folders. have solution situation this? seem me should pretty common thing do, why bit surprised not parameter jsmin.exe enabling sub-folders. you should able use dos' for command that: for /r "$(projectdir)scripts/debug" %s in (*.js) jsmin.exe %s > "$(projectdir)scripts/release/%~ns.min.js" that assumes scripts in (or in directories within) directory named ~/scripts/debug , minifies them ~/scripts/release .js replaced .min.js. i've tested in cmd, not build event in vs. so, may need tweak syntax slig

How to initialize a a struct of structs inside a header file in C? -

i trying port old code on 20 year old dos system gnu linux system. in several of header files, (which included on place), have structs of structs declare , initialize. getting warnings when compile way legacy code written. tips on how can work staying inside same header file? the following simplified example made of doing. struct { struct b temp1; struct c temp2; }; struct b { int temp3; int temp4; int temp5; }; struct c { int temp6; int temp7; int temp8; }; //these variables in how related initialization below //struct test_one = {{temp3,temp4,temp5},{temp6,temp7,temp8}}; struct test_one = {{1,2,3},{4,5,6}}; you shouldn't instantiate structures in header files. if different instance created in each c file include header in not desired effect. in c file have following. void foo(){ struct parent; struct b child_b; struct c child_c; child_b.temp3 = 3; child_b.temp4 = 4; child_b.temp5 = 5; child_c.temp6 = 6; child_c

Recording music and Sending it to ftp server using iphone -

hi have plan develop iphone application records drum playing sound , uploads ftp server. i want know possible upload ftp server while recording?. because if decide record , save upload later, there chance of memory full. want avoid . can send music files splitting small piece ? please suggest me solution this. thanks in advance. you stream audio webserver, written in whatever language choose. the server code create small files on ftp server while recording still taking place, , possibly stitch them after recording complete. this is, however, advanced first project, , make sense 'splitting' on device before hand (possibly record multiple 10 second tracks), , transmit them ftp after recording complete.

windows - SQL Server failover cluster - determine active node -

is there way programmatically determine node in sql server failover cluster active node ? or @ least determine whether current machine active node? i have windows program runs on both physical nodes in failover cluster, should operate differently depending on whether running on active node. part of reason program should not run simultaneously on inactive , active node . (i've read bit making program cluster aware, seems heavily overkill simple scenario.) from sql server: select serverproperty('computernamephysicalnetbios') you can access through microsoft.sqlserver.management.smo namespace shown here .

Add additional column to many-to-many join table in Doctrine 1 -

i set many many relationship between orders , sets. order can contain many sets , different sets can belong different orders. because can set amount set in order there should additional column amount. e.g. order can consist of 5 x "set a" , 10 x "set b". this schema of join table: orderset:columns: amount: integer order_id: type: integer primary: true set_id: type: integer primary: true works fine far, don´t know how can set value of amount column. this how save order / set-order relationship: public function saveorder($data){ $tempsets = $data->sets; $order = new order(); unset($data->sets); $order->merge((array) $data); foreach($tempsets $set){ $q = doctrine_query::create() ->from('set s') ->where('s.id = ?', $set->id); $set = $q->fetchone(); $order->sets->add($set); } $order->save(); } how can set amount of each set? many

In Blackberry, can we create common library that can be used by different applications? -

i want create common 3rd party library, can shared , used different applications , consistent. can acheive ?.if yes, how , library installed ? and how can these library files accessed other apps ? yes can this. create , compile libary. can either install ahead of applications depend on it, or applications. desktop manager can use alx files generated jde you, or can use jad files ota installation. libarary code module other not have desktop icon, installs in same place rest of modules.

Regex to extract attribute from html element -

text stream: <option value=\"1999\">1999</option>\r\n \r\n \r\n\r\n \r\n\r\ n <option value=\"2000\">2000</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2001\">2001</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2002\">2002</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2003\">2003</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2004\">2004</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2005\">2005</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2006\">2006</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2007\">2007</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2008\">2008</option>\r\n \r\n \r\n\r\n \r\n\r\n <option value=\"2009\"&

decoding - Parsing XML string using XSLT -

i have xml document has textblock contains html code. <textblock> <h1>this header.</h1> <p>this paragraph.</p> </textblock> in actual xml, however, coded this: <textblock> &lt;h1&gt;this header.&lt;/h1&gt; &lt;p&gt;this paragraph.&lt;/p&gt; </textblock> so when use <xsl:value-of select="textblock"/> displays of coding on page. there way using xslt convert &lt; < within textblock element? <xsl:value-of select="textblock" disable-output-escaping="yes"/> and result: <h1>this header.</h1> <p>this paragraph.</p> firefox has corresponding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=98168 , contains lot of comments , interesting reading. i looking fix now. edit <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:import href=&quo

oracle - Logging Framework for the ASP.NET application -

my application needs log informations user actions (inserts, updates, deletes, etc) , exceptions , want store de log on oracle10, i'am searching log framework use. read little bit about: 1 -log4net 2 - logging application block 3 - elmah whats opinion these log tools? whats framework (or way implement) log on application? *after discussion project manager, logging application block our choice, but, lets comment =) both log4net , logging application block valid choices. think elmah focused on error logging, not (the thing) want. at work, use log4net on couple of projects. stable, performant , extensible, , have never had problems it. i logging log4net , log exceptions elmah also. can log unhandled exceptions manually, , exception catch , handle in application can logged single call elmah. might seem double-logging (and :-)). valuable have elmah log when unexpected has failed in application. i have heard things nlog project , haven't used myself. se

java - Embedded Web Server -

we have web application should accessible multiple sub-domains , multiple actual domains. e.g. clients sign , if want can use own domains. far know achieved them pointing domains record @ , our web server, have embedded can update @ run-time, adding virtual host dynamically. our web application written in php (although playing around hiphop convert c++) static html , css. web application communicates back-end java api uses restlet framework. does know of web server embedded work php (and work hiphop if used that)? have had @ appweb wondered if there others. i wonder if maybe better moving web app java , using jetty? thanks, if understand question correctly, need lookup the $_server['server_name'] which different clients uses different domains. regarding minimalistic webserver, i've found mongoose flexible , easy setup. (uses php-cgi). http://code.google.com/p/mongoose/ regards, //t

printing - Any way to css select all EXCEPT the first page? -

i found css @page directive, , using :first apply css first page of html print. there way go opposite, , apply css pages except first? use css3's :not() : @page :not(:first) { } if need better browser compatibility, donut's solution of styling "undoing" them :first works (relying on specificity/the cascade). @page { /* styles first page */ } @page :first { /* override perhaps stylesheet's defaults */ }

c# - Loop list while adding to it -

i've built system in c-sharp (winforms) , i've run problem. in view - graphical interface - i'm starting pretty heavy algorithm, in each loop adds result list in view. algorithm runs in presenter (mvp pattern), using backgroundworker - enabling view not freeze. said before, algorithm runs in loop, , since it's heavy, want process results of algorithm come in. view: ... public list<string> results { get; } ... _presenter.runalgorithmasync(); //start processing results ... backgroundworker in presenter: ... _view.results.add(result); ... to sum up, how can start processing list while backgroundworker adds it? of course, backgroundworker can work faster processing of list, , vice versa - processing may have wait results arrive list, , list need able build stack of results. i realize question may blurry, if ask me questions, i'm sure can define problem better. use queue , have 2 threads treat producer , consumer .

javascript - Drawing graphics in ExtJs -

Image
first off want point out i'm new extjs library. want create image through use of drawing/canvas api. image want create similar below image. i'm wondering if possible through javascript/extjs because haven't been able find online makes clear. if can think of different kind of approach appreciate well. i don't know of canvas api ext. can use canvas api ext. i fiddled it . markup: <canvas id="c1"></canvas> javascript: ext.onready(function() { draw(document.getelementbyid('c1')); }); function draw(el) { var canvas = el; var ctx = canvas.getcontext("2d"); ctx.strokerect(0, 0, 50, 200); for(var y = 10; y < 200; y += 10){ ctx.moveto(0, y); ctx.lineto(25, y); } ctx.stroke(); ctx.closepath(); }

.net - How to convert a Class Library project to a Web Application project? -

long story short, because of issues architecture , fact put few .aspx files in class library, i'd finish off change , convert class library web application. using visual studio 2010 , .net 4.0. there easy way of doing this? thanks! edit: hoping better method recreating project, had many issues broken references when tried creating new project, including 1 never seem fix. create new web application project in solution , drag , drop files class library new web application project.

internals - How does PHP actually work? -

is there guide out there describes how php internals? how files loaded (required, included)? how parsed , executed? how memory allocated? how objects created/destroyed? how external modules loaded? how stack/heap works? how opcode caching work? common hacks , performance tips? sounds me you're should resources on php internal development. looking information elsewhere scattered. i suggest picking php core development book local book store , giving read. php.net has underdeveloped beginners reference if wanted start there.

actionscript 3 - restoring scroll position in Flex Web Page -

this crucial overlooked functionality guess in web page - on standard (non flex) web page, navigate away page , return via or forward button , restores scroll position @ on page previously. crucial function , annoying if wasn't there - having page automatically go top each time when scrolled way down on long text site. guess browser must managing this,as surprised find deleting cookies, cache , not rid of saved scroll position. so problem doing on flex web page - correct way it. have been using sharedobject.getlocal, dumbfounded discover once local shared object created , never deleted, there nothing user can in browser delete them (deleting cookies, etc has no effect.) had 100 different sharedobjects in macromedia subdirectory storing nothing scroll positions. standard web pages can delete browsing history, sharedobject they're there unless delve file subdirectory , delete them manually (which of course user never do.) subquestion be, true there no way delete share

Problem when assigning a pointer to an enum variable in C -

i getting warning of "assigment incompatible pointer type". don't understand why warning happening. don't know else declare "the_go_status" variable other integer. (note: not code, simplified version posted illustrate problem.) the warning occurs on last line of example included below. //in header file enum error_type { err_1 = 0, err_2 = 1, err_3 = 2, err_4 = 4, }; //in header file struct error_struct { int value; enum error_type *status; }; //in c file int the_go_status; the_go_status = err_1; //have error_struct "status" point address of "the_go_status" error_struct.status = &the_go_status; //warning here! because status pointer enum error_type, , the_go_status pointer int. pointers different types.

Webkit browsers (Chrome, Safari) are loading pages redirected from .htaccess twice! -

i have problem. when visit page php code: $_session['test']++; echo $_session['test']; and page redirected throught .htaccess rewriteengine on rewritebase / rewritecond %{request_filename} ^(.+)\.php$ rewritecond %{request_filename} !-d rewriterule ^([^/]+)\.php index.php?rw=1&page=$1 [qsa,l] so in non-webkit browsers see 1, on next refresh 2, 3, 4, 5 ... in chrome or safari see 1, 3, 5, 7, ... does have idea how solve it? need every page redirect index.php , load content ... every f***ed redirect has same result ... twice loaded! when there mysql query, processed twice, ... :-/ thank you! :) problem was, there were: <iframe src="#"></iframe> webkit has got problems it, , load pages twice ... solution is <iframe src="http://www.example.com/blankpage.html"></iframe> it all!!! after 10 hours of madness ... :-/

c# - event is not null but _invocationList is null? -

i thought if have code: public event propertychangedeventhandler propertychanged; protected void onpropertychanged(propertychangedeventargs e) { if (propertychanged != null) propertychanged(this, e); } and propertychanged event wasn't hooked, proeprtychanged null , i'm getting propertychanged not null , _invocationlist member null , _invocationcount member 0. (i think) causing argumentoutofrangeexception when invoke propertychanged(this, e) . idea problem be? this stack trace onclick event: at system.collections.arraylist.get_item(int32 index) @ system.windows.forms.bindingscollection.get_item(int32 index) @ system.windows.forms.bindingmanagerbase.pushdata(boolean& success) @ system.windows.forms.propertymanager.oncurrentchanged(eventargs ea) @ system.windows.forms.bindtoobject.propvaluechanged(object sender, eventargs e) @ system.eventhandler.invoke(object sender, eventargs e) @ system.componentmo

c - Different Truncation Results When Casting -

i'm having some difficulty predicting how c code truncate results. refer following: float fa,fb,fc; short ia,ib; fa=160 fb=0.9; fc=fa*fb; ia=(short)fc; ib=(short)(fa*fb); the results ia=144, ib=143. i can understand reasoning either result, don't understand why 2 calculations treated differently. can refer me behaviour defined or explain difference? edit: results compiled ms visual c++ express 2010 on intel core i3-330m. same results on gcc version 4.4.3 (ubuntu 4.4.3-4ubuntu5) under virtual box on same machine. the compiler allowed use more precision subexpression fa*fb uses when assigning float variable fc . it's fc= part changing result (and happening make difference in integer truncation).

matlab - Calculating confidence intervals for a non-normal distribution -

first, should specify knowledge of statistics limited, please forgive me if question seems trivial or perhaps doesn't make sense. i have data doesn't appear distributed. typically, when plot confidence intervals, use mean +- 2 standard deviations, don't think acceptible non-uniform distribution. sample size set 1000 samples, seem enough determine if normal distribution or not. i use matlab processing, there functions in matlab make easy calculate confidence intervals (say 95%)? i know there 'quantile' , 'prctile' functions, i'm not sure if that's need use. function 'mle' returns confidence intervals distributed data, although can supply own pdf. could use ksdensity create pdf data, feed pdf mle function give me confidence intervals? also, how go determining if data distributed. mean can tell looking @ histogram or pdf ksdensity, there way quantitatively measure it? thanks! are sure need confidence intervals or 90%

jquery - Control the appearance of a Google Map from My Maps -

i'm having difficult time looking instructions on how customize appearance of embed map instance i've created in google maps , stored in maps. there jquery plugins generating , manipulating new map instances, haven't found on how manipulate existing map instance maps. does have recommendation jquery plugin can manipulate appearance of maps map instance? i figured out: import rss/kml feed map overlay: http://code.google.com/apis/maps/documentation/javascript/v2/services.html#xml_overlays

Nicely formatted numbers in SQL Server -

how do following in microsoft sql server 2005? declare @pct decimal(4,1) set @pct=3.1 select when @pct = cast(@pct int) cast(cast(@pct int) varchar) else cast(@pct varchar) end newpct i'm trying drop .0 if percent ends in whole number. what have work if add case keyword declare @pct decimal(4,1) set @pct=3.1 select case when @pct = cast(@pct int) cast(cast(@pct int) varchar) else cast(@pct varchar) end newpct

ASP.NET MVC3 how to switch the validation to different JS validation framework -

how switch validation different js validation framework in asp.net mvc3? default jquery validation. here can find more details want do? link text you can read other question here: link text

c++ - Compiling with icc -static issue -

i have been using icc compile program wrote research (nothing impressive lot of floating point calculations) , can compile fine using: g++ -o3 mixingmodel.cpp configfile.cpp -o mixingmodel or icc -o3 -ipo -static mixingmodel.cpp configfile.cpp -o mixingmodel however, add -static compiler hangs. issue first crept when wanted use -fast , compiler sat there compiling away forever. process running called mcpcom , takes 99% of cpu (so 1 thread) , hardly memory. have let sit there on 30 minutes before (usual compile time without -fast under 1 minutes). i went ahead , wrote small hello world program in c++ , tried compiling -fast flag , again showed same mo. sat there 99% cpu used , process called mcpcom. note: compiling on 64bit linux icc version 11.1 20100806 thank you, patrick this due icc's inter-procedural optimization. considers object files, can lot when doing static linking. recommend drop -ipo . apparently, old problem .

c - How can I retrieve rows in a text file -

i started programing in language c, , have problems reading text files. let me explain. i have 1 file text organized : tony 12.23 john 09.45 tayris 03.99 i retrieve notes less ten , display them, can't... does me? thanks lot. c provides 4 functions can used read files disk: fscanf() field oriented function. fgets() line oriented function. fgetc() character oriented function fread() block oriented function. see this article more information.

asp.net - How to accept an out parameter in Ajax? -

i have static function in aspx page signature: public static bool userneedstobealertedpwdreset(out datetime dtexpires) { datetime dt = datetime.mivvalue; return true; } so want call function client side, using jquery ajax. how hold of out value? edit alternatevly check nulls if possible ajax + jquery that: public static datetime? userneedstobealertedpwdreset() { if(blah) return null; return datetime.now; } why not create function returns json response include data need. i prefer create .ashx handlers these types of things , return json response easy call , and handle client side.

c# - Windows form application exception -

i application exception @ system.windows.forms.currencymanager.get_item(int32 index) @ system.windows.forms.currencymanager.get_current() @ system.windows.forms.datagridview.datagridviewdataconnection.onrowenter(datagridviewcelleventargs e) @ system.windows.forms.datagridview.onrowenter(datagridviewcell& datagridviewcell, int32 columnindex, int32 rowindex, boolean cancreatenewrow, boolean validationfailureoccurred) @ system.windows.forms.datagridview.setcurrentcelladdresscore(int32 columnindex, int32 rowindex, boolean setanchorcelladdress, boolean validatecurrentcell, boolean throughmouseclick) @ system.windows.forms.datagridview.oncellmousedown(hittestinfo hti, boolean isshiftdown, boolean iscontroldown) @ system.windows.forms.datagridview.oncellmousedown(datagridviewcellmouseeventargs e) @ system.windows.forms.datagridview.onmousedown(mouseeventargs e) @ system.windows.forms.control.wmmousedown(message& m, mousebuttons button, int32 clicks)

coldfusion - How do I force evaluation of a cfif stored in a string? -

i trying store coldfusion code in database used subject of cfmail. code stored follows: "re: <cfif mydata.general.legalname neq """"> {{dotlegalname}}<cfelse>{{docketlegalname}}</cfif>, dot## {{dot}}, docket ##(s) {{docketstring}}" when retrieve string database, use cfsavecontent attempt evaluate it. <cfsavecontent variable="subject"> <cfoutput>#mydata.email.subject#</cfoutput> </cfsavecontent> i tried <cfsavecontent variable="subject"> <cfoutput>#evaluate(mydata.email.subject)#</cfoutput> </cfsavecontent> and replace {{ }} appropriate values. however, subject of email stubbornly refusing contain evaluated cfif, , instead showing cfif if string. any ideas? the way dynamically evaluate code creating @ runtime via writing out file, , executing it. the easiest way write .cfm page in virtual file system (probably name file after uu

javascript - Change Enter from submission to Tab? -

users don't fact enter key submits page. tasked preventing submission , changing enter key tab next field. i have tried many javascript snippets found on net none have worked far. 1 has come close having effect e.preventdefault() of jquery api, stops submit, nothing have tried emulates tab behavior. e.returnvalue = false; e.cancel = true; page still submits above in keydown event handler. same effect return false in keydown event handler. handler firing, tested putting breakpoint in firebug. this needs work both ie , firefox. don't "don't this". 1) i'm convinced shouldn't it, it's not choice mine, discussion mute. 2) answer question "should this?", not question asking. this feels icky, use event.preventdefault mentioned , call focus() on next closest input: here's simple example: $("input").bind("keydown", function(event) { if (event.which === 13) { event.stoppropagation(

ruby on rails - Convert ActiveSupport::TimeWithZone to DateTime -

i'm trying step every n days between 2 dates. tried following code wasn't working because startdate , enddate activesupport::timewithzone objects , not datetime objects thought. startdate.step(enddate, step=7) { |d| puts d.to_s} min.step(max, step=stepint){ |d| puts d.to_s } how covert timewithzone object datetime? datetime old class want avoid using. time , date 2 want using. activesupport::timewithzone acts time . for stepping on dates want deal date objects. can convert time (or activesupport::timewithzone ) date time#to_date : from.to_date.step(to.to_date, 7) { |d| puts d.to_s }

vb.net - ScriptManager is not declared - err msg -

i've class , gave me error name 'scriptmanager not declared' public notinheritable class responsehelper private sub new() end sub public shared sub redirect(byval response httpresponse, byval url string, byval target string, byval windowfeatures string) if ([string].isnullorempty(target) orelse target.equals("_self", stringcomparison.ordinalignorecase)) andalso [string].isnullorempty(windowfeatures) response.redirect(url) else dim page page = directcast(httpcontext.current.handler, page) if page nothing throw new invalidoperationexception("cannot redirect new window outside page context.") end if url = page.resolveclienturl(url) dim script string if not [string].isnullorempty(windowfeatures) script = "window.open(""{0}"", ""{1}"", ""{2}"");" else script = "window.ope

tsql - T-SQL - Help with MAX Operation Over Many-to-Many -

this closely related previous question asked. i have many-to-many relationship between post , location . the join table called postlocations , , has nothing fk's. (locationid, postid) i'm trying pull top post each location . this query have (which given in answer previous question): select pl.locationid, p.postid, p.uniqueuri, p.content, max(s.basescore) topscore dbo.postlocations pl inner join dbo.posts p on pl.postid = p.postid inner join dbo.reviews r on p.postid = r.postid inner join dbo.scores s on r.scoreid = s.scoreid group pl.locationid, p.postid, p.uniqueuri, p.content but problem is, because postlocations have entries this: locationid postid 1 213213 2 498324 1 230943 so above query returning locationid 1 twice , because has 2 records in join table. want 1 record per location - top post per locationid. i've tried this: select l.locationid, p.postid, p.uniqueuri, p.content, max(s.basescore) topscore dbo.

HTML map with css rollovers? -

i have create html page use on cd. navigation html map co-ordinates set. when user rolls on co-ordinate, want image popup appear beside it. there's 8 map links, , 8 corresponding image popups. i through jquery, cd used on ie mainly. ie doesn't allow javascript run locally (without user interaction, isn't acceptable). through jquery absolutely positioned rollover images, can't set them visible through css hover. what's best method approach this? you try serious styling effects based on pseudo-class of :hover. without knowing markup tackle along these lines... html markup <div id="mapwrapper"> <ul id="map"> <li id="location-01"><span>map text</span> <div class="item">additional pop text</div></li> <li id="location-02"><span>map text</span> <div class="item">additional pop text</div></li> <li id=&qu

javascript - IE7 problems with displaying text in TD -

i can not figure out why text inside td not displayed in ie7. frustrated core cuz works in ff! trying dynamically build table onload... appreciated. complete script @ pastebin user insertrow , insertcell add rows , cells ex: var row = table.insertrow(); row.id= rowid; var headercell = row.insertcell(); headercell.colspan = colspan; headercell.classname = "rightaligned"; headercell.innerhtml = "header text";

objective c - Displaying data from an array into labels and text areas (SQLite, iPhone) -

i reading tutorials sqlite data reading , appear use tables displaying data , wondering if had example of getting data array , displaying 1 database column in label , in text area. any great, thanks! you still need use tableview. you'll need customize appears user there 1 column solely labels, , column solely text areas. besides, don't think question has sqlite. appears more ui pattern things.

delphi - When is space allocated for local variables? -

example function test: boolean; var a, b, c: integer; begin ... end; when program containing such code executed, a , b , , c allocated each time test called, or allocated once somewhere in initialization phase of execution? ask because such information not available in debugger. here more exact version. local variables allocated: usually on stack; in registers if optimizer can use it: instance, simple method loop , var i: integer declared local variable allocate i cpu register, better speed. how stack allocated? on both x86 , x64 scheme, compiler has same process: it first computes space needed, @ compile time; it generates code reserve space on stack (e.g. mov ebp,esp; sub esp,16 ); it generates code initialize reference-counted variables allocated on stack (e.g. string ) - other kind of variables (like integer ) have no default value, , can random content on stack; it generates hidden try..finally block if there reference-counted variables;

java - Changing dropdown options -

i developing musical store. in application in makepayment.jsp have 4 links user choice , based on user choice want change options in dropdown. how can that? look @ onchange event of input component, , javascript .

winapi - C++ How to draw letter same size -

i'm working on edit box i'm creating. need find font draw letter @ same size. i'm using directx i'm guessing "find font draw letter @ same size" mean font of letters same size. called monospaced or fixed width font. there should several on systems, 1 should able count on existing on windows systems "courier new".

Edit link in theme_table drupal -

i have created table in drupal display records. how can add edit link each record goes input form corresponding id record function display($nid){ $query = db_query("select * {contactus}"); $data = array(); $i = 0; while($row = db_fetch_array($query)){ $data[$i] = $row; $i++; } $output = theme_table(array('id','email','comment'),$data); return $output; } you must implement full crud-range, create read update delete. right have index. drupal7 there example in dbtng (from examples ) for drupal 6 not aware of such example. basically pattern is: make hook_menu-items callbacks, 1 index, read, update, delete, create. the read item shows item (item/%id) the update shows form update item (item/%id/edit). form pre-filled. see formapi in drupal more information on forms. the delete shows confirm_form() callback delete entry database. the create shows form create new item. form empty. but answer exact quesion, in drup

sml - handling exceptions in ML -

everyone, i'm trying understand how exceptions work in ml, have strange error, , can't figure out wrong: exception factorial fun checked_factorial n = if n < 0 raise factorial else n; fun factorial_driver () = checked_factorial(~4) handle factorial => print "out of range."; what may wrong? in advance help. you need make sure factorial_driver has consistent type. non-exceptional case returns int , ml infers function of type unit -> int , exceptional case (that is, print expression) returns unit , not int . generally, need return value of same type in cases.

html - IE 8 flash not displaying -

Image
i'm using flash in few of websites displaying slideshow. code use in splendor-bg.com : <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="740" height="450" id="tech" align="middle"> <param name="allowscriptaccess" value="samedomain" /> <param name="movie" value="splendor-bg.swf?xml_path=slides.xml" /> <param name="quality" value="high" /> <embed src="splendor-bg.swf?xml_path=slides.xml" quality="high" width="720" height="430" name="tech" align="middle" allowscriptaccess="samedomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object&g

android - How do I use ArrayAdapter to display a list view? -

hi want display list view in application. each row should contains text , image. have used arrayadapter display this, how insert image after text. string lvr[]={"android","iphone","blackberry","androidpeople"}; super.oncreate(savedinstancestate); setcontentview(r.layout.main); list1 = (listview) findviewbyid(r.id.cg_listview1); list1.setadapter(new arrayadapter<string>(this,r.layout.alerts , lvr)); here alerts layout contains textview. if want have control on how layout of items in list view, should make own custom implementation of arrayadapter : a listadapter manages listview backed array of arbitrary objects. (...) use other textviews array display, instance, imageviews, or have of data besides tostring() results fill views, override getview(int, view, viewgroup) return type of view want. if google custom arrayadapter example , should find enough examples showing how implement this. 2 such example

android - how to start conference call programatically -

i creating app depend on parent child relationship, in when child got call particular no, should changed in conference call parent automatically. possible? i read class com.android.internal.telephony.gsm.gsmphone can functionality. not getting class directly. please me this. got call incoming call receiver. you cannot application. com.android.internal.telephony.gsm.gsmphone internal class , cannot access it. can try instantiate using java reflection, exception. can set phone state listener etc. application or can intercept out going call receiving broadcast "new_outgoing_call". try this, not work :-) try { final class<?> classphonefactory = classloader .loadclass("com.android.internal.telephony.phonefactory"); class.forname("com.android.internal.telephony.phonefactory"); // object objphonefactory = classphonefactory.newinstance(); method method_getdefaultphone;

javascript - getbounds on google api v2 is not working -

getbounds() return error on firebug. may know problem? thanks. map=new gmap2(document.getelementbyid('map')); map.setcenter(new glatlng(la,lo),15); map.addcontrol(new glargemapcontrol3d()); map.addcontrol(new gmaptypecontrol()); map.enablescrollwheelzoom(); var bounds = map.getbounds(); var southwest = bounds.getsouthwest(); var northeast = bounds.getnortheast(); var southeast = bounds.getsoutheast(); var northwest = bounds.getnorthwest(); firebug states getsouthwest() not functions. thank you. maybe should wait until map fires load event.

java - Export JAR with Netbeans -

how export java project jar netbeans ? cannot find options in eclipse. you need enable option project properties -> build -> packaging -> build jar after compiling (but enabled default)

android - How to make a circle or bullet.png move vertical at random times down the screen -

i new android game development have searched forumns , cannot find how create circle or circle.png image travel vertically down page @ random intervals. i have game designing want random bullets rain top bottom of potrait screen (that allow hittest occur on impact when bullet hits particular object) 1) cannot make simple image travel vertically down screen , repeat @ random intervals 2) cannot draw simple circle on screen , animate in number1 please help here's basic algorithm have 1 image falling. clear background draw image @ x, y increment y z number of pixels, z between 1 , 4. repeat until image reaches bottom

SharePoint permissions for a specific group -

i'm trying establish whether specific group has read access particular site collection. i have been trying day , half feel if have found 3 halves of different solutions! the code fragments have far are: using (spsite site = new spsite(this.generateabsoluteuri(modulecode, academicyear))) { using (spweb web = site.openweb()) { (int = web.sitegroups.count - 1; >= 0; i--) { spgroup group = web.sitegroups[i]; if (regex.ismatch(group.name, thegroupimlookingfor)) { but what?! most of google results tell me roles don't know how tie role group. please help! cheers patrick to assign permission user (account) or sharepoint group there objects need @ in order. first thing need the security principal want assign role (spuser or spgroup). next thing need actual permission (role) want assign (ex: read, full control etc…). need create sproleassignment object , on constructor pass in spuser or spgroup (

replace line in a file C++ -

i'm trying find way replace line, containing string, in file new line. if string not present in file, append file. can give sample code? edit : there anyway if line need replace @ end of file? although recognize not smartest way it, following code reads demo.txt line line , searches word cactus replace oranges while writing output secondary file named result.txt . don't worry, saved work you. read comment: #include <iostream> #include <fstream> #include <string> #include <algorithm> using namespace std; int main() { string search_string = "cactus"; string replace_string = "oranges"; string inbuf; fstream input_file("demo.txt", ios::in); ofstream output_file("result.txt"); while (!input_file.eof()) { getline(input_file, inbuf); int spot = inbuf.find(search_string); if(spot >= 0) { string tmpstring = inbuf.substr(0,spot); tmpstr

c++ - Magick++ in VS2010 - unresolved external symbol -

Image
i'm trying use imagemagick magick++ c++ project in vs2010. installed library here: klick then in project, added c:/program files/imagemagick-6.6.6-q16/include include folders. tried use magick++ code: #include <magick++.h> void main(int argc, char ** argv){ initializemagick(*argv); } but not work! vs2010 returns following errors: error lnk2001: unresolved external symbol "__declspec(dllimport) void __cdecl magick::initializemagick(char const *)" (__imp_?initializemagick@magick@@yaxpbd@z) error lnk1120: 1 unresolved externals what doing wrong? thanks help! update: set linker -> input -> additionnal dependencies to: kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;core_rl_magick++_.lib and linker -> general -> additionnal library directories to: c:\program files\imagemagick-6.6.6-q16\lib it still results in same error... update 2

c# - How do i modify Linq generated sql statement? -

i have summarized problem in following code. northwinddatacontext dc = new northwinddatacontext(); var query = c in dc.customers select c; above code generating following sql statement select [t0].[id], [t0].[firstname], [t0].[lastname] [dbo].[customer] [t0] now want modify above generated query this select [t0].[id], [t0].[firstname], [t0].[lastname] [dbo].[customer] [t0] (nolock) is possible in linq modify generated query?if yes how? i have found handy tips modifying linq generated sql statement. northwinddatacontext db = new northwinddatacontext(); if (db.connection.state == system.data.connectionstate.closed) db.connection.open(); var cmd = db.getcommand(db.customers.where(p => p.id == 1)); cmd.commandtext = cmd.commandtext.replace("[customers] [t0]", "[customers] [t0] (nolock)"); var results = db.translate(cmd.executereader());

javascript - WScript.Shell not working in FireFox -

i have following javascript code. (actually have launch exe on client side) function executecommands() { var commandtorun ="c:\\windows\\notepad.exe"; var oshell = new activexobject("wscript.shell"); oshell.run(commandtorun); } this code can launch notepad in internet explorer when made security option "low" code can't launch notepad in firefox. any suggestion appreciated.. firefox doesn't support activexobject() , it's proprietary feature of jscript (microsoft's version of javascript). read more information here .

oop - Is it correct for an object to reject it self? -

i want parse several files formats. wondering if it's correct oop "take risk" create object nothing. class parserfactory { private fn; public function parserfactory(fn) { this->fn = fn; } public function getparser() { = new formataparser(this->fn); if ( a->isvalid() ) { return( ); } b = new formatbparser(this->fn); // ... , on... } } class formataparser { /* object telling if able continue work... **clean or dirty design ?** */ public function isvalid() { header = someconversionandreadingstuff(); if ( header != "formata" ) { return(false) } return(true); } public function parse() { /* parsing, using conversion stuff done in isvalid */ } } thanks edit had answers. so, ok object check own validity. anyway, code

python - web2py redirect to previous page -

when page , goto page via hyperlink,is there way go previous page. previous page has arguments also. want ask whether previous page saved somewhere or there other way go page in http there header field called "referrer". if present point previous page. can access web2py: if request.env.http_referer: redirect(request.env.http_referer)

java - JSVC initscript doesn't exit -

i'm trying deamonize java app using jsvc . initscript #!/bin/sh # config jsvc=/opt/jsvc/jsvc java_home=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64 user=gserv args=none # end config pidfile=/var/run/silvercar-gameserver.pid logdir=/var/log/silvercar-gameserver case "$1" in start) export java_home cd `dirname $0` $jsvc -jvm server -pidfile $pidfile -user $user -outfile $logdir/stdout -errfile $logdir/stderr \ -cp `cat classpath` tr.silvercar.gameserver.runner.deamongameserver $args ;; stop) $jsvc -stop -pidfile $pidfile ;; esac exit 0 when run ./thisscript.sh start root 2 things go wrong, , suspect they're related: the app starts, output shown instead of saved specified outfile the script doesn't exit, blocks until hit ctrl+c . what doing wrong? i don't see wrong in launch script; perhaps there issue in s

cookies - dialog, when "x" clicked hide forever (javascript) -

so, when user visits site first time want show dialog box, , when user clicks "x" or "hide" want hide user forever . this works cookies, right? so, when user clears his/her cookies he/she see dialog box again, next time visit site, assume. or there better/more common way this? can store property on user? can false default , when click 'x' can make ajax call sets true . dialog box key off property... this way wouldn't have worry scenario user clears cookies. of course work if have user objects server side , storing data overcome small problem, might not goood practice. idea.

c# - Why can I check some event handlers for null, some not? -

i have ugly piece of code adds event handlers. problem is, if code called multiple times, event handlers called multiple times. to solve problem, remove event handler first , add it. now i've seen following behaviour: some event handlers can checked like: if (object.event == null) { // // code // } others of form if (object.object.event == null) { // // code // } i message 'object.object.event' may occur left of -= or +=. (since i'm using german version of visual studio, don't know correct translation english). i have no idea why behaviour looks inconsequent grateful information on this. to more specific: it's user control. if (mycontrol.event == null) { // // works // } if (mycontrol.treeview.nodemouseclick == null) { // // doesn't work // } slaks correct, , has linked excellent resources. here's relevant quote chris burrows' blog article : let me take quick det

model view controller - Ajax calls in Zend MVC -

im new zend framework , concept of mvc well. want make ajax request returns data specified in view (.phtml) file. the problem having right contents of .phtml file being sandwiched between html footers , headers (an entire new html page being returned). best approach getting raw data? solutions or nudge in right direction appreciated! edit: upon further research looks i'm trying rpc call, according lecture pdf (slide 51), should totally bypass mvc purpose. correct? heximal's answer place start. more bare-bones (and not way it, simple) following action: function ajaxdataaction(){ $data = getmydataasstring(); //could xml, json, etc. die($data); //since we're dying, no view or layout rendering happens. } but don't that. instead, have @ contextswitch , ajaxcontent view helpers (section 25% of way down page)

Adding a custom target validation schema in Visual Studio -

i want use visual studio 2008 web project build application uses: <!doctype vxml public "-//w3c//dtd voicexml 2.1//en" "http://www.w3.org/tr/voicexml20/vxml.dtd"> as it's validation schema in aspx file. however, when write tag such <vxml></vxml> valid tag in vxml.dtd, raises couple of warnings: element 'html' occurs few times , element 'vxml' not supported . i think due validation target setting in tools > options > text editor > html > validation. how can add vxml.dtd list of possible settings in target dropdown box? thanks, ben your correct assumptions on validation target , not think there way around when using aspx pages. schema validation when open in xml editor. try right clicking on document , select "open with..." , open xml editor. should pick schema definition include in vxml tag. have found xml editor in vs bit flaky , ended using third party xml editor oxygen .