2010-10-22
2010-10-19
The OMG Cat / Az "Óh, jajj, Istenem!" macska
Original / Eredeti
~ sees car accident / ~ autóbalesetet lát
OMG Cat sees Car Accident - watch more funny videos
2010-10-15
Ruby is not good at comments
Problem
Imagine that you are hard-coding some long list into your Ruby code and you need to- wrap the long line into multiple lines
- comment on some items
@@import_fields = [ \
"Name" \
, "Organization" \
, "Role" \
, "Internal ID" \
];
Pretty ugly, because the statement separator is the newline and you should escape it. But doable. Let's move on!Completing the second goal is not possible. The only commenting option is the line-commenting which is starts with the
# sign and ends when the line ends. If you place the comment before the backslash (\), your interpreter will not detect the newline escaper backslash. If you place the comment after it, then it stops being a newline escaper.Nonexistent solutions
- The Ruby guys failed to add statement separators / terminators to the language and that remains this way. I think the intention was to make life easier, but I believe they made it harder. Someone someday may enlighten me.
- They should introduce block comments. It would be backward compatible and would make the World a better place.
- Or they should detect the newline escaping after the
#sign.
Workaround
@@import_fields = [] @@import_fields << "Name" @@import_fields << "Organization" # Some clever saying about this field @@import_fields << "Role" @@import_fields << "Internal ID" # And some eternal wisdom about this
If you know a better way, don't hesitate to tell me!
2010-10-13
Indent with TABs, format with spaces
TABs vs spaces
UNICODE 2.0 released in year 1996. In around 2001 people wanted to kill me because I used UTF-8 characters on IRC, and they argued that their [not so good] software cannot render them correctly. I ignored them. Their [not so good] software became advanced, their minds became open.
Editors and devices where the visible width of TAB characters cannot be adjusted are not so good. TAB is not a new invention at all.
If you want to graphically align something then you should use SPACES. If you are expressing the depth of control, then you should use TAB. The above code will maintain it's visual, see:
The hairdo is still tight.
What if someone's favorite visual TAB size is 2?
The hairdo is still tight.
Favorite part: ... tabs for leading indent, spaces everywhere else. I prefer this strategy for the same reason I prefer to use symbolic names for constants, rather than embedding numeric literals throughout my source code ...
1st: Visible with
They say that TABs are rendered differently by different softwares and devices. I cannot accept that. Read on.UNICODE 2.0 released in year 1996. In around 2001 people wanted to kill me because I used UTF-8 characters on IRC, and they argued that their [not so good] software cannot render them correctly. I ignored them. Their [not so good] software became advanced, their minds became open.
Editors and devices where the visible width of TAB characters cannot be adjusted are not so good. TAB is not a new invention at all.
2nd: Formatting
TABs are not for formatting. They are only for indenting.int·main()
{
→ printf("Hello·%s!\n",·//·I·like·to·move·it,
→ ·······"World");······//·move·it.
→ return 0;
}
If you want to graphically align something then you should use SPACES. If you are expressing the depth of control, then you should use TAB. The above code will maintain it's visual, see:
int·main()
{
→ {·//·Ad-hoc·block·begin
→ → printf("Hello·%s!\n",·//·I·like·to·move·it,
→ → ·······"World");······//·move·it.
→ → return·0;
→ }·//·Ad-hoc·block·end
}
3rd: Freedom
See what happens when visible with of TAB is set to 8, because someone may like it that way:int·main()
{
→ {·//·Ad-hoc·block·begin
→ → printf("Hello·%s!\n",·//·I·like·to·move·it,
→ → ·······"World");······//·move·it.
→ → return·0;
→ }·//·Ad-hoc·block·end
}
The hairdo is still tight.
What if someone's favorite visual TAB size is 2?
int·main()
{
→ {·//·Ad-hoc·block·begin
→ → printf("Hello·%s!\n",·//·I·like·to·move·it,
→ → ·······"World");······//·move·it.
→ → return·0;
→ }·//·Ad-hoc·block·end
}
The hairdo is still tight.
4th: Symbolism
From my heart: http://www.mail-archive.com/vim_use@googlegroups.com/msg18895.htmlFavorite part: ... tabs for leading indent, spaces everywhere else. I prefer this strategy for the same reason I prefer to use symbolic names for constants, rather than embedding numeric literals throughout my source code ...
2010-09-09
2010-08-23
Stephen Fry & Hugh Laurie
Régi cucc, ami csak nekem új. Dr House egy másik élete.
Old stuff which is new for me. Another life of Doctor House.
Old stuff which is new for me. Another life of Doctor House.
2010-08-16
Villamosos üldözés / Tram pushuit
Have a good evening!
In current days, while the criminal acts are spreading, the daredevils of the gangland invent newer and newer ways to deliver their deeds.
The following police recording proofs that criminals are not picky about the vehicles they use during robbery.
In current days, while the criminal acts are spreading, the daredevils of the gangland invent newer and newer ways to deliver their deeds.
The following police recording proofs that criminals are not picky about the vehicles they use during robbery.
2010-08-15
2010-08-12
Editing JPEG DPI without resampling
The title is the naive search term for a problem. The good search term - or Google power phrase - is
P.S.: I decided to publicate the fruit of every hard and exhausting search on this blog. Maybe it is not good for the regular visitor, but I'm sure it helps the Universe in general. :-)
--- Hungarian version
JPEG DPI szerkesztés: Ez a jó neked:
Exif editor. The best of the results which simply solves the problem is the
Exif Piloton an
Exif editorspage. Enjoy!
P.S.: I decided to publicate the fruit of every hard and exhausting search on this blog. Maybe it is not good for the regular visitor, but I'm sure it helps the Universe in general. :-)
--- Hungarian version
JPEG DPI szerkesztés: Ez a jó neked:
Exif Pilotaz
Exif editorsoldalról.
2010-08-11
Welcome to Ruby
myString = "Welcome to JavaScript!" => "Welcome to JavaScript!" myString[8..20]= "Ruby" => "Ruby" puts myString => "Welcome Ruby!"
2010-07-22
LOLCODE
lolcatInternet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University.
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven Turing-complete.
-- Wikipedia
Examples
- Hello World!
HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
- Print numbers from 1 to ROOF.
HAI CAN HAS STDIO? I HAS A ROOF, I HAS A VAR ITZ 0 GIMMEH ROOF BTW U R IN CONTROL IM IN YR LOOP UP VAR!!1 IZ VAR BIGGER THAN ROOF? KTHXBYE VISIBLE SMOOSH VAR AN ":)" MKAY IM OUTTA YR LOOP KTHXBYE
→ lolcode.com
2010-07-20
2010-07-18
Publishing detailed error messages
As an opposition to "Hiding error details". On the input of [Posa1996]1 page 43 (Architectural patterns (2) / Layers (2.2) / Implementation / 10):
I have to strongly disagree with the author on that point. It is far more worse if the highest layer of all gets an error like "Error." without any details. The error message should be as detailed as possible. Do not be confused! That does not mean that higher layers should not handle these errors in a grouped manner. For example if a file transfer fails on any reason the program logic should abort the transaction, whatever the reason of the failure is, so the so called voluminous error-handling code can be avoided. Not handling but publishing the details of the error can help the user understand and solve the problem. Making distinction between "Directory not found.", "Drive not ready.", and "Permission denied." is very useful at the level of the user (or customer care, product support line, developer, whoever).
Testing, debugging and user support can be a horror without detailed error messages. It can be counted in serious amount of money. If the user does understand the error message then it is an instant win for the user himself/herself and for the customer care both. If he/she doesn't understand then he/she has something to tell at official and unofficial support forums which will bring the solution closer. It is a win-win decision to keep the error messages detailed.
And again, it does not contradict the "keep the volume of error-handling code low" principle. Handling ≠ publishing.
→ 1: [Posa1996] Frank Buschmann et al.: Pattern-oriented software architecture, Volume 1: A system of patterns; © 1996 John Wiley and sons
Design an error handling strategy. Error handling can be rather expensive for layered architectures with respect to processing time and, notably, programming effort. An error can either be handled in the layer where it occurred or be passed to the next higher layer. In the latter case, the lower layer must transform the error into an error description meaningful to the higher layer. As a rule of thumb, try to handle errors at the lowest layer possible. This prevents higher layers from being swamped with many different errors and voluminous error-handling code. As a minimum, try to condense similar error types into more general error types, and only propagate these more general errors. If you do not do this, higher layers can be confronted with error messages that apply to lower-level abstractions that the higher layer does not understand. And who hasn't seen totally cryptic error messages being popped up to the highest layer of all - the user?
I have to strongly disagree with the author on that point. It is far more worse if the highest layer of all gets an error like "Error." without any details. The error message should be as detailed as possible. Do not be confused! That does not mean that higher layers should not handle these errors in a grouped manner. For example if a file transfer fails on any reason the program logic should abort the transaction, whatever the reason of the failure is, so the so called voluminous error-handling code can be avoided. Not handling but publishing the details of the error can help the user understand and solve the problem. Making distinction between "Directory not found.", "Drive not ready.", and "Permission denied." is very useful at the level of the user (or customer care, product support line, developer, whoever).
Testing, debugging and user support can be a horror without detailed error messages. It can be counted in serious amount of money. If the user does understand the error message then it is an instant win for the user himself/herself and for the customer care both. If he/she doesn't understand then he/she has something to tell at official and unofficial support forums which will bring the solution closer. It is a win-win decision to keep the error messages detailed.
And again, it does not contradict the "keep the volume of error-handling code low" principle. Handling ≠ publishing.
→ 1: [Posa1996] Frank Buschmann et al.: Pattern-oriented software architecture, Volume 1: A system of patterns; © 1996 John Wiley and sons
0
comments
Labels:
error handling,
prog,
reading diary,
software design,
UI
2010-07-16
Processing.org

Processing is an open source programming language and environment for people who want to create images, animations, and interactions. Initially developed to serve as a software sketchbook and to teach fundamentals of computer programming within a visual context, Processing also has evolved into a tool for generating finished professional work. Today, tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production.
→ processing.org
The apropo for posting this is that I regenerated my toy applets that I wrote in this environment.
→ My graphic applets, with source code. Enjoy!
2010-07-14
Silver needle in the Skype
by Philippe BIONDI and Fabrice DESCLAUX
BlackHat Europe, March 2nd and 3rd, 2006
→ skype_BHEU06.pdf
Repost of a synsecblog entry.
If you can repeat their results you rock!!!
BlackHat Europe, March 2nd and 3rd, 2006
→ skype_BHEU06.pdf
Repost of a synsecblog entry.
If you can repeat their results you rock!!!
Codility (x)
Automated tests of programming skills.
Codility saves time of software talent recruiters by filtering out job candidates who cannot write correct programs.
Codility administers short programming tests and checks whether solutions are rock solid.
Our customers filter out up to 90% of candidates. Less wasted time. Better hires.
→ http://codility.com/
2010-07-09
Subscribe to:
Posts (Atom)


