Posts

django - How to release log from celery task -

i have celery task calling django management command using call_command , management command uses python logging framework create timedrotatingfilehandler . on windows test station, getting following stack trace seems show celery tasks still holding log file handle open after have completed: traceback (most recent call last): file "c:\python27\lib\logging\handlers.py", line 77, in emit self.dorollover() file "c:\python27\lib\logging\handlers.py", line 350, in dorollover os.rename(self.basefilename, dfn) windowserror: [error 32] process cannot access file because being used process logged file mycommand.py, line xx is known issue , if there method getting around it? (i have tried googling not find relevant).

android - supplicant connection change doesn't trigger -

i want when wifi connection established. have broadcastreceiver works prefectly receiving network_state_changed_action , scan_results_available_action, not supplicant_connection_change_action. 1 harder test: turn off/on router that. protected void oncreate(bundle savedinstancestate) { receiverwifi = new wifireceiver(); intentfilter intentfilter = new intentfilter(); intentfilter.addaction(wifimanager.supplicant_connection_change_action); intentfilter.addaction(wifimanager.network_state_changed_action); intentfilter.addaction(wifimanager.scan_results_available_action); registerreceiver(receiverwifi, intentfilter); //... } class wifireceiver extends broadcastreceiver { public void onreceive(context c, intent intent) { final string action = intent.getaction(); log.d("mhp","*broadcastreceiver: " + action")} and manifiest.xml ...

Add nodes to a fixed backbone when drawing a networkx graph with graphviz, some of the larger nodes are ending up crammed together -

Image
i have created graph using networkx. drawing graph using graphviz, these lines of code: pos = nx.graphviz_layout(g2, prog='neato', args='-goverlap=prism') plt.figure(figsize=(10, 14)) nx.draw(g2, pos, node_size=sizes, alpha=1, nodelist=nodes, node_color=colors, with_labels=true, labels=labeldict, font_size=8) the graph consists of "backbone" of few larger nodes, attached few hundred smaller nodes. i have used args='-goverlap=prism' (in first line of code above) space out graph, has created problem. matters more larger nodes spaced out, but, because of how many small nodes there are, of larger nodes ending crammed together. my thoughts on solution generate graph larger nodes ensure spaced, add smaller nodes graph without changing layout of original nodes. have done research, , seems tricky add new nodes without changing old ones in graphviz. possible "pin" nodes, unsure of how within networkx. this graph looks like: ...

Best practice MVVM navigation using Master Detail page? -

i want follow mvvm pattern as possible , don't know if doing navigation quite well. note using masterdetail page , want maintain master page, changing detail side when navigate. here way navigate viewmodel . in example, viewmodelone viewmodeltwo : public class viewmodelone : viewmodelbase { private void gotoviewtwo() { var viewtwo = new viewtwo(new viewmodeltwo()); ((masterview)application.current.mainpage).navigatetopage(viewtwo); } } masterview implementation: public class masterview : masterdetailpage { public void navigatetopage(page page) { detail = new navigationpage(page); ispresented = false; } } viewtwo implementation: public partial class viewtwo : pagebase { public menuview(viewmodeltwo vm) : base(vm) { initializecomponent(); } } pagebase implementation: public class pagebase : contentpage { public pagebase(viewmodelbase vmb) { this.bindingcontext ...

android - Tabhost/spec vs. viewpage vs tabbed actionbar ..which one? -

Image
i have been familiar tabhost/tabspec create application tabs. noticed there more 1 option create tabs: 1- tabs in action bar 2- viewpager (i guess google calls horizontal pager) 3- , offcourse tabhost/tabspec approach. i tried read google docs everywhere got further confused. when use or there 1 norm? thanks you should use toolbar viewpager simulate tabs (all wrapped in appbarlayout). result this: you can read more type of design on material design spec: https://www.google.com/design/spec/components/tabs.html#tabs-usage also, here tutorial on how implement tabs within viewpager: http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/

java - Unable to expand a ExpandableListView in Android -

[edit]- changing question framing: how use android expandablelistview inside scrollview? i implementing expandablelistview in android. whenever click on arrow expand i.e calling setongroupexpandlistener. list expands inside group itself. want below it. attaching code . drawable_list_group.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="8dp" android:background="@color/grey_transparent"> <textview android:id="@+id/lbllistheader" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="?android:attr/expandablelistpreferreditempaddingleft" android:textsize=...

php - htaccess mod_rewrite rules combination issue -

Image
i'm newbie in apache, it's basic question couldn't solve using questions or links. tried change url using .htaccess , had 2 purposes; hide .php extension change querystring somefile.php?id=bar somefile/id/bar bar number or mixed string t51-3 . querystring http://localhost/payment/theme/ticket?id=770314 want change http://localhost/payment/theme/ticket/id/770314 or http://localhost/payment/theme/ticket/770314 i found code: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r,l,nc] ## internally redirect /dir/foo /dir/foo.php rewritecond %{request_filename}.php -f [nc] rewriterule ^ %{request_uri}.php [l] in stackoverflow.com/this_question this working nice didn't solve second issue. so, searched while in site , others , did find sample codes 1 : rewriterule ^([a-za-z0-9_-]+)-([0-9...