Posts Tagged ‘javascript’
Sunday, March 1st, 2009
As I promised about 4 hours ago, here is my introduction to Hyper Text Transfer Protocol in form of a mind map.
It is to be intended as a really short introduction to this protocol. Like the previous one about computer networks, the mindmap summarizes materials copyrighted by Tanenbaum and also material taken from Wikipedia.
The topics covered are:
- Scope of the protocol
- HTTP connection
- HTTP request methods:
- GET
- HEAD
- PUT
- POST
- DELETE
- TRACE
- CONNECT
- OPTIONS
- Message Headers
- Request Headers - all
- Response Headers - all
- Status Codes:
- 1xx Information
- 2xx Success
- 3xx Redirection
- 4xx Client error
- 5xx Server Error
- Sessions:
- Cookies
- Server-Side sessions
- Secure HTTP - HTTPS:
- By URI scheme
- HTTP Upgrade Header
- SSL/TLS
You can browse an HTML version online.
You can download:
As always, you are free and encouraged to contact me in case of errors or anything else.
Hope you like it!
Tags: bd, BD-thing, BD-things, Client, client error, code, computer networks, CONNECT, contact, DELETE, Download, HEAD, HTTP, HTTPS, hyper text transfer protocol, java, javascript, message headers, mindmap, Networks, page, pageTracker, PDF, PNG, png format, POST, promise, PUT, request headers, request methods, response headers, server error, server side, sessions, source, source file, Status, Tanenbaum, Text, tls, TRACE, Transfer, Upgrade, URI, version, wikipedia
Posted in Activism?, Unibz | No Comments »
Wednesday, December 3rd, 2008
For job purposes I had to learn a lot of JavaScript, including AJAX related stuffs. Like every lazy (but intelligent) developer, I looked around for frameworks that could help me doing my work. I knew that prototype existed, but I never looked at it because of lack of interest. Well it's great, it's really great! Nowadays everybody should use frameworks, as their abstraction permits a rapid development without worrying about things like platform compatibility, in our case browsers. Prototype also has a very nice and clean syntax that overtakes functions not compatible with every browser.
In this post I'm going to report a very nice function I implemented for limiting Form input fields, like textarea and input of type text. You have to call it via onkeyup and onkeydown events. The function accepts 3 parameters: field, limit and counterDesired.
The first is the field object, you should use the keyword this for a value.
The second parameter is a limit value, the number of characters that the field should contain at maximum.
The third parameter is optional, false as default. It permits to add a visual counter after the field, like the one you see on YouTube, for example. You can either tell to the function to add the counter for you (put inside a <span> block) or to put it inside another block you've already defined. In the second case, the block must have an id of the form 'fieldID_counter'
This is the compact version, see below for some examples and the expanded, explained version:
<script type="text/javascript">
// < ![CDATA[
function limit_text(field, limit, counterDesired) {
if (counterDesired == null)
counterDesired = false;
var length = $F(field).length;
if (length > limit)
$(field).value = $(field).value.substring(0, limit);
if (counterDesired) {
if ($($(field).id + '_counter')) {
$($(field).id + '_counter').update($F(field).length + " / " + limit);
} else {
var counterText = new Element('span', {'id': $(field).id + '_counter'});
counterText.update($F(field).length + " / " + limit);
$(field).insert({'after': counterText});
}
}
}
// ]]>
</script>
(more...)
Tags: abstraction, ajax, bd, BD-thing, BD-things, browser, field id, frameworks, java, javascript, job, limit form field, limit textarea, onkeydown, onkeyup, platform compatibility, prototype, rapid development, stuff, syntax, textarea, version
Posted in Programming | No Comments »
Sunday, November 23rd, 2008
I really like (and miss) Linux Mint Menu (mintmenu), so I installed it on my Debian Sid box and here is how I managed it:
- Install mintsystem and mintmenu deb packages, either by adding mint repository to yout sources.list file or by downloading them from mint packages or simplier, by grabbing them from my blog
- Help it to recognize your applications by symlinking some files in /etc/xdg/menus (as root):
ln -s gnome-applications.menu applications.menu
ln -s gnome-preferences.menu preferences.menu
ln -s gnome-settings.menu settings.menu
- Add mintMenu to your Gnome panel..
et voilà! Here are the two deb files I'm using:
mintsystem_61_all
mintmenu_4.2_all
Here is an updated screenshot:

MintMenu complete under Debian Sid
If you also want to enable beagle or tracker, be sure to add the correct search command in the preferences of mintMenu (see the screenshot)
Tags: bd, BD-thing, BD-things, Blog, deb files, debian, debian sid, Download, java, javascript, link, linux, list, menu settings, mint, mintmenu, page, repository, screenshot, set, sito
Posted in Activism?, Programming | 2 Comments »
Wednesday, October 1st, 2008
I began today to check my theme pages for passing W3C's Validator test against XHTML 1.0 Strict. There is still some work to be done before it will be ready but I would like to share with you a modified version of the very useful Expanding Text Plugin for Wordpress, which lets you to create blocks of text in posts or which either expand or collapse when clicked on. I really like the plugin, but I noticed that it does not produce valid XHTML tags. Here is a light modification of the plugin which outputs valid XHTML blocks: dd-expanding-text-valid-xhtml
Tags: bd, BD-thing, BD-things, bodom_lx free software, Design, Download, java, javascript, page, theme, version, wordpress, wordpress plugins, XHTML
Posted in Activism?, Free*, Programming | No Comments »
Tuesday, September 30th, 2008
When I announced BD-incollo 6 days ago, I also mentioned that I would have launched the service today. I really did that, and I'm very proud to announce the first site that runs BD-incollo.
http://incollo.com! Very easy 
Incollo.com is a collaborative debugging tool like Pastebin or other similar services, but it's slightly different from it. And it's different from other Pastebin clones even written using Rails or Django.
Here are the most exciting features:
- It's Fast. Very Fast
- Written thinking about usability
- A very clean interface, a minimalist design that gives space to the code (as it should always be)
- It's possible to search through pastes, like in a forum
- A Paste is not deleted after 30 days or something similar. A paste is deleted after it is no more interesting! It's deleted after 60 days of no visualizations
- The system is anonymous. It won't store your information! Paste whatever you want but please use your brain! A Paste may be reported to the administrator!
- You don't really have to play with options and there are no required field other than the Paste itself. You may paste a text and directly hit the submit button
- Quite every page is XHTML 1.0 compatible
- It works well and has nice urls, thanks to Django
- Compatible with every browser (tested with Internet Explorer 6,7,8, Mozilla Firefox 3, Apple Safari, Google Chrome)
- Resolution friendly! Liquid design that adapts to every monitor resolution (tests from 1024x768)
- Developer friendly! Every functionality of incollo.com can be used with max 2 mouse clicks and without a mouse scroll!
- Tested with lots of pastes, quite every source code should be perfectly viewed (this does not happen with every pastebin clones I've tried)
- Uses Pygments for code highlighting
- Languages supported: ActionScript, Assembly (various), Boo, Befunge, BrainFuck, C, C++, C#, Common Lisp, D, Delphi, Dylan, Erlang, Haskell (incl. Literate Haskell), Java, JavaScript, Lua, MiniD, MooCode, MuPad, OCaml, PHP, Perl, Python (incl. console sessions and tracebacks), Redcode, Ruby (incl. irb sessions), Scheme, Visual Basic.NET, Django/Jinja templates, ERB (Ruby templating), Genshi (the Trac template language), Myghty (the HTML::Mason based framework), Mako (the Myghty successor), Smarty templates (PHP templating), JSP (Java Server Pages), , Other markup, , Apache config files, Bash shell scripts, BBCode, CSS, Debian control files, Diff files, Gettext catalogs, Groff markup, HTML, INI-style config files, IRC logs (irssi style), Makefiles, MoinMoin/Trac Wiki markup, Redcode, ReST, SQL, also MySQL, Squid configuration, TeX, Vim Script, Windows batch files, XML
This is an example of Paste with Incollo.com:
http://incollo.com/7dca5011
You are really welcome to report any bugs or leave a feedback! Remember that this is my very first Django project, and I created it in about 6 days!
Of course, I'm already beginning to think about new features
Tags: apple safari, bd, BD-incollo, BD-thing, BD-things, beginning, browser, bugs, Chrome, code, configuration, debian, debugging, Design, django, Explorer, Firefox, functionality, google, Internet, java, javascript, language, list, minimalist design, mozilla, page, pastebin, php, project, Pygments, python, shell, site, source code, templates, url, usability, XHTML
Posted in Activism?, Free* | No Comments »
Monday, April 28th, 2008
Time for two new C programs! At the DSA course I learned something about Hash Tables and collision resolutions.
I just implemented insert/search/print operations.
The first source code is an implementation of a Hash Map with open addressing (linear probing) as collision resolution method.
The following are the interesting functions of the program. As always, take a look at the source code for comments:
// hashMapLinear[] is the hash map
void linearProbingInsert
(int value
){
int probe = hash
(value
);
while (hashMapLinear
[probe
]!=
0){
probe = fmod
((probe
+1),SIZE_HASH_MAP
);
}
hashMapLinear
[probe
] = value;
}
int linearProbingSearch(int value){
int probe = hash(value);
int i;
for(i=0;i<size_hash_map ;i++){
if(hashMapLinear[probe]==value)
return TRUE;
probe = fmod((probe+1),SIZE_HASH_MAP);
}
return FALSE;
}
Download: hash-map-linear-probing.c
The second program is an implementation of a Hash Map with chaining as collision resolution method.
Interesting functions:
// t_hashTableNode is a struct that is created as single linked list
void chainedHashInsert
(int value
){
int probe = hash
(value
);
if(hashMapChained
[probe
] ==
NULL){
hashMapChained
[probe
] = malloc
(sizeof(t_hashTableNode
));
hashMapChained
[probe
]->value = value;
hashMapChained
[probe
]->next =
NULL;
}else{
t_hashTableNode *hashTableNode = hashMapChained
[probe
];
while(hashTableNode->next!=
NULL){
hashTableNode = hashTableNode->next;
}
hashTableNode->next = malloc
(sizeof(t_hashTableNode
));
hashTableNode->next->value = value;
hashTableNode->next->next =
NULL;
}
}
int chainedHashSearch(int value){
t_hashTableNode *hashTableNode = hashMapChained[hash(value)];
while(hashTableNode!=NULL){
if(hashTableNode->value==value){
return TRUE;
}
hashTableNode = hashTableNode->next;
}
return FALSE;
}
Download: hash-map-chaining.c
Tags: address, algorithms, bd, BD-thing, BD-things, C language, code, data structures, Download, hash, hash map, hash table, java, javascript, link, list, page, php, source code
Posted in Programming | No Comments »