I somehow calculated 0=-1 I know I’m wrong but I need to know why I am wrong

This is my derivation n!/ (n-1)!= n . If I extend this derivation to negative integers ( I don’t know that I can extend it or not) then -1!/-2!=-1. If I take -1! as x and -2! as y then x/y=-1.From this I get x= -y. Now there is another factorial series or equation that I calculated somehow.This series or equation is n!/n-1= (n-1)!+(n-2)! ( I don’t know this equation already exists or not )now again if I extend this equation to negative integers ( again I don’t know I can extend this equation to negative integers or not) then 0!/-1=-1! + -2! which gives 1/-1= -1! + -2! which gives -1= -1! + -2! Now -1! = x and -2!= y so -1= x+y but from the first equation I already calculated x=-y so substituting for x in second equation I get -1= -y+y which gives -1 = 0 now my question is can I extend these basic equations of factorial which are valid for positive integers to negative factorial also ?and if no then why not ?

Is there a possibility to somehow overcome limitations of using generics in interface? (without boxing/unboxing)

I’m trying to create set of interfaces that will be used in several classes. But I have troubles with setting them properly. I want to keep them generic.

I tried to get around this using dynamic type and object type without success. Maybe this will be clear with attached those interfaces below:

In code below type T is unknown. I cannot specify it because each IDeviceParameter will be different type. And number of parameters is not fixed, so I want to simply add all available IParameters to list. Only solution that came into my mind is to use some sort of boxing/unboxing (for example cast int to object and vice versa) or use dynamic. Or to totally change those interfaces. Thanks you in advance for any advises.

public interface IDevice : IDisposable {     string Name { get; }     bool Close();     Guid DeviceGuid { get; }     IList<IDeviceParameter<T>>AvailableParameters { get; }     IList<IDeviceCommand> AvailableCommands { get; } }    public interface IDeviceParameter<T> {     event EventHandler<IDeviceParameter<T>> ParameterValueChanged;     event EventHandler<Exception> ParameterNotSet;     string ParameterName { get; }     string ParameterValue { get; }     string ParameterUnit { get; }     bool IsReadOnly { get; }     T Parameter { get; }     void SetParameter(T value); } 

Is there a possibility to somehow overcome limitations of using generics in interface? (without boxing/unboxing)

I’m trying to create set of interfaces that will be used in several classes. But I have troubles with setting them properly. I want to keep them generic.

I tried to get around this using dynamic type and object type without success. Maybe this will be clear with attached those interfaces below:

In code below type T is unknown. I cannot specify it because each IDeviceParameter will be different type. And number of parameters is not fixed, so I want to simply add all available IParameters to list. Only solution that came into my mind is to use some sort of boxing/unboxing (for example cast int to object and vice versa) or use dynamic. Or to totally change those interfaces. Thanks you in advance for any advises.

public interface IDevice : IDisposable {     string Name { get; }     bool Close();     Guid DeviceGuid { get; }     IList<IDeviceParameter<T>>AvailableParameters { get; }     IList<IDeviceCommand> AvailableCommands { get; } }    public interface IDeviceParameter<T> {     event EventHandler<IDeviceParameter<T>> ParameterValueChanged;     event EventHandler<Exception> ParameterNotSet;     string ParameterName { get; }     string ParameterValue { get; }     string ParameterUnit { get; }     bool IsReadOnly { get; }     T Parameter { get; }     void SetParameter(T value); } 

SD card is somehow read-only, from both Android and TWRP… how do I make it writable again?

My SD card is being weird.

I’m in TWRP, since a Lineage OS dirty flash (one without a wipe first) bricked my phone. Using the TWRP file manager, or the terminal, it doesn’t matter, moving files to it fails. Copying files to it fails. Deleting files from it fails. Formatting it fails. mkfs.ext2 from the terminal fails (vseek error). mkfs.fat doesn’t print any error, it may be returning a nonzero exit code but I can’t check. I’ve mounted and unmounted it multiple times, it doesn’t seem to help.

I’ve checked, and there’s no hardware switch on the SD card for read-only. Since it’s vfat, I’ve tried fsck.fat to no avail. Mounting it as rw didn’t really do anything, everything still fails (it was still mounted as rw afterwards, so it didn’t switch into read-only mode). All of that was tested from the terminal.

I’m not sure what’s going on. This is a perfectly reasonable SanDisk Ultra MicroSD card, that has worked before. Here’s the fsck output (I hit backspace on the first option, sorry for the ^H):

~ # fsck.fat /dev/lock/mmcblk1p1 fsck.fat 3.0.28 (2015-05-16) 0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. 1) Remove dirty bit 2) No action ? 1^H2 FATs differ but appear to be intact. Use which FAT ? 1) Use first FAT 2) Use second FAT ? 1 Reclaimed 7 unused clusters (229376 bytes). Perform changes ? (y/n): y /dev/block/mmcblk1p1: 310 files, 7718/973584 clusters 

My particular phone is a Samsung Galaxy Note 3, Verizon variant. I just rooted it and want to try a clean flash of Lineage OS but I need the ROM on an SD card for that. Either that or I can start a Windows VM to flash a ROM like that.

fc command somehow mapped to iv

I’d like to use the fc command 1. However when I type fc in bash I get

Command 'iv' not found, but can be installed with:  sudo apt install openimageio-tools 

That is weird because I didn’t even type iv. Furthermore the suggested package seems to be an image processing library which is far from what I want.

What is going on here and how can I use fc?

Somehow having trouble pinning Firefox Developer Edition to the dock, but only on my desktop

On my laptop, I downloaded Firefox Developer Edition, extracted it to ~/.firefox, created a desktop entry in my ~/Documents, copied it to /usr/share/applications, and it works perfectly

On my desktop, I did the exact same thing, yet somehow I’m not able to pin it to the dock, from the dock. If I pin it from the applications menu, then I get the default icon and the custom icon, at the same time, in my dock

I use the same icon pack on my laptop

Despite the desktop entries being identical

Two swapfiles, hibernate working, how to correctly configure hibernate to not run out of space, or fail somehow

I have configured hibernate, its working, just to make sure it will not fail sometime – this question.

I have two swap files on different devices, first is small swap on SSD, second as big as ram on HDD. Hibernate configured to small one. It works fine for now, as hibernate not always requires too much(not everything written or compressed, I don’t known).

How to configure hibernate to use both swaps? Or it process them automatically and nothing need to do? At kernel options I have setup for first small swap, and its good if it will use it first(as fastest) and then second.
I don’t want to make SSD swap larger as SSD is small.

leonid@DevSSD:~$   grep resume < /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=UUID=050f8852-d8f6-4979-a4e4-c3d9b981bee9 resume_offset=34816" 

/etc/fstab

UUID=050f8852-d8f6-4979-a4e4-c3d9b981bee9   /   ext4    relatime,grpquota,data=ordered,usrquota,rw,errors=remount-ro,quota  0   1 UUID=3bcf1591-7033-416a-addf-9cf8e2e10c93   /home/leonid/hdd    ext4    defaults,rw,errors=remount-ro   0   1 /swapfile                   none    swap    sw  0   0 /home/leonid/hdd/swapfile   none    swap    sw  0   0 UUID=26DA-1C76  /boot/efi   vfat    defaults    0   1 

Somehow my screensaver started kicking in just 10 seconds, how do I fix that?

I have my screensaver set to 10 min. and never go to hibernation. That works. Usually.

Somehow, today my screensaver started acting and after just 10 seconds the screensaver would kick in. Moving the mouse or using the keyboard constantly was enough to make the screensaver happy and not kick in.

I tried to change the timing to 30 min. then to Never timeout. It would still take just 10 seconds.

Any idea what could cause that to happen?

I’m (still) on Ubuntu 16.04. I have a desktop so it should not be a lid problem…

P.S. Although I fixed the problem by going back to my console and restarting X11, it’s not a great solution, hence the question here.