Sunday, July 17, 2016

Anonymous User Acces to SharePoint

In addition to having to follow the standard process to enable web application's anonymous access:

I had to do a few PowerShell commands to make anonymous access perform most activities on SharePoint without limitation.

1) Modify the root webs anonymous permission mask (you can reduce the access here too)

web.AnonymousPermMask64 = "FullMask"

2) Allow client calls for anonymous users

$webApp = Get-SPWebApplication
$webApp.ClientCallableSettings.AnonymousRestrictedTypes.Remove( [Microsoft.SharePoint.SPList],"GetItems")

3) I also had to enable iframes for other sites to point to my SharePoint forms

Monday, July 28, 2014

T-SQL Set Recovery Mode to Simple and Truncate Log Files

I used this script to change the current recovery mode on a SQL server to simple from full recovery.

For new databases, update the system database named 'model' as this is the database template used for all new databases. Setting the recovery mode to simple on this database wi

USE master
rowNum int identity (1,1),
dbname sysname NOT NULL )
FROM sys.databases
WHERE state=0 AND user_access=0 and has_dbaccess(name) = 1
ORDER BY [name]
DECLARE @EndCount int;
SELECT @EndCount = count(*) FROM @DbNames
DECLARE @RowCounter int;
SELECT @RowCounter = 1;
DECLARE @DbName varchar(155);
DECLARE @sql varchar(2000);
WHILE (@RowCounter <= @EndCount)
SELECT @DbName = dbname FROM @DbNames WHERE @RowCounter = rowNum;
SELECT @sql2 = 'USE ['+@DbName+']; DBCC SHRINKFILE(N'''+@DbName+'_log'', 1)'
EXEC (@sql1)
EXEC (@sql2)
SELECT @RowCounter = @RowCounter + 1

Saturday, May 10, 2014

One of the hottest issues in web developer circles this year is accessibility of websites on various devices other than the standard desktop or laptop screens. While the subject is not new, it has taken on a relatively new approach with respect to how to deal with the opportunities ahead.
With mobile devices, tablets, and similar gadgets gaining ground faster than most can keep up, it behooves organizational stakeholders to address the issues encompassing user interactions and acceptance of their websites on the latest diminutive gizmos. Oh, and don't forget other devices acquiring web-enabled screens such as refrigerators, washing machines and other everyday appliances.

Users who access your websites through their mobile devices or other display screens really do not care what method you use, just as long as that they can effectively navigate your website on whatever device they happen to be using. For that reason, the two methods described in this article have been devised for web developers to meet the challenge, and while responsive (RWD) and adaptive (AWD) design methods are both addressing the issue for rendering websites on mobile devices, there are subtle differences between them that I will attempt to explain.


The distilled definition of a responsive web design is that it will fluidly change and respond to fit any screen or device size.


The phrase Adaptive Web Design was coined by Aaron Gustafson, who wrote the book of the same title. It essentially utilizes many of the components of progressive enhancement (PE) as a way to define the set of design methods that focus on the user and not the browser. Using a predefined set of layout sizes based on device screen size along with CSS and JavaScript, the AWD approach adapts to the detected device. A recent post, "Understanding progressive enhancement techniques in web design" described the layers that make up the adaptive approach.
The three layers of Progressive Enhancement:
  • Content layer = rich semantic HTML markup
  • Presentation layer = CSS and styling
  • Client-side scripting layer = JavaScript or jQuery behaviors
In a recent podcast interview, Aaron describes how the term was selected; he wanted to disambiguate his book from the Filament Group's book, "Designing with Progressive Enhancement". Aaron goes on to mention in the podcast:
"So, we were trying to think of, you know, what exactly does all of this stuff really mean, and it was about creating rich, adaptable experiences that tailor themselves to the particular device that you were working with. So, the way that I view progressive enhancement is very much analogous to adaptive web design. It's essentially the same concept."
The condensed definition of an adaptive design is that it will change to fit a predetermined set of screen and device sizes.

Comparisons and distinctions

The biggest similarity between the two methods is that they both allow websites to be viewed in mobile devices and various screen sizes, ultimately providing visitors with a better mobile user experience. Where the two methods differ is in their delivery of the responsive/adaptive structures: RWD relying on flexible and fluid grids, and AWD relying on predefined screen sizes. One of the main distinctions between the two is that RWD might take more code and implementation strategies with the fluid grids, CSS, and flexible foundations, while AWD has a streamlined, layered approach, which utilizes scripting to assist with adapting to various devices and screen sizes.
Some would argue that the terms used invite confusion, in particular, responsive, and might not accurately reflect what is actually occurring when a website changes its design according to the particular mobile device being used. Paul Gordon argues this point in his blog post, "Adaptive or Responsive Design."
If you are interested in reviewing live examples of known web sites that utilize the methods described in this piece, check out this list of 70 Examples of Modern Responsive Web Design from Splashnology Web Design and Development (both AWD and RWD are represented).
One of the websites on the list includes Abberdein, which utilizes RWD in its WordPress Whiteboard framework, and includes several  features in the code such as div column widths set as a percentage (%). It also utilizes the Less Framework CSS grid system, which  contains four layouts and three sets of typography presets, all based on a single grid.
An example of a website that utilizes AWD would be the Screaming Frog, a search engine marketing agency, which utilizes @media query  and @media screen properties in its CSS to set breakpoints at set pixel widths depending on the device recognized in the browser window.

Wednesday, March 19, 2014

Review Timer Job Definition - "Object Reference not set to an instance of an object"

Hi All,

Recently had a problem in SharePoint 2013 after rebuilding the Search service application. The timer job for 'CreateStoreRebalancerJobDefinition' had broken and was causing the Review Timer Job page to error with "Object Reference not set to an instance of an object" error.

The resolution was from:

  • Get-SPTimerJob | out-file –filepath “c:\timerjobs.txt”
  • http://myserver:55555/_admin/ServiceJobDefinitions.aspx – Does not display
  • Get-SPTimerJob | where {$_.displayname -like “”} | fl | out-file –filepath “c:\timerjobs.txt”
    (Creates the txt file with the jobs that do not work)
  • Get-SPTimerJob | where { $ -like “*job name” } |ft id,name
    (Not really needed, as text file above will display thiws, simply copy/paste into line below the job id number.)
  • $job = Get-SPTimerJob -id putidenumberhere
  • $job.Delete()
  • Pretty swift, fixed the issue.

  • Source:

    Tuesday, November 19, 2013

    Simple Script to return Table from CSV in Oracle

    That's T-SQL a 'select ... where @tablevar' can be over int or string. But in Oracle the IN will only work over number values, thus we must cast TO_NUMBER. That was fun =).

    SELECT TO_NUMBER(column_value) FROM XMLTABLE(<csv_string>)

    Migrate from SQL Server to Oracle in .NET using Devart

    Steps to migrate from SQL Server to Oracle for Shuts Project.

    1.      Download and install Oracle Database 11g – Personal Edition – this edition offers the full feature set of Enterprise Edition and is targeted for development/staging.

    2.      Download and install JDK 7.

    3.      Upgrade the SQL Developer from 2.x to

    4.      Launch SQL Developer and use the Migration workbench to capture an external database.

    a.      Click tools -> migration -> Create database capture scripts

    5.      Copy the capture scripts to the target server. Execute OMWB_OFFLINE_CAPTURE.BAT and pass in parameters for username/password and target db.

    rem  %1 DBA login id

    rem  %2 password

    rem  %3 database name

    rem  %4 database server name

    6.      Copy output of capture Oracle server.

    7.      Create a new oracle database ‘orclshuts’ using the Data Configuration Assistant.

    8.      Create a new oracle database ‘repo’ using the Data Configuration Assistant.

    9.      Using SQL Developer login to the newly created database

    a.      Right click on the new connection

    b.      Expand ‘Migration Repository’

    c.       Click ‘Associate Migration Repository’ and complete the wizard

    10.   Using the migration workbench

    a.      Click tools -> Migration -> Migrate…

    b.      Click Next

    c.       For repository set the connection to your new ‘repo’ database.

    d.      Click Next

    e.      Set the project name and output DIR (e.g. d:\migratedb) for scripts.

    f.       Click Next

    g.      Select source mode as ‘offline’ then browse to output your captured output folder and select the ‘sqlserver2008’.ocp file.

    h.      Click Next

    i.        Select the database to migrate from the available databases list

    j.        Click Next

    k.      On the conversion options - Click Next

    l.        On the SQL objects to translate – Click Next

    m.    Set your target as the ‘dbname' database, click Advanced and under Object Types check ‘Select All’ to include stored procs, functions and triggers -(this will also capture sequences).

    n.      Click Next

    o.      For move data, set source to ‘repo’ and target to ‘dbname'.

    p.      Click Next

    q.      Click Finish.

    11.   In SQL Developer open your output DIR and select the dropallschemas.sql file, ensure that SQL Developer is running on your ‘dbname' database and execute script.

    12.   In SQL Developer open your output DIR and select the master.sql file, ensure that the SQL Developer is running on your ‘orclshuts’ database and execute script. Provider your new user passwords as prompted by the script (should create a user named ‘dbo_MaintenanceShuts’).

    13.   Install DevArt DotConnect for Oracle.

    14.   Launch Visual Studio and add a new DevArt Entity Model.

    15.   Right Click in an empty space within the model and then click on ‘Generate Model from Database’.

    16.   On the connection details utilize the new 'dbo_schemaname’ user and use the password you used during execution of the master.sql script. Ensure that the ‘dbname' database is targeted.

    17.   Update the Entity Container Name and Namespace if needed.

    18.   Update the entity names in the Entity Framework Model to camel casing, instead of full caps as generated from the Oracle schema.

    Some gotchas during migration.

    The Oracle SQL Developer requires JDK 7.0

    The Oracle SQL Developer migration workbench that comes with 11g is not able to access SQL 2008 data and is limited to 2005. So an upgrade to SQL Developer 4.0 was necessary in order to generate the Capture scripts correctly.

    The ORM (edml) for entity framework generated by DotConnect generates two distinct namespaces, RTIO.Shuts.Data (the business entities) and the RTIO.Shuts.Data.Store (sql map). Both need to be maintained within the solution and changes to one will inevitably impact the other side.

    *The Store and Data are two different things available in designer. After fixing the method call names and adjusting to the new addobject deleteobject functions. I executed the application to find that only one object was being inserted. Sequences were created during migration and direct insertion worked. Each primary key (identity) in both the ORM entity classes and the table (still in ORM designer) must be updated to use the Stored Generation Pattern = “Identity” – then all was well.

    *Also all stored procs needed to be right clicked on at the Store and then click on “Create Method” in order to generate the method call and return type in the dbcontext object.

    *When using SQL Developer ensure that any worksheet you use – once you are done, to hit commit changes. As all SQL executions are run in a transaction and do not push to the database until the commit is triggered.



    SharePoint Set Locale Region on All Web Applications and Site Collections

    A quick script works on both SharePoint 2010 and 2013. Make sure to update en-AU to the target locale you are after =).


    $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
    $websvcs = $farm.Services | ? -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
    $webapps = @()
    foreach ($websvc in $websvcs)
    $NewLocale = "en-AU"
    foreach ($webApp in $websvc.WebApplications)
    foreach ($site in $webApp.Sites)
    Write-Host "Updating Site -" $site -ForegroundColor "Green"
    $Webs = $site.AllWebs
    ForEach ($Web In $Webs)
       If ($Web.locale -ne $NewLocale)
          Write-Host $Web.title "- " -NoNewLine; Write-Host "changing from" $Web.locale "to" $NewLocale -ForegroundColor "Green"
          $Web.Locale = $NewLocale
       Else { Write-Host $Web.title "- " -NoNewLine; Write-Host "already set to" $NewLocale -ForegroundColor "Blue"