FP File Organizer: new feature

I feel there are two programs that are essential for efficient use of a personal computer:

  • text editor
  • two-window file manager

Regarding text editors, people who use NotePad or Word may as well tie a cement block to their mouse. The freeware ConText editor is such a good choice that I would not attempt to duplicate its function. On the other hand, I have created a freeware file manager, FP File Organizer. The idea was to incrementally add all the features I ever wanted in a file manager. For example:

  • A clear and logical layout of controls makes FP File Organizer quick to learn and easy to use. There is no menu or toolbar. Navigation commands are grouped at the top while file-operation buttons occupy the space between the windows. Advanced features that are used less frequently are called from a popup menu.
  • A Backup command makes it easy to coordinate code and documents between computers via a USB drive. The command copies files and replaces files only if the source has a more recent modification time. The user has the option to generate a text log of changes made.
  • Several advanced functions are useful for data organization (e.g., create text listings of directory contents, determine directory sizes, copy full file paths to the clipboard, launch a terminal window in the current directory, show the total available storage,…).
  • Users can define custom commands with pass parameters to run external programs.

The program has had the capability to save frequently-accessed file locations (paths) in a list. Clicking the Add location button adds the currently-active directory to the list. The Saved locations button brings up a dialog showing the list with the option to go to any of the entries. In a year’s use of the File Organizer, I found that I was not using the feature, instead wasting time navigating to common locations. I decided that a list of paths was not something that compelled your interest, so I added the option to personalize entries.

Saved locations dialog

Figure 1. Saved locations dialog.

Figure 1 shows the new look of the Saved locations dialog. Anticipating that users will define more entries, the dialog is now resizable The Path column has been supplemented with a Name column. When a location is added, the program creates a name based on the lowest level of the path . Users can edit the names to make them more descriptive of the function or content of the directory. It is possible to arrange the locations by dragging the entries or automatically alphabetizing them by name. The active directory can be switched to a saved location by double-clicking the name or path. Finally, both the names and the paths are preserved in the configuration file between sessions.

The FP File Organizer is available at no charge at http://www.fieldp.com/fpfileorganizer.html. There are no ads in the full-functioned program and the installer does not add hidden programs or taskbars. Even if you already have a favorite file manager, the special features our program make it a good supplement.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Parallel processing optimization

The Professional version of the 3D field-solution programs Aether, HiPhi, Magnum, HeatWave, RFE3 and field updates in OmniTrak use parallel processing routines of OpenMP to achieve significant reductions in run-time on multi-core computers. Some users have reported that the programs sometimes fail to implement parallel processing. This article addresses two topics:

  • The limitations of parallel processing and how our programs avoid memory conflicts.
  • Modifications to the programs in the most recent version to ensure that they utilize the full parallel-processing capabilities of the computer.

Consider the application of parallel processing in a boundary-value field solution (e.g., HiPhi, Magnum,…). The discrete form of the partial differential equations are solved by an iterative method where values of the primary function (e.g., electrostatic potential, reduced potential,…) are corrected to comply with values on neighboring mesh points. An optimal method alternately corrects odd and even mesh points. It is not necessary to proceed in sequence. Different parts of the mesh may be corrected simultaneously — hence, the appeal of parallel processing. The constraint is that two processes may not change the same mesh memory location simultaneously. Because our programs use structured conformal meshes, an easy and efficient solution is to assign processes to different layers of the mesh along the z direction (index K). Each process works in tandem from the top to the bottom of its assigned layer so there is no danger of overlap.

There are two reasons why we need to avoid thin processing layers:

  • There is overhead associated with MP organization, so that increasing the number of processors may give diminishing returns. For example, little speed advantage is gained by assigning three processors to layers two indices thick verses one processor to a layer with ΔK = 6.
  • A safety factor is necessary to ensure that there is never a memory overlap.

For these reasons, we set the minimum processor layer thickness to ΔK= 5. In previous versions, the programs simply skipped a parallel calculation if

ΔK = Kmax/NProc ≤ 5.

(Here, NProc is the number of processors requested in the PARALLEL command.) In this case, parallel processing would appear to fail if a solution had large dimensions in x-y, small dimension in z and the user specified a large value of NProc.

To eliminate the sometimes mysterious behavior, the current programs use the following logic.

  1. If NProc = 1, the program performs a non-parallel calculation.
  2. If NProc > 1, the program calculates the quantity NProcMax = Kmax/5. If NProc ≤ NProcMax, the program opens NProc processes. Otherwise, the number of processes equals NProcMax.

In this way, the program uses the maximum number of processors consistent with avoiding memory overlap.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Converting video formats

This year’s major project at Field Precision is educational — a full-length video course on how to calculate static electric and magnetic fields with finite-element methods. Of course, the sub-context is the essential techniques and insights to use our software effectively (e.g., how to design meshes for maximum speed and accuracy…).

In preparation, I updated my copy of Camtasia to the latest version (8.4). I use the program to capture events on the computer screen and for general video editing. There were many improvements since I purchased Version 6.0, so the update was well worth the cost. I also got a good webcam and an entry-level  camcorder with plenty of features for the application. Even though the JVC GZ-EX210 cost less than $130, it provides resolution up to 1920×1080 pixels.

Of course, issues arose. The camcorder creates downloadable interleaved video/audio streams in MTS format (H264 video, AC3 audio). Camtasia refuses to import the files directly. An error message appears in the program that directs you to a particularly unhelpful help site. The only workable option was to download a video converter to change files to a format recognized by Camtasia, such as AVI.

The video converters available on the Internet constitute a particularly nasty snake pit, so I will offer some useful tips in this article. A basic search for video-converter software yields an infinity of options, mostly pay-for programs and misleading “download for free programs” (yes, you can download them for free, but they won’t work for free). After further searching, I found the article Top free video converters (Tomas Ondik, 02/13/2012) that lists seven freeware programs for Windows: Freemake Video Converter, Any Video Converter, Format Factory, Free Studio, Koyote Free Video Converter, 4Free Video Converter and Hamster Free Video Converter. I tried them all.

The Ondik article did not list links, so I searched for download sites. Here, you have to be cautious. If you can’t find the official site, you can run into problems — download sites like CNet use other people’s freeware and attach toolbars and other plague-ware via special downloaders.

Here is my assessment of the seven programs. First, the rejects:

  • Format Factory: no longer available.
  • Free Studio: to be avoided vigorously. Not only does it try to install plague-ware, but it adds hidden programs that are almost impossible to remove (thankfully I had WinPatrol Plus to provide warnings).
  • Koyote: I got so tired of un-checking the multiple plague-ware options that I cancelled the install.
  • Hamster: halfway through, the installer displays a terrifying screen of Cyrillic characters.

Three programs worked well and could qualify as freeware. The links point to their official sites:

In all cases, choose the Custom install option so you can uncheck plague-ware. All programs produced AVI files of comparable quality that were recognized by Camtasia. 4Free is relatively slow and displays an exhortation to upgrade ($29.95) every time you make a conversion. AnyVideoConverter also encouraged you to upgrade with each conversion. The program had extensive options to make files for specific tablets and phones, a feature I wouldn’t need. Their Ultimate package ($49.95) allows you to appropriate DVDs and NetFlix streams. For my application, FreeMake was the best choice. It had a simple interface and made quick conversions. I gave the $9.99 suggested donation to support their development.

Finally, many Internet pages suggest that VLC Media Player can be used for video conversions. I doubt this is true. The sequence of operations is counter-intuitive, and all my attempts at converting the MTS files to AVI produced output with audio but no video.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

How to do anything in Xojo

Xojo is a nice programing environment for the quick creation of interactive Windows utilities. Despite its extensive capabilities, a time always comes when you need to accomplish a relatively simple task that isn’t supported. My un-aha moment came when I wanted to fine-tune the cursor position in FP Uniscale using the arrow keys. This capability is supported in the Winteracter package for our FORTRAN programs and proved essential for the Grid snap mode of the Mesh Drawing Editor. Oddly, after an extensive search I was able to find no equivalent in Xojo. In fact, some of the responders in threads dealing with the Xojo issue felt that moving the cursor from within a program was totally outre.

The solution to this problem, as well as an infinity of others, is to make direct calls to the Windows API (application programer’s interface). This capability is buried deep in the Xojo documents and certainly isn’t emphasized, so I thought I would share some techniques in this article.

As the first example, here is how to move the cursor one pixel at a time with the arrow keys, making sure that it remains in the active window. This code appears in the KeyDown event of the window:

dim ix,iy as integer
dim IDum as integer

declare function SetCursorPos Lib "user32" (ByVal x As integer, ByVal y As integer) as integer

ix = Me.MouseX
iy = Me.MouseY
if Keyboard.AsyncKeyDown(123) then
  // Left
  if (ix > 1) then
    IDum = SetCursorPos(me.left+ix-1,me.top+iy)
  end if
end if
if Keyboard.AsyncKeyDown(124) then
  // Right
  if (ix < (me.width-1)) then
    IDum = SetCursorPos(me.left+ix+1,me.top+iy)
  end if
end if
if Keyboard.AsyncKeyDown(125) then
  // Down
  if (iy < (me.Height-1)) then
    IDum = SetCursorPos(me.left+ix,me.top+iy+1)
  end if
end if
if Keyboard.AsyncKeyDown(126) then
  // Up
  if (iy > 1) then
    IDum = SetCursorPos(me.left+ix,me.top+iy-1)
  end if
end if

The declare statement, a standard Xojo routine, is the path to the API. The function SetCursorPos is contained in the Windows library user32.lib. It requires two integer input parameters giving the desired cursor position in pixels relative to the total screen. The ByVal parameter means that only the values are passed so that the API routine does not change the variables in the calling program. In calls to SetCursorPos, note how the positions are set relative to the active window rather than the total screen.

The big question is how did I know about SetCursorPos in user32.lib? The answer may be found at the Windows API Index. This is one of the few Microsoft technical pages where you might be tempted to state that you found it helpful. It’s a huge reference that requires considerable effort to search, but many gems are hidden within. For example, one of the features I always wanted to include in FP File Organizer was a report on the available space an hard disks and USB plugins, important information to plan large copy operations. This data is not available through the Xojo FolderItem class, but is easy to obtain by calling the API. Here’s a link to information on the GetDiskFreeSpaceExW function in kernel32.lib. Here’s how the routine is used in FP File Organizer:

dim DriveName as wstring
dim UserFree, TotalSize, TotalFree As uint64
declare function GetDiskFreeSpaceExW Lib "Kernel32" (dirname As WString, _
  ByRef freeBytesAvailable as uint64, _
  ByRef totalbytes as uint64, _
  ByRef totalFreeBytes as uint64) As Integer
if (LeftFocus) then
  DriveName = LeftDirectoryName
else
  DriveName = RightDirectoryName
end if
Call GetDiskFreeSpaceExW(DriveName, userfree, totalsize, totalfree)
MsgBox "Drive space allocation" + chr(13) + _
  "   Total size: " + DisplaySize(TotalSize) + chr(13) + _
  "   Available to user: " + DisplaySize(UserFree) + chr(13) + _
  "   Total available: " + DisplaySize(TotalFree)

Note that the output variables are passed ByRef. This means that the API routine directly modifies the variables using their pointers so that the data is available to the calling program.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Uniscale update, continued

It’s an eventful time for Uniscale! Although thousands of people have downloaded the program over a two-year time period, yesterday I received the first useful suggestion for improving the program! A user pointed out that in the Find graph points and Drawing dimensions windows, it was often difficult to align the mouse cursor precisely and to maintain its position while clicking buttons. Accordingly, I added the option to fine-tune the cursor position by single pixels with the arrow keys and to use the F1 key instead of the left mouse button to read coordinates. In testing, I found that the capabilities made a big difference in convenience. While modifying the program, I also found a wealth of bugs and several opportunities for improvements. In combination with previous changes, Uniscale was so much better that I decided to declare Version 3.0. If you already use the program, updating to Version 3.0 is easy. Download and run the installer at http://www.fieldp.com/fpuniscale.html. It will replace the program while preserving your settings and saved rulers.

The excitement of receiving a comment set me to reflection on the history of this blog. Amazingly, it has been active for over six years with over 200 articles. If I believe the web statistics, hundreds of thousands of people have viewed the entries. Over the lifetime of the blog, I have received six non-spam comments (a reflection on the weirdly uncommunicative nature of the Internet, supposedly a vehicle for universal communication). Four of those related to one popular article, Saturation curves for common soft magnetic materials. These comments all had similar content, that I summarize as follows:

I want to use a type of steel that's not on your page. I'm too lazy to hunt for 
the data, so why don't you stop everything you're doing and look it up for me.

In their defense, these people at least had the courtesy to create a custom message. Well over 99% of the comments received are spam, thankfully buried by the Akismet plugin for WordPress. A typical example:

inground fiberglass pools toronto

https://www.facebook.com/pages/Backyard-Splash/56…

halinapfeffer@gmail.com
107.155.120.155
Submitted on 2014/05/29 at 3:16 pm
Hello there! This post could not be written much better!
Going through this article reminds me of my previous roommate!
He constantly kept talking about this. I am going to forward this
article to him. Fairly certain he’s going to have a good read.
Thank you for sharing!

You have to wonder a what point a person, realizing that the system is gamed and life is pointless, decides to become a total nuisance.

At any rate, I’m not complaining. The original purpose of this blog was to document tech-help responses. Previously, I found myself answering the same questions multiple times. In most instances, detailed descriptions of solutions are very helpful to users. Other outcomes of the blog are frosting on the cake.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.