Posts

Showing posts from December, 2022

Loops in Python, Java, Typescript and Go

RDBMS - MySQL with Python

NoSQL - Mongodb with Go

 NoSQL - Mongodb with Go

NoSQL - Mongodb with Typescript/NodeJS

NoSQL - Mongodb with Java

 NoSQL - Mongodb with Java

NoSQL - Mongodb with Python

 NoSQL - does it really just mean "NO , You won't need to know or use SQL (Structured Query Language)? or its more than that? lets figure it out together :) NoSQL - Mongodb with Python

Arrays in Python, Java, Typescript and Go

Unit Tests in Python, Java, Typescript and Go

Reading and Writing Files in Python, Java, Typescript and Go

Error/Exception Handling in Python, Java, Typescript and Go

 Python try: Java try{ }catch(MyException e){ //handle } Typescript Go

Comments in Python, Java, Typescript and Go

 Python # Single line comment """ Multi line comment """ Java // Single line comment  /* Multi line comment */ Typescript No different from Java // Single line comment /* Multi line comment */ Go No different from Java // Single line comment /* Multi line comment */

String in Python, Java, Typescript and Go

Image
Python Python has a built-in string class named "str" with many handy features  String literals can be enclosed by either double or single quotes Python strings are "immutable" which means they cannot be changed after they are created. Characters in a string can be accessed using the standard [ ] syntax, Python uses zero-based indexing, so if m is 'python' m[1] is 'y'. If the index is out of bounds for the string, Python raises an error. Java Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and manipulate strings. The String class is immutable, so that once it is created a String object cannot be changed. TypeScript Go

HashMap in Python, Java, Typescript and Go

 Python In Python Map/Hashmap is implemented as dictionaries,  the dictionaries have items stored as key-value pairs, where keys should be unique.  single_dict = dict(roleId=10001,name='Test') print(single_dict) multi_dict = [] single_dict_1 = {'roleId':10001,'name':'Test'} single_dict_2 = {'roleId':10002, 'name':'Test1'} multi_dict.append(single_dict_1) multi_dict.append(single_dict_2) print(multi_dict) Java Map public class Main {     public static void main(String args[]) {       Map<String, SchoolClass> mapTemp = new HashMap();       SchoolClass klass1 = new SchoolClass(10001, "Test");       SchoolClass klass2 = new SchoolClass(10002, "Test1");                     mapTemp.put("klass1", klass1);       mapTemp.put("klass2", klass2);                  mapTemp.forEach((k, v) -> System.out.println...

Queue in Python, Java, Typescript and Go

Python FIFO (First In First Out) Queue import queue q = queue.Queue() q.put(9) print(q.get()) #to print the item that we are removing Output:9 print(q.empty()) #make queue empty, we can use the empty function Python LIFO (Last In Last Out) Queue import queue q = queue.LifoQueue() q.put(5) print(q.get()) Python Priority Queue Java FIFO (First In First Out) Queue

Linked List in Java, Python, Typescript, Go

Java Example   import java . util . LinkedList ; public class Main { public static void main ( String [ ] args ) { LinkedList < String > cars = new LinkedList < String > ( ) ; cars . add ( "Volvo" ) ; cars . add ( "BMW" ) ; cars . add ( "Ford" ) ; cars . add ( "Mazda" ) ; System . out . println ( cars ) ; } } https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html https://www.baeldung.com/java-linkedlist Python Example Typescript Example Go Example