Posts

Showing posts from July, 2015

c# - get end values from lambda expressions method parameters -

basically want values of parameters of called method this: var x = 1; var = 2; var b = 3; do<homecontroller>(o => o.save(x, "jimmy", a+b+5, math.sqrt(81))); public static void do<t>(expression<action<t>> expression) t : controller { // values 1,jimmy,10,9 here } well, you'd need drill expression, find methodcallexpression , , @ arguments it. note don't have value of o , we've got assume arguments method don't rely on that. we're still assuming lambda expression relies on being methodcallexpression ? edit: okay, here's edited version evaluates arguments. however, assumes you're not using lambda expression parameter within arguments (which new object[1] - it's providing null parameter, effectively). using system; using system.linq.expressions; class foo { public void save(int x, string y, int z, double d) { } } class program { static void main() { var x = 1; ...

flex - how to change the flash builder generate HTML to call function in actionscript? -

i have actionscript project, , have provided function want called html(the flash builder generated html file). externalinterface.addcallback("geturl", geturl); this code in actionscript, how can modify flash builder generated html file can call geturl()? just add function between <script> tags in index.template.html file located in html-template folder of project.

apache - Do we really need to restart IIS 7 application pool? Do the same practice apply to other web servers? -

i wondering why restarting iis 7 application pool consider practice? know it'll clean orphan resources threads or session state, how other web server deal kind of problem? java developer/admin have restart weblogic/websphere/apache/tomcat every clean junk in memory? typically it's used compensate bad programming. yours, third parties depending on libraries using. and, recommendations, it's best @ specific environment see if it's necessary before doing it. start profiling app. simple way let run while under load. things memory utilization settle down or continually grow? if keeps growing, need set iis recycle every , go fix app. if grows point settles down should fine. make sure test edge cases of app.

mysql - How to join my "clients" and "messages" tables? -

there 2 tables: clients ___________ idclient int login varchar messages ___________ idmessage int datewakeup datetime .... other fields i need each client count number of entries in table messages in given range of time. tried this: select c.login, count(m.idmessage) clients c, messages m m.idclient=c.idclient , m.datewakeup>'2010-09-01 00:00:01' , m.datewakeup<'2010-10-01 00:00:01'; it not working. when using count(...) , have group by results: select c.login, count(m.idmessage) clients c, messages m m.idclient=c.idclient , m.datewakeup>'2010-09-01 00:00:01' , m.datewakeup<'2010-10-01 00:00:01' group c.login

PHP SAMBA/SMB/CIFS and smb4php classes -

have access media files network storage accessible through smb , common internet file system. php website required file manipulation operations on remote storage block. may suggest alternate method or if have idea or may on: configuring samba/smb/cifs smb/samba/cifs client configuration accessing file system through php - research shows php provides smb4php classes in regard, no support on how use in complete setup. whether or not can mount smb share directly on host os depend on host os is. talking samba suggests might sort of unix / posix / linux - one? most versions of linux support filesystem type of smbfs (usually man page mount list supported types). mount -t smbfs -o username=bill,password=billions //msbox/netshare /some/local/dir (note smbfs vfs developed same people write samba - seperate product). samba ships cli client smbclient. fetch file using need exec right arguments (note if don't sepcify required arguments on command line, smbclient dr...

ruby - Inline DTD with Builder -

how create this... <!doctype root-element[ <!entity % w3centities public "-//w3c//entities combined set//en//xml" "w3centities.ent" > %w3centities; ]> ...using builder? i can manage everying apart "%w3centities;" in second last line following code: xml.declare! :doctype, "root-element" xml.declare! :entity, "%", :w3entities, :public, "-//w3c//entities combined set//en//xml", "w3centities.ent" end thanks here's did work... xml.target! << "<!doctype root-element[ <!entity % w3centities public \"-//w3c//entities combined set//en//xml\" \"w3centities.ent\" > %w3centities; ]>"

moss - Why does my SharePoint workflow fail when the client is running Vista or Windows 7? -

i have similar situation this question . i have custom sequential sharepoint workflow, deleoped in visual studio 2008. associated infopath form submitted form library. configured automatically start when item created. it works sometimes. fails start. just question linked above, checked in debugger, , issue infopath fields published columns in library empty when workflow fires. (i access fields workflowproperties.item["fieldname"] .) there appears race condition, fields show in library view, , if terminate failed workflow , restart manually, it works fine! after lot of head-scratching , testing, i've determined workflow start if user running version of ie on windows xp, fails if same user submits same form data vista or windows 7 client machine. does have idea why happening? this occurs due fact vista/7 saves infopath forms through webdav, xp uses protocol (sorry, can't remember @ time). sharepoint catches "itemadded" event before file...

Is there any difference between Interop.AZROLESLib and Microsoft.Interop.Security.AzRoles? -

microsoft provide microsoft.interop.security.azroles interop library in server 2003 azman (authorization manager). built under .net 1.0. can tell me if there's difference between , creating reference "azroles 1.0 types library" (c:\windows\system32\azroles.dll) ends interop.azroleslib? apart namespace? , fact created under current version of .net? the main purpose of commonly-provided interop dll (such microsoft.interop.security.azroles) make sure type identifiers match when 2 independently-produced assemblies need pass references underlying types each other. in other words, if assemblya.dll needs provide collection of objects of type icominterface (from comcomponent.dll) public property, , assemblyb.exe needs to, in turn, pass 1 or more of objects comcomponent.dll, need common interop dll. that's microsoft.interop.security.azroles.dll for. when add reference project azroles.dll, visual studio build new interop.azroles.dll assembly has identifiers un...

flex - Loading a class in module1 with the same name as a class in module2 -

i have flex application can load modules necessary. when first module loaded, creates class mybackground(), paints background red. when choose load second module (and unload first) again load class mybackground (from second module). however, when step constructor mybackground, goes straight constructor uicomponentdescriptor: public function uicomponentdescriptor(descriptorproperties:object) { super(descriptorproperties); } is using same application domain each module load? flex load in class types parent application , cache them, when request class second time lookup, without seeing if class same? any info on appreciated. i've managed fix issue using child application domain (which doesn't make 100% sense says child domains can't override parent domains, yet appears happening). m_moduleinfo.load(new applicationdomain(applicationdomain.currentdomain));

asp.net - Mono(non-Windows) Report Writing? -

we making application run on both mono , .net. application web based, uses asp.net. we trying find kind of reporting software. prefer if there designer end users(non-programmers) able use crystal reports. currently, not finding looks barely capable. have shell access on server mono running from, doesn't matter if there no true web-preview or long it's capable of creating pdf on server in automated way. has seen competent report writing software runs on mono? (also, licensing doesn't matter long it's not gpl) edit: really, running isn't mono such php or else light on dependencies ok long run on *nix systems. having trouble finding non-windows systems server , windows systems designer(this justification linux tag) we've found reporting solution. it's not quite pretty crystal or that, works, , that's counts. it called flexcel.net http://www.tmssoftware.com/site/flexcelnet.asp you design reports in excel using special markup(actuall...

testing - Run Selenium Test Automatically Every 5 minutes -

is there way automate selenium test run every 5 minutes? if you've got tests packed executable easiest way may run cron job or windows scheduled task. that said, hudson (or continuous integration system) better long term strategies.

flash - Which is the best Twitter api library for Actionscript? -

new twitter api, need choose between 3 different actionscript libraries available twitter api. has used either: twitterscript swx twitter tweetr what pros , cons of each? i used tweetr. don't know if can recommend it. here's why: 1) - don't think events specific enough. in example code, every oauth event listened either oauthcomplete or oauthfail method. same goes twitter events. have liked events have more specific details handle them better. 2) - uses php 5 proxy requires mod-rewrite installed on server. i'm running project on iis machine has alternative mod-rewrite, can't proxy working. however, when tried installing on separate apache machine mod-rewrite, still doesn't work. i've spent better part of last 6 hours trying working, , exploring alternate libraries. 3) followed tutorial verbatim, , although connect twitter , fetch user info, couldn't change status. didn't need functionality project, many other people do. ...

rotation - How does the Maps app on the iPhone 3Gs rotate as you turn the phone? -

on iphone 3gs, if click little "show location" symbol on lower left of window twice, switches mode causes map rotate north on map faces towards north according compass. don't have 3gs, found out buddy have one. i tried applying rotation transformation mkmapview's layer, this: catransform3d rotationtransform = catransform3didentity; rotationtransform = catransform3drotate(rotationtransform, degreestoradians(-20), 0.0, 0.0, 1.0); themapview.layer.transform = rotationtransform; that sort of works, not really. contents of map rotate, frame rotates , stretches. map view ends in strip stretches diagonally across screen, , ends under buttons in view. i tried enclosing map in view isolate it, doesn't work either. next i'll try rotating enclosing view, i'm hoping else has figured out. getting work trial , error difficult @ best. regards, duncan c i have same problem. able solve stretching placing mkmapview in uiview container. ...

sorting a multidimensional array in ruby -

i have following array: [["2010-01-10", 2], ["2010-01-09", 5], ["2009-12-11", 3], ["2009-12-12", 12], ["2009-12-13", 0]] i want sort second value in each group , return highest one, want output 12 given input above. update i might add made array using to_a , hash, if there away same hash better. use on hash: hash.values.max if need highest element, there no need sort it!

php - Find is a business is open: MySQL hours calculation -

i have list of business stored in locations table, , stored in table hours business opens , closes: location `mon_1_open` `mon_1_closed` `tue_1_open` `tue_1_closed` `wed_1_open` `wed_1_closed` ect... i store times in full hours , minutes, business open 9:00am 5:30pm on monday.. mon_1_open = '900' , mon_1_closed = '1730'. i can't seem figure out way find day of week , output if business else open or closed based on time of day. any suggestions? this not answer question, may in long run. your database scheme seems flawed. not normalized. address before becomes big issue, have noticed makes hard locate businesses hours. here draft scheme might better suiting. table: locations id int auto_increment primary key name varchar(50) table: location_hours id int auto_increment primary key location_id int - foreign key references locations table day char(3) - (examples: mon, tue, wed, thu, fri, sat, sun) hours varchar(4)...

events - triggerHandler vs. trigger in jQuery -

out of curiosity -- purpose of / use cases jquery's triggerhandler ? far can tell, "real" differences between trigger , triggerhandler whether or not native event fires, , event bubbling behavior (though triggerhandler 's bubbling behavior doesn't seem hard replicate trigger in few more lines of code). advantage ensuring native event not fire? i'm curious if convenience function or there's deeper reason exists, , why/when use it. from docs @ http://api.jquery.com/triggerhandler/ the .triggerhandler() method behaves .trigger(), following exceptions: the .triggerhandler() method not cause default behavior of event occur (such form submission). not preventing default browser actions allow specify action occurs on focus or select, etc etc etc, applies style. maybe have dynamic menu javascript based, don't want apply style purely css otherwise javascript disabled won't understand why layout looks odd. can...

ruby on rails - Formtastic set class and id of form -

how can set class , id attribute form element through semantic_form_for? the following code: <% semantic_form_for (@meetingsearch), :class => "new_meeting_search", :id => "meeting_search" |f| %> gives me: <form action="/meetingsearches" class="formtastic meetingsearch" id="new_meetingsearch" method="post"> this should need (untested): <% semantic_form_for @meetingsearch, :html => { :class => "new_meeting_search", :id => "meeting_search" } |f| %> for clarification, semantic_form_for wraps around rails' built in form_for , how in regular rails forms also : <% form_for @meetingsearch, :html => { class => "new_meeting_search", :id => "meeting_search" } |f| %>

Invalid Argument Error in Jquery gzoom plugin -

i using jquery plugin named jquery gzoom. it's nice script when test in ie. script show invalid argument error. error shows in ie. i wondering if can figure in script cause error. plugin page: http://lab.gianiaz.com/jquery/gzoom/index_it.html thanks in advance. the script loading fine on browsers. invalid argument appear when drag slider towards zoomin in ie. if test plugin in in ie, see error. error not seem affect functionality , appear in ie, install firebug lite, still can't clear error message. what did it. put following code in master page, <script type="text/javascript" language="javascript" src="../scripts/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="../scripts/ui.core.min.js"></script> <script type="text/javascript" src="../scripts/ui.slider.min.js"></script> <script type="text/javascript" src="../s...

Starting a process in Java? -

is there way start process in java? in .net done example: system.diagnostics.process.start("processname"); is there equivalent in java can let user find application , work os? http://www.rgagnon.com/javadetails/java-0014.html import java.io.*; public class cmdexec { public static void main(string args[]) { try { string line; process p = runtime.getruntime().exec (system.getenv("windir") +"\\system32\\"+"tree.com /a"); bufferedreader input = new bufferedreader (new inputstreamreader(p.getinputstream())); while ((line = input.readline()) != null) { system.out.println(line); } input.close(); } catch (exception err) { err.printstacktrace(); } } } you can local path using system properties or similar approach. http://download.oracle.com/javase/tutorial/essential/environment/sysprop.html

How to access the version of a gem from within Ruby? -

how can version of gem using ruby? i'd rather not use system call , grep shells output like: `gem search passenger`.scan(/(?:\(|, *)([^,)]*)/).flatten.first => "2.2.9" can't somehow with: gem::version i don't know how specify gem want, in case want passenger gem's newest version. this should on way. searches remote index latest version of specific gem. $ irb >> require "rubygems" >> dep = gem::dependency.new "passenger", gem::requirement.default >> gem::specfetcher.fetcher.find_matching dep => [[["passenger", #<gem::version "2.2.9">, "ruby"], "http://gems.rubyforge.org"]]

iphone - UIPicker - Initial value problem -

i have uipicker 3 components containing numeric values, allows user set time in hh:mm:ss format. if select hour first component uitextfield looks this: 10:(null):(null). (null) can removed when user selects appropriate mm , ss. if user wants enter 10 hours, want other values 00 instead of (null), without user having physically move picker components. anyone have ideas on ? some code below, question related timepicker. -(nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component { if([pickerview isequal: routepicker]) { route.text = [[routearray objectatindex:0] valueforkey:@"route_name"]; return [[routearray objectatindex:row] valueforkey:@"route_name"]; } else if([pickerview isequal: activitypicker]) { activity.text = [activityarray objectatindex:0]; return [activityarray objectatindex:row]; } else if([pickerview isequal: intensitypicker]) { ...

Accessing Type Metatables Lua -

its getmetatable can access metatables of several types: getmetatable("") getmetatable({}) getmetatable(newproxy(true)) however appears though cannot metatable of other types (functions aside). there appears no way access metatable of numbers, booleans, or nil. i wondering if 1 able access metatable of entire table type. able this: ({}) + ({}) numbers, booleans , nil have no metatable default (hence getmetatable returning nil ). can give them 1 debug.setmetatable though. there no common table metatable. (and same userdata (at least of heavy variety))

c++ - a simple getch() and strcmp problem -

i have simple problem gets input user using function checks if input 'equal' "password". however, strcmp never return desired value, , culprit somewhere in loop uses getch() take each character separately , add them character array. found out having printf display character array. if type in pass word, function display pass word ". have no idea on why closing double quote , whitespace included in array right after word typed in. idea? here's code. thanks. #include <stdio.h> #include <iostream> #include <conio.h> #include <string.h> int validateuser(); int main() { for(int x = 0;x<2;x++) { if(validateuser()) { system("cls"); printf("\n\n\t\t** welcome **"); break; } else { system("cls"); printf("\n\n\t\tintruder alert!"); system("cls"); ...

c# - why would a re-thrown exception in a button click not get back to the user? -

i have code: 001 private void uibutton1_click(object sender, eventargs e) 002 { 003 string somestring = ""; 004 try 005 { 006 somestring = thismethodthrowsanexception(); 007 } 008 catch (exception) 009 { 010 throw; 011 } 012 } the code "throw" in catch standard winforms "unhandled exception" dialog never shows up. thismethodthrowsanexception() throwing exception of type system.exception. have event attached application.threadexception. event not being hit in case. uibutton standard winforms button. created button throws exception in event handler , exception is being caught application_threadexception. of processing happening on 1 thread. for life of me can't see why code wouldn't result in normal exception box (which, since app use, that's helpful). there other places in app i've seen standard exception dialog. i have button click handler looks this: private void butto...

c# 3.0 - Unexpected C# behaviour with autoproperties and constructors -

it took me debugging figure out (or think). let code loose on , see come with. there simple contact class with: some auto-properties, a parameterized constructor increments contact.id property , sets other properties according arguments gets a parameterless constructor calls parameterized constructor default values. first see code; output , question follows code: using system; class program { private static void main(string[] args) { contact[] contacts_array = { //contact 0 new contact(), //contact 1 new contact { name = "contactname1", age = 40, email = "emailaddress1@email.com" }, //contact 2 new contact { name = "contactname2", age = 41, email = "emailaddress2@email.com" }, //contact 3 new contact("contactname3", 42, ...

c# - Should I fill collections in ctor or private static method? -

if have collection object empty needs filled , going used class (say class foo), best filling in constructor? something like: list<string> strings = new list<string(); strings.add("sjsjhsj"); // on... or should in static private ctor? state not being changed of containing class can static, right? btw, if write this.name = name; or: john.name = name; // instance method passing in john person object. are these both known changing state , should not static? or instance? if need collection want able change contents of without recompile, should use txt file or xml source. faster when using collections? txt file use readalllines(); , xml use nodenavigator (not sure of exact method/object names). thanks first, static constructors cannot public / private. exist. if same instance of collection going shared amongst instances of owning class, can static. static doesn't mean doesn't change state. can still change. difference static...

r - Change the spacing of tick marks on the axis of a plot? -

how can change spacing of tick marks on axis of plot? what parameters should use base plot or rgl ? there @ least 2 ways achieving in base graph (my examples x-axis, work same y-axis): use par(xaxp = c(x1, x2, n)) or plot(..., xaxp = c(x1, x2, n)) define position ( x1 & x2 ) of extreme tick marks , number of intervals between tick marks ( n ). accordingly, n+1 number of tick marks drawn. (this works if use no logarithmic scale, behavior logarithmic scales see ?par .) you can suppress drawing of axis altogether , add tick marks later axis() . suppress drawing of axis use plot(... , xaxt = "n") . call axis() side , at , , labels : axis(side = 1, @ = v1, labels = v2) . side referring side of axis (1 = x-axis, 2 = y-axis), v1 being vector containing position of ticks (e.g., c(1, 3, 5) if axis ranges 0 6 , want 3 marks), , v2 vector containing labels specified tick marks (must of same length v1 , e.g., c("group a", "group b...

Better dialog shadows in YUI 2? -

Image
here's tricky one: has seen yui dialog/panel implementation nice os x style shadows around dialog, instead of blocky shadow implemented default "underlay" element? you can see type of shadow on amazon.com popup windows. requires quite bit of pngs looks nice. i'm thinking of inserting divs or replacing .underlay element, , hook dialog size event adapt dimensions. latter required because yui uses css trickery make underlay element "snap" dialog dimensions css in modern browsers, , uses manual dimension update ie. edit: checked yui 3. panel widget not available yet, container , it's still beta. i'm looking @ solving in yui 2. ps: oh guess include png shadow part of panel's header, body , footer (hd, bd, ft), padding. , use css rule hide yui's underlay. hmmmmmm wish didn't have because changes calculations draggable area, it's not great way it.

iphone quartz drawing 2 lines on top of each other causes worm effect -

i'm using quartz-2d iphone display route on map. route colored according temperature. because streets colored yellow, using thicker black line under route line create border effect, yellow parts of route spottable on yellow streets. but, if black line thick route line, whole route looks worm (very ugly). tought because drawing lines waypoint waypoint, instead using last waypoint next starting waypoint. way if there couple of waypoints missing, route still have no cuts. what need display both lines without worm effect? -(void) drawrect:(cgrect) rect { csrouteannotation* routeannotation = (csrouteannotation*)self.routeview.annotation; // draw our lines if we're not int moddie of transition , // acutally have points draw. if(!self.hidden && nil != routeannotation.points && routeannotation.points.count > 0) { cgcontextref context = uigraphicsgetcurrentcontext(); waypoint* fromwaypoint = [[waypoint alloc] initwithdictionary:[routeannotation....

delphi - In DevExpress' Quantum Grids, how do I restrict the click area of a cell with checkbox to the actual checkbox, not the entire cell -

i use delphi (2010) , devexpress quantum grid (v. 6.52) when have tcxgridcolumn checkbox editor, checkbox toggles when user clicks anywhere within cell. want restrict user has click on actual checkbox. is there easy way this? have enormous amount of grids in our application, many checkbox editors, i'm hoping "magic" little trick me. hate write custom code every grid in our application :-/ if (or customers) want checkbox doesn't change if click in cell, if set immediatepost property false .

c# - combobox items from the database -

in c# used combo box in form , wish obtain specific column table in database , contents of column added items in combo box. have declared way string strcon, strqry; sqlconnection con; sqldataadapter da; dataset ds; sqlcommand comm; den strcon= data source =" " initial catalog =" " use id =" " password=" "; con = new sqlconnection(strcon); strquery = select city cities; da = new sqladapter(strqry,con); ds = new dataset; da.fill(ds, " cities"); should put loop till items continue adding? update: i want entire column added items in check box. on click of check box, want entire column displayed respective item in check box. combobox1.items.add(drcities.cells[0].value); combobox1.items.add(drcities.cells[1].value);

web services - Call webservice through JavaScript -

i calling websevice through javascript using soapclient , working in internet explorer not working in firefox. actually working in firefox when webservice within same folder or same project. but not working in firefox if webservice not within same project. for internet explorer works in both cases. may cross-site http requests issue?

asp.net - Making changes to a pre-populated textbox -

i have following webform textboxes pre-populated on page load: <%@ page title="" language="vb" masterpagefile="~/default.master" autoeventwireup="true" codefile="admin.aspx.vb" inherits="admin" theme="g2m" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <form id="form1" runat="server"> <label>username: </label> <asp:textbox id="textbox1" runat="server"></asp:textbox> <br /> <label>password: </label> <asp:textbox id="textbox2" runat="server"></asp:textbox> <br /> <label>product type: ...

BOOL issue in Objective-C -

when i'm trying bool dictionary, get: bool istrue = [somedict objectforkey: @"istrue"]; i get: initialization makes integer pointer without cast i set dictionary doing this: self.somedict = [[nsmutabledictionary alloc] initwithobjectsandkeys: self.istrue, @"istrue", nil]; any ideas? use: bool istrue = [[somedict objectforkey:@"istrue"] boolvalue]; the way store bool in nsdictionary box in nsnumber object. bool primitive, , dictionary holds objects. similarly, store bool in dictionary, use: [somedict setobject:[nsnumber numberwithbool:istrue] forkey:@"istrue"]; edit: (in response comment) there 2 ways of representing @property . 1 declare ivar bool , , other declare nsnumber . for first case, ivar is: bool istrue; , , property @property bool istrue; (i'm ignoring naming conventions, obviously). for nsnumber , ivar is: nsnumber * istrue; , property @property (nonatomic, ...

java - JDBC - setAutoCommit for read only operation -

let's have common method creates db connection: connection getconnection() throws sqlexception { connection con = ... // create connection con.setautocommit(false); return con; } i put setautocommit(false) call here callers of method never have worry setting it. however, bad practice if operation executed caller reading data? there overhead? my personal opinion it's better centralize logic in 1 place, way callers never have set auto commit , avoids code redundancy. wanted make sure didn't incur unnecessary overhead read operation. i put setautocommit(false) call here callers of method never have worry setting it. this fine imo , believe 1 should never ever enable auto-commit mode inside application. recommendation turn off auto-commit. however, bad practice if operation executed caller reading data? there overhead? from strict performance point of view, it's starting , ending database transaction every sql statement has over...

is ruby on rails (or at least the community) dying? -

this honest question , not trolling. as newbie rails i've been search rails resources. i've been noticing many sites apparently once popular being abandoned. examples: http://www.softiesonrails.com/ - last updated feb 2010 http://www.therailsway.com/ - last updated aug 2009 http://nubyonrails.com/ - last updated aug 2009 http://www.railsenvy.com/ - nothing there now http://edgerails.info/ - last updated feb 2010 am coincidentally going wrong websites/blogs (even though they're top hits on google) or rails community dying off? if happen going wrong sites can please point me updated sites? ruby on rails hype. means lot of people jumped on bandwagon because do: jumping on bandwagons (for living). after hype, many communities popped up, in various languages mimic rails. or try to. or took ideas , applied them community. have gazillion halfbaked php-frameworks, , few ones. have django (python), zend, symphony (php) , in ruby, alternative framework...

asp.net - Login Page security? -

i have designed login page 1 of our website have used following resources login name , passowrd lable , textboxes combo box multilingual support submit button. now make page more secure planning use following points. captcha/ re-captcha number of retry: block after 3 unsuccessfull login attempt. i have seen these things visiting other sites. know whether these extar point makes somediffrence security? how should implement number of retry? when should again unblock user account. what right approach? general - require strong password , limit login tries/user (not ip/cookie). if add 5 minute lock-down user name after 3 fails bruit force attack take more years site live (dictionary attacks not possible since require strong passwords)*. protect users - in form, don't post password in clear text, post hashed version eg. md5([your domain] + [password]) reason add domain protect hash of password server owner (you), if user db hacked hashed passwords st...

c++ - Objective-C appropriate use of autorelease? -

i'm learning objective-c , i'm trying write vector3d class. in c++ or java function want implement this: vector3d { vector3d crossproduct(vector3d in) { vector3d result; result = ... // maths involving classes variables , input vectors variables. return result; } } now in objective-c can't return object, object pointer. appropriate place use autorelease (before returning?). enable me chain methods on vector3d class (since many methods return object itself) particularly inefficient compared manually allocating , releasing objects? there other commonly used patterns used return objects in objective-c? example of operations i'd class: vector3d * vector3d1 = [[vector3d alloc] init]; vector3d * vector3d2 = [[vector3d alloc] init]; vector3d * vector3d3 = [vector3d1 cross [ [vector3d2 normalize ] multiply 1.43f]]; thanks. yes, appropriate usage of autorelease , in fact people using code expect cross , normalize , , multiply return...

licensing - Infragistics components on build server -

i have "inherited" new (old?) winforms project , put onto our build server (bamboo). build server has absolute minimum (.net 3.5 , not more) installed, , we'd keep way. as first step, extracted assembly files (*.dll) infragistics components separate directory , referenced them local directory (instead of relying on them being installed in gac). works ok. but when try run build on bamboo (using msbuild), keep getting errors: properties\licenses.licx(1): error lc0004: exception occurred creating type 'infragistics.win.ultrawintoolbars.ultratoolbarsmanager, infragistics2.win.ultrawintoolbars.v7.2, version=7.2.20072.61, culture=neutral, publickeytoken=7dd5c3163f2cd0cb' system.componentmodel.licenseexception after bit of googling, seems licenses.licx file in projects kind of licensing scheme prevent tools being installed on several machines. but how can rid of build server build work, without installing full infragistics component set ...

c# - Oracle CONNECT BY PRIOR equivalent in LINQ? -

how achieve oraclel's connect prior output using linq? need hierarchy , level using linq? there isn't one. linq not have special support recursive queries. an approach can use write method fetches top level using linq query, method calls recursively children each of items received far. can result in lot of small linq queries might not desiarable. a different approach use stored procedure containing recursive query , call using linq.

qa - SQA questions: Smoke or Sanity -

which testing should perform first smoke or sanity? what differences between them? a description blog from smoke see if program can run sanity quick check works correctly. however imortant eed complete testing plan , these 2 small cases ok done first need see if need full regression tests, integration etc

objective c - Convert NSString to NSDate results in NULL -

i want convert following date: 2010-02-01t13:58:58.513z which stored in nsstring to , nsdate . the following shows "null" in debugger nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"yyyy-mm-ddthh:mm:ss.tttz"]; nslog(@"output: %@", [formatter datefromstring:@"2010-02-01t13:58:58.513z"]); [formatter release]; ideas? you have escape "t" in format string single quotes. [formatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss.tttz"]; -- edit: formatters aren't correct either. ttt instance not valid formatter according documentation. official documentation if can work, doesn't solve z problem: nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss.sss"]; nslog(@"output: %@", [formatter datefromstring:@"2010-02-01t13:58:58.513"]); [formatter release]; -- e...

implement bonjour sdk in visual c++ windows forms application -

i have succesfully implemented bonjour sdk in visual c++ console app. when trying implement same code in windows forms app (visual c++) receiving weird errors related local heap problem bonjour dll. the following assertion in file dbgheap.c fails: /* * if assert fails, bad pointer has been passed in. may * totally bogus, or may have been allocated heap. * pointer must come 'local' heap. */ _asserte(_crtisvalidheappointer(puserdata)); it helpful if knew resources dealing kind of problem. thanks lot help you haven't provided information, 1 place start looking bit: it may have been allocated heap are freeing objects allocated bonjour? c runtime library bonjour.dll linked against? using same 1 (dll or static, multithreaded or not, debug or release) in forms app? using same 1 in console app? in general it's bad idea free memory allocated in other dlls sort of reason. isn't there bonjourfree function can call deallocate objects allocated in...

r - Getting more info from Rprof() -

i've been trying dig time-hogs in r code i've written, i'm using rprof . output isn't yet helpful though: > summaryrprof() $by.self self.time self.pct total.time total.pct "$<-.data.frame" 2.38 23.2 2.38 23.2 "fun" 2.04 19.9 10.20 99.6 "[.data.frame" 1.74 17.0 5.54 54.1 "[.factor" 1.42 13.9 2.90 28.3 ... is there way dig deeper , find out specific invocations of $<-.data.frame , , fun (which by() ), etc. culprits? or need refactor code , make smaller functional chunks in order more fine-grained results? the reason i'm resisting refactoring i'd have pass data structures functions, , passing value, seems step in wrong direction. thanks. the existing cran package profr , proftools useful this. latter can use rgraphviz isn't installable. the r wik...

c# - Getting Data from all tables instead of one with HQL Query that should only get 1 table's data -

i have created 3 tables in database , put data them. 3 tables have foreign keys joining them together. below table classes , there mappings. when run query listed @ end ilist<> of objects , have data 3 tables. however, hql query top table. how can results top table? these classes: public class technology { public virtual int id { get; private set; } public virtual string name { get; set; } public virtual int sortorder { get; set; } public virtual string abbreviation { get; set; } public virtual ilist<technologydescription> technologydescriptions { get; private set; } public technology() { technologydescriptions = new list<technologydescription>(); } public virtual void addtechnologydescription(technologydescription technologydescription) { technologydescription.technology = this; technologydescriptions.add(technologydescription); } } public class technologydescription { public virt...

c# - OrderBy and Top in LINQ with good performance -

what way top 10 records large collection , use custom orderby? if use linq objects orderby method slow , takes lot of memory because creates entire new collection new order. new method signature below not re-order entire collection , fast: public static ienumerable<tsource> orderbytop<tsource, tkey>( ienumerable<tsource> source, func<tsource, tkey> keyselector, icomparer<tkey> comparer, int topcount) i tried write got complicated , thought there might easier way using aggregate or something. appreciated. answer thanks help. ended code below: public static list<tsource> orderbytop<tsource, tkey>( ienumerable<tsource> source, func<tsource, tkey> keyselector, icomparer<tkey> comparer, int topcount) { var itemcomparer = keyselector.toicomparer(comparer); return source.aggregate( new list<tsource>(topcount), (list<tsource> list, tsource item) =...

activerecord - Rails: Create association if none is found to avoid nil errors -

i have application users can have set of preferences. both stored activerecord-models follows: class user < ar::base has_one :preference_set end class preferenceset < ar::base belongs_to :user end i can access preferences of user: @u = user.first @u.preference_set => #<preferenceset...> @u.preference_set.play_sounds => true but fails if preference set not created, since @u.preference_set returning nil, , i'll calling play_sounds on nil . what want archive user.preference_set returns preferenceset instance. i've tried defining this: class user < .. has_one :preference_set def preference_set preference_set || build_preference_set end end this causing 'stack level deep' , since calling recursively. my question this: how can ensure @user.preference_set returns either corresponding preference_set-record or, if none exists, builds new one? i know rename association (eg. preference_set_real ) , avoid recursiv...

pound character(#) in asp.net ajax -

iam using asp.net , asp.net-ajax every thing happens on browser urls of format http://somepage#page1 http://somepage#page2 http://somepage#page3 now these urls in secured folder when logged in user directly types (or use bookmark) url below, shown page http://somepage#page2 -- (bookmarked url lying in secured folder) now when user user not logged in directly type above url gets redirected login page on login page in redirection url iam unable read characters after pound (#) sign. iam getting redirection url= " http://somepage " while want " http://somepage#page2 " there way can this everything after "#" sign in url never sent server won't able read value aspx page.

java - draw image or draw filled circle? -

we have old java swing application. need display thousands, hundreds of thousands small circle spots on canvas based on real data. right have image file of small circle spot. when need it, draw image onto canvas, thousands, hundreds of thousands times. now think may better (better performance , memory usage) draw filled circle each time instead of load image , draw it. how opinion? thanks, you need load template image once , hold in memory , copy canvas needed using graphics2d drawimage function. drawing multiple filled circles may become expensive due calls flood-fill / scan-fill algorithm bresenham draw circle. optimize rendering can decimate rendered result or perform clustering , since user not appreciate dense overlapping circles anyway. to reduce render calls test pixel template going , pass render if coloured. here nice benchmarking applet .

sharepoint - Inject javascript to Infopath form -

we use infopath 2007 + sharepoint 2007 , need inject javascript infopath form. know infopath form can hosted on aspx page using xmlformcontrol. solution doesn't suit =(. there workaround? infopath form services won't let publish infopath form javascript. if need use javascript rich client experience, may have luck loading form in xmlformcontrol mentioned, loading js library on page along side it, , binding dom elements. won't design time support way may work. generally speaking, need stick rules , managed code ipfs.

ExtJS add FormPanel global listener or solution -

i'm using extjs 3.0 , extend formpanel or solution everytime show form, first field should focus. thinking of adding global listener (if such exists) perhaps: afterrender: function() { ext.getcmp('formaddprogpaymentdoc').findbytype('textfield')[0].focus(); //// first textfield , focus } can done ? have more 40 forms , don't want add each 1 listener, it's listener automatically each one. thanks. create extoverrides.js file modify base functionality of ext. , add following code: ext.override(ext.formpanel, { onrender: function(ct, position){ this.initfields(); ext.formpanel.superclass.onrender.call(this, ct, position); this.form.initel(this.body); //begin edit of default functionality var firstfielditem = this.getform().items.first(); if(firstfielditem){ //delay focus 500ms make sure field visible firstfielditem.focus(true,500); } //end edit of def...

c# - Proper way to find the innermost exception? -

i'm working classes which, when throwing, have relatively deep innerexception tree. i'd log , act upon innermost exception 1 having real reason problem. i'm using similar to public static exception getinnermostexception(exception e) { while (e.innerexception != null) { e = e.innerexception; } return e; } is proper way handle exception trees? i think can innermost exception using following code: public static exception getinnermostexception(exception e) { return e.getbaseexception(); }

flex - Sorting in Advanced Datagrid -

i have advanced datagrid sorting. think string sorting default. need sorting in number. how can achieve number sorting? for example: have row numbers 1 100 . need number sorting 1,10,100. in advanceddatagridcolumn add sortcomparefunction: <mx:advanceddatagridcolumn sortcomparefunction="numbersorter" sortdescending="true" datafield="number" headertext="formal name" width="280"/> add function somewhere in scripts <mx:script> <![cdata[ import mx.utils.objectutil public function numbersorter(itema:object, itemb:object):int{ return objectutil.numericcompare(itema.number, itemb.number); } ]]> </mx:script>

Writing python (or any other SL4A) in android -

can point me tutorial on using android scripting enviornment? i've seen plenty of tutorials on how write python code using android api http://code.google.com/p/android-scripting/wiki/tutorials . but none of i've seen gives example of how works inside android or how call python stuff android application. i'm looking tutorial can bring can see example of actual android app running python scripts. note: tested on samsung galaxy s running android 2.2. ymmv. i never thought of running python on android till saw this. :) installed sl4a app , tried out simple shell script. installing python interpreter , trying out hello world soon. the step straight forward: 1. download app (it.s not on market http://code.google.com/p/android-scripting/ ) 2. create shell script clicking add button , choosing shell in options pop-up 3. write code. 4. select "save , run" (or "save , exit" , click on script name in main window) 5. @ point script's out...

windows - %HOMEDRIVE% vs. %ProgramFiles% vs. %HOMEPATH%: When should an Application choose which installation directory? -

some cross-platform packages ruby or qt prefer %homedrive% default installation path, google chrome uses in %homepath%. what's advantage , disadvantage of each choice? what's best choice simple private application (i.e. game, installation should work without administrator rights)? on other end: best choice industrial application (i.e. software controls industrial device, running on computer merely exists purpose)? if want ensure app can installed without admin privs, install under %localappdata% - if want install system-wide, use %programfiles%. whatever do, don't use %programfiles(x86)%.

sql - inserting if in a select query -

how can ? select (if(sum(costo) > 0) sum(costo) else 0) expr1 tdp_notaspesesezb you want use case statement. select case when sum(costo) > 0 sum(costo) else 0 end 'expr1' tdp_notaspesesezb

Oracle JDeveloper - browser Opening issue -

i trying build application (hello world) in oracle jdeveloper , run. ran fine. doesn't open in default browser. edited tools--> preferences --> web browser , proxy --> gave c:\program files\internet explorer\iexplore.exe . doesn't work. not try preview. please me. thanks, what kind of application trying run? simple hello world not open in browser. must jsp or servlet open in browser. please post code , i'll take look.

javascript - Using getNext() with Mootools -

i'm trying autocompleter in mootools 1.11. works fine cant check if this.selectel.getnext() is null or whatever. firebug outputs [li] every element , [null] non existing element output via getnext(); i saw people doing: if(this.selectel.getnext()) {... but thats not working here because null object. terribly stupid must going on here... here comes code around problem: this.selectel = $$('ul.results').getfirst(); ... oncommand: function(e, mouse) { if (e.key && !e.shift) { switch (e.key) { case 'up': this.selectel.getprevious().addclass('active'); if(this.selectel) this.selectel.removeclass('active'); this.selectel = this.selectel.getprevious(); e.stop(); return; case 'down': var test = this.selectel.getnext(); console.log(typeof(test)); ...

c - Visual Studio Changing number of bytes for data type -

is possible change number of bytes long has in visual studio? when compiling c code sizeof(int) , sizeof(long) both equal 4. since you're using visual studio, presumably target platform (and libraries you're using) target windows. win64 platform uses llp64 model ( http://msdn.microsoft.com/en-us/library/aa384083.aspx ) int , long 32-bits. futile think try make long 64-bit type in situation. use int64_t (from stdint.h ) or long long or similar 64-bit integer type

windows - Amazon SimpleDB for development environment / local installation -

is there way / tool simulate amazon's simpledb purpose of development? in quest above, found this tool mac os. can installed on win xp? needless say, simpledb apis need supported. just in case matters, mine .net based web application. simpledb/dev runs on windows, linux , mac. wareseeker.com page found has copied information across incorrectly. google code project page tool here http://code.google.com/p/simpledb-dev/

PHP: Search properly -

i have right now: if(isset($_post["search"]) && !empty($_post["search"])) { $full_name = mysql_real_escape_string($_post["search"]); $sex = mysql_real_escape_string($_post["sex"]); list($firstname, $lastname) = array_map('ucfirst', explode(' ', $full_name)); $query = "select firstname, lastname, id, user_name, sex, last_access, bostadsort users (firstname '$firstname' or lastname '$lastname') , sex = '$sex'"; $result1 = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result1); while($get = mysql_fetch_array ($result1)){ echo $get["firstname"] . " " .$get["lastname"]."<br>"; } } this search query. form called "search full names". type in, , splits $firstname , $lastname. works great, no problems. although if enter user“s lastname, because maybe dont remember user...

Telling if a Git commit is a Merge/Revert commit -

i writing script requires checking whether particular commit merge/revert commit or not, , wondering if there git trick that. what came far (and don't want depend on commit message here) check hash^2 , see if don't error, there better way? figuring out if merge easy. that's commits more 1 parent. check that, can do, example $ git cat-file -p $commit_id if there's more 1 `parent' line in output, found merge. for reverts it's not easy. reverts normal commits happen apply diff of previous commit in reverse, removing changes commit introduced. there're not special otherwise. if revert created git revert $commit , git generates commit message indication revert , commit reverted. however, it's quite possible reverts in other ways, or change commit message of commit generated git revert . looking generated revert commit message might enough heuristic you're trying achieve. if not, you'd have through other commits, comparing dif...

Rails: How to list database tables/objects using the Rails console? -

i wondering if list/examine databases/objects available in rails console. know can see them using other tools, curious. thanks. you seeking: activerecord::base.connection.tables and activerecord::base.connection.table_structure("projects") you should wrap them in shorter syntax inside .irbrc .

java - are there any different levels of synchronization? -

i have heard there different levels of synchronization.are there?(if there ,would please explain them snippet code?)thanks. before java 5 there one: synchronized keyword. waited , obtained exclusive lock on reference object. when applied function: public synchronized void dostuff() { ... } the object being synchronized on this . java 5 added lot of concurrency utils, 1 of lock object. there several versions of including readwritelock . thing can think of might referring to. the problem synchronized crude. done badly can lead deadlocks. java 5 utils allow non-blocking lock acquisition, timeout on lock acquisition , read/write lock support.