Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/04/20 in Posts

  1. Dave Nottage

    How to disable automatic adding of units to interface-uses

    Change the ClassGroup property on the service (data) module to System.Classes.TPersistent before adding any components
  2. David Heffernan

    What are your compiler settings for debug builds?

    No you wouldn't. Giving the user the wrong results is always worse than showing an error, even if the error is poorly worded.
  3. Anders Melander

    What are your compiler settings for debug builds?

    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.
  4. Anders Melander

    What are your compiler settings for debug builds?

    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 .-)
  5. If you expect your customers to double check your results, why should they use your software in the first place?
  6. 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?
  7. Dave Nottage

    Android hdd serial number

    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;
  8. Attila Kovacs

    What are your compiler settings for debug builds?

    This makes Greta even more sad.
  9. David Schwartz

    swagger help needed

    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.
  10. 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
  11. limelect

    Detect user location from ip address

    Use that https://github.com/antoniojmsjr/IPGeoLocation
  12. David Schwartz

    Detect user location from ip address

    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.
  13. Mike Torrettinni

    What are your compiler settings for debug builds?

    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!
  14. Mark Williams

    Detect user location from ip address

    Must be a European thing. As of last Friday it is now unlawful for me to get such jokes!
  15. Anders Melander

    What are your compiler settings for debug builds?

    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.
  16. 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)
  17. Der schöne Günther

    Detect user location from ip address

    See also: https://www.xkcd.com/713/
  18. Hans♫

    Just wanted to brag a bit :-)

    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.
  19. 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.
  20. 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.
  21. David Heffernan

    What are your compiler settings for debug builds?

    Unless performance is impacted
  22. David Heffernan

    What are your compiler settings for debug builds?

    Irrespective of what any poll says, opt off, range & overflow checks on is the correct thing to do
  23. SELECT * FROM CARDS_TABLE WHERE TAGS containing :taguid ORDER BY LOWER(NAME) ASC;
  24. Mike Torrettinni

    What are your compiler settings for debug builds?

    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.
×