Thursday, May 21, 2015

Making a round lable

//width and height are twice of  layer.cornerRadius

label.frame = CGRectMake(0, 0, 100, 100);
label.center = CGPointMake(160, 240);
label.alpha = 0.0;
   
  label.layer.cornerRadius = 50;
  label.clipsToBounds = YES;

Tuesday, April 7, 2015

Composite pattern

A design pattern that solves this kind of structural problem is
called the Composite patternWith the Composite pattern,  we can compose our strokes and dots into a tree structure
so that we can treat each of the nodes uniformly.

Friday, April 3, 2015

Observation Pattern in Objective-C

There are three steps to using key-value observation:

Send the addObserver:forKeyPath:options:context: message
to each object that is being observed.

Override the method observeValueForKeyPath:ofObject:chan
ge:content: in the class definition of the object that is doing the
observing.

Override the dealloc method and remove the observer reference

in the class definition of the object that is observing.

Thursday, February 12, 2015

The following are some high-level, conceptual questions to develop of Axure

• How is information organized and accessed on each screen in the case of Information Architecture?
• Where and how are key task flows initiated and ended?
• What are the main navigation systems?
• What common elements are shared across screens?
• How are common elements affected by a device size?

Tuesday, November 4, 2014

Xampp version on Windows



Add this line to xampp\phpmyadmin\config.inc.php

$cfg['ExecTimeLimit'] = 6000;

And Change xampp\php\php.ini to

post_max_size = 750M

upload_max_filesize = 750M

max_execution_time = 5000

max_input_time = 5000

memory_limit = 1000M

And change xampp\mysql\bin\my.ini

max_allowed_packet = 200M

Tuesday, September 2, 2014

Choosing a data format for Javascript

HTML snippets require very little work to implement. The external data can be loaded
and inserted into the page with one simple method that does not even require a
callback function. No traversal of the data is necessary for the straightforward task
of adding the new HTML into the existing page. On the other hand, the data is not
necessarily structured in a way that makes it reusable for other applications. The
external file is tightly coupled with its intended container.

JSON files are structured for simple reuse. They are compact and easy to read. The
data structure must be traversed to pull out the information and present it on the
page, but this can be done with standard JavaScript techniques. Since modern
browsers parse the files natively with a single call to JSON.parse(), reading in a
JSON file is extremely fast. Errors in the JSON file can cause silent failure or even
side effects on the page, so the data must be crafted carefully by a trusted party.

JavaScript files offer the ultimate in flexibility, but are not really a data storage
mechanism. Since the files are language-specific, they cannot be used to provide
the same information to disparate systems. Instead, the ability to load a JavaScript
file means that behaviors that are rarely needed can be factored out into external
files, reducing code size unless and until it is needed.

While XML has fallen out of favor in the JavaScript community, with most developers
preferring JSON, it is still so common that providing data in this format makes it very
likely that the data can be reused elsewhere. Indeed, many web services, such as Yahoo
Weather (http://developer.yahoo.com/weather/), export XML representations
of their data, which has allowed many interesting mashups of their data to arise. The
XML format is somewhat bulky, and can be a bit slower to parse and manipulate than
other options.

Tuesday, August 26, 2014

fadeIn() VS slideDown

The fading animations are very useful for items that are outside the flow of the
document. For example, these are typical effects to apply to "lightbox" elements
that are overlaid on the page. However, when an element is part of the document
flow, calling .fadeIn() on it causes the document to jump to provide the real estate
needed for the new element, which is not always aesthetically pleasing.

Friday, August 15, 2014

Convert DMG to CDR or ISO with Disk Utility

hdiutil convert /path/imagefile.dmg -format UDTO -o /path/convertedimage.iso

hdiutil convert /path/imagefile.cdr -format UDTO -o /path/convertedimage.iso

Friday, August 1, 2014

JavaScript Tips

In JavaScript, functions are objects.

Function arguments are the real values received by the function when it is invoked.

Friday, October 25, 2013

Using a self-signed ssl certificate for SSRS 2008 R2

1. Open IIS 7, click on the computer you wish to create the certificate for.  In the Content View double click on Server Certificates.
2. The top right has an “Actions” menu.  Click on “Create self-signed Certificate Request”
3. Type in a name for your certificate .
4.  Launch Reporting Services Configuration Manager, go to “Web Service URL”, select your newly created SSL certificate from the list and click apply.

Wednesday, October 2, 2013

Check the enforced password expiration setting of all users on SQL Server


select name,is_expiration_checked
from sys.sql_logins
where is_expiration_checked=1

Monday, September 16, 2013

SQL Server Trace Files (Database Schema Chang History)

EXEC master.dbo.sp_configure 'allow updates', 1;
GO
EXEC master.dbo.sp_configure 'show advanced options', 1;
GO
EXEC master.dbo.sp_configure 'default trace enabled', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO

SELECT * FROM sys.configurations WHERE configuration_id = 1568

SELECT * FROM ::fn_trace_getinfo(0)

SELECT   * FROM sys.traces
WHERE id = 1;

Wednesday, June 26, 2013

How to Find the Original Install Date and Time of Windows OS

 cmd /k systeminfo | find "Original Install Date" 

Wednesday, June 19, 2013

Checking SET Options for the Current Session in SQL Server

DECLARE @options INT

SELECT @options = @@OPTIONS

PRINT @options
IF ( (1 & @options) = 1 ) PRINT 'DISABLE_DEF_CNST_CHK'
IF ( (2 & @options) = 2 ) PRINT 'IMPLICIT_TRANSACTIONS'
IF ( (4 & @options) = 4 ) PRINT 'CURSOR_CLOSE_ON_COMMIT'
IF ( (8 & @options) = 8 ) PRINT 'ANSI_WARNINGS'
IF ( (16 & @options) = 16 ) PRINT 'ANSI_PADDING'
IF ( (32 & @options) = 32 ) PRINT 'ANSI_NULLS'
IF ( (64 & @options) = 64 ) PRINT 'ARITHABORT'
IF ( (128 & @options) = 128 ) PRINT 'ARITHIGNORE'
IF ( (256 & @options) = 256 ) PRINT 'QUOTED_IDENTIFIER'
IF ( (512 & @options) = 512 ) PRINT 'NOCOUNT'
IF ( (1024 & @options) = 1024 ) PRINT 'ANSI_NULL_DFLT_ON'
IF ( (2048 & @options) = 2048 ) PRINT 'ANSI_NULL_DFLT_OFF'
IF ( (4096 & @options) = 4096 ) PRINT 'CONCAT_NULL_YIELDS_NULL'
IF ( (8192 & @options) = 8192 ) PRINT 'NUMERIC_ROUNDABORT'
IF ( (16384 & @options) = 16384 ) PRINT 'XACT_ABORT'

http://www.mssqltips.com/sqlservertip/1415/determining-set-options-for-a-current-session-in-sql-server/

Monday, June 17, 2013

Plan cache and optimizing for adhoc workloads (fixing plan cache bloat problem)

SELECT objtype AS [CacheType]
        , count_big(*) AS [Total Plans]
        , sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
        , avg(usecounts) AS [Avg Use Count]
        , sum(cast((CASE WHEN usecounts = 1 THEN size_in_bytes ELSE 0 END) as decimal(18,2)))/1024/1024 AS [Total MBs - USE Count 1]
        , sum(CASE WHEN usecounts = 1 THEN 1 ELSE 0 END) AS [Total Plans - USE Count 1]
FROM sys.dm_exec_cached_plans
GROUP BY objtype
ORDER BY [Total MBs - USE Count 1] DESC
go

Turn "Optimize for Ad Hoc Workloads" on

http://www.sqlskills.com/blogs/kimberly/plan-cache-and-optimizing-for-adhoc-workloads/

Thursday, May 23, 2013

enables the SQL Server Agent extended stored procedures in SQL Server 2012


The possible values are:

0, indicating that SQL Server Agent extended stored procedures are not available (the default).

1, indicating that SQL Server Agent extended stored procedures are available.


The following example enables the SQL Server Agent extended stored procedures.

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Agent XPs', 1;
GO
RECONFIGURE
GO

Thursday, April 4, 2013

Installing Web Front End Only requires install from command line


If you want to install just a web front end, you have to run the install from the command line. 

Follow the instructions at http://technet.microsoft.com/en-us/library/cc262897.aspx and create a config file for server type="WFE"

Thursday, March 28, 2013

Allowing other machines to use filesharing via the DNS Alias in Windows OS


Allowing other machines to use filesharing via the DNS Alias (DisableStrictNameChecking)

This change alone will allow other machines on the network to connect to the machine using any arbitrary hostname. (However this change will not allow a machine to connect to itself via a hostname, see BackConnectionHostNames below).

    Edit the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters and add a value DisableStrictNameChecking of type DWORD set to 1.

    Edit the registry key (on 2008 R2) HKLM\SYSTEM\CurrentControlSet\Control\Print and add a value DnsOnWire of type DWORD set to 1

Wednesday, March 20, 2013

SSIS Services 32 and 64 bit with Oracle Clients

Win2003+ SQL2005SSIS + two Oracle Homes (32,64bit)

Win2008+SQL2005SSIS + two Oracle Homes (32,64bit)

Win2008+SQL2008SSIS +One Oracle Home (32,64bit)

Tuesday, March 19, 2013

Rebuild System databases on SQL 2005

start /wait "T:\Installation\SQL 2005 64Ent\Disk1\setup.exe" /qn INSTANCENAME=PROD REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=1.uwsw0542