on-internet

Open in Editor in Sublime Merge

https://www.sublimemerge.com I see there is an option on Sublime Merge, right-click file and Open in Editor..., that will open the file in the default editor (sublime text here). However sometimes I prefer to open files on QtCreator. How can I have multiple editors on Sublime Merge? And then choose which one to use while opening a file.

Join the discussion →

How to export all projects inside a group in GitLab

We are migrating from a self-hosted GitLab to a gitlab.com subscription. We have 28 parent groups and under these groups there are multiple subgroups and projects. I know I can export one group and it will export all the subgroups under it and then I can import it, but documentation says to export/import single projects. I have almost 3000+ projects and doing this 3000+ times is not practical. How can I export/import all the projects under a group regardless of whether it is in a group or under some other subgroup in the hierarchy?

Join the discussion →

What's the best way to manually save a webpage's html, so I can practice my parsing skills? (Right Clicking in Chrome isn't working)

I am just getting started on my first web scraping project. Before I go and install a headless browser etc, I thought I would just save the page manually and work on parsing the dom, as a mini project. Well, Trying to just save the page with right-clicking and saving the file as -> HTML only.... is not resulting in an HTML file with any of the information I am looking to parse. I see the information I want in HTML tags, when I open the console. How can I get the HTML with the information in an external file, so that I can play with loading it into my js script? Also curious why it is that righ

Join the discussion →

How to add hotkey in Python?

I'm making a bot for a game and I want to call the function when I press hotkey. I already tried some solutions but it is not good. Here is my code: def start(): while True: if keyboard.is_pressed('alt+s'): break ... def main(): while True: if keyboard.is_pressed('alt+p'): start() This way is stable but it causes a lag, it is hard for me to type something. def main(): keyboard.add_hotkey('alt+p', start, args=(), suppress=True, trigger_on_release=True) while True: # waiting for the user to press hotkey continue As I know keyboard.add_hotkey only returns output so I can't stop the loop in the st

Join the discussion →

Network communication between Windows + WSL2 + Docker

I have a web app hosted in a Docker container and exposes port 5050 that is mapped to port 80 of the container. The web app listens on 0.0.0.0:5050. The Docker engine runs on WSL2. Now when I open a browser on Windows and go to http://localhost:5050, everything works and I can see the web app. But I don't understand how the request can reach the Docker container when I navigate to localhost on Windows. Any ideas ?

Join the discussion →

Can't get personal access tokens to work with github for own repo

I've got a private repo I'm trying to push to, I'm on Centos 7. I cannot use SSH. Https says No anonymous write access. Stack overflow says to use personal access tokens. So I follow the directions, enable everysingle option under the token, and get a personal access token that looks something like: ghp_xxxxxxxxxxxxxxxxxxxxxxx I don't understand what I'm supposed to do with it though. I tried doing what one user said, and use my user name on github, with the access token as the password. Doing this: (note copy pasted ghp_xxxxxxxxxxxxxxxxxxxxxxx below, where ghp_xxxxxxxxxxxxxxxxxxxxxxx is repla

Join the discussion →

Possible conversion loss of data (warning C4244) [closed]

I am using an old compiler that made a a mistake in its warning diagnosis. typedef unsigned char uint8_t; // 8-bit byte typedef unsigned int uint32_t; // 32-bit word (change to "long" for 16-bit machines) typedef struct _sha256_ctx_t { uint8_t data[64]; uint32_t data_len; unsigned __int64 bit_len; // unsigned long long uint32_t state[8]; } sha256_ctx_t; void crypto_sha256_final(sha256_ctx_t *ctx, uint8_t *digest) { uint32_t i; i = ctx->data_len; // Append to the padding the total message's length in bits and transform. ctx->bit_len += ctx->data_len * 8; ctx->data[63] = ctx->bit_len; // LINE 15

Join the discussion →

How to set ability conditions using TypeScript

I am following CASL's cookbook on roles with predefined permissions. I have defined my PlatformAbility as follows, in line with the cookbook instructions. import { Ability, AbilityClass, ForcedSubject } from '@casl/ability'; const platformBaseActions = ['manage', 'read', 'write'] as const; const platformSubjects = [ 'all', 'membership', 'work-order', 'equipment', 'user', ] as const; type PlatformAbilities = [ typeof platformBaseActions[number], ( | typeof platformSubjects[number] | ForcedSubject<Exclude<typeof platformSubjects[number], 'all'>> ), ]; export type PlatformAbility = Ability<Platfo

Join the discussion →

Creating a function that works like "zip"

I am trying to make a function that does something similar to "zip". My problem is that the part a = L4[l:len(L4):len(L)] doesn't work. In the case below, it should take every third element from the L4, and append it to a new list, so I ended up with [[1, 4, 7], [2, 5, 8], [3, 6, 9]], but that is not really what is happening. Also, it would be even better if I could make tuples, so it would look like [(1, 4, 7), (2, 5, 8), (3, 6, 9)], but I don't know how to do that... L = [[1,2,3], [4,5,6], [7,8,9]] L4 = [] def my_zip(L): l = 0 for i in L: if isinstance(i, list): my_zip(i) else: L4.append(i)

Join the discussion →

Argtypes: uint8_t from C to Python

I'm using ctypes to use a C library in my Python script. I have a function in C library that accepts as argtypes uint8_t and was wondering how to invoke it from Python. This is the C function I'm referring to: void indcpa_keypair(uint8_t pk[KYBER_INDCPA_PUBLICKEYBYTES], uint8_t sk[KYBER_INDCPA_SECRETKEYBYTES]) My Python script where I'm trying to use it is this: def key_generation(): out = CDLL('./PQCgenKAT_kem.so') out.pqcrystals_kyber512_ref_indcpa_keypair.argtypes = #I don't know out.pqcrystals_kyber512_ref_indcpa_keypair.restype = None pk = [] * CRYPTO_PUBLICKEYBITES sk = [] * CRYPTO_SECRE

Join the discussion →

Is there a way to handle key not found when using operator.itemgetter without using a try-except block?

Is there any other option aside from wrapping itemgetter in a try/except block in case of a missing key? Like dict.get('bar', 'foo')? Example of usage: currentUser = { "id": 24, "name": "John Doe", "website": "http://mywebsite.com", "description": "I am an actor", "email": "[email protected]", "phone_number": "+12345678", "username": "johndoe", "birth_date": "1991-02-23", "followers": 46263, "following": 345, "like": 204, "comments": 9 } id, like, hhh = itemgetter("id","like", "hhh")(currentUser)

Join the discussion →

Polite ARIA live region for a game with high rate of messages

I'm running a little game on the web. In order for it to be optimally screen reader accessible, incoming messages, which can be about in-game actions or user text chat, have to be read automatically as soon as they arrive. Reading of messages has to be quick, but also reliable. Messages have to be read in order, and none must be prematurely interrupted or completely skipped. Otherwise, players may miss important events or information. Sometimes, messages arrive with a quite high frequency and/or in a burst. In any case, they have all to be read in order and without interruption. It may happen

Join the discussion →

How to format to "dd/MM/yyyy" in Blazor Webassembly

I'm new to Blazor and I'm working on a Blazor Webassembly project where I need to format the DateTime input as "dd/MM/yyyy". I already tried this: How to format the date using local culture using the blazor <InputDate /> tag Set dd/mm/yyyy in a custom InputDate component instead of 01/01/0001 in Blazor (This actaly is intresting, but thres nothing simplier?) Is there any way to change input type="date" format? This is what I have: <InputDate @bind-Value="@Model.Date1" class="form-control"/> <InputDate @bind-Value="@Model.Date2" class="form-control"/> <InputDate @bind-Value="@Model.Date3" class

Join the discussion →

Unable to access key and secrets in Azure Key Vault

I am the owner of an Azure Key Vault that I created. I created a key and a secret a day before. But today when I tried to create another key and secret, the Generate/Import button on top in the right pane is disabled and below it a following message is displayed: Firewall is turned on and your client IP address is not authorized to access this key vault. Networking section of the Key Vault has the following settings: Selected Networks and Allow trusted Microsoft services to bypass this filewall: Yes. Question: Why I am getting the above warning and how can we fix it. I was able to create a Key

Join the discussion →

A `cd` command in an executed Powershell script still affects the current session

Coming from the Unix world, scripts when executed (as opposed to sourced) are run in a subshell, and thus variable declarations and cd commands do not affect the actual current session (the one where we type our commands). For reference: # Executing a script ./myscript.ps1 # Sourcing a script . ./myscript.ps1 Very surprised (and quite frankly annoyed) to see than in Powershell, executing a script will still affect my current session regarding cd commands (but not declared variables). How can I prevent this from happening ?

Join the discussion →

I can't get binance Futures order book historical data

I'm trying to get binance Futures order history data using API. So I asked for data from binance, got the answer "Your application for historical futures order book data has been approved, please follow our Github guidance to access with your whitelisted account API key" and I have set up the API as follows. And I have modified the Enable Symbol Whitelist like this: The next step, I followed Github guidance: https://github.com/binance/binance-public-data/tree/master/Futures_Order_Book_Download which has the following sample code: """ This example python script shows how to download the Histori

Join the discussion →

Stm32CubeProgrammer not connecting (no error msg) using ST-LINK V2 dongle and Lora E5 mini board

I've tried countless settings in an attempt to program my stm32 board. The main tutorial I followed is https://wiki.seeedstudio.com/LoRa_E5_mini/. I have connected a USB st-link v2 dongle to my laptop with pins SWDIO, SWCLK, GND correctly wired to the STM32 board. For power the board is also connected to a usb port via its type c connector. Serial comms over usb work, updating the st link firmware works and stm32cube programmer finds the st link device: I now press the reset button, hold it, click on Connect, release the reset button after 3 seconds and then.. absolutly nothing happens and no

Join the discussion →

How to get multiple values by index in an ojAlgo-array?

Let's say I have an ojAlgo-array defined like this ArrayAnyD<Double> regularArray = ArrayAnyD.PRIMITIVE64.make(10); regularArray.loopAll((final long[] ref) -> regularArray.set(ref, ref[0]*ref[0])); which just contains the squares of the numbers from 0 to 9, and some indexes: long[] idxs = {1, 3, 4, 7, 9} Now, I'd like to do something akin to slicedArray = regularArray[idxs] which should give me another Array containing 1.0, 9.0, 16.0, 49.0, 81.0. How would I do that with ojAlgo? regularArray.get(idxs) only gives me the first value. regularArray.sliceSet(idxs, 0) returns all values from the fir

Join the discussion →

JPA insert query spring boot

I have class City which is: @Entity @Table(name="city",schema="rezervisi") public class City { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Getter @Setter private int id; @Getter @Setter @NotBlank(message = "Name is mandatory") private String name; } Now I want to override save method in which I send object city. How can I do it if i want to send whole object and not @Params separately. And also since ID is generated how I handle it through parameter here? Code for repository class is: public interface CityRepo extends JpaRepository<City,Integer> { @Query(value="select id, name fro

Join the discussion →

How does Visual Studio Code remember trusted workspaces?

I would like to know how Visual Studio Code remembers which folders, repositories and workspaces are "trusted". That is, where is the information stored? In my personal case, I want to know for Linux and Mac installations, but others may be interested in where it's stored in Windows too.

Join the discussion →

Uncaught TypeError: Cannot read properties of undefined (reading 'maps')

I'm trying to display map from google map on file html.twig, but this errors it displayed to me Uncaught TypeError: Cannot read properties of undefined (reading 'maps') my twig : let map, google; let markers = []; var infowindow = new google.maps.InfoWindow(); function initMap() { const haightAshbury = { lat: 36.77355514795189, lng: 9.088027850665279 }; map = new google.maps.Map(document.getElementById("map"), { zoom: 10, center: haightAshbury, draggable: true }); map.addListener("click", (event) => { addMarker(event.latLng); }); } function addMarker(location) { deleteMarkers(); const marker =

Join the discussion →

WARN: Unable to locate 'report-task.txt' in the workspace

My stage sonarqube always fails to run the job, I've made sure the server is correct. Console output Started by user Jesaya Fernando Napitupulu Obtained Jenkinsfile from git http://10.8.60.132/jesaya/simple-webapp.git [Pipeline] Start of Pipeline [Pipeline] podTemplate [Pipeline] { [Pipeline] node Created Pod: kubernetes jenkins/xjoj-61-kw27q-npzb8-x2q9c [Normal][jenkins/xjoj-61-kw27q-npzb8-x2q9c][Scheduled] Successfully assigned jenkins/xjoj-61-kw27q-npzb8-x2q9c to microk8s-worker [Normal][jenkins/xjoj-61-kw27q-npzb8-x2q9c][Pulled] Container image "docker.io/library/openjdk:11.0.14.1-jre" alr

Join the discussion →

How can we validate a Postgres database backup is not corrupted?

Is there a efficient way to check if the Postgres backups (for managed services like RDS and Cloudsql) are not corrupted? Currently one of the ways we are implementing this check is in the following way: spin up a new DB from the backup and run a vacuum if the vacuum runs successful we are considering the backup is not corrupted delete the test DB Does this sound like a valid approach and any better solution to this? PS: GCP has this open source tool to test on their end, but did not understand how we can implement or use it on a managed PG instance. https://github.com/google/pg_page_verificat

Join the discussion →

How do I use asyncio.Lock to stop a function from running more than once concurrently?

Looking into asyncio.Lock to stop a function from running at the same time as another. But am a little confused. Essentially what I need is for a cache update function to be locked if multiple requests are made to it at the same time (By the same user), or within close proximity of each other. This will prevent the external api from rate limiting this users token. app.ctx.cache = {} # {userToken: {user_information...} app.route(user_information, "/api/user_information") async def user_information(request): token = request.get("user_token") cooldown = 5 last_update = datetime.utcnow() - timedel

Join the discussion →

How to securely manage environment variables for AWS Elastic Beanstalk using Terraform?

We are managing an elastic beanstalk application via terraform, and are unsure of the best way to handle sensitive environment variables for our application. Currently, we are storing these sensitive values in an AWS Secrets Manager secret. During the terraform apply step, we use an aws_secrets_manager_secret data source to load the secret. We then iterate over the key/value pairs in the secret, and create setting blocks within our aws_elastic_beanstalk_environment resource. There are a couple of concerns we have with this approach: We have to mark our sensitive values as nonsensitive, because

Join the discussion →

Power Apps: Setting the default value of a dropdown to the second item

I'm using a dropdown in my Power Apps app. The default value for the dropdown is defined this way: If(Form1.Mode = FormMode.New, "-", Parent.Default) The possible options are: - Person A Person B Person C I would like to change the default value to the second option in the dropdown list. How would I go about doing that? I don't want to hardcode "Person A", because the list is dynamic and can change. I tried playing with Choices but couldn't get it to work. Thanks for any help!

Join the discussion →

Incrementing/Decrementing using JPanel and JButton

I have been trying to solve this for quite some time now and I can't figure out what am I doing wrong here Here is the code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PushCounterPanelMath extends JPanel { private int count; private JButton inc; private JButton dec; private JLabel label; public PushCounterPanelMath() { count = 0; inc = new JButton("Increment"); dec = new JButton("Decrement"); label = new JLabel(); inc.addActionListener(new ButtonListener()); dec.addActionListener(new ButtonListener()); add(inc); add(dec); add(label); setBackground(Color.cyan

Join the discussion →
Older stories