iTerm2: What is the best way to compare / diff two panes (like vimdiff)? - compare

I would like to compare two panes in iTerm2, like I can do it in vimdiff.
(Or is it the best way to do it in vimdiff, not using iTerm2 panes??)
– I couldn't find anything in the documentation.
– And how can I search the iTerm documentation – – only with help of Google?

Related

How to draw connections between items in a QTreeView

I wonder how to draw the lines connecting the items in a QTreeView as illustrated in the picture under Tree Model. My program will run on different platforms and thus use different styles. Can I guarantee that the items are drawn as desired?
I feel, using style sheets might be problematic because certain styles do not print such lines and using a delagate might lead me into issues of double drawing.
There's an example in the documentation here showing exactly what you want to achieve using style sheets.
Please note that when you use style sheets QStyleSheetStyle kicks in, irregardless from the QStyle your application is using at the moment. So if you decide to go this way you will override the look and feel of your control the same way, irregardless from the target platform.
If that is a problem, you may consider to use style sheets only for certain platforms. As an example:
#ifdef Q_OS_MAC
myControl->setStyleSheet(":/my_stylesheet_for_mac.qss");
#endif
Back to the example in the documentation, it uses a few images containing all the various lines (vertical, horizontal, branch, etc) and the ::branch subcontrol and its states to determine which image to use.
The result is something like this:
.
Obviously, you must change the code to show the vline picture instead of the arrows.
As a side node, I may suggest to consider why you want to do this if you are using native styles. If your application has a native look and feel, you should not alter it in any way. That is, if the target platform doesn't render lines to connect tree view items, then you shouldn't add those.
However, if your application is not required to look native across all the target platforms, you may consider using the same style (e.g. Fusion) and deliver the same user experience no matter what the platform is.

Google Places API: supported types for tram/cable car/light-rail?

I'm taking my first steps at using Google Places API am currently experimenting with different types. I was wondering, what kind of type I have to use, if I want to search for tram/cable car/light-rails stations?
What I want is get a list of subway, bus and tram stations inside an defined radius for an arbitrary coordinate.
Subway and bus seem to be easy (types=subway_station or types=bus_station) but there does not seem to be an equivalent for trams.
Just for experimenting:
Search for the tram station "Agnes-Bernauer-Platz" at Munich (coordinates: 48.1398418,11.496119, good example because there are not subway or bus stations in direct vicinity.) If you interactively browse Google Maps, the station is found (with a "tram icon"), but Places API does not find it:
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?location=48.1398418,11.496119&radius=100&key=....
Any ideas?
Thanks in advance!
Update:
types=light_rail_station
Ok, it seems there is already a type which is not yet documented at developers.google.com/places/supported_types: types=light_rail_station does the job.

What are SetupAPI,SetupAPI1,and SetupAPI2? And what the difference between them?

Recently,I need to realize a little function in MFC by C++ which is used to get a list of available serial ports. And then I saw this. I need to know what is SetupAPI1 and SetupAPI2? Where can I get the setup.dll when I wanna use this way to realize my function?. During searching the Internet I found there is a SetupAPI but it seems another one. Now, I am really confusing by these SetupAPI, SetupAPI1, and SetupAPI2. What are the differences? Where are they come from? And, how can I get them if I wanna to use these?
There is no such think as SetupAPI1 and SetupAPI2. There is a library named SetupAPI.
This answer you link to refers to a library named EnumSerialPort. From that page:
Internally the code provides 9 different ways (yes you read that right: Nine) of enumerating serial ports: Using CreateFile, QueryDosDevice, GetDefaultCommConfig, two ways using the Setup API, EnumPorts, WMI, Com Database & enumerating the values under the registry key HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM.
...
All of the configuration of the code is controlled by the following preprocessor values: CENUMERATESERIAL_USE_STL, _AFX, NO_ENUMSERIAL_USING_CREATEFILE, NO_ENUMSERIAL_USING_QUERYDOSDEVICE, NO_ENUMSERIAL_USING_GETDEFAULTCOMMCONFIG, NO_ENUMSERIAL_USING_SETUPAPI1, NO_ENUMSERIAL_USING_SETUPAPI2, NO_ENUMSERIAL_USING_ENUMPORTS, NO_ENUMSERIAL_USING_WMI, NO_ENUMSERIAL_USING_COMDB & NO_ENUMSERIAL_USING_REGISTRY.
This library presents two different methods that rely on SetupAPI, and simply numbers them one and two. You can see these details and more by following the links.

How to use OpenStreetMap background on Matplotlib Basemap

This should be simple, but when I look for it I just find web packages. I need something better than as oriented on This Blog. Maybe using .oms file or shapefiles. Some way to give bbox and get the OpenStreetMap background on Basemap map.
I found some questions like this on Stack, but the answers directs to, or download the .png file on OpenStreetMap website, or to use some web package.
I would suggest not to try to make something work, which is not made (yet) to work together.
There is a simple way to achieve what you want with Mplleaflet.
https://github.com/jwass/mplleaflet
The library allows you to visualize geographic data on a beautiful interactive openstreetmap. Map projection of data in long lat format is automatically performed.
Installation in windows and ubuntu is easy:
pip install mplleaflet
You can start with the provided examples and go from there.
There are many libraries today that can do this for you - smopy, folium and tilemapbase are three examples from my recent use.
Each of these tools fetch map tiles from the one of several servers that host OSM or other (Stamen, Carto, etc) map tiles and then allows you to display and plot on them using matplotlib. Tilemapbase also caches the tiles locally so that they are not fetched again the next time.
But there does not seem to be a readily available tool yet, based on my recent experience, to use offline tilesets (such as a compressed .mbtiles file) as background for matplotlib plotting.
This link contains a survey of the above tools and more - https://github.com/ispmarin/maps
EDIT
I had mentioned in my previous answer that Tilemapbase did not work for some geographical locations in the world, and hence explicitly recommended not to use it. But it turns out I was wrong, and I apologize for that. It actually works great! The problem in my case was embarrassingly simple - I had reversed the order or lat and lon while fetching tiles, and hence it always fetched blank tiles for certain geographical locations, leading me to assume that it did not work for those locations.
I had raised the issue in github and it was immediately resolved by the developers. See it here - https://github.com/MatthewDaws/TileMapBase/issues/7
Note the responses:
Coordinates are to be provided in order (1) longitude, (2) latitude. If you copied them from Google Maps, they will be in lat/lon order and you have to flip them. So your map image is not empty, it's just a location in the ocean north of Norway.
And from the developer himself:
Yes, when I wrote the code, it seemed that there wasn't a universal standard for ordering. So I chose the one which is different to Google Maps. The method name from_lonlat should give a hint as to the correct ordering...
For those who are using Cartopy, this is relatively simple:
import matplotlib.pyplot as pl
import numpy as np
import cartopy.crs as ccrs
import cartopy.io.img_tiles as cimgt
request = cimgt.OSM()
# Bounds: (lon_min, lon_max, lat_min, lat_max):
extent = [1, 13, 45, 53]
ax = pl.axes(projection=request.crs)
ax.set_extent(extent)
ax.add_image(request, 5) # 5 = zoom level
# Just some random points/lines:
pl.scatter(4.92, 51.97, transform=ccrs.PlateCarree())
pl.plot([4.92, 9], [51.97, 47], transform=ccrs.PlateCarree())
This produces:
You can download the necessary tiles yourself from one of the tile servers. The OSM wiki explains the technical details behind slippy map tilenames and also includes examples for various programming and scripting languages.
Please also read about the tile usage policy and keep in mind that different tile serves may have different policies.
This is very easy with geopandas and contextily.
Have a look at https://geopandas.org/gallery/plotting_basemap_background.html.

Filter Eclipse's "Open Call Hierarchy" to just my company/project

One of my favorite features of Eclipse is the ability to open a caller/callee hierarchy of a method.
By default, the view shows calls to/from classes that are outside of my codebase... which I don't usually care about.
There is an option to filter out specific package names I don't want, but I need to do the opposite... to filter out all packages except the one I want. What is the appropriate regex to use here to "match all strings except those that start with com.mycompany.?"
I had the same problem lately and exploring the options of the Call Hierarchy led me to the Search In option. It is activated by clicking on the triangle
The filtering options are pretty simple and effective:
It appears that "Filter Calls" uses glob syntax for filter patterns, not regular expressions. You can't specify something that should not match with glob patterns. Sorry.
It is not exactly what you are looking for, but it is an alternate solution. Take a look at nWire for Java. It is a code exploration plugin. Among many other things, it will present the call hierarchy. However, it will only show calls which originate from your own code, so it should fit your needs.
Another approach is to open the 'Type Hierarchy' view's View menu, select 'Select Working Set' and select an existing or new working set that only includes the project you're currently interested in (create one just for this purpose if necessary, e.g. called 'TypeHierarchyFilterWorkingSet').
I just did this using Eclipse Indigo, by the way, not sure whether the other versions have something similar.
After "Open Call Hierarchy" right click on the root of the results and select under "References" or "Declarations" the project you interest in:
One solution (though somewhat brute force) is to remove the other code from Eclipse's reach. Either put them into separate workspaces, or, if you sometimes do need them in one workspace, close the other projects when you don't want to see them.
You could try to add a parameter to the method, than all calls will be shown as error on rebuild.
you could filter out org., net., java.* and so on. This (in my case) reduces the list enormously