Wednesday, November 14, 2018

IActionResult Vs ActionResult


IActionResult Vs ActionResult
IActionResult is an interface and ActionResult an implementation of that interface.
ActionResults is an abstract class and action results like ViewResult, PartialViewResult, JsonResult, etc derive from ActionResult.
When you will use IActionResult and create your own implementation of it
Let's say you want to create an action result not catered for by MVC, say an XML result.

IActionResult is an interface, we can create a custom response as a return, when you use ActionResult you can return only predefined ones for returning a View or a resource, withIActionResult  we can return a response, or error as well. On the other hand, ActionResult is an abstract class, and you would need to make a custom class that inherits and then further stuff.
For example as below
public NoContentResult NoContentActionResult()
{
        return NoContent();
}
public IActionResult NoContentActionResult()
{
        return NoContent();
}

OR

public IActionResult JsonActionResult()
{
      return NotFound();
}

public JsonResult JsonActionResult()
{
        return NotFound(); // This line will give Error
}

From above examples we can return NoContent() OR NotFound() from IActionResult But if you want to use such type of return values with ActionResults, you need to use particular ActionResults, NoContentResult AndJsonResult.

Tuesday, March 20, 2018

WebPage Weight and Performance

What is the most important aspect of web application which user likes?
And definitely answer is Performance.

In the latest survey 40% of user not interested or abandon a website/web page which take more than 3 seconds to load. 1 second delay in page response or page load can result in a 7% reduction in conversion
Search engines and users struggle to trust unresponsive websites, even if the site is useful or beautiful.
Even on Google's Company belief page, one of the most important point is “Fast is better than slow. We know your time is valuable… We keep speed in mind with each new product we release.”Speed of webpage is inversely proportional to Weight of page.
Speed of webpage is inversely proportional to Weight of page.
Reduction of Weight is most important and difficult whether it is human or webpage, however if we take care from beginning of developing of product it is really easy to be Fast.
Here are some precautions/tips to achieve your websites ideal weight
1) Optimize/compress Images - Un-Optimized images can weigh a page highly down. Whether they are big or of wrong format, they contain unused amounts of data that adds up the web page load time. Dropping such images is a fast and easy way to speed up your website/webpage.
You can use lazy-loading technique to load Images. Means, to lazy-load an image means that the image is not loaded until it is needed
You can optimize your images using Google’s PageSpeed functionality (extension to the Chrome). It’s built into Chrome’s developer tools and can be accessed by right clicking on a page and selecting “Inspect Element”. PageSpeed is a tab at the top and you can use it to analyze the page you’re inspecting. When it’s finished, you can select “Optimize images” then identify the biggest offenders.
You can then replace the problem images with an optimized version from Google. Simply click on “See optimized content”, save that version, and then replace the existing one.
2) Better Use of CSS - Removing unused CSS is a good first step. Allowing that code to stick around results in downloading unnecessary bytes. Avoiding CSS expressions is a smart move as well.
3) Use of Cache - Cache what you can. Optimizing caching is particularly helpful for websites with repeat visitors. Rather than making the user’s browser load your web page’s images, CSS, and JavaScript, every single time they visit the site, you can opt to have them stored in the browser’s cache. That way, their return visit requires far less loading.
4) Useless Plugin - Plugins are really great. Implementation is fast, functionality is diverse, and most of them are free. But, definitely it has impact on page size and load times.
If you’re managing a website that has lots of plugins installed, perform a quick audit and uninstall or deactivate anything that’s not in use.
For WordPress users, the P3 (Plugin Performance Profiler) is a great way to determine what’s causing your website the most grief.
5) Minification - Minification (or minimization) is the process of reducing the size of text-based files by removing unnecessary characters such as whitespace, newline characters, and comments. File size can drop by over 30%. JavaScript, CSS, HTML and SVG can all be minimized.
6) Avoid custom fonts - Particularly on mobile devices, do you really need custom fonts? Most visitors won’t notice the difference between a fancy web font and the nearest standard one. If you insist on using a web font, it might possible to get a version of the font limited to only those characters you need
Apart from this there are many ways to increase speed of your website/webpage, but above are the most common and important factors.
Always Remember, Neglecting your website’s performance is like skipping leg day at the gym. Your upper body may get most of the spotlight, but your legs are doing most of the work throughout the day.

HIRING – Simple for companies but Confusing for Candidates

Hiring is the hottest topic ever specially in Software world. Requirement of good talent is always in market even at recession time. Almost all companies always in search of good candidates and interviews goes on, but rejection count keep on increasing.
What are the reasons?
First we need to understand who build professionals, who create them? And the answer is company itself. Then my question is why companies produce unprofessional (by behavior, attitude wise, lack of skills) employees, it means that companies are not serious about their employees.
For Example - In HR interview or in Induction company representative convey message to newly joined employees that they are the asset of the company, and just outside of the room every boss, manager shouting that Client is the GOD, Clients come first.
Some reasons are listed below and questions for the companies.
1)     Companies are confused: - many of the companies are confused about what they want. Companies want Skills, innovator, out of the box thinking, professional, positive attitude, can-do behavior, good academics, stability in career and many more. Seriously? with all above qualities will anyone work for companies, chances are very less, he/she will work for him/herself not for companies.
2)     HR: - I have personally seen and talked with tons of professionals if there is any factor who is responsible for rejection then that is HR person. They are the most unprofessional entity in the industry and in hiring process. Now a day most HR people want to be verbally good, email of HR people never reaches on time or sometimes they don’t reach, Job Description not to the point, don’t show flexibility about interview. Everyone should know that we are in second decade of 21st century, face to face interview will be outdated in next few years. Use Skype, WhatsApp, messengers and many more medium for interviews. Video call facility is everywhere now a day.
We can take a call with Clients/Customers, then why not interviews.
3)     Interview process: - There are different interview process with different companies. Companies asking for technical test to 8+ years of experience is simply unbelievable. If interviewer not able to assess the candidate by talking to them then companies need to think themselves.
4)     Latest Technologies: - companies always need latest technologist. Companies need to think and check their project technology stack before asking latest technologies. 90%+ time companies hire latest technology experience candidate and allocate them old version tech project. Companies should understand upgrading skills of employees is the building them professionally and associate them for long term, however degrading skills is un-securing employee’s career, and it is short term game.
5)     Full Stack Development Skill: - maximum top-level leaders don’t understand the meaning of Full Stack Development skills, they think asking 10-20 skills list is the Full Stack. Please come out of it. Full Stack development concept plays disastrous role in IT skills, with this concept we can produce Jack of all Master of none. Knowledge of many technologies definitely helps to industry and individual, however expecting expertise in 10 skills is just like making fun of time, costs, talents and professionalism.
6)     GAP in employment – If there is gap in employment, then there must be the reason. Irrespective of reason companies should prefer such employees. Experienced professionals who stayed away from office or work always are excited to work and knows the importance of employment. Also there are no of genuine reasons for professional’s break. Also breaks brings lots of experiences and learnings.  So take it in positive way and hire peoples having break/gap in employment
So Companies don’t be confused, don’t be political, decrease your demands, it is era of startups, you never know you are giving birth to you competitor.

Monday, November 21, 2011

Add BookMark Programmatically

Add BookMark Programmatically through JavaScript

function addToBookMarks()
{
    if(document.all)
         window.external.AddFavorite(location.href,document.title);
         else if(window.sidebar)window.sidebar.addPanel (document.title,location.href,'');
}

IActionResult Vs ActionResult

IActionResult  Vs   ActionResult IActionResult   is an interface and  ActionResult   an implementation of that interface. ActionRes...