Quantcast
Channel: programming | ashishb.net
Browsing all 31 articles
Browse latest View live

GCC Hacks

A small list of GCC Hacks g++ -o helloworld helloworld.cc produces helloworld binary from helloworld.cc C++ file. use -Wall switch turns on all warnings(potential errors) in the code (like unused...

View Article



Programming in Linux for newbies

This is meant to be a small guide (though not exhaustive) for students beginning to program on Linux system. Particularly for those, who have done extensive C/C++ programming in Windows, using the...

View Article

Basic GDB Tutorial

So, you believe there are bugs in your C/C++ code or you have encountered SEGFAULT while executing your code. What will you do? write a lot of printf statements at various places in your code under...

View Article

Analysis of Facebook Rotating Images worm

If you are looking for how to avoid/recover : read this one instead. In past few weeks, a lot of facebook users have received following (or similar) messages posted by their friends Hi Friends see...

View Article

FOSS (Free and Open Source Code) Licensing FAQ

There are two choices while writing on this topic, to write a detailed (and accurate) or to write a concise (but avoid all details) post, I preferred latter and have added appropriate links to dig...

View Article


File size should always be of “long” type

int getTextFileSize(String fileName) { return (int) (new File(BASE_DIR, fileName).length(); // WRONG } A 32-bit signed int can deal with ~2GB worth of data. And if your code is not going to deal with...

View Article

Tabs vs spaces for code indentation

One argument which some people might give in favor of using tabs is that it allows the viewer to decide how the code should appear to them. And hence, it separates the logic (indentation) from its...

View Article

Image may be NSFW.
Clik here to view.

Floating point in user-facing strings

Incorrect floating representation of 507.45 %f in user-facing strings is dangerous. Depending on the architecture, programming language involved, version of that language and compiler optimization...

View Article


Google I/O 2017: Android Notes

Infrastructure – Architecture & Performance Android Vitals – More visibility in Google Play dev console on battery drain, wakelocks being held for too long, ANRs, crashes, dropped frames, and...

View Article


Java Musings – initializing a final variable with an uninitialized final...

Java has fewer quirks compared to C++, but sometimes I do come across surprises. A code like following will fail to compile since you are trying to initialize a variable with an uninitialized...

View Article

How to speed up HTML5 videos

Some video streaming websites like YouTube provides an option for speeding up/slowing down videos; some don’t. The trick is simple, find out the Video object viadocument.querySelector("video")and then...

View Article

Testing resumable uploads

The core idea behind resumable upload is straightforward if you are uploading a big file, then you are going to encounter users in the network conditions where they cannot upload the file in a single...

View Article

Android: Handling JPEG images with Exif orientation flags

A JPEG file can have Exif metadata which can provide the rotation/translation field information for a raw JPEG image. So, a landscape raw JPEG image could actually be a portrait because it’s EXIF...

View Article


Android: Fragment related pitfalls and how to avoid them

Don’t use platform fragments (android.app.Fragment), they have been deprecated and can trigger version-specific bugs. Use the support library fragments (android.support.v4.app.Fragment) instead. A...

View Article

Stanford CS251: Cryptocurrencies, blockchains, and smart contracts

Lectures Introduction Creating a Digital currency Bitcoin Overview Bitcoin Blockchain Bitcoin Mining Bitcoin Miner interactions and Game Theory Cryptocurrencies: Community, Economics, and Politics...

View Article


Keep your dotfiles bug-free with Continuous Integration

Just like many software engineers, I maintain my config files for GNU/Linux and Mac OS in a git repository. Given that, I wrote a fair bit of them in interpreted code, notably, Bash, it is a bit hard...

View Article

The first two statements of your BASH script should be…

#!/usr/bin/env bash set -euo pipefailThe first statement is a Mac, GNU/Linux, and BSD portable way of finding the location of the bash interpreter. The second statement combines “set -e” which ensures...

View Article


Consoles by Google

A single developer has to sometimes deal with 7 different consoles by the same company… Google Analytics console – to see website analytics Google Cloud console – to access Google Cloud Platform Google...

View Article

Docker 101: A basic web-server displaying hello world

A basic webserver Docker containers are small OS images in themselves which one can deploy and run without worrying about dependencies or interoperability. All the dependencies are packed in the same...

View Article

How to deploy side projects as web services for free

In 2020, the web is still the most accessible permission-less platform. For the past few months, I have been playing and building side-projects to simplify my life. I started with a Calendar Bot for...

View Article
Browsing all 31 articles
Browse latest View live




Latest Images