Installing the “Wonderful” Package Control in Sublime Text 3 Editor when behind a proxy server

1) Open Sublime Text 3
2) Press CTRL + ` to bring up Console
3) Type the below Python script to install Package Control (script available at – https://packagecontrol.io/installation)

import urllib.request,os,hashlib;
h = ‘df21e130d211cfc94d9b0905775a7c0f’ + ‘1e3d39e33b79698005270310898eea76’;
pf = ‘Package Control.sublime-package’;
ipp = sublime.installed_packages_path();
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler({“http”:”http://YOUR_PROXY_IP_HERE:8080″})) );
by = urllib.request.urlopen( ‘http://packagecontrol.io/’ + pf.replace(‘ ‘, ‘%20’)).read();
dh = hashlib.sha256(by).hexdigest();
print(‘Error validating download (got %s instead of %s), please try manual install’ % (dh, h)) if dh != h else open(os.path.join( ipp, pf), ‘wb’ ).write(by)

NOTE: Changes below in the above text for handling Package Control install from behind a proxy.

urllib.request.ProxyHandler({“http”:”http://YOUR_PROXY_IP_HERE:8080″})

Enjoy your Package control !!

SublimePackageControl

Advertisements

Java | Dynamically read a file from AppServer Path. when file is outside WAR or EAR.

This post illustrates a way to read any file (say a properties file, XML File, XSLT File,  or image file ) as an InputStream object when the file needs to exist outside of an Application Context. Say you have an application accessible via a URL http://localhost:8080/MyApp, whose context is /MyApp.

Typically, there will be a WAR file responsible for this context /MyApp (say MyApp.war). Now if you want to access a file which is outside this context, In Glassfish app server there is a docroot folder where your domain is. This docroot folder serves as alternate root for documents.

  • Just create a folder, say, “data” under the docroot folder of your Glassfish domain.
  • Place your properties, image, or XML file there, say, myFile.xml.

In your web application, this will be accessible as URL

http://localhost:8080/data/myFile.xml    (you can check this direct “GET” URL in browser when web app is running)

You can read this URL as inputstream with the following code snippet:

String baseStaticFilePath = “”;
StringBuffer requestUrl = request.getRequestURL();
String requestUri = request.getRequestURI();
String ctxPath = request.getContextPath();
String baseAppUrl = requestUrl.substring(0, requestUrl.length() – requestUri.length() + ctxPath.length()) + “/”;

// this will give the base Application URL as  http://localhost:8080/MyApp/

Now all we need to do is to subsitute the MyApp with the “data” folder .

baseStaticFilePath = baseAppUrl.replaceAll(“MyApp“,”data“);

String outlierFileName = baseStaticFilePath + “myFile.xml”;

InputStream inputStream = new StreamSource(new URL(outlierFileName).openStream());

And we have the myFile.xml as InputStream object from within the web application.
The added benefit of obtaining this file as InputStream object is that any subsequent changes to this file are dynamically picked up (on the fly) on next call which would not be same as reading a file using getResourceAsStream() which is more of static in nature and may require AppServer restart.

Python | Windows | Running PIP in PyCharm console with Proxy configuration.

We can configure PIP to use a proxy as shown in the screenshot when using it from within JetBrains PyCharm CE or Ultimate Edition. We need to set an environment variable:

SET HTTPS_PROXY=your.proxy.server:yourProxyServerPort and pip is ready to download and install packages !

capturepipproxy

Great Infographic | Healthcare

http://www.datasciencecentral.com/profiles/blogs/smart-spenders-in-healthcare-great-infographic

Clonezilla Spin : External Hard disk to USB drive

2016-05-03 21.08.37

Taking Clonezilla for a new spin by Cloning an external hard drive  containing Ubuntu Linux 14.04 LTS to a USB drive.

The Ubuntu 14.04 LTS on external hard drive is NOT a fresh one but has all software and customizations in it.

In a nutshell, image will sum it.

[Edit] Cloning was successful and I am now running the cloned Ubuntu 14.04 LTS from external USB Drive !

 

 

Super Cool Numix Circle Theme for Ubuntu 14.04 LTS and 16.04 LTS

This article at ItsFOSS details step-by-step instructions on how to install the Super Cool Numix icon theme on Ubuntu 14.04 LTS and 16.04 Xenial Xerus LTS.

http://itsfoss.com/install-numix-ubuntu/

Commands wise:

  • sudo add-apt-repository ppa:numix/ppa
  •  sudo apt-get update
  •  sudo apt-get install numix-gtk-theme numix-icon-theme-circle
    If you want to install Numix wallpapers, use the command below:
  •  sudo apt-get install numix-wallpaper-*
    If you do not already have the Unity Tweak Tool from Software Center, then install it as below:
  •  sudo apt-get install unity-tweak-tool
    If using GNOME, then install Gnome Tweak Tool as shown below:
  •  sudo apt-get install gnome-tweak-tool

Apply the theme by selecting in the GNOME Tweak Tool and Voila !

Kazam_screenshot_00002

 

Installing Open JDK 1.8 on Ubuntu 14.04 LTS

OpenJDK Java 8 has been made into official Ubuntu repositories for 14.10 Utopic and higher. For Ubuntu 14.04, Ubuntu 12.04, and Linux Mint 17 users here’s how to install it from PPA.

  • sudo add-apt-repository ppa:openjdk-r/ppa
  • sudo apt-get update
  • sudo apt-get install openjdk-8-jdk

    You may have more than one version (like Open JDK 1.7 installed previously), so run this command below to set the default Java

  • sudo update-alternatives --config java

    And set default Java Compiler by running:

    sudo update-alternatives --config javac

Finally, check the java and javac version by running the commands below:

  • java -version  ,  javac -version