Django – show loading message during long processing

After trying the two different approaches suggested by Brandon and Murat, Brandon’s suggestion proved the most successful. Create a wrapper template that includes the javascript from http://djangosnippets.org/snippets/679/. The javascript has been modified: (i) to work without a form (ii) to hide the progress bar / display results when a ‘done’ flag is returned (iii) with … Read more

Dynamically loading css file using javascript with callback without jQuery

Unfortunately there is no onload support for stylesheets in most modern browsers. There is a solution I found with a little Googling. Cited from: http://thudjs.tumblr.com/post/637855087/stylesheet-onload-or-lack-thereof The basics The most basic implementation of this can be done in a measely 30 lines of — framework independent — JavaScript code: function loadStyleSheet( path, fn, scope ) { … Read more

Java – Loading dlls by a relative path and hide them inside a jar

I don’t believe you can load the DLL directly from the JAR. You have to take the intermediary step of copying the DLL out of the JAR. The following code should do it: public static void loadJarDll(String name) throws IOException { InputStream in = MyClass.class.getResourceAsStream(name); byte[] buffer = new byte[1024]; int read = -1; File … Read more

How and when should I load the model from database for JSF dataTable

Do it in bean’s @PostConstruct method. @ManagedBean @RequestScoped public class Bean { private List<Item> items; @EJB private ItemService itemService; @PostConstruct public void init() { items = itemService.list(); } public List<Item> getItems() { return items; } } And let the value reference the property (not method!). <h:dataTable value=”#{bean.items}” var=”item”> In the @PostConstruct you have the advantage … Read more

Webview with asynctask on Android

Don’t use AsyncTask, as you are not in charge of loading the webview. If you want to show a progress dialog, here is how to do it. private ProgressDialog dialog = new ProgressDialog(WebActivity.this); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); webView = (WebView) findViewById(R.id.webView1); Bundle extras = getIntent().getExtras(); String url=extras.getString(“adres”); webView.setWebViewClient(new WebViewClient() { @Override … Read more