Skip to main content

Posts

Setting up Less in JetBrains: Ubuntu

This is a quick guide on setting up the Less preprocessor to automatically create .css files from .less files. I'll show you how to do this in a JetBrains IDE running on Ubuntu OS. Make sure that you have the latest JetBrains IDE installed. The steps will be similar for both PHPStorm and WebStorm Open Terminal and install NodeJS:  sudo apt install nodejs Install npm:  sudo apt install npm Run the following command:  sudo ln -s /usr/bin/nodejs /usr/bin/node Get the less module. In Terminal type in the following command:  sudo npm install less -g Open your JetBrains IDE and create a new project or open an existing one. Click File -> Settings. Under the  Languages & Frameworks  tab, select  Node.js and NPM. Node interpreter should be set to  /usr/bin/node Click the  Enable  button to enable Node.js and then click  Apply Do not close the Settings window. Navigate to  Tools  (category right under Languages ...

SASS, JetBrains and Ubuntu: No Ruby

The following is a quick guide on how to setup SASS on Ubuntu and use it in a JetBrains IDE without the need to install Ruby. Make sure that you have the latest JetBrains IDE installed. The steps will be similar for both PHPStorm and WebStorm Open Terminal and install NodeJS: sudo apt install nodejs Install npm: sudo apt install npm Run the following command: sudo ln -s /usr/bin/nodejs /usr/bin/node Get the node-sass module. In Terminal type in the following command: npm install node-sass Open your JetBrains IDE and create a new project or open an existing one. Click File -> Settings. Under the Languages & Frameworks tab, select Node.js and NPM. Node interpreter should be set to /usr/bin/node Click the Enable button to enable Node.js and then click Apply Do not close the Settings window. Navigate to Tools (category right under Languages & Frameworks) Click File Watchers Click the Green Plus and select SCSS The following Program location may differ dependi...

Setting up PHP CodeIgniter

I like to tweak CodeIgniter beyond what the common settings are. There are a few quirks here and there that I sometimes wish were native features of CodeIgniter. Some internal settings make it seem like they are going to work but then you realize that they just don't work the same across all servers. So, here's my CodeIgniter setup. First thing, of course, is to download CodeIgniter and extract it to the folder location where you'll be using it from. Visit that directory in your browser and you'll notice that CodeIgniter is setup and ready to go. That's it! Simple, right? To make most out of CodeIgniter you'll want to keep reading. First, open application/config/routes.php and modify the  $route['default_controller'] element. I normally change mine to main . Open the application/controllers/ directory and rename the  Welcome.php file to Main.php . Open the Main.php file and change the class name from Welcome to Main . Test to make sure it's w...

Getting Started with Git

This article is meant to get you started with GIT fast. There won't be too much clutter as this article can be used as a reference later on. The following will focus mainly on Windows users. Download Git:  https://git-scm.com/downloads Install Git leaving everything as default Open the newly installed Git Bash Shell.  You'll also notice Git CMD and Git GUI have been installed. Git CMD and Git Bash will essentially have the same Git commands. Git GUI is a graphical way of using Git. Edit the Git author configurations git config --global user.email "dinocajic@gmail.com" git config --global user.name "Dino Cajic" Omitting --global lets you specify different users for different repositories Create a directory on your computer. Place a file such as index.html in it if you choose to do so. Go back to your Git Bash shell and navigate to your folder using the cd command. Once you're inside your folder type git-init This creates a Git reposi...

A High-Level Introduction to C Programming

C is a great programming language if you want to work closer with the machine. A couple of decades ago, C was considered a high-level programming language; look at how times have changed. We’ve been babied with programming languages like Java, C#, JavaScript, PHP, Python, you name it. You can pull a car using the frame machine, but we’re going to do it with a hammer and a chain. Why? Just to prove that we can. There are other reasons for studying C; the primary being the speed of the program. Understanding how everything works at a lower level makes learning other programming languages a breeze. So, let’s get into it. There will be limited code, if any, in this post. You can watch some YouTube tutorials for that. C is a compiled language, meaning that you need a C compiler to convert your readable code into machine code. Machine code is just a bunch of zeros and ones. C got its popularity mainly because Unix was written in C. Currently, most operating systems are written in ...

Programming Language Concepts Questions/Answers Part 3

1. What is an associative array? - An unordered collection of data elements that are indexed by keys. 2. Each element of an associative array is a pair consisting of a _______ and a _______. - key and a value 3. True or False? Java supports associative arrays? - True. As a matter of fact, Perl, Python, Ruby, C++, C# and F# do too. 4. What are associative arrays called in Perl? - hashes 5. Why are associative arrays in Perl called hashes? - Because their elements are stored and retrieved with a hash function 6. What character does a hash in Perl begin with? % 7. In Perl, each key is a _____ and each value is a _______. - string - scalar 8. In Perl, subscripting is done using _______ and _______. - braces and keys 9. In Perl, how are elements removed from hashes? - using delete 10. In Perl, the ________ operator tests whether a particular value is a key in a hash. - exists 11. What are associative arrays called in Python? - dictionaries 12. What is a dif...

When does Garbage Collection run in Java?

First, we cannot force garbage collection to run (System.gc()). Sometimes it will but it’s unpredictable. What are the steps to Garbage Collection in Java? Mark: GC walks through the object graph and marks the objects that are reachable as live Sweep: deletes unreachable objects Compact: compacts the memory by moving around the objects GC collectors are called generational collectors since the heap is divided into 2 spaces: Young and old generation spaces. Young generation is for new objects and is divided into Eden, “Survivor 0” and “Survivor 1” spaces. Old generation holds objects that survive for a long time. Minor garbage collection runs in the Young Generation space. Major garbage collection runs across the entire heap. Steps to GC: As your application runs, new objects get allocated to the Eden space. Some objects become unreachable. When the Eden space becomes full, and your application tries to create another object, and the JVM tries to allocate space on t...