Wednesday, April 17, 2013

[MySQL] Installing MySql on windows 7 no-installer


Getting the MySQL service to work
  • Extract the file contents to desired directory.
  • Create a 'my.ini' file in the root of the new directory.
  • Copy the following info into my.ini:
[mysqld]
 basedir = C:/mysql
datadir = C:/mysql/data
port = 3306
socket = /tmp/mysql.sock


  • In command line, run ' mysqld --install ' to add the MySQL service
  • Run MySQL service 
  • Then just run mysql to start mysqling. lol
Creating Users

  • Run mysql
  • Type in: create user 'username'@'localhost' identified by 'password'
  • Grant privileges by using the following as guidelines:
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
GRANT USAGE ON *.* TO 'dummy'@'localhost';

Tuesday, April 16, 2013

[PHP] Installing PHP, Apache, Laravel locally on Windows 7

This guide is only for note taking purposes. Whenever I set up something for the first time, I feel like writing about it. I don't know why that is, but don't worry about it and let's begin.

Installing PHP 5.4 and Apache 2.4:
  • Download Apache 2.4 from apachelounge.com
  • Download PHP 5.4 from the php.net
  • Extract Php files into a directory. You can choose c:\php if you want.
  • I think Apache 2.4 comes in a zip. So just extract the contents into a directory of choice. I use c:\apache
Configuring PHP and Apache

  • In command line, install Apache as a service by running this in cmd: httpd -k install
  • Navigate to Apache's configuration directory and open httpd.conf in a text editor
  • Add the following lines

# PHP Stuff #####################################
#
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php


# configure the path to php.ini
PHPIniDir "C:/php"


  • Change the listening port if necessary. You may want IIS to be on 80 and Apache on 8080. Or vice versa
  • Start apache!!!
Install Laravel
  • Download Laravel 4. Search on google. And follow the tutorial on the Tut+ site
  • If you're migrating and seeding the database, you need to add $this->call('TableNameTableSeeder') make the following class:


class TableNameTableSeeder extends Seeder {

    public function run()
    {
        DB::table('tablename')->delete();
        User::create(array(
                'id' => 1,
                'username' => 'firstuser',
                'password' => Hash::make('first_password'),
                'created_at' => new DateTime,
                'updated_at' => new DateTime
        ));   
    }
}


Monday, April 8, 2013

[.NET] Adding POCO Entities in the WCF mix

When you want to separate the domain model such that it is now housed a separate project for other layers/projects to use, you must remove proxy creation and assign the domain object and properties with DataContracts and DataMember attributes.

To remove proxy creation, simply put in the service implementation constructor

DBcontext.ContextOptions.ProxyCreationEnabled = false