Popular Tags:

My New Debian Xfce Desktop Setup

March 29, 2013 at 2:26 am

Above is a snapshot of my new Debian Xfce setup. Quite a few people liked it, so I thought I’d make a quick guide on how to set that up.

First off, I’m using a standard Debian install with the Xfce desktop environment. You can just head over to Debian.org and grab an install image; there’s also Gnome and KDE versions among others, just make sure you grab the Xfce one.
Once you install, make sure you enable display composing for things like opacity, window shadows, etc, by going to Settings > Window Manager Tweaks > Compositor > Enable Display Composing
For the Terminal I’m using the standard Xfce4 Terminal. The color scheme is a combination of things I found on blogs and github with my own tweaks. I uploaded my version to Github: https://gist.github.com/felixmc/5256193

You should save it as ~/.config/Terminal/terminalrc

The window on the left is a code file opened in vim. I’m using one of the default color schemes called elflord, though of course it also uses some of the colors from my terminal color scheme posted above.

To enable it, add the following lines to your /etc/vim/vimrc file (assuming you are the only user, otherwise you might want to create a user-specific vim configuration file, I’m not sure it has one by default; ~/vimrc did not work for me, but I didn’t really make much of an effort to figure it out):
set number
syntax on
color elflord
For the GUI, I’m using the xfce-4.2 theme, it is one of the default ones. You can set it by going to Settings > Appearance > Style

For the Window Decoration (the borders around each window and the minimize/close/etc buttons), I’m using the Waza style. It’s another one of the default ones, you can set it by going to Settings > Window Manager > Style

For the system icons, I’m using Cheser, it’s one of the default ones, you can select it by going to Settings > Appearance > Icons

For instructions on how to install new themes/other UI customizations, see  http://wiki.xfce.org/howto/install_new_themes
For the wallpaper I’m using see http://blog.desdelinux.net/wp-content/uploads/2012/09/Xfce-wallpaper-blue.png

Hope this is useful, sorry if any information was redundant, let me know if you have any questions.

Small Reddit Management Tool

March 29, 2013 at 1:21 am

About 6 months ago I started getting really into reddit and soon I feel victim to content overload. So, in order to help remedy that, I made this small content managing tool: http://reddit.felixmc.com/

It uses localStorage to persist the data, and as such it is virtually anonymous. However, this also means that if you were to clear your browsing data, all the information saved on the web app would be lost. Another downside it that this can’t be synced across different web browsers or devices, as the data is saved in the local browser only.

Because I rather sloppily implemented this using an iframe, I found that it works best if you have the “open links in a new window” enabled in your reddit preferences.

Here’s how you can use it:
- You can add subreddits to a category, and you can click on the category name to open up a multi subreddit of all the subreddits in that category. You can still click on a subreddit to open it up by itself.
- You can click the imgur icon to switch to imgur mode, which makes all your categories/subreddits link to their imgur counterparts. – You can drag both categories and subreddits on the top “menu” box to delete them.
- You can drag categories and subreddits around to rearrange them, and you can also drag subreddits from one category to another.
- You can use the +/- to minimize/maximize a category

All the aforementioned UI interactions rely on jQuery UI.

I tried to replicate reddit/imgur’s UI to make it feel more intuitive, though am not sure of how well I did.

I’d appreciate any feedback, suggestions, etc, just let me know below. :)

Setting Up My Web Development Environment in Windows 8

December 22, 2012 at 7:17 am

A few weeks ago I decided to give Windows 8 a try as it was offered free of charge by the University I attend. As I have a very small hard drive (128GB solid state drive), I decided to use the whole drive for the installation, erasing my Linux partition where I had my web development environment setup.

Earlier today I decided to re-setup my local web development environment, this time on my Windows 8 machine, rather than on a separate Linux partition. This is mostly because as I spend more and more time in Windows for school projects, booting to a different OS every time I want to get some work done on personal project had become a huge inconvenience. Not only that, but I also wanted to see how easily this could be done on the Windows platform.

My web development setup consists of the technologies required to run and test web applications written in  node.js, php, and MySQL. Besides the system-specific implementation of the aforementioned technologies, my setup also includes some sort of web server that supports an implementation of php, usually nginx as its very lightweight and can easily be used as a reverse proxy for node.js scripts, as well as some sort of front end for MySQL, usually phpMyAdmin, as it goes hand-in-hand with the rest of my setup.

As such, I decided to install WAMP, as it is a very robust package that I have had experience with before, which meets most of the requirements of my setup: it comes with the latest versions of php, MySQL, phpMyAdmin among other tools that simplify managing my web server in Windows.

Though WAMP also comes with Apache, I much rather prefer Nginx as my main the web server as it’s what I use on my production server (which this blog runs on!), and because I could easily reverse proxy node.js scripts to a path on localhost which I could much more easily share to friends or colleagues over LAN or the internet because I would only have to forward one port for Nginx in my firewall/router, rather than a unique port for every node.js script running on my machine.

The next logical step was to setup Nginx to run as a reverse proxy for Apache as well  (there would be no point in trying to get Nginx to work smoothly with the WAMP implementation of php and MySQL since they came prepackaged with and pre-configured to work out-of-the-box with Apache).

First, the port Apache listens on needed to be changed so that it wouldn’t conflict with Nginx running on port 80. To do this I edited the main Apache config file (located at something like C:\wamp\bin\apache\apache2.x.x\conf\httpd.conf depending on the WAMP version), namely these two lines: Listen 80 and ServerName localhost:80 (which one could easily locate using find and replace). I simply changed 80 to 3000, though it could’ve been any other valid/available port on my machine.

Next, Nginx needed to be configured to act as a reverse proxy for Apache. I decided to do this by forwarding all requests beginning with a path, namely /wamp/, to Apache. To achieve this I simply added a location directive to the default server directive inside Nginx’s main config file nginx.conf:

 location /wamp/ {
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;

 proxy_pass http://127.0.0.1:3000/;
 proxy_redirect off;
} 

Now all requests to /wamp/ point to Apache’s root directory and any request to a specific Apache URI can be reached by prepending /wamp/ to it (to access WAMP’s phpMyAdmin you’d go to localhost/wamp/phpmyadmin/, etc).

This seems to work for most things one might use WAMP for, though one notable exception (and kind of a big one) seems to be phpMyAdmin. WAMP now ships with phpMyAdmin 3.4, which relies heavily on Ajax for virtually any communication with the back-end; when accessing phpMyAdmin through Nginx, Ajax requests tend to hang and sometimes the browser window becomes unresponsive. Oddly, the javascript console doesn’t show any errors, so either the request or response seems to be getting lost at some point in the communication. This doesn’t happen if I access phpMyAdmin straight through Apache (via localhost:3000/phpmyadmin/), so I’m thinking it has something to do with the way I setup my Nginx proxy. I haven’t had that much time to look into it, but I’ll update this post if I figure it out.

The good news is that WordPress seems to be working fine with the current configuration, which is great because that’s what most of my client work revolves around.

 

Update 12/22/2012

So it appears I ran into an issue when accessing WordPress via different hosts: when accessing WordPress directly through Apache (<code>localhost:3000/wordpress/</code>) as opposed to Nginx (<code>localhost/wamp/wordpress/</code>) and then again while accessing it through Nginx over WAN. Part of it was because WordPress uses a “hardcoded” base URL to link to resources as well as redirects, causing issues when accessing the WordPress from a host that didn’t match the one stored in the database. The other issue was due to an Apache redirect when accessing WAMP over WAN because the WAN host differed from the one specified in <code>httpd.conf</code>.

To fix the Apache issue, I simply opened <code>httpd.conf</code> and commented out the line <code>ServerName localhost:3000</code> forcing Apache to try to guess the hostname whenever it has to do redirects and whatnot.

Next, to fix the issue with WordPress’ “hardcoded” base URL, I opened up <code>wp-config.php</code> and added the following code before the “do not edit past this point” warning:

$host = $_SERVER["HTTP_HOST"];
$uri = ($host === $_SERVER["SERVER_NAME"] || $_SERVER["SERVER_NAME"] !== "localhost" ? "/wamp" : "") . "/wordpress";
$base_url = "http://" . $host . $uri;
define('WP_HOME', $base_url);
define('WP_SITEURL', $base_url);

The code above determines the host and uses it to construct the base URL for WordPress dynamically, overwriting the one specified in WordPress’ <code>wp-options</code> table.

Web Design Graveyard: Basic Campaign Website

November 19, 2012 at 6:24 am

In an effort be more active on my blog, I decided to start a new series of posts entitled “Web Design Graveyard” discussing web design projects that never went live, be it because the client rejected the design, the project got cancelled, or whatever it might be.

Web design is not necessarily one of my strengths, but it is one of the things I really enjoy doing most. It is something I constantly strive try to improve on and part of the reason I wanted to do this “series” of posts is to hopefully gauge some feedback that will make me a better designer, but also to showcase work that would otherwise not make it online.

Anyway, this first project is from well over a year ago, it is a mock up for a very last minute campaign site for a candidate in the 2011 Virginia state elections. Ultimately the campaign decided against launching a website as it was too close to election time, but I didn’t mind as I got paid anyway and the candidate won without the website.

wbesite snapshot

Typography

- Ballpark Weiner (site heading)
- Georgia (content headings)
- Arial (content text)

Stock Photos

- sxc.hu (flag image in background of site)


Some things I would change if I were to redesign this website would probably be my choice of typography. Ballpark Weiner seems a little tacky and unprofessional for this project, there is probably a nice Serif font out there that would fit better. Arial (except for when in all caps) is a little too condensed as I used it, increasing line height and font size would greatly improve readability, though if I were to redesign this project today, I would probably use either Helvetica NeueOpen Sans or something along those lines. Georgia seems to work okay for the headings, though I might increase the font weight.

On a different note, I would probably not use rounded corners for the slider as it looks a little overdone, and I would definitely increase the contrast of the slider navigation against the background. The image of the map could also use some sort of border and/or slight drop shadow to make it to stand out some more.

The things I am particularly proud of from this design are my donate button, which I think turned out quite nicely, and my use of slight drop shadows with the slider and page footer.

I would love to hear your thoughts on this design down below.

fmc.io: Free, Open, URL-Shortening Service

October 29, 2012 at 12:32 am

Visit fmc.io

fmc.io is a URL-shortening service similar to bit.ly or tinyurl.com.

I started this project during break for college just for fun and to give me something to do. I knew I wanted to do something with node.js, and was also interested into learning more about how HTTP works, so I thought a RESTful service would be a good project.

The backend for it runs on node.js and MySQL, and I actually also ended up with another project, Shortnr, which is the node.js app running fmc.io, which I will talk about in a different blog post.

You don’t need to sign up to use the service. It doesn’t use cookies or anything, but it does collect some data about its users, just like any other online service.

The service has a publicly available RESTful API that anybody can implement into their website or web app to generate shortened URLs. See here for documentation on the API.

Feel free to use it for your URL-shortening needs, I will keep it online as long as it doesn’t crash my server.

The software that runs fmc.io, Shortnr, is available as open source on GitHub.

Dribbble Preview GreaseMonkey Script/Chrome Extension

October 28, 2012 at 10:43 pm

Originally posted on 03/19/2012 on my old blog. This might be a little outdated.

Dribbble is an awesome website, especially when you’re stuck on a design and need some inspiration. However, whenever I’m on Dribbble I find myself opening up more tabs than I can keep track of, simply because I want to view the full-sized dribbble. In order to fix this, I wrote a small script that retrieves the full shot when you hover over a preview.

To install this script or view its source visit its UserScripts page. Since this is a javascipt snippet, you can install it natively as a Chrome Extension or if you use another browser like Firefox, you can install it using GreaseMonkey or a similar plugin.

Below are some examples of the script in action:

 

 

 

CSS3 Parallax Scrolling Space Background

October 28, 2012 at 10:28 pm

Originally posted on 03/19/2012 on my old blog.

While cleaning up my web server’s public directory today I stumbled upon a simple jQuery parallax scrolling animation that I wrote a while ago. Since I didn’t know much about CSS3 when I wrote it, I decided to rewrite the whole thing using keyframe animations.

Originally I had found a tileable space background online and separated the various objects on it into three separate images using Photoshop. Each of the images acts as a background layer moving at a different speed and in different directions, thus creating the parallax scrolling effect. For this version I kept the original images and simply rewrote the animation in CSS3.

The only thing I dislike about my solution is that I had to use a couple div‘s to act as the various background layers because animating pseudo elements isn’t currently possible using keyframe animations. Bernd pointed out on Google+ that you can now use multiple backgrounds in CSS3, so I fixed the animation accordingly.

I was able to find the original image I used for the background as part of a bigger set which you can download here. You can also see this animation in full screen.

Google Code Prettify Oblivion Theme

October 28, 2012 at 9:57 pm

Originally posted on 03/22/2012 on my old blog.

View project on GitHub

Gedit is a wonderfully simple text editor and my tool of choice for web development. The Oblivion theme, which is one of the themes it comes equipped with by default, is my favorite. Google Code Prettify happens to be one of my preferred way of embedding code online (excluding jsfiddle), so naturally I decided to port the Oblivion theme to Google Code Prettify.

Simply including the CSS file in your project should work. You can see a preview of the theme below:

 

Quick Pure CSS3 Browser Window

October 28, 2012 at 9:05 pm

Originally posted on 03/14/2012 on my old blog.

I needed a tiny browser window “wrapper” for another project tonight, but all I could find online were .psd files, so I decided to make my own css3 version. It’s really basic, and probably not the most semantic mark-up, but it got the job done.

Solid Regex Pattern for URL Validation

October 28, 2012 at 8:53 pm

Originally posted on 02/21/2012 on my old blog.

I started working on a new web app today and one of its features requires parsing a user’s plain text input for URLs and replacing them with html links. Looking at Regex URL patterns online, I found that none of them could really recognize more complex URLs, so I wrote my own.

The Regex below should be pretty solid. Let me know if you find anything broken or have trouble implementing it. You can see it in action in this RegexPal demo.

/(https?|ftps?)\\:\\/\\/([a-z0-9+!*(),;?&=\\$_.-]+(\\:[a-z0-9+!*(),;?&=\\$_.-]+)?@)?([a-z0-9+\\$_-]+(\\.[a-z0-9+\\$_-]+)*)(\\:[0-9]{1,5})?(\\/([a-z0-9~#!%,+\\$_-]\\.?)+)*\\/?(\\?[a-z+&\\$_.-][a-z0-9,.;#:@&%=+\\/\\$_.-]*)?/i