Posts

string - How to get a specific field from delimited text -

i have string of delimited text ie: value1:value2:value3:value4:value5:value6 how extract, example, specific value ie: label.caption := getvaluefromdelimitedtext(2); value2 thanks in advance paul this should it: function getvaluefromdelimitedtext( const s: string; const separator: char; const index: integer ): string; var i, itemindex, start: integer; begin itemindex := 1; start := 1; := 1 length(s) begin if s[i]=separator begin if itemindex=index begin result := copy(s, start, i-start); exit; end; inc(itemindex); start := i+1; end; end; if itemindex=index begin result := copy(s, start, length(s)-start+1); end else begin result := ''; end; end; this version allows specify separator, pass ':' . if ask item beyond end function return empty string. change exception if preferred. finally, have arranged uses 1-based indexing per example, choose 0-based indexing. ...

python - Finding index of the same elements in a list -

suppose have find each index of letter 'e' in word "internet": letter = 'e' word = 'internet' idx = word.index(letter) but code gives first index. how can find rest of them? mark's answer better single letter. i'm adding in case real substring longer single character. if want use str.index() , can take optional start position , raise valueerror if desired substring not found: >>> letter = 'e' >>> word = 'internet' >>> last_index = -1 >>> while true: ... try: ... last_index = word.index(letter, last_index + 1) ... print last_index ... except valueerror: ... break ... 3 6

mysql - PHP : How can I synchronize one online sql database with another offline database? -

currently working on bus ticket booking site here want run site offline when online server not working due internet problem or server error occurs. problem when run site offline through xammp server how can find last insert bus id online server , how online server know last offline bus_id . anyone can book ticket online 1 pc handle offline site. you have insert communication between servers if both online. or use different ids both servers (largs ids offlie / small ids online).

logging - microSD card FAT module -

i have been using ualfat microsd board ghi electronics data logging, have been having problems reliability; of function calls, @ times, take far longer can handle. using msp430 microcontroller talk ualfat. what similar boards out there possibly use instead of ualfat more reliable? or what favorable oem solution if needed design own interface board work msp430? i think bit differently. flash based storage device have variable timing on writes. 1 file system , wear leveling , features that. tends nature of flash since have erase whole blocks , move things around. if can't live variable timing, i've done in past move piece out of time critical portion of code. typically add queue time critical code writes to, , in background pull queue , write sd card. in rtos, lower priority task. in polling loop, function called when system idle. this changes constraint being worst case timing function call being able meet average throughput requirements logging. worst ca...

c# - How to add Assembly-References on a per-configuration-basis -

i'm looking add debug code windows phone project. debug code drag in debug class library references (nunit helpers) , wcf service client references, , i'd not have these referenced in release build. can suggest way can add assembly-reference debug, not have appear in release? i've seen on connect - https://connect.microsoft.com/visualstudio/feedback/details/106011/allow-adding-assembly-references-on-a-per-configuration-basis-debug-release - it's marked "postponed" there's request on visual studio's uservoice marked closed won't fix here: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2062487-allow-assembly-references-to-switch-based-on-confi both cases using msbuild condition , you've once configure csproj , forget this. first: using condition create new project debugonlyhelpers reference debug-specific helpers in project specify condition in csproj file need filter references: ...

android - how to change the color of the list items in list view -

i using listview in activity class. i'm not using xml code listview. unable change color of text item in listview. i changed background color of listview unable change color of list items. got links internet not able figure out. can me code? my activity class looks this: listview listview; // create array of strings, put our listactivity string[] names = new string[] { "india", "malaysia" }; textview tv = new textview(getapplicationcontext()); tv.settext("select country"); tv.settextcolor(012); listview = getlistview(); listview.addheaderview(tv); listview.setcachecolorhint(color.rgb(36, 33, 32)); listview.setbackgroundcolor(color.rgb(225, 243, 253)); this.setlistadapter(new arrayadapter<string>(this,android.r.layout.simple_expandable_list_item_1,names)); } above, tv.settextcolor set heading of list items. , not working asking me pass integer value...

iis 7 - Classic ASP .CopyFile "Permission Denied" error on Windows Server 2008, IIS 7 -

we upgrading our intranet web server windows server 2000, iis 4 environment windows server 2008, iis 7 environment. part of upgrade, i'm modifying classic asp application make work in new environment. one of pages attempts create new word file copying template file (.dot) word file (.doc) in same directory on web server, using command: fs.copyfile docroot & templatefile,docroot & docname, true note - docroot absolute path, not virtual path. the destination folder set have full permissions for: everyone administrators iusr iwam accounts i still following error: microsoft vbscript runtime error '800a0046' permission denied just wondering if had seen this, , if there workaround available. (i attempted set default application user use permissions, didn't work, either...) the problem in windows 2008 /2008 r2 uac service born in vista era. secures in inetpub directory ... workarround try put file in users/public/ directory, mod...