Check spelling on multiple LaTeX files using multiple languages

Consider that you have several directories and sub-directories, e.g., the organization of a thesis document in which each chapter has its own directory and several .tex files. And your goal is to check the spelling on all the .tex files in this tree of directories, recursively. Moreover, you want to check the spelling in different languages, some circumstances require that, such as the abstract of the thesis was written in multiple languages. Here is my approach for that, explained step-by-step:

First, in order to check the spelling, we are going to use aspell. Therefore, we rely on its dictionaries, which are packeged on Debian as aspell-[language], e.g., aspell-fr is the package for French dictionary. Install the packages referent to the dictionaries you want. To check which language dictionaries you have installed do:

aspell dump dicts

Then take note of those you gonna use, we gonna need them later on.

Now, back to our .tex spell check. First, lets get the content of all the .tex files, from here on lets consider you are in the root directory of your document’s tree:

find . -name '*.tex' -exec cat {} \;

Second, to spell check the words from text that resulted from the command above using, at the same time, many languages, for example, English from US and Brazilian Portuguese , we use aspell as following:

aspell --lang=en_US -t list | aspell --lang=pt_BR -t list

the -t indicates that we are going to check LaTeX files, i.e., to discard its directives and the list parameter outputs the words that were not found in the dictionary.

A final touch would be write to a file only unique instances of the misspelled words alphabetically sorted, thus the whole command is:

find . -name '*.tex' -exec cat {} \; | aspell --lang=en_US -t list | aspell --lang=pt_BR -t list | sort -u > typo.txt

Now you can proofread the typo.txt file and see if there are problematic words in there.

Advertisements

Wifi Disconnects and it is Unable to Reconnect, “device not ready” on Debian and Ubuntu

On both Ubuntu and Debian I’ve faced a problem with the Wifi that would get disconnected and would not be able to reconnect. On some circumstances, even brand-new Debian Jessie, Network Manager 0.9.8 would show a “device not ready” message instead of a list of wireless networks.

On both Debian Jessie and Ubuntu 10.04 I’ve solved that by removing and reloading modules, though different modules were targeted.

Ubuntu 10.04 (and it will probably work for newer versions):


sudo rmmod iwlagn
sudo rmmod iwlcore
sudo modprobe iwlcore
sudo modprobe iwlagn

Debian Jessie

rmmod iwlmvm
rmmod iwlwifi
modprobe iwlmvm
modprobe iwlwifi lln_disable=1 swcrypto=1

ADB List of Devices “???????????? no permissions”

Suddenly ADB was not listing my device, and everything I could see with “adb devices” was a bunch of interrogation marks and “no permissions”. It happens while I was coding an Android application with Eclipse.

To solve that go to your “android-sdk-linux” directory, mine is on my home, therefore:

cd ~/android-sdk-linux/platform-tools
./adb devices
List of devices attached
????????????	no permissions # ok, lets fix it

./adb kill-server
sudo ./adb start-server
./adb devices
List of devices attached 
0D3AACA1DDE1001C	device # and here is our device!

That is it.

Twitter Stream Mysterious 401:Unauthorized Status with Oauth and Clock Issue

I’ve been facing the following problem with Twitter Stream while using Python: The REST API was working fine, but the Stream API was returning me 401:Unauthorized.

Both, REST and Stream were working fine when using curl with the command provided by the Oauth tool, but while I was trying to make it work with Python, I was not being successful at all, only receiving the 401-thing. At that point nothing seemed to be strange, the response header was:

Content-Type: text/html
WWW-Authenticate: Basic realm="Firehose"
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1505
Connection: close

After 2 months struggling with that problem, I discovered that Twitter API will return 401 if your clock is not synchronized. To solve this you need to execute ntpdate. On Ubuntu you can execute the following command:

sudo ntpdate ntp.ubuntu.com

and I guess that you will be able to connect with the Twitter Stream again. On the end, I discovered that this happened because I’ve moved to a different country, and I changed only my clock, without changing my Zone Time. I discovered this because the hour on my clock changed to the one from my home country when I used ntpdate. If this is your case, and you are using Ubuntu, change your Zone Time with the following comand:

sudo dpkg-reconfigure tzdata

Well, I learned a bunch of things in a row 🙂

Unknown or ambiguous terminal type; type just ‘set terminal’ for a list

This appeared when I tried to “set terminal pdf” on Gnuplot. Im using Ubuntu 10.04.  Making the long story short, I needed to install the Maverick (10.10) packets for Gnuplot.

The direct links for those packages, depending on the arch, are amd64, gnuplot-nox and gnuplot-x11. For i386, gnuplot-nox and gnuplot-x11. Download, install and the same output should be something like

gnuplot> set terminal pdf
Terminal type set to 'pdfcairo'

and that is it!

Force Google Chrome Close a Hanged Tab

My Chrome 9.0 had two hanged tabs, and those were not being identified by the browser, I mean, informing me that they were problematic. The computer was 2 days on but Chrome was endlessly loading those 2 tabs. In order to force a tab being closed in Chrome read this Google Support’s article. Basically you have to go to the Menu > Tools > Task Manager > Choose tab > Close it.

Deploying With Git Using a Remote Repository

Im deploying Ruby on Rails applications with Git. The code of my personal application was hosted in Beanstalkapp.com because it gives me one free private repo. Following steps can give a basic deployment:

  • On the remote server in which your application is running.
  1. cd /var/www/your_application_directory
  2. git init
  3. git remote add production git@acount.beanstalkapp.com:/repository.git
  4. git pull production master (*)(**)
  • On the local machine in which you are changing your code.
  1. Change/Add some code
  2. git add .
  3. git commit -m “Changing some stuff”
  4. git push beanstalk master
  • On the remote server in which your application is running in order to get the new modifications
  1. git pull production master
  2. stop the server, in my case mongrel 
    mongrel_rails stop
  3. restart the server 
    mongrel_rails start -p PORT_NUMBER -d -e production -P log/mongrel.pid
* If you have the erro

Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly

you have to set a new RSA key for the remote server. To set a new RSA public key in the remote server, you just need to run 

ssh-keygen

, answer some questions, and copy the content of ~/.ssh/id_rsa.pub.

** You have to add your RSA public key to grant the access from the server in which your application is running. On Beanstalk, accessing the https://acount.beanstalkapp.com/public_keys you can dot it.