Category Archives: tutorial

Python – Install pip and virtualenv and distribute without sudo access

Recently I started to so some dev on python and noticed that on the server that I was going to do the work I don’t have sudo access.  In the past, this has not been an issue, but in this case getting sudo access is almost impossible and not doable.  So my only option is being able to run pip (to install python packages) as an user.

After painfully researching on how to successfully do this, I was able to make it work.  I hope that this helps others in the future. Good luck!

  1. Make sure that you have python installed
    which python
  2. Download latest version of virtual environment (virtualenv)
    wget https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz#md5=44e19f4134906fe2d75124427dc9b716
    
  3. Unpack source tarball
    tar -xzf virtualenv-15.1.0.tar.gz
  4. Create your package environment
    python virtualenv-15.1.0/virtualenv.py py-packages
  5. Delete the virtual environment folder
    rm -rfv virtualenv-15.1.0
  6. Install virtualenv into your environment.  You can use the package that you downloaded or using pip.
    py-packages/bin/pip install virtualenv-15.1.0.tar.gz

    or

    py-packages/bin/pip install virtualenv
  7. If you want to clone environments you can do the following
    py-packages/bin/virtualenv py-clone1

Sources:
http://stackoverflow.com/questions/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python
https://pypi.python.org/pypi/virtualenv
https://packaging.python.org/installing/

Ranking algorithm for the layman – New Modeler Extension

There are a lot of ranking algorithms for you to use and represent your data. Now, that doesn’t mean that the ranking algorithm is the most appropriate for your situation. It all depends on what you are trying to accomplish and who will be the audience of your final product. Some ranking algorithms could be too sophisticated to be actually understood by a layman’s type of person. The reasoning to develop this particular piece of work was to not only rank specific type of datasets but be able to explain how the ranking is performed for the layman’s type of person.

main-view

The inspiration for creating this node came from this site -> http://www.psychstat.missouristate.edu/introbook/sbk14.htm. Now that this node exists, it allows us to reuse it over and over. According to the author of the site, transforming raw scores into percentile ranking, will enable us to: 1) Give us meaning and interpret the scores and 2) Provide a direct comparison between scores.

Sample Output:
results-after-ranking

If you want to learn more and try this extension go to the GitHub Repository. You can find my extension and all others in thePredictive Analytics Gallery.

Source: Missouri State – Score Transfromations

Source: | Ranking algorithm for the layman – New Modeler Extension

Installing rJava in RHEL

Installing rJava on Ubuntu is a piece of cake. All you have to do the code below, and boom!!! You got rJava working in R.

 sudo apt-get install openjdk-7-jdk
 sudo apt-get install r-cran-rjava
 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
 export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/i386:$JAVA_HOME/jre/lib/i386/client

Now, the challenge was trying to get rJava working on RHEL. I could not find any proper documentation that worked. Instead, I ran into a bunch of posts and pointing to things that worked in their environment, but not on mine (so, this might not work on yours as well, but I hope it does). I usually like to give credit to the sources, but this time, they were so many over a long time span, that I could not remember what came from where anymore. So, I apologize for that. Below are the things that I did to get rJava working.

packages need

$ sudo yum install gcc-c++ gcc-gfortran R R-core R-core-devel R-devel R-java R-java-devel java-1.7.0-openjdk-devel
$ sudo yum list install gcc*

Once, you have installed the necessary packages; then it is time to

configure your environment

$ sudo /usr/sbin/alternatives --config java #select openjdk
$ sudo /usr/sbin/alternatives --config javac #select openjdk
$ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64/jre
$ export PATH=$PATH:$JAVA_HOME/bin
$ sudo /usr/bin/R CMD javareconf
$ R
> install.packages("rJava") #install rJava on R console

And that is it! If you got the install.packages(“rJava”) to work on R, that means that now you can call Java from within R console.

Move messages from one Lotus Notes archive to another archive

Just recently I found out how difficult is to search through out my split archives.  I found this recourse but, really doesn’t give me the information that I need in order for me to be able to merge my archive *.nsf files.  So, instead here I am documenting how you can merger multiple Lotus Notes archive files.

  1. make sure that your folder structure is the same across archives.  If is not, then create the folders in the archive where you will be moving the data to.
  2. backup your archives just in case something goes wrong
  3. create an archive replica where you would like to move the files to
  4. go to your workspace
  5. right click on the replica that you would like to move data from
  6. go to Applications -> properties
  7. Click on “Archive Settings…”
  8. Create a new setting.
  9. Click “Selection Criteria…” . In this case we are going to move any file that hasn’t been modify in the last 1 day.
  10. Check “Enable this criteria”
  11. Update the section “What Should Happen to the Selected Documents?” and choose the archive db where you will be moving this data to.
  12. Once you are done click “OK”, then “OK” again.
  13. At this point you should be back to the workspace.  Double click/open on the archive db that you would like to move data from.
  14. Go to File -> Application -> Archive…
  15. Then hit “Yes”
  16. Let it run in the background until all your emails has been moved.  Hit F9 to refresh window if you are not sure if all your emails have been moved.
  17. before saying viola … double check that everything has been move and then viola!!! enjoy having only one archive.

Let me know whether this documentation didn’t help you or not 🙂

Source Move messages from one Lotus Notes archive to another.

Splitting in Linux and Combining in Windows

i don’t know if you do this on a daily, monthly, yearly, or never basis, but i do some times.  what is it that i do?!

whenever i want to email or upload gigs of information over the net usually takes for ever.  the file might be upload it incorrectly or the file won’t go through because is too big.  well, there are applications out there that you can use in order to be able to split files.  for example, if you are compressing an application using WinRar, it will automatically create *.rar-xxx which it will have your files separated depending on the size that you specified.  well, i believe there is a easier way to be able to perform this.

OK, now lets say that you are using Linux and you would like to split a 1GB file into 100MB files.  the way to do this is using the split command… and it will go like this:

split --bytes=100mb file1 file_

where you will replace file1 with the actual name of the file (e.g. MyFamilyDVD.iso) and file_ will be how the files will be renamed (e.g. MyFamilyDVD.iso_)

now, lets say that you upload these files to a server and your friend download them.  your friend will need the following command in order to be able to combine the files:

cat file_* > file1

where file_* are all the files that were created (e.g. MyFamilyDVD.iso_*) and file1 is the actual name of the file to be created (e.g. MyFamilyDVD.iso).

so, lets say that your buddy doesn’t have Linux and they have Windows instead.  here is the command that they will need in order to combine all of those files.

copy /B file_1+file_2+file_3 file1

where file_1+file_2+file_3 (e.g. MyFamilyDVD.iso_*)will be all the files created and file1 will be the actual name of the file to be created. the bad thing in windows is that you won’t be able to use the asterisk and you will need to type file per file.

any ways i hope this helps!!!

iTunes in Virtualbox and your iPod

so after installing ubuntu in my desktop i started to install windows xp on a virtual machine.  yes, i am running away from BLUE SCREENS and VIRUSES, why wouldn’t you?! well anyways… i needed my iTunes to run propertly and be able to sync with my iPod. i got it work worh with my library and THANK God that i make backups :).  well i thought that after enableling my usb drive and pluging my ipod and telling my itunes that my ipod is connected it was going to work propertly, but guess what!!! it didn’t.

so there was a extra special step that i had to take and it was pretty easy.  i shutted down my virtual machine and open up virtualbox program.  went to the windows xp settings, and then to usb.  in the usb i connected my ipod and waited until my ubuntu system recognized my ipod and then added the ipod to the filters.  this will allow my ipod to be recognized by windows before my ubuntu system.  pretty clever ah!

and that would be it… now my ipod works like if there was a sole windows os installed.  hope this helps to anybody.

Enable USB with Virtualbox

this small tutorial will illustrate how to have your usb working with virtualbox.  virtualbox has the usb support disable by default.  if you want to have your usb to work properly with virtualbox you would have to perform the following steps.

this tutorial applies for ubuntu 8.10.  but it might work with other distros.

steps:

  1. type “sudo gedit /etc/init.d/mountdevsubfs.sh
  2. go to the following block
    #
    # Magic to make /proc/bus/usb work
    #
    #mkdir -p /dev/bus/usb/.usbfs
    #domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    #ln -s .usbfs/devices /dev/bus/usb/devices
    #mount --rbind /dev/bus/usb /proc/bus/usb

    change it to
    #
    # Magic to make /proc/bus/usb work
    #
    mkdir -p /dev/bus/usb/.usbfs
    domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    ln -s .usbfs/devices /dev/bus/usb/devices
    mount --rbind /dev/bus/usb /proc/bus/usb

  3. now go type “sudo gedit /etc/fstab”
  4. copy and paste the following code to your fstab
    none /proc/bus/usb usbfs devgid=1000,devmode=664 0 0

you are almost done.  now reboot your computer and you should be good to go.

Installing Tor in Ubuntu Hardy

before i show you how to install tor in ubuntu hardy, i am going to explain a little bit what exactly tor is.

Tor is a software project that helps you defend against traffic analysis, a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security. Tor protects you by bouncing your communications around a distributed network of relays run by volunteers all around the world: it prevents somebody watching your Internet connection from learning what sites you visit, and it prevents the sites you visit from learning your physical location. Tor works with many of your existing applications, including web browsers, instant messaging clients, remote login, and other applications based on the TCP protocol.

Retrieved from torproject.org

So if you want more information go and visit torproject.org and you will be able to answer all your questions.  so now lets go and install tor in ubuntu.

Steps:

  1. Open your “Terminal” and type “sudo apt-get install tor”
  2. after tor is installed now you will need to install privoxy.  for that you will need to go to this page and download you system architecture version (http://sourceforge.net/project/showfiles.php?group_id=11118&package_id=35042&release_id=627607).  in my case is privoxy_3.0.10-1_i386.deb.after having both programs install now is all about configuration of just one of them ;).
  3. now, on your “Terminal” make a copy of the configuration file from privoxy folder. in my case would be “sudo cp /etc/privoxy/config /etc/privoxy/config-backup”
  4. make a new file with “sudo nano /etc/privoxy/config”
  5. paste the following information:

    # Generally, this file goes in /etc/privoxy/config
    #
    # Tor listens as a SOCKS4a proxy here:
    forward-socks4a / 127.0.0.1:9050 .
    confdir /etc/privoxy
    logdir /var/log/privoxy
    actionsfile standard # Internal purpose, recommended
    actionsfile default # Main actions file
    actionsfile user # User customizations
    filterfile default.filter

    # Don’t log interesting things, only startup messages, warnings and errors
    #logfile logfile
    #jarfile jarfile
    #debug 0 # show each GET/POST/CONNECT request
    debug 4096 # Startup banner and warnings
    debug 8192 # Errors – *we highly recommended enabling this*

    user-manual /usr/share/doc/privoxy/user-manual
    listen-address 127.0.0.1:8118
    toggle 1
    enable-remote-toggle 0
    enable-edit-actions 0
    enable-remote-http-toggle 0
    buffer-limit 4096

    Retrieve from https://wiki.torproject.org/noreply/TheOnionRouter/PrivoxyConfig

  6. exit out from the program (nano NOT terminal) and save it.
  7. go to this site to install the tor plug in for firefox.  Tor Plug in.
  8. after firefox is restarted click on the “Tor Disabled” button in the bottom to enable it, and to check that it works properly go to check tor installation.

if it works, congrats.  if it doesn’t sorry.  go back and check this tutorial or go to tor website to get support.

Blackberry and Exchange without Blackberry Enterprise Server

since february i’ve been a blackberry user.  i really like my black berry pearl 8130, but the only thing that i don’t like at all is the memory.  it is alright, i could live resetting my blackberry so my phone log will not be deleted.  well anyways, sinse i got the blackberry i’ve all my email being send to my blackberry.  now, i am working at this new company and i just configure microsoft exhange.  so guess what?! i would need a blackberry enterprise in order for me to sync my blackberry with an exchange server.  i don’t think that my company would like to pay $2,000 for a blackberry server that will sync my blackberry and theirs.

i started to do some research and i found this web How to set up a Blackberry with Exchange (without using Blackberry Enterprise server) and i tested it but it didn’t work. but, i found a way that you can configure your blackberry and exchange for free and be able to send and receive emails to your blackberry.  it is really easy to do and all you need is to do some research about your phone provider.

Steps:

  1. go to google.com and search for “blackberry webmail sprint”
    just change sprint for your phone provider ex. verizon, alltell, etc.
  2. now you will have bunch of search queries. click on the one that is related to your phone provider in my case is http://bis.na.blackberry.com/html?brand=sprint
  3. login with your user name and password
    if you don’t have. create one.
  4. after you login, click on “Set Up Account”
  5. put your email address and password that you want to setup
  6. then, click next
    wait patiently… until is done TRYING to setup your account
  7. now, click on “I will provide the settings to add this email account.” THEN click “Next”
  8. select either, “This is my personal email account.” OR “This is my work email account.”
    in my case is work email
  9. now this is the part that is tricky. the way i did it was selecting “Outlook® Web Access”.  the reason why i chose that is because my URL of the company is not going to change. so select that one and then click “Next”
  10. now input, the exchange URL, user name, password, email address and mailbox name.  in Exchange, the user name and mailbox name are going to be the same. but, of course this depends on how your Exchange server is setup. in order words, ask your server administrator ;).
  11. then, click “Next”, and congrats you are done ;).

after setting up your blackberry you should receive an emails saying that your blackberry has been compleate configure and you should be receiving emails like in 20 min.  if this didn’t happen, go back and READ CAREFULLY.