Sign up to create your own snipts, or login.

Public snipts » ludicco's snipts The latest snipts from ludicco.

showing 1-7 of 7 snipts
  • Web.config ASP.NET MVC SQL SERVER/EXPRESS - Development x Production
    <connectionStrings>
      <remove name="LocalSqlServer" />
       <!-- DEVELOPMENT - SQLEXPRESS -->
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=True;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;User Instance=True" providerName="System.Data.SqlClient" />
      
      <!-- PRODUCTION - SQLSERVER -->
      <add name="ApplicationServices" connectionString="Data Source=MACHINE_NAME;Initial Catalog=DataBaseName;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Sep 15, 2009 at 5:57 a.m. EDT
  • C# parameterize for mvc
    private string GenerateURL(string strTitle) 
    { 
    //Trim Start and End Spaces. 
    strTitle = strTitle.Trim(); 
    
    //Trim "-" Hyphen 
    strTitle = strTitle.Trim('-'); 
    
    strTitle = strTitle.ToLower(); 
    char[] chars = @"$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray(); 
    strTitle = strTitle.Replace("c#", "C-Sharp"); 
    strTitle = strTitle.Replace("vb.net", "VB-Net"); 
    strTitle = strTitle.Replace("asp.net", "Asp-Net"); 
    
    //Replace . with - hyphen 
    strTitle = strTitle.Replace(".", "-"); 
    
    //Replace Special-Characters 
    for (int i = 0; i < chars.Length; i++) 
    { 
    string strChar = chars.GetValue(i).ToString(); 
    if (strTitle.Contains(strChar)) 
    { 
    strTitle = strTitle.Replace(strChar,string.Empty); 
    } 
    } 
    
    //Replace all spaces with one "-" hyphen 
    strTitle = strTitle.Replace(" ", "-"); 
    
    //Replace multiple "-" hyphen with single "-" hyphen. 
    strTitle = strTitle.Replace("--", "-"); 
    strTitle = strTitle.Replace("---", "-"); 
    strTitle = strTitle.Replace("----", "-"); 
    strTitle = strTitle.Replace("-----", "-"); 
    strTitle = strTitle.Replace("----", "-"); 
    strTitle = strTitle.Replace("---", "-"); 
    strTitle = strTitle.Replace("--", "-"); 
    
    //Run the code again... 
    //Trim Start and End Spaces. 
    strTitle = strTitle.Trim(); 
    
    //Trim "-" Hyphen 
    strTitle = strTitle.Trim('-'); 
    
    return strTitle; 
    } 
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Sep 12, 2009 at 4:28 p.m. EDT
  • ASP MVC MS SQL Fix in Webconfig
    in web.config
    Under the ...<system.web>
        <identity impersonate="true" userName="ludicco" password="s4lv4d0rd4l1" />
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Sep 11, 2009 at 12:30 p.m. EDT
  • IIS7 start
    Open the applicationHost.config file, located here: %windir%\system32\inetsrv\config\applicationHost.config
    
    In my instance, I need to edit the "handlers" section.
    
    Change this line:
    
    <section name="handlers" overrideModeDefault="Deny" />
    
    To:
    
    <section name="handlers" overrideModeDefault="Allow" />
    
    
    %windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers
    
    appcmd unlock config -section:system.webServer/modules
    
    
    on ISS activate modules to run ISAP FastCGI ASP.NET etc...
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Aug 24, 2009 at 2:43 p.m. EDT
  • Bless CD To be opened automatically on mac when inserted
    sudo bless -folder "/Volumes/VolumeName/" -openfolder "/Volumes/VolumeName/"
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Aug 19, 2009 at 9:55 a.m. EDT
  • Run DB Migrate on production
    rake db:migrate RAILS_ENV=production
    

    copy | embed

    0 comments - tagged in  posted by ludicco on Jul 15, 2009 at 6:23 a.m. EDT
  • Ruby FTP Server Files Transfer
    require 'net/ftp'
    
    ftp = Net::FTP.new('example.com')
    ftp.login(user = "****", passwd = "****")
    ftp.putbinaryfile("/data/images/myimage.jpg", File.basename( "/data/images/myimage.jpg" ))
    ftp.quit()
    
    #passive mode (works on railsmachine, heroku, etc)
    
    ftp = Net::FTP.open("ftp.example.com") do |ftp|
      ftp.login(user = "*****", passwd = "*****")
      ftp.passive = true
      ftp.putbinaryfile("public/data/myimage.jpg", File.basename( "myimage.jpg" ))
      ftp.quit()
    

    copy | embed

    0 comments - tagged in  posted by ludicco on May 24, 2009 at 4:59 p.m. EDT
Sign up to create your own snipts, or login.