Tuesday, August 28, 2012
Windows uptime
1. Go to "Start" -> "Run".
2. Write "CMD" and press on "Enter" key.
3. Write the command "net statistics server" and press on "Enter" key.
4. The line that start with "Statistics since …" provides the time that the server was up from.
The command "net stats srv" can be use instead.
Taken from: http://support.microsoft.com/kb/555737
Other possibility: the command systeminfo
And another: net statistics workstation.
Friday, July 6, 2012
How to Initialise a static Map in Java
private static final Map<String, String> channelTypes =
new HashMap<String, String>();
static {
channelTypes.put("I", "Incremental");
channelTypes.put("N", "Instrument");
channelTypes.put("S", "Snapshot");
}
private static final Map<String, String> channelTypes =
new HashMap<String, String>() {
{
put("I", "Incremental");
put("N", "Instrument");
put("S", "Snapshot");
}
};
new HashMap<String, String>();
static {
channelTypes.put("I", "Incremental");
channelTypes.put("N", "Instrument");
channelTypes.put("S", "Snapshot");
}
private static final Map<String, String> channelTypes =
new HashMap<String, String>() {
{
put("I", "Incremental");
put("N", "Instrument");
put("S", "Snapshot");
}
};
Friday, June 29, 2012
MP3 tagging with Perl
#!/usr/bin/perl
use strict;
use warnings;
use MP3::Tag;
use File::Basename;
my $Directory = ".";
while (<$Directory/*.mp3>) {
my ($FileName) = basename($_, '.mp3');
my $Mp3 = MP3::Tag->new($_);
$Mp3->title_set($FileName);
$Mp3->artist_set('Artist');
$Mp3->album_set('Album');
$Mp3->year_set('2012');
$Mp3->update_tags();
print "Filename: $_\n";
print "Artist: " . $Mp3->artist . "\n";
print "Title: " . $Mp3->title . "\n";
print "Album: " . $Mp3->album . "\n";
print "Year: " . $Mp3->year . "\n";
print "Genre: " . $Mp3->genre . "\n";
$Mp3->close();
}
__END__
Friday, June 8, 2012
How do I add the Bloomberg Excel Add-in to Excel?
- Open Excel
- Go to Tools menu
- Select Addins, then Browse
- Select: C:\blp\API\Office Tools\BloombergUI.xla
- After selecting the add-in the Bloomberg Excel tools should appear checked in your add-ins list. Close the add-ins and the toolbar should appear.
Thursday, May 24, 2012
Five Fridays in July every 823 years == false
package pkg5fridaysinjuly;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main {
private static final int NUMBER_OF_YEARS = 823;
public static void main(String[] args) {
Calendar c = new GregorianCalendar();
int firstYear = c.get(Calendar.YEAR);
int lastYear = firstYear - NUMBER_OF_YEARS;
c.set(firstYear, Calendar.JULY, 1);
System.out.println("Initial: " + firstYear);
System.out.println("Last: " + lastYear);
for (int y = firstYear; y >= lastYear; y--) {
c.set(y, Calendar.JULY, 1);
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
System.out.println(y + " Found!");
}
}
}
}
Wednesday, April 25, 2012
Configuring Logging in Glassfish
Calls to System.out.println are logged at the INFO level using the logger name javax.enterprise.system.stream.out. Calls to System.err.println are logged at the WARNING level using the logger name javax.enterprise.system.stream.err. To turn off the logs from these sources, specify the logger name with the value OFF in the Additional Properties area.
Friday, April 20, 2012
The World's Greatest Solvable Problem
The price tag for solving hunger is also less than you may realise:
- US $10: the costs to feed a boy in a Kenya refugee camp for 3 weeks, less than the cost of a lipstick bought in Manhattan
- US $50: the cost to feed a schoolgirl for one year, roughly the same price for an iPod shuffle
Taken from freerice.com site.
Subscribe to:
Posts (Atom)