Posts Tagged ‘linux’

Lucid Ubuntu and GDAL Latest

Tuesday, August 31st, 2010

I’m writing some software that relies on a feature of GDAL (Geospatial Data Abstraction Library) in a more recent version than the one Ubuntu Lucid currently has in their repository. As I write the software on my desktop, I found out pretty quickly that I was using an old version of one of the commands (more specifically ogr2ogr and the clipping functionality).

Thanks to this site for the initial tip, it’s pretty easy to get the latest “unstable” release of GDAL installed without having to manually compile the program from source code yourself.

If you are using Karmic or above, you can run these commands:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable

Or you can opt for the more involved version below:

In your desktop, navigate to here:
System -> Administration -> Software Sources
“Other Software” tab

Add these two items:

deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu  main
deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu  main

Where in my case, would be lucid…

You will also need to run from a terminal:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160
sudo apt-get update

If you don’t have GDAL installed, you can install it from the terminal by:

sudo apt-get install gdal-bin python-gdal

“python-gdal” being optional…

Otherwise, you can use the standard Ubuntu update program to install the newest version on your computer:
System -> Administration -> Update Manager
Run through that and you should see a new version of GDAL show up to be installed. Install those updates to get the newest version!

Speed up Netbeans in Ubuntu Linux

Saturday, August 28th, 2010

Java Netbeans is a pretty decent editor for PHP code. I use Linux Ubuntu now for my primary desktop computer, so it’s quite convenient and easy to get running.

One issue is that in default configuration the program is a bit slow feeling.

Doing a quick search I found this page:

http://performance.netbeans.org/howto/jvmswitches/

Which describes a few command line parameters that might help the IDE function faster.

I’m currently running the command “/usr/bin/netbeans -J-Xverify:none -J-Xmx384m -Dsun.java2d.opengl=true”

Basically, it removes one unnecessary verification check, adds 256mb of RAM to the default RAM pool the program can use, and attempt to use OpenGL to render the IDE. I am currently using closed-source video card drivers, so your mileage could very with that last parameter.

You can modify your default system menu link by doing this:
Right-click on the “Applications” dropdown system menu. Select the “Edit Menus” list item.
Click the Programming menu and then the Netbeans X.X icon. There will be a Properties button where you can modify the command being called. Just add the parameters you would like to try out in there.

Overall I feel a noticeable improvement in scrolling, auto-completion pop-ups, and switching between tabbed documents with the limited bit of testing I’ve done so far.

.NET MONO Which Operating System is Running?

Monday, June 28th, 2010

Do you want to execute operating system specific code (exes) in the .NET/Mono framework? I’ll go over how you can do that.

Below is part of a class I had written that can determine if Linux or Windows is running. Keep in mind that for the code to properly detect Mac OS, you will need to figure out the proper platform number and modify the code respectively.

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace namespace1
{
 static class HostOS
 {
  /// <summary>
  /// an enumerator that holds a list of possible operating systems
  /// this code can execute on
  /// </summary>
  public enum HostEnviroment
  {
   Windows,
   Linux
  }

  /// <summary>
  /// determine the operating system this program is running on
  /// </summary>
  /// <returns>the current operating system</returns>
  /// <remarks>
  /// the current choices are only linux or windows
  /// it really only checks to see if the OS is linux,
  /// otherwise, it defaults to windows
  /// if other OS are inplemented in the future, this
  /// would need to be changed
  /// </remarks>
  public static HostEnviroment determineHostEnviroment()
  {
   HostEnviroment currentHost;

   int platformNumber = (int)Environment.OSVersion.Platform;

   //determine if the host is a *nix operating system
   //these numbers take into account historic values,
   //do an internet search for details
   if ((platformNumber == 4) || (platformNumber == 6)
   || (platformNumber == 128))
   {
    //running on *nix
    currentHost = HostEnviroment.Linux;
   }
   else
   {
    //not running on *nix (this function defaults to windows)
    currentHost = HostEnviroment.Windows;
   }

   return currentHost;
  }

  //............
 }
}

I had written this class because I have been writing code that I develop on Windows, but needs to run in Linux. Ideally, I wanted it to work in both operating systems for various reasons. The program I was writing needed to call a few console applications that were operating system specific, but had versions for both Windows and Linux. Thanks to the System.Diagnostics namespace, it’s quite easy to run the OS specific code!

.NET and MONO

Sunday, April 19th, 2009

I’ve been working on a personal project with a friend for quite a while now.  To make a long story short it deals with loading/editing/saving large quantities of public geographic data. Lately we have been throwing around the idea of having our database server’s OS in Linux instead of Windows 2000.

Which brings me to the MONO project. I’ve started testing some code I wrote in C# (a console application that accesses the Internet) by using that MS Virtual PC program I setup in my previous posting with Xubuntu. While my current goal changed a bit, I’m glad to start getting some use out of it. Basically, all I needed to do was install the mono run-time libraries and I was good to go. Now keep in mind that some Linux distributions might only have older versions of MONO available by way of a package manager (or pre-install). In this case you should see if your .NET application requires something that the available version of MONO does not have by visiting the mono project website. Otherwise you need install MONO from source (search google for a tutorial, I’ve seen at least one).

I have had one issue so far in how I wrote my application. File paths are of course difference between Windows and Linux. The issue that I’m looking into has to deal with the path separators \ and /. I currently have the program hard coded to take a path specified and append a \ between that and a filename. In linux this doesn’t work properly, so the path and filename are a bit screwed up. More specifically if I specify /home/username/Desktop, the program will save into /home/username with a filename of /Desktop-filename.ext… I’ll update this or make a new posting once I figure out how to fix that.

EDIT: This page on the mono site details about path separators.
“To write portable software, you must make sure that you use the System.IO.Path.DirectorySeparatorChar (System.IO.Path.DirectorySeparatorChar) character when you must concatenate paths, or even better, use the System.IO.Path.Combine (System.IO.Path.Combine(string,string)) method to combine pathnames.”

All that being said, I noticed on go-mono.com that they offer a VMWare file that has the latest version of MONO pre-installed on OpenSUSE Linux. I’m currently in the process of downloading the ISO and the VMWare Player and will see if it is any better than Virtual PC with Xubuntu that I’m currently using.

2nd EDIT: Started trying out VMWare and the MONO SUSE Linux image. It’s much much better than Using the MS VIrtual PC program. So I suggest you go that route if you are interested in trying something similar.

3rd EDIT: Sun VirtualBox looks like a good program to use too. It’s freely available and seems to have more features than the free VMWare does.

I’m impressed with MONO so far!




The Way Of Coding



 
Scott J. Waldron Photography
Stock Photo Website
Tech Learning Site
Follow me on Twitter

Popular Article Tags

Archives

Pages