This is the First of some basic articles about creating a GUI in Java. The following code is the basis of the following series of articles. I am using the Java Swing window toolkit.
import java.awt.*;
import java.swing.*;
class FirstWindow
{
public static void main(String[] args)
{
//Create Window object and set title bar text
JFrame frame = new frame("First Window");
// Set the Default operation when you close the window
// This exits the program on closing the window
// The default behavior is to HIDE_ON_CLOSE
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Now we need to Display the window
// The null argument will place the element in the center of the screen.
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
}
This is enough to display a simple window, but it will probably not have any useful size associated with it and it does not do anything.
The next step will be to add some useful widgets and eventually functionality to make the window useful.
Helpful info:
Java: Great link to Swing Examples
Tags: Java, Swing
So I was charging my Droid X and noticed that while I was connected I could not use my SD card anymore. And the camera will not take any picutures if there is no SD card present.
So I pulled down the task bar and selected “USB connection” .
Once I selected the “Charge Only” option, it was smooth sailing and my SD card was available to my phone again.
This is also the place to turn on “USB Mass storage” when you are ready to copy off those pictures.
Tags: android
So I finally moved away from the iPhone(as it turned horrible when I used the “supported” update to iOs 4 on my 3g) and have gotten myself a Droid X. This phone has been awesome(and I have only had it for 2 days).
The Google driving directions app that comes with the phone has been awesome and the unified mailbox is pretty cool. The Android market has been nice and I have perused quite a few apps so far and have been very excited as to what is out there. I was a little afraid as I had heard some less then great things but am very happy to be misinformed.
I am still on the hunt for a good messaging app that supports popup messages (like the iPhone had) and also looking for a new expense receipt tracking app.
I will be following up with some useful information about using the Android OS as I have access to two of them in the house.
I am excited to have this new toy and looking forward to the things I can do with it.
Tags: android, droid, droidx, review
A quick way to test a perl module with a new method is to use a command like the following:
$ perl -MeTechTips::IssueTracking::ClearQuest -we '$tr = eTechtips::IssueTracking::ClearQuest->new();'
This will test the new and ensure that you have the correct syntax if you do not have an easy test environment for your code, for example as I do not have a ClearQuest instance to test with.
If you are not sure of the location of where a library is being included from in Perl you can use the following command:
perl -MXML::SAX -le 'print $INC{"XML/SAX.pm"}'
This search is for the XML::SAX library and it displays the location of the SAX.pm file.
I have some scripts that were giving me the following message:
could not find ParserDetails.ini in /usr/lib/perl5/vendor_perl/5.10/XML/SAX
The way that I worked around this message was to create the ParserDetails.ini file in the /usr/lib/perl5/vendor_perl/5.10/XML/SAX directory with the following contents.
[XML::SAX::PurePerl]
http://xml.org/sax/features/namespaces = 1
Tags: perl, scripting
If you have every wanted to set certain IP addresses in your network without depending on a nameserver, you can edit the ‘hosts’ file in your operating system. This can be done to stop access to any inappropriate sites as well.
The hosts file in Windows is:
%systemroot%System32driversetchosts
This is typically in:
c:windowsSystem32driversetchosts
On linux this file is:
/etc/hosts
The common layout of the file is
<IP address> hostname [hostname]
So if would look something like this:
127.0.0.1 localhost
192.168.2.222 homeserver homeserver.mydomain.net
127.0.0.1 badlocation
Remember that these lookups happen before looking to a nameserver. So this will override any name lookup. So if you happen to do this on a laptop that you regularly use outside of your home network, make sure that you do not override an address that might be needed when you are not at home.
You will need appropriate privileges to access the file. So you may have to be root or use sudo on Linux and you may have to open an editor as administrator before opening the file on Windows.
Tags: Linux, Windows
This turns off word wrap in the vi window
:set nowrap
to enable it again:
:set wrap
Tags: editors, vi
I have a Lenovo Thinkpad T410 running Windows 7 64-bit and the touchpad stops working after about 10 minutes or so and required a reboot and removal of devices to get it to work again.
I found that if you remove the Lenovo version of the drivers and go to the Synaptics website to download them, then you can have the full functionality of the touchpad back.
Synaptics Driver Download site
Tags: fix, Hardware
There are two ways to include an external stylesheet. Using a <link> tag in the <head> section of your web page or using the @import tag in a <style> section. The @import tag can also be placed inside a CSS file to include other CSS files.
Example of an externally linked stylesheet named anyname.css
<head>
<link rel="stylesheet" type="text/css" name="anyname.css" href="url" media="all">
</head>
The name field is the filename and can be set to any path that is available to your Web Server. The media type can be specified in the link tag.
An example of a @import statement to include a CSS file:
<style>
@import('anyfile.css');
</style>
You can also specify the type of stylesheet with the @import statement:
@import('anyfile') screen;
@import('anyfile') print;
The @import statement is not understood by many older browsers, Netscape 4 ignores them completely and Internet Explorer 4 requires you to use parenthesis, even though they are optional. Luckily, there should be very few people still using these browsers and this is a useful technique to not include features that would not work in those browsers.
The @import directives must be the first items in your CSS. Even comments should not appear before these statements.
Internet Explorer versions 4-7 have the limitation that they do not like specifying the type on the @import line. I have not researched if this is the case with versions 8 and above.
Tags: CSS, html