Top

Coder’s Grave

Where to store uploaded files? File System versus Database storage.

The purpose of this research, as described in the title, comparing the idea of storing files using either a Database or the mere FileSystem of the operating system by studying the experience of other people’s or companies’ and learning as much as possible from their experience. Almost all analyses and discussions present on different speciality websites, as well as dedicated database companies, present almost the same answer, and the same principles in storing uploaded files. But before that, let’s see some pros and cons for using each type of file storage (also, with additional comments, explaining or negating some of the affirmations): Pros of the File system: Performance can be better than doing it in DB. To justify this, If you store large files...

The purpose of this research,...

Read More

Cross Programming Language Encryption – C# vs JavaScript vs Go, Part 4

See a demo at Github This 4th section of the article was written about a week after I finished the other 3 to clarify a mistake I kinda perpetuated from the begging. After reviewing my code, one of my colleagues raised the following issue: even though I was using RSA encryption, I was using the wrong public and private key. So I had to go back, to the beginning: RSA RSA (Rivest–Shamir–Adleman) is one of the first public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and distinct from the decryption key which is kept secret (private). In RSA, this asymmetry is based on the practical difficulty of factoring the product of two large prime numbers, the "factoring problem". The acronym RSA is the initial letters of...

See a demo at Github ...

Read More

Cross Programming Language Encryption – NodeJs vs Go, Part 3

See a demo at Github Previous parts of this article treated encryption from the point of view of C# and GoLang programming languages. What I did not mention, was the full architecture of our application, which I should probably not and which eventually would also imply a module that will also need to send encrypted content from a NodeJs module, towards our Go Lang module. This also gave me the chance to extend a bit my research and try to make a 3 programming languages implementation of the same two crypto algorithms that I have started with: AES and RSA. When it comes to NodeJs, there are a few modules that claim they do encrypt stuff, however, the best choice is to use...

See a demo at Github Pre...

Read More

Cross Programming Language Encryption – CSharp vs Go, Part 2

See a demo at Github The first part of this article, discussed Encryption coding at C# level. It introduced you in the world of AES and RSA encryption algorithms. But the role of this story is not only to introduce you to some encryption algorithms but also show you how to code them under some programming languages. As mentioned before, our team goal was to encrypt messages from a module written in C#, and decrypt them in a module written in Go lang. Coding AES with Go For this purpose, I have chosen to define a structure holding the Key and the Initialization Vector (IV). As explained in the previous article, we will use a private Hash which will be shared between...

See a demo at Github The...

Read More

Cross Programming Language Encryption – CSharp, Part 1

See a demo at Github One of our challenges at work, lately, was to send encrypted messages between multiple applications, written in different programming languages: C#, Go and JavaScript. In our case, it was more like TypeScript, but from this point of view, it is safe to talk about JavaScript from two simple reasons: TypeScript compiles to JavaScriptThe library used for cryptography was written with JavaScript. Our team debated between two encryption algorithms for this job: AES and RSA. AES The Advanced Encryption Standard (AES), also known by its original name Rijndael (Dutch pronunciation: [ˈrɛindaːl]), is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) in 2001. AES is a subset of the Rijndael block cipher developed by two Belgian cryptographers, Vincent Rijmen and Joan Daemen, who submitted a proposal[5] to NIST...

See a demo at Github One...

Read More

Resizing Transparent PNG in ColdFusion

Hello guys, Needed to do this for a project my team is maintaining, but I could only find the solution for ColdFusion, which looks like this: JavaImport = structNew(); JavaImport.io = structNew(); JavaImport.io.File = CreateObject('java', 'java.io.File'); JavaxImport = StructNew(); JavaxImport.imageio = StructNew(); JavaxImport.imageio.ImageIO = CreateObject('java', 'javax.imageio.ImageIO'); imageBuffer = JavaxImport.imageio.ImageIO.read(JavaImport.io.File.Init(imagePath)); response = getPageContext().getFusionContext().getResponse(); response.setHeader('Content-Type', 'image/png'); response.setHeader('Cache-Control', 'max-age=604800, public'); JavaxImport.imageio.ImageIO.write(imageBuffer, "png", response.getResponse().getOutputStream() ); After consulting Railo documentation on GetPageContext method, we've come to the following result: JavaImport = structNew(); JavaImport.io = structNew(); JavaImport.io.File = CreateObject('java', 'java.io.File'); JavaxImport = StructNew(); JavaxImport.imageio = StructNew(); JavaxImport.imageio.ImageIO = CreateObject('java', 'javax.imageio.ImageIO'); imageBuffer = JavaxImport.imageio.ImageIO.read(JavaImport.io.File.Init(imagePath)); response = getPageContext(); response.setHeader('Content-Type', 'image/png'); response.setHeader('Cache-Control', 'max-age=604800, public'); JavaxImport.imageio.ImageIO.write(imageBuffer, "png", response.getResponseStream() ); How it will be useful to you as well....

Hello guys, Needed to do this...

Read More

Docker Toolbox port forwarding to localhost or the network

For a long time we avoided using Docker Toolkbox because we didn't understand how to allow the containers created within the docker Virtual Box machine by using local host and not the virtual machine's ip (usually 192.168.99.100).   This recently changed when one of my employees was forced to work for a while from within a client's network, and even more, work under Windows while the application was to be accessed under network designated domains only. Long story short, the application had to be run on docker, however accessed on a domain like 'myapp.domain.foo', which also made it accessible not only to my developer as well as the rest of the group. This can be easily achieved under Windows Pro hence HyperV and...

For a long time we avoided usi...

Read More

Atom – Changing ATOM_HOME

How many of you didn't try to make a propert IDE from Atom by now. Let me tell you. From many many many many (I forgot how many) points of view, it's one of the best text editors out there. And yes, with a little work, the right plugins and a lot of think through, it can be transformed into a proper IDE. Not what I'm gonna talk abut today though...

How many of you didn't try to ...

Read More