Get Architecture Plainly Without Version In Android

If you want to just get plainly the architecture of system like “arm” or “x86” in your apps, then this post is just for you. So with this function that I’m gonna present, you will get 3 values, “arm”, “mips” or “x86” whether or not the system is 32 bit or 64 bit. Here is the function : public static String getArch() { String arch = System.getProperty("os.arch").substring(0, 3).toLowerCase(); if (arch.equals("aar") || arch.

[READ MORE]

How To Install & Run Composer Binaries Globally

Take PHPUnit as an example. You can install it using Composer doing this : composer require phpunit/phpunit This will install a phpunit shortcut in vendor/bin directory. This obviously means you can run it. But, you would have to point to the exact location of the phpunit file to run : /home/username/mysite/vendor/bin/phpunit phpunit.xml But, that’s long and uncomfortable. And you would have to install PHPUnit separately for each projects. I’m gonna tell you how to install binaries globally as well as running it simply.

[READ MORE]

Theme Version 2

If you are reading this post, you should have seen the new UI of my blog. It’s a custom made theme created in a week during the exams. It’s similar to the old theme because, I liked it colorful and dark at the same time. I’m a Batman fan and black is good for the eyes. As a programmer, you don’t want to hurt your eyes. The theme is named “Subin’s Blog V2”.

[READ MORE]

Convert Bytes To KB, MB, GB in PHP

Say you were displaying the size of a file in PHP. You obviously get the file size in Bytes by using filesize(). You won’t have any idea what the file size is if you read it in Bytes. Bytes is useful for file transmission in a network, but not for human usage. So, it’s better to convert it to human readable form.The circled areas show the converted size from Bytes.

[READ MORE]

Set Same Time Zone in PHP & MySQL

Time Zones are important if you’re creating a social app which will include chat, social network and others which is interacted with the society. There are many time zones and you have to choose one to set in your server. I would totally recommend using UTC instead of your time zone in server. Web Server and Database server are different and they each have their own configuration. This includes the time zone too.

[READ MORE]

jQuery Popping Up Text Effect

If you are creating a web app and there is conversation to the user without audio and just text, animations and effect will make the app better. In this short post, I’m introducing a simple text effect without any trouble at all. All it does is animate the text’s font size. But, the effect is like the text is popping up. Demo Here’s the code. It’s wrapped in a function and you can easily customize it :

[READ MORE]

Variables in Bash “: command not found”

Bash is like the very complicated language, even a space can make a syntax error. But, when you get into it often, you will get a hang of it and it will be easy. This post is a solution to one of the most common problems that happen to a newbie in Bash and it’s about a single whitespace. Here is a sample Bash file : a = 50 echo $a and when you execute it, the error will be as follows :

[READ MORE]

Append Contents to Files in Bash

In Bash, we can add contents to file easily using the > character. Like this : echo "myContents" > ~/myfile.txt What if you want to append contents to the file without overwriting ? The easiest way to do this is change the “>” to “>>”. Just by making this small change, appending will be done : echo "myContents" >> ~/myfile.txt Even if the file doesn’t exist, Bash will create one with the contents given to append.

[READ MORE]

if, else, elif Conditions in Bash

All programming languages have the if & else conditions and they’re different in syntax according to each programming languages. In Bash, it’s really different and even a small space can cause syntax errors. So, you have to be careful while writing Bash code. In this post, I’ll give you many examples on how to use if and else conditions in Bash. if, else a="AC" if [ $a = "AC" ]; then echo "

[READ MORE]

Creating a File with Contents in Bash

It’s really easy to create a file in Bash with cat and > : cat "/home/simsu/file.txt" > "/home/simsu/file.txt" But, what if you want to add contents to file too ? In this case, we can use cat and echo. Here’s how we do it in echo : echo "My File, My Choice" > "/home/simsu/file.txt" But, there’s a problem with doing like this. Since there is an option to limit the characters of a Terminal command, adding large contents is not possible.

[READ MORE]