Flicker Images

Find programmers and grapic design experts at ScriptLance.com

Friday, July 28, 2017

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);
Share:

Tuesday, September 29, 2015

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];
Share:

Friday, September 11, 2015

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}];
Share:

Tuesday, June 16, 2015

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

Share:

Wednesday, November 13, 2013

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, this is where
    // you should do it
    $possible = "2346789bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ";

    // we refer to the length of $possible a few times, so let's grab it now
    $maxlength = strlen($possible);
  
    // check for length overflow and truncate if necessary
    if ($length > $maxlength) {
      $length = $maxlength;
    }
	
    // set up a counter for how many characters are in the password so far
    $i = 0; 
    
    // add random characters to $password until $length is reached
    while ($i < $length) { 

      // pick a random character from the possible ones
      $char = substr($possible, mt_rand(0, $maxlength-1), 1);
        
      // have we already used this character in $password?
      if (!strstr($password, $char)) { 
        // no, so it's OK to add it onto the end of whatever we've already got...
        $password .= $char;
        // ... and increase the counter by one
        $i++;
      }

    }

    // done!
    return $password;

  }

?>

solution 03


<?php
 
function generatePassword($length=9, $strength=0) {
    $vowels = 'aeuy';
    $consonants = 'bdghjmnpqrstvz';
    if ($strength & 1) {
        $consonants .= 'BDGHJLMNPQRSTVWXZ';
    }
    if ($strength & 2) {
        $vowels .= "AEUY";
    }
    if ($strength & 4) {
        $consonants .= '23456789';
    }
    if ($strength & 8) {
        $consonants .= '@#$%';
    }
 
    $password = '';
    $alt = time() % 2;
    for ($i = 0; $i < $length; $i++) {
        if ($alt == 1) {
            $password .= $consonants[(rand() % strlen($consonants))];
            $alt = 0;
        } else {
            $password .= $vowels[(rand() % strlen($vowels))];
            $alt = 1;
        }
    }
    return $password;
}
 
?>
Share:

Monday, July 15, 2013

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 physical files using Windows Explorer;
 
--Attach Database
USE [master]
CREATE DATABASE [NEW_DB] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\NEW_DB.mdf'),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\NEW_DB_log.ldf')
 FOR ATTACH
  
Successfully execute above sql we can easily rename database name and data files.
Share:

Thursday, May 30, 2013

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 DataBaseName SET MULTI_USER
GO

If you want make new
RESTORE DATABASE DataBaseName
FROM DISK = 'D:\BaakUpFile.bak'
WITH MOVE 'DataBaseName' TO 'database location ... DataBaseName.mdf',
MOVE 'DataBaseName_log' database location ... DataBaseName_log.ldf'


Collect from : blog.sqlauthority.com
Share:

Game Reviews

BTemplates.com

Powered by Blogger.

The Logical Name field in question, is in: Database properties->Files USE [HEALTHCARENEW]; -- Changing Physical names and paths -- R...

Search This Blog

Video Of Day

Find Us OIn Facebook

Blogroll

Contact

Tackle the Web with up to 5 new .COMs, $5.99 for the 1st year!

Advertisement