Pebble Smartwatch has offered SDK to develop watchfaces and watchapps in C language for a while now. But most recently they tried something different: Pebble.JS a project that lets you code for Pebble in JavaScript. Unlike native app – JS code runs on your phone, so it’s not as fast, and Bluetooth communication required to display any data, but there’re numerous advantages as well.
To test it I decided to write a simple app that would use basic, but important features of Pebble.JS: displaying of information card (a la Pebble notifcation), using menu and executing an AJAX call to bring information from the Net.
If you’re using jQuery UI Dialog, you know sometimes there’s a need to access dialog’s button objects after the dialog has already been created. This can be easily done via
$(dialogElement).dialog("option").buttons
command. One possible scenario where this can be useful – is executing specific button click function when user clicks [X] in dialog title. Imagine that buttons are set via array and the last object in this array is always something like CANCEL or NO or DISREGARD – and you want to simulate click of that last button whenever user clicks [X]. Using above command it’s pretty straightforward:
$(oDivDialog).dialog({
//... some dialog parameters
buttons: arrayOfButtonObjects,
//... some more parameters
close: function () {
var buttons = $(this).dialog("option").buttons;
buttons[buttons.length - 1].click();
}
})
Line 5 begins close event which is called on dialog closing. Line 6 retrieves array of buttons for the dialog Line 7 calls click() function of the last button in the array
There’s a a few possible scenarios when you need to manually to initiate server-side Click event of Infragistics WebDataMenu control. For example in client side click event you do some verification/user confirmation and upon positive confirmation (e.g. user clicks YES) – server-side Click event should kick in.
In a normal flow of event you can use set_cancel(bool) method to allow/disallow natural menu postback e.g.
function Menu_ItemClick(sender, eventArgs) {
if (confirm('Are you sure?'))
eventArgs.set_cancel(false)
else
eventArgs.set_cancel(true)
}
This works because this dialog stops code execution waiting for the user input. But what if you use something like jQueryUI dialog that relies on callback functions to get user feedback? In this case execution of the code continues immediately so you have to cancel postback right away and instead in the callback of the dialog initiate manual postback e.g
The example above initiates modal confirmation jQuery UI dialog and immediately cancels menu postback (Line 18). Later if user clicks “Yes” button – dialog is closed and manual menu postback is initiated (Line 10) – it passes menu ID and correct postback argruments which result in server-side Click event of menu control. If user clicks “No” – dialog is closed and nothing else happens.
You know you shouldn’t use showModalDialog to open modal windows – it’s bad taste and prone to cause issues. Unfortunately many applications (especially Enterprise ones) rely on the method ability to halt code execution until the window closed (e.g. user answers a YES/NO question).
Tough luck, starting version 37 Google Chrome removed support for showModalDialog. Your code suddenly began to act in weird and unpredictable way. You definitely should rework it to use a different approach to dialogs. Fortunately Google gives you a bit more time. You can re-enable showModalDialog support, but only temporarily – until May of 2015. Continue reading 'Reenable (temporary) showModalDialog support in Chrome (for Windows) 37+'»
I encountered weird issue using Infragistics ASP.NET WebDataMenu control. If total width of top-level items was bigger than menu’s width and scrolling kicked in – Google Chrome browser produces unexpected results.
Consider following basic markup for Infragistics WebDataMenu:
It’s a pretty basic markup that defines 10-item horizontal menu with a limited width, so scrolling is enabled. Code in the Initialize event handler would handle some calculation based on menu dimensions and other items on the page would be affected by these calculations. Continue reading 'Infragistics WebDataMenu delayed resizing in Chrome'»
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).
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
Ever since I upgraded to IE11 my Skype is throwing error
Digging deeper – the error is throwing while Skype is attempting to display an ad banner
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.
Hello there. Haven’t written in a while, been busy participating in Stack Overflow community, but this little bit I found interesting.
Infragistics has a cool versatile Web Splitter control in their ASP.NET suite, but recently I encountered a shortcoming – there’s no way to set a CSS class for splitter bar on client-side via JavaScript. On server-side you can do something like