Lê e sente, algumas aulas de escrita e diálogo de línguas latinas, notícias estonteantes e é claro o meu Blog.
Um abraço e apreciem o momento.
Thursday, March 20, 2014
Locating countries from IP Addresses
2.Retrieving the Country Name and Country Code from the IP Number
1. Converting an IP address to an IP Number
IP address (IPv4 / IPv6) is divided into 4 sub-blocks. Each sub-block has adifferent weight number each powered by 256. IP number is being used in the
database because it is efficient to search between a range of number in database.
Beginning IP number and Ending IP Number are calculated based on following formula:
IP Number = 16777216*w + 65536*x + 256*y + z (Formula 1)
where IP Address = w.x.y.z
For example, if IP address is "202.186.13.4", then its IP Number "3401190660" is based on the Formula 1.
IP Address = 202.186.13.4
So, w = 202, x = 186, y = 13 and z = 4
IP Number = 16777216*202 + 65536*186 + 256*13 + 4 = 3388997632 + 12189696 + 3328 + 4 = 3401190660
To reverse IP number to IP address,
w = int ( IP Number / 16777216 ) % 256
x = int ( IP
Number / 65536 ) % 256
y = int ( IP Number / 256 ) % 256
z = int ( IP Number ) % 256
where % is the mod operator and int is return the integer part of the division.
2. Retrieving the Country Name and Country Code from the IP Number
Search the IP-COUNTRY TABLE to match a unique record that has the IPnumber fits between From IP Number and To IP Number.
For example, IP Address "202.186.13.4" is equivalent to IP Number "3401190660". It falls in the following range of IP number in the table because it is between the "From IP number" and the "To IP number".
"3401056256","3401400319","MY","MALAYSIA"
From the IP range, the Country Name is Malaysia and Country Code is MY.
IP-COUNTRY TABLE:
From IP Number |
To IP Number |
Country Code | Country Name |
3400892416 | 3400925183 | HK | HONG KONG |
3400925184 | 3400933375 | TH | THAILAND |
3400941568 | 3400949759 | AU | AUSTRALIA |
3400957952 | 3400966143 | AU | AUSTRALIA |
3400982528 | 3400990719 | HK | HONG KONG |
3400990720 | 3400998911 | ID | INDONESIA |
3400998912 | 3401003007 | PH | PHILIPPINES |
3401007104 | 3401011199 | IN | INDIA |
3401023488 | 3401056255 | TH | THAILAND |
3401056256 | 3401400319 | MY | MALAYSIA |
3401408512 | 3401416703 | HK | HONG KONG |
3401416704 | 3401420799 | KR | KOREA, REPU |
3401441280 | 3401449471 | PH | PHILIPPINES |
3401449472 | 3401515263 | MY | MALAYSIA |
3401531392 | 3401539583 | IN | INDIA |
3401547776 | 3401580543 | MY | MALAYSIA |
3401580544 | 3402629119 | CN | CHINA |
3402629120 | 3404464127 | JP | JAPAN |
3405774848 | 3406434303 | AU | AUSTRALIA |
3406436352 | 3409969151 | AU | AUSTRALIA |
3409969152 | 3410755583 | TW | TAIWAN |
3410755584 | 3410780159 | AU | AUSTRALIA |
3410788352 | 3410796543 | HK | HONG KONG |
3410796544 | 3410800639 | LK | SRI LANKA |
3410812928 | 3410821119 | AU | AUSTRALIA |
3410821120 | 3410853887 | TW | TAIWAN |
3410853888 | 3410862079 | HK | HONG KONG |
3410870272 | 3410874367 | IN | INDIA |
3410878464 | 3410886655 | ID | INDONESIA |
3410886656 | 3410887679 | TW | TAIWAN |
3410894848 | 3410898943 | HK | HONG KONG |
3410903040 | 3410911231 | HK | HONG KONG |
3410919424 | 3410927615 | IN | INDIA |
3410944000 | 3410952191 | PH | PHILIPPINES |
3410952192 | 3410960383 | TW | TAIWAN |
3410968576 | 3410984959 | NZ | NEW ZEALAND |
3410984960 | 3411017727 | TW | TAIWAN |
3411017728 | 3411018751 | HK | HONG KONG |
3411034112 | 3411051519 | HK | HONG KONG |
3411058688 | 3411062783 | AU | AUSTRALIA |
3411066880 | 3411083775 | HK | HONG KONG |
3411087360 | 3411091455 | CN | CHINA |
3411091456 | 3411095551 | SG | SINGAPORE |
3411099648 | 3411107839 | MM | MYANMAR |
3411116032 | 3411124223 | IN | INDIA |
3411132416 | 3411136511 | PK | PAKISTAN |
3411147776 | 3411149311 | HK | HONG KONG |
3411156992 | 3411161087 | PH | PHILIPPINES |
3411165184 | 3411173375 | MY | MALAYSIA |
3411181568 | 3411189759 | JP | JAPAN |
3411197952 | 3411202047 | BD | BANGLADESH |
3411213312 | 3411215359 | HK | HONG KONG |
3411230720 | 3411247103 | HK | HONG KONG |
3411247104 | 3411255295 | AU | AUSTRALIA |
3411278848 | 3411296255 | HK | HONG KONG |
3411312640 | 3411313151 | HK | HONG KONG |
3411329024 | 3411337215 | PH | PHILIPPINES |
3411337216 | 3411341311 | AU | AUSTRALIA |
3411345408 | 3411411967 | HK | HONG KONG |
3411435520 | 3411443711 | IN | INDIA |
3411443712 | 3411460095 | HK | HONG KONG |
3411475456 | 3411476479 | HK | HONG KONG |
3411476480 | 3411509247 | AU | AUSTRALIA |
3411509248 | 3411517439 | PH | PHILIPPINES |
3411525632 | 3411529727 | SG | SINGAPORE |
3411533824 | 3411543039 | CN | CHINA |
3411558400 | 3411566591 | AU | AUSTRALIA |
3411574784 | 3411582975 | IN | INDIA |
3411591168 | 3411595263 | HK | HONG KONG |
3411599360 | 3411607551 | AU | AUSTRALIA |
3411607552 | 3411608575 | CN | CHINA |
3411623936 | 3411632127 | AU | AUSTRALIA |
3411640320 | 3411648511 | PK | PAKISTAN |
3411656704 | 3411673087 | AU | AUSTRALIA |
3411673088 | 3411674111 | CN | CHINA |
3411689472 | 3411701759 | IN | INDIA |
3411722240 | 3411726335 | PH | PHILIPPINES |
3411730432 | 3411738623 | HK | HONG KONG |
3411738624 | 3411739647 | CN | CHINA |
3411755008 | 3411763199 | AU | AUSTRALIA |
3411771392 | 3411779583 | HK | HONG KONG |
3411795968 | 3411804159 | AU | AUSTRALIA |
3411804160 | 3411805183 | CN | CHINA |
3411820544 | 3411832831 | SG | SINGAPORE |
3411836928 | 3411845119 | MY | MALAYSIA |
3411853312 | 3411857407 | IN | INDIA |
3411861504 | 3411869695 | AU | AUSTRALIA |
3411869696 | 3411943423 | CN | CHINA |
3411951616 | 3411967999 | LK | SRI LANKA |
3411968000 | 3411984383 | AU | AUSTRALIA |
3411984384 | 3412000767 | IN | INDIA |
3412000768 | 3412002815 | CN | CHINA |
3412017152 | 3412025343 | SG | SINGAPORE |
3412033536 | 3412066303 | TW | TAIWAN |
3412066304 | 3412213759 | NZ | NEW ZEALAND |
3412213760 | 3412221951 | AU | AUSTRALIA |
3412230144 | 3412246527 | HK | HONG KONG |
3412254720 | 3412262911 | NR | NAURU |
3412262912 | 3412273151 | NZ | NEW ZEALAND |
3412279296 | 3412281343 | NZ | NEW ZEALAND |
Anedotas! LOL
Adivinhas e Anedotas
Um dia na sala do Joãozinho a professora pede a toda a turma para fazerem um trabalho com as palavras green, pink e yellow de inglês.
No dia seguinte a professora pergunta ao Joãozinho:
- Então Joãozinho como é que escreves-te o teu trabalho?
-Hoje tocou o telefone green, green. Atendi e disse:
-Yellow, yellow. Como o senhor que estava do outro lado se tinha enganado no número desliguei e o telefone fez:
-Pink, pink.
O Sr. Tacalado e a sua mulher Graça foram andar de mota, mas esqueceram-se do capacete.
De repente um polícia mandou-os parar e disse:
- O seu nome por favor.
- Tacalado.
- Mau... não lhe admito brincadeiras.
- O seu nome por favor.
- Tacalado. Já lhe disse.
- Desculpe lá, mas onde é que está a graça?
- A minha mulher está aqui ao pé de mim.
Uma vez, um jovem foi a um restaurante e resolveu dar tanga ao empregado.
E diz para consigo. – Hoje, vou dizer tudo por F. Vamos começar.
-Faz favor.
- O que é que o Sr. deseja?
- Frango Frito.
- Com quê?
- Feijão frade.
- Há.
- E para beber?
- Fanta.
-Fanta não temos!
- Frisumo fresco.
- Deseja um cafezinho?
- Forte e fervido.
(algum tempo depois)
- O cafezinho estava bom?
- Frio, fraco, filtro furado, formigas flutuando.
- Desculpe lá o seu nome por favor.
- Fernando Faria Fagundes Filho.
- O que é que o Sr. faz?
- Fui ferreiro.
- Porquê? Já não é?
- Fui forçado.
- Porquê?
- Faltou ferro.
- E que é que o Sr. fazia?
- Ferragens, ferraduras e ferramentas.
- O Sr. tem algum clube?
- Fui Felgueiras.
- Porquê já não é?
- Fez fraco!
- Desculpe lá! Se o Sr. me disser 10 palavras começadas por F vai-se embora sem pagar a conta.
- Foi fixe, fixe fazer fiado facilmente fiquei freguês.
- Ei, ei faltam 2.
- Foste falido.
Diz um menino para uma menina:
-Eu consigo estar mais de cem dias sem comer.
-Como é que consegues?
-Como só de noite!
Diz uma formiga a um elefante:
- É pá, já viste a poeirada que nós estamos a fazer?
Anedota seca.
Era uma vez um jovem que andava no 9º ano sem saber o que era uma flor azul, então tiveram de o reprovar.
Ficou na mesma no 9º ano.
E assim sucessivamente.
Um dia foi atropelado.
Moral da história:
Deve-se olhar para todos os lados antes de se atravessar a rua.
Estava o Joãozinho e o Pedrinho na estação de comboios.
De repente, diz o Joãozinho:
- Se aquele comboio fosse de chocolate por onde começarias a comê-lo?
- Pelas rodas para ele não me fugir.
A professora pergunta ao Pedrinho:
- És do reino vegetal, mineral ou animal?
- Vegetal!
- ...?
- É que eu chamo-me José da Horta.
Qual é a primeira coisa que Pedro Álvares Cabral fez depois de pôr um pé no Brasil?
Pôs o outro!
Qual é o cumulo da estupidez?
Dois carecas estarem a discutir por causa dum pente.
Qual é o cumulo da sorte?
Ser atropelado por uma ambulância.
Um gajo foi a um pintor para ele pintar a última ceia de Jesus.
Passado uma semana, foi lá, pega no quadro e começa a contá-los.
Contou 13 pessoas e disse:
- Ó MAS ELES SÃO 12!!!
- MAS ELE ACABA DE COMER E VAI-SE EMBORA!!!
- ESTÁ BEM QUANDO ELE SE FOR EMBORA EU PAGO-LHE!!!
Monday, February 10, 2014
How to make a new Drupal theme.
How to make a new drupal theme:
Now we have /sites/all/mytheme/ with all the templates files.
On this directory are important files, and that is the important part to make a new theme.
Drupal theme files:
.../sites/all/mytheme/screenshot.png
logo.png
mytheme.info
/css
/images
/color
page.tpl.php
node.tpl.php
template.php
maintenance-page.tpl.php
comment.tpl.php
theme-settings.php
1.screenshot.png:
The screenshot should show the entire page and be about ~960x720 (4:3 ratio) resized to exactly 294x219 (~30% of the original size). Try to show many useful page elements (menu, tabs, title, links). Don't include browser chrome (toolbar, status bar, scrollbar, etc). A screenshot used for display purposes in the admin panel.
2.logo.png:
Your logo, if you are using one.
3.mytheme.info:
A required file that is new to Drupal 6 which provides information about the theme.
4.page.tpl.php
!!!page.tpl.php is the only file which is absolutely required. It overrides the theme('page') function, which outputs the final page contents, along with all the extra decorations like a header, tabs, breadcrumbs, sidebars and a footer.
This template defines the main skeleton for the page.
The main template that defines the content on most of the page.
5.node.tpl.php
This file defines the content of the nodes.
This template controls the display of a node, and a node summary. It can only affect the output of the $content variable.
6.template.php
Any PHP functions in your theme should use the Drupal API and follow best practices for writing secure code. Note that functions should be placed in template.php or a module and not in *.tpl.php.
7.maitenance-page.tpl.php
8.comment.tpl.php
Defines the content of the comments.
9.theme-settings.php
Any PHP functions in your theme should use the Drupal API and follow best practices for writing secure code. Note that functions should be placed in template.php or a module and not in *.tpl.php.
10.html.tpl.php
Default theme implementation to display a single Drupal page.
style.css — The CSS file that sets the CSS rules for the template.
block.tpl.php — Defines the content of the blocks.
box.tpl.php — puts a box around things like comments. See also http://drupal.org/node/11814.
style-rtl.css — this file is new to Drupal 6's Bluemarine. I think it's a CSS for right to left languages and can be ignored if you're using a left-to-right language like English.
#You can create files to override the following functions:
theme('page') (page.tpl.php): theme a page
theme('block') (block.tpl.php): theme a block in sidebar
theme('box') (box.tpl.php): theme a generic container for the main area
theme('comment') (comment.tpl.php): theme a comment
theme('node') (node.tpl.php): theme a node
Useful links for druapl theme information
https://drupal.org/node/341707https://drupal.org/documentation/theme
https://drupal.org/node/173880