Wednesday, October 16, 2013

Kate's python plugins really needs some package love!

I have been trying out Kate's Pate or Kate's Python Plugins on various Linux distributions and my finding is this. Most of them don't work right out of the box. Pate used to be an external plugin that you had to install into Kate but now is part of Kate's default plugins.

This is kind of a shame to me as when the plugins, work right, they are really great and of all I have seen has got great potential. The problem here is that none of them work right out of the box. I only managed to install and get one installation right on an OpenSuSE box.

Try to follow along the origin story of pate (if you can!)

The plugins that can be used in KDE 3 can be found here: The latest and greatest, which means that can be used with KDE 4 can be found here:, but then from the looks of it the last change in that repo is quite sometime ago. It says that the project was passed down to kate-editor about 6 months ago.  Well increasing the count of developers from one to twelve is always a good thing. This to me is a positive development for Kate's future.

My advise is either you try the source or stick with your distro's package management. Try not to mix the two unless your day has really been slow and you are desperate for some time tinkering around with package resolutions on your box. The plugins themselves has a feeling of still being under heavy development, which is not evident from the two links above. Rather what I found that was nearer to the true source is here: I think that absorbing the python plugins to be the default set of plugins that comes with Kate is a good move and ensures the future of the plugins, just that we need some good packages to ensure that the plugins themselves are showcased and represented correctly to users. Of the two packages I tried: LinuxMint and Sabayon, both were missing dependencies which I have already reported it. On my trusty Sabayon Pate would not even load because of mismatch of versions of somekind related to sip. 

The allure for me for considering Kate for an IDE is that it already comes with KDE, which I use from time to time so there is no additional bloat to put on top of KDE which is is nice so I hope that they get this right. The list of features to come with Kate that I use daily are:

  1. Linting (pep8, pyflakes and pylint). Here I wished that I got a list of clickable pep violations rather than a pop up window that would disappear with time. A bit clunky but at least it's there without me having to do some extra tinkering. 
  2. Project (svn and git integration but with some manual tinkering. Coult not get this to work though)
  3. A basic Python console. This comes as a "pop up" window. If it was integrated or inline it would have been superb but then having a console itself is great. 
  4. Snippet support and easy creation of snippet.
  5. Some great code editing functionality such as code navigation and their likes.  
  6. Vi-mode keymap.
Another one thing that I felt wanting since I have been too spoilt by PyCharm and Sublime is the all powerful alt-p in Sublime and the ctrl-alt-a in PyCharm. Wished that there was such a thing in Kate. Would have really cut short the time trying to explore around in the GUI which is actually quite a substantial time since it has grown by leaps and bounds. I had a good time looking for some configuration items and hunting around on the UI's menu system really made me hanker for PyCharm's and Sublime's superb all seeing-eye key.

Just as an update, I managed to get the full version working on Mint 15 but I had to use backports. I was happy to get it working so that at least I would be using and judging the plugins itself instead of judging the installation and configuration of the plugins. There are a few things apparent when I was using Kate for my daily editing jobs. One looking for stuff without the all seeing eye is a chore. The other is, the fact that I got to play around with external tools for viewing repository history and checking in is a definite pain and a minus against it. Well, you can look at it two ways. One way is Kate is a really good editor and the other it is really not as accomplished as an "Integrated" Development Environment for Python. It's all really there, just that probably some more thought has got to be put in to redesign some of the screens to change the workflows to be less clunky.


Bug Report Sabayon:
Linux Mint bug report:

Sunday, October 13, 2013

Deployment woes

We are still having deployment woes here where we deploy our applications on to live servers. What really irks me is that these errors are very amateurish and keeps on giving our whole team a bad image. This is a waste as clients keeps on focusing on what is wrong instead of what was done right. This also puts them into a fault finding mode which is not advantageous to adoption of new functionality.

What do I mean by "Silly mistakes" ? When I say this I mean things like major services not enabled after server upgrades / deployment. Some errors I have found are:
  • Mis configured wsgi files usually something to do with paths or virtualenvs
  • Core services that error-ed out usually web servers or cron server. Our application depends largely on scheduled jobs and cron jobs erroring out and not running can prove disastrous.
  • Wrong people seeing the wrong things on the server or just some silly test strings appearing on the live system. 

This kind of errors, it's very hard to recover and cover or explain as it really looks amateurish and as though we don't know what we are doing. Depending on our own people to eye ball the application after upgrade is not workable for simple reason, no one can ever take leave and people tend to make mistakes. The other challenge is of course to find the mid way point between resources that are stretched to the breaking point and putting in some fashion of testing as a stop gap for this kind of silly mistakes. I still feel that asking developers to check on the work that they have been working day in day out everyday for most of the week or month is not really a good idea. I am just constantly surprised how our clients use our application, normally just something I have never considered using it that way.

I saw that we had really good notification checking and we had tests. We had good selenium tests and good nagios scripts. I thought about incorporating our nagios scripts into our deployment script where the deployment script would call the nagios scripts to check our core services. That would also give us a somewhat basic check script for our application that would give us a head start with minimal effort. Our notifications scripts were actually customized scripts written for Nagios. If we were to run them after the upgrade / deployment of our sites it could then warn or tell us if we fudged up and certain services were indeed dead.

On the selenium side, we could abstract some basic tests from our existing scripts to run after an upgrade or deployment is done. These are just a subset of the full test and should just try the basic functionality of the components comprised in the whole application.

Ideally the collection of behavior about a certain upgrade / deployment should come from the project team or the stake holders in the form of BDD scripts. This flies against what I have been told about running my tests on live systems but then having your clients doubt your system as being buggy because you failed to check your application at the most basic level is just not fun and does not foster good faith in your system nor does it help to solidify job security. I am still at the drawing board for this but then it would work something like this. The post installation step would require us to run either a selenium test or any other black box type testing based on collected BDD scripts written based on core or important functionality that should be deployed in a particular version of deployment or installation.

At last and in no way is this a conclusion, we have decided to go the route where we have some pre-flight tests before we release our deployment out into the wild. These pre-flight tests also should contain BDD scripts that are passed down to us by stake holders in the project.  The other thing that I found is, as much as we want convenience security to live servers should be locked down to as few people have administrator rights as possible and as much as it pains to tune ACL for every specific action, it pays in the end when you want to track who did what to screw up another live server deployment. 

Sunday, October 6, 2013

Review of the Xtar XP4 charger

Besides tinkering around with Python and system stuff as evident from the bigger title of this blog, I am also a certified battery charger nut. Just the technology behind battery chargers and the types of them out there totally fascinates me. Recently, I was offered the chance to review one of the new battery chargers from Xtar called the XP4. Why is this battery charger special ? Well to fully appreciate how this charger is special firstly you got to understand that batteries are made out of different compositions, the two main camps currently used are the Nickle and Lithium camps. Your typical rechargeable AA/AAA you find in the market nowadays are usually of the Nickle camp while your phone and laptops usually uses Lithium batteries.  Each camps' batteries have their own special way they like to be charged and in a lot of ways are different.

Because of this difference, making a charger that can automatically sense the type of battery put into it and charge it just the way it likes to be charge proves to be a challenge not many chargers currently in the market can answer currently. Currently the majority of chargers in the market are what you would call "dumb chargers" as in their time based, where they will charge up until a certain point then switch off. Put in a battery that is 80% full vs 10% and it will still "dumbly" charge it for 5 hours then switch off. Not too efficient or smart.

Before this, there are actually chargers being sold that can charge both of them but these class of chargers are what people call "Hobby Chargers" because they were mainly used to charge battery packs used for RC toys. This also meant that if you were just looking for a charger with battery trays built in to charge 'normal' batteries, you are better off looking somewhere else. How these chargers handled dual chemistry is by having the user choose the type of battery that they are going to charge before hand.

The XP4 is a dual chemistry charger new in the market. It can charge NiCD, NiCd and Lithium batteries. I have tried charging mostly NiMh batteries on it as I do not really own any Lithium batteries (well not yet). So, far from what I can see, the charger works flawlessly. It has four independant channels. What this means is that each channel works by itself like a self contained battery charger and can work individually without being effected by the other channels. Some battery chargers out in the market now have paired channels. That means that batteries must be charged in pairs as the underlying circuitry pairs up the channels.

I was happy and excited to review this charger as personally I am happy that Chinese electronics are finally starting to come out on their own with their own brands rather than just acting as the behind-the-scenes manufacturer for other companies. Xtar or Xtarlight is one of the more reputable companies based in Hong Kong.

This charger will also mark Xtar's first batch of foray (the other charger being XP1) into the NiMh/NiCd scene.  More and more you see these new Chinese companies coming out with their own brand of chargers which have no counterpart on the European which are at the same time affordable. While for now buying and using these chargers for now can be like a walk on the wild side as in the huge mixing bowl there are good as well as not so reputable manufacturers, a few good companies like Xtarlight has emerged that produce good and stable hardware. If the chargers produced by them have good functionality coupled with good safety features, I say all the more power to them! I am impartial to who really produces them, as long as it's a good product, though traditionally Chinese / Asian manufacturers have not really been known to put consumer safety high up in their list as they do not have as stringent as the standards enforced on them compared to their Western counterparts.

On to the review....

My initial views on the charger:

Construction (5/5):


XTar XP4 Panzer

This charger is code named "Panzer" and in my opinion aptly too as the construction feels solid just like a tank. I kept on getting the model of this charger wrong initially because of their significant lineup. My advice ? Just call the frigging thing Xtar Panzer! Nice ring to it and easy to remember.

The charger even comes with it's own verification code to ensure that the charger is genuine. It works albeit just a little too spartan or basic to be truly impressive or memorable.

The springs feel and work well without much hint of needing any lubrication. I based this finding comparing with other chargers with springs which normally need a touch of lubrication to work normally. The case also feels solid and surprisingly does not feel light or 'cheap'. I would say on this end, I am happy that Xtar did not spare when it came to materials to build the charger, even though the cost of them putting everything into the charger did show on the box material. The charger has got a nice solid feel to it. While I would have liked to have a digital display to show charging progress of batteries, for an initial effort from Xtar, this is sufficient. Here is a picture of the charger with the 4 bays in question. These chargers because of the protrusion on the metal contact will work with flat top batteries too. Initially, I was not used to the way the battery fit into the bays but after a few days I found it to be second nature.  I guess the initial issue I had with it was because this is my first unit that uses a spring loaded.

Performance (4/5):

Some confusion I had initially was about the temperature sensor on the charger. On the manual it states that the charger's "operating temperature" for NiMh batteries was about 40 Celcius. I mistaken this for that the device contained some kind of temperature sensor but as pointed out by xtar representative this is not true. One thing I must note here is that the representative from Xtar must be given a point here because of their exemplary service. Every question that I had ranging from when the charger is going to be released right up to if the charger contained any temperature sensors was answered courteously and in a timely manner. Back to the charger, while it did not have a temperature sensor, none of the batteries that I charged on it became anything beyond warm because I suspect that it's heat dissipation is really good. I guess what it really meant by "operating temperature" really means what normal temperature the charger will be operating at when charging NiMh batteries.

I don't really have any of those fancy man toys to measure heat via thermal images  beyond a child thermometer so you have got to take my word without backing proof here. Normally for NiMh battery chargers, currently in the market there are roughly 3 ways to terminate charge on a battery and switch to trickle charge:

  1. dv Change in voltage as in a voltage dip after being fully charged.
  2. dT temperature controlled as in the cases where the battery becomes overly warm. 
  3. Time controlled. This is the so called "dumb charger".
Ideally a NiMh charger should have the ability to do 1 and 2, just in the case if the voltage detection fails, then at least the possibility of the batteries melting in the charger can be avoided. The best case scenario is if a charger can do all three. This charger can do one of them and in most cases do it rather well so I guess it's acceptable, just that the "operating temperature" might be confusing and bring certain people for a loop.

Nearly all of the charging scenario, my findings are all based on the 0.5A charging settings as running on the 0.25A settings, some of the charging could not be terminated and was running indefinitely. After numerous exchanges on the forums namely candlepower forums, I was informed that 0.25A is way too low and most chargers would miss the termination. I take away 0.5 point from the charger here as it allows the user to pick the 0.25A charge setting although it might have problems terminating the charge on that setting, I mean the charger itself should not allow batteries to be charged at that setting if there potentially would be a problem terminating the charge at that setting.

Charging batteries(3/5)

Besides charging batteries of different chemistries namely Lithium and NiMh batteries this charger also come with a few other functions:
  • Discharge / Charge cycle for NiMh
  • Discharge of Lithium via USB to charge mobile devices (only for batteries loaded into Bay 4 of the charger)
** For all of the times I did my evaluation of these functionality I wished that I had a fancy schmancy multimeter to capture all of the data coming from charger. Alas, I don't, I guess next time or if someone sends it to me to be evaluated. 

Here is what I thought of them:

Charging Lithium bats

Since I did not really have any Lithium batteries, in order to be complete I decided to go out there and finally get myself a torchlight. I settled on the PD32 out of recommendation which came with a Lithium battery.

Charging Lithium plus NiMh

Both of the batteries terminated fine and I had no issues here, one improvement I can see here is if in future editions of this charger the basic lcd display in the VP1 can be incorporated somehow into this charger it would be great. 

USB discharge function 

I tried using the USB discharge function to power up my Samsung S3 and it seems to work as advertised, the only issue I seemed to have run into is that the connector of the USB seems a bit loose (it could very well have been my own cable as well, so I won't fault the charger for this) and it disrupted the charging multiple times. Charging is acceptable and not anything memorable. The only  thing that would have liked or I found lacking is that if only the USB function would work also if connected to a AC source then it would be superb. Assuming that the unit will only be used as a powerbank seems to be a mis-step on the construction of the unit.  Also, if this unit was meant to be used as a powerbank it would be nice if batteries of different chemistries could be used instead of just Lithiums. The other thing is that the way that the unit holds the battery should be more secure if you really want to use the USB discharge function to charge up your HP or other mobile devices. Below is shown the USB section of the charger.

Discharge and Charge

The discharge and charge function is another function offered by XP4 which differentiates it from most chargers in the market now. There aren't many at this price range that does that.  The only compliant I have here is that it this cycle takes a long time as it does not allow you to choose the discharge current. The option of the charge current only takes effect during the charging stage.



- The construction of the charger is great and feels solid
- The charging works (at 0.5A) settings with NiMh and Liion batteries that I tried.


- The verification code on the site seems a little too basic to be impressive.
- You cannot choose the discharge current in the discharge-charge or the refresh function.
- USB function only works with Lithium batteries and do not work with NiMh batteries.
- Lacking the LCD display that came with VP1.


- There are no temperature sensor which can do dT based termination
- Charging at 0.25A charging is very spotty. Should not have allowed charging at this setting in my opinion
- You cannot use the USB when the AC is connected to the device.

As I see it now, the charger seems to be a good initial effort of Xtar foraying into the NiMh charging sphere. Where does it fit ? Well I have arguably the most advanced NiMh system out there: NC2500 from SkyRC but where I see Xtar's XP4 shining is the convenience of just having one charger that can do all sorts of charging. If I just want to dump my batteries irrespective of type into it and not want anymore information beyond just when it's charging and when it's done XP4 fits the bill perfectly. Look for this charger if you already know something about your batteries and just want something that charges and works without you having to do a lot of settings before it starts charging. While it is not perfect, I am happy with this initial effort and do hope that they continue to improve on this charger. I am looking forward to see an improved version of this in the future.

Also, I don't think that this review is complete without at least a mention of the great PR that Xtar has. The person that communicated with me about this charger was responsive and promptly answered all of my questions. Although this was my first time getting a review set from them I was very impressed with they way they treated me. This is one thing that the company has right and judging from their FB page, they got the community around them happy too. 

You can probably find a good deal here:

XTAR XP4 Panzer Ni-MH/Li-ion Charger with USB Charging Port for Cell Phone & Car Adaptor