Displaying Full Storage Capacity after removing Wndows 10 after a dual boot

I’m not able to access the available storage list. It only shows a partial section of the memory leaving out the former memory which had Windows 10 installed in it. I’m sending a screenshot just for clarification.
MY hard-disk contains 500GiB but it says only 135GiB left
Kindly help pls.the image shows the partitions and the notification about only showing 135GiB leaving out the rest of the memory

Go to Source
Author: Kelvin

Best way to deal with lots of nested closures in Swift

I have some external SDK library that makes IO calls (either networking or database) in the form of blocks, like so:

SomeClass.doWork(success: {}, failure: {})

Now I need to chain about 60 different calls because we are working on data replication where each operation is distinct enough that it’s not the same, but the principle is there -> all of these take a success and a failure blocks.

What is the best way to organise this spaghetti:

let failureBlock: () -> Void = { // something
}

SomeClass.doWork(success: { [unowned self] in
   self.runChecks(success: {
       SomeOtherClass.somethingElse(success: { 
           SomeClass.doWork(success: { [unowned self] in
              self.doMore() ///... and on and on she goes
           }, failure: failureBlock)
       }, failure: failureBlock)
    }, failure: failureBlock)
}, failure: failureBlock)

Go to Source
Author: zaitsman

mongodump and restore in single command

How to perform mongo DB dump and restore in a single command, by providing source and sink DB and collection name separately?

I understand we can do mongodump and then mongorestore but if I need to this on an intermediate machine, this will mean I will need to wait for mongodump to complete before I can start mongorestore manually again. Is there a way to do it in a single command?

Go to Source
Author: Shubham A.

Get/create the parent taxonomy by using shortcode in woocommerce?

How would I get/create the parent taxonomy by using shortcode in woocommerce?

My product categories should be like:

– Food

— Fruits

— Healthy Fruits
— Organic Fruits

— Meat

— Pork
— Lamb
— Beef

For example, I would like to display “Fruits” when user at the “Healthy Fruits” product archive page.

Go to Source
Author: Needa Hell

How do remove the default storage pool from a libvirt hypervisor, so that even after libvirtd restarts there is NO storage pool

I want to remove the default storage pool from my virt-manager AND NOT HAVE IT COME BACK BY ITSELF, EVER. I can destroy it and undefine it all I want, but when i restart libvirtd (for me thats “sudo systemctl restart libvirtd” in an arch linux terminal window), and restart virt-manager, the default storage pool is back, just like Frankenstein.

I don’t want a storage pool of any kind. I simply want to move from the dual-boot I have now (arch linux and windows) to running the two OS simultaneously. I intend to provision two physical disk partitions on the host to be disks on the guest, and I can do this via the xml that defines the domain.

Or am i required to have a storage pool no matter what?

Go to Source
Author: Scott Petrack

How do I apply a Statement in my bucket policy to all users in my account?

Setting the princable to “*” with “Effect”: “Allow”, would make it public and i don’t want that.

“arn:aws:iam::my account id:user/*” is showing as invalid.

currently im just listing all the users in the princable but thats not exactly very maintainable.

I can allow in the IAM policy attached to the users and then deny in the bucket policy useing NotPrincipal but I can see that getting a bit complex and it seems much more secure to white list than black list?

Go to Source
Author: doug

Need help with .htaccess redirection for WordPress websites

I am changing the domain of my website.

But, I am struggling with the domain redirection. I need to implement this wildcard redirection.

So that I visit.

https://www.oldomain.com/page1

It should go to

https://newdomain.com/page1

Note: The new domain is without www.

Can anyone help me how to implement this?

Go to Source
Author: Nirmal Kumar

ANSWER

A 301 Redirect, or permanent redirect, is recommended when dealing with something similar to this one.

If you just want to hard redirect anything hitting oldomain.com to newdomain.com then a simple Redirect should do like so:

<VirtualHost *:443>
	ServerName oldomain.com
        ServerAlias www.oldomain.com
	Redirect 301 / https://newdomain.com
</VirtualHost>

The above example is also something that you will want to write in a server config like httpd.conf but not in a .htaccess file somewhere on your site directory. It is also clumsy since your old site’s pages – e.g https://www.domain.com/some/page/123 – will redirect only to https://newdomain.com which is the index page of the site.

So the other option would be Rewrite. It is also in case you don’t have root access to the server, and/or other sites that are not yours are sharing it as well. It would look like the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.oldomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301,NC]

The above considers whether the request is written with or without the www subdomain in it. The old links or pages will also get carried over to the new one.

How to get center point (CGPoint) of a UIView that has been set using autolayout

So I haven’t seen any other SO question about this. Basically, I have set a UIView with autolayout, programmatically.

The issue occurs when I try to create a UIBezierPath:

let circularPath = UIBezierPath(arcCenter: myView.center, radius: (91*(1.2))/2 - (8/2), startAngle: -CGFloat.pi / 2, endAngle: 2 * CGFloat.pi, clockwise: true)

The issue is that the myView.center prints out: 0.0, 0.0 since I did not set a CGRect .frame for the myView, and instead used autolayout (which is below):

NSLayoutConstraint.activate([
    myView.heightAnchor.constraint(equalToConstant: 91),
    myView.widthAnchor.constraint(equalToConstant: 91),
    myView.centerXAnchor.constraint(equalToSystemSpacingAfter: myButton.centerXAnchor, multiplier: 1),
    myView.centerYAnchor.constraint(equalToSystemSpacingBelow: myButton.centerYAnchor, multiplier: 1),
])

and also perhaps I should note that myView is added as a subview of myButton (though this shouldn’t really matter..)

So how do I make this work? how could I get the .center (a type CGPoint) to use in the UIBezierPath? THANKS!

Go to Source
Author: GEO G

VNC on Ubuntu 20.04 without monitor

Since couple of days I am trying to set VNC Connection with my “server” Ubuntu desktop 20.04. I want to use it as remote workstation and I want to use gnome3 environment, VNC Connect or NoMachine (for better management). Everything works well as long as monitor is attached. As soon as I remove monitor – connection breaks. Ok, that’s how it works. I have created dummy screen…

sudo apt-get install xserver-xorg-video-dummy

With config based on this post:

Add Fake Display when No Monitor is Plugged In

I can access server, but it stuck on login screen with password prompt. When I put password, nothing happen. Still login screen with password prompt.

If anybody have any idea – please, help.

Regards

Go to Source
Author: sawax

How is a source RPM different from unpacking an RPM with rpm2cpio and cpio?

I am attempting to understand the use of a .srpm aka “source rpm” Red Hat Package Manager package. From what I understand so far, a .srpm is different from a standard .rpm in that it provides the source code and is commonly used during development. I am puzzled on why this is useful because if I run rpm2cpio ./myrpm-1.1-1.x86_64.rpm | cpio -idmv, I can still view the source code. As I understand, even standard RPMs pull down a .tar.gz/bz file which contains the source, and eventually builds this. Could you please clarify how source RPMs are different and why I would want to use one?

Go to Source
Author: the_endian

Getting proper output of my SELECT clause. SQLite

I am coding a bus connection search engine. My goal is to see the time when the bus is departing, while the stop_from and stop_to names are provided.

I have created the STOP table

CREATE TABLE STOP (
ID INTEGER PRIMARY KEY,
STOP_NAME TEXT NOT NULL,
ROUTE_ID INTEGER NOT NULL
);

and the TIMETABLE table

CREATE TABLE TIMETABLE (
ID INTEGER PRIMARY KEY, 
TIME TEXT NOT NULL,
STOP_ID INTEGER NOT NULL,
FOREIGN KEY (STOP_ID) REFERENCES STOP (ID)
);

The route starts in Lidzbark Warmiński and leads via Smolajny and Dobre Miasto to Olsztyn. There are four connections per day. And I have also inserted all the possible routes from Lidzbark Warmiński to Olsztyn

INSERT INTO STOP VALUES
(1,'Lidzbark Warmiński', 1),
(2, 'Smolajny', 1),
(3, 'Dobre Miasto', 1),
(4, 'Olsztyn', 1),
(5, 'Lidzbark Warmiński', 2),
(6, 'Smolajny', 2),
(7, 'Dobre Miasto', 2),
(8, 'Lidzbark Warmiński', 3),
(9, 'Smolajny', 3),
(10, 'Smolajny', 4),
(11, 'Dobre Miasto', 4),
(12, 'Smolajny', 5),
(13, 'Olsztyn', 5),
(14, 'Dobre Miasto', 6),
(15, 'Olsztyn', 6),
(16, 'Smolajny', 7),
(17, 'Dobre Miasto', 7),
(18, 'Olsztyn', 7);

and the timetables regarding them

INSERT INTO TIMETABLE VALUES
--towards Olsztyn
(1, '08:00', 1),
(2, '12:00', 1),
(3, '15:00', 1),
(4, '19:00', 1),
(5, '08:00', 2),
(6, '12:00', 2),
(7, '15:00', 2),
(8, '19:00', 2),
(9, '08:00', 3),
(10, '12:00', 3),
(11, '15:00', 3),
(12, '19:00', 3),
(13, '08:20', 4),
(14, '12:20', 4),
(15, '15:20', 4),
(16, '19:20', 4),
(17, '08:20', 5),
(18, '12:20', 5),
(19, '15:20', 5),
(20, '19:20', 5),
(21, '08:30', 6),
(22, '12:30', 6),
(23, '15:30', 6),
(24, '19:30', 6),
(25, '08:20', 7),
(26, '12:20', 7),
(27, '15:20', 7),
(28, '19:20', 7);

I am developing under python 3.8 and this is a function with my SELECT clause

def fetch_hours(cursor, stop_from_name, stop_to_name):
    cursor.execute(
        '''SELECT T.TIME FROM TIMETABLE T
             JOIN STOP S1 ON T.STOP_ID = S1.ID 
             JOIN STOP S2 ON S2.ROUTE_ID = S1.ROUTE_ID 
             WHERE S1.STOP_NAME = ? 
             AND S2.STOP_NAME = ? ORDER BY T.TIME ASC''', 
        (stop_from_name, stop_to_name)) 
    return cursor.fetchall()

However, I have encountered some problems. For a wide range of bus stops this code doesn’t work well. Providing stop_from Smolajny and stop_to Dobre Miasto, the result is

Departures: 08:00, 08:30, 12:00, 12:30, 15:00, 15:30, 19:00, 19:30

While I would like to see only four hours. For some connections it doesn’t work at all and for some it is OK.

The desired effect is to see four departure hours for any stop_from and stop_to on this route (from Lidzbark Warmiński to Olsztyn). The reverse route is now commented, and if it would be helpful, the rest of my code can be achieved here: https://github.com/wwmarkositrawe/autobusy-backend

While looking for help,
Wishing you best regards,
marasecki

Go to Source
Author: marasecki

Debian 10.4 / Exim 4.92 add incremental delay to the unsuccessful login attempt answer

Browsed over all the internet, but cannot find an answer – is there any acl or something that I could apply to unsuccessful login attempt to add delay to it? As probably anyone running mx, I have a lot of bots logins trying to guess users passwords. To make dictionary attacks at least a bit more difficult, I’d like to add some (incremental is better) delay after each unsuccessful login attempt’s answer.
But cannot find how to do that with standard debian exim installation. Please share one with a brief explanation. Thank you.

Go to Source
Author: BbIKTOP

Prevention of RF-Capture Based Attack

I am looking for preventive measures to an RF-Capture based attack. I have found faraday material capable of attenuating wifi signals up to about 80-90dB, but is that sufficient to block all possibility of a close range attack? Or is it feasable that signals can be emitted strong enough to penetrate this barrier at close range?

Go to Source
Author: McWayWeb

Flight Information Regions / GIS

I want to create a flight planning tool for flight simulation and I am searching GIS information for Flight Information Regions globally. Of course there is the offical ICAO dataset around 3000 USD worth, but is there any kind of free data version you would know off? I didn’t have luck yet.

Kind regards
Sebastian

Go to Source
Author: konturgestalter

How do I link to a specific gmail search, google document etc on the correct google apps domain?

I want to provide links to specific GMail folders, GMail messages, Google Drive items etc on a company webpage.

Users may have multiple Google accounts and it is not guaranteed that their primary / default account is the company account.

You’d expect this to be trivial and well documented, but … not so much. Google multi-account support uses URLs with /u/2 (or similar) to differentiate users by login ordinal position in the current session. These links break if the user logs out of an account then back in and they cannot be shared correctly between users.

Google accounts have the seemingly undocumented feature of supporting /u?authuser=me@domain.com links which work but require a fully qualified user account. I could not find any documentation on it, nor any listing of supported paramters, and my guesses did not turn up any obvious “authdomain” type links that’d pick the currently logged in user matching the domain-part.

The redirect mechanism used by Google for subdomains does not appear to work for gmail links. You can’t take a link to https://mail.google.com/mail/u/1/#search/rfc822msgid%xxxxx%40mydomain.com and massage it into https://mail.mydomain.com/mail/u/#search/rfc822msgid%xxxxx%40mydomain.com or variants I tried with /u? etc. You’ll get an error like

Secure Connection Failed

An error occurred during a connection to mail.mydomain.com. PR_END_OF_FILE_ERROR

(Firefox)

This site can’t be reached

mail.mydomain.com unexpectedly closed the connection.

(Chrome)

So all in all, it’s ghastly. Not to mention that GMail searches to specific messages or threads are already painful; you have to “view source” because you can’t customise the headers shown, then hand-concoct a rfc822msgid:THE_MSGID_HERE msgid search.

Am I missing some simple sane way to just send a link that’ll take the recipient to a specific label, mailbox, message ID, search, etc?

Go to Source
Author: Craig Ringer