How do i uninstall kde packages with unmet dependencies?

Question: I recently tried downloading from the software centre when I was greeted with this message:

I then tried removing everything kde from ubuntu in the terminal but this is what happens:
sudo apt-get install ppa-purge
[sudo] password for t:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 kde-telepathy-minimal : Depends: kde-config-telepathy-accounts (>= 15.04.0) but it is not going to be installed
 ppa-purge : Depends: aptitude (>= 0.6.6-1ubuntu1.2)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).]

Ubuntu software centre gives this message:
The following packages have unmet dependencies:

kde-telepathy-minimal: Depends: kde-config-telepathy-accounts (>= 15.04.0) but it is not installed
                       Depends: telepathy-connection-manager but it is a virtual package
                       Depends: telepathy-mission-control-5 (>= 1:5.12) but 1:5.16.3-1ubuntu4 is installed

This is not allowing me to install or remove anything!!! I'm not quite advanced at linux so any help will be appreciated. apt-get install -f did not work, by the way. I've even tried bleachbit, to no avail. At this point I just want to get rid of kde completely.
I installed it using these commands:
sudo add-apt-repository ppa:kubuntu-ppa/backports
 sudo apt-get update
 sudo apt-get dist-upgrade
 sudo apt-get install kubuntu-desktop

for removal they list these commands which wouldn't work because of broken packages:
 sudo apt-get install ppa-purge
 sudo ppa-purge ppa:kubuntu-ppa/backports
 sudo apt-get remove kubuntu-desktop

Answer: Download the needed package and force the installation:
apt-get download ppa-purge
sudo dpkg -i --force-all ppa-purge*.deb

Purge the PPA and the desktop, as you say in your question:
sudo ppa-purge ppa:kubuntu-ppa/backports
sudo apt-get remove kubuntu-desktop

Perhaps not necessary but also not a bad idea:
sudo apt-get install -f


How do I get a byte[] of the camera frame in unity?

Question: I am relatively new to Unity. I was wondering how I could get the byte[] frame of the virtual main camera in Unity.
I couldn't find any tutorials online?
Comment: This likely isn't possible in most cases. The problem is that the GPU renders the scene, and then itself outputs to the screen in many cases. There are ways to capture it but it can be slow. There is probably a better way to do what you want to do.
Comment: What is the reason for the capture? If it's for a screenshot, you can simply use https://docs.unity3d.com/2023.2/Documentation/ScriptReference/ScreenCapture.CaptureScreenshot.html
Answer: You can use RenderTexture for this:

Create render texture
Set it as target texture
Render the current camera view to this texture
Set the camera's render texture to null if it is not needed
Create Texture2d
Read data to the created Texture2d (example can be found here)
Get bytes from your Texture2d


Is there a difference between domination league and standard league?

Question: My friend created a character in "domination league", while I am in the standard one.
I want to play with my friend, but we can't because we're in different leagues (ocurrs when you want to create a party).
Now, what's the difference playing "domination league" and "standard league"?
Answer: The Domination League is a 4 month long league (started about a week ago) which is a softcore league (if your character dies, you lose XP, but you don't lose the character).
The difference between it and Standard League besides the 4 month limit is that domination contains shrines that spawn with mobs surrounding it, gaining it's buff. Tagging the shrine gives the player the buff instead.
The Domination League has a fresh new economy, so the prices so various items are quite different from the Standard League, which has been heavily inflated and altered since it first came out (it's been almost a year).
The Domination League also allows players to complete Challenges, completing all within the 4 month period gets you a reward. Some of the Challenges are specific to the Nemesis League though so it's not completely obtainable through just the Domination League.
You cannot play a Standard League character in the Domination League, but, at the end of the 4 month period, all Domination League characters are moved into the Standard League.
Answer: It sounds like you mean the Domination league rather than the Dominion League. According to the wiki:

Domination: A variety of powerful shrines spawn along with large
  groups of monsters that receive powerful buffs from the shrine. If you
  get close to a shrine and "tag" it, you receive the shrine's bonuses
  for a short time.


Are all finite dimensional hilbert spaces isomorphic to spaces with Euclidean norms?

Question: I have read that Hilbert spaces generalize Euclidean spaces to infinite dimensions.
This suggests to me that any finite dimensional Hilbert space is isomorphic to a space with the norm $||v||=\sqrt {v_1^2 +...+v_n^2}$. Is this true? If not, then it seems it is wrong to say that Hilbert spaces generalize Euclidean spaces to infinite dimensions (i.e. they would be more general than that).
Comment: Are you familiar with Gram-Schmidt orthonormalization? Given an arbitrary basis of a finite dimensional inner product space, the procedure generates an orthonormal basis, i.e. one with respect to which the inner product is the usual Euclidean one (the dot product). Given such a basis, it should be clear how to get an isometry (the natural notion of isomorphism for inner product spaces) from any finite dimensional inner product space to $\mathbb{R}^n$ equipped with the dot product.
Comment: @jawheele, do you mean hilbert space rather than inner product space? I can't see how that would be an isomorphism from an arbitrary finite inner product space that is *incomplete*, to $R^n$ with the dot product.
Comment: The existence of the above isomorphism is actually a proof that every finite dimensional inner product space is complete, and it is true more generally that every finite dimensional normed vector space is complete.
Answer: If we are given an inner product on a finite dimensional space, there will always be a change of basis that turns the given inner product into the Euclidean one.
By definition the product $(\cdot,\cdot)$ can be represented as a symmetric positive-definite matrix $A$ such that $(x,y) = x^T A y$. Now by the spectral theorem (which you probably learnt in Linear Algebra) the matrix $A$ has an orthogonal basis of eigenvectors. In other words there is an orthogonal matrix $M$ such that $J = M^TAM$ is diagonal. That means $(x,y) = x^T M^TJ My = (Mx)^TJ(My)$.
Exercise: Use positive-definiteness to prove $J$ has only positive diagonal entries $\lambda_1,\lambda_2,\ldots,\lambda_n$.
It follows there is a further diagonal matrix $L$ such that $J=LIL = L^TIL$. That gives $$(x,y) = (Mx)^TL^TIL(My)= (LMx)^T(LMy)$$
Put another way, for each $x,y$ we have
$$\big(\,(LM)^{-1}x,(LM)^{-1}y\, \big) = x^T y$$
That means the given product is the Euclidean product with respect to the basis with transition matrix $LM$.
Answer: It is true in multiple ways. You have to distinguish between algebraic and tological isomorphy.
Let us consider vector spaces over $\mathbb{R}$, the case for $\mathbb{C}$ is analogous. First, realize, that any real vector space $V$ of dimension $n$ is (algebraically) isomorphic to $\mathbb{R}^n$. To see the isomorphism, one can choose an arbitrary base
$$ b_1, ..., b_n \in V$$
of $V$ and then define the mapping
$$ V \ni v \mapsto (\text{coordinates of v with respect to $b_1,...,b_n$}) \in \mathbb{R}^n \quad (\dagger).$$
It is not hard to show, that this is a bijection as well as a vector space homomorphism.
So every finite dimensional real vector space V is algebraically isomorphic to $\mathbb{R}^n$.
Morever, every Hilbert space of dimension $n$ is topologically isomorphic to $\mathbb{R}^n$ (where the topology on $H$ is induced by the scalar product of $H$). To see this, realize that $(\dagger)$ is a continuous bijection with continuous inverse and therefore a topological isomorphism.
Answer: Any Euclidean space is Hilbert space, so Hilbert spaces generalize Euclidean. But Euclidean space isn't just a finite dimensional linear space, it's a finite dimensional linear space with additional structure - either inner product, or norm that satisfies parallelogram law.
Such structure can be introduced on any finite dimensional space, so any finite dimensional space is isomorphic to some Euclidean as linear space.
Comment: I'm not sure what linear spaces have to do with this? Do you mean this: https://en.wikipedia.org/wiki/Linear_space_(geometry)? It seems like a very different formalization than norm/metric/inner product based formalizations.
Comment: I meant usual vector spaces (they are also called linear spaces sometime). Did you mean something different in question text? ("any finite dimensional linear spaces")
Comment: whoops that should have been "hilbert space". Typo, sorry!


php soap: how to get it to generate <soap:Envelope instead of <SOAP-ENV:Envelope?

Question: I'm new at this, and have been poring through forums trying to figure out how to use PHP's soap.
I'm going to pull my hair out soon!
spend a gazillion years trying to figure out how to generate this header.
<AutenticationToken>
      <Username>admin</Username>
      <Password>123456</Password>
   </AutenticationToken>

ended up using this:
$sh_param = "<AutenticationToken><Username>admin</Username><Password>123456</Password></AutenticationToken>";
$auth = new SoapVar($sh_param, XSD_ANYXML, null, null, null);
$headers = new SoapHeader($wdsl, 'AuthenticationToken', $auth);

it keeps generating the 'ns' like this ->  when i use this method.
<ns2:AuthenticationToken>
  <item>
   <key>Username</key>
   <value>admin</value>
  </item>
  <item>
   <key>Password</key>
   <value>123456</value>
  </item>
</ns2:AuthenticationToken>

$sh_param = array(
                    'Username'    =>    'admin',
                    'Password'    =>    '123456');
 $headers = new SoapHeader($wsdl, 'AuthenticationToken', $sh_param);

now i need to get it to change from <soap:Envelope to <SOAP-ENV:Envelope  .
Help!
Answer: class SOAPStruct
{
function __construct($user, $pass)
{
    $this->Username = $user;
    $this->Password = $pass;
}

}
//set username and password
$auth = new SOAPStruct("admin","123456");

//soap header object
$header = new SoapHeader("http://gateway.asiagategroup.com/","AutenticationToken",$auth,false);
$client->__setSoapHeaders($header);

Hope this will resolve your problem


Window get transparent

Question: I'm using Xubuntu 14.04, after changing display from external screen to internal in my laptop my Firefox window get a little bit transparent.
The only one window which I set to have transparency is "xfce4-terminal 0.6.3", by it's own configuration. I didn't play with transparency of any other programs or system settings, if there is any.
The same kind of strange transparency has been before few times with Nautilus window.

Why is it happen? Where can I adjust and play with these settings of transparency, or is it just a strange bug? If so, where and how can I report this bug?
After reboot everything goes back to normal.
Answer: Looks like a bug, but you can try to play with this Settings:

You can report a bug here https://bugzilla.xfce.org/buglist.cgi?component=Decorations&product=Xfwm4&resolution=---
Answer: I do believe that is not a bug , but a feature in xfce where , when you scroll down on the titlebar of a window , the opacity of the window decreases .
To revert this just scroll up on the title bar to increase opacity.
Hope it helps. !!
Answer: Thank you for reporting that.
I have had this problem two (maybe three) times.
Though unsure, I think something flickered when problem occurred.  It's so quick and unexpected it's hard to tell what happened.  May look like when xfwm is restarted (unsure). Anyway:

The first time I worked around it by closing the affected window.
The second time closing the window was not an option. I opened a terminal and typed
xfwm4 --replace &

You may just press Alt-F2 and type xfwm4 --replace there.
The first time, I wondered if I Accidentally some key shortcut I was unaware of.
Tuknutx may be right in suspecting a bug in xfwm.

Window get transparent


How hive manage the Non-Tez and Non-MapReduce based queries

Question: Create table t1(id int)

I was firing above query on Hive 2.3.6 (MapR Hadoop Distribution 6.3.0).
Default hive engine was tez.
So after firing the query I was not able to see any TEZ application is launched on the yarn resource manager web ui
So I've changed the execution engine to MapReduce.
set hive.execution.engine=mr

And tried to run the same query again.
Same I was not able to see any MR application was launched on the yarn resource manager web ui
So my questions are how hive manage such types of queries?
And where the details of this queries are stored like application id, start time so on?
Answer: create table - is a metadata operation only, data is not being processed. It creates records in the metastore database, no distributed processing framework like Tez or MR is necessary for this, Yarn is not used.
Compiler translates DDL to the metastore query only if possible.
Also some simple DQL queries can be executed as metastore only if statistics exists and this feature is enabled: https://stackoverflow.com/a/41021682/2700344, without using Tez or MR.
Also small tables can be queried without distributed framework, using fetch-only task, see this: Why is Fetch task in Hive works faster than Map-only task?
Comment: Thanks.
Can we extract those metastore only queries via any API or from HDFS location?
Comment: @Pash0002 Please explain what do you mean? There are some APIs: https://cwiki.apache.org/confluence/display/Hive/Hive+APIs+Overview Also depending on the distribution/ vendor you may have additional APIs like provided by Qubole, AWS and others
Comment: Like for MapReduce and Tez we have the job history server and timeline server REST API respectively. So for the fetch task queries do we have any API?
Comment: @Pash0002 I'm not sure is it possible to monitor fetch-only task, it is just `cat` command, no map-reduce involved... But Cloudera says that fetch-only task s log is available on HiveServer https://docs.cloudera.com/cdp-private-cloud-base/7.1.6/managing-hive/topics/hive_query_progress.html


What are the requirements for fire doors in homes?

Question: A family member is having some major remodeling planned on an end-terraced house. The builder's plans apparently are calling for fire doors on essentially every interior doorway - bathrooms, bedrooms, kitchen, any other partition between rooms, etc.
I've seen the type of door and it feels quite solid, has a sealing strip around it, and and auto-close mechanism (spring?). They certainly seem fit for purpose but are also: expensive, somewhat difficult to operate, noisy, and sometimes seem almost hazardous because of the auto-close. Aside from annoyances a concern is how well elderly people will be able to handle them.
Are fire doors actually required for ALL interior doorways? I can see the logic for specific areas like the kitchen, but on small bathrooms (for instance) its hard to see the rationale.
I'd like to understand what are the actual legal requirements / building regulations so that we can understand what areas have some design flexibility and which do not. No one is looking to undermine safety, just understand the available options.
Thanks
Comment: @isherwood yes, single family; I tagged it UK but more specifically england
Answer: In England, the regulation is Approved Document B of the Building Regulations 2019
In Wales, Approved Document B of the Building Regulations (Wales) and amendments
In Scotland, Part 2 Building Standards technical handbook 2017
In Northern Ireland, Technical Booklets
In general fire doors are not required inside dwellings of one or two storeys. In a three storey dwelling (including loft conversion or basement) fire doors are required on doorways to the protected stair and corridor leading to the final exit.
In some circumstances a sprinkler system may be allowed as an alternative to protect the final exit route instead of fire doors.
Answer: @Owain links to the actual regulations, so please adhere to them and not to me.
We had our loft converted a couple of years ago, and had to change all internal doors to bedrooms, the lounge, dining room and kitchen. There was no requirement to do so on the bathroom, or a door off the kitchen leading to a utility room. For aesthetics, we changed them, but to save a few pennies, made them style-matching, but not fire rated.
There is no longer a requirement to make fire doors self-closing (at least, there wasn't for us). Once you had to spring them all, but door wedges become prevalent, and so the theoretical benefit was lost and the requirement was dropped (or so I was told - double check to be certain!). I'll also add that "hidden" springs inside the doors impact their fire resistance, so don't add them to doors that aren't designed for it!
FWIW, we replaced our doors with oak fire doors, and the kitchen doors with a glazed oak door pair (there were specific requirements for double doors). You'd imagine being oak they'd be on the heavier end of the scale, and if memory serves, each door was about 40Kg. I can't speak for all elderly people, but the grandparents seem to have no trouble with the replacement doors. As a middle aged man, I honestly can't say they feel at all heavy or difficult to push/stop or whatever. The kids don't seem to struggle either.
I'll also say that the mounting of the doors makes a difference - the old 1930s doors (thin, not very heavy) didn't move nearly as well as the new doors that have been fitted (I think) very competently. If you have the proper hinges, and things are done right, then the weight of the door should have little impact on its usability.
For the double doors into the kitchen, our local authority inspector mandated we buy doors "made as a pair", which have factory installed smoke seals. They wouldn't accept two separate doors mounted together, but when asked, went as far as to give us some Internet links of examples they would accept.
If after you've read the regulations you still have questions, my experience of the local authority inspectors was that whilst very busy, they were very helpful and constructive. Ultimately they want you to build things they can sign-off, so its good for them to make sure you do it right first time. They may be able to help clarify things for you, or your builder.
Last thing... where you do choose to replace non-fire rated doors, you may want to think a little. The very cheapest doors are essentially some thin plywood sheets with cardboard between them - which will happily catch fire in a heartbeat. At the other end of the scale are rated fire doors which offer at least 30 minutes of protection - there's no harm putting these where you don't strictly need them, but I personally wouldn't want one of those cardboard things anywhere in my house - even if the room its on had a second exit out of the house. It'll probably come down to budget, but worth thinking it through a little before "cheaping out" on something you may regret later.


Stuck padlock without key - its attachements to the door seem stuck, how could I remove it?

Question: I recently lost the key to the padlock for the door in the garage. This was installed by the previous owner. Don't have a duplicate of the key and could not find the original I've lost.

So I tried padlock picking after watching some videos, it looks like padlock picking requires some minimum training / skills, some feeling, sense of doing it right.
I tried to use wrenches to damage/break the padlock, but I have very small space to operate, after 10 / 15 minutes of trying, I gave up, could not find a proper position for both wrench to get enough force ( like you can see , there is not so much space between the door and the things in the circle in red ).
I tried removing these things attached ( circle in red on the photo ) which keep the padlock, the door, and the wall fixed together. But for some reason they would not totally come out my way ? Like if they were not entirely straight, with some angle that makes them stuck or something. Not sure if I have tried hard enough on both at the same time. But it looked really stuck at some point.
I thought of borrowing or renting a grinder, but I would like to avoid that - would be a last solution.
What could be done ? Could you tell just by looking at the photo ?
Any help / advice would be much appreciated. Thanks.
Comment: I would say that whoever installed that did a fine job. The "things" the lock runs through are eye bolts - they're screwed into the wood. You'd have to pull one straight out of the wood to remove it and it's not going to be easy and that's by design. Your "best bet" would probably be to find the key. Barring that, use bolt cutters or an angle grinder with a cutting disk to cut the shackle of the lock. _Why do I feel like I'm helping with a breaking and entering?_
Comment: that lock looks cheap, it can probably be shimmed open.
Comment: Renting a grinder will be cheaper than tearing up the door.
Answer: A set of bolt-cutters of an appropriate size should be able to cut that shackle without too much trouble.  It appears to be a relatively cheap lock.
Alternatively you could also easily cut either or both of the eyes that the lock is holding.  Those are just bent mild steel.
Comment: Yes, Cut the BOLT not the LOCK!  Far easier, and it's all trash anyway.
Answer: You could pry open the loop of the screw-eye using vise-grips. The screw-eye above the door handle looks the easiest and most accessible. Just make a strong grip near the cut end, then twist the vise-grip to roll open the loop. With the door open you can dismantle everything. If the garage needs continued security, have your new locking mechanisms ready to install before you release the old lock.
Answer: There is a good chance you can shim this padlock open. This required minimal skill. You will need some tin snips (or regular scissors will probably work) and an empty aluminum beverage can.

You cut a shape like this and bend it so the wings can wrap around the shackle, and the extended portion can slip into the hole the shackle goes into in the lock body. Then rotate the setup and it may release the locking mechanism.
A video demonstration will probably be easier to follow.
Answer: The loops are the heads of screw eyes - you need to remove the lock to unscrew them unless you want to do a LOT of damage to the door.
So, cut the lock. If you don't want to get a grinder, start cutting with something else, because it will be slow going. Bolt cutters will cost more...
Perhaps a quart of liquid nitrogen? I seem to recall that being popular with bike thieves for a while - freeze the lock, smack with a hammer, sweep up the remains.


Water Hammer on sink hot tap

Question: I have just installed a new washing machine which doesn't require a hot water feed as where the old one did so now that hot water feed is switched off.
Since then the tap on the main sink which is on the same piperun as the old feed has developed water hammer at low flows, is there any way to stop this?
Comment: Depending where you "switched that off" perhaps you could simply open a valve to restore the access to the likely existing arrestor on the washing machine hot pipe run...
Comment: I managed to get a plumber to look at it turned out to be the tap washer which had almost disintegrated as tap was probably 30 years old, I think the upset associated with switching mains water off and on again finally did for it.
Answer: You can add a water hammer arrestor on that line. They are not expensive approx  15$ . These devices have a spring loaded chamber that dampen the water hammer most plumbing and big box stores stock them.  This is the easiest diy method of fixing , if you have access to the pipes strapping them down can also solve the problem.

Water Hammer on sink hot tap


How to fix 'ffmpeg.load() failed to fetch' TypeError?

Question: I'm trying to create a function that adds a text watermark to a video in Next.js using ffmpeg and I'm keep running into the same error and I've no idea how to fix it.

TypeError: Failed to fetch
await ffmpeg.load();

No errror in code, error only occurs in browser after I click Add Watermark button.
Server component: app/api/addwatermark.ts
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';

const ffmpeg = createFFmpeg({ log: true });

export default async function addWatermark(
  inputFile: File,
  text: string
): Promise<string> {
  if (!ffmpeg.isLoaded()) {
    await ffmpeg.load();
    // Error ☝
  }

  ffmpeg.FS('writeFile', inputFile.name, await fetchFile(inputFile));

  await ffmpeg.run(
    '-i',
    inputFile.name,
    '-filter_complex',
    `drawtext=text='${text}':fontfile=Arial.ttf:email@example.com:fontsize=40:x=(w-text_w)/2:y=(h-text_h)/2`,
    'output.mp4'
  );

  const data = ffmpeg.FS('readFile', 'output.mp4');

  const videoUrl = URL.createObjectURL(
    new Blob([data.buffer], { type: 'video/mp4' })
  );

  return videoUrl;
}

Client componenet:
export default function VideoWatermark() {
  const [inputFile, setInputFile] = useState<File>();
  const [outputFile, setOutputFile] = useState<string>();
  const [text, setText] = useState<string>('');

  const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    if (event.target.files && event.target.files.length > 0) {
      setInputFile(event.target.files[0]);
      setOutputFile(undefined);
    }
  };

  const handleWatermark = async () => {
    if (!inputFile) {
      return;
    }
    const output = await addWatermark(inputFile, text);
    setOutputFile(output);
  };

  return (

      <input type='file' onChange={handleFileChange} />

      <input
        value={text}
        type='text'
        onChange={(event) => setText(event.target.value)}
      />

      <button onClick={handleWatermark}>Add Watermark</button>
      {outputFile && (

          <video controls>
            <source src={outputFile} type='video/mp4' />
          </video>

      )}

  );
}

Answer: https://github.com/ffmpegwasm/ffmpeg.wasm
Why it doesn't work in my local environment?
When calling ffmpeg.load(), by default it looks for http://localhost:3000/node_modules/@ffmpeg/core/dist/ to download essential files (ffmpeg-core.js, ffmpeg-core.wasm, ffmpeg-core.worker.js). It is necessary to make sure you have those files served there.
If you have those files serving in other location, you can rewrite the default behavior when calling createFFmpeg():
const { createFFmpeg } = FFmpeg;
const ffmpeg = createFFmpeg({
  corePath: "http://localhost:3000/public/ffmpeg-core.js",
  // Use public address if you don't want to host your own.
  // corePath: 'https://unpkg.com/@email@example.com/dist/ffmpeg-core.js'
  log: true,
});

I moved the ffmpeg-core.js, ffmpeg-core.wasm and ffmpeg-core.worker.js files to the public folder.
And I used it like below.
const ffmpeg = createFFmpeg({ log: true, corePath: `http://localhost:3000/ffmpeg/ffmpeg-core.js` });

If you are using NextJS, copy the core files to the /public in your NextJS project.
For example, copy core files to /public/ffmpeg, and test with the following URL in a browser.
http://localhost:3000/ffmpeg/ffmpeg-core.js
Access this URL and verify that the contents of the file are displayed.
Finally, set corePath to the URL above and try again.
Comment: I did include: https://cdn.jsdelivr.net/npm/@firstname.lastname@example.com/dist/ffmpeg-core.js - just like you suggest and still not working.


Bootbox alert focus not returning to the input

Question: In my current project I have used bootbox to replace my old ordinary alert and confirm boxes to a trendy one.But the problem is after closing or dismissing the bootbox its focus is not returning to my input.
    bootbox.alert("Please create a milestone");
    $('input[name="mile_stone[]"]:first').focus();
    return false;

Everything working as expected except the focus function.Is there any way to solve this problem?
Comment: Can you provide [JS Fiddle](http://jsfiddle.net/) code for whatever work is done so far.
Answer: See this question: Bind a function to Twitter Bootstrap Modal Close
In the case of a bootbox modal, you can add the following:
$('.bootbox').on('hidden.bs.modal', function() {
    $('input[name="mile_stone[]"]:first').focus();
});

Answer: Create a generic function to focus without repeating the code.
This example is for the bootbox alert, for others (confirm, etc ...) just adapt the code:

<input type="text" id="nome" name="nome" />
<button type="button" id="btnAlerta">Alert</button>

follows the example in practice
https://jsfiddle.net/marsites/tLwo253e/


Issue Updating Snap Store on Ubuntu 23.10

Question: Hello Ask Ubuntu community,
I'm currently running Ubuntu 23.10, and I've encountered an issue while trying to update the Snap Store. Here are the details of the problem:
Description:
The Ubuntu Software application notifies me that there is an update available for Snap.
When I go to Ubuntu Software and click on the update button for Snap, I receive an error message stating that"Unable to update "Snap Store": (null): cannot refresh "snap-store": snap "snap-store" has running apps (ubuntu-software), pids: 2098" .The exact error message is not displayed in the terminal.
Steps I've Tried:
I have closed the Ubuntu Software application and retried the update.
I attempted to manually update the Snap Store using the terminal with sudo snap refresh snap-store, but the issue persists.
System Information:
snap    2.60.4+23.10.1
snapd   2.60.4+23.10.1
series  16
ubuntu  23.10
kernel  6.5.0-13-generic
I would appreciate any assistance or insights into resolving this issue. Thank you!
Comment: "*The exact error message is **not** displayed in the terminal.*" Is that a typo? Else what is displayed?
Comment: @user535733 the message is displayed in a floating box in the ubuntu software application after clicking update on snap and entering password of the pc to update snap
Answer: There was an issue over the past day where the previous version of the App Center / Snap Store got pushed out to 23.10 users.
This version is based on GNOME Software, which runs persistently in the background even after the visible application window is closed. To be able to refresh the Snap (and get back to the new App Center), open up your System Monitor app by pressing the Super Key (usually the left Windows key by defaut) and in the search box start to type System Monitor and select from the options provided. Under the Processes tab and in the search box type gnome-software, select it and click on End Process in the bottom left hand corner to kill that process.
You'll probably get a notification within a few seconds that snap-store has successfully refreshed, but if not, sudo snap refresh should confirm that all is now in order.
Comment: Try `snap-store`
Comment: If that answers the question for you, please consider accepting it (the grey tick under the votes). This will help other users with finding a solution if they have the same issue. Thanks
Comment: Process Name
at-spi2-registryd gdm-wayland-session
gjs
gjs
Igjs
gnome-keyring-daemon
gnome-session-binary
gnome-session-binary
gnome-session-ctl
gnome-shell
gnome-shell-calendar-server
gnome-system-monitor
|xdg-desktop-portal-gnome. I could not find gnome-software


Class Chronometer in java

Question: I´m trying to do Chronometer in Java; is just for game.
I find this class in the Java API  but I don´t know how I use it.
I try this code to create the Object of Chronometer, the compiler says "I cannot find the simbol "Chronometer" ". I think is because I need to import a specified librery to create a object for the Chronometer.
My problem is just to create the object for the class Chronometer; I know how use it for my objective.
Again, my question is how create the object of the class Chronometer, just it.  Do I need a specified librery?  Is not Chronometer a class that I can instance? How  does Chronometer work ?
public class Timer{

private Chronometer cronos;

  public Timer(){
     cronos = new Chronometer();
  }

}

Thanks, Thanks for the help :P
PD: Sorry for the first version of the question, I wrote very fast and is my first time.
Comment: did you try `cronos.start()`? That should work.
Answer: First of all you need to add a new dependency to https://docs.oracle.com/middleware/1213/jdev/api-reference-esdk/index.html?oracle/javatools/util/package-summary.html.
Once you have added dependency, you wll get rid of compile time error I cannot find the simbol "Chronometer"

Class Chronometer in java


How to wait for suspendCoroutine in unit test?

Question: I want to write tests for my android application. Sometimes the viewModel executes tasks in the background using Kotlins coroutine launch function. These tasks are executed in the viewModelScope that the androidx.lifecycle library so handily provides. In order to still test these functions, I replaced the default android Dispatchers with Dispatchers.Unconfined, which runs the code synchronously.
At least in most of the cases. When using suspendCoroutine, the Dispatchers.Unconfined will not be suspended and later resumed, but instead will simply return. The documentation of Dispatchers.Unconfined reveals why:

[Dispatchers.Unconfined] lets the coroutine resume in whatever thread that is used by the corresponding suspending function.

So by my understanding, the coroutine is not actually suspended, but the rest of the async function after suspendCoroutine is run on the thread that calls continuation.resume. Therefore the test fails.
Example:
class TestClassTest {
var testInstance = TestClass()

@Test
fun `Test with default dispatchers should fail`() {
    testInstance.runAsync()
    assertFalse(testInstance.valueToModify)
}

@Test
fun `Test with dispatchers replaced by Unconfined should pass`() {
    testInstance.DefaultDispatcher = Dispatchers.Unconfined
    testInstance.IODispatcher = Dispatchers.Unconfined
    testInstance.runAsync()
    assertTrue(testInstance.valueToModify)
}

@Test
fun `I need to also test some functions that use suspend coroutine - How can I do that?`() {
    testInstance.DefaultDispatcher = Dispatchers.Unconfined
    testInstance.IODispatcher = Dispatchers.Unconfined
    testInstance.runSuspendCoroutine()
    assertTrue(testInstance.valueToModify)//fails
}
}

class TestClass {
var DefaultDispatcher: CoroutineContext = Dispatchers.Default
var IODispatcher: CoroutineContext = Dispatchers.IO
val viewModelScope = CoroutineScope(DefaultDispatcher)
var valueToModify = false

fun runAsync() {
    viewModelScope.launch(DefaultDispatcher) {
        valueToModify = withContext(IODispatcher) {
            sleep(1000)
            true
        }
    }
}

fun runSuspendCoroutine() {
    viewModelScope.launch(DefaultDispatcher) {
        valueToModify = suspendCoroutine {
            Thread {
                sleep(1000)
                //long running operation calls listener from background thread
                it.resume(true)
            }.start()
        }
    }
}
}

I was experimenting around with runBlocking, however it only helps if you call launch using the CoroutineScope created by runBlocking. But since my code is launching on the CoroutineScope provided by viewModelScope this will not work. If possible I would prefer not to inject a CoroutineScope everywhere, because any lower level class could (and does) make their own CoroutineScope as in the example, and then the Test has to know a lot about the implementation details. The idea behind the scopes is that every class has control over cancelling their asynchronous operations. The viewModelScope for example is by default cancelled when the viewModel is destroyed.
My question:
What coroutine dispatcher could I use that runs launch and withContext etc blocking (like Dispatchers.Unconfined) and also runs suspendCoroutine blocking?
Comment: It is hard to undestand the problem with the code as presented. Could you separate your testing code from your production code?
Your test method should call your production code and not have it inlined. This way it would be easier to reason about your problem
Comment: @EricMartori Is it now more understandable?
Comment: It is better now.
Answer: How about passing the coroutine context to your model? Something like
class Model(parentContext: CoroutineContext = Dispatchers.Default) {
    private val modelScope = CoroutineScope(parentContext)
    var result = false

    fun doWork() {
        modelScope.launch {
            Thread.sleep(3000)
            result = true
        }
    }
}

@Test
fun test() {
    val model = runBlocking {
        val model = Model(coroutineContext)
        model.doWork()
        model
    }
    println(model.result)
}

Update
for viewModelScope from androidx.lifecycle you can just use this test rule
@ExperimentalCoroutinesApi
class CoroutinesTestRule : TestWatcher() {
    private val dispatcher: TestCoroutineDispatcher = TestCoroutineDispatcher()

    override fun starting(description: Description?) {
        super.starting(description)
        Dispatchers.setMain(dispatcher)
    }

    override fun finished(description: Description?) {
        super.finished(description)
        Dispatchers.resetMain()
        dispatcher.cleanupTestCoroutines()
    }
}

here are the test model and the test
class MainViewModel : ViewModel() {
    var result = false

    fun doWork() {
        viewModelScope.launch {
            Thread.sleep(3000)
            result = true
        }
    }
}

class MainViewModelTest {
    @ExperimentalCoroutinesApi
    @get:Rule
    var coroutinesRule = CoroutinesTestRule()

    private val model = MainViewModel()

    @Test
    fun `check result`() {
        model.doWork()
        assertTrue(model.result)
    }
}

don't forget to add testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" to get TestCoroutineDispatcher
Comment: This does work. However it will be a lot of effort to make sure that every CoroutineScope is based on a runBlocking context. I can't even make this a junit rule then, because the test needs to run inside the runBlocking, so it needs to be done in every test that calls such code... Also I wouldn't be able to use the viewModelScope provided by androidx.lifecycle.
But this is the best answer so far, so unless something better comes, I will award it the bounty.
Comment: ah, you are using viewModelScope? There is a simple way. I'll update my answer
Comment: On first look the TestCoroutineDispatcher seems to have the same effect as Dispatchers.Unconfined. But I will need to make a more extensive test tomorrow to make sure this isn't because of my test setup.
Comment: I've read your new question explanation. Yes, you're right. The test rule won't work
Answer: With the helps of other answers, I have found the following solution. As sedovav suggested in his answer, I can run the task async and wait for the Deferred. Basically the same idea, I can run the task with launch and wait for the job that handles the task. The problem in both cases is, how do I get the Deferred or Job.
I found a solution to this. Such a Job is always a child of the Job contained in the CoroutineContext which is part of the CoroutineScope. So the following code does solve the problem, both in my example code as well as in the actual android application.
@Test
fun `I need to also test some functions that use suspend coroutine - How can I do that?`() {
    replaceDispatchers()
    testInstance.runSuspendCoroutine()
    runBlocking {
        (testInstance.viewModelScope.coroutineContext[Job]?.children?.forEach { it.join() }
    }
    assertTrue(testInstance.valueToModify)//fails
}

It does seem a bit like a hack, so if someone has a reason why this is dangerous, please tell. Also it won't work if there is another underlying CoroutineScope created by some other class. But it is the best solution I have.
Comment: This doesn't work if the view model is collecting a SharedFlow for example. That's because it is a Job that doesn't finish (unless viewModelScope is cancelled or destroyed, but that's not usable in a scenario like the example above). Similar issues would occur collecting a StateFlow or a Channel.
Comment: Of course one could call join only on the relevant `Job` but identifying it is tricky and not maintainable long-term. Relying on this can cause problems later if consuming `SharedFlow` is introduced later on. So I don't recommend using this approach.
Answer: Now, you can use runTest
From Android developer site https://developer.android.com/kotlin/coroutines/test
build.gradle
dependencies {
    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
}

Test
suspend fun fetchData(): String {
    delay(1000L)
    return "Hello world"
}

@Test
fun dataShouldBeHelloWorld() = runTest {
    val data = fetchData()
    assertEquals("Hello world", data)
}

And you can use advanceUntilIdle() for queued coroutines
Answer: As I understood, you want everything in your production code to run in the main thread of your test. But it doesn't seem to be achievable as something may be run in a regular thread pool/background, and if have no means to synchronize/join the background process in your code you probably in trouble. The best thing is to join background threads somehow in a coroutine and await that coroutine in the test before the assertions. It may require you to change your existing production code.
I'm talking about a different approach to write your code. Surely, it's not always possible. I've updated your example accordingly to illustrate my point:
class TestClassTest {
    var testInstance = TestClass()

    @Test
    fun `Test with default dispatchers should fail`() = runBlocking {
        val valueToModify = testInstance.runAsync().await()
        assertTrue(valueToModify)
    }

    @Test
    fun `Test with dispatchers replaced by Unconfined should pass`() = runBlocking {
        testInstance.DefaultDispatcher = Dispatchers.Unconfined
        testInstance.IODispatcher = Dispatchers.Unconfined
        val valueToModify = testInstance.runAsync().await()
        assertTrue(valueToModify)
    }

    @Test
    fun `I need to also test some functions that use suspend coroutine - How can I do that?`() = runBlocking {
        testInstance.DefaultDispatcher = Dispatchers.Unconfined
        testInstance.IODispatcher = Dispatchers.Unconfined
        val valueToModify = testInstance.runSuspendCoroutine().await()
        assertTrue(valueToModify)//fails
    }
}

class TestClass {
    var DefaultDispatcher: CoroutineContext = Dispatchers.Default
    var IODispatcher: CoroutineContext = Dispatchers.IO
    val viewModelScope = CoroutineScope(DefaultDispatcher)

    fun runAsync(): Deferred<Boolean> {
        return viewModelScope.async(DefaultDispatcher) {
            withContext(IODispatcher) {
                sleep(1000)
                true
            }
        }
    }

    fun runSuspendCoroutine(): Deferred<Boolean> {
        return viewModelScope.async(DefaultDispatcher) {
            suspendCoroutine<Boolean> {
                Thread {
                    sleep(1000)
                    //long running operation calls listener from background thread
                    it.resume(true)
                }.start()
            }
        }
    }
}

Comment: this does sound like a reasonable idea. If I could await the work done in my viewModelScope, it would probably work. Do you have any idea how I would do that?
Comment: ah so you want to await the job that is started. That is sadly not possible. In my case I trigger the event via a LiveData that is observed, so I can't get any return values.
Comment: I have found a solution to get the job to join it. See my answer to this question.
Answer: This is exactly what runBlocking was created to do. Simply replace the GlobalScope.launch call:
result = runBlocking {
    suspendCoroutine { continuation ->
        Thread {
            sleep(1000)
            //long running operation calls listener from background thread
            continuation.resume(true)
        }.start()
    }
}

Comment: Sorry that this is not clear, the launch call is not in the test methods but in the production code. Otherwise I wouldn't need a test rule to replace the Dispatchers. The code above is simply a minimal reproducible code bit.


Container's Borders are not uniform

Question: Even with the same width given to the borders of a container they don't look like they have the same width, just like the image below ( Tested on a real device,Model Name - Samsung S9 ) : -

Along with this, the borders seem to look different on different devices as in the following image ( Tested on a real device,Model Name - Samsung a31 ) : -

In the above image also the borders do not look that they have the same width
Code which I used : -
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Box(),
    );
  }
}

class Box extends StatefulWidget {
  const Box({super.key});

  @override
  State<Box> createState() => _BoxState();
}

class _BoxState extends State<Box> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.red[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  left: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                  right: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.green[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                  right: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.orange[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                  right: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
        ],
      ),
    ));
  }
}

Comment: what's the question here? if the boxes are not the same width or if the borders are not equals?
Comment: Border dont look of equal of width , even though they all have the same width, In my first image , you can see one border looks thicker than others.
Comment: what's the flutter version you are using?
Comment: also can you try this value in your BorderSide? `strokeAlign: BorderSide.strokeAlignInside,`
Comment: @diegoveloper, I will try. I am using flutter 3.10.1
Comment: @diegoveloper, even with strokeAlign: BorderSide.strokeAlignInside, still border dont look equal
Comment: does this only happen of you samsung devices? I tried on iOS simulator and it works fine.
Comment: @diegoveloper, On other devices  like OnePlus same thing happens, also on some devices its works fine but on most of the devices it does not.
Comment: This is one of those "not your problem" problems.  If you defined the border to be uniform, then what happens after that is out of your control.  You cant be responsible for predicting the misbehavior of every existing device and/or the flutter renderer.  Im guessing the issue has to do with rounding error and/or anti aliasing.
Comment: @NerdyBunz but  every problem has a solution. If this is a bug then it can be fixed.
Comment: Are you asking about width (Thickness) of border or length?
Comment: @UpendraShah, I am pertaining to Width(Thickness) of border
Comment: @Ramji as per Dart Doc if you passes width 0.0 to 1.0 than it means it takes min 1px and that might double-hit pixels, giving it a slightly darker/lighter result. so if you want proper result than pass width as 1 or more px. I have also added answer you can get more details from that.
Comment: @UpendraShah, the brighter/thicker effect should be applied on all borders of container and not just only on few borders.
Comment: @Ramji I have added a comment on my answer.
Answer: This is due to the difference in the screen DPI(Dots per inch) which leads to the difference in layouts in different devices. It also differs for an iOS device and an Android device with the same screen height.
So, I basically use the sizer package from Flutter for the UI responsiveness. Also, it is very simple to use.
Configuration:
Wrap MaterialApp with Sizer widget:
Sizer(
      builder: (context, orientation, deviceType) {
        return MaterialApp();
      }
 )

Example:
For widgets:
 Container(
  width: 20.w,    //It will take a 20% of screen width
  height:30.h     //It will take a 30% of screen height
)

For fonts:
Text(
  'Sizer',style: TextStyle(fontSize: 15.sp),
);

Hope this can help you :)
Comment: I have already tried this but still, in some devices, borders look thicker than others.
Answer: The problem is that you have widths that are decimal. Personally I don't get why it's even allowed but I also experience that it often gives issues. Just define all those widths that you have as 0.5 and change them to 1. It doesn't make much sense anyway to have something be half a pixel
Comment: @Ramji physical of course :-) those virtual keyboards on smartphones sometimes are too "smart"
Comment: but remember that 0.5 is a logical pixel which has nothing to do with a philosophical one
Comment: Yes, you are right @Ivo, that decimal is the root problem and I knew about it before posting my question. Setting the width to 1 makes my app look completely different. So I can not do that.
Comment: @pskink, what do you mean by "philosophical one" ?
Answer: This is because the width value is not the same on all screen, ex: if the device width is 500 and your container width is 250 that mean is equal to 50% of the screen but with different screen widths for example tablet is 700 width screen then your 250 container width is no Longer 50%,
To fix this I wish to use my package screentasia it's simply the best flutter package to deal with all screens.
In this line
bottom: BorderSide(width: 0.5, color: Colors.black),

for example, you can use Screentasia with an extension like this
bottom: BorderSide(width: 0.5.w, color: Colors.black),

Now your goal is done.
Comment: My question is regarding the container border's width not the width of container
Comment: The same concept work on border width, you can try and check the result, I hope the package is useful for you.
Answer: As per document on Dart BorderSide Width

The width of this side of the border, in logical pixels.
Setting width to 0.0 will result in a hairline border. This means that
the border will have the width of one physical pixel. Hairline
rendering takes shortcuts when the path overlaps a pixel more than
once. This means that it will render faster than otherwise, but it
might double-hit pixels, giving it a slightly darker/lighter result.

Hairline is defined as "the thinnest continuous frame." This essentially means it will always be one physical pixel, and not be defined by logical pixels.
from above we can conclude that you are setting width 0.5 pixel it means it might double-hit pixels, so it gives slightly darker/lighter result. So I suppose for test purpose pass width of 2 or more pixel then compare it will not give slightly darker/lighter result.
Comment: Even if there are double hit pixels , it should have effect on all border width and not on few. In my case , few borders look alike and few do not.
Comment: Yes, that can. You can read **it might double-hit pixels** terms and your are using 10 border sides so there can be few border look alike and few not.
Comment: All right with your answer we understood what the problem is but how can we solve it ?
Comment: > Option 1: Just try If you have only three containers then on first and last container add Border.all and in middle border side top and bottom.
> Option 2: Increase border width.

But I am not sure it will fix your issues because you have test case and device.
Comment: Options 1 didn't work.  I cant work with Option since increasing border makes the page look completely different.
Comment: But you can't assign width less than 1px.
Comment: I don't have any other option but using 0.5 for border width.
Answer: it could be due to the device pixel density. To ensure consistent border widths across devices, you can calculate the pixel value based on the device's pixel density.
try this:
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Box(),
    );
  }
}

class Box extends StatefulWidget {
  const Box({super.key});

  @override
  State<Box> createState() => _BoxState();
}

class _BoxState extends State<Box> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.red[100],
                border: Border(
                  bottom: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  left: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  top: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  right: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.green[100],
                border: Border(
                  bottom: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  top: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  right: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.orange[100],
                border: Border(
                  bottom: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  top: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                  right: BorderSide(
                      width: (0.5 * MediaQuery.of(context).devicePixelRatio),
                      color: Colors.black),
                )),
          ),
        ],
      ),
    ));
  }
}

Comment: I implemented what you suggested but the value of (0.5 * MediaQuery.of(context).devicePixelRatio) is 1.3 which makes the border thicker than what I want, so I just decreased its value to 0.2 then multiplied by devicePixelRatio the value is 0.525 which makes the border look thin which I want in my app but then problem still remains the same , borders dont look similiar.
Comment: The reason for the varying appearance of the border on different devices is due to differences in device resolution and pixel density. Consider the scenario of comparing an older 720p monitor with a high-resolution 4K screen, and you will grasp the concept.
Comment: I was not addressing this in my comment. What I meant is that in a certain device for example Samsung S9 , the borders of containers itself do not look of equal width even after using devicePixelRatio. I understood the concept that border thickness will differ from device to device because of devicePixelRatio but in the device itself borders are not looking uniformed
Answer: Im pretty sure it's because your borders touch each other so you have an illusion that they are thicker that they should be.
Can you try this :
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Box(),
    );
  }
}

class Box extends StatefulWidget {
  const Box({super.key});

  @override
  State<Box> createState() => _BoxState();
}

class _BoxState extends State<Box> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.red[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  left: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.green[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  left: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.orange[100],
                border: const Border(
                  bottom: BorderSide(width: 0.5, color: Colors.black),
                  left: BorderSide(width: 0.5, color: Colors.black),
                  top: BorderSide(width: 0.5, color: Colors.black),
                  right: BorderSide(width: 0.5, color: Colors.black),
                )),
          ),
        ],
      ),
    ));
  }
}

Comment: It didnt make any difference, still few border are bigger in width than others
Answer: In Flutter, logical pixel values are used instead of physical pixels. On screens with higher pixel densities, a border of 1 logical pixel could be less than 1 physical pixel
Like this:
double pixelRatio = MediaQuery.of(context).devicePixelRatio;
double borderWidth = 1 * pixelRatio;

Your _BoxState class should Like this
Widget build(BuildContext context) {
double pixelRatio = MediaQuery.of(context).devicePixelRatio;
    double borderWidth = 1 * pixelRatio;
    return Scaffold(
        body: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.red[100],
                border: Border(
                  bottom: BorderSide(width: borderWidth, color: Colors.black),
                  left: BorderSide(width: borderWidth, color: Colors.black),
                  top: BorderSide(width: borderWidth, color: Colors.black),
                  right: BorderSide(width: borderWidth, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.green[100],
                border: Border(
                  bottom: BorderSide(width: borderWidth, color: Colors.black),
                  top: BorderSide(width: borderWidth, color: Colors.black),
                  right: BorderSide(width: borderWidth, color: Colors.black),
                )),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: BoxDecoration(
                color: Colors.orange[100],
                border: Border(
                  bottom: BorderSide(width: borderWidth, color: Colors.black),
                  top: BorderSide(width: borderWidth, color: Colors.black),
                  right: BorderSide(width: borderWidth, color: Colors.black),
                )),
          ),
        ],
      ),
    ));
  }

Comment: In my device when giving borders the value of (1 * pixelRatio) then border width is actually 3 which is almost 2.5 times greater than what I want. When I use (0.2 *pixelRatio), the border width is 0.5, giving the same output, which is border not looking like they have equal width.
Comment: You can try with the fixed with like:
double borderWidth = 0.5;
Comment: Did that but still same output
Answer: Can you try this code to see if it gives desired result. If yes, I will explain the logic in edit
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Box(),
    );
  }
}

class Box extends StatefulWidget {
  const Box({super.key});

  @override
  State<Box> createState() => _BoxState();
}

class _BoxState extends State<Box> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            height: 80,
            width: 80,
            decoration: const BoxDecoration(
                border: Border(
              bottom: BorderSide(width: 0.5, color: Colors.black),
              left: BorderSide(width: 0.5, color: Colors.black),
              top: BorderSide(width: 0.5, color: Colors.black),
              right: BorderSide(width: 0.5, color: Colors.black),
            )),
            child: ColoredBox(
              color: Colors.red[100]!,
            ),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: const BoxDecoration(
                border: Border(
              bottom: BorderSide(width: 0.5, color: Colors.black),
              top: BorderSide(width: 0.5, color: Colors.black),
              right: BorderSide(width: 0.5, color: Colors.black),
            )),
            child: ColoredBox(
              color: Colors.green[100]!,
            ),
          ),
          Container(
            height: 80,
            width: 80,
            decoration: const BoxDecoration(
                border: Border(
              bottom: BorderSide(width: 0.5, color: Colors.black),
              top: BorderSide(width: 0.5, color: Colors.black),
              right: BorderSide(width: 0.5, color: Colors.black),
            )),
            child: ColoredBox(
              color: Colors.orange[100]!,
            ),
          ),
        ],
      ),
    ));
  }
}

Comment: Thanks Rahul suggesting this approach however even with this method. Borders still appear to have different width.
Comment: Can you try adding clip=Clip.hardedge?
Comment: I thought this might work but it did not.
Answer: try to use MediaQuery.of(context).size.width to get the screen width and then calculating containerSize as a quarter (0.25) of that width. This ensures that the containers' sizes adjust based on the screen width.
To make the borders more consistent, use Border.all instead of defining individual BorderSide for each side of the container. This gives you all the borders the same width and colors, reducing the uneven appearance.
Feel free to adjust the borderWidth value to your liking for thicker or thinner borders. This way, your containers should look much better and more uniform on various devices.
Comment: I cannot use Border.all since it will overlap the Container and also even with MediaQuery it still makes borders uneven
Comment: in that case use margin and padding with each of the container like this
  margin: const EdgeInsets.all(15.0),
  padding: const EdgeInsets.all(3.0),
Comment: are you also getting this info from chatgpt like you now-deleted answer?
Comment: No, actually i wrote solution on my notepad then paste it here when I'm going to paste here there's some issue on my laptop may be some of its text missing so i type it by myself by modifying my reply i hope you understand the issue.
Comment: @SyedNaseebAli, if I add margin or padding then I wont get the desired layout. I want container to be juxtaposed with each other.
Comment: So then wrap the each container with positioned
Comment: @SyedNaseebAli, I am not able to understand, can you add a small example of that code.
Comment: @Ramji here is example from my code
       **Positioned(
                          left: 0,
                          top: 0,

                          child: Container(
                            width: 335,
                            height: 92,
                            decoration: ShapeDecoration(
                              color: Colors.white,
                              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),

                            ),
                          ),
                        ),**
Comment: Understood but still media query does not solve the problem. Border width still look unequal.
Comment: @Ramji bro just give position to each container  make container as a child inside the position before that add left, right ,top, and bottom.it will resolve your problem
Comment: Code which you have added in comment does not even have borders.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

Container's Borders are not uniform


intellij maven output link

Question: How can i manage that the maven output compile errors in intellij output window are shown as links?
That would be very helpfull!
i am currently using intellij idea 10.2. My output is just a bunch of Text. i am using the scala maven plugin... perhaps thats the problem.. i dont know how the links to the files are produced.
Thanks for any help.
Comment: Which version are you using? I am using 9.0.3 and my compilation failures are links (it opens the java file when I click it). I can't remember having to configure it anywhere.
Comment: i am currently using intellij idea 10.2. My output is just a bunch of Text. i am using the scala maven plugin... perhaps thats the problem.. i dont know how the links to the files are produced.
Answer: It works automatically if you have sources for the files you build attached in your project.
Comment: Provide the sample of Maven output with file paths which are not recognized.

intellij maven output link


What would be the best magic robes for me to use?

Question: What would be the best robes for me on Runescape? My magic level 60, and my defense is 61. I am looking for high hp and defense bonus, and non degradable and cheap (I have 1M to spend on it).
Answer: There are two armours I would recommend:
Enchanted Robes:

Magic Level: 40
Defence Level: 45
Constitution Level: 10
HP Bonus: 2430
Defence Bonus: 475
Degradable: No
Cost: 150k in GE

Batwing Robes:

Magic Level: 50
Defence Level: 50
Constitution Level: 10
Defence Bonus: 666
HP Bonus: 3755
Degradable: No
Cost: 25k in GE

Those are my recommendations for your combat stats. Of course there is more at:Runescape Wiki - Magic Armour
These armours should be used because they are cheap, and like you stated before, you are looking for a decent defence bonus. These are by far the cheapest robes for your level that also provide the best non degradable defence bonuses (besides infinity robes).
For more information, please see the link provided.
Comment: Why should these armors be used?  Give your reasoning, please.
Comment: I added my reasoning.


SQL Where IN CLAUSE Variable

Question: I have a process where I basically have to go through a spreadsheet and look up individuals name by name on an internal system by name/surname and DOB and then retrieve the setting in what they attend.
I have been given access to the database and I have previous experience with SQL but nothing extensive. I have put dummy names for my tables as below just because it can contain sensitive information.
I want to know if there is anyway I can do this in an easier way, I will eventually be connecting to the db via VBA and retrieving the data this way. I don't know if I could insert a variable into the IN Clause and create a custom function which create a variable which will return something like 'Bob','Keith' etc  it so it can be passed into SQL (hopefully that makes sense). Also, are you able to pass abbreviated table names if you are passing the SQL through VBA?
Also I am not sure if it is possible so that the setting is returned on the correct rows or its best to use some lookup function on multiple criteria?
It isn't a great way of doing things I know but its the only way as each person doesnt have a unique identifier in the data I initially receive.
SELECT  p.Forename
      ,p.Surname
      ,p.Birth_Date
      ,p.xxx
      ,p.xxx
      ,csc.name
      ,cs.name2
FROM dbo.Person AS P
INNER JOIN dbo.banana AS csc ON csc.xxx = p.xxx
INNER JOIN dbo.apple AS cs ON cs.xxx = p.xxx
WHERE p.forename IN('xxx', 'xxx', 'xxx', 'xxx')
  AND p.surname IN('xx','xx','xx', 'xx')
  AND p.Birth_Date IN(N'xx', N'xxx', N'xxx', N'xxx')

Comment: Do you store dates in a nvarchar column?
Comment: you can pass a variable of type array if you are running this query from any program.
Comment: The canonical way to do this is with a TVP, but old fashioned ADO driver used in VBA does not support it. Maybe a CSV and then split it with `STRING_SPLIT`?
Comment: Hi @jarlh dates are as dates, I guess it doesnt need to be in apostrophes?
Comment: No, it doesn't need the notational character (`N`) @paulr23. `N'xx'` *implies* your column `Birth_Date` is an `nvarchar`, as you're passing `nvarchar` literals to it; which you would only do with an `nvarchar`. Dates, when using strings, are best served as `varchar` values in the format `yyyyMMdd` or `yyyy-MM-ddThh:mm:ss.nnnnnnn` but *really* you should be passing them as a date and time data type (though impossible if you do need to go down the `STRING_SPLIT` method).
Comment: @Larnu Hi, it doesnt work unless I pass N as the dates are 2020-01-01 it doesnt like the - I checked the table properties and the birthdate is a date
Comment: *"it doesnt work unless I pass N as the dates"* to a date and time data type, `N'2020-01-01'` and `'2020-01-01'` are identical; neither contain a character outside of the normal code pages and they would both be implicitly converted to the appropriate date and time data type. If it doesn't work when you pass `'2020-01-01'`, but does when you pass `N'2020-01-01'`, then there's something *very* wrong with your data.
Comment: @Larnu sorry I am wrong it works without the N'infront, I didnt really know what this is but it works without it anyway so all good. Still need an idea to come up with however
Comment: To use a variable with the in clause implies dynamic sql, which you shouldnt do in this scenario. I would work with the dba/sql dev team to see if creating a stored procedure for you to pass in those variables and let them handle it on their end. I would even suggest you just send a json object.
Comment: @DougCoats how come you shouldnt do it this way, performance?
Comment: @paulr23 Just imagine all the end user like yourselves sending in dynamic sql doing god knows what without any way to protect the database from malicious behavior.
Comment: Also, the way your query is structured it implies that all values with name in (...) and DOB in (...) will be returned. Youre literally going to get every combo because theres no way to tie them together the way you wrote it. A json object would o that for you.
Comment: Yea I have no idea what that really is. It would only be one person doing this on a daily basis with a recordset of circa <50 records
Answer: Depending on the control and access you have, you could use XML to pass in a list of values.
Here's an example of what I mean:
DECLARE
    @forenames xml = '<names><name>Bill</name><name>Steven</name><name>Steve</name></names>',
    @surnames xml = '<names><name>Gates</name><name>Spielberg</name><name>Jobs</name></names>',
    @birthdates xml = '<dates><date>10/28/1955</date><date>12/18/1946</date><date>02/24/1955</date></dates>';

SELECT
    p.Forename
    , p.Surname
    , p.Birth_Date
    , p.xxx
    , p.xxx
    , csc.name
    , cs.name2
FROM dbo.Person AS P
INNER JOIN dbo.banana AS csc ON csc.xxx = p.xxx
INNER JOIN dbo.apple AS cs ON cs.xxx = p.xxx
WHERE
    p.forename IN(
        SELECT x.f.value( '.', 'varchar(50)' ) FROM @forenames.nodes( '//names/name' ) x( f )
    )
    AND p.surname IN(
        SELECT x.f.value( '.', 'varchar(50)' ) FROM @surnames.nodes( '//names/name' ) x( f )
    )
    AND p.Birth_Date IN(
        SELECT x.f.value( '.', 'varchar(50)' ) FROM @birthdates.nodes( '//dates/date' ) x( f )
    );

Comment: thanks for the suggestion, could you explain at all at what this really is as I do not understand it too well. And how i pass the values into xml would this be manually?
Comment: This allows you to pass a list of values via a string in XML that can be used with `IN`.

SQL Where IN CLAUSE Variable


How to level my front porch?

Question: My front porch, which is concrete, is leaning to one side. How can I fix it? I had a contractor look at it and he wanted to pour another porch on top of it, but I read somewhere that the preferred approach would be to jack it up somehow? Wondering what the best approach is and ballparks on expected cost would be great. I have a picture but I guess I need more reputation to post it :(
Comment: If you post a link to the picture, one of the higher rep users can edit it into the question.
Comment: what are the dimesions and how many steps to the ground?  A pic would be most helpful.
Comment: Picture here: can a higher rep user edit it into the question? https://docs.google.com/open?id=0B4JV18drrN2jU1FicVZ3TVdSWWFOOHJXb3BnS3FtZw
Comment: Here is another pic: can a higher rep user edit it into the question? https://docs.google.com/open?id=0B4JV18drrN2jdGZ6MnhHV19UM09jelRodGx3dTUyQQ
Comment: I guess it isn't technically a "porch", but rather a "landing" on the way to the porch. There are 2 steps leading up to the landing. The landing is 4'x4' (not including attached steps). The steps face south, and the entire concrete landing/steps structure is leaning east (away from the house). From the landing, you step up to the west to the actual "porch", which is _not_ leaning.
Answer: The techniques used are all similar but seems to have regional names.It is called slab lifting,mudpumping,etc.The method is to pump a slurry under the pad and lift it.I would check for a foundation repair company that has good local references.I have no idea of cost.I'm sure it varies based on the size of the slab,amount of lift.
Answer: I wouldn't just add concrete on top to level out. If you do so you don't take away the real issue and sooner or later you'll face the same problem.
New concrete on top would only help if it was never level. I bet it was level in the past, no? So that means it has been sinking to one side because of lack of foundations.
I don't know the exact terminology in English but you could dig underneath it alternating in blocks of 60cm. So it stays up on columns of 60cm. Then add more concrete (with iron). Then wait at least 30 days so the concrete can dry out. At that point dig out the other 60cm blocks and do the exact same thing.
That way you have the foundations improved and now you could add concrete on top to level out. But only after you fixed the real issue.
Comment: Pouring concrete on top would probably make it worse, anyway - since the part that was lower would then have thicker concrete on top, making it heavier, thus exacerbating what probably caused the problem to begin with.

How to level my front porch?


Adding new repositories to obsolete distribution?

Question: I don't even know if what I'm asking is doable, but suppose I loved one EOL version of Ubuntu and wanted not to upgrade to a supported version but rather add/replace the old repositories with the most current one. Will my EOL system break down as soon as I start updating and/or upgrading?
To illustrate, take ubuntu 10.04. Will adding new 16.04 repos kill it?
Comment: Your EOL system will break eventually.
Comment: Is this question fake? Because the best EOL Ubuntu is "utopic unicorn" xD
Answer: If you replace the standard available repositories in <code>/etc/apt/sources.list</code> with the current ones then your question makes no sense because this will upgrade the system anyway since it installs the latest version of software available in the repositories. This method is officially unsupported but it does work. I always use this method. There's one catch if you do this you'll have to do it on a regular basis. Going from 10.04 to 16.04 means skipping 6 years or 12 versions and that's a very long period. You might encounter incompatibilities or even break the system.


Need driver for an Epson WF-3620 printer

Question: Does anyone know where I can get an Ubuntu driver for the Epson WF-3620 printer? The "linux drivers" page they send me to has download buttons but they don't work.
Thanks!
Answer: Go to the Epson download page.
Enter WF-3620 as product name and choose Linux as operating system.
The search result page will give you three download links. Click on each of them. You will get new windows or tabs. Change to them. Scroll down until the end of the relevant driver download pages. Click the accept button and scroll down again.  There you click again on the download button of your matching *.deb file. Download and install them.
But beware, unfortunately not all features are supported by these generic drivers
Comment: When you get the printer up and running you may find you don't have access to the scan facility. Downloading Simple Scan from the Ubuntu Software Centre should allow you access to this important feature.
Answer:
Go to "Ubuntu Software Center" and install package epson-inkjet-printer-escpr
Then add the printer through GUI and it should identify the printer and locate the driver immediately.

For scanning use Ubuntu-included scanning program. For better quality printing you have to change paper in "Printer Properties"->"Printer Options" you need to select under "Media Type": choose "plain papers-Standard-Vivid" in place of "plain papers-standard"
All works like a charm for me on Ubuntu 14.04 with this setup.
Comment: Have you got it connected via USB for scanning to work?


unix script to replicate .net code logic

Question: I do not have any experience with Unix coding besides navigating through directories and was wondering if someone could help me with writing a script to replicate what I am doing within .NET. I was told it would run faster since the .NET code is deployed remotely and sometimes using a mapped drive to access large amounts of folders runs slow. I basically am sorting files by moving files from selected folders to a group of folders based on the filename and sorting each based on the file date which is included in the filename.
    Private Sub moveAllfiles(ByVal directoryStuff As String)

    Dim templist As New ArrayList
    Dim finalDestination As String = String.Empty
    Dim pathName As String = String.Empty
    Dim fileToDelete As String = String.Empty
    Dim folderDate As String = String.Empty

    Dim counter As Integer = 0
    Dim folders = Directory.EnumerateDirectories(directoryStuff)

    For Each item In folders
        Dim files As String() = Directory.GetFiles(item)
        //' if directory is empty delete folder
        If Directory.GetFiles(item).Count = 0 Then
            Directory.Delete(item)
            Continue For
        End If
        For i As Integer = 0 To files.Count - 1
            Try
                counter += 1
                Dim oInfo As New FileInfo(files(i))
                // ' if file is empty or small delete it
                If oInfo.Length <= 1 Then
                    File.Delete(files(i))
                    Continue For
                End If
               If Not files(i).EndsWith(".gz") Then
                    CompressFiles(files(i))
                    Continue For
                End If
                Dim objInfo As New FileInfo(files(i))
                If Not objInfo.Name.Contains("Data_G_E") Then
                    If objInfo.Name.Contains("Data_G_P") Then
                        Dim pfiledate As String = objInfo.Name.Remove(20)
                        pfiledate = pfiledate.Remove(7, 5)
                        Dim ftempDirectory As String
                        = "M:\Archive\DataP\" + pfiledate & "\"
                        If Not Directory.Exists(ftempDirectory) Then
                            Directory.CreateDirectory(ftempDirectory)
                            Dim destdirectory As String = ftempDirectory
                            Dim ff As String = files(i)
                            fileToDelete = ff
                            File.Move(ff, destdirectory + objInfo.Name)
                            File.Delete(ff)
                        Else
                            Dim destdirectory As String = ftempDirectory
                            Dim ff As String = files(i)
                            fileToDelete = ff
                            File.Move(ff, destdirectory + objInfo.Name)
                            File.Delete(ff)
                        End If
                    End If
                    Continue For
                End If
                Dim filedate As String = objInfo.Name.Remove(20)
                filedate = filedate.Remove(7, 5)
                Dim tempDirectory As String = String.Empty
                tempDirectory = "M:\Archive\DataE\" + filedate & "\"
                If Not Directory.Exists(tempDirectory) Then
                    Directory.CreateDirectory(tempDirectory)
                    Dim destdirectory As String = tempDirectory
                    Dim ff As String = files(i)
                    fileToDelete = ff
                    File.Move(ff, destdirectory + objInfo.Name)
                    File.Delete(ff)
                Else
                    Dim destdirectory As String = tempDirectory
                    Dim ff As String = files(i)
                    fileToDelete = ff
                    File.Move(ff, destdirectory + objInfo.Name)
                    File.Delete(ff)
                End If
           Catch ex As Exception
                If ex.Message.Contains("already exists") Then
                    File.Delete(fileToDelete)
                    Console.WriteLine("DELETING OLD FILE " & fileToDelete)
                End If
                Continue For
            End Try
        Next

    Next

End Sub

Not sure if the logic makes sense but basically it searches all subfolders for files. Strips the filename to get the date and name which indicates where the file should go. Use the date to create a folder in the destination directory and move files accordingly. If someone can help get started or propose a better way to do this I would really appreciate it.
Answer: Not looking too closely (indeed, hardly at all) at your .NET code, it looks like you want to find all of the files in or below a given directory, extract a string from a fixed position in the filename to use as a destination directory, and then move each file to that directory.  If that is indeed what you are trying to do, it is fairly simple.  To move each file in or below the directory /p/a/t/h to /path2/xxx where xxx is taken from positions 7 to 10 in the file name (I selected the indexes 7 and 10 randomly), just do:
find /p/a/t/h -type f -exec sh -c 'd="/path2/${0:7:3}";
    mkdir -p "$d"; mv -i "$0" "$d"' {} \;

The -i flag to mv will cause an interactive prompt if you are overwriting any files, and is here as a safety catch to help prevent the unwary from blowing away files.  (But you, the reader, would never execute any code that you don't fully understand, so this is not necessary!)  You may want to replace it with a -f or just remove it.  Also note that the double quotes are only necessary if your filenames are pathological.  (For example, if they contain whitespace.)


How can you paralellize the processing of File InputStreams in Kotlin / Arrow?

Question: I am processing large Files, having a list of them:
val originalFiles: List<File>

I need to read the InputStream of each file, process it, and write it to another processedFile. For the sake of simplicity let's assume I just read the original InputStream and write it to the destination file output stream.
I would like to process the originalFiles in parallel.
The first straigtforward way would be to use parallelStream()
override suspend fun processFiles(workdir: File): Either<Throwable, Unit> = either {

    val originalFiles = ...

    originalFiles.parallelStream().forEach {
        val destination = File("${workdir.absolutePath}/${it.name}-processed.txt")
        logger.info("Starting merge {}", destination)
        FileOutputStream(destination).use { faos ->
            IOUtils.copy(it.inputStream(), faos)
        }
        logger.info("Finished processing {}", destination)
    }
}

However, given that I'm working with coroutines and Arrow, I get a compile warning Possibly blocking call in non-blocking context could lead to thread starvation.

Is there a proper (non-blocking) way to work with Input/OutputStreams with coroutines/suspend functions?
Is there a better way to paralellize the List processing with coroutines/Arrow?
Answer: Your best best would be to use parTraverse (going to be renamed to parMap in 2.x.x). This function comes from Arrow Fx Coroutines, there is also Flow#parMap and Flow#parMapUnordered that you can use instead.
You also need to make sure that FileOutputStream is closed correctly, and in face of cancellation, and I would recommend using Resource for that.
The Possibly blocking call in non-blocking context could lead to thread starvation warning will disappear by invoking it on the correct Dispatchers.IO.
suspend fun processFiles(workdir: File): Unit {
  val originalFiles: List<File> = emptyList<File>()
  originalFiles.parTraverse(Dispatchers.IO) {
    val destination = File("${workdir.absolutePath}/${it.name}-processed.txt")
    logger.info("Starting merge {}", destination)
    FileOutputStream(destination).use { faos ->
      IOUtils.copy(it.inputStream(), faos)
    }
    logger.info("Finished processing {}", destination)
  }
}

So the summary the answers on your question:

Is there a proper (non-blocking) way to work with Input/OutputStreams with coroutines/suspend functions?

Execute them using suspend + Dispatchers.IO.

Is there a better way to paralellize the List processing with coroutines/Arrow?

Leverage parTraverse to parallelise the List transformations in Kotlin Coroutines. Optionally, parTraverseN if you want to also limit the amount of parallel processes.


On convex hulls of polyhedra and transitivity

Question: It's easy to prove that the convex hull of any vertex-transitive polyhedron is vertex-transitive. Specifically, any symmetry of the original polyhedron that moves any vertex to another will also move the same vertices on the convex hull, but since it will preserve the general shape of the original polyhedron (and therefore the set of vertices) it must preserve the convex hull.
However, my question is the following: Are the convex hulls of edge-transitive polyhedra edge-transitive, and are the convex hulls of face-transitive polyhedra face-transitive?
I have gathered evidence backing up this, mostly from uniform polyhedra, but I can't use the same technique as before to support my claim. Does anyone know why is it true or does anyone have a counterexample?
Comment: Very nice question, but you should modify your proof in the vertex-transitive case. The reason it holds is that the vertex set of the convex hull is a subset of the original vertex set. Thus fails for edges and faces, which makes the problem interesting. +1.
Comment: Isn't it true that a non-convex polyhedron is neither vertex-transitive, edge-transitive or face-transitive? (For example, if it is non-convex, some of vertices will be in the convex hull, some not, and similarly for edges and faces.) In particular, assuming some kind of transitivity, the polyhedron is convex and thus equal to its own convex hull.
Comment: Could you clarify which definition of polyhedron you are using? (In the non-convex case, there are many competing ones.)
Comment: @verret For me, a polyhedron is a set of faces and edges, such that exactly two faces meet at each edge. With some extra conditions, particularly not being a compound and having no two elements as coincident. I know this isn't the most orthodox definition out there but it's the one that most suits my needs.
Comment: I don't get the problem. There can be non-convex polyhedra that are vertex, edge and face-transitive, Kepler-Poinsot polyhedra are a well known example. In fact, my original intent in answering this question was to find all of those polyhedra. So, what's wrong with what I asked?
Comment: Sorry, I was using a different definition of polyhedra. (Where, for example, edges can only meet at a vertex, and so on.)
Comment: How do you define the edges of  the convex hull?
Comment: @verret Well, the convex hull is guaranteed to be one of your kinds of polyhedra, isn't it? Therefore, the edges shouldn't be hard to define. Although tbh I don't know why is it formally true that the convex hull of a finite set of points is a polyhedron.
Comment: I think the lists of [edge-transitive polyhedra](https://en.wikipedia.org/wiki/Isotoxal_figure) and [face-transitive polyhedra](https://en.wikipedia.org/wiki/Isohedral_figure) are both reasonably short enough to just check each case. Especially, you just have to check the non-convex ones.
Answer: I'm going to assume that we're dealing with polyhedra whose faces are planar polygons (possibly self-intersecting, like a pentagram, but contained in a plane), with no two co-planar.
Here's a very sketchy proof sketch.
Now, in Grünbaum and Shephard's article Duality of Polyhedra, they are attempting to grind the axe "Duals are not as well-defined as everyone seems to think they are", but what they actually say is that for polyhedra with planar, possibly self-intersecting faces, a dual can always be constructed by polarity with  matching symmetry/transitivity/regularity properties.
In particular, a face-transitive polyhedron has all its face centroids lying on a sphere, the center of which is a fixed point of its symmetry group, which is the natural choice for the center of the sphere of reciprocation.
So, a face-transitive polyhedron $P$ has a dual $P^*$ which is vertex-transitive. As you say, $\operatorname{conv}(P^*)$ is a vertex-transitive convex polytope, and so its dual, $\operatorname{conv}(P^*)^*$ is a face-transitive convex polytope.
Now, the question is, is the dual of the convex hull of the dual the same as the convex hull of the original polytope? I.E. does $\operatorname{conv}(P^*)^* = \operatorname{conv}(P)$? And my claim is "Sure, what else would it be?"
That leaves the case of edge-transitive polyhedra. But every edge-transitive polyhedron is also either vertex-transitive or face-transitive.
You can find this claim on the Wikipedia page Isotoxal figure ("An isotoxal polyhedron or tiling must be either isogonal (vertex-transitive) or isohedral (face-transitive) or both."), and also in Peter Cromwell's 1999 book Polyhedra, in both cases appearing to apply to star polyhedra as well as convex ones. I'm sure that I once dug up a proof of this, but I forget where.
Perhaps you can make some progress closing up the gaps I left you. ;-)
Comment: That's actually a pretty nice answer. I'll think about it :)


Should buttons appear on a menu bar?

Question: I am reviewing a design change in a desktop application. The proposed change is implemented with standard clickable buttons in a menu bar, appearing to the right of the normal menu items. These are standard action buttons, like the ones you would use for an OK button in a dialog (although they carry out an action more akin to what menu items are normally used for). Note that this is not a tool bar; these buttons appear on an otherwise normal menu bar with pull down menus like File and Edit.
Here's a representative shot of just the menu bar:

It seems self evident to me that it would be better to put these commands in a standard pull down menu, perhaps augmented by additional commands in a contextual menu or toolbar. It is apparently not a self evident to the other programmer, though.
I am looking for clear design guidelines that directly address whether components other than pull down menus belong in a pull down menu. I found one such reference from Oracle, but Apple and Microsoft UX guidelines seem silent on the issue.
If possible, I'd like something more specific than the ubiquitous "use components for what they were designed for," although I realize this comment does address this issue.
Alternatively, if this has somehow become acceptable in some UX designs, pointing to examples or design guidelines saying so would also be appreciated.
Comment: Hey Mike! Welcome to UX Stackexchange. Adding reference images to your question would help others visualize the context of your design problem. You can grab screenshots, or just jot down a rough wireframe on a piece of paper and upload here, to help everyone give you a better solution.
Answer: welcome to StackExchange!
(Sorry for the length of this answer. I felt like I needed to make sure you have enough fodder to convince whomever wants you to place buttons in the menu bar, that that is a bad idea, at least on a Mac. ;) )
You mention that this design is for a native desktop application. I'm most familiar design patterns for macOS, so I'll respond for that platform.
The intro paragraph to Apple's Human Interface Guidelines chapter on the Menu Bar states this:

The menu bar at the top of the screen provides a home for the top-level menus in your app. These menus can include standard, system-provided menus, as well as custom menus your app defines.

While this does not explicitly mention what does not belong in the menu bar, this statement is pretty clear: the menu bar is for menus, and that's it.
Interestingly, Apple violate this rule themselves, as the icons for Siri and Spotlight at the right edge of the menu bar behave like buttons. But that's not that problematic, as I'll explain below.
What you will never find in a well-designed Mac app's menu bar, though, are standard text-label buttons like the ones you're showing in your design mockup.
Besides not being "compatible" with the above HIG quote, there are (at least) two further problems:

There simply is not enough room.
Especially on smaller laptop screens, and with more powerful applications (think Sketch or Xcode), and the user really liking all those "menu extras," ;) you'll not have enough room in the menu bar to place a text-label button.
As an example, here's the Safari menu bar on my machine as I type this:

Maybe you could place, what?, one button with a medium-length label in that narrow space near the center. Even if there's some space, you'd still be faced with a more serious drawback:
Buttons in the menu bar might not sufficiently reflect the context within which they trigger an action.
If I click on the default Siri or Spotlight "button," this triggers a system-global action: Siri can command the OS and potentially all applications, and Spotlight can search the entire file system and the web!
In contrast, all menu items only affect the front-most application (with the exception of some items in the Apple menu, of course).
If you place a button in the menu bar, it might not be obvious to the user whether that button does something strictly within the scope of the front-most application, or whether it triggers something beyond that scope.
If you use a menu instead, users will immediately understand that the menu operates within the context of the front-most app. Why? Because that's how all other applications' menus work, so you should keep your own app's behavior consistent with all those other apps. ;)

Bottom Line: At least on macOS, never place application-specific buttons in the menu bar.
In your specific case, depending on what those buttons trigger in your application, consider using a menu instead, or add them in a toolbar within the app's main window(s), as you already wrote yourself.
Good luck!
Answer: I will probably use button if user is performing any action (Longing in popup) other than navigating from one page to another. Whatever you are going to use make sure it is consistence all over the site.

Should buttons appear on a menu bar?