Posts

Match a word that starts and end with "##" (Special character) in C# regex -

match word starts , end ## (special character) in c# regex for example: want match "##id##" "##uuid##" could please me? try this: string s = "lorem ipsum ##text## second [lorem ipsum]. how #are you. it's ok. done. #else now."; foreach (match match in regex.matches(s, @"\##[^[\]]*\##")) { messagebox.show(match.value);//here value. }

python - tf.nn.depthwise_conv2d is too slow. is it normal? -

i trying out recent arxiv work called " factorized cnn ", which argues spatially separated convolution (depth-wise convolution), channel-wise linear projection(1x1conv), can speed convolution operation. this figure conv layer architecture i found out can implement architecture tf.nn.depthwise_conv2d , 1x1 convolution, or tf.nn.separable_conv2d. below implementation: #conv filter depthwise convolution depthwise_filter = tf.get_variable("depth_conv_w", [3,3,64,1], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/9/32))) #conv filter linear channel projection pointwise_filter = tf.get_variable("point_conv_w", [1,1,64,64], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/1/64))) conv_b = tf.get_variable("conv_b", [64], initializer=tf.constant_initializer(0)) #depthwise convolution, multiplier 1 conv_tensor = tf.nn.relu(tf.nn.depthwise_conv2d(tensor, depthwise_filter, [1,1,1,1], padding='same')) #...

ios - Issue in finding time difference -

in app, want know difference between: the total hours worked in week(54.30 hours) and the total hours worked on specific day(10.45 hours) for example, want know value of (54.30 hours - 10.45 hours) in hours. since total hours of week greater 24 hrs, couldn't convert nsdate. use 2 functions,this you the below function return total seconds hour string - (nsnumber *)secondsfortimestring:(nsstring *)string { nsarray *components = [string componentsseparatedbystring:@"."]; nsinteger hours = [[components objectatindex:0] integervalue]; nsinteger minutes = [[components objectatindex:1] integervalue]; //nsinteger seconds = [[components objectatindex:2] integervalue]; return [nsnumber numberwithinteger:(hours * 60 * 60) + (minutes * 60)]; } and below function return formatted time seconds - (nsstring *)timeformatted:(int)totalseconds { //int seconds = totalseconds % 60; int minutes = (totalseconds / 60) % 60; ...

java - ble beacon transmitter app close once it run -

i trying create app transmit beacons android 5.0 devices error {09-07 10:23:45.184 3057-3057/com.example.mohamed_pc.test2 e/androidruntime: fatal exception: main process: com.example.mohamed_pc.test2, pid: 3057 java.lang.runtimeexception: unable start activity componentinfo{com.example.mohamed_pc.test2/com.example.mohamed_pc.test2.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'android.bluetooth.le.bluetoothleadvertiser android.bluetooth.bluetoothadapter.getbluetoothleadvertiser()' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activ...

android - Share user's information with other apps with same signature -

my play store account has on 100 apps published , of them have common user generation process includes otp verification. interesting note apps have same user object same properties particular otp verified number, gets stored in respective sharedpreferences string. for better user experience trim down user generation process if there 1 app installed in device , has done otp verification. want share user object, saved string in each app's sharedpreferences . so here's want when install com.domain.app.cx app: 1) com.domain.app.cx -> (do have verified user?) -> com.domain.app.cy 2.1) com.domain.app.cy -> (yes have, here "user json") -> com.domain.app.cx or 2.2) com.domain.app.cy -> (no don't have user) -> com.domain.app.cx 3) move check if com.domain.app.cz installed , on step 1 options have: 1) have read contentprovider , understood need put in uri of contentprovider package name specific. 2) use package name createpa...

resources - Android: asking to add additional or optional raw files after application downloaded market -

i try add external resources apk. firstly, have ask possible for example, 1 downloaded app google market, when app launches, his/her default language , ask "do want download additional mp3 files?". if he/she presses "ok", app download additional resources , starts. i have because i'm using mp3 files in application. these files expand application size more. besides, application supports lot of different language, can not add mp3 files initially. not useful. additionally, know , use localization (values/ values-fr/ values-es/ values-) strings. string files don't expand application size more, not important, mp3 files(raw file) crucial. are there knows how can realize that? thanx u need server contain data "mp3 files" , if user accept ur request think u must donwload json or ever else. u need request permissions on m android.

c# - Realm async usage in Tasks -

i'm trying better understand how use realm in async scenario. far i'm aware realm instance can access objects on thread created. async transaction need new instance of realm using getinstance("somerealmfile"); . there function called task writeasync(action<realm> action) can execute write transaction on worker (background) thread. here's example scenario. app needs make web request. runs async task function go off web , fetch data. request returns , app wants take data parse in realm object , persist database using realm.manage<t>(t obj) . note entire scenario assumes have created realm database on ui main thread begin with. let's assume want stay on background thread @ point, in context of async task function started web request. so we're in situation have results of web request (data) via var results = await webfetch(); , possibly using taskcompletionsource instead , can realm write transactions on worker thread. assume call asyn...