Posts

Showing posts from May, 2013

How can I compile OpenCV 2.2 to use in an iPhone app? -

i trying compile , use opencv 2.2 in iphone app, (specifically object-finding) can't figure out how it. have tried tutorials none have worked. know how this? thanks in advance. http://www.catb.org/~esr/faqs/smart-questions.html#examples you'll more answers here if let know tried, happened, , sort of thing. "something didn't work" doesn't give go on.

What is a constructor in Coq? -

i having trouble understanding principles of constructor , how works. for example, in coq, have been taught define natural numbers this: inductive nat : type := | o : nat | s : nat -> nat. and have been told s constructor, mean? if do: check (s (s (s (s o)))). i 4 , of type nat . how work, , how coq know (s (s (s (s o)))) represents 4 ? i guess answer extremely clever background magic in coq. inductive naturals : type := | z : naturals | n : naturals -> naturals. says following things: z term of type naturals when e term of type naturals , n e term of type naturals . applying z or n 2 ways create natural. when given arbitrary natural, know either made 1 or other. two terms e1 , e2 of type naturals equal if , if both z or if respectively n t1 , n t2 t1 equal t2 . you can see how these rules generalize arbitrary inductive type definitions. however, turns out when type definition constructors of shape of z , n , the

javascript - Resource responses is cut -

i have web app displays java script image carousel. showing 1 image @ time n seconds. when html page (index.html) loads loads n images in hidden parent html div , app (javascript) responsible showing , hiding parent divs images @ given interval. this works fine, times (randomly) half of image loaded (eg. half of image displayed on screen). sometimes "half" of index.html response loaded making html kode bleed out display. unfortunatly not have tools firebug etc. debug problem yet since screen kiosk (screen hanging on wall) to me seems network problem no network administrator guessing here. as said happens randomly. the image starts loading half of image. after maybe 15 seconds rest of image displayed. if network problem be? best regards, bob sounds network issue. why not try , cache images on browser don't have wait them load every time. try looking in firebug/web inspector net panel , should able see if browser waiting on network response

asp.net mvc - How to avoid duplication of authorization code logic -

i've written custom authorization attribute derived system.web.mvc.authorizeattribute . i'm using controllers restrict access features. public class articlecontroller : controller { [customauthorize(role.administrator)] public actionresult delete(int id) { // ... } } and works fine. want show or hide html elements according same authorization logic. example, in view "article", want hide action button "delete" if user not administrator. i've written that: <ul id="menu"> <li>@if (user.isinrole(role.administrator)) { @html.actionlink("delete", "delete", "article", new { id = article.id }, null) } </li> </ul> it works fine well, creates code logic duplication because need specify twice necessary credientials perform action: in controller block or allow action. in view show or hide action link. what best way avoid duplication? there w

Segfault when trying to call a Python function from C -

so, want call python callback function c. at point, function sent c , packed tuple this pyobject *userdata = py_buildvalue("oi",py_callback,some_number); somewhere in area, py_incref(py_callback) , too. @ later time in program, want call function pyobject *py_callback; int some_number; pyarg_parsetuple((pyobject*)userdata,"oi",&py_callback,&some_number); // returns true pyobject *py_result = pyobject_callfunctionobjargs(py_callback, /* ... */ null); and last call throws segmentation fault. have idea, why such thing? when getting weird behaviour python c api, worth double checking managing state of global interpreter lock (aka "the gil") correctly: http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock

javascript - How to disable the delete button using if condition in Extjs -

how disable delete button using if condition in extjs ex;i want disable button if satifies given if condition else remain enabled. if(validaction(entityhash.get('entity.xyz'),actionhash.get('action.delete'))) this grid delete button code. ext.reg("gridheaderbar-inactive", ad.gridinactivebutton,{ xtype: 'tbspacer', width: 5 }); ad.gridcampdeletebutton = ext.extend(ext.toolbar.button, { //text: 'delete', cls: 'ad-img-button', width:61, height:40, iconcls: 'ad-btn-icon', icon: '/webapp/resources/images/btn_del.png', handler:function(){ statuschange(this.parentbar.parentgrid, 'delete') } }); create actioncolumn , make custom renderer: { xtype: 'actioncolumn', width: 38, renderer: function (val, metadata, record) { this.items[0].icon = '${context_path}/images/' + record.get('filetype') +

Proper foreign keys for MS SQL Server 2005 without UNIQUE constraints? -

i have 2 tables (ms sql server 2005) existing application (no db alterations other indexes, etc allowed). the 2 tables are: activitydetails (primary table) activitydetailkey (primary key) subactivities (child table) activitydetailkey (refers activitydetails) now, there no contraints on subactivities activitydetailkey . basically, each activitydetail row, there can many subactivities rows , there nothing stopping user deleting activitydetails row , leaving subactivities orphaned. there supposed "soft locks" in application prevent isn't working , wanted put better integrity in db layer too. but can't seem add foreign key because subactivities 's activitydetailkey column isn't unique. how can prevent people deleting activitydetails rows if there children present? thanks edit i apologize complexity. subactivities table named tedetailsubactivities . changed in question easier read. but anyway, here gist of complete schema

javascript - Call C# Code from Ribbon JScript CRM Online 2011 -

i need have code execute on click of ribbon button on entity updates related data crm online 2011. prefer not have write of logic in jscript. there way call c# code jscript? have looked @ jscript file microsoft using ribbon , looks this: mscrm.campaign.copycampaign = function (campaignid, saveastemplate) { var $v_0 = new remotecommand("marketingautomation", "copycampaign", null); $v_0.setparameter("campaignid", campaignid); $v_0.setparameter("saveastemplate", saveastemplate.tostring()); var $v_1 = $v_0.execute(), $v_2 = $v_1.returnvalue; openobj(mscrm.entitytypecode.campaign, $v_2, null, null, mscrm.navigationmode.navigationmodeinline, null); mscrm.utilities.refreshparentgrid(mscrm.entitytypecode.campaign, campaignid) }; i see remotecommand call being placed assume going web service function. hoping this. can add own web service functions? i able make call jscript send "assign" message enti

tsql - t-sql group by category and get top n values -

imagine have table: month | person | value ---------------------- jan | p1 | 1 jan | p2 | 2 jan | p3 | 3 feb | p1 | 5 feb | p2 | 4 feb | p3 | 3 feb | p4 | 2 ... how can build t-sql query top 2 value rows , third sum of others? something this: result: month | person | value ---------------------- jan | p3 | 3 jan | p2 | 2 jan | others | 1 -(sum of bottom value - in case (jan, p1, 1)) feb | p1 | 5 feb | p2 | 4 feb | others | 5 -(sum of bottom values - in case (feb, p3, 3) , (feb, p4, 2)) thanks in assumption using sql server 2005 or higher, using cte trick. attach row_number each row, starting highest value, resetting each month. select top 2 rows each month query (rownumber <= 2) union remaining rows (rownumber > 2) sql statement ;with months (month, person, value) ( select 'jan', 'p1', 1 union select 'jan', 'p2', 2 union select 'jan&

jQuery FadeIn/Out Attributes -

i able modify code below fadeout , fadein removal , adding of style attribute body_id. i know can fade whole of body_id animate removal , adding of style attribute not inside id itself? $(".bg").click(function(){ var1 = $(this).attr('id'); loc = "background-image:url(" + var1 + ")" $("#body_id").removeattr("style").attr("style", loc + ";"); $.cookie('pagebg', loc,{ expires: 7, path: '/'}); return false; }); not possible in case, since we're talking background-image here, , there's no way change opacity of background-image through css. you can either change master opacity ( .fadein / .fadeout ) of element or use separate element positioned in same position background , fade instead. separate cleanup of current code: $(".bg").click(function(){ var bgurl = this.id; $("#body_id").css('backgroundimage', bgurl); $.cookie(&#

android: set layout dimension, center it and set to fullscreen in combination does not work? -

i want set width , height of window, center , set fullscreen hide top bar. with these lines can set dimension , set fullscreen centering takes no effect. window window = getwindow(); window.setgravity(gravity.center | gravity.fill_vertical | gravity.fill_horizontal); window.setlayout(480, 320); window.requestfeature(window.feature_no_title); window.addflags(windowmanager.layoutparams.flag_fullscreen); following sets dimension , centers top bar visible fullscreen takes no effect. window window = getwindow(); window.setgravity(gravity.center); window.setlayout(480, 320); window.requestfeature(window.feature_no_title); window.addflags(windowmanager.layoutparams.flag_fullscreen); and fanally if add <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/theme.notitlebar.fullscreen"> the window centered, dimensions set , fullscreen… first time launch app. after app cl

windows - Is there a cross-platform C signal library available(better open-sourced)? -

i'm working on project in need port portion of linux c code windows. code uses linux signal mechanism(i mean "sigaction", "sigprocmast", etc...) not supported on windows. is there c/c++ library available implements cross-platform signal mechanism(better open-sourced)? need library support linux & windows . i think this question make sense you because might given similar task day. one of colleagues told me ace powerful library implements cross-platform signal mechanism perfectly, said it's huge library , take time study it. project doesn't give me time i'm trying light-weight , easy-to-study signal library. (hmm.. well, if libraries know pretty big, please tell me. :-) i've done lot of research on subject google couldn't find want. here what have done far : searched in stackoverflow.com. people asked lot of details how use signals in linux nobody seemed ask cross-platform signal implementation. or, in stackoverflo

eclipse - no ocijdbc10 in java.library.path -

so i've been plagued issue, whenever try run app in eclipse, error. 2011-02-23 09:55:08,388 error (com.xxxxx.services.factory.serviceinvokerlocal:21) - java.lang.unsatisfiedlinkerror: no ocijdbc10 in java.library.path i've tried following steps found here no luck. i've tried on xp vm windows 7 (although in win 7 different error, below) java.lang.unsatisfiedlinkerror: no ocijdbc9 in java.library.path i've made sure oracle client ok (by running toad) , re-added classes12.jar / ojdbc14.jars web-inf/lib folder taken directly %oracle_home% folder (also re-added them lib path). i've tried adding ojdbc14.jar without classes12.jar. suggestions appreciated. in xp vm have path variable set c:\program files\java\jdk1.6.0_24\bin;c:\oracle\product\10.2.0.1\bin. i'm using tomcat server 5.0 i agree advice you've gotten in comments use thin driver instead of oci driver if can. simpler , should bypass problem you're having. if need oci driver

.net - Best approach to send mass e-mails through an ASP.NET webpage -

i've written contact management/communication system records details of people , allows mass communications sent out. however when e-mails being sent following exception raised: system.threading.threadabortexception: thread being aborted what best way send out mass e-mails through asp.net? what i'm looking approach that'll keep in asp.net i have feeling may need store e-mails in database , have separate .net console application/windows service send them out. because of development overhead , lack of time have, last option want consider. there no reliable way mass email broadcasting .net without intermediary. what mean emails must queued in database or other persisted storage. then, need app (console, service, whatever) responsible monitoring queue , acting on broadcast requests. second, not send them straight code. instead, send emails local mail server under control rebroadcasting actual recipient. shear number of spam detection mechanisms

Admin Plugins For Rails -

i'm looking admin plugin/gem rails 3 application. have tested rails_admin , seems good. has used other plugins rails 3.0? also has had issues rails_admin? a lot of options, @ moment. check of them out here. http://ruby-toolbox.com/categories/rails_admin_interfaces.html i have heard both admin_data , typus good.

How do I sort and add unique array options to a DropDownList using jQuery? -

i have array of objects “allclaimants” has 2 properties (userinfo & userid); example: allclaimants[allclaimantscounter].userinfo = "santhalingam sugirtha, 1980-06-05"; allclaimants[allclaimantscounter].userid = "1076073"; my allclaimants[allclaimantscounter].userinfo information contains 2 things “name + date of birth”. how can sort (by userinfo - in userinfo want sort name part not date of birth) , add unique values select dropdown (claimantsdropdown) text allclaimants[allclaimantscounter].userinfo , value allclaimants[allclaimantscounter].userid ? thanks you convert array list array.aslist(array) and use linq like list.orderby(x=> x.key) and depend on type of dropdrown have fill it, if dropdown aspnet server control use list datasource.

sharepoint - preupgradecheck site definition missing -

i have missing site definition when sharepoint 2007 preupgrade check, , can't find information on online, nor know how remove it. details are... name = unknown, language = 1033, template id = 15, count = 1, status = missing there no missing features, rogue side definition blocking upgrade. ideas? i figured out needed do. ran stsadm -o enumallwebs -databasename mydatabasename gave me list of sites , templates. i matched id (in case 15) site using , deleted site since didn't need anymore. preupgradecheck throws no errors.

php - How to exclude certain category in SQL Statement -

here's current codes popular post wordpress wp_post table. how can exclude in categories such 3 or 4? $popularposts = "select id,post_title {$wpdb->prefix}posts post_status = 'publish' , post_type = 'post' order comment_count desc limit 0,".$pop_posts; $posts = $wpdb->get_results($popularposts); dugg through web , stackoverflow, solved problem. still need add order comment_count desc limit 0,".$pop_posts somewhere in following code. $popularposts = "select * $wpdb->posts inner join $wpdb->term_relationships on($wpdb->posts.id = $wpdb->term_relationships.object_id) inner join $wpdb->term_taxonomy on($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ($wpdb->term_taxonomy.term_id <> 3 , $wpdb->term_taxonomy.term_id <> 4 , $wpdb->term_taxonomy.taxonomy = 'category' , $wpdb->posts.post_type = 'post' , $w

Get Visual Studio Designer's (Cider) zoom level -

i developing smart tag 1 of wpf controls. smart tag added through adornerprovider in design dlls of control. want synchronize zoom level of smart tag , visual studio designer, because if zoom in/out visual studio designer, smart tag remains unchanged. got idea? private designerview designer { { return designerview.fromcontext(this.context); } } protected override void activate(modelitem item) { this.adornedcontrolmodel = item; designer.zoomlevelchanged += new eventhandler(designer_zoomlevelchanged); // // code // base.activate(item); } void designer_zoomlevelchanged(object sender, eventargs e) { throw new notimplementedexception(); }

Can i provide services in Android app -

my question may seem foolish you! have doubt that, happens if dev android app, showing text "do want android app this? contact me on abcd@gmail.com" what happen? google ban! thank you! if distributing app on market, check android market developer distribution agreement.

c++ - Understanding getopt() example. Comparison of int to char -

hello hope can me understand why getopt used int , handling of optopt variable in getopt. pretty new c++. looking @ getopt, optopt defined integer. http://www.gnu.org/software/libtool/manual/libc/using-getopt.html#using-getopt and example here, http://www.gnu.org/software/libtool/manual/libc/example-of-getopt.html#example-of-getopt in example part not understand how `c', integer being compared char in switch statement. as understand main argument geopt working though character array argv fact deals returns int seems strange me, expectation char , required cast numerical arguments int. char being automatically converted it's ansi code , again or something? printf statment fprintf (stderr, "unknown option `-%c'.\n", optopt); is expecting char understand it, being given int. why getopt use int when it's dealing character array? am missing obvious? must be. when integer compared character constant in optopt == 'c' , character con

In Rails, what is the "API" of Restful Authentication? -

using restful authentication ( https://github.com/technoweenie/restful-authentication ), there api methods adds rails project? so far, found current_user # returns user object of current logged in user, nil if none logged_in? # returns true/false whether there logged in user before_filter :login_required # if no logged in user, redirects login page is there complete list of methods / api available? in old days, have complete list of methods / functions can call, in rails, find information scattered around. here's documentation of methods in project: http://rdoc.info/github/technoweenie/restful-authentication the wiki quite well: https://github.com/technoweenie/restful-authentication/wiki alternatives rails 2.3 , 3.0 authlogic: https://github.com/binarylogic/authlogic devise: https://github.com/plataformatec/devise

c++ - I need a smooth transition from One Dialog to another Dialog that looks the same -

i creating app has row of buttons across top , depending on button gets selected row of buttons appears across side. way planned on doing create separate dialog box each of top row of buttons , have new dialog pop when button selected. far able pop new dialog , hide main 1 it's obvious has happened. know how make appear seamlessly? thanks help! mary if interface changes user should see change. helps them use program effectively. you're trying achieve more aesthetic transition?

unix - Please Explain Ping -R www.xyz.com in a specific case? -

when use command on unix : $ping -r intra.mycompany.com (intranet address of company) it gives me desired router information (when ping local intranet address.) but when use other web site (outside intranet i.e. on internet) :- $ ping -r www.stackoverflow.com ping www.sta.com (64.34.119.12) 56(124) bytes of data. 10.203.129.242 icmp_seq=7 destination host unreachable could explain behavior of ping in above scenario. thanks help. basically think means unable ping stackoverflow.com or outside internet sites whatever reason. this might helpful information details issue , possible solutions. btw: know link shows windows cmd prompt (without knowing unix) guess issues similar on windows , unix, think network connection issue. hope helpful, if not sorry!

ruby - Can Bundler be configured to install gems rdoc? -

i use bdoc (with hanna formatting) quick way of looking @ rdoc documentation gems installed on system. however, because bundler not install rdoc when installing gems, i'm having generate them manually whenever start using new gem, or update existing one. does know if there's way of configuring bundler install rdoc when installing gems avoid me having manually? can't see mention of in bundler source, nor in config manual . if use rvm, try "rvm rdocs generate ..."

Arrays, multi-dimensional and jagged...in C# -

c# through asp.net 2.0. in datatable have 2 columns of ids, attributeid , productattributeid. i want loop through table , 'group' them in such way productattributeids have 1 or more attributeids associated them. for example, in pseudo-code i'm doing for each datarow in mydatatable.rows insert myarray @ index(productattributeid) - corresponding attributeid end foreach so loop , each time same productattributeid present, attributeid added array corresponding. obviously won't work arrays need size declared etc. i've tried multi-dimensional arrays, jagged arrays, arraylists, lists of arraylists no avail, code failing yet know in theory want do. i would, personally, use dictionary<int, list<int>> : foreach(var row in data) { // data... int attributeid = getattributeid(); int productattributeid = getproductattributeid(); list<int> attributes; if(!dictionary.trygetvalue(productattributeid, out attributes

c# - SQL CLR stored procedure for encryption -

background: have ssis package loads profile data system , creates corresponding profiles , membership users in system b. system b uses custom asp.net membership provider must able decrypt passwords generated ssis package. i've created clr stored procedures salt generation , encryption used ssis package. problem: in order encrypted passwords decryptable asp.net membership provider need set machinekey used clr stored procedures. have no idea how this, or if it's possible. i used reflector pull out required encryption code system.membership dll. after bit of refactoring looks this: private static byte[] performencryption(byte[] input, bool encryptflag) { if (input == null) return null; byte[] inputbuf = input; byte[] outputbuf; try { using (memorystream targetstream = new memorystream()) using (symmetricalgorithm algo = symmetricalgorithm.create()) using (icryptotransform cryptotransform = createcryptotransform(algo

modalviewcontroller - iPad - modal view - UINavigationController title is jumping -

so i'm presenting uinavigationcontroller standard modal window on ipad ( uimodalpresentationformsheet ). , i'm setting title of inside root view controller. when slides title on left side (as if center if width 320 of iphone), , when stops title jumps true middle. any idea why / can it?

c# - Should I use a simple foreach or Linq when collecting data out of a collection -

for simple case, class foo has member i , , have collection of foos, ienumerable<foo> foos , , want end collection of foo's member i , list<typeofi> result . question : preferable use foreach (option 1 below) or form of linq (option 2 below) or other method. or, perhaps, it not worth concerning myself (just choose personal preference). option 1 : foreach (foo foo in foos) result.add(foo.i); option 2 : result.addrange(foos.select(foo => foo.i)); to me, option 2 looks cleaner, i'm wondering if linq heavy handed can achieved such simple foreach loop. looking opinions , suggestions. i prefer second option on first. however, unless there reason pre-create list<t> , use addrange , avoid it. personally, use: list<typeofi> results = foos.select(f => f.i).tolist(); in addition, not use tolist() unless need true list<t> , or need force execution immediate instead of deferred. if need collection of "i"

ruby - Private channels with Pusherapp (using Rails) -

Image
i got through hello world pusherapp. want create private channels users read messages supposed read. the pusher docs give details on how this, , i'm kind of lost. from docs : ... pusher js library returned socket_id when connects pusher. when attempts subscribe private channel, sends ajax request server channel_name , socket_id parameters. the default url http://yourserver.com/pusher/auth . ... class pushercontroller < applicationcontroller def auth if current_user response = pusher[params[:channel_name]].authenticate(params[:socket_id]) render :json => response else render :text => "not authorized", :status => '403' end end end given unique user id (current_user.id), how can authenticate user have him/her subscribe corresponding channel? thanks this blog post on implementation seems explain things bit more: https://pusher.com/docs/client_api_guide/client_pr

mysql - Database suspension for 10 minutes -

how suspend row in mysql database 10minutes... after 10minutes database row must recovered normal stage... it seems trying wrong way. trying achieve. know no way of "suspending row". can copy row want suspend new table , remove original table. , reverse action based on timely event: does mysql have time-based triggers?

garbage collection - How does the .NET CLR distinguish between Managed from Unmanaged Pointers? -

everything jited native machine code, ultimately, have native stack in .net gc needs scan object pointers whenever garbage collection. now, question is: how .net garbage collector figure out if pointer object inside gc heap managed pointer or random integer happens have value corresponds valid address? obviously, if can't distinguish two, there can memory leaks, i'm wondering how works. or -- dare -- .net have potential leak memory? :o as others have pointed out, gc knows precisely fields of every block on stack , heap managed references, because gc , jitter know type of everything . however, point well-taken. imagine entirely hypothetical world in there 2 kinds of memory management going on in same process . example, suppose have entirely hypothetical program called "intermothra chro-nagava-sploranator" written in c++ uses traditional com-style reference-counted memory management pointer process memory, , objects released invoking release method c

javascript - Different CSS style on odd and even rows -

is possible, using css, set different styles on odd , rows dynamically generated table without myself setting correct style on each row when iterate collection? i'm not sure work cross-browser, i'd prefer jquery myself, css-only should trick: tr:nth-child(even) { ... } tr:nth-child(odd) { ... }

c# - Difference between null and not initialized? -

when write following code in c#: sqlcecommand command; try { // command used affect data command = new sqlcecommand { // init code removed brevity }; // stuff // more stuff } { if (command != null) command.dispose(); } resharper complains on check of command != null. says command may not assigned (because fail how in constructing , still hit try block). so change declaration of command sqlcecommand command = null; , happy. but left wondering difference is? and why doesn't default null? meaning: how c# benefit not defaulting local variables null? class field members defaulted (value types each depending on type, ref types null) local variables not. // example 1: someclass someobject; if(x == y) { someobject = new someclass(); } someobject.somemethod(); //error since may not execute if statements // example 2 someclass someobject; someobject = new someclass();

ruby on rails - Minimizing queries - Sorting results from a model -

i have client has_many :tasks . want sort these tasks separate variables, or hash, available view depending on date due. i'm trying minimize queries, , know @ point should pull tasks client, sort each task variable. can using controller method , before_filter when loading show action: def build_client_tasks @tasks = client.tasks.due @tasks_today = [] @tasks_tomorrow = [] @tasks_upcoming = [] @tasks_later = [] task in @tasks if task.due_date <= date.today @tasks_today << task elsif task.due_date == date.tomorrow @tasks_tomorrow << task elsif task.due_date > date.tomorrow && task.due_date <= 7.days.from_now.to_date @tasks_upcoming << task else @tasks_later << task end end end is there better/smarter way this? works fine, if want reload these tasks when user adds new task via ajax? i'm forced duplicate code in *.js.erb file availabl

large files Download in Java using FileCopyUtils.copy -

i wrote codes download files sever clients machines: bufferedinputstream in = null; try { in = new bufferedinputstream(new fileinputstream(filenpath)); } catch (filenotfoundexception e) { e.printstacktrace(); } string mimetype = servletcontext.getmimetype(filenpath); response.setbuffersize(fsize); response.setcontenttype(mimetype); response.setheader("content-disposition", "attachment; filename=\""+ filename + "\""); response.setcontentlength(fsize); try { filecopyutils.copy(in, response.getoutputstream()); in.close(); response.getoutputstream().flush(); response.getoutputstream().close(); } catch (ioexception e) { e.printstacktrace(

tsql - SQL Server Stored Procedure to dump oldest X records when new records added -

i have licensing scenario when person activates new system adds old activations lockout table can have latest x systems activated. need pass parameter of how many recent activations keep , older activations should added lockout table if not locked out. i'm not sure how best this, i.e. temp table (which i've never done) etc. for example, activation comes in john doe on system xyz. need query activations table activations john doe , sort date desc. john doe may have license allowing 2 systems in case need records older top 2 deactivated, i.e. inserted lockouts table. thanks in advance assistance. something perhaps? insert lockouts (<column list>) select <column list> (select <column list>, row_number() on (order date desc) rownum activations) t t.rownum > @numlicenses

android - How to remotely toggle application features? -

i want test 2 ad agencies on application. know there ad companies merge these companies that's not i'm looking for. want able control application features remotely. there service such flurry or such gives option change settings remotely? or have implement own? feature strictly developer use , not actual application users. hopefully i'm asking understandable... thanks! -jona check out www.adwhirl.com .i'm using , it's perfect!

asp.net - Why Windows Server 2003 causes "varchar to datetime out-of-range", wheras Server 2008 does not -

i have written small asp.net application using entity framework. a stored procedure accepts following: employeeid int, startdate varchar(12),enddate varchar(12) i use sql server convert short date strings datetime. set @correctstartdate = convert(datetime,(convert(varchar(10),@startdate,103) + ' 00:00:00am'), 103) set @correctenddate = convert(datetime,(convert(varchar(10),@enddate,103) + ' 11:59:59pm'), 103) in development environment iis7 windows server 2008 sql server 2008 r2 there no issues. if deploy production server iis6 (windows server 2003 sp2 sql server 2008 r2) get: "the conversion of varchar data type datetime data type resulted in out-of-range value.the conversion of varchar data type datetime data type resulted in out-of-range value." why be? both have regional settings same. what values of start , end date? try doing same using datetime2 instead of datetime.

Effective algorithm for finding 16x16 pixel same squares in a big image - C# -

i coding software @ visual studio 2010 using c#. software finding same squares @ image after square selected. every square composed 16x16 pixel. current algorithm starts first pixel , scan entire image pixel pixel comparing determine same pixel squares selected one. takes big time. can suggest me better way ? also every square ordered. start 0 - 16 - 32 - 48 a square can not start 5 or 65 etc thank you you cache checksum of each image-region. have check ones match checksum equality. let's assume each image 16x16 rgb elements. (and yes, have integer overflow.) all of in pseudo code - you're expected able translate c#. add int field image class, or create image wrapper int 'checksum' int checksum = 0 each pixel in image { checksum += pixel.red + pixel.blue + pixel.green // wanted here, // checksum *= 17 + pixel.red // checksum *= 17 + pixel.blue // checksum *= 17 + pixel.green // make "unique enough", hashcode } image

sorting - How Expensive is SQL ORDER BY? -

i don't quite understand how sql command sort large resultset. done in memory on fly (i.e. when query perfomed)? is going faster sort using order in sql rather sort linked list of objects containing results in language java (assuming fast built-in sort, using quicksort)? it more efficient sort data in database. databases designed deal large data volumes. , there various optimizations available database not available middle tier. if plan on writing hyper-efficient sort routine in middle tier takes advantage of information have data database doesn't (i.e. farming data out cluster of dozens of middle tier machines sort never spills disk, taking advantage of fact data ordered choose algorithm wouldn't particularly efficient), can beat database's sort speed. tends rare. depending on query, example, database optimizer may choose query plan returns data in order without performing sort. example, database knows data in index sorted may choose index scan re

rsync symlink help -

i'm trying setup rsync work symlinks. client server: example on client machine have symlink, when sync server, syncs actual file, want. server client: on server, if update file , sync server client, it's replacing symlink file, not want. problem: need client symlink remain intact, , rsync update actual file on client instead. i've been messing around options , can't right. any ideas? thanks. use rsync -l preserve links!

Porting from Rails 2.3.x to 3.x? -

has had experience porting rails 2.3.x rails 3.x? any pitfalls aware of or suggestions make? thanks! there lots of online resources performing upgrade. firsthand experience issues arise , first are: gem incompatibilities : there many gems work rails 3, , gems used work in rails 2 might no longer work in rails 3. make sure latest gem versions , read documentation ensure gems depend on supported. configuration changes : there's nothing special them, there lots , you'll have go through grunt work of making them. ruby 1.8.7 or greater : can't run rails 3 ruby 1.8.6. if aren't doing though, should @ least on ruby 1.8.7. if want upgrade ruby 1.9.x you'll have whole slew of other gem extension issues deal with, won't go here because you're asking rails 2 rails 3. bundler : if aren't using it, should be. makes managing gems , gem dependencies easier. have use bundler rails 3. no ./script/... anymore : calls made through rails script: rail

windows phone 7 - Is there a way to get addresses back from Bing SOAP Search Service? -

i'm using bing's soap search service in order points of interest around location. however, return items have geocoordinate location, not address. the program wp7 app maps poi, i'd show address of places found user. way make subsequent calls bing's geocode service each of lat/long results? seems time consuming , inefficient unless batch geocode call. thanks! the framework teasingly includes civicaddressresolver , appear perform task us, unfortunately, documentation states: this class not implemented in current release. however, not lost. can use same bing search service using reverse geocode location sending reversegeocoderequest described in developing silverlight application using bing maps soap services under reverse geocoding section. for detailed walkthrough (including code), take @ nick harris' blog post: how reverse geocode location address on windows phone 7

php - Submit external form without leaving the page/site -

i looked through site answers this, nothing's spot on need (this close, except doesn't submit form: prevent form redirect or refresh on submit? ). i'm trying incorporate mailing list sign-up (code borrowed sign-up page hosted on reverbnation) website. the form submits properly, signee redirected hideously rendered page on reverbnation's site. cannot modify script , don't think there's api can use keep things tidy. is there way can submit form in background, without user being redirected? here's example in php tunneling post. //set post variables $url = 'http://domain.com/url-to-post-to'; $fields = array( // add fields want pass through // remove stripslashes if get_magic_quotes_gpc() returns 0. 'last_name'=>urlencode(stripslashes($_post['last_name'])), 'first_name'=>urlencode(stripslashes($_post['first_name'])), 'email'=>u

sql server - How to join/flatten these tables -

i have table this: table name: product id productid productname 1 d100 sample product 2 k500 sample product there related table looks this: table name: colorsize id productid color s m l xl 1 d100 red s m l 2 d100 black s m l 3 d100 blue s m l 4 k500 green l xl 4 k500 red l xl the general rule product id has same sizes, different colors. if d100 red comes in s, m , l, d100s come in s, m , l. product can have 20 colors. i need write sql statement output following productswithcolors id product id productname color1 color2 color3 s m l xl 1 d100 sample product red black blue s m l 2 k500 sample green red

c# - How can I limit access to an assembly? -

how can limit loading , execution of libraries based on defined precondition? example, if distribute client application uses external library, how can ensure external library used application , not used client other purposes? is code access security answer? if so, there example of how apply in situation described above? thanks! update: cannot use services protect logic. must supply code in assembly, , want protect being used build other products. the best way limit access move logic assembly service layer. if concerned protecting logic in assembly best way. remember, mechanism can defeated enough effort if client has assembly in hands , motivated use it. why service layer perfect solution gives application access logic without allowing client obtain implementation itself.

javascript - Adding div before selected div -

i have bunch of divs 1 after other. <div class="betweenable">some content</div> <div class="betweenable">other content</div> <div class="betweenable">yet another</div> when click last div, want insert text new content in div before it, final result be <div class="betweenable">some content</div> <div class="betweenable">other content</div> <div class="betweenable">new content</div> <div class="betweenable">yet another</div> i tried append it's adding new markup inside select div at top . want inserted outside selected div , right before it. should use instead of line var newmarkup = '<div class="betweenable">new content</div>'; $(this).prepend(); you can try $('.betweenable').click(function(){ var newmarkup = '<div class="betweenable">new cont

artificial intelligence - parameter optimization for classifier algorithm -

it said different algorithms have different parameters. don't see true, if tree decision algorithm , naive bayesian algorithm, parameter each? can give me example.. if case doing 5-fold cross validation data going run using decision tree algorithm different bayesian? also parameter optimization 5-fold cross validation. there way automatically determine set values key of parameters using weka? since using weka, can see parameters each algorithm opening dataset in explorer , going classify , choosing algorithm , clicking on algorithm box. instance naive bayes classifier has parameters affect how deals continuous data (discretization or using kernel estimator)

caching - How do I save and reload MySQL Query Cache to Keep Site Running at Peak Speed -

i running magento e-commerce installation (which runs on php/mysql) on testing server. have large (from i've read) query_cache_size of 272,629,760 bytes , works great. the site runs lightning fast once of queries loaded query cache, fast fastest production sites (other perhaps google.com or amazon.com). problem have in order load of queries query cache have manually click through 100's of links on site. every time click link, query sent database , saved in cache. if restart server, have on again. there must better way! ideally, think there should way "backup" query cache before restart , load upon restart. possible? otherwise, i'm going have design web crawler automatically clicks links. aside mysql's query cache, should using apc (alternative php cache) well, , possibly of magento's built-in full-page caching mechanisms. this mitigate of round-trips mysql , back, lessening need primed mysql cache. can 'prime' cache of m

c - updating data in a CSV file -

hi every 1 want read , write data csv file using c program. problem @ run time data increasing in both row wise , column wise. means continuously updating in both direction. is there way through can find next colum or row eg (row 4 ,col 3) , place data it one thing more not necessary that rows have same number of column filled appreciated thanks why don't keep data in memory , write out csv file if ready? or option, line feed indicator new data element come? or maybe option think kind of structure can use , modify , in end write out .csv file? or if structure inhomogenous why stick csv? because answer burried in comments. current suggestion commens needs way read in csv file. has keep track of things wants track (ip connections) , file can regenerated 30 or seconds.

asp.net mvc - Linq to Sql: Error on InsertOnSubmit -

private table<gallery> gallerytable; public galleryrepository ( string connectionstring ) { dc = new datacontext(connectionstring); gallerytable = dc.gettable<gallery>(); } public void savegallery(gallery gallery) { if (gallery.galleryid == 0) gallerytable.insertonsubmit(gallery); else if (gallerytable.getoriginalentitystate(gallery) == null) { gallerytable.attach(gallery); gallerytable.context.refresh(refreshmode.keepcurrentvalues, gallery); } gallerytable.context.submitchanges(); } when inserting new gallery table, method throws object reference not set instance of object error. gallery not null , neither gallerytable in advance so problem gallery entity had private entityset<tag> _tags; [system.data.linq.mapping.association(storage = "_tags", otherkey = "tagid")] public entityset<tag> tags { { ret

iphone - how to fault find if a delegate call is not being picked up in objective-c -

just implementing first delegate in objective-c. thought had in place call addcontroller listcontroller isn't being picked in listcontroller. given i'm not getting exception, , can see code point in addcontroller calls delegate, there fault finding tips? so example: given "delegate" call (see below) did not throw exception can assume delegate declarations in same file ok? "[delegate newitemcontroller:self didfinishwithsave:yes];" given parent controller speak have delegate specified in *.h definition (see below), implied i've correctly implemented method in *.m file, noting no build errors? @interface rootviewcontroller : uitableviewcontroller { is there known way delegate calls go missing without exception if items don't (i.e. if there should check for) thanks most common error i've seen delegate method not being called nil delegate property. in other words, forgetting specify delegate is? as debugging tips, an

Rails - Validate field in another model -

need on figuring out how validate 1 field if , if field in related model of value. example: //my models class course < activerecord::base has_many :locations, :dependent => :destroy accepts_nested_attributes_for :locations end class location < activerecord::base belongs_to :course end a course can have many locations (state, city, etc) start_date. want have like: "allow location.start_date blank if course.format == 'dvd'" in location model tried like: validates_presence_of :start_date, :message => "start date can't blank", :allow_blank => false, :if => proc.new { |course| self.course.format != 'dvd' } then when use that, get: private method 'format' called nil:nilclass not sure if i'm on right track here. thanks! the proc passed if clause passes parameter block instance of current object being validated.

asp.net mvc - MVC 3, Best way to call this HTML -

creating site in mvc 3 , have code snippet use on several parts on design. it's designcode creates head modules on site. wondering if best way call code snippet? should use helpers or there better way? today this: public static ihtmlstring framemoduleheader(this htmlhelper helper, int type, string headline) { stringbuilder html = new stringbuilder(); html.append("<div class='module_top'>"); html.append("<div class='module_top_left'></div>"); html.append("<div class='module_top_middle_" + type + "'><div class='module_top_headline'><h4>" + headline + "</h4></div></div>"); html.append("<div class='module_top_right'></div>"); html.append("</div>"); return mvchtmlstring.create(html.tostring()); } an

java - REGEX matching problem -

my entering string can in format tim0.vw0 ( starts tim or cnt or enc followed numbers, point , @ end char or chars digit @ end). how find out if entering string matches regex ? something do: import java.util.arrays; public class test { public static void main(string[] args) { string regexp = "(tim|cnt|enc)\\d+\\.\\p{alpha}+\\d"; (string test : arrays.aslist("tim0.vw0", "tim0.vw5", "tim0.0", "tim99.a5", "cnt0vw0", "abc0.vw0", "-tim0.vw0", "tim9.8x", "enc0.55")) system.out.printf("%-10s: %s%n", test, test.matches(regexp)); } } output: tim0.vw0 : true tim0.vw5 : true tim0.0 : false tim99.a5 : true cnt0vw0 : false abc0.vw0 : false -tim0.vw0 : false tim9.8x : false enc0.55 : false

java swing remember Login and password and another text field :) -

so want make our swing application remembet our last choices(login,pasw,smtng) when start program. so easiest way save entered values file , read it, , auto connect somewhere :) but have feeling java has smarter way remember values (i’m making smtng putty.exe) jdbc? preference api help

jquery - Including datanodes in html by hiding : good idea? -

i add data html page showed dynamically (by means of jquery). data xml (so in fact part of html dom). now hiding css ( .data { display:none; } ) html : <div id="section1"> <h2>section 1</h2> <p>a visible paragraph </p> <!-- data has section 1 --> <data class="data"> <eg1>some data</eg1> <eg2>more data</eg2> </data> </div> the data not shown , can reached jquery. while seems work fine, want know now, in process, if way of working has drawbacks i'm not thinking of now... update : of course it's non-html tags also. use <div class="data"> <div class="eg1> just : then, question remains. thanks input! the drawback having no non-js fallback. robust code create static html displayed. , use javascript hide "hidden" data , allow user show again via links/fns/whatever. this useful becaus

php - HTML input value change -

i have php update page in showing text field containing value database. this, , working, <input type="text" name="title" id="title" class="text_box" value="<?php echo $row['title']?>"/> now need put updated value in database! have used code this, it's not updating: $title=$_post['title']; $v_id = $_get['v_id']; $sql = mysql_query("update vehicles set title = '$title' v_id = '$v_id'"); in detail... input field there. it's showing value contained in $title (retrieved database) , value edited , updated. from side code working without showing error, value give $title giving same 1 without change. is there other way show value in input field without putting in "value" tag? 2 things wants happen in single input field! you'll need post form html well. unless form looks following, code won't work <form method='post'

javascript - checkbox question with php -

my question when user click on checkbox, user activated. code working fine. when user again click on uncheckbox, again user de-activated. how that? here working code. activate user when user click on checkbox if($_get['doaction'] == 'activate') { if(!empty($_get['q'])) { $userid = $_get['q']; $conn = db_connection(); $query = "update user set activate = '1' userid = '".$userid."' "; $result=$conn->query($query); } } here checkbox <input type="checkbox" name="app" onchange="calluser(this.value,doaction.value);" value="<?php echo $userid;?>" <?php if($row['approved'] == '1'){ echo "checked=\"true\""; }?>/> <input type="hidden" name="doaction" id="doaction" value="approved" /> thanks much. :-) edit-> here calluser() functio

blackberry - Add gui components from bottom up instead of top down -

is possible add gui components blackberry screen beginning bottom instead of top ? thanks a quick response no let me explain why , suggest afew work arounds; screens don't handle laying out of fields onto themselves, delcare delegate manager can type of manager, vertical, horizontal etc. problem managers begin painting top left. manager paint fields starting bottom have know exaclty bottom located , add components rather down goes against low level code inside manager class. can read more on managers in blackberry api documentation . you still achieve effect similar though tweaking how add fields , playing field styles. example consider code: add(new labelfield("field 1")); add(new labelfield("field 2")); this give results; field 1 field 2 because field 1 drawn field 2 below it. if insert fields @ begining of our manager e.g. position 0 so: insert(new labelfield("field 1", field_bottom), 0); insert(new labelfi

c++ - how does overloading of const and non-const functions work? -

the stl full of definitions this: iterator begin (); const_iterator begin () const; as return value not participate in overloading resolution, difference here function being const . part of overloading mechanism? compiler's algorithm resolving line like: vector<int>::const_iterator = myvector.begin(); in example gave: vector<int>::const_iterator = myvector.begin(); if myvector isn't const non-const version of begin() called , relying on implicit conversion iterator const_iterator.

security - Sharing an encrypted connection string across multiple applications in .NET -

i'm looking way of encrypting database connection string shared across number of different services , applications. these applications , services run on same machine, may (most likely) change in future. i've taken @ functionality in .net's system.configuration namespace, , doesn't quite want. unless i'm missing obvious, allows me encrypt connection string there doesn't appear way export encryption keys can share them across multiple machines. in fact, isn't clear msdn documentation whether i'll able share encrypted data across multiple processes. it's worth noting here not asp.net web service, can't make use of web.config file , aspnet_regiis.exe perform key management. or can i? if there no way of doing with system.configuration classes, i'll resort storing encrypted connection string in registry , own key management. ideal solution avoid registry , use .net's system.configuration facility. you can use same .config encry

windows phone 7 - how to get parent name of a context menu item? -

i'm trying parent name of context menu item. so tried on menuitem_click : button clikance = (button)sender; string ladygaga = convert.tostring(clikance.content); but didn't work (invalid cast exception). thx help i have use different approach getting sender button of context menu. have made event on "hold_click" where have content of button in public string private void gesturelistener_doubletap(object sender, gestureeventargs e) { button clikance = (button)sender; buttonenvoyeur = convert.tostring(clikance.content); }

java - XSS attacks in jsp -

hi have jsp page in following lines if(exception err) { out.println (err.getmessage() + "<br/><br/>"); } may xss attacks want display above things without xss attacks thought ? use c:out tag. also see java-best-practices-to-prevent-cross-site-scripting

javascript - JQuery - Stopping Event Bubbling in all Browsers -

i have massively nested gui controls - when they're clicked or changed or whatever need stop event going further dom tree. needs work across browsers. at point i've got rather clunky js code: //do in response original user action //leave @ that. try { e.stoppropagation(); } catch (ex) { } try { event.cancelbubble(); } catch (ex) { } try { event.preventdefault(); } catch (ex) { } ... this work, smells , feels wrong (personally loathe empty catch blocks). there neater x-browser trick can use? if use jquery event.stoppropagation() work fine. jquery unifies event handling. in general if, want test special browser methods, can so: if(event.stoppropagation) { event.stoppropagation(); } else if... this jquery doing. creates wrapper event , provides unified interface. the name of event object defined you . event object passed first argument event handler. have setup event handler accept p

visual studio - Reporting Services - header with blank spaces -

i got problem rdlc-report repeats whole header, if there data or not, repeats blank space. i dont want use rectangle instead of header or something, there workaround let header-data in header? i dont want have blank spaces, wanna see body there. thanks in ancipiation alex you can try group header...? hide row(s) if there's no data it, , won't leave space... set header repeat on each page. would option? i've done few reports required footer of stuff in there needed on last page didn't want huge white space in footer area when visibility set hide pages last one... group footer didn't work me because needed things @ bottom of every page (like form) , can't access globals in body of report toggle visibility... had setting stuff wanted on last page @ end of data, meaning might in middle of last page.... positioned main tablix inside big rectangle that's equal whole page length - margin size - header length - footer length - (that rectangl

help in using HttpWebResponse c# -

i need in finding better way in downloading url using httpwebresponse i used next code httpwebresponse myboot = httpwebrequest.create("http://www.wwenews.us/m1.php?id=441229").getresponse() httpwebresponse; streamreader myboot_content = new streamreader(myboot.getresponsestream(), encoding.getencoding("windows-1256")); string temp_data = myboot_content.readtoend(); but problem says the server committed protocol violation. section=responseheader detail=cr must followed lf appears me when trying parsing http://www.wwenews.us/m1.php?id=441229 please me download string of site note: test solution code before present had tested several solutions , no 1 solve problem add reference system.configuration project , add following method. public static bool setunsafeheaderparsing() { assembly oassembly = assembly.getassembly(typeof(system.net.configuration.settingssection)); if (oassembly != null) {

c# - How to generate Crystal Report in PDF format while passing Multiple Parameters? -

i want generate crystal report in pdf format. had done same thing passing 1 parameter. time want pass 10 parameter. followed same thing did passing 1 parameter. but got error message "unable evaluate expression because code optimized or native frame on top of call stack." please give suggestions. in advance. please modify code according generate crystal report in pdf format. in button click event have written following code. try { crystaldecisions.crystalreports.engine.reportdocument rpt = new crystaldecisions.crystalreports.engine.reportdocument(); string conn = configurationmanager.connectionstrings["connectionstring"].tostring(); string[] str = conn.split(';'); string server = str[0].substring(str[0].indexof(" = ") + 3); string database = str[1].substring(str[1].indexof(" = ") + 3); string userid = str[2].substring(str[2].indexof(" = ") + 3