All posts by John

Building K2 Smartform Control – Part 2

Continuing from the previous post on building a custom control, visit Part 1 here.

We are going to add a sidemenu javascript library to the K2 Smartform Control.

I have chosen the following javascript library, you can download it from here.

Add Javascript Library to Solution

Now lets add those library to the solution project.

6. Adding the javascript and CSS library

 

Open up the property windows of those files and set them to “Embedded Resources”

7. Setting the properties to Embbedded Resources

NOTE: This is critical for the K2 SmartForm Control, as this will tell the solution to compile the library along with it.

Linking the Javascript Libraries & CSS in the source code

In the SideMenu_Control.cs, open it up and add the following lines of codes.

8. Adding CSS library to Control source file

 

9. Adding JS library to source file

 

We are not done yet, the above codes only tells to K2 Smartfrom Custom Control that those are required resources.

We are going to add those following JS and CSS to the code base with the following lines.

9.1 Adding JS library to source file

Housekeeping

You will notice that the K2 Smartform Custom Control Template generate a whole bunch of codes for you. In this section, we going to remove some stuff to keep it clean.

SideMenu_Control.cs

Remove the following sections that is generated along with the template.

section 1:

 

10. Remove the Generated Method

section 2:

11. Remove the Generated Method 2

section 3:

12. Remove input type as this not a input control

With that all done, we have a clean baseline to work with.

Go to K2 Smartform Custom Control – Part 3

 

Building K2 Smartform Control – Part 1

K2 Smartform is a rapid development tool that provide a WYSIWYG interface. There’s a lot of plus point to this as this closely resemble the visual studio designer or even dreamweaver and K2 have place alot of thought in the Smartform product design and a whole lot of controls are available out of the box.

However, the downside here is that since the K2 Smartform only work within the K2’s technology ecosystem, to extend the capability of the Smartform such as cooking your own controls or even using those commercially available (e.g. Telerik) are limiting.

In this article, we will be writing a mulit part series to show you guys how to build your own custom control.

Setup

The K2 Smartform is design such that its almost similar to any custom user control on ASP.NET or Sharepoint Webpart in terms of architecture.

To get started building a K2 Smartform custom control, head over to the following url and install the template that the community have release to help everyone get started.

K2 Visual Studio Template

Download the respective template and install for your version of Visual Studio. The “good” guys at the community have cater for different version of Visual Studio.

Getting Started – Creation of the K2 Smartform Control Project Solution

Now, let go about creating a new project. You should have a new category for the option on the left which is named K2.

K2 Visual Studio Project

Expand the K2 and select K2 Extension. Now choose Custom Smartform Control Project and give it a project name.

This should generate a Visual Studio Solution Project for you.

Generating the K2 Smartform Control Files

Let’s go generate some files for the custom control that we are going to build.

Right-Click and select Add New Item.

2. Visual Studio - Add New Item

Choose SmartForms Basic Client Control Item and give it a name. (This should be the name of the control).

3. Visual Studio - Add New Basic Client Control

 

Your Visual Studio Solution Explorer should look like below.

4. Directory Structure

 

Go to K2 Smartform Custom Control – Part 2

Global Variable in Objective C

Using Global Variable in Objective C, allow you to store static information or values similar to Microsoft.NET C#.

In this post, we are going to using the Singleton design pattern.

Step 1: Create the class in Xcode, add both the header and method file (.h / .m), call it GlobalVariables.

Step 2: Add the following content into your header file.

Step 3: Add the following content into your method file.

 

At this stage, you will be wondering what does all these do. You will be adding @property for those value that you want to be able to access globally in the header file and synthesize them in the method file.

How do we use them?

To access the singleton, you need to import the header file.

First, saving data to the singleton.

Getting Data from the Singleton

Reachability: Testing Internet Connectivity on IOS APP

Introduction

Any apps that you build today will require some form of internet connectivity.

In today’s mobile applications environment, apps are getting more and more intuitive. Users are constantly looking at the apps to notify them of the lack of connectivity.

Step 1 : Getting Reachability library into your Xcode Project

We will be using the following library, Reachability. https://github.com/tonymillion/Reachability

There are 2 ways to setup the app in your Xcode project.

1. Manual
– Check out a copy from the above github url, add the Reachability.h/.m file to your project

2. Cocoapod
– Add the following line to your pod file, pod ‘Reachability’
– Run pod install on terminal.

Step 2: Setting up the SystemConfiguration Framework.
– Go to the Project -> Targets -> Build Phases tab.
– Add SystemConfiguration.Framework into your project.

Step 3: Codes to set up Reachability to test internet connectivity.

AppDelegate.h

Import the Reachability.h, at the very top of the file.

#import “Reachability.h"

AppDelegate.m

Add the codes below to your application did Finish Launching method.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Add the following codes,

Reachability *reachability = [ReachabilityreachabilityWithHostname:@"http://localhost:3000/"];

reachability.reachableBlock = ^(Reachability *reachability) {
NSLog(@”Network is reachable.”);
};

reachability.unreachableBlock = ^(Reachability *reachability) {
NSLog(@”Network is unreachable.”);
};

// Start Monitoring
[reachability startNotifier];

Checking for inactivity in K2 Smartform

This article covers the steps to get a timer going that checks for inactivity.

Inactivity is consider as no movement in the mouse or keyboard.


So here we have create a View and add a Data Label in it.

Step 1, adding a Data Label
Step 1, adding a Data Label

 

Next go to the rules designer and add a View Initialize Rule.

2. Adding a View Init Rule
Step 2. Adding a View Initialize Rule

Now configure this rule and do a “Transfer Data” action.

3. Adding Transfer Data Action
Step 3. Adding a Transfer Data Action

The javascript that does all the magic is found here, http://stackoverflow.com/questions/9564602/how-to-know-browser-idle-time

But for our case, we need to modify it a little, so to use my version download the script from the following link, http://pastebin.com/embed_js.php?i=FDkg3EML

4. Adding the script
Step 4. Copy the script into the rule

 

Finally, Save & Checkin and Test.

Step 5. Testing!
Step 5. Testing!

Adding Or Removing mysql from AutoStarting on Mac

The following snippet provide sample for adding the mysql service to cheap jerseys auto start on mac.

Note: You should input all these in the terminal cmd cheap jerseys China window.

Step 1 :

Step 2:

The following snippet kolejnego allow you Montreal to remove antes auto starting the mysql server.

Things to note here my manually removing this file from the LaunchAgents will not unload it!