Text
The data directory contains an old postmaster.pid file
PostgreSQL Connection Failure
I experienced this issue when my laptop crushed and after rebooting, PostgreSQL was unable to connect to the database. I attempted to start my server and this error dialog window appeared.
The Problem: Two instances of the same PostgreSQL server cannot run on the same data directory at the same time thanks to the postmaster.pid lock file. Follow the link for more information about what a postmaster.pid file is, otherwise let's move on to resolving our issues.
STEP 1:
Click on the “OK” button to close the dialog window or open the Postgres.app desktop app if its not already open
STEP 2
Click on “Server Settings…” button
Click on Show button next to the Data Directory. This should open the data directory of your PostgreSQl installation.
STEP 3
Once you have located your postmaster.pid file. Delete it!
STEP 4
After deleting the file, the error message should change from "Stale postmaster.pid file" to "Not running" on the Postgres GUI app . Now just start your PostgreSQL server by clicking the "Start" button on the Postgres GUI app
Finally
0 notes
Text
Ruby key concepts
These concepts are just refresher notes for me. I posted some links, In hope it would help me and others. Inheritance
Inheritance is a relation between two classes. A child class inherits all the features of its parent class. We know that all kids have a parent, and all people are humans. The benefit of inheritance is that classes lower down the hierarchy get the features of those higher up, but can also add specific features of their own. If all human breathe, then all human can breathe. In Ruby, a class can only inherit from a single other class.
“when an object or class is based on another object or class, using the same implementation specifying implementation to maintain the same behavior.“
Example
class People
def breathe
puts "inhale and exhale"
end
end
class People < Human
def speak
puts "Hello"
end
end
boy = People.new
boy.breathe
boy.speak
Ruby Open Classes
Did you know ruby classes never close. You can always write more method existing class, even built in classes. Talk about open!
Example
# defining the class Human
class Human
def thirsty
puts 'drink water'
end
end
# make an object
people = Human.new('boy', 'girl')
people.thirsty
people.hungry
people.run
Encapsulation
“Encapsulation is the packing of data and functions into a single component.”
You want to obtain or change information of an instance variable? Talk to my getters and setters. Certain methods are to help my other methods and not for you to use. Encapsulation basically mean that internal representation of an object is hidden from the outside. “what happen in Vegas stays in Vegas”. It tells us that we should know just an interface of class to be able to use it. We don't have to know anything about internals of class to be able to use it.
Like the below example, we understand its interface from first sight and we don't have to know how it works inside. We know that we can press 2+2 then = and see the sum on display.
Example
class Calculator
attr_accessor :numbers
def add(numbers)
@add_num = numbers + numbers
end
def subtract(numbers)
@sub_num = numbers - numbers
end
end
sum = Calculator.add(2)
Polymorphism
“At its core, in Ruby, it means being able to send the same message to different objects and get different results. Let’s look at a few different ways to achieve this.”
Using an example with inheritance, I sent the same message to different object and got different result. The bored method is a single interface to entities of different types : Mammal and Insect.
Class Human
def initialize
end
def bored
puts “watch tv”
end
end
Class Mammal < Human
def bored
puts “go to sleep”
end
end
Class Insect < Human
def bored
puts “go eats”
end
end
Mammal.new.bored #=> go to sleep
Insect.new.bored #=> go eats
7 notes
·
View notes
Text
REST 6 Principles & Architectural Constraints
Best Article I have read about REST!
Guiding Principles of REST
Client–server
Stateless
Cacheable
Uniform interface – REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.
Layered system
Code on demand (optional)
REST is acronym for REpresentational State Transfer. It is architectural style for distributed hypermedia systems and was first presented by Roy Fielding in 2000 in his famous dissertation.
There’s no point in me trying to repeat what defines what 6 architectural constraint makes – a true RESTful API. I have attached links with in debt explanation.
Uniform interface
Client–server
Stateless
Cacheable
Layered system
Code on demand (optional)
0 notes
Text
RoR Web Request Lifecycle
A user opens his browser, types in a URL, and presses Enter. When a user presses Enter, the browser makes a request for that URL.
The request hits the Rails router (config/routes.rb).
The router maps the URL to the correct controller and action to handle the request.
The action receives the request, and asks the model to fetch data from the database.
The model returns a list of data to the controller action.
The controller action passes the data on to the view.
The view renders the page as HTML.
The controller sends the HTML back to the browser. The page loads and the user sees it.
2 notes
·
View notes
Text
HTTP Request Surface Level Touch Up
Phase 1: Local Processing
First browser will extracts the "scheme"/protocol (HTTP), host (www.sampleHost.com), and optional port number, resource path, and query strings that are specified in the form. Which we look something like this:
|http|://|www.sampleHost.com||:5000||/mainpage||?query=param&query2=param2|
Above you can see
http <protocol>
www.sampleHost.com<host>
:500<:optional port>
mainpage<path/to/resource>
query=param&query2=param2 <?query>
Once the browser have the intended hostname for the request, it will need to resolve an IP address. The browser will look through recent urls cache requests, the operating system’s recent queries cache, and even your router snf DNS cache.
Phase 2: Resolving an IP
If the cache lookup fails, your browser sends off a DNS request using UDP. “UDP is a lightweight protocol, but the tradeoff is that it offers no guarantees in terms of delivery, and there is no acknowledgement other than a response being sent and received.” The DNS request contains the preconfigured IP for your DNS server and your return IP in its header. The hostname for which you are trying to resolve an IP is in the request’s "Question" section. Your request will have to travel through manny network devices to reach its target DNS server. The devices use a routing table to determine which other device it is connected to and then pick the shortest route to it destination.
When your request arrives at your configured DNS server, the server looks for the address associated with the requested hostname. If it finds once, it sends a response back. If the DNS server you have targeted cannot locate the given hostname, it passes the request along to another DNS server (it is configured to defer to).
This happens recursively until the address is found, or an "authoritative" nameserver is hit. If an address for the given domain cannot be resolved, the server responds with a failure and your browser returns an error.
Once successful, the response makes it back and the requesting client now has a target IP. Next time the subsequent request will take a shortcut from the pervious steps to here, now that it has the target IP stored.
0 notes
Photo

Even though Thanksgiving is over, I finally received my Hacktoberfest shirt in the mail from Digital Ocean. I’ll just look at it as an early Christmas gift 🤗
What developer doesn’t like free shirts and dev stickers?
0 notes
Text
Error Installing RMagick on macOS Sierra
After the new High Sierra update for macOS, I attempted to start a new Rails 5.1 application that was dependent on rmagick 2.13. As I ran bundle install, of course it would break upon installing. Below are steps I took and the Fix that worked for me.
gem install rmagick
After a couple of different attempts, I started searching the net for common issues. I found out that RMagick gem ~> v 2.13.4 is not compatible with ImageMagick 7. (which the bugger would’ve said that). Following these steps from StackOverflow
*Uninstall existing imagemagick if needed
1. Install version 6: $ brew install imagemagick@6 2. Since this is keg-only, you should then force-link it: $ brew link --force imagemagick@6
This installed imagemagick version 6.9.7-4 for me.
Afterwards, the gem then installed successfully. I am including the version numbers for future readers:
Hope this helped anyone
0 notes
Text
Querying Habits
Does it Existence
A great habit I’m trying to instill in myself is to check if an object exists or not. Which is something everyone might need to do in Ruby before running a method. #exists? will return true/false
#any? will return true/false if any records match the specified criteria
#many? will return true if multiple records match the specified criteria
What’s really awesome, is you can run each of these either on a model directly, a Relation, an association, or a scope (which we'll cover later). Basically, anywhere you might think of using them, they're likely to work
In a model
User.any? User.many?
in a relation
User.where(:published => true).any? User.where(:published => true).many?
in an association
User.first.address.any? User.first.address.many?
0 notes
Text
Her name is Complacency
There’s a military saying that has stuck with me since basic training, drilled into me by my sergeant. “Complacency will get you killed” –Drill SSG Baily. It made perfect sense during that time of training because they were preparing us for an active war environment. Being complacent means, feeling too satisfied with how things are and not wanting to try to make them better. I’m sure you can imagine the danger by behaviors accompanying this feeling. On the battlefield, this can cause you, your battle buddies (comrades), and others to get seriously hurt.
There are many sayings that I have picked up from the military, but that one is my favorite. It can be applied to almost anything in life. I’m in the National Guard, yes I know; I’m a part-time soldier. There are many pros and cons but I won’t get into all that in this blog. I love being in the National Guard because it allows me to serve my country, pursue my civilian dreams, and spend significant amount of time with my family.
Avoiding complacency has become a key element to success for me, equivalent to a way of living. As a developer, when building a scalable application/project, there’s little room for complacency. There is a daily battle with constant surrounding updates, security threats, and unexpected or predictable errors. I’m sure there’s many more reason why a developer shouldn’t be complacent or how being complacency can ruin an application.
The truth is, it’s hard not being complacent after reaching a mile marker. Yes, we are finally getting to the reason why I wrote this blog. I got complacent without even noticing it! She and I were in some sort of relationship. Since high school I was always taught to never settle, always seek gold, and once you receive it, keep running with it. This never back down get back up mindset helped me thrive in high school and during collegiate level wrestling. This attitude seeped into everything I did including how I approached challenges, life, and how I conducted myself when I worked. I call her Consistency and we were always together unofficially, I guess. So when I finally got a taste of complacency, she felt good.
She was like a forbidden fruit that was hidden from me. I savored and treasure her delightful sensation. I hadn’t ever remembered meeting her before. Some might say my high school and college grades were a reflection of her presence. I would beg to differ because I know lackadaisical claimed those credits. Complacency didn’t offer herself to me in the form of laziness, but masked herself behind rest. She told me “I made it”, she whispered to me “that it is finished”, she convinced me “there’s nothing left to do”. Like a wrestler completing only one round of a match, or a runner finishing only the 1st leg of a race I was convinced I have finished and longed for rest. Forgetting there’s more ahead of me and allowing my body to cool down and relax was the biggest mistake.
I was ok with the line of code I was writing because it worked. I was fine with only running two miles because I met the military standard. I was ok with just saying the words “I love you” to my wife without putting maximum effort. I was ok with this feeling and way of life because it honestly felt good to just settle. I wasn’t improving, which I have grown to accept. Probably because I thought I wasn’t overall declining. This couldn’t be farther from the truth.
My coding skills, the way I troubleshoot, and practice was quickly affected. The tech environment is one of the fastest and constantly growing fields. The fact that I was only maintaining is evidenced that I was already behind. In conjunction, just maintaining in my military world wasn’t showing my leadership I was ready for the next level. I cursed this fruit called complacency and the deception that she brought with her. This false feeling that everything was fine, when in reality I was slowly dissolving.
I don’t hate her, she taught me a valuable lesson that I will never forget. For me, complacency is settling just to get by. For some people, that’s all they know or prefer. I can’t allow complacency to tarnish my skill, drive, or life. It was a short relationship but a meaningful one. After realizing who she really was, we broke up. I made the commitment and ran off with her beautiful cousin, Consistency. Yes, my next blog will be about her and how she accepted me back and I continued running that amazing race.
0 notes
Text
Gem In A Box
Gem In A Box is a simple Sinatra app that allow you to host your own in-house gems
Why Gem in a Box
Has a web interface and support a command line to remotely publish new gem
Its smooth, fast, easy to set up and it just works
Cool links for setting up Gem in a Box
http://guides.rubygems.org/run-your-own-gem-server/
https://github.com/geminabox/geminabox
http://www.jamesrobertson.eu/blog/2015/jan/20/running-your-own-gem-server.html
Prerequisite
First thing first, make sure your environment is set up and updated if you haven’t already
Install or update Ruby, below are a few ways to go about it
1. Homebrew
2. RVM
Trouble with RVM?
If your having issues with using RVM (updating or switch your Ruby version)
Error message example:
“ RVM is not a function, selecting rubies with ‘rvm use ..’ will not work”.
Try this from stackoverflow:
“[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
3. Ruby
Update or Download RubyGems v2.4.8
Install or update bundle
Once you have your environment set up, just follow the simple direction provided from the guilds.
1. Install the gem geminabox
[~/dev/geminabox] gem install geminabox
2. Create a file directory to place your gems
[~/dev/geminabox] mkdir data
3. Within the geminabox directory create the following config.ru file
Make sure this is added within the config.ru file
[~/dev/geminabox] cat config.ru require
"rubygems" require
"geminabox"
Geminabox.data = "./data" run Geminabox::Server
4. Within your directory run the server with rackup
~/dev/geminabox] rackup
Use config.ru –o to add your own IP or HHTP address
e.g. rackup config.ru -o 190.163.4.193
5. You can use the web interface available on http://localhost:9292 to push your gem or use the command gem inabox
The first time you do this, you’ll be prompted for the location of your gem server.
type in the URL e.g. http://192.168.4.190:9292/. After that it will return with something similar to the following error:
Host: You didn't specify a gem, looking for one in . and in ./pkg/... ERROR: While executing gem ... (Gem::CommandLineError)
Couldn't find a gem in pkg, please specify a gem name on the command line (e.g. gem inabox GEMNAME)
Change into the file directory where the gem file is stored and run inabox again this time supplying the gem to be pushed e.g.
james@mia:~/gem_src/xes$ gem inabox ./secretgem-0.0.1.gem
[~/dev/secretgem] gem build secretgem.gemspec Successfully built RubyGem Name: secretgem Version: 0.0.1 File: secretgem-0.0.1.gem
[~/dev/secretgem] gem inabox ./secretgem-0.0.1.gem Enter the root url for your personal geminabox instance. (E.g. http://gems/) Host: http://localhost:9292 Pushing secretgem-0.0.1.gem to http://localhost:9292/..
0 notes
Text
Removing Tumblr “Follow Me” Button (Fix)
I have seen many posts about removing the Tumblr “Follow Me” button link. Many are out of date, too extreme or simple doesn’t work.
Option 1
I know tumblr does give you the option located in “Advanced Options ” to toggle between “Promote Tumblr” (For the Follow me button”
-This work for some theme not all, In my case it didnt
Option 2
You can manually edit the HTML code and use the extreme method
Step 1
Log in to your Tumblr account, and click the name of the blog you want to edit.
Step 2
Click “Customize Appearance” from the right menu.
Step 3
Click the “Edit HTML” button in the left menu under your theme name. Tumblr will open a new frame that displays the HTML coding for your blog’s theme.
Step 4
Find the tag “{CustomCSS}”, you can press the "Ctrl" & "F" key or “Command” & “F” simultaneously to open your browser's search feature and search “{CustomCSS}” then Paste:
iframe {display:none !important;}
The reason why I consider this an extreme method is because it blocks all iframe node! So if you use a custom Disqus add on for commenting, it’ll be blocked from displaying also.
Option 3 (best method)
Be more specific with what you don’t want displaying
Follow Step 1-3 on Option 2 to get you to the HTML edit page and locate the tag “{CustomCSS}” and right under it, paste:
/*To remove that tumblr edit helper box*/ .iframe-controls-container.desktop-iframe-controls-container { display: none !important; }
/*To remove that tumblr follow me*/ .tmblr-iframe--controls.iframe-controls--desktop, .tmblr-iframe--mobile-loggedin-controls.iframe-controls--desktop { display: none; }
#RemoveButton#EditHTML#FollowMeRemove#easyWay#bestWay#thatshowyoudoit#follow button#HindButton#tutorials#easy tutorial#pictureshelp
5 notes
·
View notes
Photo










A Sneak peak into Facebook own little red book. Ben Barry, who use to be a designer for Facebook, published a series of scans from the company’s “little red book”, which he created during his time at the company.
The small book is full of interesting quotes that the power house company “live” by. Going through the little red book, I found myself favoriting many of the quotes that I believe plays an important role in my journey as a developer.
I am glad someone posted this in our slack channel. My favorite quote from the book is “Hacking can be playful...as long as it works", I believe in that!
1 note
·
View note
Text
It Didn't Happen Overnight (My 1st Developer Job)
At last, I am a developer! Well I always considered myself a “developer”, but now I finally have the job title to back it up. This is going to be a simple recap on how I landed my first programming job.
There was no short cut to it! I applied to over 117 organizations and got rejected 116 times!! It was a huge blow to my pride and self esteem. It took a supportive wife, great friends, and encouraging cohorts to keep me from giving up.
I had no answer to why I couldn’t land a job. The lack of experience seemed to be the biggest hindrance so I did some freelance, paired programming volunteering, and open source work. Still, months later, nothing! I was putting all the time and effort in, which I can look back now and be extremely grateful for, but at the time it just felt like I was going nowhere.
I spent a lot of time praying. Did I make the wrong choice? Was this not Gods will for me? Finally, one day, right when I was about to begin looking for “any” job rather than my dream of programming I received a phone call from the CEO of a small start-up!
The conversation went well even though I found out he accidently stumble upon my profile. Believe it or not, he was looking for someone with more experience and clicked on the wrong LinkedIn profile. Despite that, he asked me to stop by the office to chat and check out the company.
I made the trip there as soon as I could. I got to meet some of the developers and had a long conversation with the CEO. He called me back soon after and explained how he would love to create a position for me. Based on our non-official interview conversation, he noticed a lot of key attributes and character traits that he admired. I was humbled, faltered, and extremely grateful! Next thing you know, I was offered a programming position!
My theme here, it didn't happen overnight. All the rejection and criticism, although challenging, did ultimately fuel me to become better, smarter, and stronger. It made me hungry to prove something not just to myself, but also to every organization that didn’t give me a chance. Through countless applications, interviews, networking, recruiters, resume revisions, and PRAYER I didn’t give up. It took a lot of work and a little favor from the Lord. What a rollercoaster it was for my wife and I. Trust me this is the short version.
#Junior Developer#developer#theironyard#newcareer#hardwork#perseverance#endurance#blessed#noshortcuts#short version#it didnt happen over night
0 notes
Text
The Search Continue...
After recently graduating from The Iron Yard (Tampa/St. Pete Location), my quest to find a career as a Ruby on Rail developer began. I hit all the major tech job boards, search engines, and even social media sites in an attempt to broaden my search. I was thrilled with the numbers of request for developers. There seemed to be a high demand for developers, which was expected. Now how would I narrow my search down to find my ideal work place?
Honestly, I would be thrilled to work anywhere, but I am a picky individual. My ideal work place would be with an organization that provides an environment where there would be lots of collaboration with my team. Where high functioning tools aid our success. Where we would sharpen each other to become better individually, allowing us to exceed our company and personal goals.
I am a firm believer that organizations that promote a team atmosphere have immeasurable benefits. Working as a team benefits all involved: Individual employee - personal skill development from transferred knowledge, reward of results of collaborative effort, unity, and multi-perspective problem solving. The company - Well rounded employees, supportive work environment, and highest level of productivity. The customer - reaping the benefits of a cohesive innovate production.
Learning to narrow my search was simple. I used my skill level, and my preferred location. I narrowed my location to only warm climate states, like FL, CA, TX, AZ and few others. I spent a good amount of years up north and had no interest with dealing with snow again! My skill level was based on my experience and coding skills. Taking several code tests, my skill level seems to fall between entry to junior level work. That was acceptable for me because I knew I could only get better!
There’s more to each developer beside the code he writes. His writing style is a reflection of his teacher, his passion, his goal, and his personality. I wonder how my coding skill describes me. Does it reflect that I am comfortable with abstract thinking, which helps me color the walls of the future with the texture of quality? Does it reflect that I am a talented graduate developer that’s a fast learner offering the ability to assess an organization’s needs and create a complementary, robust web presence? I hope it at least screams that I have the ability to think through a problem coupled with the confidence to make ideas heard.
One thing I am sure of is that I will put all the work in necessary to become a great developer. I will find my ideal work environment or I will create it! I am currently looking for a software developer opportunity that will allow me to work alongside an expert team of developers. Thereby helping to drive my career progression to more senior roles in the future. Until then, the search continues as I sharpen my skills through personal development, continued learning, and networking.
#Developer#Junior Developer#ruby#RoR#programming#programmer#ruby on rails#career#job#entry level ruby#searching#theironyard
2 notes
·
View notes
Text
Review on Dice
Dice.com is a career website serving mainly information technology and engineering professionals. Dice.com is not just a job search site. They also offer a blog and a newsletter to which anyone can subscribe. These include articles about the tech industry in general, as well as tips and guidance on getting the job you want in the industry pertaining to tech matters.
Dice is also well known for their recruiters. Yes information technology recruiters! IT Recruiters:
Small to large companies use IT recruiters to hire professionals for areas of technology. Some of the professional positions include system architects, analysts, developers, engineers and technical support staff members.
To find companies that need their IT recruiting services, recruiters may solicit businesses by cold calling, networking or requesting referrals. Upon establishing relationships with those who need recruiting services, recruiters assist in the development of strategies and improvements to the hiring process.
Recruiters can be very essential in your next job placement or a barrier that's keeping you from finding your dream placement. Basically they can be a double edge sword. Many times it depends on the firm they are working for.
Dice is FULL of recruiters job posting. They post jobs for respectable clients and others, just post jobs from other career site, expecting you to utilize them as the middle man.
Despite the over numbering job posting posted by recruiters, Dice has a very sweet simple UI, that many people can appreciate. Navigating and dodging recruiters posting is simple, once you learn your way around the site.
Many concerns surrounds the legitimacy of this the website Dice. Many user seem to be targeted for identity thief.
"So I signed up with Dice because I'm looking for a new career. It seemed legit. The very next day I received an email that seemed promising. I responded that I was interested in the position and requested more information. I received an email response that asked about 12 questions. A couple of the questions were "What is your full name" and "What is your email ID". Well, 1) my full name is listed on the Dice account they accessed in the first place and 2) they emailed me the questions so they already had my email ID. I wrote back asking if they were serious. I have not heard back. I just received another email about another position. I responded and have not heard back. Dice seems to be a gathering of scammers and suspicious activity. Maybe not everyone on it, but so far it's been a joke. Even the "About Dice.com" article above is ridiculous. Just beware if you decide to use their site"
"A Rep called 10 times every hour stating he was a representative and asked for my ssn and dob. I declined and received a call back in 30 mins with a different rep and stating I could email my ssn and dob. It is a scam"
From my personal experience, I have ran into two different types of fake job representative calling and attempting personal information. I am confident that Dice, will crack down on this sooner or later. Until then, I will be utilizing other career website like:
Angel
Stackoverflow
https://www.interviewstreet.com/recruit2/
http://jobs.readwriteweb.com/
http://jobs.ajaxian.com/
http://jobs.metafilter.com/
http://www.freshwebjobs.com/
http://www.coroflot.com/jobs
http://jobs.mashable.com/jobs/search/results
http://www.creativehotlist.com/
http://www.thefwa.com/jobs
http://www.sensationaljobs.com/
http://www.techinmotionevents.com/jobs
4 notes
·
View notes
Text
Renaming a database column using migration in Rails
Revisiting: There's going to be many times, at least for junior developers. When you misspell or want to rename a database column. I remember having to do flip and cartwheels to figure out how to change it. Its pretty simple once you understand migrations. Here's 3 simple steps that will do the trick.
Now in such situations, to change the column name do the following steps.
1. Execute
$> rails generate migration ChangeColumnName
where, ChangeColumnName is the name of our migration. This can be any name.
2. Now, edit the generated migration file at db/migrate/<whatever timestamp>_change_column_name.rb
class ChangeColumnName < ActiveRecord::Migration def change rename_column :table_name, :old_column, :new_column end end 3.
$> rake db:migrate
This should fix your problem! you can double check by viewing your Schema.rb.
You can always checkout the RailsGuide
#rails#ruby#ruby on rails#ironyard#theironyard#Junior Developer#programming#migration#backend#coding
0 notes
Text
Git Update
So Git recently announced a security vulnerability and a corresponding fix. From my understanding "If your Git installation remains un-patched, then a malicious person could over-write the .git/config directory in one of your repositories. This would allow them to alter your Git history and make changes in the repo without your knowledge. Details."
Even though the issue may not affect Linux users, if you are a hosting service whose users may fetch from your service to Windows or Mac OS X machines, you are strongly encouraged to update to protect such users who use existing versions of Git. ~Git Core Team
So to prevent this from ever happening you have to updated your Git.
Step one: Figure out what version of Git you are running
"git --version"
If you are running anything before 'git version 2.2.1' You need to update
Step Two: If you haven't already installed Homebrew (makes it easy to install and maintain Git.) Please go ahead.
once you have already downloaded or updated Homebrew, use Homebrew to install Git
"brew install git"
"brew upgrade git" (if you already have git installed"
This will update and install the latest Git version (should be that easy).
This worked for me, so hopefully it will be as easy for you. There are many open source guides and instructions to help if you get tangled along the way.
0 notes