Today, I stumbled upon this. It's amusing to say the least; at first i took it seriously but then it clicked, that this was possibly an April fools joke. My suspicions were proven to be true when i took a hex editor to String's bytecode, just to see for myself. I'd just like to say, an April Fool's joke done well Christian!
I cannot talk April Fool's without talking about Google. They have the most creative minds behind them, so it's not shocking they have some pretty imaginative April fool's jokes!
Tuesday, April 1, 2008
Tuesday, March 25, 2008
Summer of code 2008: what will you be doing?
As posted earlier that OpenMRS is participating in Google Summer of Code as a mentoring open source project. Working with OpenMRS will be highly rewarding knowing that you are single-handedly affecting the lives of people in developing nations ravaged by HIV/AIDS. If you are a student (undergaduate/graduate) you are eligible! So go apply for summer of code with OpenMRS! Student applications opened up yesterday and will be accepted up until Monday, March 31st 2008.
Stop by #openmrs on
Stop by #openmrs on
irc.freenode.org for more information -- ask for docpaul or burke.
Monday, March 24, 2008
Update: weird properties bug in the prototype
Okay, I sent an email to the kijaro mailing list and apparently the runtime library only has support for read-write properties. Which does indeed explain the bugs I was experiencing.
The respone:
The respone:
Hi robby, thanks for testing, i will incoporate test cases based on your examples
in the test suite.
Currently properties is in a weird state between version 3 and unpublished version 4
of the spec. I've done major design changes. I have rewrittent the runtime support,
drop the writeonly properties from the spec, etc.
Currently the runtime library (java.lang.Property and helper classes)
only support read-write property, i think it explain these bugs.
Expanding on Properties
It it worth nothing that in groovy, properties already exist. let's give an example:
Groovy basically generates the getters/setters behind the scenes, but in essence these are for all intensive purposes -- properties. I felt that this needed to be addressed.
class Book {
String title;
}
def gina = new Book();
gina.title = "Groovy In Action";
println gina.title;
Groovy basically generates the getters/setters behind the scenes, but in essence these are for all intensive purposes -- properties. I felt that this needed to be addressed.
Sunday, March 23, 2008
Java gets some Properties.
There is a proposal to add properties to java. Properties will eliminate the need for getters/setters in the usual javabeans pattern style. I'm sure you wanna see some code examples, so as usual, i'll give you the way it's done currently, in this case following the JavaBeans spec of specifying a getter/setter. To run this code you'll need to go and check out the prototype compiler from the subversion repository at java.net. You will need to register. After you have done that type:
Apache Ant is required to build the compiler.
Now to compile it (instructions are for users running linux;
if running windows i assume you know your OS properly to adjust this).
1) type
2) type
3) now to compile the code you'll do /path/to/kijaro/bin/kijaro-javac /path/to/ClassName.java setting your classpath as needed.
4) To run this, you can either use /path/to/kijaro/bin/kijaro-java /path/to/ClassName or you can use your installed JRE and do: java /path/to/ClassName
That's all you need to know to run this code. Questions? email me.
The getters/setters are boiler-plate code that just isn't necessary. Most IDEs will generate getters/setters for you with the click of a mouse; but still it makes your code verbose. Now I wrote three examples for properties, since there are three types: read-only,read-write and write-only. Each example showcases just one of those types for reasons of simplicity. First, I'll tackle the example of a read-only property.
Already, you can see that we've removed a great deal; and it's not that as verbose as the JavaBean example. Now let's see what happens if I try and write to the property? It's a compile-time error; or at least it should be. As of the latest prototype compiler, it didn't complain and happily let me write to the property. Now let's see a properties example that behaves properly as defined by the spec.
Okay, this is a read-write property; note that
Okay, now that you've gotten a taste of what's to come (if this makes it passed the JCP that is!) go out and play!
svn checkout https://kijaro.dev.java.net/svn/kijaro/branches/properties kijaro --username username --password yourpassword replace username and yourpassword with the username and password you registered with. Apache Ant is required to build the compiler.
Now to compile it (instructions are for users running linux;
if running windows i assume you know your OS properly to adjust this).
1) type
cd kijaro/langtools/make2) type
ant -Dboot.java.home=$JAVA_HOME3) now to compile the code you'll do /path/to/kijaro/bin/kijaro-javac /path/to/ClassName.java setting your classpath as needed.
4) To run this, you can either use /path/to/kijaro/bin/kijaro-java /path/to/ClassName or you can use your installed JRE and do: java /path/to/ClassName
That's all you need to know to run this code. Questions? email me.
/**
* Created: Mar 23, 2008 9:13:54 PM
*
* @author Robert O'Connor
*/
public class BeanExample {
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public static void main(String[] args) {
BeanExample example = new BeanExample();
example.setUserName("rob");
System.out.println(example.getUserName());
}
}
The getters/setters are boiler-plate code that just isn't necessary. Most IDEs will generate getters/setters for you with the click of a mouse; but still it makes your code verbose. Now I wrote three examples for properties, since there are three types: read-only,read-write and write-only. Each example showcases just one of those types for reasons of simplicity. First, I'll tackle the example of a read-only property.
/**
* Created: Mar 22, 2008 5:37:41 PM
*
* @author Robert O'Connor
*/
public class ReadOnlyPropertiesExample {
private String userName;
public property String name get { return userName; };
public ReadOnlyPropertiesExample() {
this.userName = "rob";
}
public static void main(String[] args) {
System.out.println(new ReadOnlyPropertiesExample().userName);
}
}
Already, you can see that we've removed a great deal; and it's not that as verbose as the JavaBean example. Now let's see what happens if I try and write to the property? It's a compile-time error; or at least it should be. As of the latest prototype compiler, it didn't complain and happily let me write to the property. Now let's see a properties example that behaves properly as defined by the spec.
/**
* Created: Mar 23, 2008 8:11:41 PM
*
* @author Robert O'Connor
*/
public class ReadWritePropertiesExample {
private String userName;
public property String name
get { return userName; }
set(String name) { userName = name; };
public static void main(String[] args) {
ReadWritePropertiesExample example = new ReadWritePropertiesExample();
example.userName = "rob"; // set the name
System.out.println(example.userName); // output it.
example.userName = "robby"; // set it to something different
System.out.println(example.userName); // output the new value
}
}
Okay, this is a read-write property; note that
example.userName is NOT using direct field access. The final example is a write-only example; note that it is a compile-time error to attempt to retrieve the value; however the compiler currently let's you do it; which in my opinion is bad. I coded against the spec, so to circumvent that, I defined a getter (I know properties are supposed to eliminate those, but I needed a way to test that the value was set properly.)
/**
* Created: Mar 23, 2008 8:45:02 PM
*
* @author Robert O'Connor
*/
public class WriteOnlyPropertiesExample {
private String userName;
public property String name set;
/**
* this is used purely to check that the property set the field's value properly.
* @return the username
*/
public String getUserName() {
return userName;
}
public static void main(String[] args) {
WriteOnlyPropertiesExample example = new WriteOnlyPropertiesExample();
example.userName = "rob"; // we can only *SET* it since it's write-only
System.out.println(example.getUserName());
example.userName = "robby";
System.out.println(example.getUserName());
}
}
Okay, now that you've gotten a taste of what's to come (if this makes it passed the JCP that is!) go out and play!
Saturday, March 22, 2008
Futurama fans: Listen up
There's a nifty unix command you can enter to get random futurama quotes:
Okay, so how does it work? Let's look at what
Pretty neat eh?
Now, what it does is it looks for lines that start with "X-" and contain F or B after the "X-"; thus bringing up Fry or Bender quotes only :).
curl -Is slashdot.org | egrep '^X-(F|B)' | cut -d \- -f 2
Okay, so how does it work? Let's look at what
curl -Is slashdot.org returns:
HTTP/1.1 200 OK
Date: Sun, 23 Mar 2008 01:04:28 GMT
Server: Apache/1.3.37 (Unix) mod_perl/1.29
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005000198
X-Leela: I'm a millionaire! Suddenly I have an opinion about the capital gains tax.
Cache-Control: private
Pragma: private
Vary: User-Agent,Accept-Encoding
Connection: close
Content-Type: text/html; charset=iso-8859-1
Pretty neat eh?
Now, what it does is it looks for lines that start with "X-" and contain F or B after the "X-"; thus bringing up Fry or Bender quotes only :).
Wanna make some money while making a difference?
Hey guys,
OpenMRS is an open source medical records system that is used in many third-world developing countries where HIV/AIDS is an epidemic. Now here's where you can make a difference: They are participating in Google Summer of Code. You can make $4500 this summer while making a difference in the lives of people ravaged by the HIV/AIDS epidemic in developing third-world countries. Here's how it works: at the beginning you will get $500; after the mid-term evalations you will get $2000; at the end you will get the final $2000. Check out the projects you could potentially work on! For an overview click here.
Apply here.
Drop by #openmrs on irc.freenode.org for more information. Ask for docpaul, burke or bwolfe
OpenMRS is an open source medical records system that is used in many third-world developing countries where HIV/AIDS is an epidemic. Now here's where you can make a difference: They are participating in Google Summer of Code. You can make $4500 this summer while making a difference in the lives of people ravaged by the HIV/AIDS epidemic in developing third-world countries. Here's how it works: at the beginning you will get $500; after the mid-term evalations you will get $2000; at the end you will get the final $2000. Check out the projects you could potentially work on! For an overview click here.
Apply here.
Drop by #openmrs on irc.freenode.org for more information. Ask for docpaul, burke or bwolfe
Subscribe to:
Posts (Atom)