Error while choosing the input controls in SAP BO WebI

Hello All,

Today, we’ll talk about an error message you might get when you access the input controls for filtering your WebI reports for a newly created user or existing user. Below is the screen shot of the error message.

763905

For a new or existing user, ensure that the user has all the desired access to Connection, Universe and the Folder of the WebI report. Unless the user has the access to the above entities it is not possible for them to get to a point where they can access the WebI report and extract data from it.

So, after the access to the above entities are set, open the CMC and go to Applications section (CMC > Application). In the list select Web Intelligence (CMC > Application > Web Intelligence).

From the User Security window, select User Security tab and click Add Principals.

CMCWebi

It is in the Add Principals window, that the desired user is given the access to add.I had provided the access as Full Control, View On Demand, Schedule and View.

I hope, this solves your problem.

-Cheers!

 

 

Adding SOAP Header to ASP.Net Web Service

Hello All,

In todays age of technology, where data-interchange between systems is imminent. In some cases, it is the application interacting with each other or in some cases it will be the web services interacting with each other.

So, today, we will talk about how to add a SOAP header to your Web Service Call. i.e. if you are trying to call a web service, from your web service and you need to pass a SOAP header to each request you send to that service.

Commonly, web service access credentials are passed along with the service request.

This article assumes, you have a knowledge of:

  1. .Net
  2. Web Services
  3. What is SOAP
  4. How to create a ASP .Net Web Service Project in Visual Studio.

Visual Studio IDE:

  1. Visual Studio 2013

So, lets get started:

Firstly, after your .Net Web Service project is created, right click on the Project name and click Add >> Service Reference

Untitled.png

After you have added the service reference. A pop-up would appear as shown below:

test.png

Enter the Web Service URL that you need to connect to and click Go, to check the connectivity. If successfully connected, then enter the Namespace. In my case, the namespace is ‘ServiceReference’, and then click Ok.

Servicerefernece.png

The service reference will show up under Service References section as shown below:

solution.png

Now, lets open the Web.Config file and edit few things there. As you may see in the screen grab below, a new tag is added into the Web.Config by name name system.serviceModel. It is here that your web service bindings and endpoint details are mentioned.

webconfgig.png

Notice the endpoint tag is closing in-line. Which means, it does not have a separate closing tag

Now, remove the inline closing tag for Endpoint and add a separate closing tag for Endpoint as

webconfgig.png

After you do that, add the below tags in the endpoint tag as shown below:

Webconfig2.png

Now, the headers will be attached with each of your SOAP request.

I hope, this blog helps you with your problem.

-Cheers!

 

 

 

Unable to find a specification for ‘ObjectiveDropboxOfficial’ while pod install

Hello All!

Today, we’ll talk about an error which you will face, while using the DropBox V2 API with Objective-C SDK in XCode.

You can configure the DropBox V2 API, by following the steps in the official GitHub repository of DropBox at https://github.com/dropbox/dropbox-sdk-obj-c.

However, while following the instructions to configure it to your XCode project, you will run into an issue while following to integrate the Dropbox Objective-C SDK into your project using CocoaPods.

It is while running the command pod install after you update the pod file with the below information:

platform :ios, '8.0'
use_frameworks!

target '' do
    pod 'ObjectiveDropboxOfficial'
end

The error that you will face in the terminal is:

: $ pod install

Analyzing dependencies

[!] Unable to find a specification for `ObjectiveDropboxOfficial`

There is a workaround for this, all you need to do is run the following command:

pod repo update

I had run this command in my project directory.

It will take a while (it took a good 30 Mins for me to get my pods updated-so please be patient), for the pod to get updated.

After which run the below command to configure the DropBox SDK to your project. Please make sure that your project is not opened in the XCode.

Below are the statuses while configuring the SDK. It wont take much time to configure the SDK to your project.

Analyzing dependencies

Downloading dependencies

Installing ObjectiveDropboxOfficial (3.0.4)

Generating Pods project

Integrating client project

Once the project is configured, please use xcworkspace file to open the project.

I hope, it works for you all.

Please comment, if necessary.

-Cheers!

Error while installing Cocoapod or any Ruby Gem into OS X El Capitan or Sierra Errno::EPERM

Hello All,

Today, we’ll talk about an error you would be facing while installing a Ruby Gem into your OS X El Capitan or OS X Sierra.

ERROR:  While executing gem … (Errno::EPERM)

This is due to a fact that with OS X El Capitan and Sierra, there is a new security feature called called System Integrity Protection

Well, as I always say, there is always a workaround for your problems. And here is the one for this.

Open your Terminal, and type the below command into your terminal.

sudo gem install -n /usr/local/bin GEM_NAME_HERE

So, if you are going to install Cocoapods then type this command:

sudo gem install -n /usr/local/bin cocoapods

After few seconds, the pod should start installing into your OS X.

-Cheers!

 

 

 

How to print a Barcode to a shared / network Barcode Printer using .Net (System.Drawing.Printing.PrintDocument)

Hello All!

Today I’ll talk about how you can print a Barcode or a generic text to a Printer or a Barcode Label Printer.

This blog post will cover the following topics. You can choose your familiarity and proceed to the topic you wish to know.

  1. How to install a Barcode Printer
  2. How to share the Printer
  3. Printing Barcode to a Network Printer

You don’t need to spend on getting a Print Server or a Network Card enabled Barcode Label Printer (which few companies would try selling you) to bring the Barcode Label Printer into the Network. 

Follow these steps to make it all work! Ensure that you have connected a printer to your computer and you are able to run a Test Print out of it. You can name the printer whatever name you wish to name it as. This is the most essential part to get it all working.

If you do not know how to install a Barcode Label Printer in your workstation, please follow the below steps: ( I am installing the Barcode Label Printer with a Generic Text Driver)

STEPS TO INSTALL A BARCODE PRINTER

  1. Go to ControlPanel in your computer and click ‘Add a printer’

Addprinter.png

2. In the Add Printer Modal window, click ‘The printer that I want isn’t listed’ link. It will open up another modal window allowing you to choose the mode you want to add the printer.

addprinter2.png

 

3. In this window, choose ‘Add a local printer or network printer with manual settings’ option and click Next

addprinter3.png

4. In the next window, choose the port you have your printer connected. Mine is connected to USB port, so I am selected USB001 port.

TIP: If you see multiple USB ports in the list (which is normal), try to change the ports in the list and see if you are able to run a test print through that. I had faced similar problems in the past.

addprinter4.png

5. I always print barcodes using the Generic Text drivers (if you wish you change, you can according to your need), so in the below screenshot, I am selecting the Manufacturer as Generic and the Printers as Generic / Text Only. Click Next.

addprinter5.png

6. Select ‘Use the driver that is currently installed (recommended)’ Click Next

addprinter6.png

7. Name the printer as BAR or whatever name you wish to name the printer as and click Next.

addprinter7.png

8. In the below modal popup, if you wish to share the printer, click appropriately and give a proper Share Name. or click Do no share this printer and click Next.

addprinter8.png

9. You will receive a successful confirmation of your new printer being added into your printer list. If you wish to make it a default printer, you can check appropriately and click Finish.

addprinter9.png

HOW TO SHARE THE PRINTER

If you have selected to share the printer in the step 8 (above), then your printer is already shared and ready to use.

If not, then please follow the below steps to share the printer.

1. In the printers list, right click on the Barcode Label printer and click Printer Properties menu item.

Sharing1.png

2. This will open up the printers properties popup. Go to the Sharing tab and check the Share this printer checkbox and give it a share name. I usually provide the same name as the printer name to avoid any confusion. And click Ok.

Sharing2.png

That is it. Your printer is shared across the network.

Like I said, You don’t need to spend on getting a Print Server or a Network Card enabled Barcode Label Printer to bring the Barcode Label Printer into the Network. 

PRINTING BARCODE THROUGH THE NETWORK PRINTER

Firstly, you will have to list down the installed printers in the machine that the program is executed. Below is the code, that lists down the installed printers and shows it in a ListBox.

For Each strPrinterName As String In PrinterSettings.InstalledPrinters
ListBox_PrinterList.Items.Add(strPrinterName) ‘ Adding the installed printers.
Next

‘Find the Default printer
Dim PD As New PrintDocument
ListBox_PrinterList.SelectedItem = PD.DefaultPageSettings.PrinterSettings.PrinterName

Next, add the code to print to the printer

Public Sub prt(ByVal text As String, ByVal asPrinterName As String)
TextToBePrinted = text
Dim prn As New Printing.PrintDocument
Using (prn)
prn.PrinterSettings.PrinterName = asPrinterName
AddHandler prn.PrintPage, AddressOf Me.PrintPageHandler
prn.Print()
RemoveHandler prn.PrintPage, AddressOf Me.PrintPageHandler
End Using
End Sub

Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
Dim myFont As New Font(“Microsoft San Serif”, 10)
args.Graphics.DrawString(TextToBePrinted, New Font(myFont, FontStyle.Regular), Brushes.Black, 0, 0)
End Sub

In the above code, the asPrinterName argument holds the name of the selected printer. Argument text holds the text/barcode to be printed.

You should be testing it by now!

One Important thing to note:

Barcode Label Printers have their own programming language to send the barcode text to the Barcode Label Printer to print. I am using Zebra printers which enables us to use ZPL or EPL languages to send the barcode to the Zebra Barcode Label Printers.

-Cheers!

Rohant K.

List of Fonts available in iOS (9.3.4)

Hello There,

Today, i’ll be talking about the list of fonts in iOS (9.3.4):

You can set the Font by using this code:

[UIFont fontWithName:@”SFUIText-Regular” size:17.0]

Family name: Copperplate

Font name: Copperplate-Light

Font name: Copperplate

Font name: Copperplate-Bold

Family name: Heiti SC

Family name: Iowan Old Style

Font name: IowanOldStyle-Italic

Font name: IowanOldStyle-Roman

Font name: IowanOldStyle-BoldItalic

Font name: IowanOldStyle-Bold

Family name: Kohinoor Telugu

Font name: KohinoorTelugu-Regular

Font name: KohinoorTelugu-Medium

Font name: KohinoorTelugu-Light

Family name: SF UI Text

Font name: SFUIText-Regular

Family name: Heiti TC

Family name: Courier New

Font name: CourierNewPS-BoldMT

Font name: CourierNewPS-ItalicMT

Font name: CourierNewPSMT

Font name: CourierNewPS-BoldItalicMT

Family name: Gill Sans

Font name: GillSans-Italic

Font name: GillSans-Bold

Font name: GillSans-BoldItalic

Font name: GillSans-LightItalic

Font name: GillSans

Font name: GillSans-Light

Font name: GillSans-SemiBold

Font name: GillSans-SemiBoldItalic

Font name: GillSans-UltraBold

Family name: Apple SD Gothic Neo

Font name: AppleSDGothicNeo-Bold

Font name: AppleSDGothicNeo-Thin

Font name: AppleSDGothicNeo-UltraLight

Font name: AppleSDGothicNeo-Regular

Font name: AppleSDGothicNeo-Light

Font name: AppleSDGothicNeo-Medium

Font name: AppleSDGothicNeo-SemiBold

Family name: Marker Felt

Font name: MarkerFelt-Thin

Font name: MarkerFelt-Wide

Family name: Thonburi

Font name: Thonburi

Font name: Thonburi-Bold

Font name: Thonburi-Light

Family name: Avenir Next Condensed

Font name: AvenirNextCondensed-BoldItalic

Font name: AvenirNextCondensed-Heavy

Font name: AvenirNextCondensed-Medium

Font name: AvenirNextCondensed-Regular

Font name: AvenirNextCondensed-HeavyItalic

Font name: AvenirNextCondensed-MediumItalic

Font name: AvenirNextCondensed-Italic

Font name: AvenirNextCondensed-UltraLightItalic

Font name: AvenirNextCondensed-UltraLight

Font name: AvenirNextCondensed-DemiBold

Font name: AvenirNextCondensed-Bold

Font name: AvenirNextCondensed-DemiBoldItalic

Family name: Tamil Sangam MN

Font name: TamilSangamMN

Font name: TamilSangamMN-Bold

Family name: Helvetica Neue

Font name: HelveticaNeue-Italic

Font name: HelveticaNeue-Bold

Font name: HelveticaNeue-UltraLight

Font name: HelveticaNeue-CondensedBlack

Font name: HelveticaNeue-BoldItalic

Font name: HelveticaNeue-CondensedBold

Font name: HelveticaNeue-Medium

Font name: HelveticaNeue-Light

Font name: HelveticaNeue-Thin

Font name: HelveticaNeue-ThinItalic

Font name: HelveticaNeue-LightItalic

Font name: HelveticaNeue-UltraLightItalic

Font name: HelveticaNeue-MediumItalic

Font name: HelveticaNeue

Family name: Gurmukhi MN

Font name: GurmukhiMN-Bold

Font name: GurmukhiMN

Family name: Times New Roman

Font name: TimesNewRomanPSMT

Font name: TimesNewRomanPS-BoldItalicMT

Font name: TimesNewRomanPS-ItalicMT

Font name: TimesNewRomanPS-BoldMT

Family name: Georgia

Font name: Georgia-BoldItalic

Font name: Georgia

Font name: Georgia-Italic

Font name: Georgia-Bold

Family name: Apple Color Emoji

Font name: AppleColorEmoji

Family name: Arial Rounded MT Bold

Font name: ArialRoundedMTBold

Family name: Kailasa

Font name: Kailasa-Bold

Font name: Kailasa

Family name: Kohinoor Devanagari

Font name: KohinoorDevanagari-Light

Font name: KohinoorDevanagari-Regular

Font name: KohinoorDevanagari-Semibold

Family name: Kohinoor Bangla

Font name: KohinoorBangla-Semibold

Font name: KohinoorBangla-Regular

Font name: KohinoorBangla-Light

Family name: Chalkboard SE

Font name: ChalkboardSE-Bold

Font name: ChalkboardSE-Light

Font name: ChalkboardSE-Regular

Family name: Sinhala Sangam MN

Font name: SinhalaSangamMN-Bold

Font name: SinhalaSangamMN

Family name: PingFang TC

Font name: PingFangTC-Medium

Font name: PingFangTC-Regular

Font name: PingFangTC-Light

Font name: PingFangTC-Ultralight

Font name: PingFangTC-Semibold

Font name: PingFangTC-Thin

Family name: Gujarati Sangam MN

Font name: GujaratiSangamMN-Bold

Font name: GujaratiSangamMN

Family name: Damascus

Font name: DamascusLight

Font name: DamascusBold

Font name: DamascusSemiBold

Font name: DamascusMedium

Font name: Damascus

Family name: Noteworthy

Font name: Noteworthy-Light

Font name: Noteworthy-Bold

Family name: Geeza Pro

Font name: GeezaPro

Font name: GeezaPro-Bold

Family name: Avenir

Font name: Avenir-Medium

Font name: Avenir-HeavyOblique

Font name: Avenir-Book

Font name: Avenir-Light

Font name: Avenir-Roman

Font name: Avenir-BookOblique

Font name: Avenir-Black

Font name: Avenir-MediumOblique

Font name: Avenir-BlackOblique

Font name: Avenir-Heavy

Font name: Avenir-LightOblique

Font name: Avenir-Oblique

Family name: Academy Engraved LET

Font name: AcademyEngravedLetPlain

Family name: Mishafi

Font name: DiwanMishafi

Family name: Futura

Font name: Futura-CondensedMedium

Font name: Futura-CondensedExtraBold

Font name: Futura-Medium

Font name: Futura-MediumItalic

Family name: Farah

Font name: Farah

Family name: Kannada Sangam MN

Font name: KannadaSangamMN

Font name: KannadaSangamMN-Bold

Family name: Arial Hebrew

Font name: ArialHebrew-Bold

Font name: ArialHebrew-Light

Font name: ArialHebrew

Family name: Arial

Font name: ArialMT

Font name: Arial-BoldItalicMT

Font name: Arial-BoldMT

Font name: Arial-ItalicMT

Family name: Party LET

Font name: PartyLetPlain

Family name: Chalkduster

Font name: Chalkduster

Family name: Hoefler Text

Font name: HoeflerText-Italic

Font name: HoeflerText-Regular

Font name: HoeflerText-Black

Font name: HoeflerText-BlackItalic

Family name: Optima

Font name: Optima-Regular

Font name: Optima-ExtraBlack

Font name: Optima-BoldItalic

Font name: Optima-Italic

Font name: Optima-Bold

Family name: Palatino

Font name: Palatino-Bold

Font name: Palatino-Roman

Font name: Palatino-BoldItalic

Font name: Palatino-Italic

Family name: Malayalam Sangam MN

Font name: MalayalamSangamMN-Bold

Font name: MalayalamSangamMN

Family name: Al Nile

Font name: AlNile-Bold

Font name: AlNile

Family name: Lao Sangam MN

Font name: LaoSangamMN

Family name: Bradley Hand

Font name: BradleyHandITCTT-Bold

Family name: PingFang HK

Font name: PingFangHK-Ultralight

Font name: PingFangHK-Semibold

Font name: PingFangHK-Thin

Font name: PingFangHK-Light

Font name: PingFangHK-Regular

Font name: PingFangHK-Medium

Family name: Trebuchet MS

Font name: Trebuchet-BoldItalic

Font name: TrebuchetMS

Font name: TrebuchetMS-Bold

Font name: TrebuchetMS-Italic

Family name: Helvetica

Font name: Helvetica-Bold

Font name: Helvetica

Font name: Helvetica-LightOblique

Font name: Helvetica-Oblique

Font name: Helvetica-BoldOblique

Font name: Helvetica-Light

Family name: Courier

Font name: Courier-BoldOblique

Font name: Courier

Font name: Courier-Bold

Font name: Courier-Oblique

Family name: Cochin

Font name: Cochin-Bold

Font name: Cochin

Font name: Cochin-Italic

Font name: Cochin-BoldItalic

Family name: Hiragino Mincho ProN

Font name: HiraMinProN-W6

Font name: HiraMinProN-W3

Family name: Devanagari Sangam MN

Font name: DevanagariSangamMN

Font name: DevanagariSangamMN-Bold

Family name: Oriya Sangam MN

Font name: OriyaSangamMN

Font name: OriyaSangamMN-Bold

Family name: Snell Roundhand

Font name: SnellRoundhand-Bold

Font name: SnellRoundhand

Font name: SnellRoundhand-Black

Family name: Zapf Dingbats

Font name: ZapfDingbatsITC

Family name: Bodoni 72

Font name: BodoniSvtyTwoITCTT-Bold

Font name: BodoniSvtyTwoITCTT-Book

Font name: BodoniSvtyTwoITCTT-BookIta

Family name: Verdana

Font name: Verdana-Italic

Font name: Verdana-BoldItalic

Font name: Verdana

Font name: Verdana-Bold

Family name: American Typewriter

Font name: AmericanTypewriter-CondensedLight

Font name: AmericanTypewriter

Font name: AmericanTypewriter-CondensedBold

Font name: AmericanTypewriter-Light

Font name: AmericanTypewriter-Bold

Font name: AmericanTypewriter-Condensed

Family name: Avenir Next

Font name: AvenirNext-UltraLight

Font name: AvenirNext-UltraLightItalic

Font name: AvenirNext-Bold

Font name: AvenirNext-BoldItalic

Font name: AvenirNext-DemiBold

Font name: AvenirNext-DemiBoldItalic

Font name: AvenirNext-Medium

Font name: AvenirNext-HeavyItalic

Font name: AvenirNext-Heavy

Font name: AvenirNext-Italic

Font name: AvenirNext-Regular

Font name: AvenirNext-MediumItalic

Family name: Baskerville

Font name: Baskerville-Italic

Font name: Baskerville-SemiBold

Font name: Baskerville-BoldItalic

Font name: Baskerville-SemiBoldItalic

Font name: Baskerville-Bold

Font name: Baskerville

Family name: Khmer Sangam MN

Font name: KhmerSangamMN

Family name: Didot

Font name: Didot-Italic

Font name: Didot-Bold

Font name: Didot

Family name: Savoye LET

Font name: SavoyeLetPlain

Family name: Bodoni Ornaments

Font name: BodoniOrnamentsITCTT

Family name: Symbol

Font name: Symbol

Family name: Menlo

Font name: Menlo-Italic

Font name: Menlo-Bold

Font name: Menlo-Regular

Font name: Menlo-BoldItalic

Family name: Bodoni 72 Smallcaps

Font name: BodoniSvtyTwoSCITCTT-Book

Family name: SF UI Display

Font name: SFUIDisplay-Regular

Family name: Papyrus

Font name: Papyrus

Font name: Papyrus-Condensed

Family name: Hiragino Sans

Font name: HiraginoSans-W3

Font name: HiraginoSans-W6

Family name: PingFang SC

Font name: PingFangSC-Ultralight

Font name: PingFangSC-Regular

Font name: PingFangSC-Semibold

Font name: PingFangSC-Thin

Font name: PingFangSC-Light

Font name: PingFangSC-Medium

Family name: Euphemia UCAS

Font name: EuphemiaUCAS-Italic

Font name: EuphemiaUCAS

Font name: EuphemiaUCAS-Bold

Family name: Telugu Sangam MN

Family name: Bangla Sangam MN

Family name: Zapfino

Font name: Zapfino

Family name: Bodoni 72 Oldstyle

Font name: BodoniSvtyTwoOSITCTT-Book

Font name: BodoniSvtyTwoOSITCTT-Bold

Font name: BodoniSvtyTwoOSITCTT-BookIt

Cheers!!

Rohant K

Set Landscape or Portrait Orientation for a Single View Controller (Objective-C)

Hello All,

Today, I’ll talk to you all about setting only a single View Controller in a StoryBoard (with NavigationController) to either Portrait or Landscape Orientation.

So lets get started!

Firstly set the Device Orientation property of the project to allow Portrait.. Landscape Left and Landscape Right orientations.

Screen Shot 2016-07-24 at 5.14.15 PM.png

Next we point our attention to AppDelegate.m class of your project.

Copy the below snippet into your AppDelegate.m file. The below snippet will return the top ViewController in the UI Stack of the RootViewController

 

– (UIViewController *)topViewController{

return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];

}

– (UIViewController *)topViewController:(UIViewController *)rootViewController

{

if (rootViewController.presentedViewController == nil) {

return rootViewController;

}

if ([rootViewController.presentedViewController isMemberOfClass:[UINavigationController class]]) {

UINavigationController *navigationController = (UINavigationController *)rootViewController.presentedViewController;

UIViewController *lastViewController = [[navigationController viewControllers] lastObject];

return [self topViewController:lastViewController];

}

UIViewController *presentedViewController = (UIViewController *)rootViewController.presentedViewController;

return [self topViewController:presentedViewController];

}

Now add the below snippet in the AppDelegate file. This snippet will check the the current top View Controller in the RootViewController by its title.

And according to its title, will decide, what would be the Orientation of the View Controller.

In the below snippet, I have set the orientation to Landscape with a specific title and for the rest, I have set the orientation to Portrait.

A bit of a workaround, but it works for me.

– (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

{

if ([[self topViewController].title isEqualToString: @”Enter your view controller title”])

{

return UIInterfaceOrientationMaskLandscape;

}

else return UIInterfaceOrientationMaskPortrait;

}

One More Thing!

Now lets point our focus towards the Storyboard. The above snippet / code will work only if you present your “Landscape” view controller Modally.

So, in order to set the “Kind” property in the Segue to “Present Modally”. Screen Shot 2016-07-24 at 5.30.39 PM.png

Also, it would be better if you change the orientation of the View Controller to Landscape by changing the “Orientation” property to Landscape!

Screen Shot 2016-07-24 at 5.32.27 PM.png

I hope it helps!

Do comment your opinions!

Cheers!!

Rohant K!

‘global_asax’ is ambiguos in the namespace ‘ASP’

Hello All!

Today, I’ll talk about an error message, that I had encountered while compiling my ASP.Net Web Application, which nearly, compelled me to create a new Project Solution and transfer my project files into that Solution – Old School way of getting things to work 🙂

The Global.asax, Project Classes and Web Service references were all showing the error for ambiguity.

Error.png

After struggling for 3-4 days to get my Project Solution working, I arrived at a solution.

You’ll have to delete these files from the Bin folder and then build the solution again.

files.png

I hope it works for you’ll too!

Cheers!

Rohant K3

Reducing the Database Log File Size

Hello All,

Today i’ll talk about how to reduce the file size of the Log file of your SQL Server Database.

Log Files tend to grow to an extent that it might eat up a lot of space on your drive and for me it went to an extent that my database was down due to lack of space on the drive.

So, no apps were able to dump any record into the database at all.

Well, we’ll have to live with it though as it seems.

Log Files can be cleared using a SQL Script

ALTER DATABASE  DATABASENAME
SET RECOVERY SIMPLE;
GO
— Shrink the truncated log file to 1 GB (You can shrink upto 1 MB).
DBCC SHRINKFILE (DATABASE_log, 1000); –LOG FILE NAME
GO
— Reset the database recovery model.
ALTER DATABASE DATABASENAME
SET RECOVERY FULL;
GO

Hope this works for you too!

Cheers!

Rohant K.

Using HighCharts with ASP.Net

Hello There!

Today, we will talk about using HighCharts with ASP.Net Web Site.

I am big fan of responsiveness in a Web Site whenever it comes to a single platform for information sharing. I use HighCharts for responsive dashboards.

Since HighCharts is purely a JavaScript front-end / client side API for showing charts, we will be using DotNet.HighCharts for building up the Chart from the code-behind rather than using Client-side JavaScript.

So, first create an Asp.Net web site and run the Nuget Package Manager Console as shown below and execute the following command for Nuget to download and reference DotNet.HighCharts

Install-Package DotNet.Highcharts

PackageManager.png

After Nuget has downloaded and referenced the DotNet.HighCharts, its DLL will be automatically referenced by the Project. Please cross-check if your project references DotNet.HighCharts.dll in the references window.

TIP: If you are facing difficulties in downloading the package, then there is a download link for the DotNet.Highcharts.dll at the end of this tutorial.

References.png

In your code-behind file, add the below imports statements:

Imports DotNet.Highcharts.Enums
Imports DotNet.Highcharts.Helpers
Imports DotNet.Highcharts.Options
Imports Point = DotNet.Highcharts.Options.Point
Imports DotNet.Highcharts
Imports System.Drawing
Imports System.Net
Imports System.Runtime.Serialization.Json
Imports System.IO
Imports Newtonsoft.Json
Imports System.Data ‘ To use incase your charts is connected to the DataSet to fetch the data from database

I will be showing two examples:

  1. Column Chart (using 1 Dimensional Array)
  2. Pie Chart (using 2 Dimensional Array)

In the .aspx add the below call to the Highcharts javacript reference. Without this call, your chart will not render on the web page.

http://code.highcharts.com/highcharts.js

<%–without the call to the exporting.js, your chart will not be able to export itself to any format.–%>
http://code.highcharts.com/modules/exporting.js

Add the ASP.Net Literal Controls in the Markup as shown below:

<asp:Literal ID=”Literal_Column” runat=”server”></asp:Literal>

<asp:Literal ID=”Literal_Pie” runat=”server”></asp:Literal>

Now lets open the Code behind vb file.

Column Chart:

I am adding the below code to a event handler to launch and populate the chart with the data.

In order to show the information in Column Chart, you need information for the X Axis and the Y Axis. So, for this purpose you must have two single dimensional arrays filled up. One for the X Axis and the other for the Y Axis.

‘ COLUMN CHART WORK AREA

Dim oListXAxis As New List(Of String)()
Dim oListYAxis As New List(Of Object)() ‘ You must have the Y Axis data in the Array of type Object only. It will not be able to read through the other data types.

‘ Below, I am filling the information from the DataSet oDataSet into the Array. One for the XAxis and the other for the YAxis

Dim oArrXAxis As New ArrayList

oArrXAxis.Add(“Jan”)
oArrXAxis.Add(“Feb”)
oArrXAxis.Add(“Mar”)

Dim oArrYAxis As New ArrayList

oArrYAxis.Add(“123”)
oArrYAxis.Add(“456”)
oArrYAxis.Add(“789”)

For iCountXAxis As Int32 = 0 To oArrXAxis.Count – 1
oListXAxis.Add(oArrXAxis(iCountXAxis))
Next

For iCountYAxis As Int32 = 0 To oArrYAxis.Count – 1
oListYAxis.Add(oArrYAxis(iCountYAxis))
Next

Next, We will move to create a Chart object.

Dim chartColumn As Highcharts ‘ HighCharts Object.

chartColumn = New Highcharts(“ColumnChart”).InitChart(New Chart() With { _
.DefaultSeriesType = ChartTypes.Column, _
.Animation = New DotNet.Highcharts.Helpers.Animation(True), _
.MarginRight = 130, _
.MarginBottom = 25, _
.ClassName = “chart”}) _
.SetCredits(New DotNet.Highcharts.Options.Credits() With { _
.Enabled = False}) _
.SetTitle(New Title() With { _
.Text = “Column Charts”, _
.X = -20 _
}) _
.SetSubtitle(New Subtitle() With { _
.Text = “Source: Rohant Kunnat @ WordPress”, _
.X = -20 _
}) _
.SetXAxis(New XAxis() With { _
.Categories = oListXAxis.ToArray() _
}) _
.SetYAxis(New YAxis() With { _
.Title = New YAxisTitle() With { _
.Text = “Connections” _
}, _
.PlotLines = {New YAxisPlotLines() With { _
.Value = 0, _
.Width = 1, _
.Color = ColorTranslator.FromHtml(“#808080”) _
}} _
}) _
.SetTooltip(New Tooltip() With { _
.Formatter = “function() {” & vbCr & vbLf & “return ‘<b>’+ this.series.name +'</b><br/>’+” & vbCr & vbLf & ” this.x +’: ‘+ this.y +”;” & vbCr & vbLf & ” }” _
}) _
.SetLegend(New Legend() With { _
.Layout = Layouts.Vertical, _
.Align = HorizontalAligns.Right, _
.VerticalAlign = VerticalAligns.Top, _
.X = -10, _
.Y = 100, _
.BorderWidth = 0 _
}) _
.SetSeries({New Series() With { _
.Name = “Count of Q1”, _
.Data = New Data(oListYAxis.ToArray)}})

Literal_Column.Text = chartColumn .ToHtmlString() ‘ Sets the Chart to the ASP.Net Literal control.

Pie Chart:

I am adding the below code to a event handler to launch and populate the chart with the data.

‘ PIE CHART WORK AREA

‘ Q1 REPORT.
Dim oDTQ1Report As New DataTable
Dim oDCQ1ReportMonth As New DataColumn(“MONTH”)
Dim oDCQ1ReportCount As New DataColumn(“COUNT”)

Dim oDRQ1Report As DataRow

oDTQ1Report.Columns.Add(oDCQ1ReportMonth)
oDTQ1Report.Columns.Add(oDCQ1ReportCount)
oDTQ1Report.AcceptChanges()

oDRQ1Report = oDTQ1Report.NewRow()
oDRQ1Report.Item(0) = “Jan”
oDRQ1Report.Item(1) = “123”
oDTQ1Report.Rows.Add(oDRQ1Report)

oDRQ1Report = oDTQ1Report.NewRow()
oDRQ1Report.Item(0) = “Feb”
oDRQ1Report.Item(1) = “456”
oDTQ1Report.Rows.Add(oDRQ1Report)

oDRQ1Report = oDTQ1Report.NewRow()
oDRQ1Report.Item(0) = “Mar”
oDRQ1Report.Item(1) = “789”
oDTQ1Report.Rows.Add(oDRQ1Report)

oDTQ1Report.AcceptChanges()

‘ We’ll have to convert the DataTable into a two dimensional array for the Pie Chart to understand. So lets declare a two dimensional array as show below:

Dim o2DArrQ1Report(oDTQ1Report.Rows.Count – 1, 1) As Object

For iCount As Int32 = 0 To oDTQ1Report.Rows.Count – 1

For iCount2d As Int32 = 0 To 1

o2DArrQ1Report(iCount, iCount2d) = oDTQ1Report(iCount)(iCount2d)

Next

Next

 

Next, We will move to create a Chart object.

‘ PIE CHART

Dim chartPie  As Highcharts ‘ HighCharts Object.
chartPie = New Highcharts(“chartPie”).InitChart(New Chart() With { _
.Type = ChartTypes.Pie, _
.MarginTop = 80, _
.MarginRight = 40, _
.Animation = New DotNet.Highcharts.Helpers.Animation(True), _
.Options3d = New ChartOptions3d() With { _
.Enabled = True, _
.Alpha = 45, _
.Beta = 0 _
} _
}).SetCredits(New DotNet.Highcharts.Options.Credits() With { _
.Enabled = False}) _
.SetTitle(New Title() With { _
.Text = “Pie Chart” _
}).SetTooltip(New Tooltip() With { _
.PointFormat = “{series.name}: <b>{point.value}</b>” _
}).SetPlotOptions(New PlotOptions() With { _
.Pie = New PlotOptionsPie() With { _
.AllowPointSelect = True, _
.Cursor = Cursors.Pointer, _
.Depth = 35, _
.DataLabels = New PlotOptionsPieDataLabels() With { _
.Enabled = True, _
.Color = ColorTranslator.FromHtml(“#000000”), _
.Formatter = “function() { return ‘<b>’+ this.point.name +'</b>: ‘+ this.y; }”
} _
} _
}).SetSeries(New Series() With { _
.Type = ChartTypes.Pie, _
.Name = “Q1 Report”, _
.Data = New Data(o2DArrQ1Report) _
})

Literal_Pie.Text = chartPie .ToHtmlString() ‘ Sets the Chart to the ASP.Net Literal control.

EXPORTING THE CHARTS

In a way, it is a great practice, if the user is able to export the charts as an image or a PDF document. So, in order to enable the export of the Charts, please include the following call to the Java Script in your Default.aspx

http://code.highcharts.com/modules/exporting.js

After adding this script call, the Export button will appear on the top right corner of the Chart.

ContextMenu.png

The option lets you to export the Chart to various file types.

And that is it!, you should be getting your Charts on the Web Page.

It is quite difficult for me to show a complete example of all the chart types available with Highcharts in this blog. Nevertheless, I would definitely come up with a solution in case you have any problems for implementing any other chart type available with HighCharts.

If you have any trouble getting around this tutorial, please don’t hesitate to leave a comment on my blog.

With a big public demand in form of comments and eMails to me for the Download link of the above tutorial, Good News!!, I have a download link for it now. Please click the below link for the above tutorial.

Download Link for the above blog

TIP: The entire code resides in the Default.aspx file and Default.aspx.vb file. If the project for reason or dependency does not run, then just copy the Default.aspx and Default.aspx.vb file into another project of yours. In this case, you will have to download the DotNet.Highcharts.dll to your project as well. You can download from the below link.

Download Link for DotNet.HighCharts.dll

Cheers!

Rohant K