InputStream in = null; OutputStream out = null; try { // Ensure folder is created FileUtils.forceMkdir(new File("/Users/yann/myfolder")); in = new FileInputStream(new File("/Users/yann/from.txt")); out = new FileOutputStream(new File("/Users/yann/myfolder", "to.txt")); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); }
Friday, April 29, 2011
Java -=- How to copy file using Apache IOUtils
Here is a code snippet that explain how to copy a file using IOUtils. You can get Apache IOUtils at http://commons.apache.org/io/download_io.cgi
Wednesday, April 27, 2011
JAD Java Decompiler Download Mirror
Since http://www.kpdus.com/ is not available anymore, JAD is now hard to find.
Here's a mirror containing all the versions of JAD. This article is a copy of Tomas Varaneckas's site (http://www.varaneckas.com/jad).
This will create two files:
No further setup is required.
Here's a mirror containing all the versions of JAD. This article is a copy of Tomas Varaneckas's site (http://www.varaneckas.com/jad).
- Jad 1.5.8g for Windows 9x/NT/2000 on Intel platform (238600 bytes).
- Jad 1.5.8g for Mac OS X 10.4.6 on Intel platform (170707 bytes, compiled by GCC 4.0).
- Jad 1.5.8e for HP-UX 11.x (293214 bytes).
- Jad 1.5.8e for Linux on Intel platform (214917 bytes).
- Jad 1.5.8e for Linux (statically linked) (389972 bytes) - take this version if the one above crashes or displays the "seek error" message.
- Jad 1.5.8d for OS/2 (288717 bytes) - OS/2 version was cross-compiled on Windows using EMX and RSXNT packages, therefore it requires EMX runtime (EMX.DLL should be enough).
- Jad 1.5.8c for FreeBSD 4.0 (322311 bytes) - statically linked.
- Jad 1.5.8c for OpenBSD 2.7 (334499 bytes) - statically linked.
- Jad 1.5.8c for NetBSD 1.5 (324440 bytes) - statically linked.
- Jad 1.5.8c for Solaris 8 on Intel platform (264751 bytes).
- Jad 1.5.8c for Mac OS X (Darwin 1.3) on PowerPC platform (266264 bytes).
- Jad 1.5.7g for Linux on Sun Sparc platform (180606 bytes).
- Jad 1.5.7g for Linux on Sun Sparc platform (346221 bytes) - statically linked.
- Jad 1.5.7f for Solaris 7 on Sun Sparc platform (318096 bytes) - compiled on Sun 4m (Sparc10) using GCC 2.8.1, statically linked. Works on Solaris 2.6 as well.
- Jad 1.5.7f for BeOS 5.0 on Intel platform (245422 bytes) - statically linked.
- Jad 1.5.7b for Mac OS X (Rhapsody 5.3) on PowerPC platform (372317 bytes).
- Jad 1.5.7a for Solaris 7 on Intel platform (252582 bytes) - try the version for Solaris 8 instead.
- Jad 1.5.5.3 for AIX 4.2 on IBM RS/6000 platform (360970 bytes).
Installation
Unzip jad.zip file into any appropriate directory on your hard drive.This will create two files:
- an executable file named 'jad.exe' (Windows 9x/NT/2000) or 'jad' (UNIX)
- README file 'Readme.txt', which contains the short user's manual
No further setup is required.
Disclaimer
JAD is Copyright 1997-2001 Pavel Kouznetsov. All rights reserved. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE IN ON-LINE CONTROL OF AIRCRAFT, AIR TRAFFIC, AIRCRAFT NAVIGATION OR AIRCRAFT COMMUNICATIONS; OR IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE AUTHOR DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OFFITNESS FOR SUCH USES. YOU MUST REPRESENT AND WARRANT THAT YOU WILL NOT USE THE SOFTWARE FOR SUCH PURPOSES
Monday, April 18, 2011
[RSA] Install Cicso AnyConnect on Mac OS X Snow Leopard
Hi!
There is a bug with the version of Cisco AnyConnect 2.3 that made impossible to install the VPN client on Mac OS X Snow Leopard.
To be able to install it, we must download a newer version (2.4 and later).
You can get the client by connecting to the Cisco Web Site (http://www.cisco.com/cisco/software/navigator.html) and download it. You need a username / password.
If you do not have an account on the Cisco's Web Site, you can download a copy of the software here:
at http://unf.net/snowleopard/anyconnect-macosx-i386-2.4.0154-k9-BETA.zip
Download and install the client. After that, connect yourself to the RSA servers. The AnyConnect client will be automatically updated.
You must be ready to use AnyConnect Client with Snow Leopard.
There is a bug with the version of Cisco AnyConnect 2.3 that made impossible to install the VPN client on Mac OS X Snow Leopard.
To be able to install it, we must download a newer version (2.4 and later).
You can get the client by connecting to the Cisco Web Site (http://www.cisco.com/cisco/software/navigator.html) and download it. You need a username / password.
If you do not have an account on the Cisco's Web Site, you can download a copy of the software here:
at http://unf.net/snowleopard/anyconnect-macosx-i386-2.4.0154-k9-BETA.zip
Download and install the client. After that, connect yourself to the RSA servers. The AnyConnect client will be automatically updated.
You must be ready to use AnyConnect Client with Snow Leopard.
Thursday, April 14, 2011
ExtJS -=- Converting a timestamp value to a valid date when loading a FormPanel (DateField)
I've got a problem today. I was trying to load a record that contains a timestamp field that comes from a Rails application (with PostgreSQL DB).
The FormPanel refuse to load the date value in my DateField component. I've discovered that it was because the DateField did not recognize the date because it was a timestamp.
In order to be able to set the date's value, we need to format the timestamp as a date when loading the FormPanel.
Here's how to do this.
Generated JSON used to load the FormPanel
Add this code to your FormPanel
When loading, the value of the date will be converted from a timestamp to a valid date and the DateField will recognize the value.
The FormPanel refuse to load the date value in my DateField component. I've discovered that it was because the DateField did not recognize the date because it was a timestamp.
In order to be able to set the date's value, we need to format the timestamp as a date when loading the FormPanel.
Here's how to do this.
Generated JSON used to load the FormPanel
{ success:true, data: { start_date: \"Tue Apr 12 20:06:11 UTC 2011\", id: 4, app_id: 2, version: \"1.2.3\", message: \"test msg\", active: true } }
Add this code to your FormPanel
form.getForm().on({ actioncomplete: function(form, action) { if (action.type === 'load') { if (action.result.success) { var date = new Date(action.result.data.start_date); form.setValues({ start_date: date.format('Y-m-d') }); } } } });
When loading, the value of the date will be converted from a timestamp to a valid date and the DateField will recognize the value.
ExtJS -=- Wait message while loading a store
Hi!
To display a loading message while a store is loading, simply add this line of code...
If you want a loading mask for a grid panel, simply set GridPanel's property "loadMask" to true
To display a loading message while a store is loading, simply add this line of code...
// Store Definition var objectAStore = new Ext.data.JsonStore({ url: '/objecta/json_dropdown_list', root: 'Records', totalProperty: 'Total', fields:[ { name: 'id' }, { name: 'name' } ] }); // Loading Mask new Ext.LoadMask(Ext.getBody(),{msg:'Loading data...', store: objectAStore});
If you want a loading mask for a grid panel, simply set GridPanel's property "loadMask" to true
Monday, April 11, 2011
Mac OS X -=- Installing Java 1.4 on Snow Leopard
By default, Snow Leopard does not include Java 1.4 anymore. All the Java 1.4 softlinks points to the Java 1.6 library. If you want to install Java 1.4, you must install it manually.
In the terminal:
Get the java 1.4.2 that was included in 10.5 "leopard" and unpack
Move it to your System java folder (password needed)
Tell OS X that java 1.4.2 actually is java 1.4.2
Open Java Preferences
Change the properties to use Java 1.4.2 32-bit by default:
Credits goes to http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard
In the terminal:
Get the java 1.4.2 that was included in 10.5 "leopard" and unpack
cd /tmp/ curl -o java.1.4.2-leopard.tar.gz http://icebergsofts.com/static_content/java.1.4.2-leopard.tar.gz tar -xvzf java.1.4.2-leopard.tar.gz
Move it to your System java folder (password needed)
sudo mv 1.4.2 /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2-leopard
Tell OS X that java 1.4.2 actually is java 1.4.2
cd /System/Library/Frameworks/JavaVM.framework/Versions/ sudo ln -s 1.4.2-leopard 1.4.2 sudo ln -s 1.4.2 1.4
Open Java Preferences
open "/Applications/Utilities/Java Preferences.app"
Change the properties to use Java 1.4.2 32-bit by default:
Credits goes to http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard
Subscribe to:
Posts
(Atom)