π¦ Grab The Stack Trace Of An Exception π¦
Checking your code for errors is one of the most Painstaking β and frustrating β parts of the development process. ππ»ββοΈ
Itβs also horrendously Time-Consuming, particularly if youβve a pesky error whose source isnβt immediately clear. π‘
Using this code, you can more easily track down where an Exception is occurring β and bring yourself that much closer to being rid of it. β
Code
#java #exception #error #trick
@ProgrammingTip
Checking your code for errors is one of the most Painstaking β and frustrating β parts of the development process. ππ»ββοΈ
Itβs also horrendously Time-Consuming, particularly if youβve a pesky error whose source isnβt immediately clear. π‘
Using this code, you can more easily track down where an Exception is occurring β and bring yourself that much closer to being rid of it. β
Code
Exception e = β¦;
java.io.StringWriter sw = new java.io.StringWriter();
e.printStackTrace(new java.io.PrintWriter(sw));
String trace = sw.getBuffer().toString();
#java #exception #error #trick
@ProgrammingTip
Use String.valueOf() instead of toString() π
If obj needs to be converted to string then the result of obj.toString() and String.valueOf(obj) will be same.
But String.valueOf() is Null Safe, means it will never throw NullPointerException. π―
γ°γ°γ°γ°γ°γ°
#java #string
@ProgrammingTip
If obj needs to be converted to string then the result of obj.toString() and String.valueOf(obj) will be same.
But String.valueOf() is Null Safe, means it will never throw NullPointerException. π―
Test test = null;
// Below statement will not throw NPE
System.out.println(String.valueOf(test));
// Next statement will throw NPE
System.out.println(test.toString())
γ°γ°γ°γ°γ°γ°
#java #string
@ProgrammingTip
JavaScript Clean Code π
Use getters and setters π‘
Bad :
Good :
ββββββ
#JSTips #CleanCode
@ProgrammingTip
Use getters and setters π‘
Bad :
function makeBankAccount() {
return {
balance: 0,
// ...
};
}
const account = makeBankAccount();
account.balance = 100;Good :
function makeBankAccount() {
let balance = 0;
function getBalance() {
return balance;
}
function setBalance(amount) {
balance = amount;
}
return {
getBalance,
setBalance,
};
}
const account = makeBankAccount();
account.setBalance(100);ββββββ
#JSTips #CleanCode
@ProgrammingTip
Value Types in the Real World π
Suppose youβre reading something fantastic, and you want a friend to read it too. π
What do you need to give your friend so that he can read it tooβ
To give your friend a copy, youβd need to photocopy all the pages and then give it to him, At that point, he has his own complete copy of the document. π
In this situation, youβre dealing with value type behaviorβοΈ
All the information is directly in your hands, you donβt need to go anywhere else to get it.
Your copy of the information is also independent of your friendβs after youβve made the copy. π₯
You could add some notes to your pages, and his pages wouldnβt be changed at all.π π»ββοΈ
γ°γ°γ°γ°γ°γ°
#Types #ValueTypes
@ProgrammingTip
Suppose youβre reading something fantastic, and you want a friend to read it too. π
What do you need to give your friend so that he can read it tooβ
To give your friend a copy, youβd need to photocopy all the pages and then give it to him, At that point, he has his own complete copy of the document. π
In this situation, youβre dealing with value type behaviorβοΈ
All the information is directly in your hands, you donβt need to go anywhere else to get it.
Your copy of the information is also independent of your friendβs after youβve made the copy. π₯
You could add some notes to your pages, and his pages wouldnβt be changed at all.π π»ββοΈ
γ°γ°γ°γ°γ°γ°
#Types #ValueTypes
@ProgrammingTip
Reference Types in the Real World π
Compare that with the situation where youβre reading a web page. π
This time, all you have to give your friend is the URL of the web page. βοΈ
This is reference type behavior, with the URL taking the place of the reference. βοΈ
In order to read the document, you have to navigate the reference by putting the URL in your browser and asking it to load the page. βπ»
If the web page changes for some reason, both you and your friend will see that change the next time each of you loads the page. ππ»
γ°γ°γ°γ°γ°γ°
#Types #ReferenceTypes
@ProgrammingTip
Compare that with the situation where youβre reading a web page. π
This time, all you have to give your friend is the URL of the web page. βοΈ
This is reference type behavior, with the URL taking the place of the reference. βοΈ
In order to read the document, you have to navigate the reference by putting the URL in your browser and asking it to load the page. βπ»
If the web page changes for some reason, both you and your friend will see that change the next time each of you loads the page. ππ»
γ°γ°γ°γ°γ°γ°
#Types #ReferenceTypes
@ProgrammingTip
GraphQL π₯
A query language for your API π
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
GraphQL provides a complete and understandable description of the data in your API,
gives clients the power to ask for exactly what they need and nothing more,
makes it easier to evolve APIs over time,
and enables powerful developer tools.
http://graphql.org/
https://scaphold.io/
γ°γ°γ°γ°γ°γ°
#GraphQL #API
@ProgrammingTip
A query language for your API π
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
GraphQL provides a complete and understandable description of the data in your API,
gives clients the power to ask for exactly what they need and nothing more,
makes it easier to evolve APIs over time,
and enables powerful developer tools.
http://graphql.org/
https://scaphold.io/
γ°γ°γ°γ°γ°γ°
#GraphQL #API
@ProgrammingTip
graphql.org
GraphQL | A query language for your API
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
C# in Depth.pdf
12.1 MB
C# in Depth 3d Edition π
Author : Jon Skeet π
Level : Advanced π
γ°γ°γ°γ°γ°γ°
#Book #CSharp
@ProgrammingTip
Author : Jon Skeet π
Level : Advanced π
γ°γ°γ°γ°γ°γ°
#Book #CSharp
@ProgrammingTip
JavaScript Clean Code π
Async/Await are even cleaner than Promises π‘
Bad :
Good :
ββββββ
#JSTips #CleanCode
@ProgrammingTip
Async/Await are even cleaner than Promises π‘
Bad :
get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin')
.then((response) => {
return writeFile('article.html', response);
})
.then(() => {
console.log('File written');
})
.catch((err) => {
console.error(err);
});Good :
async function getCleanCodeArticle() {
try {
const response = await get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin');
await writeFile('article.html', response);
console.log('File written');
} catch(err) {
console.error(err);
}
}ββββββ
#JSTips #CleanCode
@ProgrammingTip
What happens when you enter "google.com" into a browserβ
This text attempts to answer this question with as much extreme detail as possible. π€·πΏββοΈ
https://github.com/alex/what-happens-when/blob/master/README.rst
γ°γ°γ°γ°γ°γ°
#Fun #FreeTime
@ProgrammingTip
This text attempts to answer this question with as much extreme detail as possible. π€·πΏββοΈ
https://github.com/alex/what-happens-when/blob/master/README.rst
γ°γ°γ°γ°γ°γ°
#Fun #FreeTime
@ProgrammingTip
GitHub
what-happens-when/README.rst at master Β· alex/what-happens-when
An attempt to answer the age old interview question "What happens when you type google.com into your browser and press enter?" - alex/what-happens-when
β Add Any Numbers Without β+β Operator In C β
Bitwise operators can be used to perform the addition (+) operation as mentioned in below example π
γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°
#c #cpp #operator
@ProgrammingTip
Bitwise operators can be used to perform the addition (+) operation as mentioned in below example π
int Add(int x, int y)
{
if (y == 0)
return x;
else
return Add( x ^ y, (x & y) << 1);
}
γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°γ°
#c #cpp #operator
@ProgrammingTip
Do casts if it's necessary βοΈ
When you're casting an object, you are choosing to ask the compiler to trust you at compile time and to generate a check that will run at execution time to keep you honest. ππ»ββοΈ
#Casting
@ProgrammingTip
When you're casting an object, you are choosing to ask the compiler to trust you at compile time and to generate a check that will run at execution time to keep you honest. ππ»ββοΈ
#Casting
@ProgrammingTip
THX π
This WebGL banner is so captivating βοΈ
I can't stop playing with it, it's incredible. π
http://www.thx.com/
#WebGL #FreeTime
@ProgrammingTip
This WebGL banner is so captivating βοΈ
I can't stop playing with it, it's incredible. π
http://www.thx.com/
#WebGL #FreeTime
@ProgrammingTip
THX
THX- Home
THX - Home -
Code School Courses for Free π
Just 1 day & 15 hours left. πΈ
https://www.codeschool.com/free-weekend
#Tutorial #Course
@ProgrammingTip
Just 1 day & 15 hours left. πΈ
https://www.codeschool.com/free-weekend
#Tutorial #Course
@ProgrammingTip
JavaScript Clean Code π
Only comment things that have business logic complexity. π‘
Comments are an apology, not a requirement. Good code mostly documents itself.
Bad :
Good :
ββββββ
#JSTips #CleanCode
@ProgrammingTip
Only comment things that have business logic complexity. π‘
Comments are an apology, not a requirement. Good code mostly documents itself.
Bad :
function hashIt(data) {
// The hash
let hash = 0;
// Length of string
const length = data.length;
// Loop through every character in data
for (let i = 0; i < length; i++) {
// Get character code.
const char = data.charCodeAt(i);
// Make the hash
hash = ((hash << 5) - hash) + char;
// Convert to 32-bit integer
hash &= hash;
}
}Good :
function hashIt(data) {
let hash = 0;
const length = data.length;
for (let i = 0; i < length; i++) {
const char = data.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
// Convert to 32-bit integer
hash &= hash;
}
}ββββββ
#JSTips #CleanCode
@ProgrammingTip
Understanding Callbacks, Promises, Observables and async/await π€·π»ββοΈ
Whilst we only had callbacks for quite some time, in recent years promises, observables and lately async/await enriched the JavaScript world.
Let's take a closer look at these features and how they differ in this articleβοΈ
https://academind.com/articles/javascript/callbacks-promises-observables-async-await
#JavaScript #Observables #Async #Promise
@ProgrammingTip
Whilst we only had callbacks for quite some time, in recent years promises, observables and lately async/await enriched the JavaScript world.
Let's take a closer look at these features and how they differ in this articleβοΈ
https://academind.com/articles/javascript/callbacks-promises-observables-async-await
#JavaScript #Observables #Async #Promise
@ProgrammingTip
Code Sandbox β‘οΈ
Code Sandbox makes it easier to create, share and reuse React projects with others. π
https://codesandbox.io/
#JavaScript #React
@ProgrammingTip
Code Sandbox makes it easier to create, share and reuse React projects with others. π
https://codesandbox.io/
#JavaScript #React
@ProgrammingTip
CodeSandbox
CodeSandbox: Instant Cloud Development Environments
CodeSandbox is a cloud development platform that empowers developers to code, collaborate and ship projects of any size from any device in record time.
Vue VSCode Snippets by sdras π₯
Super easy to write Vue codes fast π
Documentation :
https://github.com/sdras/vue-vscode-snippets
#JavaScript #Vue
@ProgrammingTip
Super easy to write Vue codes fast π
Documentation :
https://github.com/sdras/vue-vscode-snippets
#JavaScript #Vue
@ProgrammingTip
πβ° What is Glide Library β°π
Glide is a fast and efficient Open Source Media Management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.
Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. ππ»ββοΈ
By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead. π
For learn more about Glide see
https://github.com/bumptech/glide π
#android #java #media
@ProgrammingTip
Glide is a fast and efficient Open Source Media Management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.
Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. ππ»ββοΈ
By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead. π
For learn more about Glide see
https://github.com/bumptech/glide π
#android #java #media
@ProgrammingTip
GitHub
GitHub - bumptech/glide: An image loading and caching library for Android focused on smooth scrolling
An image loading and caching library for Android focused on smooth scrolling - bumptech/glide