-
Content Count
1977 -
Joined
-
Last visited
-
Days Won
26
Everything posted by Attila Kovacs
-
It's slightly offtopic but I can't just pass over it. Sql Server (from 2008 I think) offers indexes with a "WHERE" clause, for example if you want to rule out duplicate values but permit duplicate NULL's you can write: CREATE UNIQUE NONCLUSTERED INDEX [YourIndexName] ON [YourTableName] (YourFieldName) WHERE [YourFieldName] IS NOT NULL This is sensational. I should read more whatsnew.txt's.
-
Actually you don't need it if you put the data into a separate table, but I was a lazy dog and googled it up. Never ever used before. Not sure even if I can keep it this way until I finished implementing.
-
You know what? Now I know what will I do if I have some days off. I'll try to port my app to FB as it supports cte too. \o/
-
@Dany Marmur Actually they are right and this also makes sense! I'm happy you come up with FB, good to know even if I'm not using it. Maybe someone reads that.
-
Can Delphi randomize string 'Delphi'?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
That was a waste of time and energy.. You should read more RTL code and the answers to your questions!! -
Can Delphi randomize string 'Delphi'?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
You could run this to check if Delphi's random() is able to generate the consecutive numbers of 29 4 11 15 7 8 which are the characters of 'Delphi' taken from the desired (zero based) set 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. It iterates 4.29 billion possibilities in only 20 seconds on my notebook. vRndString := ''; z := Low(integer); RandSeed := z; vSW := TStopWatch.StartNew; while z < MaxInt do begin if Random(52) = 29 then if Random(52) = 4 then if Random(52) = 11 then if Random(52) = 15 then if Random(52) = 7 then if Random(52) = 8 then begin vRndString := 'Delphi'; WriteLn(Format('%s found in %d ms with seed of %d', [vRndString, vSW.ElapsedMilliseconds, RandSeed])); Break; end; Inc(z); RandSeed := z; end; if vRndString = '' then WriteLn(Format('not found in %d ms', [vSW.ElapsedMilliseconds])); ReadLn; And as an example you could use 'VWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU' with a seed of -1929919901 to get 'Delphi'. for vPhrase in cPhrases do begin RandSeed := -1929919901; ... -
Can Delphi randomize string 'Delphi'?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
But they don't use random in bruteforcing as it has no benefits. -
Try - except - finally generates no debug-breakpoint in Exception scope
Attila Kovacs replied to Rollo62's topic in RTL and Delphi Object Pascal
I'm wondering if it has something to do with the try/except/finally tweak introduced in the new compiler and the debugger is lacking behind? -
Can Delphi randomize string 'Delphi'?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
Why would you assume that? Because it's written in Delphi or because you don't know the basics of randomness? -
does it runs on IB? maybe this would give you some hints SELECT RNO, COUNT(*) FROM CUSTACC GROUP BY RNO HAVING COUNT(*) > 1
-
This is called the generic navigation. 😛
-
I'm afraid you are the only one who can do that as we don't know what do you want to do there.
-
Your subselect (SELECT C.RNO FROM CUSTACC C WHERE C.CUSTNO=P.CUSTNO) returning more than 1 rows and the server doesn't know what do you want to do. Either change the subselect to return only 1 row or use an aggregate function in the subselect like SUM() to make one result from the returned rowset.
-
@balabuev There was a setting for the delay AFAIR, isn't it?
-
Do we have a working lib/class which implements TNothingable<T> in Delphi? Where "null" is a valid value. For simple types I could achieve that relative easily, for structured types it's funnier to implement.
-
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
@Rollo62 Sometimes I have no Idea what am I talking about. Saint Augustine, on being asked what is time: "I know what it is, but when you ask me I don’t." -
IDLIST is an array of integer, why do you want to convert it to a string?
-
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Ooookay, this conversation brought me to a moment of enlightenment. We were both right, but they are two different things (null/[]) so I will threat them differently, with the same JSONName attribute. This solves everything for now. I can keep my object mapping, which was the most important thing for me. Thx guys! -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Yes, i did the same, returning TNothing = interface end; in the TValue. I just lost my temper on the structured types and I thought I'm asking if somebody has something similar (and maybe much simpler/better) done. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
If you are telling me that you can't check a json array in php if it's holding a value of null, just if it's empty, then I'm fine, the above example is wrong. I'm not sure. Bollock what I wrote. It's just a key/value pair. There is no such thing that an array can't be null. This is the problem. Edit: My example above is indeed wrong on arrays. It should have been t.y.SetNull or similar. [] should translate to [], you are right. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
@Stefan Glienke Please tell this the people who are writing the php API's. I did the same with objects and passed "{}" and the server created the object with default values. @Fritzew A simple webshop php API, but any json API's out there where the values are interpreted individually. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
as an example: T=type y: TNothingable<TArray<string>>; z: TNothingable<TSomeObject>; end; T.tojson => {} T.y := []; T.y.SetNull; T.tojson => { "y" : null } T.z := nil; T.tojson => { "y": null, "z": null } There are API's where I have to pass null values if I want to clear its content and I also want to keep everything mapped. I'm not willing to map those fields with string literals and build up a json-object. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Actually Nullable<Nullable<T>> with a distinction by level between the nulls -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
No, one step above. Nothing / (values incl. null) -
How do you identify bottleneck in Delphi code?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
I think you are doing it very well...