loading

How do I properly load a BufferedImage in java?

时光毁灭记忆、已成空白 提交于 2019-11-29 02:49:09
Okay, so I've been trying to load a BufferedImage using this code: URL url = this.getClass().getResource("test.png"); BufferedImage img = (BufferedImage) Toolkit.getDefaultToolkit().getImage(url); This gives me a type cast error when I run it though, so how do I properly load a BufferedImage? Use ImageIO.read() instead: BufferedImage img = ImageIO.read(url); BufferedImage img = null; try { img = ImageIO.read(new File("D:\\work\\files\\logo.jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } 来源: https://stackoverflow.com/questions/601274/how-do-i-properly

Should I copy all my JavaScript sources into one single file?

六月ゝ 毕业季﹏ 提交于 2019-11-29 02:09:05
In a current web project, I'm using several jQuery plugins and initializing them just before the closing body tag. My question is, from a loading time/performance standpoint, would it be best for me to take all such initializations and copy them into a single, externalized js file? the plugins are being initialized in the same way within all pages in the site, so it would seem loading one, centralized file would be best, no? thanks for any feedback. It all depends on what you are developing for, but here are some rules of thumb. HTTP requests mean overhead (especially over HTTPS) so try to

Java loading and unloading .java files dynamically, garbage collection?

Deadly 提交于 2019-11-28 23:04:41
问题 I am in the process of creating a java application that will be running for long periods of time which requires updated functionality without shutting down. I've decided to provide this updated functionality by loading it in the form of .java files (pulled as a byte array from a database) which are compiled in memory and instantiated. If you have a better way I am all ears. The problem I have run in to is that memory footprint increases slightly with each cycle of loading these "scripts" when

Advice on handling large data volumes

时光怂恿深爱的人放手 提交于 2019-11-28 19:55:46
So I have a "large" number of "very large" ASCII files of numerical data (gigabytes altogether), and my program will need to process the entirety of it sequentially at least once. Any advice on storing/loading the data? I've thought of converting the files to binary to make them smaller and for faster loading. Should I load everything into memory all at once? If not, is opening what's a good way of loading the data partially? What are some Java-relevant efficiency tips? Stu Thompson So then what if the processing requires jumping around in the data for multiple files and multiple buffers? Is

C# WinForm - loading screen

↘锁芯ラ 提交于 2019-11-28 18:02:36
I would like to ask how to make a loading screen (just a picture or something) that appears while the program is being loaded, and disappears when the program has finished loading. in fancier versions, I have seen the process bar (%) displayed. how can you have that, and how do you calculate the % to show on it? I know there is a Form_Load() event, but I do not see a Form_Loaded() event, or the % as a property / attribute anywhere. JSJ all you need to create one form as splash screen and show it before you main start showing the landing page and close this splash once the landing page loaded.

Running sites on “localhost” is extremely slow

别等时光非礼了梦想. 提交于 2019-11-28 17:11:30
Having real trouble using my localhost to test sites. It runs extremely slowly! Sometimes it takes up to a minute to load a page. I'm using Firefox and the sites I'm testing run fine on other developers in my office's local machines / on the production server. I've gone through the normal things :- Disabled IPv6 Not running in debug mode Put the site in the highest app pool (High Isolated) on IIS 6. Taking of firewalls etc. The problem only seems to occur when hitting pages which contain some form of .net code in the code-behind. Appreciate that this a little bit of a vague topic / stab in the

Show spinning wheel dialog while loading data on Android

故事扮演 提交于 2019-11-28 16:59:37
I want to show a spinning wheel dialog while my app loads some data: The spinning wheel dialog should show on a button click. I’m using the code below but it does now show the spinning wheel. What could be the problem? public void CheckAccount(String username, String password) { try { final ProgressDialog progDailog = ProgressDialog.show(this, "Progress_bar or give anything you want", "Give message like ....please wait....", true); new Thread() { public void run() { try { // sleep the thread, whatever time you want. sleep(1000); } catch (Exception e) { } progDailog.dismiss(); } }.start(); /

Reload configurations without restarting Emacs

倾然丶 夕夏残阳落幕 提交于 2019-11-28 15:24:41
How do I load the edited .emacs file without restarting Emacs? M-x eval-buffer I usually use M-x load-file. But be aware that some initialization is only done the first time through. Things like libraries that set their defaults when loaded, but don't get reloaded the second time through. Its always a good idea to start up emacs from scratch as a final check that everything works ok. Open the .emacs file, select its contents and hit C-x,C-e M-x load-file and then choose the .emacs file should also work M-x load-file ENTER ~/.emacs ENTER ( source ) tkf In the *scratch* buffer, type: (load-file

AssemblyResolve event is not firing during compilation of a dynamic assembly for an aspx page

末鹿安然 提交于 2019-11-28 14:04:16
This one is really pissing me off. Here goes: My goal is to load assemblies at run-time that contain embedded aspx,ascx etc. What I would also like is to not lock the assembly file on disk so I can update it at run-time without having to restart the application (I know this will leave the previous version(s) loaded). To that end I have written a virtual path provider that does the trick. I have subscribed to the CurrentDomain.AssemblyResolve event so as to redirect the framework to my assemblies. The problem is that the when the framework tries to compile the dynamic assembly for the aspx page

How to add a spinner icon to button when it's in the Loading state?

与世无争的帅哥 提交于 2019-11-28 13:17:42
问题 Twitter Bootstrap's buttons have a nice Loading... state available. The thing is that it just shows a message like Loading... passed through the data-loading-text attribute like this: <button type="button" class="btn btn-primary start" id="btnStartUploads" data-loading-text="@Localization.Uploading"> <i class="icon-upload icon-large"></i> <span>@Localization.StartUpload</span> </button> Looking at Font Awesome, you see that there's now an animated spinner icon. I tried to integrate that