Wednesday, August 6, 2014

Upgrading to Windows 8.1

On my Dell machine at work, I had no choice to use Windows 8. My plan was to remove Windows and use Ubuntu. And install Windows as a virtual machine. Thanks to Dell, it's not possible...
So I dual boot using grub.

Anyway, because Windows 8 was crashing once a week (especially when the computer was idle), I decided to try Windows 8.1.

The process to upgrade to Windows 8.1 is easy, but you should know that after all files are downloaded, you have 15min max before the computer restart!
Then it takes around 30 - 40min to install everything.

No problem during installation, Windows starts ... and I was not really satisfied...
First thing I noticed is that the language is in Japanese and I can't switch to English... Ok, I will set it to English again, as I did before. Oh surprise! There is no option to download the language pack... Fortunately I could find this thread on the Social Technet forum:
Language Pack not usable message in Windows 8.1

Here is what you should do (in case the link is broken):
Download the new 8.1 MUI:
EN-GB
32Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_43e709fc9932e26431ff87e163daaaeae15677eb.cab
64Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_55c5ff4da1d83ae6f4ebd1f8c020cb80ceda7da8.cab
EN-US
32Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_45b0cfb6b0bfd5984faa3cd64b7b8f2b2a72465e.cab
64Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_8fa033dd9ab61a528192eaa696088d582f112e68.cab
Rename the file to LP.mlc and double click it to install it.



I'm glad it worked!

Good, I can start working, let's connect to the VPN... boom error. I have to re-install OpenVPN.
Ok done. Now let's start VirtaulBox... boom error. I have to re-install VirtualBox.

After 90min, I could start working... (and I didn't fix grub yet...)
Not as smooth as I expected. After 2 days, my PC didn't crash. I hope it will continue to work correctly.

Tuesday, August 5, 2014

Cross-compile GDB for ARM (ARMEL & ARMHF)

Let's say you have:
Machine A: x86, cross-compile for armhf
Machine B: armhf

On Machine A, you create a program. Then you copy the program to Machine B.
On Machine B, you execute the program and boom fatal error, a core is generated.

The question is: on which machine should I use GDB to read the core file?
Answer: Machine A! But you need to install GDB for ARMHF!

Here are the steps (on Machine A):

Download GDB
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.gz
Extract
gunzip gdb-7.8.tar.gz
tar -xf gdb-7.8.tar
Go to the folder
cd gdb-7.8/
Build GDB 
#ARMHF
./configure --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabi-g++"
#ARMEL
./configure --target=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
make
make install
And that's it.
From Machine B, copy the core file in Machine A, and run this command:
/usr/arm-linux-gnueabihf/arm-linux-gnueabihf-gdb myProgram core

And that's it.


Note: I'm not sure if you really need to specify CXX when building GDB.

Saturday, August 2, 2014

Steps to develop Android applications

So I think the way to setup everything and to be able to develop and run an app are not friendly user at all.

Just last week, I met a guy who is interested in Android. He downloaded the ADT plugin with eclipse. Everything looks good, he created a new application based on the "blank activity". Then he hit run and boom error... How to demotive new people to start coding app for Android...
I think I had a similar problem with a "fullscreen activity".


Anyway, here are the list of steps that I should remember when changing VM:

- if it's a 64-bit VM, don't forget that Android architecture is ARM 32-bits, so you should install 32-bits libraries!
sudo apt-get install libc6:i386 libstdc++6:i386
sudo apt-get install lib32z1

- you will need Java:
sudo apt-get install openjdk-7-jdk

- Setting up a Device for Development
http://developer.android.com/tools/device.html
sudo vi /etc/udev/rules.d/51-android.rules
#Samsung 
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1104", MODE="0666", GROUP="plugdev"

sudo chmod a+r /etc/udev/rules.d/51-android.rules

For VirtualBox:
- install the Guest Additions
- add a shared folder so it's easy to copy from file between host and guest
- add your user to the group vboxsf to be able to access the share folder:
sudo usermod -a -G vboxsf alex
- in the VB settings of the VM, go to USB and add your device! So the VM will capture the device.
- install GIT
sudo apt-get install git

You can install Eclipse IDE with built-in ADT
http://developer.android.com/sdk/index.html
And go to: Window-> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
And set it to 10000 (if you leave it to 5000, you  may see some timeout)

Friday, August 1, 2014

Debian hangs at “Select and Install Software”

Recently, I wanted to use Debian 5.0.3 Lenny (for work).

The first step was to find the ISO.
I couldn't find it on the Debian website. Fortunately I could find it on these both sites: http://www.debiantutorials.com/download-debian-iso/
 http://cdimage.debian.org/mirror/cdimage/archive/5.0.3/i386/iso-cd/

After downloading the file debian-503-i386-netinst.iso (~150Mo), I'm ready to create a VM using VirtualBox.

The installation is easy but it freezes at the screen "Select and Install Software".

The way to solve this is the following:
  • start a new installation 
  • just before 'Select and install software.' I could see a popup about a warning. Press alt+F2 
  • press enter to activate the console 
  • run the command to place you into the system you are installing
    chroot /target
  • run the command to install the keyring
    aptitude install debian-archive-keyring
  • run the command
    aptitude update
  • run the 3 following commands
    gpg --keyserver pgp.mit.edu --recv-keys 6070D3A1
    gpg --armor --export 6070D3A1 | apt-key add -
    apt-get update
    
  • press alt+F1 to go back to the installer 
  • continue the installation as normal to the end 

And that's it !


Here is a quick link in case you want to cross compile:
http://wiki.micromint.com/index.php/Debian_ARM_Cross-compile

source: http://forums.debian.net/viewtopic.php?t=12259

Wednesday, July 30, 2014

cross-compile ncurses for ARM: ARMEL & ARMHF

First, make sure you have installed these packages:

# ARMHF
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
# ARMEL
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi
Make sure you did the following command and that "gcc" is in your path
sudo apt-get install build-essential

Download ncurses:
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

Extract ncurses:
tar -xzf ncurses-5.9.tar.gz

Go to the folder:
cd ncurses-5.9

And build ncurses:
#ARMEL
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
#ARMHF
./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabihf-g++"
make
sudo make install

 Done!

Then you should see libncurses.a with this command:
ls /usr/arm-linux-gnueabi/lib
ls /usr/arm-linux-gnueabihf/lib

Saturday, September 14, 2013

VirtualBox is slow !

So my host OS is Windows 8 and I wanted to separate my everyday stuff from my projects (coding) stuff.
I created a virtual machine, guest OS is Linux Mint.
My PC is: intel i3570K, 8GB DDR3, 64SSD + 128SSD, Asus Z77. Not a bad one!

Problem

So when I was in Mint, it was kind of slow.

 In settings > System > Processor, I had only 1 processor and when I selected 2 processors, I could see a warning message saying something like "this is not the most efficient setup". I ignore this message and in settings > System > Accelation, I checked "Enable VT-x/AMD-v".
When I start my virtual machine, I add an error message and the machine didn't start at all.

Solution

After searching on the Web, I found out that I had to go to the bios and activate a feature.
I don't remember exactly the name of the feature (and I guess it depends of the motherboard), but it was in the CPU section, and the feature was like "activate virtualization something".

After activating it, I could select 2 CPU and now my virtual machine is not slow anymore!

And that's it!

Thursday, May 30, 2013

imageMagick on mac os

Recently, I'm working on a mac os, creating a website using Rails.
I want the user to be able to upload a picture as an avatar. I found excellent
information on Internet. The most popular library is probably Paperclip (https://github.com/thoughtbot/paperclip).
Paperclip is intended as an easy file attachment library for Active Record.


After installing Paperclip and  ImageMagick (with brew), I added the code in my model :
attr_accessible :avatar, :name
has_attached_file :avatar, :styles => { :medium=>"300x300>", :thumb => "100x100>"},
  :url  => "/assets/restaurants/:id/:style/:basename.:extension",
  :path => ":rails_root/public/assets/restaurants/:id/:style/:basename.:extension"

It's exactly like in the wiki page of Paperclip (nothing fancy).

Problem :
But when I tried to upload an image, I had this error :
 ... is not recognized by the 'identify' command.

On Internet, many people said to do:
which identify
#/usr/local/bin/identify
And then add in config/environment.rb:
Paperclip.options[:command_path] = "/usr/local/bin"

But this didn't work for me.
If I just tried the command "identify", I could see this error :
dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib
  Referenced from: /usr/local/bin/identify
  Reason: image not found
Trace/BPT trap: 5

So I was thinking there is a problem with the file "libtiff.3.dylib".

Solution :
I copied the file libtigg.3.dylib :
from : /opt/local/lib/libtiff.3.dylib
to : /usr/local/lib/libtiff.3.dylib

I restarted my rails server, and now it's working !
It's probably not the best solution, but at least it's working so far.
I think ImageMagick is looking for the file libtiff.3.dylib in a wrong folder.
Maybe if I could modify ImageMagick config file and change to the good folder, this
would be a better solution.

And that's it !