Category Archives: TOS

File Management on the Server with Git

After trying out a few different options, I finally came up with an easy way to move files to the server using git. This isn’t using GitHub at all, but actually a Git repository on our server. It’s nice and you never have to use FTP or SCP, just some shell commands for the initial setup! The setup might seem a bit daunting but it’s not that hard and you’ll have it running in no time. It may ask for your password a few times in the commands, keep in mind when you’re typing characters they won’t show up when doing the password. This is for security purposes, of course.)

SSH into the server, Windows users can use puTTY, OS X and GNU/Linux users can use the ssh command like this:

ssh user@server.internet.com

(obviously replacing user with your username and server.internet.com with the server)

Then do the following commands: (replace web with what you want to call the repo if you want to call it anything else. web is perfectly ok though.)

mkdir web
cd web
git init –bare
cd hooks
touch post-receive
nano post-receive

This will open a text file to edit. You can use a text editor of your choice instead of nano, but I think the server only has nano and vim. Vim is what I’d recommend using if you know how, but if not nano is perfectly O.K. Here’s what you need to fill the file with:

#!/bin/bash
GIT_WORK_TREE=~/html/ git checkout -f
echo Updated Successfully

After that save the file and exit (I think it’s CTRL+X with Nano, and :wq on Vim). Then you will be all set with the server. After this you need to clone the repo. I’m not sure how to do this properly on Windows, but for the OS X and GNU/Linux users you do the following command:

git clone user@server.internet.com:web

(where user is your username and server.internet.com is our server. web is the repo)

This will clone the repo to your machine. It’s going to be empty, so it’s time to fill it with things. I’d test it first, by putting an index.html file with some stuff in it in the folder, and then adding, committing, and pushing. (If you don’t know the commands, they’re:

git add -A
git commit
git push origin master

git add -A adds every file in the folder, so watch out) Then the server should be updated. Put the server address in an address bar and head to your user folder and your files should now be there. They’re also tracked by git so if you’re familiar with git you can revert changes and all that fun stuff.

Hope this is helpful to some people. I’d recommend doing this over the other options as this’ll help get you familiar with git and it’s also much simpler to do after the initial set-up.

From the blog Five mvs of Doom by Chad Wade Day, Jr. and used with permission of the author. All other rights reserved by the author.

File Management on The Server

Now that we have a server set up and you can remotely access it, I can full document how to get your files on there. Make sure you get your username set up by Dillon before attempting this, if you don’t have that info, you’re not going to be able to do anything. Make sure you put your files in the html directory for things to show up on the server online under the development folder.

There’s a few options available to you.

Using SCP

scp (Secure Copy) is a means of simply copying files over SSH (Secure Shell). It’s a replacement for the old rcp (Remote Copy) command which was functionally equivalent, but unencrypted so not secure at all. It’s a safe, easy, and fast way of getting files from one place to another.

In Linux (and possibley OS X systems, I’m honestly not too sure), you can do this with a simple command line command. To copy files to the server, here’s what you’d do in a shell:

scp file-to-copy user@server:path

an example would be

scp test.txt chad@example.com:html/

which would copy a test.txt file to the html/ directory on the server relative to a user chad’s home folder. You can also use the -P option to specify a port, but for our purposes we’re using the default SSH port so you don’t have to worry about that. Also if you’re copying over a directory, you’ll have to use the -r option for recursive, as without it it’ll only transfer individual files (don’t worry though, it’ll warn you). Depending on your setup, it might ask for your password when you want to copy, enter your password (your text won’t show up on the screen as you type a password) if it does that and hit enter and you should be ok.

You can also copy files from the server back, just by swapping the inputs,

scp user@server:file-to-copy location-to-copy-to

I use this command quite a bit, so if you have any trouble with it, feel free to ask.

For Windows users, you can use WinSCP. Basically you start the program up, and it should prompt you with a window called WinSCP Login. Set the protocol to SCP, the Host name to our server, enter your username and password in the appropriate fields and ignore the key field. Click Login, and another prompt should pop up telling you about the key on the server, just hit Yes and it should connect you from there. It should be pretty easy to understand from there.

You can also do SFTP from WinSCP which leads us to the next option

Using SFTP

SFTP is the FTP (File Transfer Protocol) over SSH. It offers a few more features than SCP such as changing file permissions, which shouldn’t matter, but some people might be more comfortable with FTP. WinSCP works fine for this, but FileZilla is cross platform so that’s what I’d recommend using. Pretty much any modern FTP client should support the SFTP protocol though (you could even do it from command line although I’m not a fan of doing that)

Open up FileZilla, and head to File -> Server Manager. Click on New Site and call it whatever you want. In the General tab, for host fill in our server, and port 22. For Protocol make sure to pick SFTP (FTP is the default option). Change Logon type to Normal, and enter your username and password in those fields and hit connect. Then you can click connect and it should put you on the server (if there’s a prompt about a key, just hit yes or ok).

Using Git

Ideally we should be able to set up a git repo on the server that we can push local projects to. I’m going to look into this for another blog post.

Hope this helps, and if you have any questions, be sure to drop me an email at cdayjr@worcester.edu or send me a message in the comments.

From the blog Five mvs of Doom by Chad Wade Day, Jr. and used with permission of the author. All other rights reserved by the author.

Logging into server with SSH and Changing Password

Hello everyone,

Now that we have an open ssh port on our server, individuals can log on and look at the code structure or play around with their own development folder. Once you have a username, you should log onto the server and change your password for security reasons.

Using SSH to Gain Access to the Server

The easiest way to gain access to the server and change your password is to use SSH. If you are using a windows machine you should install putty. Once you have putty installed you can place the url in the server field and leave the port on 22. When the prompt shows up enter your username and then type your password. If you are using windows or mac, you can SSH from a terminal by typing ssh username@server and then type your password when prompted. Be aware that you won’t be able to see any characters when typing your password but it’s being entered.

Changing your Password

Once you’re logged onto the server which is running CentOS you can easily change your password by typing passwd and hitting enter. This will prompt you for the current password and then you can type your new password. Again no characters will show up but this is normal.

In Your Home Folder

You should see one directory in your home folder, which is where you can place all the files that you want to test through the web server. This is a folder that is sim linked to a folder in the webroot. In order to test any code that you place in here you can go to cstest.worcester.edu/development/your_username or simply go to cstest.worcester.edu and navigate to your folder from there.

If you have any questions, please blog about them or send out a message on the ListServ.

From the blog CS 401 - Object Oriented Design » cs-wsu by dillonmurphy10 and used with permission of the author. All other rights reserved by the author.

Ready for Take Off!

We had another class meeting today on IRC chat. Where we discussed our goals from the previous week and tasks that everyone should be working on this week. Our previous weeks goal was to get everything into the developmental branch on GitHub even if it was just a blank template. Our goal was to have a working application for this week. We were very close in hitting this.

For work on the puzzle, after class I started to re work the directory structure of the puzzle application. I figured this way it would be much easier for somebody to read the directories and to get a feel of how it all works. So I basically changed the structure to now have a folder called utilities. This utilities folder holds all of the images, jQuery tools, and the puzzle pieces depending on the size of the game. From there inside the puzzle folder holds just the 3 HTML, CSS, and JavaScript files. I figured this was a good start into cleaning up and getting the code much more organized. So this way my team or anyone else in the class can follow it better.

That is all for tonight, along with learning more about this entire puzzle application that was free for use off of the web. The licenses and copyrights are stored inside each file of the application.

Will be posting more as the week goes on.

From the blog rwilliams5262 » cs-wsu by rwilliams5262 rwilliams5 and used with permission of the author. All other rights reserved by the author.

Ready for Take Off!

We had another class meeting today on IRC chat. Where we discussed our goals from the previous week and tasks that everyone should be working on this week. Our previous weeks goal was to get everything into the developmental branch on GitHub even if it was just a blank template. Our goal was to have a working application for this week. We were very close in hitting this.

For work on the puzzle, after class I started to re work the directory structure of the puzzle application. I figured this way it would be much easier for somebody to read the directories and to get a feel of how it all works. So I basically changed the structure to now have a folder called utilities. This utilities folder holds all of the images, jQuery tools, and the puzzle pieces depending on the size of the game. From there inside the puzzle folder holds just the 3 HTML, CSS, and JavaScript files. I figured this was a good start into cleaning up and getting the code much more organized. So this way my team or anyone else in the class can follow it better.

That is all for tonight, along with learning more about this entire puzzle application that was free for use off of the web. The licenses and copyrights are stored inside each file of the application.

Will be posting more as the week goes on.

From the blog rwilliams5262 » cs-wsu by rwilliams5262 rwilliams5 and used with permission of the author. All other rights reserved by the author.

Almost ready to launch!

As most of you probably know, I pushed everything everyone has done so far (excluding the puzzle, Ryan already pushed it) to the developmental branch. I took the homepage, article viewer and coloring app from everyones private repos (hopefully they don’t mind). I also updated the homepage to link to the respected app. Hopefully we can now get this thing rolling for some testing!

Other than that, I’ll be making some tweaks to the slideshow app. Hopefully James and I can get that thing shaped up to what it is suppose to be over the next few days. I may also look into adding the homepage button to each app. Although, I might not touch it since I think Joe wants control over that?

It’s looking good guys and gals!

From the blog Sean » cs-wsu by shorton1 and used with permission of the author. All other rights reserved by the author.

Almost ready to launch!

As most of you probably know, I pushed everything everyone has done so far (excluding the puzzle, Ryan already pushed it) to the developmental branch. I took the homepage, article viewer and coloring app from everyones private repos (hopefully they don’t mind). I also updated the homepage to link to the respected app. Hopefully we can now get this thing rolling for some testing!

Other than that, I’ll be making some tweaks to the slideshow app. Hopefully James and I can get that thing shaped up to what it is suppose to be over the next few days. I may also look into adding the homepage button to each app. Although, I might not touch it since I think Joe wants control over that?

It’s looking good guys and gals!

From the blog Sean » cs-wsu by shorton1 and used with permission of the author. All other rights reserved by the author.

Begin Puzzle Demo

This week we were asked to have a working Demo for our class on the 25th. Researching ways to start this demo a team member found open Source code, we thought this would be a good place for us to start. Adding on to the open source code one of the teams members uploaded the code to Github so we could all play around with it and get a feel for how the code worked. As we began playing with it we realized that some of the pieces were “sticky” meaning they were very hard to move and you almost had to grab them from the bottom of the piece to be able to move them to a new location. This was the only major drawback from the demo. So in this upcoming week we will continue working on the demo and fix the buttons so they move easily. Other features that were incorporated in the puzzle were 3 difficulty levels (easy, medium and hard). There is also a working refresh button and a restart button.

Next week we hope to resolve the issue with the pieces but as for now we believe we are on the right track.

From the blog klentblog » cswsu by klent22 and used with permission of the author. All other rights reserved by the author.

Database Side: Looking into Github hooks.

This week I was tasked to look into a way to notify our web server whenever changes are made in our Github repository, so that we may automatically pull and sync the new code in order to update our application. I found out that this can be done using Github’s Post-Receive Hooks. The first step that has to be done in this is to update our Administrators Github settings page, under the WebHooks URL section and update that section with the URL to our webserver. Once a commit is made to github they send JSON encrypted script to the webserver, based on a template in Ruby that contains the payload data.

 

If I understand things correctly we can either go about it in the previous manner, or use a slightly different approach using an SSH key.. I will go over this later when we all meet in class..

From the blog CS:401 » CS-WSU by dcarlin2013 and used with permission of the author. All other rights reserved by the author.

Git Hub Headaches…

Image

Hello again,

So there have been no new developments for the coloring page.  I have been waiting for concrete commitment on layout from the Worcester Art Museum but as of yet there seems to be no consensus as to how the page should ultimately look.  That said I was still busy this week.

I spent Monday night trying to understand why the puzzle teams code won’t load the image on the pieces.  Unfortunately I could not solve their problem, but I did find an alternative solution which even came with a few extra bells and whistles, like a timer and movement counter as well as snap positioning.  Its basically a javascript file built on top of jQuery which is provided as freeware by google.  I even showed of a pic of my dog Chewie, seen in the photo above.

Well, you might be wondering at this point, why the title of this article is Git Hub Headache.  I would answer that question with “Git Hub was a huge headache this week”.  I tried to learn the Git Hub command lines this week, which was not so bad.  Sompop’s Git Hub power point presentation was definitely helpful. I could clone the repository, I could add my files to a branch, but I could not figure out how to actually commit them.  After a while spent with no luck, I decided to change strategies.

I then tried to clone the repository with netbeans, but netbeans wanted me to make a project file which did not make sense seeing the 401Project is not being developed exclusively in netbeans.  After a few hours spinning my wheels… I decided to just go to the website thinking there must be some way to do this from that end.  I selected the development branch and cloned the repository.  Then I added my files and committed them to what I thought was the development branch.  However when I checked to see if it had uploaded correctly the changes had been made to the master branch.

At this point I was becoming thoroughly frustrated.  I looked for a few ,minutes for a way to remove the upload but then just moved on.  My last attempt was in the Git Hub app fro mac.  It took a bit of looking but I was able to branch off the development branch and commit my files.  However my branch contained all the file from the development branch an I was not sure If that was normal.  I suppose it would be, so you can run the whole application but only be change your particular part.  At this point I was just happy the files were uploaded.

Any way that was it for the week.  Hopefully next week will be more fruitful.

Till next time.

Jason Hintlian

From the blog jasonhintlian » cs-wsu by jasonhintlian and used with permission of the author. All other rights reserved by the author.