Re: [Lazarus] Finding out the Hostname of the Computer.

2008-11-28 Thread Graeme Geldenhuys
On Thu, Nov 27, 2008 at 3:28 PM, Dave Coventry [EMAIL PROTECTED] wrote:

 I'm trying to get the name of the computer my app is running on.

 I've tried this:

We use the following in tiOPF for Delphi and FPC.


--

function tiGetComputerName : string;
begin
  {$IFDEF MSWINDOWS}
  Result := tiWin32GetComputerName;
  {$ENDIF MSWINDOWS}
  {$IFDEF UNIX}
  Result := tiUnixGetComputerName;
  {$ENDIF UNIX}
end;


-
uses
  unix;

function tiUnixGetComputerName: string;
begin
  Result := GetHostName;
end;


 uses
Windows;

function tiWin32GetComputerName: string;
var
  computerNameBuffer: array[0..255] of char;
  sizeBuffer: DWord;
begin
  SizeBuffer := 256;
  getComputerName(computerNameBuffer, sizeBuffer);
  result := string(computerNameBuffer);
end;

--

Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding out the Hostname of the Computer.

2008-11-28 Thread Malcolm Poole
Dave Coventry wrote:
 Can anyone see what I'm doing wrong, or offer an alternative way of
 getting the name of the computer?
uses unix;

GetHostName :-)

Malcolm
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] [joke] Explanation about the Lazarus logo

2008-11-28 Thread Damien Gerard

http://cdn.ugoto.com/pictures/the_end_of_the_chase-53b.jpg

Sorry I found it funny :)


--
Damien Gerard
[EMAIL PROTECTED]

La raison de la bouffe est toujours la meilleure.









___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] The db-aware controls allow editing a readonly-dataset

2008-11-28 Thread Michael Van Canneyt


On Thu, 27 Nov 2008, Joost van der Sluis wrote:

 Hi all,
 
 When a dataset is read-only, the db-aware controls allow editing. The
 changes aren't send to the dataset, though. Which is very confusing for
 the user.
 
 I don't know how to fix it. I can change TDatalink.ReadOnly so that is
 checks if the dataset is ReadOnly. But, for exmple, TDBEdit.Readonly
 directly passes the result of TDatalink.Readonly. And I checked with
 Delphi and there TDBEdit.Readonly is false, even if the TDataset is
 readonly.

That is because the readonly is the TCustomEdit.ReadOnly, no ?

You can set a edit read-only, even if the field is read-write, so
this is normal in my eyes.

But if the TDataset is readonly then the edit should of course also
give readonly=True.

 Alternative is to check in TDBEdit.IsReadOnly and relatives...

? Please explain ?

Michael.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding out the Hostname of the Computer.

2008-11-28 Thread Dave Coventry
Thanks guys.

I knew there must be an easier way of doing it!
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] A new competitor to Lazarus and Free Pascal

2008-11-28 Thread Graeme Geldenhuys
2008/11/27 Marc Geldon (SCALA IT) [EMAIL PROTECTED]:

 If RealBasic would have a mySQL and Firebird support, it could be a real
 competitor ... also to Delphi!

 I would switch or also use RealBasic if it would have native support of
 mySQL / Firebird.

Not that I want you to switch from the awesome FPC compiler and the
Object Pascal language, but look at the following links.

MySQL
http://alacatialabs.com/products/realbasic-mysql-plugin/

Firebird (using the standard cheap edition)
http://forums.realsoftware.com/viewtopic.php?f=3t=16418hilit=+firebird+api
Alternatively you can use ODBC (unix and windows) as far as I understand.

PS:
Just because it isn't included as standard doesn't mean anything. Many
Delphi developers use 3rd party (specialised) DB connection components
instead of the stock ones.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How to trim history lists

2008-11-28 Thread Mark Morgan Lloyd
In a similar vein to the question about removing unwanted bookmarks: how 
does one remove redundant entries from the Open Recent Project list?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] A new competitor to Lazarus and Free Pascal

2008-11-28 Thread Leonardo M. Ramé
mmm. Not to me, it doesn't compile Object Pascal.

Leonardo M. Ramé
Griensu S.A. - Medical IT Córdoba
Tel.: 0351 - 4247979




Marc Geldon (SCALA IT) escribió:
 that is a very easy look on this issue!

 If RealBasic would have a mySQL and Firebird support, it could be a 
 real competitor ... also to Delphi!

 I would switch or also use RealBasic if it would have native support 
 of mySQL / Firebird.



 Am 27. November 2008 12:22 schrieb Henrique Faria 
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

 I don't think RealBasic is a competitor to Lazarus for the
 following reasons:

 1) They suffer with the same problem of huge executables, after
 downloading the trial, i build a simple form with a menu and a
 pushbutton and it creates an exe of 3200KB. With Lazarus 0.9.27 i
 create the same form, menu and button (after stripped) 1774KB.

 2) The RB IDE use 200556KB of memory against 21256KB of Lazarus.

 3) It costs $100 to $500.

 4) If you don't need an IDE, but want to use Basic, you can use
 FreeBASIC for windows or linux, that is free.


 Henrique.


 
 Receba GRÁTIS as mensagens do Messenger no seu celular quando você
 estiver offline. Conheça o MSN Mobile! Crie já o seu!
 http://mobile.live.com/signup/signup2.aspx?lc=pt-br

 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org mailto:Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus




 -- 
 SCALA IT | Internet- und Softwareagentur
 Büro Mannheim: L7, 7a | 68161 Mannheim
 Firmensitz: Gutenbergstr. 18 | 67112 Mutterstadt

 Tel: (06234) 600 57-6
 Fax: (06234) 600 57-9

 e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 Mobil: (0176) 206 263 04

 Inhaber: Marc Geldon
 Steuernummer: 41/049/7267/0 (Finanzamt Speyer)
 

 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
   
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Linking to an arbitrary DLL (libusb-win32)

2008-11-28 Thread Mark Morgan Lloyd
Out of curiosity I'm trying to press ahead a bit further with linking a 
Lazarus program that runs successfully with libusb to run instead with 
libusb-win32. I know that there will be runtime problems since I'm 
trying to run on NT4 but I'm interested to see to what extent I can get 
additional error messages etc. out of the system.

When compiled for Linux I've got a simple unit UsbIf that calls Uwe 
Zimmerman's translation of libusb.h which includes

{$linklib usb}
..
procedure usb_set_debug(level: longint);cdecl;external;

On the Windows systems the DLL is libusb0.dll and in principle I've got 
.h files etc. available. When I compile I get

Error: Import library not found for usb
..
Error: Undefined symbol _usb_set_debug

It's 20 years since I've played with import libraries, and before I 
start tinkering I need to know that I'm not heading off in the wrong 
direction.

This is in no way important, but what should I be doing to get this to 
link against the available DLL?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding out the Hostname of the Computer.

2008-11-28 Thread Mark Morgan Lloyd
Andrew Haines wrote:

 Result := GetEnvironmentVariable('HOSTNAME'); This won't work under 
 windows and there is probably a better way to do this with sockets.

GetHostName() or similar. If you use a shell variable it can be spoofed, 
so particularly if running as root go to the lowest-level API available.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] [joke] Explanation about the Lazarus logo

2008-11-28 Thread matt shaffer
Nah, the poor fellow just has to jump from his pole to the other side of the
fence - then he can continue running... and running...

2008/11/27 Damien Gerard [EMAIL PROTECTED]


 http://cdn.ugoto.com/pictures/the_end_of_the_chase-53b.jpg

 Sorry I found it funny :)


 --
 Damien Gerard
 [EMAIL PROTECTED]

 La raison de la bouffe est toujours la meilleure.









 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Ping Graeme

2008-11-28 Thread Leonardo M. Ramé
Graeme, I'm trying to use the NPAPI Mozilla Plugin Framework with
FreePascal and while searching for info about it I stumbled with a
mailing list post that says you investigated about this:

On The Lazarus mailing list Graeme if i remember correctly posted some
links, he apparently already did an interface for it and it's working
well, please ask there :)

To refresh your mind, the project I'm talking about is part of this:
http://www.paranoia.clara.net/mozilla_delphi_project.html and
specifically this: https://www.mozdev.org/bugs/show_bug.cgi?id=8708

My question is, have you created a mozilla plugin compilable with
FreePascal?

-- 
Leonardo M. Ramé
Griensu S.A. - Medical IT Córdoba
Tel.: 0351 - 4247979



___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] The db-aware controls allow editing a readonly-dataset

2008-11-28 Thread Joost van der Sluis
Op donderdag 27-11-2008 om 22:37 uur [tijdzone +0100], schreef Michael
Van Canneyt:
 
 On Thu, 27 Nov 2008, Joost van der Sluis wrote:
 
  Hi all,
  
  When a dataset is read-only, the db-aware controls allow editing. The
  changes aren't send to the dataset, though. Which is very confusing for
  the user.
  
  I don't know how to fix it. I can change TDatalink.ReadOnly so that is
  checks if the dataset is ReadOnly. But, for exmple, TDBEdit.Readonly
  directly passes the result of TDatalink.Readonly. And I checked with
  Delphi and there TDBEdit.Readonly is false, even if the TDataset is
  readonly.
 
 That is because the readonly is the TCustomEdit.ReadOnly, no ?
 
 You can set a edit read-only, even if the field is read-write, so
 this is normal in my eyes.

But also the other way: set a field or an TCustomEdit to read/write, if
the dataset is read-only? (atm , this is possible, and I did check with
Delphi, there you can do this also)

 But if the TDataset is readonly then the edit should of course also
 give readonly=True.

Well, it doesn't. The same holds for Delphi. But in Delphi
TEdit.Readonly is false, but you can't change it's data.

  Alternative is to check in TDBEdit.IsReadOnly and relatives...
 
 ? Please explain ?

That's a private function which is used internally. We could check here
if the TDataset is readonly...

Just look up the code, it's pretty straight-forward.

Joost.

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] [joke] Explanation about the Lazarus logo

2008-11-28 Thread Florian Klaempfl
Damien Gerard schrieb:

I can explain you at least part of the lazarus logo: I like cats and
especially cheetahs (though they aren't common in Germany ;)) so I have
choosen the cheetah as FPC logo.

 http://cdn.ugoto.com/pictures/the_end_of_the_chase-53b.jpg

Funny picture :)

 
 Sorry I found it funny :)
 
 
 --
 Damien Gerard
 [EMAIL PROTECTED]
 
 La raison de la bouffe est toujours la meilleure.
 
 
 
 
 
 
 
 
 
 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
 

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where does Lazarus store/look for global settings/options?

2008-11-28 Thread Mattias Gaertner
On Thu, 27 Nov 2008 08:45:21 +0100
Luca Olivetti [EMAIL PROTECTED] wrote:

 En/na Mattias Gärtner ha escrit:
  Zitat von Luca Olivetti [EMAIL PROTECTED]:
  
  En/na Mattias Gaertner ha escrit:
 
  IMO it should go to development documentation, because these
  files are almost only edited by the IDE itself. I never edited
  them myself manually.
  I would even say: If you need to edit/inspect them, then you
  found a bug.
  Then I found a bug ;-)
  I reported here before that, when switching lazarus version I
  ended up mixing bundled components from the old version to the new
  one, so I had to manually edit those files to fix the paths.
  
  What components, what paths?
 
 http://news.gmane.org/find-root.php?message_id=%3c48F836DE.2080402%40wetron.es%3e

Well, yes and no.
It is not a bug, because to use two different settings the --pcp option
exists (See my answer to the above mail).
And yes, lazbuild does not have an option to override the lazarus
source directory.
The same is true for many other options.

Sharing a lazarus config directory by two different lazarus versions
can give trouble. Better use two different lazarus config directories.
I'm not sure what settings you want to share.


Mattias

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Finding out the Hostname of the Computer.

2008-11-28 Thread Malcolm Poole
Aleš Katona wrote:
 If you want the value of $HOSTNAME, use unit SysUtils and 
 GetEnvironmentVariable('HOSTNAME');
   
Hmm. This was the first thing that I tried. For some reason I get an 
empty string on my system (Ubuntu Gutsy). That's why I dug around and 
found the GetHostName function.

Any idea why GetEnvironmentVariable('HOSTNAME') doesn't work for me? 
'echo $HOSTNAME' on the commandline works as expected.

Malcolm
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Linking to an arbitrary DLL (libusb-win32)

2008-11-28 Thread Sergei Gorelkin
Mark Morgan Lloyd wrote:

 ...
 When compiled for Linux I've got a simple unit UsbIf that calls Uwe 
 Zimmerman's translation of libusb.h which includes
 
 {$linklib usb}
 ..
 procedure usb_set_debug(level: longint);cdecl;external;
 
 On the Windows systems the DLL is libusb0.dll and in principle I've got 
 .h files etc. available. When I compile I get
 
 Error: Import library not found for usb
 ..
 Error: Undefined symbol _usb_set_debug
 
 It's 20 years since I've played with import libraries, and before I 
 start tinkering I need to know that I'm not heading off in the wrong 
 direction.

Having faced with the same problem in the meantime, I deleted the 
{$linklib } directive and added library and name to all function 
definitions, so your example would look like

procedure usb_set_debug(level: longint);cdecl;external libname name 
'usb_set_debug';

The libname constant has to be defined differently for Windows and Linux:

const
{$IFDEF MSWINDOWS}
   libname = 'libusb0.dll';
{$ELSE}
   libname = 'libusb.so';
{$ENDIF}

Another caveat with libusb-win32 is that LIBUSB_PATH_MAX constant should 
be different from the Linux one:

{$IFDEF MSWINDOWS}
const LIBUSB_PATH_MAX = 512;
{$ENDIF}
{$IFDEF LINUX}
const LIBUSB_PATH_MAX = 4097;
{$ENDIF}

Regards,
Sergei

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus