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

Advertisements

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

 

Apple Push Notification Production certificate not recognized by PushSharp

Hello There,

Today, i’ll talk about the problem, where your Production Apple Push Notification Service Certificate is not recognized by Push Sharp.

I use Push Sharp [Github] to send push notifications to the iOS devices.

Somehow things were Ok, until I was using my development / sandbox certificate. But then when the Production APNS certificates were being used to send Push Notifications, I received an exception in PushSharp which read:

You have selected the Production server, yet your Certificate does not appear to be the Production certificate! Please check to ensure you have the correct certificate!

After thoroughly revisiting other tech blogs, I found that Apple has changed the name in the Production Service from : “Apple Production IOS Push Services” to “Apple Push Services”

So, to fix this:

  1. Go to ApplePushChannelSettings.cs file
  2. Go to CheckProductionCertificateMatching(bool production) method
  3. Change the If condition from
    1. if (production && !subjectName.Contains(“Apple Production IOS Push Services”)) to¬†if (production && !subjectName.Contains(“Apple Push Services”))
  4. Secondly, in the¬†bool DetectProduction(X509Certificate2 certificate) function change the If Condition from¬†if (subjectName.Contains(“Apple Production IOS Push Services”)) to¬†if (subjectName.Contains(“Apple Push Services”))

That is it! Build your project and your distribution / production push notification service is ready to use!

-Cheers!

Rohant K.

 

MapBox GL JS: Resize maps on hidden divs or Modal Dialog boxes in Bootstrap. Server Side event.

Hello There,

Today, we i’ll show you how to resize a map on a Bootstrap Modal Dialog box which is hidden.

You may sometimes find it easy to show up a map window in Bootstrap Modal Dialog Box than occupying a large real estate on your web page.

I am using MapBox since it has got the most intuitive, extended open-source Map JS. Moreover it is much faster to render on a Web Page than Google Maps. So if you have a not-so-complicated requirement to show up on a Map, I would recommend MapBox.

So, lets get started..

If you dont have a MapBox Account, it is required that you create an account first. You can visit https://www.mapbox.com/studio/signup/ . After signing up, you will receive a API Key for your account, which you can use for your projects.

STEP 1:

Create ASP.Net Web Page Project.

STEP 2:

Go to Default.aspx (or any other aspx file, you want the map to be drawn..) and add the following lines of code below the <asp:Content /> declaration.

<meta name=’viewport’ content=’initial-scale=1,maximum-scale=1,user-scalable=no’ />
https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.js
<link href=’https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.css&#8217; rel=’stylesheet’ />

STEP 3:

Add the Style tag. This style tag defines the style for the map. Below the map is saved in a map variable, so the style is defined for the #map variable.

<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width:100%
}
</style>

STEP 4:

Add a Bootstrap Modal to show the map.

ModalMap.png
Some how WordPress did not allow me to add this markup as a plain text. So adding it as a screenshot. Bear with me. ūüôā

STEP 5:

Add the java script to handle the bootstrap modal dialog box and also set the Map attributes.

mapboxgl.accessToken = ”; // Enter you MapBox Access Token here.

var map = new mapboxgl.Map({
container: ‘map’, // container id
style: ‘mapbox://styles/mapbox/streets-v8’, //stylesheet location
center: [, ], // starting position. I have two variables sLatitude and sLongitude here to pass the Latitude and Longitude from the Server Side.
zoom: 9 // starting zoom
});

function MapModal() {
$(‘#Map_Modal’).modal();
}

function MapResize() {
map.resize(); // We will use the map.resize() function, to resize the MapBox map  once the modal has finished loading.
}

// Given that your modal has the id #modal
// and your map is under the variable map. The ‘shown.bs.modal’ event handler is an in-built event handler for Bootstrap Modals.
$(‘#Map_Modal’).on(‘shown.bs.modal’, function () {
map.resize();
});

STEP 6:

On the server side we must now pass the values of Latitude and Longitude to the two variables sLatitude and sLongitude. Below is the full code from the Server Side.

Partial Class _Default
Inherits Page

Protected sLatitude As String
Protected sLongitude As String

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

sLatitude = “58.548025”
sLongitude = “23.6063006”

End Sub

Protected Sub Button_Click_Click(sender As Object, e As EventArgs)

‘ First to execute the script to show the modal dialog box.
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), “LaunchServerSide”, “$(function() { MapModal(); });”, True)

‘ Second, to execute the resize function of the MapBox.
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), “LaunchServerSide”, “$(function() { MapResize(); });”, True)

End Sub
End Class

And that is it!

You should be having the map drawn properly on a Bootstrap Modal Dialog Box.

-Cheers!

Rohant K.

 

How to get the Windows User Name of the logged in user in ASP.Net, IIS

Hello There!

So, today i’ll speak ¬†about how you can get the User ID of the current user who has logged into the Web Application.

Lets consider the Web Application is hosted in IIS.

Here, I am avoiding all the boiler plate code to create and set up your project and host into the IIS.

There are three ways to get the logged in User ID in ASP.Net.

FIRST WAY

<authentication mode=”Windows”/>

You can add the authentication tag into the <system.web> tag in the Web.config file of your project.

Enable the Anonymous access in IIS. You will find this setting in your Application under the Authentication Option.

Authentication.png EnableAnonymousAuthentication.png

Write the below lines of code in your application CS or VB file.

  1. System.Environment.UserName .. Will give you the Computer Name
  2. Page.User.Identity.Name .. Will give you Blank
  3. System.Security.Principal.WindowsIdentity.GetCurrent().Name .. Will give you the Computer Name

SECOND WAY

<authentication mode=”Windows”/>

You can add the authentication tag into the <system.web> tag in the Web.config file of your project.

Disable the Anonymous access & Enable Windows Authentication in IIS. You will find this setting in your Application under the Authentication Option.

Authentication.pngEnableWindowsAuthentication.png

After setting the Application to enable Windows Authentication, you will have to migrate your application to a Classic .NET AppPool and enable the  Integrated Pipeline for the Classic .Net AppPool inside the IIS.

AppPool.png

Write the below lines of code in your application CS or VB file.

  1. System.Environment.UserName .. Will give you ASPNET. i.e the account that is used to run the Asp.Net service.
  2. Page.User.Identity.Name .. Will give you Domain\Windows Account Name
  3. System.Security.Principal.WindowsIdentity.GetCurrent().Name .. Will give you Computer Name\ASPNET

 

THIRD WAY

<authentication mode=”Windows”/>¬†<identity impersonate =”true”/>

You can add the above tags into the <system.web> tag in the Web.config file of your project.

Disable the Anonymous access & Enable Windows Authentication in IIS

Authentication.pngEnableWindowsAuthentication.png

After setting the Application to enable Windows Authentication, you will have to migrate your application to a Classic .NET AppPool and enable the  Integrated Pipeline for the Classic .Net AppPool inside the IIS.

AppPool.png

Write the below lines of code in your application CS or VB file.

  1. System.Environment.UserName .. Will give you Windows Account Name
  2. Page.User.Identity.Name .. Will give you Domain\Windows Account Name
  3. System.Security.Principal.WindowsIdentity.GetCurrent().Name .. Will give you Domain\Windows Account Name

* Browser will ask you for the user name and password if the Windows Authentication is enabled.

That’s all you have to do to fetch the Windows User ID in ASP .Net IIS environment.

Cheers!

Rohant K.

 

Using Microsoft Exchange Web Service – EWS

Hello There,

We do have requirements to integrate your application with the eMail, either by sending them or by reading them (Yes! Рit is possible), for this purpose, Microsoft has a cool new protocol called as the Exchange Web Services.

If you have an eMail Exchange Server 2007 and above already set up, then it is a cake walk to integrate your application with the Exchange Server eMail using EWS.

NOTE: At the time of writing this article EWS API 2.2 was the latest version.

NOTE: I am using VB .Net for this example

So lets get started!

Firstly, you’ll need to download the EWS API from the Microsoft MSDN website, using the below URL and follow the installation procedure mentioned there:

https://www.microsoft.com/en-us/download/details.aspx?id=42951

After installing the EWS API 2.2, you must now turn on your Visual Studio environment and create a new Project:

VS1.pngnewProject.png

Click ‘Ok’ to create a new project.

Now lets turn our focus on the steps to reference the newly installed Exchange Web Service. We will have to manually reference them into our project. To do this:

Click the add reference menu item by right clicking the project > Add > Reference

reference

A Reference Manager window opens upReferenceManager.png

Click Browse on the left pane and then click Browse button again from the Footer

It will open up the Windows Explorer. Navigate to the below path, which ideally the default path where the Exchange Web Services are installed.

 

C:\Program Files\Microsoft\Exchange\Web Services\2.2

reference2.png

There are two dlls that you will have to import into your project. Click Add after you select them both.

reference3.png

You need to keep these information handy before you follow the code below:

  1. Your Microsoft Exchange Server version (For example Exchange Server 2007 or Exchange Server 2010 etc.)
  2. eMail ID, Password and the Domain Name that you will be using to send the eMail from
  3. URL of your exchange web service. Ideally, it is the exchange server name. You can find your exchange server name, by going into the Account Settings. The highlighted area in the image below is the server name. So the URL of the exchange web service would be https://<Server Name>/EWS/Exchange.asmx . Clicking on the link the web service page of the Exchange should open up. It will ask you for your user name and password.
  4. AccountInfo1.png
  5. An HTML File, for you to send an eMail (You can even send a plan text eMail.)

Now lets send an eMail using EWS!

Follow the code block below:


' We create an object of the Exchange Server. 
' In the argument, I specify the Exchange Server Version. Mine is 2010.
Dim service As New ExchangeService(ExchangeVersion.Exchange2010_SP2)
service.Credentials = New WebCredentials(<eMail ID of the Sender>, <Password of the sender>, <Domain Name under which your Exchange Server resides>)

' This is your Exchange Web Service URL
service.Url = New Uri("https://<Server Name>/EWS/Exchange.asmx")

' Set up the recepients eMail IDs
Dim oEmail As New EmailMessage(service)
oEmail.ToRecipients.Add(<Recipient EMail ID>)

' Read the HTML File and store it in a String.
 Dim sHtml As String = System.IO.File.ReadAllText("C:\index.html")

' EMail Subject, Body Block

 oEmail.Subject = "SUBJECT"
 oEmail.Body = New MessageBody(sHtml)
 oEmail.Body.BodyType = BodyType.HTML
 oEmail.Send()

' To trace the request and responses while using EWS. It helps to find out where your service is wrong.
 service.TraceEnabled = True
 service.TraceFlags = TraceFlags.All

and thats it!, this is how you can send an eMail using Microsoft Exchange Service API 2.2 web service.

You can extend the capability further, by reading the eMail messages from the inbox using the Exchange Web Service.

Let me know your comments!

-Cheers!

Rohant K.