Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, December 19, 2013

Ubuntu: Day 7 - Hello World! with Python, Django, and Eclipse Completed

I still do not have a full grasp of Eclipse, but I finally got to start programming in Python and publishing a Python Django site. A very simple "Hello World" page but this should basically be the last major barrier to starting the web application. Although it took me about a week, I probably put in about 16 hours of reading, preparing, installing, and learning some very basic stuff including Linux so I think I did a decent job of getting started.

Ubuntu Eclipse

My experience with the install was a little disappointing. I am still not quite sure what I did wrong the first time through. It may have to do with Django not being compatible with Python 3, but the article I read was rather old. I figured it would be by now. I could probably read up on that, but this just adds more complexity to the users who just wants to get something up and running.

Microsoft Visual Studio builds practically all the starting files so that you could run the application right after creating the project. I thought it was much easier to figure out which files I had to update without watching tutorials.

Keyboard Shortcuts

I am also having issues with the keyboard shortcuts. I dislike that I have to go to the bottom window to end the virtual web server, then go back to the top to restart. I found a keyboard shortcut, CTRL+F2, that should end when debugging. I am not quite sure what it means by debugging but I couldn't find option that says to just stop whenever. I am assuming that setting is what is preventing it to work even when I tried to run in debug mode (at least I think I was from clicking on the bug button). I can change the shortcut key to other key combinations and CTRL+F2, so it is not another application has some sort of higher priority to the key binding.

Intellisense

This feature is always nice. I probably need to spend some more time familiarizing myself with libraries but there are a lot of functions that I do not think I always need to see. There's a lot of properties or functions that are surrounded by sub-scores like '__someName__' which from what I understand so far are more internal use (but technically available). I think this makes it more difficult to learn some of these classes.

There are also some nuisances in getting the intellisense to pop-up. I still need a bit more experience in how the import portion works. I am not quite sure why I have to reference a library then import a "class" or is it a library(?). Anyhow, I figure I will get more exposure to this as I program a bit more.

Conclusion

I am happy that I've gotten to this point. I do not enjoy having to learn all the little nuances just to get this up and running, but then if this was exactly like VS then I suppose there wouldn't be a need to have Eclipse. I wonder at what point when I feel comfortable to put this on my resume.

I also have noticed that for some reason when I want to type python, I sometimes type pythong instead. I am wondering if this is because it is similar to 'anything.' Anyways, I may occasionally misspell this word in my post so just know that I mean python. Hopefully my muscle memory will correct this soon.

There is at least one big obstacle that I still need to work on which is publish the website to Apache. Currently, running out of Eclipse is sufficient for hobby purposes. I definitely will not be looking into the till later in January at the earliest. I need to give my brain some time to connect a bunch of the new dots.

Wednesday, December 18, 2013

Ubuntu: Day 6 - Reinstalling Ubuntu, Python, Eclipse, Django, MySql

Spent most of day 6 reinstalling Ubuntu 13.10, then Python 3.2.3, Eclipse 4.3, and Django. I was finally was able to create a project with Django within Eclipse with Python 2.7 but not Python 3.2. I spent some time trying to get that to work but to no avail.

I've been tired the last couple days and have not progressed further in my Linux project yet. I am currently in the process of install MySql which seems to take quite some time to install. (Edited 12/19 - In the middle of the install, it requests for a password for root. For some reason this dialog box does not appear on top of the software center window. Look for the extra icon in the left tray.)

I'm not sure I'll have time tomorrow either to do some shopping and other chores before the holidays. I may have one last evening to work on something before year end. Otherwise, I'll pick this back up in January. I did start reading a book on graph databases in hopes of perhaps looking into MongoDb.



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

Saturday, December 14, 2013

Ubuntu: Day 4 & 5 - Broke Ubuntu by Uninstalling Python

Yesterday, I installed Eclipse 3.8 and PyDev.

This morning, I was trying to create a new Django project in Eclipse but kept running into an error, "Django not found." There were several sites that fixed this issue but none fixed mine. I checked that Django was indeed installed and that it was installed in Python 2.7.1. I added the Django folder to Interpreter's PYTHONPATH. None seemed to have fixed the problem.

After a couple hours of resolving the issue, I uninstalled Python and all applications dependent on Python. Of course, I did not realize how many applications were dependent on Python. I reinstalled Python in hopes that it will at least fix the problem with Eclipse (which it did not). I noticed some apps were not working properly like the Software Center, so I rebooted Linux. After I logged in, I just had a blank screen.

I am not exactly sure how to revert back, so I am considering to reinstall Ubuntu. I could use more practice in the installing applications. There were also some questions whether Python was installed in a virtual environment which I was not sure if mine was or not. I do not believe so as I did not install any virtual machines, but perhaps Python has its own method of installing in a contained environment? This is all new so I am only speculating.

Worse comes to worse, I could just start developing a Java application.

Ubuntu: Day 3 - Crashes, Django, Apache

Continuing to watch videos. Ubuntu appears to crash whenever I leave the videos on overnight. This was the second night that this has happened. After the first night, I was able to use the mouse and click on other windows but was unable to type anything in. Also, I could not click anything on the top so I could not shutdown or restart. I was able to close windows and open whatever was in the left panel. After the second night, I had left the youtube video on full screen. I was not able to click on anything at this point although the mouse moved. Clicked on videos, replay button, full screen button, and keyboard shortcuts do not seem to do anything. Both times I had to hard reboot. Everything seems to function after rebooting.

Yesterday, I installed Apache while I was watching videos on Python. I came across Google's Python 2 day class which I thought was very informative while I was cooking. The day 2 part 1 on regular expression was worth skipping. It was more on RE than on python programming. If you are watching for RE, it may be worth it. I did hear much of it as I was washing dishes while that section played. Afterwards, I tried to find some more tutorials and came across Django.

Django seems interesting. It is a web application framework. So far it seems analogous to ASP.NET for C# (and other .NET languages). I am hoping to get some time to install and actually start playing around with all the different apps that I've installed.

Friday, December 13, 2013

Ubuntu: Day 2 - MySql, Python, Keyboard Only XP

Keyboard Only

Since I am working off a pc mounted to my friend's tv and didn't have access to a mouse, I tried to navigate around with just a keyboard. I was able to get around quite a bit with just the keyboard. Linux has a bunch more keyboard shortcuts which I learned quite easily, although some of them I have to consciously think about because the key patterns are different from windows.

For example, navigating webpages uses the alt plus arrow keys. You'll see me just hacking away at the backspace like your standard ID10T. Also does not help that my friend's keyboard also has foreign keys so the layout is just slightly different enough to mess with my fingers. There is an extra key between alt and space. I learned that I find the alt key by referencing the space key. Also the right shift is much smaller to fit in the up arrow which is probably the most frustrating lesson for my fingers to learn.

What I found most interesting was navigating YouTube. I cannot find a way to get the "cursor" to activate on the video. So, I cannot rewind, fastforward, stop, full-screen, and worst of all skip super long commercials. Fortunately, the video auto-starts because if it didn't I'd be stuck for a while. I was using YouTube to test the video because there is quite a bit of lag with the TV.

Disabling Screen Saver or Monitor Power Off

While watching some of the tutorials, the TV would turn off after 5 minutes of inactivity. So whenever I forgot to press a button or doing some chores while watching, the TV would just turn off. Because I am such a sucker for punishment, I wanted to just figure this out without looking online. The more I couldn't find it, the more I didn't want to look it up. I looked under power, monitor display, and even the TV menu (thinking perhaps there is off-chance that it was the TV... although it was obvious since it would say that it loses data connection). But seriously... who would look under brightness and lock? 

Installing Applications

My Ubuntu life became much easier when I familiarized myself with the Ubuntu Software Center. It works similar to the Google store. And works quite while with just the keyboard.

The first app was Chromium. A nice small lightweight application to test out the install process. I found that this is much easier tool for first-time users. After getting the hang of Linux a bit, I can see how the command prompt could be slightly faster once someone is familiar with it.

Next, I installed MySQL. I find it interesting that I say "my-S-Q-L" for MySQL when I use "sequel" for SQL. I wish I kind of knew why I do that. Anyways...

At first, I thought Linux crashed because it stayed at the same point in the install for a very long time. I am still quite not sure what happened. The PC is somewhat slow but it took a few hours. Fortunately, I was doing chores so I didn't just sit there the whole time.

After that, I installed the MySQL Workbench which appeared to be an developer environment somewhat similar to Microsoft's Management Studio. This time it installed at a much more normal rate that I expected.

I watched a couple quick tutorial while it downloaded and installed. It has some functionality similar to Management Studio like the ability to create tables and databases, but very different overall. The naming schema is not the same. The structure of schema, database, and tables are not exactly the same, but not difficult to learn.

Python

My friend was talking about how he had to learn Python to use a certain library that did what the manager needed. So, I (being the easily distracted person that I am) started to look into Python. Python is already installed in Ubuntu so that part is super easy.

You can start writing commands write in the terminal and see results of what happens. It being a scripting language and with the interpreter engine, there is no need to build a project and compile to see something happen. This is very similar to VBScript and JavaScript but even easier.

I stumbled across a tutorial on string manipulation, and I was impressed to how easy it was to manipulate a string variable. Very intuitive, simple, and still elegant to read even for someone that hasn't even written Python code before. In C# or Java, it would still be quite a bit more verbose to do the same functionality. Of course, Python may not be as perfectly efficient in execution in the highest tier of efficiency but most applications and developers do not have to think at that level anymore. I could even argue that traditional languages could be inefficient if designed incorrectly.

Conclusions

I still have a long ways to go. For some reason, work has been very busy so I have not been able to put as much time and energy into getting my Linux project going. But I have been able to put a couple hours into it so far. I hope I can at least have a simple web application up and running by next week.

Wednesday, December 11, 2013

Ubuntu: Terminal Basics

I think this is rather self-explanatory with Windows command prompt experience.

pwd - displays your current directory [cd]
ls - list files [dir]
cd - change directory [cd]
clear - clear terminal screen, clear buffer [cls]
mkdir - create a directory
cp - copy file [copy]
mv - move file [move]

~ - home directory
/ - root directory


home directory - this is equivalent to Window's user directory
root directory - this is the base directory, the closest equivalent would be like Window's C drive but not exactly.

Work Life: Ubuntu - First Impression

I finally got around to installing Ubuntu. I have never really used Linux although I did have some exposure over a decade ago. Unfortunately, I installed the server version so there was absolutely nothing there except for the terminal. The only command that I knew how to use was [ls] which just provides me the list of directories and files.

A friend then work his magic while I tried to follow what he was doing. Eventually ended up with a gui interface (I think it was called X Windows) with nothing there. He then just recommended to use the GUI version of Ubuntu.

Since he's out, I tried to play around with the flash drive and found that I could run Ubuntu right off the drive. This was much easier to use with the interface. It is much easier to navigate directories and open files which are very similar to Windows. I was able to open Firefox and watch YouTube videos on Linux tutorials.

I started by searching for how to install files from Ubuntu although I kind of figured how to do so in the terminal. From the GUI, I would just get a folder-like directory when I clicked on the files that I downloaded. I also did not know what the difference was between YUM and RPM. So... I have much to learn.

One minor thing that I have to get used to is that the icons to close, minimum, maximize, etc. are on the top left corner. Also what takes me a while to adjust is that the icons do not appear in max size unless the mouse hovers in the upper regions of the screen. This seems to throw me off for some reason.

In conclusion, I was not able to do much with my working knowledge of Windows except to navigate the directories and configure the wireless. My goal was try to get to installing a web server and database, so there may be other basic functions that I could figure out for regular use.