Thursday, December 15, 2011

A Reflective Question

I was recently asked a Question in an interview about Creating a function that can read reflection of certain aspects off a class instance. (some version of debugger … I guess)

anyway, here’s my solution (using recursion of course)

private static string Reflective(string instanceName, Type type, object obj, int depth)
{
StringBuilder sb = new StringBuilder();

string format = "* <{0}> {1}";
for (int i = 0; i <= depth; i++)
format = ("\t") + format;

sb.AppendFormat("\n" + format,
type.Name, instanceName);

if (obj == null)
return sb.ToString()
+ "-> {Null}";

FieldInfo[] fields = type.GetFields();
foreach (FieldInfo fld in fields)
{
format = "<{2}> {0}={1}";
for (int i = 0; i <= depth; i++)
format = ("\t") + format;
if (fld.FieldType.IsPrimitive)
{
string val = (obj==null)? "NULL" : fld.GetValue(obj)+"";
sb.AppendFormat("\n\t" + format,
fld.Name, val, fld.FieldType.Name);
}
else
{
sb.Append(
Reflective(fld.Name, fld.FieldType,
fld.GetValue(obj),
depth+1));
}
}
return sb.ToString();
}
}



How to use



var computer = new Computer
{
CPUs = 4,
Display = null,
AnotherDisp = new Monitor {
Height = 768, Width = 1024, Zoom = 2
}

};


string s = Reflective("computer", computer.GetType(), computer, 0 );
Console.WriteLine(s);



Will print out



* <Computer> computer

        * <Monitor> Display-> {Null}


        <Int32> CPUs=4


        * <Monitor> AnotherDisp


                <Int32> Width=1024


                <Int32> Height=768


                <Int32> Zoom=2


Thursday, December 08, 2011

Android Source Files

 

for some reason, the open-source project Google setup for android with all the Git’s and Repos and stuff is very well mainained but requires a degree in particle physics to understand.

This is especially true, if you’re just trying to look under the hood of android and not interested in joining the project per-say or  uploading stuff of your own to a Git repository.

I come from Windows and am unused to becoming an IT specialist to install and use development software.

looking around different blogs and sites I finally found a likeminded individual interested in spreading the joy of SIMPLE and EASY rather than COMPLEX and REQUIRES HOURS OF UNDERSTANDING to do android things.

I want to develop for android, not be part of a complex Operating System’s development team (at least not for now).

I found a blogger who has likeminded views on the subject.

http://mobilebytes.wordpress.com/2010/06/30/classes-source-for-eclipse/

He has downloaded, stripped, mapped, vm’s and refitted the sources for android classes ready for Eclipse.

I uploaded them to megaupoad as well to lower this bloggers bandwidth problems (in case he pays for them)

and here they are:

Android version source megaupload URL I uploaded it to
1.5 r3 http://www.megaupload.com/?d=OL71VL2F
1.6 r2 http://www.megaupload.com/?d=B5F0R1AV
2.01 r1 http://www.megaupload.com/?d=MIJOHYYI
2.1 r1 http://www.megaupload.com/?d=93048HL0
2.2 froyo http://www.megaupload.com/?d=UJRSNLHN

 

In case you don’t know how to wire this up:

Step 1

Download the source codes into a directory such as c:\android\android-sdk-source\

SNAGHTML498a857

Step 2

1) open eclipse, open a project you wish to view the source of:

 

Right click on android.jar – select image

2) Select properties (last one on the context menu) or press Alt-Enter

3) In the window that comes up, under Java source Attachment select External file, then find the source file you downloaded in my case C:/Android/android-sdk-sources/android-sdk-1.6_r2-src.jar

image

4) click Open on the Windows Folder

5) and OK on the eclipse, and you should be all sourced up.

usage:

Click F3 on an android class such as BroadcastReceiver.class and you will see the source code.

image

Word of warning to the Debuggers out there.

YOUR USE OF ANDROID SOURCES and Versionage does not mean the EMULATOR is using the same version - if your app is for android 1.6 (as most should be) and your emulator is 2.2, the source you should attach is 2.2 as the emulator works under 2.2 and not 1.6

make sense?

Good luck

Mickey Perlstein

Sunday, November 27, 2011

Mobility conference

Today I went to the mobility conference. Here are a few things that I learned:

When developing a mobile app you need to ask yourself a couple of questions:

Stickiness over time - will the user be installing it and forgeting all about it or will she be using it always.

  • stickiness will be created also by using Facebook and twitter and other such posts in social media.
  • viral is very important - word of mouth is much better than buying your users (i.e. Advertising)
      • create value to the user
      • make it social
      • make it enjoyable
      • make it very viral
  • very little apps offered to VCs are life-changing ones
  • lowering the customer acquisition costs - interesting someone else to use it - if the only way I can use it is if you use it -  it helps you use it - and helps me gain new customers.

Respond to every support call

Challenges facing the mobile market:

  • Security on mobile is challenging
  • Discoverability is very hard
  • Revenue streams are shocking
  • new challenges - the mobile market place brings in bouncers - a new phase of rejects from the marketplace/apple/google etc.  adds and other layer of challenges
  • Problems with revenue streams especially when direct to consumer
  • Ad revenue alone is a bad model
  • Different mobile users are of different user types and should be considered accordingly

What is the user experience, what the apps does the user usually use. Do your best to create a single application connected to all the application's the user uses, or unifying them.  Try changing the UIx using the same backend(s). 

The new user paradigm : There is no such thing as the final user - all users are middle users, and will be RE sending an edited version of the data in a new way to someone else – who will again be a middle user recreating and sending it to someone else.  So the data itself needs to be dynamic and available (perma links).

Analytics are very important!!!  Not only in web but even more so in mobile apps.  What's tabs are pressed, how the user uses a system, what gestures are used etc.

The smart phone is not always connected, think not connected systems think synchronization

Real time collaboration - the users are used to real time collaboration with their colleagues, think constant syncing with server think multiple user interface think multiple users.

Platforms: every couple of months and you platform comes out, each platform comes with its own resolution, abilities, controls and OS.

IMG_20111127_150413

Try to think cross-platform: maybe abstraction layers like HTML 5, phonegapp, flex

UIX

  • All female users are righties (except for a small promil)
  • Most male users are righties
  • A lot of male users are colorblind

idea of Cool:

  • Users need to be set in a certain zone
  • There should be a flow to the application - remember when you scroll on the iPhone the scrolling continues even for a bit - even though you've stopped scrolling

The user’s mental image should agree with the user's experience

REACTION   VISUALIZATION
  SIMILAR DIFFERENT
SIMILAR positive nothing/positive
DIFFERENT BAD!!! N/A

if the users visual experience is the same*  and the reaction is similar meaning the same gestures apply the same interaction takes place the user uses the same cognitive abilities to manipulate the screen then to the reaction is a positive one

However, if the users visual experience is the same however the reaction required by the user is different such as scrolling vs.  Gesturing, right clicking vs. long press, gesturing with two fingers vs.  Selecting with a mouse Et cetera, the user's learning curve would be longer, and their overall experience would be bad.

* the screen looks the same on a desktop and on the mobile or on the tablet/pad

Friday, November 04, 2011

QR Codes and Contact information - part 2

Because of Error Correction
you can ad readable text too (not a lot)

QR Codes and Contact information

-- This blog is being written by Microsoft Windows 7 speech recognition software, so if there are some errors I missed, please excuse me.

Today I was reading a LinkedIn article by Lynne, more a blog post actually. I dunno if it's her company or if she works there is this is an advertisement, but still it intrigued me.

http://www.linkedin.com/groupItem?view=&gid=1062177&type=member&item=78767032&commentID=57065334&report%2Esuccess=8ULbKyXO6NDvmoK7o030UNOYGZKrvdhBhypZ_w8EpQrrQI-BBjkmxwkEOwBjLE28YyDIxcyEO7_TA_giuRN#commentID_57065334

Recently I was at a DLD conference where I met someone who had an iPhone 4, she insisted that we connect through WhatsApp so she could send me full contact record that would be installed directly into my phone - including all her numbers, contact information and even a picture.

This got me thinking, I was out of business cards and there were too many people in the conference so Internet was a problem and slow plus the fact that the lot of foreign dignitaries were there and not all of them had Internet. EVERYONE had some form of smartphone (iPhone 3, iPhone 4, android, windows mobile phone, and even some new Nokia phones).

There has to be some kind of method to communicate data between these phones.

vCard doesn't work for android, although it used to work for my old Nokia e71.

Then I saw Lynne’s blog post (above) and decided there must be a better way.

WhatsApp contact transferring is not the solution - but it is the doorway though which I entered the field.

So Googling my way around, I started reading about QR Codes, and found out that their are different identifiers hidden in the text part of the QRCode.

The first one I found was the MATMSG

According to NT DoCoMo Japan, these are the identifiers available:

1. MATMSG: - this will automatically a allow you to open an email, the TO, the Subject and the body as well as your signature can be embedded into QR code. I don't know why one would use this, as it is almost an invasion of privacy for nontechnical people, this would be a nice way of stealing their e-mail address all they need to do is just click enter on their phone and you have their email. But whatever I'm not the cyber police, and I really like the expression

“When you make something idiot proof - they just invent a better idiot”

2. MEBKM - this allows you to install a bookmark in one's browser, the NAME and URL are fields.

3. LAPL – don’t know if this really works, because obviously we're not using NT DoCoMo but it's supposed to start an application according to its ADF key (whatever that is).

4. MECARD - the holy grail.

Allows one to send contact information directly into your contact application. I've tested this on android with success, and I'm about to test this also on other devices soon (hopefully yours)Open-mouthed smile

Contact Grabber

So using any QR Code generator, in the text option, you can add your own contact information. The fields are:

Field Info Comment
N: your Name When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name.
TEL: your phone number 1 to 24 digits
TEL-AV: your number for Video Calls 1 – 24 digits
EMAIL: your email
ADR: Address The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order.
BDAY: your birthday 8 digits consist of the year (4 digits), month (2 digits) and day (2 digits), in order.
URL: your homepage
NICKNAME: Your nickname
NOTE: a note I would probably add something about you as well as the conference. This will help the receiver remember where they met you

Then I found this bad boy http://www.quickmark.com.tw/en/qrcode-datamatrix-generator/?qrmecard

Which is exactly to make a universal contact for your smartphone.

This is My contact info if you want to check and see if it works for you.

111004140850 MECARD:
N:Perlstein,Mickey;
TEL:+972-checktheQRCODE;
EMAIL:pitronot-AT-bigfoot.com;
URL:http\://mperlstein.blogspot.com;NOTE:Server/Client/Mobile Developer and Consultant. I offer unique services in all aspects of your Technical project\, from conceptualization\, through Financial and Strategic Models all the way to Product launch.;;

So create your contact data, save it on your phone’s picture gallery, and let someone scan it off your phone.

YAY for old technology.

Thursday, November 03, 2011

Ruby On Rails

 

I met a guy who seemed to know his stuff at an entrepreneurship (don’t you just hate that word?).  His name is Ori Pekelman (in case you're interested), and he told me about ruby on rails version 3.1.

A few years ago I heard about the Ruby, and I tried it out but I didn't really see the point in it. Another unstructured language is not what we need.

However if Ori says that he can create a whole web site in 5 minutes, maybe it's worth my time to investigate a bit further.

After googling for a bit,I found two sites:

http://Railsforzombies.org which is a really cool site, and http://tryruby.org.

After playing around with Railsforzombies, I come to a couple of conclusions:

1.  dot.net 3.5 lambda methods is taken directly from Ruby.

2.  dot.net 3.5 entities is taken from Ruby’s Rails, even the plural/Singular Classes vs. Tables naming conventions.

3. dot.net 4 MVC is probably taken from Ruby’s Rails as well.

 

I'm disappointed in you Microsoft, I thought you invented something cool.  Turns out you just took something cool and brought it to the masses.

Kudos to you th

Thursday, September 29, 2011

WCF and Large Packets of data : part 2

 

excerpts from http://msdn.microsoft.com/en-us/library/ms789010.aspx

To enable streaming, define the OperationContract appropriately and enable streaming at the transport level.

To stream data

  1. To stream data, the OperationContract for the service must satisfy two requirements:

    1. The parameter that holds the data to be streamed must be the only parameter in the method. For example, if the input message is the one to be streamed, the operation must have exactly one input parameter. Similarly, if the output message is to be streamed, the operation must have either exactly one output parameter or a return value.
    2. At least one of the types of the parameter and return value must be either Stream, Message, or IXmlSerializable.

 

[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
public interface IStreamingSample
{
[OperationContract]
Stream GetStream(string data);
[OperationContract]
bool UploadStream(Stream stream);
[OperationContract]
Stream EchoStream(Stream stream);
[OperationContract]
Stream GetReversedStream();

}





GetStream operation receives some buffered input data as a string, which is buffered, and returns a Stream, which is streamed. Conversely



UploadStream takes in a Stream (streamed) and returns a bool (buffered).



EchoStream takes and returns Stream and is an example of an operation whose input and output messages are both streamed.



GetReversedStream takes no inputs and returns a Stream(streamed).



2. Streaming must be enabled on the binding. You set a TransferMode property, which can take one of the following values:




  • Buffered,


  • Streamed, which enables streaming communication in both directions.


  • StreamedRequest, which enables streaming the request only.


  • StreamedResponse, which enables streaming the response only.

Backup Schemes

 

SQL

http://social.msdn.microsoft.com/Forums/en/sqlexpress/thread/5e70a1c9-8495-4c83-8040-897a7c62783e

http://www.sqldbatips.com/displaycode.asp?ID=26

http://expressmaint.codeplex.com/

 

WMI

http://www.vbsed.com/scripts/desktop/restore/scr_317.aspit – restore points

VbsEdit includes all these samples!

Download now! (32-bit version)
version 4.0   -   The evaluation version never expires

Tuesday, September 20, 2011

So my test is on its way

I have been commissioned to write a distributed Backup service system. basically we’re talking about a Server element and multiple Services each polled by the server or polling the server – I have yet to decide that.

Each Service element will be able to backup a server and communicate back to the main Server element about its success or failure.

The server will then commission all the backup up data and get it to the main location.

the server will create a log detailing each services state : success/failure.

In step 2, there will be a GUI

Step 1, Design the Backup service element

 

For Now I have the Service element which I named BackupUtility

It asks a Factory for the right BackupEngine (I called it BackupWorker) and using IBackupWorker I manipulate it.

I Took newkie’s code from code-project (love that site btw) ThreadBase<T>.

He wrote two implementations, and using some knowhow I transformed it into a cancalable version I decided I don’t need, and reverted back. YEAY Sad smile

So now I wrote a class that implements it and adds logging to the start and finish and has some more fun parts. and a Factory to retrieve it. – had a heck of a time with log4net not reading its configuration file. – I wish log4net could just say HEY COUNLDNT FIND CONFIG FILE instead of spewing garbage when in debug mode – ooof

 

Next is the Parser

as the Workers are Threads and run asynchronously, 

As a worker threads are run asynchronously, the log files are also very jumbled up.  I have two options:

1) create two log files

2) parse/ sort the single log file

I’m guessing I’ll go with 1 because I think I wont know how many log files there will be until runtime. and I plan to use some version of DataTable to store my data. <this will also help in part two which is the WCF service and data transfers>

 

I have found a Microsoft Tool called Log Parser, so it’s a dandy

checking it out now

Monday, September 19, 2011

Log4Net Patterns

 

taken from http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html

The recognized conversion pattern names are:

a - Equivalent to appdomain - Used to output the friendly name of the AppDomain where the logging event was generated.

c - Equivalent to logger

C - Equivalent to type

class - Equivalent to type

d - Equivalent to date

enclosed between braces. For example, %date{HH:mm:ss,fff} or %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is given then ISO8601 format is assumed (Iso8601DateFormatter).

For better results it is recommended to use the log4net date formatters. These can be specified using one of the strings "ABSOLUTE", "DATE" and "ISO8601" for specifying AbsoluteTimeDateFormatter, DateTimeDateFormatter and respectively Iso8601DateFormatter. For example, %date{ISO8601} or %date{ABSOLUTE}.

These dedicated date formatters perform significantly better than ToString.

exception - Used to output the exception passed in with the log message.

If an exception object is stored in the logging event it will be rendered into the pattern output with a trailing newline. If there is no exception then nothing will be output and no trailing newline will be appended. It is typical to put a newline before the exception and to have the exception as the last data in the pattern.

F - Equivalent to file Used to output the file name where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

identity - Used to output the user name for the currently active user (Principal.Identity.Name).

WARNING Generating caller information is extremely slow. Its use should be avoided unless execution speed is not an issue.

l - Equivalent to location

L - Equivalent to line

location

Used to output location information of the caller which generated the logging event.

The location information depends on the CLI implementation but usually consists of the fully qualified name of the calling method followed by the callers source the file name and line number between parentheses.

The location information can be very useful. However, its generation is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

level - Used to output the level of the logging event.

line - Used to output the line number from where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

logger - Used to output the logger of the logging event. The logger conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.

If a precision specifier is given, then only the corresponding number of right most components of the logger name will be printed. By default the logger name is printed in full.

For example, for the logger name "a.b.c" the pattern %logger{2} will output "b.c".

m - Equivalent to message

M - Equivalent to method

message - Used to output the application supplied message associated with the logging event.

mdc - The MDC (old name for the ThreadContext.Properties) is now part of the combined event properties. This pattern is supported for compatibility but is equivalent to property.

method - Used to output the method name where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

n - Equivalent to newline

Outputs the platform dependent line separator character or characters.

This conversion pattern offers the same performance as using non-portable line separator strings such as "\n", or "\r\n". Thus, it is the preferred way of specifying a line separator.

ndc - Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.

p - Equivalent to level

P - Equivalent to property

properties - Equivalent to property

property - Used to output the an event specific property. The key to lookup must be specified within braces and directly following the pattern specifier, e.g. %property{user} would include the value from the property that is keyed by the string 'user'. Each property value that is to be included in the log must be specified separately. Properties are added to events by loggers or appenders. By default the log4net:HostName property is set to the name of machine on which the event was originally logged.

If no key is specified, e.g. %property then all the keys and their values are printed in a comma separated list.

The properties of an event are combined from a number of different contexts. These are listed below in the order in which they are searched.

the event properties
The event has Properties that can be set. These properties are specific to this event only.
the thread properties
The Properties that are set on the current thread. These properties are shared by all events logged on this thread.
the global properties
The Properties that are set globally. These properties are shared by all the threads in the AppDomain.

r - Equivalent to timestamp

t - Equivalent to thread

timestamp

Used to output the number of milliseconds elapsed since the start of the application until the creation of the logging event.

thread

Used to output the name of the thread that generated the logging event. Uses the thread number if no name is available.

type

Used to output the fully qualified type name of the caller issuing the logging request. This conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.

If a precision specifier is given, then only the corresponding number of right most components of the class name will be printed. By default the class name is output in fully qualified form.

For example, for the class name "log4net.Layout.PatternLayout", the pattern %type{1} will output "PatternLayout".

WARNING Generating the caller class information is slow. Thus, its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

u - Equivalent to identity

username - Used to output the WindowsIdentity for the currently active user.

WARNING Generating caller WindowsIdentity information is extremely slow. Its use should be avoided unless execution speed is not an issue.

utcdate - Used to output the date of the logging event in universal time. The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %utcdate{HH:mm:ss,fff} or %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is given then ISO8601 format is assumed (Iso8601DateFormatter).

The date format specifier admits the same syntax as the time pattern string of the ToString.

For better results it is recommended to use the log4net date formatters. These can be specified using one of the strings "ABSOLUTE", "DATE" and "ISO8601" for specifying AbsoluteTimeDateFormatter, DateTimeDateFormatter and respectively Iso8601DateFormatter. For example, %utcdate{ISO8601} or %utcdate{ABSOLUTE}.

These dedicated date formatters perform significantly better than ToString.

w - Equivalent to username

x - Equivalent to ndc

X - Equivalent to mdc

% -The sequence %% outputs a single percent sign.

The single letter patterns are deprecated in favor of the longer more descriptive pattern names.

Sunday, September 18, 2011

UPDATED: Getting Log4Net to work with Dot.Net Framework 4.0

 

UPDATED: If you want to write code for Log4Net and you’re using dot.net 4 and it won’t compile do the following

open the src directory and open the log4net.csproj –> update it to dot.net 4

  1. Project Properties :
    1. Application : Target Framework : .Net Framework 4
      image
    2. Build : Conditional compilation symbols: change NET_1_0 to NET_4_0
      image
  2. AssemblyInfo.cs

Line 52: copy the line 52 and 53

and paste it under line 52

change #elseif(NET_1_0) to #elseif(NET_4_0)

and change Framework 1.0 to Framework 4.0

image

3. in References: Delete System.Data, System.Web references and add Reference : System.Data and System.Web from the .NET tab

*this is don’t so they are Framework 4 compatible (before they were Framework 1.1 compatible, which is not good enough for Framework 4.0 I guess.

Now change The SystemInfo CurrentThreadId from the Obsolete GetCurrentThreadId to the new System.Threading.Thread.CurrentThread.ManagedThreadId;

image

 

Next

Some security changes were made in the .NET 4.0 framework. In the AssemblyInfo.cs file of the log4net project, you'll find the following line:
[assembly: System.Security.AllowPartiallyTrustedCallers] –

This is affected by the security changes. Take a look at this page for more details: http://msdn.microsoft.com/en-us/library/system.security.allowpartiallytrustedcallersattribute.aspx.

because it’s bad for dot.net 4 , but not for anything else

add

image

 

Now Build using Release and all should work.

good luck

Wednesday, August 10, 2011

Layout of the Android Main.xml and friends

 

Being a Dot.Net programmer for several years now. It’s kinda hard downgrading back to good old eclipse and eclipse plugins.

 

It’s like watching RHPS at home, it’s the same except for all the bells and whistles. And tell ya the truth, You go to watch the show in the cinema because of the bells an whistles. Actually one would argue that without the bells and whistles throwing crap at each other, shouting APs and playing around with water pistols is damn right stupid – but I digress.

I found this site http://developer.android.com/guide/topics/ui/declaring-layout.html pretty useful to understand most of the technobabble about how to setup the vocab and the naming and stuff.

 

In general, if you want to work WITHIN the framework, you must learn these rules. ELSE? else you’re a regular programmer that fights the framework rather than embracing it and then shouting that M$ is just an evil system that doesn’t allow you to customize….

or in this case I guess it’s be G$$gle’s day in court vs the undisciplined programmers.

It’s kinda hard readjusting to setText vs .Text in properties and all this workaround shit.

too bad google went all NIH on us, and didn’t take a page out of the dot.net handbook.

had the added partial class life would’ve been sooo much simpler. this is like programming in 1995 again using tools designed to fight the good fight rather than tools to just WORK. I’ve half a mind to write my own hack to offer partial classes and point click services to the ADT – but I’m too lazy and underpaid for that. (or as I said before, I have only half a mind).

 

Back to the framework, and excuse my rants

So the layout file will contain a layout type located in the res/layout directory

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             
android:layout_width="fill_parent"
             
android:layout_height="fill_parent"

             
android:orientation="vertical" >

   
<TextView android:id="@+id/text"
             
android:layout_width="wrap_content"
             
android:layout_height="wrap_content"
             
android:text="Hello, I am a TextView" />
   
<Button android:id="@+id/button"
           
android:layout_width="wrap_content"
           
android:layout_height="wrap_content"
           
android:text="Hello, I am a Button" />
</LinearLayout>


After you've declared your layout, you need to load it.



the default Activity loads a Layout of:




public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}



I love it how the “main” is itallicized and bolded, soo cute donchathink ?



so how do we write the ID ? we write it using



<Button android:id=”@+id/my_Button” />



this will be created in the R.java respectfully.



on the onCreate() method you can reach the Button using



Button myButton  = (Button) findViewVyId(R.id.my_Button);



HELLO GOOGLE! WAKE UP



Dot.NET solved this is Dot.Net 2.0!



Specifically in ASP.NET. the xml parser the creates on the fly dot.net code? _Default.aspx class that locates the button and makes the connection ?



Why should I be writing automatic and seziphic code instead of programming my app? This is not something a programmer should be dealing with. this is something you should have written into your designer – oof.

Tuesday, August 09, 2011

Android SDK

 

Installing the android SDK and starting to write my android App

Installed Java 7

Installed Android SDK : FAILED

Added path vars

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Java\jdk1.7.0\bin\;

Installed SDK : PASSED

Eclipse Classic 3.7

http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.7-201106131736/eclipse-SDK-3.7-win32.zip

ADT Plugin for eclispe

http://developer.android.com/sdk/eclipse-adt.html

 

Downloading the ADT Plugin

Use the Update Manager feature of your Eclipse installation to install the latest revision of ADT on your development computer.<>

Assuming that you have a compatible version of the Eclipse IDE installed, as described in Preparing for Installation, above, follow these steps to download the ADT plugin and install it in your Eclipse environment.

  1. Start Eclipse, then select Help > Install New Software....
  2. Click Add, in the top-right corner.
  3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
    http://dl-ssl.google.com/android/eclipse/
  4. Click OK
    Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
  5. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  6. In the next window, you'll see a list of the tools to be downloaded. Click Next.
  7. Read and accept the license agreements, then click Finish.
    Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
  8. When the installation completes, restart Eclipse.

Pasted from <http://developer.android.com/sdk/eclipse-adt.html>

 

image

image

Google USB Driver

http://developer.android.com/sdk/win-usb.html#WinUsbDriver

clip_image001

Setting up the enviroment

5. In the Variable Name field, type ANDROID.

6. Type the full path to the tools directory in the Variable Value field (see Figure 2-14).

clip_image001[5]

Create an AVD

To learn more about how to use AVDs and the options available to you, refer to the Android Virtual Devices document.

In this tutorial, you will run your application in the Android Emulator. Before you can launch the emulator, you must create an Android Virtual Device (AVD). An AVD defines the system image and device settings used by the emulator.

To create an AVD:

  1. In Eclipse, choose Window > Android SDK and AVD Manager.
  2. Select Virtual Devices in the left panel.
  3. Click New.

The Create New AVD dialog appears.

  1. Type the name of the AVD, such as "my_avd".
  2. Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator.
  3. Click Skin: built In resolutions : QVGA

clip_image002

You can ignore the rest of the fields for now.

  1. Click Create AVD.

Pasted from <http://developer.android.com/resources/tutorials/hello-world.html>

Droid Draw

  • Not needed for now – I think it’s a standalone project made prior to the ADT ?

ANDROID SOURCE CODE

http://source.android.com/source/downloading.html

couldn’t download this. tried to download Git and other stuff, just ended with a headache. NEXT

 

My Next post … Hello world