There are many teams and individuals that run Ruby on Rails under Cygwin although it is a little slower than the native Windows or the much faster Linux installations. One of the problems those folks come across is with talking to mysql. After starting ./script/server and trying to connect, Rails throws out an error looking for a unix socket: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ ‘/tmp/mysql.sock’. But as most guess, mysql would have been already been running as a Windows Service.
The solution is to simply replace all ‘localhost’ occurences to ‘127.0.0.1’ because then, Rails will be forced to use Windows TCP/IP sockets instead of a unix socket. And remember to restart your Rails server (WEBRick/Apache/Lighttp).
The simplest order of installing Rails under Cygwin on an all new Windows box would be:
- Make sure you have uninstalled all copies of RubyOneClick Installer.
- Install Cygwin and a shell such as bash (or xterm if you like Cygwin-X)
- Install Ruby from the cygwin setup under ‘Devel’ Category.
- Have MySQL installed as a Windows Service (or make one from mysql source packages)
- Download RubyGems, extract it to a temporary directory (c:/cygwin/tmp/ or c:/temp/ if you like)
- Open bash and navigate to that directory using “cd” commands, and type: ruby setup.rb
- When done, type: gem install rails --include-dependencies
- Then, type: gem install mysql and in the prompt, pick latest mswin32 if you installed mysql as a service or latest ruby version if you built it from the source.
- Create a sample rails application at /tmp/railstest/ by typing: rails /tmp/railstest
- and finally edit ./config/database.yml file to use 127.0.0.1 rather than localhost
The entire process along with the time taken to gather necessary knowledge etc (if you wish to) would take 2 hours but if you follow these instructions blindly it shouldn’t take more than 30-45 minutes on a quite fast machine.
As for an editor, download PSPad and turn on Ruby On Rails highlighter under Settings-->Highlighters Settings and pick “Ruby on Rails” and “Ruby” for any two unassigned slots.
Posted by Sheriff, Md. at 09:14 PM.
Filed under:
(93) Comments •
(1) Trackbacks •
Permalink
Ever wanted to have your dev WAMP / XAMPP server to run multiple web projects on its own dummy hostnames? Want your http://localhost/ point to the same document root but still need multiple dummy hostnames such as http://www.project1.local/ or http://www.project1.com.dev/ pointing to different project folders?
Well, the answer is to take advantage of Apache’s VirtualHosts feature and place dummy URLs in your hosts file. In WinXP, your hosts file is located at the directory path: C:\Windows\System32\drivers\etc\
Note that the ‘hosts’ file has not extension so if you get a Open with dialog choose an appropriate text editor or simply notepad.
Once you have the file opened add a new line in the end like as show below:
127.0.0.1 http://www.project1.local
127.0.0.1 project1.local
So, now the first half of it is over. To check the progress, open a cmd prompt and type “ping project1.local” you should see the ping going to 127.0.0.1. Also, if you open your browser and point to where apache is running (http://localhost/ or http://localhost:81/ depending upon your setup) you would see the original document root files as expected and as it was working—you could also do: http://www.project1.local or http://project1.local
At this point, both http://localhost/ and http://www.project1.local/ point to the same directory location. Now, here comes the VirtualHosts trick:
Open your httpd.conf file (C:\wamp\Apache2\conf\httpd.conf on a default WAMP installation) and append the following lines near the end
NameVirtualHost *
<VirtualHost *>
ServerName localhost
DocumentRoot "C:/Wamp/www"
</VirtualHost>
<VirtualHost *>
ServerName project1.local
DocumentRoot "C:/Wamp/project1" # Change here
</VirtualHost>
Restart your apache server and thats it.. http://localhost/ will point to your default C:/wamp/www directory files and http://project1.local/ will point to the other different set of project files!
Target Audience: Beginner Apache Administrators, Beginner to Intermediate PHP Developers.
Difficulty level: Easy
Time: 10-15 minutes
Posted by Sheriff, Md. at 12:23 AM.
Filed under:
(95) Comments •
(0) Trackbacks •
Permalink
If you ever get your passwords locked out or wanted to reset your password, being the domain/db owner yourself, then there is a way to solve this. Connect to your ExpressionEngine database and browse to the table exp_members. This will list rows corresponding to the the number of members registered in the system. Now edit the corresponding row that has your username. You will note that the password is encrypted and is 40 characters long. ExpressionEngine uses SHA1 encryption, so you will need a tool to generate SHA1 hash. If you don’t know (or don’t want to know) what those are, use this 40 character value:
8b60e9d739b5a5bfd87cbfe67501ab4fa6e41504
The above is the SHA1 hash for the word “recovery”. Replace this in the password field in your database row (pay attention to the field name, there is a similar field named unique_id just next to it) and Save your row (hit Go in phpMyAdmin). You have now successfully reset your password to “recovery”. Now, go quickly login to your system and change your password the normal way.
Questions?
Do this only when you have no other choice of recovering your password. If you have doubts that someone else reading this post, might try the same out to hack into your own system, then actually they can’t. Well, they can’t as long as they don’t have access to your database
This tells you two lessons: Number 1) Always keep very secured passwords to your hosting and database accounts and Number 2) Do not forget any of your passwords
By and large, ExpressionEngine is more secured enforcing password lockouts and the folks have done necessary precautions to prevent hacker attacks—Kudos to them. Honestly speaking, I haven’t seen a little security hole in EE myself as far.
Cheers and Happy ethical Hacking!
Posted by Sheriff, Md. at 09:33 PM.
Filed under:
(107) Comments •
(0) Trackbacks •
Permalink
I am an innovator with a 6+ year track record of advanced enterprise-level applications. I enjoy a good challenge, and can think outside the box to reach workable solutions that others might not see. My experience in the I.T. industry, knowledge, degrees in computer science/ math/ business, high quality output, and ability to meet deadlines enable me to deliver an excellent service. My broad cross-platform expert knowledge has been beneficial to many companies and organizations.
TECHNICAL SKILLS SUMMARY
Program Languages, APIs, and Doc Formats:
C, C++, PureBasic, Java, C#, VB.NET 2.0/3.0/3.5, PHP4/5, JavaScript, SOAP, AJAX, Hand-coded HTML, Assorted template formats, XML, JSON, DHTML, XHTML, CSS, PDF, Sockets/Networking Web 2.0/3.0, W3C AAA and Section 508 Compliance
Databases:
Data integration/ migration, SqlLite3, PostgreSQL, MySQL, InnoDB, MS-SQL, Access, Excel, DBase, FileMaker Pro, Oracle 8 SQL, flat-file
OS Installed and Used:
Linux, Fedora/RedHat/CentOS, Mac-OSX, Suse/Novell, Debian/Ubuntu, Mandriva, FreeBSD, Windows and many others.
Web Software Solutions:
Created many custom web softwares.
Custom enhanced/ compiled/ configured/ optimized software source code.
Customized/ installed many web and Intranet software, including:
Servlets, JSP, Tomcat, Apache OFBiz, Zend Framework, CodeIgniter, Symphony, Prototype, jQuery, ExtJS, Joomla, Mambo, phpBB, Drupal, Typo3, vBulletin, Wordpress, phpMyAdmin, SquirrelMail, OSCommerce, ZenCart, Interchange, X-Cart, phpCart, Apache, Lighttpd, Sendmail, Subversion, Git, etc...
Assorted Other Experience:
OOP/ OOD, Internationalization, Custom e-commerce solutions, Payment gateways, Currency conversion, Social networking/Facebook Login,Twitter API, Online memberships, Database Abstraction Layer, Database speed optimization, Web interfaces, GUI, Web graphics, SVN, Server maintenance, Network maintenance, Shell scripting, Open SSL, Data mining, Website administration, Technical support, Crontab, Batch files, SSH, SCP, SSH-tunnels, Log file analysis, Email, SMTP, TCP-IP, Application security, Firewall, FTP, Encryption, Unit Testing, TDD.
This is my Personal weblog. I started this blog site in order to share my knowledge, thoughts, and other experiences in the Real world and the IT world. You may find some of my deep thoughts, advices and rants that are expressions of purely my own.
2009
As of 2009, I own a startup: TakeMyScreen.Com, a remote desktop sharing product that uses cutting-edge technologies (including Facebook Login/Connect) - still under development. If you are interested in knowing more details on this project, like to fund, or join in the development, feel free to contact me at: sheriff -a,t- netrcs (d.o.t) com
Personal History
I started off with Basic and VB6 as a hobby, moved onto the VC++ platform and COM/ActiveX staying there for a while and actually got into the IT field by freelancing to clients abroad using ASP. In the due course, I started learning many different platforms and languages and by a year and a half after that moved completely to Web technologies such as PHP and JavaScript.
As a Solutions Delivery Associate, I talked to clients understanding their web-based business needs and suggesting them with paths to solutions that improves their business, productivity, technology and technical dependence, and other strategies to satisfy their requirements on technology and IT support. As a Technical lead, I did framework/codebase level programming in C#, Webforms/MonoRail, JavaScript/JQuery/ActiveWidgets, and use Wordpress, ExpressiongEngine, Typolight for CMS. I delivered a Web2.0 based Java/J2EE project that uses GWT/Hibernate. I've also delivered projects using jQuery/.NET. My current craze is: Ruby on Rails, MonoRail/NHibernate, JQuery. I mostly program in Windows, by making use of Visual Studio Express/Eclipse/PSPad and Subversion/Git.
Posted by Sheriff, Md. at 07:13 PM.
Filed under:
(5236) Comments •
(0) Trackbacks •
Permalink