A humble approach to my books…

First, it was a mail from Pramila Balan, the acquisition editor of Apress. They wanted to publish my book on ethical hacking.
After a few more conversations they finally decided to publish two books – another one about Laravel that has been in the market nearly for a year or more.
My Books in Apress
I saw the whole development as a warning from my creator, probably the last warning; that simply says: grow up, life is too short and there are so many things to do.

Advertisements

What to start with, ASP.NET or PHP?

For further reading, more php and asp.net codes please go to Sanjib’s Scribble
********************
Well, I’d like to write about this in INDIAN context. That is, I presume, you are about to start your journey as a web developer in India, and thinking about learning a web language. Now, keeping this condition in mind, what you’ll do? What will you learn first? And why this but not that?
I’ll keep writing it in several parts. Because I have not enough time and bandwidth in my data card to keep going on for a long journey, but I promise I’d keep it as short as possible.
Before starting I’d apologize for not including Python, Java or Rubi on Rails in my discussion mainly for two reasons.
1) I don’t know them.
2) For dynamic web site, the competition is fierce between these two technology and I have some live experiences about them.
If you are Indian, PHP is the best options for you to start. Not ASP.NET. Why?
Let me write down the reasons first. Next I’ll explain them in detail. I don’t claim, that this is final judgement and won’t suggest you to follow my reasons blindly. What I write, writing from a realistic point of view. You may agree or disagree. Whatever your opinion I’d like to get your comments.
Here are the reasons why PHP is better to start with.
1)Cost effective.
2)Open source.
3)Simplicity.
4)You don’t have to buy any software.
5)A good demand in small or medium company.
6)Takes less time to learn and start with.
7)Compactness and simple integrity with MySql database.(If you can conceptualize array, 50% job has been done!)

Now I’d like to clarify from my experience. One by one.

1) Cost : As a web developer, you’ll find that cost will play a very important role in the future. Whenever, you’d like to contact a hosting company they will always ask more money for a windows hosting which is needed for ASP.NET. For PHP you need Linux hosting that is almost half the amount for the same space and bandwidth. In Windows, it takes more cost because you need to hire an extra SQL Server. In PHP, MySql is in-built. So you need not spend extra dime for it. Form my experience I can say, in Linux hosting there are other advantages or features like blog, wiki, E-Commerce, image gallery projects like wordpress, phpbblog etc. In windows hosting you can not take advantage of such open source frameworks. What ever you want to do in ASP.NET, you have to do single handedly.
Some will argue here, there are many starter kits and open source projects available in ASP.NET also that you can download free from asp.net official site. Then where is the difference?
The difference is in installation process. In ASP.NET you may find some open source projects like blog, wiki etc. But to install them in a separate folder is quite cumbersome. On the contrary, WordPress or PHPBB type projects(run in php and MySql) are ready to install easily and quite user friendly.
So LAMP is not cheap in that sense but cost-effective.
2) Open Source
PHP/MySql is Open Source. If you want to learn more about it, please google it or read Wikipedia. You’ll get more idea about it. Basically it means, it is free, easy to use and there are much more free support from the community in every step. You can also edit the source code that you get from elsewhere.
3)Simplicity
ASP.NET is more user friendly, no doubt. But, if you want to learn the basic, core ideas on which the passage of data depends, then PHP is the best bet. If you can conceptualize array, then 50% job has been done.
4) You don’t have to buy any software.
To learn PHP/MySql you need not buy any software. This is free and that is why it is so much popular.
5)A good demand in small or medium company.
As the job market is concerned, small or medium level companies opt for free open source softwares. So PHP developers are in demand always.
6)Takes less time to learn and start with.
If you are from a computer background learning PHP is much easier. Logic plays a vital role. If you can follow the logic, how the logic flows, how data transfered from one page to other through array(name=>value) combination, the job has been done.
7)Compactness and simple integrity with MySql database.(If you can conceptualize array, 50% job has been done!)
The best friend of PHP is MySql. They are like Marx and Engels. You may type SQL in your PHP page and get the desired effect in your web page. Also, the hosting companies come with this great combinations so you start with an advantage.

ASP.NET and PHP, a basic difference

In ASP.NET you need to declare data type of variable explicitly. Like int num; that means num variable knows how much place it will hold in memory. It could be string str; float flt etc. But in PHP you need not do that. Usually you write $number to declare a integer variable.
So it is wise to pick up variable name so that it will mean either integer or string.
In PHP when you take up someone’s name you may write $name. It could be a string.
Actually what happens, PHP engine interprets the variable according to the value you are assigning it. That makes it operative part a little bit easier.
The CRUD concept is present in both. But, in ASP.NET it is more complicated and divided into many sections. Of course, people who know ASP.NET, may find it more organized too.
Lastly, due to windows, ASP.NET gives you a desk top experience and much more user friendly. If PHP gets something like this (I know nothing about zend framework although), it will be unstoppable and unparalleled due to its Open Source Presence.
Lastly, to host a ASP.NET site is more costly than PHP, and other Open Source helps make PHP much more desirable.

ASP.NET and PHP

I started this blog mainly with a plan – I’d try to evaluate ASP.NET and PHP, tracing a honest comparison between these two great programming languages.
Frankly speaking when I tried to do my hands dirty with codes, I found that I have still miles to go in PHP specially. I’m still learning ASP.NET, but about PHP I’m still lurking in darkness. So I’d better have a grasp first.
One thing I can say for sure, PHP is easier to pick up and easier to implement.
If you consider The OOP part, Object Oriented part of ASP.NET will take some time to learn and understand and it gets complicated a little bit with newly built classes belong to App_Code folder and calling them into Page class and run methods.
In PHP, just use include method anywhere, either in the class where you’d like to call a function from another class or include in your PHP page.
So OOP seems bit easier to me in PHP than ASP.NET.
I’d like to write more about it later.

How you’ll get your Membership.ValidateUser() to Work

Recently I’ve come across a intriguing question in asp.net forum. One member from Canada asked that his membership.validateuser() method is not working. Actually, what happened, according to him :

Long ago I implemented the Login control on a login page and I thought all was working. Testing has revealed that if you first enter an incorrect password but then next enter the correct password, the Login control fails to log the user in until they enter the correct password a second time. This is unacceptable.

So I began investigating what is wrong and quickly discovered that Membership.ValidateUser(username, password) is failing to return true even though I’m entering the correct credentials. I’ve done much research and discovered that plenty of other developers have experienced the same problem. As of yet, I have not found a solution to my particular problem so I thought I should try seeing if I could get an answer here.

In web.config here is the pertinent info related to Memberships:

If anyone could tell me why they think that Membership.ValidateUser() is consistently failing to work, I’d much appreciate it!

Now I found that, PasswordAttemptWindow is missing in his web.config file. So my answer was :

It probably happened because you’ve not set the PasswordAttemptWindow to some exact time. That is why, I gave you a code to test, in my code it is set to 10.

If you kindly go through what MSDN says about it, you’ll understand why it is locked out no matter what value you’ve set for MaxInvalidPasswordAttempts.

MSDN says:

“The MaxInvalidPasswordAttempts property works in conjunction with the PasswordAttemptWindow property to guard against an unwanted source using repeated attempts to guess the password or password answer of a membership user. If the number of invalid passwords or password answers entered for a membership user is greater than or equal to the value of the MaxInvalidPasswordAttempts property within the number of minutes specified by the PasswordAttemptWindow property, then the user is locked out of the Web site by setting the IsLockedOut property to true until the user is unlocked by a call to the UnlockUser method. If a valid password or password answer is supplied before the value of the MaxInvalidPasswordAttempts property is reached, the counter that tracks the number of invalid attempts is set to zero. Invalid password and password answer attempts are tracked separately. For example, if the MaxInvalidPasswordAttempts property is set to 5, the user has up to five attempts to enter a correct password and up to five attempts to enter a correct password answer without being locked out. The MaxInvalidPasswordAttempts property value is set in the application configuration using the passwordAttemptThreshold attribute of the membership Element (ASP.NET Settings Schema) configuration element. ”

Best of luck.

I would like to share it for many reasons, mostly because, people often get stuck in creating Membership API in ASP.NET forgetting that there are many small, subtle but very important aspects that to be considered.

To get it into detail, you may visit the original post here :
asp.net forum
12Reach
My Site
PHP/MySql Blogs
PHP/MySql Blogs