Public snipts »
ludicco's
snipts
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>
-
∞ 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; }
-
∞ ASP MVC MS SQL Fix in Webconfig
in web.config Under the ...<system.web> <identity impersonate="true" userName="ludicco" password="s4lv4d0rd4l1" />
-
∞ 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...
-
∞ Bless CD To be opened automatically on mac when inserted
sudo bless -folder "/Volumes/VolumeName/" -openfolder "/Volumes/VolumeName/"
-
∞ Run DB Migrate on production
rake db:migrate RAILS_ENV=production
-
∞ 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()



Python in a Nutshell, Second Edition