Programming Tips π‘
Photo
ASP.NET Core.2 & Angular 5.pdf
7.3 MB
API Feature Folders β‘οΈ
In ASP.NET Core (and unlike ASP.NET 5 / Web API 2), Web API controllers are just controllers. π
You donβt need to inherit from a different base type or anything like that. β
Whatβs more, your API controllers should be returning DTOs that are separate from your underlying domain or data model. βοΈ
What Iβve found to be a better organization is to do away with the Controllers folder (or keep it around if youβre using view-based controllers) and instead use feature folders for your APIs. π
Iβm partial to having a root level API folder but if youβd prefer to put your features in the root of the project that would work, too. ππ»
Within each feature folder, you include the controller along with any model types it needs to work with, like this πΎ :
https://t.me/pgimg/124
Obviously one benefit of this approach is that itβs more cohesive. β
Things that change together are located physically next to one another, and the friction involved in moving between different folders with too many files in them is greatly reduced. βοΈ
Another nice thing about this approach is that it just works. Unlike view-based controllers, you donβt need to change anything about how ASP.NET Core is configured to have this organization structure work for you. β¨
[ Article ] : bit.do/apif
γ°γ°γ°γ°γ°γ°
#AspMvc #Core #API
@ProgrammingTip
In ASP.NET Core (and unlike ASP.NET 5 / Web API 2), Web API controllers are just controllers. π
You donβt need to inherit from a different base type or anything like that. β
Whatβs more, your API controllers should be returning DTOs that are separate from your underlying domain or data model. βοΈ
What Iβve found to be a better organization is to do away with the Controllers folder (or keep it around if youβre using view-based controllers) and instead use feature folders for your APIs. π
Iβm partial to having a root level API folder but if youβd prefer to put your features in the root of the project that would work, too. ππ»
Within each feature folder, you include the controller along with any model types it needs to work with, like this πΎ :
https://t.me/pgimg/124
Obviously one benefit of this approach is that itβs more cohesive. β
Things that change together are located physically next to one another, and the friction involved in moving between different folders with too many files in them is greatly reduced. βοΈ
Another nice thing about this approach is that it just works. Unlike view-based controllers, you donβt need to change anything about how ASP.NET Core is configured to have this organization structure work for you. β¨
[ Article ] : bit.do/apif
γ°γ°γ°γ°γ°γ°
#AspMvc #Core #API
@ProgrammingTip
Telegram
Programming Tips Resources
A Mini-Course on React Native Flexbox β¨
Flexbox solves design issues that are particularly challenging on mobile, and it does so strikingly well β without requiring hacky CSS or Javascript tricks. π
But thereβs a learning curve.
The property names all sound incredibly similar and do nothing to indicate what sets them apart. βοΈ
On top of that, each property has a set of values that are mostly similar, yet slightly different, from each other. And to compound the confusion, not all properties of the Flexbox standard are included in React Native. π
This can cause surprises when you try to follow regular CSS documentation, only to discover that React Native doesnβt implement a particular feature, such as reverse flexβοΈ
To help make it easier to internalize the rules of Flexbox, Iβve decided to write the guide that I would have liked to read β with the underlying concepts explained and simple examples along the way. πΎ
Doodle along with me and get comfortable solving design scenarios with Flexbox. π
https://t.me/pgimg/125
[ Article ] : bit.do/rnat
γ°γ°γ°γ°γ°γ°
#ReactNative #Design
@ProgrammingTip
Flexbox solves design issues that are particularly challenging on mobile, and it does so strikingly well β without requiring hacky CSS or Javascript tricks. π
But thereβs a learning curve.
The property names all sound incredibly similar and do nothing to indicate what sets them apart. βοΈ
On top of that, each property has a set of values that are mostly similar, yet slightly different, from each other. And to compound the confusion, not all properties of the Flexbox standard are included in React Native. π
This can cause surprises when you try to follow regular CSS documentation, only to discover that React Native doesnβt implement a particular feature, such as reverse flexβοΈ
To help make it easier to internalize the rules of Flexbox, Iβve decided to write the guide that I would have liked to read β with the underlying concepts explained and simple examples along the way. πΎ
Doodle along with me and get comfortable solving design scenarios with Flexbox. π
https://t.me/pgimg/125
[ Article ] : bit.do/rnat
γ°γ°γ°γ°γ°γ°
#ReactNative #Design
@ProgrammingTip
Telegram
Programming Tips Resources
InversifyJS β‘οΈ
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript. π
About π€
InversifyJS is a lightweight (4KB) inversion of control (IoC) container for TypeScript and JavaScript apps. π
An IoC container uses a class constructor to identify and inject its dependencies. π
InversifyJS has a friendly API and encourages the usage of the best OOP and IoC practices. β
Motivation π
JavaScript now supports object oriented (OO) programming with class based inheritance. These features are great but the truth is that they are also dangerous. β οΈ
We need a good OO design (SOLID, Composite Reuse, etc.) to protect ourselves from these threats. The problem is that OO design is difficult and that is exactly why we created InversifyJS. β¨
InversifyJS is a tool that helps JavaScript developers write code with good OO design. π―
Philosophy π
InversifyJS has been developed with 4 main goals π :
β’ Allow JavaScript developers to write code that adheres to the SOLID principles. βπ»
β’ Facilitate and encourage the adherence to the best OOP and IoC practices. π₯
β’ Add as little runtime overhead as possible. β°
β’ Provide a state of the art development experience. π
https://t.me/pgimg/126
[ Github ] : bit.do/inversify
γ°γ°γ°γ°γ°γ°
#JavaScript #DI #Inversify
@ProgrammingTip
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript. π
About π€
InversifyJS is a lightweight (4KB) inversion of control (IoC) container for TypeScript and JavaScript apps. π
An IoC container uses a class constructor to identify and inject its dependencies. π
InversifyJS has a friendly API and encourages the usage of the best OOP and IoC practices. β
Motivation π
JavaScript now supports object oriented (OO) programming with class based inheritance. These features are great but the truth is that they are also dangerous. β οΈ
We need a good OO design (SOLID, Composite Reuse, etc.) to protect ourselves from these threats. The problem is that OO design is difficult and that is exactly why we created InversifyJS. β¨
InversifyJS is a tool that helps JavaScript developers write code with good OO design. π―
Philosophy π
InversifyJS has been developed with 4 main goals π :
β’ Allow JavaScript developers to write code that adheres to the SOLID principles. βπ»
β’ Facilitate and encourage the adherence to the best OOP and IoC practices. π₯
β’ Add as little runtime overhead as possible. β°
β’ Provide a state of the art development experience. π
https://t.me/pgimg/126
[ Github ] : bit.do/inversify
γ°γ°γ°γ°γ°γ°
#JavaScript #DI #Inversify
@ProgrammingTip
Telegram
Programming Tips Resources
Favor Privileges over Role Checks βοΈ
A very common practice in web applications, especially those written using the ASP.NET built-in Role provider, is to perform role checks throughout the code to determine whether a user should have access to a particular page or control or command. π
For instance, you might see something like this β»οΈ :
The problems with the maintainability of this approach become apparent after a short while.βοΈ
For one, any buttons or other controls on the SomeSpecialControl above that post back to the page should also do a role check to ensure the user submitting the postback is in an acceptable role, otherwise a security hole may be present and users outside of these roles may be able to perform privileged actions. β οΈ
πΈπΉπΈπΉ
Introducing Privileges β
Wouldn't it be better to act like thisβ
This is very clear and is at the appropriate level of abstraction. π
CanEdit isnβt itself a privilege; we can look at it as a sort of helper method in this case that lets us write clear and concise code. β¨
https://t.me/pgimg/127
[ Full Article ] : bit.do/prauth
γ°γ°γ°γ°γ°γ°
#AspMvc #Authorization
@ProgrammingTip
A very common practice in web applications, especially those written using the ASP.NET built-in Role provider, is to perform role checks throughout the code to determine whether a user should have access to a particular page or control or command. π
For instance, you might see something like this β»οΈ :
if (User.IsInRole(Roles.Administrators))
{
SomeSpecialControl.Visible = true;
}
The problems with the maintainability of this approach become apparent after a short while.βοΈ
For one, any buttons or other controls on the SomeSpecialControl above that post back to the page should also do a role check to ensure the user submitting the postback is in an acceptable role, otherwise a security hole may be present and users outside of these roles may be able to perform privileged actions. β οΈ
πΈπΉπΈπΉ
Introducing Privileges β
Wouldn't it be better to act like thisβ
EditorPanel.Visibility = CurrentUser.CanEdit(CurrentArticle);
This is very clear and is at the appropriate level of abstraction. π
CanEdit isnβt itself a privilege; we can look at it as a sort of helper method in this case that lets us write clear and concise code. β¨
https://t.me/pgimg/127
[ Full Article ] : bit.do/prauth
γ°γ°γ°γ°γ°γ°
#AspMvc #Authorization
@ProgrammingTip
Telegram
Programming Tips Resources
Real World - Conduit π
While most "todo" demos provide an excellent cursory glance at a framework's capabilities, they typically don't convey the knowledge & perspective required to actually build real applications with it. β
Real World solves this by allowing you to choose any front-end like π :
β’ React / Redux / Mobx
β’ Angular
β’ Vue
β’ Elm
β’ Aurelia
β’ Clojure
And any back-end like π :
β’ ASP.NET Core
β’ Node / Express
β’ F#
β’ Laravel
β’ Django
β’ Rails
β’ Go + Gin
β’ Rust
β’ Scala & Play Framework
β’ Hapi.js
And see how they power a real world, beautifully designed fullstack app called "Conduit". β¨
https://t.me/pgimg/128
[ Projects ] : bit.do/reworld
γ°γ°γ°γ°γ°γ°
#Template #RealWorld
@ProgrammingTip
"The mother of all demo apps." π₯
While most "todo" demos provide an excellent cursory glance at a framework's capabilities, they typically don't convey the knowledge & perspective required to actually build real applications with it. β
Real World solves this by allowing you to choose any front-end like π :
β’ React / Redux / Mobx
β’ Angular
β’ Vue
β’ Elm
β’ Aurelia
β’ Clojure
And any back-end like π :
β’ ASP.NET Core
β’ Node / Express
β’ F#
β’ Laravel
β’ Django
β’ Rails
β’ Go + Gin
β’ Rust
β’ Scala & Play Framework
β’ Hapi.js
And see how they power a real world, beautifully designed fullstack app called "Conduit". β¨
https://t.me/pgimg/128
[ Projects ] : bit.do/reworld
γ°γ°γ°γ°γ°γ°
#Template #RealWorld
@ProgrammingTip
Telegram
Programming Tips Resources
Carbonβ¨
Create and share beautiful images of your source code. π
You know all of those code screenshots you see on Twitterβ
Although the code's usually impressive, we saw room for improvement in the aesthetic department. β
Carbon is the easiest way to create beautiful images of your source code. π
So what are you waiting forβ
Go impress all of your followers with your newfound design prowess. π¨
https://t.me/pgimg/129
[ Website ] : carbon.now.sh
γ°γ°γ°γ°γ°γ°
#Code #Scheme
@ProgrammingTip
Create and share beautiful images of your source code. π
You know all of those code screenshots you see on Twitterβ
Although the code's usually impressive, we saw room for improvement in the aesthetic department. β
Carbon is the easiest way to create beautiful images of your source code. π
So what are you waiting forβ
Go impress all of your followers with your newfound design prowess. π¨
https://t.me/pgimg/129
[ Website ] : carbon.now.sh
γ°γ°γ°γ°γ°γ°
#Code #Scheme
@ProgrammingTip
Telegram
Programming Tips Resources
Apress - Real-Time Web Application Development.pdf
21.3 MB
Flexbox Froggy πΈ
Flexbox Froggy is a game for learning CSS flexbox. πΎ
Flexbox Froggy takes inspiration from the classic arcade game Frogger, and web literacy games like the brilliant CSS Diner and Erase All Kittens, where you learn about CSS selectors and HTML markup respectively. π₯
https://t.me/pgimg/130
[ Learn ] : flexboxfroggy.com
γ°γ°γ°γ°γ°γ°
#FlexBox #CSS
@ProgrammingTip
Flexbox Froggy is a game for learning CSS flexbox. πΎ
Flexbox Froggy takes inspiration from the classic arcade game Frogger, and web literacy games like the brilliant CSS Diner and Erase All Kittens, where you learn about CSS selectors and HTML markup respectively. π₯
https://t.me/pgimg/130
[ Learn ] : flexboxfroggy.com
γ°γ°γ°γ°γ°γ°
#FlexBox #CSS
@ProgrammingTip
Telegram
Programming Tips Resources
Using Redis Cache in .NET Core π
Redis is a high performance distributed cache. Itβs great for storing data that you are going to need again and again in a short period of time when you donβt want to use processing power to βcreateβ that data again. β»οΈ
Think number crunching or heavy SQL queries for data that doesnβt change often. π«
Roll Your Own π€
First off. You can absolutely roll your own Redis Cache services abstracted by your own interfaces etc. β
You may find it a little difficult to find libraries that target .NET Core, but this will change over time. β³
In saying that, there is a β.NET Coreβ way of doing things that is a little different. It does tie you into the framework a little, but it abstracts away the caching completely and letβs Microsoft handle it and thatβs what we are going to go over today. π
https://t.me/pgimg/131
[ Article ] : bit.do/rcache
γ°γ°γ°γ°γ°γ°
#Redis #AspMvc #Core #Cache
@ProgrammingTip
Redis is a high performance distributed cache. Itβs great for storing data that you are going to need again and again in a short period of time when you donβt want to use processing power to βcreateβ that data again. β»οΈ
Think number crunching or heavy SQL queries for data that doesnβt change often. π«
Roll Your Own π€
First off. You can absolutely roll your own Redis Cache services abstracted by your own interfaces etc. β
You may find it a little difficult to find libraries that target .NET Core, but this will change over time. β³
In saying that, there is a β.NET Coreβ way of doing things that is a little different. It does tie you into the framework a little, but it abstracts away the caching completely and letβs Microsoft handle it and thatβs what we are going to go over today. π
https://t.me/pgimg/131
[ Article ] : bit.do/rcache
γ°γ°γ°γ°γ°γ°
#Redis #AspMvc #Core #Cache
@ProgrammingTip
Telegram
Programming Tips Resources
WarriorJS π‘
An exciting game of programming and Artificial Intelligence. π€
In WarriorJS, you wear the skin of a warrior climbing a tall tower to reach The JavaScript Sword at the top level. β³οΈ
Legend has it that the sword bearer becomes enlightened in the JavaScript language, but be warned : the journey will not be easy. β οΈ
On each floor, you need to write JavaScript to instruct the warrior to battle enemies, rescue captives, and reach the stairs alive. β οΈ
No matter if you are new to programming or a JavaScript guru, WarriorJS will put your skills to the test. Will you dareβ
https://t.me/pgimg/132
[ Github ] : bit.do/warriorjs
γ°γ°γ°γ°γ°γ°
#JavaScript #Fun #Game
@ProgrammingTip
An exciting game of programming and Artificial Intelligence. π€
In WarriorJS, you wear the skin of a warrior climbing a tall tower to reach The JavaScript Sword at the top level. β³οΈ
Legend has it that the sword bearer becomes enlightened in the JavaScript language, but be warned : the journey will not be easy. β οΈ
On each floor, you need to write JavaScript to instruct the warrior to battle enemies, rescue captives, and reach the stairs alive. β οΈ
No matter if you are new to programming or a JavaScript guru, WarriorJS will put your skills to the test. Will you dareβ
https://t.me/pgimg/132
[ Github ] : bit.do/warriorjs
γ°γ°γ°γ°γ°γ°
#JavaScript #Fun #Game
@ProgrammingTip
Telegram
Programming Tips Resources
VS Code can do that βοΈ
All the best things about Visual Studio Code that nobody ever bothered to tell you. π₯
Features β :
β’ Update Image Size
β’ Emmet
β’ Wrap Individual Lines
β’ Prettier
β’ Font Ligatures
β’ Bracket Pair Colorizer
β’ JavaScript Type Checking
β’ JSON Intellisense
β’ Node.js Debugging
β’ Debugging Browser Apps
β’ Log Points
β’ CosmosDB / MongoDB
β’ Bookmarks
β’ Docker
β’ Settings Sync
β’ Deployment
β’ Image Preview
β’ CSS Preview
β’ Inline File / Folder Nesting
https://t.me/pgimg/133
[ Website ] : bit.do/vscod
γ°γ°γ°γ°γ°γ°
#VSCode #Extensions
@ProgrammingTip
All the best things about Visual Studio Code that nobody ever bothered to tell you. π₯
Features β :
β’ Update Image Size
β’ Emmet
β’ Wrap Individual Lines
β’ Prettier
β’ Font Ligatures
β’ Bracket Pair Colorizer
β’ JavaScript Type Checking
β’ JSON Intellisense
β’ Node.js Debugging
β’ Debugging Browser Apps
β’ Log Points
β’ CosmosDB / MongoDB
β’ Bookmarks
β’ Docker
β’ Settings Sync
β’ Deployment
β’ Image Preview
β’ CSS Preview
β’ Inline File / Folder Nesting
https://t.me/pgimg/133
[ Website ] : bit.do/vscod
γ°γ°γ°γ°γ°γ°
#VSCode #Extensions
@ProgrammingTip
Telegram
Programming Tips Resources
Never commit code thatβs been commented out π«
Iβve never understood the reasoning behind committing code thatβs been commented out. π€
I assume itβs to keep old versions of the code around just in case the new code doesnβt work, but thatβs just bizarre. β οΈ
Keeping track of old versions is the reason we use a version control system in the first placeβοΈ
Why was the code commented outβ
Does it workβ
Should it workβ
Has it ever workedβ
Is it something we should strive towards or run away fromβ
Code thatβs been commented out is worse than useless, because every time itβs read, it raises questions like these without providing any answers. β
It only serves to confuse and distract from the code in use. π€―
https://t.me/pgimg/134
γ°γ°γ°γ°γ°γ°
#Tips #Git
@ProgrammingTip
Iβve never understood the reasoning behind committing code thatβs been commented out. π€
I assume itβs to keep old versions of the code around just in case the new code doesnβt work, but thatβs just bizarre. β οΈ
Keeping track of old versions is the reason we use a version control system in the first placeβοΈ
Why was the code commented outβ
Does it workβ
Should it workβ
Has it ever workedβ
Is it something we should strive towards or run away fromβ
Code thatβs been commented out is worse than useless, because every time itβs read, it raises questions like these without providing any answers. β
It only serves to confuse and distract from the code in use. π€―
https://t.me/pgimg/134
γ°γ°γ°γ°γ°γ°
#Tips #Git
@ProgrammingTip
Telegram
Programming Tips Resources
Programming Tips π‘
Photo
It's quiz time, What do you think will be loggedβ
anonymous poll
2 then 3 β 83
πππππππ 50%
1 then 1 β 28
ππ 17%
1 then 3 β 28
ππ 17%
1 then 2 β 28
ππ 17%
π₯ 167 people voted so far. Poll closed.
anonymous poll
2 then 3 β 83
πππππππ 50%
1 then 1 β 28
ππ 17%
1 then 3 β 28
ππ 17%
1 then 2 β 28
ππ 17%
π₯ 167 people voted so far. Poll closed.
This media is not supported in your browser
VIEW IN TELEGRAM
And now ... here is the answer. π€π»
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#JavaScript #Async
@ProgrammingTip
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#JavaScript #Async
@ProgrammingTip
Avian π
A lightweight virtual machine and class library designed to provide a useful subset of Javaβs features, suitable for building self-contained applications. π‘
Efficient
πΈJust-In-Time (JIT) compilation for fast method execution
πΉGenerational, copying garbage collection ensures short pause times and good spatial locality
πΈThread-local heaps provide O(1) memory allocation with no synchronization overhead
πΉNull pointer dereferences are handled via OS signals to avoid unecessary branches
The class library is designed to be as loosely coupled as possible, allowing tools like ProGuard to aggressively isolate the minimum code needed for an application. β‘οΈ
This translates to smaller downloads and faster startup. β¨
https://t.me/pgimg/135
[ Website ] : readytalk.github.io/avian
γ°γ°γ°γ°γ°γ°
#Java #VM #JIT
@ProgrammingTip
A lightweight virtual machine and class library designed to provide a useful subset of Javaβs features, suitable for building self-contained applications. π‘
The VM is implemented from scratch and designed to be both fast and small.
Efficient
πΈJust-In-Time (JIT) compilation for fast method execution
πΉGenerational, copying garbage collection ensures short pause times and good spatial locality
πΈThread-local heaps provide O(1) memory allocation with no synchronization overhead
πΉNull pointer dereferences are handled via OS signals to avoid unecessary branches
The class library is designed to be as loosely coupled as possible, allowing tools like ProGuard to aggressively isolate the minimum code needed for an application. β‘οΈ
This translates to smaller downloads and faster startup. β¨
https://t.me/pgimg/135
[ Website ] : readytalk.github.io/avian
γ°γ°γ°γ°γ°γ°
#Java #VM #JIT
@ProgrammingTip
Telegram
Programming Tips Resources
Programming Tips π‘
Photo
Mastering Docker.pdf
26.3 MB
Mastering Docker - Second Edition π
Authors π :
Russ McKendrick
Scott Gallagher
Publisher : Packt β¨
γ°γ°γ°γ°γ°γ°
#Book #Docker
@ProgrammingTip
Authors π :
Russ McKendrick
Scott Gallagher
Publisher : Packt β¨
γ°γ°γ°γ°γ°γ°
#Book #Docker
@ProgrammingTip