Posts

Showing posts with the label Tips

Handle Divide-By-Zero Error In SQL

Image
The idea here is that, as with any other form of math that we know of, we cannot divide by zero in a SQL call. Therefore, running this code : SELECT ( 3765 / 0 ) AS value ; if  you ever tried this , result of SQL server would be  : To prevent this sort of error from being thrown, author Hugo Kornelis suggests using a NULLIF () in the divisor of the equation. NULLIF () takes two arguments and returns NULL if the two values are the same and can be used to turn the divisor from a zero into a NULL which, in turn, will force the entire equation to become NULL .  SELECT ( 3765/ NULLIF( 0, 0 ) ) AS value ; Therefore, while we try running modified query (as above) , we would end up getting Null Object , which reduces the risk of handling divide by zero : NULLIF(0,0) returns NULL since zero is equal to zero , which makes SQL statement to return NULL . Till this point its pointless example since both zero values are hard coded . But imagine if in case it wa

AngularJs -Effective way to Monitor Changes to Model data

Image
The two-way data binding in AngularJS is very powerful, especially when there is a direct mapping of input data to view-model-data. But, when the data mapping requires some translation, interpretation, or validation, you need to get your hands a little dirty - you need to get more involved in how data changes are propagated within your Controller(s). As this has happened to me, I've been forced to think more deeply about my AngularJS application architecture; and, as a result, I've found that my life is often simplified (in the long term) by calling a directive to watch before I bind the data to View model. Factory To Monitor Changes This is easiest and effective way because of these reasons : 1) I just need to call a Trigger Method with scope which should be monitored 2) Once the data is retrieved from Ajax call , I just Initialize the data 3) If there are any changes to bound data on the form and user tries to navigate to another page, I get Confirm box on the

Make it Easy by Angular-JS Directive to Format or Filter Date

Image
There is always a havoc on handling dates in the application either it's java /dot net or angular . So here is the best way I found in order to overcome the problem . Date Directive Here I am going to explain about angular date filtering concept and how to  use filtering concept to filter Date across your application.It is always better to create a date.js file for those filtering concept.  The advantage of this is you can very easily filter the data anywhere in your view by just placing directive. This can be achieved by using following code in your module defined, for example : CYW.date below. angular.module('CYW.date', []) .filter('stringToDate', function () { return function (input) { /// gets Date input, if not, returns null. Also sets the date to /// correct format if (!input) return null; var date = moment(input); return date.isValid() ? date.format('MM/DD/YYYY') : null; }; }

Some of the time-saving tips every AngularJS user should know !! - Part 2

Image
Must Read  before Reading this Post : Some of the time-saving tips every AngularJS user should know !! - Part 1  . As Discussed in Earlier post  ,It was all about High/Architecture level Tips . Let's go through some Low-Level thoughts. At a Low-Level Thoughts/Tips/Gotchas: 1) Learn and love your console logs - Sometimes, especially with the digest cycles and angular lifecycle, it's sometimes easier to print your debugs to a console.logs instead of adding breakpoints. It's faster! 2) Get Batarang  , the chrome extension -   That is by far the best way to get into the bowels of AngularJS, and some of the details it provides (performance, dependencies) will make your life super simple and easy 3) Start running your unit tests on every save -   It will do the work of the compiler, and next time you break any functionality, you can fix it with a simple Undo in your IDE 4) Use the [] notation for listing your dependencies -  That is angularA

The 9 Most In-Demand Programming Languages of 2016

Image
Glassdoor published a report on the  top 25 lucrative, in-demand jobs . More than half of the jobs listed are in tech and require programming skills. If you’re interested in a fast-growing and lucrative career, you might want to make  learning code  next on your checklist! Next, comes the hard part – deciding on the best programming language to learn. To help narrow things down, below are compiled data from Indeed.com .While this isn’t an extensive list, it does provide insight into the most in-demand programming languages sought after by employers. Credits: Indeed.com Breakdown of the 9 Most In-Demand Programming Languages 1.    SQL It’s no surprise SQL (pronounced ‘sequel’) tops the job list since it can be found far and wide in various flavors. Database technologies such as MySQL, PostgreSQL and Microsoft SQL Server power big businesses, small businesses, hospitals, banks, universities. Indeed, just about every computer and a person with access to technology eventually touch somethi

Visual Studio's most useful and underused tips

Image
Do you know Solution Tree Explorer are Searchable !!! Below ones are a saver . There's a lot of little tricks like this in Visual Studio that even the most seasoned developers sometimes miss. This phenomenon isn't limited to Visual Studio, of course. It's all software ! Here's some exceedingly useful stuff in Visual Studio (It's  free to download  and use, BTW) that folks often miss. SEARCH SOLUTION EXPLORER WITH CTRL+; You can just click the text box above the Solution Explorer to search all the nodes - visible or hidden. Or, press "Ctrl + ;" Type in anything and this shows results which match Even stuff that's DEEP in the beast. The resulting view is filtered and will remain that way until you clear the search. QUICK LAUNCH - CTRL+Q  If there is one feature that no one uses and everyone should use, it's Quick Launch. Some blogs tell us the internal telemetry numbers show that usage of Quick Launch in the single digits or lower.  Do you know