Author - Web Developer - Educator
Found 3 results for tag "development"
RSS Feed

My Journey into Git

Git logo

My Journey


My journey to discovering git was not an easy one. Since git was not covered in my formal programming lessons, I had to learn "version control" the hard way - the very hard way.

When I started learning HTML back in 2001, I learned to save and modify local files only. In 2002, I learned PHP and MySQL by working on a team server, but version control was not introduced (git was introduced to the world in 2005, but options like CVS or SVK weren't taught). My first local server came in 2004, when I learned to FTP files, instead of testing local files only.

I quickly updated to SSH'ing into the server and editing the direct code, and backuped the files using a combination of file extensions (such as .bak, date stamps like.20150515, and "Backup 20140523" folders).

...and I used this method up to about a year ago, when I took a git intro course online. Unfortunatly, I didn't quite understand the purpose of git because the demos kept talking about files that either already existed, or branches that were made by someone else - never really diving into the underlying purpose of git, which was version control.

I also couldn't get used to the idea of uploading my database login information (along with other private code) to the public site GitHub, which is great for open-sourced projects (see mine here), but not great for a company version control backup. So I dabbled in git for a while, until it hit me about a month ago: I could use git on my own server(s) and not have to deal with private repositories on GitHub (or the prices).

So, I started using git on my server for backups of projects site-wide. Then, I wanted to deal with errors on a non-production server basis (I didn't want the world to see my error testing, because that would be unprofessional). After getting a local Apache server, and MySQL server, and installing PHP (on Windows), I thought that I could use the GitHub software to create backups - but that was only for the GitHub site; I needed something to work with my own existing servers. Therefore, I installed Cygwin and got the Linux-enabled commands with git to my production server.

Overall, this is what I learned, and I hope it helps others:
The Process
The "direct" process vs the git process

Usage


(If you don't already have git set up on your remote server, then please do so by installing it - I recommend sudo apt-get install -y git. Otherwise, this won't work, and it's just a bunch of lines of code)
The SetupRemote (seperate from production folder):
mkdir [dir].git && cd $_
 
git init --bare
 
cp ~/post-receive.sample hooks/post-receive

The hooks folder deals with webhooks to automatically catch incoming files and do something with them (or at least, that's what I've discovered). To make the hooks run properly, you need a post-receive file, and this is what it should look like:
post-receive.sample
#!/bin/sh
 
GIT_WORK_TREE=[absolute path to production] git checkout -f


Once you have that set up, you can work on your local machine to create and modify files.
Local development machine
# If files do not exist
 
git clone [email protected]:[dir].git 
 
cd [dir]
 
# If files DO exist/update
 
cd [dir]
 
git pull
 

 
# Time for editing
 
vim [file]
 
[...]
 
[work on files, test on development machine]
 
[...]
 
(Ready to upload to production server)
 
git add [file(s) - * works as well]
 
git commit -m "Relevant message to update"
 
git push


One important note: As I have learned, your Git folder is not your production folder. I had my .git folder in my production folder of a project, and it was good for local editing, but not remote pulling. If your project folder (example: project.git) is somewhere else, like your home folder, then you can use the post-receive webhook to automatically pull committed files to the production area

Bonus: SSH Login w/o PW


Unless you want to type in your login information every time you git push, I recommend setting it up so your local machine/development server can automatically upload to the production server. If you are running a Linux system (and I recommend you do), then you can do the following:
SSH Password-less LoginOn your local machine (hopefully a Cygwin or Linux/Mac Terminal)
ssh keygen -t rsa
 
ssh [email protected] 'mkdir -p .ssh'
 
cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'
B = Remote server



Summary


There is still quite a lot I don't understand about git (like branches, merging, etc), but I am getting better. I've been using this guide as a resource, as many other guides are very technical for a non-git person.

My takeaway: Better integration into team development instead of just "solo development"


Tags:#git #development #php #mysql #html #linux

RSS Feed

My First Mobile App

I've been trying to push my limits for the past few days, to make up for the fact that I've been very de-motivated. So, I decided to pick up the progress on WNC Local, which has been going well. I've also been working on the WePay API as well, and that's been...enlighetning? It's been a little challenging, but it's good to get the experience.

So, to take a break from the many hours I've spent slaving over the API, I decided to switch directions for a bit and start tackling the Android and see what I can do with mobile apps. Not having a speck of knowledge in Java, it is a real challenge.

However, thanks to the Android SDK bundle, the Eclipse IDE was included (I've had experience with Eclipse when I was working on C++ back in 2003), and Eclipse+Android Development Toolkit (ADT), getting to "Hello World" was fairly simple.

Using the techniques mentioned on the basic training page, I created the following:
My First App Icon
(Yes, that is Asuna in the background)

My First App

The basic training allowed for the creation of the basic app: input text, output the text.
My First App Output

The documentation was not completely fool-proof, so I had to do some additional research to do a few things (thanks to Toast), like this:
Search Button Pressed

Settings Button Pressed

And the documentation didn't go this far, so I thought I'd add this based on some UI experiences:
String cannot be Blank

I know it's not a very impressive app, but it's not bad for my 1st one done within an hour.

In case you want to fork it or view the source code, I have the app on Github: https://github.com/kode29/MyFirstApp

Here's the APK if you want it

Here's to seeing what Mobile App Development can do!


Tags:#android #app #development #github #wnclocal #wepay #c++ #sdk #eclipse #ide #adt

RSS Feed

Early Bird get the....you know the rest

Good morning world! Yes, it is 3:47am here on the east coast, and what am I doing? I am at work! Not because someone forced me to be here at this ungodly hour, but because I wanted to. Yes, I am that insane.

Don't believe me? Here's a photo I took about 30 minutes ago:


Actually, I'm not that insane. Most developers work best at night, and since Keat is out of town for 24 hours, I thought it would be a good chance to come in and get some work done without the distraction of home (and since Netflix doesn't (completely) work on Linux, I can't stream it from the office. Pandora on the other hand is a joyous pleasure).

Usually at this time, I have been up for 12+ hours and have been drugging away all day with the standard day-to-day activities. This time, I've turned the tables. I went home after work yesterday, got some dinner, finished "Rules of Engagement" (at least, Season 6 on Netflix), slept from 10:30 till 2:30, got dressed, had breakfast, fed the kitties, got all of my materials together, came to work, loaded up Pandora, got some tea ready, and I'm working! YAY!

I don't want to jinx the day so early, but I would like to estimate that today looks like it will be a good day.

Anyway, my expectation is to get a lot of development-specific work done during these wee hours. We'll see how things go.

On the brighter side (ha, get it? Because it's before sunrise.......), I thought I'd post a few comics here to free up my un-used collection. Enjoy, and Good Morning!









Tags:#goodmorning #shadowdevelopment #keat #dilbert #bug #kitty #linux #netflix #badjoke