HEMANT SONKER’S BLOG

September 22, 2007

Cake php

Filed under: cake php — Hemant Sonker @ 1:29 pm

Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.

  1. Hot Features:
    • Model, View, Controller Architecture
    • View Helpers for AJAX, Javascript, HTML Forms and more
    • Built-in Validation
    • Application Scaffolding
    • Application and CRUD code generation via Bake
    • Access Control Lists
    • Data Sanitization
    • Security, Session, and Request Handling Components
    • Flexible View Caching
    • And More…
  2. Active, Friendly Community - Just join our IRC channel to see who’s in. We’d love to help you get started.
  3. Flexible License - Cake is distributed under the MIT License
  4. Clean IP - Every line of code was written by the CakePHP development team
  5. Extremely Simple - Just look at the name…It’s Cake
  6. Rapid Development - Build apps faster than ever before .
  7. Best Practices - Cake is easy to understand and sets the industry standard in security authentication, and session handling, among other features.
  8. OO - Whether you are a seasoned object-oriented programmer or a beginner, you’ll feel comfortable
  9. No Configuration - Set-up the database and watch the magic begin

September 21, 2007

More stuffs on Ruby

Filed under: ruby — Hemant Sonker @ 4:16 pm

Variables and identifers normally start with an alphabetic letter or a special modifier.

  • Local variables (&pseudo-variables such as self and nil) begin with a lowrcase letter.
  • Global variables begin with dollar sign($)
  • Instance variables with an object begin with an at sign(@)
  • Class variables within a class begin with two at signs @@.
  • Constant begin with capital letters.

For Example

  1. local variables: alpha_ident,gama
  2. pseudo-variables:self,nil
  3. Constants:LENGTH,Length
  4. Instance variables:@sum,@not_const
  5. Class variable:@@my_var
  6. Global variable:$beta,$pi

We will see some codes in ruby in the next post

Scroll area with overflow in CSS

Filed under: css — Hemant Sonker @ 1:15 pm

Small Scrollable Areas

Scrollable areas on webpages has become increasingly popular after being used by some leading design communities on internet. Scroll areas can be done with a textarea or iframe tags, but a more frequent way of doing it is through using the abilities that already lies within HTML and CSS for any block element. A normal block element like <div> can be set to a certain height and width. What happens when the content of the element exceeds the size given to it?

Enter the CSS property overflow.

  • overflow: auto - This will insert a scrollbar - horizontal, vertical or both only if the content in the block requires it. For practical purposes, this is probably the most useful for creating a scrolling area.
  • overflow: scroll - This will will insert horizontal and vertical scrollbars. They will become active only if the content requires it.
  • overflow: visible - This will cause the block to expand to view the content.
  • overflow: hidden - This forces the block to only show content that fits in the block. Other content will be clipped and not hidden with no scrollbars.

for example

<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>scrolling</title>
<style type=”text/css”>
<!–
div.scroll {
height: 200px;
width: 300px;
overflow: auto;
border: 1px solid #666;
background-color: #ccc;
padding: 8px;
}
–>
</style>
</head>

<body>

<div class=”scroll”>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>
<span style=”color: red;”>This is red color</span>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh.</p>
<p>This is a normal paragraph.
<span style=”font-weight: bold; font-size: 22px;”>This is big bold text</span>
</p>
<p>This scrolling are can contain normal html like <a href=”#”>link</a></p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh.</p>
</div>

</body>

</html>
save this code and run.

Layer on layer with z-index (Layers)

Filed under: css — Hemant Sonker @ 12:26 pm

CSS operates in three dimensions - height, width and depth. . In this, we will learn how to let different elements become layers. In short, this means the order of which the elements overlap one another.

For that purpose, you can assign each element a number (z-index). The system is that an element with a higher number overlaps an element with a lower number.

Grouping of elements (span and div)

Filed under: HTML — Hemant Sonker @ 12:16 pm

The elements <span> and <div> are used to group and structure a document and will often be used together with the attributes class and id.

We will take a closer look at the use of <span> and <div> as exactly these two HTML elements are of central importance with regards to CSS.

Grouping with <span>

The element <span> is what you could call a neutral element which does not add anything to the document itself. But with CSS, <span> can be used to add visual features to specific parts of text in your documents.

SPAN is an inline element, so it may be used just as elements such as EM and STRONG in HTML. The important distinction is that while EM and STRONG carry structural meaning, SPAN has no such meaning. It exists purely to apply style, and so has no effect when the style sheet is disabled.

For example

<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>grouping with span</title>
<style>
.abc{color:#ff0000;
font-size:16px;}
.xyz{color:#1E3593;
font-size:10px;}

</style>
</head>
<body>
<p>This tutorial helps beginners learn the basics of creating Web sites with<span class=”abc”> HTML</span> and <span class=”abc”>Cascading Style Sheets.</span></p>
<p>This is a test to define grouping of elements in <span class=”xyz”>span </span>and <span class=”xyz”>div</span></p>
</body>
</html>

save this code and run.you will see the effects.

Grouping of elements with div

The DIV element is similar to the SPAN element in function, with the main difference being that DIV (short for “division”) is a block-level element. DIV may contain paragraphs, headings, tables, and even other divisions. This makes DIV ideal for marking different classes of containers, such as a chapter, abstract, or note

Aside from this difference, the grouping with <div> works in more or less the same way. Let us take a look at an example

<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>grouping with span</title>
<style>
#democrats{color:#ff0000;
font-size:16px;}
#republicans{color:#1E3593;
font-size:10px;}

</style>

</head>

<body>

<div id=”democrats”>
<ul>
<li>Franklin D. Roosevelt</li>
<li>Harry S. Truman</li>
<li>John F. Kennedy</li>
<li>Lyndon B. Johnson</li>
<li>Jimmy Carter</li>
<li>Bill Clinton</li>
</ul>
</div>

<div id=”republicans”>
<ul>
<li>Dwight D. Eisenhower</li>
<li>Richard Nixon</li>
<li>Gerald Ford</li>
<li>Ronald Reagan</li>
<li>George Bush</li>
<li>George W. Bush</li>
</ul>
</div>

</body>

</html>

Hope u would have come to know about the use of div and span.

if any queries ,please comment on it.i will get back to you.

Deprecated Elements in HTML

Filed under: HTML — Hemant Sonker @ 11:17 am

According to the W3C standrds, they have identified the following as depreciated tags.These tags if used may differ in differnt browsers like firefox,safari,opera,aol,IE6 ,IE 7 etc.

Deprecated Tags
<applet> use <object> tag (caution, not well supported yet)
<basefont> use style sheets
<blockquote>  
<center> use style sheets
<dir> use <ul>
<em> use style sheets
<font> use style sheets
<isindex> use <input>
<listing> use <pre>
<menu> use <ul>
<plaintext> use <pre>
<s> use <del>
<strike> use <del>
<strong> use style sheets
<u> use style sheets
<xmp> use <pre>

addition to tags, several attributes (modifiers to tags which set specific behaviors) are depreciated. These are listed in the table below.

Deprecated Attributes
align
alink
background
bgcolor
color
hspace
link
size
text
type
vlink
vspace

Differneces between XHTML and HTML

Filed under: HTML — Hemant Sonker @ 11:08 am

HTML is rapidly being replaced by XHTML. The differences are very minor, but the results of switching can be worth the effort. The primary benefit is that XHTML is more widely accepted in non “computer” devices like cell phone, palm devices and other scaled down browsers. This is commonly called portability between devices.
XHTML is also said to be extensible, which is the fancy way of saying the new tags can be added without a new document type declaration.

Firstly, what are the differences:

  • the tags in the page MUST be in lower case, so instead of <IMG src=”resource/frankisboat.gif” WIDTH=”389″ HEIGHT=”227″ BORDER=”0″ ALT=”boat”>, as we would do in HTML, we instead use: <img src=”resource/frankisboat.gif” width=”389″ height=”227″ border=”0″ alt=”boat” />
  • all tags must close, either by using a corresponding closing tag which has a slash, like paragraph ( <p></p> ) for example, or some tags are self closing like the above img src tag and line break ( <br /> ). In HTML, many of these tags were simply left open.
  • all tags must be properly nested, so if you start tag “a” and then start tag “b”, you must close tag “b” before you close tag “a”
  • some tags which were previously allowed are no longer allowed, although see the discussion below of document type declarations (DTD’s).
  • all attributes must also be lowercase
  • all values for attributes must be encased in single or double quotes
  • all attributes must be long form, not abbreviated, for example: disabled=”true” in XHTML vs DISABLED in HTML
  • structure must be separated from content. So for example, the <p> tag is a content tag (paragraph) so you can’t put a table in it for example, because a table is a format construct. You can however put the <p> tag inside <td> </td> tags with no problem because the content goes in the construct, not the other way around.

    The first thing you will notice if you look at the source of an XHTML document is that the first line is a document type declaration (DTD also called the DOCTYPE). There are three that are used, strict (that will only validate if you have no deprecated tags), transitional (which will still validate with deprecated tags) and frameset (which is for a page that “sets” up “frames”). Oddly enough, even though all tags in XHTML are lower case, parts of the DTD must be in upper case. The three DTD’s look like this:

  • Strict -
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “DTD/xhtml1-strict.dtd”>
  • Transitional -
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
  • Frameset -
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “DTD/xhtml1-frameset.dtd”>

Depreciated tags in XHTML (they are also depreciated in HTML 4), and at least be aware of the tags that are “depreciated”, tags like: <center>, <u> and <font>. Also be aware that some tag attributes are depreciated, like ‘align’ for example.
These tags are depreciated because what they do (or did) can now be better or more easily done with CSS.

The Difference between strict and transitional HTML / XHTML:
In short, transitional is a forgiving form of doctype as it allows depreciated tags and attributes to pass validation, and the browser will do its best to display the page as you wanted it. You must still have properly nested lowercase tags to get validation though.

The strict doctype is just that, all the depreciated tags and attributes will fail to validate under a strict doctype and may well display incorrectly as well.

September 20, 2007

Ruby Basics…

Filed under: ruby — Hemant Sonker @ 11:06 pm

Hey guy’s have you word before. Hope so you have heard this name earlier.But those who have not heard of this, i would like to give a brief thing about it.Ruby on Rails is basically a open source language.Yukhiro Matsumoto,known as Matz created Ruby in 1993.
So lets first understand that what is Ruby?

Ruby is a cross-platform interpreted language which has many features in common with other scripting languages like Perl,Python,LISP etc.Ruby is hightly dynamic and extensible.

A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

In Ruby, everything is an object. Every bit of information and code can be given their own properties and actions. Object-oriented programming calls properties by the name instance variables and actions are known as methods. Ruby’s pure object-oriented approach is most commonly demonstrated by a bit of code which applies an action to a number.

Ruby follows the influence of the Smalltalk language by giving methods and instance variables to all of its types. This eases one’s use of Ruby, since rules applying to objects apply to all of Ruby.

Ruby is seen as a flexible language, since it allows its users to freely alter its parts. Essential parts of Ruby can be removed or redefined, at will. Existing parts can be added upon. Ruby tries not to restrict the coder.

Ruby has certain features :

  • Ruby has exception handling features, like Java or Python, to make it easy to handle errors.
  • Ruby features OS independent threading. Thus, for all platforms on which Ruby runs, you also have multithreading, regardless of if the OS supports it or not, even on MS-DOS!
  • Ruby is highly portable: it is developed mostly on GNU/Linux, but works on many types of UNIX, Mac OS X, Windows 95/98/Me/NT/2000/XP, DOS, BeOS, OS/2, etc.

Blog at WordPress.com.