Sometimes copying code from webpage to vim can be painful. You might end up loosing all the newlines. So I prefer to copy (from webpages) using html source. If you use html source, you will have to replace >, < .. and lot more to <,> and stuff.
The following will do it automatically for you.
:%!perl -pne 'use HTML::Entities; $_=decode_entities($_)'
Thanks to godlygeek from #vim .
Thursday, May 15, 2008
Friday, November 23, 2007
Wifi at Changi Airport
I just checked out the free internet terminals in Changi Airport. Few of them run secured version of Internet Explorer. I was also able to use "Wireless@SG", the free island wide wireless at Changi. The speed was amazing. I had to download JavaDoc for JDK 1.5. It completed in 12 minutes. If you are not aware, JavaDoc for JDK 1.5 is 150MB.
IT Security Awareness Day 2007 at Singapore Poly
I gave a talk on WebSecurity at Singapore Poly at the IT Security Awareness Day Event. Around 300 students attended the event, and most of them were school kids. I mostly spoke about Johnny's Google Hacking Database, and little bit about XSS. Justin Lister from InterSect Singapore also spoke at the event. He organized a simple game to explain Phishing. Thanks to Samson, and Cecil for organizing the event.
Labels:
geeks,
Singapore,
talk,
WebSecurity
Sunday, November 18, 2007
Lunch with David Axmark, Co-founder of MySQL
David Axmark, the Co-founder of MySQL was in Singapore today. The local MySQL interest group meet along with David at GeekTerminal for lunch. David patiently answered variety of questions relating to BitKeeper, GIT, SpikeSource's testing framework , Enterprise version of MySQL, SQLite, India, SQL Injection, etc. Thanks to Wong for organizing the event.
Saturday, November 17, 2007
UandMe
Social networking has grown a big way. FaceBook has taken social networking to a different level. UandMe is a mobile social networking application build by Locatrix. UandMe goes one step further, by integrating with GPS. With UandMe, you can know where your friend is, find a near by restaurant to meet with your friend, create alerts for various events, etc. Location based advertisement is also possible when you integrate with GPS. I guess UandMe will change the way people meet, dine, work etc. I was privileged to meet with Mark White, the founder of Locatrix. He was also kind enough to demonstrate UandMe.
Security Related Groups in Singapore
1) LinkedIn Group for OWASP
2) OWASP-Singapore mailing list
3) Security Meetup - Singapore == Next meeting on 13th Dec 2007.
2) OWASP-Singapore mailing list
3) Security Meetup - Singapore == Next meeting on 13th Dec 2007.
Labels:
geeks,
Singapore,
WebSecurity
Thursday, November 15, 2007
OWASP Meeting at GeekTerminal Singapore
Two days back, I attended the second OWASP-Singapore (Open Web Application Security Project) meeting at Geek Terminal. Six people turned out and we had three different presentations. Michael Boman spoke about "Overcoming USB (In) Security". He also demonstrated Lock Picking. Wong from Resolve spoke about ILDP Strategies. Later we discussed about MMORPG hacking. We discussed about SecondLife hacking, gaming client hacking, gaming logic exploitation, etc . We also discussed about developing a framework to test and prevent Game Hacking. Later we discussed about websecurity. The whole meeting went for around 3 hours. I wish more people join.
Labels:
geeks,
Singapore,
WebSecurity
Tuesday, November 13, 2007
Singleton Vs Static
Singleton, MVC and Factory patterns are the design patterns I use very often. I also use static classes, more often than Singleton, but static classes are not design patterns. For every implementation of Singleton, one can come out with an alternate implementation with static classes. Lot of critics argue that Singleton is not the right way to program, and it is an anti-pattern. Singleton patterns can be considered as substitutions for global variables, and they are most useful when you want to use the same instance all over your program. Using one object ( say of type Class A) to manage instances of a different class (say Class B) , and providing all functionalities using the objects of Class B is obviously a better coding practice. This is a better replacement of Singleton pattern, compared with static classes. Here is an interesting discussing I'd with Cybereal at #java@irc.freenode.net. Cybereal explains why Singleton is a bad wrt to dependency injection.
(12:03:11 AM) codeshepherd: cybereal .. Aren't Singleton the best suitable implementations for Database connection pooling ?
(12:03:43 AM) codeshepherd: In a more general way... Singletons are best suitable to manager global variables..
(12:03:53 AM) cybereal: singletons *ARE* global variables, basically
(12:03:56 AM) cybereal: and that's why they are bad
(12:04:24 AM) cybereal: codeshepherd: you shouldn't need to use a singleton to use the same resource across a program
(12:04:50 AM) cybereal: but because people are lazy about typing and passing on dependency information to instantiated objects, you find they will lean towards singletons to do little more than save some keystrokes
(12:05:01 AM) cybereal: It's really hard to justify it for any other reason
(12:05:41 AM) cybereal: codeshepherd: despite being an anti-pattern, it does get used frequently so you'll still need to know how to deal with it, and sometimes to work around them
(12:06:02 AM) cybereal: at least in java if you really need to you can bury a singleton in a separate classloader instance
(12:06:13 AM) codeshepherd: So how will you implement a Database connection pool? Just a static class ?
(12:06:30 AM) cybereal: no, a regular class that you pass around to all the new instances of other classes that need to know about it
(12:06:44 AM) cybereal: like handing out invitations to a party
(12:06:58 AM) cybereal: you don't hand out houses with those invitations, and people aren't expected to figure out the address themselves
(12:07:06 AM) codeshepherd: then.. some dumb guy who comes tomorrow will start creating instances of the regular class..
(12:07:13 AM) cybereal: it won't matter
(12:07:24 AM) cybereal: but even so, if he's dumb he's gonna do dumb things :)
(12:07:34 AM) cybereal: you shouldn't write bad code just to try and protect from dumb coders
(12:07:54 AM) cybereal: but the point is you should be able to have more than one in the same vm, and not have them hurt each other
(12:07:56 AM) codeshepherd: It is really a debatable issue..
(12:08:54 AM) cybereal: codeshepherd: you probably won't really see it this way until it eventually comes back to bite you in the ass as it has me :)
(12:09:08 AM) codeshepherd: I still agree with the fact that.. you let one class (A) provide all functions.. and another class manage instances of Class A.. .. that looks more clean..
(12:09:33 AM) cybereal: you're making a mistake of thinking a class should ever be in charge of anything
(12:09:37 AM) cybereal: INSTANCES of classes should
(12:09:43 AM) cybereal: classes are blue prints
(12:09:54 AM) codeshepherd: hmm.. ok....
cybereal cybereal
(12:10:19 AM) codeshepherd: interesting argument.. thanks a lot cybereal
(12:10:28 AM) cybereal: nothing stops you, as I already described, from sharing a single instance of a class across your whole app
(12:10:50 AM) cybereal: you get what you want from a singleton without the limiting factors, and all it takes is a little longer parameter list in constructors :)
(12:11:18 AM) codeshepherd: ok.. I guess I will realize it better when it bites me back..
(12:11:24 AM) cybereal: hehe ok
(12:03:11 AM) codeshepherd: cybereal .. Aren't Singleton the best suitable implementations for Database connection pooling ?
(12:03:43 AM) codeshepherd: In a more general way... Singletons are best suitable to manager global variables..
(12:03:53 AM) cybereal: singletons *ARE* global variables, basically
(12:03:56 AM) cybereal: and that's why they are bad
(12:04:24 AM) cybereal: codeshepherd: you shouldn't need to use a singleton to use the same resource across a program
(12:04:50 AM) cybereal: but because people are lazy about typing and passing on dependency information to instantiated objects, you find they will lean towards singletons to do little more than save some keystrokes
(12:05:01 AM) cybereal: It's really hard to justify it for any other reason
(12:05:41 AM) cybereal: codeshepherd: despite being an anti-pattern, it does get used frequently so you'll still need to know how to deal with it, and sometimes to work around them
(12:06:02 AM) cybereal: at least in java if you really need to you can bury a singleton in a separate classloader instance
(12:06:13 AM) codeshepherd: So how will you implement a Database connection pool? Just a static class ?
(12:06:30 AM) cybereal: no, a regular class that you pass around to all the new instances of other classes that need to know about it
(12:06:44 AM) cybereal: like handing out invitations to a party
(12:06:58 AM) cybereal: you don't hand out houses with those invitations, and people aren't expected to figure out the address themselves
(12:07:06 AM) codeshepherd: then.. some dumb guy who comes tomorrow will start creating instances of the regular class..
(12:07:13 AM) cybereal: it won't matter
(12:07:24 AM) cybereal: but even so, if he's dumb he's gonna do dumb things :)
(12:07:34 AM) cybereal: you shouldn't write bad code just to try and protect from dumb coders
(12:07:54 AM) cybereal: but the point is you should be able to have more than one in the same vm, and not have them hurt each other
(12:07:56 AM) codeshepherd: It is really a debatable issue..
(12:08:54 AM) cybereal: codeshepherd: you probably won't really see it this way until it eventually comes back to bite you in the ass as it has me :)
(12:09:08 AM) codeshepherd: I still agree with the fact that.. you let one class (A) provide all functions.. and another class manage instances of Class A.. .. that looks more clean..
(12:09:33 AM) cybereal: you're making a mistake of thinking a class should ever be in charge of anything
(12:09:37 AM) cybereal: INSTANCES of classes should
(12:09:43 AM) cybereal: classes are blue prints
(12:09:54 AM) codeshepherd: hmm.. ok....
cybereal cybereal
(12:10:19 AM) codeshepherd: interesting argument.. thanks a lot cybereal
(12:10:28 AM) cybereal: nothing stops you, as I already described, from sharing a single instance of a class across your whole app
(12:10:50 AM) cybereal: you get what you want from a singleton without the limiting factors, and all it takes is a little longer parameter list in constructors :)
(12:11:18 AM) codeshepherd: ok.. I guess I will realize it better when it bites me back..
(12:11:24 AM) cybereal: hehe ok
Labels:
design patterns,
geeks,
IRC,
java
Monday, November 12, 2007
GMail's POP and SMTP service.
GMail's POP and SMTP service have been giving lot of troubles lately. Very often, I'm not able to send out mails via SMTP, and downloading new mails occurs at snails pace. Many others have reported the same problem, and I hope Google fixes it very soon. Email is an essential service, and use web interface for checking emails can be tedious if you have dozens of email accounts with a variety of service providers.
Tuesday, November 06, 2007
Red Black Tree
TreeSet is an implementation of Red-Black Tree in Java. It implements the Set and Collection interface. Here is a short yet excellent video on adding new nodes to TreeSet.
Labels:
algorithms,
datastructures,
geeks,
java,
video
Friday, November 02, 2007
Barcamp - Brisbane, Australia.
I'm planning to fly a bit early for OSDC, so that I can also attend Brisbane Barcamp. It is on Saturday, 24/11/2007. I'm planning to talk there on websecurity. I'm also looking forward to meet David Novakovic, a Computational Linguistics researcher and geek from Gold Coast. He will also speak about his new technology incubator. Click here for complete list of talk at Brisbane Barcamp. Let me know if anyone else is also planning to attend.
Design Patterns by Codingkriggs
Codingkriggs has excellent set of videos on Design Patterns. I wish he continues making videos :)
Labels:
design patterns,
geeks,
talks
Wednesday, October 31, 2007
Linus on GIT
The concept of distributed source code management system is very interesting. IMHO GIT is a much better idea compared with Subversion. GIT takes care of the social factors involved in running a open source project. Here is a talk by Linus on GIT.
Labels:
geeks,
GIT,
Subversion,
talk
Interactive Shell
Interactive Shells for some popular languages.
IPython ==> Python (supports readline)
IRB ==> Ruby (supports readline)
php -a ==> PHP
BeanShell ==> Java (interpretor for compiled language?? )
SquareFree Shell ==> JavaScript
Installing readline library should help you auto complete and browse through history.
IPython ==> Python (supports readline)
IRB ==> Ruby (supports readline)
php -a ==> PHP
BeanShell ==> Java (interpretor for compiled language?? )
SquareFree Shell ==> JavaScript
Installing readline library should help you auto complete and browse through history.
Yahoo! Pipes
I've been playing with Yahoo Pipes for a while now. Here is a Yahoo Pipe to read orkut scraps. You can choose to receive the scraps in RSS form.
Labels:
geeks,
yahoo pipes
Douglas Crockford on JavaScript
YUI Theater has excellent talks by Douglas Crockford on JavaScript. JS follows prototype based objects and supported prototyped inheritance. Douglas explains the fundamental difference between prototype based object orientation and class based object orientation.
Labels:
geeks,
JavaScript,
talk
Friday, October 26, 2007
Meta Programming with Ruby at Singapore Ruby Brigade
Choon Keat Chew gave an excellent talk on Meta Programming at the Singapore Ruby Brigade today. He explained meta programming with a logger example. Generally in Java we program to the interface and subclass existing classes to introduce new features. But in Ruby you could directly implement the new method or feature to the object and it instantly gets reflected over the entire scope of the program. It is kinda dangerous in large teams, since anyone can override existing classes and change their behavior by modifying their methods. He also discussed extensively about method_missing , *args feature in Ruby. From what I understand the method_missing function lets you avoid "method not found exception", and also generate setter/getter and other simpler functions automatically. This is one case where meta programming is explicitly visible. He also discussed about simplicity of Rake. Implementing a simple task with Rake will take a lot less time compared with Ant. We also discussed about ducktyping, design patterns and readline library in the end.
Labels:
geeks,
meta programming,
ruby,
Singapore
Wednesday, October 24, 2007
FaceBook Developer Garage
Today I attended Asia's first Facebook developer garage at NUS Staff Club. The even was extensively advertised and there were around 200 people. But most of the people were only interested in business and social networking part. There were very few developers as usual. I was late; hence I missed the video conference with F8 developers from SanFransico. For those who didn't turn up, don't worry you did not miss anything.
Comparing Programming Languages
Comparing programming languages has always been interesting. A thorough understanding of Object Orientation, Static/Dynamic/Duck typing, Functional Programming, Generics, Aspects, Closures, Design Patterns, Data Structures and Meta Programming will let a programmer hop from one language to another very easily. For example, though both Java and JavaScript are Object Oriented, Java is Class-Based whereas JavaScript is Prototype-Based. Java forces programmers to implement proper namespaces, where as JavaScript does not. Most JavaScript programmers define variables in global scope, though it is possible to organize them with namespaces. Haskell is fundamentally different from other programming languages since it uses functions as basic building blocks. Python, Perl, Ruby and PHP support Dynamic Typing, where as C, C++ and Java support Static Typing. DuckTyping is implemented in the core of Python, but not in languages like Java, though you can emulate Duck Typing in Java as well. Design patterns are suppose to be language independent, but some of them get implemented in the core of some languages. For example the Iterator pattern is implement in Java, Python etc. So we don't even realize that we are using Iterator patterns when we use Python or Java. On the other hand we manually implement Iterator patterns in C.
Java Bean Shell
Java Bean Shell is a handy tool for Java programmers to test APIs, regular expressions, and other small code snippets. In particular if you are working on Client-Server architecture, it takes long time for you to test small changes in the back end. Though Java is compiled language, the interpreter tool in BeanShell will let you interpret the code. It can be downloaded from http://www.beanshell.org/ .
Demo
The Interpreter does not support history and coloring. But the Console does. But the output from Console is thrown in the parent shell.
Demo
//to start Console
$ java -classpath ./bsh-2.0b4.jar bsh.Console
//to start Interpreter
$ java -classpath ./bsh-2.0b4.jar bsh.Interpreter
bsh % import java.io.Decoder;
bsh % String dir = "%2Fhome%2Fcodeshepherd";
bsh % System.out.println(dir);
%2Fhome%2Fcodeshepherd
bsh % System.out.println(Decoder.decode(dir));
/home/codeshepherd
The Interpreter does not support history and coloring. But the Console does. But the output from Console is thrown in the parent shell.
Monday, October 22, 2007
Open Web Application Security Project - Singapore Chapter
OWASP-Singapore meetup was held on 9th Oct at Geek Terminal in Singapore. Five of us meet and had a chat for about an hour. Geek Terminal is a nice place for geek meetups. I guess they provide laptops with wifi connection to use and they also have mini rooms with projects for conducting mini talks. I'm not sure if those laptops run Linux, would be great if it does so. Last Saturday Facebook and Slashdot community hosted a meeting there, but I could not make it . I hope we have more of these Security related meeting and Open Hack Days in and around Singapore.
Labels:
geeks,
OWASP,
Singapore,
WebSecurity
An Informal Interview With a Haskell Hacker
2:33:03 PM codeshepherd: given that haskell is a functional programming language.. what are the main differences you find when you compare haskell with other langs
2:34:10 PM rajagopal.n: modifying the system state is something that is still tricky for me to do in some cases. For instance, I was thinking I had understood Monads properly, only to understand that there is more that I didn't understand clearly, when i tried to do some database manipulation using the HSQL connectors, and print the resultsets on a webpage using HAppS.
2:34:22 PM rajagopal.n: but otherwise, if all that you want to do is lot of computation
2:34:28 PM rajagopal.n: writing Haskell code is fun
2:34:36 PM rajagopal.n: you wanna one line binary tree?
2:34:38 PM rajagopal.n: you can
2:35:05 PM rajagopal.n: you can construct all such stuff with ease, without leaving space for much bugs.
2:36:43 PM codeshepherd: function are building blocks of language.. and not objects.. so is it difficult for people from OOP background to learn haskell ?
2:40:00 PM rajagopal.n: The difficulty of learning depends on the OOP that you were using. Most people find it difficult to get used to the concept of lazy evaluation, and immutable data in Haskell, being used to languages where the statements get executed in sequence, and having been used to using variables as counters and stuff. people tend to ask in C, C++, I can do a I++ to increment the value of I. but why does haskell make these variables immutable? It takes time for them to understand that immutability is a way to facilitate lazy evaluation.
2:40:27 PM rajagopal.n: It needs forgetting some of the imperative programming concepts to start accepting the functional programming concepts
2:41:46 PM codeshepherd: Does haskell support Meta Programming ? If so how different is it from Ruby's meta programming implementation ?
2:43:51 PM rajagopal.n: Haskell supports meta programming. I've just learnt it to understand some parts of the HAppS example blog application code. As I hadn't done any meta programming in Ruby, I'm not sure about how it compares to it
2:45:08 PM codeshepherd: Does Meta programming combined with Functional programming pose special advantages ?
2:49:53 PM rajagopal.n: I'm not sure about that da.
2:50:19 PM codeshepherd: ok.
2:50:41 PM codeshepherd: Does Haskell support Duck Typing ?
2:51:06 PM rajagopal.n: ya,
you see that it makes it Num
2:51:53 PM codeshepherd: Duck Typing with functions as basic blocks is kinda difficult to understand ? Do functions act like so called ducks in duck typing ?
2:54:16 PM rajagopal.n: There is not difference in the way you see functions and data in a functional programming language
2:57:02 PM codeshepherd: Is there any reason for people to choose Haskell over other languages for hobby programming ?
3:00:49 PM rajagopal.n: Haskell is pure functional. You get to learn a lot of new things, being a pure functional language that restricts modification to the state to be done only through monads. Learning Haskell and teasing the brain is refreshing when you get bored with all those languages that mostly differs only by syntactic sugar or a few extra features.
3:01:55 PM codeshepherd: ok
2:34:10 PM rajagopal.n: modifying the system state is something that is still tricky for me to do in some cases. For instance, I was thinking I had understood Monads properly, only to understand that there is more that I didn't understand clearly, when i tried to do some database manipulation using the HSQL connectors, and print the resultsets on a webpage using HAppS.
2:34:22 PM rajagopal.n: but otherwise, if all that you want to do is lot of computation
2:34:28 PM rajagopal.n: writing Haskell code is fun
2:34:36 PM rajagopal.n: you wanna one line binary tree?
2:34:38 PM rajagopal.n: you can
2:35:05 PM rajagopal.n: you can construct all such stuff with ease, without leaving space for much bugs.
2:36:43 PM codeshepherd: function are building blocks of language.. and not objects.. so is it difficult for people from OOP background to learn haskell ?
2:40:00 PM rajagopal.n: The difficulty of learning depends on the OOP that you were using. Most people find it difficult to get used to the concept of lazy evaluation, and immutable data in Haskell, being used to languages where the statements get executed in sequence, and having been used to using variables as counters and stuff. people tend to ask in C, C++, I can do a I++ to increment the value of I. but why does haskell make these variables immutable? It takes time for them to understand that immutability is a way to facilitate lazy evaluation.
2:40:27 PM rajagopal.n: It needs forgetting some of the imperative programming concepts to start accepting the functional programming concepts
2:41:46 PM codeshepherd: Does haskell support Meta Programming ? If so how different is it from Ruby's meta programming implementation ?
2:43:51 PM rajagopal.n: Haskell supports meta programming. I've just learnt it to understand some parts of the HAppS example blog application code. As I hadn't done any meta programming in Ruby, I'm not sure about how it compares to it
2:45:08 PM codeshepherd: Does Meta programming combined with Functional programming pose special advantages ?
2:49:53 PM rajagopal.n: I'm not sure about that da.
2:50:19 PM codeshepherd: ok.
2:50:41 PM codeshepherd: Does Haskell support Duck Typing ?
2:51:06 PM rajagopal.n: ya,
Prelude> :t map
map :: (a -> b) -> [a] -> [b]
Prelude> let bar a = map (*1) a
Prelude> :t bar
bar :: (Num a) => [a] -> [a].
you see that it makes it Num
2:51:53 PM codeshepherd: Duck Typing with functions as basic blocks is kinda difficult to understand ? Do functions act like so called ducks in duck typing ?
2:54:16 PM rajagopal.n: There is not difference in the way you see functions and data in a functional programming language
2:57:02 PM codeshepherd: Is there any reason for people to choose Haskell over other languages for hobby programming ?
3:00:49 PM rajagopal.n: Haskell is pure functional. You get to learn a lot of new things, being a pure functional language that restricts modification to the state to be done only through monads. Learning Haskell and teasing the brain is refreshing when you get bored with all those languages that mostly differs only by syntactic sugar or a few extra features.
3:01:55 PM codeshepherd: ok
Labels:
duck typing,
dynamic typing,
haskell,
meta programming,
ruby,
static typing
Friday, October 19, 2007
My talk at Singapore Linux Meetup
This wednesday I gave a talk on websecurity titled "Hacking the Web" at Singapore Linux meetup. This is my first talk in Singapore and as usual I was kinda nerves. Around 35 to 40 people attended the talk and there were lot of questions from the audience. We had some technical problems initially, with internet connection. I was not able to connect to the internet from my macbook because of dhcp version mismatch. So I'd to run through the talk without internet connection and then later borrow a Windows laptop to demonstrate things on internet. The slides are hosted at http://www.codeshepherd.com/hackingtheweb/hackingtheweb.html . Thanks to Darrel for organizing the talk and everyone else who came down. I will be giving the same talk at Singapore Poly, National University of Singapore, and Open Source Developers Conference 2007 at Brisbane, in the near future. Overall this talk turned out to be a very good experience.
Labels:
geeks,
Singapore,
talk,
WebSecurity
Friday, October 12, 2007
Geeky License Plates
geeky license plates..
http://thesiblog.blogspot.com/2007/04/top-ten-geek-license-plates.html
http://thesiblog.blogspot.com/2007/04/top-ten-geek-license-plates.html
Labels:
geeks
Thursday, October 04, 2007
Wife and Girl Friend
If
Family:Package
GirlFriend:Private
Wife: ?
Adultery: ?
Diverse: ?
OpenMarriage: ?
Choices
1)final
2)static
3)Public casting for Private
4)Abstract
5)Interface
6)BCEL
(03:18:29 PM) codeshepherd: if private is for girlfriend , then what is for wife ?
(03:18:46 PM) ***cybereal: hides his "jib" whatever that is...
(03:18:51 PM) Fanook: codeshepherd: static
(03:18:57 PM) cybereal: final
(03:19:18 PM) cybereal: unless you're in an open marriage, then it's abstract
(03:19:22 PM) codeshepherd: Fanook: static does not suit... finay may be ..
(03:19:36 PM) cybereal: Or if you're homeless it's transient...
(03:20:06 PM) Fanook: cheeser: hmmm, how would one implement a divorce then? :)
(03:20:22 PM) cybereal: Fanook: bytecode manipulation!
(03:20:26 PM) Fanook: hehe
(03:20:28 PM) cheeser: that's research i'll leave to others. P^)=
(03:22:08 PM) codeshepherd: adultery = ?
(03:22:21 PM) freeone3000: adultery is achieved through bcel.
(03:22:43 PM) freeone3000: Or those who put things public that should be private.
(03:22:57 PM) codeshepherd: hehe :)
(03:24:52 PM) cybereal: these metaphors would be more fun if java allowed multiple inheritence
Family:Package
GirlFriend:Private
Wife: ?
Adultery: ?
Diverse: ?
OpenMarriage: ?
Choices
1)final
2)static
3)Public casting for Private
4)Abstract
5)Interface
6)BCEL
(03:18:29 PM) codeshepherd: if private is for girlfriend , then what is for wife ?
(03:18:46 PM) ***cybereal: hides his "jib" whatever that is...
(03:18:51 PM) Fanook: codeshepherd: static
(03:18:57 PM) cybereal: final
(03:19:18 PM) cybereal: unless you're in an open marriage, then it's abstract
(03:19:22 PM) codeshepherd: Fanook: static does not suit... finay may be ..
(03:19:36 PM) cybereal: Or if you're homeless it's transient...
(03:20:06 PM) Fanook: cheeser: hmmm, how would one implement a divorce then? :)
(03:20:22 PM) cybereal: Fanook: bytecode manipulation!
(03:20:26 PM) Fanook: hehe
(03:20:28 PM) cheeser: that's research i'll leave to others. P^)=
(03:22:08 PM) codeshepherd: adultery = ?
(03:22:21 PM) freeone3000: adultery is achieved through bcel.
(03:22:43 PM) freeone3000: Or those who put things public that should be private.
(03:22:57 PM) codeshepherd: hehe :)
(03:24:52 PM) cybereal: these metaphors would be more fun if java allowed multiple inheritence
Tuesday, October 02, 2007
A map is a collection of pairs, but it's not a Collection.
A funny discussion at #Java@irc.freenode.net
(02:13:47 AM) iamgedanken: sorry for the noob question, but what is the difference between an arraylist and a collection?
(02:14:13 AM) ojacobson: An ArrayList is one kind of Collection; there are others
(02:14:29 AM) Logi: ArrayList implements List extends Collection
(02:14:34 AM) iamgedanken: o rly
(02:14:42 AM) iamgedanken: ok that makes sense
(02:14:47 AM) ojacobson: ~javadoc Collection
(02:14:47 AM) javabot: ojacobson, please see java.util.Collection: http://java.sun.com/javase/6/docs/api/java/util/Collection.html
(02:14:49 AM) iamgedanken: thanks very much
(02:14:56 AM) Logi: HashMap implements Map which is a collection even if it doesn't implement Collection directly
(02:15:05 AM) kimtiede: An ArrayList gives easy random access to the elements
(02:15:12 AM) codeshepherd: Collection = List Or Set ; List = ArrayList or LinkedList .. iamgedanken
(02:15:21 AM) Logi: Map m=...; m.keySet() instanceof Set implements Colletion
(02:15:32 AM) cybereal_design_patterns_utah: Logi: to be fair, it's a relationship of collections as provided
(02:15:38 AM) cybereal_design_patterns_utah: entrySet, keySet, values
(02:15:43 AM) codeshepherd: List and Set are interfaces implementing Collection... ArrayList is a Class implementing interface List.. iamgedanken
(02:16:16 AM) iamgedanken: alright I understand now thanks for your time
(02:16:20 AM) iamgedanken: :)
(02:16:32 AM) codeshepherd: Logi: HashMap is not a Collection..
(02:16:45 AM) codeshepherd: HashMap does not implement the Collection interface ..
(02:16:48 AM) Logi: codeshepherd: it is with a lower case "c"
(02:17:24 AM) aditsu: in STL style it would be a collection of pairs :)
(02:17:33 AM) codeshepherd: Logi: sorry I dont unerstand.. what is the difference ?
(02:17:51 AM) ojacobson: codeshepherd: A map is a collection of pairs, but it's not a Collection
(02:18:01 AM) ojacobson: eg it doesn't implement the Collection interface
(02:18:03 AM) Logi: codeshepherd: Collection is an interface and Map doesn't extend it. but what ojacobson said
(02:18:21 AM) codeshepherd: oh ok.. Yes, in English.. not in Java :P
(02:18:26 AM) ojacobson: Right :)
(02:13:47 AM) iamgedanken: sorry for the noob question, but what is the difference between an arraylist and a collection?
(02:14:13 AM) ojacobson: An ArrayList is one kind of Collection; there are others
(02:14:29 AM) Logi: ArrayList implements List extends Collection
(02:14:34 AM) iamgedanken: o rly
(02:14:42 AM) iamgedanken: ok that makes sense
(02:14:47 AM) ojacobson: ~javadoc Collection
(02:14:47 AM) javabot: ojacobson, please see java.util.Collection: http://java.sun.com/javase/6/docs/api/java/util/Collection.html
(02:14:49 AM) iamgedanken: thanks very much
(02:14:56 AM) Logi: HashMap implements Map which is a collection even if it doesn't implement Collection directly
(02:15:05 AM) kimtiede: An ArrayList gives easy random access to the elements
(02:15:12 AM) codeshepherd: Collection = List Or Set ; List = ArrayList or LinkedList .. iamgedanken
(02:15:21 AM) Logi: Map m=...; m.keySet() instanceof Set implements Colletion
(02:15:32 AM) cybereal_design_patterns_utah: Logi: to be fair, it's a relationship of collections as provided
(02:15:38 AM) cybereal_design_patterns_utah: entrySet, keySet, values
(02:15:43 AM) codeshepherd: List and Set are interfaces implementing Collection... ArrayList is a Class implementing interface List.. iamgedanken
(02:16:16 AM) iamgedanken: alright I understand now thanks for your time
(02:16:20 AM) iamgedanken: :)
(02:16:32 AM) codeshepherd: Logi: HashMap is not a Collection..
(02:16:45 AM) codeshepherd: HashMap does not implement the Collection interface ..
(02:16:48 AM) Logi: codeshepherd: it is with a lower case "c"
(02:17:24 AM) aditsu: in STL style it would be a collection of pairs :)
(02:17:33 AM) codeshepherd: Logi: sorry I dont unerstand.. what is the difference ?
(02:17:51 AM) ojacobson: codeshepherd: A map is a collection of pairs, but it's not a Collection
(02:18:01 AM) ojacobson: eg it doesn't implement the Collection interface
(02:18:03 AM) Logi: codeshepherd: Collection is an interface and Map doesn't extend it. but what ojacobson said
(02:18:21 AM) codeshepherd: oh ok.. Yes, in English.. not in Java :P
(02:18:26 AM) ojacobson: Right :)
Saturday, September 29, 2007
Please don't tell anyone... that I..
Dig into dustbins in the bus stop,
Sniff wireless traffic in my apartment; watch what people do online,
Walk along the beach late at night,
Read other people's emails and IM conversations,
Delete all my email accounts,
Bully newbies in IRC and other mailing lists,
Run a keylogger in my machine.
Sniff wireless traffic in my apartment; watch what people do online,
Walk along the beach late at night,
Read other people's emails and IM conversations,
Delete all my email accounts,
Bully newbies in IRC and other mailing lists,
Run a keylogger in my machine.
Friday, September 28, 2007
Geek gatherings in Singapore
Unlike Bangalore, Singapore has very few Geek gatherings. Singapore Linux meetup, Novel Suse Linux meetup, Ruby Brigade, Singapore JUG, are the active geek gatherings in Singapore. On the other hand Bangalore boasts of many Geeky activities like "Hack Days", "Open Coffee Club meet", regular Linux user group meetings, Bangpypers meeting, PHP user group meetings, Blog Camps, Bar Camps, FOSS.IN, Freed, Geek gatherings at pubs, etc.
Labels:
geeks
Syntax Highlighting for Code Embedded in Blogger
There are multiple ways for highlighting the syntax of code embedded in Blogger. One way is to generate HTML files directly from VIM using :TOHtml and extract the CSS part in it and use it in Blogger. You can do the same with Textmate or Emacs. Another alternative is to use Prettifier. Prettifier is very easy to use. All you need to do is add a CSS and JavaScript file in your server and link them in your blog template. Please look at the readme file for more details. In my case, Blogger does not allow me to upload JavaScript files and CSS files, so I'm hosting them on a different server. I have updated my earlier posts to use Prettify.
http://codeshepherd.blogspot.com/2007/07/eliza-loves-you-rogerian.html#links
http://codeshepherd.blogspot.com/2007/06/hello-world-orkut-chickenfoot.html#links
The Perl code has turned out bit messy, but the GreaseMonkey JavaScript code looks clean.
http://codeshepherd.blogspot.com/2007/07/eliza-loves-you-rogerian.html#links
http://codeshepherd.blogspot.com/2007/06/hello-world-orkut-chickenfoot.html#links
The Perl code has turned out bit messy, but the GreaseMonkey JavaScript code looks clean.
Labels:
CSS,
JavaScript,
VIM
Tuesday, September 25, 2007
SpringMVC + Hibernate + GridSphere + Apache Tomcat
I've successfully integrated GridSphere and SpringMVC. I've been using a lot of GridSphere Tag Libraries in my JSPs. Now I've to rewrite them using Spring specific tag libraries. In my opinion the GridSphere specific tag libraries are much easier to use compared to Spring tag libraries. The following link provides detailed explanation for integrating SpringMVC with GridSphere. http://docs.gridsphere.org/display/gs30/GridSphere+3.0+and+Spring+Portlet+MVC . Now I've to explore some templating Engines, and Acegi Tag libraries.
Labels:
frameworks,
gridsphere,
j2ee,
java,
MVC,
portlets,
spring
Thursday, September 13, 2007
Happy News!!
I just received a email from Open Source Developers Conference, Australia, Committee, confirming that my talk has been accepted for the Conference. I will be speaking on "Web Security" at OSDC 2007, Brisbane, Australia this November. Let me know if anyone else is attending the conference.
Labels:
Australia,
Conferences,
OSDC,
WebSecurity
Friday, August 17, 2007
Frustrating 3wplayers and Pr0n
Last night, I finished downloading Rush Hour 3. When I played it using mplayer, it prompted me to download 3wplayer. So I googled for W3player and found Perl source (look below for the link) for decrypting 3wplayer encrypted files into AVI files. I decrypted Rush Hour 3 file and it happened to be pr0n!!!
Wikipedia:
3wplayer is a rogue media player software application bundled with trojans that can infect computers running Microsoft Windows. It is designed to exploit users who download video files, instructing them to download and install the program in order to view the video.
Perl code to decode 3wplayer encoded video files: http://www.federicopistono.org/Futile_attempt_of_spreading_malware_3wPlayer_vs_perl_hackers
Wikipedia:
3wplayer is a rogue media player software application bundled with trojans that can infect computers running Microsoft Windows. It is designed to exploit users who download video files, instructing them to download and install the program in order to view the video.
Perl code to decode 3wplayer encoded video files: http://www.federicopistono.org/Futile_attempt_of_spreading_malware_3wPlayer_vs_perl_hackers
Wednesday, August 08, 2007
Why are programmers lucky?
#bioinformatics @ irc.freenode.net
(05:07:23 PM) _dan: my dad is an electronics enginerer, he has a room stacked full of stuff, always made me quite jealous, I mean I can hardly have an electron microscope at home..
(05:07:23 PM) _dan: my dad is an electronics enginerer, he has a room stacked full of stuff, always made me quite jealous, I mean I can hardly have an electron microscope at home..
Monday, August 06, 2007
The sarcastic subconscious
Many times I code in the dream only to wake up and realize that I haven't saved my code!!! Maybe technology will grow up soon to tap productive work from our subconscious minds. Maybe someday biologists will create a VIM plugin to save the code we dream of.
Thursday, July 26, 2007
Intellectual Masturbation
Geek's Google query to search for porn: 'intitle:"index of" porn (mpeg|mpg|avi)'. Click here to try it. 100% satisfaction guarantied.