Monday, 25 March 2013

IDENTITY_INSERT

Cannot insert explicit value for identity column in table ‘tblTestTable’ when IDENTITY_INSERT is set to OFF.

Suppose you have a table in MS Sql with two Columns.
CREATE TABLE [dbo].[tblTest](
[Test_Id] [int] IDENTITY(1,1) NOT NULL,
[Test_Name] [varchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
(
[Test_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
Now you are inserting the three values in this table:
Insert Into tblTest(Test_Name) values(“Test1″)
Insert Into tblTest(Test_Name) values(“Test2″)
Insert Into tblTest(Test_Name) values(“Test3″)
So your table will look like as follows:
1 Test1
2 Test2
3 Test3
Now you are deleting second row of the table using the following syntax:
DELETE From tblTest where Test_Id=2
Now you table will looks like the following:
1 Test1
3 Test3
Now you are going to insert a row with the following query:
Insert Into tblTest(Test_Id,Test_Name) values(2, “TestTemp2″)
when you execute this query, you will face the following error:
This error is coming when we have a Identity Specification is ‘Yes’ and IsIdentity is also ‘Yes’, Identity Increament is set to(1/2/…).
So you are unable to insert this type of row, because sql know that the Test_Id is the Identity_Column and so you cannot insert the value which already inserted. So to resolve this error, you have to set the Column_Identity ON by using the following syntax.
SET IDENTITY_INSERT tblOrderItemStatus ON
Then try to insert the row using the above same query, which was as following:
Insert Into tblTest(Test_Id,Test_Name) values(2, “TestTemp2″)
Now you need to reset the Column_Identity OFF. You can do it just by the following syntax:
SET IDENTITY_INSERT tblOrderItemStatus OFF
Is it resolve your problem. Howdy buddy?….

Wednesday, 30 January 2013

Why the Internet works and how to break it





If the internet was a person, it would be beginning to feel its age this year as it gets into its 30s, with a mid-life crisis looming. As it happens, the internet has never looked better: it's faster, bigger, better and richer than it was in its 20s.
But there are people having a midlife crisis on the internet's behalf. Governments want to change how it is governed, how it works and, most disturbingly, its openness. So, it is worth taking a moment to outline the first principles of the internet that have made it successful, why they are worth preserving and what we can expect if they are preserved.

Bob Kahn and I began work on the design that became the internet in the 1970s, motivated by the spectacular success of the Arpanet project, funded by the US Defense Department , in which small computers sent data 'packets' across dedicated telephone circuits. It was a homogeneous network connecting inhomogeneous computers: different operating systems, different word sizes, different computational capacities.

We met in 1973 at Stanford and started working on a design to allow up to 256 networks to be connected in such a way that the host computers would not need to know anything about the layout of this super-network . At the same time, every host computer would be able to talk to every other one despite their different operating systems and other differences. We also worked on a detailed design of the Transmission Control Protocol (TCP) and began implementing and testing it in 1975.

We were sure that this was powerful . The packets we were using to transport data were remarkably adaptable : they could be transmitted over any digital communication channel , bringing with them any information that could be digitised. The network was not designed for a particular application and this has allowed it to support applications that weren't predicted in the early formulation of the internet's design.

We didn't , for instance, anticipate the hand-held mobile. We did anticipate an 'Internet of Things' — more on that in a moment — and personal computing. We even foresaw notebook computing, whereby a computer that isn't powerful can perform tricky tasks by drawing on the internet. We didn't have to imagine it. Alan Kay had shown a notebook-computer concept around 1968 he called FLEX and Xerox Parc built the Alto personal computer along with the Ethernet in the early 1970s. They were living in a world that others would not experience for 20 years.

The system Bob
 and I designed, alongside collaborators from Europe and Asia who visited our lab in the mid-1970 s, has since grown by factors of a million or more on all dimensions : a many million times more users , a million times more hosts, a million times more networks, all connected a million times faster.

But the numbers aren't the only difference . The internet era is different from the telephone era for at least two reasons: it allows groups to communicate , coordinate, collaborate and share information, and it supports every medium of communication invented, all in one network. People can discover each other without knowing who they are and they can find groups with common interests.

The institutions spawned by the internet and which regulate and build the internet are similarly meritocratic and diverse. The Internet Society , Internet Architecture Board, Internet Engineering and Research Working Groups, Internet Governance Forum and Internet Corporation for Assigned Names and Numbers : all of them are run by many 
stakeholders who together decide policies and standardisation. It is a meritocracy that respects ideas more than institutions. It values openness and sharing of information, freedom of choice and expression.

Of course, the internet can be abused and people harmed from that abuse . Protection of personal information should be a high priority for all internet application providers. We also need to educate people about what can happen when they share information on the internet: once it is available to anyone, it is possible for someone to upload to other sites or to capture and store the information . Any country that gets the internet soon finds out that some harm comes from people who are in other national jurisdictions. We will need to find ways for international cooperation to deal with abuse.

But as we do figure out better ways to make cyberspace safe to use, we must preserve the very properties that have made it so successful: freedom of expression, transparency and openness, participatory policy and technology development.

Tuesday, 29 January 2013

Tip to become a successful software engineer.




 This post is a follow up to Derick’s great post. I could not agree with his view point any more., but it struck a chord with me.  There is more to it. To actually call yourself a software engineer you need to take into account a few aspects of what an engineer should do.

You’re Not Paid To Type
Typing code into a code editor or text editor is not what a Software Engineer is paid to do.  At least, it is not the primary reason this profession exists.  Yes, part of the job is to write code in any number of languages and platforms. As Derick pointed out, it is more then writing code, it is about writing tests, and making sure the code you do type works as designed and can be easily maintained.
All that being said, the actual act of typing is simple and quick.  There is training in keyboard typing and methods to increase how many words per minute one can type. So, does typing more code constructs per minute mean you should to get paid more money?  If you turn out more code then the engineer sitting next to you, have you created more value?  See where I am going with this.  Typing is easy, and typing the wrong code is really easy.  I have seen organizations that are fearful of missing deadlines and dates. Its so unhealthy that the developers think they need to start writing code NOW, but they don’t really know what they are supposed to be creating. They do know what to create in the general sense, but they rush intp writing software without knowing most of the details.

You are paid to THINK, so start doing that
So, my main point of this post is that Software Engineers are paid to Think.  You are paid to think about what is the correct code to create, how is should be constructed to lower the total cost of ownership.
If you only change one thing about the way you work this year try this.
  If you normally get your requirements verbally, trying writing them down.
Write down your requirements or technical plan in the easiest manner possible. That could be on a whiteboard, you could annotate a screenshot of an existing screen, you could use pencil and draw the changes to a print out of a screen shot.  Just do something in terms of thinking about what needs to be done before you start typing.  If you do write down what you plan to do, you can actually communicate it to other developers. You can have someone else review it and think through the problem.  You can also show it to the person who will decide if you created the correct software, imagine getting some feedback on what you want to build before you mess it up?
The two most valuable ways I have found to write down what needs to be created are Screen Mockups and Sequence Diagrams. Now, I have been in the web space for a long time, so if you are not creating websites, or web applications, you may find that there are better ways to write down what you need for your particular design problem.  Either way , try to write it down. If you are writing mockups today, then add a sequence diagram for the more complicated problems and see if it helps.  I know it helps me and the developers I work with.



Posted by Eric Hexter 

Friday, 18 January 2013

Nokia to transfer 820 jobs to TCS, HCL Tech



Finnish mobile phone maker Nokiasaid it will cut over 1000 IT jobs, including 820 employees who will be transfered to HCL Technologies and Tata Consultancy Services, as part of an already-announced restructuring.
It said 300 jobs will be cut altogether, and that most of the reductions would be in Finland.
HCL Tech has recently entered into a long-term, global IT infrastructure management outsourcing services agreement with Nokia. The scope of this engagement includes datacenter, network management, end-user computing services and cross-functional service management across Nokia's global IT infrastructure operations. As part of this engagement, HCL will be deploying its MTaaS and MyCloud solutions. HCL has also been delivering global service desk and desktop management outsourcing services for Nokia since 2009.
TCS has been operating in Finland for about 10 years, servicing clients such as Nokia Siemens, ABB and Telenor.

The job cuts are part of Nokia's plans to cut 10,000 jobs, including 3,700 in Finland.

Nokia will offer employees affected by these planned reductions both financial support and a comprehensive Bridge support programme. These are the last anticipated reductions as part of Nokia's focused strategy announcement of June 2012.

The majority of the employees affected by these planned changes are based in Finland. Nokia is beginning the process of engaging with employee representatives on these plans in accordance with country-specific legal requirements

.
http://www.techgig.com/tech-news/editors-pick/Nokia-to-transfer-820-jobs-to-TCS-HCL-Tech-16743?mailer_id=1412&utm_source=Mailer&utm_medium=TG_batch&utm_campaign=digest_news_2013-01-18&email=rmuthukumarece89@gmail.com&activity_name=tgdailynews_2013-01-18&dt=&auto_login=cm11dGh1a3VtYXJlY2U4OUBnbWFpbC5jb21AIyRAIyQzNjM3OTJAIyRAIyQxMzU4NDU1NzMw&src_type=autoLogin

Friday, 4 January 2013

10 enemies of being a good programmer



FOI...

This article discusses the habits which would need to be avoided if a person wants to become a good programmer.

Introduction and background

The information technology is not a new term now. For a common person, this is the field which guarantees good money and life (in the context of INDIA). People working in this industry are looked up-to and generally considered intelligent than others. 
After working for quite some time in this industry, looks like the above points are coming very close to being a myth.

Definitely this industry has been life changer for many and also big employer, foreign currency grabber but by large it would be interesting to know what’s the reality at ground level.

Many would comment that the quote about intelligence is overrated and this is just another industry with revenues in dollars helping for mammoth turnovers.

The common minimum ingredient of this industry is a programmer (or a developer or coder) who is the one writing the programs which are supposed to make things happen. As in every field of life, there are good programmer and bad programmers. The other hot topic in this industry is whether this industry possesses chunk of good programmer or not. Many wouldn’t agree.

So, what makes a good programmer? This is debatable point and to make things simpler, let’s see this the other way round i.e. discuss the top 10 enemies which can prevent oneself from becoming a good programmer.

Objective

To know about the DONT's if anyone wants to become a good programmer.

Description
Programming world is a confusing world. There have been so many languages, technologies, platforms, infrastructures to choose from which doesn't make life of a programmer easy even though they are supposed to. In the scenario where business needs are outscoring the engineering practices, the programming has become a real complex thing increasingly challenged by time and budget. There has been lot of research into software metric to measure the performance and quality but it still not straightforward to categorize programmers and probably say who is good or bad. Following are list of points which if we can ensure while programming, would definitely result in better code quality, better planning and better professional life. These points are picked up from real incidences which always keep happening with considerable frequency and it is observed that such incidences leads to poor quality, performance and higher costs. These points are not just related to technical skill but rather the attitude, awareness, behavior.

1. Is it computer or my program: When something goes wrong there is a tendency to term that it must be something wrong with computers or something else other than me? It’s funny but it omnipresent statement one hears. Barring few cases, it’s always the program doing something wrong rather than computer. If we take environmental, infrastructural attributes into account while programming we won't end of saying this. This is the biggest enemy.

2. Its working on my PC: This is probably mostly used age old statement and many have encountered it umpteen times. It is hard to believe but it happens all the time that the programs work well on developer’s machine but fail after deployment... Do we program for our own pc or our programs are intended to run only on the developer’s machine? Surely not and this is caused by insufficient programming skills and not enough knowledge of working environments, necessary settings etc.

In most of such cases, mostly the programmer has forgotten to update the deployed environment with some settings/ configurations, some component missing etc. rather than anything else.

3. Finger pointing: I have just changed it but I didn’t cause this error, it must be somebody else who might have worked on the same stuff. This is a statement one would hear all the time and it’s generally the first reaction one would hear when asked about some error or fault. In reality, something is changed and the original functionality is also lost then these statements are made. This is quite intriguing that something is changed and before a change things were working and still the programmers say this. This depicts the lack of ownership as well as understanding and escapist attitude. Given the complexity and difficulty to find the facts, many are encourage saying this.

There is a small remedy to overcome this and which is the practice of performing unit testing and take my word, life would be easy.

4. Skipping the validation of user input: While programming for user interactive applications / programs, one tends to skip the validation of user inputs under the assumption that he has coded for it and it shall work. The minimum check which is like confirming the data entered in GUI doesn’t exceed the data type and lengths defined in the database. No wonder, many of the defects and also the program crashes arises out of lack of such validation.
It is better to always ensure that the data types and lengths on GUI matches with the ones defined in data source and also it handles the common pitfalls which can spell doom for hackers. 

5. Not estimating (or planning) the work or tasks: Most of the programmer (especially junior ones) has urged to jump into coding without estimating the work. Estimation is just not important from planning perspective but it gives an opportunity to revisit the scope as the estimates are bound to scope.

There might couple of tasks challenged by time and/or budget which can be performed well without estimates but not     all. Whatever may the work or tasks if it is estimated, then it ease out planning, controlling and monitoring and also         given an avenue for asking the help before it is too late?

6.   Swallowing the exceptions: Exception handling is still a mystery for many programmers and when he/ she don’t know how to handle the exception or there is lack of good exception handling mechanism, the exceptions are swallowed means not action is taken after the occurrence of such exceptions or errors.
     Today's programming languages offers far more sophisticated mechanism in the form of try-catch-finally. This           swallowing mostly results into application crashes putting programmers into awkward position.
7.   Blindly copying and pasting: In today’s internet era, everything is available on internet and code snippets are not exceptions to this. With super-efficient searches, it is possible to locate code snippet which can do one's job.  
   
Probably it can't be called wrong to copy such code snippets and use but unfortunately the usage is always coincided      by blindly copying or retrofitting which results into partial solutions not taking into account the existing scenario. Also      one has to remember that such code snippets needs more rigorous testing than your native code to make sure that it      is doing what is needed. Another example is copying from code samples or others code which generally skips the understanding curve resulting into inferior quality software and it is also difficult to change such program and   maintain too. So copying and pasting is unavoidable but it would be better to invest some time to understand what it is doing and what is expected to be done and perform this with sound judgment.
8. Not being latest: The technology paradigm is characterized by the continuous changes and improvements. While working hard and long, many programmers are not able to synch them up with such changes and improvements. This may result in inferior solutions or far more time investment than could be justified. Also there are many changes happening on software engineering front where new methodologies like Agile, XP are introduced which can address many pertinent challenges in development life cycle.

9.  Lack of Documentation/ comments/standardization: No denying the fact the programs are written to be executed by computers but they are also written which could be understood by others. Many programmers shy away from writing enough comments or documentation which can help others about why, how and when something is done. Essentially this makes other programmer not attempting to understand and write something which would add to confusion. There are many instances of coding horrors, coding mess, coding chaos which have one thing in common and i.e. lack of documentation and standardization. Essentially the programs shall be human readable.

10. Speed well than accuracy: This is a trap for even the proven programmers. Many programmers think that the programming is 100 ctr races and one has to be lightning fast to win this race and in the process the quality, accuracy is sacrificed. This catapults into more work (many would want this for continuity of their business) which is not good of one looks at cost and time. Accuracy could attain more priority and speed with accuracy could be the motto.  

Summary and Conclusion
This topic is exhaustive and complex to discussed and addressed on one write-up. Still these 10 point are put forth to touch base the perennial challenges in software industry. There may be more apt points and detailed discussions but hope that this write-up could help to bring some really interesting practices to the fore.

Source:http://www.dotnetfunda.com/articles/article2098-10-enemies-of-being-a-good-programmer.aspx

How technology powers supply chain





Supply chain is about managing a network of several interconnected businesses that are involved in the process of delivering the product to the end customer. Throughout this process, flow of information from one stage to another plays a crucial role as it ensures effective decision-making at the planning and execution stages.

When it comes to the flow of information, no other tool or resource can do it as quickly and accurately as technology. This is true when it comes to supply chain as well.

Today, technology in supply chain is much more than just computers. It includes varied aspects, right from factory automation, enhanced communication devices, data recognition equipments to other types of automated hardware and services.

Companies have also started using technologies like advanced versions of speech recognition, digital imaging , radio frequency identification (RFID), real-time location systems (RTLS), bar coding, GPScommunication , Enterprise Resource Planning (ERP), Electronic Data Interchange (EDI), etc to improve their processes.

These IT-enabled infrastructure capabilities not only help organisations achieve higher efficiency, but also reduce cycle time, ensure delivery of goods and services in timely manner and improve overall supply chain agility.

Use of technology in three arenas
Organisations use technology in three broad areas namely transaction processing, supply chain planning and collaboration, and order tracking and delivery coordination. In transaction processing, companies employ technology to increase efficiency of information exchanged regularly between various supply chain partners. Typically, in this area, technology enables easy order processing, sending dispatch advice, tracking delivery status , billing, generating order quotes, etc.

Technology also helps in supply chain planning and collaboration, thereby improving the overall effectiveness of the process. Here, technology is used to share planning-related information like customer feedback, demand forecasting, inventory level, production capacity and other data. This helps in managing waste and inconsistency arising out of unpredictable and logistically demanding markets. According to Mr Prashant Potnis, GM - IT and Systems at Spykar Lifestyle Pvt Ltd, "Statistical capabilities enabled by technology like importing historical sales data, creating statistical forecasts, importing customer forecasts, collaborating with customers, managing and building forecasts, etc. bring accuracy to a company's demand plans."

Lastly, technology is also useful for order tracking and delivery coordination, as it monitors and coordinates individual shipments, ensuring delivery of the product to the consumer without errors.

Employing technology at all these levels no doubt comes at a cost. However, apart from reducing physical work, technology improves the quality of information, expedites information transfer, and increases and smoothly manages the volume of transactions. Yogesh Shroff, Finance & Supply Chain Director at Nivea India Pvt Ltd, agrees. "A combination of process changes and use of advanced technology can help companies gain better returns on marketing and sales investments, reduce cost, strengthen relationships across the value chain and retain customers," he says.

While most companies have employed technology to manage their supply chain today, they have realised that conventional methods have to be pushed beyond their peripheries to sustain in highly competitive environments and fields. If applied correctly, technology holds the potential to turn supply chain into a major differentiating factor for any company.

Calling javascript function from CodeBehind with C#


Javascript works from the client side while server code requires server processing. 
It is not possible to direcly invoke a client event through a server event. However there exists a fairly simple methods to achieve this. I will explain one simple way to do it.

Injecting a javascript code into a label control

This is one of the simplest method to call a javascript function from code behind. You need to do the following:

1.     Create a new website project
2.     Add a label and button control on your Default.aspx page
3.     You body part of the markup should now look something like this: 

<body> 
    <form id="form1" runat="server"> 
    <div> 
        <asp:Label ID="lblJavaScript" runat="server" Text=""></asp:Label> 
        <asp:Button ID="btnShowDialogue" runat="server" Text="Show Dialogue" /> 
    </div> 
    </form> 
</body> 

4.     Add a javascript function to show a message box as shown below: 
<head runat="server"> 
    <title>Calling javascript function from code behind example</title> 
        <script type="text/javascript"> 
            function showDialogue() { 
                alert("this dialogue has been invoked through codebehind."); 
            } 
        </script> 
</head>
5.     Now double-click on the button and add the following code: 
lblJavaScript.Text = "<script type='text/javascript'>showDialogue();</script>";

6.     Run your project and click the Show Dialogue button

A message box will be displayed as shown below: 
screen shot of client side message box

Sample Text

Sample text