Friday, 18 September 2009

MonoTouch Info.plist & Default.png

I'm the first to admit this is a somewhat lazy post... but hey it's Friday. There's not a lot of MonoTouch-C#-specific content today - but .NET developers coming to the iPhone might not be aware of this stuff, so here goes:

Default.png
AKA "Splash screen", if you place a file named Default.png in the root of your application with Build action: Content then the iPhone will automatically display this while the application loads (rather than the "black screen").
There's a few approaches you can take: the awesome Flight Control app uses a simple 'Please wait' banner (which conveniently prompts you to turn the phone sideways); my other sample uses a 'greyed out' copy of its UI with a 'loading...' message.

Alternatively you could take a screenshot before shut-down and save it as /Name.app/Default.png, so the next time it starts up it looks like you are continuing where you left off - even before the app is finished loading. UPDATE: here's some sample screenshot code to add to your WillTerminate method

Info.plist
Whether you realise it or not, your MonoTouch app already contains an Info.plist file - right-click on your project → Options → iPhone Application → Application Bundle - these fields all end up in a MonoTouch-generated Info.plist.


If you navigate with Finder to /Projects/<your project>/bin/iPhone/debug/ and remove the .app extension you can open your 'app' (it's just a folder!) then you can view the generated Info.plist that is sent to your device.


That doesn't mean you are restricted from adding more details though! Remember that plist files are basically just a special 'Apple' form of XML. Simply add a text file to the root of your project and rename it Info.plist - MonoTouch will merge it with the Options before copying to the simulator/device. Here is a sample Info.plist (described below). DON'T FORGET to set the Build action:Content in the file's properties.

SBUsesNetwork & UIRequiresPersistentWiFi
Indicates to the operating system that your app uses connectivity. The Persistent setting keeps the WiFi running (so beware of running down the battery).


UIPrerenderedIcon
When true it tells the operating system that your icon is already pretty, and not to mess with it! When false the icon is made shiny with curved corners for you.

You probably want to leave it as the default: false!

UIStatusBarHidden
If true, totally HIDES the status bar (eg. for games such as Flight Control).

UIStatusBarStyle
Use this to turn the status bar from grey to black! The UIPrerenderedIcon example above also shows the UIStatusBarStyleOpaqueBlack status bar style.

UIInterfaceOrientation
If you change this from the default setting (eg. to UIInterfaceOrientationLandscapeRight) you should ensure you have provided landscape views in your application. You really don't want this effect:


CFBundleURLTypes
If you read about initiating a call or other actions in MonoTouch you'll know about the use of OpenURL schemes to open other applications.

Using CFBundleURLTypes in Info.plist informs the operating system of what schemes your application will respond to. If you use the sample Info.plist and view this blogpost on your iPhone, clicking initdial://123456789 will open your app! You probably also want to parse the parameters... but that's another post :)

Custom schemes are really useful for social apps (eg. twitter clients, map stuff, etc). To learn more about what schemes are already available/used check out handleopenurl.com.


There are many more options you can set in Info.plist, and also other ways to control some of the things above (such as showing/hiding and changing the appearance of the status bar). Check out some of the Objective-C resources and try them for yourself!

Monday, 14 September 2009

MonoTouch released

MonoTouch 1.0 has been released and is available for purchase!
MonoTouch logo

Phonebook sample updated

Thank's to Simon's Build a Customer UITableViewCell post the Corporate Phonebook sample has been updated: now featuring custom UITableViewCells (and the phonenumbers don't overflow any more). Read more in the previous post.



The project can be downloaded (29Kb) to try out on your newly registered copy of MonoTouch! Maybe having the company phonebook on the iPhone will help convince your employer to spring for an Enterprise licence :)

Friday, 11 September 2009

MonoTouch with SQLite "Corporate Phonebook"

UPDATE [3-May-12]: The latest code for this sample is now on github (CorporateDirectory). It contains the latest version of SQLite.cs and minor bugfixes. Firstly, let me begin by saying this sample totally relies on the contribution of Frank Krueger who posted the SQLClient.cs code to the MonoTouch mailing list
Here is the code. Consider it released into the public domain. If there's interest, I can start a Google code project or something.
Many thanks Frank! This is a VERY simple application using that library: it lists 'employees' from an SQLite database and allows you to call or email them:
*
* note: may not adhere to iPhone user interface guidelines!

The c# code itself can be downloaded (26Kb) or browsed below:
This first sample only reads from SQLite on the iPhone - just a single database call
using (var db = new SQLiteClient.SQLiteConnection("phonebook")) {
db.Open();
var users = db.Query(
"SELECT Firstname, Lastname, Work, Mobile,
Department, Email
FROM Phonebook ORDER BY Lastname"
, 1000);
listData = users.ToList();
}
which queries data that was set-up in the SQLite Database Browser and included with the application as a 'Content' file within the MonoTouch project.
Creating a database using SQLite Database Browser


It uses UITableViewDelegate, UITableViewDataSource and UIAlertViewDelegate implementations to populate the scrolling list and react to touch 'events'.

When you touch a row, we use the OpenUrl method discussed previously to trigger a call or email.

Future additions to this sample might include alphabetized sections, search function and a proper 'user page' rather than using UIAlertView. Perhaps some hierarchical navigation and an online 'updater' function as well?

p.s. yes, I shouldn't have used INTEGER for the telephone numbers in SQLite... they seem to be overflowing. I will convert them to TEXT in a future post..

Sunday, 6 September 2009

MonoTouch MapKit 101

UPDATE 27-Sep:MapKit 103 has the MKAnnotation working - DEVICE ONLY.
UPDATE 25-Sep:MapKit 102 has the MKPlacemark working.
UPDATE 14-Sep:This post was written against MonoTouch beta 0.8; some issues have been addressed in the released version. Updated blog post coming soon...

MonoTouch MapKitMapKit seems to have the following 'features' which were supposed to be covered by this sample:
• Display a map
• Change map appearance
• Interact with the user's location via GPS
• Reverse-geocode a location
• Place pins (with popups) on the map

The sample manages to cover four out of five of those, but pin-placement just refused to work...

Firstly, you can download the MapKit.zip (16Kb) if you want to give it a try or just view Main.cs and MainWindow.xib.designer.cs.htm online.

To start with, don't forget you will need using MonoTouch.MapKit; using MonoTouch.CoreLocation; in your c#.

Some of the 'code highlights' are shown below - I'm not sure if this is the best way to do it, just that it "works" (and if you have any ideas why MKAnnotation is so problematic, let me know).

Show current location
Actually this sample doesn't use MapKit's built-in feature to put a little blue pin on your current position, but it is VERY easy to configure:
mapView.ShowsUserLocation = true;

Change map location
It's also pretty easy to set the map's current center-point (and optionally animate the transition):
mapView.SetCenterCoordinate(new CLLocationCoordinate2D(
Convert.ToDouble(textfieldLatitude.Text),
Convert.ToDouble(textfieldLongitude.Text)),
true);

Respond to map being 'dragged'
When the map is dragged, a MKMapViewDelegate subclass is provided to 'listen' for various things and take some action. The MapViewDelegate class takes a reference to the AppDelegate so it can interact with the UI.
Firstly you must 'attach' the delegate (NOTE: this is NOT a c# delegate but a different concept with the same name!)
mapView.Delegate = new MapViewDelegate(this);
and then do our UI update in the class itself
public class MapViewDelegate : MKMapViewDelegate
{
public override void RegionChanged(MKMapView mapView, bool animated)
{
Console.WriteLine("Region did change");
_appd.labelCurrent.Text = "Map Center " +
mapView.CenterCoordinate.Latitude + ", " +
mapView.CenterCoordinate.Longitude;
}

Reverse geocoding a location
MKReverseGeocoder follows the same delegate pattern as MKMapView, first you 'configure' the geocoder
geoCoder = new MKReverseGeocoder(mapView.CenterCoordinate);
geoCoder.Delegate = new GeoCoderDelegate(this);
geoCoder.Start();
then provide the implementation in another class. In this case MonoTouch.MapKit does not currently provide the method we need, so here is the full class with special MonoTouch attributes included (meaning the c# name FoundPlacemark is not important - just make sure you get the parameters correct)
public class GeoCoderDelegate : MKReverseGeocoderDelegate
{
AppDelegate _appd;
public GeoCoderDelegate(AppDelegate appd) {_appd = appd;}
// Not currently exposed by MonoTouch, use ExportAttribute
[Export("reverseGeocoder:didFindPlacemark:")]
public void FoundPlacemark(MKReverseGeocoder geocoder
, MKPlacemark placemark
)
{
Console.WriteLine("Found in " + placemark.Country);
_appd.labelPlacemark.Text = placemark.SubThoroughfare
+ " " + placemark.Thoroughfare
+ " " + placemark.Locality
+ " " + placemark.AdministrativeArea
+ " " + placemark.Country;
}

GPS Tracking with CoreLocation
You can spot the CoreLocation classes with their CL prefix (as opposed to MK). Once again we have the 'delegate pattern' in play, first creating it with some custom constructor parameters (and not forgetting to start the tracking)
locationManager = new CLLocationManager();
locationManager.Delegate = new LocationManagerDelegate(mapView, this);
locationManager.StartUpdatingLocation();
with the implementation in another class
private class LocationManagerDelegate : CLLocationManagerDelegate
{
private MKMapView _mapview;
private AppDelegate _appd;
public LocationManagerDelegate(MKMapView mapview, AppDelegate appd)
{
_mapview = mapview; _appd = appd;
}
public override void UpdatedLocation(CLLocationManager manager
, CLLocation newLocation, CLLocation oldLocation)
{
MKCoordinateSpan span = new MKCoordinateSpan(0.2, 0.2);
MKCoordinateRegion region =
new MKCoordinateRegion(newLocation.Coordinate, span);
_appd.mylocation = newLocation;
_mapview.SetRegion(region, true);
_appd.labelInfo.Text = "UserLocation "
+ newLocation.Coordinate.Latitude + ", "
+ newLocation.Coordinate.Longitude;
Console.WriteLine("Location updated");
}
You can stop it when you are done 'tracking', and you can also set locationManager.DesiredAccuracy (if you can figure out what the CONST values need to be!).

Here's the class diagram (the three delegates are actually nested in AppDelegate, as is a subclass of MKAnnotation which isn't working just yet...)


And yes, the user-interface on this sample isn't exactly intuitive... so here's the "manual" :)

Thursday, 3 September 2009

Initiate a call with MonoTouch

Initiating calls, text messages and triggering other applications on the iPhone is a pretty basic requirement for MonoTouch applications - but it still took me a little while to "translate" the examples I found (eg developertips).






The mechanism is pretty simple - you just need to construct a Url with a specific 'scheme' and call the OpenURL method. I kept finding examples using self to reference OpenURL so it took me a second to figure out the method is actually on UIApplication. I'm working with iPhone OS 3.0 so OpenURL returns a bool if the action is 'possible': false if that scheme is not recognised on the device.
public partial class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
window.MakeKeyAndVisible();
buttonCall.TouchDown += delegate { // trigger action
NSUrl url = new NSUrl("tel:" + textfieldInput.Text);
if (!UIApplication.SharedApplication.OpenUrl(url))
{
var av = new UIAlertView("Not supported"
, "Scheme 'tel:' is not supported on this device"
, null
, "Ok thanks"
, null);
av.Show();
}
};
* Note: you can read about the singleton SharedApplication property in the UIApplication reference.

Some of the other common schemes look like this:
new NSUrl("sms:" + textfieldInput.Text);
new NSUrl("http://maps.google.com/maps?q=" + textfieldInput.Text); // opens Maps
new NSUrl("http://" + textfieldInput.Text); // opens Safari
new NSUrl("mailto:you@gmail.com?subject=" + textfieldInput.Text);
and two others I've added for testing are
new NSUrl("tweetie:///post?message=" + textfieldInput.Text);
new NSUrl("comgoogleearth://");
You can view the full code for the test app - Main.cs and MainWindow.xib.designer.cs - the Xib is basically a textfield and seven buttons - complete source in MonoTouch solution ZIP (14k).

Here's a link to Apple's Url Scheme Reference (PDF)
and two lists of the currently available url types: iPhone Url Schemes & AppLookup

Sunday, 30 August 2009

MonoTouch Settings.bundle

Property Lists (plist) and Bundles are probably so obvious to seasoned Mac/iPhone developers that they're not even worth mentioning, however for someone with a '100% .NET' background you can't take anything for granted. I had a -lot-bit of trouble getting iPhone Settings working with MonoTouch (see here), but now that I've figured it out it seems very simple. Here's a quick guide:

1. Bundles are folders
Within your MonoTouch project, create a new folder (right-click solution → Add → New Folder) and call it Settings.bundle


2. Plist files are some sort of hybrid Xml key-value
(right-click solution → Add → New File... → Empty Text File) and call it Root.plist. You could add an existing plist-xml-formatted file if you like - but we're just going to create one from scratch (in the next step).


3. Edit Root.plist with the Property List Editor
The structure of the plist is very specific - look for some doco or Chapter 10 of Beginning iPhone Development. In this example I've only used PSGroupSpecifier and PSTextFieldSpecifier but there are many other types (PSMultiValueSpecifier, PSToggleSwitchSpecifier, PSChildPaneSpecifier...).
Double-click the Root.plist file inside MonoDevelop to open the Property List Editor - type carefully as there is no 'validation' and if you mis-spell (or mis-capitalize) something it just won't work:


4. Set the correct build action for Root.plist
This is important (and I think the cause of my earlier problem) - you MUST tell the IDE to make sure this file is copied to the phone.


5. Access the settings
Use the NSUserDefaults.StandardUserDefaults property to access the values set by the user.


6. See/Edit "Settings" on the iPhone


It's worthwhile noting that the 'useability' for these kinds of Settings is 'unusual' for desktop applications, but probably familiar to iPhone users... the settings for a whole swag of unrelated applications are grouped under the Settings icon (it's not necessarily obvious from with the application that they are available). The user must also quit the application to get to these settings - which means they're most useful for things that don't change much (eg. the users identity and servers in the Mail.app).

Thursday, 27 August 2009

MonoTouch "iSOFlair"

UPDATE: 6-Oct version 2.0 adds some functionality and the source code.

I didn't get as far as I'd have liked with today's MonoTouch app - a pretty basic rendering of your 'score' on stackoverflow.com (via their 'flair' feature). Yep, definitely not a 'practical' application.

The main goals were to play with WebClient, the 'filesystem' and then to get a multi-page/view app working with proper Settings (to configure the various stackoverflow variants). As you can see from the screenshots below I only got half-way there...


Here's the code: Main.cs, MainWindow.xib.designer.cs and root.plist. At least the WebClient for text and images worked well, as did saving and loading from the local file system. You'll have to excuse the dodgy Html parsing ;)

Unfortunately I've wasted a bit of time trying to figure out the Settings and how to get the plist setup correctly. I first created a folder in MonoDevelop called Settings.bundle with the root.plist inside. It has to be "partly" correct because the application now appears in the Settings menu - which it wasn't before - BUT when you select it the screen is empty of inputs :-(
I'm probably missing something really basic - the root.plist file is shown in the editor below:

Anyway, I'll do some more reading and try again tomorrow!

Obligatory Interface Builder screenshot...

Wednesday, 26 August 2009

MonoTouch "Restaurant Bill Splitter"

Okay - my first "real" iPhone via MonoTouch beta application is complete... welcome to Restaurant Bill Splitter, the easiest way to determine who pays the check :-)

Here it is before any data entry and after you have entered the total restaurant bill (plus the subtotal of any alcohol in that figure) and chosen the number of drinkers versus non-drinkers who are going to pay.



Here is the Interface Builder screen shot


You can also download the MonoTouch BillSplitter solution (11Kb) and view the c# code for Main.cs and MainWindow.xib.designer.cs. Even though MonoTouch is currently still in (closed) beta, it is VERY cool to be able to write c#/.NET targetting the iPhone platform. There is still quite a bit to get my head around (mostly the Apple stuff: XIBs, Views, delegates, events, Interface Builder, etc) but hopefully once I get the hang of it, much more complex applications will be forthcoming...

NOTE: there is one known bug in there... I'm having trouble making the keyboard disappear when you press the [Done] button - so if you're wondering what all the ResignFirstResponder() delegates are for, it's my attempt to debug/fix the keyboard problem. That is also the reason for the [Split] button, which otherwise wouldn't really be required since the calculations happen 'on change' for each of the input controls...


UPDATE: this is the class diagram for the app (obviously excludes stuff *in* the XIB, but includes the .xib.designer.cs). I've also posted the class diagrams for Foundation and UIKit online.

Tuesday, 25 August 2009

MonoTouch "Hello World"

First, let me say that this is the MonoTouch team's "Hello World" code. I'm still trying to figure this whole MonoTouch thing out, so I've given @redth's YouTube screencast a try, and posted my own screenshots (even though they look a lot like these)...

Massive thanks for @redth for the screencast - hopefully I'll be posting something of my own creation very soon. It made a lot more sense (more quickly) than reading.

Anyway, here's the quick links:

0. Read "Hello World" on the MonoTouch official site

1. Watch @redth's screencast

2. Check out my screenshots
Here are a couple of them...


Wednesday, 19 August 2009

Parsing XML with PHP4

PHP is not something I'm familiar with, but I was recently helping out a friend and was surprised how difficult it was to find some sample code for downloading/parsing an XML (specifically using PHP4, apparently PHP5 has some built-in functionality).

Thankfully I stumbled across Taha Paksu's SimpleXML for PHP4 - you must join/login to download it, but it's worth it.

Once you have downloaded the ZIP file, place simplexml.class.php in your PHP 'app', and use the supplied example test.php to ensure everything is working:
<?
require_once "simplexml.class.php";

echo "<pre>";
$file = "http://musicbrainz.org/ws/1/track/?query=metallica&type=xml";
$sxml = new simplexml;
$data = $sxml->xml_load_file($file);
print_r($data);
?>
which prints out a 'tree view' of the XML data.

If that works, you can then address individual elements (say your XML looks like this - an example from the download)
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>
<format>text</format>
<content>Don't forget me this weekend!</content>
</body>
</note>
then your PHP might look like this:
<?
require_once "simplexml.class.php";

$file = "http://SOMESERVER.com/example.xml";
$sxml = new simplexml;
$data = $sxml->xml_load_file($file);
?>
<html>
<body>
<table>
<td>to:</td><td><?php echo $data->to; ?></td>
<td>sender:</td><td><?php echo $data->from; ?></td>
<td>subject:</td><td><?php echo $data->heading; ?></td>
<td>message:</td><td><?php echo $data->body->content; ?></td>
</table>
</body>
</html>


You can read more in the SimpleXML for PHP4 forum... That's enough PHP for now - back to c#/t-sql/xaml/html/javascript... and hopefully soon MonoTouch!

Friday, 14 August 2009

When Mono "just works" - Searcharoo 'ported'

Decided to have another play with Mono today, in preparation for MonoTouch to come out of beta (or for my beta-participation to be approved)...

It was very easy to install Mono and MonoDevelop on my Mac, and because MonoDevelop supports Visual Studio 2008 solution files the current release of Searcharoo opened straight away*, compiled and could be tested with the 'provided' XSP2 webserver:


* I removed the Silverlight project from the Searcharoo solution (playing with Moonlight is a project for another day), but the Silverlight XAP from my Windows machine runs happily on the Mac against the Mono-version of the website:


The other cool thing about MonoDevelop is that it already supports the iPhone/MonoTouch 'project types'. You can't compile/test/run anything (you need MonoTouch.Foundation and MonoTouch.UIKit which are in 'private beta'), but you can browse the MonoTouch Samples - so at least you can see what C# code for the iPhone looks like. Fingers crossed Miguel and the team release the bits publicly ASAP :-)

Wednesday, 12 August 2009

City2Surf 2009 on RaceReplay.net with Flickr

The world's "largest timed footrace" - Sydney's City2Surf - is now viewable on RaceReplay.net thanks to Silverlight and BingMaps.

There are two 'new' features:

1) Flickr photo integration (try it)

Using the Flickr photo search API, the Silverlight client renders small pink-and-blue dots for photos that are both geo-tagged and tagged:"city2surf". Clicking on the dot will open the Flickr page.



2) Visualizing the entire race (try it)

It is (unfortunately) impossible to animate the 65,000 or so points that would represent every runner and walker taking part in the event. By aggregating the finishers into timebands (and using both size & opacity to represent 'value') you can get some idea of the distribution of participants over time, over the course.



Add yourself!

As always, you can search for and add more 'runners' to the animation. Start typing a name into the autocomplete box, select from the list (optionally choose a color from the color-picker) and click Add runner.

Friday, 31 July 2009

Seadragon - Deep Zoom on Demand

Microsoft LiveLabs just announced the release of Seadragon.com, an Azure-based service that creates hosted DeepZoom images 'on demand', making it super-easy to share very-high-resolution images with a quick link.

I tried it out with a few images from my Flickr account (they only take a minute or two to 'process')... click the links to play with Seadragon, click the images just to see a larger copy

Sydney skyline 9774 x 2154 (21 megapixels)



Seattle suburbs from the Space Needle 11991 x 2186 (26 megapixels)



Here's a few more to try for yourself:

Sydney at night 2048 x 768 (1.6 megapixels)

Pike Place Farmers Market 5273 x 2309 (12 megapixels)

Space Needle and Mt Rainier 6388 x 2366 (15 megapixels)

Seattle waterfront from the Space Needle 8861 x 2062 (18 megapixels)

Pike Place close-up 11323 x 3026 (34 megapixels)

As LiveLabs mentions on their website - an easy way to add hi-res images to your eBay listing, real-estate website, ecommerce store, blog, etc...

Saturday, 11 July 2009

SQL in Silverlight

It never ceases to amaze me how short my attention span has become...

what was I saying :) ?

Aaanyway, I sat down in front of my PC today planning to accomplish a few different things... but before that I had to catch up on blogs and twitter. A tweet caught my eye
migueldeicaza IDEA: SOmeone to do a line-by-line port of Sqlite to C# to run inside Silverlight

"Great idea" I thought... but seemed like quite a big job and certainly not something I have the time to tackle. Then I started to recall seeing a C# port of an SQL engine (ages ago) and thought it might be fun to have a poke around. At least it would be easier to port something already in .NET land.

A couple of Google results later, I came across Sharp HSql, a circa 2001 port of the Java-based hsqldb (licence). The code was subsequently added to Codeplex with the following warning: This version is not ready for production grade applications. More testing is needed and some important bugs has to be fixed before that. You are warned.
Long story short...
it's a couple of hours later and I've done nothing that I'd planned to, but here is an 'alpha' of SharpHSql for Silverlight (try it out) - there's some test SQL at the bottom of the post.


The "port" mainly consisted of:
  • 'implementing' ArrayList and Hashtable (umm, can you say List<object> and Dictionary<object, object>)
  • removing the 'Provider' and all the dependencies on System.Data that work fine in the full framework, but are missing from Silverlight (would be nice to add some sort of wrapper back in...)
  • converting FileInfo and related operations to IsolatedStorageFileStream (still some persistence testing to do...)
  • breaking DateTime handling (for now)
The REAL work was all done by Mark Tutt so don't get the idea that I'm taking any credit - all the goodness is his, any errors are mine.

The full source of the consuming Silverlight app is this Page.xaml and Page.xaml.cs; the full Visual Studio 2008 project ZIP (199Kb) is available to download. Anywhere I've touched the code you'll find a //HACK: tag!

Disclaimer: I've no idea if this is fit for any purpose at all... it seems to be able to DROP and CREATE tables, INSERT rows and SELECT/JOIN - but even that could be a fluke. Try it out at your own risk; leave a comment if you find something good or bad. Have fun!

UPDATE: the output is a lot prettier (try it) with the Silverlight DataGrid and Vladimir Bodurov's awesome dynamic datasource compiler - updated for generic types

(updated source (277Kb))

Test SQL

#1
DROP TABLE IF EXIST "books";CREATE TABLE "books" ("id" INT NOT NULL PRIMARY KEY, "name" char, "author" char, "qty" int, "value" numeric);

INSERT INTO "books" VALUES (1, 'Book000', 'Amy', 1, 23.5);
INSERT INTO "books" VALUES (2, 'Book001', 'Andy', 2, 43.9);
INSERT INTO "books" VALUES (3, 'Book002', 'Andy', 3, 37.25);
INSERT INTO "books" VALUES (4, 'Book 21', 'Amy', 99, 20.5);
INSERT INTO "books" VALUES (5, 'Book 22', 'Andy', 2, 903.9);
INSERT INTO "books" VALUES (6, 'Book 23', 'Andy', 5, 0.25);

SELECT * FROM "books" ORDER BY "value"

DROP TABLE IF EXIST "author";CREATE TABLE "author" ("name" char NOT NULL PRIMARY KEY, "country" char);

INSERT INTO "Author" VALUES ('Andy', 'UK');
INSERT INTO "Author" VALUES ('Amy', 'USA');

SELECT * FROM "author" ORDER BY "value"

SELECT * FROM "books" LEFT JOIN "author" ON "author"."name" = "books"."name"
#2
CREATE TABLE "clients" ("id" int NOT NULL IDENTITY PRIMARY KEY, "DoubleValue" double, "nombre" char, "photo" varbinary, "created" date );
INSERT INTO "clients" ("DoubleValue", "nombre", "photo", "created") VALUES (1.1, 'NOMBRE')
SELECT * FROM "clients"