Monday, June 15, 2015

Populate an array

I needed a quick array of the integers to represent calendar years for use with a phone app.
The solution was quite simple using the range.enumerate method

DateTime start = DateTime.Now.AddYears(-40);
DateTime end = DateTime.Now.AddYears(40);
return Enumerable.Range(start.Year, end.Year - start.Year).ToArray();

Friday, June 12, 2015

Problem Step Recorder

Microsoft PFE turned me onto this little tool built in to windows. 

Run>psr

This bring up the problem step recorder.  This will record a session with screen caps and comments.  This eases the whole documentation rig-a-moroll.

IOS iPhone Simulator killing a running app

Problem:
Running my new app in the simulator and each time I start it up it defaults to the latest screen.
This is by design as it starts up where you  left off.  I need to give a demo and need to get it to start at their first screen.  How do I kill the session in memory?

Solution:
For iOS 7 & 8:
  • shift+command+H twice to simulate the double tap of home button
  • swipe your app's screenshot upward to close it
Source
http://stackoverflow.com/questions/18519799/ios-simulator-how-to-close-an-app

Wednesday, June 3, 2015

SSL cert binding in IIS 7.5

Trying to add an SSL Binding in IIS 7.5 with the GUI and realized that there is a bug in the process.
If you use the GUI the cert will be installed incorrectly. Use the following command lines to install your cert correctly.



Run the following commands from the C:\Windows\System32\inetsrv directory:
1. Open powershell as admin

2. Open netsh shell and Issue http verb
• Netsh
• http
• nesh http> add sslcert ipport=XXX.XXX.XXX.171:443 appid={4dc3e181-e14b-4a21-b022-59fc669b0914} certhash=69c04af8588ec65762de96ddd51d78fa6e47c692 certstorename=MY


3. Appcmd set site /site.name:”<SITE_NAME>” /+”bindings.[protocol=’https’,bindingInformation=’<IP_ADDRESS>:443:<HOST_NAME>’]”

Error:
Cannot find site object with the identifier bindingInformation

Fix:
Add double quotes around the bindings command

  ./appcmd set site /site.name:update.com  /+"bindings.[protocol='https',bindingInformation='XXX.XXX.XXX.171:443:update.com']"

Source:
  1. Netsh
  2. AppCmd
  3. http://stackoverflow.com/questions/9616722/error-using-appcmd-to-add-ssl-binding
  4. http://stackoverflow.com/questions/779228/the-parameter-is-incorrect-error-using-netsh-http-add-sslcert

DISA PKI and PKE Tools

This tool allows users to install DoD production PKI, Joint Interoperability Test Command (JITC) test PKI, and External Certification Authority (ECA) CA certificates into their Windows and Firefox certificate stores. InstallRoot 4.1 is packaged with a command line version as well as an InstallRoot service, which can check for updated Trust Anchor Management Protocol (TAMP) messages that contain the latest certificate information from DoD. The following operating systems are supported: Windows XP, Windows Vista, Windows 7, Windows 8 and 8.1, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2.



Source:
http://iase.disa.mil/pki-pke/Pages/tools.aspx

Wednesday, May 13, 2015

Get SQL management Studio installed on a STIGGed box

Problem:
My work system is locked down but I have the responsiblity to manage several SQL servers and to develop TSQL for my projects.  Sounds like a job for SQL Managment Studio, heh?  Well not if you
want to get SeDebugPrivilege on your work box!!!!!  GPOs denied my account this priv so no love running the exe package.

Solution:

1.) Download the bits:

en_sql_server_2012_express_management_studio_with_service_pack_2_x86_4385973.exe

2.) Add your admin account to local admins group on the box where you want to use MS.
3.) Grab a copy of ntrights.exe 2012,

4.) Run cmd.exe as elevated admin account.
5.) Execute this command in the cmd session

ntrights.exe -u "BUILTIN\Administrators" +r SeDebugPrivilege
 
6.)Now run the exe you downloaded in step 1.
 
Your done!
 
 
Source:
1.)http://pwrshell.net/attribuer-des-privileges-locaux/
2.)NtRights.exe is part of Windows Resource Kit.
 

Thursday, May 7, 2015

How to Wrap Text in a Monotouch/Xamarin UILabel

Doing some UI work on our iPhone app and still trying to remember what the UI supports.
I had an issue with how to wrap text in a UILabel field.  Fortunately, Xamarin forums has some great recipes.

What I needed was (UILineBreakMode.WordWrap)

Solution

var descriptionField = new UILabel(new RectangleF(10, 45, 300, 140));
descriptionField.LineBreakMode = UILineBreakMode.WordWrap;
descriptionField.Lines = 10;
descriptionField.BackgroundColor = UIColor.Gray;
Add(descriptionField);


Source:
http://developer.xamarin.com/recipes/ios/standard_controls/labels/uilabel-truncate-wrap-text/