Android Addicted Apps Creator

August 7, 2012

Standby Touch Advanced just got released on Google Play

Filed under: Uncategorized — alinberce @ 12:24

Standby with one touch

main_featured_thumb[1]

Developer Notes

I did this project from scratch and even if on first look it seems quite simple, took me some hours to polish it. I tried to make the design as ICSish as possible. I received very good feedback on various forums about it. I use this app every day.

Technical Details

  • requires Administrator permission to perform Lock operation
  • Data, Sound and Wifi access permissions

Official description

    The app does not need any nasty permission, does not access your data, does not run all the time in background, does not use resources, does not have ads. It does just a simple thing: sends the phone to sleep as it happens when you press the Power button. I always prefer to touch a icon on the screen rather than searching for the Power button which isn’t to handy, especially if you have a bumper.

INSTALLATION NOTES
When you will install the app you will see in the Launcher two icons:
– Standby Settings – with app settings and operations.
– Standby Touch – can be added in your Home screen for convenient access which performs fast send to Standby command.

STEPS NEEDED
– First you need to Enable Admin Permission from Settings page. After your do this, the app will work as intended. Without Admin permission, it cannot perform send to standby operation.
– If you want to uninstall the app there are two ways:
a) Go to StandBy Settings and press the Uninstall button and you won’t have to worry for anything else as it will take care of the rest.
b) From Standby Settings press on the Remove Admin Permission (an android app cannot be uninstalled while it has Admin permissions enabled.) and the go to Android Apps and Uninstall the app.

With the new version I have added the possibility to use Tasks, which means you can define an interval in which the Sound/Data/Wifi (for now) are On or Off. The app will check when you press the Standby icon for tasks and update phone’s status according to them. Tasks are the reason why the app needs more permissions, but as you can see, all permissions are related to Sound, Data Connection and Wi-Fi settings. Please note that the time interval is set by rotating both circles, the inner one for the hour and the outer one for the minute.

Made for Galaxy Nexus and other large screen devices running android 4.0.1 +

Screenshot_2012-08-06-15-06-18_thumb[1] Screenshot_2012-08-06-15-06-34_thumb[1]

Screenshot_2012-08-06-15-06-44_thumb[1]Screenshot_2012-08-06-15-06-57_thumb[1]

google_play_thumb https://play.google.com/store/apps/details?id=com.alinberce.standbytouch

Advertisements

September 17, 2010

We’re in business. VOrienteering.com is alive and kicking. You’re welcome to join our community.

Filed under: Uncategorized — alinberce @ 17:32

Hi all. It has been a really long time since I posted something in here. In past months I’ve been very busy as I switched to the Dark Side Smile, I program in java now. More precisely in Android. It is a wonderful journey for me, and I hope that in the end it will worth the time.

  A few words… well, it’s all about nature, move, sport, tracks, gps, devices, android, iphone, winmo. Just go in there, make a track and… do it with the device in real world. You know it guys don’t you… real world with trees and stuff, nature… I’m talking to you programmer Open-mouthed smile   Unfortunately the Android client isn’t ready yet, but until the end of month you’ll be able to use it with your device. Everything is free.

The web site is www.vorienteering.com . Be our next friend, register (it’s really easy to do) and provide us feedback, ideas and problems. As you can see we are in beta version.

Here are some screens of Android client:

 

image  image  image

I feel some new tutorials on Android platform coming soon Smile 

Technorati Tags: ,,,

November 6, 2009

I’m a father…. Yupiiiiiiii

Filed under: Uncategorized — alinberce @ 20:43

   Well, I am very excited, today my wife gave birth of our daughter. In my country there is a serious issue with AH1N1 flu and I have problems getting to see them in the hospital. So, as you can guess, I am the happiest man on earth, thank God for making this wonder happen. Daria, my little angel, has 3.2 Kg and was born today at 10.15 am.

October 15, 2009

Using a web service straight from SQL Server 2005

Filed under: Uncategorized — alinberce @ 17:33
Tags: , , ,

Interesting idea with lots of potential. I managed to consume web services from Window Forms application,from ASP.Net web pages but never directly from a SQL Server Database. I’ve researched a little and I know that it can be done and how it can be done. So let us proceed then.

To be able to use the web service from SQL Server we will use a component called CLR (Common Language Runtime) which has been included since the 2005 version. Using this component, we will create a UDF (User Defined Function) within Visual Studio which will consume the web service and which will be used in a SQL Server Table Valued Function to get the results as a SQL table. It does sound kind of tricky but I’ll try to explain it step by step.

I will make this into 2 parts, one that will take place in Visual Studio 2005 and one that will take place in SQL Server Management Studio.

Part I – The Visual Studio side of the story

Everything starts with creating a new project in Visual Studio pf SQL Server Project type. Its name will be CLRWebService

image

Before creating the UDF object we need to get a reference to the web service. The web service I will use for exemplification is offered free by www.infovalutar.ro , a website owned by a friend of mine.

To add a reference right click on the name of the solution and choose from the menu the option Add web reference. In the window that appears, it he URL field write the web service’s address

http://www.infovalutar.ro/curs.asmx?wsdl

image

In the right site of the window you can observe all the methods offered by the service and the parameters required. In The Web reference name filed will rename it to infovalutar and will press the button Add Reference

After the window closes you can see in Solution explorer that the reference has been added.

image

Now we can create the UDF object. Add a new item to the solution:

image

As I said before, the template used will be User-Defined Function and it will have the name GetCursuriValutare. The main scope of this function will be to access the getall(Date) method of the web service and get the exchange rate for the date sent as parameter.

Before writing any code we must analyze and see what exactly this function must achieve:

  • it must be read only, since it only shows data
  • it will have a method to populate the data (GetCursuriValutare_FillRow)
  • will return a table that will contain the fields returned by web service’s method

Let’ start by defining the functions attributes using SQLFunction command

[SqlFunction(
       DataAccess = DataAccessKind.Read,
       FillRowMethodName = "GetCursuriValutare_FillRow",
       TableDefinition =   "IDCurrency NVARCHAR(10), " +
                           "Value float  "
       )
   ]

We have a method that returns the final result

public static IEnumerable GetCursuriValutare()
    {
        DateTime dt = DateTime.Now.AddDays(-1);
        return new Curs().getall(dt).Rows;
    }

Here we take care of the DateTime parameter requested. This method returns an object Of type IEnumerable for the web service Curs() contained in the namespace infovalutar.

The GetCursuriValutare_FillRow methods populates UDF the record set from the object Curs returned as IEnumerable

public static void GetCursuriValutare_FillRow(
        object CursObj,
        out SqlString IDCurrency,
        out SqlDouble Value
        )
    {
        DataRow r = (DataRow)CursObj;
        IDCurrency = new SqlString(r[0].ToString());
        Value = new SqlDouble(Convert.ToDouble(r[1]));
    }

The final piece of code should look like this:

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Xml;
using CLRWebService.infovalutar;

public partial class UserDefinedFunctions
{
    [SqlFunction(
       DataAccess = DataAccessKind.Read,
       FillRowMethodName = "GetCursuriValutare_FillRow",
       TableDefinition =
      "IDCurrency NVARCHAR(10), " +
       "Value float  "
       )
   ]

    public static IEnumerable GetCursuriValutare()
    {
        DateTime dt = DateTime.Now.AddDays(-1);
        return new Curs().getall(dt).Rows;
    }

    public static void GetCursuriValutare_FillRow(
        object CursObj,
        out SqlString IDCurrency,
        out SqlDouble Value
        )
    {
        DataRow r = (DataRow)CursObj;
        IDCurrency = new SqlString(r[0].ToString());
        Value = new SqlDouble(Convert.ToDouble(r[1]));
    }

};

Because we managed to finalize the function we must now obtain the required dll files to be able to use it in SQL Server. A very important thing to mention here, the XML object aren’t automatically serialized so we need to do this our self. This is being done using a tool included in Visual Studio: sgen.

To automate things a little bit will use Solution’s Build events to tale care of serialization. Right click on Solution name -> Properties ->Build Events and in the Command line for the Post-build event add the following

“C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe” /force “$(TargetPath)”

image

From the Build menu choose Build CLRWebService and pray that there will be no errors.

If everything went well, in the project folder should be 3 generated files:

image

If you have those files it means that the UDF creation is done. Go grab a snack and come back for the second step of this tutorial.

Step II – What does SQL Server has to say

To make things easyier will make a new folder on C:\ named CLRGetCurs in which we will copy 2 of the 3 generated files: CLRWebService.dll and CLRWebService.XmlSerializers.dll

Open SQL Server Management Studio, connect to the desired SQL Server instance and open a new Query. For exemplification we will use the AdventureWorks database.

use AdventureWorks
go
-- allows access from exterior
ALTER DATABASE AdventureWorks SET TRUSTWORTHY ON;
GO

--checking that the objects exists before creation
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'GetCursuriValutareWS')
   DROP FUNCTION GetProductWS
go
IF EXISTS (SELECT [name] FROM sys.assemblies WHERE [name] = N'XmlSerializers')
    DROP ASSEMBLY [XmlSerializers]
IF EXISTS (SELECT name FROM sys.assemblies WHERE name = 'GetCusturiValutareCLR')
   DROP ASSEMBLY GetProductCLR
GO

-- create assemblys for the  2 dll files from folder CLRGetCurs
Create ASSEMBLY GetCusturiValutareCLR FROM 'C:\CLRGetCurs\CLRWebService.dll'
WITH PERMISSION_SET = External_Access

CREATE ASSEMBLY [XmlSerializers] from
'C:\CLRGetCurs\CLRWebService.XmlSerializers.dll'
WITH permission_set = SAFE
GO

We are one step closer to the finish line. We only need to create a Table Valued Function that makes use of the external UDF function:

CREATE FUNCTION GetCursuriValutareWS() 

RETURNS TABLE (
IDCurrency NVARCHAR(10),
Value FLOAT
   )
AS EXTERNAL NAME GetCusturiValutareCLR.UserDefinedFunctions.[GetCursuriValutare]
GO

And now, let us enjoy the results of our work:

image

Impressive, I was really amassed to see the web service result in the SQL Server Management Studio. It makes you feel you can do anything you want. I wonder if these UDF functions can be used to alter the content of the database ? Hmm… I’ll check and see.

A good source of information for this article I’ve found on www.databasejournal.com.

I hope you enjoyed this short tutorial. Until next time, Happy coding.

P.S. I know I’ve started a series of tutorials regarding n-tier concepts. Now I left this aside and I started learning about DDD (Domain Driven Design) and how these concepts can be implemented using C# techniques. Still layers but in a more effective “proven” way and a more documented concept.  I would like to THANK Emanuel for guidance and for pointing me into the right direction. There will be some interesting tutorials so stay put.

For the romanian version of the tutorial check this address http://www.infovalutar.ro/howto/sqlserver.aspx

May 28, 2009

WPF – the almighty Button Tooltip

Filed under: Uncategorized — alinberce @ 20:28
Tags: , ,

A very brief tutorial about making a Button Tooltip that contains not just text, but images too. WFP Rocks!

May 27, 2009

WPF Lesson One – Layouts (The beginning)

Filed under: Uncategorized — alinberce @ 16:25
Tags: , ,

(as usual, videos are at the bottom of the post)

Hello. I decided to make a turn on my learning curve, so I decided to switch to WPF – XAML… Funny name it sounds like “zama”, a word that means some sort of food in my native language.

Because I’m a beginner, I will start, of course, with the basics.

What I can say about WPF is that it represents a pretty dramatic change in the way I approach user interfaces. In first version of .NET controls where fixed using hard coded coordinates (Top, Left). So… not a really "changeable" interface. The only things that saved the day were anchoring and docking properties. In the second .NET
we had FlowLayoutPanel and TableLayoutPanel. By using this, the interface became more flexible and more web-like.
WPF introduces a new layout system in which coordinates are placed on a second place and flow layouts becomes the winner. This gives us the possibility to create flexible interfaces which aren’t that dependent on resolution or size.

The main idea beneath the WPF window is that it can contain only one element. First thing that comes to my mind is: How I’ll do all the complex interfaces I think of if the window can hold only one element. Answer is simple: just place a container in the windows… and add all the elements in that container.

The  WPF layout containers are panels and can be:

  • StackPanel – Places elements in a horizontal or vertical stack.
  • WrapPanel – Places elements in a series of wrapped lines.
  • DockPanel – Aligns elements against an entire edge of the container.
  • Grid – Arranges elements in rows and columns according to an invisible table.

All this new names and properties may sound wired to you… it did sounded wired when I first read about them, but we’ll take it step by step and in the end, everything will be clear as daylight.

Let’s begin by creating a new Project of type Wpf Application, named WPFLesson1. By default Visual Studio creates a new window called Window1.xaml. Because the Grid panel is the almighty one, it is added by default.

 

<Window x:Class="WPFLesson1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        
    </Grid>
</Window>

The StackPanel – For the beginning I will start with the StackPanel. Delete the <Grid></Grid> and add a StackPanel with one label and three buttons in it.

<Window x:Class="WPFLesson1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <StackPanel>
        <Label>Hello... This is StackPanel Label</Label>
        <Button>First Button </Button>
        <Button>Second Button </Button>
        <Button>Third Button </Button>
    </StackPanel>
</Window>

Run the project and it should look like this:

1

Without adding any code, the label and buttons were arranged from the top to the bottom. All these elements are stretched to full width of the panel, and their height is automatically set to be enough to display the text inside them.

If I want items to be displayed Horizontally, then all I must do is modify the <StackPanel> to this:

 <StackPanel Orientation="Horizontal">

Run the project and see if it looks like this:

2

As can be seen, the Height of element’s height are stretched to panel’s weight, and their width is set to accommodate the text.

Let’s revert on how was before and try to make some alignment. We’ll make the label on the Left, First button on the center and last button on the right. To do this, we’ll use the HorizontalAlignament of the elements.

<StackPanel>
        <Label HorizontalAlignment="Left">Hello... This is StackPanel Label</Label>
        <Button HorizontalAlignment="Center">First Button </Button>
        <Button>Second Button </Button>
        <Button HorizontalAlignment="Right">Third Button </Button>
    </StackPanel>

3

Well, well, well as you can see the result is as intended, but important thing: no more stretch for the elements we aligned.

There are two more important things for me to tell you: margins and Minimum/Maximum sizes. If I want some space between a control and the controls around it, I use the Margin property. Setting explicit sizes for a control in WFP is not really recommended, but setting a range of size for it, is recommended.

 <StackPanel>
        <Label Margin="5" MaxWidth="400" HorizontalAlignment="Left">Hello... This is StackPanel Label</Label>
        <Button Margin="5" MaxWidth="400" HorizontalAlignment="Center">First Button </Button>
        <Button Margin="5" MaxWidth="200" >Second Button </Button>
        <Button Margin="5" MaxWidth="400" HorizontalAlignment="Right">Third Button </Button>
    </StackPanel>

4

The WrapPanel – arranges controls in the available space, one line or column at a time.

<WrapPanel>
        <Label Margin="5" MaxWidth="400" HorizontalAlignment="Left">Hello... This is StackPanel Label</Label>
        <Button Margin="5" MaxWidth="400" HorizontalAlignment="Center">First Button </Button>
        <Button Margin="5" MaxWidth="200" >Second Button </Button>
        <Button Margin="5" MaxWidth="400" HorizontalAlignment="Right">Third Button </Button>
    </WrapPanel>

5

Resize it to see how the WrapPanel does it’s job.

The DockPanel – do you want controls stretched on one side of a panel ? Don’t worry, DockPanel is here.

    <DockPanel>
        <Label DockPanel.Dock="Top" Margin="5" MaxWidth="400" HorizontalAlignment="Left">Hello... This is StackPanel Label</Label>
        <Button DockPanel.Dock="Left" Margin="5" MaxWidth="400" HorizontalAlignment="Center">First Button </Button>
        <Button DockPanel.Dock="Bottom" Margin="5" MaxWidth="200" >Second Button </Button>
        <Button DockPanel.Dock="Right" Margin="5" MaxWidth="400" HorizontalAlignment="Right">Third Button </Button>
    </DockPanel>

6

The Grid – the grid panel separates elements into a grid of rows and columns. With it we can do pretty much all that we can do with previous explained panels. Using this panel implies two steps: first chose the numbers of rows and columns, second assign each element to the appropriate row and column. Grid lines are invisible, but I will enable it for our lesson.

<Grid ShowGridLines="True">
           <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Label  Grid.Row="0" Grid.Column="0" Margin="5" MaxWidth="400" HorizontalAlignment="Left">Hello... </Label>
            <Button  Grid.Row="1" Grid.Column="0" Margin="5" MaxWidth="400" HorizontalAlignment="Center">First Button </Button>
            <Button   Grid.Row="0" Grid.Column="3" Margin="5" MaxWidth="200" >Second Button </Button>
            <Button  Grid.Row="1" Grid.Column="1" Margin="5" MaxWidth="400" HorizontalAlignment="Right">Third Button </Button>
    </Grid>

7

As you may think already, these panels won’t be used alone. To develop ergonomic user friendly interfaces these panels must be combined. So we’ll start to use our knowledge to create something useful: a classic text edit window. Not only that we will have it done, but we’ll do it in 2 ways. And I’m sure that there are some more ways to do it. (As someone said: each thing in a program can be done in at least 4-5 different ways).

First attempt: using a DockPanel and a StockPanel

The windows will have the following format: a big textbox at the top and two buttons at the bottom for Save and Cancel. For the buttons we’ll use a StockPanel. This panel will be put inside of a DockPanel at the bottom side of it. Set LastChildFill to true, so you can use the rest of the windows to fill in another content.

    <DockPanel LastChildFill="True">
        <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" Orientation="Horizontal">
            <Button Margin="8,8,4,8" Padding="3">Save</Button>
            <Button Margin="4,8,8,8" Padding="3">Cancel</Button>
        </StackPanel>
        <TextBox DockPanel.Dock="Top" Margin="10">Write some text in here.</TextBox>
    </DockPanel>

Run the project and see what happens

8

Was this easy or what ? But what if I tell you that this can be done even easier ?  What ?  You don’t believe me ?

Second attempt: the mighty Grid Panel

    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBox Margin="10" Grid.Row="0">Write some text in here.</TextBox>
        <StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
            <Button Margin="10,10,2,10" Padding="3">Save</Button>
            <Button Margin="2,10,10,10" Padding="3">Cancel</Button>
        </StackPanel>
    </Grid>

9

Pretty easy, huh ?  I told you so…

And we came to the end of a very nice lesson. We’ve learn about WPF layouts what they are and how we use them. A very good book for learning is :”Pro WPF in C# 2008” by Matthew MacDonald

I really hope that I’ve been helpful. So, until next time: Happy coding!

Because of the restricted length in youtube videos of 10 minutes, today you’ll have 2 parts

May 19, 2009

Freeware initiative

Filed under: Uncategorized — alinberce @ 17:45

I’ve always tried to use free software. Basically, because I don’t want to spend too much money on software, I searched all over the net to find free alternatives to the commercial programs I use. Here is the list:

  • Windows 7 Release Candidate build 7100 (x64) – Free from MS, available until next year.
  • Avast Home Edition – free antivirus/antispy, regular updates, good detection rate, low resource use. With the skin from skin here looks even nicer. (has  64 bit version)
  • SuperAntiSpyware – free antispy. Just in case something passes avast. Never happened.
  • CDBurnerXP – Burning disk software. Has all the features of commercial products.
  • JK Defrag – Fast hard disk defragmenter. It even has a screensaver to defrag while computer is idle. (has  64 bit version)
  • GomPlayer – All in one player. Runs almost every type of video file without the need of external codec installation.
  • FastStone Image Viewer – Image viewer. (has  64 bit version)
  • SUMO – Software update monitor. Alerts you when a new version of program appears for the installed programs.
  • 7Zip – Archive manager. It’s a little slower than winrar but… it’s free. (has  64 bit version)
  • CCleaner – erase all your history tracks from browsers, programs and registry.
  • PC Inspector File Recovery – recover accidentally deleted data.
  • Foobar2000 – light but effective mp3 player.
  • PDF-XChange Viewer – PDF reader. It seems to be better than foxit reader.
  • Daemon Tools – virtual drive. Latest version works with Win 7 flawlessly.
  • ClipX – windows clipboard replacement/enhancer.
  • GetDiz – nfo viewer.
  • Notepad++ – text/code editor.
  • Firefox + Addons – the best browser so far. Extensions like AdBlockPlus, FireGestures, PrivateBrowsing make it king of the hill. When Google Chrome will support extensions, than we’ll have a new winner. Until then…
  • Team Viewer – Remote assistance without headache.
  • Yahoo Messenger + AdBannerRemoverPlus 🙂 – Windows Live Messanger is great, but it doesn’t support file send over yahoo network.
  • OpenOffice – Seems to be better and better.
  • Gimp – Image editor.
  • Everything – Forget about Windows Search. Everything is incredibly fast, small and light.
  • Windows Live Writer – Blog editor, the tool I use right now for writing. 😀
  • Visual Studio Express editions – that’s all I user for these tutorials.

   So, there is a free way. It’s true, it takes a while to get used to it. Some features from commercial programs still scream in my face. But, we humans can adapt. Maybe because I like freeware so much, my qSQL and qPlanner projects will be free.

April 26, 2009

Hello world!

Filed under: Uncategorized — alinberce @ 16:10

      Welcome to my blog. Here I’ll try to present some of the stuff I learn. Small tutorials, small video samples and stuff like this concerning C#. Fell free to post comments on my work, so that together we will progress.  This being said, let’s get to work.