Skip to content

Saturday, 6 August 2022

Are you the C++ experienced reader to solve the following challenge?

Given a class C (edit: covered by binary compatibility needs) with the overloaded methods foo() and foo(A a):

    class C
    {
    public:
        void foo();
        void foo(A a);
    };

Now you want to add an overload, to serve further use-cases as requested by API consumers, and going for another overload matches your API guidelines :

        void foo(B b);

But there is existing consumer code, making use of C++17, which calls

    C c;
    c.foo({});

So the new overload will not be source-compatible and break existing code, due to the ambiguity whether {} should be turned into an instance of A or B.

What could be done about this?

The goals here would be:

  1. to enable API consumers to write code which works as if there are the two old and the one new overloads declared
  2. any calls using the {} expression as argument are resolved to a method which emits a compiler warning to avoid that ambiguous argument and which on any next compatibility breaking occasion can be simply removed

While asking around, some approaches have been proposed, but so far none could satisfy the second goal, catching existing ambiguous argument expressions to hint API consumers to adapt them.

Would you have an idea?

Edit: Note that we cannot change A or B (might be types/classes from elsewhere), and only can add new API to C, due to binary compatibility needs.

Edit: On a second thought, similar problems also exist before C++17 already when an argument has a type which can be implicitly converted both to A and B, by implicit constructors or type operator methods.

Hello and welcome to my second GSOC update! I think I these last few weeks have been really productive in fixing some issues with my code and getting some direction in the next steps for my project. If you remember last time we had just figured out how to get the SVG option to appear in Krita so we can start testing out saving a test SVG file. We were getting a few errors actually trying to use that option and save the file but those should be all fixed now.

Firstly we were getting a Permission denied: Krita is not allowed to read the file. error when actually trying to save with SVG. At first I thought this was due to how I was trying to use the svgWriter class. The svgWriter assumes that we are only getting to export one layer (the current one) so I thought by trying to save in the context of the whole file, that was tripping it up somehow. After doing some investigation and tracing all the steps in the code this didn’t seem to be the issue.

Hmmmm alright so since my intitial assumption was incorrect lets try starting from the beginning with whats actually producing this error? Well turns out it is from the fail of the check !io->isReadable(). Is this the correct way to check if a file is readable? Well comparing to the check used in an example commit (from amyspark) it seems to use a different method to check if the file is writeable KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(io->isWritable(), ImportExportCodes::NoAccessToWrite);. Thats interesting, lets try commenting our check and see if the file gets created or Krita crashes, either way we’ll get some valuable information. After trying that it the file gets created! An empty file but thats exactly what we expected. Now we’ll replace my incorrect check with the right one.

Next step is get the boilerplate SVG file context written to our empty file. After some investigation it seems like all of the SVG writer code does get executed properly and it does try to write to the file but something is missing. Even when passing the same layer contents to svgWriter it still doesn’t write to that file. Well to make a long story short it turns out you have to actually pass your IO device if you want to actually write to it/use it. After changing my code to pass the current QIODevice it was properly writing to the file!

After figuring out those issues I had a discussion with Wolthera around the next steps for my project. We talked about how I was going to traverse the layers of the Krita file as I was writing to my SVG file. At first I thinking about writing entirely new code, reading the document, and going through layer by layer but then Wolthera introduced me to the intended way to do this process. Namely, by making an implementation for the KisNodeVisitor class that would handle traversing the layers. Instead of trying to re-invent the wheel I can use the standard way Krita accesses file. I started working on that implementation late last week so I’m still figuring out all the details on how it works. Hopefully I’ll be able to talk about my making that next week.

Thanks for tuning in!

Friday, 5 August 2022

Let’s go for my web review for the week 2022-31.


How far can you go by train in 5h?

Tags: tech, train, map

Very cool map. Definitely useful tool to push for more train use.

https://chronotrains-eu.vercel.app/


Remote attestation is coming back. How much freedom will it take? – Gabriel Sieben

Tags: tech, microsoft, vendor-lockin, surveillance, security

Palladium is coming back and it’s not good news in my opinion.

https://gabrielsieben.tech/2022/07/29/remote-assertion-is-coming-back-how-much-freedom-will-it-take/


How Tor is fighting—and beating—Russian censorship | Ars Technica

Tags: tech, tor, security, censorship

It’s nice to see Tor is still winning even in difficult countries.

https://arstechnica.com/information-technology/2022/07/how-tor-is-fighting-and-beating-russian-censorship/


The OG Social Network: Other People’s Websites - Jim Nielsen’s Blog

Tags: tech, google, search, attention-economy, advertisement, open-access, web

The paradox of how walled gardens could kill search engines in the end. I’m not too concerned for Google in practice though, it’s been a long time since it’s an ad agency and not a search engine, and they’ll always have something to advertise…

https://blog.jim-nielsen.com/2022/other-peoples-websites/


Use One Big Server - Speculative Branches

Tags: tech, infrastructure, cloud, services

This is definitely a good musing on when not to go for “cloudy architectures”. Most often people don’t really need it, this needs to be properly thought out for each project. There are costs involved which you might not make sense to pay for in your context.

https://specbranch.com/posts/one-big-server/


The Slotted Counter Pattern

Tags: tech, design, databases

Nice little database pattern to avoid row contention with counters.

https://planetscale.com/blog/the-slotted-counter-pattern


Manifold

Tags: tech, java

This looks like an interesting set of extensions for Java projects. Unsure if it’s been properly battle tested yet. Likely need that before being really advisable.

http://manifold.systems/


Unlocking type-safety superpowers in Typescript with nominal and refinement types

Tags: tech, typescript, type-systems

That’s an intersecting Typescript pattern to get to nominal and refinement types despite the fact they lack from the language.

https://zackoverflow.dev/writing/nominal-and-refinement-types-typescript



Bye for now!

While testing my merge request, Tobias spotted that NeoChat was making multiple requests to the /hierarchy API endpoint. The requests were actually being spammed to the server.

So I was suggested to separate the Space hierarchy caching functionality to a separate class itself.

The work was mostly about refactoring. Code was already existing in a different class. I moved it to the new SpaceHierarchyCache class and edited it to glue in properly.

getRoomListForSpace() in SpaceHierarchyCache accepts a space id, and returns a list of rooms id that belong to the space. This function is exposed in QML and used to populate SortFilterRoomListModel:: m_activeSpaceRooms whenever user clicks a Space icon.

Rest of the implementation is mostly similar to what was earlier scattered through SortFilterRoomListModel.

The code is currently on a separate branch on my fork so that my mentors can check if it looks and works right. If they say its fine, I'll add the code to my open merge request.

PS. Its my birthday today :)

Thursday, 4 August 2022

I’ve gotten annoyed with the inability to manage system files so I’ve made a KIO worker that enables Dolphin to view and edit files as root.

This is dolphin viewing the system root with administrative access.

The way this works is actually fairly exciting. It’s pulling off worker chaining: The admin worker itself contains gloriously little logic, all it does is translate all worker calls to dbus calls, and those dbus calls go out to a privileged polkit helper. The polkit helper then translates the URIs from admin:///foo to file:///foo and uses the regular KIO API to recreate the request in root-scope. KIO then, behind the scenes, acts just like it would in dolphin proper, using the existing file worker code to execute the file operations.

The advantages are amazing! It’s fairly little actual code (albeit a lot of boilerplate). Since it’s an ordinary worker on the Dolphin side we can expect all file operations to just work™ because really admin:// is just like trash:// or desktop://. Because ultimately the file worker is actually in charge of doing the work, all things are generally expected to work (it’s the same code that powers regular file operations).

Disadvantageously it’s a fair large portal into root-scope, meaning the worker should really only be used in trusted environments (e.g. with only sandboxed applications on the system ;)). Even with polkit guarding the entrance, once you have given permissions you have to trust the application (e.g. dolphin) to not get exploited.

“But why a dedicated worker instead of integrated polkit support in the file worker?” Why, I’m glad you asked! Integrated polkit support sounds simple but is really rocket science. For example there is currently no good architectural way to “catch” operations that had gone wrong - you try to copy a file to `/srv` and that fails with 🤖PERMISSION DENIED🤖 but there is no consistent way to then go “well, let’s retry this entire operation with privileges then” so without huge code refactoring first, we’d end up tucking fallback logic onto every which error scenario… it’s messy and also easy to miss or mess up edge cases. There are also user experience problems. You’d not want to have every internal operation require dedicated permission, so you kind of have to bundle them up and then request permission for the bundle; but how do you know when a bundle is complete? It’s really frightfully complicated.

In conclusion admin:// is awesome today. Maybe one day integrated polkit will also be awesome.

Reviews and testing appreciated https://invent.kde.org/sitter/kio-admin (mind the readme - this currently wants some patching elsewhere in the stack).

The process of selecting the new KDE Goals is ongoing, and after finishing the submission stage we now have 11 proposals.

As you might see in the workboard, they are in the “Not ready for voting” column. This is because even though they have successfully been created according to the template, there is still much to do before the voting starts.

Right now we are in the Refinement stage, which lasts until August 27th. But what is the purpose of this stage?

The point is to shape each proposal into its best possible version. This is the moment to work on the proposal with a larger audience, seek feedback and gather people that would be interested in participating in the Goal.

Konqi is ready to work on stuff.

I encourage everyone in the community – newcomers and veterans – to look through the proposals and voice your opinions. If you find a proposal that you like and needs some work, be sure to suggest changes. You can help refine any number of proposals. If you want to show support for a Goal proposal in a visible way, each entry should have a “Interest” section at the bottom – you can add your name there.

Some things to consider when refining the Goals:

  • The name of the Goal should be attractive, not very long, and clearly state what is it about. It will be easier to vote for a Goal that has clear steps of how it will be achieved. The more concrete plan is formulated, the better it will look.
  • Ambitious Goals are good, but keep them in the realm of possibility. A selected Goal will be in focus for the community for ~2 years, the community expects major parts of the Goal to be completed in that time AND visible progress to be made on an ongoing basis.
  • And of course, the Goal needs to serve the KDE community :)

With all of that in mind, I again encourage you to look at the current proposals and start refining!

Sunday, 31 July 2022

Second issue about the progress on rolisteam.

1. Mindmap

When I wrote down a story for a TTRPG game, I always find useful to draw an interaction diagram. It’s the best way to get an overview of the story really quickly. First, it was on blocknotes, then I wish for a better tool and I designed it.

For a overnight game, this is how a mindmap looks: image

Now, we decided to add this rmindmap into rolisteam. The original tool has received several versions and implementation about diagram style and technology.

Adding QML mindmap into rolisteam

Let’s talk about technical aspect here. The main difference between the stand-alone version and the mindmap inside rolisteam is that in rolisteam, some components have to follow some APi.

image

Basically, MediaControllerBase is the low-level api that every media controller shares. You share an image on rolisteam, there is an ImageController which extends from MediaControllerBase. And it is the case for every media: Charactersheet, virtual map, Notes…

MediaControllerBase stores all data required for identifying the media (Uuid, name…) and it also stored data to describe the permission context: the owner, the gamemaster, and does this controller is a remote version or the original one.

Then, you have the MindMapControllerBase which provided the mindmap API, such as adding nodes, links, packages, remove them, manage the selection and so on. This code is mainly from the original stand-alone software rmindmap.

Then, the last layer: MindMapController. This class takes in charge any specific behaviour or feature for mindmap into rolisteam. The mindmap is the second media to have a permission selector. Users will be able to share in read-only mode or read-write mode to everyone or to some selected people.

Features:

  • Add node
  • Customize node: text, description, tags and style
  • Add picture to node (drag and drop or contextual menu)
  • Default style
  • Editable link label
  • (Activate/Disactive) Automatic spacing
  • Add Packages
  • Dark mode
  • Realtime small view, the visible part on the mindmap is marked with a blue rectangle
  • Export in png
  • hide/show link label
  • Search for node based on tags, name or description
  • Show/Hide children node
  • Reparenting
  • Add link
  • Undo/Redo
  • Zoom in/out
  • Automatic save

Demo: From nothing

image

Demo: The big one

image

2. Image in instant messaging

We implement a small feature on the instant messaging. If you copy/paste a link to image. The url is replaced by the image.

image

Other urls (to website or other kind of format), the link is clickable.

3. Upnp class

Some users have difficulties to configure their network device at home to host games.
Then, we create a simple QObject to open network port and forward it to the rolisteam server. In rolisteam, the object will only be used on server side.

You can find the implementation here It is already integrated into rolisteam. Some improvements can be done, of course. But it works on our side. Feel free to test it on your side and give us feedback.
There is a unit test to run. The unit test does exactly what we are doing in rolisteam.

4. Translation scripts for KDE

As you may know, rolisteam is now part of KDE. We are trying to enjoy that new status. One way to do it, it’s to change the way rolisteam is translated. The KDE project has huge translation team and they are really efficient.
On project side, when you want your application to be translated. You have to provide a script that extract all texts. We made this script for DiceParser, and it is now ready for rolisteam.

5. Work for August

  • Finish Mindmap
  • keep working on Vectorial map
  • See network status for mindmap and vectorial map

Hi everyone! In this blog, I will be discussing the algorithm used in Bismuth to find the closest relative window to be focused for focusWindowByDirection event. If you haven’t read the previous blog, make sure to give it a read here.

Recap from the previous blog

Let’s start with a quick recap though, in the previous blog, we discussed:

focusWindowByDirection requires the following information:

  • direction (from the user) - can be one of: right, left, top/up, bottom/down.
  • activeWindow (from the current session) - this is needed since focusWindowByDirection event is a relative event to your current focused window.
  • Neighbor window candidates (neighborCandidates) to your current window (activeWindow) and the given direction (direction).
// declaration
std::vector<Window> Engine::getNeighborCandidates(const FocusDirection &direction, const Window &basisWindow);

// use
std::vector<Window> neighborCandidates = getNeighborCandidates(direction, basisWindow);
  • From these neighbor candidates (neighborCandidates), we will now find the closest relative window corner. To me, it was tricky to understand at first, so we’ll be discussing this in detail over in the later sections.
  • Once we know the closest relative window corner, we’ll try to find the window which satisfies the corner condition.
  • If there were multiple found, we’ll return the first one based on the time-stamp (last used)

Understanding the scenario

I want to start off with a visual, took me some time to draw it, but in case it doesn’t look good, I’m sorry! My drawing teacher in the high school tried his best, but…

Saturday, 30 July 2022

KStars v3.6.0 is released on 2022.07.30 for MacOS, Linux, and Windows. It's a bi-monthly bugfix release with a couple of exciting features.

Linear 1 Pass Algorithm

John Evans contributed a new Focus algorithm: The Linear 1 Pass Algorithm. When using this algorithm, Ekos initially performs like the Linear algorithm in establishing the first pass V-Curve and fitting a curve to it to find the solution. Then, however, it moves directly to the calculated minimum. Key features include:

  • The algorithm compensates for focuser backlash, providing that backlash is consistent.

  • The algorithm is fast, taking 1 pass to identify optimum focus.

  • The algorithm uses more sophisticated curve fitting to pinpoint the optimum focus position.

  • The algorithm is highly configurable with user control over many parameters like step size and number of steps.




Early tests by various users shows very promising and stable results

Polar-alignment V3


Hy Murveit introduced a new Polar Alignment method based of plate solving. The original polar-alignment error measurement scheme has not changed. The user interface has changed slightly--different messages and a new LED display to indicate progress.

The original polar-alignment refresh/correction method still exists (if you choose the MoveStar or MoveStar & Cal Err refresh methods).

A new polar-alignment refresh/correction method is provided called PlateSolve. It allows for corrections of larger polar-misalignment in a single pass, does not depend on the image display, and may be more reliable if your plate solving is working well.

A new alternative to MoveStar is the PlateSolve method. This can polar align mounts with larger alignment errors in a single procedure. A similar triangle is displayed on the image display, but it is not central to this scheme. 


Rather the user should concentrate on the Updated Error line at the bottom of the display, and attempt to zero the Altitude and Azimuth errors. Also, arrows display the direction the mount needs to move to reduce error.

The method works by plate-solving images as they are captured, and then estimating the user's knob-adjustments from the plate-solve solutions. Note that, since knobs may be moved during exposures, some images may have large star trails and plate solves may fail. Be patient and allow the system to capture a clean image before relying on the error estimate. 

Image ROI Statistics


Madhav Prabhu made his first contribution to KStars by adding Region-Of-Interest (ROI) selection in FITS viewer where users may view statistics for a particular region of the image. The stats include average, median, and standard deviation.



You can select from existing probes of varying sizes (50x50, 100x100..etc), or you can simply hold down the Shift key and drag the mouse to create your own rectangle.

Profile Scripts


For complex equipment profile that have inter-dependencies requiring script execution or programmable delays, the new Script Profile edit provides complete control over the driver startup sequence.


You may define a Pre-Delay and Pre-Script before a driver is executed (e.g. script to turn on the observatory electricity), and define a Post driver delay and script if desired. For some drivers like Pegasus Ultimate Power Box, it is often desirable to start this driver before other drivers so that all configuration is loaded.

Geographic Map Update


Ed Lee made his first contribution to KStars by replacing the old geographic map from a new high quality version from NASA. This should play more nicely on larger monitors and high DPI displays.

Misc. Updates


Small but important quality of life improvements to KStars & Ekos.
  • Hy Murveit Show number of clipped pixels on fitsviewer status bar if show-clipping is enabled
  • Akarsh Simha Improve the manual focus dialog for the SkyMap
  • Sophie Taylor Correct nomenclature for Linear1 focus algorithm with "R2" -> "R²", and add a default and minimum value for R² limit
  • Akarsh Simha Further improvements to Add Catalog Object UI, including auto-filling data from text.
  • Sophie Taylor Improve tooltips for GPG expert settings
  • Akarsh Simha Various fixes and improvements related to DSO catalogs and visibility.
  • Akarsh Simha Refactor `DmsBox` widget and improve the Add Catalog Object form.

This is a maintenance release as part of the ongoing effort to support our users and fix bugs and annoyances. If you think you can support the project with some code changes or your artistic or writing talent, please take a look at the some low hanging fruits at the KMyMoney junior job list. Any contribution is welcome.

Despite the ongoing permanent testing we understand that some bugs may have slipped past our best efforts. If you find one of them, please forgive us, and be sure to report it, either to the mailing list or on bugs.kde.org.

The details

critical

  • 432380 Appimage unable to print reports

major

  • 426161 Duplicating an investment transaction also duplicates a matched but not accepted transaction in the brokerage account with original not the new date on the matched transaction
  • 447025 Calculation of the balance is incorrect for future balances

crash

  • 445458 Investment Cap Gains by Account (Customized) crashes with my dataset. Changing the date of one ledger entry fixes the crash.
  • 450016 Attempting KMyMoney 5.0.8 “Currencies” Maintenance, Application Crash
  • 451677 crashes on new category with a double colon

normal

  • 223708 Closed accounts are not hidden in accounts/categories view
  • 411272 Not saving changes to Shortcuts
  • 424303 Export report as csv file gives a html file
  • 425333 no pre-defined account templates on a mac
  • 428156 OFX import goes to the wrong account
  • 435866 No ledger icon in the pane of the left side
  • 439287 Home view is missing styling
  • 439722 Equities are shown with currencies in new account dialog
  • 439819 Issue with changing credit card limits
  • 439861 Rounding error on investment transactions
  • 440060 Icons are missing on Linux if Breeze icon theme shipped by the bistro is older than 5.81
  • 440111 Tags/Payees Double Enter
  • 440476 Can not update stock price manually
  • 440500 Stock wizard shows online source that no longer exist
  • 440681 Currency list not sorted with locale awareness in the new account wizard
  • 440692 When importing OFX, the OK and Skip buttons are reversed
  • 440695 Unable to inspect the Splits when account is closed.
  • 441292 Impossible to paste into calculator widget
  • 443208 Build failure with aqbanking 6.3.2
  • 444414 Transaction notes are not imported from paypal account
  • 445472 Stock split transactions can cause rounding problems
  • 446990 Wayland: Tooltip on date input fields steals focus, prevents entering data
  • 451891 Setting the payee matching to exact name is not persistent
  • 452068 kmymoney complains about “GPG no secure keyring found”
  • 452497 Scheduled transactions: “Next due date”, “Number remaining” and “Date of final” do not always update in step
  • 452616 Missing transaction information
  • 452720 Provide feature to rename existing loan accounts
  • 452918 Payee > Account Numbers > IBAN does not accept pasted content with a space at the start
  • 456520 OFX import broken upstream

minor

  • 440736 In “New Account” wizard, Enter key does not work on “Parent account” page
  • 441296 Fields in Exchange Rate/Price Editor misaligned
  • 441937 Default cash flow report: Name does not match date range
  • 448013 Unresponsive UI elements in “New File Setup” > “Select Accounts”
  • 452863 New file setup wizard: UK VAT Accounts produces “invalid top-level account type” error

wishlist

  • 399685 add match strings as well as name from deleted payee to new payee
  • 424377 Change default matching behavior for new payees to “match on exact payee name”
  • 440586 When exporting a report, the file name (suggested) takes the report name
  • 441581 When “Amount” at ledgers get the focus by click, select the entire value
  • 444262 Date picker, frequency and process schedule at last day of the month should interact
  • 447480 Allow currencies to be divisible by more than ten decimal places
  • 450965 Please add Functionality to Scheduled Transactions
  • 453922 Decimal and thousands separators in ordinate axis labels are missing

A complete description of all changes can be found in the ChangeLog.