All in vain

Some rants about technology, PHP, people, tools, web etc from a developers perspective. Feel free to copy ideas, code or anything from here.

Tuesday, November 24, 2015

see the output from unit files created using template

if you are wondering how to see the output of multiple systemd unit files launched via template units then you have come to the right place. On CoreOS i created multiple instances of a service file using template files. Systemd Unit files are of this format:

foo@.service

[Unit]
Description=Preview Application service

After=etcd.service
After=docker.service
After=docker-connect.service

Requires=docker.service

[Service]
TimeoutStartSec=0
EnvironmentFile=/etc/environment
User=core
ExecStartPre=-/usr/bin/docker kill hg-doc-preview-%i
ExecStartPre=-/usr/bin/docker rm hg-doc-preview-%i
ExecStartPre=/usr/bin/docker pull localhost:5000/hg-doc-preview
Restart=always
ExecStart=/usr/bin/docker run --name hg-doc-preview-%i -m 500m \
    -e COREOS_PRIVATE_IPV4=${COREOS_PRIVATE_IPV4} \
    -e "HG_CACHE_BACKEND=MultilevelCache" \
    -e "SERVICE_%i_NAME=hg-doc-preview" \
    -e 'SERVICE_%i_ROUTE=Host("mock-server.test-easywebats.com")' \
    -p ${COREOS_PRIVATE_IPV4}:%i:7090  \
    --add-host backends:${COREOS_PRIVATE_IPV4} \
    localhost:5000/hg-doc-preview
ExecStop=/usr/bin/docker stop hg-doc-preview-%i

[X-Fleet]
Conflicts=hg-doc-preview@%i.service


You can then start instances of this service like so:
fleetctl start foo\@1234.service to launch on external port 1234. Now if you follow this there would be many unit files and you would like to watch the output of all these units.

Just run this command to see the logs for all such units:
fleetctl list-units | grep foo | awk '{ printf " -u %s ", $1 }' | xargs journalctl -f

Thursday, October 09, 2014

running grunt cli shows nothing on ubuntu 14

If you are running ubuntu and you followed some tutorial which lists first step in the installation of nodeJS you might have run

sudo apt-get install node

and when you tried to do your basic hello world this would have failed with the console reporting missing NodejS binary. The reason being on ubuntu NodeJS is called nodejs and there is another legacy program called node. You must run the following commands to ensure GruntJS works fine:

sudo apt-get --purge remove node

ln -s /usr/bin/nodejs /usr/bin/node

grunt -v

Now you should be able to run Grunt without any issue!

Saturday, September 13, 2014

docker fails to run on Ubuntu LTS 14?

If you try to follow the documentation on docker.com and install the latest version you might encounter this error:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

to solve this run:

sudo apt-get install apparmor;sudo docker -d &

Friday, April 13, 2012

IE z-index bug for absolutely positioned elements

I hate IE. Its because of the way it interprets css standards it makes it painful for web developers. If you are facing similar issue that your absolutely positioned elements are hiding behind content below it do not despair, there is help at hand. Head to this blog.


In brief, giving the parent element a higher z-index actual fixes the bug.



Sunday, February 26, 2012

DIY make your normal TV smart



Question: What to do if you want a "Smart" TV and you don't have the money it requires?
Answer: You take any "Dumb" TV that is good enough and make it smart. Continue reading below to know how.








Sunday, December 11, 2011

A new JAVA framework with PHP leanings

Just came across a different kind of framework in JAVA. Usually when we talk about frameworks in JAVA they are always "full stack" with the kitchen sink thrown in for good measures. I am used to developing with PHP frameworks as they are not too complex and also i like the fact that there is no compilation involved. You just refresh the page and you can see the results. This is where PHP excels.

 But what if you want the robustness of JAVA and instant results of PHP? May i suggest Play Framework to you? Not only is it a breeze to get it up and running but also it follows the "shared nothing" approach of PHP which i have always liked for quick web development.

From the Play Framework site:
Play is a real "Share nothing" system. Ready for REST, it is easily scaled by running multiple instances of the same application on several servers.
Also, the fact that it uses "Groovy" as the template language it makes it more appealing for me, cause XSLT is a big PITA and i never "got" JSP. I have to say the designers of this framework got it right. They took the Best of breed programming language(JAVA) and married it to the shared nothing model of the Most popular scripting language(PHP). I will take this framework for a spin soon. Only question running through my mind is, will it scale?

Tuesday, August 30, 2011

HybridAuth PHP authentication library

Came across this new Social sign-in library which goes by the name of HybridAuth. Seems like it is a good tool when you want to let your users sign-in to your website without registering to your site.

Will give a try sometime later. Check it out here!

New CSS framework from Twitter

Recently one of my friends shared this new CSS framework with me. Named Bootstrap, this is a good attempt at creating a CSS framework and also helps accelerate web development.

Will certainly love to include in my next project. So check it out here!