• Home
  • About
  • Resume

Infragistics WebDataMenu flashes unexpected color on hover

By , 07/17/2014 2:44 PM

WebDataMenu
Infragistics WebDataMenu ASP.NET control comes both with predefined stylesets and allows you granularly overwrite any of the styles. For example definition like this

<ig:WebDataMenu ID="xmyMenu" runat="server" StyleSetName="Office2007Blue"
                 CssClass ="topMenuStyle" >
   <GroupSettings Orientation="Horizontal" />
   <ItemSettings CssClass="itemCssStyle" 
                 HoverCssClass="hoverCssStyle" 
                 SelectedCssClass="selectedCssStyle" />  
</ig:WebDataMenu>

will create a horizontal dropdown menu in default “Office 2007 Blue” styleset but allows you to overwrite individual styles via exposed CSS properties.

Let’s take a look at hover style. Continue reading 'Infragistics WebDataMenu flashes unexpected color on hover'»

Infragistics WebDataGrid crashes if its total width over 32767 pixels

By , 07/14/2014 1:33 PM

When you’re dealing with Infragistics WebDataGrid and want to manipulate appearance of individual columns – there’s a handy Columns collection for that. Unfortunately it’s available only if you define columns at design time or add columns to it in code-behind. If your grid features autogenerated columns – the collection will be empty.

There’s a way to derive column info tho – and can be done from grid row. The example below uses grid’s PreRender event to capture first row from which columns are derived and their width set:

Protected Sub xmyGrid_PreRender(sender As Object, e As EventArgs) Handles myGrid.PreRender
   Dim oGrid As GridControls.ContainerGrid
   Dim oRow As GridControls.ContainerGridRecord

   oGrid = sender
   oRow = oGrid.Rows(0)

   If oRow IsNot Nothing Then
      InitGridColumns(oRow) 'passing 1st grid row to helper sub
   End If
End Sub

Sub InitGridColumns(i_oRow As GridControls.ContainerGridRecord)
   Dim oGridCol As GridControls.BoundDataField

   'looping thru row cells
   For I As Integer = 0 To i_oRow.Items.Count - 1
       oGridCol = i_oRow.Items(I).Column 'deriving column object from row cell
       oGridCol.Width = Unit.Pixel(CalculateWidthHere()) 'setting calculated width
   Next
End Sub

This works pretty well – that is until summary width of all columns combined hit’s 32K. If this happens – grid crashes:

Continue reading 'Infragistics WebDataGrid crashes if its total width over 32767 pixels'»

WebHierarchicalDataGrid binds to data twice

By , 07/14/2014 12:04 PM

Infragistics WebHierarchicalDataGrid offers a nice ability to custom load-on-demand data via its ContainerGridDataBinding event. It is very useful during paging or displaying grid children – you can make a DB call and provide data a just needed for current page or child.

But it has a drawback – if you need to programmaticaly sort the grid by manipulating SortedColumns collection – grid thinks it needs to rebind the data and is calling ContainerGridDataBinding event handler again thus making it execute DB call again – which is redundant and may hinder performance. In a typical scenario you have your binding code:

Protected Sub xmyGrid_ContainerGridDataBinding(sender As Object, e As GridControls.DataBindingEventArgs) Handles xmyGrid.ContainerGridDataBinding
   e.Cancel = True
   e.DataSource = MakeDbCallToGetCurrentData()
   e.SelectArguments.TotalRowCount = iTotalNumberOfRecords
End Sub

and somewhere else add sorting

Protected Sub xmyGrid_PreRender(sender As Object, e As EventArgs) Handles xmyGrid.PreRender
   xmyGrid.Behaviors.Sorting.SortedColumns.Add(sCol1Key, SortDirection.Ascending)
   xmyGrid.Behaviors.Sorting.SortedColumns.Add(sCol2Key, SortDirection.Descending)
End Sub

Sorting code in the second event handler is causing grid to perform second call to ContainerGridDataBinding. The solution is to move sorting code inside of ContainerGridDataBinding handler:

Protected Sub xmyGrid_ContainerGridDataBinding(sender As Object, e As GridControls.DataBindingEventArgs) Handles xmyGrid.ContainerGridDataBinding
   e.Cancel = True
   e.DataSource = MakeDbCallToGetCurrentData()
   e.SelectArguments.TotalRowCount = iTotalNumberOfRecords

   xmyGrid.Behaviors.Sorting.SortedColumns.Add(sCol1Key, SortDirection.Ascending)
   xmyGrid.Behaviors.Sorting.SortedColumns.Add(sCol2Key, SortDirection.Descending)
End Sub

Since at this point grid already bound to data – columns are already available. And since we’re inside of ContainerGridDataBinding – the call to it is not repeated.

Infragistics WebDataGrid stalls on paging large datasets

By , 06/25/2014 4:12 PM

A common scenario while using Infragistics WebDataGrid is to have an unbound column, whose cell’s value is determined at runtime in InitializeRow event, something like

Private Sub xmyGrid_InitializeRow(ByVal sender As Object, ByVal e As GridControls.RowEventArgs) Handles xmyGrid.InitializeRow
   '... some code
   e.Row.Items(0).Value = SomeCalculatedData
   '... some more code
End Sub

This works fine if you bind the grid to a small data set (and you should!) But if, due to circumstances out of your control, you bind it to a dataset with tens of thousand of records you might be screwed. Even if you enable paging (and you most definitely should!) you may find yourself living in a shotgun shack in a situation that changing page takes forever and eventually crashes. If you do – change the above line to

e.Row.Items(0).Text = SomeCalculatedData

note using of .Text property, which is String, instead of .Value which is Object. Since you’re assigning the calculated data for presentation only – no need to change underlying value – and this makes all the difference.

Flipping pebbles

By , 06/25/2014 3:31 PM

Big Flip Clock

As far as smartwatches go – Pebble is a lot of fun. But after playing around with Watchface Generator, Canvas for Pebble and numerous other apps I wanted something more, something that only Pebble SDK could provide. A coder in me wanted to code.

Enter CloudPebble – an amazing online development environment that runs in your browser, has a full-blown C compiler and connects to your watch to run/debug compiled apps. Plus your projects are stored on the cloud and available anywhere you can get online.

Yes you program Pebble in classic C – and it’s a lot of fun. And my first real attempt at custom watchface (pictured above) is old-style flip clock, you can get it here. It is based on amazing pebble bitmap library by Gregoire Sage

Display “Lose It!” data on Pebble watchface

By , 06/04/2014 2:01 PM

Original Lose It!Lose It! on Pebble

Lose It! is an excellent service that helps people lose weight by monitoring calories intake. It integrates with variety of devices so I was curious if I can display my user data on Pebble smartwatch (to make sure I can have another piece of cake or not).

Unfortunately LoseIt doesn’t have a public API. There had to be another way. Continue reading 'Display “Lose It!” data on Pebble watchface'»

How to receive Stack Overflow notifications on your phone and smartwatch (v 2.0)

By , 05/21/2014 1:59 PM

StackOveflow Pebble UpdateA while back I described how you can receive Stack Overflow notifications on your phone and smartwatch by reading RSS feed provided by StackOvedlow API (v1) and connecting it to PushOver push notification service (and their Android app and ultimately Pebble Smartwatch via awesome IFTTT.

Since then Stack Exchange retired version 1 of their API (and besides it didn’t provided all the information needed, e.g. total reputation points) so I was looking for an alternative. Fortunately StackOverflow API v2 provides very extensive set of functions. One call I was looking for is

api.stackexchange.com/2.2/users/[userid]?site=[site]

Where [userid] is your Stack Exchange User ID and [site] is the Stack Exchange site you’re interested in. For example for me call to

https://api.stackexchange.com/2.2/users/961695?site=stackoverflow

provides a nice JSON output: Continue reading 'How to receive Stack Overflow notifications on your phone and smartwatch (v 2.0)'»

Microsoft Skype Doesn’t support IE11

By , 05/21/2014 8:39 AM

Ever since I upgraded to IE11 my Skype is throwing error

Skype IE11 error

Digging deeper – the error is throwing while Skype is attempting to display an ad banner

Skype ad banner error

So not only when Skype came into Microsoft possession it stated to display banner ads – in doing so it relies on Internet Explorer and it’s not compatible with the latest version.

How stupid is that?

Canvas for Pebble: How to hide time in all-day events

By , 05/03/2014 8:23 PM

If you wish to create a custom watchface for Pebble Smartwatch but want it to have some more advanced features than very cool Watchface Generator offers then amazing Android app Canvas for Pebble is definitely for you.

Using it you can have your Pebble watchface to display weather, location, temperature, of course date and time, etc. etc. in highly customizable formats.

One cool thing it allows you to show – next calendar events from your Google calendar. As with everything else it’s a highly customizable entry. For example three (out of much more) options are:

%a – abbreviated day of the week
%R – start time of the event in 24-hour-format
%ET – event title

So if you format the calendar field as "%a %R: %ET" your Pebble will display something like "Mon 12:30: Visit from Elvis". Unfortunately if calendar event is an all-day event (e.g. national holiday) – start time of the event (%R) always displays as “00:00″ making your event look like "Tue 00:00: Day of the Tentacle". It would be really nice if we could hide the time for all-day events.

Fortunately one of the things Canvas allows you to do is conditional formatting. It does this in a form of {text1#condition#text2} where if condition is true – text1 is displayed, otherwise text2 is displayed (which is optional and can be omitted).

I noticed that for all-day events, event duration (represented in Canvas as %ED) is always 24 hours (duh). So I replaced the above format for calendar event with this one: %a{ %R#%ED<24}: %ET. The code in braces means “if event duration is less than 24 hours – show event start time, otherwise don’t show anything”. And the result is in images above.

Pebble Steel: DIY (some assembly required)

By , 04/01/2014 8:38 AM

Pebble Steel: DIY

Pebble Steel is a new flagship smartwatch of a widely successful kickstarter Pebble. It’s the latest craze and everybody wants one. Unfortunately the demand far outweighs the supply – it’s a well known problem. Pebble can’t manufacture enough new Steels in time, there’re many backorders, missed deadlines, a lot of frustrated, complaining customers.

But Pebble is not called genius for nothing. They found a brilliant solution, one they borrowed directly from the Apple, when the company was at its very humble beginning and was struggling as well. If you recall – original Apple 1 computer was sold as an electronic kit, that users had to put together themselves. This approach solved many problems for Apple back then and it will be very helpful for Pebble today.

Enter “Pebble Steel: Do it yourself” kit. The new Steel will ship as a collection of parts with detailed instructions on how to put them together. Since Pebble Steel doesn’t have to come fully assembled – that will seriously cut down manufacturing time and the product will ship to users much sooner. Cost saved on assembly labor will also be passed directly to customers – expect to see cheaper Steels soon. And since majority of Pebble users are computer/electronics geeks anyway, crowd that loves tinkering with their gadgets – assembling your very own Pebble Steel will come as an interesting and a welcome challenge and will make a proud owner even more proud.

Panorama Theme by Themocracy