Display a loading bar before the entire page is loaded

Use a div #overlay with your loading info / .gif that will cover all your page: <div id=”overlay”> <img src=”loading.gif” alt=”Loading” /> Loading… </div> jQuery: $(window).load(function(){ // PAGE IS FULLY LOADED // FADE OUT YOUR OVERLAYING DIV $(‘#overlay’).fadeOut(); }); Here’s an example with a Loading bar: jsBin demo ;(function(){ function id(v){ return document.getElementById(v); } function … Read more

Dot dotdot dotdotdot as loading?

<span id=”wait”>.</span> <script> var dots = window.setInterval( function() { var wait = document.getElementById(“wait”); if ( wait.innerHTML.length > 3 ) wait.innerHTML = “”; else wait.innerHTML += “.”; }, 100); </script> Or you can get fancy and have them go forward and back: <span id=”wait”>.</span> <script> window.dotsGoingUp = true; var dots = window.setInterval( function() { var wait … Read more

Java: Which of multiple resources on classpath JVM takes?

It is specified by the order in which the resources (i.e. usually jar files) are specified using -classpath option. Resources ‘earlier’ on the classpath take precedence over resources that are specified after them. This can be also set in the manifest file of your application and then you don’t need to provide -classpath option. You … Read more

JavaScript Loading Screen while page loads

You can wait until the body is ready: function onReady(callback) { var intervalId = window.setInterval(function() { if (document.getElementsByTagName(‘body’)[0] !== undefined) { window.clearInterval(intervalId); callback.call(this); } }, 1000); } function setVisible(selector, visible) { document.querySelector(selector).style.display = visible ? ‘block’ : ‘none’; } onReady(function() { setVisible(‘.page’, true); setVisible(‘#loading’, false); }); body { background: #FFF url(“https://i.imgur.com/KheAuef.png”) top left repeat-x; font-family: … Read more

How to detect when a image is loaded, that is provided via props, and change state in React?

There are several ways to do this, but the simplest is to display the final image hidden, and then flip it to visible once it loads. JSBin Demo class Foo extends React.Component { constructor(){ super(); this.state = {loaded: false}; } render(){ return ( <div> {this.state.loaded ? null : <div style={{ background: ‘red’, height: ‘400px’, width: … Read more

How should I load files into my Java application?

The short answer Use one of these two methods: Class.getResource(String) Class.getResourceAsStream(String) For example: InputStream inputStream = YourClass.class.getResourceAsStream(“image.jpg”); — The long answer Typically, one would not want to load files using absolute paths. For example, don’t do this if you can help it: File file = new File(“C:\\Users\\Joe\\image.jpg”); This technique is not recommended for at least … Read more

WPF loading spinner

A very simple “plug and play” spinner could be one of the spinning icons from the Font Awesome Wpf Package (Spinning icons). The usage is quite simple, just install the nuget package: PM> Install-Package FontAwesome.WPF Then add the reference to the namespace xmlns:fa=”http://schemas.fontawesome.io/icons/” and use the ImageAwesome control. Set the Spin=”True” property and select one … Read more

open resource with relative path in Java

I had problems with using the getClass().getResource(“filename.txt”) method. Upon reading the Java docs instructions, if your resource is not in the same package as the class you are trying to access the resource from, then you have to give it relative path starting with “https://stackoverflow.com/”. The recommended strategy is to put your resource files under … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)