Leaderboard
Popular Content
Showing content with the highest reputation on 02/04/20 in Posts
-
How to disable automatic adding of units to interface-uses
Dave Nottage replied to microtronx's topic in FMX
Change the ClassGroup property on the service (data) module to System.Classes.TPersistent before adding any components -
What are your compiler settings for debug builds?
David Heffernan replied to dummzeuch's topic in Delphi IDE and APIs
No you wouldn't. Giving the user the wrong results is always worse than showing an error, even if the error is poorly worded. -
What are your compiler settings for debug builds?
Anders Melander replied to dummzeuch's topic in Delphi IDE and APIs
Killing all exceptions with empty try...except and disabling range and overflow checking amounts to the same thing. Not showing exceptions is a different topic. I don't believe the users should see the raw exception messages if it can be avoided, but when something goes wrong, that the application cannot reliably recover from by itself, then they need to know there is a problem and what to do about it. -
What are your compiler settings for debug builds?
Anders Melander replied to dummzeuch's topic in Delphi IDE and APIs
Probability: There's an infinite number of locations far away vs. a relative smaller number close by. Therefore any object is almost guaranteed to be far away. How's my logic .-) -
What are your compiler settings for debug builds?
Sherlock replied to dummzeuch's topic in Delphi IDE and APIs
If you expect your customers to double check your results, why should they use your software in the first place? -
Our iOS app, EarMaster, made with Delphi is now featured in App Store, in the "Best of the month - New apps we love". Nice to see that a Delphi app can get this kind of approval from Apple. PS. I am in Denmark, so I see the Danish app store, but I am curious to know, in what other countries it has been featured too?
-
I'm assuming he means any file-based media that it can access. This may be of use to you: uses Androidapi.JNI.JavaTypes, Androidapi.JNIBridge, Androidapi.JNI.Os, Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers; type JStorageManager = interface; JStorageVolume = interface; JStorageManagerClass = interface(JObjectClass) ['{0F83E5E0-9AE5-41F8-9FA1-E91CABBC6720}'] function _GetACTION_MANAGE_STORAGE: JString; cdecl; function _GetEXTRA_REQUESTED_BYTES: JString; cdecl; function _GetEXTRA_UUID: JString; cdecl; function _GetUUID_DEFAULT: JUUID; cdecl; property ACTION_MANAGE_STORAGE: JString read _GetACTION_MANAGE_STORAGE; property EXTRA_REQUESTED_BYTES: JString read _GetEXTRA_REQUESTED_BYTES; property EXTRA_UUID: JString read _GetEXTRA_UUID; property UUID_DEFAULT: JUUID read _GetUUID_DEFAULT; end; [JavaSignature('android/os/storage/StorageManager')] JStorageManager = interface(JObject) ['{A7190FB5-1DBE-4A4E-8A21-A6215C00243C}'] function getAllocatableBytes(storageUuid: JUUID): Int64; cdecl; function getCacheQuotaBytes(storageUuid: JUUID): Int64; cdecl; function getCacheSizeBytes(storageUuid: JUUID): Int64; cdecl; function getMountedObbPath(rawPath: JString): JString; cdecl; function getPrimaryStorageVolume: JStorageVolume; cdecl; function getStorageVolume(&file: JFile): JStorageVolume; cdecl; function getStorageVolumes: JList; cdecl; function getUuidForPath(path: JFile): JUUID; cdecl; function isAllocationSupported(fd: JFileDescriptor): boolean; cdecl; function isCacheBehaviorGroup(path: JFile): boolean; cdecl; function isCacheBehaviorTombstone(path: JFile): boolean; cdecl; function isEncrypted(&file: JFile): boolean; cdecl; function isObbMounted(rawPath: JString): boolean; cdecl; function mountObb(rawPath: JString; key: JString; listener: JOnObbStateChangeListener): boolean; cdecl; // function openProxyFileDescriptor(mode : Integer; callback : JProxyFileDescriptorCallback; handler : JHandler) : JParcelFileDescriptor; cdecl; function unmountObb(rawPath: JString; force: boolean; listener: JOnObbStateChangeListener): boolean; cdecl; procedure allocateBytes(fd: JFileDescriptor; bytes: Int64); cdecl; overload; procedure allocateBytes(storageUuid: JUUID; bytes: Int64); cdecl; overload; procedure setCacheBehaviorGroup(path: JFile; group: boolean); cdecl; procedure setCacheBehaviorTombstone(path: JFile; tombstone: boolean); cdecl; end; TJStorageManager = class(TJavaGenericImport<JStorageManagerClass, JStorageManager>) end; JStorageVolumeClass = interface(JObjectClass) ['{C11D1D2A-77D0-4D1A-B4B9-5042B60BADB0}'] function _GetCREATOR: JParcelable_Creator; cdecl; function _GetEXTRA_STORAGE_VOLUME: JString; cdecl; property CREATOR: JParcelable_Creator read _GetCREATOR; property EXTRA_STORAGE_VOLUME: JString read _GetEXTRA_STORAGE_VOLUME; end; [JavaSignature('android/os/storage/StorageVolume')] JStorageVolume = interface(JObject) ['{F6555252-D4E1-405B-BAAB-2C8F59A01F41}'] function createAccessIntent(directoryName: JString): JIntent; cdecl; function describeContents: Integer; cdecl; function equals(obj: JObject): boolean; cdecl; function getDescription(context: JContext): JString; cdecl; function getState: JString; cdecl; function getUuid: JString; cdecl; function hashCode: Integer; cdecl; function isEmulated: boolean; cdecl; function isPrimary: boolean; cdecl; function isRemovable: boolean; cdecl; function toString: JString; cdecl; procedure writeToParcel(parcel: JParcel; flags: Integer); cdecl; end; TJStorageVolume = class(TJavaGenericImport<JStorageVolumeClass, JStorageVolume>) end; procedure TForm1.Button1Click(Sender: TObject); var LService: JObject; LStorageManager: JStorageManager; LVolumes: JList; LVolume: JStorageVolume; I: Integer; begin LService := TAndroidHelper.Activity.getSystemService(TJContext.JavaClass.STORAGE_SERVICE); LStorageManager := TJStorageManager.Wrap(TAndroidHelper.JObjectToID(LService)); LVolumes := LStorageManager.getStorageVolumes; for I := 0 to LVolumes.size - 1 do begin LVolume := TJStorageVolume.Wrap(LVolumes.get(I)); Memo1.Lines.Add(Format('%s (%s)', [JStringToString(LVolume.getDescription(TAndroidHelper.Context)), JStringToString(LVolume.getUuid)])); end; end;
-
What are your compiler settings for debug builds?
Attila Kovacs replied to dummzeuch's topic in Delphi IDE and APIs
This makes Greta even more sad. -
I'm trying to build a small test bed in Delphi for accessing an internal company API and there's a swagger link published for it. What I want to do is suck in the Swagger definition and use it to build something that lets me query the API in Delphi. I'm not sure what all that requires. I guess most of the time people use some kind of javascript framework for this; I want to use Delphi. I searched around on Google and found this project: https://github.com/marcelojaloto/SwagDoc There's a demo in it named 'GenerateUnitFileForMVCFramework' that lets me put in the Swagger URL and it generates a Delphi unit. It works fine, but there may be a bug in this code in that it duplicates every class and interface definition. I was able to fix that without much trouble in the code generator, but there may be a problem in the part that's parsing the Swagger. (Right now I don't care.) I guess the MVC Framework comes from here: https://github.com/danieleteti/delphimvcframework I'm not exactly sure what to do from here. I need a way to connect to the service with OAuth2, and then make some queries and display the results in a form, like in a TListview. I'm looking for suggestions on how to proceed. Thanks! FWIW, someone here wrote a similar thing that generates C# code from a Swagger URL, and that code looks very similar to the Delphi code that's generated by this SwagDoc tool.
-
By default the IDE enables optimization and disables Range checking and Overflow checking. I've always found that odd, because I want the best possible compiler support for debugging which means: Optimization off Range checking on Overflow checking on
-
Detect user location from ip address
limelect replied to Mark Williams's topic in Network, Cloud and Web
Use that https://github.com/antoniojmsjr/IPGeoLocation -
Detect user location from ip address
David Schwartz replied to Mark Williams's topic in Network, Cloud and Web
Both my T-Mobile and AT&T LTE data accounts terminate at servers in the Los Angeles area. I'm in Phoenix, but could be anywhere in a very large radius (hundreds of miles). When I watch TV or surf the net using these connections, I get stuff for the LA area b/c they think that's where I am. No, that's just where the IPs terminate. It's effectively working somewhat like a VPN. If you're using WiFi and moving around, then you can use the location of nearby WiFi routers to provide fairly accurate location info as long as they're connected to an ISP that uses static IPs. But with DHCP, location data could be off by a mile or two. Or it'll be the location of the hub where they're line is connected. -
What are your compiler settings for debug builds?
Mike Torrettinni replied to dummzeuch's topic in Delphi IDE and APIs
By now you should know I'm in some sort of denial (especially when it comes how much dev books I should read) 😉 I didn't want to hijack this thread, but as always I will get something out these debates, even though I got a little triggered by some comments. I'm just releasing new software and I will rethink the whole Range on/off in release version. Thanks! -
Detect user location from ip address
Mark Williams replied to Mark Williams's topic in Network, Cloud and Web
Must be a European thing. As of last Friday it is now unlawful for me to get such jokes! -
What are your compiler settings for debug builds?
Anders Melander replied to dummzeuch's topic in Delphi IDE and APIs
I'm currently working on a project where they (my client) have done everything they can to kill or hide exceptions. It's a nightmare. All I have to work on is vague reports from the users that "something" doesn't work, sometimes - and of course Range and Overflow Checks are disabled too, because they cause exceptions... I've tried removing all the empty try...except blocks but then the application can't even start because there are so many bugs in it. Luckily I only have 4 months left on that contract The sad thing is that I've seen this thing so many times. Some idiot developer can't figure out how to fix a bug to they hide it with a try...except and then it becomes a habit. -
Thanks Dave, it solved the problem! I added the fake includer function to the FB SDK headers as you suggested: procedure CLangRTLoader; cdecl; external '/usr/lib/clang/lib/darwin/libclang_rt.ios.a'; Now it links with the FBSDK 4.36 without problems, and after a few hours of work to adapt my code to the new API version, everything works! (I didn't try newer versions for now, as they might require further updating of my code and headers)
-
Detect user location from ip address
Der schöne Günther replied to Mark Williams's topic in Network, Cloud and Web
See also: https://www.xkcd.com/713/ -
It's all native. We use the TMS iCL components for the GUI, only the screen instruments are custom FMX components, wrapped by a FMX wrapper.
-
Firemonkey app for Android - segmantation fault in TIdThreadSafe.Lock
Dave Nottage replied to Vandrovnik's topic in Indy
You would if you included the Indy source path. If the callstack says it's being used, you're using it. Does your app use any tethering functionality? That ultimately includes Indy units. -
FireDAC / SQL Server "Connection is busy with results for another hstmt"
NamoRamana replied to Nathan Wild's topic in Databases
Was connecting to SQL server 14, creating FDConnection at run-time in a thread. Thread was running 3 queries on the same FDConnection. The program was fine in dev, but was getting this error in Prod. Following steps fixed it: - Prod machine had only default sql server driver (10.xx, I guess) that came with a new PC. Downloaded the ODBC 17 driver (and redistribution files, if needed) mentioned elsewhere. - Added following code: cnMain.DriverName := 'MSSQL'; cnMain.Params.Add('Server=' + server); cnMain.Params.Add('Database=' + db); cnMain.Params.Add('User_name=' + username); cnMain.Params.Add('Password=' + pwd); cnMain.Params.Add('MARS=Yes'); cnMain.Params.Add('OSAuthent=No'); - Even with the new driver(ODBC 17), if I remove MARS, I get the error. The FireDAC documentation says, MARS=Yes by default, but somehow it didn't work in my case. Hope someone find it useful. Thanks. -
What are your compiler settings for debug builds?
David Heffernan replied to dummzeuch's topic in Delphi IDE and APIs
Unless performance is impacted -
What are your compiler settings for debug builds?
David Heffernan replied to dummzeuch's topic in Delphi IDE and APIs
Irrespective of what any poll says, opt off, range & overflow checks on is the correct thing to do -
Firebird SQL return rows only if a sub-string exists within a specific column
Markus Kinzler replied to Yaron's topic in Databases
SELECT * FROM CARDS_TABLE WHERE TAGS containing :taguid ORDER BY LOWER(NAME) ASC; -
What are your compiler settings for debug builds?
Mike Torrettinni replied to dummzeuch's topic in Delphi IDE and APIs
I also set Optimization Off, Range and Overflow On, in debug. But for release, of course Range is off. But I see some of you set it On also in release mode. I only sometimes set them on for Beta versions, never in final release. I would rather have wrong results reported by users (and then I see that Range On would catch a bug and I fix it) vs to trigger exception to the customer. Perhaps this differs if you project is used in house vs out of country customers.