Easy AdSense by Unreal
portella.com.br

portella.com.br

Blog pessoal de Felipe Portella

Como configurar o Notepad++ para editar LaTeX

without comments

Achei o guia definitivo com todas as dicas que precisava nesse site:

johnbruer.com/2013/05/21/latex-editing-using-notepad/

inclui um script que não só compila, mas como faz um link entre a linha que vc está editando e em que ponto o PDF será aberto, facilitando muito a revisão.

Written by Felipe Portella

November 15th, 2013 at 5:48 pm

Posted in Uncategorized

Tagged with ,

How swype works?

without comments

Nice simple Python code to undestand how swype works:

krishnabharadwaj.info/how-swype-works/

 

—-

 

Swype is an awesome software which makes typing in mobile phones using the qwerty keyboard very easy. This is how it looks:

swype

I was just thinking how this could be implemented. It boils down to a string sub-sequence problem. The path traced by the user consists of all the characters in a word. This is an ideal situation, but many a times, we do not take care of all the characters in between and miss many of them.

Some of the characteristics i have considered:

1. Filtering of words based on the first and last character.
2. Characters which are buried among other characters in the path traversed by the user.
3. The number of traversals between different rows of the keyboard gives us a fair idea about the length of the word.

We can use a number of such characteristics and increase the chances of suggesting the right word. One such hint i can think of is:

Split the words in sets of three characters:
Lets take the case of the word "English" here. The actual trace may be like "edfgbnbghjkliugfdsdfgh"

Groups like bnb, bgh, kli, dsd strongly suggest that there is a turn which signifies a character which has a higher probability of being present in the word.

I wrote a basic version of this using python and this wordlist. Some basic introduction to some of the functional programming used here is discussed in this link

WORDS = open('wordlist.txt').read().split()
KEYBRD_LAYOUT = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm']

def match(path, word):
    """ Checks if a word is present in a path or not. """

    try:
        for char in word:
            path = path.split(char, 1)[1]
        return True
    except : return False

def get_keyboard_row( char ):
    """ Returns the row number of the character """

    for row_no, row in enumerate(KEYBRD_LAYOUT):
        if char in row:
            return row_no

def compress(sequence):
    """ Removes redundant sequential characters. ex : 11123311 => 1231 """
    ret_val = [ sequence[0] ]
    for element in sequence:
        if ret_val[-1] != element:
            ret_val.append(element)
    return ret_val

def get_minimum_wordlength(path):
    """ 
    Returns the minimum possible word length from the path.
    Uses the number of transitions from different rows in 
    the keyboard layout to determin the minimum length
    """
    row_numbers = map(get_keyboard_row, path)
    compressed_row_numbers = compress(row_numbers)
    return len(compressed_row_numbers) - 3

def get_suggestion(path):
    """ Returns suggestions for a given path. """

    suggestions = filter(lambda x: x[0] == path[0] and x[-1] == path[-1], WORDS)
    suggestions = filter(lambda x: match(path, x), suggestions)

    min_length = get_minimum_wordlength(path)
    suggestions = filter(lambda x: len(x) > min_length, suggestions)

    return suggestions

if __name__ == '__main__':
    test_cases = ['heqerqllo',                   # hello
        'qwertyuihgfcvbnjk',                     # quick
        'wertyuioiuytrtghjklkjhgfd',             # world
        'dfghjioijhgvcftyuioiuytr',              # doctor
        'aserfcvghjiuytedcftyuytre',             # architecture
        'asdfgrtyuijhvcvghuiklkjuytyuytre',      # agriculture
        'mjuytfdsdftyuiuhgvc',                   # music
        'vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty', # vocabulary 
        ]

    for test in test_cases:
        print get_suggestion(test)

The results for the same were pretty good.

 ['hello', 'hero', 'ho']
 ['quick']
 ['wed', 'weird', 'weld', 'wild', 'wold', 'word', 'world', 'would']
 ['doctor', 'door', 'dour']
 ['architecture']
 ['adjure', 'agriculture', 'article', 'astute']
 ['music', 'mystic']
 ['vocabulary']

The basic version was working within an hour. I must say that the string split method in python is very well thought of. split( delimiter, 1) returns a the string before and after the first match.

Written by Felipe Portella

May 23rd, 2013 at 11:53 am

Showing a vertical rule in Visual Studio

without comments

You can install this add on:

visualstudiogallery.msdn.microsoft.com/0fbf2878-e678-4577-9fdb-9030389b338c

You may find interesting to install this one too. It’s a UI to configure the rules direct in the editor panel:

visualstudiogallery.msdn.microsoft.com/7f2a6727-2993-4c1d-8f58-ae24df14ea91/

Written by Felipe Portella

March 26th, 2013 at 1:35 pm

Posted in Uncategorized

Fix windows offline files with “The process cannot access the file because it is being used by another process” errors

without comments

When encountering this error you can solve by changing the OPLOCKS flags in the Samba config file:

/etc/samba/smb.conf

Add the following lines, at the bottom of the GLOBAL section, just before the ‘include’ line;

oplocks = yes 
level2 oplocks = yes 
kernel oplocks = no

Now reboot or restart samba


 

Written by Felipe Portella

December 3rd, 2012 at 3:55 pm

Posted in Linux,Uncategorized

Hora Legal Brasileira

without comments

O NIC.br e o Observatório nacional oferecem em conjunto, gratuitamente, o NTP.br: o serviço para sincronização com a Hora legal brasileira via Internet. O NTP é muito fácil de instalar e usar. Existem versões disponíveis para todos os sistemas operacionais e equipamentos de rede, como Linux, Windows, OS X, roteadores Cisco e Juniper. Em servidores e computadores, deve-se utilizar o deamon ntpd. Nos roteadorees, o NTP já vem instalado por padrão, bastando configurá-lo.

Para saber com instalar e usar acesse: ntp.br

Written by Felipe Portella

November 29th, 2012 at 1:27 pm

Posição em tempo real de aviões e navios

without comments

É possível acompanhar a posição em tempo real dos aviões em www.flightradar24.com/

Também é possível ver a posição em tempo real de embarcações em www.marinetraffic.com/ais/

Written by Felipe Portella

November 29th, 2012 at 12:08 pm

Posted in Dicas de Sites

Boa ferramenta para cálculos de churrasco

without comments

www.calculoparachurrasco.com.br/

Calcula quantidades de carnes, bebidas etc. levando em consideração se é homem, mulher , criança e a fome …

Written by Felipe Portella

November 20th, 2012 at 4:35 pm

Posted in Uncategorized

Livro gratuito de programação com NCL

without comments

Written by Felipe Portella

May 5th, 2012 at 10:16 am

Posted in Desenvolvimento

Firmware alternativo para o roteador ASUS RT-N56U

without comments

Firmware alternativo  (similar ao DD-WRT, mas desenvolvido especificamente para os roteadores da ASUS, baseado no código fonte do firmware original)

Written by Felipe Portella

February 27th, 2012 at 2:09 am

Posted in Uncategorized

SCRUM

without comments

Video interessante com uma visão geral da metodologia SCRUM em menos de 10 minutos:

Written by Felipe Portella

January 21st, 2012 at 3:41 pm

Posted in Desenvolvimento

Tagged with