Quantcast
Channel: Planet Object Pascal
Viewing all 1725 articles
Browse latest View live

Delphi Haven: A few XE5-related bits

$
0
0

With XE5 now out, I’ve updated my FMX TClipboard and Mac PDF writer code to compile with it, and in the case of the latter, also made an unrelated fix suggested by Sebastian Zierer. With respect to TClipboard, I must add the caveat that the Android implementation merely delegates to the standard, frankly half-arsed IFMXClipboardService, and as such, only supports text. This is because my investigations into the Android API suggest there is no standard way to exchange pictures over the Android clipboard – if anyone knows something to the contrary, by all means let me know in the comments though. Anyhow, if you want to browse the code, check it out here:

http://code.google.com/p/delphi-foundations/source/browse/#svn%2Ftrunk%2FFMX%20Utilities

Alternatively, the SVN link is http://delphi-foundations.googlecode.com/svn/trunk/FMX%20Utilities/

I have also just posted to the same place a TCustomIniFile descendant that delegates to the Android SharedPreferences API, which I have unimaginatively called TAndroidPreferencesIniFile (the unit is CCR.Android.PrefsIniFile.pas). This class corresponds to the TMacPreferencesIniFile class I had written previously, which sits on top of the CFPreferences API on OS X. The idea in both cases is to have classes that roughly correspond to TRegistryIniFile on Windows, providing a consistent interface over whatever is the native preferences store for the platform.

Be warned that unlike TIniFile (but like TMacPreferencesIniFile), TAndroidPreferencesIniFile is case sensitive with respect to section and key names. Further, there’s also a slightly annoying issue in which each time an app is deloyed by the IDE, existing preference data gets wiped in the process. Given when you run an Android app from the IDE you see a message saying it is uninstalling the previous version of the app, I imagine the preference wiping is just a function of that.

Anyhow, accompanying the main unit is a small (and very crude!) demo designed for a 7″ tablet (a Nook HD in my case):

TAndroidPreferencesIniFile demo

The demo works best if you write a series of values first, given the third edit box doubles as both the entry field for values to write and default values to read.



Te Waka o Pascal: A Backup Solution That Just Works

$
0
0
In a comment on my Shaggy Dog story yesterday commenter Iztok gently chastised me for not having backups of my VM’s. Ironically I did. The problem is that my backup strategy is so silently effective that I completely forgot I had it ! Having been reminded, I thought it might be worth sharing. The Good […]

Te Waka o Pascal: Delphi for (Some) Android

$
0
0
Embarcadero have blogged about the first Android app “in the wild” (actually, being on the Play store I think it’s the first domesticated app – wild ones surely get side-loaded ? ). Rather embarrassingly they already have a comment from someone unable to use this “true native Android” application on their actual Android device. Of […]

The Podcast at Delphi.org: Mobile Location on iOS and Android

$
0
0

Most Android and iOS devices either include a GPS antenna, the ability to triangulate off cellular or wireless access points, or some combination. Accessing the location is different when using the platform APIs for iOS and Android. Luckily Delphi XE5 includes the TLocationSensor component. When activated it has a OnLocationChanged event which fired when the location changes more than the specified distance. In there simply examine the NewLocation.Latitude and NewLocation.Longitude to know the current location.

Learn more about multi-device, true-native app development with Delphi XE5 and check out other Mobile Code Snippets.

Free Pascal Answers: My Story with Object Pascal language. Part one: Turbo Pascal

$
0
0

Before the university I have studied BASIC language using my MSX 64 K Bytes Ram, 2.8 Z80 Computer. On that time cassette tapes were the only available storage media that I have. On this computer I have learned the basic of programming, dealing with data, input and output, and finally I was able to write some graphical games, using spirit in MSX BASIC as I do remember.

After I have joined Sudan university in 1995 , I found that Turbo Pascal 6 is used as introductory language for computer programming. At first I hated it, I found it more complex than Basic. Then I started using QBasic in University labs. After writing a game in QBasic I decided to learn Pascal language, and that happens before first official course of programming language. The course of Pascal language has started in the second semester. In the second semester I write three graphical computer games using Turbo Pascal 7. I remember that in lab was not allowed to play games, but my friends copy these games and start to play with them. When lab administrator ask them to stop playing games, they say, this is a program of Turbo Pascal not a game and they open the source to prove it. Here are some snapshots of the games:

carCarFinGuess

At some point lab administrators upgrade Turbo Pascal 6 to Turbo Pascal 7, and when we asked our seniors about the difference, the say TP7 makes different color for reserved words.

I have resumed developing a lot of applications using Turbo Pascal during the first year in university. One of my important projects was typing tutorial, a text mode application to practice typing.

typing

typingrep

At the middle of second year at university I started to move into graphical interface instead of text mode. I spent enough time to write graphical library which includes menus, buttons, and different dialog boxes that supports mouse click and is similar to Windows, at that time it was Windows version 3.11. Then I used these graphical libraries to write some applications like Arabic font designer, and diskettes library.

arabicfont

I want to comment that Turbo Pascal 7 has a wonderful help system, strong compiler, bug free editor, fast executables and a debugger from the future.


Te Waka o Pascal: Learning Valuable Lessons

$
0
0
Iztok has been at it again, making comments that prompt another post. He expresses his view that there are only two viable options for mobile development. The first is essentially the web-based technology approach (HTML/JS/PhoneGap etc) and the other is the platform native tool chains, Eclipse/AndroidStudio/Xcode etc. He may be correct about the latter, and […]

Te Waka o Pascal: iOS 6.x Now Required By FireMonkey in XE5

$
0
0
In XE4 FireMonkey supported iOS 5.1. According to the platform requirements for XE5 this has now increased to iOS 6. This something to be aware of. Even if your application could run on older, simpler devices, the FireMonkey runtime has demands of it’s own, over and above those of any application you might develop. Even […]

The Podcast at Delphi.org: GExperts for XE5 Experimental Build

$
0
0

My good friend and Delphi MVP Jeroen Pluimers has just posted an experimental build of GExperts for XE5. He is working with Erik Berry to get an official build up on the GExperts site.

GExperts is a collection of open source productivity enhancements for Delphi.


Delphi Haven: My FMX TClipboard and TMacPreferencesIniFile implementations now compiling in XE4

$
0
0

A bit belatedly, but my FireMonkey TClipboard and TMacPreferencesIniFile/TApplePreferencesIniFile (*) implementations are now compiling with XE4 (thanks goes to Ken Schafer for prodding me in the case of the former). See my post from nearly a year ago for the details:

http://delphihaven.wordpress.com/2012/07/27/fmx-tclipboard-and-tmacpreferencesinifile/

With respect to TClipboard, I’ve also done the following:

  • Added a cfPNG TClipboardFormat identifier (this is the same as cfBitmap on OS X).
  • Fixed a bad assumption about bitmap pitches on Windows that was causing issues for some people.
  • Switched to using CF_DIBV5 internally when reading or writing bitmaps on Windows.
  • When assigning to a bitmap, cfPNG is now looked for first (this makes things works better with MS Word), and correspondingly, HasFormat(cfBitmap) now also checks for cfPNG as a special case.
  • On Windows again, when a source bitmap includes transparency, the outputted DIB has this transparency removed, however at the same time a PNG representation is added that maintains the original alpha channel.
  • For greater flexibility (e.g. when there is only PDF data on the clipboard), the Mac implementation may now use NSImage as an intermediary when assigning to a TBitmap.
  • For both Windows and OS X, added GetFormats and GetFormatName methods. Where the former returns an array of TClipboardFormat, the latter converts a TClipboardFormat to a string:
procedure TfrmClipboardDemo.btnListClick(Sender: TObject);
var
  Format: TClipboardFormat;
  S: string;
begin
  for Format in Clipboard.GetFormats do
    S := S + sLineBreak + Clipboard.GetFormatName(Format);
  if S = '' then
    S := 'Nothing is currently on the clipboard.'
  else
    S := 'The following formats are on the clipboard:' + S;
  MessageDlg(S, TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0)
end;

This is the result when I copy a word on a webpage in Safari:

One word copied from Safari

As this example hints at, it’s better to use Apple’s ‘UTI’ format for custom clipboard identifiers on OS X (e.g. com.mycompany.formatname, though ultimately just something.something, or something.something.something, etc.). While things still work if you don’t, failing to do so will lead the OS to allocate a parallel ‘dynamic’ UTI for you (e.g. dyn.a1oad0fg1bber13hthat600s0nand0nand0n). As such, I’ve tweaked the demo accordingly – click the ‘Copy as Custom Clipboard Format’ button then the ‘List’ one, and you get this:

Custom format list

(*) Update (14/9/13): as the code actually worked for iOS too, I’ve renamed the unit CCR.Apple.PrefsIniFile.pas and the class TApplePreferencesIniFile. For XE5, I’ve also written a TAndroidPreferencesIniFile class – see here.


Te Waka o Pascal: Anatomy of a Camera App

$
0
0
Part 1 in an as yet unknown number of articles using a (very) simple camera application to demonstrate building first class Android applications using “Pascal for Java” – i.e. Oxygene Cooper. In this first instalment we will look at the basics – the components we are going to need and the basic UI of the […]

Castle Game Engine news: Development: great API for 2D games and UI, our engine in Debian, on the road to OpenGL ES, Orcs and Volcanoes game screenshots

$
0
0
Orcs and Volcanoes - intro screen
Orcs and Volcanoes
Orcs and Volcanoes
Orcs and Volcanoes
Orcs and Volcanoes
Orcs and Volcanoes
Octopus exported from Blender to KAnim.
Tooltips with rounded corners over partially-transparent buttons.
Custom image under selected item.
Custom image under selected item, 2.
view3dscene tooltips with rounded corners.
Message dialog with nice buttons.
New dialog look with a nice scrollbar and button.
New dialog look with a nice scrollbar and button.
  1. Great news for Debian users: Castle Game Engine package is available inside official Debian repositories. Version 4.0.1 is already available in the testing release, and version 4.1.1 is in unstable (on the way to testing). Installing Castle Game Engine in Debian, with documentation and Lazarus integration, is now as trivial as installing standard FPC units :)

  2. On the side of this post you see screenshots from "Orcs and Volcanoes", a game Michalis did 2 weekends ago at Ten Square Games"gamejam" :) This is a roguelike with pixelart graphics, with some 3D twists and real-time action. For a weekend project (literally 36 hours of programming, no sleep) I think the result is quite cool, the game actually works and is playable :) Of course, it uses our engine for everything.

    Almost all graphics from the "Badass Heroes" game. Used with permission, but they are not freely redistributable, so I can't share the game publicly... Anyway, feast your eyes on the screenshots :)

  3. A lot of engine API improvements done in the recent weeks, in particular around 2D controls and images. Most of that is caused by the desire to port complete engine to OpenGL ES, and have Android/iOS version.

    The nice side-effect is that the 2D API is now generally much better. Frankly, if you want to make a pure 2D game, Castle Game Engine is now an excellent choice :) Drawing 2D images and animations is now very flexible. Details:

    TGLImage (our class to render images as 2D, for GUI and 2D games) much improved:

    • Renders 2D images as npot textures underneath (suitable for modern OpenGL and GLES, better with anti-aliasing).
    • TGLImage.Draw can display image stretched (if ScalingPossible, OpenGL bilinear filtering will stretch it nicely).
    • TGLImage.Draw3x3 can display image stretched intelligently, preserving corners and sides. These functions are the basis for implementing 2D GUI, e.g. TGLImage.Draw3x3 is used for all TCastleButton states, which makes it also easier to theme (e.g. it's now possible to make rounded corners without any fuss, just make transparent corners in the texture). All CastleControls are now drawn using TGLImage.
    • TGLImage drawing automatically uses alpha test or alpha blending, depending on alpha channel in the loaded image. You can always change TGLImage.Alpha to explicitly force specific alpha treatment. You can also change TCastleImageControl.AlphaChannel.
    • TCastleTheme is now a configurable collection of images (with nice defaults).
  4. Tutorial about 2D controls (SVN version) contains various examples about new TGLImage and Theme.Draw usage.

    Dialog boxes (CastleMessages unit) improved:

  • Drawn using images, so much more configurable.
  • Normal buttons at the bottom (descendants of our TCastleButton), so it's natural to handle them with mouse.
  • Theme for slider and frame much better (somewhat based on GTK 2 theme "clearlooks", esp. the scrollbar).

More 2D controls:

  • TCastleLabel (like Font.PrintStringsBox, but nicely wrapped in a class).
  • TCastleDialog (to make modal or non-modal dialog boxes, with scrollbars, buttons etc).
  • TCastleProgressBar (display progress bar as TUIControl, regardless if you use CastleWindow or CastleControl).

Because of the move to new TGLImage API and the rest of GLES2 changes, small compatibility breakage may happen at 4.2.0 release. This concerns you if you do direct OpenGL calls or use low-level tricks from CastleGLUtils. Things to take into account to have a smooth upgrade to 4.2.0:

  • Always use SetWindowPos, never directly use glRasterPos* functions. In general, forget about raster position — this concept is gone in GLES2 and modern OpenGL. Use only SetWindowPos to affect initial text position for TGLBitmapFont and TGLImage, this works in both engine 4.1.1 and in SVN (future 4.2.0). It is only for 2D, and is not affected by modelview matrix state.
  • Since 4.2.0, it will be advised to use cleaner TGLBitmapFont.Print(X,Y,Color,string) and TGLImage.Draw(X,Y) instead of SetWindowPos. But SetWindowPos will also work, to allow you to write code in the existing 4.1.1 API that will also work smoothly in engine >= 4.2.0.
  • If you hope to keep your code portable to GLES2, of course be sure to avoid old OpenGL API. Immediate mode rendering cannot be used (use only VBO; usually, you should just use our TCastleScene for rendering all 3D, and TGLImage or TGLVideo2D for all 2D).

Font API improved:

  • The advised font drawing call is now Print(X,Y,Color). Other versions are deprecated, as they lead to messy code — it's not nice to manage global state in WindowPos, it's not nice to manage global color in CurrentColor.
  • All font drawing can use blending for text (just pass text color with alpha 1).

Consistent TCastleColor usage. We now consistently use TVector4Single type to express a color, it's even aliased as TCastleColor.

  • We do not use TVector3Single (as we like having alpha available).
  • We do not use byte versions. There are numerous arguments in favor of using float-based color values (instead of byte-based): it allows for components > 1 (useful for physically-correct rendering and some shaders inputs), it is natural to smoothly interpolate (you can also use functions in CastleColors to interpolate in HSV space), it is easier to express constants.

    The only advantage of using byte-based colors is that this is what you get from RGB 32-bit color images, and you can compare it for exact equality. But this isn't universal anyway (there are images with float colors, like RGBE). When dealing with TRGBImage or TRGBAlphaImage you can still use byte-based colors and eventually convert using Vector4Single() and Vector4Byte() both ways (in practice 8-bit and 16-bit values will be expressed precisely as Single too).

  • Color constants as TVector4Single have simple names inside CastleColors, just "Yellow" instead of "Yellow4Single".
  • Comfortable TAbstractGeometryNode.Solid, TAbstractGeometryNode.Convex.

  • X3D and Kanim exporters for Blender updated to work with latest Blender 2.68a.

  • Te Waka o Pascal: iOS 7 and arm64 Support in Oxygene

    $
    0
    0
    Marc Hoffman of RemObjects blogged over the weekend about the forthcoming iOS 7 and arm64 support in Oxygene. Actually, the only part that is really “coming” is the arm64 aspect since, as he explains in the blog post, Oxygene has always been able to use the iOS 7 SDK betas from the first day they […]

    The road to Delphi: Tools and projects updated to support Delphi XE5

    The road to Delphi: Delphi Dev. Shell Tools – New features 3

    $
    0
    0

    Features added to the new version of the Delphi Dev. Shell Tools.

    • Full refactoring of the code related to drawing the items bitmaps and icons, now only 32 bpp bmp (Windows 8/7/Vista) and 32-bit with alpha channel icons (Windows XP) are used.
    • Added support for Delphi XE5. Now you can build your Delphi Android projects with a single click without open the Delphi IDE.

    dproj_menu_new

    • Added feature to extended the Shell extension with custom scripts (.bat). This new option allows create a script and associate a set of extensions.

    This is a preview of the window to register the scripts.

    Custom_Tools

    You can setup the Sub-Menu (Group) where the new option will be displayed, the label and image for the menu entry, the extensions associated, set an option to run the script as Administrator and use a small set of macros.

    The tool includes as set of predefined scripts for FPC and Delphi which you can use as example to register you own most used Apps.

    FPC & Lazarus

    • h2pas is a small command-line utility that can be used to translate C header files to pascal units. The Free Pascal team uses it to make import units for important C libraries such as GTK or MySQL.
    • ppdep is a small utility that scans a program or unit and creates a depend file that can be used for inclusion by make. It understands conditional symbols and interdependency of units.
    • ptop is a configurable source formatter. It pretty-prints your pascal code, much like indent does for C code.
    • ppudump dumps the contents of a unit in human-readable format. It understands older versions of units and gracefully handles unknown (future) versions.

    For more info check the Tools that come with Free Pascal page.

    Delphi

    For more info check the RAD Studio Command-Line Utilities page

    External Tools

    • Regsvr32, This command-line tool registers .dll and ocx files as command components in the registry.

    Te Waka o Pascal: Exploring Listeners With Oxygene

    $
    0
    0
    Part 2 in a short series demonstrating the development of a simple camera app for Android using Oxygene. In the previous instalment we looked at the basic framework of our app. For this instalment I was going to show how to implement the camera preview or viewfinder for this instalment, but instead have decided to […]

    DelphiTools.info: DWScript now supports Delphi XE5

    $
    0
    0
    DWScript SVN version will now compile and run under XE5. There is only one gotcha due to an XE5 regression. While running the DWScript test suite through XE 5 trial, and while most of DWScript ran okay under XE5, I noticed the following regression: integer divisions by zero aren’t properly wrapped, instead of an EDivByZero,…

    Žarko Gajić: SQLite: Referential Integrity With Full Text Search Virtual Tables (used in a Delphi application)

    $
    0
    0

    sqlite-fts-ref-integrity
    As a second step in my goal to implement full text search functionality in my Delphi application I had to create a sample SQLite database supporting FTS queries.
    Full text search models in databases allow to do what Google does with web documents – quickly search for documents containing some word (token).

    FTS enabled tables in SQLite are special tables created using the virtual table paradigm. There’s lots of info on FTS tables and their construction and usage on the SQLite web site.

    Reminder: my idea is to see how to have full test search implemented in a Delphi application processing files under some read-only folder structure.

    Each file (to end up in my FTS table) has several pages and the content of a page should be stored in a FTS table.

    Warning: from now on I will presume you have enough knowledge on SQL syntax and SQLite to be able to read and understand “CREATE TABLE…”, “INSERT INTO…” and alike.

    Initial idea would be to create the database using the following model (simplified):

    DocumentFileContent
    Id (primary field)
    FileName
    Id (primary field)
    DocumentId (foreign key / ref integrity)
    PageNumber
    PageContent

    Therefore two tables. First table “Document” stores file names, this table is a parent/master table, while table “FileContent” is a child table storing several records (page number and page text content) for each entry in its parent table (each record in child is for one page of the file being processed).

    In the above model the DocumentID field in FileContent table should reference Document.Id so that SQL queries like Delete and Update on the Document table would also delete/update the corresponding rows in the FileContent table.

    If the above could work (and it does not as you will see) the DDL SQL would look like:

    CREATE TABLE Document (
      Id INTEGER PRIMARY KEY,
      FileName TEXT NOT NULL,
    );
    
    /*SQLite Full Text Search Tables */
    CREATE VIRTUAL TABLE FileContent USING FTS4 (
      DocumentId INTEGER REFERENCES Document(Id) ON DELETE CASCADE ON UPDATE CASCADE,
      Page INTEGER,
      PageContent TEXT,
      UNIQUE(DocumentId, Page)
    );
    

    The above unfortunately does NOT work.
    Virtual tables in SQLite do NOT support any constraints (referential integrity, foreign keys)!

    DDL for FTS virtual table allowing foreign keys

    Luckily, SQLite is enough powerful to support views and triggers and even triggers on views! There are ways to have best of both worlds: referential integrity on FTS virtual tables.

    After some testing, the structure of the database best matching my requirements is :

    CREATE TABLE Document (
      Id INTEGER PRIMARY KEY,
      FileName TEXT NOT NULL,
    );
    
    CREATE TABLE FilePages(
      DocumentId INTEGER REFERENCES Document(Id) ON DELETE CASCADE ON UPDATE CASCADE,
      Page INTEGER,
      UNIQUE(DocumentId, Page)
    );
    
    CREATE VIRTUAL TABLE PageContent USING fts4();
    
    CREATE TRIGGER FilePages_DELETE AFTER DELETE ON FilePages
    BEGIN
      /* required when ref. integrity deletes rows in FilePages as
         a result of delete row(s) operation in Document */
      DELETE FROM PageContent WHERE rowid = OLD.rowid;
    END;
    
    CREATE VIEW FTSData AS
      SELECT FilePages.rowid AS rowid, FilePages.DocumentId, FilePages.Page, PageContent.Content
      FROM FilePages JOIN PageContent ON FilePages.rowid = PageContent.rowid;
    
    CREATE TRIGGER FTSData_INSERT INSTEAD OF INSERT ON FTSData
    BEGIN
      INSERT INTO FilePages(DocumentId, Page) VALUES (NEW.DocumentId, NEW.Page);
      INSERT INTO PageContent (rowid, Content) VALUES (last_insert_rowid(), NEW.Content);
    END;
    
    CREATE TRIGGER FTSData_DELETE INSTEAD OF DELETE ON FTSData
    BEGIN
      DELETE FROM FilePages WHERE rowid = OLD.rowid;
      DELETE FROM PageContent WHERE rowid = OLD.rowid;
    END;
    

    Visually:

    Document [1 - ∞ FilePages]FilePages [1 - 1 PageContent]PageContent
    rowid
    Id (primary field – alias to “rowid”)
    FileName
    rowid
    DocumentId (foreign key / ref integrity)
    Page
    rowid
    Content

    In SQLite, every row of every table has a signed integer ROWID field. The ROWID for each row is unique among all rows in the same table. If a table contains a column of type INTEGER PRIMARY KEY, then that column becomes an alias for the ROWID. If no columns are specified when creating the FTS table, a single column “Content” table is created.

    Recipe: 3 tables, 1 view, and 3 triggers. Triggers are database operations that are automatically performed when a specified database event occurs. Views are pre-packaged SELECT statements.

    The view FTSData serves to join the FTS table PageContent with its “one-to-one” relation table “FilePages” (the relation is actually imposed by triggers). FilePages are in one-to-many relation with Document being the parent table.

    SQL Test

    insert into Document values (1, 'file 1');
    insert into FTSData values(null, 1, 1, 'doc 1 page 1');
    insert into FTSData values(null, 1, 2, 'doc 1 page 2');
    
    insert into Document values (2, 'file 2');
    insert into FTSData values(null, 2, 1, 'doc 2 page 1');
    insert into FTSData values(null, 2, 2, 'doc 2 page 2');
    
    /* and finally a simple FTS query */
    SELECT FROM PageContent WHERE MATCH 'page'
    

    Any comments / better ideas?

    From Zero To One: Library and site updates

    $
    0
    0

    After being quiet for quite some time (but extremely busy), I am now posting updates about what is new in the “Cromis Library” and on the page itself.

    Page updates

    In the past I already worked with TRAC, a great open source project management tool written in Python. I fiddled with it a little, even used it for one of my internal projects, but that was more or less it. Now after a few years, I upgraded my Debian VM, where the blog runs and decided that I upgrade and use TRAC again. So I put up a project management for “Cromis Library”. It features:

    You can find the page here: http://www.cromis.net/trac/cromis. It is also accessible from the blog top navigation under “DOCS”. Why did I decide to do this? Well I want to run my projects in a more structured manner. Yes, I write them in my spare time and when I can, but that does not mean, I can’t have a road-map, a ticket system and a forum. It took me very little time to set up and I think I will benefit from it. Also the users of “Cromis Library” will have a lot of info at hand. More and more people use my library and I get a lot of e-mails regarding how to use something, etc… Lots of content in these e-mails  is overlapped and I think its a shame, that the content is not available online. As of now it is! Furthermore I will benefit from bug tracking tickets and from tasks that I will assign to myself. This way I have a clear picture what I intend to do and how are things progressing. But please do not take the road-map as sacred. After all I have a family and a job among other things and I will update the road-map and change dates if needed.

    The documentation is currently not there yet, but it will dribble in slowly. Also the code, is for reasons I will not discuss here right now, not ultra clean and organized at that moment. But downloads are always stable snapshots when they are made. This means that using SVN code directly, is being on the bleeding edge.

    I am open to criticism, suggestions and most of all participation on the site itself. Welcome to it :)

    Library updates

    1. Cromis.IPCBoth IPC and IMC went through some serious redesigns, to allow further code development and to incorporate new features. All the changes are listed on the download page, I will sum here
      • New events have been added, OnClientConnect, OnClientDisconnect, OnServerError
      • Improved error handling and notifications, especially the server side
      •  Unit renamed to Cromis.Comm.IPC
      • Server now holds a list of connected clients
      • Clients can specify their class that holds the data for each client
    2. Cromis.IMC - Similar changes as IPC
      • New events have been added, OnClientConnect, OnClientDisconnect, OnServerError
      • Improved error handling and notifications, especially the server side
      •  Unit renamed to Cromis.Comm.IMC
      • Server now holds a list of connected clients
      • Clients can specify their class that holds the data for each client
      • Exposed bindings for TCP server
    3. Cromis.Scheduler - Scheduler has been optimized and new funcionality has been added
      • LastEvent propery for schedule
      • OnScheduleAdd and OnScheduleRemove handlers added to events list
      • stQueue added as signal type, this allows more modern approach then Sychronize
      • Improved thread stopping and freeing
    4. Cromis.AnyValue - Very important change here. Safe mode code has been added, that does not use hooks. Under x64 it is automatically enabled and under x86 you can enable it if you fear for the stability. But do not worry it is rock solid anyway :)
      • “AnyValue_HookingOn” and “AnyValue_HookingOff” defines added
      • Under x64 automatically swithces to safe mode. Manual control over hooking

    Here I would like to appeal for help.  Cromis.AnyValue uses System.pas hooks to be as fast as it is and as memory efficient. But that means, I have to use Cromis.Detours. And while it is rock solid under x86, the code it is not x64 safe. Although it works just fine in my tests, that does not mean it will work fine anywhere. I lack the assembler knowledge to make it x64 safe and I also lack time to do so. So if any of you has the skills and want’s to help, I will be more then happy and that person will have my eternal gratitude :)

    The Podcast at Delphi.org: Android Screen View

    $
    0
    0

    Android Screen View UI

    People have asked for a copy of the utility I wrote to view the attached Android device on the screen. It uses the built in screencap functionality of Android and the ADB (Android Debug Bridge) to grab and display a series of screenshots. It requires the Android SDK installed and does not require a rooted device.

    The speed of update has to do with the screen resolution and image complexity. Simple screens (text and controls) update about twice a second. More complex screens (pictures, graphics, etc.) are slower than that.

    For best results, turn on “Show Touches” under debug options.

    It also supports saving a PNG to file.

    Get the source: https://code.google.com/p/android-screenview/

    Download the build: http://delphi.org/downloads/AndroidScreenView.7z

    There are a few pending features that I just haven’t gotten to. If you’d like to contribute let me know. Thanks to Stephen Ball for all his contributions already!

    The Wiert Corner - irregular stream of stuff: jpluimers

    $
    0
    0

    Igor Ostrovsky wrote a few very nice MSDN magazine articles. Not all of them have ended up in the list at MSDN magazine, so here is a more complete list:

    Though the articles show the majority of sample code in C#, the actual topics are of great interest to any developer writing .NET code or interfacing to it.

    Some keywords in his articles:

    • PLINQ
    • volatile and read/write reordering
    • memory access patterns
    • threading, locking
    • System.Threading and System.Collections.Concurrent namespaces
    • ThreadPool
    • InvokeAsync, RunWorkerAsync, SendAsync, DownloadStringAsync
    • IAsyncResult
    • System.Threading.Task.Tasks and task composition and parallel execution
    • SynchronizationContext
    • False sharing (when 2 unrelated objects share the same processor cache line)
    • Sequence Zipping
    • JIT Compiler optimizations and influence on memory operationsC++

    –jeroen

    via: MSDN Magazine Authors: Igor Ostrovsky.


    Filed under: .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Delphi, Development, F#, LINQ, PLINQ, Prism, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0
    Viewing all 1725 articles
    Browse latest View live