Skip to main content

Posts

Showing posts from June 28, 2011

HTML, XHTML and CSS

Cascading Definition: The cascade in CSS or cascading style sheets is the ability to have multiple styles from different sources merge together into one definitive style. The benefits of CSS Separation of content and presentation Smaller webpage file sizes Improved webpage download speed Improved rendering speed Streamlined maintenance Changing presentation for different devices Accessibility Table-less layout Customisation Search engine optimisation CSS Grouping When several selectors share the same declarations, they may be grouped into a comma-separated list. Example(s): In this example, we condense three rules with identical declarations into one. Thus, h1 { font-family: sans-serif } h2 { font-family: sans-serif } h3 { font-family: sans-serif } is equivalent to: h1, h2, h3 { font-family: sans-serif } Reverse a string in CSS? <p style="direction: rtl; unicode-bidi: bidi-override;"> 0C 88 65 36 5C 65 14 8D B5 3E 47 D9 20 11 9F ...

MySQL Questions

InnoDB Table Space Unlike MyISAM where data for individual tables is stored in their respective files, InnoDB stores data in a tablespace. By default, there is one single tablespace and data of all the databases is stored in one file. This file has data dictionary, tables, as well as indexes in it. There is a global parameter innodb_data_file_path that defines this tablespace file. It has a syntax like ibdata1:256M:autoextend, this means at the beginning a file of size 256 MB will be created and then whenever the data size exceeds this, the file will be auto-extended. The innodb_autoextend_increment variable defines in MB's that by how much each increment should be. Let's see how well can we play around: Inserts: Suppose you have too many inserts and InnoDB is extending the file too frequently. It makes sense to increase the value of innodb_autoextend_increment. Say we increase it to 16MB, then obviously the number of attempts to autoextend tablespace comes do...

CodeIgniter

CodeIgniter CodeIgniter Flow Diagram: How do you get the current controller and method name of the URL? echo $this->router->class; echo $this->router->method; Thumbnail Class: /** * PHP class for dynamically resizing, cropping, and rotating images for thumbnail purposes and either displaying them on-the-fly or saving them. * */ class thumbnail_model extends Model { /** * Error message to display, if any * * @var string */ private $errmsg; /** * Whether or not there is an error * * @var boolean */ private $error; /** * Format of the image file * * @var string */ private $format; /** * File name and path of the image file * * @var string */ private $fileName; /** * Image meta data if any is available (jpeg/tiff) via the exif library * * @var array */ public $imageMeta; /** * Current dimensions of working image * * @var array */ private $currentDimensions; /** * New dimensions of working image * * @var array */ ...

OOPS General

Overloading / Overriding: Overloading is about creating multiple methods with the same name, but different signatures, in the same scope. Overriding is about changing the behavior of a certain method in the child class from the way it is behaving in the parent class. Abstraction: Abstraction means to show only the necessary details to the client of the object. Eg: 1) Do you know the inner details of the Monitor of your PC? What happen when you switch ON Monitor? Does this matter to you what is happening inside the Monitor? No Right, Important thing for you is weather Monitor is ON or NOT. 2) When you change the gear of your vehicle are you really concern about the inner details of your vehicle engine? No but what matter to you is that Gear must get changed that’s it!! This is abstraction; show only the details which matter to the user.

Performance Tuning your website

1.Top Ten Web Performance Tuning Tips Check for standards compliance by using Weblint or other HTML checking tools. Content that conforms to the HTML 4.0 standard will load faster and work in every browser because the browser then knows what to expect. Note that Microsoft-based tools create content that does not even use the standard ASCII character set, but instead uses many proprietary Microsoft characters that will display in Netscape as question marks and can slow down rendering. Minimize the use of JavaScript and style sheets. JavaScript is a major source of incompatibility, browser hangs, and pop-up advertising. Style sheets require separate downloads before the page can be displayed. There are some nice features to both JavaScript and style sheets, but at a big cost. Life is better without them. Turn off reverse DNS lookups in the Web server. If left on, reverse DNS will log a client's machine name rather than IP address, but at a large performance c...

Joomla Interview Questions

What is Joomla Joomla! is a content management system platform for publishing content on the World Wide Web and intranets as well as a Model–view–controller (MVC) Web Application Development framework. ---Joomla! came into being as the result of the fork of Mambo by the development team on August 17, 2005. ---Open Source ---Customize modules ---Built-in modules & plugins ---Develop by PHP ---MySql Support ---Admin & User Section ---User Management ---Media Manager ---Language Manager ---Banner Management & many more... What are Positions? Site templates divides the "pages" displayed on a site into a series of positions, each with a different name. You can view the location of positions in your default template from the administrator go to Site =>Preview=>Inline with Positions. You can annotate your positions through the administrator (backend). Go to Site=>Template Manage=>Module Positions. You can add or remove positions by...

MYSQL

MySQL performance Tips Avoid doing SQL queries within a loop. MySQL * MySQL is interpreted from right to left so you should put the most significant limiters as far to the right as possible. * Only select fields you need, instead of selecting * (everything). * Don't put things that changes very rarely in the database, instead put it in a global array in some include file. * Use indexes on the columns in the WHERE clause and on the columns you want to ORDER BY. * Indexes are great if you search the table alot, but it slows down insertion. * Use the EXPLAIN command to analyze your indexes. * If you only want one line as a result from the database you should always use LIMIT 1. This way mysql stops searching when it finds the first line instead of continuing through the whole database, only to find that there weren't any more lines that matched the query. * If you use $line = mysql_fetch_array($result) you'll get two ways of accessing the columns, $line...

What is “normalization”? “Denormalization”? Why do you sometimes want to denormalize?

Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier. Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing.

What is a “constraint” in SQL?

A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints that are currently supported by SQL Server * PRIMARY/UNIQUE - enforces uniqueness of a particular table column. * DEFAULT - specifies a default value for a column in case an insert operation does not provide one. * FOREIGN KEY - validates that every value in a column exists in a column of another table. * CHECK - checks that every value stored in a column is in some specified list. * NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint.

What types of index data structures can you have?

An index helps to faster search values in tables. The three most commonly used index-types are: * B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases. * Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD) * Hash: A hashing algorithm is used to assign a set of characters to represent a text string such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases.

cursors / primary key / trigger / view questions

cursors / primary key / trigger / view questions Types of cursors in SQL ? * Static * Dynamic * Forward-only * Keyset-driven What is a “primary key”? Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.For example “user Id” should be unique for users, so we can make that field a s primary key in some tables for making sure that value wont repeat. What is a “trigger”? Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurrence of one of the data-modification operations. A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The type...

Optimization of your web site *Yahoo

Optimization of your web site *Yahoo Minimize HTTP Requests tag: content 80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages. One way to reduce the number of components in the page is to simplify the page's design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs. Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of you...