PaaS is happily buzzing in the Cloud and it seems to be hottest topic in the infrastructure services today, so I decided to test Openshift – PaaS offering from Red Hat. Couple of reasons make this platform interesting – firstly it’s open source solution, so we can use it to build your own private solution, secondly on public service we get 3 gears ( linux containers with predefined configuration) for free forever, so it’s easy to experiment with this platform. As a sample project we will create very simple Python Flask web application with MongoDb. Continue reading OpenShift Experiencies
All posts by admin
Beautiful Code History Visualization with Gource
Gource tool offers very nice and appealing visualization of SW project history. Gource works with all major version control systems – git, svn, etc. can be easily installed from Ubuntu repos and is fairly easy to use. Continue reading Beautiful Code History Visualization with Gource
Check UPnP port mapping on you router
Most modern SOHO routers (like my Asus) support UPnP IGDP or NAT-PMP protocols to enable hosts on local network to open and map incomming (from WAN) port on router. While these two are different protocols with different origins, they both serve same purpose, so often they are enabled by a single option in your router configuration ( like in my Asus – there is only one option ‘Enable UPnP’, but in fact it enables both protocols).
This automatic incomming port port management is very convenient, however it can cause some security problems in your local network. Because normaly neither UPnP nor NAT-PMP is authenticated, all local subnet is basically trusted, it means that any program can open incomming port, as it needs (including malware programs). More detailed description about potential UPnP issues is for instance here. Continue reading Check UPnP port mapping on you router
Video Streaming from File Sharing Servers
As I’ve written video files can be streamed via Bit Torrent protocol. Although responsiveness (time to start, time to seek) is notably worst that in specialized solutions, it is still usable for normal user, with a bit of patience.
Video files are also provided by file sharing servers, but in many cases download rate is limited, so it’s not enough to stream video file. However it’s often possible to open several requests for same file, and combine download rate – this method is quite common in download managers. And if we add possibility to stream downloaded content to video player, we can achieve satisfactory results, possibly similar as or better then streaming via Bit Torrent. Continue reading Video Streaming from File Sharing Servers
OpenSubtitles provide easy to use API
When working on btclient, I was interested in possibility of downloading a subtitles for a video file, that is played. This seems to be common option in many player. I’ve found that opensubtitles.org provides XML-RPC remote API, which is very easy to use. With help of python xmlrpclib
module, it’s really a matter of minutes to create a simple working client. Continue reading OpenSubtitles provide easy to use API
Subtle evil of close_fds parameter in subprocess.Popen
In python newly created sub-process inherits file descriptors from parent process and these descriptors are left open – at least this was default till python ver. 3.3. subprocces.Popen
constructor has parameter close_fds
(defaults to False on python ver. 2.7), which can say if to close inherited FDs or not. Leaving them open FDs for child process can lead to many problems as explained here and here. Continue reading Subtle evil of close_fds parameter in subprocess.Popen
Tunneling SSH through Restrictive HTTS Proxy
In one of past articles I’ve described how to use HTTP CONNECT method to tunnel other protocols through a proxy. It worked for me for various protocols ( mainly email access IMAP, SMTP), but recently it stopped working for SSH protocol. After some investigation I’ve found that proxy is checking what protocol it is tunnelling through and expects it to be SSL/TLS. If it is anything else, proxy closes connection with an error. It still worked for mail protocols, because they were already wrapped in SSL. But to be still able to use SSH through proxy some more sophisticated setup was needed – tunnelling SSH through SSL protocol, which is then tunnelled via HTTPS proxy ( HTTP CONNECT method). Below I describe a setup, which works for me. Continue reading Tunneling SSH through Restrictive HTTS Proxy
Opa – Mixed Impressions
Coming little bit late to Opa (looks like real hype was couple years ago), I was still caught by this interesting new language. Opa is a new language – cross-over between JavaScript ( providing JS like syntax) and OCaml (using many functional programming idioms from that language , plus Opa complier is written in OCaml). Opa is used solely to program web applications – so Opa is both language and web framework. Opa compiles to JavaScript, which on client side runs in a browser and on server side in node.js. You write just one Opa code and compiler decided, where the code should run.
I have spent some time looking into Opa recently – mainly trying some of Opa tutorial plus and doing some small experiments myself and I’d like to share my experiences and impressions. Continue reading Opa – Mixed Impressions
Running Oracle VM Template for DB 12c in XenServer
As many may know Oracle VM Server is based on Xen hypervisor so it’s possible to run VMs prepared for Oracle VM on other Xen based solutions like XenServer or OCP. Main difference is management of VMs – Oracle VM is using xm, while recent XenServer is using newer xapi stack. But paravirtualized Linux kernels can run easily on both.
Oracle is providing VM templates with many of it’s key products – like for instance new Oracle 12c database. In this article we will show how to run Oracle 12c Database VM template on XenServer 6.2. Continue reading Running Oracle VM Template for DB 12c in XenServer
Accesing Oracle from Python (with proper unicode support)
It’s not obvious to set it right, so I’m putting some notes here:
Installation is described here.
Few comments:
- ORACLE_HOME is needed just for installation
- If you add client library path to
/etc/ld.so.conf.d/oracle.conf
and updateldconfig
, you don’t need to export modified LD_LIBRARY_PATH - when you install Oracle client library and set environment, you can install cx_oracle also via
pip install cx_Oracle
The crucial step not mentioned in the installation guide is to set NLS_LANG environment variable – this should be in the environment of your python program using cx_oracle. So for instance for Flask+SQLAlchemy you can have:
if app.config.get('SQLALCHEMY_DATABASE_URI').startswith("oracle"): os.environ['NLS_LANG']= 'AMERICAN_AMERICA.AL32UTF8'
Without this variable oracle client is using 7bits ASCII! So any unicode character will raise “UnicodeEncodeError: ‘ascii’ codec can’t encode character” error.