Σάββατο 23 Οκτωβρίου 2010

CleanMyMac

One of my colleagues, proposed me to use the CleanMyMac. It is a useful utility that helps MAC OS users to remove any useless data from their computers.

You can download it from using the url http://macpaw.com/cleanmymac

Δευτέρα 18 Οκτωβρίου 2010

Η οικονομική κρίση πρέπει να μας κάνεις υπεύθυνους καταναλωτες

Οι έλληνες έχουμε ακομα το κατοχικό σύνδρομο. Μας το περάσανε οι γονεις μας, που τους το περάσαν οι γονεις των οποιων οι γονεις έζησαν την Γερμανική κατοχή. Αυτό το σύνδρομο μας έκανε να θέλουμε να κατεβάζουμε ράφια ολόκληρα απο το σουπερ-μαρκετ, ειδικά τρόφιμα. Ο παραλογισμός αυτός, της συνεχώς αυξημένης-παράλογης ζήτησης, οδήγησε στην συνεχή αύξηση των τιμών. Η αυξηση αυτή, οσο κι αν παραπονιόμαστε, ήταν βασισμένη στην βασική αρχή της σχέση προσφοράς με ζήτησης. Οσο ανεβαίνει η ζήτηση σε σχέση με την προσφορά τόσο ανεβαίνει και η τιμή.

Πλέον ομως ο έλληνας δεν έχει την αγοραστική δύναμη να ανταποκριθεί στις υπερβολικές τιμές και αναγκάζετε, πιθανον για πρώτη φορά μετά την Κατοχή, να αγοράζει μικρότερες ποσότητες απο αυτές που απλειστία μας έκανε να παίρνουμε. Πλέον έχουμε αρχισει να εξορθολογίζουμε τις αγορές μας και σταδιακά να μετράμε τα ελάχιστα χρήματα που μας έχουν απομείνει.

Σε αυτήν την κατάσταση έχουν βασιστει αρκετές νέες ιδέες, οι οποίες έχουν υλοποιηθεί μεσω ιστοχώρων. Αυτοί οι ιστοχώροι (web sites) παρέχουν λειτουργίες σύγκρισης τιμών μεταξύ καταστημάτων (τύπου http://www.shopnsave.gr/), αλλά και ανάρτησης ειδικών προσφορών (όπως το skroutzDeals.gr). Πέραν ομως αυτών υπάρχουν κι άλλα τα οποία μας προτρέπουν να δοκιμάσουμε την τύχη μας συμμετέχοντας στους διάφορους διαγωνισμούς που πραγματοποιούνται στο Διαδικτυο (τύπου http://diagonismos.gr/).

Search anywhere using a single hotel search engine

Most of us like travelling around the world. The most necessary "product" whenever you travel is the accommodation. There are several online hotel booking engines, like booking.com, lastminute.com, expedia.com and other well known sites.
So someone who needs accommodation visits those sites and tries to find the best offer. This process needs a lot of time, but there is also another way to do it. There is at least one hotels' search engine that is used to search to several sites at once.
The site that I know is the http://www.hotelscombined.com/. This sites simply returns results from several sites and lets the user choose!

Σάββατο 9 Οκτωβρίου 2010

Greece is not high-tech, but Greeks are!

Σήμερα ειδα μια συζήτηση στο linkedIn σχετικά με ένα blog που αναφέρει νέους ελληνικούς ιστοχώρους. Το blog λέγεται http://greekwebwatch.blogspot.com/ και η πρώτη επίσκεψη με εντυπωσίασε τοσο που σκέφτηκα να το προωθήσω! Ελπίζω να αρέσει και σε εσάς!

Ουκ εν τω πολλώ το ευ, αλλά εν τω ευ το πολύ (2)

Οπως ειχα γράψει και παλιότερα, "ου εν τω πολλώ το ευ, αλλά εν τω ευ το πολύ". Δηλαδή δεν η ουσία δεν είναι να κάνει πολλά, αλλά να κάνεις καλά! Έτσι απλές ιστοσελίδες μπορούν να γίνουν διάσημες απλά και μόνο επειδή ειναι απλές. Ένας τέτοιου είδους ιστοχώρος είναι και το http://www.my-greece.gr/. Δεν ειναι τίποτα περισσότερο από μια web εφαρμογή που χρησιμοποιεί το google maps και προσφέρει δυνατότητα στον χρήστη να ανεβάζει φωτογραφίες και βίντεο το οποίο και μοιράζεται με τους υπόλοιπους χρήστες.


Τετάρτη 6 Οκτωβρίου 2010

JavaScript: Expand/Collapse function for any kind of Elements

I have written a simple function in JavaScript that can be used for expansion and collapsion of any kind of element. The expansion/collapsion is performed by changing the value of the style.display between 'none' and ''. Value 'none' means that the element won't be shown at all while '' that the element will be shown.
In order to use this function you should add the attributes groupId having a common value for the elements of the same group (let's say of the same table in the same ul) and collapsable="true" (for those elements of the group that should be able to be collapsed and expanded)

Sample HTML:


<table>
<tr groupid="aTable">
<td>Static row</td>
</tr>
<tr groupid="aTable" collapsable="true">
<td>Show/hide row 1</td>
</tr>
<tr groupid="aTable" collapsable="true">
<td>Show/hide row 2</td>
</tr>
<tr groupid="aTable">
<td>
<a href="onclick()" onclick="expandCollapse('aTable','collapse',this);">expand</a>
</td>
</tr>
</table>


JavaScript function:

function expandCollapse(tableId,collapseMSG,obj){
$("[collapsable='true'][groupId='"+tableId+"']").each(

function(){
if(this.style.display=='none'){
this.style.display='';
}else
this.style.display='none';
}
);
var newMSG=(obj.opp)?obj.opp:collapseMSG;
obj.opp=obj.innerHTML;
obj.innerHTML=newMSG;
}


Notes:

jQuery is prerequired to use this function.

Δευτέρα 4 Οκτωβρίου 2010

Βεντουζα!

Ισως η καλύτερη πατέντα για iPad! [πηγή: iphonehellas.gr]





How to run JavaScript after sucessful completion of Ajax request

A common issue that rises whenever you make ajax call is how you 'll be able to call initializing javascript of the changed html elements. A potential solution is to create a javascript function that you 'll call after the success complete of the ajax request.
There is also another solution that is even better and more dynamic. This solution is to use a method that parses your whole html and call any part of scripting code.

The code [1]:
function parseScript(_source) {
var source = _source;
var scripts = new Array();
// Strip out tags
while(source.indexOf("<script")> -1 || source.indexOf("</script")> -1) {
var s = source.indexOf("<script");
var s_e = source.indexOf(">", s);
var e = source.indexOf("</script", s);
var e_e = source.indexOf(">", e);

// Add to scripts array
scripts.push(source.substring(s_e+1, e));
// Strip from source
source = source.substring(0, s) + source.substring(e_e+1);
}

// Loop through every script collected and eval it
for(var i=0; i
try {
if((scripts[i]).indexOf("parseScript(")==-1){//ignore javascript of current function!!
eval(scripts[i]);
}
}
catch(ex) {
alert(scripts[i]);
alert(ex);
// do what you want here when a script fails
}
}
// Return the cleaned source
return source;
}

Additional notes:
I propose you to use jquery and add any code that should be called in functions that had window load event:
$(window).load(function(){//whatever you want to execute});
And after successful completion of ajax request to trigger the load event of window by calling
$(window).trigger("load");

References:
[1] Evaluate scripts while working on AJAX Requests [http://www.developersnippets.com/2009/05/20/evaluate-scripts-while-working-on-ajax-requests/]
[2] Run Javascript Code After an AJAX Request [http://www.linein.org/blog/2009/06/05/run-javascript-code-after-an-ajax-request/]


Παρασκευή 1 Οκτωβρίου 2010

How to make your old web application use ajax to avoid page refresh

The problem
Have you already implemented a web application that works perfect but it doesn't make any ajax request? User are bored of unlimited refresh that happens each time they press any link or button?

The solution

I have the solution! Simply use ajax to make your request, the way you are used to and implement success function to update your pages' root element[1]!

Some code

1) Simply add the following JavaScript function in your js library:

function ajaxReq (requestURL, what2change){
$.ajax({
url: requestURL,
cache: false,
async: true,
dataType: 'html',
success: function(html){
var x = $(html);
$('#'+what2change,x).each(
function (i) {
document.getElementById(what2change).innerHTML=this.innerHTML;
}
);
}
});

And use it writting something like the following:
a) <input onclick="ajaxReq ('index.jsp?param1=2','root')" type="button">
b) <a href="http://www.blogger.com/post-edit.do#" onclick="ajaxReq ('index.jsp?param1=2','root')">

[1] In most cases you have some div or table that contains the part of the page that changes in each refresh. This should have a specific id the value of this id should be set also as value of the variable 'what2change' in the ajaxReq function.

Additional Information
If you use JavaScript that runs while your page is being rendered, then you should also read my new post "How to run JavaScript after sucessful completion of Ajax request" that is based on the articles http://www.developersnippets.com/2009/05/20/evaluate-scripts-while-working-on-ajax-requests/ and http://www.linein.org/blog/2009/06/05/run-javascript-code-after-an-ajax-request/

Metawidget, a useful framework for easy UI development

I currently work on a project that requires a lot of forms to be implemented. For that reason I had either to design each form using a visual tool (e.g. Matisse[1]), or a domain driven design (e.g. Naked Objects pattern[2]). Due to the fact that requirements may change at any time and everything should similar, I preferred the solution of domain-driven design.
Developing a model that support everything that is required for the application and adding metadata that will be useful for the UI is a very good combination for easy and agile development of a user friendly application! While I was designing my solution I discovered that there is a new framework that could help me. It's named Metawidget[3]. Metawidget offers integration with several front end frameworks. The only framework that I have used is swing, and I would like to inform you that it works perfectly and it is easy to add your own code to extend the functionality. For instance if you need to use some additional attribute to specify how a member should be shown then you can do it easily[4]!
Try it, and if you need any help just ask me!


[1] Swing GUI Builder (formerly Project Matisse) (http://netbeans.org/features/java/swing.html)
[2] Naked Objects is an architectural pattern where User Interface (UI) is just reflection of the model. For more details see http://en.wikipedia.org/wiki/Naked_objects
[3] Metawidget is an open source project that helps you to easily generate graphical user interface for desktop, web and mobile applications. It is simply a bridge between back-end architecture (using annotations or xml files for metadata) and existing front-end frameworks (such as Swing,Java Server Faces, Struts, Android). For more informations visit the official web site http://www.metawidget.org/
[4] The only case that I can't find an efficient solution is the one that I need a JTable to represend and edit values of a java.util.Collection, but I hope that I will find the way to do it!

LinkWithin

Blog Widget by LinkWithin

Mobile edition