Tuesday, August 11, 2015

How to get rid of those SharePoint Authentication Prompts

FYI:
This isn’t SharePoint specific, however Im sure the same process could be used to save credentials for other web apps that use Windows Authentication, the below article shows how to get rid of that pesky Login prompt in SharePoint that I continuously get when editing MS Office docs in SharePoint,

It seems like every time I click to open or download an Office file in SharePoint I kept getting prompted to login after I had already checked the check box “Remember My Credential” which never seemed to work for me….Well this article worked for me, Now I don’t have to enter my UID/PWD every time I open a doc in SharePoint….Yay!

I tried this in SP2010 / IE11

Thanks!




Friday, August 7, 2015

Remoting Computing Tools: How to Awake & Sleep on schedule, KeepAlive by Mouse and Remote Awake with magic packets

Will update links shortly, below I document my current setup/tasks to awake, sleep keep alive computer for daily work, this allows me to do other tasks while these automated redundant daily shores are done for me on schedule, TimeSaved = TimeEarned,

Tools Used:
Move Mouse
NirCmd
taskkill.exe (a simple exe to call kil process by exe name or NirCmd)

1. Schedule a Sleep:

2. Schedule an Alive

3. Keep Alive with Move Mouse


4. Magic Packets using router and util
See this great article here using WakOnLoan

Monday, August 3, 2015

Improve DataObject Serialization Performance and the Gotchas

While working on a custom reporting app I came across a little ADO.Net serialization gotcha, when we use WriteXML() and ReadXML for serializing a DataSet to stream, any column with null values in all rows will be magically removed from the de-serialization! Ina  service arena, this probably isn't an issue, however when dealing with service consumers that include CSV output for users or HTML, dropping columns is a big NO NO, at least to a user, Yes the data is blank, and who really cares to look at a blank column, well report users LOVE their columns and having one disappear will result in a bug task.

After digging around, I found this stackoverflow that describes the issue, with an old invalid KB reference. The solutions remarked here are not really attractive by any means, certainly not looping over a result set just to add a String DataColumn with Empty string , yuck, Im gonna try a little Hack just to get by today: If DataTable.Rows.Count > 0, then for each DataColumn that is DBNull, set to empty string to see if that works for me. Better yet, after looking at the .Net FW, there's a param avail with 3.5+ (I believe) that does the trick:

 //convert to xml with the DataSet schema:
        StringWriter writer = new StringWriter();
        ds.WriteXml(writer, XmlWriteMode.WriteSchema);
        string xml = writer.ToString();

What the impact is on the string size Im not sure, will need to test performance before and after,

In peruzing related articles I came across a better final solution which will involve switching over to JSON, this article is a good ref for that:

8 ways to improve ASP.NET Web API performance
http://blog.developers.ba/8-ways-improve-asp-net-web-api-performance/

Lightweight DataTable Serialization
http://blogs.msdn.com/b/shitals/archive/2009/12/04/9932598.aspx




Monday, July 20, 2015

Disable Windows 10 Update Pesky Notifications

On Win7, here are steps I did to remove this painful Win10 update notification that kept popping up due to an implicit (not invited) windows update, Accidentally enabling Windows Update caused MS to install this pesky troll on my machine and Im sure U may encounter the same (I am not sure if Win8 although I assume is the same) on a Win8(.x) box:

1. Go to C:\Windows\System32\GWX take ownership to urself/admin account
2. Set permissions to Full Control Everyone
3. Kill any GWX.exe process via task manager or akin,
4. Rename the folder C:\Windows\System32\GWX to C:\Windows\System32\GWX.old\
5. Delete the Tasks under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks
- backup of course this reg key
- search for *gwx*
- delete subkeys
See here for more details
6. Delete C:\Windows\System32\GWX.old\

Saturday, July 18, 2015

Thursday, July 16, 2015

Write to Event Log: Examples in C#, CMD, SQL, PS1, WMI

Couple ways to log to event log, then we can use simple filtering and alerts in EvtViewer to create a quick and dirty notification sub-system in case we dont have time to implement notifications in an app or we are using an existing app such as a COTS product, See here

Log to Event Log using:

CMD 
using eventcreate:
eventcreate /ID 755 /L APPLICATION /T INFORMATION  /SO BACKUP /D "My first log"

C# System.Diagnostics
 System.Diagnostics.EventLog.WriteEntry(source,
                        message,
                        ConvertTraceType(type),
                        eventId);

c# MS App Blocks
Logger.Write(message, LogSources.CheckSource(source), Priority.Normal, eventId, type, title, dictionary);

Logger.Write(ex, LogSources.DefaultSource(), Priority.High,
                    eventid, TraceEventType.Error, title , dictionary);

PS check source, create 
if ([System.Diagnostics.EventLog]::SourceExists($mysource) -eq $false) {
    [System.Diagnostics.EventLog]::CreateEventSource($mysource, "Application")

}

PS  log
Write-EventLog -LogName "Application" -Source $mysource -EntryType Information -EventID 100 -Message "Start logging!"
Write-EventLog –LogName Application –Source “My Script” –EntryType Information –EventID 1
 –Message “This is a test message.”

WMI
strEventDescription = "Payroll application could not be installed on " _ 
    & objNetwork.UserDomain & "\" & objNetwork.ComputerName _ 
        & " by user " & objNetwork.UserName & _
            ". Free space on each drive is: " & strDriveSpace
objShell.LogEvent EVENT_FAILED, strEventDescription
SQL (T-SQL)
  DECLARE @msg VARCHAR(100)      SELECT @msg = ERROR_Message()
    RAISERROR(@msg, 11, 1) WITH LOG
-- OR
USE master;
EXEC xp_logevent 60000, @@MESSAGE, informational
C# Ent Logging Detail:
public void EntLoggingTest03()
        {
            try
            {
                LogEntry entry = new LogEntry();
                //entry.ActivityIdString = "ActivityIdString";
                entry.AppDomainName = "AppDomainName";
                //entry.Categories.Add("DTech Data Services NOC Services");
                entry.Categories.Add(SOURCE);
                //entry.ErrorMessages = "ErrorMessages";
                entry.EventId = (int)LogEventID.FileRouterEventID.FileRouterError;
                Dictionary<stringobject> dictionary = new Dictionary<stringobject>();
                dictionary.Add("ZipFile""1.zip");
                dictionary.Add("ZipURI"@"C:\Tamepo");
                entry.ExtendedProperties = dictionary;
                //entry.LoggedSeverity = "LoggedSeverity";
                entry.MachineName = "Me";
                entry.Message = "a msg";
                entry.Priority = 1;
 
                entry.ProcessName = "DTech.Util.Data.Test?";
                entry.Severity = TraceEventType.Warning;
 
                Logger.Write(entry);
 
                //                throw new ArgumentException("InsertEventLogErrorTest00 EXCEPTION");
            }
            catch (Exception ex)
            {
 
                handleException(ex);
            }
            Assert.IsTrue(true);
        }
How to use EntLib (old directions)
 /// 1) Download April or May 2007 Enterprise Lib : 
    ///     URL : http://msdn.microsoft.com/en-us/library/aa480453.aspx

    ///     
    /// Steps to use Ent Lib Logging!
    /// 1) Open your or add an app.config to your app.
    /// 2) Add Reference to 
    ///     Microsoft.Practices.EnterpriseLibrary.Logging (C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Bin\)
    ///     Microsoft.Practices.EnterpriseLibrary.Common.dll: (C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Bin\)
    ///     Microsoft.Practices.EnterpriseLibrary.Data.dll: C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Bin\
    /// 3) Open your App.Config and the App.Config from this app (DTech.Logging.Test.config)
    /// 4) Copy the following from this app's App.config to your App.config
    ///         - /configuration/configSections 
    ///         - /configuration/loggingConfiguration
    ///  5) Open the Ent Lib Config Tool: EntLibConfig.exe : "C:\Program Files\Microsoft Enterprise Library 3.0 - April 2007\Bin\
    ///         - Open your app.config and go to Logginng Application Block|Category Sources

    ///  6) You are now done and your app is ready to use the Entreprise Library Logging Block!
    ///  
    /// Why should you use Ent Lib for Logging?
    /// 1) Saves time
    /// 2) Easy to use
    /// 3) Change logging destination without change to code
    /// 4) Only need to reference 3 dll's to work
    /// 5) Log to DB and Event log with ease
    /// 6) Consistent and stable design
    /// 7) Your app will have an automatic UI to manage your config file.
    /// 8) Administration of Logging Destination via Rich UI, no need to change code
    /// 9) Extensible

Sunday, July 5, 2015

Private Cloud: How to use our home cloud

I ended up getting a 4TB Sea-gate cloud NAS (Network Attached Device) after a somewhat arduous setup, which included setting up the private shares and remote access, I got the opportunity to start adding the shares for our home network, To make it easier for the family, I have create the following simple guide and video for the family which shows set by step how to access the cloud from you home computer,

A summary of the steps is as follows:

Access Cloud from Home Computer:
1) Open windows explorer
2) Click Network
3) Click DoyleCloud
4) You will see a folder with your name (Private Share) and a Public folder.
5) To access your private share, click on the folder and you will be prompted with network login,
this where you will enter your network cloud login for example :
User Name: DoyleCloud\Jadon
Password: #####\

Here is a link to a video that shows step by step:



Access Cloud from Web (on the road)
1. Browse to https://remoteaccess.tappin.com/login
2. Enter your remote cloud login
3. You can now access your private folder and Public share !
4. You will see the below screen (should)