3.07.2013

Syntax Highlighter for Blogger using Prettyfy

Adding Prettify Syntax Highlighter to any CMS or webpage is very easy. For Blogger you just need to go to your blog’s Template tab, click “Edit HTML” button and add the below script before </head> tag.
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js">
As you can see that the project is hosted on Google Code. This is an auto-loader which will automatically load the required JavaScript API and the CSS file from the subfolders of SVN. So the last thing that you are left is to mention where it should highlight the codes by adding class="prettyprint" to pre and/or code tags within Blogger Post Editor, HTML view. Here is an example:
<pre class="prettyprint">
$(function() {
 alert('I am using Prettify as Syntax Highlighter');
});
</pre>
There are also some styles available that you can call and load the stylesheet in one URL, here is an example:
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sunburst"></script>

2.27.2013

AraNight - My Color Scheme for Visual Studio

I have been changing my color scheme for Visual Studio.  I have decided to share it at...

http://studiostyl.es/schemes/aranight

2.20.2013

Alternating Colors Table Rows Css

Pure CSS Solution for alternating color rows for a table:

table.MyGrid tr:nth-child(even) {
    background:#ECF4FE;
}

12.13.2012

EF Code First Migrations Error on Foreign Key Constraints

Got this error message: Introducing FOREIGN KEY constraint 'FK_dbo.Emails_dbo.Certificates_CertificateId' on table 'Emails' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

SOLUTION: Change the Up Method of the migration on the ForeignKey field as follows:
.ForeignKey("dbo.Creators", t => t.SenderId, cascadeDelete: false)
.ForeignKey("dbo.Certificates", t => t.CertificateId, cascadeDelete: false)
Change cascadeDelete to false.

11.29.2012

How to Install Windows Service in Server 2008

1.  Open command as administrator
2.  Go to C:\Windows\Microsoft.NET\Framework64\v2.0.50727
3.  Install service:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727>installutil MyNewService.exe
4.  Go to Services: services.msc in cmd and then start the service.
5.  To uninstall.  First stop the service, then do:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727 installutil /u MyNewService.exe

11.19.2012

Cannot truncate table because it is being referenced by a FOREIGN KEY

This would have the same effect as truncate, minus the warning...(be careful, this also deletes all the data of the table referencing this table)
DELETE FROM dbo.Creators DBCC CHECKIDENT ('dbo.Creators',RESEED, 0)

11.16.2012

Set Up Code First Migrations for EF in ASP.NET MVC 4

First open Package Manager Console: Tools > Library Package Manager > Package Manager Console

1.  Go to the project, either the Web Application or if a separate project for Model, then enable the migration as follows:
PM> Enable-Migrations -ContextTypeName ProductCoC.Model.DataContext
This creates a Migration folder within the project root and creates the initial creation classes as well as the Configuration.cs.  Open Configuration.cs and add your seed.

2.  Initialize
PM> Add-Migration Initial
3.  Now, let's update the database:
PM> update-database
4.  If adding a property to the model classes, change the model class then do an add as follows, any arbitrary name will do:
PM> add-migration AddSoldToPartyAndShipToParty
5.  Now do a database update:
PM> update-database