Tuesday, June 4, 2013

Difference between Zend_Registry and Zend_Session




The use of these objects was confusing to me at first.. The basic difference between these objects is the ‘scope’ in which they are valid: 

a) Zend_Registry : request scope
b) Zend_Session : session scope

Zend_Registry is used to store objects/values for the current request. In short, anything that you commit to Registry in index.php can be accessed from other controllers/actions (because EVERY request is first routed to the index.php bootstrapper via the .htaccess file). Config parameters and db parameters are generally prepped for global use using the Zend_Registry object.

Zend_Session actually uses PHP sessions. Data stored using Zend_Session can be accessed in different/all pages. So, if you want to create a variable named ‘UserRole’ in the /auth/login script and want it to be accessible in /auth/redirect, you would use Zend_Session.

Monday, April 29, 2013

Configure wamp for windows 7

Configure wamp for windows 7

1) ;short_open_tag = Off

REPLACE TO THIS---------------------

short_open_tag = On

2);error_reporting(E_ALL ^ E_DEPRECATED);

 REPLACE TO THIS---------------------------

error_reporting = E_ALL & ~E_NOTICE  & ~E_WARNING & ~E_DEPRECATED



3)rewrite_module




-------------------------------------------------------------------------------
Must be checked in php.ini file

Than Restart Your Wamp Server................

Wednesday, April 3, 2013

What is InnoDB and ACID in DBMS.

bhupendra
bhupendra
ACID
*Atomicity states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintain the atomic nature of transactions in spite of any DBMS, operating system or hardware failure.
* Consistency states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules. On the other hand, if a transaction successfully executes, it will take the database from one state that is consistent with the rules to another state that is also consistent with the rules.
* Isolation requires that multiple transactions occurring at the same time not impact each other’s execution. For example, if Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. The database should either perform Joe’s entire transaction before executing Mary’s or vice-versa. This prevents Joe’s transaction from reading intermediate data produced as a side effect of part of Mary’s transaction that will not eventually be committed to the database. Note that the isolation property does not ensure which transaction will execute first, merely that they will not interfere with each other.
* Durability ensures that any transaction committed to the database will not be lost. Durability is ensured through the use of database backups and transaction logs that facilitate the restoration of committed transactions in spite of any subsequent software or hardware failures.
infinititsolutions


=============================InnoDB=================================
InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB row-level locking (without escalation to coarser granularity locks) and Oracle-style consistent nonlocking reads increase multi-user concurrency and performance. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys. To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints. You can freely mix InnoDB tables with tables from other MySQL storage engines, even within the same statement.

Saturday, March 2, 2013

IEC College of Engineering and technology,Batch[2006-2009]bhupendra pratap singh 2009 MCA

bhupendra-pratap-singhIEC College of Engineering and Technology (IECCET), Greater Noida was established in 1999. The institute was approved by AICTE, affiliated to Mahamaya Technical University and Gautam Budh Technical University. The quality of institute is to uncompromising commitment to impart quality technical education by providing an environment of high   academic ambience to mould young minds of future engineers, technocrats and managers to meet the challenges of future with vision, competence and excellence.

The mission of the institute is to create an ambience for quality education, training and research in the fields of science, technology and management, thus contributing towards building of knowledge, industrial development and economic growth of the nation.

 The vision of the institute is to be a seat of world class education from where technocrats and managers would emerge empowered to face the challenges of ever changing society with courage, conviction and compassion.

Facilities at IEC College of Engineering and Technology -

  • Library
  • Classrooms
  • Hostels
  • Internet
  • Auditoriums
  • Computer
  • Sports

History

IEC-CET was established in 1999, for imparting engineering education and for promoting technological research to generate suitable technical manpower.
The institute is affiliated to Mahamaya Technical University and recognised by AICTE.[1]
The IEC-CET, started in 1999, constituted the Faculty of Engineering and Technology. Initially, it offered MCA degree, and a Bachelors of Technology in five branches, namely Computer Science, Electrical Engineering, Electronics and Communication, Mechanical Engineering and Information Technology. Within a few years, two more degree program i.e. MBA and MTech(Power System) were introduced.

Programs

The Institute offers a Bachelors of Technology in the following fields:
  1. Computer Science
  2. Information Technology
  3. Civil Engineering
  4. Mechanical Engineering
  5. Electronics & Communication Engineering
  6. Electrical Engineering
  7. Electronics & Instrumentation
The institute also offers:
  1. MCA
  2. Master of Business Administration
  3. Master of Electrical Power Systems

Infrastructure

The IEC campus is spread over 218 acres (880,000 m2). There are separate blocks for B.Tech, MBA and MCA, PGDM, B.Pharma, and BHMCT programmes.
The colleges and its academic facilities are organized over 160.5 acres (650,000 m2), and the remaining 57.5 acres (233,000 m2) have been kept for residential facilities, a shopping arcade and other commercial ventures that benefit students and staff residing on the campus.

Location

The college is situated in Knowledge Park - I, Gr

Regular Expression Writing with PHP

Writing Regular Expression with PHP

Regular Expression, commonly known as RegEx is considered to be one of the most complex concepts. However, this is not really true. Unless you have worked with regular expressions before, when you look at a regular expression containing a sequence of special characters like /, $, ^, \, ?, *, etc., in combination with alphanumeric characters, you might think it a mess. RegEx is a kind of language and if you have learnt its symbols and understood their meaning, you would find it as the most useful tool in hand to solve many complex problems related to text searches.
Just consider how you would make a search for files on your computer. You most likely use the ? and * characters to help find the files you're looking for. The ? character matches a single character in a file name, while the * matches zero or more characters. A pattern such as 'file?.txt' would find the following files:
file1.txt
filer.txt
files.txt

Using the * character instead of the ? character expands the number of files found. 'file*.txt' matches all of the following:
file1.txt
file2.txt
file12.txt
filer.txt
filedce.txt
While this method of searching for files can certainly be useful, it is also very limited. The limited ability of the ? and * wildcard characters give you an idea of what regular expressions can do, but regular expressions are much more powerful and flexible.
Let Us Start on RegEx
A regular expression is a pattern of text that consists of ordinary characters (for example, letters a through z) and special characters, known as metacharacters. The pattern describes one or more strings to match when searching a body of text. The regular expression serves as a template for matching a character pattern to the string being searched.
The following table contains the list of some metacharacters and their behavior in the context of regular expressions:
Character Description
\ Marks the next character as either a special character, a literal, a backreference, or an octal escape. For example, 'n' matches the character "n". '\n' matches a newline character. The sequence '\\' matches "\" and "\(" matches "(".
^ Matches the position at the beginning of the input string.
$ Matches the position at the end of the input string.
* Matches the preceding subexpression zero or more times.
+ Matches the preceding subexpression one or more times.
? Matches the preceding subexpression zero or one time.
{n} Matches exactly n times, where n is a nonnegative integer.
{n,} Matches at least n times, n is a nonnegative integer.
{n,m} Matches at least n and at most m times, where m and n are nonnegative integers and n <= m.
? When this character immediately follows any of the other quantifiers (*, +, ?, {n}, {n,}, {n,m}), the matching pattern is non-greedy. A non-greedy pattern matches as little of the searched string as possible, whereas the default greedy pattern matches as much of the searched string as possible.
. Matches any single character except "\n".
x|y Matches either x or y.
[xyz] A character set. Matches any one of the enclosed characters.
[^xyz] A negative character set. Matches any character not enclosed.
[a-z] A range of characters. Matches any character in the specified range.
[^a-z] A negative range characters. Matches any character not in the specified range.
\b Matches a word boundary, that is, the position between a word and a space.
\B Matches a nonword boundary. 'er\B' matches the 'er' in "verb" but not the 'er' in "never".
\d Matches a digit character.
\D Matches a nondigit character.
\f Matches a form-feed character.
\n Matches a newline character.
\r Matches a carriage return character.
\s Matches any whitespace character including space, tab, form-feed, etc.
\S Matches any non-whitespace character.
\t Matches a tab character.
\v Matches a vertical tab character.
\w Matches any word character including underscore.
\W Matches any nonword character.
\un Matches n, where n is a Unicode character expressed as four hexadecimal digits. For example, \u00A9 matches the copyright symbol (©).

RegEx functions in PHP
PHP has functions to work on complex string manipulation using RegEx.  The following are the RegEx functions provided in PHP.

Function Description
ereg This function matches the text pattern in a string using a RegEx pattern.
eregi This function is similar to ereg(), but ignore the case sensitivity.
ereg_replace This function matches the text pattern in a string using a RegEx Pattern and replaces it with the given text.
eregi_replace This is similar to ereg_replace(), but ignores the case sensitivity.
split This function split string into array using RegEx.
Spliti This is similar to Split(), but ignores the case sensitivity.
sql_regcase This function create a RegEx from the given string to make a case insensitive match.

Finding US Zip Code
Now let us see a simple example to match a US 5 digit zip code from a string
<?
$zip_pattern = "[0-9]{5}";
$str = "Mission Viejo, CA 92692";
ereg($zip_pattern,$str,$regs);
echo $regs[0];
?>
This script would output as follows
92692
 
Note the change in the RegEx pattern in examples. preg_match() is considered as  faster alternative for ereg().
RegEx for US Phone Numbers
Now let us try to create a RegEx pattern to match a US telephone number.  US telephone numbers are 10 digit numbers usually written with three parts like xxx xxx xxxx.  These three parts are normally used with – hyphen, () braces, and blank spaces. The most common patterns can be seen as follows:
XXX XXX XXXX
(XXX) XXX XXXX
XXX-XXX-XXXX
(XXX) XXX-XXXX
In some cases, US ISD code would be added in the first, like +1 XXX XXX XXXX.
Let us create a Perl-Compatible RegEx pattern to match the above patterns. First we would need to match the single digit ISD code (let us not restrict it to 1). But this may or may not available in the phone numbers, hence we would write it as follows:
$Phone_Pattern = “/(\d)?/”;
Here \d is equivalent to 0-9 and the succeeding ‘?’ indicates that the digit may appear one time or doesn’t appear at all.
Now what would appear next in the sequence? The possibilities are a blank space or a hyphen. So we would add the pattern “(\s|-)?” with the above RegEx. This pattern indicates that either a blank space or a hyphen may or may not appear. So our RegEx becomes:
$Phone_Pattern = “/(\d)?(\s|-)?/”;
The next sequence would be either XXX or (XXX). To match this sequence, we need to first match the braces with the pattern “(\()?”. As we use braces to enclose the patterns in RegEx, braces are metacharacters and to match these metacharacters explicitly, we need to use the escape character “\” preceding the metacharacters. Hence we use “\(“ in our RegEx pattern.  Now we need to match the three digits and a closing braces. So this can be written as “(\d){3}(\))?”. Now our RegEx is added with these patterns,
$Phone_Pattern = “/(\d)?(\s|-)?(\()?(\d){3}(\))?/”;
After the first part XXX, there should be either a blank space or a hyphen. So we add “(\s|-){1}” to the phone pattern.
$Phone_Pattern = “/(\d)?(\s|-)?(\()?(\d){3}(\))?(\s|-){1}/”;
Further construction of RegEx would be much more simpler, as we need to match either XXX-XXXX or XXX XXXX. This could be written as “(\d){3}(\s|-){1}(\d){4}”. Adding this part of pattern to our RegEx,
$Phone_Pattern = “/(\d)?(\s|-)?(\()?(\d){3}(\))?(\s|-){1}(\d){3}(\s|-){1}(\d){4}/”;
Yippee!!! We have created a RegEx to match US phone numbers.

Now we need to use this RegEx to perform some task, so that we can understand the significance of RegEx better. Now let us try to script a code to fetch the phone numbers from Google contact us page. So first we need to fetch the html content from Google’s contact us page.
$str = implode("",file("http://www.google.com/intl/en/contact/index.html"));
 
Then we need to search for the phone number pattern with the help of our “Just Created” RegEx. If we use the preg_match(), we can fetch only one match. So to get more than one match we would use preg_match_all().
preg_match_all($Phone_Pattern,$str,$phone);
Now putting all these pieces into a single script,
<?
$str = implode("",file("http://www.google.com/intl/en/contact/index.html"));
$Phone_Pattern = "/(\d)?(\s|-)?(\()?(\d){3}(\))?(\s|-){1}(\d){3}(\s|-){1}(\d){4}/";
preg_match_all($Phone_Pattern,$str,$phone);
for($i=0;$i<count($phone[0]);$i++)
{
echo $phone[0][$i]."<br>";
}
?>
This script will display the following output,
(650) 253-0000
(650) 253-0001


Wrap Up
Hope you had a good session with RegEx and now you would have some understanding on tackling problems related to text pattern findings using RegEx.  To become a specialist in RegEx, you need to continuously practice it and need to identify complex problems and give a try to solve them. Happy Practicing With RegEx.

Friday, November 4, 2011

bhupendra pratap singh


bhupendra pratap singh:
Makrain
Add caption

  Mere Dil me tere aarzu-e-mahobbat jalti rahegi, nazron se meri ashq chalakte rahenge, Aap Chiraagh bankar Dil ko roshan to karo, hum to M...

Sunday, September 4, 2011

Dehri on sone

Dehri, a small town in northeastern India, lies on the banks of the Sone River with an average elevation of 99 metres (324 feet). It has a station on the Grand Chord railways route, and the Grand Trunk Road (NH 2) also passes through the town. The main occupation of the local population is agriculture - principally rice growing.As of the 2011 Indian census[1],
Giving this information to the media Census Director bhupendra singh said on Monday that Rohtas district has the highest (75.59 per cent) literacy rate
 Dehri had a population of 119,007. Males constitute 54% of the population and females 47%. Dehri has an average literacy rate of 66%, higher than the national average of 59.5%: male literacy is 74% and, female literacy is 57%. In Dehri,

Link : http://en.wikipedia.org/wiki/Dehri

dehri on sone
Dehri has many good educational institutes. For primary education, a lot of government supported and private schools are there, where you can get education in Hindi medium as well as English medium. A few of the famous schools are Model School, Sun Beam Public School, GEMS English School and Dehri High School. There is a girls school- Rama Rani Jain Balika Unch Vidyalaya and one girls college- Mahila College. For higher education, there are several undergrads colleges: Nehru College, Jagjeevan College, Women's College and SP Jain College and for Computer Education " VISHWA COMPUTER SAKSHARTHA MISSION". There are plenty of private tuition facilities. Educational institutes in Dehri include Dehri High School,Dalmianagar High School & Dillian High School. Also, known by the name Dehri-On-Sone, this place has produced great many IITians and NRIs.
dehri on sone




There are two parallel bridges, one for road and another for railway. The road bridge (Jawahar Setu built by Gammon India Ltd in 1963-65) over Sone was the longest (3061 m) in Asia until it was surpassed by the Mahatma Gandhi setu (5475 m) over the river Ganga at Patna. The railway bridge is still the longest railway bridge in Asia.

Upper Sone Bridge at Dehri-on-sone on the river Sone is the longest railway bridge in India. The bridge is on Howrah-Delhi Grand Chord Line. it is 3 kms and 65 meters in length... having 93 spans....and now its going to be the widest bridge in india too.                                          

                                            


Dalmianagar is one of the oldest and biggest industrial towns in India. It is situated near Dehri-on-Sone on the banks of the Son River in Rohtas District of Bihar.

The Industrial town of Dalmianagar was founded by the famous industrialist Ramkrishna Dalmia, a doyens of business in 20th century India and founder of the Dalmia group. He was assisted by his younger brother Jaidayal Dalmia and son in law Sahu Shanti Prasad Jain in establishing many factories of Rohtas Industries Ltd. in Dalmianagar.

Shanti Prasad Jain took over Rohtas Industries Ltd. from his father-in-law, and under his stewardship, Dalmianagar developed into a massive industrial town from 1940s till 1980s with factories producing sugar, cement, paper, chemicals, vanaspati etc. employing top professionals of the country. Dalmianagar boasted of vast and beautiful housing colony, gardens, clubs, schools, market complexes, hospital etc. for its employees. Rohtas Industries had their own private aircraft in those days and a small air-field near Dalmianagar.

Makrain
River

The Son river at 784 kilometres (487 miles) long, is one of the largest rivers of India. Its chief tributaries are the Rihand and the Koel. The Son has a steep gradient (35-55 cm per km) with quick run-off and ephemeral regimes, becoming a roaring river with the rain-waters in the catchment area but turning quickly into a fordable stream. The Son, being wide and shallow, leaves disconnected pools of water in the remaining part of the year. The channel of the Son is very wide (about 5km at Dehri) but the floodplain is narrow, only 3 to 5 km wide. In the past, the Son has been notorious for changing course, as is traceable from several old beds on its east. In modern times this tendency has been checked with the anicut at Dehri, and now more so with the Indrapuri Barrage.
There is a small Village  -Makrain On the Bank Of Sone River.

By: Bhupendra pratap singh, from Makrain,email : bhupendra.iec@gmail.com