• Home
  • About
  • Resume

Posts tagged: cool

Colorful watchfaces for Pebble Time

By , 05/13/2015 7:50 PM

Pebble Time is latest and greatest smartwatch from Pebble corp. And one of the advantages it has over classic model is new epaper screen capable of supporting 64 colors. To test its capabilities I developed several color watchfaces. Some of them are the converted ones that originally were made for classic Pebble, some of them new. Click on the image to get redirected to Pebble appstore.

Long Shadow “Long Shadow” – inspired by stock LG G watchface, features large time and long colorful shadows. Config page allows customization of every color as well as shadow direction
TV Time “TV Time” – old-style TV displays time in cartoon format. Grid on the panel shows battery level
Simpe Striped “Simple Striped – Large time in color-striped font. Thin line at the bottom shows battery level both in length and coior
RusticSlider “Rustic Slider” – Though not in full color, uses Pebble Time gray shades to create realistic blocks with customizable sliding animation
Poochie “Poochie” – spoof of Gucci luxury digital watch
MeyerObjects “Meyer Objects” – Hour. minute and second hands are represented by wireframe design. Shake to display normal digital time. Configurable options
3D Wedge “3D Wedge” – Time displayed in diagonal skewed form along with date, time and battery percentage

Give them a try once you get your PT! Or, you can load them on your classic Pebble as B&W versions 🙂

Pushing pins to Pebble Time timeline from .NET code

By , 05/12/2015 1:27 PM

Timeline on Pebble Time Pebble Time timeline is a very cool user interface allowing you to see future and past events and act upon them right on your watch. Right out of the box Pebble Time supports calendar pins that shows your future and past appointments in the timeline as well as weather alerts. But the real power comes from 3rd party apps using timeline – they can add anything from sports scores to latest news to TV showtimes – limit is just your imagination.
Pebble has always had open SDK – this is one of its major strengths, and Timeline is not an exception. Timeline API is a very straightforward way to push your own pins to users of your app. There’re various examples and libraries including PHP and node.js on how to deal with the timeline, but I, being mostly a Microsoft developer by trade, decided to bring Timeline into .NET. This particular example is in ASP.NET – pin is pushed from Webpage when user clicks a button, but it’s just one of the possible scenarios.

In order to push timeline pins successfully you will need 2 pieces:

  1. A watchapp that runs on Pebble. In fact after first run, that subscribes user to timeline, the app doesn’t have to be running on the watch anymore. It doesn’t even have to be on the watch. As long as it simple remains in your locker on the phone – you will continue to receive its pins
  2. Your own server that sends calls to Pebble public Timeline API to control pins

Continue reading 'Pushing pins to Pebble Time timeline from .NET code'»

Cancel long running SQL Command in ASP.NET WebForm application

By , 04/14/2015 3:03 PM

It’s an all too common scenario when your ASP.NET page takes too long to load and the culprit is slow, long running SQL query. It shouldn’t come to this, you should optimize your DB stuff to minimize delays, but if you’re trying to decode feline genome or find alien live in the neighboring galaxies – that’s unavoidable. So the page is running and at some point you decide enough is enough and decide you need to cancel it. But you want to do it gracefully, for example slow page is in an IFRAME and you want to remain in the parent page and you don’t want to close/reload the whole thing.

There’s a way. The idea is, every time you create an SqlCommand – you add it to static (shared in VB.NET) list. If command runs successfully – you remove it from the list. But if it takes too long – you can issue an AJAX call from client page to cancel the command stored in that list.

Thanks Arsalan Tamiz for posting this solution to my question on StackOverflow. His demo project was in C# (you can download it from the above link). but since most of my projects are in VB.NET – I did a conversion with some adjustments.
Continue reading 'Cancel long running SQL Command in ASP.NET WebForm application'»

Universal access to Pebble framebuffer on Basalt and Aplite via coordinates

By , 04/04/2015 11:27 PM

Rotate Effect on Aplite In my previous post I described how you can access framebuffer of Pebble screen via familiar X,Y coordinates. To reiterate: you capture framebuffer as a bitmap, and access bitmap as 2-dimentional matrix:

#define WINDOW_WIDTH 144
GBitmap *fb = graphics_capture_frame_buffer(ctx);
uint8_t (*fb_matrix)[WINDOW_WIDTH] = (uint8_t (*)[WINDOW_WIDTH]) gbitmap_get_data(fb);

After that you can access specific pixel on the screen via coordinates, e.g. fb_matrix[120][60] will represent pixel and coordinates Y = 120, X = 60

This works fine on Pebble Time (Basalt platform) where every pixel represented by a byte. But what about classic Pebble (I think this term is becoming quite popular, but to avoid confusion I will call it Aplite platform). On Aplite every byte in the framebuffer represent 8 pixels and the above approach doesn’t work.

Fortunately there’s a universal solution.
Continue reading 'Universal access to Pebble framebuffer on Basalt and Aplite via coordinates'»

Simplify access to Framebuffer on Pebble Time

By , 04/03/2015 4:43 PM

Pebble smartwatch SDK offers a very extensive graphics library. And if that is not enough – you can access graphics memory directly for pixel-precision manipulation. For example this code

GBitmap *fb = graphics_capture_frame_buffer_format(ctx, GBitmapFormat8Bit);
uint8_t *fb_data = gbitmap_get_data(fb);

captures Pebble screen as a bitmap and consequently as raw uint8_t data you can manipulate. But the problem with this approach – you access the data as 1-dimensional array, which is very inconvinient when you’re dealing with 2-dimensional screen.

Fortunately due to magic of casting this problem can be addressed. Consider following addition to previous code:

#define WINDOW_WIDTH 144  
uint8_t (*fb_matrix)[WINDOW_WIDTH] = (uint8_t (*)[WINDOW_WIDTH]) fb_data;

Using this, you can access screen data via familiar coordinates. For example if you need to set pixel at coordinates Y=120, X=60 to black color, all you have to do is

fb_matrix[120][60] = 0;

And now we can rewrite InverterLayer from previous post to a simpler form. First in layer callback we create bitmap matrix and call effect function:

static void effect_layer_update_proc(Layer *me, GContext* ctx) {
  // getting layer coordinates
  GRect layer_frame = layer_get_frame(me);  
  //capturing framebuffer bitmap into 2-d matix
  GBitmap *fb = graphics_capture_frame_buffer_format(ctx, GBitmapFormat8Bit);
  uint8_t (*fb_matrix)[WINDOW_WIDTH] = (uint8_t (*)[WINDOW_WIDTH]) gbitmap_get_data(fb);
  //callig effect function
  effect_invert(fb_matrix, layer_frame);

  //releasing framebuffer
  graphics_release_frame_buffer(ctx, fb);

And actual inverting function becomes much simpler as well, simple loop thru layer pixel, inverting colors:

// position: x,y,h,w of the layer  
void effect_invert(uint8_t (*fb_a)[WINDOW_WIDTH], GRect position) {
  for (int y = 0; y < position.size.h; y++)
     for (int x = 0; x < position.size.w; x++)
        fb_a[y + position.origin.y][x + position.origin.x] = ~fb_a[y + position.origin.y][x + position.origin.x];

You can see this approach in EffectLayer library.

InverterLayer (and other effects) for Pebble Time

By , 04/03/2015 11:48 AM

Inverter EffectMirror Effect
InverterLayer is a pretty cool feature of Pebble smartwath SDK, its simple purpose to invert colors of everything it’s placed over (black becomes white and vice versa).

Unfortunately it no longer works in SDK 3 (Basalt, Pebble Time) and will be depreciated. Fortunately it’s pretty straightforward to create your own InverterLayer. Continue reading 'InverterLayer (and other effects) for Pebble Time'»

Sideload APKs directly from your phone to FireTV/FireStick

By , 02/05/2015 3:22 PM

ADP If you’re joining a grown crowd of cordcutters (people who disconnect their Cable TV services) you’re not a stranger to streaming. Devices like Roku and Chromecast go a long way to provide all your TV shows and movies need.

Amazon Fire TV and Fire Stick are the latest additions to the streaming gadgets. One advantage they have over other devices they run Android (albeit heavily modified). This gives you ability to install (sideload) ordinary Android apps onto these gadgets. There’re multiple tutorials on how to do it from desktop computers, but you have to download apps APKs onto desktop. Wouldn’t it be easier if you could do this directly from your phone?
Continue reading 'Sideload APKs directly from your phone to FireTV/FireStick'»

The many faces of Pebble

By , 12/02/2014 9:11 PM

It occured to me that I’ve been playing with Pebble smartwatch for a while, so I decided to put together a collection of what I created so far: 11 watch faces and 1 very serious watch app. Enjoy!

Developing first Pebble.js app

By , 10/24/2014 2:57 PM

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.

Enter AutoInsult for Pebble – application that is based on autoinsult.com – it generates a random insult based on style you selected.
Continue reading 'Developing first Pebble.js app'»

Compare 2 source files and add difference to 3rd

By , 08/19/2014 2:53 PM

Beyond Compare 3-way merge

Sometimes when you patch or update your current version of software there is a need to apply the same changes to a previous version. Ordinary it’s a pain – you need to painstakingly determine which changes from the current source should go to previous version (because current source has changed a lot, new features added etc).

Enter Beyond Compare – coolest tool to do all kind of compassion. One of the best features – “3 way merge”. It allows you to compare 2 files and apply the difference to 3rd.

In our case here is what it can do:

  • Select new patched version of source file and compare it to old unpatched version
  • In menu select “Session –> Merge Files” – a middle pane appears that allows you to select 3rd file
  • In the middle tab select new unpatched version

That’s it! Beyond Compare will compare new patched and new unpatched version. If there’s a difference – those lines will be applied to old unpatched version. Otherwise if both new versions are the same – old version keeps it lines, even though they’re different from new version.

It’s all performed automatically all you have to do in the bottom pane (where merge result appear) select the filename to save to and hit “Save”

Panorama Theme by Themocracy