Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Tuesday, February 8, 2011

Solidworks on an Ubuntu netbook? A Howto for MIT MechE undergrads

yo, I heard u liek solidworks so i put a solidworks in ur windows7 in ur desktop, and put that in ur ubuntu in ur netbook
TECHNOLOGY FTW: making life complicated since 10,000 BC

Ah, the life of a course 2 (MechE) major, where everything I need is Windows-only.

Here's the situation:
2.007 recommends that we install Solidworks on our laptops.
Solidworks only runs on Windows.
I only run Ubuntu. On mai netbook. :)

Possible solutions:

  1. Dual-boot XP: well, I hate rebooting. Scratch that.
  2. Install XP inside a virtual machine on my netbook: Works under casual inspection
  3. Triple boot windows 7 on my desktop, install Solidworks, and remotely connect to that:
    The Win!
    Specifically, using the RDC protocol, Windows 7 on my desktop, and remmina on Ubuntu Maverick on my netbook.

I have: a netbook (1.6 ghz, 2 gb RAM, 160 gb drive) running Ubuntu (Maverick 10.10), with about 50 gb of free space.

Solution 2.
I installed:

  1. VirtualBoxfrom the virtualbox website
  2. Downloading the Windows XP iso from IS&T
  3. Creating a new machine in VirtualBox with 1.4 gb of RAM and 20 gb of  (dynamically expanding) virtual hard drive space
    (my Ubuntu setup consumes 500+ mb of RAM)  
  4. Installed Solidworks the normal route (MIT MechE website / share folder)
    This step took, oh, half a day or so on my netbook.

Results: Runs okay, faster than all my friends expected. Haven't tested it on a really complicated assembly. At the speed at which XP boots on my netbook, followed by starting up Solidworks (~15 minutes total), I'm very grateful for the "pause" feature on VirtualBox (so I can boot everything up ahead of time), but the virtual machine still sits there eating 1.4 gb of RAM.
Verdict: Not a great solution.

(This is skipping a long story of trying to install a modified-to-be-slim 1gb XP, followed by hours spent trying to expand the virtual hard drive from 1 gb to 20 gb so that I could install SolidWorks. Many thanks to my friends at MITERS last Friday/Saturday).


Solution 3
Now, I also have a desktop, which allows me to reach a more ideal solution. Over IAP I installed Windows 7 in order to install Solidworks, bringing me to a triple boot of XP, Ubuntu, and Win7.
Desktop: 80 gb SATA drive, 3.6 ghz, 2 mb RAM. + a 50 gb IDE (aka PATA) drive I acquired.

In retrospect, I should have mounted the 50 gb drive and commanded XP to recognize it, thus giving me enough disk drive space to install Solidworks. (XP eats up less RAM than Win7). Oh well.

Anyway, there's a few options here.
1. VNC (Virtual Network Connection): TightVNC, UltraVNC, and RealVNC are free software for Windows. For connecting to a VNC server, Vinagre comes by default on Ubuntu.
2. RDC (Remote Desktop Connection): Comes by default on Windows. sudo apt-get install remmina for Ubuntu.

VNC: Allows both server (local user) and listener (remote user) to see the screen at the same time. Slow (literally transmitting images).
RDC: Fast. When listener (remote user) connects, locks out the server (the local user) so she can't see what's going on.

VNC

  1. Download and install TightVNC, set and remember passwords. Run it as a service (supposedly faster). Icon (with "V") should appear in status bar.
  2. Notes: I went with TightVNC, since it looked like it had been updated more recently (mid-2010) than UltraVNC, and I read mixed review of the free version of RealVNC.
    No idea about TightVNC vs. RealVNC vs. UltraVNC in terms of speed.
  3. On Ubuntu, run vinagre and set up a new VNC connection to your IP address
  4. Done!

RDC
  1. Enable remote access on win7 (Control Panel > System > Allow Remote Access)
  2. Disable hibernation / suspend power saving
    Also note that the IPs (via ethernet) change every few days, and you may hit a IP change like I did, so double-check via www.whatismyip.com (or other method, such as the TightVNC status tray icon)
  3. Install Remmina on Ubuntu (sudo apt-get install remmina)
    Start Remmina
    Create new connection: Under basic, put RDC protocol, the IP address of my windows machine, my username and password on windows. Hit "Ok"
  4. Done!

The result: VNC showed noticeably lag both refreshing the screen and updating cursor position (half a second, perhaps) and it was funny watching the mouse cursor jerk around on my desktop. RDC ran like I was sitting at my desktop, even after bumping it up in remmina from 256 colors (the default, which looked very weird) to 16 bit colors.

VNC (lag)

RDC (almost negligible lag)

Verdict: RDC to a desktop is fastest. Run Solidworks on my desktop. It's acceptable to reboot into windows occasionally, especially if it's just for set times like lecture or lab. I wasn't happy about the idea of constantly running windows instead of Ubuntu on my desktop, which won't be the case.


==========
Notes for myself

BIOS Settings: Turn all drives ON (PATA-1, PATA-2, SATA-1, SATA-2). Set Boot Order to SATA before IDE.
Ignore "Drive 1, 3 not found" warnings and hit F1 to continue.
Booting Windows 7: Connect all drives. At GRUB screen (installed with Ubuntu), select "Windows 7 (loader)" followed by "Windows 7" (the second time is only because I have an old UNetBootin installation).
~Win7 GRUB e: "root (hd0,1)"
Booting Ubuntu: Disconnect Win7 hard drive (otherwise, says "Error mounting")

I think I had to do some work to repair GRUB after installing Windows, but I don't remember exactly what. Google!

Wednesday, February 2, 2011

Embedded pdf in Firefox 3.6, Ubuntu 10.10, with Evince and Mozplugger

sudo apt-get install mozplugger

I think I had acroread installed (not sure, since it wasn't working), so I had to tweak mozplugger a bit to get it to work by adding a single line: repeat noisy swallow(evince) fill: evince "$file"

So my file looks like:
user@user-netbook:~$  sudo gedit /etc/mozpluggerrc

    text/x-pdf:pdf:PDF file
        ACROREAD()
        [...]
        repeat noisy swallow(evince) fill: evince "$file"
        [...]
        repeat noisy fill exits: evince "$file"

        application/x-dvi:dvi:DVI file [...]


Restarted Firefox, works great.
(btw for troubleshooting: in my FF, under edit > preferences > applications > PDF Document, it says "Use MozPlugger 1.13.3 handler")

Wednesday, December 29, 2010

1and1: Shell access on (Linux) Home and Beginner accounts / Installing Prestashop || WIP

[Shell access on 1and1 (Linux) Home and Beginner accounts ] ...kind of. In a ghetto way.
(||WIP: format code, links. organize in steps.)

According to http://faq.1and1.com/web_space__access/secure_shell_access_ssh/3.html, Home and Beginner accounts don't have shell access (you can't ssh, only ftp) which sucks. Also, their ftp upload speed is insanely slow on my computer for whatever reason. Working off of the genius of http://jeffchannell.com/Joomla/quick-install-joomla-on-1a1-hosting.html, I can avoid learning PHP for a few more hours.

  1. create a getpresta.php file
    1. <?php
      echo shell_exec( 'echo This is a wget started at time:' );
      echo shell_exec( 'date' );
      echo shell_exec( 'wget "http://www.prestashop.com/download/prestashop_1.3.6.0.zip"' );
      echo shell_exec( 'echo This is a unzip php started at time:' );
      echo shell_exec( 'date' );
      echo shell_exec( 'unzip prestashop_1.3.4.0.zip' );
      echo shell_exec( 'echo This is a unzip finished at time:' );
      echo shell_exec( 'date' );
      ?>
  2. ftp to your 1and1 site (u1234123, and your password)
  3. copy over getpresta.php
  4. go to http://yoursitename.com/getpresta.php
    This should not take too long (more than 2 or 3 minutes)! If it takes too long, hit refresh. you may need to delete any partially-downloaded or unzipped files via FTP.

For Prestashop:
create .htaccess file for php5
AddType x-mapp-php5 .php

[edit 27 jan 2010: fixed missing ?php line, updated version from 1.3.4 to 1.3.6]

Tegaki: chinese handwriting recognition on ubuntu maverick [meerkat 10.10]

In short, in a terminal, type in:
sudo apt-get install ibus-tegaki
sudo apt-get tegaki-zinnia-simplified-chinese

Pinyin / keyboard-based Chinese IME works well enough in Ubuntu, but tablet recognition is iffy.

The tegaki 0.3.1 packages are already in the meerkat universe repositories. (ibus-tegaki, tegaki-zinnia-simplified-chinese), so it's super straightforward.

(if when you type in above the terminal says "can't find package", you need to enable to universe repositories. Via command line: https://help.ubuntu.com/community/Repositories/CommandLine. Via GUI: go to [Applications > Ubuntu Software Center > Edit > Software Sources] and make sure that "universe" is checked.

Maybe you also need to install libzinnia0, not sure.

Yay, that's it! If you need to, start the Ibus daemon. [System > Preferences > Keyboard Input Methods] should prompt you to start the daemon if you haven't already. Then go to [Input Method > Select an Input Method... > Other > tegaki] and hit [Add].
You can also try [... > Chinese > Pinyin]  and hit [Add]. Note that that's a capital-P! "pinyin" is for typing the tone marks.

Now you can select "tegaki" as an Ibus input method like normal (by clicking the keyboard ibus icon in the notication area), and I think the default keyboard shortcuts are [left-alt + shift] for switching inputs and [ctrl-space] for turning Input Methods on and off.

Tegaki does some weird hogging-the-input on my computer sometimes, though, and I can't even turn it off via IBus>Restart. I have to go ps x | grep ibus, sudo kill -9 [process #], ibus-daemon (to restart ibus), which is silly.

I can't get the wagomu engine to install though. :/ grr it keeps saying "can't find wagomu.h"

Also, ibus and tegaki are teh fails compared to Vista [Business and Up]'s Tablet PC Input Panel recognition. Tegaki is unsuitable for my give-tablet-to-grandma project. Sometimes it works beautifully, but my dad and I spent 15 minutes trying to write "那" before we gave up. Also, there's no way to enter in pinyin to shore up the recognition fail, and there's no way to easily enter English characters. There's no way I'm going to tell my grandma "Then you go down to this corner here and click and pick English handwriting recognition."

I was puzzling over this and then I used Vista Biz's tablet pc UI and it did address all of these issues (of course, some issues are obviated because its handwriting recognition feature is, for the most part, accurate, so there's no need for a back-one-stroke in addition to a back-entire-strokes and delete-all-characters-I've-approved-but-not-yet-inserted = 3 delete buttons).

Of course, this means I should haxor on the tegaki code, but ?? I have no idea where to get started and wish I could just skype with the developer for 30 minutes. I bet that would save me 20 hours of confusion.

Also to consider:
  • Running Vista Business in a VM inside Ubuntu (if I can find or order the restore media), writing code to access its input panel technology
  • Plunking down 40 euros for http://www.visionobjects.com/en/webstore/buy-myscript-stylus
Alternatively, I could keep spamming my living group's mailing list and hope someone's interested enough to tackle this with me, or start spamming SIPB's mailing list

Also, my ssh is still more broken than not so I can't even anti-social-tastically whine on Zephyr and keep my daily realization that I hate computers from polluting the internets.

Useful command line of the day:
apt-cache search [search term]

e.g.
apt-cache search tegaki

Also,
https://help.ubuntu.com/community/UsingTheTerminal

Monday, December 27, 2010

Zencart, Prestashop, and LAMP (on Ubuntu Maverick Meerkat 10.10) ||WIP

|| WIP: add links, fill out zencart, format with code tags

Yay for adapting instructions from books that only explain how to do things on Windows!

Anyway, I hate any sort of reinventing the wheel, so here goes.

Also, I would like to note that Zencart is so much more responsive than Prestashop when I installed both on the localhost server on my netbook, it's not even funny (<1 second compared to 5+ seconds to load the homepage). Maybe it's because I installed the sample data for Prestashop but not Zencart, but it would make sense that software created back then is much less of a (database-calls?)-resource-hog than software made nowadays, unfortunately.

My system:
Ubuntu 10.10
apache2.2.16

Set up LAMP (localhost server)
sudo tasksel install lamp-server
Explanation: Ubuntu/Debian software comes in packages and tasks, which are collections of packages.
Useful commands:
sudo /etc/init.d/apache2 restart

sudo apt-get install phpmyadmin
IMPORTANT: Hit "enter" when you tab down to select apache2 (see * in pic below) Otherwise, it gets rather painful.


Google will tell you to make a symlink, ala sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin (http://ubuntuforums.org/archive/index.php/t-591952.html), but apparently that has security issues and the correct method is to 
sudo apt-get remove phpmyadmin
sudo apt-get install phpmyadmin
and hit Enter this time. 

Zencart






Prestashop

Explanation:
Apache2 looks for sites in /var/www by default (https://help.ubuntu.com/10.10/serverguide/C/httpd.html). This directory is root-access only, so we'll download the zip and unzip inside a regular directory so that they unzip with the right permissions (unzipping the the /var/www does NOT work, if I access any pages with my web browser I'll get "503 Permissions" errors).
 
Let the normal folder be ~/MyProjects/presta, and let the folder we'll want to install into be /var/www/pshop.
  1. cd ~/MyProjects/presta
    cat@cat-netbook:~/MyProjects/presta$
  2. Download zip of version you want:
    wget “http://www.prestashop.com/download/prestashop_1.4.0.5.zip"
  3. Unzip in normal nautilus:
    prestashop_1.4.0.5.zip
  4. LAMP-specific: Now move to the apache localhost server directory:
    sudo mv prestashop_1.4.0.5.zip /var/www/pshop
    (Explanation of /var/www: https://help.ubuntu.com/10.10/serverguide/C/httpd.html)
  5. http://localhost/pshop/install in a browser, finish the first step,
    and get to Step 2: System and Permissions.
    (This is more reliable than following http://www.prestashop.com/wiki/Installing_and_Updating_PrestaShop_software/#Install_PrestaShop which was apparently outdated list of files I need to chmod.
    1. Fix gd2:
      sudo vi /etc/php5/apache2/php.ini
      Add extension=php_gd2.dll in there anywhere
      (php-gd2 package was already installed when i checked in synaptic, otherwise we need to install it)
    2. Set appropriate file permissions: (Hint: Hit the "update" button on the page after you chmod, NOT the refresh button) 
      cd /var/www
      cat@cat-netbook:/var/www$
      sudo chmod 777 pshop
      cd pshop
      cat@cat-netbook:/var/www/pshop$
      1. Prestashop v.1.4 alpha 2 (aka 1.4.06):
        sudo chmod 777 config upload download tools/smarty/compile tools/smarty/cache/ sitemap.xml
        sudo chmod 777 -R img mails modules themes/prestashop/lang translations themes/prestashop/cache
      2. Prestashop v1.3.5:sudo chmod 777 config tools/smarty/compile sitemap.xml
        sudo chmod 777 -R img mails modules themes/prestashop/lang translations upload download
    3. If you want to check that your permissions are correct (and not hit bogus "503 permissions" or "you need javascript" errors):
      ls -l | grep js
      should output:
      drwxr-xr-x   5 root root   4096 2010-12-26 11:28 js
  6. Click Next to go to Step 3. Database Configuration.
    1. Create a database for our prestashop site.
      In another browser tab or window: go to http://localhost/phpmyadmin
      In the field [MySQL localhost > Create new database], type in “pshop” and hit [Create]
    2. In the tab with http://localhost/pshop/install, enter in your details
      Database Server: localhost
      Database Name: pshop
      ... your MySQL username and password (what you use to login to PHPMyAdmin] ...
      Hit [Verify Database] to make sure you entered everything correctly
    3. Pick "full" or "simple" install
  7. Click Next. Wait a few seconds (an animated bar will appear at the top of the screen)
    Step 4. Now we can visit our site @ http://localhost/pshop, yay!
    but if we visit our backend, http://localhost/pshop/admin, it will remind us to delete the install folder and rename the admin folder:
    sudo rm -r install
    sudo mv admin sekrit123
    sudo rm readme*.txt
  8. Now, login to admin @ http://localhost/pshop/sekrit123 (obviously, you should use something other than "sekrit123" for your folder)
  9. Screwed up Prestashop? No problem, just delete the folder and the database and repeat above steps again.
    1. cd /var/www/
      sudo rm -r pshop
    2. go to: http://localhost/phpmyadmin/index.php?db=pshop
      or, more flexibly, go to http://localhost/phpmyadmin and on the left-hand side click the name of the database you want to drop
    3. Click on the "Drop" tab in red. It warns you that you're DESTROYING a database, click okay (this always makes me feel like going "mwahaha!" ^^)
    4. Copy the prestashop folder you downloaded and unzipped over to /var/www again.