←February→
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
|
|
|
|
|
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
|
| ←2025→Months |
Jan |
Feb | Mar |
Apr |
May |
Jun |
Jul |
Aug |
Sep |
Oct |
Nov |
Dec |
|
Sun, Aug 28, 2022 3:45 pm
Setting the path variable for Java
I had installed
Java
on a Windows 10 system as part of the installation of the
Eclipse
integrated development environment (IDE), which did not add the
directory where the java.exe and javac.exe executable files were installed.
I could temporarily add the directory where Eclipse installed those files
to the path
environment variable—see
Running java from an Eclipse installation from the command line—but
I didn't want to continue to have to do that every time I wanted to compile
a Java program at a command prompt or run one from
a
command-line
interface (CLI). So I added the path to the executable files to the
system-wide path environment variable so it would be permanent and apply
to all accounts on the system.
[ More Info ]
[/languages/java]
permanent link
Sun, Aug 28, 2022 1:47 pm
Setting JAVA_HOME for Gradle
While trying to set up
Gradle, a software develpment build automation tool, on a Microsoft Windows
10 system, when I ran the gradle.bat file in the gradle bin directory, I saw
the message below:
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>gradle.bat
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>
I had installed Java with the
Eclipse
integrated development environment (IDE) previously and the java.exe
executable was installed beneath the
C:\Users\Jim\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_18.0.1.v20220515-1614\jre\
directory, so I created a JAVA_HOME
environment
variable pointing to that directory that applied to all accounts on the
system. You can create a temporary JAVA_HOME environment variable for the
account under which you are currently logged in from a
command line
interface (CLI) as noted at
Running java from an Eclipse
installation from the command line, but I wanted to create a permanent
environment variable so I typed advanced system settings
in
the Windows "Type here to search" field and then clicked on View
advanced system settings when I saw that listed.
[ More Info ]
[/languages/java]
permanent link
Fri, Aug 05, 2022 5:01 pm
Running java from an Eclipse installation from the command line
For an introductory
Java
class I am taking, I installed the
Eclipse
integrated development environment
(IDE)
on a Microsoft Windows 10 system. In addition to compiling and running
Java programs through the IDE, though, I wanted to compile Java programs using
the Java compiler, javac.exe, and run them using java.exe from Windows'
command-line interface (CLI). The installation process for Eclipse
installed the javac.exe and java.exe executables in a user directory with
a long directory path to those executables. Note: you should install the
Eclipse IDE from the account which you wish to use to compile and run
java programs. The location wasn't added to the
path environment
variable, so if you try to run the programs from a command prompt, you will
see the following, unless you specify the full path name where the executable
files are located.
C:\Users\Jim>java
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Jim>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Jim>
I didn't want to have to copy and paste the full path on the command line
or type it in every time I wanted to use the two executables from the
command line. To avoid that problem you can add the directory path to the
path environment variable through a set path=
command or create
another environment variable, e.g., JAVA_HOME that points to the directory
where the two files are located, though both methods apply only to a particular
command line instance. I.e., if you close a command prompt window where you've
set one of the variables to include the location where Eclipse installed
java.exe and javac.exe then open another command prompt window, you will have
to set the environment variable again in the new instance. An alternative
way to make a permanent path change from a command prompt interface is to use
the Windows setx
command, though I would not recommend it, since if
your path variable already has a path that is more than 1,024 characters long,
setx can truncate the path to 1,024 characters, so that you not only don't
get the additional directory added to the path, but you may lose some of
the path setting you had prior to issuing the command. If you want to
make a permanent change, see responses to the
"Overcoming the 1024 character limit with setx"
posting at the superuser.com site.
[More Info ]
[/languages/java/eclipse]
permanent link
Wed, Apr 07, 2021 9:34 pm
Iterating over a PHP associative array by key
The
PHP scripting language
provides
associative
arrays that allow one to associate a key in the array to a value; each key
in the array must be unique. E.g., I can create an array of United States
presidents that uses the presidents' names as the keys and their political
party affiliation as the value for each key. I could then iterate through
the array by key and show the corresponding value for each key as in the
example PHP code.
[/languages/php]
permanent link
Sat, Sep 12, 2020 7:48 pm
Codes for Short and Long Vowels in Latin
If you wish to insert vowels used in Latin in a document, such as
a Microsoft Word or
WordPad
document, on a Microsoft Windows system to indicate
vowel length, i.e.,
whether the vowel should be pronounced as a long or short vowel, you can use
the
Unicode values shown
in the table below — Unicode is an encoding standard for characters
in most of the world's
writing systems. For Latin, a
macron, which is
a
diacritic mark,
is placed above the letter to indicate a long vowel. Sometimes a
breve may also be used
to indicate a short vowel. In addition to the Unicode codes, the corresponding
Hypertext Markup Language (HTML)
code is listed as well for displaying the characters in a web page.
To insert the characters using a Windows keyboard on a system running the
Microsoft Windows operating system, type the numeric code (the numbers are
hexadecimal numbers so
"A" through "F" represent the numbers 10 through 15) and then hit Alt-x,
i.e., hit the "Alt" and "x" keys simultaneously, after entering the numeric
code. Note, you needed to have a space before the number you enter, otherwise
if you attempt to put "ē" in "fēmina," by typing "f" with "0113"
immediately after it, the "f0113" will be replaced with a small box with a
question mark within it. So place a space after the "f," type
0113
, hit Alt-x, then when ē
appears, remove
the space before it. Also note that though Microsoft Word supports this
method of entering vowels with a diacritic mark in a document not all
Microsoft Office
applications allow you to enter Unicode characters by this
method. E.g., for
Microsoft Powerpoint, you will need to use the
Character Map method of entering such characters, instead.
[ More Info ]
[/languages]
permanent link
Fri, Apr 19, 2019 10:01 pm
Extract images from a PDF file with Python
You can use the PyMuPDF module with
Python to extract images from a
PDF
file. You can install PyMuPDF using the
pip package
manager with the command pip install PyMuPDF
. You can determine
if it is already installed with the command pip list | grep PyMuPDF
or pip freeze | grep PyMuPDF
.
# pip list | grep PyMuPDF
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won't be maintained after that date. A fut
ure version of pip will drop support for Python 2.7.
PyMuPDF 1.14.13
# pip freeze | grep PyMuPDF
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won't be maintained after that date. A fut
ure version of pip will drop support for Python 2.7.
PyMuPDF==1.14.13
#
The code for the file is in
extract-PDF-image.py.
[ More Info ]
[/languages/python]
permanent link
Sat, Aug 18, 2018 10:16 pm
Determine Python installed modules/packages
If you need to determine the
packages/modules/
libraries installed for
Python on a system, you can do so by obtaining a Python
command prompt and issuing the help("modules")
command.
$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
2018-08-18 15:31:45.666 Python[74959:5231860] Cannot find executable for CFBundle 0x
7fe335602be0 </System/Library/Frameworks/Message.framework> (not loaded)
AVFoundation _TE dircache profile
Accounts _Win dis pstats
AddressBook __builtin__ distutils pty
AppKit __future__ dl pwd
AppleScriptKit _abcoll doctest py2app
AppleScriptObjC _ast dumbdbm py_compile
Audio_mac _bisect dummy_thread pyclbr
Automator _builtinSuites dummy_threading pydoc
BaseHTTPServer _codecs easy_install pydoc_data
Bastion _codecs_cn email pyexpat
CFNetwork _codecs_hk encodings pylab
CFOpenDirectory _codecs_iso2022 ensurepip pyparsing
CGIHTTPServer _codecs_jp errno pytz
Canvas _codecs_kr exceptions quopri
Carbon _codecs_tw fcntl random
Cocoa _collections filecmp re
CodeWarrior _csv fileinput readline
Collaboration _ctypes findertools repr
ColorPicker _ctypes_test fnmatch resource
ConfigParser _curses formatter rexec
Cookie _curses_panel fpformat rfc822
CoreData _elementtree fractions rlcompleter
CoreFoundation _functools ftplib robotparser
CoreGraphics _hashlib functools runpy
CoreLocation _heapq future_builtins sched
CoreText _hotshot gc scipy
Dialog _io genericpath select
DictionaryServices _json gensuitemodule sets
DocXMLRPCServer _locale gestalt setuptools
EasyDialogs _lsprof getopt sgmllib
EventKit _markerlib getpass sha
ExceptionHandling _multibytecodec gettext shelve
Explorer _multiprocessing glob shlex
FSEvents _osx_support grp shutil
FileDialog _pyio gzip signal
Finder _random hashlib site
FixTk _scproxy heapq six
Foundation _socket hmac smtpd
FrameWork _sqlite3 hotshot smtplib
HTMLParser _sre htmlentitydefs sndhdr
IN _ssl htmllib socket
InputMethodKit _strptime httplib sqlite3
InstallerPlugins _struct ic sre
InstantMessage _symtable icglue sre_compile
JavaScriptCore _sysconfigdata icopen sre_constants
LatentSemanticMapping _testcapi idlelib sre_parse
LaunchServices _threading_local ihooks ssl
MacOS _tkinter imageop stat
Message _warnings imaplib statvfs
MimeWriter _weakref imghdr string
MiniAEFrame _weakrefset imp stringold
Nav abc importlib stringprep
Netscape aepack imputil strop
OSATerminology aetools inspect struct
OpenDirectory aetypes io subprocess
OpenSSL aifc itertools sunau
PixMapWrapper altgraph json sunaudio
PreferencePanes antigravity keyword symbol
PubSub anydbm lib2to3 symtable
PyObjCTools applesingle linecache sys
PyPDF2 appletrawmain locale sysconfig
QTKit appletrunner logging syslog
Quartz argparse macerrors tabnanny
Queue argvemulator macholib tarfile
ScreenSaver array macostools telnetlib
ScriptingBridge ast macpath tempfile
ScrolledText asynchat macresource terminalcommand
SearchKit asyncore macurl2path termios
ServiceManagement atexit mailbox test
SimpleDialog audiodev mailcap textwrap
SimpleHTTPServer audioop markupbase this
SimpleXMLRPCServer autoGIL marshal thread
Social base64 math threading
SocketServer bdb matplotlib time
StdSuites bdist_mpkg md5 timeit
StringIO bgenlocations mhlib tkColorChooser
SyncServices binascii mimetools tkCommonDialog
SystemConfiguration binhex mimetypes tkFileDialog
SystemEvents bisect mimify tkFont
Tix bonjour mmap tkMessageBox
Tkconstants bsddb modulefinder tkSimpleDialog
Tkdnd bsddb185 modulegraph toaiff
Tkinter buildtools multifile token
UserDict bundlebuilder multiprocessing tokenize
UserList bz2 mutex trace
UserString cPickle netrc traceback
WebKit cProfile new ttk
_AE cStringIO nis tty
_AH calendar nntplib turtle
_App cfmfile ntpath types
_CF cgi nturl2path unicodedata
_CG cgitb numbers unittest
_CarbonEvt chunk numpy urllib
_Cm cmath objc urllib2
_Ctl cmd olefile urlparse
_Dlg code opcode user
_Drag codecs operator uu
_Evt codeop optparse uuid
_File collections os videoreader
_Fm colorsys os2emxpath warnings
_Folder commands parser wave
_Help compileall pdb weakref
_IBCarbon compiler pickle webbrowser
_Icn contextlib pickletools whichdb
_LWPCookieJar cookielib pimp wsgiref
_Launch copy pip xattr
_List copy_reg pipes xdrlib
_Menu crypt pkg_resources xlrd
_Mlte csv pkgutil xml
_MozillaCookieJar ctypes platform xmllib
_OSA curses plistlib xmlrpclib
_Qd datetime popen2 xxsubtype
_Qdoffs dateutil poplib zipfile
_Qt dbhash posix zipimport
_Res dbm posixfile zlib
_Scrap decimal posixpath zope
_Snd difflib pprint
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".
>>> exit()
$
[ More Info ]
[/languages/python]
permanent link
Mon, Jun 11, 2018 10:43 pm
Finding text within lines in a file with PHP
For a weekly status report, I need to determine the number of work requests
that are approved and awaiting implementation. The list of requests in that
state is contained in a webpage that contains other information, including
requests that are in various other states, such as those awaiting approval.
I normally download the webpage containing the information to run
scripts against it to extract other information from the page, so I decided
to create a PHP
script that would display just the list of requests awaiting implementation and
produce a count of those requests in that state. On the source webpage the
line on the page that marks the start of the section of the page containing
the requests that are approved and awaiting implementation contains the text
"Requests Waiting Implementation". The
HTML code on
the page that marks the end of that section contains and ending
div
tag. So I created the two PHP variables below to hold the two
strings I
need to search for within the file.
$startString = "Requests Waiting Implementation";
$endString = "</div>";
[ More Info ]
[/languages/php]
permanent link
Fri, May 18, 2018 10:56 pm
Installing new packages for WinPython
To install a new package/module under
WinPython, double-click on WinPython Command Prompt
in
the directory where you installed WinPython to open a command prompt window.
At the command prompt window type pip install pkgname
where pkgname is the name of the package you wish to install. If the
package is already present, you will see the message "requirement already
satisfied."
[ More Info ]
[/languages/python]
permanent link
Sun, May 13, 2018 9:55 pm
WinPython - Python for Microsoft Windows
If you wish to run
Python on a
Microsoft Windows system, you can use
WinPython.
The first window you will see when run run the downloaded installation file is
one for the license agreement, which notes
"WinPython components are distributed as they were received from their
copyright holder, under their own copyright and/or license, and without any
linking with each other." WinPython itself uses the
MIT
license. Once you accede to the license, you will be prompted for a
destination folder. By default that will be a WinPython directory created
beneath the directory where you're running the downloaded file from,
but you can change the location. When the installation has been
completed, a window will appear where you can click on a Finish
button to exit from the installation program.
[ More Info ]
[/languages/python]
permanent link
Privacy Policy
Contact