Monday, 12 September 2016

How to disable the Caps Lock key on Mac


Caps Lock is the the most unnecessary key on the keyboard for me. I rarely need to write more than couple of words in capitals and to often I accidently hit the key, suddenly finding myself typing IN ALL CAPS
Here’s an easy way to change the behavior of your Mac’s Caps Lock key and even disable it altogether.

  • Click the  icon in the top-left corner of your desktop and select System Preferences
  • Select the Keyboard icon and click the “Modifier Keys” button in the bottom-right corner 
  • From the pull-down menu next to “Caps Lock Key”, select “No Action” 
  • Press “OK”



Monday, 20 June 2016

How you can make someone unfollow you on Twitter

This trick is known as a "soft block", and it comes handy when someone’s annoying you on Twitter and you really do not want to block him. You have a few options for dealing with annoying accounts.
Block, which prevents them seeing your tweets.
Mute, which stops you seeing their tweets and replies to you.
And Soft block which forces them to unfollow you.
If you are active Twitter user you are most likely familiar to Block and Mute. But you might or might not have heard about Soft block. Because It’s not an official feature, soft block is not commonly known.
The procedure is quite simple, all you have to do is promptly block and unblock the user in question.

If the person doesn’t notice you’re not coming up in their feed anymore, you’re good. Else repeat.

--Cheers


Wednesday, 25 May 2016

Restoring applications after minimizing to Mac OS X dock


When you click the yellow pill button in the upper left corner of a window to minimize that window in Mac OS X or if you use ⌘ Cmd + M you might want to bring the application back. When cycling through running applications, including the minimised applications, using ⌘ Cmd + Tab you might expect to retrieve the application back.

This sequence on the other hand will bring wour application window.
1. Use ⌘ Cmd + Tab untill you find your application.
2. Before releasing ⌘ Cmd, press and hold ⌥ Alt

Other method is to hide application using ⌘ Cmd + H, then you can restore your window with ⌘ Cmd + Tab
Thursday, 12 May 2016

Using Python, MySQL and UTF-8

I have been spending way to long time figuring out how I can encode my data to utf8 when fetching records from MySQL database. All the time I was focusing on encoding the output, resulting in error like this one.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 1: 
ordinal not in range(128)
The solution I finally found is to set the character set when I prepare the MySQL connection
con.set_character_set('utf8')
Ending up in my code like this.
!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb as mdb

def getname(p):
    con = mdb.connect('hostname', 'username', ' password', 'databasname')
    con.set_character_set('utf8')
    sql = "SELECT cellname1 from tablename where cellname2='%s'"%(str(p))
    cur = con.cursor()
    cur.execute(sql)
    row = cur.fetchone()
    if not row:
        return 'n/a'
    else:
        return str(row[0])
    cur.close()
Now everything works like a charm.
Tuesday, 15 December 2015

How To Allow Usb To Serial Adapters In Osx “el Capitan


In my line of work I use serial port on some devices frequently and most new computers do not have serialport. In Linux I found out that it’s easy to connect using usb to serial and screen, but now when I’ve got mac it looks like there is no driver for the usb to serial by default.
I bought PL-2303 Driver (€6.17/$7.36) and all my problems are solved. It'a easy and fast installation.
After I connect the USB serial converter I simply type in:
screen /dev/tty.Repleo-PL2303-00001014
-cheers
Monday, 23 November 2015

Windows is blocking random websites


My gf is running Windows and some time after she got Windows 8 some DNS issue occurred and random webpages started to get blocked. After update to Windows 10 this problem was still ongoing. To "fix" this she had to use
ipconfig /flushdns
But that was just a temporary fix because later same day you could need to do this again.
I did multiple web searches and in the end I found this method that seems to fix this issue.

Run CMD as admininstrator.
In the command line type:
netsh winsock reset
Press Enter then restart your PC.

Netsh winsock reset is a helpful command that you can use in Windows to reset the winsock catalog back to default setting or clean state.
In computing, the Windows Sockets API (WSA), later shortened to Winsock, is a technical specification that defines how Windows network software should access network services, especially TCP/IP.



Tuesday, 9 June 2015

Terminal won't launch after upgrade to Ubuntu 15.04

After upgrade to Ubuntu 15.04 there is know bug where you can't get the terminal to open with Ctrl+Alt+T
Apparently the problem has to do with custom locale. You can fix this by changing the locale /etc/default/locale
LANG="en_US.UTF-8
"LANGUAGE="en_US"
Or you can add the LANG=en_US.utf8 to your ~/.bashrc file by adding following line to it
export LANG=en_US.utf8
If you have any improvement to this or a better method, please feel free to share it here in the comments.