Watch, Follow, &
Connect with Us

Embarcadero Blogs

Latest Posts



Final days for upgrade discount for Delphi 2007 and earlier users

If you're currently using Delphi 2007 or earlier and have been considering upgrading to Delphi XE2 or RAD Studio XE2, you only have until January 31 to get the upgrade price. Starting February 1 you have to pay the new user price to get XE2. If you upgrade by January 31st, you also qualify for the BOGO offer and get a second tool or equal or lesser value free.



posted @ Wed, 25 Jan 2012 17:06:00 +0000 by Tim


Usando expressões regulares em aplicações FireMonkey com C++Builder

Vamos a outro exemplo em C++ onde demonstro como usar expressões regulares a partir da RTL em aplicações FireMonkey e C++Builder.

Este exemplo demonstra como validar um conteúdo a partir de uma string em quatro diferentes expressões regulares, que são:

  • Validar se a string enviada contém um endereço de e-mail
  • Validar se a string enviada contém um endereço de IP válido
  • Validar se a string enviada está no formato dd-mm-yyyy
  • Validar se a string enviada está no formato mm-dd-yyyy

O código a seguir mostra as quatro expressões regulares usadas por essa aplicação.

void __fastcall TForm1::lbRegExpChange(TObject *Sender) {
	switch (lbRegExp->ItemIndex) {
	case 0:
		lbType->Text = "E-mail for validation";

		MemoRegEx->Text =
			"^((?>[a-zA-Z\d!#$%&''*+\\-/=?^_`{|}~]+\\x20*" "|\"((?=[\\x01-\\x7f])[^\"\\\\]|\\\\[\\x01-\\x7f])*\"\\"
			"x20*)*(?\.?[a-zA-Z\d!" "#$%&''*+\\-/=?^_`{|}~]+)+|\"\"((?=[\\x01-\\x7f])"
			"[^\"\\\\]|\\\\[\\x01-\\x7f])*\")@(((?!-)[a-zA-Z\\d\\" "-]+(?)$";

		break;
	case 1: {
			// Accept IP address between 0..255
			lbType->Text = "IP address for validation (0..255)";
			MemoRegEx->Text =
				"\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\" ".(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
				"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
			break;

		}
	case 2: {
			// Data interval format mm-dd-yyyy
			lbType->Text =
				"Date in mm-dd-yyyy format from between 01-01-1900 and 12-31-2099";
			MemoRegEx->Text =
				"^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[" "01])[- /.](19|20)\\d\\d$";
			break;

		}
	case 3: {
			// Data interval format mm-dd-yyyy
			lbType->Text =
				"Date in dd-mm-yyyy format from between 01-01-1900 and 31-12-2099";
			MemoRegEx->Text =
				"^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[01" "2])[- /.](19|20)\\d\\d$";
			break;

		}
	}
	EditTextChangeTracking(EditText);

}

Para executar a validação, utilizamos o método TRegExp::IsMatch como demonstrado a seguir:
To execute the validation you can use the method TRegExp::IsMatch as you can see bellow:

void __fastcall TForm1::EditTextChangeTracking(TObject *Sender) {
       // EditText contain the string value and MemoRegEx the regular expression
	if (TRegEx::IsMatch(EditText->Text, MemoRegEx->Text)) {
		SEResult->ShadowColor = TAlphaColors::Green;
	}
	else
		SEResult->ShadowColor = TAlphaColors::Red;

}

Uma vez que este é um aplicativo FireMonkey, utilizei o efeito de sombra para demonstrar ao usuário se o valor informado no Edit é válido ou não (Verde = válido / Vermelho = inválido). A seguinte imagem demonstra o que irá acontecer caso o usuário informe um endereço de e-mail inválido no Windows e Mac.

Abaixo o resultado quando o usuário informar o endereço de e-mail válido.

Você pode baixar o código fonte  aqui ou atualizar a pasta de exemplos local do seu RAD Studio XE2 a partir do repositório do RAD Studio XE2 no SVN.

Posts relacionados

Andreano Lanusse | Tecnologia e Desenvolvimento de Software
Follow me on Twitter: @andreanolanusse


posted @ Wed, 25 Jan 2012 03:00:24 +0000 by Andreano Lanusse


FireMonkey in Lisbon today

"FireMonkey in Action LIVE" is hitting the road again! I’m in Lisbon now and it was a very exciting day. I have demonstrated RAD Studio XE2, Delphi and FireMonkey to a fully packed room of developers in Lisbon. The energy levels were very high and it was a pure pleasure to demonstrate some cool new FireMonkey 3D demos and also to spend a significant chunk of time showing DataSnap for building multitier applications with Delphi, HTML5 and jQueryMobile.

Great thanks to Sergio Transmontano from Danysoft-Portugal for being such a great host today:-)

Go Delphi! Go FireMonkey! Go InterBase!


posted @ Tue, 24 Jan 2012 19:12:38 +0000 by Pawel Glowacki


iOS Address Book fun

Getting data out of the iOS address book is a lot harder than I thought… Must make component… ;)

Here’s a Q&D routine I managed to eek out today. It simply prints all contacts and all their numbers to the log console.

Enjoy!

uses
  iPhoneAll, AddressBook, CFArray, CFBase;

procedure DumpAddressBook;
var
  addressBook : ABAddressBookRef;
  allPeople : CFArrayRef;
  nPeople : CFIndex;
  ref : ABRecordRef;
  i, j : Integer;
  firstName : CFStringRef;
  lastName : CFStringRef;
  phoneNumber : CFStringRef;
  l, v : CFStringRef;
  S : NSString;
begin
  addressBook := ABAddressBookCreate;
  allPeople := ABAddressBookCopyArrayOfAllPeople(addressBook);
  nPeople := ABAddressBookGetPersonCount(addressBook);

  for i:=0 to nPeople-1 do begin
    ref := CFArrayGetValueAtIndex(allPeople,i);

    firstName := ABRecordCopyValue(ref,kABPersonFirstNameProperty);
    lastName := ABRecordCopyValue(ref,kABPersonLastNameProperty);
    if firstName <> nil then
      if lastName <> nil then
        S := NSString.stringWithFormat(NSSTR(PChar('%@, %@')),lastName,firstName)
      else
        S := NSString.stringWithFormat(NSSTR(PChar('%@')),firstName)
    else
      if lastName <> nil then
        S := NSString.stringWithFormat(NSSTR(PChar('%@')),lastName);
    NSLog(S);

    phoneNumber := ABRecordCopyValue(ref, kABPersonPhoneProperty);
    for j:=0 to ABMultiValueGetCount(phoneNumber)-1 do begin
      l := ABMultiValueCopyLabelAtIndex(phoneNumber,j);
      v := ABMultiValueCopyValueAtIndex(phoneNumber,j);
      S := NSString.stringWithFormat(NSSTR(PChar('%@: %@')),l,v);
      NSLog(S);
      CFRelease(l);
      CFRelease(v);
    end;

    if phoneNumber <> nil then
      CFRelease(phoneNumber);
    if firstName <> nil then
      CFRelease(firstName);
    if lastName <> nil then
      CFRelease(lastName);
  end;
end;

posted @ Wed, 25 Jan 2012 00:36:45 +0000 by Anders Ohlsson


Handling Swipe Gestures in FireMonkey for iOS

I’ve added a component to handle left, right, up and down swipe gestures to my set of iOS components.

Here’s the full set!

NOTE: This component requires that you edit the FMX_Platform_iOS.pas file on the Xcode side to surface mainWindow and a few other things.

Once installed, this component is extremely easy to use. Simply hook up the OnSwipe events that you’d like to handle and you’re done!

type
TSwipeEvent = procedure of object;

TiOSSwipeGestureRecognizer = class(TFmxObject)
private
  FOnSwipeRight : TSwipeEvent;
  FOnSwipeLeft : TSwipeEvent;
  FOnSwipeUp : TSwipeEvent;
  FOnSwipeDown : TSwipeEvent;
public
  constructor Create(AOwner: TComponent); override;
  destructor Destroy; override;
published
  property OnSwipeRight: TSwipeEvent read FOnSwipeRight write FOnSwipeRight;
  property OnSwipeLeft: TSwipeEvent read FOnSwipeLeft write FOnSwipeLeft;
  property OnSwipeUp: TSwipeEvent read FOnSwipeUp write FOnSwipeUp;
  property OnSwipeDown: TSwipeEvent read FOnSwipeDown write FOnSwipeDown;
end;

Enjoy!


posted @ Tue, 24 Jan 2012 20:44:09 +0000 by Anders Ohlsson


FireMonkey в записи с Евгением Крюковым

Хотел выложить до НГ, но потом решил не портить праздник. С одной стороны, очень полезно не разлениться в долгие/долгожданные каникулы. Время вроде как есть. Но всё-таки при всей своей продвинутости программисты часто ставят собственные интересы в удовлетворении творческого начала выше семейного долга. Поэтому способствовал временному возвращению отцов в семьи. Всё-таки дети - ну они как программы. Развиваются, получают новый функционал, приобретают новый уровень самоорганизации. Да и наши жёны заслуживают внимания, что вопреки повсеместному консьюмеризму очень даже благостно сказывается на психике.

Далее позволю себе избежать сомнительных параллелей, и просто порекомендую уважаемым любителям новых технологий в мире Delphi посмотреть и послушать Инициализация FireMonkey с Евгением Крюковым.

Thanks, Dev{eloper} Stonez for making me post the English subtitles for the webinar with Eugene. The text is broken by slides, but they are rather static, so reading is as ok, as watching the video.


posted @ Tue, 24 Jan 2012 11:23:13 +0000 by Vsevolod Leonov


TMS Components Video - Windows, Mac, iOS - Same Code!

Back in December, David I blogged on the release of the TMS Instrumentation WorkShop for FireMonkey

This brand new component set for FireMonkey works on Windows, Mac and iOS with the same code base and is a true FireMonkey citizen.

Moving on from this there is also a video showing the code in action and live on Windows, Mac and iOS.
http://www.youtube.com/watch?v=3BKrAqNsU80&feature=share

This isn’t your typical video, it really is a camera pointed at each LIVE device, rather than screen capture; it also shows PAServer in action running remotely from the IDE machine on the MAC on the same network.


posted @ Mon, 23 Jan 2012 09:51:38 +0000 by Stephen Ball


Desenvolvimento de software, tecnologias e outros assuntos #6

Meu resumo mensal está de volta depois de muito tempo, vamos ver se agora consigo atualizar todo o mês:)

  • Jailbreak para iPhone 4S e iPad 2 finalmente disponibilizado, desta vez os hackers tiveram muito trabalho para quebrar os novos aparelhos da Apple com aparelho A5
  • Se você está interessado em saber como escalar suas aplicações nas nuvens, leia o artigo publicado pela equipe da Netflix onde eles compartilham a experiência deles com a Amazon “Auto Scaling in the Amazon Cloud”
  • Eu sou fan do iPhone, talvez mude para o Nokia Lumia 900 (Windows Phone) no futuro e Android não está nos meus planos. A algumas semanas descobrir este artigo “Why I Hate Android“, é pelo menos interessante.
  • A guerra dos browsers continua, Chrome está ganhando e o IE continua na liderança, vamos ver por quanto tempo
  • Projeto Delphi Open Source do mês - DORM é um framework ORM para Delphi criado pelo Daniele Teti
  • Se você precisa converter seus projetos VCL Delphi e C++Builder para FireMonkey, da uma olhada neste solução conhecida como Mida, um produto comercial para converter projetos VCL em FireMonkey
  • TMS Software acaba de lançar o  TMS Instrumentation Workshop para FireMonkey, um conjunto de componentes para aplicações que necessitam de instrumentação e multimídia, os componentes podem ser utilizados em Windows, Mac e iOS
  • Uma ótima oportunidade para os clientes Embarcadero - BOGO está de volta!!! – Compre uma ferramenta de desenvolvimento e leve a segunda GRÁTIS!
  • Artigo (em inglês) muito bom que mostra como criar FireMonkey shader effects

Posts relacionados

Andreano Lanusse | Tecnologia e Desenvolvimento de Software
Follow me on Twitter: @andreanolanusse


posted @ Mon, 23 Jan 2012 04:00:51 +0000 by Andreano Lanusse


Software Development, technologies and other matters #5

My monthly summary is back after long time, let’s try to keep this up to date every month :)

  • Jailbreak for iPhone 4S and iPad 2 finally available, hackers had a lot of work to break the new Apple A5 devices.
  • If you are interested to know how to use the Cloud to scale your applications, the Netflix team posted a really nice article sharing their experience with Amazon “Auto Scaling in the Amazon Cloud”
  • I’m a iPhone fun, maybe switching for Nokia Lumia 900 (Windows Phone) in the future, and Android is not part of my plan. A few weeks ago I saw this article “Why I Hate Android“, it is at least interesting.
  • The browser war continues, Chrome is winning and IE still the number one, not sure for how long
  • Delphi Open Source Project of the MonthDORM is an ORM framework for Delphi created by Daniele Teti
  • If you need to convert your Delphi and C++Builder VCL projects to FireMonkey, check out this solution called Mida a commercial product that convert VCL projects to FireMonkey
  • TMS Software releases TMS Instrumentation Workshop for FireMonkey, a set of components for instrumentation and multimedia applications for FireMonkey, it support Windows, Mac and iOS
  • Great opportunity for Embarcadero customers - BOGO is back!!! – Buy One Developer Tool, Get a Second Tool FREE!
  • Great post showing how to create FireMonkey shader effects

Related Posts

Andreano Lanusse | Technology and Software Development
Follow me on Twitter: @andreanolanusse


posted @ Mon, 23 Jan 2012 04:00:44 +0000 by Andreano Lanusse


Server Response from: BLOGS1