Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- API



  Empty slice vs nil slice in GoLang

In Go, there is a type called slice which is built on top of array. It's a very convenient type when we want to handle a group of data. This post will explain a subtle but tricky difference between empty slice and nil slice. A nil slice is a slice has a length and capacity of zero and has no underlying array. The zero value of slice is nil. If a slice is declared like below, it is a nil slice. package main import "fmt" func main() { var a []string fmt.Println(a == nil) } The output will be t...

   GOLANG,JSON,EMPTY SLICE,NIL SLICE     2018-10-18 09:25:21

  C vs Java Complete Comparison

Similarities: Java and C have same syntax operators. Difference—thinking Two paradigms: Java: Object oriented language C: Structured language Differences: --Syntax No preprocessor Java does not include a preprocessor and does not define any analogs of the #define, #include, and #ifdef directives. Constant definitions are replaced with static final fields in Java. (See the java.lang.Math.PI field for an example.) Macro definitions are not available in...

   C,Java,Comparison,Difference,Similaritie     2011-10-06 12:46:39

  Java Sequential IO Performance

Many applications record a series of events to file-based storage for later use.  This can be anything from logging and auditing, through to keeping a transaction redo log in an event sourced design or its close relative CQRS.  Java has a number of means by which a file can be sequentially written to, or read back again.  This article explores some of these mechanisms to understand their performance characteristics.  For the scope of this article I will be using pre-a...

   Java,IO,Sequential,Blocking     2012-02-23 07:09:10

  Fix issue docker-credential-desktop not installed or not available in PATH on Mac

Sometimes you may encounter below issue while running docker-compose on MacOS. Traceback (most recent call last): File "docker-compose", line 6, in <module> File "compose/cli/main.py", line 71, in main File "compose/cli/main.py", line 127, in perform_command File "compose/cli/main.py", line 1085, in up File "compose/cli/main.py", line 1081, in up File "compose/project.py", line 527, in up File "compose/service.py", line 354, in ensure_image_exists File "compose/service.py",...

   MACOS,DOCKER,DOCKER-COMPOSE     2020-06-23 03:25:16

  Java Doesn't Need to Be So Bad

I do a lot of Java coding and I enjoy it. I admit that there is a lot of typing, often a lot of boilerplate and getting even simple tasks done can involve too much work. Most of the tools that try to fix these problems trade one moment saved for another lost. Maven's XML based configuration file is a good example: Thank you for making my project easier to manage and I won't forget that you made me edit XML to do so. These are the things that you live with, these are the things you trade for ...

   Java,Coding,Enterprise application,Tedious     2011-12-09 07:50:20

  Canonicalize XML in Java

XML canonicalization is often used when there is need to create digital signature to be sent to peers for verification. Since digital signature is created based on XML data, the XML data has to be canonicalized before its signature value can be calculated. Even an extra space may affect the signature value calculated, hence it must follow some rules to canonicalize the XML data so that it has a standard format. This is why W3C created specification Canonical XML Version 1.1. This specificat...

   JAVA,XML,JAVA SECURITY     2016-01-20 01:39:45

  STOP WRITING GOOD CODE; START WRITING GOOD SOFTWARE

Good software trumps elaborate code. And unfortunately, you can’t usually have both. The real world has deadlines and ship dates. It’s a game of pick two:Ship on timeShip with elaborate codeShip with a fantastic productAlmost always, you should pick the first and the last when you’re building software applications for users (if you’re building API’s or open source libraries for other developers, then it’s a different story). Too often I have seen de...

   Good software,Standard,Good code,Deadline,Tradeoff     2011-11-20 06:56:06

  Let's talk about JavaScript deep clone

In JavaScript, deep clone means creating a brand new object that includes all nested objects, with all properties being completely independent copies. This is different from shallow copying, which only copies the first-level properties, with nested objects being referenced rather than copied. There are multiple ways to perform deep copying in JavaScript, but the best one to use depends on the specific use case. Can use JSON.parse & JSON.stringify? ❌ JSON.parse(JSON.stringify(obj)) is a dep...

   JAVASCRIPT,DEEP CLONE     2023-02-25 08:57:11

  Cross platform portable class libraries and .net

What’s that happy little feature developers are admiring? Oh that’s Portable class libraries that have been chugging along, during their thing and delivering to the point results wherever used by developers. If a developer is not writing .net applications for multiple targets, then he likely hasn’t bumped into these libraries. However, developers who are writing .net apps and want these apps to run on every platform from watches to tablets to desktops to the cloud, they can ava...

   asp.net, Cross platform     2015-01-12 05:06:44

  ByteBuffer in Java

ByteBuffer is introduced in java.nio since Java 1.4. It provides a way of representing raw structured data such as from a file or from network. It enables fast access of underlying data compared to traditional ways like byte[] Prior to Java 1.4, if you want to represent a structured raw data, you need to create a byte[] and then having a set of checks to delimit the byte array to get the expected tokens. There are three ways to create a ByteBuffer: Wrapping an exiting array by calling ByteBuffe...

   JAVA,BYTEBUFFER,ALLOCATION     2015-07-08 03:17:44