Перейти к содержанию
Fire Monkey от А до Я

Лидеры

  1. Евгений Корепов

    Евгений Корепов

    Пользователи


    • Баллы

      8

    • Постов

      738


  2. rareMax

    rareMax

    Пользователи


    • Баллы

      4

    • Постов

      553


  3. Andrey Efimov

    Andrey Efimov

    Модераторы


    • Баллы

      2

    • Постов

      842


  4. krapotkin

    krapotkin

    Пользователи


    • Баллы

      2

    • Постов

      2 185


Популярный контент

Показан контент с высокой репутацией 15.06.2016 во всех областях

  1. Я использую дополнительный модуль с отдельным потоком отправляющий все что надо на мой сервер. На сервере кусок кода на php все это пишет в лог. В основном коде использую глобальную переменную FAppStage : procedure TFormMain.ServiceConnectionOnChange(Sender: TObject; AChange: TPushService.TChanges); begin FAppStage:='ServiceConnectionOnChange start'; if AChange=[TPushService.TChange.DeviceToken] Then GetHTTP(CommandActions, -1, ''); FAppStage:='ServiceConnectionOnChange stop'; end; В проекте лежит TfgApplicationEvents, в нужных событиях, к примеру fgApplicationEventsException, идет отправка FAppStage и E: Exception. В логе я вижу где и какое исключение произошло. Достаточно удобно мне кажется.
    3 балла
  2. Если у кого перестали приходить пуши http://stackoverflow.com/questions/37789264/android-api-key-for-gcm-is-suddenly-invalid-unauthorized-401-error/37801206#37801206
    2 балла
  3. Если не получается сразу определить источник ошибок, я публикую для бетатестеров новую версию приложения, где FAppStage прописана более подробно - начало конец вызова каждой подозрительной функции или кода.
    2 балла
  4. Почитал, посмотрел все варианты и сделал работу над ошибками. Переделал свой, показанный выше, код. Проверил на Windows и Android, с стилем по умолчанию и другими стилями - работает безупречно. Так же не нуждается в подгонках типа "Height:= Round(t) + 30;". Преимущество кода в том что на вход подаем ATextObject : TListItemText, т.е. можно легко использовать для вычисления Text или Detail. function TFormMain.CalculateListItemObjectHeight(ATextObject : TListItemText) : Single; begin FTextLayout.BeginUpdate; try FTextLayout.Text:=ATextObject.Text; FTextLayout.MaxSize:=TPointF.Create(ATextObject.Width, TTextLayout.MaxLayoutSize.Y); FTextLayout.Font.Assign(ATextObject.Font); FTextLayout.WordWrap:=ATextObject.WordWrap; FTextLayout.Trimming:=ATextObject.Trimming; FTextLayout.HorizontalAlign:=ATextObject.TextAlign; FTextLayout.VerticalAlign:=ATextObject.TextVertAlign; finally FTextLayout.EndUpdate; end; Result:=FTextLayout.Height; end; Пример использования: у меня Text непредсказуемой длины, вверху ListItem, по всей ширине ListItem. Под Text располагаются слева Image, справа Detail. Текст Detail может быть от пары слов, до нескольких предложений procedure TFormMain.ListViewActionsUpdateObjects(const Sender: TObject; const AItem: TListViewItem); Var AItemTextHeight, AItemDetailHeight, AItemImageHeight, AItemHeight : Single; AListView: TListView; begin AListView:=TListView(Sender); AItem.Objects.TextObject.Width:=AListView.Width - AListView.ItemSpaces.Left - // Вычисляем ширину Text AListView.ItemSpaces.Right - DefaultScrollBarWidth; AItemTextHeight:=CalculateListItemObjectHeight(AItem.Objects.TextObject); // Вычисляем высоту Text AItem.Objects.DetailObject.PlaceOffset.Y:=AItemTextHeight; // Устанавливаем смещение для Detail AItem.Objects.ImageObject.PlaceOffset.Y:=AItemTextHeight; // Устанавливаем смещение для Image AItemDetailHeight:=CalculateListItemObjectHeight(AItem.Objects.DetailObject); // Вычисляем высоту Text AItemImageHeight:=AItem.Objects.ImageObject.Height; AItem.Objects.DetailObject.Height:=AItemImageHeight; AItemHeight:=AItemTextHeight + Max(AItemDetailHeight, AItemImageHeight); // Вычисляем высоту всего Item AItem.Height:=Round(AItemHeight); end;
    2 балла
  5. Andrey Efimov

    WiFi Info

    Название: WiFi Info Платформа: Android 4.1.2 или более поздняя Тип устройства: смартфон, планшет Актуальная версия: 1.1.0 Ссылка: Google Play Описание: Приложение позволяет просматривать полную информацию об активном подключении, сканировать Wi-Fi точки и просматривать информацию о них, а также просматривать информацию о конфигурациях для сохранённых точек доступа. Есть возможность настроить автоматическое обновление информации. Поддержка Android 4.1.2 и выше. Приложение протестировано на устройствах: LG-P705 - Android 4.1.2 Huawei Y541-U02 - Android 4.4.2 Xiaomi Redmi Note 3 - Android 5.0.2 LRX22G (MIUI by xiaomi.eu stable 7.3.1) Samsung SM-T585 Galaxy Tab A 10.1 - Android 7.0
    1 балл
  6. rareMax

    Delphi LeakCheck

    Автор:Honza Rames Репозиторий: https://bitbucket.org/shadow_cs/delphi-leakcheck Platform: Win32, Win64, Android Далее оригинальный Ридми.мд: This is a repository for the Delphi LeakCheck library. Basic description LeakCheck is a memory manager extension that adds leak checking functionality. Main difference from the default memory manager is multi-platform implementation of leak checking with DUnit and DUnitX integration. Main features Multi-platform leak checking Testing framework integration (DUnit and DUnit), compares true allocations not just allocation size Allocation stack tracing (with symbols) Allocation snapshots (not thread safe) Independent object structure scanning (with object cycle detection, complete allocation visualization and graph generation - with aid of Graphviz) Complex leak ignoring options (including object graph ignore from entry point) Minimal external dependencies (even for stack tracing - for basic implementations) Interception of virtual (and interface) calls on freed objects Setup Add LeakCheck as the first unit in the project Optionally add LeakCheck.Utils unit to your project if you want to enable class detection on Posix (or if you want to use any of its utility functions, on mobile you need to add External\Backtrace\Source to your search path) Enable ReportMemoryLeaksOnShutdown Run the app Testing: Follow the steps above DUnit : Add External\DUnit to your search path so our modifications of the TestFrameworkunit can be found (and the memory manager can plug into DUnit) Add LeakCheck.DUnit to your project (this is where the the memory manager plugs into DUnit) - there will be compile errors if you do the step above incorrectly. Enable leak reporting in your DUnit runner Run the tests (I recommend using TestInsighthttps://bitbucket.org/sglienke/testinsight/ to run the tests, but note that you have to enable leak reporting manually in the TestInsight.DUnit.RunRegisteredTests set result.FailsIfMemoryLeaked to True.) DUnitX: Add DUnitX.MemoryLeakMonitor.LeakCheck to your project (it will register the default memory monitor) Run the tests I recommend checking the latest DUnitX sources with extended reporting options (commit DUnitX/918608a) but other versions should be supported. Tested on Win32 Win64 Android Detailed description Main goal of this library is providing pure pascal implementation of leak checking so it can be used across platforms, it also provides simple cross platform implementation of some basic functionality for synchronization and ansi char handling that is used internally. It can be used as a replacement of FastMM full debug mode but keep in mind that it is implemented to be safe and platform independent not as fast as possible so its use is recommended for testing only. It can create memory snapshots So you can detect leaks between snapshot and last allocation. This is what DUnit integration does. In test results, you'll be able to see detailed leak information including class names, reference count, string and memory dumps. It is configurable You can specify (using TTypeKind) what type of leak to report but only few kinds are supported: tkLString, tkUString - ignore appropriate string type leaks tkClass - ignore object leaks (see bellow) tkUnknown - ignore other types of leaks In addition to ignoring all classes, each class type can be inspected and ignored separately by assigning InstanceIgnoredProc (this can be useful to ignore globally allocated objects from RTL or other sources, like System.Rtti collections of objects and alike). This can also be used to ignore unreleased closures (anonymous method pointers). (See LeakCheck.Utils for more details). It plugs into default ReportMemoryLeaksOnShutdown You can use ReportMemoryLeaksOnShutdown on any platforms. The output varies across platforms: On Windows message box containing the leaks is shown, this behavior can be changed by defining NO_MESSAGEBOX conditional in which case the output will be sent into the IDE Event log (by OutputDebugString) On Android the output is sent to logcat on WARN level using leak tag. You can use adb logcat -s leak:* to see it in console (adb can be found under platform-toolsdirectory of your Android SDK installation). It is highly recommended to ignore tkUnknownleaks on Android (ARC) since the RTL will allocate data for weak references that are mistreated for leaks, System will release them during finalization. It can detect reference cycles LeakCheck.DUnitCycle and DUnitX.MemoryLeakMonitor.LeakCheckCycle units implement cycle detection scanner that if given a reference will scan its reference graph to find any instances creating a reference cycle thus preventing the instance from freeing. This works only for managed fields ie. interfaces (and objects on NextGen) or if used together with UseExtendedRtti (enabled manually) any field with RTTI is supported. It can scan inside other objects, records, TValues, anonymous method closures, static and dynamic arrays (which mean it supports any of the System.Generics.Collections types). You need to manually register TLeakCheckCycleMonitor (or any descendants with more scanning options) as TestFramework.MemLeakMonitorClass to integrate it into your DUnit tests. You need to manually register TDUnitXLeakCheckCycleMemoryLeakMonitor (or any descendants with more scanning options) into the DUnitX's IoC container to integrate it into your DUnitX tests. TDUnitXIoC.DefaultContainer.RegisterType<IMemoryLeakMonitor>( function : IMemoryLeakMonitor begin result := TDUnitXLeakCheckGraphMemoryLeakMonitor.Create; end); Cycle detector scanner can optionaly use extended RTTI information (see TScanFlags), so scanning for object (not just using interfaces) cycles in non ARC environment is possible, but note that RTTI generation is required, for objects not supporting extended RTTI (ie. closures), there is a fallback mechanism to classic solution. When using extended RTTI, the reference scanner may output field names holding the references as well (and add it as named edges for Graphviz, see bellow). This extension isn't tied to the memory manager itself and doesn't need it to run. So it can be used to generate object graphs in any application at any point of its execution, just give it appropriate entry point reference. It can generate visual cycle representation LeakCheck.Cycle supports format flags in the TCycle.ToString method that can be set to generate Graphviz DOT format output. Combined with TLeakCheckCycleGraphMonitor that appends another needed information, test cycle output can be copied to a file (make sure to copy only the graph specification not the entire error message) and converted using Graphviz (dot -O -T png cycle.dot) to visual representation. You can also select different memory monitor TLeakCheckGraphMonitor which will generate full reference tree not just cycles. It can acquire stack traces If registered, LeakCheck memory manager may acquire stack traces when some block is allocated which is then displayed in leak output either as pure addresses or formatted (if trace formatter is registered). Multiple stack tracers and formatters are available. Make sure to configure your compiler/linker properly. It is configurable via the LeakCheck.Configuration.inc include file also GetStackTraceProchas to be set to one of the predefined implementations or custom one. To get pretty-printed stack traces make sure to also register GetStackTraceFormatterProc. Keep in mind that different implementations have some limitations and requirements: The safest solution is WinApi based stack tracer and MAP file based formatter (MAP file needs to be enabled in the linker settings and symbols generation must be enabled in the compiler to get line numbers etc.). JCL implementation offers better stack traces (RAW) on Win32 and offers more options while formatting the output (debug symbols, MAP file, etc.) but needs external caching. Android implementation cannot show symbols right away but the formatter allows you to feed the output directly to addr2line utility which will then output the symbols and line numbers. It can detect virtual (and interface) calls made on freed object instances Fake VMT is assigned to an object (and if enabled to all interface entries as well) when it is freed. If virtual (or interface) call is made on a dangling pointer of such object, the call is reported and AV is raised. Ligthweight version may be used that will set fake VMT without reporting but will most likely raise an AV during the call. Examples Memory manager setup program SomeApp; uses {$IFDEF WIN32} // LeakCheck can be used together with another memory manager (if // LEAKCHECK_DEFER is defined) FastMM4, {$ENDIF } // LeakCheck must be the first unit (if no supervising memory manager is used) LeakCheck, // Following any platform dependent unit System.StartUpCopy, // LeakCheck utility unit that adds some reporting enhancements on mobile and // defines several useful functions (not required) LeakCheck.Utils, More.Units; begin ReportMemoryLeaksOnShutdown := True; Run; // Now you will get leak report when your program terminates (if leaks // are found). end. Getting leak report // You can use following function at any point and you'll receive complete // report of all unreleased (and not ignored) pointers. TLeakCheck.GetReport(nil); // This may not sound really helpful but you can create memory snapshot // and report everything in between current allocation and given snapshot. procedure DetectLeak; var Snapshot: TLeakCheck.Snapshot; Report: LeakString; begin Snapshot.Create; FunctionThatLeaksMemory(); Report := TLeakCheck.GetReport(Snapshot.Snapshot); try DisplayTheReport(Report); finally // Don't forget to do this. We cannot use string in the LeakCheck // low-level functions so we need a helper. Report.Free; end; end; Adding call stack to your report // Register stack trace to obtain the call stack (call addresses) TLeakCheck.GetStackTraceProc := WinApiStackTrace; // Pure pointers aren't really helpful so convert it to helpful format: // First enable symbol generation and MAP file generation or symbol linking // (based on what formatter you want to use) then assign the formatter. TLeakCheck.GetStackTraceFormatterProc := MapStackTraceFormatter; // More complex may look like this {$IFDEF MSWINDOWS} {$IFDEF CPUX64} TLeakCheck.GetStackTraceProc := WinApiStackTrace; {$ELSE} TLeakCheck.GetStackTraceProc := JclRawStackTrace; {$ENDIF} TLeakCheck.GetStackTraceFormatterProc := MapStackTraceFormatter; {$ENDIF} {$IFDEF POSIX} TLeakCheck.GetStackTraceProc := BacktraceStackTrace; TLeakCheck.GetStackTraceFormatterProc := PosixProcStackTraceFormatter; {$ENDIF} Or just add any of the LeakCheck.Setup.* units to simplify this process. Ignoring Sometimes it is useful to ignore public caches or other stuff when RegisterExpectedMemoryLeak is just not enough. // Ignore some basic types TLeakCheck.IgnoredLeakTypes := [ // Ignore all class leaks tkClass, // Ignore all ansi string leaks tkLString, // Ignore all unicode string leaks tkUString // Ignore all other leaks tkUnknown]; // In addition classes can be ignored in more complex way by assigning // TLeakCheck.InstanceIgnoredProc. This can be custom defined function // or any of the LeakCheck.Utils ignore functions. // Is not evaluated if tkClass is ignored globally in which case all classes // are already ignored. TLeakCheck.InstanceIgnoredProc := IgnoreRttiObjects; // If you need to ignore multiple objects you can use helper functions TLeakCheck.InstanceIgnoredProc := IgnoreMultipleObjects; // Helper ignore function // Register all ignore functions you need AddIgnoreObjectProc([ // Ignores Rtti unit objects (obtained through TRttiContext) IgnoreRttiObjects, // Classes created by using anonymous function use IgnoreAnonymousMethodPointers, //Custom attributes allocated by Rtti IgnoreCustomAttributes, //Ignore all descendants of TMyObject TIgnore<TMyObject>.Any ]); // Additionaly you can ignore managed fields in your objects by calling // IgnoreManagedFields or IgnoreAllManagedFields from inside your ignore // function or use TIgnore<T>.AnyAndFields or TIgnore<T>.AnyAndAllFields. // To ignore complete object graph use IgnoreGraphLeaks from the // TLeakCheck.Cycle unit. // You can also use TLeakCheck's MarkNotLeaking (ignores all allocations // from and including given snapshot), BeginIgnore and EndIgnore // (disables/enables allocations from being recorded as a leak) low-level // functions but be careful when you do! DUnit integration program MyTests; uses LeakCheck, TestFramework, // Don't forget to use the modified version LeakCheck.DUnit, GUITestRunner; begin RegisterTests([...]); // Configure ignoring and stack tracing if you want // Don't forget to enable leak reporting in your runner RunRegisteredTests; end. // You may create more complete leak report by assigning // MemLeakMonitorClass. begin MemLeakMonitorClass := TLeakCheckCycleMonitor; RegisterTests; ... DUnitX integration program MyTests; uses LeakCheck, DUnitX.TestFramework, DUnitX.MemoryLeakMonitor.LeakCheck, TestInsight.DUnitX; begin TDUnitX.RegisterTestFixture(...); // Configure ignoring and stack tracing if you want RunRegisteredTests; end. // You may create more complete leak report by creating other // IMemoryLeakMonitor. program MyTests; uses LeakCheck, DUnitX.TestFramework, DUnitX.IoC, DUnitX.MemoryLeakMonitor.LeakCheck, DUnitX.MemoryLeakMonitor.LeakCheckCycle, TestInsight.DUnitX; procedure Run; begin TDUnitX.RegisterTestFixture(...); // Configure ignoring and stack tracing if you want TDUnitXIoC.DefaultContainer.RegisterType<IMemoryLeakMonitor>( function : IMemoryLeakMonitor begin result := TDUnitXLeakCheckGraphMemoryLeakMonitor.Create; end); RunRegisteredTests; end; begin // It is not a good idea to add anonymous methods to main unit functions Run; end. Delphi support Delphi XE7 Delphi XE6 (Android not tested since XE6 doesn't support Lollipop) Delphi XE5 (Android not tested) Delphi XE Delphi between XE and XE6 should also work but was not tested. If you find any problems, please create an issue. Support for older version will not be added, some other versions may work but I will not test them nor will I add any patches that would add support to older versions. Note Although this library was tested on fairly large projects it comes with no guarantees, use at your own risk. This is a low level library at a very early stage of development so you may expect errors if you use it incorrectly or if you have memory issues in your application that the default memory manager survives somehow. But I'd like to get any input about issues you may run into, but please don't say it crashed my application, include stack traces or other technical information that may help me figure out the problem or better yet, submit patches. Known issues On Android (or actually any platform that needs libicu) the program may cause SEGFAULT during System unit finalization. This is caused by System allocating some memory before the memory manager is initialized and not freeing it properly (there are more comments in the LeakCheck source code). This should now be prevented in cases when the application doesn't leak any memory. Thanks to FastMM team DUnit team Stefan Glienke - for creation of TestInsight License Unless stated explicitly otherwise (in the code), the sources of this library is licensed under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
    1 балл
  7. А есть пример использования того же ZBar на C++?
    1 балл
  8. отрисовать текст на картинке и передать ее для создания маркера
    1 балл
  9. Друзья, часто бывает такие глюки как вылетание приложение без особый причины и без понимаю что приохотит, только мысль WTF вообще. В связи с этим хотел узнать, как вы делаете отладку приложений и есть ли тонкости. Допустим логи в устройстве на котором идет отладка или получение подробного описание ошибки.
    1 балл
  10. GASCHE

    Информация на графиках

    Рисую на двух TBitmap. На первый копирую график с TPathData на втором рисую координатную сетку с надписями оба Bitmap копирую на TRectangle, изменились размеры перерисовываю.
    1 балл
  11. Vitaldj

    Информация на графиках

    Глянь тут. Случайно напал на эти компоненты (читал блог Эмбаркадеры). Может будет полезным. Они платные, но есть какие то версии не дорогие. Пока сам не вчитывался. Начал дальше читать блог и увидел вот это чудо)))). Как говориться очень красиво. А вообще, взгляните сами, может что кому пригодиться.
    1 балл
  12. Andrey Efimov

    Geofencing

    Geofencing <> BeaconFence Geofencing - основана на вычислении примерного местоположения, используя вышки мобильных операторов. BeaconFence - предлагает сделать "вышки" самостоятельно, из Beacon маячков. p.s. Вот ваша тема по BeaconFence
    1 балл
  13. Капитан Очевидность шепчет: "Обновите операционку на айфоне". Официальный список поддерживаемых версий: http://docwiki.embarcadero.com/RADStudio/Berlin/en/Supported_Target_Platforms К сожалению у Mac совершенно другая политика в отношении сторонних программистов чем у Win. Фруктовая компания не поощряет иные средства разработки кроме своего, по этому на такие мелочи как поддержка совместимости не заморачивается. Тут как с XP сидеть 15 лет на старой версии не получится. P. S. на всякий случай напоминаю, что это мнение не официальное, все названия вымышлены, и совпадения с реальностью совершенно случайны
    1 балл
  14. От эмбр: http://community.embarcadero.com/blogs?view=entry&id=8542 procedure TVariableHeight.ListView1UpdateObjects(const Sender: TObject; const AItem: TListViewItem); var Drawable: TListItemText; SizeImg: TListItemImage; Text: string; AvailableWidth: Single; begin SizeImg := TListItemImage(AItem.View.FindDrawable('imgSize')); AvailableWidth := TListView(Sender).Width - TListView(Sender).ItemSpaces.Left - TListView(Sender).ItemSpaces.Right - SizeImg.Width; // Find the text drawable which is used to calcualte item size. // For dynamic appearance, use item name. // For classic appearances use TListViewItem.TObjectNames.Text // Drawable := TListItemText(AItem.View.FindDrawable(TListViewItem.TObjectNames.Text)); Drawable := TListItemText(AItem.View.FindDrawable('txtMain')); Text := Drawable.Text; // Randomize the font when updating for the first time if Drawable.TagFloat = 0 then begin Drawable.Font.Size := 1; // Ensure that default font sizes do not play against us Drawable.Font.Size := 10 + Random(4) * 4; Drawable.TagFloat := Drawable.Font.Size; if Text.Length < 100 then Drawable.Font.Style := [TFontStyle.fsBold]; end; // Calculate item height based on text in the drawable AItem.Height := GetTextHeight(Drawable, AvailableWidth, Text); Drawable.Height := AItem.Height; Drawable.Width := AvailableWidth; SizeImg.OwnsBitmap := False; SizeImg.Bitmap := GetDimensionBitmap(SizeImg.Width, AItem.Height); end;
    1 балл
  15. Да пожалуйста) procedure nnn; var socket: TSocket; LBytes: TBytes; LRecesiv: TBytes; Begin socket := TSocket.Create(TSocketType.TCP); try // ну только ваш ип socket.Connect(TNetEndpoint.Create(192, 168, 1, 1, 8081)); LBytes := [233, 123, 001, $FF]; socket.Send(LBytes); while True do // Begin if socket.Receive(LRecesiv) = 0 then Continue; // если ничего не пришло - опять запрашиваем инфу if LRecesiv = LBytes then socket.Send([66, 124]); End; finally socket.Free; end; end;
    1 балл
  16. uses System.Net.Socket; Procedure Sample; var Socket: TSocket; LBytes: TBytes; Begin Socket := TSocket.Create(TSocketType.TCP); try // ну только ваш ип Socket.Connect(TNetEndpoint.Create(192, 168, 1, 1, 8081)); LBytes := [233, 123, 001, $FF]; Socket.Send(LBytes); finally Socket.Free; end; End; { TvkDatabase } function TvkDatabase.getCit
    1 балл
  17. Полностью согласен. Ширину я устанавливаю в ListViewActionsUpdateObjects, и только после этого вызываю функцию.
    1 балл
  18. у меня аналогичная функция содержит еще один важный момент иногда ATextObject не имеет установленной ширины, т.е. значение по умолчанию=0! тогда нужно либо всегда задавать ее при создании итема, либо передавать ее отдельным параметром думаю над созданием наследников TDrawable которые кроме Offset имеют свойства Margins OFF: по идее, все это уже пройдено в HTML когда настала эпоха DIV-верстки. Мы пытаемся наощупь идти по тем же граблям
    1 балл
Эта таблица лидеров рассчитана в Москва/GMT+03:00
×
×
  • Создать...