How to create or use a portable java installation

So this is pretty simple, I am running a set of tools on windows, however to avoid issues regarding a lack of java installation I have bundled with my installation its own jre folder which in windows allows me to simply run a java virtual machine with a .bat and run my program.

My question, am I able to do the same on linux without java, I know my program works fine on ubuntu so far as long as it has java installed, but I am now running into issues regarding certain linux computers that do not have java installed at all. How would I call the java folder inside my program to run a virtual machine to run the .jar? Would it be the same process? I already have a .sh that opens java and runs my virtual machine , it starts with a java command followed by -jar. example: java -jar -xmx1024m ./myprogram.jar .

How would I change that command above to use a java or portable java installation inside my program folder? how can I create a portable java in linux also as I am pretty sure that the jre folder I have which works on windows will not work on java.

Want to install Ubuntu fully portable on an external hard drive. Should I be afraid that I’ll mess up my main drive?

I love Ubuntu and I really want it installed somewhere, however my laptop is pretty low on disk storage, and I would like to have it on an external drive. Just like a Live CD, but it’s actually storing my files etc.

Right now when I’m writing this, I am running a live session. There are 3 drives connected to the laptop: The main one (i cannot disconnect it), a 8GB flash drive I am using to run Ubuntu, and the drive I want Ubuntu to be installed to. Strangely, running “sudo fdisk -l” prints out only two drives, which appear to be the flash and the installation destination drives (my main pc’s drive is missing). The same is shown in ubiquity.

The only disk shown here is the disk I wish to install to.

If I ran the installation, should I be worried about messing up my main drive?

TL;DR – Want a full ubuntu installation on a portable drive. Ubuntu can’t detect my pc’s main drive. If I run the installation, can it ruin my main drive by any chance?

I’m really sorry for this post, I’m just trying to play safe.

portable hashable string representation of data object

I have a class of (flat) objects that are going to be passed around between three different parties, each possibly running a different software stack.

my_object:   item: "string_a"   money:     amount: 99.9     currency: "EUR"   metadata: 5   origin: "https://www.example.com/path" 

These objects will need to be signed and the signatures will need to be verifiable.
In order for the signed hash to be stable from one party to another, there has to be an exact canonical string representation.

EDIT:
For example, both the following are valid string representations of the above object, but they’ll have different hashes.

<my_object xmlns="https://www.TBD.com">   <item>string_a</item>   <money>     <amount>99.9</amount>     <currency>EUR</currency>   </money>   <metadata>5</metadata>   <origin>https://www.example.com/path</origin> </my_object> 
<my_object xmlns="https://www.TBD.com">   <item>string_a</item>   <money><amount>99.9</amount><currency>EUR</currency></money>   <metadata>5.0</metadata>   <origin>https://www.example.com/path</origin> </my_object> 

All parties will be parsing the objects, so it’s the values that need to be verifiable in the signature process. In the above example, the data that needs to be signed is
{“string_a”, 99.9, “EUR”, 5, “https://www.example.com/path”}.
Of course there must be no ambiguity about which value goes with which key; for example it must be clear that 5 is the metadata and not the amount.
That said, it seems reasonable to have the original serialization of the data treated as a data-value in-itself, and the contained data parsed out of it as needed. This would solve the above problem of a byte-perfect canonical version.
END EDIT

I think it’s a good idea to define the “outer” signed object in XML.

<signed_object xmlns="https://www.TBD.com">   <data>string representation of the inner data object</data>   <signature>RSA signature of the SHA512 hash of the value in `data`</signature> </signed_object> 

Clearly I have a variety of options for what should go in that inner <data> tag.

  • An escaped XML string would work.
    • We know all the parties have xml parsing set up.
    • We could help with verification by providing an XSD.
    • The relatively large size of an xml string isn’t a big deal because this will all get compressed.
    • On the other hand, it would be a pain for a human to look at an xml-escaped xml string and understand what was going on.
    • Also, a naive implementer might try to rebuild the XML from the contained data, get a different hash, and decline a valid signature.
  • JSON and Yaml might be slightly better than XML for human readability, but would have the same problem that “equivalent” objects could have different hashes.
  • A delimited string (with commas, pipes, etc) would more be human-readable, and would clearly be string data in itself.
  • Taking that idea even farther, we could provide a canonical regex with capture groups for unambiguously validating and parsing these strings.
  • And finally, we could decide not to worry about having a canonical string version of each such object, and instead have a really well defined process for serializing the data for hashing.
    • This would look the best.
    • This would be the easiest to screw up.

EDIT:
Expanding on that last option (because it’s the one I’ve actually seen done in the wild):

  • Simply concatenating the values in an explicit order probably won’t work: what if item ends with numeric characters?
  • Concatenating the keys and values in an explicit order would probably work, the only problems I can think of are ambiguities in how to represent numbers (5 vs 5.0), or possibly conversions between UTF-8/UTF-32/ASCII.

I like the idea of defining the string format using a regex. Is that a bad idea for any reason?

EDIT: I’ll be asking other people to implement parts of this system, on a variety of platforms. What system will be the easiest and/or most reliable to implement, in general?

Portable monitor past monitor edges

I have an Asus monitor for a 2016 XPS 13 developer edition laptop. I’ve been trying to get the resolution to look better than the defaults. I ran the following xrandr commands:

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync xrandr --addmode DVI-I-1-1 "1920x1080_60.00" 

The screen looks much better but the edges overflow past the monitor edges. Is there a good way to fix this? The monitor I am using is:

https://www.amazon.com/ASUS-MB169B-1920×1080-Portable-Monitor/dp/B00FE690DI/ref=sr_1_3?keywords=portable%2Bmonitor&qid=1560014011&s=gateway&sr=8-3&th=1

MacBook Pro (Retina, 13-inch, Early 2015) Thunderbolt 2 port for small second display (ASUS MB169C+ Portable USB Monitor for eg)

MacBook Pro (Retina, 13-inch, Early 2015) Thunderbolt 2 port for small second display (ASUS MB169C+ Portable USB Monitor for eg)

can I get a bidirectional adapter like the Thunderbolt 3 (USB-C) to Thunderbolt 2 Adapter? I believe the thunderbolt port puts out 9.9 W max and this display Power Consumption(Typical):<7.5W* *measuring a screen brightness of 200 nits without audio/ USB/ Card reader connection)

basically I need a second portable screen 13″ – 15″ preferably type C like a large variety of modern displays available as mentioned above, preferably powered from the adapted thunderbolt 2 port etc, that way when I update the Macbook Pro later the screen will be usable on any updated model with Thunderbolt 3…

It doesn’t have to be the above mentioned Asus screen but it looks the goods and no less then 1920×1080. I am not against the idea of utilizing the two thunderbolt ports one for display and one to power said display if required OR even use the HDMI port etc… just as long as it works and powered by the Macbooks ports as the Macbook can be running from the wall charger as required…

Again a portable setup preferably single cable. recommendations and ideas much appreciated.

Is there an alternative to mkusb to install Ubuntu on a portable SSD that works with both UEFI and BIOS boot methods?

I’ve successfully used mkusb to install a persistent Ubuntu 18.04.2 LTS system on a new Samsung T5 USB SSD. What is nice about mksusb is that it creates a bootable system that works on a wide variety of computer systems. However, I would like to have a portable ‘real’ Ubuntu installation vs. a live/persistent install that works with both UEFI and BIOS boot methods.

The process outlined here looked like it would do the trick, but in my case I’m just presented with the grub prompt when booting the drive. Note, that I interpreted the step:

Cut grub.cfg from sdx5/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file 

…to mean that I should move the new grub.cfg file from /dev/sdx5/boot/grub to /dev/sdx3/boot/grub, overwriting the grub.cfg file created by mkusb and deleting the grub configuration file created by the installation from the installation partition. Also, /dev/sdx3 was not mounted after the Ubuntu installation completed, I had to manually mount it (/dev/sdx5 was already mounted on /target).

Since mkusb without modifications works fine with the T5 SSD drive, I assume that there is something about the Ubuntu 18.04.2 LTS installation grub.cfg file that is causing an issue.

Is there an alternative approach that would work, or is there something inherently different with a portable SSD vs. a USB thumb drive that prevents creating a truly portable drive?

How long does it take to place an item in a Bag of Holding or Portable Hole?

The descriptions of a Bag of Holding and Portable Hole are very specific about how long it takes to retrieve items from them, but do not have any indication of how long it takes to place an item in them. In contrast, the description of the Handy Haversack specifically says that placing an object in it requires your object interaction.

So, if my character wanted to place an object in a Bag of Holding or Portable Hole in the middle of combat, would it require an action, object interaction, or something else?