Wednesday, November 18, 2009
Microsoft PDC 2009 - first recordings available!
There's been the first recording made available from this year's PDC. It's the key note from day one. It looks like things are going to be very much thumbs up for the next year!
Java and Closures - own goal
Today in the morning there was an announcement made that closures (a feature long awaited in Java) will make it to version 7. Here you'll find some examples of how it will actually look like.
But...
To have an understanding of what closures really are useful for one must follow an example. Here's something written in C# for sorting a list of strings:
And here's the equivalent in Java:
One can clearly see the intent of what the closure (a function being passed as parameters) looks like in both languages with the clear winner in succinctness being C# (or pretty much any other modern language out there). I know that java tends to be verbose on all possible counts but having a different approach for commonly understandable constructs is a bad thing all along.
One other thing that you can clearly see in the example above is the lack of type inference feature which makes the syntax even more verbose.
So when I said "own goal" in the title what I really meant is that the primary function, which is succinctness and clarity has been lost in transition.
Unfortunately we're facing yet another messed up implementation of a perfectly good idea (like generics with type erasure) in one of the most popular languages in the industry.
With this kind of mind set the end is near!
C ya!
But...
To have an understanding of what closures really are useful for one must follow an example. Here's something written in C# for sorting a list of strings:
var list = new List<string>() {...content go here...};
list.Sort({ (s1, s2) => s1.Length - s2.Length });
And here's the equivalent in Java:
Listlist = ...
Collections.sort(list, #(String str1, String str2) {
return str1.length() - str2.length();
});
One can clearly see the intent of what the closure (a function being passed as parameters) looks like in both languages with the clear winner in succinctness being C# (or pretty much any other modern language out there). I know that java tends to be verbose on all possible counts but having a different approach for commonly understandable constructs is a bad thing all along.
One other thing that you can clearly see in the example above is the lack of type inference feature which makes the syntax even more verbose.
So when I said "own goal" in the title what I really meant is that the primary function, which is succinctness and clarity has been lost in transition.
Unfortunately we're facing yet another messed up implementation of a perfectly good idea (like generics with type erasure) in one of the most popular languages in the industry.
With this kind of mind set the end is near!
C ya!
Monday, September 28, 2009
Java 7 - a dissapointment
I've just been looking into the "features" available in J7 and I must say I'm mostly disappointed. Closures are out, properties are not yet implemented... I guess the code base must be to big to do any relevant changes to the language. Maybe it's time someone will admit that the language is going down and that there's time for Java++?
Tuesday, September 15, 2009
I Come to Bury Agile, Not to Praise It - by Alistair Cockburn
Hi all,
from all the presentations about programming methodologies I believe this one given by Alistair Cockburn at the InfoQ conference to be of particular value. It's mainly because of the fact that he discloses most of the actual patterns occurring during a software development process and shows probable solutions for the upcoming (or present) challenges that we might face.
Go check it out at Bury not praise agile
And please - have fun!!!
from all the presentations about programming methodologies I believe this one given by Alistair Cockburn at the InfoQ conference to be of particular value. It's mainly because of the fact that he discloses most of the actual patterns occurring during a software development process and shows probable solutions for the upcoming (or present) challenges that we might face.
Go check it out at Bury not praise agile
And please - have fun!!!
Monday, September 14, 2009
PostgreSQL and phpPgAdmin on Ubuntu Server
I was struggling to get the phpPgAdmin application to work on a virtual machine running Ubuntu 9.04 today. As it turns out phpPgAdmin's default installation is by default targeted at desktop environments which is by all intents and purposes stupid (to say the least).
So what's so "desktop-ish" about it? Well as it turns out the default configuration accepts connections from localhost only which is completely unusable in a server-like environment with no graphical environment and no web browser whatsoever.
The default behavior also manifests itself in a very non-verbose manner. At first the log entry
is not saying very much. It'd be better if the error message said something more verbose and direct the user to change the access rules or better yet to have a configuration step during installation that asks for this rather than to have poke around some configuration files.
To change it's default behavior one has to edit the file /etc/apache2/conf.d/phppgadmin (which is a symbolic link to /etc/phppgadmin/apache.conf) and change the default access policy from 127.0.0.1/255.0.0.0 ::1/128 to all.
To do that simply comment out the line that reads
and remove the comment from one line below that reads
That does the trick. Of course that opens the ability to connect to this server from the outside world, but since this is a server installation it's not uncommon to access it from far far away, is it?
Happy hunting!
So what's so "desktop-ish" about it? Well as it turns out the default configuration accepts connections from localhost only which is completely unusable in a server-like environment with no graphical environment and no web browser whatsoever.
The default behavior also manifests itself in a very non-verbose manner. At first the log entry
"GET /pgphpadmin HTTP/1.1" 403 268is not saying very much. It'd be better if the error message said something more verbose and direct the user to change the access rules or better yet to have a configuration step during installation that asks for this rather than to have poke around some configuration files.
To change it's default behavior one has to edit the file /etc/apache2/conf.d/phppgadmin (which is a symbolic link to /etc/phppgadmin/apache.conf) and change the default access policy from 127.0.0.1/255.0.0.0 ::1/128 to all.
To do that simply comment out the line that reads
allow from 127.0.0.1/255.0.0.0 ::1/128and remove the comment from one line below that reads
allow from allThat does the trick. Of course that opens the ability to connect to this server from the outside world, but since this is a server installation it's not uncommon to access it from far far away, is it?
Happy hunting!
Labels:
installation,
phpPgAdmin,
PostgreSQL,
ubuntu
Thursday, September 10, 2009
The size does not matter
I've just finished a very inspiring conversation with a friend of mine and I want to share the outcome with the rest of you.
So it started quite innocent. He talked how he liked the Flex framework with some server-side code, I talked about the discovery of Apache Wicket... Just a normal conversation between 2 fellow programmers.
Then after some time he expressed his bad feeling about dynamic languages and all. Well, I've asked if he'd like to see the waves of a WiFi transmitter where he immediately replayed that he ain't got a microscope laying around....
At that time it was quite obvious that he thinks of them as something that really is there. That they are something he can take for granted. That's an assumption even if on a very theoretical level. He made an assumption and to that end he expressed his behavior as dynamic.
This fact lead to a conclusion that human beings are in fact in their nature more suited to the dynamic part of programming languages than anything else. We choose to think about programming as a very static thing whereas it is completely dynamic in its very nature. We can never predict what the user will give for an input to our carefully design form, do we? We can never predict what kind of weather condition will be fed to our application's flight planning routine - it's just a wild guess that we can cope with all of that.
On a more structural level it's a lot better to define the actual interface required for the part in question to work as expected than to say that this part must definitely be of some special type. Hell, the duck and a canary are birds and are similar in a lot of different ways. Did they evolve from the same species? Maybe yes but, on the other hand, maybe not. The fact remains the same that we can talk about the wings of a duck as well as of the wings of a canary and we all know that they move more-less up and down to create some lift to allow the bird to fly!
At the end of the day both ideas (the static and the dynamic one) have their advantages and disadvantages. It's just takes the openness of one's mind to realize the similarities and advantages of both solution to pick the right one for the job.
Happy hunting!
So it started quite innocent. He talked how he liked the Flex framework with some server-side code, I talked about the discovery of Apache Wicket... Just a normal conversation between 2 fellow programmers.
Then after some time he expressed his bad feeling about dynamic languages and all. Well, I've asked if he'd like to see the waves of a WiFi transmitter where he immediately replayed that he ain't got a microscope laying around....
At that time it was quite obvious that he thinks of them as something that really is there. That they are something he can take for granted. That's an assumption even if on a very theoretical level. He made an assumption and to that end he expressed his behavior as dynamic.
This fact lead to a conclusion that human beings are in fact in their nature more suited to the dynamic part of programming languages than anything else. We choose to think about programming as a very static thing whereas it is completely dynamic in its very nature. We can never predict what the user will give for an input to our carefully design form, do we? We can never predict what kind of weather condition will be fed to our application's flight planning routine - it's just a wild guess that we can cope with all of that.
On a more structural level it's a lot better to define the actual interface required for the part in question to work as expected than to say that this part must definitely be of some special type. Hell, the duck and a canary are birds and are similar in a lot of different ways. Did they evolve from the same species? Maybe yes but, on the other hand, maybe not. The fact remains the same that we can talk about the wings of a duck as well as of the wings of a canary and we all know that they move more-less up and down to create some lift to allow the bird to fly!
At the end of the day both ideas (the static and the dynamic one) have their advantages and disadvantages. It's just takes the openness of one's mind to realize the similarities and advantages of both solution to pick the right one for the job.
Happy hunting!
Sunday, August 30, 2009
Re-encoding AVCHD video using FFMpeg
There's been some changes to how ffmpeg operates starting from revision 19459 and simply pointing out the input and output files with libx264 will not do the trick anymore. This is due to the fact that ffmpeg now recognizes the subtitles track and doesn't know how to deal with it in the resulting MKV file. To overcome this issue add the -sn to the parameters and you're done.
Also some of the x264 options don't have working default values so one must specify the preset for video encoding. Here's an example:
ffmpeg.bat -i 00001.MTS -acodec aac -ac 2 -ab 128k -sn -vcodec libx264 -deinterlace -s 1280x720 -vpre ./libx264-hq.ffpreset -crf 23 -threads 2 00001.mkv
To make it work make sure you've copied the libx264-hq.ffpreset file from ffmpeg archive into the folder with your MTS file to be re-encoded.
Also you can adjust the -crf 23 parameter to steer the final size and quality of the resulting MKV file.
Enjoy!
Also some of the x264 options don't have working default values so one must specify the preset for video encoding. Here's an example:
ffmpeg.bat -i 00001.MTS -acodec aac -ac 2 -ab 128k -sn -vcodec libx264 -deinterlace -s 1280x720 -vpre ./libx264-hq.ffpreset -crf 23 -threads 2 00001.mkv
To make it work make sure you've copied the libx264-hq.ffpreset file from ffmpeg archive into the folder with your MTS file to be re-encoded.
Also you can adjust the -crf 23 parameter to steer the final size and quality of the resulting MKV file.
Enjoy!
Subscribe to:
Posts (Atom)