Posts

cocoa - Converting NSString to keyCode+modifiers for AXUIElementPostKeyboardEvent -

edit: turns out, misled during initial explorations of accessibility apis. once found secure text field in ax hierarchy, able set value. not sure question beyond that, wanted update future searchers. i'm working on code post keyboard events targeted applications using accessibility apis. far, have been able write trivial app allows me type in string value , post keyboard events key codes targeted application. in reality, strings read location. what have not yet been able figure out how ascertain whether , modifier keys should posted. instance, when type hello, world! test application, input sent other application hello, world1 because not yet including modifier keys create upper case h , exclamation point. made doubly complicated multi-keystroke characters é or ü . sending é sends raw e no accent example. is there simple method overlooking discerning modifiers combine keycode creating particular nsstring or unichar? if not, have suggestion of how proceed? far, best ...

c# - how would i call this function with a delegate as a parameter -

i have repetitive code trying refactor generic function generate list of checkboxes list of objects (all lists of inamed). the second parameter delegate call function can't figure out how call method. best way call method delegate? (i looking example of code call checkboxlist function) public delegate bool hashandler(inamed named); here generic method static public string checkboxlist(iqueryable<inamed> allitems, hashandler has, string name) { stringbuilder b = new stringbuilder(); foreach (var item in allitems) { if (has(item)) { b.append("<input type='checkbox' class='checkboxes' name='" + name + "' value=" + item.id + " checked />" + item.name); } else { b.append("<input type='checkbox' class='checkboxes' name='" + name + "' value=" + i...

sql server 2008 - Modeling A Food Recipes Database -

i'm trying design "recipe box" database , i'm having trouble getting right. have no idea if i'm on right track or not, here's have. recipes(recipeid, etc.) ingredient(ingredientid, etc.) recipeingredient(recipeid, ingredientid, amount) category(categoryid, name) recipecategory(recipeid, categoryid, name, etc.) so have couple of questions. how doing far? design okay know? how implement preparation steps? should create additional many-to-many implementation (something preparation(prepid, etc.) , recipeprep(recipeid, prepid)) or add directions in recipes table? ordered list in ui (webpage). thank help. some thoughts: you might want use same table recipe , ingredient, type indicator column. reason recipes can contain sub-recipes. let's call combined table "item". recipeingredient table like recipeingredient (recipeid, itemid, amount). i'd expect table have sequencing column. if want calculations these re...

iphone - Video recording and saving the video on a server -

i caught task how should go capturing video in app , saving directly on server. have sample code discussed in wwdc2010 need other more helpful links or tutorials complete task. please give me opinion or share links if have. thanks, there nothing in apis allow this. way use avassetwriters segment video. stream completed segments. these need reassembled on server side if require single file.

regex - Attribute Error for strings created from lists -

i'm trying create data-scraping file class, , data have scrape requires use while loops right data separate arrays-- i.e. states, , sat averages, etc. however, once set while loops, regex cleared majority of html tags data broke, , getting error reads: attribute error: 'nonetype' object has no attribute 'groups' my code is: import re, util beautifulsoup import beautifulstonesoup # create comma-delineated file delim = ", " #base url sat data base = "http://www.usatoday.com/news/education/2007-08-28-sat-table_n.htm" #get webpage object site soup = util.mysoupopen(base) #get column headings colcols = soup.findall("td", {"class":"vatextbold"}) #get data datacols = soup.findall("td", {"class":"vatext"}) #append data cols in range(len(datacols)): colcols.append(datacols[i]) #open csv file write data fob=open("sat.csv", 'a') #initiate 5 arrays state...

header - Multiple Source File Problem in C++ -

i had a problem in implementing multiple source file my function this: inline bool textcontains(char *text, char ch) { while ( *text ) { if ( *text++ == ch ) return true; } return false; } void split(char *text, char *delims, vector<string> &words) { int beg; (int = 0; text[i]; ++i) { while ( text[i] && textcontains(delims, text[i]) ) ++i; beg = i; while ( text[i] && !textcontains(delims, text[i]) ) ++i; words.push_back( string(&text[beg], &text[i]) ); } } string convertint(int number) { stringstream ss; ss << number; return ss.str(); } string dateformatchecker(const char *date){ string strdate=date; char getdate[50]; strcpy_s(getdate, strdate.c_str()); vector<string> checkdate; split( getdate, "-", checkdate ); int year, month, day; year=atoi(checkdate[0].c_str()); month=atoi(checkdate[1].c_str()); day=atoi(checkdate[2].c_str()); string checkyear, che...

c++ - new operator for memory allocation on heap -

i looking @ signature of new operator. is: void* operator new (std::size_t size) throw (std::bad_alloc); but when use operator, never use cast. i.e int *arr = new int; so, how c++ convert pointer of type void* int* in case. because, malloc returns void* , need explicitly use cast. there subtle difference in c++ between operator new , new operator. (read on again... ordering important!) the function operator new c++ analog of c's malloc function. it's raw memory allocator responsibility solely produce block of memory on construct objects. doesn't invoke constructors, because that's not job. usually, not see operator new used directly in c++ code; looks bit weird. example: void* memory = operator new(137); // allocate @ least 137 bytes the new operator keyword responsible allocating memory object , invoking constructor. what's encountered commonly in c++ code. when write int* myint = new int; you using new operator allo...