Posts

file io - Python error: list indices must be integers, not unicode -

there problem: i'm trying numbers tkinter's text widget(get's text file) way: text = self.text_field.get(1.0, 'end') s = re.findall("\d+", text) s returns this: [u'0', u'15', u'320', u'235', u'1', u'1', u'150', u'50', u'2', u'2', u'20'] than try add tags text widget: for in s: self.text_field.tag_add('%s', '5.0', '6.0') %s[i] and gives error: list indices must integers, not unicode thanx helping me :) in python when do for x in l: ... inside body loop x list element, not index. in case correction needed use % i instead of % s[i] . if in other cases need both list element , index number common python idiom is: for index, element in enumerate(l): ...

Android custom adapter getView() NullPointerException out of nowhere! -

i've got custom adapter supply data listview. worked fine, 'suddenly'(i don't have word what's happening) app started crashing while loading activity listview: w/dalvikvm( 228): threadid=3: thread exiting uncaught exception (group=0x4001b188) e/androidruntime( 228): uncaught handler: thread main exiting due uncaught exception e/androidruntime( 228): java.lang.nullpointerexception e/androidruntime( 228): @ advertisementlistadapter.getview(advertisementlistadapter.java:72) e/androidruntime( 228): @ android.widget.abslistview.obtainview(abslistview.java:1274) e/androidruntime( 228): @ android.widget.listview.measureheightofchildren(listview.java:1147) e/androidruntime( 228): @ android.widget.listview.onmeasure(listview.java:1060) e/androidruntime( 228): @ android.view.view.measure(view.java:7964) e/androidruntime( 228): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3023) e/androidruntime( 228): @ android.w...

.net - Extend DataSet Class Not Working -

i've created dataset using dataset designer. 1 of tables called users , there class called usersdatatable . in class properties, namely connection . created partial class usersdatatable , none of routines, properties, or variables usersdatatable class in designer codebehind file visible me. i'm trying extend class add own routines leverage connections , strong typing of designer-generated class. i've tried creating own partial classes , testing them see if have problem other classes , don't. these dataset designer-generated classes can not access items in other half of partial class. i'm working in .net 4. might doing wrong? all of "partial" classes must declared such in order technique work, , i'm guessing visual studio dataset designer isn't generating partial classes: http://msdn.microsoft.com/en-us/library/wa80x488(v=vs.100).aspx you might need inherit designer-generated classes instead. edit: looked @ vs2010-generate...

path - php: setting root directory for project? -

i'm having following url test project on local server: http://localhost/projects/test/ now i'd have have possibilty of using root directory eg. includes/images - <img src='/img/test.jpg'> - way save me lot of time simple put online without path modifications/flag. any ideas how work? thanks i guess not php related question, more on html. may on <base> tag. instead of saying: <img src='/img/test.jpg'> go , make: <head><base href="http://localhost/projects/test/" /> ... </head> <body> <img src="img/test.jpg" /> </body> which in fact point to: http://localhost/projects/test/ img/test.jpg and php scripts use set_include_path() function <?php $path = '/usr/lib/pear'; set_include_path(get_include_path() . path_separator . $path); ?>

dll - C++: 'adding references' to namespaces (and class libraries)? -

i'm curious adding references through "property pages" dialog in visual studio c++. adding 'class libraries' and, more so, 'namespaces'. in i'm reading says both 'class library's , 'namespaces' can referenced in way-- can see reference 'class libraries' (bringing in dll able access it's '.h' files , such-- correct me if i'm wrong). referencing namespace do? understand 'using' declarative allows not qualify namespace anymore-- 'referencing namespaces' way that? to clarify mean 'referencing': i'm talking when right clicking on project in solution explorer , selecting 'references' brings 'property pages' dialog , selecting 'add new reference...' button. 'add reference' in .net #include ing in normal c++. allows use classes , namespaces inside .cs file, not in project, e.g., system libraries. if you're coding normal c++, don't wo...

ios4 - can we retrieving text messages from iPhone memory in iPhone sdk? -

hello friends want know whether can access or fetch or retrieve text messages in iphone memory can make pdf of these text messages. in advance. no. pretty bad privacy , security standpoint if allowed that.

Perl regex - exponential values -

what's regex match decimal number check not contain exponential values? thanks help. can match except if contains "e-", "e+", "e-" or "e+"? the thing cost field, , can contain currency symbols, parenthesis , other characters that without detailed specs it's not easy task using regular expressions. in opinion, regex inappropriate when know little format of input. update after op's edit: can match except if contains "e-", "e+", "e-" or "e+"? that e.g. ^(?!.*[ee][+-]).*$ (using negative lookahead ), matching more like…