Monday, March 26, 2012

VirtualBox and The Pesky Shared Folder

VirtualBox and Shared Folders

What I learned: if you want full access to your shared folder on VirtualBox, do manual mounts.


System:
Host: Mac OSX 10.7 (a.k.a. "Lion")
Guest: Ubuntu 11.10 (a.k.a. "Oneiric Ocelot")
VirtualBox version: 4.1.10 r76795
VirtualBox Guest Addition version: 4.1.10
Shared Folder name: ~/sharedfolder

Case:
I need to rebuild a database in the guest OS. The database dump is stored in the shared folder (due to limited space in my .vdi), and I need to use it to rebuild the database.

Issue:
I used the command:
~$ sudo su postgres -c "psql -d < path-to-shared-folder/database.pgdump"

Result:
after entering root password, it returned:
"Permission denied"

I checked the permission on the shared folder and the dump file. The file's permission was:
-rwxr-x---

I tried changing the permission to no avail.

Solution: manual mount!

  1. Create a new folder in your HOST system. e.g. ~/sharedfolder
  2. Add the folder to your VirtualBox Guest OS shared folder list
    1. To access the Shared Folders option: select your guest OS > Settings > Shared Folders
    2. Add your shared folder. Make sure NOT to check "Auto-mount" (it's evil). Then click "OK".
  3. Run your guest OS. The following instructions are for Ubuntu only (sorry!).
  4. In your guest OS, create the directory you want the shared folder to be mounted to. For example: /mnt/shared
  5. Open a Terminal and mount your shared folder
  6. Et voila, your file (if you have any in the shared folder) will have the following permission:
    -rwxr-xr-x 1 root root
Only after doing the manual mount, I was able to use the .pgdump file to rebuild the database. Prior to that, it's just a bunch of "Permission denied", "Wrong protocol", "file or folder not found", etc. I can't say whether or not this would work if you want to use a shared folder you already used with Auto-mount. I had to create a new folder for it to work. Let me know if you had a different experience/luck. Signing off...

Tuesday, March 6, 2012

iPadHD = iP+ADHD

The new iPad will be called iPadHD:
i - P - Attention Deficit Hyperactivity Disorder (ADHD)

What is ADHD?

Tuesday, November 8, 2011

VirtualBox Shared Folder (Mac OS X 10.6)

I believe it's generally a good idea to set up a shared folder if you're doing virtual machines (VM's) like VirtualBox.  Particularly:

  • If you have limited disk space (like me), you'd want to make your virtual disk fixed-sized. But at the same time, you recognize you may do a lot of work with your VM, so you want some way to store your data without quickly hitting the capacity of your virtual disk.
  • You may have some files you'll be working on both in your VM OS, and your host/main OS. So you need a way to transfer/access the files between the two OS'es.
Here are the steps to set up your shared folder for VirtualBox (version 4.1.4 as of this writing) with Mac OS X 10.6 as host, with Xubuntu 11.10 in the VM:
  1. Launch VirtualBox - don't run your VM yet.
  2. Select the VM you want to add your shared folder to.
    1. Go to Settings > Shared Folder
    2. You should only see "Machine Folder" in the list box if your VM is off. If you see "Transient Folder" in the list, that means your VM is running. Turn it off.
    3. To the right of the list box, click on the Folder-with-Plus-Sign icon to add the folder.
    4. Select the folder you want to use as your shared folder (create one if you like/necessary). For example, name the folder: "SharedFolder" (creative, I know). Check the Auto-mount option.
    5. Accept, OK, and close the Settings window.
  3. Run your VM.
  4. Log in. (You can skip step 5 and go to step 6 - I'm just showing that the Shared Folder is not yet accessible at this point)
  5. Open the File Browser/Explorer and try to access the shared folder at: /media/sfSharedFolder. You will get a "Permission denied" error. Don't panic - follow the next step.
  6. Open a Terminal window.
  7. Add yourself to the group: vboxsf.  E.g.
    ~$ usermod -g vboxsf
    You might need to become root before you can do it:
    ~$ sudo usermod -g vboxsf
  8. Check that the group vboxsf has been added to your group list:
    ~$ groups
  9. Now this is important: Log out, then log back in. You won't be able to access the shared folder if you don't.
  10. After you log in, you should now be able to access your shared folder (/media/sfSharedFolder) without the "Permission Denied" error.
Hope that helps.
 

Sunday, November 6, 2011

The Ten Virgin Brides

It's a glorious foggy morning
This morning, the Gospel reading is on Jesus' parable of the ten virgin brides; five wise, and five foolish.

'Then the kingdom of Heaven will be like this: Ten wedding attendants took their lamps and went to meet the bridegroom.
2 Five of them were foolish and five were sensible:
3 the foolish ones, though they took their lamps, took no oil with them,
4 whereas the sensible ones took flasks of oil as well as their lamps.
5 The bridegroom was late, and they all grew drowsy and fell asleep.
6 But at midnight there was a cry, "Look! The bridegroom! Go out and meet him."
7 Then all those wedding attendants woke up and trimmed their lamps,
8 and the foolish ones said to the sensible ones, "Give us some of your oil: our lamps are going out."
9 But they replied, "There may not be enough for us and for you; you had better go to those who sell it and buy some for yourselves."
10 They had gone off to buy it when the bridegroom arrived. Those who were ready went in with him to the wedding hall and the door was closed.
11 The other attendants arrived later. "Lord, Lord," they said, "open the door for us."
12 But he replied, "In truth I tell you, I do not know you."
13 So stay awake, because you do not know either the day or the hour.
(Source: http://catholic.org/ Matthew 25:1-13 for November 6, 2011)

It looks like in this version, they changed the original "virgins" to "wedding attendants" - whatever. This is one of Jesus' parables that seemingly have a darker side to the story, but one have to keep in mind that: a) the context (time and place) where these things make sense, and b) Jesus used a parable to make a point, and only one point. So, don't get caught up in the details and missing the whole picture. The following points are based on Fr. Ignatius' homily (the presider for today's mass) and what I understood from it.

First interesting point: there were ten virgins. Why would a bridegroom have ten virgins? What kind of bridegroom is this? Well, this is a parable; Jesus often illustrates the relationship between God and mankind as to be as intimate as the relationship between a bride and bridegroom. And in those times, marriage ceremonies are big events that lasts for days - it is supposed to be a big, joyful occasion. Hence, the relationship between God and mankind is to be like one in a marriage: through good times, and bad times. The number of virgins? Doesn't matter.

Second point: did you notice how selfish the wise virgins are? Those bastards won't share their oil and help their poor, oil-less companions. Are they really companions? Well, if you put it in the context of the coming of the bridegroom as the end of times, the 'oil' is your 'good deeds' that you did in your life. 'Being prepared' then means doing good deeds as you prepare for the end of times. If good deeds are your Trophies (for those of you PS3 gamers) or Achievements, how are you to share those with others who don't have any when it's time to tally? You can't. So the issue of selfishness is irrelevant for this parable.

Third point: when the 'foolish five' came late to the wedding, the bridegroom denied them by saying he did not know them. How dare he! Well, I don't have a good explanation for this one. But if you think about it, how late did they come? What if the main part of the ceremony already passed? In a sense, it's kind of disrespectful to the bridegroom, the guests, and the ceremony itself.

Lastly, all ten virgins fell asleep and none of them knows when the bridegroom is coming. In those days, the bridegroom need to make preparations for the wedding with the parents of the bride before coming for the bride. This process can be quick, or it can take a while. Thus, the bride is just left waiting until it is done, but not knowing when it will be done. The point is: both the wise and foolish virgins all fell asleep - waiting. Same thing: none of us know when the Second Coming (if you believe in that term) or the end of times is. I frankly would rather not knowing anyway. Whatever - just. be. prepared. THIS is the main point of the parable.

I thought it was an interesting parable. At first it sounds like it has a bunch of darker twists to it, but once you look closer, the twists are not the point Jesus was trying to make. And it's very easy for us to focus on the twists and missing the whole point of the parable - and believe me, the Evil One is masterfully tricky and will use it to his advantage.
Mass at St. Michael the Archangel Church, Portland, OR
Study/Research
Made a bunch of progress this week. Brzozowski's original Derivatives of Regular Expression paper was actually difficult to comprehend! Luckily my adviser had written a paper that gives the gist of it with examples. So it makes sense now.

In another news, made a lot of progress with Lisp programming. Made a Breadth-First Search and Depth-First Search program, and learned how to use structs (defstruct ...), which is useful in programming the A* search, and a bunch of other Lisp functions. Next up: either a program for Brzozowski's method or some sort, fuzzy logic, genetic algorithm, genetic programming, and maybe neural nets if I have time.

But first, I need to get a mobile platform for my robot. Maybe getting one of these:

(Source: Stingray Chassis Kit)
Now this is FASCINATING. The idea of a structure that is not random, but does not have a repeating pattern. Who knew that this property is what makes a sonar ping works best?! At this point I can't explain this very well, but I am going to use this for my research for using patterns and other properties in music to change the behaviors/movements of a robot.



I'm going to have to research this more, and I think it's going to be awesome.

Sunday, October 30, 2011

The Patron Saint of the Internets

There is none. We need to find one.

St. Gabriel
In the Catholic belief, we have Patron Saints for most anything: AIDS care-givers (St. Aloysius Gonzaga), accountants (St. Matthew), firefighters (St. Florian), police officers (St. Michael the Archangel), and so on (Source: www.catholic.org). Yet, although we deal and work everyday on and with the internet, it has no Patron Saint to protect it. We rely on the internet to bring us close together: our friends and families in our home country while we study abroad, our loved ones on duty overseas, our business partners, and so on. The internet enabled us to obtain information about our world like never before! The closest saint I could find was of information workers: St. Gabriel the Archangel.

Most of the images I can find on St. Gabriel portrayed him as this handsome, beautiful, long haired angel. Hence, my rendering of St. Gabriel above, as a messenger on bike (I know, I drew a lousy bike). He is delivering God's messages in that awesome satchel of his; padded Blessed Heavenly Leather that could withstand the forces of the elements, safely protecting the message inside. He is faster and better than the internet itself. He has been God's messenger since the very beginning, and I can't imagine the amount of information he has to go through and manage through the years. I think it would be appropriate if St. Gabriel the Archangel be appointed as the Patron Saint of the INTERNETS!

Friday, October 28, 2011

Tale of Two Laptops

It was the best of times, it was the worst of times...

My ThinkPad and a loaned MacBook just kicked the bucket. The two laptops died only a few weeks apart. The motherboard was fried on one, the HDD was fried on the other (hmm, fried...). Even the iPad is starting to behave weird; some apps were experiencing sluggishness - ugh! This predicament is so blah, I wish Darth Vader would Force Grip it.

In any case, I might need to get a new laptop soon - an expense I'm not looking forward to.

Research/Study
It's back to reading the Basics of Set Theory! A new robot shall rise in the near future!