2017年9月21日 星期四

javascript delphi

WebBrowser1.OleObject.Document.ParentWindow.execScript('alert("Hello")');
Edit: I found SpiderMonkey for Delphi. It supports 64 bit but there is no 64 bit dll provided. "js64.dll" that is.
Here is the 64 bit build. It works perfect with delphi-javascript





A memory manager for Delphi and C++ Builder with powerful debugging facilities

fastmm4

https://github.com/pleriche/FastMM4
A memory manager for Delphi and C++ Builder with powerful debugging facilities


Fast Memory Manager
Description: A fast replacement memory manager for Embarcadero Delphi applications that scales well under multi-threaded usage, is not prone to memory fragmentation, and supports shared memory without the use of external .DLL files.
Advantages:
  • Fast
  • Low overhead. FastMM is designed for an average of 5% and maximum of 10% overhead per block.
  • Supports up to 3GB of user mode address space under Windows 32-bit and 4GB under Windows 64-bit. Add the "$SetPEFlags $20" option (in curly braces) to your .dpr to enable this.
  • Highly aligned memory blocks. Can be configured for either 8-byte or 16-byte alignment.
  • Good scaling under multi-threaded applications
  • Intelligent reallocations. Avoids slow memory move operations through not performing unneccesary downsizes and by having a minimum percentage block size growth factor when an in-place block upsize is not possible.
  • Resistant to address space fragmentation
  • No external DLL required when sharing memory between the application and external libraries (provided both use this memory manager)
  • Optionally reports memory leaks on program shutdown. (This check can be set to be performed only if Delphi is currently running on the machine, so end users won't be bothered by the error message.)
  • Supports Delphi 4 (or later), C++ Builder 4 (or later), Kylix 3.

TCMalloc : Thread-Caching Malloc memory manager

http://goog-perftools.sourceforge.net/doc/tcmalloc.html

TCMalloc : Thread-Caching Malloc


TCMalloc is faster than the glibc 2.3 malloc (available as a separate library called ptmalloc2) and other mallocs that I have tested. ptmalloc2 takes approximately 300 nanoseconds to execute a malloc/free pair on a 2.8 GHz P4 (for small objects). The TCMalloc implementation takes approximately 50 nanoseconds for the same operation pair. Speed is important for a malloc implementation because if malloc is not fast enough, application writers are inclined to write their own custom free lists on top of malloc. This can lead to extra complexity, and more memory usage unless the application writer is very careful to appropriately size the free lists and scavenge idle objects out of the free listTCMalloc also reduces lock contention for multi-threaded programs. For small objects, there is virtually zero contention. For large objects, TCMalloc tries to use fine grained and efficient spinlocks. ptmalloc2 also reduces lock contention by using per-thread arenas but there is a big problem with ptmalloc2's use of per-thread arenas. In ptmalloc2 memory can never move from one arena to another. This can lead to huge amounts of wasted space. For example, in one Google application, the first phase would allocate approximately 300MB of memory for its data structures. When the first phase finished, a second phase would be started in the same address space. If this second phase was assigned a different arena than the one used by the first phase, this phase would not reuse any of the memory left after the first phase and would add another 300MB to the address space. Similar memory blowup problems were also noticed in other applications.
Another benefit of TCMalloc is space-efficient representation of small objects. For example, N 8-byte objects can be allocated while using space approximately 8N * 1.01 bytes. I.e., a one-percent space overhead. ptmalloc2 uses a four-byte header for each object and (I think) rounds up the size to a multiple of 8 bytes and ends up using 16N bytes.

OmniThreadLibrary The Ultimate Delphi Threading Library

http://www.omnithreadlibrary.com/tutorials.htm

OmniThreadLibrary

The Ultimate Delphi Threading Library


What Is OmniThreadLibrary?

OmniThreadLibrary is simple to use threading library for Delphi. Currently, versions 2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6, XE7, XE8, 10 Seattle, 10.1 Berlin, and 10.2 Tokyo are supported. OmniThreadLibrary is an open source project. It lives on GitHub and is licensed under the BSD license.
This is not the first threading framework I've written. There are, however, few big differences between the OTL (OmniThreadLibrary) and previous projects. All previous projects were closed source, used only for the in-house programming. They were all designed from the bottom. And they all had big problems when used in some real-life cases. Still, they were an important research tools. I learned a lot from them - what works, what doesn't and, most important, what kind of threading issues are appearing in the real life applications. 


Presentations

ITDevCon 2010

FastMM in Depth – presentation (ppspdf), code (zip)
Parallel Programming Made Easy – presentation (ppspdf), code (zip)
Building Multithreaded Solutions with OmniThreadLibrary – presentation (ppspdf), code (zip)

VDUG webinar 2010

Parallel Programming with OmniThreadLibrary -  presentation (pdf), video (flashmp4)

ADUG 2011

Getting Full Speed with Delphi - presentation (pps), handouts (pdf), code (zip)

ITDevCon 2011

Multithreading Made Simple with OmniThreadLibrary - presentation (ppspdf), code (zip)

ITDevCon 2012

Parallel Programming with OmniThreadLibrary - presentation (ppspdf), code (zip)

delphi Socket Components


DelphiA variety of SocketComponents of the model and the model

Assembly
Unit
Dependence
Pattern
Model
WebApp/CGI
sockapp.pas
Indy
Blocking or non blocking
select
Indy


Blocking or non blocking
select
ICS
OverbyteIcsWSocket.pas

Non blocking
WMAsyncSelect
TTcpServer/TTcpClient
sockets.pas

Blocking or non blocking
Select
RealThinClient

The ICS variant
Non blocking
wsaasyncselect
synapse
blckSock.pas

Blocking or non blocking
Select
TServerSocket
TClientSocket
ScktComp.pas

Blocking or non blocking
WSAAsyncSelect
FastNet
psock.pas


WSAAsyncselect
TSocketConnection

TServerSocket
TClientSocket



From the table above can be seen, not a component using the following 4 models:
Blocking mode
Overlap port
Event selection
The completion port
Only to:
Select
WSAAsyncselect
These two kinds of models, and the use of WSAAsyncselect model, the inevitable need window, components used as service is not much. 
We will analyze various server program is what model: 
IOCP 
Apache
Legend
Mysql
Erlang
WSAEventSelect
TServerSocket 
...


By steven
2014-2-1
 

What Web Application Framework for Delphi is recommended?


https://stackoverflow.com/questions/3793112/what-web-application-framework-for-delphi-is-recommended

There has been some activity in the Web Application Framework area for Delphi (Win32) 
Delphi on Rails - for D2010
  • Elevate Web Builder
  • Smart Mobile Studio
  • uniGUI (unified Graphical User Interface) is a framework for developing AJAX Web Applications in classical WYSIWYG Delphi RAD  
    In a past job, I used webhub (http://www.href.com) with pretty satisfying results.
    Some time ago I used RTC, which was stable and very fast, the RTC Server-side code can be compiled to a Stand-alone Server and ISAPI Extension
    I never used g-framework but looks promising
    DelphiMVCFramework has been released as Open Source. Check this answer Web MVC framework for Delphi
    Kitto allows to create Rich Internet Applications based on a data model that can be mapped onto any database. The client-side part uses ExtJS (through the ExtPascal library) to create a fully AJAX application,