Is There A Clipboard For Windows 10?

What are the freely available Clipboard programs, if any, for Windows 10? Are there such? I don’t want ads in it and I prefer it simple as possible. No crazy or complex features. I’m only after a simple copy-paste of the short history of what I’ve copied on my desktop. I find this useful for my productivity. I somehow always ending up in open a Notepad and copying the items in there. It works but a clipboard would be better in my opinion.

ANSWER

Windows 10 already comes with a built-in Clipboard Manager. This was from an update some time ago. However it is not enabled by default, buried somewhere in the Settings and you will have to activate it. This feature is not very well known. But it is there and it works as expected.

To activate:

Open Settings via any of the following ways:

  • You can either search for it if you have that search bar on your Windows taskbar.
  • Start typing “Settings” when you have the Windows Start Menu opened.
  • Open the Start Menu then, then click on the Gear icon on the left hand side of the menu.
  • Windows + i shortcut key combo.

Once you are in Settings, go to System. That should be the first icon entry at the top.

You will be taken to another page where there are items at the left hand side. Scroll down and find Clipboard.

Under Clipboard history, toggle the button to On.

To get to your clipboard history, simply press Windows + V shortcut key combo. It will appear as a floating box over your last active application. Otherwise, it will show up on the right side of the desktop on top of the system tray.

The clipboard can contain a max of 25 entries. It is a FIFO (first in, first out) stack so the oldest entry will go out first once that entry limit is hit.

It supports plain text, HTML and images up to 4MB size.

Your clipboard history can be synced across your Windows devices. Be warned that if you enable this it means you are allowing Windows to save the history on Microsoft servers. Make sure you don’t have sensitive information in there when the Sync functionality is enabled.

Re-publish Kafka record not setting partition number?

Well, I plan to re-publish Kafka records that my app is consuming to another Kafka topic on another host (internal only). This sort of lets other groups consume data from this topic without having to create connections outside of the private network, since the original data source is a 3rd party vendor. They can then also do their own transformations or other business logic on it as if they were consuming from the original source. Delay from source to re-publish should be minimal. Will still be close to real time.

What I normally do when producing records is not to set a partition by default. Would this be okay when re-publishing records? Will there be conflict with original record partition number to the target topic partition?

ANSWER

How many partitions does your target topic have? Do you have freedom to create as many partitions as the source?

(1) If you can create 1:1 partitions then my suggestion is to retain the original partition number of that record when you publish to the destination topic.

(2) You can also assign the partition in a round-robin way when you have lesser partitions on your target topic. Save metadata info of that record in the headers, such as original partition assignment and etc. Perhaps that will be useful down the line for your consumers.

(3) Lastly, you can NOT assign a partition number. Instead, let Kafka do the magic for you. When no partitions are set, Kafka will determine the next partition in a round robin method. You can do this with a null value instead of an int for partition number.

Bottom line is that it depends on the project requirements, I suppose, or more so on the infrastructure of your destination Kafka.

Can’t copy text from webpage?

Sometimes I come upon a website that I cannot copy text from a HTML web page. Simply cannot click and highlight the lines I try to select for copying. I thought that my browser/mouse was not working. But I go to other sites, I am able to highlight/copy normally. They must’ve done something on that page probably to prevent content from being lifted of the page easily?

Why is this and how do they do it? Is this a javascript in the page that prevents me from copying?

ANSWER

Could be a script on the webpage. I’m certain that can be done or already been done through Javascript before.

I know that the same effect can be achieved via CSS alone. It is easier, cleaner and does not add to another Javascript messing up or slowing down a site. I prefer this method over the other.

Below are the CSS lines that does what you want. Different ones for different browsers. It is vendor specific for some, but does the same exact thing.

   user-select: none; /* Supported by Chrome, Firefox & Opera */
  -moz-user-select: none; /* Firefox (older) */
  -ms-user-select: none; /* Edge */
  -khtml-user-select: none; /* Konqueror */
  -webkit-touch-callout: none; /* Safari for iOS */
  -webkit-user-select: none; /* Safari for Mac */

Try it out. You can make it for entire page/site.

* {
     /* CSS lines go here */
}

Or you can make it so only targeted content will have it using Class or ID selectors.

#text-no-select {
     /* ID selector -  CSS lines go here */
}

.text-no-select {
     /* Class selector -  CSS lines go here */
}

Be aware this does not totally prevent anyone from copying content on a website. There are many other ways to go around this or even with a Javascript impementation. It is a minor roadblock.

How to make IntelliJ check and create SerialVersionUID

When the class implements Serializable I want the serialVersionUID field to be auto-created by IntelliJ IDE. This feature comes in automatically in Eclipse. But the former does not.

How do I make IntelliJ create the field or warn me that it is not defined in the class yet?

ANSWER

It is not turned on by default in IntelliJ. Can be easily done by going to the following:

File > Settings > Editor > Inspections > Java > Serialization Issues

Then find and select – Serializable class without ‘serialVersionUID’ – by checking on the box to the right of it.

Similarly, you can search for it once in File > Settings. Keyword for search can be – ‘serialVersionUID’ – without the quotes.

The path or location of this feature on IntelliJ may vary. It should be the same on Linux and Windows for versions 2019 and 2020.

This will only throw a warning. It does not magically create the field in all those classes that implements Serializable straight away. But then IntelliJ will help you create it, like any other decent IDE out there. Go to the class name declaration, you may find that it is subtly highlighted in yellow to hint that there is a user action that can be done. Hover then click on the option – Add ‘serialVersionUID’ field – and you will get the desired result like this one:

private static final long serialVersionUID = 6265605531073886420L;

Database tables map One To Many without foreign key in @JoinColumn

Possible to not have foreign key relationship in child table to its parent in the database, while in JPA it will still be able to map out fine? How will this be done?

Can I still use @JoinColumn to define the field for reference back to the parent table?

This is a one-to-many relationship. One parent record, many child records.

I only care about writes to the database tables right now.

ANSWER

Yes, no FKs defined in the database is fine. JPA will still be able to map out there relationships as defined in your entity classes.

In fact, enabling – spring.jpa.generate-ddl – in your application properties file will create the necessary Foreign Key and/or Unique Key constraints in the database. This is vendor dependent however.

For a One To Many relationship, it is straightforward to do. Example below definition below:

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "recommendation_id")
    private List<CommentEntity> commentList;

This will map out the entity object values to the Comment table, assuming that is the name of the target table. Each one will be persisted to the child table along with the ID of the parent Recomendation under the recommendation_id column.

How to ignore unknown fields when parsing JSON using Jackson

In Java, there is Jackson 2 library that is very popularly used when reading JSON objects and mapping those values out to a POJO.

Happy path, as long a I have all the fields from the JSON defined in the POJO then okay. In a perfect world it will work 100%.

But there is no perfect world. The JSON object in other scenarios can contain unknown fields. These are not in my POJO. Application fails from reading that JSON to POJO.

Getting this error:

Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "status" (class com.example.dto.Evaluation), not marked as ignorable (6 known properties: "Book",

ANSWER

Use this Jackson annotation at a class level. This has to be configured per class. That should do it. Will ignore any unknown properties silently including nested objects.

@JsonIgnoreProperties(ignoreUnknown = true)

When you are using Jackson ObjectMapper directly, that can be configured to ignore unknown properties globally as well.

ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

How Do I Decode An OpenShift Secret In A Mounted Volume?

Mounting an OpenShift Secret to its own volume is straightforward. There are plenty of examples on how to do it. The Web is littered with examples. Next, the most common thing any manual, guide or tutorial would say is to encode the secret in Base64.

For example I have a SSL certificate stored in a Java KeyStore file format or JKS. The recommended way is to store it in a Secret instead of ConfigMap since it is sensitive information. Of course, that goes without saying the JKS file is password-protected.

Second, it must be as a Base64 string before I save it as OpenShift Secret.

How do I get the Base64 string to be decoded in the mounted volume? This one does not seem to get many answers.

Do I need to include shell commands to decode it and write it to a folder?

Which folder should I write it to as best practice?

ANSWER

#1 The encoded JKS Secret as an environment variable

This is an option but I’m not a fan of it. The JKS file when encoded can become very long, especially when the file size is large. I don’t think environment variables were meant to be used like this – hold very long text values. That said, this is an easier implementation.

Map out the secret as an env var in OpenShift or Kubernetes. Then you can use that env var to echo the value and write it out to a file.

echo -n $SECRET_JKS_VAR | base64 --decode > /file/path/to/decoded-secret.jks

#2 Mount for read, mount for write

You have the secret mounted to a file path. That is for reading. Now you need to decode, which means writing to a file so your application can read it back unencoded.

First, define a mount point as and empty directory. It must be writable. Then make it memory only.

Next, read the JKS file from its mount point, write it out to the empty dir mount point.

cat /mount/file/path/for-reading/encoded-secret.jks | base 64 --decode > /mount/file/path/for-writing/decoded-secret.jks

I like this approach better. It makes more sense rather than mapping a very long base64-encoded text value as an environment variable. The caveat is here is slightly more configurations to be made. Also if I’m not mistaken the in-memory volume count against your app memory quota. Should be negligible unless you write thousands of files into it.

#3 Lastly, write where you can

Underneath that container is a file system. Where you have permission to write, then do so there. If it’s Linux, then this decision is pretty much arbitrary IMHO. Put it in /tmp or /home or /mnt. Security wise, others might have access to your app’s pod, that means they can get to the Secret as well. But that is another topic.

WorPress Editor Won’t Load Content Anymore

Got this weird WordPress behaviour recently. While most pages load successfully, editing something – like a post or a page – will draw a blank browser tab. Zero content whatsoever. It has the same result for both Firefox and Chrome. Not tried on other browsers.

ANSWER

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'unsafe-inline'

This was the error that I got when I went into the page, opened developer tools, then reloaded the page.

Caused by additional custom Header policy on the web server of the website. Looks something like this:

Header set Content-Security-Policy "default-src 'unsafe-inline' 

Add ‘unsafe-eval’ to go around it. Use of eval() is usually considered bad practice and not secure hence it’s getting blocked until it is allowed by adding it into the policy. Now the Header will look like this after modifying it. Don’t forget to restart the web server.

Header set Content-Security-Policy "default-src 'unsafe-inline' 

More detailed explanations can be had here: https://scotthelme.co.uk/content-security-policy-an-introduction/

How do I make my async coroutine function not block?

I’m trying to write some concurrent Python.

In my app below, I’m trying to subscribe to a websocket feed, but then continue through the app, so this code should just print hello. Instead, it blocks on feed.__init__.

I’m hoping I can build a websocket client to some update some application state.

How do I do feed.__init__ and continue running my program, while the websocket runs in the background?

def main():
  myFeed = feed('XBTUSD')
  while True:
    "hello"


import websockets
import asyncio
import json

class feed:
    def __init__(self, symbol):
        self.symbol = symbol
        self.uri = "wss://www.bitmex.com/realtime?subscribe=instrument,quote:{}".format(symbol)
        asyncio.get_event_loop().run_until_complete(self.socket())
        # asyncio.get_event_loop().run_forever()
   

    async def socket(self):
      async with websockets.connect(self.uri) as websocket:
        while True: 
          msg = await websocket.recv()
          self.process_msg(json.loads(msg))

    def process_msg(self, msg):
      try:
        data = msg['data'][0]
        if data['symbol'] == self.symbol:
            self.last_message = msg 

      except:
        print("Unhandled") 

Go to Source
Author: cjm2671

Is there a way to add an event from the top panel calendar without opening up the calendar app?

I just want a little “+” button on the top bar calendar so I can add events without having to go into the full calendar.

I think it would be very quick and useful for most people instead of a read-only solution in the top panel.

Does a solution exist for this? How do I go about implementing such a solution if it does not?

Go to Source
Author: plants

gnuplot: Can you set shell variables in a script and then later call them?

I want to be able to issue shell commands from a gnuplot script, such as setting a variable, but it appears that the system command spawns a new shell instance as opposed to issuing commands to the shell instance which is running the gnuplot script. See the following script where the first line allows assignment of $foo, but the second line cannot access that variable. In this case, $foo is assigned as an arbitrary string as opposed to a reference to the directory, hence the "

#!/usr/bin/gnuplot -p
system "export foo="$HOME/path/to/dir";echo $foo"
system "echo $foo"
set datafile separator "t"
#plot "`echo $foo`/bar.dat" using 2:3
plot "<( sed '5p' $foo/bar.dat )" using 2:3

Go to Source
Author: T. Zack Crawford

How to use Apache resource by HTTPS in pacemaker?

I have a problem when i change apache url to HTTPS. Before the change every this working fine with http. Now my company need to use the Virtal ip by HTTPS. so that i didn’t find any suitable tutorial about this issue.

i am working on debian 9. more details are below:

/etc/apache2/status.conf

 <Location /server-status>
 SetHandler server-status
 Order Deny,Allow
 Deny from all
 Require local
 </Location>

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
.....
DocumentRoot /var/www/html
Redirect "/" "https://ip_address/"
....
</VirtualHost>

Error i received

Failed Actions:
* Apache_monitor_0 on server1 'unknown error' (1): call=59, status=complete, exitreason='none',
    last-rc-change='Wed Sep  9 17:28:19 2020', queued=0ms, exec=71ms
* pgsqld_promote_0 on server2 'unknown error' (1): call=63, status=complete, exitreason='server1 is the best candidate to promote, aborting current promotion',
    last-rc-change='Wed Sep  9 16:57:25 2020', queued=0ms, exec=496ms

pcs status

I tried to add resource like this but it didn’t work

pcs resource create Apache ocf:heartbeat:apache  configfile=/etc/apache2/apache2.conf  statusurl="https://localhost/server-status"  op monitor interval=1min --force

pcs resource create Apache ocf:heartbeat:apache  configfile=/etc/apache2/apache2.conf  statusurl="http://localhost/server-status"  op monitor interval=1min --force

Go to Source
Author: Karippery

Bulk VMware vCenter updates vs. GitOps

What is state of the art for managing* multiple VMware vCenter hosts in terms of GitOps?

What I read in the online documentation, it feels like less GitOps but maybe I have missed something.

Managing vCenter hosts can include:

  • update licenses (automation works for provisioning but not update?)
  • install updates “download ZIP files..” (browser login..)

Go to Source
Author: Peter Muryshkin

How to prevent WordPress from redirecting single page to prefixed category archive with same name?

I have been trying to solve this problem for hours. I would like to have a page with a simple slug (/blog) and a category term with the same name (/category/blog) exist on my site together at the same time. But the problem I am running into is that my page (/blog) keeps redirecting to the category archive page (/category/blog).

I have tried the following:

  • adjusting my permalinks by clearly specifying my category base
  • using remove_action(‘template_redirect’, ‘redirect_canonical’); to suppress redirects
  • using add_filter( ‘template_redirect’, ‘blog_redirect_filter’, 10, 3 ); to try and target my blog category specifically

I am running out of ideas. How can I stop my site from redirecting an existing page to a category archive when they each have different slugs?

EDIT

I figured it out! Classic wait-until-you-post-publicly-before-figuring-it-out-yourself problem. It was a fun mix of Yoast, custom permalinks, and category bases all conflicting with each other.

My answer:

  • Make sure your category base is specified in Permalinks. Save them.
  • Remove any custom permalink slugs in the category terms.
  • Go to Yoast > Search Appearance > Taxonomies and scroll to the very bottom. Make sure Category URLs is set to Keep.
  • Clear any cache and/or flush_rewrite_rules.
  • Voila it’s fixed.

Go to Source
Author: Beth Mac

db2cli license file not being used

I’m using the db2 driver for CLI and ODBC to configure an ODBC connection to DB2 on IBM i/OS from CentOS. I’m trying the following command:

db2cli execsql -connstring "protocol=TCPIP;database=MyDB;hostname=MyHost;ServiceName=446;uid=MyUser;pwd=MyPass"

And getting the following error which seems pretty straightforward:

[IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968

I believe I have the paths and everything correct:

# Environment
export PATH=$PATH:/opt/DB2/odbc_cli/clidriver/bin/
export DB2_CLI_DRIVER_INSTALL_PATH=/opt/DB2/odbc_cli/clidriver
export LD_LIBRARY_PATH=/opt/DB2/odbc_cli/clidriver/lib

license file: /opt/DB2/odbc_cli/clidriver/license/db2consv_is.lic

I have also attempted to move the license to a few other paths without any success. It is valid and works on another (windows) installation without issues. Any idea what I can troubleshoot from here?

Go to Source
Author: user19702