Posts

Handling HTML SELECT Options with event delegation to javascript on iPhone Safari -

we developing web application gui customized use on iphone. page on app has 3 subsequent select dropdowns, selection of option 1st dropdown derives options 2nd dropdown, , forth. subsequent dropdown options populated javascript based on onchange event on previous dropdown. problem that, on iphone options select appears 'prev' , 'next' links move previous , next control. when 'next' link clicked, control moves next select , displays options. javascript triggered onchange event previous select , populates options next select. on dropdown 2nd select displays previous options before repopulated javascript. there workaround or event can sequence execution of javascript , selection of next control? there event can triggered when select option selected , before control leaves select element? there handle next , previous links select dropdown option display? maybe use focus event, in jquery be: $('#select2').focus(function () { // update sel...

linked list - Passing a object by reference in c++ -

this noobie question, i'm not sure how pass reference in c++. have following class sets node , few functions. class node { public: node *next; int data; node(int dat) { next = null; data = dat; } node* getnext() { return next; } void setnext(node *n) { next = n;} void reverse(node *root) { node *previous = null; while(root != null) { node *next = root->getnext(); root->setnext(previous); previous = root; root = next; } root = previous; } }; now, purpose of little class create singularly linked list , have ability reverse it. , seems work fine, if return node named 'previous' @ end of reverse. but @ main function: int main() { node *root = new node(1); node *num2 = new node(2); node *num3 = new node(3); node *num4 = new node(4); root->setnext(num2); num2->setnext(num3); num3->setnext(num4); root->printlist...

c# - Approaches to do keyword search in FAQ -

my site (asp.net + c#) has faq data pull site's web service in xml format. data size pretty small (just 50 faqs). want implement keyword search faq , highlight search keyword. fast , easy approach this? my first thought using c# string search or xml search method. know not scalable. consider faq little, may not need index faq. wrong. can give me suggestions? thanks. the best solution using regular expressions . regex scales too, don't need worry speed. using regex replace, adding tag around matches make them stand out easy well. you can find regex tutorial here . has info both general regex use, , link goes explanation .nets implementation. regex has step learning curve, worth effort, because incredibly powerful.

What am I missing? GetLine function (C++) -

string getline() { char parameter[26] = {null}; infile.getline (parameter,26,' '); return parameter; } now example of input file looks this: ~in.txt~ bac bca(space after last a) ~end file~ i have have space after or else function line won't work. there way not have space after , still work? i have 26, because input line have 26 letters in it. i need have them separated have because how use it: string in, post; in = getline(); post = getline(); thanks suggestions on this, small chunk of code program i'm still working on. wanna cover bases because professor testing program own input file , don't know if input file end space. this kind of silly redundant function, , don't know why call "getline", here ya go: string getline() { string s; infile >> s; return s; }

design patterns - Advice on POCO Validation with ASP.NET MVC/Entity Framework -

here's scenario: asp.net mvc2 web application entity framework 4 (pure poco's, custom data context) repository pattern unit of work pattern dependency injection service layer mediating controller -> repository so basically, cool stuff. :) flow of events basic ui operation ("adding post"): controller calls add(post) method on service layer service layer calls add(t) on repository repository calls addobject(t) on custom data context controller calls commit() on unit of work now, i'm trying work out can put validation. at stage, need 2 types of validation: simple, independant poco validation such "post must have title". seems natural fit data annotations on poco's. complex business validation, such "cannot add comment locked post". can't done data annotations. now, have been reading "programming entity framework, second edition" julie lerman (which excellent btw), , have been looking hoo...

c# - Correct Process for Routing with Admin Subsite -

i'm building first asp.net mvc2 site, , i'm trying add /admin area site. i don't want area visibile main set of users accessible when enter http://intranet/admin what have newscontroller regular users want admin newscontroller , i'm not sure how setup class hierarchy , folders when add views in correct location. inside global.asax.cs i've added , routes resolve correctly. routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional }, // parameter defaults new string[] { "intranet.controllers" } ); routes.maproute( "admin", // route name "admin/{controller}/{action}/{id}", // url parameters new { controller = "admin", action = "index", id = urlparameter.optional }, // parameter defaults new string[] { "intranet.controllers.ad...

ios4 - UIPopOverController for iPhone (currently only available for iPad) -

before implement similar iphone, i'm wondering if has implemented similar of uipopovercontroller iphone . far available ipad. see implementation here: https://github.com/werner77/wepopover it has same interface uipopovercontroller generalized iphone , support custom background views.