OSNews asks: What's in the Dalvik cache?
And one of the commenters points to interesting reference document:
http://www.netmite.com/android/mydroid/dalvik/docs/dexopt.html
Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
2012-07-22
2012-05-26
Elegant Event Handling in Java
Here's a comment I added to a great post with a very nice piece of Java code:
Elegant Event Handling in Java
And here is a link to original code on GitHub: EventListeners.java
Elegant Event Handling in Java
Yes, that's very elegant. I was implementing some Java class, when I went "hey, I need to handle events". I know how to do this in Delphi and .NET/C#, and I know how to use Swing events (even if I don't really like their approach).
So I've looked into JButton searching for "actionPerformed()" method, but no luck.
Then I went to AbstractButton and found "fireActionPerformed()" - which looked pretty ugly.
I even went to EventListenerList - to confirm my suspicion, that there is a mess in Java regarding events. And it is inherited from old, pre-generics, Swing design.
I knew there must have been some better way.
I've found Mr HappyObject - funny, but not so useful.
Then this: How To Create Your Own Events In Java - little better, and with synchronized methods (nice bonus).
This one looked promising: Generic event code - quite promising, but I kept on looking.
But your code is the best so far. I'm going to test it and will probably use it in my internal, little project.
Thanks a lot!
And here is a link to original code on GitHub: EventListeners.java
2010-04-09
2010-02-26
2010-02-21
Java Triggers and the Oracle Database
Fine article with a nice and easy to understand example:
http://java.sun.com/developer/technicalArticles/javase/oracle_db_triggers/?feed=JSC
http://java.sun.com/developer/technicalArticles/javase/oracle_db_triggers/?feed=JSC
2009-02-16
Ironic view at software diagramming
http://www.theregister.co.uk/2007/08/16/verity_stob_software_diagramming/
Somewhat funny look at different diagramming techniques over the course of years. I suspect the author's experience cannot let him feel the 'real' power of UML to use it correctly. Although UML is far from perfect, it's the best we have now (similiar to what Churchill has said about democracy).
But anyway, there is a hidden gem in the above article, a link to an open-source State Machine Compiler: http://smc.sourceforge.net/
Somewhat funny look at different diagramming techniques over the course of years. I suspect the author's experience cannot let him feel the 'real' power of UML to use it correctly. Although UML is far from perfect, it's the best we have now (similiar to what Churchill has said about democracy).
But anyway, there is a hidden gem in the above article, a link to an open-source State Machine Compiler: http://smc.sourceforge.net/
2009-01-12
2008-12-28
Spaghetti code? Meet lasagna and ravioli code!
An old joke, but a good one: http://www.gnu.org/fun/jokes/pasta.code.html
There are plenty more: http://www.gnu.org/fun/humor.html
And my favourite: http://www.gnu.org/fun/jokes/helloworld.html
However there is an ugly error, in the code they use
There are plenty more: http://www.gnu.org/fun/humor.html
And my favourite: http://www.gnu.org/fun/jokes/helloworld.html
However there is an ugly error, in the code they use
void main():This is non-standard (process returns a random number upon completion). It should rather be
New professional
#include <stdio.h>
void main(void)
{
char *message[] = {"Hello ", "World"};
int i;
for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}
int main() instead - with a correct, standard behavior (process returns 0, even if final return 0; is omitted). Using void main() implies the dreaded "undefined behavior"...
Fork Ruby?
As Kroc Camen mentions in his article, Ruby came to the point where the mainline codebase became somewhat bloated. One interesting thing is that he mentions a need to redesign Ruby's syntax, to incorporate multithreading capabilities better. Exactly what C++09 intends to do with regard to multithreading quite soon. Nice, nice, nice! One more reason to learn new C++ :)
And he then says:
Nice touch, especially since that's exactly what I'm looking for :)
And he then says:
Clearly then, even after 50 years of general-purpose computing we still haven't come up with the answer to the final language to describe it all.
Nice touch, especially since that's exactly what I'm looking for :)
2008-12-20
JFXBuilder - The First JavaFX Visual Designer
A cool Java Web Start application for creating JavaFX files. Good!
http://www.reportmill.com/jfx/
Also an original announcement:
http://www.reportmill.com/news/2008_12.html
http://www.reportmill.com/jfx/
Also an original announcement:
http://www.reportmill.com/news/2008_12.html
2008-11-17
What's new in PHP V5.3, Part 1
What's new in PHP V5.3, Part 1: Changes to the object interface
http://www.ibm.com/developerworks/opensource/library/os-php-5.3new1/index.html
http://www.ibm.com/developerworks/opensource/library/os-php-5.3new1/index.html
2008-10-01
jQuery to ship with ASP.NET MVC and Visual Studio
Blog entry of Scott Hanselman with simple, yet effective example:
http://www.hanselman.com/blog/jQueryToShipWithASPNETMVCAndVisualStudio.aspx
http://www.hanselman.com/blog/jQueryToShipWithASPNETMVCAndVisualStudio.aspx
2008-06-28
.NET Framework Naming Guidelines
Now that's interesting. I already knew there are naming conventions for Java, however .NET doesn't seem to be left behind. Go and check it out:
http://msdn.microsoft.com/en-us/library/xzf533w0.aspx
http://msdn.microsoft.com/en-us/library/xzf533w0.aspx
2008-06-27
The A-Z of Programming Languages: C++
Bjarne Stroustrup of C++ fame dissects the history of his famed programming language:
http://www.computerworld.com.au/index.php/id;408408016;pp;1;fp;16;fpid;1
(and a single page for printing)
http://www.computerworld.com.au/index.php/id;408408016;pp;1;fp;16;fpid;1
(and a single page for printing)
2008-06-24
2008-06-11
UNA - collaborative free source code editor
Editor that presents unique approach to collaborative work. Supports many programming languages, integrates with Exuberant CTags, offers superior configurability and has a highly usable user interface.
Interview: John De Goes Introduces a Newly Free Source Code Editor
Interview: John De Goes Introduces a Newly Free Source Code Editor
2008-04-14
The Spider of Doom
From http://thedailywtf.com/Articles/Best_of_2006_0x3a__The_Spider_of_Doom.aspx
And there's a great moral in it:
http://www.pradosoft.com/forum/index.php/topic,6977.msg31702.html#msg31702
Josh Breckman worked for a company that landed a contract to develop a content management system for a fairly large government website. Much of the project involved developing a content management system so that employees would be able to build and maintain the ever-changing content for their site.
Because they already had an existing website with a lot of content, the customer wanted to take the opportunity to reorganize and upload all the content into the new site before it went live. As you might imagine, this was a fairly time consuming process. But after a few months, they had finally put all the content into the system and opened it up to the Internet.
Things went pretty well for a few days after going live. But, on day six, things went not-so-well: all of the content on the website had completely vanished and all pages led to the default "please enter content" page. Whoops.
Josh was called in to investigate and noticed that one particularly troublesome external IP had gone in and deleted *all* of the content on the system. The IP didn't belong to some overseas hacker bent on destroying helpful government information. It resolved to googlebot.com, Google's very own web crawling spider. Whoops.
After quite a bit of research (and scrambling around to find a non-corrupt backup), Josh found the problem. A user copied and pasted some content from one page to another, including an "edit" hyperlink to edit the content on the page. Normally, this wouldn't be an issue, since an outside user would need to enter a name and password. But, the CMS authentication subsystem didn't take into account the sophisticated hacking techniques of Google's spider. Whoops.
As it turns out, Google's spider doesn't use cookies, which means that it can easily bypass a check for the "isLoggedOn" cookie to be "false". It also doesn't pay attention to Javascript, which would normally prompt and redirect users who are not logged on. It does, however, follow every hyperlink on every page it finds, including those with "Delete Page" in the title. Whoops.
After all was said and done, Josh was able to restore a fairly older version of the site from backups. He brought up the root cause -- that security could be beaten by disabiling cookies and javascript -- but management didn't quite see what was wrong with that. Instead, they told the client to NEVER copy paste content from other pages.
And there's a great moral in it:
Try not to pass parameters in the URL the can make changes to your application, the URL should be "idempotent", that is, the same URL should display the same results each time (to certain extent). E.g. passing a parameter to delete something is a really bad idea most of the times.
http://www.pradosoft.com/forum/index.php/topic,6977.msg31702.html#msg31702
Subscribe to:
Posts (Atom)
