Pages

Wednesday, January 30, 2013

Group files in Visual Studio projects

NestIn extension for Visual Studio will group files in a project. The files will be displayed nested one underneath the other.
This is convenient when using Sublime Text 2 for editing CoffeeScript files and needing to attach the resulting JavaScript files.

Android Reverse Tethering 3.02 - xda-developers

After trying out several USB Reverse Tethering apps for Android, now is time for this one:

[Tool][Windows Only][Root] Android Reverse Tethering 3.02 - xda-developers

Not to mention that, for one reason or another, none of the solutions could be implemented in my specific scenario.

Tuesday, January 29, 2013

My Favourite Icon Site(s)

When needing graphics for web sites and applications, here are some useful resources:

Icon Finder (link)
Icon Archive (link)

Sunday, January 27, 2013

Electronics

DealExtreme has tons of electronics with low prices and worldwide delivery.

DealExtreme - Cool Gadgets at the Right Price - DX Free Shipping Worldwide

Additional sites I'm trying out include GearBest and FastTech.

#electronics #gadgets #cables #hardware

Tuesday, January 22, 2013

Navigating tabs in GTK applications

To navigate between tabs in Gnome applications (Nautilus, GEdit, etc.) use:

  • Alt+1..n to navigate to specific tab. The pattern is Alt+
  • Ctrl+PgUp or PgDn to move up/down between tabs

Monday, January 21, 2013

mongoose - Mongoose - easy to use web server

Mongoose is a lightweight web server that works on many platforms.

mongoose - Mongoose - easy to use web server - Google Project Hosting

Binary for Windows is available for download at the site above. Binaries for Linux are available through distributions: "sudo yum install mongoose".

IndexedDB via WebSql

IndexedDB Polyfill is "a polyfill to enable IndexedDB using WebSql." Why is something like this needed, you say? Well, the issue comes from the current lack of support for HTML5 storage standards.
As the proposal for WebSQL implementation has been deprecated, the candidate for client-side storage has become IndexedDB standard. This is a key/value object store, not a relational one. However, there are indexes and stores, so it is quite capable as a storage mechanism.
While major desktop browsers support IndexedDB in their current iterations, mobile browsers are not up-to-date with support. The major issue is Android's stock browser which, if you are creating mobile apps, is the execution sandbox for the app. This means that using IndexedDB in an app that executes in the Android browser will not get you anywhere. By default, that is.
Fortunately, there is a project that bridges that gap. IndexedDB PolyFill (axemclion/IndexedDBShim · GitHub) offers IndexedDB APIs via supported storage mechanism, which is WebSQL. In their own words,
IndexedBD is not supported on all browsers. This IndexedDB polyfill exposes the IndexedDB API in unsupported browsers using WebSQL. This shim is basically an IndexedDB-WebSql adapter.

Using this polyfill, you can use a single offline storage API across browsers (Opera, Safari, Firefox, Chrome and IE10) and even mobile devices (Phonegap on iOS and Android).
This is currently a lifesaver, making the code longer-lasting as you can write code that uses IndexedDB APIs and have it work seamlessly through the HTML5 implementation across various browsers.

More:
To see which major browsers support HTML5 features, see this page.

Android SDK Manager hangs while "Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml"

Just had an issue with Android SDK Manager, where it hung while "Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml".

The issue is resolved by checking "Force https://... sources to be fetched using http://..." in Android SDK Manager, Tools -> Options.

Sunday, January 20, 2013

Deleting IndexedDb

Currently there is no way in Chrome Developer Tools to delete IndexedDb. In order to do so, we need to open the profile directory, then get into the IndexedDB directory, and delete the storage there directly through the file system.

In Linux, this location is
/home/alen/.config/google-chrome/Default/IndexedDB/

For more information, see
User Data Directory - The Chromium Projects

Caffeine on Fedora 18

If annoyed by the lack of handy options for preventing computer sleep while watching movies, Caffeine is the answer.
There is a Gnome Extension if you are using Gnome Shell but if you are using Cinnamon then that doesn't work. Fortunately, there is a Caffeine application that works in that case. It is not in official Fedora repository but is available at RPM Sphere (link).

The project homepage is here. Software can also be downloaded from there and installed by following these instructions (link). That, however, did not work for me but installing the RPM package right after this did.

Edit: Since Caffeine does not seem to work with current Fedora 18, this still seems to be the only way to prevent Gnome from going to sleep.

Saturday, January 19, 2013

Jailbreak iOS 6 with RedSn0w

How to jailbreak iOS 6 with RedSn0w 0.9.15b1

Run redsn0w as Administrator on Windows.

If you get "Exploit Failed", check these instructions - link. The cause is improper DFU mode activation. Release home button only after 15 seconds, not before.

If you get "Missing Keys.plist data for this build", follow these instructions - link. Always select the IPSW v6.0 with redsn0w v0.9.15b3.

If you cannot connect after this, see this video. During jailbreak, select "Install iPad baseband" separately from "Install Cydia", meaning you'll have to jailbreak twice. Once for each of these options.


nodejs on Fedora 18

Node.js has been added as an available package in Fedora 18. Note that it is currently only in Rawhide and Updates Testing repositories. So, to install, first make sure that Updates Testing repo is enabled and then install nodejs package.
sudo yum install nodejs --enablerepo=updates-testing

After that install NPM:

git clone https://github.com/isaacs/npm.git
cd npm
sudo make install

Finally, install sugar-on-top CoffeScript:
sudo npm install -g coffee-script


More info on available packages: RPM resource nodejs

Friday, January 18, 2013

npm proxy configuration

To configure npm (Node Package Manager) to use a proxy server, check config page.
Basically, npm will use  HTTPS_PROXY or https_proxy or HTTP_PROXY or http_proxy environment variables. If that is not satisfactory, the proxy can be set via command:

npm config set https-proxy


In my case, the issues are mostly fixed by setting HTTPS_PROXY and HTTP_PROXY to the proxy server in format "server.domain:port", i.e. proxy.org:8080.
If there are still issues after setting these values, try running
npm cache clean
There is an issue for npm, here, and the suggested workaround is to use parameters:
npm install --proxy myproxy1.mydomain.com:3128 --registry=http://registry.npmjs.org/ socket.io

Setting up Report development environment with SQL 2012

In order to set up an environment for working with reports in SQL Server 2012, using Team Foundation Server (TFS), follow these steps:

  • Install SQL Data Tools as a part of SQL Server installation, or add this feature after an initial installation. This will install Visual Studio 2010 shell, project types, etc.
  • Install Microsoft Visual Studio Team Explorer 2010 - ISO (link), for working with TFS.
  • Apply Microsoft Visual Studio 2010 Service Pack 1 (Installer) (link).
Instructions with screenshots: (link).

Tuesday, January 15, 2013

noda-time - DateTime library for .Net

Noda Time is a port of Joda Time to .Net. It contains good utilities for dealing with Dates and Intervals.

noda-time - A port of Joda Time to .NET - Google Project Hosting

Access Google Tasks directly

The URL to access Google Tasks is

For more ways to access Tasks, see 5 Ways To Access Your Google Tasks

Entity Framework Code First Migrations

For an overview of Migrations in Entity Framework, Code First approach, see
Entity Framework Code First Migrations

Monday, January 14, 2013

EF Code First Stored Procedures with Multiple Results

There is only limited support for stored procedures in Entity Framework 5.0. Here are some suggestions for how to map Select SP, with multiple result sets, to an entity.

Code First Stored Procedures with Multiple Results « RoMiller.com

Kernel 3.7.2 and VMWare Workstation 9

After upgrading kernel to version 3.7.2 on Fedora 18, VMWare Workstation 9 requires recompilation and installation of kernel-level modules required for its operation. This is normally transparent and done automatically. However, with this update the source code structure has changed and the automatic recompilation does not succeed. Fortunately, the solution is simple. Create the symbolic link as below


sudo ln -s /usr/src/kernels/3.7.2-201.fc18.x86_64/include/generated/uapi/linux/version.h /usr/src/kernels/3.7.2-201.fc18.x86_64/include/linux/version.h


and then run

sudo vmware

so that permissions are available for recompilation and installation of the modules.

More info: Linux Kernel 3.7, VMWare Workstation and NVidia Driver (link)

Moving Redmine data to a different location

When using Redmine as an issue tracker, I used to make backups of the database manually. Then, later, I put the code to make backups into the script that starts Redmine. However, this is also not the best solution. A better way would be to have the database directly in a (dropbox) synchronized directory.
On Linux this is simple and all that is required is to put the full path to the database file. On Windows it is a bit more tricky but there is a simple and convenient way. Move the database to the synchronized directory and in db/ directory for Redmine, create a symbolic link:
mklink redmine.db [path to dropbox]\redmine.db
This will create a symbolic link to the file outside the Redmine directory and it can also be on a different partition or drive.
Using full file path in the config file did not work but using symlinks works around that limitation.

Moving Files

Windows

The same concept can be applied to other user-editable files. Whole directories can be redirected. The files users upload to Redmine are stored in "files" directory.
mklink /d files [path to dropbox]\files

On Linux

As Mercurial doesn't support symlinks, it is necessary to mount the "files" directory in Dropbox, to Redmine directory. So, in Redmine directory, rename the original 'files' to 'files.bak', and then create empty 'files' directory:
mkdir files
Then, mount the 'files' from Dropbox folder to the newly created mount point:
sudo mount --bind /path-to-Dropbox/redmine/files files

References:
Windows File Junctions, Symbolic Links and Hard Links (link)
MkLink (link)
Warning! Before removing links see this (link).
directory junction vs directory symbolic link? (link)

Saturday, January 12, 2013

Overview of Entity Framework relationships

Properly configuring one-to-many relationships may be simple in Entity Framework but one-to-one and one-to-zero-or-one can be tricky unless it is something you're doing every day. Below is a reference for those who don't.

Configuring Relationships with the Fluent API
http://msdn.microsoft.com/en-us/data/jj591620.aspx

Finding a column in SQL Server

In addition to finding all columns of a certain type, we can also search SQL Server for columns by name. Not to mention that this can be a life saver.

USE AdventureWorks
GO
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%EmployeeID%'
ORDER BY schema_name, table_name;

Source (link)

Configuring startup programs in Gnome

To view and modify startup programs in Gnome (Linux), run

gnome-session-properties

A simple way is to run gnome-open by pressing Alt+F2 and typing the name of the program above.

The easiest way to edit mime type handlers in Linux

The easiest way I found to set a Mime Type handler in Linux is the following:

  • Create a .desktop file for a handler application, in "/home/alen/.local/share/applications". Make sure that the MimeType is set in the .desktop file.
  • Open Dolphin (KDE file browser), select a file you want to handle, right-click it and select Properties. Next to Type, click the wrench icon to open file type editor (KEditFileType). Set the handlers there (add, edit, remove, or set preference order).
This setting has effect on the whole system so Mime Type handler preference order will be reflected in other file browsers (Nemo, Nautilus, etc.). 

Friday, January 11, 2013

Desktop files: putting your application in the desktop menus

Reference for creating application launchers (.desktop files) in Gnome.

Desktop files: putting your application in the desktop menus:

#linux

"Cloud9 IDE now integrates with Bitbucket"

Here is an excellent combination for editing your code online. Cloud9 integrates with Bitbucket for both authentication and repository access. This means that, if you have some code on BitBucket, it can be edited through c9 editor inside your browser. No need to clone any repositories and have any extra development tools.

Source: Cloud9 IDE now integrates with Bitbucket

SQL Service Manager

SQL Service Manager (link) is still alive and well. This is a software that has an icon sitting in the tray, allowing quick access to SQL services. These services can be monitored, started, and stopped by clicking the tray icon. A feature that was previously part of SQL Server itself long time ago but is now sorely missing for desktop deployments mostly.

1 - Tray icon 2 - Service is started

Ergonomics: lighting

F.lux is a software that adjusts your screen color according to time of day. The main point for this is:
We know that night-time exposure to blue light keeps people up late. We believe that f.lux adjusts colors in a way that greatly reduces the stimulating effects of blue light at night.
There are editions for Linux, Mac, and Windows available.



Download f.lux (link).

Note that on Fedora, it is fairly easy to run Windows version of F.lux under Wine. It works under Gnome the same as in Windows!

Thursday, January 10, 2013

Creating 32-bit Wine prefix on a 64-bit system

In order to create a 32-bit Wine prefix on a 64-bit system, Wine has to create the prefix directory itself. Run
 
WINEPREFIX='/home/wine/photoshop' WINEARCH='win32' wine 'wineboot'
 
More:
wineboot unable to create win32 prefix under certain conditions (link) 

Model- to Code-First with Entity Framework

This applies to Entity Framework versions 4.1 and above. In brief, the steps are liste below.
This is the simplest way, provided by the EF team: 
"Open the .edmx file in the Entity Designer.

Right-click an empty area on the Entity Designer surface and point to Add Code Generation Item.

In the Add New Item dialog, select Online Templates and type DBContext in the Search Online Templates text box.

Select the appropriate version for your template (5.0, if you want to target the Entity Framework 5.0).

Click OK."

* Generate .edmx model from existing database (instructions)
* Install "EF 5.x DbContext Fluent Generator for C#" (link)
* Add "EF 5.x DbContext Fluent Generator" item to the project
* Edit the template files, replacing $edmxInputFile$ with the name of the model generated earlier (i.e. model.edmx) in all three template files.
* [The generation will happen automatically when templates are saved.]
* Delete .tt files related to the .edmx model and leave the diagram file, if desired.

Additional information:
How to: Create a New .edmx File (link)
Entity Framework 5 - How to generate POCO classes from existing database (link)

"Run" T4 templates (.tt) in Visual Studio

In order to process the T4 template files (.tt), their Custom Tool (in Properties) has to be set to TextTemplatingFileGenerator. Then, right-click on a .tt file and select option "Run Custom Tool" to process the template and generate the output file.

Wednesday, January 09, 2013

Screenshot on Android 4.2

To create a screenshot on Android (4.2 in this case) press Volume Down and Power buttons together and hold for 2 seconds.
The screenshot notification will appear and from there it is possible to preview the image with Gallery and share it through available providers.

Tuesday, January 08, 2013

Find all data columns of certain type (SQL Server)

The following SQL command will display all the columns of certain type. This works on Microsoft SQL Server. It will display table name and column name. In this case, we are displaying all columns of type datetimeoffset.
SELECT table_name [Table Name], column_name [Column Name]
FROM information_schema.columns where data_type = 'datetimeoffset'
Source: link
More on datetimeoffset (link).