Install Microsoft .NET Framework 3.5 Offline in Windows 8/8.1

To install .NET Framework 3 in offline mode on Windows 8, you need your installation iso / flashdisk drive with the windows installation or windows installation cd, then type this on Command Prompt with admin

1
Dism /online /enable-feature /featurename:NetFx3 /All /Source:F:\sources\sxs /LimitAccess

type the drive where your windows installation is located, for my case it’s in drive F.

Give it a try 😀

Register .NET in IIS

I always forgot how to register .Net in IIS so i will write it here

The following command installs the ASP.NET version associated with the tool and updates the script maps of all existing ASP.NET applications. Note that only applications that are currently mapped to an earlier version of ASP.NET are affected.

type this in command prompt

1
Aspnet_regiis -i

for full information can be seen in http://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=vs.71%29.aspx

Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’

Today suddenly i can’t run my website project and show this error

Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’

When attempting to run a service that receives messages over the HTTP transport, you may receive an error similar to the following:

Server Error in ‘/WCFApplication’ Application

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

Description: An unhandled exception occurred during the execution of the current Web request. Review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

and as ussualy i search google and find the solution, i just need to type aspnet_regiis.exe -iru in command prompt at .NET framework 4.0 folder

Convert Decimal to Roman with MSSQL

Today I got assignment to make ms sql function to convert decimal to roman numeral
here’s the code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Function DecToRom
(
    @InputNumber as varchar(MAX)
)
RETURNS varchar(MAX)
AS
BEGIN
  DECLARE @Hasil varchar(MAX), @RomanLetter varchar(7), @InputTemp bigint, @Posisi int, @Mod bigint
 
  SET @Hasil = ''
  SET @RomanLetter = 'IVXLCDM'

  IF @InputNumber = 0
        SET @Hasil = '0'
  ELSE
  BEGIN
    SELECT @Posisi = 1, @InputTemp = ABS(@InputNumber)
   
    WHILE(@Posisi <= 5)
    BEGIN
        SET @Mod = @InputTemp % 10
        SET @InputTemp = @InputTemp / 10
       
        SELECT @Hasil = CASE
         WHEN @Mod IN (0,1,2,3) THEN        
           Replicate( SubString( @RomanLetter, @Posisi, 1 ), @Mod ) + @Hasil
         WHEN @Mod IN (4) THEN
           SubString( @RomanLetter, @Posisi, 2 ) + @Hasil
         WHEN @Mod IN (5,6,7,8) THEN
           SubString( @RomanLetter, @Posisi + 1, 1 ) +
           Replicate( SubString( @RomanLetter, @Posisi, 1 ), @Mod - 5 ) + @Hasil
         WHEN @Mod IN (9) THEN
           SubString( @RomanLetter, @Posisi, 1 ) + SubString( @RomanLetter, @Posisi + 2, 1 ) + @Hasil
        END
         
        SET @Posisi = @Posisi + 2
    END
   
    SET @Hasil = Replicate('M', @InputTemp) + @Hasil
   
    IF @InputNumber < 0
        SET @Hasil = '-' + @Hasil
       
   END

   RETURN @Hasil
END
GO

credit to sql-bi-dev