I'm very new to Version Control, and I was wondering if I could get some advice on how it can fit into website design.
At the moment I'm working on a typical, simple website that includes images:
A few .html files and a .css file
One folder full of photographs
Another folder with the corresponding thumbnails
Can I just put the whole lot in a repository? Or is there a better way I could apply Version Control to it? How should I deal with the images?
edit:
How well will it work with changes to the images? What if I decide to try and optimise my photographs or resize them. I wont be able to see what exactly changed about the images, should comments be enough to keep track of that?
One common practice is to decide what files you would need to publish the site, then include those files in your DVCS. If you eventually adopt a build server/continuous integration server, it will check out your code from your repository, run tests on it, compile it, then publish it to your testing/production server. To do that, you'll need to include all necessary files.
You should not include unnecessary files that may change often, but signify nothing. For the ASP.NET world, those include .suo, .user, resharper files. If you have an uploaded files folder, you could excluded that as well so files that you test upload don't get included. Basically, anything of that nature.
Clarification
Regarding the "uploaded files folder" thing. If you site supports user's uploading files and they are stored inside the site's directory, say in a folder called "Uploads", then you would want to exclude such a folder from the source control. This is just an example of the kind of thing you wouldn't want to include. While testing, you would test uploading files to your site, but you certainly wouldn't want those test uploads published to production, so keep them out of source control.
Unless you have a compelling reason not to, I don't see why you couldn't put the images into the repository.
Related
Let's say I have the following setup:
SolutionProjects containing Project1, Project2.
Project1 contains code, Project2 contains a folder called Images and in it is a file 'example.png'.
Now I want to use 'example.png' in Project1, e.g. <img src="example.png"/>
I can't navigate there via ../../ because it stops at the root of Project1 and doesn't let me go up by one into the solution folder.
I want to use relative paths if possible.
Can someone with more experience help me out?
If you have two web projects, they can be deployed in different applications within the same website, different web sites on the same server or even different websites on different servers.
You cannot navigate towards the other project using ../, because the file structure you have on disk in your solution does not necessarily match the file structure after deploying. Your web application is not going to serve another web application's files.
In other words, the file may not be where you expect it to, and you cannot go up beyond your wwwroot.
You'll have to prefix the actual site that the other project is going to use. During development this may be https://localhost:12345/, and it'd be wise to make this configurable.
So your image tag becomes something like <img src="#(Html.ImageServerUrl)/Images/Foo.png" />.
I am making an windows store application and one of the requirements is that it must not use data connection. The application includes a lot of photos (around 400, all compressed as much as possible, around 8 kb each).
What would be the best practice handling this situation? How should I "preload" them in to the application?
If your requirement for zero net connectivity is real, then you have two options.
ONE. You can ship your app, and request that the user get the images from some other location and then give them to your app, loading the image in a somewhat manual way.
I know this does not sound ideal, but I wanted to acknowledge it was an option.
TWO. You can ship your app with the images embedded inside the installation package. This means as soon as your app installs, the user has all the images, no net necessary.
Here's how:
Create a new folder in your project, call it "Images" or something.
Drag your images into that folder (using Visual Studio).
Refer to your images like this "ms-appx:///Images/MyImage.jpg"
Note: it's up to you how you keep track of all your images, you could iterate through the folder over and over again, but it's probably best you just hard code the list in some class.
It's really that easy.
Best of luck!
Can you just store them in your project solution and refer to them in your code using the ms-appx:/// format?
Also if you are using so many images, prefer jpg images or compress your images using
https://tinypng.com/
Hope that helps.
here's my website:
www.newportclassic.com
do you know of any free, easy to use, content management systems, that will allow me to simply edit the text on my site without having to download the file, open the file, edit the code, save the file, upload the file ???????
I know of a few CMS's that have done well, here are two of them.
Wordpress - free - http://wordpress.org/ - 3.0 is coming soon
Perch - paid - http://grabaperch.com/ - very light and easy
Wikipedia has a very good list of content management systems broken down by language and cost (open source/proprietary) and DBMS. Most of the ones I've used/evaluated in the past have been .NET based, such as DotNetNuke. Pretty much any CMS will give you the ability to edit your HTML without changing any files on your web server. If you're going for simplicity, the Wikipedia list has several that use a flat file instead of a database, so I would start there: http://en.wikipedia.org/wiki/List_of_content_management_systems#File_.2F_Flat_file
As an alternative to installing a CMS on your server, you might be interested in a service like CushyCMS. It allows you to specify what parts of your page are editable by setting an appropriate class in each editable div tag. Then to edit the contents of those div blocks, you log in to the CushyCMS site and make your changes right there. CushyCMS connects via FTP to the server for you and updates the HTML page.
You can use emacs -- it has a mode (tramp) where you can open, edit and save remote files as if they were on your local machine. This makes it really easy to edit files on a webserver.
haven't used it myself but i've heard Surreal CMS is quite good and easy to setup. Here's a tutorial to get you started.
In terms of user friendliness zimplit is hard to beat.
Try their demo.
You can literally edit your website with a wysiwyg interface inside your browser.
Refinery HQ is probably the easiest way to create, edit and update your website. You can upload images and files as you describe in your question.
You can also connect it to your own domain (it's a hosted service). So you'd be able to hook the site you create up to newportclassic.com
I have what seems like a typical usage scenario for users downloading, editing and uploading a document from a web page.
User clicks a link to download a document
User edits downloaded file
User saves the file
User goes back to the web page and uploads the new file with the changes
The problem is that downloaded files are typically saved in a temporary directory, so it can be difficult to find the file after it is saved. The application is for very non-technical users, and I can already imagine the problems with saved files being lost or the wrong versions being uploaded.
Is there a better way? Things I've thought about:
Using Google Docs or something similar.
Problems: forcing users to use new
application with less features,
importing legacy content, setting up
accounts for everyone to edit a
file.
Using WebDAV to serve the files. Not sure how this would work exactly, but seems like it should be possible
Some kind of Flash or Java app that manages downloads and uploads. Not sure if these even exist.
User education :)
If it matters, the files will be mostly Word and Powerpoint documents.
Actually, despite the fact that you have more flexibility with AJAX in developing application, the problem of uploading multiple files is not solved yet.
To the thoughts you've mentioned in your question:
Google Docs:
Online apps like Google docs are certainly appealing for certain use cases. However, if you'd like to upload Word and Powerpoint slides, you don't want the content to be changed once you've uploaded the document. The problem is that Google Docs uses its own data format and therefore changes some of the formats. If you go for an online app, I'd go for a Document Management Solution. I'm sure there are plenty (even free ones) out there; however, I didn't use any on them yet.
WebDAV It is possible and seems to me like the best solution. You can embed WebDav like any directory. Documents are locked until a user releases the document. Unfortunately, you don't have a web front end to manage the files or administer access restrictions.
It
Flash or Java app They do exist, for sure. I'd prefer Flash over Java since Flash Apps still run smoother within a browser. I would definitely not use a rich application, even if it is a Java Web Start app that can be downloaded and opens in a separate window. More and more, users seem to accept browser based web applications. Which brings me to point 4:
User education You can educate them, sure. But in the end you want them to want to use the system. Most often, users get easily used to a tool. However, if they don't like the tool, they're not going to use it.
Clear instructions to save to their desktop is a start. Then clear instructions to go to the desktop to re-up it. I've not run across an online MSWord viewer/editor or whatever format the file is, but I'm sure they exist, now that Google Docs and a few other online versions of MSOffice exist.
I would make sure that there are easy to follow instructions, plus a tutorial somewhere else (perhaps with a video too) to guide users through the process.
What is the best client side http library to upload multiple files? If it can handle directories that's a huge bonus. I'm looking for something that is open source or free. I'm looking for something like FTP, but that works over http, through the browser. Uploading multiple files through a normal HTML 4.x form is a bit of a hassle when it comes to uploading more than 5-6 files.
Feel free to share your personal experiences.
Uploadify is also another great multiple file uploader. It was built off of SWFUpload and they added new features to it.
Some of the features that I have found most helpful are:
The user can upload all the files at once using ctrl + clicking on all of
the files
As the files are being downloaded a queue is displayed which
shows the files being downloaded including a completeion bar.
As files are completed they are removed from the queue
It also allows you to specify which file types the user is
able to download (they can only see the ones you choose)
I'd recommend something like SWFUpload for that. It's main feature is its support for progress bars, but it also allows for queuing files which is particularly handy (this is actually the second time I've recommended it today).
Just to make sure other options are documented (SWFUpload is great) - another good solution is FancyUpload2.
You could use a Java based solution. I've been using JumpLoader on one of my web pages and haven't had any problems with it. It can also upload directories, which other solutions mentioned here do not support.
Another option that I have used before is uploading and then extracting ZIP files. I have used PEAR::Archive_Zip to extract. Requires more knowledge on the user's side, but supports directories and unlimited files (depending on the memory alloted to PHP).
Take a look at jquery-html5-upload it doesn't require Flash, and has a sexy jQuery API.