Are you over 18 and want to see adult content?
4
More Annotations
2
2
Favourite Annotations
A complete backup of whistleblowersblog.org
whistleblowersblog.org
Are you over 18 and want to see adult content?
5
A complete backup of visitvalencia.com
visitvalencia.com
Are you over 18 and want to see adult content?
A complete backup of advancedenergy.com
advancedenergy.com
Are you over 18 and want to see adult content?
A complete backup of recyclingproductnews.com
recyclingproductnews.com
Are you over 18 and want to see adult content?
A complete backup of nigerianbulletin.com
nigerianbulletin.com
Are you over 18 and want to see adult content?
1
Text
* Michael Hirsch, Ph.D. option option. Since this is a Windows issue, this command is likely inside each response .rsp file used to compile each source code file. Twitter
* About
* Blog
* Tags
* Categories
USE TEXLIVE FROM THE COMMAND LINE31 October, 2019
TeXLive is a well maintained and often updated LaTeX distribution – akin to the idea of a Linux distribution, but TeXLive works for anyOS.
* Download TeXLive net Installerfor your OS and
run. We use the basic scheme. * Try to build a document e.g. like xelatex foo.tex and note theerror messages.
*
find and install needed packages via tlmgr like: * find package by filename: tlmgr search --global --file fullpage.sty * find fonts/packages by name: tlmgr info ieee * install package: tlmgr install lmodern*
install a LaTeX IDE (GUI editor) like TeXstudio* latex
AVOID LOADING WINDOWS PATH INTO WSL30 October, 2019
WSL uses an INI-like configuration file at /etc/wsl.conf.
It’s a bit easier to configure than the Windows Terminalprofiles.json
.
We usually avoid the WSL default of putting the full Windows PATH into WSL. Particularly when using a build system like CMake, there will be Windows libraries that WSL-based CMake thinks it can use that it actually can’t. There are a lot of StackExchange questions on thistopic as well.
There is a trivially-simple fix to this problem. Simple be sure that /etc/wsl.conf includes:enabled=false
appendWindowsPath=false* windows
* windows-subsystem-for-linux* cmake
MAKE A NOTEPAD++ MULTI-WINDOW SHORTCUT29 October, 2019
These techniques allow a Windows development machine to use Notepad++more effectively.
NOTEPAD++ FROM COMMAND LINE Add to the user PATH the binary path of Notepad++ – usually it’s like c:/Program Files/Notepad++ This allows one to use notepad++ from the Windows command prompt. NOTEPAD++ SHORTCUT ICON OPEN A NEW WINDOW When using multiple virtual desktops, it’s very annoying to have Notepad++ snap to the other desktop when clicking the Notepad++ start menu icon. Make the Notepad++ icon open a new Notepad++ window by editing the Notepad++ start menu shortcut, appending -multiInst to the right and outside of the quoted full path to notepad++.exe. That is, the Target field will contain something like: "c:/Program Files/Notepad++/Notepad++.exe" -multiInst* windows
* ide
CMAKE FETCHCONTENT VS. EXTERNALPROJECT28 October, 2019
Generally, using code from external project is better done by the build system e.g. CMake or Meson instead of Git submodules. CMake can bring together code or libraries from multiple projects using CMakefunctionality from:
* ExternalProject
* FetchContent
Let’s discuss the highest-level approach of each. We’ll call the master project “parent” and the other project “child”. Suppose “parent” wants to use “libfoo” from “child”, and that both are CMake projects. The master Fortran project has an executable use_ext.f90 that uses the Fortran module inside a target named ext inchild project.
A live example of this is: https://github.com/scivision/fortran2018-examples/ submodulesdirectory
For reference, Meson subprojects work somewhat like CMakeExternalProject.
EXTERNALPROJECT
ExternalProject populates content from the other project at BUILD time. This means the other project’s libraries are not visible until the master project is built. Thus, after defining the external project, we must add a manual dependency as in: “master” project CMakeLists.txt: cmake_minimum_required(VERSION 3.13) project(master Fortran) include(ExternalProject) ExternalProject_Add(child GIT_REPOSITORY https://github.invalid/username/child.git GIT_TAG master # it's much better to use a specific Git revision or Git tag for reproducibility INSTALL_COMMAND "" # this disables the install step for the external project)
ExternalProject_Get_Property(child BINARY_DIR) set(child_BINARY_DIR ${BINARY_DIR}) # to avoid overwriting value elsewhere add_executable(useext use_ext.f90) add_dependencies(useext child) target_link_directories(useext PRIVATE ${child_BINARY_DIR}) target_link_libraries(useext PRIVATE ext) target_include_directories(useext PRIVATE ${child_BINARY_DIR}) add_test(NAME ExternalSubmodule COMMAND useext) * target_link_directories() is easier than cross-platform specifying the full path * add_dependencies() makes external project always update and build first “child” project CMakeLists.txt: cmake_minimum_required(VERSION 3.13) project(child Fortran) add_library(ext ext.f90) set_target_properties(ext PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}) * set_target_properties(... PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}) avoids having to introspect the directory tree ofthe other project.
FETCHCONTENT
A key distinction from ExternalProject is that FetchContent populates content from the other project at configure timeinstead
of at build time like ExternalProject. FetchContent allows directly using code from the other project in the current project’s CMakeLists.txt: cmake_minimum_required(VERSION 3.11) project(master Fortran) include(FetchContent) FetchContent_Declare(child GIT_REPOSITORY https://github.invalid/username/child.git GIT_TAG master # it's much better to use a specific Git revision or Git tag for reproducibility)
FetchContent_GetProperties(child) if(NOT child_POPULATED) FetchContent_Populate(child) add_subdirectory(${child_SOURCE_DIR} ${child_BINARY_DIR})endif()
add_executable(useext use_ext.f90) target_link_libraries(useext PRIVATE ext) add_test(NAME ExternalSubmodule COMMAND useext) * add_subdirectory() command could be other commands directly using the source code as if it were part of the master CMake project.WHICH ONE TO USE?
A simple way to decide between CMake FetchContent and ExternalProjectis:
* need to use other project code as if it were part of this project:FetchContent
* only need to link other project as a library: ExternalProject* cmake
* cmake
* meson
WINDOWS TERMINAL IS RECOMMENDED FOR DEVS ON WINDOWS PCS26 October, 2019
Since Windows Terminal v0.6 was released,
Windows Terminal is now a useful and welcome addition to any developer working on Windows. It has no prerequisites and works well with multiple WSL distros. The major bugs now fixed include: * ability to scroll left and right through many terminal windows tabs * ability to copy and paste with proper newlines The Windows PC does not have to have a Developer Build of Windows. Just standard Windows 10 1903 (build 18362) or newer is fine, and get Microsoft Terminal from the Microsoft Store. Windows Terminal and associated infrastructure is open source with MIT license. The current plan is to have v1.0 by year-end 2019.* windows
* shell
* powershell
FLIP IMAGE USING COMMAND LINE24 October, 2019
We often find it convenient to flip an image vertically or horizontally using a command line tool. Many programs can do this; we will give examples using ImageMagick and IrfanView. In general, modifying an image in any way including cropping, flipping, rotating, etc. is a lossy process if the image compression algorithm used is lossy such as JPEG. Lossless compression formats such as PNG will remain lossless with this operation. We assume the input image is named “in.png”, while the modified image will be written to “out.png”.IMAGEMAGICK
ImageMagick is a command-line oriented program available for just about any operating system including Windows, Mac and Linux. The order of the commands is important in ImageMagick.VERTICAL FLIP
convert in.png -flip out.pngHORIZONTAL FLIP
convert in.png -flop out.pngIRFANVIEW
IrfanView has been popular for decades on Windows and WINE as a no-cost (not open source) image viewing and simple modification program that handles many formats. IrfanView can also be used from the command line under these conditions (we assume 64-bit Irfanview) * install IrfanView directly, not via the Microsoft App Store. * add to user PATH c:/Program Files/IrfanView The order of the commands is important. These commands do not open the IrfanView GUI–they are “headless” operations. If there are spaces in the file paths, they must be enclosed in quotes like “c:/my pics/in.png”VERTICAL FLIP
i_view64 in.png /vflip /convert=out.pngHORIZONTAL FLIP
i_view64 in.png /hflip /convert=out.png* image-processing
* irfanview
INTEL COMPILER ON WINDOWS BUG WORKAROUNDS22 October, 2019
There is a tension between the Visual Studio point release and Intel compilers on Windows. The issue arises from Visual Studio frequently updating, and Intel compiler falling behind with the Intel compiler to Visual Studio ABI. This can cause strange and unpredictable errors when compiling a C program, for example C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\vcruntime_string.h(18): error: expected an attribute name _NODISCARD _Check_return_WORKAROUND
Intel support notes
that a workaround is to force C++ compiler to be used with the /Tp.
This replaces the usual /c* c-lang
* c
* visual-studio
GOOGLE FI TECHNICAL ASPECTS19 October, 2019
Google Fi is reasonably priced (but not the cheapest), using three LTE carrier + WiFi UMA calling service from Google. Google Fi requires specific phones for full network-switching functionality. UMA WiFi calling as with every carrier does not always have flawless performance. This is not a big issue since Google Fi phones only use UMA if no cellular signal is available. Google Fi is a better value for those with officially compatible network-switching phones.CARRIER SWITCHING
Google Fi phones will typically sit on the preferred carrier in your area. In much of the US, Google Fi phones prefer Sprint. If Sprint signal is lost (e.g. walking into a building) Google Fi switches to the next strongest carrier, which is typically T-Mobile. In rural US areas where Sprint and T-Mobile are weak, US Cellularcoverage
may be used. US Cellular has a mix of 4G and 3G coverage. Google Fi may sit on the preferred carrier (e.g. Sprint) even if say T-Mobile has a much stronger signal. When the preferred carrier signal is lost, Google Fi “roams” to the less preferred carrier. Dialer codes can force Fi phones to a particular carrier for the duration ofa phone call.
COVERAGE
Google Fi publishes a map that is roughly a superposition of their host carriers. I compliment Google Fi coverage map for not exaggerating LTE coveragearea
like many other carriers do. In most of the world , Google Fi uses open WiFi whereavailable
.
* Sprint coverage
* T-Mobile coverage
* US Cellular coverageWIFI CALLING
Google Fi currently behaves with the following descending priority order for VOICE calls: * If any Fi cellular connection available, use cellular (even if Wifialso available)
* If no Fi cellular and connected to WEP/WPA WiFi, use UMA VoIPcalling
* If no Fi cellular and not connected to WiFi but open good WiFi available, use UMA VoIP over VPN. You’ll see a lock symbol in thestatus bar.
VOLTE
VoLTE is being tested on Google Fi.
You can tell if you’re on a VoLTE call by the phone remaining in LTE mode during a call instead of falling back to 3G. Limiting factors to the Google Fi VoLTE rollout include that Sprintand US Cellular
are still working to deploy VoLTE. On the other hand, T-Mobile VoLTEhas
been working fine for over a year, so at this time you need to be in a T-Mobile Google Fi call with a supported device to get VoLTE. You can tell if your Google Fi phone is included in the test by seeing if you have under Settings → Cellular Networks the option for “Enhanced 4G LTE Mode”. If not, you’re not in the VoLTE testyet.
Outside the VoLTE test sites, your phone will fall back to a 2G or 3G connection to make a voice call. This is a disadvantage many phones on many carriers suffer, as often the best coverage by a factor of 10 dB or so is on the 700 / 800 MHz LTE band, yet the phone gets forced to a weak 1.8 / 1.9 GHz signal for voice calls. Many times, the phone will have an 850 MHz 2G / 3G connection available, so the disadvantage is not so large for voice calls vs. LTE. The Google Pixel phones have many LTE bands for generation-leading worldwide LTEcoverage.
NON-OFFICIAL PHONES/WATCHES Google Fi requires a phone with appropriate software to be able to switch between the LTE carriers and VPN-protected Wifi. If you have a non-Google Fi phone, Google Fi defaults to T-Mobile. _Some_ LTE Wear OS smartwatches work with Google Fi .* wireless
* google-fi
INSTALLING LATEX EDITOR IN WINDOWS17 October, 2019
Related: install LaTeX editor on Linux ------------------------- TeXstudio LaTeX GUI in Windows can be used via:* Native Windows
* Windows Subsystem for Linux. TeXstudio needs a LaTeX system – either TeXLive or MiKTeX is fine.NATIVE WINDOWS
Download TexLive or MiKTeXMIKTEX
The default MiKTeX install options are generally fine. MiKTeX by default installs a minimal LaTeX system where needed resources aredownloaded as used.
TEXLIVE
By default TeXLive installs all LaTeX packages–5-10 Gbytes work. Instead, use the scheme “basic” under “Advanced” install options, which takes about 300 Mbytes. You can install other packageslater.
Finally, download and install TeXstudio.
Packages can be added to TeXLive by the Start Menu → TeX Live Manager–under Package List select Status: All. However we often prefer to use tlmgr convenient command line like: * find package by filename: tlmgr search --global --file fullpage.sty * find fonts/packages by name: tlmgr info ieee WINDOWS SUBSYSTEM FOR LINUX Graphical LaTeX editing on Windows can be done via WSL by:* install WSL X11
* install TeXstudio for Linux in WSL .NOTES
ALL THE REFERENCES ARE ?? you need to (re)compile your .bib file by pressing F8 in TeXstudio. Watch for error messages. MIKTEX INSTALL PACKAGE This popup occurs when compiling a new document with packages it uses that you don’t have yet. You can uncheck “ask me each time” if you are comfortable with that and want to stop seeing the popups. FIX “PACKAGE NOT FOUND” * press the Windows key then type Package Manger and click on the MiKTeX icon to open the package manager. * click Repository/Synchronize. * install the missing package.* latex
* windows
* texstudio
* miktex
MAJORITY OF NEW PYTHON WORK IS PYTHON 316 October, 2019
(This post was originally from June 2017, and is periodicallyupdated).
Consider requiring Python ≥ 3.6 for your Python projects. There is considerable additional effort required to support Python ≤ 3.5 in general while using concurrent and other performant Python programming with the latest common modules like Numpy, Xarray,Matplotlib, etc.
PYTHON 3.5 EOL IS SEPTEMBER 2020. Python 3 is used by a large and growing majority of new and active Python developers in science, engineering, medical research and education. Python 3 was released in December 2008. While initially there was pushback over backward incompatibilities, the performance, efficiencies and features of Python 3 have won out over Python 2. Python 2 is obsolete, so it is unwise to continue to put effort into new Python 2 code in general. PYTHON 2 DEPRECATION * Numpy 1.17 requires Python ≥ 3.5 * Matplotlib 3.0 requires Python ≥ 3.5* Xarray
requires Python ≥ 3.6 Major Python data analysis packages used in STEM industry, research and education have already abandoned Python 2, including IPython , AstroPy, SunPy Django and virtually every worthwhile maintained Python module. The most popular Python packages have supported Python 3 for some time now, includingAmazon AWS
and Google Cloud Platform.
Already in 2016, Python 3 was starting to take over in PyCharm IDE: and by May 2017, the majority of PyCharm users were on Python 3: More than 95% of our projects require at least Python 3.6. PyPy supports Python 3.6 syntax. Python projects should generally be written for Python ≥ 3.6, due to the important number of features requiring Python 3.6. The main holdouts in Python 2 code are of the same nature as those that hang on to COBOL systems. Those with static, unchanging requirements in large proprietary codebases that few people are familiar with. Some programmers thrive and make a decent living servicing those legacy COBOL and Python 2 environments. The majority of STEM coders, analysts and educators have been writing Python 3 code. The old Python 2-only and Python 2-first objections were mostly written before 2016 and almost all were before 2017. Some of their complaints were addressed in Python 3.6 (released December 23, 2016). The main outstanding complaint I see over Python 3 is over the separation between bytes and strings. Our work in applications with IoT and embedded systems distinguishes between bytes and strings, so I appreciate the separation of bytes and strings in Python 3. For the global environment I write for, I appreciate that strings are Unicodein Python 3.
EFFICIENCY
Python 3 efficiencies in terms of programmer time come in more efficient syntax. The Python 3 core itself is as much as 10% faster in several aspects, with some standard modules like re processing regular expressions as much as 20x faster. The modernize tool and six and __future__ modules smooth over most of these changes to make Python 2 / 3 compatible code. Some of the most enticing changes from Python ≥ 3.6 are not easily backportable to Python 2.7, however. These features simplify syntax and make the code more self-documenting. Python 2 has many years of cruft bolted in, and that’s a big part of why Python 3 introduced backward incompatibilities, and they are growing with time. The brief list below are just a few Python 3 features that I take advantage of. There are very many more than this that may apply foryou.
ASYNCHRONOUS EXECUTION asyncio has been rapidly maturing since its genesis in Python 3.4. It brings to core Python features that used to require Tornado, twisted, etc. Asynchronous execution is required for applications that need to scale massively. Not just for Facebook, but also IoT applications where remote sensors report in are a perfect use case for asyncio. asyncio is a convenient , relatively safe way to thread, increasingly baked right into Python. Since asyncio continues to develop at speed, you should use the newest version of Python suitable (at least Python 3.6) and ensure the documentation you’re reading is for the version of Python you’re using. {: .alert-box}LRU CACHING
Least-recently used caching is enabled by a decorator to functions. For example, you have a computationally-expensive function where you sometimes use the same arguments, but don’t want to bother tracking the output by saving in a variable. LRU caching is as simple as: from functools import lru_cache @lru_cache(maxsize=None)def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)print()
print(fib.cache_info())>
>
> CacheInfo(hits=28, misses=16, maxsize=None, currsize=16) FACTORY INSTALLED PIP Factory installed pip encourages proper use of setup.py and setuptools instead of one-off non-OS-independent setup scripts. In 2018, pip ≥ 10 can use the simpler pyproject.toml instead of or along with setup.py for Python projects.TYPE HINTING
Python 3.5 added type hinting , which some parsers use to give code warnings, while not actually enforcing strict typing (unlessyou want to).
import math
def 2sinxy(x:float, y:float) -> float: return 2*math.sin(x*y) This function would not crash if you fed int in on most interpreters,but PyCharm IDE
and other can emit warnings when conflicting variable types are passedin/out.
ARGUMENT UNPACKING
Python 3.5 added argument unpacking , where iterables can be fed into functions requiring multiple arguments, expanded with *iterable. Multiple iterables can be unpacked into a single function. OO IPV4/V6 ADDRESSINGipaddress is a
useful standard library feature for manipulating IP addresses, used in the findssh program to scan for active servers in IP address ranges.OO PATH/FILENAME
pathlib is standard library. This gets rid of most awkward os.path functions. F-STRINGS (NO ‘{}’.FORMAT) f-strings from Python 3.6 allow f'This is {weight} kg for {price} dollars. instead of 'This is {} kg for {} dollars'.format(weight,price)PYTHON 3.7
Python 3.7 adds several more compellingreasons to upgrade.
LARGE COMPANIES
Patreon
transitioned from PHP → Python 3 in 2015. Key appeals for Patreon to switch to Python 3 included: * future-proofing * appeal to developer hiring, working with latest language * lower risk than porting to static typed language like Scala ------------------------- Instagram runs fully on Python 3 as noted at the 2017 PyCon Keynote atthe 13 minute mark:
------------------------- Facebook is proud of its ongoing conversion to Python 3 as well, and uses this fact to help recruit top talent. LINUX PYTHON 2 DEMOTION Starting in 2010, Arch Linux defaulted to Python 3. In 2017, Ubuntu 17.10 defaulted to Python 3, and Python 2 had to be manually installed. In 2018, Ubuntu 18.04 cleaned Python 2 from programs in the main Ubuntu repository with default Python 3.6. The goal is to demote Python from the main repository, requiring an extra step to install Python 2 from the “universe” repository. Executable Python scripts should continue to have the first line #!/usr/bin/env python so that users can configure their desired Python version. Many users install a third party Python distribution such as Anaconda Python , PyCharm, Intel Python , etc. that have high performance math libraries such as Cuda-based CuPy .FURTHER READING
* Very detailed notes from Python Software Foundation Fellow Nick Coghlan on why, when, what, how, where of Python 3 transition with fascinating historicalnotes.
* ActiveState
saw majority of downloads being Python 3 since January 2017.* python
Previous
GitHub SciVision, Inc. KeybaseDetails
2
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0