Quantcast
Channel: Geekswithblogs.net
Viewing all 6441 articles
Browse latest View live

CloudKit Server To Server

$
0
0

Originally posted on: http://geekswithblogs.net/MobileLOB/archive/2016/02/12/cloudkit-server-to-server.aspx

Now this is quite a big deal for me.

I spend most of my time in the land of enterprise apps (as you know).   Most of the effort it with building the infrastructure to have someones device talk back to one of our servers.    I get wrapped up with issues, about connectivity/amount of bandwidth I’ve got and what happens if someone goes offline.     iCloud has been a walled garden up until this point.   Its great for syncing your photos/documents etc.   but its a closed system for us Enterprise folks.  Now I’ve got the ability to use iCloud to also host my enterprise data.   I can pump data into iCloud;  securely.   iOS takes care of the synchronisation for me.

So use case.   I can take a bunch of data, say a price catalogue and some tables to store quotes.   Pump that over to iCloud.    Then my mobile app.  can just auto-magically just see all that data.    I can quickly just build a UI to take customer orders and let iOS just do its thing to make sure all the data just synchronises.      All I have to worry about is getting the data in and out of the iCloud servers.     This is where the pretty comprehensive and secure (well it looks that way) new API comes in.

So you can do this now,   and thanks to some kind help on the Apple Developer Forums,     + I can do this all from (our own walled garden) from c#.

Announcement here

https://developer.apple.com/news/?id=02042016a

 

Code to follow



Speaking at SPTechCon Austin 2016

$
0
0

Originally posted on: http://geekswithblogs.net/bjackett/archive/2016/02/16/speaking-at-sptechcon-austin-2016.aspx

   I’m honored to be accepted to speak at SPTechCon Austin 2016 next week.  It has been a few years since I’ve been able to attend / present at an SPTechCon with many life and work changes in the past 2 years.  The organizers for this event put on a great conference with top name speakers, educated attendees, and a nice venue from the previous ones I’ve attended.  Below are the sessions that I will be presenting along with a call out to another session by Jen Mason you should see before my PowerApps session.

 

Sessions

When: Mon Feb 22, 2:00pm-3:15pm

Title: PowerShell for Your SharePoint Tool Belt

Abstract: PowerShell is becoming the command line interface for all Microsoft server products, including SharePoint. If you haven’t started using PowerShell you will want to add it to your set of tools in your tool belt.  In this demo-heavy session we will show tips and tricks for using the PowerShell console and ISE, traverse through all sites in a farm, create reports, and create a secure remote connection with whitelisted commands through constrained endpoints.  We will also cover some of the more intermediate to advanced techniques available within PowerShell that will improve your work efficiency.  This session is targeted to administrators and developers and assumes a basic familiarity with PowerShell.

 

(Jen Mason’s session on PowerApps for O365 which you should attend prior to my PowerApps integration session)

When: Wed Feb 24, 8:30am-9:45am

Title: An Inside Look at PowerApps on Office 365

Abstract: Microsoft has ?unveiled PowerApps, an innovative and compelling new service for building mobile-first business applications. PowerApps empowers ?information workers to connect to data sources in the cloud and on-prem, and to create no-code, targeted mobile applications that can be shared with users on any device. PowerApps let users take advantage of pre-configured templates to do tasks like:
·       Use simple logic flows and create an email notification if a new tweet appears
·       Create a lead in Salesforce if an email arrives
·       Create an approval process email when a button is clicked in an app
…and more. PowerApps can connect to Office 365, OneDrive, Dropbox, Salesforce, Oracle, SAP, Twitter, SQL and more. In this session we will explore this new tool and show some demos. You don’t want to miss this great opportunity to hear about the new PowerApps features.

 

When: Web, Feb 24, 11:00am-12:15pm
Title: PowerApps Enterprise Integration and Demos

Abstract: PowerApps is an enterprise service (currently in preview) that allows power users and developers to build scalable applications that connect with numerous consumer and enterprise sources using PowerPoint and Excel-like tools.  In this session we will overview the integration points for PowerApps with various sources such as OneDrive, Twitter, Azure, and more.  We will also talk about the developer story for integrating with on-prem sources such as SQL Server and SharePoint.  Lastly we will demo a number of scenarios to give you a feel for how quickly and easily apps for Windows, iOS, Android, and web can be created once and consumed on all platforms.  This session is targeted to information workers, power users, and developers.  General experience working with Excel / PowerPoint data is helpful but not required.

 

When: Wed Feb 24, 1:30pm-2:45pm

Title: Running Your Dev/Test Virtual Machines in Azure for Cheap

Abstract: With an MSDN subscription you can run your dev / test SharePoint environment in Azure IaaS for less than the cost of a cup of coffee each day. In this session we will overview the basics of Azure IaaS (Infrastructure as a Service), the pieces you will use to be successful deploying SharePoint in Azure (including the new Azure Resource Manager templates), and how to use resources as efficiently as possible to reduce your costs and boost your farm performance. This session is targeted to SharePoint developers and administrators. Prior knowledge of Azure is helpful but not a requirement.

 

Conclusion

   There is still time to register for SPTechCon Austin 2016.  You can use code JACKETT to save $200 but the early bird pricing is already over.  If you are attending please come say hi and I look forward to meeting you.

 

      -Frog Out

TeamCity Build Number from Most Recent Git Tag + 1 Dash Short Sha

$
0
0

Originally posted on: http://geekswithblogs.net/BobHardister/archive/2016/02/16/teamcity-build-number-from-most-recent-git-tag--1.aspx

We want a semantic version build number derived from the most recent git tag that follows a three-node semantic version format.  We use GitLab and here’s how we do that in TeamCity.

 

1. Add a Powershell build step as follows:

$lastVerTag = git describe --abbrev=0 --tags --match [0-99][.][0-99][.][0-999][string]$majMin = $lastVerTag.Substring(0,$lastVerTag.LastIndexOf('.'))[int]$incr = $lastVerTag.Substring($lastVerTag.LastIndexOf('.'))$incr = $incr + 1$semVer = $majMin + '.' + $incr$Hash = "%build.vcs.number%"$ShortHash = $Hash.substring(0,7)Write-Host"##teamcity[buildNumber '$semVer-$ShortHash']"

2. In the Build Configuration Settings General settings set the Build numbe format field to: %build.number%

 

If the most recent Git tag using a valid three-node semantic version format was 0.0.0, then the build number would be: 0.0.1-fe46b10

Stash, Pull, Stash Apply as one git command

ScrollToControl helper method for ASP.Net web forms to move position to particular control

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/17/scrolltocontrol-helper-method-for-asp.net-web-forms-to-move-position.aspx

I've created a helper method for ASP.Net web forms to move position to particular control

           ///<summary>
           ///
           ///</summary>
           ///<param name="page"></param>
           ///<param name="clientId"></param>
           ///<param name="alignToTop"></param>
           publicstaticvoidScrollToControl(Pagepage,stringclientId,boolalignToTop)
            {
               //NOTE: if there are more than one call on the page, first one will take preference
               //If we want that last will take  preference, change key from MethodBase.GetCurrentMethod().Name to anchorName
               //recommended in http://gnidesign.blogspot.com.au/2011/06/how-to-maintain-page-scroll-on-postback.html               
               Stringscript =" window.scrollTo = function () { };"+Environment.NewLine;
                script +=String.Format("document.getElementById('{0}').scrollIntoView({1});", clientId, alignToTop.JSToString());
                page.ClientScript.RegisterStartupScript(TypeForClientScript(),MethodBase.GetCurrentMethod().Name, script,true);
               //return script;
            }
            public static string JSToString(this bool bValue)
            {
                return bValue.ToString().ToLower();
            }
Use getElementById('{0}').scrollIntoView is simpler than location.hash , because you don't need to add extra anchor element.
Parameter alignToTop is very convenient to specify do you want to show control at the top or bottom of the screen.

There is more advance jQuery plug-in http://erraticdev.blogspot.com.au/2011/02/jquery-scroll-into-view-plugin-with.html

Case insensitive StringHelper.EnsureEndsWith

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/17/case-insensitive--stringhelper.ensureendswith.aspx

I've created an extension  method for string      
public static string EnsureEndsWith(this string str,string sEndValue,bool ignoreCase=true)
        {
           if(!str.EndsWith(sEndValue, ignoreCase,CultureInfo.InvariantCulture))
            {
                str = str + sEndValue;
            }
           returnstr;
        }

Apple to create Feedback Forum.

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/19/apple-to-create-feedback-forum.aspx

Resently I've submitted a few suggestions to iTunes support forum. But I was informed, that for suggestions I have to use http://www.apple.com/feedback/itunesapp.html form. I feel slightly uncomfortable, that I can't check later, what I submitted. So I proposed to Apple to create Feedback Forum.      It will be good to have a forum for feedback similar to what you have for support. 1.It will allow me as a customer  to check what I suggested and edit/append new considerations. 2.It will allow othe customers to read my suggestions and vote if they like/ dislike the idea, as well as add more details to the idea. 3.It will allow you to provide information about status the idea, is it accepted and when it will be implemented.

Insert new line in multiple xml files using Visual Studio

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/19/insert-new-line-in-multiple-xml-files-using-visual-studio.aspx

I needed to insert new line after existing one in multiple similar xml files.

In Visual Studio open "replace in files" dialog and tick "use regular expression"
In "find" escape "/" as "\/"
     <param name="ExistingKey" value="False" \/>
In "Replace" repeat original string, then add \n and add a new string
     <param name="ExistingKey" value="False" />\n  <param name="NewKey" value="new value" />

Related links:


How to set iOS Pocket to open in Web View.

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/19/how-to-set-ios-pocket-to-open-in-web-view.aspx


I prefer to open pages in Web View, because Article View often doesn't show text (in particular source code) properly.
However option "Open Best View" usually opens Article View and I needed to change it manually.

Pocket support provided me with solution

          To force the app to open all the articles in web view in your iPad you can follow these steps:
  1. Tap the Profile option
  2. Tap Settings, in the top right corner
  3. Under the headline Offline Downloading, disable “Download Best View”, “Always Fetch Article”
  4. Enable “Always Fetch Web View”

However it will be easier for user to have in settings section "select view" with options Web, Article,View.
Also if Pocket would have support forums, they will not need to repeat the same answer for other users and I would not create this post.

Links for RazorEngine development.

$
0
0

SqlDependency Notification database Options troubleshooting

$
0
0

Originally posted on: http://geekswithblogs.net/mnf/archive/2016/02/19/sqldependency-notification-database-options-troubleshooting.aspx

For SQL notifications we followed the steps described in http://dimarzionist.wordpress.com/2009/04/01/how-to-make-sql-server-notifications-work.

However it didn't work for our database. The instructions missed a step to ensure that database options are set for SqlDependency Notification
I've created a function to Follow recommendation to always check the notification source, info and type, it returned
 
SqlNotificationEventArgs, Type : Subscribe, Source : Statement, Info :Options 

    //TODO: pass  SQL string
     ///<summary>
              ///
              ///</summary>
              ///<param name="logger"></param>
              ///<param name="e"></param>
              publicstaticvoidLogSqlNotificationEventArgs(Loggerlogger,SqlNotificationEventArgse,DbConnectiondbConnection=null)
              {
                     LogLevellevel =LogLevel.Warn;
                     //You're supposed to check the values of the SqlNotificationEventArgs argument. Only if Type is Change and Source is Data where you notified for a data change.
                     if((e.Type ==SqlNotificationType.Change) && e.Source ==SqlNotificationSource.Data)
                     {
                           level =LogLevel.Info;
                     }
                     if(e.Info ==SqlNotificationInfo.Options)
                     {
                           if(dbConnection !=null)
                           {
                                  //TODO http://www.mssqltips.com/sqlservertip/1415/determining-set-options-for-a-current-session-in-sql-server/. Make SP
                                  //check DB set options,
                                  // Execute SqlDependencies_CheckDBSetOptions
                                  // Run Alter DB

                           }
                     }
              //http://msdn.microsoft.com/en-us/library/ms189308%28SQL.105%29.aspx Insert/update/delete/truncate are valid
                     logger.Log(level,"SqlNotificationEventArgs, Type : {0}, Source : {1}, Info : {2} ", e.Type, e.Source, e.Info);
                     
              }

Based on TROUBLESHOOTING QUERY NOTIFICATIONS in http://rusanu.com/2006/06/17/the-mysterious-notification/ 

and Troubleshooting Query Notifications I've created Stored Procedure


/*
-- RUN manually for every DB that required change

ALTER DATABASE MyDB
set ANSI_NULLS ON
       , ANSI_PADDING ON
, ANSI_WARNINGS ON
, CONCAT_NULL_YIELDS_NULL ON
, QUOTED_IDENTIFIER ON
, NUMERIC_ROUNDABORT OFF
,ARITHABORT ON
*/
GO
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIERON
GO
-- Drop stored procedure if it already exists
IFEXISTS( SELECT*    FROMINFORMATION_SCHEMA.ROUTINES   WHERESPECIFIC_SCHEMA=N'dbo'   ANDSPECIFIC_NAME=N'SqlDependencies_CheckDBSetOptions')
  DROPPROCEDUREdbo.SqlDependencies_CheckDBSetOptions
GO

-- =============================================
-- Author:           MNF
-- Create date:
-- Description:      
-- =============================================
CREATEPROCEDURESqlDependencies_CheckDBSetOptions
       @dbNamesysname 
AS
BEGIN
       -- SET NOCOUNT ON added to prevent extra result sets from
       -- interfering with SELECT statements.
       SETNOCOUNTON;
select--*
       is_ANSI_NULLS_ON
       ,is_ANSI_PADDING_ON
       ,is_ANSI_WARNINGS_ON
       ,is_CONCAT_NULL_YIELDS_NULL_ON
,is_QUOTED_IDENTIFIER_ON
,is_NUMERIC_ROUNDABORT_ON--OFF
,is_ARITHABORT_ON
--select *
Fromsys.databaseswherename=@dbName 
and(
       is_ANSI_NULLS_ON=0
       oris_ANSI_PADDING_ON=0
       oris_ANSI_WARNINGS_ON=0
       oris_CONCAT_NULL_YIELDS_NULL_ON=0
oris_QUOTED_IDENTIFIER_ON=0
oris_NUMERIC_ROUNDABORT_ON=1--OFF
oris_ARITHABORT_ON=0)

END
-- SqlDependencies_CheckDBSetOptions 'MyDB'
GO

Death of a Scrum Room

$
0
0

Originally posted on: http://geekswithblogs.net/mrsteve/archive/2016/02/21/death-of-agile-scrum-room.aspx

A friend of mine (seriously - a friend of mine - this isn't about me) works at a medium-large company on a medium-large application in a medium-size dev team. A few years ago they had a scrum master and ran fortnightly sprints with retrospectives, demos and stand-ups. Sprint work was planned and protected, and if anything was added during a sprint - which didn't happen often - the impact was accounted for. The team worked in a dedicated scrum room, which helped foster a productive atmosphere and kept disturbances and distractions to a minimum. They delivered several major releases on time, with minimal production issues.

Now, this was not some dev utopia. It was a legacy application, and had some truly impressive poor design. 2000-line JavaScript files. 3000-line stored procedures. Oodles of business logic in both. Lots of duplication, and - to begin with - no automated tests. But architecture was refactored, code was de-duplicated, tests were written, and goals were accomplished.

The thing was, 'The Business' weren't sure about agile, and the scrum master had regular fights to run things that way. The problems were textbook:

  • Resistance to addition of work mid-sprint
  • Lack of oversight - is dev X really taking this long to finish story Y? How do we know it's not already finished, and now they're just playing Minesweeper?
  • Lack of 'precise' answers to questions like "On exactly what date will this massive new piece of work be delivered?"

So a little under a year ago, they parted ways with the scrum master. People began filtering into the room to talk to devs about their work. Devs were called into meetings to discuss when and how they were going to fix issues they were in the middle fixing. Refactoring started to be second-guessed by non-devs, and was eventually banned. Two months went by with enforced overtime.

A new development manager was brought in - a proud and public fan of 'old school waterfall'. Timesheets were introduced. The product owner was moved onto something else, the acting replacement was moved out of the scrum room and became more difficult to get hold of. The test team was moved into the scrum room. And then, very recently, the scrum room doors were removed. So no more scrum room, and only the fading vestiges of agile practice remain. Why did this happen, and what are the consequences?

The scrum master was originally brought in to organise the team and implement a productive process, but vital elements of the business never really got on board with agile. Running scrum produced some great results, but lacked the (in my experience, fictitious) security and control of waterfall. Refactoring was absolutely necessary, but a hard sell - "You want to work on… making it the same…?" A new dev manager with an anti-agile attitude (there's still plenty of them about) confirmed things didn't have to run that way.

With mounting time pressure on development, code quality decreased - oversight increased to compensate. But the product is still making money - if it easily pays for a team to maintain it, does it matter if it's poorly written? I guess it depends on whether job satisfaction matters. The more ambitious devs are unhappy and the current job market for developers is very strong, so you do the maths on where that's heading. I wonder if eventually a new scrum master will be brought in to improve the environment, and the whole process will start all over again. It'll be interesting to see.

Well-run agile teams can produce great results, but even now - 15 years after the Agile Manifesto - it's often viewed with suspicion. If you like agile practice you can make efforts to sell it, but people hate change, and you have to know when to move on. Some devs like regimented, waterfall environments, so if those environments and devs find each other, everyone's happy. You spend too much time at work to stay somewhere if you're not enjoying it.

Slides and Scripts from SPTechCon Austin 2016

$
0
0

Originally posted on: http://geekswithblogs.net/bjackett/archive/2016/02/22/slides-and-scripts-from-sptechcon-austin-2016.aspx

   Thanks to all of the attendees at my SPTechCon Austin 2016 sessions.  On this blog post I’ll share my slides and demo scripts (and update it with future slide decks as I give the presentations).  Note that all scripts are provided as-is with no warranty.  Run them in a non-production environment first.

 

PowerShell for Your SharePoint Tool Belt

Slides

 

Demo scripts

 

 

 

 

Running Your Dev / Test VMs in Azure for Cheap

Coming soon…

 

PowerApps Enterprise Integration and Demos

Coming soon…

 

 

      -Frog Out

Fast Square Root calculation for the BigInteger class in .NET

$
0
0

Originally posted on: http://geekswithblogs.net/alexhildyard/archive/2016/02/22/fast-square-root-calculation-for-the-biginteger-class-in-.net.aspx


If you google carefully, it appears there are someresources to help with a common problem.

But just for good measure, here's my own implementation, which applies Newton-Raphson directly to the series expansion of squares. Theoretically this should give you the square root in a single iteration, once the nearest power of two has been calculated, an initial step which I'm sure can be optimised. But because all operations are integer-based, in practice more than one iteration is required. The code will still root a 300 digit integer in around 10 iterations, which is probably sufficient for general purposes.

static BigInteger SQRT(BigInteger N)
{
    BigInteger q = N;
    int two_pows = 1;
    int iters = 0;
    // Handle 1
    if (q == 1)
    {
        return q;
    }

    // Get powers of 2 for N
    while (q > 1)
    {
        two_pows++;
        q /= 2;
    }

    // Divide by 2 to get the root
    two_pows /= 2;

    // First approximation
    BigInteger t = N / BigInteger.Pow(2, two_pows);
    iters = 0;
            
    while (true)
    {
        BigInteger p = t * (t + 2) + 1;

        if (p == N)
        {
            return t+1;
        }

        BigInteger e = N - p;
        BigInteger correction = (2 * (t + 1)) + 1;

        t += e / correction;

        if (t * t == N)
        {
            return t;
        }

        iters++;
    }
}

Simple Generic CRUD with AngularJS, Parse and Bootstrap

$
0
0

Originally posted on: http://geekswithblogs.net/alexhildyard/archive/2016/02/23/simple-generic-crud-with-angularjs-parse-and-bootstrap.aspx


Envisage almost any data-driven user interface, and sooner or later you will probably come across a requirement like:

- present the user with the list (of users, addresses, products, etc.)
- allow the user to edit an existing item in the list
- allow the user to create a new item and add it to the list

I decided to have a look at several web-based technologies to see how easy it might be to fulfil this requirement in as generic and extensible a way as possible, with the absolute minimal in the way of coding or configuration. I ended up opting for:

- angularJS for a data-bound UI
- Bootstrap for icons and element styling
- Parse for remote object definition, serialisation and persistence

My implementation involves:

- creating an angularJS Parse-based persistence service, which serialises the objects within a named Parse table
- creating a generic angularJS controller to present data supplied by the service and respond to user events

In order to use it, you just need to:

1. Subclass the service, specifying the name of the table you want bound to the UI

The following code creates an angular service bound to a Parse table called "Users":

angular.module('crudApp').service('UserPersistenceService', function () {
    return new PersistenceService("Users");
});


At the same time, you should create a table named "Users" within Parse, with columns for any information you want to bind. In this example, I created the fields "name", "bio" and "score." But I am electing just to bind the "name" and "bio" elements.


2. Subclass the controller, and add hooks to define application behaviour when items are added or edited

The controller exploits "backing fields" to store partially edited information, as well as supply default values when a new 

record is created. These operate as follows:

- initBackingFields(): called when a new record is created
- copyBackingFields(): called when you choose to edit a record
- commitBackingFields(): called when you have edited a record and elect to commit your changes 

So in the example above, we have just two editable fields, "name" and "bio", which we will back with two further fields, 

"newName" and "newBio", reflecting information that has been edited but not yet committed. The full implementation of the subclassed controller looks like this:

angular.module('crudApp').controller('UserListCtrl', ['$scope', '$controller', 'UserPersistenceService', function ($scope, 

$controller, persistenceService) {

    $controller('PersistenceController', {
        $scope: $scope,
        persistenceService: persistenceService,
        initBackingFields: function (item) {
            item.name = "";
            item.newName = item.name;
            item.bio = "";
        },
        copyBackingFields: function (item) {
            item.newName = item.attributes.name;
            item.newBio = item.attributes.bio;
        },
        commitBackingFields: function (item) {
            item.set("name", item.newName);
            item.set("bio", item.newBio);
        }
    });

} ]);


3. Bind the fields that interest you to the UI with appropriate directives 

Create an HTML page to display the items in the table in a list. The Persistence controller exposes three helper functions to facilitate record editing:

- toggleItemEdit(): switch a record in the UI between "editable" and "read only"
- deleteItem(): delete the currently selected item, and persist changes to the back end
- commitItemEdit(): update an existing or add a new record, and persist the changes

The resultant HTML page now looks like this:

<html>
<head>
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="Stylesheet" href="./styles.css" />
    <script src="http://www.parsecdn.com/js/parse-1.6.7.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
    <script src="./crudController.js"></script>
    <title>CRUD Test</title>
</head>
<body ng-app="crudApp">

    <!-- item controller -->
    <div class="userContainer" ng-controller="UserListCtrl">
        <h3>Users</h3>
          <table class="table table-striped">
          <thead><tr>
            <th>Name</th>
            <th>Bio</th>
          </tr></thead>
          <tbody>
            <tr ng-repeat="item in items">
                <td>
                    <span ng-show="!item.isEditing">{{item.attributes.name}}</span>
                    <input ng-model="item.newName" ng-show="item.isEditing" type="text"/>
                </td>
                <td>
                    <span ng-show="!item.isEditing">{{item.attributes.bio}}</span>
                    <input ng-model="item.newBio" ng-show="item.isEditing" type="text"/>
                </td>
                <td>
                  <button ng-hide="item.isEditing" class="btn" ng-click="toggleItemEdit(item)">
                    <span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;Edit
                  </button>
                  <button ng-hide="item.isEditing" class="btn" ng-click="deleteItem(item)">
                    <span class="glyphicon glyphicon-remove"></span>Delete
                  </button>
                  <span ng-show="item.isEditing">
                      <button ng-disabled="item.newName==''" class="btn" ng-click="commitItemEdit(item)">
                        <span class="glyphicon glyphicon-pencil"></span>Update
                      </button>
                      <button class="btn" ng-click="toggleItemEdit(item)">
                        <span class="glyphicon glyphicon-pencil"></span>Cancel
                      </button>
                  </span>
                </td>
            </tr>
          </tbody>
        </table>
        <table>
            <tr>
                <td>
                    <button class="btn btn-success" ng-click="addNewItem()">
                        <span class="glyphicon glyphicon-item"></span>New User
                    </button>
                </td>
            </tr>
        </table>

        <hr>
     </div>

</body>
</html>


Finally, here is the Javascript file that does all the work, "crudController.js" and the accompanying "styles.css", which adds some spacing to the table elements.

-- styles.css --

input
{
    width: 200px;
}

td
{
    width: 200px;
}


-- crudController.js --

var app = angular.module('crudApp', []);

function PersistenceService(parseTable) {

    var objParse = Parse.initialize("YOUR PARSE ADMIN KEY", "YOUR PARSE APP KEY");
    var items = Parse.Object.extend(parseTable);
    var queryItems = new Parse.Query(items);
    
    // Store the type of the persistence service created
    this.persistenceTable = parseTable;
    
    // Load a list of items from the back end
    this.load = function (itemsLoadedCallback) {

        queryItems.find(
        {
            success: function (results) {
                itemsLoadedCallback(results);
            },
            error: function (results) {
                alert("Failed to load items: " + results.message)
            }
        });
    }

    // Add a new or update an existing item
    this.update = function (item, itemUpdateCallback) {

        item.save(
        {
            success: function (results) {
                itemUpdateCallback(results);
            },
            error: function (results) {
                alert("Failed to update item: " + results.message)
            }
        });
    }

    // Delete an item
    this.remove = function (item, itemDeletedCallback) {

        item.destroy(
        {
            success: function (results) {
                itemDeletedCallback(results);
            },
            error: function (results) {
                alert("Failed to delete item: " + results.message)
            }
        });
    }
}

angular.module('crudApp').controller('PersistenceController', ['$scope', 'persistenceService', 'initBackingFields', 'copyBackingFields', 'commitBackingFields', function ($scope, persistenceService, initBackingFields, copyBackingFields, commitBackingFields) {

    // Callback to receive list of users, and bind them to the scope
    $scope.itemsLoaded = function (items) {

        // Set the isEditing and newName attributes on each user; these aren't persisted
        // but the controller uses them to facilitate editing
        for (i = 0; i < items.length; i++) {
            // We add these non-persisted fields to facilitate editing; "parse" won't serialise them
            copyBackingFields(items[i]);
            items[i].isEditing = false;
        }

        $scope.items = items;

        // Force scope update, to rebind updated item list to the view
        $scope.$apply();
    }

    // Called by the service when an item has been deleted, added or updated
    $scope.OnDatabaseChanged = function (items) {
        // Refresh the view
        persistenceService.load($scope.itemsLoaded);
    }

    $scope.toggleItemEdit = function (item) {
        item.isEditing = !item.isEditing;
    }

    $scope.commitItemEdit = function (item) {
        commitBackingFields(item)
        item.isEditing = false;

        // Commit the changes to the database
        persistenceService.update(item, $scope.OnDatabaseChanged);
    }

    $scope.addNewItem = function () {

        // This method doesn't commit the new user to the database; it just adds a row to the view,
        // and makes it editable
        var Item = Parse.Object.extend(persistenceService.persistenceTable);
        var item = new Item();
        item.isEditing = true;
        initBackingFields(item);
        $scope.items[$scope.items.length] = item;
    }

    $scope.deleteItem = function (item) {
        persistenceService.remove(item, $scope.OnDatabaseChanged);
    }

    // Start with an empty collection of items
    $scope.items = [];

    // Load the items from the service
    persistenceService.load($scope.itemsLoaded);
} ]);











How to hire a Scala Dev

$
0
0

Originally posted on: http://geekswithblogs.net/JoshReuben/archive/2016/02/23/how-to-hire-a-scala-dev.aspx

As chief architect of an Ad-Tech startup, part of my role involves hiring and mentoring software engineering candidates. Our technology stack includes Scala, SBT, Akka, Spray, Spark + MLlib, AWS, Ecmascript 6, BeEF, Linux environment, Git, Docker, Bash, Kafka, ELK, NGinX, and as of today, Mesosphere. I can tell you, it ain't easy to find Scala Devs. IMHO, a suitable candidate must demonstrate that they are capable of diving in and learning frameworks that make up the Scala ecosystem. 

Now, you can conduct a technical interview and watch said candidate sweat while they try to explain to you the merits of recursive singletons (joke), but that won't tell you whether they can 
  1. learn on their own
  2. grasp concepts 
  3. code elegantly in Scala (without being under the artificial pressure of an interview) 
  4. integrate disparate technologies
Its not enough for a software engineer to grasp the syntax of a programming language. More is expected.
I constructed the following exercise, which I give candidates a week to do in their own time:

Part 1 - Spray

This exercise will demonstrate the candidates' ability to learn and apply the basics of Spray


  • Create a simple Spray Restful Server with a Route that exposes 1 GET endpoint.

  • This endpoint will expect a querystring parameter that will contain a string.

  • The endpoint functionality will be to reverse the string passed in the Request and return it as the Response

  • Write a unit test for the Route


Part 2 - Akka

This exercise will demonstrate the candidtate's ability to learn and apply the basics of Akka


Part 3 - Bash

This exercise will demonstrate the ability to write a basic bash script

  • check for the existence of the text file

  • run the Spray service

  • run the Akka app, passing in the path to the text file

  • read the output file that the Akka program produced – select the top 5 words with the highest counts

  • curl these words to the spray service and display the output


Part 4 - Git

This simple exercise will demonstrate the ability to use basic source control

  • create a github project – commit and push each stage of your work on this exercise.


If you can do these basic tasks - congratulations, you are Scala job-worthy.

Angular, Parse and Bootstrap JSFiddle

$
0
0

Originally posted on: http://geekswithblogs.net/alexhildyard/archive/2016/02/24/172893.aspx


Further to my previous post, I have uploaded the code as a JSFiddle.


1. Default view of list of users
A full list of all users in the "Users" table is retrieved and displayed. "Edit" and "Delete" buttons appear alongside each entry.




2. Edit an existing user entry
The default text that appears when you edit an existing entry depends on your implementation of copyBackingFields(). In this case, both fields are populated with the record's existing data.



3. Add a new user
On clicking "New user", a new record is created and populated with data as defined in your initBackingFields() implementation. In most cases, the desired behaviour will be simply to start with an empty record.





Bootstrap dropdown not working properly

$
0
0

Originally posted on: http://geekswithblogs.net/wpfmonk/archive/2016/02/25/bootstrap-dropdown-not-working-properly.aspx

Sometimes back, when I was working on TurboScrum project with angular and bootstrap, I bumped into this issue. I was unable to get the bootstrap drop down working. After couple of hours of hard research I found the solution was rather too simple.

What I had is,

<scripttype="text/javascript"src="Scripts/bootstrap.min.js"></script><scripttype="text/javascript"src="Scripts/jquery-2.1.1.min.js"></script>

instead of,

<scripttype="text/javascript"src="Scripts/jquery-2.1.1.min.js"></script><scripttype="text/javascript"src="Scripts/bootstrap.min.js"></script>

"The jQuery should be included before bootstrap. The order matters(ofcourse)"

How to hire a WPF developer?

$
0
0

Originally posted on: http://geekswithblogs.net/wpfmonk/archive/2016/02/25/how-to-hire-a-wpf-developer.aspx

Lately people were asking me, what is the minimal list of things expected when you are looking for a WPF programmer. So, I managed to compile a list, hope this helps

1) XAML Basics & Basic controls such as TextBox, Buttons etc.,
2) VisualTree and LogicalTree
3) Bubbling and Tunneling

4) DependencyProperty
5) AttachedProperty

6) DataTemplate
7) ControlTemplate

8) Style

9) DataBinding

Triggers:
10) EventTriggers
11) DataTriggers

MVVM Basics & Commands:
12) DelegateCommand
13) RelayCommand
14) ApplicationCommands
15) RoutedEvent
16) RoutedCommand

Transformations:
17) RenderTransform
18) LayoutTransform

Resources:
19) BinaryResource
20) LogicalResource
21) StaticResource
22) DynamicResource
23) RelativeResource

Panles and Basic Controls:
24) Layouts and Panels
25) UserControl
26) ContentControl
27) Some Controls like Grid, TreeView and Charts

Interfaces and Collections:
28) IValueConverter
29) INotifyPropertyChanged
30) ObservableCollection
31) CollectionViewSource

Tools:
Knowledge on IDE/Tools such as Expression Blend, Expression Designer and Visual Studio will be of great advantage.

Installing the Windows Azure Active Directory Synchronization Tool (a.k.a. DirSync)

Viewing all 6441 articles
Browse latest View live