Usually when you try to download Oracle's JDK or Oracle's DB driver jars you need to manually accept a license agreement before you are allowed to download them.
This obviously is not possible to do when trying to get those resources using wget or curl, but you can work around this by adding a cookie to your request saying that you do accept the licence:
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "RESOURCE URL"
Where RESOURCE URL for latest JDK7 for example is: http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
If you do not do this, you'll just download a file saying that you need to accept the licence instead
Pages
▼
14/07/2015
[Java] Gzip deflate and inflate
Here's a simple class to deflate and inflate Gzip files in Java. It uses Apache Commons compress (those methods are also in Apache Commons library) for some utility methods, but they can be replaced with pure Java versions.
As you can see, all usual checks have been omitted but I'm sure you'll check for file existence, etc.. beforehand
import org.apache.commons.compress.utils.IOUtils;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public static class GZ{
public static void gzDeflate(String in, String out){
try{
FileInputStream fin = new FileInputStream(in);//file to compress
FileOutputStream fout = new FileOutputStream(out);//output file
GZIPOutputStream gz_out = new GZIPOutputStream(fout);//gzipped file
//creates gzip
IOUtils.copy(fin, gz_out);
/*if you do not want to use Apache libraries, you can read bytes from fin and write them to gz_out in a loop*/
}
catch(Exception e){
//do something
}
finally{
//DO NOT close in any other order!!
IOUtils.closeQuietly(gz_out);
IOUtils.closeQuietly(fout);
IOUtils.closeQuietly(fin);
/*if you do not want to use Apache libraries you can check if object is not null and close it*/
}
}
public static void gzInflate(String in, String out){
try{
FileInputStream fin = new FileInputStream(in);//file to decompress
GZIPInputStream gz_in = new GZIPInputStream(fin);
FileOutputStream fout = new FileOutputStream(out);//output file
//inflates gzip
IOUtils.copy(gz_in, fout);
/*if you do not want to use Apache libraries, you can read bytes from gz_in and write them to fout in a loop*/
}
catch(Exception e){
//do something
}
finally{
//DO NOT close in any other order!!
IOUtils.closeQuietly(fout);
IOUtils.closeQuietly(gz_in);
IOUtils.closeQuietly(fin);
/*if you do not want to use Apache libraries you can check if object is not null and close it*/
}
}
}
As you can see, all usual checks have been omitted but I'm sure you'll check for file existence, etc.. beforehand
10/07/2015
[TIBCO] BusinessWorks 6 Compress Plugin for TAR and GZ
Happy to announce the availability of the 1.2.0.FINAL version of the TIBCO BW6 Compress palette. It supports ZIP, GZ and TAR formats. This is developed in my free time and it's not endorsed, verified or supported by TIBCO in any way (yet?).
It uses Apache Common Compress library 1.9 with no modifications and it's packaged within the plugin.
Online docs are (temporarily) available at: http://digilander.libero.it/otacoconvention/archivi/TIBCO_BW6_Compress_plugin_doc/index.html and can also be accessed from BusinessStudio by selecting the activity and pressing F1 (requires internet connection).
I would urge anyone wanting to try this to take all necessary precautions even though the version number says FINAL
Check GitHub https://github.com/steghio/TIBCO_BW6_Compress_Plugin/
for the source code, sample project, Eclipse (BW6) installer. If you want to manipulate it, READ THE GUIDE first.
History: first release 1.0.0.FINAL
It uses Apache Common Compress library 1.9 with no modifications and it's packaged within the plugin.
Online docs are (temporarily) available at: http://digilander.libero.it/otacoconvention/archivi/TIBCO_BW6_Compress_plugin_doc/index.html and can also be accessed from BusinessStudio by selecting the activity and pressing F1 (requires internet connection).
I would urge anyone wanting to try this to take all necessary precautions even though the version number says FINAL
Check GitHub https://github.com/steghio/TIBCO_BW6_Compress_Plugin/
for the source code, sample project, Eclipse (BW6) installer. If you want to manipulate it, READ THE GUIDE first.
History: first release 1.0.0.FINAL
04/07/2015
[Oracle] Remove tablespace with missing DBF file
Well, nobody's perfect. But if a software is good we can afford not to be flawless.
Say instead of dropping a tablespace the proper way from your Oracle DB, you deleted its DBF file instead; how can you make Oracle forget about this and let you create a new one with the same name and location?
Luckily, you can still salvage the situation by issuing some commands while connected as sys:
SELECT * FROM sys.dba_data_files;
Now find your tablespace and copy the value from the FILE_NAME column, then delete the file association:
ALTER DATABASE DATAFILE 'file_name_we_got_before' OFFLINE DROP;
Finally, drop the tablespace itself:
DROP TABLESPACE your_tablespace INCLUDING CONTENTS;
And you're back in business
Say instead of dropping a tablespace the proper way from your Oracle DB, you deleted its DBF file instead; how can you make Oracle forget about this and let you create a new one with the same name and location?
Luckily, you can still salvage the situation by issuing some commands while connected as sys:
SELECT * FROM sys.dba_data_files;
Now find your tablespace and copy the value from the FILE_NAME column, then delete the file association:
ALTER DATABASE DATAFILE 'file_name_we_got_before' OFFLINE DROP;
Finally, drop the tablespace itself:
DROP TABLESPACE your_tablespace INCLUDING CONTENTS;
And you're back in business