on-internet

Powershell Script to Remove all Expired Certificates on a Group of Servers

We are cleaning up our server environment and need to find all expired certs and delete them. The environment consists of Windows 2008 R2, Windows 2012, Windows 2012 R2 servers I have tried several published scripts that don't work, they just say completed with no output. I tried one published in stackoverflow: Powershell Script to remove expired certificates. I have also tried a few of the scripts below as well with no luck. Using the one by thumbprint is ok but I need to get rid of all expired certs ''' Delete by thumbprint Get-ChildItem Cert:\LocalMachine\My\D20159B7772E33A6A33E436C938C6FE7

Join the discussion →

Visa for China: leisure and work

I am a European citizen and I will be attending an academic conference in China. However, after the conference I would like to travel a bit (say 10 days). The conference organizers are providing an invitation letter, but this only states the duration of the conference. Can I add leisure to this trip when applying for a visa? I also read the following: However, there is no distinctive line between tourist visa and business visa. In another word, tourist visa will not prevent you from conducting business in China. So would it be better to simply apply for a tourist visa?

Join the discussion →

Pytest running very slow for project

My pytest setup is running very slow, especially during collection phase. So I have put up a pytest setup for my Django project, and each Django app's test-files are located in its own folder, i.e., the tree looks as follows root | +--a | | | +--tests | | | +--conftest.py | +--testAa.py | +--testBa.py +--b | | | +--tests | | | +--conftest.py | +--testAb.py | +--testBb.py ... pytest.ini The pytest.ini file specifies where to look for the tests and has the following content [pytest] DJANGO_SETTINGS_MODULE = project.project.settings.test python_files = tests.py test_*.py *_tests.py addopts = --re

Join the discussion →

Is there an efficient way to build up regression model on panel data?

I have two-dimensional data, including frequent crime type in certain regions and corresponding house prices along the year. I want to understand possible association between crime frequency in certain regions and house price fluctuation. Initially, I tried to use linear regression to do that, but it didn't work well. Now I want to try PCA analysis on my data, but it is still not efficient to me to grab meaningful results. How can I perform efficient PCA analysis on panel data for the purpose of doing regression? any efficient workaround to make this happen? Data: Because my data is bit long i

Join the discussion →

How To Set Global Random Seed in Python

Like in R, I would like to set a random seed globally for the entire script/session, instead of having to call the random seed function every time I execute a function or run a model. I am aware that sci-kit learn uses the numpy RNG, but also could not find a way to set it globally. I have read several posts here on this topic, such as this one: Differences between numpy.random and random.random in Python It explains the difference between the two RNG classes, but not how to set it globally. Is there no way of doing this except for calling the random seed EVERY time I want the output to be the

Join the discussion →

How do I setup tnsnames.ora in asp.net core web application?

I have a small asp.net core 2.2 app that should access an oracle db; I'm using NuGet Oracle.ManagedDataAccess.Core (2.18.6), and it just works on my machine. When I deploy it to the windows server with IIS, I place a tnsnames.ora file in app's directory and again it just works. Now I want to use a shared tnsnames.ora file. I have tried web.config like following (recipy from StackOverflow/Google answers to similar questions). <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Ora

Join the discussion →

GuzzleHTTP returns 404 on existing page

My Guzzle POST request to https://api.scarif.dev/auth gives back a 404, while the page exists through Postman, or browser, or javascript. It should return a 200 with a 401 message, but Guzzle gives back a 404. In both POST and GET mode that is. I've tried multiple Client setups, including different headers and disabling SSL verification, but without any success. Now I've copied the exact same headers that made it work in postman, but still no success. I've been searching through google and stackoverflow, but couldn't find an answer that fixed my problem. Request in PHP: <?php $client = new Cli

Join the discussion →

Your account does not have permission to create Developer ID Application certificates

Can anyone help me with the following error message? I have seen a few of these messages in Xcode (and on Stackoverflow) but not exactly this one. I have an admin role (but I am not the account holder). Does anyone know why Xcode has problems with the creation of the Developer ID Application certificate? In Xcode I signed in with the admin account but still no success. Any help is highly appreciated!

Join the discussion →

Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /"

I just started following a symfony 4 tutorial I set up the whole project with composer and got the index file showing up in browser http://127.0.0.1:8000/ I'm stuck on the very first Router/Controller/View example The route is not working properly or at all. I always get a 404 error. 1: 2: 3: <?php namespace App\Controller; use Symfony\Component\HttpFoundation\Response; class LuckyController { public function number() { $number = random_int(0, 100); return new Response( '<html><body>Lucky number: '.$number.'</body></html>' ); } } # the "app_lucky_number" route name is not important yet app_luc

Join the discussion →

How to mock API calls made within a React component being tested with Jest

I'm trying to mock a fetch() that retrieves data into a component. I'm using this as a model for mocking my fetches, but I'm having trouble getting it to work. I'm getting this error when I run my tests: babel-plugin-jest-hoist: The module factory of 'jest.mock()' is not allowed to reference any out-of-scope variables. Is there a way I can have these functions return mock data instead of actually trying to make real API calls? Code utils/getUsers.js Returns users with roles mapped into each user. const getUsersWithRoles = rolesList => fetch(`/users`, { credentials: "include" }).then(response =

Join the discussion →

How to change PR merge commit message?

When pull requests are created, their commit message is always like "Merged PR### from {branch name} into {target branch name}" I keep amending commit messages and this is a bit tiring. I rely on the commit messages to keep track, so the automatic messages present a problem.

Join the discussion →

The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed for Selenium

I’m running a jupyter notebook on ubuntu server. I’m trying run the selenium code below using chromedriver. I’m getting the error below but if I run the line of code below in Ubuntu terminal it returns the output below. Does anyone know what the issue might be? I’m still pretty new to ubuntu. Ubuntu code: which google-chrome output: /usr/bin/google-chrome jupyter notebook code: driver = webdriver.Chrome(executable_path=os.path.abspath("/home/username/chromedriver"), chrome_options=chrome_options) error: --------------------------------------------------------------------------- WebDriverExcept

Join the discussion →

How do I make git add my code without recognizing it as a submodule?

I have two files, say FrontEnd and BackEnd in two separate git repos. I want to combine them into one repository, and copy-pasted them into a brand new repo. I get this error: hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> BackEnd hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached BackEn

Join the discussion →

How to correct Arraylist index out of bounds for length error in Java

I am writing a program for school which acts as a cash register. I am asking for input for prices of items and playing them into an ongoing ArrayList until the user enters -1 or 0. 0 is to re-enter the previous price in case of mistake and -1 terminates the loop. I am getting the java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 error when I try to run my code. I have to include a method called removeLastEntry(), which will remove the last price entered into the array upon a 0 being entered by the user. How can I ensure the array is populated and I am indeed removing the

Join the discussion →

Angular render complete event

What is the best way to capture a completed redraw/render event of an angular component? I want this to occur AFTER every time the component has re-rendered due to some input property changing. As far as I can see, ngOnChanges fires when any input property changes, but it fires before any subsequent component redraws occurs.

Join the discussion →

How to check if screen lock is enabled in the settings using adb

I need to know how to check if any type of screen lock is enabled in the settings part of the device. I need to check this using an adb command (by using adb shell). I also need to know the type of lock applied. I have tried dumpsys but did not get any success. I want to know if the screen lock is enabled in the settings even if the device is currently unlocked, just check if any security is there, in any state.

Join the discussion →

Is there a way on ojAlgo to normalize a Matrix?

I am interested to know if there is a way to find a normalized form for a MatrixStore using the ojAlgo matrix library. Perhaps a routine or a task that once performed on a MatrixStore will cause each of the rows to have a mean of 0 and a standard deviation of 1. If one is familiar with sklearn, what I'm looking for is some function on ojAlgo that functions similarly like the preprocessing module on sklearn.

Join the discussion →

Using Jest expected mock function to have been called one time, but it was called zero times

I am new to the Jest testing framework and so I wan't too mock a function that returns a Promise to test my click event button. I am receiving an error that says my method has not been called but I have it defined below as a jest.fn() and expect it to be called once. Any help in solving this or some clarity on why my code is wrong. const props = { activitiesStore: { isFirst:false, isLast:false, isLaunching:false, isLoaded:false, currentActivityIndex:115, markLessonFinished:() => { }, setContent:{ description: "In the CompTIA A+ training course, you will learn the fundamentals of computer techn

Join the discussion →

How to read large zip files in pyspark

I do have n number of .zip files on s3, which I want to process and extract some data out of them. zip files contains a single json file. In Spark we can read .gz files, but I didn't find any way to read data within .zip files. Can someone please help me out how can I process large zip files over spark using python. I came across some options like newAPIHadoopFile, but didn't get any luck with them, nor found way to implement them in pyspark. Please note the zip files are >1G, some are of 20G as well. Below is code, which I used: import zipfile import io file_name = "s3 file path for zip file"

Join the discussion →

Set charset different from UTF-8 in JSON Response

I have this get request in my controller in ASP.NET Core project [HttpGet] [Route("api/controller/getlastresult/{id}")] public IActionResult GetLatestResultForController(string id) { Response.ContentType = "application/json"; var list = _dbAccessLayer.GetAllVoteResults(); var appropriateResults = list.Where(item => item.DeviceId.Equals(id) && item.Status == "Finished") .OrderBy(item => item.TimeStarted); if (appropriateResults.Any()) return Ok(Json(appropriateResults.Last().Result)); return BadRequest(); } It works fine, but in the headers there is Content-Type: application/json; charset=utf-8

Join the discussion →

Using two html index pages with the same name but different extensions

I'm using two index pages with different contents and different extensions on my html site root folder, html and htm. The problem is that sometimes when I open my site in Chrome (or other browsers) I see the htm index file and sometimes vice versa. For various reasons (e.g avoiding 302 or 404 errors), I can't delete the htm index file. My questions are: 1. Why is this happening? 2. Which extension is more important in terms of priority in browsers view? 3. What are my options to overcome this problem? I have checked my html index file with applications like HTMLValidator and other services to

Join the discussion →

React Native : Flatlist and Array

it is a common question surely, but I can not render a FlatList with array source. I follow this example :https://medium.com/javascript-in-plain-english/how-to-loop-through-arrays-in-react-3eaa8a14445 The example begins with : let shoppingCart = [ {id: 35, item: 'jumper', color: 'red', size: 'medium', price: 20}, {id: 42, item: 'shirt', color: 'blue', size: 'medium', price: 15}, {id: 71, item: 'socks', color: 'black', size: 'all', price: 5}, ] This how I actually work to fill an array in my work. Then, I follow the instructions, with an arrangement : this.items = this.shoppingCart.map((item, k

Join the discussion →

How to create a bootstrap-table dynamically?

I'm having trouble developing a bootstrap-table by clicking a button. My goal is to add a sort feature for each columns on a table. So for my user case, when a user clicks on the button, it calls an ajax to grab a data from Database and sends back a result (it works so no worries on it). So i need to display the results as a bootstrap-table so i can use the sort feature for each column. Plus, I'm using pagination.js which uses Array of json objects and table to display the result. When I develop the table and append it into a div, I dont see the sort feature on each columns. It works when I cr

Join the discussion →

How to serialize in .NET MessagePack and deserialize in Node.js

I have a RabbitMQ queue and two applications. First application is written in .NET core to generate send the payload to queue and the second one is in Node.js to read from the queue. Producer Application I use MessagePack-CSharp to serialize and compress (LZ4) the payload. Here is the serialization code in .NET: using MessagePack; namespace uBeac.Serialization { public class MessageSerilizer { public static byte[] Serialize(object message) { MessagePackSerializer.SetDefaultResolver(MessagePack.Resolvers.ContractlessStandardResolver.Instance); return LZ4MessagePackSerializer.Serialize(message);

Join the discussion →
Older stories