If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Per esempio se volete che la vostra stringa sia di 10 caratteri e che i caratteri aggiuntivi siano degli zero, potreste usare questo codice:
$valore = str_pad($valore, 10, 0);
che sfrutta questa funzione php:
string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
This functions returns the input string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.
Che in pratica vuol dire:
La fuzione restituisce la stringa “$input” allungata a destra, a sinistra o da entrambi i lati fino ad arrivare alla lunghezza definita ($pad_lenght). Se non è definito il parametro $pad_string, la stringa viene allungata per mezzo di spazi.
Non ci riesco proprio: mi sono letto le pagine del supporto di google e alcuni post che dovrebbero spiegare come raggiungere questo ambito risultato. Qualcuno che è riuscito a collegare gli account di google adsense con google analitycs per tracciare da che pagine o parole chiave si ottengono le migliori conversioni potrebbe darmi una mano? Grazie mille!
XHTML, code, codice, js/ajax, programmazione
Css, Links, XHTML, code, firefox, osx
If you want to find non used CSS styles aka orphan CSS classes or ID or simply styles let’s install “Dust-Me Selectors” FIREFOX extension:
Dust-Me Selectors is a Firefox extension (for v1.5 or later) that finds unused CSS selectors.
It extracts all the selectors from all the stylesheets on the page you’re viewing, then analyzes that page to see which of those selectors are not used. The data is then stored in your user preferences, so that as you continue to navigate around a site, selectors will be crossed off the list as they’re encountered.
Css, Graphics, XHTML, code, iphone, mac, osx
this is the code to attach a custom css for the iphone browser only (soon my blog will have an iphone css).
<link media=”only screen and (max-device-width: 480px)”
href=”iPhone.css” type=”text/css” rel=”stylesheet” />
So you are a java programmer and you loose many minutes waiting for re-deploy time every time you’ve got to test a change in HTML or CSS. Please stop and read on:
1. download and install scrapbook extension for firefox
2. open in firefox the page you want to modify
3. save the page with ScrapBook extension
4. open the scrapbook dock (control + K on WIN, option + K on OSX)
5. look for your html page
6. left click on page, choose TOOLS and then SHOW FILES
7. edit HTML or CSS to test your modification
8. reload the page (the one saved by ScrapBook)
if you have to test only CSS, let’s give a try to editCSS firefox extension that let you edit a site CSS and see changes on the fly for all the pages you browse.
Chapter 1: Introduction to Django
Chapter 2: Getting started
Chapter 3: The basics of generating Web pages
Chapter 4: The Django template system
Chapter 5: Interacting with a database: models
here the toc
echo "pippo" | sed "s/pi/si/g"
Why unix commands and scripts are so unreadable and geek?
Chapter 3 of the free DJANGO BOOK has been released:
Your first view: Dynamic content
As our first goal, let’s create a Web page that displays the current date and time. This is a good example of a dynamic Web page, because the contents of the page are not static — rather, the contents change according to the result of a computation (in this case, a calculation of the current time).
This simple example doesn’t involve a database or any sort of user input — just the output of your server’s internal clock.
Links, Software, code, mac
Do you wanna try Ruby On Rails on OSX? Don’t you want to go crazy with command line instructions? Here you are: MacOsX Ruby on Rails installer (locomotive).
Drag-n-drop is all there is to installing Locomotive. Try Ruby on Rails without worrying about breaking your current system – it’s entirely self-contained. You can always muck around on the command line and irrevocably modify your system with a custom install later, but after trying Locomotive, most people don’t need anything more.
Links, XHTML, code
- easy to learn, fast to write: it should be as fast as writing HTML (the farther it goes from HTML the worse is)
- programming logic should be not visible (no PHP or ASP code, no sql – is xsl/xpath simple enought?)
- fully documented and supported by an active user community: if you have a problem, you should be able to solve it quickly, maybe with help from some community help or knowledge base like a wiki, a forum or a manual)
- editable with preview with wysiwyg tools (like dreamweaver): you don’t have to change HTML programmer habits
- errors should not block all the template rendering
- errors should be easy to identify and correct
- templating language you choose should be a standard or widely used (quite important for your selling)
- there should be templates, functions, addon or macro (I mean something that can help you to make difficoult tasks easy)
- fast rendering (maybe It should let you to control caching logics)
- different outouts (html, xml, text and so on)
smarty, cheetah, freemarker, velocity, webmacro…
So do you want to choose what CMS install for your website company? You can code and there is some html specialist that can skin the contents. What kind of templating system you should choose to let the HTML people work easily?
Here some tips:
you should not use JSP (Why JSP Sucks So Hard) cause:
the “not Java” that is included in the HTML page is completely alien to (most) HTML authors, that it might as well just be Java for all they know or care. So I have to put some
exec:iterator condition="_%= shopBean.validate() %_" right here, or nothing on the page will work? Yeah, okay. How do I test that again?
You can check the “Apache :: HTML :: ClassParser“, but I’m not really sure you wanna mix CSS style names with something that sounds like a xpath code (”append::href::flavor_id”)?
The XML / XSL templating can be interesting, but there are some problems: no preview (without XML SPY or similar), unreadable error reports, simple but not zero learning time language (XSLT)..
A good solution seems the “custom templating system” like the WORDPRESS one..
If you want to explore many more solutions let’s read this article: Choosing a Templating System!