সোমবার, ১৬ সেপ্টেম্বর, ২০১৩

Live Blogging on how my proxy setting on Ubuntu is working back in the office

Following is a brief description of how I followed up with proxy

11:45 am: At home, I cleared  the setting in Dropbox preference for proxy setting. Then it worked. Now back in the office I put those manually. And Dropbox started to work again.

11:50 am: Chromium is not working. So what I do is
sudo vim /etc/chromium-browser/default
#Add proxy server detais in the following form
export http_proxy="http://rushadf:0302@127.0.01:3128/"

What I do is just remove the '#' sign to uncomment  "export....." command. But chromium is still not working.

12:01 am: Now I start following the instruction from the last post to see whether it make any changes. But before that let me see whether I can get synaptic to work in here.

12:06 pm: Got Synaptic to work  just fine. Just manually entered proxy information in Synaptic Preference and it worked just fine. But strange apt-get does not work.

12:11pm: Now let's follow the instructions from here:

sudo vi /etc/bash.bashr

Add your proxy server details in the following format

export http_proxy="http://username:password@proxyhost:port/"

export ftp_proxy="http://username:password@proxyhost:port/"
Since I already worked on this yesterday, I had those commented out when I got home. Now I uncomment those and they work just fine.

Chromium browser works!!!!!!!!!!!!!!

12:35 PM update: Chromium browser is not actually working. I just got fooled by the appearance of the website from the tabs. But whenever I put a new link or address they won't work.

Now let's check whether apt-get works or not.  "apt-get" is still not working. What we do now?

12:25 pm:  Let's try this tip from the same source as above:

Some releases sudo is configured in such a way that all environment variables all cleared when running the command. To keep the value for your http_proxy and fix this, you need to edit /etc/sudoers, run:

visudo 

Then find a line that states:

Defaults env_reset

and add this after it: 

Defaults env_keep = "http_proxy ftp_proxy"
Nah! apt-get is still not working.  What to do now?

12:29 pm:  I just check to see what's the output of this command:  echo $http_proxy
It returns a blank line.

12:39 pm: Now this is really strange. When  comment out the "Defaults env_keep = "http_proxy ftp_proxy" command, the chromium browser works back again. That's weird!

"apt-get" is still not working.

12:47  PM  :  Well, apt-get finally works after I  remove the "#" from the /etc/apt/apt.conf file in front of the following that starts like "Acquire::http::Proxy  "http://rushadf:0302@127.0.0.1:3128";

Seems like everything is working now again in the proxy setting.

To sum it up: To set the proxy work which is behind an ISA server what I do is the following from this site:

Install cntlm  and follow the instructions from the above site up to 1.4. Now to set-up proxy for different programs, I just repeat from the beginning what I have done today.


রবিবার, ১৫ সেপ্টেম্বর, ২০১৩

Proxy setting in Ubuntu is a real pain!

This is a very simple procedure to set up proxy in Lubuntu taken from here:

edit /etc/bash.bashrc by the following command

<code>
sudo vim /etc/bash.bashrc
export http_proxy="http://rushadf:0302@127.0.01:3128/"
export ftp_proxy="http://rushadf:0302@127.0.01:3128/"
</code>
To keep the value for http_proxy,you need to edit /etc/sudoers

<code>
visudo
</code>

Then find a line that states:
Defaults env_reset
and add this after it:
Defaults env_keep="http_proxy ftp_proxy"

for chromium:

sudo vim /etc/chromium-browser/default
#Add proxy server detais in the following form
export http_proxy="http://rushadf:0302@127.0.01:3128/"

It seems this is all there it is. Too good to be true?

Then what are those gsettings command?

gsettings set org.gonome.system.proxy.http host '172.16.4.84'
gsettings set org.gonome.system.proxy.http port '3128'
gsettings set org.gonome.system.proxy.http host '172.16.4.84'
gsettings set org.gonome.system.proxy.http host '172.16.4.84'
gsettings set org.gonome.system.proxy mode 'manual'
gsettings set org.gonome.system.proxy mode 'none'

# I also don't quite understand the difference between ~/.bashrc and /etc/bash.bashrc. But they have different line numbers.

Here I review some the proxy commands in Lubuntu that needs to be remembered:


cat /etc/environment

# The above command gives what is in environment variable

env | grep -i proxy

# This is anothe useful command to to look at which give all the proxy
# environment.

export http_proxy=

#Above command sets a null value for http_proxy.We can check whether that worked by the following command.

echo $http_proxy

#It should return a blank line.

শুক্রবার, ১৩ সেপ্টেম্বর, ২০১৩

It's All About Linux and Linux

I probably spend a good portion of a day and half on figuring out how installing Linux on my Samsung netbook. I wanted to find a suitable distro for my atom under-powered machine and thought I would give "Lubuntu" and "Easypeasy" a try. But the problem that I ran into is that I was unable to create a bootable USB drive with UNetbootin  which is one of the most excellent tools available for installing and trying out Linux distros. But in the Samsung, I did not find the option to boot from USB, as a result, it all failed. Then I tried to install it from the hard disk, the image .iso file but it did not work due to a well known but which prevents the distro to install if the live disk created by UNetbootin is in the same disk. It gives an error by stating to unmount the CDROM. This comes along because the USB acts as CDROM and since it is in the same disk as where we are trying to install the distro, the error comes along.

But there is a way out to do exactly that which I did not try. Here is the link:

http://community.linuxmint.com/tutorial/view/171

What I did is that found a way to activate USB boot option in Samsung by disabling the fast bios option in BIOS setup. Then I fired up unetbootin and  created Live CD for Lubuntu. Then freed up some space from the logical drive by using disk management in Windows 7. Then when I rebooted, the netbook nicely booted into untebootin boot window where you have the option to try it before installing. Anyway I liked it already so I went to direct installation. It went smoothly and I was ecstatic. But then I got greedy!

I freed up a little bit more space from my logical drive and installed Easypeasy in the same manner. But alas, what happened is that my Windows7 was gone from GRUB list. Then following the instructions on this page:

http://askubuntu.com/questions/83771/recovering-grub-after-installing-windows-7

Specially these simple commands worked just find to recover GRUB with windows on it:
To recover grub:
  1. Open the live version.
  2. Open the terminal and run sudo fdisk -l to see where Linux is installed.
  3. Run sudo mount /dev/sdaX /mnt where x is the number you have found Linux word in
  4. Run sudo grub-install --root-directory=/mnt /dev/sda to install grub.
  5. Run sudo update-grub to update grub and if this command didn't work run it after rebooting.
  6. Reboot.

বৃহস্পতিবার, ২৯ আগস্ট, ২০১৩

Editing .Rnw file in with vim-r-plugin and insert-mode shortcut bug

When I started editing a sweave file with .Rnw extention, at the beginning it seemed everything is honky-dory. The latex-suite was loaded with the menus  along with R functionalities but ran into a wicked problem. Here in the tex.stackexchange.com forum I posted the problem:

http://tex.stackexchange.com/questions/130436/latex-suite-autocompletion-feature-not-working-with-rnw-file


I have been a great fan of Vim with its awesome Vim-latex suite providing extremely useful keybindings and autocompletion features. Then I installed vim-r-plugin and opened a .Rnw Sweave file. While syntax highlighting and other R related features such as key shortcuts are working fine, LaTeX shortcuts no longer works. For example, if I type SSE it longer gives "\section{}". But if I instead I open a .tex file, those shortcuts works just fine.
It's not that .Rnw files not detecting latex-suite in Vim. My latex suite is loaded with .Rnw files with all the menu and stuff. I can get the short cuts work with F5, F7 and alt keys. It's just that short cuts do not work in the insert mode. It's bugging me a lot and I have been on the hunt for a solution the whole day but could not find a fix yet.

I got this heavenly response with an elegant solution from  an user named FvD:

You need to associate the .Rnw files with tex.
The most direct way to do this is to issue the following command with the open .Rnw file:
:set filetype=tex
As soon as you have done that the vim-latex behaviour you are used to should be back. To incorporate this in a nice way in your vimrc is described here in a stackoverflow question. To wit:
autocmd BufRead,BufNewFile *.Rnw set filetype=tex
As per the vim-latex recommendations I also have
let g:tex_flavor="latex"
in my .vimrc, but that should not impact on the behaviour of the plugin itself (the filetype certainly does).

That was sweet indeed!

Work-around of a strange problem in vim-r-plugin

After installing the latex suite, my first task was to bring in the vim-r-plugin to edit noweb that is Sweave/knitr files. Following the installation instructions, whenever I tried to start R from Vim (/rf), the R started without any configuration I put in the .Rprofile ( see my earlier post). Then I had to actually make changes in the  Rprofile.site  file which is the  etc directory in the "Program Files" directory of R installation. Now whenever I call R  from Vim,  the configuration loads at the start-up.

মঙ্গলবার, ২৭ আগস্ট, ২০১৩

Configure .Rprofile for customizing R

Well, this has been bugging me a lot since I started using R, customizing start-up mechanism at R. Here is a great site which gives pretty good instructions on setting this up.

http://scs.math.yorku.ca/index.php/Rprofile

With notepad I created a file named .Rprofile with file extension  "all files". This is required because this is not a typical text even though you can open it with notepad. I put it in C:\R directory but you can put it in any directory you like but that has to be your startup directory. You can changes the startup directory by doing this:  right-click on the R icon, select Properties, and then change the Start In field to C:\R

With those instructions there I changes the prompt in R from "> " to "R> " by putting the following line in my  "C:\R\.Rprofile" file:

options(prompt="R> ")

I also had an long-standing issue where I had to always type my default library location. With .Rprofile this problem is gone. I simply add the following line in this .Rprofile file:

.libPaths("J:\\Rushad\\MOF\\R-stuff\\library")

The location of the directory above is my computer specification. It will differ from user to user.  

শনিবার, ২৪ আগস্ট, ২০১৩

Using Latex with Stata

Few days back I discovered a great tool for using LaTeX with Stata. Most of us are familiar with Sweave which is a package in R. I was very happy to find the utility to be used with  Stata. You can download it from here.

It's a .jar file, so you need to have java installed. I installed it it on my windows machine in root folder that is C:\ with a folder created named 'statweave'. After the installation, you have to adjust the statweave.cfg which is a configuration file. Specially look for your default LaTeX distribution, R and Stata installation folders address whether they are rightly located in the file.

To test whether it is working or not, I have created a separate folder which I guess can be anywhere on you computer. I downloaded some test files from here.

Another important aspect is that you should have Statweave.sty file in the same folder where your .swv or .tex file is. During the installation at one point you would be asked where you want to put your Statweave.sty file? I have chosen "C:\texlive\texmf-local\tex\latex\local". But everytime I run, it says that Statweave.sty is missing. Therefore I have copied it from that directory to the working directory where the .swv or .tex files are. Now it's working just fine.