Posts

Showing posts from April, 2010

python - extract info from a string -

the following code working, not able extract information need. can use soup or need regular expression? from bs4 import beautifulsoup import urllib2 mynumber='1234567890' url="http://www.nccptrai.gov.in/nccpregistry/savesearchsub.misc?phoneno="+mynumber page=urllib2.urlopen(url) soup = beautifulsoup(page.read()) table = soup.findall("table")[1] myl=[item.text.strip() item in table.find_all('td')] import re re.findall(r'is:\s*[^,]*' , myl[1]) the expected output 4 parameters mentioned in first string of first slice. ['2014-08-07 15:50:00', 'andhra pradesh', 'unitech', '0'] (note date changed y-m-d) the string returned looks this... [u'is:\n 31-10-2009 01:11\n\n\nservice area : \n mumbai\n\n\nservice provider :\n idea\n\n\n\n\n\nyour preference :0'] i'd rely on the number registered in ncpr header (it in td tag class gridheader ) , next rows via find_next_siblings() :

Python line.split only acts on one line -

i have list of highscores (saved in text file score, space, name (no commas)). however, when go retrieve data, appears first line read. for line in previous_scores: data = line.split() current_data = data[0] if int(current_data) > highscore: highscore = current_data highscore_names = [data[1]] elif int(current_data) == highscore: highscore_names.append(data[1]) for example, data below: 2 james 3 anna 5 emily it return highscore james, score being 2. if code wrong please tell me wrong, , if awesome fix it. don't mind if there better way this. edit: file opened with: previous_scores = open("scores.txt", "a+") edit 2: added lines on end, , updated code testing following: for line in previous_scores: data = line.split() current_data = data[0] print "1 " + data[0] print "2 " + current_data if int(current_data) > highscore: print "3 " + current_data highscor

Execute multiple PHP scripts from 1 PHP script in Browser -

the situation this. have created multiple php files name operation.php , hosted in domains. this: example.com/operation.php example123.com/operation.php example1234.com/operation.php okay want code 1 single php script mother of these operation.php scripts. if execute motherexample.com/operaterun.php browser these php scripts run 1 one. is possible? result in server outage? not want run these @ once, maybe take gap of 10seconds between each script execution. need help! update i'm not sure whether guys getting or not here's example.. let's have 100 sites each having maintenance.php located @ example001.com/maintenance.php not possible load , run each of 100 maintenance.php in browser 1 one. why want 1 single mother-maintenance.php when run browser execute each of maintenance.php 1 one or maybe time gap! if user doing it, recommend ajax. otherwise can try code that. <?php $somearg = escapeshellarg('blah'); exec("php file2.php $some

hadoop - Interface InputFormat vs Class InputFormat -

i newbie hadoop, trying learn , came across 2 versions of inputformat . org/apache/hadoop/mapred/inputformat org/apache/hadoop/mapreduce/inputformat the explanation of both apis seems same 1 interface , other class. can please me why there 2 apis same explanation in hadoop? mapreduce has undergone complete overhaul in hadoop-0.23 , called mapreduce 2.0 (mrv2) or yarn. org/apache/hadoop/ mapred /inputformat refers hadoop mrv1 org/apache/hadoop/ mapreduce /inputformat refers hadoop mrv2 both these libraries refer same functionality. mrv2 rewrite of mrv1 compatibility of yarn architecture.

How to combine both javascripts to include ajax call for a server time instead of user time? -

i struggling how combine , make ajax call check server time upon loading javascript time server time , not client time ? need call time.php because page (where javascript located) doesn't use php , static, need @ way .. appreciate really! ajax function call script time(): $.fn.jclock.getserveroffset = function(el) { //want make synchronous call server server time. $.ajax({ url: "time.php", async: false, context: el, success: function(result) { var serverdate = new date(+(result) * 1000); //convert seconds number, , multiple 1000 milliseconds. var clientdate = new date(); $this = $(this.context[0]); $this.serveroffset = clientdate - serverdate; //set offset between server , client. } }); }; and countdown timer function ... must edit first new date() have no idea. please give me clue how may it? javascript countdown timer: <script> var currday = new date(); var d

html - jQuery with complex selector -

i have list of input control in application. want find input control, have written following js code working fine. html <input id="txt1" value="sdgjhsgd" type="text" /> <div class="tab active"> <input id="txt2" value="gf5" type="text" /> <input id="txt3" value="4r" type="text" /> <input id="txt4" value="345" type="text" /> </div> <div class="tab"> <input id="txt21" value="dfg" type="text" /> <input id="txt31" value="56" type="text" /> <input id="txt41" value="67" type="text" /> </div> <div class="tab"> <input id="txt22" value="df" type="text" /> <input id="txt32" value="32" type=&qu

google play - Android app compatibility issues with Nexus 6 -

for supporting nexus 6 screen size , density, have following in manifest: <compatible-screens> <screen android:screensize="normal" android:screendensity="560" /> <screen android:screensize="large" android:screendensity="560" /> <screen android:screensize="xlarge" android:screendensity="560" /> </compatible-screens> the complete list of values in manifest listed below. google play says app incompatible. not sure missing here.. <compatible-screens> <screen android:screensize="normal" android:screendensity="xhdpi" /> <screen android:screensize="normal" android:screendensity="480" /> <screen android:screensize="normal" android:screendensity="560" /> <screen android:screensize="normal" android:scre

ios - Setting Track ID -

i having trouble setting track id when set input parameters audiomix. how set trackid? have tried way params.trackid(track2.trackid) gives me error cmpersistanttrackid -> $t4 not identical cmpersistanttrackid . trying translate line [audioinputparams settrackid:[track trackid]]; https://developer.apple.com/library/ios/qa/qa1716/_index.html error when run code below: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nsarraym trackid]: unrecognized selector sent instance 0x7f98c34cbfc0' code: let type = avmediatypeaudio let asset1 = avurlasset(url: beatlocationurl, options: nil) let arr2 = asset1.trackswithmediatype(type) let track2 = arr2.last avassettrack let asset = avurlasset(url: vocalurl, options:nil) let arr3 = asset.trackswithmediatype(type) let track3 = arr3.last avassettrack var trackparams = nsmutablearray() let params = avmutableaudio

c++ - How can i find out the difference between two thrift structs? -

i have 2 thrift struct of same type. struct nestedobject { 1: string name 2: i64 version } struct object { 1: string name 2: i64 version 3: nestedobject object; 4: xyz ..; 5: cbde ..; // , tons of fields } i have object , object b , want find fields differ between 2 objects , b? wouldn't want write simple comparison function check a.name == b.name && a.object.name == b.object.name list can grow indefinitely.

Add more words to a text file in C++ -

i'm creating program writes user inputted words text file has other words begin with. this: "words.txt" apples oranges bananas what wanna add other words list , output words on screen. wrote program won't input user specified word. int main(){ ifstream fin("wordlist.txt"); if (fin.fail()){ cerr << "error opening file" << endl; system("pause"); exit(1); } vector<string> wordlist; string word; string out_word; cout << "please enter word: "; cin >> out_word; fin >> out_word; //trying input user specified word //this inputs words while (!fin.eof()){ fin >> word; wordlist.push_back(word); } //this outputs words on screen (int = 0; < wordlist.size(); i++){ cout << wordlist[i] << endl; } fin.close(); system("pause"); return 0; }

android - get request token google+ oauth 2.0 -

i trying login android app via google+. code oauthservice authservice = new servicebuilder().provider(googleapi.class).apikey(google_api_key) .apisecret(google_api_key_secret).scope(google_oauth_web_scope) .callback(oauth_intent_scheme + "://" + oauth_google_intent_host).build(); authservice.getrequesttoken(); but receive next error org.scribe.exceptions.oauthexception: response body incorrect. can't extract token , secret this: 'consumer not registered: where can correct api key , api key secret? when click create new client id -> installed-> android developer console give me client id. can secret key

delphi - How to set stack (non initial) commit size of main thread -

the question not minimal stack size (initial commited size). found how in vs http://msdn.microsoft.com/en-us/library/8cxs58a6.aspx . in delphi 7(in xe possible make easier), can offer after сompiling edit pe header manually own utility. may have solution easier. you can use $minstacksize , $maxstacksize directives control gets written pe file. directives control stack commit , reserve sizes respectively. alternative using 2 separate directives can control both values @ once $m directive. documentation here: http://docwiki.embarcadero.com/radstudio/en/memory_allocation_sizes_(delphi) these settings can controlled in project options. location of these options vary between ide versions found linker options: http://docwiki.embarcadero.com/radstudio/en/linking

eclipse - Import android.bluetooth.BluetoothGatt cannot be resolved -

i use eclipse luna , turns out have bunch of import * cannot resolved errors. import android.bluetooth.bluetoothgatt; import android.bluetooth.bluetoothgattcallback; import android.bluetooth.bluetoothgattcharacteristic; import android.bluetooth.bluetoothgattdescriptor; import android.bluetooth.bluetoothgattservice; import android.bluetooth.bluetoothmanager; i cleaned project, remove , import have same error. bluetoothgatt , other bluetooth gatt profile apis added in api level 18 . so in project properties -> android - > project build target , select target greater 18. or edit project.properties like target=android-20

windows - Renaming files in one format to the other -

i have batch of files named in following format str1_xxxxxxxxxx_str2.txt i remove xxxxxxxxxx part. that rename str1_str2.txt update : to make simple, consider str1 random string random length dont know. may include character "_". str2 string know. xxxxxxxxxxxx random string fixed length, part want remove. test.bat @echo off set file=str1_xxxxxxxxxx_str2.txt set file2=%file:*_=% /f "delims=_" %%a in ("%file%") set file1=%%a set file1=%file1%_%file2:*_=% ren %file% %file1% try this. place batch file have text file. updated now try this @echo off setlocal enabledelayedexpansion set file=str1_2_xxxxxxxxxx_str2.txt call :reverse %file% file1 /f "delims=_" %%a in ("%file1%") set file2=%%a set file1=%file1:*_=% set file1=%file1:*_=% call :reverse %file1% file3 call :reverse %file2% file4 set file1=%file3%_%file4% set file1=%file1: =% ren %file% %file1% goto :eof :reverse set str=%~1 set cnt=0 :lo

performance testing - How jmeter execute threads? -

i have set per following : ** - users : 20 ramp-up period : 30 loop count :1 ** what means thread group 1-2 , 1-3 ... how jmeter consider 20 user execute request? when jmeter script runs , can see following in log viewer : 2014/11/27 03:45:59 info - jmeter.threads.jmeterthread: thread started: thread group 1-2 2014/11/27 03:46:00 info - jmeter.threads.jmeterthread: thread started: thread group 1-3 2014/11/27 03:46:02 info - jmeter.threads.jmeterthread: thread started: thread group 1-4 2014/11/27 03:46:03 info - jmeter.threads.jmeterthread: thread started: thread group 1-5 2014/11/27 03:46:05 info - jmeter.threads.jmeterthread: thread started: thread group 1-6 2014/11/27 03:46:06 info - jmeter.threads.jmeterthread: thread started: thread group 1-7 2014/11/27 03:46:08 info - jmeter.threads.jmeterthread: thread started: thread group 1-8 2014/11/27 03:46:09 info - jmeter.threads.jmeterthread: thread started: thread group 1-9 2014/11/27 03:46:11 info - jmete

jquery - Cordova: $.Ajax function is ignored -

i'm working on app works great legacy hybrid build in intel xdk. i'm trying build in cordova 3.5 intel xdk ajax functions ignored. no error, no success... this strange because works great in emulator on actual device functions ignored. this pretty logic use: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" /> <link rel="stylesheet" href="mobile/1.4.4/jquery.mobile-1.4.4.min.css" /> <script type="text/javascript" charset="utf-8" src="js/jquery-2.1.1.min.js"></script> <script type="text/javascript" charset="utf-8" src="mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script> <script src='cordova.js'></script> <script src="intelxdk.js"></script> <script src="xhr.js"></script> an

javascript - Jquery Dependent Dropdown to load on document ready -

hello have depdent dropdown country sate , city , want load states , cities based on country on document ready function tried put document.ready (function()) but nothing works please update me how can use my code here function showstate(sel) { var country_id = sel.options[sel.selectedindex].value; $("#output1").html( "" ); $("#output2").html( "" ); if (country_id.length > 0 ) { $.ajax({ type: "post", url: "fetch_state.php", data: "country_id="+country_id, cache: false, beforesend: function () { $('#output1').html('<img src="images/loading.gif">'); }, success: function(html) { $("#output1").html( html ); } }); } } function showcity(sel) { var state_id = sel.options[sel.selectedindex].value

java.lang.UnsupportedClassVersionError: Bad version number in .class file error while calling web service -

i getting following error while using web service. 500 internal server error java.lang.unsupportedclassversionerror: bad version number in .class file @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:620) @ java.security.secureclassloader.defineclass(secureclassloader.java:124) @ com.evermind[oracle application server containers j2ee 10g (10.1.2.3.0)].util.oc4jsecureclassloader.defineclassentry(oc4jsecureclassloader.java:172) @ com.evermind[oracle application server containers j2ee 10g (10.1.2.3.0)].naming.contextclassloader.defineclass(contextclassloader.java:1179) @ com.evermind[oracle application server containers j2ee 10g (10.1.2.3.0)].naming.contextclassloader.defineclass(contextclassloader.java:1065) @ com.evermind[oracle application server containers j2ee 10g (10.1.2.3.0)].naming.contextclassloader.findclass(contextclassloader.java:404) @ java.lang.classloader.loadclass(classloader.ja

ios - UIPageViewController crash without stack log -

trying implement uipageviewcontroller . starting off adding single uiviewcontroller page. app crashes without stack log. i'm not facing exception i've enabled exception breakpoints. similar question asked here . doesn't seem solving problem. this i'm doing: - (void)viewdidload { [super viewdidload]; self.datasource = self; self.delegate = self; // 3 vcs self.view.backgroundcolor = [uicolor clearcolor]; self.matchinfovc = [[matchinfoviewcontroller alloc] initwithnibname:@"matchinfoviewcontroller" bundle:nil]; self.matchinfovc.index = 1; uiviewcontroller *initialviewcontroller = (uiviewcontroller*)[self viewcontrolleratindex:0]; nsarray *viewcontrollers = [nsarray arraywithobject:initialviewcontroller]; [self setviewcontrollers:viewcontrollers direction:uipageviewcontrollernavigationdirectionforward animated:no completion:nil]; } #pragma mark uipageviewcontroller delegates - (uiviewcontroller *)pageviewcont

tomcat - Deploying Spring Boot app to AWS beanstalk -

i trying since yesterday deploy spring boot in tomcat on aws beanstalk , have exception being raised : caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'errorpagefilter': initialization of bean failed; ..... caused by: java.lang.classcastexception: org.springframework.boot.context.web.errorpagefilter cannot cast org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory @ org.coursera.symptomserver.auth.config.oauth2securityconfiguration$1.customize(oauth2securityconfiguration.java:212) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:67) @ org.springframework.boot.context.embedded.embeddedservletcontainercustomizerbeanpostprocessor.postprocessbeforeinitialization(embeddedservletcontainercustomizerbeanpostprocessor.java:54) .

R - merge/combine columns with same name but incomplete data -

i have 2 data frames have columns same names , others different names. data frames this: df1 id hello world hockey soccer 1 1 na na 7 4 2 2 na na 2 5 3 3 10 8 8 23 4 4 4 17 5 12 5 5 na na 3 43 df2 id hello world football baseball 1 1 2 3 43 6 2 2 5 1 24 32 3 3 na na 2 23 4 4 na na 5 15 5 5 9 7 12 23 as can see, in 2 of shared columns ("hello" , "world"), of data in 1 of data frames , rest in other. what trying (1) merge 2 data frames "id", (2) combine data "hello" , "world" columns in both frames 1 "hello" column , 1 "world" column, , (3) have final data frame contain of other columns in 2 original frames ("hockey", "soccer", "football",

android - Using fragment more than one time with new values with backstack maintain -

i making app using sliding menu , tab in bottom...whole app fragment based..i facing problem using fragment a click on button , go fragment b ,in fragment b there button on clicking on button fragment a update new values..and on means switching a->b should occur..but backstack should mantain.. here code backstack : public static void gotofragmentwithbackstack(fragment fragment) { fragment tmp = fm.findfragmentbytag(fragment.getclass().getname()); if (tmp != null && tmp.isvisible()) return; ft = fm.begintransaction(); ft.add(r.id.content_frame, fragment, fragment.getclass().getname()); ft.settransition(fragmenttransaction.transit_fragment_open); ft.addtobackstack(null); ft.commit(); currenttag = fragment.getclass().getname(); } here using method go next fragment. , button mantained activity's backpressed. when use method , again call fragment a(which in container) not called ...and if use gotofragment method call

c++ - Why does linker fail when accessing static member in inline constructor -

just started doing coding simple automated test framework internal use. (i know there hundreds of them out there - ones too, @ moment that's not interesting, don't point me of those, please ;)) came across following problem can't explain, asking help. i have following code part of dll: (the code barely embryo , took me <2 minutes write, it's logic, structure - nothing - refined, in way yet.) h-file: #pragma once #ifdef __dll__ // defined in dll-project #define dllexport __declspec( dllexport ) #else #define dllexport #endif class dllexport autotest { public: enum etestid {testid_somefunction}; autotest(etestid id, lpvoid lpdata) { if(sm_btestsactive) exectest(id, lpdata); } void activatetests(); private: static void exectest(etestid id, lpvoid lpdata) { }

html - Selector where table td: contains null in jquery -

i have table display 'timetable': +------------------------------------------+ key: |name 00:00 00:20 00:40 01:00 01:20 etc xxxxxxx 'itema' |item xxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy yyyyyyy 'itemab' |item yyyyyyyyyyyyyyyyyyy xxxxxxxxxxxx zzzzzzz 'itemabc' |item ------------ zzzzzzzzzzzz xxxxx ------- null/blank which made using: <table> <tr> <th>name</th><th>00:00</th><th>00:20</th><th>00:40</th><th>01:00</th><th>01:20</th><th>etc</th> </tr> <tr id="row1"> <th>item</th> <td colspan="2">itema</td> <td colspan="3">itemab</td> </tr> <tr> <th>item</th> <td colspan="3">itemab</td> <td colspan=&q

r - googleVis: Colors with alpha < 1 -

i trying use colors alpha < 1 in googlevis chart without success. my initial color list applied is: mycolors <- c('#dd4477', '#109618', '#aaaa11) then apply function adjustcolor: myalphacolors <- adjustcolor(mycolors, 0.4) if try use these colors in googlevis chart error: #109618e6 not valid color string how overcome problem , use colors alpha < 1 in googlevis charts? here reproducible example (in particular case don't error message second series colors not plotted properly): library(googlevis) mycolors <- c('#dd4477', '#109618', '#aaaa11') df <- data.frame(country=c("us", "gb", "br"), val1=c(10,13,14), val1.style = mycolors, val2=c(23,12,32), val2.style = adjustcolor(mycolors, 0.4)) plot(gviscolumnchart(df, xvar="country", yvar=c(colnames(df)[2], colnames(df)[3], colnames(df)[4], colnames(df)[5]), options=list(legend="none",

AngularJS testing a service with dependencies -

il go strait it. im writing unit tests angular front end application. have far... app.js: var app = angular.module('app', ['dependency1', 'dependency2', 'dependency3']); then create service have: app.factory('myservice', ['servicedependency', function(servicedependency) { ... }); how create/inject myservice tested? when do: beforeeach(module("app")); jasmine screams @ me not finding dependencies, , dont know how mock them. (there more 3, way more. :) ) beforeeach(inject(function(myservice){})); does not work without doing 'module' 1 first. im stuck on 3 days googleing watching videos , cant find need, or cant see it. first time writing help, ask questions if feel missed something, , need more info. ktnxbye edit: custom providers created so: app.config(['customprovider', function(customprovider){ ... }]); any suggestions on how mock this? ktnxbye well, i've 'sol

Using MySQL with Old Password and Doctrine running with Php 5.4 -

i have been trying use doctrine silex framework. using php 5.4. when try use database, getting error: an exception occured in driver: sqlstate[hy000] [2000] mysqlnd cannot connect mysql 4.1+ using old insecure authentication. please use administration tool reset password command set password = password('your_existing_password'). store new, , more secure, hash value in mysql.user. if user used in other scripts executed php 5.2 or earlier might need remove old-passwords flag my.cnf file unfortunately, on shared hosting , not have access mysql database apply set password command , update password. hosting provider not willing upgrade it. i did check threads fix issue - of them ask me run set session , set password queries on mysql database. is there other way can use doctrine older authentication mysql?

java - Without using finally, how can we execute any statement even after exception is thrown? -

without using finally, how can execute compulsory statement after exception thrown ?? furthermore, variables used or method has scope inside try block. question asked me in interview. please suggest answer. try{ //........ statement 1 // ....... statement 2 might throw exception // ....... statement 3 - compulsory statement needs executed if exception thrown. } catch { } this academic - if want statement executed after exception thrown, should use finally. however, could catch exception in try-catch-block, put statement inside catch clause, , rethrow exception. emphasis on could , of course should not. /* * not this! (even if could.) */ try { //........ statement 1 exception e = null; try { // ....... statement 2 might throw exception } catch (exception e2) { e = e2; } // ....... statement 3 - compulsory statement // needs executed if exception throw

Loop through fields in rdlc report -

i have rdlc report in report have field takes values expression (round(((first(fields!occurs.value) / first(fields!totaldistance.value))* 10000),2) but in cases (totaldistance.value) = 0 previous expression returns infinity, need next record in case of field equals 0 , if next field equals 0 , want next one i looked way of getting next record didn't find found (first , last) methods, how can ? instead of using first or last if don't care record long isn't 0 couldn't use aggregate function. ex: (round(((first(fields!occurs.value) / max(fields!totaldistance.value))* 10000),2) you use max, min or avg value. unaware of way within rdlc loop through records asking. another different way load data datatable add column contain calculated value , use code calculate values before being passed report.

App Engine - Remove file change detection from dev_appserver log -

in recent sdk update, seems google has added info level log dev_appserver prints out each , every time file change detected. this, in opinion, clutters log information know don't want printed out on console. info 2014-11-27 09:52:43,876 module.py:391] [default] detected file changes: /users/michael/app/templates/home /users/michael/app/templates/home/index.html is there way remove these lines log? since info level log, can't remove info log_level other info logs come in handy many times... any suggestions? it's issue on app engine issue tracker. vote quicker resolution. https://code.google.com/p/googleappengine/issues/detail?id=11662

c - Fibonacci series sum -

i have following code: #include<stdio.h> void main() { int = -1, b = 1, c = 0, i, n, sum = 0 ; printf("enter limit : ") ; scanf("%d", &n) ; printf("\nthe fibonacci series :") ; for(i = 1 ; <= n ; i++) { c = + b ; printf("%d-", c) ; sum = sum + c ; = b ; b = c ; } printf("\nthe sum of fibonacci series : %d", sum) ; printf("\n"); } now need find term of series makes sum bigger 7 digits, how can that? p.s new c , sorry english. if want first sum of 7 digits, set threshold 1 million, known 1e6 = 10**6 = 1000000 . notice there 7 digits in 1000000 . if want sum have more 7 digits, set threshold ten million. number has 8 digits. the following code trick. note instead of for loop, have while loop keeps iterating while sum less threshold. # include <stdio.h> int main() { int previous, current = 0, next = 1, sum = current, threshold; printf("en

javascript - Loading gif while form.submit() -

i have js on button class="submit" : $( ".submit" ).click(function( event ) { if(some checks){ ... }else{ $("#importform").submit(function(event){ alert("submitted"); }); } }); but form never submited, , alert never pop. if drop function(event){ alert("submitted"); } it's working well. idea? edit : actually want display loading gif while form submited, load() in view : $("body").load(url, function(){ $('#loadinggif').empty(); }); $('#loadinggif').empty().html('<img src="/assets/image/loader.gif" width=31 height=31 alt="loading image" />'); this piece of code: $("#importform").submit(function(event){ alert("submitted"); }); adds event listener element (presumably <form> ), doesn't call it. if .submit not button within

ios - Add TableView scroll gesture to View -

basically have uitableview uiview in each row. problem uiview stealing scrolling gesture uitableview resulting in tableview doesn't scroll. how apply scroll gesture uitableview uiview? assuming didn't already, add customtableviewcell class project , create xib along (add uiview subclass created xib , property of custom cell class). after add code in cellforrowatindexpath nsarray *toplevelobjects; static nsstring *cellidentifier = @"cell"; customtableviewcell *cell = (customtableviewcell *) [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (!cell) { toplevelobjects = [[nsbundle mainbundle] loadnibnamed:@"customtableviewcell" owner:nil options:nil]; (id currentobject in toplevelobjects) { if ([currentobject iskindofclass:[customtableviewcell class]]) cell = (customtableviewcell *) currentobject; } } cell.yourview = ...; hope helps

vb.net - String.replace adding extra characters -

i trying replace words in mails in outlook. here code it dim input string = mail.htmlbody dim pattern string = "qwq[a-z][a-z][0-9][0-9][0-9][0-9][0-9]" dim replacement string dim rgx new regex(pattern) dim match match = regex.match(input, pattern) while (match.success) replacement = "a" + match.value + "a" input = input.replace(match.value, replacement) match = match.nextmatch() end while mail.htmlbody = input for input qwqrt12345 qwqrt1234533 wwqwqrt12345 qwqrt1234534 qwwqwqrt12345 i expect output as aqwqrt12345a aqwqrt12345a33 wwaqwqrt12345a aqwqrt12345a34 qwwaqwqrt12345a but output getting is aaaaaqwqrt12345aaaaa aaaaaqwqrt12345aaaaa33 wwaaaaaqwqrt12345aaaaa aaaaaqwqrt12345aaaaa34 qwwaaaaaqwqrt12345aaaaa what can issue? the description of string.replace states, returns new string in occurrences of specified string

linked list - Alias a new name for a function (C) -

i've been trying implement queue structure in c, using implementation of linked list in c. some functions need queue defined in linked_list.h, , wanted alias new name them; example, alias create_queue() create_list(). since i'm new c programming, looked online way this, , ran topic of function pointers. seemed right way wanted, yet when tried it: #include "linked_list.h" typedef list_t queue_t; // list_t list type defined in linked_list.h, // functions such create_list() queue_t (*create_queue)() = null; // setting function pointer null create_queue = &create_list; // aliasing create_queue() create_list() when try compile, error , warning: error: redefinition of 'create_queue' different type: 'int' vs 'queue_t (*)()' warning: type specifier missing, defaults 'int' what missing in code? don't want full solution problem, redirection right way. this create_list(): list_t create_l

javascript - How to decode manually JPEG Lossless, Non-Hierarchical, First-Order Prediction -

i'm trying create dicom viewer on own, using javascript , html5. i'm working on project last few days , parse textual information need , can correctly read , display uncompressed grayscale , rgb images. i'm trying display called "jpeg lossless, nonhierarchical, first- order prediction" type of image (in dicom file, enumarated transfer syntax unique identification: 1.2.840.10008.1.2.4.70) i'm stuck. want read pixel data of image manually , build image out of it. there no actual information on how bits stored in dicom documentation , tried find description of kind of jpeg on internet no success. can give me advice on have read solve problem. thank :) check document, leads right direction jpeg lossless codec there more links may help: dclunie jpeg sources

ios - remove view from super view from otherclass -

hi having 3 view controllers. a,b,c firstly adding b under c under b.in c view controller when c visible after click of button want remove c super view , b super view.for removing c b using following code [self.view removefromsuperview]; i able remove c b on click of button. how can remove b from c viewcontroller class. after clicking of button in c view controller both b, c must remove & should visible. thanks in advance. uiview has property superview can call. [self.view.superview removefromsuperview]; be sure read documentation: uiview . edit: bear in mind view c subview of view b, code remove both c , b a.

android - Open URI / Webbrowser in Main Activity -

i´ve tried open uri www.example.com/[scancontent] within activity: intent browserintent = new intent(intent.action_view, uri.parse("http://www.example.com/" + scancontent)); startactivity(browserintent); unfortunately, got error: "uri cannot resolved" regardless of error, method open browser externally. how can open uri within activity ? thank you do this string url = "http://www.example.com"; intent = new intent(intent.action_view); i.setdata(uri.parse(url)); startactivity(i);

javascript - Why is the Angular digest loop different on UI events, $timeout and $http? -

i have been working on lib angular, using 1.2.27, , surprise looking @ result: $scope.myclickmethod = function () { $scope.$$phase; // $apply $scope.$apply(); // gives digest error, of course }; $timeout(function () { $scope.$$phase; // null $scope.$apply(); // not give digest error }); $http.get('/').then(function () { $scope.$$phase; // $digest $scope.$apply(); // gives digest error }); the problem can not identify digest loop ready run when using $timeout, $http etc. ng-clicks etc. questions is... why different? thought angular did in both cases: $scope.myclickmethod = function angularwrapper () { $rootscope.$apply(function myoriginalmethod () { // code }); }; $timeout(function angularwrapper () { $rootscope.$apply(function myoriginaltimoutfunction () { // code }); }); why $$phase = $apply on ui-events, $$phase = $digest on $http , $$phase = null on $timeout? async in nature, not make sense behave differently. sure there reason thou

html - How to style OL number points in CSS -

Image
this question has answer here: how can customize numbers in ordered list? 16 answers i'm trying pretty order list items , i'm wondering how can achieve following effect, , if it's possible in pure css: is possible change number-points , style them in css, , if so, how? yes, possible combination of :before pseudo element , css counter-increment . the html: <ol> <li>lorem</li> <li>lorem</li> </ol> and css: ol { counter-reset: li; } li { position: relative; list-style-type: none; } /* style before element how want, important bits here content element , counter-increment */ li:before { width: 1.75em; height: 1.75em; position: absolute; left: 0; margin-right: 12px; content: counter(li); counter-increment: li; }

c++ - How to start gst-launch on a custom xy position -

i'm developing c++ application on embedded-linux , need display video camera in it. i've used gstreamer create window , start video capture (because has hardware support on tegra) command: system("gst-launch -e v4l2src device=\"/dev/video0\" \ ! \"video/x-raw-yuv,width=320,height=240\" \ ! videoflip method=counterclockwise \ ! nvvidconv \ ! nvxvimagesink &") the main application on device running fullscreen, need position window on specific location on screen, user has feeling runs in same "window". i've managed with: xmovewindow(display, win_video, x, y); // x, y top left point in landscape mode! the problem i'm facing gst-launch first displayed on 0, 0 coordinates (since run command line) , "snaps" on correct location (programmatically) in application. running xquerytree search displayed windows , find 1 gst-launch , move it. takes time , doesn

c - Means to allocate contiguous physical memory -

i aware c malloc , posix_memaligh 1 can allocate contiguous memory virtual address space of process. however, wondering whether somehow 1 can allocate buffer of physically contiguous memory? investigating side channel attacks exploit l2 cache want sure can access right cache lines.. your best , easiest take @ continuous memory request single "huge" page system. availability of depends on cpu , kernel options (on x86_64 2mb huge pages available , cpus can 1gb pages; other architectures can more flexible this). check out hugepagesize field in /proc/meminfo size of huge pages on setup. those can accessed in 2 ways: by means of map_hugetlb flag passed mmap() . way can sure "huge" virtual page corresponds continuous physical memory range. unfortunately, whether kernel can supply "huge" page depends on many factors (current layout of memory utilization, kernel options, etc - see hugepages kernel boot parameter). by means of mapping file de

python - get current connection in flask socket.io -

i want make multiple emitting individual socket connection using flask's socket.io extension. from flask.ext.socketio import socketio, emit, join_room, leave_room # creating flask app , io... @io.on("/saysomething") def saying(): emit("said", "hello") saying2() def saying2(): # ... # doing long , important # ... emit("said", "and how you?") i not know connection saying2 emitting to. should pass current connection saying2 method? how can achieve goal? in example, saying2() emitting client sent /saysomething event. based on concept similar request contexts in standard flask. the emit function has 2 optional arguments send other clients: broadcast=true send connected clients, including client sent /saysomething event. room=<room-name> send clients attached given room. if want address individual clients, put each client in different room , target desired room.

javascript - Reactjs passing methods as props to child -

is there way pass methods of current class child class props as example; var signupmodal = react.createclass({ mixins: [checkmixin], getinitialstate: function(){ return { 'wizardstate': 0 } }, setwizardstate: function(state){ var = this; switch (state){ case 0: that.setstate({'wizardstate': 0}); break; case 1: that.setstate({'wizardstate': 1}); break; case 2: that.setstate({'wizardstate': 2}); break; case 3: that.setstate({'wizardstate': 3}); break; case 4: that.setstate({'wizardstate': 4}); break; } }, render: function(){ var temp; switch (this.state.wizardstate){ case 0: temp = (<signupsetup setwizardstate={this.setwizardstate}/>); break; case 1: temp = (<emailsetup />);

Show only differences between two rows in mysql -

having (mysql) audit table containing rows similar, possible view columns have different values? for example, table containing 4 columns column key primary key, , column id identifier match rows: key id col1 col2 1 123 b c 2 123 c 3 456 b c 4 789 b 5 789 b b 6 987 c in example above need query return row 1, 2, 4, , 5 have matching id, , differing values in col1 , col2, ie b,a , b,a. key id col1 col2 1 123 b 2 123 4 789 5 789 b i know might not efficient solution, gives want. here try this: select a.id, (case a.col1 when b.col1 null else b.col1 end), (case a.col2 when b.col2 null else b.col2 end) tblname full outer join tblname b on a.id=b.id (a.col1=b.col1 , a.col2<>b.col2) or (a.col2<>b.col2 , a.col1=b.col1) inner join should give same result

c - Creating a make file -

i know there infinite amount of resources on internet regards makefiles, still not understand it. @ moment have 3 c files polycalculatormain.c polycalculator.c polycalculator.h , polyfunctions.c so far have polycalculator: polycalculator.o polycalculatormain.c gcc -wall -ggdb -o polycalculator polycalculatormain.c polycalculator.o polycalculator.o: polycalculator.c gcc -wall -ggdb -c polycalculator.c polycalculator.h clean: rm polycalculator *.o *~ *# any or explanation on go complete file appreciated. note im beginning dont want complex code not understand it in compile command don't specify .h files. included preprocessor (which runs before compiler) encounters #include statements. thing can see. the .h files show in makefiles dependencies since changes them can require code uses them need recompiled. i basic rule include on dependency line cause recompile necessary if changed. polycalculator: polycalculator.o polyfunctions.o polycalcula

vba - run time error 2465 -

i getting error in ms access 2003, run time error 2465: microsoft can't find field '|' referred in expression. count = dcount("*", "prepayment_pricing_change", ([insert_date] - int([insert_date])) = ([now()] - int([now()]))) db.execute "insert tbl_audit ([filepath],[filename],[action],[trans_date],[button],[number_of_records])" _ & " values ( '" & strfname & "', '" & file & "' , ""'import_of_nts_rate_pcd_file'"" ,now() ,""'import nts rates file'"",'" & count & "');" i think forgot " in dcount condition: count = dcount("*", "prepayment_pricing_change", "([insert_date] - int([insert_date])) = ([now()] - int([now()]))") also try escape variables: db.execute "insert tbl_audit ([filepath],[filename],[action],[trans_date],[button],[nu

On click of Activate button I need to call customized workflow in CQ5? -

on click of activate button need call other customized workflow, need modifications, files involved in in cq5 version 6. intercepting activate button click quite intrusive therefore should done on filter level. can write example osgi component class: @component(immediate = true) @service @properties({ @property(name = "filter.scope", value = "request") }) public class mycustomreplicationfilter implements filter { public void dofilter(servletrequest request, servletresponse response, filterchain chain) { slinghttpservletrequest slingrequest = (slinghttpservletrequest) request; if ("/bin/replicate.json".equals(slingrequest.getpathinfo())) { list<string> paths = lists.newarraylist(request.getparametervalues("path")); //do magic paths. e.g. invoke workflow } } alternatively can change ootb siteadmin panel ( /siteadmin ) , change behaviour of activate button send request

c++ - Why no "variant" any in boost or Standard? -

one advantage of any on variant is, 1 not need specify types, may contain. i've noticed, number of types variant may contain grows, people tend switch any @ point, because don't keep track of types anymore. think hybrid between any , variant possible. 1 store " placeholder " (via placement new ) of any in aligned_storage , size calculated in constexpr function or template metafunction, sample of largest types, may end being stored. user, on other hand, not need specify types, any might contain. any throw @ time, if user try store larger aligned_storage in there. does such " variant_any " class exist? there inherent problem idea? here basic some . the t copy/assign/move/etc can implemented in terms of emplace . sfinae using can_store<t> can ensure types some can store assignable it, avoiding needless exceptions. currently, moving some destroys contents instead of moving it. , some can empty (they "nulllable"

Java reflection - non case sensitive Class.forName() in a package -

the same question has answers fields , methods , both suggesting iterate on existing members , lower-case comparing names. classes different in can't [easily] iterate on classes in package. my java application instantiates objects according given input 3rd party - non-case-sensitive - application, , fails when case wrong. since java won't allow classes same name , different case in 1 package, guess there should simple way class object without having exact case. i want avoid multiple if / else if since add classes package time. try ing case possibilities out of question (since o(2^n)). so, how should go it? solution: as suggested in @ireeder's answer (thanks @assylias), ignored standard java conventions , name classes lowercase. way can call class.forname lower case version of input.

ios - Store Kit crashes on 2nd request -

i building first store kit app , have crash issue: the app sprite kit game in mainmenuscene.swift allocate removeadbutton when tapped call initpurchaseremoveads() function mainmenuscene.swift e = skpaymentqueue.defaultqueue() func initpurchaseremoveads() { let actionrotate = skaction.rotatebyangle(cgfloat(m_2_pi), duration: 0.1) let spin = skaction.repeatactionforever(actionrotate) self.loadingwheel.runaction(spin) self.loadingwheel.hidden = false nsnotificationcenter.defaultcenter().postnotificationname(keyvaluekeyclassification.notificationbuyremovead.rawvalue, object: nil, userinfo: nil) } gameviewcontroller.swift var request : skproductsrequest? var queue : skpaymentqueue. = skpaymentqueue.defaultqueue() // called through notification (works!) func initpurchase(notification: nsnotification) { println("user clicked remove ads") if skpaymentqueue.canmakepayments() { println("user can ma