Randomness

I am all alone, as I whine
and everything seems fine,
the sun hasn’t lost its shine,
the poems haven’t lost their rhyme,
the music hasn’t lost its chime
the world hasn’t lost its crime
and everyone does look fine.
This is what I always wanted when you were mine…
Why then O dear so I whine ?
I am all alone, no one to bother, No one to answer,
Master of my wishes and time!

I am all alone, as I whine
But if everything does seems fine
Why then O dear do I fright ?
Why is sun no longer bright.
Why is melody no longer in sight
and why does nothing feels right ?

I am all alone, as I whine,
Master of my own time,
but why is the that time stopped ?
Flowers now smell of the rot
and spirit seems wrought
But everything does seem fine.

I am all alone, as I whine,
No soul to talk except mine,
No memories to ponder except thine,

Waiting for the eternal peace,
which I just saw dying…

At.js with froala issue

At.js is a Javascript library for having Github like mentions in an app. The library is here. It’s a very good library and simple to use however when I tried it, it didn’t work out of the box for froala editor. The problem is At.js surrounds the range with spans and since WebKit browsers insert spans, the editor accepts spans only if

data-fr-verified=”true”

is set to true. So to counter this, when initiating the function, a small tweak is required.

$(‘.froala-view’).atwho({
at: “@”,
editableAtwhoQueryAttrs: {“data-fr-verified”: true},

data:[‘Peter’, ‘Tom’, ‘Anne’]
})

This should get it working as it did for me.

 

Reference: Github issue

 

Hope  it helps

Screen shot in Chrome Extension

Hi,
There are many chrome extensions to take a screenshot. But recently, I was working on a project where we had to build an extension and also were taking a screenshot. So apparently, chrome provides an API called ‘capturevisibletab’ (doc) and it works. While coding, I referred to this git repo which works perfectly.
But then, as we tested, we found the image was cropped when using a macbook retina display machine.
It took us a while to understand that this is because the devicepixelratio (window.devicePixelRatio) is 2 in a macbook(with retina) display and 1 in others and hence the issue.
Thus, we had to adjust for scale which we did not account for earlier and we referred to this code for adjusting it.

Will soon post our whole code for completeness but the logic is pretty clear from the above code.

Hope it helps !

Modifying the “PATH” variable in MAC

This is probably the most important thing one can do in a UNIX based system- Modify the PATH variable.

I recently installed Libreoffice on my mac for using its command line tools. It was working fine in the applications folder and showing up on spotlight as well as dock but the command line tool was not working

After some time , I figured that in Linux, I used “libreoffice ….” but in Mac I had to use “soffice…”. soffice command was not directly available to me on terminal and I had to specify the whole path to use it:

/Applications/LibreOffice.app/Contents/MacOS/soffice –help

To use soffice without the whole path, I modified my PATH variable :

nano ~/.bash_profile

(create this file using touch ~/.bash_profile if your system doesn’t have one!!)

Include the lines:

export PATH=”/Applications/LibreOffice.app/Contents/MacOS:$PATH”

Save it and enter the command:

source ~/.bash_profile

And wallah ! The Path variable is modified and we can now use soffice directly in command line.

soffice –help

This way, we can include any application in command line.

Hope it helps.

WiFi issues on Ubuntu 12.04

Hey ,

Recently installed ubuntu 12.04 on a fresh and clean system. While it works like a charm, a very irritating issue was that the inbuilt wireless card was not working. The ethernet connection using wire worked fine. Googled a lot and wasnt able to figure things out. Finally, backports saved my day. Here is the procedure I followed incase someone finds it useful.

 

Installing backports:

sudo apt-get install  linux-backports-modules-cw-3.8-precise-generic 

Some generic headers and libraries:

sudo apt-get install linux-headers-generic build-essential

Download this file and extract it at a location of your choice.
Navigate to the extracted directory using terminal and try:

make defconfig-ath9k
make
sudo make install

Reboot the system and ideally wireless should work!

Hope it helps.

Guake – Annoying feature of renaming tabs

I am a huge fan of guake terminal and after having used it for quite a while, I am literally addicted to it.

Recently, I encountered a very annoying feature which is when I rename a tab and perform any operation on that tab, the name I gave disappears and the absolute path is shown.

This was very painful because I am used to work with multiple tabs open and naming helps navigation.

After some googling, I found a solution which I present below.

Install gconf-editor.

sudo apt-get install gconf-editor

Start gcong-editor

gconf-editor

Browse to apps/general/guake/general.

On the right hand side, uncheck the “use_vte_titles” item and close it and restart guake.

All tabs would be named “Terminal” and renaming would preserve it.

The technical reason for doing this is the following piece of code:

def on_terminal_title_changed(self, vte, box):
    use_them = self.client.get_bool(KEY("/general/use_vte_titles"))
    if not use_them:
        return
    page = self.notebook.page_num(box)
    self.tabs.get_children()[page].set_label(vte.get_window_title())

As we can see ‘use_vte_titles' key prevents the autorenaming feature

Hope this helps and enjoy using guake.

Editing a form in nested_form gem

This is a very very naive and simple thing but I quite lost my time on this so I thought might be helpful.

Recently I was using the ‘nested_form’ gem by the great Ryan Bates (https://github.com/ryanb/nested_form). The form to create a new form works like a real gem without any effort.

Now, when I clicked on ‘edit’ link, it created some issues as the nested models didnt come.

I had a simple thing like each question has many answers. When I created a question, I added 5 answers to it but when I edited the question, no answers were visible.

The simple solution for this would be that the <% f.fields_for :answers do |an| %> line in your form would be without an equal to sign so just add it.

Thus, it looks like

<%= f.fields_for :answers do |an| %>

Thats all and it works like a charm!

Hope it helps.

Fixing Ubuntu GPG BADSIG error

Recently, I faced a error while updating my Ubuntu system.

When I ran “sudo apt-get update”,

it gave me the followinf error message:

 

W: GPG error: http://archive.canonical.com intrepid Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key

 

The way I fixed it was:

 

$ sudo -i

# apt-get clean

# cd /var/lib/apt

# mv lists lists.old

# mkdir -p lists/partial

# apt-get clean

# apt-get update

 

Hope it helps. !!

Western european special characters and how to enter them from your keyboard

HTML Name Code HTML Number Code Glyph MacOS Windows Description
&lsquo; option+] Alt+0145 left single quote
&rsquo; shift+option+] Alt+0146 right single quote
&sbquo; single low-9 quote
&ldquo; option+[ Alt+0147 left double quote
&rdquo; shift+option+[ Alt+0148 right double quote
&bdquo; shift+option+w double low-9 quote
&dagger; option+t Alt+0134 dagger
&Dagger; shift+option+7 Alt+0135 double dagger
option+; horizontal ellipsis
&permil; shift+option+r Alt+0137 per mill sign
&lsaquo; shift+option+3 Alt+0139 single left-pointing angle quote
&rsaquo; shift+option+4 Alt+0155 single right-pointing angle quote
&spades; black spade suit
&clubs; black club suit
&hearts; black heart suit
&diams; black diamond suit
&oline; overline, = spacing overscore
&larr; leftward arrow
&uarr; upward arrow
&rarr; rightward arrow
&darr; downward arrow
&trade; option+2 Alt+0153 trademark sign
&quot; " double quotation mark
&amp; & & ampersand
&lt; < < less-than sign
&gt; > > greater-than sign
[ [ left square bracket
] ] right square bracket
&ndash; option+hyphen Alt+0150 en dash
&mdash; shift+option+hyphen Alt+0151 em dash
&nbsp;   Alt+0160 nonbreaking space
&iexcl; ¡ ¡ option+1 Alt+0161 inverted exclamation
&cent; ¢ ¢ option+4 Alt+0162 cent sign
&pound; £ £ option+3 Alt+0163 pound sterling
&curren; ¤ ¤ Alt+0164 general currency sign
&yen; ¥ ¥ option+y Alt+0165 yen sign
&brvbar; or &brkbar; ¦ ¦ Alt+0166 broken vertical bar
&sect; § § option+6 Alt+0167 section sign
&uml; or &die; ¨ ¨ shift+option+u Alt+0168 umlaut
&copy; © © option+g Alt+0169 copyright
&ordf; ª ª option+9 Alt+0170 feminine ordinal
&laquo; « « option+\ Alt+0171 left angle quote
&not; ¬ ¬ option+l Alt+0172 not sign
&shy; ­ ­ Alt+0173 soft hyphen
&reg; ® ® option+r Alt+0174 registered trademark
&macr; or &hibar; ¯ ¯ Alt+0175 macron accent
&deg; ° ° shift+option+8 Alt+0176 degree sign
&plusmn; ± ± shift+option+= Alt+0177 plus or minus
&sup2; ² ² Alt+0178 superscript two
&sup3; ³ ³ Alt+0179 superscript three
&acute; ´ ´ shift+option+e Alt+0180 acute accent
&micro; µ µ option+m Alt+0181 micro sign
&para; option+7 Alt+0182 paragraph sign
&middot; · · shift+option+9 Alt+0183 middle dot
&cedil; ¸ ¸ shift+option+z Alt+0184 cedilla
&sup1; ¹ ¹ Alt+0185 superscript one
&ordm; º º option+0 Alt+0186 masculine ordinal
&raquo; » » shift+option+\ Alt+0187 right angle quote
&frac14; ¼ ¼ Alt+0188 one-fourth
&frac12; ½ ½ Alt+0189 one-half
&frac34; ¾ ¾ Alt+0190 three-fourths
&iquest; ¿ ¿ shift+option+? Alt+0191 inverted question mark
&Agrave; À À option+` A Alt+0192 uppercase A, grave accent
&Aacute; Á Á option+e A Alt+0193 uppercase A, acute accent
&Acirc; Â Â option+i A Alt+0194 uppercase A, circumflex accent
&Atilde; Ã Ã option+n A Alt+0195 uppercase A, tilde
&Auml; Ä Ä option+u A Alt+0196 uppercase A, umlaut
&Aring; Å Å shift+option+a Alt+0197 uppercase A, ring
&AElig; Æ Æ shift+option+’ Alt+0198 uppercase AE
&Ccedil; Ç Ç shift+option+c Alt+0199 uppercase C, cedilla
&Egrave; È È option+` E Alt+0200 uppercase E, grave accent
&Eacute; É É option+e E Alt+0201 uppercase E, acute accent
&Ecirc; Ê Ê option+i E Alt+0202 uppercase E, circumflex accent
&Euml; Ë Ë option+u E Alt+0203 uppercase E, umlaut
&Igrave; Ì Ì option+` I Alt+0204 uppercase I, grave accent
&Iacute; Í Í option+e I Alt+0205 uppercase I, acute accent
&Icirc; Î Î option+i I Alt+0206 uppercase I, circumflex accent
&Iuml; Ï Ï option+u I Alt+0207 uppercase I, umlaut
&ETH; Ð Ð Alt+0208 uppercase Eth, Icelandic
&Ntilde; Ñ Ñ option+n N Alt+0209 uppercase N, tilde
&Ograve; Ò Ò option+` O Alt+0210 uppercase O, grave accent
&Oacute; Ó Ó option+e O Alt+0211 uppercase O, acute accent
&Ocirc; Ô Ô option+i O Alt+0212 uppercase O, circumflex accent
&Otilde; Õ Õ option+n O Alt+0213 uppercase O, tilde
&Ouml; Ö Ö option+u O Alt+0214 uppercase O, umlaut
&times; × × Alt+0215 multiplication sign
&Oslash; Ø Ø shift+option+o Alt+0216 uppercase O, slash
&Ugrave; Ù Ù option+` U Alt+0217 uppercase U, grave accent
&Uacute; Ú Ú option+e U Alt+0218 uppercase U, acute accent
&Ucirc; Û Û option+i U Alt+0219 uppercase U, circumflex accent
&Uuml; Ü Ü option+u U Alt+0220 uppercase U, umlaut
&Yacute; Ý Ý Alt+0221 uppercase Y, acute accent
&THORN; Þ Þ Alt+0222 uppercase THORN, Icelandic
&szlig; ß ß option+s Alt+0223 lowercase sharps, German
&agrave; à à option+` a Alt+0224 lowercase a, grave accent
&aacute; á á option+e a Alt+0225 lowercase a, acute accent
&acirc; â â option+i a Alt+0226 lowercase a, circumflex accent
&atilde; ã ã option+n a Alt+0227 lowercase a, tilde
&auml; ä ä option+u a Alt+0228 lowercase a, umlaut
&aring; å å option+a Alt+0229 lowercase a, ring
&aelig; æ æ option+’ Alt+0230 lowercase ae
&ccedil; ç ç option+c Alt+0231 lowercase c, cedilla
&egrave; è è option+` e Alt+0232 lowercase e, grave accent
&eacute; é é option+e e Alt+0233 lowercase e, acute accent
&ecirc; ê ê option+i e Alt+0234 lowercase e, circumflex accent
&euml; ë ë option+u e Alt+0235 lowercase e, umlaut
&igrave; ì ì option+` i Alt+0236 lowercase i, grave accent
&iacute; í í option+e i Alt+0237 lowercase i, acute accent
&icirc; î î option+i i Alt+0238 lowercase i, circumflex accent
&iuml; ï ï option+u i Alt+0239 lowercase i, umlaut
&eth; ð ð Alt+0240 lowercase eth, Icelandic
&ntilde; ñ ñ option+n n Alt+0241 lowercase n, tilde
&ograve; ò ò option+` o Alt+0242 lowercase o, grave accent
&oacute; ó ó option+e o Alt+0243 lowercase o, acute accent
&ocirc; ô ô option+i o Alt+0244 lowercase o, circumflex accent
&otilde; õ õ option+n o Alt+0245 lowercase o, tilde
&ouml; ö ö option+u o Alt+0246 lowercase o, umlaut
&divide; ÷ ÷ Alt+0247 division sign
&oslash; ø ø option+o Alt+0248 lowercase o, slash
&ugrave; ù ù option+` u Alt+0249 lowercase u, grave accent
&uacute; ú ú option+e u Alt+0250 lowercase u, acute accent
&ucirc; û û option+i u Alt+0251 lowercase u, circumflex accent
&uuml; ü ü option+u u Alt+0252 lowercase u, umlaut
&yacute; ý ý Alt+0253 lowercase y, acute accent
&thorn; þ þ Alt+0254 lowercase thorn, Icelandic
&yuml; ÿ ÿ option+u y Alt+0255 lowercase y, umlaut