Too much…

Lately the IT industry is going through too many changes and its getting difficult to keep up with the developments happening.

Too many programming languages, too many frameworks, too many devices to support, too many standards to follow. Too much time wasted, learning, forgetting. Too many tips n tricks, too many quirks, too many gotchas. Too many patterns/anti patterns to follow.

Too many tools, too many packages, too many dependencies, too many breaking changes. Too many employers don’t want employees to learn. Takes too much time to learn and master,costs too much money.  Too many hours staring at a screen. Too much back pain. Too many emails, too many chats, too many meetings.

Too little pay for too much work. Too many programmers. Too many programs….

 

 

2017 Best Practices for Loading from ChromeDevSummit

  • Compress diligently! (GZip, Brotli)
  • Cache Effectively (HTTP, Service Workers)
  • Minify & Optimize *.*
  • Preresolve DNS for critical origins
  • Preload Critical Resources
  • Respect Data Plans
  • Stream HTML responses
  • Make fewer HTTP Requests
  • Have a Font loading Strategy
  • Send less JavaScript (code-splitting)
  • Lazy-Load non-critical resources
  • Route based chunking
  • Library Sharding
  • PRPL pattern
  • Tree-shaking (Webpack, Rollup)
  • Serve modern Browsers ES2015 (babel-preset-env)
  • Scope hoisting (Webpack)
  • Don’t ship Dev code to PROD

From #ChromeDevSummit

Adding/Removing users from command prompt on Linux

Recently I installed Kali Linux and found that by default we will be logged in with root and we continue to work in root, which might be not so good idea. So here is a way to create new users, assign password to the new user account and giving su rights to the newly created user.

Here are the steps to follow:

1. While logged in as root, Open a terminal using Ctrl+Alt+T or clicking on the icon on the dock

2. Add a new user using:

useradd -m <username>

-m to create the user’s home directory, replace <username> with new username

3. Create a password for the username created in step 2:

passwd <username>

4. Add the user to the sudo group (to install software etc):

usermod -a -G sudo <username>

-a to add and -G mentions the group name to be added to

5. Now finally change the default shell of the newly added user to bash:

chsh -s /bin/bash <username>

-s to provide a new login shell for the user account

Logout from root and login with newly created username and password and you are ready to go.

 

wget on Windows 10

After I installed wget on Windows 10 and started downloading the files, I could not find the downloaded files and little bit of exploration lead me to the location where the files got saved. I am posting it here the default location of the downloaded files which might be helpful to some of you too.

C:\Users\<current user>\AppData\Local\VirtualStore\Program Files (x86)\GnuWin32\bin

Enterprise level Application architecture using MVC5 – Best practices

  1. First of all, it is important to note that in software design process, there is nothing like solid right and wrong. As long as an approach works for your project and fits well, it is right and if it doesn’t, it is wrong. There are no rigid principals in software design. There are Project needs and specifications. But generally, it has been accepted using Design Patterns and Principles makes project more robust, reliable and easy to maintain and make your code loosely coupled and highly cohesive.
  2. The whole story of Software Design and Architecture is about how you could manage your project easily and how you could maintain your future changes. Think about which approach gives you best answer on them. That will be the best for you. Don’t think too much about Professionalism! .Your project grows by time and gets more mature. So just think about your project!
  3. As a first step and for Enterprise level application architecture, always try to follow Separation of Concerns or SoC. It means you should have different tiers for different layers of your project. It is highly recommended to use different project in your solution for Data Access Layer, Domain Entities, Business Layerand Presentation Layer. In MVC5 project, it is better to use Class Library Project for Data Access Layer, Domain Entities, Business Layer and a MVC project for Presentation Layer.
  4. Data Access Layer is the project that faces to database and database interactions. You could have all your Entity Framework or similar entities in this project. Having separated layer for database layer means in the case of changing your project data warehouse, the only thing you need to change is changing this project and some minor changes on your Business Layer. All other projects in your solution remain intact. So you could easily move from MS Sql to Oracle or from Entity Framework to NHibernate.
  5. Domain Entities is the project I use to define all my solution level interfaces, classes, enums and variables. This project keeps integrity throughout my solution on my classes and my methods. My all classes in whole solution are inherited from interfaces in this project. So I have one place to change my classes or global variables and it means Easy to Maintain for future in my solution and easy to understand for newly joined developers to the project.
  6. Business Layer is the place I put my all business logic including Business Entities and Business Services. The whole idea about this layer is having one place to keep your all business methods and interactions. All calculations, object modification and all logic about data including saving, retrieving, changing and so on should happen in this section. By having this layer in your project, you could have different consumers at the same time, for example one native MVC and one Web API layer. Or you could provide different feeding based on different business services consumers specifications. It is highly recommended to avoid putting any business logic into controller section of MVC layer. Having any business logic inside controllers means you using your presentation layer as business logic layer and it violates Separation of Concerns. Then it won’t be easy to change from one presentationlayer to other or having different type of consumers for your solution. It is better to keep controller section in MVC as slim as possible. The controllers should only have logic and methods directly related to View Models. For more information about View Models refer to section 7. One thing to remember, It is better to have different Business Services classes based on your solution objects or Business Entities.
  7. Presentation Layer in MVC solution will be an MVC project. But solution could have other type or more than one Presentation Layers for different consumers or technology. For example you could have one MVC layer and one Web API in one solution. Generally Use Presentation Layer to keep all presentation logic in it. Presentation logic shouldn’t have anything related to business logic or data logic. So question is what is Presentation logic? Presentation logic is logic related to view models. View models are objects customized for views or pages. In most cases, business objects are not suitable to use in views. On the other hand, presentation views usually need some validation logic or presentation logic, for example display name different than original object names. In these cases it is better keep presentation logic separated than business logic to make it easy to change presentation logic or business logic independently and even easy to switch presentation layer for different UI design or changing business logic for having more functionality without fear of any interruption with presentation logic. In the case of using MVC project as presentation layer for solution, all view models should be places in Models section of MVC project and all presentation logic should be placed in Controllers section of project.
  8. The last thing to say is for every multi-tier solution, you need frameworks for object to object mapping, for example to convert your business entity to view model. There are some tools for this purposes like AutoMapper, BLToolkit, and EmitMapper.

 

I have reposted it here so that I don’t have to search for it.

Source : StackOverflow