niedziela, 9 grudnia 2012

Symfony2 + Windows + less

Less for windows exists. But using CLI applications on Microsoft's platform is pain in the ass.
Instead of installing less to the PATH env variable I decided to use serverside lessphp (this is NOT recomennded for production env).

Symfony2 + Composer + twitter/bootstrap dependency problem

Today I started my playground with Symfony 2. As it uses Composer as dependency manager -which I have also never used before - I realised that it's gonna be workful weekend.

After almost 2 hours of fightining with twitter/bootstrap package not found error:
 PS D:\Projects\symfony> composer install  
 Loading composer repositories with package information  
 Installing dependencies  
 Your requirements could not be resolved to an installable set of packages.  
  Problem 1  
   - The requested package twitter/bootstrap could not be found in any version, there may be a typo in the package name  
 .  
 Potential causes:  
  - A typo in the package name  
  - The package is not available in a stable-enough version according to your minimum-stability setting  
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.  
 Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.  

trying different configurations of composer.json, crawling millions of issues & forums finally I came to solution, which worked:
Repository:

 "repositories": [  
           {  
                "type": "package",  
                "package": {  
                     "version": "master",  
                     "name": "twitter/bootstrap",  
                     "source": {  
                          "url": "https://github.com/twitter/bootstrap.git",  
                          "type": "git",  
                          "reference": "master"  
                     },  
                     "dist": {  
                          "url": "https://github.com/twitter/bootstrap/zipball/master",  
                          "type": "zip"  
                     }  
                }  
           }  
      ],  

require:
 "twitter/bootstrap": "dev-master"  
Hope that this will save someone's time in the future (or mine, if I will forget).

wtorek, 4 grudnia 2012

Tricks for web development enviornment on Windows

Usually I do work on my laptop running Debian. However my desktop PC is running Windows and I don't wanna change it (gaaameees <3).
Recently I found that sitting in front of big screen have many pros and that's why I started to looking for things that would speed up working with many projects.

First of all I installed XAMPP.
Next, in Apache documentation I found module called vhost_alias which allows to map requested address to local file system without touching mod_rewrite rules.
I store my projects in D:/Projects so it looks like following (replace in http-vhosts.conf):


<VirtualHost *>
UseCanonicalName Off
VirtualDocumentRoot "D:/Projects/%1/
<Directory "D:\Projects">
    Order allow,deny
    Allow from all
Options FollowSymLinks
    AllowOverride All
  </Directory>
</VirtualHost>

Next I had to manually add entries to windows/system32/drivers/etc/hosts file, which maps domains to IP address before making DNS request. I found opening this file as administrators really boring plus it took so many time. 
In about 10 minutes I wrote application in C# which allows me to modify this file. It's simple, without support for comments (it will ommit them when saving again):
You can download it here: HostsEditor.exe
Beware: Bitdefendeer removed contents of my hosts file after I added mapping for google.com :P