Posts

How to properly structure a python cron script for single instance execution -

this related another question here . i want create series of cron scripts, cron scripts can have 1 instance each. need implement lock files each script. decided create abstract cron class create lockfile on __init__ , destroy on __del__ . approach has proven incorrect getting unpredictable results __del__ method. it has been requested open new question asking how implement this. best approach here? 1 cron script check email, checks database, , forth. my reasoning behind using cron don't trust myself build monolithic daemon 1 script. can't afford have entire daemon breakdown if 1 unrelated part stops working. perhaps unwarranted fear proper implementation?

c++ - Parse url_encoded_fmt_stream_map -

i'm trying parse url_encoded_fmt_stream_map in c++, because i'm creating youtube downloader have hard time understand how parse it. basically want this: url_encoded_fmt_stream_map=url%3dhttps%253a%252f%252fr3---sn-oxu8pnpvo-ua8s.googlevideo.com%252fvideoplayback%253fkey%253dyt6%2526ip%253d217.132.162.185%2526pl%253d21%2526itag%253d22%2526dur%253d179.629%2526mv%253dm%2526source%253dyoutube%2526ms%253dau%2526mt%253d1505157185%2526mn%253dsn-oxu8pnpvo-ua8s%2526sparams%253ddur%25252cei%25252cid%25252cinitcwndbps%25252cip%25252cipbits%25252citag%25252clmt%25252cmime%25252cmm%25252cmn%25252cms%25252cmv%25252cpl%25252cratebypass%25252crequiressl%25252csource%25252cexpire%2526expire%253d1505178857%2526id%253do-adsbso6vmuxg9rlrwkzvyp_kttq8sji4uuzyqzui3c-k%2526beids%253d%25255b9466593%25255d%2526mime%253dvideo%25252fmp4%2526lmt%253d1502272667670502%2526signature%253d969232dfe8d6f9c52bf60808a8e5520603abc565.791784bf0dfb1e074e9c5f02c312d7918afbb31e%2526mm%253d31%2526ratebypass%253dy...

jquery - opening multiple divs with javascript -

i'm trying open div on right side, , change animation div on same time, works when use same div id, gives me problems css positions. when press 1 intro animation disappears , animation div loads data_1.json appears. http://bolink.eu/demo/ current js code : <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $('a').click(function () { var divtitle= this.title; $("#"+divtitle).show("slow").siblings().hide(1000); }); }); </script> <script> $(function() { $("#slideshow > div:gt(0)").hide(); setinterval(function() { $('#slideshow > div:first') .fadeout(1000) .next() .fadein(1000) .end() .appendto('#slideshow'); }, 3000); }); ...

java - HttpResponseCache not caching urls without Content-Length header -

using stock android examples httpurlconnection , httpresponsecache, have created bare bones app calls 2 urls, twice. first 1 without content-length , second 1 content-length . i can see in charles endpoint without content-length not cached. removed content-length caching url , confirmed prevents caching well. unfortunately there no way have gzipping , content-length in restify according gzip plugin docs . is there way force httpresponsecache cache url when content-length missing? logic behind not caching urls without content-length? (ios caches without content-length) *using volly or restify last resort due large existing codebase. ended moving retrofit had no issues caching without content-length header.

python - What is the most efficient & pythonic way to recode a pandas column? -

i'd 'anonymize' or 'recode' column in pandas dataframe. what's efficient way so? wrote following, seems there's built-in function or better way. dataset = dataset.sample(frac=1).reset_index(drop=false) # reorders dataframe randomly (helps anonymization, since order have meaning) # make dictionary of old , new values value_replacer = 1 values_dict = {} unique_val in dataset[var].unique(): values_dict[unique_val] = value_replacer value_replacer += 1 # replace old values new k, v in values_dict.items(): dataset[var].replace(to_replace=k, value=v, inplace=true) iiuc want factorize values: dataset[var] = pd.factorize(dataset[var])[0] + 1 demo: in [2]: df out[2]: col 0 aaa 1 aaa 2 bbb 3 ccc 4 ddd 5 bbb in [3]: df['col'] = pd.factorize(df['col'])[0] + 1 in [4]: df out[4]: col 0 1 1 1 2 2 3 3 4 4 5 2

Android: vector asset distortion -

i created vector asset in android studio can see correctly once launch app gets distorted. original vector asset distorted in app <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="45dp" android:height="79dp" android:viewportwidth="45.9" android:viewportheight="79.2"> <path android:fillcolor="#ff000000" android:pathdata="m22.9,1.5c42.1,1.6 41.7,3 41.7,3s1.2,-1.1 -0.7,-1.9s28.7,0 22.9,0s6.7,0.4 4.8,1.1s4.1,3 4.1,3s3.7,1.6 22.9,1.5"/> <path android:fillcolor="#ff000000" android:pathdata="m22.9,3c19.2,0.1 18.5,1.4 18.5,1.4s41,4.9 42.1,7c1.1,2.2 3.4,6.7 3.4,6.7s-7.6,-1 -22.6,-0.9c-15.2,-0.1 -15,-0.1 -22.6,0.9c0,0 2.4,-4.5 3.4,-6.7c0.2,-0.4 1.6,-1.7 0.7,-2.6c4.4,4.4 3.7,3.1 22.9,3"/> <path android:fillcolor="#ff000000" android:pathdata="m22.9,71.4c22,0 22.9,-1.7 22.9,-1.7l0.1,-54.4c0,0 -...

flask - Using Zappa as a conda user -

i trying create api , looking use flask/aws lambda so. best can tell, zappa looks best (only?) deployment option. the problem use conda manage environments , zappa not have version can work in conda. requires virtualenv. my questions are: how other conda users deploying flask/aws lambda apps? can run both virtualenv , conda on same machine? risks/challenges?