EzDevInfo.com

jedi

Awesome autocompletion and static analysis library for python. Jedi - an awesome autocompletion/static analysis library for Python — Jedi 0.9.0 documentation

Looking for an event scheduler for Delphi?

I was recently looking at TJvScheduledEvents that comes with the JVCL library because I have a need for a dynamic scheduler in a Delphi application. Initially this looked to fit the bill, but I have run into some concerns.

  • Limited documentation other than the code itself
  • The event scheduler form that lets you create events appears to be a design time form with no runtime interface.
  • Issues with storing dynamically created scheduled events to a file or database so that they are not lost when the application restarts.

Does anyone have any experience with this object or another scheduling interface. I would rather not have to build this myself if there are other options.


Source: (StackOverflow)

emacs jedi doesn't work

I'm trying to find the solution for days, but I didn't get it yet. So, if you guys could help me I'd appreciate it. I've been using emacs to code in Python, I'm a very beginner using emacs, so, I decided to install the autocomplete Jedi feature. In some tutorials I've found they ask me to add this line in the ./emacs file (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup)

I add those lines in the file and restart Emacs, however when I open some .py file they report me some errors. ps. I've installed Jedi through the Melpa package! ps. I'm using Ubuntu 12.04

Thanks in advance!


Source: (StackOverflow)

Advertisements

JEDI JCL Compression library wont open spanned archive files

Summary:

I am having trouble to get the JCL compression library to open any spanned archives. It presents the error "(0000001) Incorrect Function" as defined in borlands 'windows.pas';

scenerios:

A single archive compressed using the JCL compression example.
-Will uncompress in both the JCL example and the 7zip gui.

A spanned archive over 7 files compressed using the JCL compression example.
-Will uncompress in only the 7zip gui. Fails to uncompress using JCL example.

A single archive compressed using the 7zip gui.
-Will uncompress in both the JCL example and the 7zip gui.

A spanned archive compressed over 7 files using the 7zip gui.
-Will uncompress in only the 7zip gui. Fails to uncompress using JCL

Extra information

The JCL compression demo is the one included with the JCL library.
JCL: 2.2.1.3970
7zip dll: 9.20.0.0 and 9.65.0.0
Example filename in spanned archive set: "Test Archive.7z.002"
Tried with both .tar and .7z compression
Different file sizes were used. 2048 bytes and 2048KB
Delphi 2009.

This is the code im using. Its from the JCL compression demo. Error occurs on line 'TJclDecompressArchive(FArchive).ListFiles'.

procedure TFormMain.ActionOpenROExecute(Sender: TObject);
var
  ArchiveFileName, Password: string;
  AFormat: TJclDecompressArchiveClass;
  SplitArchive: Boolean;
begin
  if OpenDialogArchiveRO.Execute then
  begin
    CloseArchive;

ArchiveFileName := OpenDialogArchiveRO.FileName;
SplitArchive := AnsiSameText(ExtractFileExt(ArchiveFileName), '.001');
if SplitArchive then
  ArchiveFileName := ChangeFileExt(ArchiveFileName, '');

AFormat := GetArchiveFormats.FindDecompressFormat(ArchiveFileName);

if AFormat <> nil then
begin
  if SplitArchive then
    ArchiveFileName := ArchiveFileName + '.%.3d';

  InputQuery('Archive password', 'Value', Password);

  FArchive := AFormat.Create(ArchiveFileName, 0, SplitArchive);
  FArchive.Password := Password;
  FArchive.OnProgress := ArchiveProgress;

  if FArchive is TJclDecompressArchive then
    TJclDecompressArchive(FArchive).ListFiles
  else
  if FArchive is TJclUpdateArchive then
    TJclUpdateArchive(FArchive).ListFiles;

  ListView1.Items.BeginUpdate;
  try
    while ListView1.Items.Count < FArchive.ItemCount do
      ListView1.Items.Add;
  finally
    ListView1.Items.EndUpdate;
  end;
end
else
  ShowMessage('not a supported format');
  end;
end;

The JCL example does know about the files and does open them. (zip format used in image. Same problem). Image of files opened by JCL compression example.

Prehaps someone has come across this before?.
Can anyone point me in the right direction please?.
Thank you for your time.

Scott M.


Source: (StackOverflow)

Can the JEDI Code Library, Delphi IDE menu item (JCL Options...), be moved?

Is there a way to move the Delphi IDE menu item Tools->JCL Options..., to the bottom of the tools menu?

enter image description here


Source: (StackOverflow)

How can I make emacs-jedi use project-specific virtualenvs

I would like emacs-jedi to detect when I am editing files in different projects, and use the corresponding virtualenv if it is available. By convention my virtualenvs have the same name as my projects. They are located in $HOME/.virtualenvs/

I found kenobi.el but it assumes that virtualenvs are found in the bin directory in the project root. It also has a couple of other features that I don't need at all.

With inspiration from kenobi.el, I wrote the following initialisation for jedi. It works pretty well, but not perfectly.

If I import library A from my project, and A imports B. I am able to jump into definitions defined by A, but once there, I'm not able to continue jumping into definitions from B.

My initialisation:

(defun project-directory (buffer-name)
  (let ((git-dir (file-name-directory buffer-name)))
    (while (and (not (file-exists-p (concat git-dir ".git")))
                git-dir)
      (setq git-dir
            (if (equal git-dir "/")
                nil
              (file-name-directory (directory-file-name git-dir)))))
    git-dir))

(defun project-name (buffer-name)
  (let ((git-dir (project-directory buffer-name)))
    (if git-dir
        (file-name-nondirectory
         (directory-file-name git-dir))
      nil)))

(defun virtualenv-directory (buffer-name)
  (let ((venv-dir (expand-file-name
                   (concat "~/.virtualenvs/" (project-name buffer-name)))))
    (if (and venv-dir (file-exists-p venv-dir))
        venv-dir
      nil)))    

(defun jedi-setup-args ()
  (let ((venv-dir (virtualenv-directory buffer-file-name)))
    (when venv-dir
      (set (make-local-variable 'jedi:server-args) (list "--virtual-env" venv-dir)))))

(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)
(add-hook 'python-mode-hook 'jedi-setup-args)
(add-hook 'python-mode-hook 'jedi:setup)

What is wrong with how I initialise jedi?


Source: (StackOverflow)

run-time evaluation of values in DelphiWebScript

My delphi application runs scripts using JvInterpreter (from the Jedi project).

A feature I use is runtime evaluation of expressions.
Script Example:

[...]
ShowMessage(X_SomeName);
[...]

JvInterpreter doesn't know X_SomeName. When X_SomeName's value is required the scripter calls its OnGetValue-callback. This points to a function I handle. There I lookup X_SomeName's value and return it. Then JvInterpreter calls ShowMessage with the value I provided.

Now I consider switching to DelphiWebScript since it has a proper debug-interface and should also be faster than JvInterpreter.

Problem: I didn't find any obvious way to implement what JvInterpreter does with its OnGetValue/OnSetValue functions, though.

X_SomeName should be considered (and actually is, most of the time) a variable which is handled by the host application.

Any Ideas?

Thanks!


Source: (StackOverflow)

Delphi: JEDI TrayIcon hides all frames. Bug

I have a frame, two buttons and a JEDI TrayIcon (TJvTrayIcon, Version 3.40). Delphi XE.

The first button:

Frame11.Visible := true;

Second:

Frame11.Visible := false;

When I try to minimize a window -> restore it from a system tray -> click the "Visible:=false" button and then "Visible:=true" = the frame doesn't appear.

A problem is in [tvAutoHide] of Visibility of TJvTrayIcon.

I don't see this problem in a new project, but I have in an old one. I cannot understand why it happens and how to prevent it. Please see my problem project: http://www.filedropper.com/trayicon

Thanks for help!


Source: (StackOverflow)

Emacs Jedi auto-complete not working on init

I installed jedi along with some other packages via el-get the other day, and initially it all worked great (auto-completion, popup menus etc).

In the past few days, however, jedi has stopped working (i.e. auto-completion, popups and function argument suggestion no longer work).

I've discovered part of the reason for this not working is that, for some reason, auto-complete is not enabled on startup. I've tried adding (setq auto-complete-mode t) to my .emacs file both before and after el-get loads jedi, but despite enabling auto-complete, it still doesn't work for some reason. Instead, I have to enable auto-complete using M-x auto-complete-mode once emacs has loaded (I have also tried the suggestions here Emacs auto-complete-mode at startup, but that just throws a load of errors when emacs loads).

Besides this, when I type M-x jedi RET, some of the commands listed on the jedi troubleshooting page (such as jed:setup-keys) seem to be missing.

I also seem to be experiencing the same problems as this guy here: emacs-jedi does not find numpy completions, but I'm not sure if the two problems are linked.


Source: (StackOverflow)

Delphi - .bpl plugins for application - problem while loading > 1 plugin

I'm using TJvPluginManager to build simple application with ability to load .bpl plugins. I have common interfaces declaration in "uIntfs.pas" file, which is kind of SDK ;)

The problem is, that if I try to load more than one plugin, the app throws an error:

Cannot load package 'test2'. It contains unit 'uIntfs,' which is also contained in package 'test'

It's quite obvious that BOTH bpls contain that file, however I need to make it work ...

Please help!


Source: (StackOverflow)

How to redirect binary gbak output to a Delphi stream?

I want the Firebird backup tool gbak to write its output to a Delphi stream (with no intermediate file). There is a command line parameter to write to stdout rather than a file. I then use the Execute method in JEDI's JclSysUtils to launch gbak and process that output.

It looks like this:

procedure DoBackup;
var
  LBackupAbortFlag: Boolean;
  LBackupStream: TStringStream;
begin
  LBackupAbortFlag := False;
  LBackupStream := TStringStream.Create;
  try
    Execute('"C:\path to\gbak.exe" -b -t -v -user SYSDBA -pas "pw" <db> stdout',
      LBackupStream.WriteString, // Should process stdout (backup)
      SomeMemo.Lines.Append, // Should process stderr (log)
      True, // Backup is "raw"
      False, // Log is not
      @LBackupAbortFlag);
    LBackupStream.SaveToFile('C:\path to\output.fbk');
  finally
    LBackupStream.Free;
  end;
end;

The problem is that the output file is way too small to contain that actual backup. Still I see elements of the file's content. I tried different stream types, but that doesn't seem to make a difference. What could be going wrong here?

Update

To be clear: other solutions are welcome as well. Most of all, I need something reliable. That's why I went with JEDI in the first place, not to reinvent such a thing. Then, it would be nice, if it would be not too complicated.


Source: (StackOverflow)

Is it possible to control how tabs are displayed in the JvDockServer component?

If you run the AdvanceDemo in the JVCL's JvDocking example code, with VSNetStyle selected, you can drag a second form onto the main form; a tab with the second form's title will be displayed. If you then drag a another form onto the same side of the main form, another tab will be created. The two tabs will overlap:

screenshot of overlapping tabs

Is there a way to control how much these two tabs overlap? I'd like the tabs to be separated enough so that users can read the text on both tabs.

Thanks, as always -- Al C.


Source: (StackOverflow)

How to use JEDI TJCLHashMap classes?

I'm trying to use TJCLHashMap family of classes, but apparently this class has no useful public methods. All methods are "protected". How to use this class? Although JCL comes with some samples, I seem to miss something. A basic example would be great.


Source: (StackOverflow)

How to reskin a Delphi 6 application?

I just received some artist rendered images of my Delphi Pro 6 application that I will use to overhaul the look and feel of it. The problem is of course that my application, like any other Delphi application, uses the VCL custom control library and those controls paint themselves and in a way that frequently isn't conducive to altering their look and feel. I also make heavy use of the open source JEDI JVCL library too.

If anyone out there has a some tips, articles, web pages or anything that talk about working from an image to reskin or overhaul a Delphi 6 application, I would appreciate knowing about it. It's a big application with tons of complex TFrame descendants and a heavy use of the JEDI VCL page control so switching over to a brand new component library isn't practical.

One idea I had that I have not tried out yet is to take each top level form and nestle it in another TForm by changing the current form's Parent property to the new TForm and setting the AlphaBlend property of the current form so that it is transparent. Then I'd set the new shell or host TForm's background to an image containing the new look and feel so that it bled through the transparent form. That approach seems kind of kludgy and I worry about resizing issues but that's the kind of technique that I'm wondering if is usable.


Source: (StackOverflow)

Save/Load TObject(TPersistent) to XML

everybody.

I'm trying to save my class:

TA= class(TPersistent)
private
    FItems: TObjectList<TB>;

    FOnChanged: TNotifyEvent;
public
    constructor Create;
    destructor Destroy; override;
    ...
    procedure Delete(Index: Integer);
    procedure Clear;
    procedure SaveToFile(const FileName: string);
    ...
    property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
end;

to file using the following code:

var
  Storage: TJvAppXMLFileStorage;
begin
  Storage := TJvAppXMLFileStorage.Create(nil);
  try
    Storage.WritePersistent('', Self);
    Storage.Xml.SaveToFile(FileName);
  finally
    Storage.Free;
  end;

but file is always empty.

What am I doing the wrong way?


Source: (StackOverflow)

How to serialize Delphi TObjectList type to XML with TJvAppXMLFileStorage?

Previously, to save the settings of some applications, I used:

  • A TSettings = class(TPersistent) for the container
  • Each data to serialize in a published property
  • List of object were TCollection and TCollectionItem types
  • The TJvAppXMLFileStorage component to save everything with the single line :

    JvAppXMLFileStorage.WritePersistent(...);

BUT now, I'm using TObjectList as properties in the TSettings class.
So I drop the TCollection/TCollectionItem in favor of Generics ...
When serializing it, there is no list of items ... I think it's because TObjectList is not from TPersistent.

How can I serialize my TObjectList<> with TJvAppXMLFileStorage ?


Source: (StackOverflow)