Monday, June 10, 2013

[Android] Clearing previous activities and opening a new one

So maybe you want to close the Welcome Screen as well as the Login Screen when you get to the screen after a successful login. Here are the flags to pass:

Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK

If you look around, people may suggest 

Intent.FLAG_ACTIVITY_CLEAR_TOP
but this didn't do the job.

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

Sunday, February 10, 2013

Asus G75VW Boot Recovery. Formatting is not an option!!!!!

Hey guys,
I just got a new Asus G75VW with Windows 7 Ultimate loaded (in place of Home Premium). I do not have an Ultimate disk nor the Home Premium (except for the CD key in the bottom of the laptop). The current Windows was booting by EFI so this was going to be a special solution.

I completely f'd up my Asus G75VW laptop by messing with EasyBCD. In detail, I messed up by using EasyBCD 1.6, since adding a new entry has the ability to choose Generic x86 as the boot type or whatever. I needed this option because lots of hackintosh tutorials used this. Turns out, EasyBCD 1.6 is not supported by Win7. I loaded some defaults with EasyBCD, saved it, and restarted my computer. NOW YOU CAN POUND ME INTO A PANCAKE!!!!!

So when I boot, windows boot manager loads into an error screen that says something is wrong with the BCD. The location was either of the error was either (forgot which displayed first):

/EFI/Microsoft/Boot/BCD

or

/Boot/BCD


So, what are my options? A. Fix the boot for Windows Ultimate. B. Format the drive with Windows Home Premium. I opted for A: So what worked and what didn't?

- When doing a search, I found a lot of people suggest using the Repair disk in the Windows Install DVD. This DID NOT WORK....yet. Something about being EFI bootable will show an incompatibility error no matter which Windows disk I used.

Then I downloaded the Hiren Boot CD 15.2!!!!

- Then I used DiskGenius, which was part of the CD. This may work for some, but it totally f'd up my BCD. Refer to here:

http://www.sevenforums.com/installation-setup/228504-missing-boot-manager-4.html

Using it pretty much just made the whole drive unallocated, although the partitions were still there, but lost.

- Then I used Partition Recovery Wizard, another utility in the CD. I basically used this to find partitions and repair it. It successfully did.

- Now when I restarted the computer, it would say BootMgt is missing.

- So I popped in a Windows 7 disk. At the installation screen, I pressed shift+f10 to go to the command line and I ran all the bootrec commands. It successfully did.This also assigned a drive to the BCD. So you when you run bcdedit in command line, you see "partition=c:" instead of {unknown}

- I believe it still didn't boot then. So now I booted up the Windows 7 Ultimate DVD and hit the repair disk option. Finally!!! It passed the incompatibility error. Now all I did was choose the option to fire up the Startup Recovery.

- When I booted, now there are 2 options for this drive. To boot off the Windows Boot Manager or the drive itself. The boot manager, I believe, boots off the EFI partition. This will obviously create an error since I did not fix this. So if I boot off the hard drive itself, it will FINALLY LOAD INTO WINDOWS! YA!

Conclusion:

I know this was not a clean fix, since I converted from EFI to MBR boot (or is it GPT or MBR boot?). Anyways, I am not a claimed IT, hardware expert either. But I'm just glad this thing is finally working.