Jul
2
Peerdreams
Filed Under general | Leave a Comment
Want to find a sponsor for you ? or your project need to be funded.. check this out http://www.peerdreams.com/
Jun
24
It rained after a very long time :)
Filed Under About Me | Leave a Comment
This is my 1st post after 15th February. I was away from most of things i was doing and was doing some serious thinking. Had to take some important decisions in my life. I realized everything around me is so rapidly changing, and above all shockingly i have been changed. Well yeah this post is also a crappy post with no much importance, but well thought of writing something before i go to my usual articles from tomorrow onwards (Hopefully
) After all its my own blog, and am not making money out of this. so its my world i write all what i want.
I finished my Internship in Germany and am back in Sri Lanka, enjoying the warm weather
, mocking at politics, freaked out about the inflation and of cause surviving from the random blasts, Then again its home, no place like home isn’t it? At the moment am entirely jobless, not doing anything productive. sleeping most of the time (Dreaming
). Oh but soon after i came i wanted to fix a nice geeky work station to start my University final year with. Yeah so last week i bought a nice 19inch Wide screen LCD, a comfortable MD chair and resembled my old PC with some new pieces. so now it looks neat and looking hot and with all theHAHOO about the Original Software I just switched to Ubuntu hardy without a hesitation. so yeah now am 100% Linux. hope I’ll stay that way.

So yeah I don’t intend to write much about myself, as i said i took some important decisions which is more or less life changing (maybe a bit life threatening too at the moment, yet am really happy about how everything turned out to be). So finally what i really want to do now is to scream out so loud, SO LOUD AND SAY HOW HAPPY I AM.
cheers !!
Feb
15
Valentines Day, Blogging, Movies & All Other Crap (Don’t waste time reading this..)
Filed Under Blogging, Entertainment & Interests, general, About Me | 3 Comments
Thought of writing another post under NO category / general (I do this when I don’t have anything useful to blog about yet when i have alot things to blog about.). Last couple of days I was pretty busy with work. (Was playing with some Ajax frameworks for JSF.. and yeah I will write about that in my next post… it was pretty fun using Ajax in your Java EE app). So anyways as my topic says.. this Post does not contain anything important.. well maybe about movies if you are a great fan of All kinds of movies
Valentines day
Yesterday morning after i woke up and checked my mail…. (Well yeah i do that before having a morning tea…in-fact first thing after opening my eyes
not that am getting thousands of mails that I should reply, but it had been a habit, which i cannot get over with). My Girl Friend had sent me an email saying
“…..oh btw…i knw we dnt celebrate but happy vals day..muwaaaahhhh…my valantine <3″
I was like WHAT ?? OH Crap the Valentines day… that’s how I knew that yesterday is the so called lovers day.. For last couple of years 14th February was just there… as she said we never used to HAHOO about it.. one reason, we were having more important stuff to worry about, and we never saw a point in that idea (same as Mothers’, Day Fathers’ day, That Day and This Day but accept the Birthday LOL )… But any how This time I thought of sending something to her.. Not that I suddenly saw a meaning in that idea, But by the end of the day i felt like i want to send something… well i do believe in doing things without a meaning.. (am talking about the Day.. not sending something to her
).. Anyhow yeah for the 1st time later that day night, I ordered a valentines Gift to be delivered to her… !!!
Blogging
Last week with the 1st release of the project i was working on, I got some time to surf around the net and do some reading..Specially about blogging, SEO, Micro Blogging, Pod-casting etc, etc, (Yeah my last post also a result of this reading). I was reading quite alot of blogs, Mostly Sri Lankan (Through SLBlogs and Kottu), and i found pretty interesting ones not to mention there were some Sri Lankan Blogs which discuses some serious topics in charming way (its a complement).
When I started Blogging back in 2007 i didn’t have a clear reason, the only reason I started was that I had a server to play with and a DOT COM domain was not so expensive. The reason that am doing it still is… well I dont know !! maybe i will stop it tomorrow…. !!! Anyhow still am enjoying this..its nice to see the graphs in Google analytics, and some times when some of your posts come in googles’ 1st page of search results under java or Linux hacks.
Another thing I came across last week was some thing called Micro Blogging.., well its not a new thing (Was new to me).. but well Its a pretty strange way of blogging.. because when you read one of those blogs, It doesn’t make any sense Why you do it.. !! Then again I celebrated the valentines day didn’t I !!
With my last article (The criticism about a criticism) I happened to do some reading on this So called HOT topic SEO. After reading some articles i actually wondered, Whats there to talk about this much. SEO for me is all about good content..!! infarct 99% of the Google page rank is directly depending on the valuable content, its The valuable content which makes back links (Organic links).. All other gambling which is done is just a matter of 1%. And that 1% can never make you site go more than 2 in PR. One of my friends last week said, doing SEO is like we are putting few bugs when we program. :). But i must also say before 1998 (before Google born) SEO was a big deal. Meta tags and keywords made a huge difference, But with the Goolge’s Algorithm the story took a different turn. So Don’t waste time in gambling for back links. write valuable content it will surely make a deference.
Movies
After i started my Interns in Germany since last July, I guess my Bit-torrent client is running nonstop (well maybe few days of a rest on my notebook). Soon as i landed here my 1st wish was to experience, at-least more than 2Mbps DSL line (That’s the best we can have in Sri Lanka). Making my dreams come true for few euros i took a DSL connection of 4Mbps . and was being fond like a child with a candy bar. My room mate those days said… “Dude now you can download movies faster than you watch them.” apparently making that statement true. I had a to buy a bigger hard drive after not more than one month. So yeah I took a 500GB external hard Drive, in august, and yeah 90% of it is now filled.. !!
Okey so I guess the above lines says that I have downloaded almost all the rated movies in IMDB… so for the all types of movies fans… there are few good stuff i wanted to tell..check release log every day.. It contains almost all the releases up-t-odate…maybe you feel its too much information, and yeah true..yet its a valuable site.. I found it through Kasun.
And check out the torrentfive.com this a good site where they publish new movie torrents with good quality. One drawback is you have to register before downloading torrents.
Talking about some TV series, I got to write about Band Of brothers, this is an awesome war story. Not a new one yet then again I found it recently. Jericho 2nd season is out and casting on every Wednesday, but with the strike of the writers guild i am missing some pretty good stories these day, Office, Heroes are among them.
So yeah I will not waste time writing about my 430GB movie collection, just visit release log and download what ever you like.
All sort of other crap.
Well other than above… when i stared writing this post i wanted to write some Sri Lankan politics and some philosophical stuff, but after writing the above… i think i am done jabbering about crap for the day. So this will be my last post on general or “No Category” category. (At least for some time
)
So…am sorry for wasting your time !!
cheers !!
Feb
11
Well Its been some time that I have written a post under the category of general, or rather non-technical. After reading my friend kasun’s blog, I happened discover an interesting post of a fellow Sri Lankan blogger, which made me write this. Few days back I wrote the news about SLBlogs, and yeah this post is also about SLBlogs, or rather about a criticism that SLBlogs received recently.
Before I start saying anything, i must say that this post brings no offense on the fellow blogger who made the criticism.
Sir William Arthur once said “Flatter me, and I may not believe you. Criticize me, and I may not like you. Ignore me, and I may not forgive you. Encourage me, and I may not forget you.”
So yeah Criticisms are good, they may not make the critique your favorite, but you will remember an encouraging criticism.
I am not naive to say that SLBlogs is a perfect Blog syndicator, or that it is THE Sri Lankan Blog-o-spere. SlBlogs is 1 month old child. Which can and will improve with age… yet again, I find some unrealistic or let me put it this way, “I cannot 100% agree with mind blogger with his 5 points on SLBlog not being THE Sri Lankan Blog-o-spere”. So I will just point out how I see these five points. Then again it’s how i see
1. Blog syndication networks work no more without specific niches.
I do agree with Mindblogger up to a certain extent. Its true SLBlogs still has 16 Blogs syndicated, it lacks content. I do read Kottu to find some news and ideas. But well SLBlogs is one month old. still the bloggers of Sri Lanka doesn’t know about it, and surely if The MindBlogger have syndicated his own blog to SLblogs.org and wrote this criticism I will not see the hypocrisy behind this 1st point.
As we all know a Blog syndication site work its way, from the help of its contributors, and when that Syndicator says it’s for Sri Lankan bloggers. The Sri Lankan blogging community has to help it. The owner of the Site will do his part. Yet as the Bloggers in Sri Lanka, we also should do our part. So how I see about Mind Bloggers 1st point is That SLBlogs is not 100% responsible in its Contributor count.
2. Doesn’t know open link-baiting could ban a blog.
This is one interesting point!! The MindBlogger have directly Mentioned that SLBlogs.org doesn’t know anything about open link-baiting. Actually till I read the Mind bloggers comment under this point, I didn’t have a clear idea about this topic, not that am saying The MindBlogger have a clear definition of what is Open Link baiting is…. I knew that John Chow and the BMW -German website has been banned and ranked 0 from Google due to some illegal ways of search engine optimization.
Yet even in Google’s terms, Google doesn’t explain how it will be illegal to build links, or make your page ranks grow…. So yeah!! After some reading and surfing over the net what I finally found is that link building or baiting is not at all illegal. Am not saying that Google is wrong in banning John Chow or BMW. What am saying is there are healthier ways of link building. If you are really interested in reading about this topic. I found a nice article in the Smashing Magazine.
So if I come back to what I was telling… What SLBlogs have mentioned in its Competition page (Which the sentence is no longer there) is as I can remember “OF CAUSE you can also add a link to SLBlogs” There is no direct sentence saying that you will get a Domain if you link back to SLBlogs. What it clearly said is..if you really want you can put a link to SLBlogs. This is not at all similar with the John Chow situation.
John Chow directly asked from his readers to make a link to his blog when those readers use certain key words (”make money online”) when they write posts in their blogs. For the people who do this John Chow gave a link back. Yes this is an extreme of link building. Its like you reserve a keyword over the internet for your own blog.
So What I see in Mind Bloggers second point is that he doesn’t know what is link building is. (Well I didn’t know it before too
) If SLBlogs attempt of building links is illegal it will be closer to illegalness if someone uses an Internet Marketing Link Exchange Directory. But what am saying is using that kind of a directory is also not illegal or its rather in the Gray Zone. (There are no direct definitions of the limits in this matter). So as I see SLBlogs should not remove the line which said about this. (Well Its all SLBlogs decision.)
3. “7 things Why a slBlogger needs a RSS reader!” - now, that’s a bit cliche.
“Cliché” if I am correct with this very word and about the SLBlogs article. I should actually ask why is it so… even the MindBlogger say do not ask. My view for this point is, This is another Blog Post. Yeah it is done by the owner of SLBlogs. I am not saying the topic of this article is very suitable or colorful. Yet the content of this article is not “Cliche”, at least not to me. Yes this post contains some nice phrases about me… and one might say am writing this to defend myself. Then again this is my Blog, and this is My thought. This reminds me of only one thing, several days ago, i downloaded some of the linux.conf.au 2008 talks. In the talk, “Fixing Web”, look at the first minute of his talk and you’ll see why..
So what am saying is Something being Cliché is so personal. Some great programmer can say my whole Blog is Cliché. I write what was new to me.. What I found..There can be people who know all what I write daily… But yet.. There can also be people who don’t.. So a blog Post will never be Cliché.
So in this case there can be plenty of readers who don’t know about a RSS reader. Being honest I started using Google reader after I started Blogging. Thanks to Sandaruwan. So yeah why do you need a RSS reader….? SLBlogs says WHY….
4. Open display of subscriber count?
Yes on this point I do agree with Mind Blogger. But yeah as usual its only because the display of the feedburner. I do agree that SLBlogs should remove this, from its Display.
But I would like to put out the main reason as I think why it is only 3. SLBlogs is not in my Google reader too. In fact I do have a question why is it 3. It should be 0. Why I say this is. SLBlogs is a Blog syndicator. Why do you want a blog syndicator in your RSS reader? I don’t want to read all the posts which are pasted on SLBlogs. I have only few and some important blogs in my RSS reader.
What am saying is the Subscriber count in a syndication Site Does not show its regular readers. So it will never be 50 to show. With a syndicator what you do is, you visit the site time to time, do a quick sniffing around the posts, then if you feel like it’s good, click on the link, go to the individual blog and read it.. Then subscribe to the blog if you want..
So anyhow. I also believe SLBlogs should remove the feedburner display. Because it says nothing about SLBlogs.
5. Take a look around.
As i see The Mind Blogger in his 5th point have said that the Sri Lankan Blogging community will be offended by SLBlogs motto.
slblogs.org “the” Sri Lankan blog syndication network
well this is partially true. Yet there is always another point of view. Someone can be so narrow minded and think that this phrase is an offence to all the great bloggers in Sri Lanka. Yet all Companies, societies, products..or ideas do have their own mottos. SLBlogs as it seems has a clear goal of being THE Sri Lankan blog syndication network. SO they are using this phrase as their own motto. Which is not closed to any great Sri Lankan blogger.. It openly invites all the Sri Lankan Bloggers to Join Its community.
A simple example is… while I was walking outside today… An Italian restaurant said
Have the Experience of Nectar in Heaven.”
I know it’s funny. But well there are very few English billboards in Germany. Anyway my whole point is. Each of these people including SLBlogs need to gain attention from the community. So they use their own mottoes. So if some blogger will get offended by this kind of a motto. What kind of a blogging community do we have?
So I guess I have written the lengthiest post in my blogging life… yet again. This is just my opinion. And SLBlogs have to be happy because criticisms always make you popular. And as Mind Blogger said his 200+ loyal subscribers will surely make some traffic on SLBlogs.
Finally I should say. SLBlogs is doing a good job. There are things to be learnt. Things to be changed, and things to be improved and criticized, I hope the admin of SLBlogs will do these changes in order to make it a more mature network.
And before wrapping up I must again mention this does not make any offense to anyone. This is my point of view. Open for debate… !!
Feb
6
Select Many Problem : JSF
Filed Under JSF, Java, Web Designing & Development, programming | Leave a Comment
After few days, got some time to write a post… well as i promised in my earlier post.. I thought of writing about the Annoying problem anybody will face while using selectMany component in JSF.
At 1st with out any experience what any one would do is writing both assessor and mutator methods to return and set A LIST of selected objects. some thing like
private List<myClass> selectList;
public List<myClass> getSelectList() {
return selectList;
}public void setSelectList(List<myClass> selectList) {
this.selectList = selectList;
}
Even though this is the straight forward way, For some reason JSF implementation does not support it. In many places over the NET and in JSF forums, people have advised to use String Arrays, Saying you cannot use Java Collections in this scenario.
But Use of String Arrays are very much annoying and makes your work very messy. After some testing and trying I found this work around to take the selected objects as it is, not just the label string, Its pretty simple. Instead of using String arrays, Just use an array of your own class. Something like this
private myClass[] selectList;
public myClass[] getSelectList() {
return selectList;
}public void setSelectList(myClass[] selectList) {
this.selectList = selectList;
}
Of-cause you have to use a converter in this case but not difference out there its just a normal converter for your class. So hope this tip will help
cheers !!
Jan
29
“Validation Error: Value is not valid” famous validation error, when using custom converters in JSF.
Filed Under JSF, Java, Web Designing & Development, programming | 14 Comments
This is one problem i faced when i worked with select-many and select-one menus in Java Server Faces. For any one who have worked with JSF knows that you have to use custom converters in order to populate select-many and select-on menus with ur own data types.
if i elaborate on this a little bit, Select menus are not just there to show simple value-label pairs. you can give directly an object to its value and one of its fields as the label. for an example,
public ArrayList<SelectItem> getLandSelectList() {
if (landSelectList != null) {
return landSelectList;
}
landSelectList = new ArrayList<SelectItem>();
List<Land> landList = this.getLandList();
for (int i = 0; i < landList.size(); i++) {
landSelectList.add(new SelectItem(landList.get(i), landList.get(i)
.getLandsName_DE()));
}
return landSelectList;
}
The returning Select list can be taken to a select one or a select many list box like..
<h:selectOneMenu id=”listBoxLand”
value=”#{userManagerBean.land}” required=”true”>
<f:selectItems value=”#{userManagerBean.landSelectList}” />
</h:selectOneMenu>
<h:message for=”listBoxLand” />
This component will set the selected land object directly to the backing bean. If you used simple value(some text or the id) - label pair. you should again query for the object from the selected id and save in the backing bean. but in this way that extra trouble will be handled by JSF.
The problem is if you do it just like this with out anything else.. you will get a wired validation error saying “Validation Error: Value is not valid“. This is where you start googling and debugging. Well after some hours of googling..(couldn’t do much debugging because this is a exception thrown by JSF framework) and reading about 10 to 20 forums i found out that the object which is loaded and the object wich was selected will be compared when setting to the backing bean. So if your object’s Class has not overridden the equals method this error message is shown.
So what you have to do is. if you are using your own data Objects for the select menus or in that case for any other JSF tag where you will use converters. You have to override the Equals method. Probably do the comparison with the Id, or with some unique value in that data Object. That’s it.. The problem solved. In my case the equals methods looks like
// overridden equals method
public boolean equals(Object obj) {
if (!(obj instanceof Land)) {
return false;
}
Land land = (Land) obj;return (this.id == land.id);
}
Yeah hope this will be useful to some one.. !! I will write another post on how to use Java Collections when working with Select-Many menus.
Jan
26
Joomla Hack! Automated Joomla user registration via JSF form
Filed Under Joomla, JSF, Java, Web Designing & Development, programming | 2 Comments
Well this post is some what continuation of my last post.
What is the use of single sign on if you have to register in two different sites ? yeah this is the solution for that… What i wanted to do is, when a user registers in my java web application i wanted to register the same user in the PHP app. Since these two applications have different user data-tables (well in my project i cannot merge these tables or use one database. if that is your case just ignore this post.)
When a new user registers in my JAVA web app am taking that user form data and insert those to the joomla database.
(Yup I know.. What is there to blog about this ?)
But what went wrong is joomla use some extra data from 2 other different tables other than jos_users (in joomla database).
those tables are jos_core_acl_aro and jos_core_acl_groups_aro_map so when you are inserting the data to the jos_users table.. also save the data in to the other two tables as well.
there are foreign key constrains over these tables. so
1- Insert the user to the jos_users
2- take the user id from a select query and insert that user to the jos_core_acl_aro
3- takes jos_core_acl_aro id from a select query and insert it in to the jos_core_acl_groups_aro_map
take a look at the three tables then you will realize what you should do.
The other task is password encryption. well Joomla 1.5 uses md5 encryption mechanism to hash the passwords. When a password is created, it is hashed with a 32 character salt that is appended to the end of the password string. The password is stored as {TOTAL HASH}:{ORIGINAL SALT}.
you can see this method at plugins/authentication/joomla.php lines 80-116.
So what you have to do is take your password and make a {TOTAL HASH}:{ORIGINAL SALT} from it and save the created string. I found this information also in a discussion forum. which had shown a java class to do this task.. so yeah it was quite useful..
so that’s all about behind the seen registration
Have fun !
Jan
24
Single Sign-On between Joomla (PHP) and a custom JSF / JSP login (JAVA)
Filed Under TCP/UDP, Java, JSF, Joomla, Web Designing & Development, hacks, PHP, open source, programming, LAMP | Leave a Comment
Single sign-on (SSO) is a method of access control, that enables a user to authenticate once, and gain access to the resources of multiple software systems. Well in my case, the task i have given is to authenticate a user in a PHP and a JAVA (Web) system simultaneously.
My PHP web application is the well known Joomla CMS, and my JAVA web application is based on JSF and custom built. After some thinking and research I found several resources which are worth reading (JOSSO, OneSign ), but i couldn’t take any help from them, mostly those SSO frameworks are complex ( yeah
I couldn’t understand ) and aimed on a general pourpose and most of them are not for free.
So yeah I thought of doing some Hack to joomla and also make some changes in my Java web app’s authentication method. After talking with some of my geeky Friends (Sandaruwan and Anjana). I came up with two approaches. both are involved in handling the cookies manually up to certain extent.
The 1st approach is (Which i didn’t try and had to give up due to the reason that I am using JSF as the web application framework) to log-in to the Joomla site and after loged in to Joomla create a random named temp file in the server (possibly in /home/secrets with 777) with the user-name (if a valid log in) and set a cookie using set_cookie(”name”,$filename) and direct to a jsp page to do the java side authentication.
in this JSP, page read the secret file name from the cookie and read the file from the http server in-order to take the username of the loged-in user. By passing this to the authentication method of the java web app, the java side also can be authenticated.
yup it is pretty simple, but i had to give it up mainly because I use JSF. if I do the user authentication in the above way in the java side. I cannot add the user object to the FacesContext which will be used by my other java side components. so even though i log in. later on in other jsf pages my loged user cannot be found. (Shortly my java login process is not happening according to the JSF implementation procedures.) and secondly i had to give up this method because my Project manger didn’t like the idea of saving temp files in the server.
So the Second and the method which i have implemented is, automating the Joomla log-in process by making an http request to the http server from my JSF backing bean. and set the PHP cookie manually via Http Servlet response.
before i explain this method more broadly i have to mention about two nice tools which helped me to monitor the http requests and response.
Apache TCP Monitor
Live Http headers (FireFox ad-on)
Architecture
Implementation
There are two different scenarios.
1. User can visit teh home page of the joomla site 1st and the PHP Cookie is already set.
2. User visit the Java site PHP Cookie is not available.
Jan
18
JSF : Setting a custom message from a backing bean
Filed Under JSF, Java, Web Designing & Development, programming | Leave a Comment
So yeah !! I thought of writing something about JSF. Since am working with it for Nealy 3 months now. So how about custom message handling for starters !!
JSF message tag is pretty useful in many places. for an example, for the use of validators. but what i wanted to write here is, not how a message is shown after validation.
Think after some database transaction you wanted to say “Transaction is successful or not successful” or in some random scenario if you wanted to show a message in anywhere in your web-page at anytime, you can do that from your backing bean with out much effort.
I will take the tomahawk fileupload tag as an example JSF tag. so in the JSP side it will look like
<h:outputlabel for="fileupload" value="File :"></h:outputlabel>
<t:inputfileupload id="fileupload" accept="image/*" size="50">
value="#{bbaBean.theFile}" storage="file"
styleClass="fileUploadInput"
required="true">
</t:inputfileupload>
<h:message for="fileupload" showdetail="true">
errorstyle="Color: red;">
</h:message>
<h:commandbutton value="Datei Hochladen">
action="#{bbaBean.uploadFile}" styleclass="linkbox">
</h:commandbutton>And when the upload button is clicked the uploadFile method will be invoked in our backing bean. which will look like..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | public String uploadFile throws IOException { FacesMessage messageErr = new FacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR : ", "XML File you have uploaded is not compatible"); FacesMessage messageSuc = new FacesMessage( "The XML File You have uploaded is successfully added to the Database"); FacesContext fc = FacesContext.getCurrentInstance(); try { //TODO: Transaction or logic.... fc..addMessage("form1:fileupload", messageSuc); } catch(Exception e) { fc.addMessage("form1:fileupload", messageErr); } } |
Simply that is it. So when an exception occurs your JSP page shows the custom error message. One other thing is you can set the message type too. if its and error message as i have shown make it’s SEVERITY to ERROR. and add an error style class for the tag. so your error message will be shown different than the other messages..
so yeah enjoy..
Jan
16
Well yeah I am back… I know things have gone gray.. my technorati ranking has gone down.. my readers are disappointed.. Okey.. So here I plead for forgiveness….
Well for past 3 months I was so sunk in work.. the new project which i am working on right now.. made the days fly so soon… any how.. the things i learnt cannot be written in one blog post..and yeah its not yet finish… I thought of writing a post today.. for few reasons..
I didn’t want anyone to think that I gave-up writing… One of the friendly bloggers threaten me to start writing again.. and yeah I wanted to deliver the news about “SLBOLGS“.
well what can i say about SLBlogs… In few words if i describe…Its a journal with many authors… I know the concept is not so new, but well i see this as a nice place where most of the Sri Lankan Bloggers meet..or rather share there ideas to the whole world.. So yeah its Open for you too.. subscribe with SLBlogs… I hope it will be fun..
Any how, No promises i can make when i will write my next post yet… A lot to scribble… So until then..
Cheers !!
Older >>
