Posts

The Logical Name field in question, is in: Database properties->Files USE [HEALTHCARENEW]; -- Changing Physical names and paths -- Replace all NewMyDB with the new name you want to set for the DB -- Replace 'C:\...\NewMyDB.mdf' with full path of new DB file to be used ALTER DATABASE HEALTHCARENEW MODIFY FILE (NAME = 'HEALTHCARE', FILENAME = 'C:\SQL Database\CSHEALTHCARE.mdf'); -- Replace 'C:\...\NewMyDB_log.ldf' with full path of new DB log file to be used ALTER DATABASE HEALTHCARENEW MODIFY FILE (NAME = 'HEALTHCARE_log', FILENAME = 'C:\SQL Database\CSHEALTHCARE_log.ldf'); -- Changing logical names ALTER DATABASE HEALTHCARENEW MODIFY FILE (NAME = HEALTHCARE, NEWNAME = CSHEALTHCARE); ALTER DATABASE HEALTHCARENEW MODIFY FILE (NAME = HEALTHCARE_log, NEWNAME = CSHEALTHCARE_log);

Set Background Image to UILabel Properly in iOS

How you will set a background image to UILabel. I searching different site and stackoverflow following code is solve my purpose. This code help me set a image and to fit / shrink according to size of UILabel.     UIImage *img = [ UIImage imageNamed : @"yourimage.png" ];     CGSize imgSize =  self . YourLabelName . frame . size ;          UIGraphicsBeginImageContext ( imgSize );     [img drawInRect : CGRectMake (0,0,imgSize. width ,imgSize. height )];     UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext ();     UIGraphicsEndImageContext ();          self . YourLabelName . backgroundColor = [ UIColor colorWithPatternImage :newImage];

iPhone UITextField - Change placeholder text color

We can Change the Placeholder textcolor to any color which you want by using the below code.     UIColor *color = [ UIColor whiteColor ];        self . txtUserName . attributedPlaceholder = [[ NSAttributedString alloc ] initWithString : @"Username" attributes :@{ NSForegroundColorAttributeName : color}];

How to make completely transparent navigation bar in iOS 7 + iOS 8 programticaly

I found the solution from  Stack Overflow  and other site . Solution 01 Objective c self . navigationController . navigationBar setBackgroundImage :[ UIImage new ] forBarMetrics : UIBarMetricsDefault ]; self . navigationController . navigationBar . shadowImage = [ UIImage new ]; self . navigationController . navigationBar . translucent = YES ; self . navigationController . view . backgroundColor = [ UIColor clearColor ]; self . navigationController . navigationBar . backgroundColor = [ UIColor clearColor ]; swift  self . navigationBar . setBackgroundImage ( UIImage (), forBarMetrics : UIBarMetrics . Default ) self . navigationBar . shadowImage = UIImage () self . navigationBar . translucent = true Learn about More UINavigationBar

Generating a random password in php

I am trying to generate a random password in php. I found couple of solution for this . solution 01 use strlen instead of count, because count on a string is always 1 <?php function randomPassword() {     $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";     $pass = array(); //remember to declare $pass as an array     $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache     for ($i = 0; $i < 8; $i++) {         $n = rand(0, $alphaLength);         $pass[] = $alphabet[$n];     }     return implode($pass); //turn the array into a string } echo randomPassword(); ?> Solution 02 <?php function generatePassword ($length = 8) { // start with a blank password $password = ""; // define possible characters - any character in this string can be // picked for use in the password, so if you want to put vowels back in // or add special characters such as exclamation marks, th

Rename a Database and its MDF and LDF files in SQL Server

In Developing a solution or rebuild a solution some time we need to change database rename and it's data file. I found couple of solution in online . I am prefer to use T-SQL . USE [master] --Set Database to Single-User Mode ALTER DATABASE [OLD_DB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE --Rename Database ALTER DATABASE [OLD_DB] MODIFY Name = [NEW_DB] --Set Database to Multi-User Mode ALTER DATABASE [CSLMS] SET MULTI_USER WITH ROLLBACK IMMEDIATE --Rename Logical File Names ALTER DATABASE [NEW_DB] MODIFY FILE (NAME=N'OLD_DB', NEWNAME=N'NEW_DB') ALTER DATABASE [NEW_DB] MODIFY FILE (NAME=N'OLD_DB_log', NEWNAME=N'NEW_DB_log') -- Checking Physical name SELECT name, physical_name FROM [CSLMS].sys.database_files -- Detach Database USE [master] ALTER DATABASE [NEW_DB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE EXEC master.dbo.sp_detach_db @dbname = N'CSLMS' Now we rename the database physi

Restore Sql server Database from .bak file using (T-Sql)

Database  has full backup .bak file. It can be restored using following two steps. Step 1:  Retrive the Logical file name of the database from backup. RESTORE FILELISTONLY FROM DISK = 'D:\BaakUpFile.bak' GO Step 2: If you want replase this existing Database RESTORE DATABASE AdventureWorks FROM DISK = 'D:\BaakUpFile.bak' WITH REPLACE Or Use the values in the LogicalName Column in following Step. ----Make Database to single user Mode ALTER DATABASE DataBaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE ----Restore Database RESTORE DATABASE DataBaseName FROM DISK = 'D:\BaakUpFile.bak' WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf', MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf' /*If there is no error in statement before database will be in multiuser mode. If error occurs please execute following command it will convert database in multi user.*/ ALTER DATABASE DataB