[Lazarus] bcd to variant

2014-10-22 Thread Chris Rempas
Hi!
    I am trying to have some decimal fields in my database, causing BCD and 
FMTBCD field type to pop up to my program. I am not able to save any data of 
this kind to my database, as i get an error "invalid variant type cast".    I 
tried any workaround i could think of for the last 5 days, making myself crazy!

    I have browsed most of SQLdb units and i came to believe that BCD fields 
are not supported by lazarus! Is this true? Is there a way to work with BCD 
fields in my database? Is there an example i could use as a guide?

Thank you--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] web push?

2014-10-22 Thread Anthony Tekatch
What would be the best (Lazarus/Freepascal) way to push data to a web page?

I would like a cgi-bin application that sends updates to the client
browser telling of things like:
 - display the modification time of a file on the server
 - display statistics of items from the server side without having the
   user refresh the web page on their browser.

I'm not sure if fcl-web can do that.

I think that the terminology is:
  Ajax Push
  Reverse Ajax
  Two-way-web
  HTTP Streaming
  HTTP server push
  WebSockets

Can anyone point me in the right direction?

Thanks,
Anthony
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] fpspreadsheet bug - and fix

2014-10-22 Thread Werner Pamler

>  No idea who is the current maintainer of fpspreadsheet
I'm doing most of the development currently, no idea if I am the 
maintainer then...


Thanks for pointing me to this bug which I've seen for some time, but 
did not take seriously enough. But your solution is not working here, in 
fact I don't understand why it is working at all since the fpsfunc needs 
the TsBuiltInExpressionManager which is declared in fpsexprparser.


Now I removed the dependence on fpsfunc from fpexprparser, and after 
moving the "RegisterStdBuiltins" from fpexprparser to fpsfunc and the 
"ExprFormatSettings" from fpsfunc to fpsexprparser, the packages and 
demo projects compile. But now the built-ins - a central element of the 
parser - are no longer registered in the parser unit itself which does 
not seem right to me ( --> r3678).


I am aware of the fork of the exprparser, and initially I had been 
trying to extend it to fit into the fpspreadsheet infrastructure. But 
soon I realized some limitations of the exprparser: The parser uses 
hard-coded programming-style expressions which are not used in the 
spreadsheet environment. The hard-coded "and", for example" interferes 
with the "AND()" function of the standard spreadsheets. My main 
difficulty was how to put cell references into the existing code. This 
naturally leads to a dependence on fpspreadsheet. And even with the 
present version I am fighting with the rather strict data type checks of 
the parser. Finally I decided to fork the parser to get me a step 
forward. But if you have a better idea I'd be happy to use it.




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


[Lazarus] TFMTBCDField problem

2014-10-22 Thread Chris Rempas
Hi guys!    I am using SQLdb with Firebird 2. I have a DECIMAL(9,5) field that 
SQLdb makes it TFMTBCDField automatically. Mt problem is that i cannot save any 
value to the database. If i let the field with the NULL value, my record is 
saved fine, if i try to put any value and save the record, it fails with 
"Invalid Variant convertion" error.I Edited the record with an external 
tool and it loads up fine in my grid. In my grid i can change the data and 
scroll to another records (cached data is fine) but if i try to execute 
ApplyUpdates, i get the same error.
    Google could not help and i could not find anything in the bugtracker for 
the last 3 days!

Please help!!!
Regards,
Chris
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] fpspreadsheet bug - and fix

2014-10-22 Thread Michael Van Canneyt


Hi,

No idea who is the current maintainer of fpspreadsheet, but to those involved:

I updated - after a long time - my version of fpspreadsheet.

There is a bug (apart from breaking backwards compatibility) which makes it 
difficult to use:

fpexprparser depends on unit fpsfunc.
fpsfunc depends on fpsexprparser.

This circular dependency creates a problem:

When I compile the fpspreadsheet package, it compiles.

When I compile my project that uses fpspreadsheet, the compiler complains it 
cannot compile fpexprparser,
that it must recompile it because fpsfunc changed.

I then removed the dependency of fpsexprparser on unit fpsfunc by simply removing the 
unit from the uses clause.


After that everything compiles without errors: the package and the project,
making me wonder why this circular dependency was introduced to begin with ?

Anyway:

May I please suggest that the fpexprparser unit is changed in this manner 
permanently ?
I prefer to work with third-party sources as-is.


As a side note, I found that fpsexprparser is a fork from the exprparser unit 
in the FCL.
After some studying, it seems to me that with little effort, the FCL version could have 
been changed to suit the needs of the fpspreadsheet project, making a fork superfluous: 
a simple descendent would have been sufficient...


Is there a reason this was not done ? 
After all, improvements to existing components are always welcome...


Michael.

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


Re: [Lazarus] How do I tell codetools to use implicitly loaded unit for code complesion?

2014-10-22 Thread Michael Ring

OK, I found out what is going on.

FindControllerUnit in components/codetools/definetemplates.pas already 
contains a copy of the arm version of cpuinfo.pas but it does not 
include the mips version of cpuinfo.pas.


so FindControllerUnit does not find a match and returns an empty string 
-> the Value of -Wp get discarded.


I have attached a patch that adds the missing definitions for mipsel.

Please note that the definitions differ from the ones in trunk; I have 
asked sergej to merge my latest changes for mipsel but he did not yet 
find the time to do so.


So trunk is outdated and it makes no sense to use the definitions 
currently available there.


Michael

Am 22.10.14 um 09:51 schrieb Michael Ring:
Thank you for the hint on macros, I will see if I can come up with a 
patch.


The lookup of the controllerunitstr looks like the 'right' solution, 
for my purposes it would be enough to simply add the value of -Wp, but 
this would only help for mipsel target, for arm there usually exists a 
mapping from the controller model to a more generalized unit.


How do you import definitions like those, do you duplicate the code 
from fpc or do you use the units provided by fpc?


If you duplicate the code it is perhaps better to also make the unit 
files match the controller names in fpc so that the list of 
controllers does not need to get implemented in both fpc and lazarus.


Michael

Am 21.10.14 um 23:28 schrieb Mattias Gaertner:



Michael Ring  hat am 21. Oktober 2014 um 22:27
geschrieben:
[...]
Example: -Wppic32mx795f512h

should load unit pic32mx795f512h

The IDE already does that.
Search for MacroControllerUnit.

to make life a (very little) harder the fully correct rule for 
selecting

the right unit is:

search for uppercase(-WpVALUE) in array embeddedcontrollers (defined in
[arm,mipsel,avr]/cpuinfo.pas) and load the unit with name defined in 
the

field controllerunitstr

Is something like this doable?

Theoretically yes. Is that needed?



I already hardcoded the unit for my testing purposes (Works fine), but
failed to find a way to get the value of the -Wp switch in
GetHiddenUsedUnits.

Mattias

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



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


Index: components/codetools/definetemplates.pas
===
--- components/codetools/definetemplates.pas(revision 46642)
+++ components/codetools/definetemplates.pas(working copy)
@@ -6618,7 +6618,7 @@
   controllerunitstr: string[20];
 end;
   const
-ControllerTypes: array[0..211] of TControllerType =
+ControllerTypes: array[0..302] of TControllerType =
  ((controllertypestr:'';  controllerunitstr:''),
   (controllertypestr:'LPC810M021FN8'; controllerunitstr:'LPC8xx'),
   (controllertypestr:'LPC811M001FDH16';   controllerunitstr:'LPC8xx'),
@@ -6830,7 +6830,99 @@
   (controllertypestr:'XMC4500X768';   controllerunitstr:'XMC4500'),
   (controllertypestr:'XMC4502X768';   controllerunitstr:'XMC4502'),
   (controllertypestr:'XMC4504X512';   controllerunitstr:'XMC4504'),
-  (controllertypestr:'THUMB2_BARE';   
controllerunitstr:'THUMB2_BARE'));
+  (controllertypestr:'THUMB2_BARE';   controllerunitstr:'THUMB2_BARE'),
+  (controllertypestr:'PIC32MX110F016B';
controllerunitstr:'PIC32MX110F016B'),
+  (controllertypestr:'PIC32MX110F016C';
controllerunitstr:'PIC32MX110F016C'),
+  (controllertypestr:'PIC32MX110F016D';
controllerunitstr:'PIC32MX110F016D'),
+  (controllertypestr:'PIC32MX120F032B';
controllerunitstr:'PIC32MX120F032B'),
+  (controllertypestr:'PIC32MX120F032C';
controllerunitstr:'PIC32MX120F032C'),
+  (controllertypestr:'PIC32MX120F032D';
controllerunitstr:'PIC32MX120F032D'),
+  (controllertypestr:'PIC32MX130F064B';
controllerunitstr:'PIC32MX130F064B'),
+  (controllertypestr:'PIC32MX130F064C';
controllerunitstr:'PIC32MX130F064C'),
+  (controllertypestr:'PIC32MX130F064D';
controllerunitstr:'PIC32MX130F064D'),
+  (controllertypestr:'PIC32MX150F128B';
controllerunitstr:'PIC32MX150F128B'),
+  (controllertypestr:'PIC32MX150F128C';
controllerunitstr:'PIC32MX150F128C'),
+  (controllertypestr:'PIC32MX150F128D';
controllerunitstr:'PIC32MX150F128D'),
+  (controllertypestr:'PIC32MX170F256B';
controllerunitstr:'PIC32MX170F256B'),
+  (controllertypestr:'PIC32MX170F256C';
controllerunitstr:'PIC32MX170F256C'),
+  (controllertypestr:'PIC32MX170F256D';
controllerunitstr:'PIC32MX170F256D'),
+  (controllertypestr:'PIC32MX210F016B';
controllerunitstr:'PIC32MX210F016B'),
+  (controllertypestr:'PIC32MX210F016C'

Re: [Lazarus] TAChart cannot zoom

2014-10-22 Thread Leonardo M. Ramé


El 21/10/14 a las 15:32, Werner Pamler escibió:

You have added a ChartToolset and have assigned it to the chart. This
deactivates the built-in toolset which is responsible for default
zooming and panning. All you have to do is to add another ZoomDragTool
to your toolset. To make it respond to dragging with the left mouse
button set its Shift property to ssLeft, this is the standard behavior
of the built-in zoom tool. If you need panning as well add a
ZoomPanTool; by default, it becomes active with the right mouse button.
But if you already use these Shift values in tools that are currently in
your toolset, select something else, or add a key like ssCtrl, or
ssShift (or both) - there are many possibilities.

There are several tutorial which cover zooming in TAChart:

  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Chart_Tools,
  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Function_Series
  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming



Thanks Werner, I'll take a look at it.

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877


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


Re: [Lazarus] How do I tell codetools to use implicitly loaded unit for code complesion?

2014-10-22 Thread Michael Ring

Thank you for the hint on macros, I will see if I can come up with a patch.

The lookup of the controllerunitstr looks like the 'right' solution, for 
my purposes it would be enough to simply add the value of -Wp, but this 
would only help for mipsel target, for arm there usually exists a 
mapping from the controller model to a more generalized unit.


How do you import definitions like those, do you duplicate the code from 
fpc or do you use the units provided by fpc?


If you duplicate the code it is perhaps better to also make the unit 
files match the controller names in fpc so that the list of controllers 
does not need to get implemented in both fpc and lazarus.


Michael

Am 21.10.14 um 23:28 schrieb Mattias Gaertner:



Michael Ring  hat am 21. Oktober 2014 um 22:27
geschrieben:
[...]
Example: -Wppic32mx795f512h

should load unit pic32mx795f512h

The IDE already does that.
Search for MacroControllerUnit.


to make life a (very little) harder the fully correct rule for selecting
the right unit is:

search for uppercase(-WpVALUE) in array embeddedcontrollers (defined in
[arm,mipsel,avr]/cpuinfo.pas) and load the unit with name defined in the
field controllerunitstr

Is something like this doable?

Theoretically yes. Is that needed?



I already hardcoded the unit for my testing purposes (Works fine), but
failed to find a way to get the value of the -Wp switch in
GetHiddenUsedUnits.

Mattias

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



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


Re: [Lazarus] CodeTools error when using 'section' keyword

2014-10-22 Thread Michael Ring
I did a little digging, Sven is right, this is only for embedded 
targets; I found the following in systems.pas:


   { all embedded systems }
   systems_embedded = [system_i386_embedded,system_m68k_embedded,
system_alpha_embedded,system_powerpc_embedded,
   system_sparc_embedded,system_vm_embedded,
system_iA64_embedded,system_x86_64_embedded,
   system_mips_embedded,system_arm_embedded,
system_powerpc64_embedded,system_avr_embedded,
system_jvm_java32,system_mipseb_embedded,system_mipsel_embedded];

   { all systems that allow section directive }
   systems_allow_section = systems_embedded;

I found the first occurence of this in the sources of fpc 2.4.0

Michael

Am 22.10.14 um 08:09 schrieb Sven Barth:


Am 21.10.2014 23:32 schrieb "Mattias Gaertner" 
mailto:nc-gaert...@netcologne.de>>:

>
>
>
> > Michael Ring > hat am 21. Oktober 2014 um 22:36

> > geschrieben:
> >
> >
> > program hello;
> > const
> >  devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3';
> > begin
> > end.
> >
> > is a program that compiles fine but gives me an error in lazarus 
when I

> > try to use completion with ctrl-SPACE.
> >
> >
> > hello.pas(3,48) Error: = erwartet aber '.devcfg3' gefunden
>
> fpc 2.6.4 gives the same error.
> When is "section" allowed?

It only works on certain targets (currently only Embedded AFAIK). I 
don't know its rules of declarations currently though...


Regards,
Sven



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


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