Native OneDrive not following configuration that is displayed with --display-config, causes constant pop-ups

Question: I installed native onedrive (not from PPA). Auth, started a sync.
Using /home/user/ as the sync_dir so it uses the Documents Pictures and Desktop directories for my user.
I set it to skip dot files, and also to check for .nosync, then I touch .nosync files in the directories I did not want synced like Downloads, VirtualBox\ VMs etc.
I keep getting these notifications for OneDrive no such file or directory, but they are all from dotted directories like .config or .cache, which I thought were ignored because of the skip_dotfiles being true.
Since this started happening, I touch .nosync files inside of .config and .cache, and have also started using the skip_dir parameter adding .cache|.config and have restarted daemon in between each but I still get the messages.
I did set it up as a service with
sudo systemctl enable onedrive@user

sudo systemctl start onedrive@user

Here is output of onedrive --display-config (run as 'user')
Configuration file successfully loaded
onedrive version                       = v2.4.13-1build1
Config path                            = /home/user/.config/onedrive
Config file found in config path       = true
Config option 'check_nosync'           = true
Config option 'sync_dir'               = /home/user/
Config option 'skip_dir'               = .cache|.config
Config option 'skip_file'              = ~*|.~*|*.tmp|sdc*.txt*|securelink*.log|desktop.ini
Config option 'skip_dotfiles'          = true
Config option 'skip_symlinks'          = true
Config option 'monitor_interval'       = 300
Config option 'min_notify_changes'     = 5
Config option 'log_dir'                = /var/log/onedrive/
Config option 'classify_as_big_delete' = 1000
Config option 'upload_only'            = false
Config option 'no_remote_delete'       = false
Config option 'remove_source_files'    = false
Config option 'sync_root_files'        = false
Selective sync 'sync_list' configured  = false
Business Shared Folders configured     = false

Here is example of what is constantly popping up on my screen:
screenshot of error messages
System is a fresh Kubuntu 22.04
Linux katana 5.15.0-50-generic #56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Thank you for the response. I have changed the config to use /home/user/OneDrive as sync root, created the soft links from /home/user/Documents (target) to /home/user/OneDrive/Documents (linkname) for Desktop, Pictures, etc. When I do a dry run it all seems to go fine, it shows Documents/ ... and not OneDrive/Documents for the linked folders. However when I run onedrive --synchronize --resync it fails:
$ onedrive --resync --synchronize
Configuration file successfully loaded
Configuring Global Azure AD Endpoints

A database statement execution error occurred: disk I/O error

Please retry your command with --resync to fix any local database corruption issues.

Segmentation fault (core dumped)

Comment: > A database statement execution error occurred: disk I/O error - this is because you are running a version less than v2.4.21 ... please upgrade your client.
Comment: @andrew.46♦ it says you edited this, what did you edit?
Comment: @ScriptyScript Looks like you provided extra information on your Question as an Answer; I *appended* the extra information to your Question and deleted the Answer.
Answer: Disclosure: I am the developer of the OneDrive Client for Linux - https://github.com/abraunegg/onedrive

I installed native onedrive (not from PPA). Auth, started a sync.
onedrive version                       = v2.4.13-1build1

Firstly, you are running an obsolete and unsupported client version. Do not install from Ubuntu repositories, do not install from any PPA. These contain unsupported and obsolete client versions.
Please install the correct client version following the procedure to install the client on Ubuntu platforms. This information can be found on the GitHub site: https://github.com/abraunegg/onedrive/blob/master/docs/ubuntu-package-install.md
To your actual issue, your issue stems from the following configuration you have made:

Config option 'sync_dir'               = /home/user/

Please do not do this.
As you have found out, it will attempt to start uploading all manner of items, and, literally cause a mess. If this truly is your desired configuration - you will have to configure a whole host of exclusions that you are probably not doing at the moment - which, if you do not do - could lead to things such as your SSH Keys being exposed online to OneDrive. Please do not do this sort of configuration.
Now .. I get that you want to upload Documents Pictures and Desktop directories for your user.
Your best solution here is to:

Configure the application to use a sync_dir of /home/user/OneDrive
Inside your /home/user/OneDrive - create a symbolic link to the directories you wish to sync, for example: /home/user/Desktop -> /home/user/OneDrive/Desktop ... so that the client will sync to OneDrive online the contents of those directories.

I set it to skip dot files, and also to check for .nosync, then I touch .nosync files in the directories I did not want synced like Downloads, VirtualBox\ VMs etc.

and:

Configuration file successfully loaded
Configuring Global Azure AD Endpoints

A database statement execution error occurred: disk I/O error

Please retry your command with --resync to fix any local database corruption issues.

Segmentation fault (core dumped)

This error is specifically caused by using any version less than v2.4.18 - so please upgrade your client to v2.4.21 or greater
What I suggest that you do:

Install the correct client version. You need to install v2.4.21 or later.
Configure the application correctly, validate with --display-config and test manually using --synchronize --dry-run --verbose to ensure the client is performing the operations and exclusions you are expecting.

If you run into issues, please follow the correct support process and open a discussion on the GitHub site.
Comment: You are free to your opinion - however this is 100% correct method for the application to advise that a new version has been released and it is time to upgrade. There are many folk who compile from source, or use Docker as well - not just 'repositories'. The OpenSuSE Build Service that provides the Debian|Ubuntu packages was also updated shortly thereafter - so Ubuntu should also be telling you that there is a new version available.
Comment: As for 'spamming' ..... advising once at application startup that something is out of date is not 'spamming' - it is called appropriate notification. There is a retry of this action post application startup every 24 hours - but again - this is certainly not 'spamming' by any definition. As for development learning - I have been using Linux since boot & root floppy disk days and have been developing software (commercial and open source) for close to 30 years now on a variety of systems ... so I do have quite a bit of knowledge on this matter.
Comment: Disappointing I can not backup from /home. The soft links did not work well and caused their own problems, which means whenever an application tries to save to its default folder, I have to manually put it in the correct folder, under onedrive. This whole setup is 'workable' but not ideal. I am looking for an alternative to this onedrive software that will work better. I wanted to ask why is your software so out of date from Ubuntu? I would get that fixed. Other software, the version I get from Ubuntu repos is the latest version, updated just days ago. Only your software is not.
Comment: You can backup from /home ... you need to configure the application to do so. Re ' I wanted to ask why is your software so out of date from Ubuntu?' ... because there is no package maintainer for Ubuntu ..... why dont you become the package maintainer?
Comment: It's not my software, and my time is devoted to paid work with little other time for volunteer projects. I wish you luck in your search to find a package maintainer.
Comment: This is why the the OpenSuSE Repo exists ....
Comment: You just released an update, and one day later my system is SPAMMED with notifications about it being out-of-date and obsolete. ONE DAY and you declare it obsolete and SPAM notifications? Nah, that is wrong. It is now apparent why you aren't on Ubuntu legitimately. You have some learning to accomplish, learning how to manage a software project. Uninstalled your poorly-managed software. I suggest you start with a google search to begin your learning "how to manage a software package on linux"


Is 2 ranks in V.A.N.S. better than 2 ranks in Perception Training?

Question: Let's say I wanted +2 Perception.
I could...

Put two points into Perception.
Put two points into VANS; the second rank gives you +2 Perception.

Seems like for 2 points I could have +2 Perception, or I could have +2 Perception and bonus VANS pathfinding.
VANS pathfinding isn't the best perk, but is there any downside to taking 2 ranks of VANS instead of 2 ranks of Perception?
Answer: The difference is that VANS gives a +2 bonus to Perception. It does not give +2 Perception.
This means that rank 2 VANS will not unlock Perception perks.
Comment: And when you go into vats there's a silly green arrow. Nope.


Purpose of Dummy Parameter in Postfix Operator Overload? c++

Question: When overloading the postfix operator, I can do something simple like
Class Foo
{
private:
   int someBS;
public:
   //declaration of  pre &postfix++
   Foo operator++();
   //rest of class not shown
};

Prefix doesn't need to take any parameters, so when I define it, something like
Foo Foo::operator()
{
   someBS ++;
   return *this;
}

and it makes perfect sense to me.
When I go to define the postfix overload I have to include a dummy int parameter
Foo Foo::operator++(int)
{
   Foo temp = *this;
   someBS ++;
   return temp;
}

My question is why? I don't ever use it in the method. The prefix operator doesn't require one. The postfix returning the temp value is not dependent on the dummy parameter. I know that if I want to overload a postfix operator that's how it's done, I just want to know the reason behind.
Comment: What alternative way would you propose?
Comment: @AlanStokes, How about  `Foo ++operator()` and `Foo operator++()`? ;)
(Only 5% serious...)
Comment: @kloffy I suspect that would introduce parsing ambiguities - `operator` was introduced specifically in order to make it possible to handle an operator being used as an ordinary name in the grammar. Anyway, if you have a time machine handy, you should definitely go back and suggest it to Bjarne.
Comment: @AlanStokes, No alternative way. Given that I was unsure of its purpose, I certainly didn't have a way to do it differently.
Answer: The dummy parameter is simply there to distinguish between the postfix and prefix operators. The name ++ or -- is the same in both cases, so there has to be some way to specify which one you're defining. Adding a dummy parameter is perhaps not elegant, but any alternatives would probably have required inventing new syntax (perhaps a postfix keyword, which would break code that uses postfix as an identifier).
Comment: @JeffreyDilley: You don't pass anything. You just say `lilBunny++;` -- The compiler determines that you want the postfix version by the fact that you put the `++` after the variable name, instead of before.
Comment: So then when I go to call the method with a class object, lets say something like "Foo lilBunny;", if I wanted to use the postfix on it, what value would I include in the parameter? Junk? If it's dummy, something has to be passed, but since it does nothing does what I pass matter?
Answer: Citing C++reference here:

Prefix versions of the built-in operators return references and postfix versions return values, and typical user-defined overloads follow the pattern so that the user-defined operators can be used in the same manner as the built-ins.

Explaining this logically:
int a = 3;
int b = 0;

int c = a + ++b;
int d = a++ + b;

In the third line, ++b gives you a reference to the updated value; in the fourth line, that's not possible: a has to be increased, so a value-copy is made, and added to b. That dictates different semantics for the operators.
In fact, just to avoid having another operator name:

The int parameter is a dummy parameter used to differentiate between prefix and postfix versions of the operators. When the user-defined postfix operator is called, the value passed in that parameter is always zero, although it may be changed by calling the operator using function call notation (e.g., a.operator++(2) or operator++(a, 2)).
Answer: To quote cppreference:

The int parameter is a dummy parameter used to differentiate between prefix and postfix versions of the operators.

The quote says it all, because how else would you differentiate prefix and postfix?
Let's just say that you don't need the int parameter, then the prefix (Foo operator++()) and postfix (Foo operator++()) would be exactly the same! How would the compiler know which one you meant? That's why there is this dummy int parameter.


Is it normal for a freestanding pergola to wobble a little bit?

Question: We built our first pergola (20'x 18' x 10' tall). We used cedar with 6 - 6x6 posts with 30-inch concrete footings attached with 1/2" J bolts to OWT/OZCO post bases. We have double 2x8 beams that span ~10ft with 2x6 rafters that span ~18ft and are connected with Simpson Hurricane Ties. Post to beam connections were made with 8-inch OWT timer bolts. I also put ~2ft braces up everywhere that I could. There were some issues with the patio not being level so I used some wood and stainless steel shims to ensure that the posts make good contact with the post bases and reduce any extra play.
On paper, I felt like everything seemed okay, and in a static situation or with light force the structure seems to be stable. The issue I noticed is that if I give it a hard push or if I try to rock it back and forth in the direction parallel with the rafters, the structure still wobbles a bit. It is pretty solid when you try to move it in the direction of the beams (this is the direction with 3 posts instead of 2) so I am not really worried about that.
We really like how it turned out but wanted to get other opinions on whether or not this would be considered safe. I don't want anyone to get hurt for the sake of my pride if we were to leave it alone.
Are there any suggestions on how to make it more sturdy? Would larger braces on the side with only 2 posts help? I also saw Simpson has some knee brace stabilizers and was thinking maybe those would work better than just the timber screws I used for the braces?

Edit: Adding photos of diagonal brace connections

Video of wobbling when forcefully shaking one of the posts: https://drive.google.com/open?id=15B0GaEV4My2gBfh_8d0WrulkR2FXMe2_
Comment: Can you provide close up shots of how the rafters are attached to the diagonals and to the beams?
Comment: Have you seen https://diy.stackexchange.com/questions/13636/how-do-i-improve-pergola-stability ?
Comment: "I don't want anyone to get hurt for the sake of my pride if we were to leave it alone." earns my vote!
Comment: When you shake it parallel with the joists/rafters, do the joints at the knee brace open up?
Comment: @RvdK yes I checked that one out and that's where I got the idea for the 45 degree braces. I followed as much as I could from that one but my structure is slightly different as it is freestanding versus being connected to the house via a ledger.
Comment: @AloysiusDefenestrate it doesn't seem so, I feel like the movement seems to be more in the posts. It seems that shaking one shakes all of the posts even with all of my leveling efforts with shims, etc. The post bases I used are the OWT ones that have the four separate plates that slide together and I wonder if those just aren't as stiff as other post bases.
Comment: @FreeMan I edited the original post to add the close ups, I also added a video of the shaking: https://drive.google.com/file/d/15B0GaEV4My2gBfh_8d0WrulkR2FXMe2_/view
Comment: Curious if you ever got this resolved or if you decided to leave well-enough alone. If you did resolve it, please let us know what you did!
Comment: Forgot all about this! I decided to leave it alone and its been standing great for 15 months now. No structural issues from what I can tell. I guess you really had to give it a lot of force to shake the structure, which we don't do. Also probably helps that there isn't a solid roof on it to catch wind either.
Comment: I did buy a pack of these Simpson Knee Brace stabilizers: Simpson Strong-Tie KBS1Z Knee-Brace Stabilizer Pack of 20 https://www.amazon.com/dp/B0796J91KM/ref=cm_sw_r_cp_api_glt_fabc_G9VP4AMFQHHGTR1066F5?_encoding=UTF8&psc=1 and have been meaning to out them on but they've been sitting in my garage for over a year now.
Answer: I think you've got several issues:

I don't think that the single screw holding each end of the bracing in place is sufficient.

You might consider adding a 2nd screw at each end of each diagonal brace.
I would put the 2nd screw at a different angle than the original (i.e. if the original lower screw is horizontal, add a 2nd screw at a 45° angle up).
This may help provide some additional stiffness. You may want to try one pair to see if that helps before doing all of them. (Or wait for someone to give a more authoritative answer instead of a guess/suggestion.)

Those hurricane clips look nice, but they provide minimal stiffness along the rafter direction.

A rafter tie like this would probably work better.
Image courtesy of Lowes.com. No endorsement implied or expressed
Yes, this one is ugly, but they make nice ones for visible work.
Adding a 2nd hurricane clip between the rafter and other joist may help improve the stiffness.

Unfortunately, I think the biggest issue is actually the most difficult to solve. I don't think that surface mounting the posts with those connectors is sufficient.

I took a look at the web-site for the brand you mentioned and they seem reasonably beefy, but they seem to be targeted more at railing posts than pergolas.
I mounted 2 short posts to my concrete steps with similar (though admittedly not as beefy) surface mounts and the posts wobbled horribly. I ended up removing them and half-lapping the post off the edge of the step and bolting it horizontally. Now it's rock solid.
I'd think you would have been better served by burying 1/3 of the post in concrete rather than trying to mount them on top. Unfortunately, this is a major rebuild at this point - hopefully someone will have a simpler solution.

Finally, it does appear from the video that there is a fair bit of wobble. How hard do you have to work to produce that wobble? Is it obviously evident from just casually leaning against a post, or do you have to put both hands on it and give it the ol' college try?
If you have to work hard to get that wiggle going, it may be sufficient to just leave it as is. If it wobbles like that from a stiff breeze blowing, then you'll probably want to do some strengthening.
Comment: I would seriously consider "leave it alone" as a viable option, @pergola-newb. If you were supporting a 2nd floor deck with this structure, I'd be quite concerned, but the most you'll have up there is sunshine and maybe some vines.
Comment: I generally agree, though many a pergola (including some I've built) use posts that aren't buried. I think improving the connections of the braces will take 90% of the movement out, here. Consider threaded rod running completely through. Then you can snug it up as the wood shrinks and not worry about wood threads working loose.
Comment: Thanks for the thorough response! The wobble isn't immediately evident and you have to use both hands to get it to wobble like the video.

Unfortunately, I agree with what you said about the post base being the big issue. If I could do it again I would bury the post (I was worried about water & rot) or get a monolithic post base instead of a 5-piece.

Unless someone else has a better solution, I'll try what you said and maybe find rafter saddles that fit my beams or clip the rafter to the other side. I'll try to strengthen the brace connection and maybe get thicker lags for the post bases.
Comment: Heck, even if you were to decide to cover it with fabric for shade, and climbed up there and walked across the rafters dragging the fabric behind you, that would be a 1-time, careful endeavor and I wouldn't worry about the wobble other than it possibly throwing you off balance. Moving slowly probably wouldn't cause enough wobble to worry about.
Answer: you have to bury the post in concrete. then they will be stable. the post will rot in 20 years. But it will be stable. Those metal post brackets are only for when you tie a deck to a existing house/building.
Answer: A trellis or handrail can double as bracing. There's a natural high step at the corner posts by the stairs where you could add a stiffening trellis or handrail.


If element present do stuff, if not present skip next

Question: I am bumped in a situation where I need to do something if an element exists, and if that element does not exists I will need to skip to the rest of the code. I have tried several methods but I do not know why it does not work, the code looks logical to me and it worked for similar macros.
Code below:
Do
    DoEvents
Loop Until driver.ExecuteScript("document.readystate") <> "complete"

If driver.FindElementByName("x").IsPresent Then
Item.Offset(0, 2).Value = "Completed already" 'And need to skip to next iteration

ElseIf driver.FindElementByName("x") Is Nothing Then
Set cancel= driver.FindElementByName("cancelbutton")
cancel.Click

Set myVar= Item.Offset(0, 1)
Set radiobtn = driver.FindElementByXPath("//input[@value='" & myVar & "']")
radiobtn.Click

Set cancelSelected = driver.FindElementByName("submitCancel")
cancelSelected.Click
driver.SwitchToAlert.Accept
Item.Offset(0, 2).Value = "Canceled"
driver.Refresh
driver.Wait 1000
End If

I have also tried the situation where if the element X is present, then find other element
If driver.FindElementByName("x").IsPresent Then
Item.Offset(0, 2).Value = "Completed already"

ElseIf driver.FindElementByName("Y").IsPresent Then
Set cancel= driver.FindElementByName("cancelbutton")
cancel.Click

Set myVar= Item.Offset(0, 1)
Set radiobtn = driver.FindElementByXPath("//input[@value='" & myVar & "']")
radiobtn.Click

Set cancelSelected = driver.FindElementByName("submitCancel")
cancelSelected.Click
driver.SwitchToAlert.Accept
Item.Offset(0, 2).Value = "Canceled"
driver.Refresh
driver.Wait 1000
End If

When element X is present on the page element Y is not, and vice versa. I have also tried .count > 0 but it still does not work. Could anyone help me with a solution or give me some tips and trick?
Comment: readystate will not wait until all elements are loaded. It is less reliable than the inbuilt implicit webdriver waits. If an error is thrown why not have an error handling section which deals with that scenario then have a resume next to take you back? So long as you have an exit sub before the error handler, and an appropriate err.Number test in the err handler might be ok i.e. use the error, or lack thereof, to branch your code. Remember to reset error.
Comment: Is there an url we can use to make this a reproducible problem please?
Comment: And of course, suitable x,y values for the scenario please
Comment: Unfortunately even if I share an URL you cannot see it because it is business related and secured by VPN and 2factor authenticators..
Comment: Please provide more detail then on what you tried and in each case what the exact result was including any error messages in full. Include an explicit wait times you have added if used and relevant to the error messages,
Comment: It's exactly as described. There is a code that waits until all of the elements are loaded on the page `Do
    DoEvents
Loop Until driver.ExecuteScript("document.readystate") <> "complete"`. Also Element X does not exist on every form. What I tried to do is to give a condition, If element X is present, do stuff, else if not present, do something else. the error received is NoSuchElementError Name=x.
Answer: Actually, I bought a course on Udemy and found the answer myself. There are several ways to find if an element is present and what to do next if it is or not present. Funny, the solution is so simple that I'm embarrassed I missed it.
First Dim By AS New By
Then add a split second of wait before and after the if clause:
driver.Wait 500
If driver.IsElementPresent(By.Name("uncompleteButton__")) Then
Item.Offset(0, 2).Value = "Can't do stuff, go to next iteration."
Else
Set cancelitemsbtn = driver.FindElementByName("cancelButton")
cancelitemsbtn.Click
Item.Offset(0, 2).Value = "Can do stuff"
driver.Wait 500
End if

Answer: Try to use not driver.findelement but driver.findelements(By.whatever).size()>0  I hope it works with vbs, it works with Java 100%.
Comment: Thank you for your answer, in VBA we can write driver.find both ways, i have tried it this way before as well, but it does not work.
Comment: Maybe you need some time to wait for that element if that is the case, you can use smart waits like e.g
WebDriverWait w1 = new WebDriverWait(driver, 8);
  w1.until(ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(By.id("submit_btn")),
    ExpectedConditions.presenceOfElementLocated(By.cssSelector("div.visible-desktop a.hosted-payment-btn.btn-primary"))));

And after that use the size thing.


i want to seamlessly connect a known parabola with an unknown sine wave at a specific x coordinate

Question: The known parabola's equation is (x-(-5√3+127/8))^2+((505√3)/4)-(14337/64)
and the unknown sine function is sin(bx+c).
I am needing to find b and c that will allow for a seamless transition with the known parabola above at x=10.
For context, this is to form a roller coaster track.
I attempt the basic f(x)=g(x) solving for the equation at x=10 , then f'(x) =g'(x) solving for the equation at x=10 then putting both equation and solving simultaneously for b and c, however that proved no solution.

Step 1: Find the value of the known parabola function at x = 10: Substitute x = 10 into the parabola function: f(x) = (x - (-5√3 + 127/8))^2 + ((505√3)/4) - (14337/64) f(10) = (10 - (-5√3 + 127/8))^2 + ((505√3)/4) - (14337/64).
Step 2: Find the derivative of the known parabola function: f'(x) = 2(x - (-5√3 + 127/8))
Step 3: Find the value of the derivative of the known parabola function at x = 10: f'(10) = 2(10 - (-5√3 + 127/8))
Step 4: Set up equations to ensure seamless transition: We want the sin function sin(bx + c) to have the same value and derivative as the parabola function at x = 10. Equation 1: $\sin(10b + c) = f(10)$ Equation 2: $b\cos(10b + c) = f'(10).$
Step 5: Solve for the values of b and c: Use Equations 1 and 2 to solve for the values of b and c. You may need to use numerical methods or approximation techniques, as these equations might not have simple closed-form solutions. Once you have the values of b and c, you can use them in the sin function sin(bx + c) to seamlessly connect the parabola and the sine function at x = 10, creating a smooth transition for your roller coaster track. But this also proved no solution.
Comment: I edited your post to include your comments about your attempts. Please delete them from here, and [format them there](https://math.stackexchange.com/help/notation).
Comment: I attempt the basic f(x)=g(x) solving for the equation at x=10 , then f'(x) =g'(x) solving for the equation at x=10 then putting both equation and solving simultaneously for b and c, however that proved no solution
Answer: The value of your equation at $x=10$ is $\left(10-\left(-5\sqrt{3}+\frac{127}{8}\right)\right)^2+\frac{505\sqrt{3}}{4}-\frac{14337}{64}\approx2.41342$. The goal would be to take the derivatives of both equations, and set them equal. However, a function of the form $\sin(bx+c)$ lives strictly between $-1$ and $1$, so it cannot possibly connect with the function at $x=10$. You will need to include a third variable $d$, and try to connect your curve smoothly to $\sin(bx+c)+d$ at $x=10$. There will be infinitely many solutions for $b,c,d$ to this equation, so I won't try writing them down.
Comment: thank you so much now I get why it hasn't been working :)
Comment: @rose There are multiple ways to go about finding a solution. Note that $d$ must be within approximately the interval $[1.41342,3.41342]$, since the sine wave will not be able to reach the point $2.41342$ otherwise. If you choose $d$ within this range, then you may be able to solve for $b$ and $c$, though your solutions may be decimal approximations.
Comment: One can also scale the sin function instead of shifting its value
Comment: @rose It may also be easier to use an amplitude $a$ as follows: $a\sin(bx+c)$, instead of using $d$.
Comment: yes I might do the amplitude instead thank you so much has helped heaps :)


Android delete directory using Media Store URI

Question: This is with the new scoped storage.
var dlRequest = DownloadManager.Request(Uri.parse(urlToPhoto))
...
var file = File("somedir", filename) // File inside directory "somedir"
dlRequest.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, file.path)

So far so good, photos are downloaded into /Pictures/somedir/
Now I want to delete the directory and all the files inside. How can I do this?
Update: Using scoped storage I have read here that accessing files via a path is no longer possible, you must use the media store URI. I can get the URI and delete the file, but I still have found no solution to delete the directory.
Comment: Android version of used device?
Comment: You are abusing the File class. The File class is for files. And files have a full path. "somedir/filename" is no full path. Try File.exists(). Better: dlRequest.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, "somedir/filename")
Comment: You cannot delete the directory on Android 11+ as it belongs the download manager. To delete the files use the uries you could obtain from DownloadManager.
Comment: That makes more sense, I am using Android 11. There must be another way to store files in a sub-directory that would allow you to delete the directory afterwards. Or you are saying I will need to save the URI from download manager?
Comment: Yes save all the uries. Can be you can query the media store for them too. Dont know. Just try.
Comment: Did a little test. Could just use File.listFiles() in that directory and delete them. I wonder why you did not even try it.
Comment: How do you know I did not try it? List files always returns 0 files. Without using the deprecated Environment.getExternalStoragePublicDirectory, I have used the applicationContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES), which always returns 0 files.
Comment: You can query the media api, that is what I do now and the media store URI is not helpful in deleting the directory.
Comment: getExternalFilesDirs() returns a completely different path. Your files are not there. Makes no sense to use it. Just use getExternalPublicDirectory().
Comment: You can use the mediastore uri i think if you dont just delete but do a createdeleterequest.
Comment: Ive not seen any method to delete directories using the media store URI. If you have an actual solution to the above question that does not use deprecated methods then that would be helpful
Answer: FYI
I tested @broot's approach (File.deleteRecursively()) on my production app code, it works fine on my device Android 8.1.
val downloadDirectory = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "tancolo")
println("TANCOLO===> download folder = ${downloadDirectory.absolutePath}")
val file = File(downloadDirectory, fileName)
...

Obviously, the folder "tancolo" must exist in parent folder "Download", the log shows: download folder = /storage/emulated/0/Download/tancolo
And then I used the extension method of deleteRecursively(), like this:
//delete the folder "tancolo" and all files in it.
val directory = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "tancolo")
        try {
            val hasDeleted = directory.deleteRecursively()
            println("TANCOLO===> hasDeleted: $hasDeleted")
        } catch (exp: Exception) {
            println("TANCOLO===> exception: ${exp.message}")
        }

the log shows:  TANCOLO===> hasDeleted: true
Answer: You can do this with built-in deleteRecursively() function:
val picturesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
File(picturesDir, "somedir").deleteRecursively()

Note that since Android 10, accessing this directory directly has been deprecated.
Comment: And what is somedir in your example code?
Comment: @Coop click the link!
Comment: I understand it is a `File` object. I've been combing through the docs for several hours already and that is one of the first things that comes up in a search, it doesn't answer my question.
Comment: So if I understand you correctly, your question isn't really on how to delete a directory recursively, but how to find the right path? Then the question title is totally misleading. The documentation of `setDestinationInExternalPublicDir()` method seems to be very clear on what is the resulting path. I updated my answer. I hope it works, because I didn't have a chance to test it.
Answer: You'll need to pass the uri list to the Mediastore delete API to delete the
images from it.
If you are deleting images below android 10, then it's very easy with the traditional method.
For android 10 & above, you'll need to take the persisted uri permission of the target directory and then pass the list of the uri to the mediastore's delete method.
You can find many examples to take persistable permission using SAF (Storage Access Framework).
So I am only guiding you through deleting the image files.
Like this,
public void deleteAPI29(ArrayList<Media> mediaList) {
        DocumentFile documentFile = DocumentFile.fromTreeUri(this, getContentResolver().getPersistedUriPermissions().get(0).getUri());
        for (int i = 0; i < mediaList.size(); i++) {
            File file = new File(mediaList.get(i).getPath());
            DocumentFile nextDocument = documentFile.findFile(file.getName());
            try {
                DocumentsContract.deleteDocument(getContentResolver(), nextDocument.getUri());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }

For android 11,
@RequiresApi(api = Build.VERSION_CODES.R)
    private void deleteAPI30(ArrayList<Media> mediaList, Context context) throws IntentSender.SendIntentException {
        ContentResolver contentResolver = context.getContentResolver();

        List<Uri> uriList = new ArrayList<>();
        for (int i = 0; i < mediaList.size(); i++) {
            uriList.add(mediaList.get(i).getAppendedIdUri());
        }
        Collections.addAll(uriList);
        PendingIntent pendingIntent = MediaStore.createDeleteRequest(contentResolver, uriList);
        ((Activity) context).startIntentSenderForResult(pendingIntent.getIntentSender(),
                DELETE_REQUEST_CODE, null, 0,
                Intent.FLAG_GRANT_WRITE_URI_PERMISSION, 0, null);
    }

You can check if images are deleted or not by observing the result in 'onActivityResult' method.
That's it! Hope it will get your job done easily.


How can I resolve this Pyart Issue with "Time" as the keyError from the data?

Question:           KeyError                                  Traceback (most recent call last)
           <ipython-input-17-e0d335b3929e> in <module>()
            1 numfile = 0
            2 filename = os.path.join(data_dir, Directory[0])
---->       3 radar = pyart.io.read(filename)
            4 display = pyart.graph.RadarMapDisplay(radar)

       1 frames
      /usr/local/lib/python3.7/dist-packages/pyart/io/cfradial.py in read_cfradial(filename,
      field_names, additional_metadata, file_field_names, exclude_fields, include_fields,
       delay_field_loading, **kwargs)

            134     # 4.4 coordinate variables -> create attribute dictionaries enter code here
            135     time = _ncvar_to_dict(ncvars['time'])
            136     _range = _ncvar_to_dict(ncvars['range'])
            137

          KeyError: 'time'

Answer: It is hard to answer this with a specific solution unless you can provide a little more detail. The basis of this error, however, is that the reader pyart.io.cfradial is looking for a specific variable in the provided NetCDF but cannot find it. One simple solution might be to directly specify a "time" variable using either NetCDF4.Dataset or xarray, which might allow the file to be opened, if there are no other missing variables.
It is also possible that a specific file handler in Pyart could open your NetCDF file; take a look at pyart.io and pyart.aux_io for listings of available functions.
Comment: Thank you for your response. I am trying to follow your suggestions. However, what more detail would you want? Do I have to rename the files to contain time stamps?
Comment: In terms of what more detail I would want: I would want to know the structure of the netcdf file. Netcdf files are not opinionated about the variable and dimension names of the underlying data. Therefore, any netcdf file reader must know what to expect about the file. Where did you get this Netcdf file? What is the data's schema? Have you attempted any of the other Netcdf file readers available in Pyart that I suggested?
Comment: The netCDF file is from an X-Band Radar. Yes, I have tired those Pyart libraries to read the file but I got other type of Keyword Errors. In the past, I have been able to read and plot other netCDF files with different structures from other radar bands that are not Xband. This file is in the format: rjy21328144655.nc
Comment: Try to use Python's NetCDF4 library to list the variables that are available in your netcdf file, then post what the variables are. I suspect that there may be a "time" variable under a different name. If that is the case, you will have two options: 1) write your own reader file to produce a `radar` object in pyart, or; 2) rename (or derive) a "time" variable in the dataset that matches the format pyart expects. Also, can you edit your question to include a link to an example netcdf that exhibits this problem?


Is black residue on wiring cause for concern?

Question: While running coax cable in our newly-purchased house, I removed a receptacle and box (which was not attached to or supported by anything but paint and drywall mud, but that's a story for another day). The cable coming in was wrapped around some insulation and the portions of it touching the insulation were covered with this black residue.

I have read elsewhere that this can be caused by tar from old insulation, but the insulation in this case does not appear to be particularly old, and the insulation itself doesn't seem to have any discoloration.

The residue appears to only be on the surface, as you can see from the couple places where I scratched it off with my fingernail to expose the cable sheath underneath. The sheath itself does not appear to be compromised. (The silvery patch on the cable in this picture, which I had initially thought was a hole of some sort, appears to have just been a piece of foil or other material as I was able to peel it off and reveal the white sheath beneath.)
Is this cause for concern? Or is it in fact tar from the insulation, or something else entirely?
Comment: Reminds me of what mildew would do to surfaces.
Comment: Thermal damage?
Answer: The "tar" is not a concern, it sounds like the box you described is an old work box they are listed and legal, they are held in by small stops or wings that hold the box to the sheetrock.
Comment: Some insulation has tar and some vapor barriers are tar paper. Both can leave residue that will discolor the romex outer covering.
Comment: Thanks. Is the tar from the insulation, then?

As for the box, I am familiar with old work boxes, and I don't think this was one. There were no wings or anything else holding it to the drywall. Once I chipped away a little of the drywall mud it pushed freely into the wall and I pulled it right out. In any case, I am going to replace it with a Carlon old work box that I know will stay in place.


How to identify whether an item is a file or a folder in QT

Question: I wanted to specify from a path, whether the item is a file or a folder. How can I implement such function which takes a path (QString based input) and tells whether it is a file or folder?
Answer: You can use the method QFileInfo::isFile() or QFileInfo::isDir() to accomplish this.
Example:
QFileInfo fi("/your/path/string");
if (fi.exists() && fi.isFile())
{
   //Do stuff...
}


How to grab a word from a page

Question: I was wondering how to grab some text from an external page using PHP.
I think that preg_match() can help but I can't get how to use it.
The text in the page is the following:
dragontail-5.7.2.tgz

and I need to grab only
5.7.2

Thank you for helping.
Answer: Check this out:
https://regex101.com/r/cF8mS1/1
/([0-9.]+)/gm

Means "Select all the integer characters since they are more than 1, and include the "." as well, and give me all of them, on multiline too. Thank you."
The last thing to do is to delete the last or first character ".", so:
if (preg_match('/([0-9.]+)/gm', $input, $matches)) {
    $result = trim($matches[1], '.');
} else {
    $result = null;
}

Comment: By default an undefined variable returns `NULL`: `var_dump($undefinedvariable);`. `$var = null` may be used in place of `unset($var)` to destroy a variable. The `g` "modifier" doesn't exist in PHP *(since when you want to make a **g**lobal research you use `preg_match_all` instead of `preg_match`)*. The `m` modifier is not needed.

How to grab a word from a page


How can I make all desktop menus dissapear?

Question: In the past (before Unity), it was possible to use my entire desktop without any menus whatsoever.
I used a quick launch app to run my programs and used some of the nice compiz windows managers to cycle between my windows. Now I'm kinda stuck with the menu at the top and unity at the left (which I can autohide, but this messes things up with two monitors side by side).
There are hacks and utilities to make them disappear, but what would be the least intrusive way? I can't afford for my Ubuntu to become unstable.
Comment: Have you looked at using an alternate window manager like [Fluxbox](http://en.wikipedia.org/wiki/Fluxbox) or [xmonad](http://en.wikipedia.org/wiki/Xmonad)?
Comment: I've looked at them, but have not installed them. Maybe I should give them a go - I just don't like messing around with fragile config settings too much and would love to learn from someone else's experience here.
Comment: The [Linux Action Show](http://www.jupiterbroadcasting.com/7376/hardcore-window-management-las-s16e06/) did a lengthy video review of xmonad, if you want to see it in action. I like Unity so I have no experience in other window managers, sorry.
Answer: If I am reading this correctly, solving the problem of managing dual screens would also solve the initial problem you describe.
Comment: Thanks David, the other question did solve part of the problem, but here I'm really hoping to find and answer to windows management that gets out of your way. I use the keyboard a lot, and switch between apps a lot, and desktop real-estate is prime.


What are the dangers of operating a mini excavator?

Question: I plan to rent an excavator like this:

I am aware that it is quite dangerous if someone walks by and is hit by the bucket, but assuming I can clear the area of passers-by, what are some common dangers to be aware of that could cause harm to the driver? Can a mis-move of the levers cause the bucket to break through the cage?
Comment: Why not take a mini-excavator training course? Seems like a small investment for the
safety of yourself and those around you.
Comment: Tip over or hitting power lines are the two cases.  Should be stops to prevent bucket/boom from going back to far, unless something breaks.  Need to check if any utilities are in the ground first.  Most places have free check for utilities before digging.
Comment: The major risk is the lack of common sense...
Comment: I'm not at all an "equipment operator" but have rented them several times. For a newbie, just take a slow and easy until you get familiar with the controls.  Make sure your work area is clear. Not too much risk from the equipment itself, but like others have said, biggest risk of damage is hitting  buried utilities.
Comment: If using a spotter, make sure they are clear of where you CAN reach. It's very easy to crush a person. Rollover is probably the most common  of the various "equiment-related" issues, and the "digging into things you should not" issues are mentioned below (beware that the utility marking services **won't** tell you about your house's private services, so destroying your own septic field or wire between house and garage is entirely on you knowing where it is, if you have one.)
Comment: For a properly assembled and maintained mini like the one you have shown, there is no way for the bucket to even contact the cage much less break through it.
Comment: This question is unfocused, invites opinion, and shows no research - there is no practical way to detail an exhaustive list of all the "dangers of operating a mini excavator" nor all the "common dangers to be aware of that could cause harm to the driver". You would need to make site specific hazard assessment to give a meaningful answer and there is no way to do that here, nor is there near enough information to approximate one. This is the same as if I ask, "What are the dangers of operating a motor vehicle" and what are "common dangers to be aware of that could cause harm to the driver".
Comment: In my experience, the single biggest risk with one of those is the sudden urge to buy one at the end of the rental period. :)
Comment: Hydrostatic things respond well to slow, smooth control inputs. They try to do what is requested _now_. The good news is that letting go of everything ought to make everything stop. The bad news is that happens abruptly and may result in a tipover, ... . Take it slow, practice, and have a spotter to warn you and others of things you can't see, aren't focused on, ... .
Comment: Also, what gradient is the land/area you're working on ?  Is it flat, slightly sloped, a hillside, or a mountain?   How wet is it - desert / garden / swamp ?
Comment: I have to say, I've seen children operate a mini excavator under the supervision of parents and be fine. So long as you're careful, you'll be all right.
Comment: What are you planning to do? - a trench, foundation, pathway, clearing scrub, grading, etc.
Comment: I hope you also plan to go through a training to use it safely as well as renting it? Your question would get answered in that training.
Comment: Just don't try these tricks at home ... https://www.youtube.com/watch?v=WMeLQaIc0Ug
Comment: This is more about transporting it than operating it, but I was once driving behind a truck carrying one of these, who didn't take into account a low bridge under the freeway.  The upper joint of the excavator took out a fist-sized chunk of steel girder from the bottom of the bridge which wasn't fixed for years (I drove under that bridge a lot).  I assume the excavator was damaged as well, but I didn't stick around to see.
Comment: It's a big and powerful machine.  The dangers are that you could kill people, yourself included, and damage or destroy property and/or the excavator.  Don't operate one if you don't know what you are doing.
Comment: Get some training, this operator has a bit of skill: https://youtu.be/8xifXEv_FpI
Comment: Fully agree with Jon; StackExchange Q&A is not a "tell me 10 things that an old sock can be used for" intent; there is no partical way to determine which of the hundreds of possible answers (or lists of answers) you could get for this are "the correct answer"
Comment: Don't forget about injuries to pets that might wander into the area unnnoticed.
Comment: Whenever I see that brand of digger in the neighborhood, all I can think of is Computer Aided Software Engineering.
Answer: OSHA has a search engine.  Many accidents are not reported to OSHA, in particular, amateur/homeowner operators like you don't have a reporting chain to OSHA.  But here are those OSHA knows about.
Obviously the vast majority involve the operator injuring others.  I omitted them since you say you'll be a lone worker (which has its own set of risks...)
The following contains descriptions of serious injury and death. Reader discretion is advised
Stuff they brought down on their own heads

At 11:00 a.m. on May 5, 2020, an employee was operating an excavator (KOMATSU Model PC240LC, mid-size hydraulic excavator) to jackhammer the base of a concrete silo so that two coworkers operating undescribed heavy machinery with one inch cables attached to the silo to pull it down once freed from its base. As the employee was jackhammering the base, the silo collapsed and fell onto the employee's excavator. The employee received unspecified fatal injuries from the falling silo material and was killed.

At 3:30 p.m. on August 2, 2019, Employee #1 was clearing trees and brush from a lot, using an excavator. One of the trees fell on the cab of the excavator and killed Employee #1.

At 4:00 p.m. on August 7, 2018, an employee was installing steel shoring in an excavation. The excavator inadvertently released the steel shoring plate which fell onto the employee. The employee was hospitalized with multiple rib fractures and a wrist facture.

Hit power lines

At 4:30 p.m. on April 13, 2020, Employee #1, employed by a pumping company, was working at a construction site. He was operating an excavator to drill a point well. The excavator became energized by an overhead power line. Employee #1 sustained an electric shock. He was transported to the hospital, where he died.

By the way, the machine chassis has a fair chance of protecting you while you remain in the cab, because the whole metal machine will tend to be one voltage (whatever it is touching).  There's no harm in being at one voltage, even if it is 21,000 volts.   The dumbest thing you can do is try to climb out of the machine at that point, because you'll be touching a) the energized machine and b) earth. Either stay put and call 911, or if able, move the machine to disengage from the wires.  But if the wire is downed, get hundreds of feet away from a downed wire before thinking of climbing down, as a voltage gradient can carry some distance.  And always report the strike to the power company; the strike may have broken insulators or weakened a wire that will drop later.
Lost stability due to terrain

At 3:15 p.m. on February 15, 2019, an employee was moving a Takeuchi Model TB007 Mini Excavator Serial # 1074544 down a ramp to the basement of a building to be stored. The equipment rolled over down the hill several times landing on the employee at the bottom of the ramp resulting in fatal injuries and bleeding. The equipment was not provided with roll over protection.

Self-inflicted tipping/rollover not caused by terrain
It's perfectly possible to rollover an excavator on flat ground without digging any holes.

At 11:00 a.m. on September 10, 2018, an employee was operating an excavator to move tree brush from the bottom of a hill to the top. While moving the load of brush up the hill, the employee moved the boom which cause the excavator to roll over onto its left side. The employee, who was seat belted into the cab of the excavator, hit his head on the roll over protection system frame as the roll over occurred. The employee was taken to a local hospital for treatment of a head laceration.

Pinned by ones own machine (not due to tipping/rollover)

At 3:30 p.m. on May 26, 2020, an employee was operating an excavator. At some point, the employee stuck their head out of the excavator cab while the cab rotated in close proximity to a tree. The employee's head was caught between the cab and the tree and crushed. The employee was killed by traumatic head injury.

At 11:15 a.m. on February 25, 2019, Employee #1 was operating a John Deere 225d excavator. The employee attempted to adjust the mirror on the excavator so that he could continue backing out of building to clear the doorway. He pulled the shut off lever and leaned out of the cab to fix the mirror. When he reengaged the safety shut off lever, he was inadvertently leaning against the joystick that rotates the cab. The employee was struck by and caught in between the excavator cab and the building's door opening. The employee used the joystick to rotate the cab back to the right, and freed himself. Employee #1 sustained three fractured vertebra and a broken collarbone. He was transported by ambulance to a nearby hospital and remained hospitalized for treatment.

Loading and unloading the excavator off the trailer
Needless to say, several accidents involved the operator trying to load or unload the excavator from the delivery trailer for highway transport.  Honestly, I forgot them because I was in the mentality of searching for accidents where the operator is in the cab.  But yeah, during load/unload, a lone worker can fall, get pinched e.g. have the unit shift on them, rollover while loading, or be tempted into "hold my beer" tricks of radical self-loading.

source: Youtube video
"What could possibly go wrong?"
(full disclosure, that last is actually a patented, engineered kit. The excavator has guide wings welded to frame and bucket. Once up top, it can move down the entire train of same-height cars, by expanding or contracting like a ... um... caterpillar.)
Comment: "The excavator became energized by an **overhead power line**." - every one forgets about the obvious when they're thinking too hard about the oblivious.
Comment: Last one probably could be nominated for a Darwin Award.
Comment: Relative to the human body (even the skull), an excavator is like you stepping on a ripe grape. People just need to respect heavy machinery more. Heck, even power tools will readily kill you if you're stupid.
Comment: @DMoore I saw one report where someone got injured while tying down the excavator. Tie it up the wrong way, start cranking the cinch down and the whole thing could move on you, etc.
Comment: I'm pretty sure Mysthbusters has done the "self loading" one... Successfully, I might add. It's still ***very much*** a "don't try this at home" trick.
Comment: The most significant and most relevant danger is missing from your answer, and that is untrained and unqualified operators, which manufacturers operating instructions specifically prohibit, as they are the greatest danger of operating an excavator.
Comment: Instead of OSHA search, one can use google/youtube search and get quite a hint from the less lucky excavator operators https://www.google.com/search?q=excavator+fails
Comment: I have never had to load or unload an excavator back on a trailer.   If that is the case it offers another unique danger of getting hurt or severely damaging the excavator, trailer or vehicle.   I have goofed around while regrading yards in tiny bobcats that I seem to barely fit into...  it hurts on flat ground - A LOT - when you have a slow rollover.   Yea I would goof around again doing it... but thats a bobcat on flat ground and the first thing I think of when I see someone on an excavator digging an 8 ft deep pool... glad I got someone insured and bonded.
Comment: "resulting in fatal injuries _and bleeding_". Because the fatal injuries weren't enough...
Answer: Hitting buried pipes and cables: gas, water, sewer, electric power, communications (telephone, TV, fiber), and oil. For oil and gas lines, third party damage (eg. backhoe) is the second most common cause of leaks after pinhole corrosion leaks. Transmission lines are rare in a subdivision but there are some old ones.  Also, watch out above for power lines as well, and don't tip the thing over.
As to finding those buried hazards the easy way, 811 will get you the locations of lines owned by utility companies, through what's called a mark out process.  In North America, the marks (spray-painted symbols or flags) are color-coded as follows:

Note, though, that this service only covers utility lines: private service laterals, feeds to outbuildings, and such are your responsibility to avoid
Comment: **watch out above** - everything else is pretty obvious. At least it'd better be. Other than driving off a cliff that's about the worst thing that can happen. Unless you're a trucker or a crane operator, you've probably never had to deal with a machine that had a required height clearance....
Comment: Make sure your insurance or a supplemental covers this type of damage; it's going to be VERY expensive if you're held liable.
Answer: Edit:
This question is far too broad to be practically answered in detail. If you were asking about specific dangers, that would be appropriate for this forum in my read of the question requirements, but you are asking something that invites opinion and cannot reasonably be responded to comprehensively because you haven't given us any details about the specific hazards you will encounter. Answering your question comprehensively would require a complete index of every possible hazard in every possible work environment. For this reason, my experience strongly indicates that you don't know enough about safely Operating the question you have plans to rent to even know if it's the best idea for achieving your project goal. Dangers aside, whatever it is you're digging, you may not even be aware that you might make more work and cost your self more by attempting to DIY than hiring a professional. Additionally, since you haven't asked about specific dangers, and since this strongly indicates you have done no research into training material for operating such machinery, I can't reasonably assume that you actually have the competency to build a proper jobsite barrier or to work around utilities or structures that might hurt someone beyond any barrier you do errect. Anyone encouraging you to proceed with your plan to operate this piece of machinery without adequate training to indicate a level of knowledge to safely operate such machinery would be, in many contexts, indirectly complicit in causing any incidents you may directly bring about. Knowing the dangers is not the same as knowing how to avoid them, and it is not enough to safely operate the machine.
A previous version of this answer suggested you should not operate such machinery as you indicated planning to rent, and cautioned that if you have to ask such a broad and basic question, you should strongly consider getting formal training first as this lack of basic understanding of the fundamentals of responsible Operating implies you are truly ignorant to these dangers, especially as you have not indicated this is a question for academic purposes. If you asked me personally, face to face, for my honest opinion, that is what I would tell you. Here, on this free-use forum with it's own culture and expectations, I won't speak from the heart, and instead here is some more generic advice... The greatest danger to the operator and any other person or thing is inexperienced Operators and the human error that results from inexperienced operating.

I won't outright tell you not to rent this and to hire a professional, but I will say that an open-ended question on a subject that has ample information in great depth directly answering this question available to you for free online really strongly indicates you have not researched the topic to the fullest extent a responsible operator might expect would be appropriate before even beginning to plan to rent and operate a piece of such equipment.
I will also tell you that if you have to ask such an open-ended question, and since this has been up for some time and you have not made it more specific despite the breadth of answers, you are strongly indicating that your lack of knowledge is the greatest risk to the driver, as well as everyone one and thing that could get near you - as such, I would strongly propose you suggest to yourself, 'if I have to ask such an open ended and naive question, not for academic purposes, I should strongly consider the fact that their is no reasonable and safe reason to proceed with my plans to operate this piece of machinery until I have training or a depth of knowledge that permits me to understand the basis of safe Operating."
When beginning to attempt to operate Heavy Machinery (even when they are referred to as "mini" or "light" models) it is best to keep the mantra "Crawl, Walk, Run" in mind, especially for inexperienced Operators who are concerned with dangers to their-selves as Operator and looking to prepare their-selves to rent the equipment. Asking "What are the dangers of operating a mini excavator?" is practically saying "I plan to rent an airplane, what are the dangers of flying one."
Since it is reasonable to assume you are an adult, and since in general on Stack Exchange if we don't see a nationality clarifying your citizenship, we assume you are a citizen of the USA, there is a strong cultural tendency to hold the sentiment "Nobody can tell you what to do! It's your god given right!" close to your heart. Other's will tell you, people do rent these all the time and it turns out to be a great time, but you are asking what the dangers are and the primary danger is proceeding with a plan to rent and operate one of these without training or understanding even the basic capabilities of the machinery, despite the fact that there are typically no laws against it in the USA.(I do suggest you check your jurisdiction for city ordinances and codes that may require licensed operators, but ususlaly this is not the case). For example:

Can a mis-move of the levers cause the bucket to break through the cage?

No, and that is a fundamental design regulation of the equipment you are planning to operate.
Nevertheless, if you do decide to proceed with your plan instead of hiring a pro, here is some reference material: here is the spec and Operator's Manual for a mid-size excavator (the big sister to the class you're proposing to rent). The operator's manual is old, but still the basic point of the rest of my post is the 1-2-1 "Operate Only If Qualified" clause. These manuals and the hazards they outline are 'must know model-specific material' per manufacturer's requirements for anyone operating heavy machinery (although federal regulations only allow enforcement of that requirement to employees; you're local or state jurisdiction may be subject to broader restrictions). Within this context, the manufacturer requires that you read the Operators manual (such as linked to above) prior to operating the machine, even if you are a "certified" operator - the regulations are, you still have to read it and know the information within prior to operating the machine. (Whether that is broadly and consistently enforced or even practical to broadly and consistently enforce is another topic). This is to say, failing to read and comprehend the entirety of the Operator's Manual that remains in the cab of whatever unit they drop off for you (regulations require that their must be an Operator's Manual in good readable condition), is the first and principle danger you will have a chance to avoid before you even put your key in the ignition.
Next, as you will see recommended by machinery manufacturers in the Operator's Manual, and as the Federal standard for Earthmoving machinery will require of those Operating such machinery during the course of their employed daily activities (but to which you as a private citizen not Operating this Machinery for any business purpose), you are told you must be trained by a competent trainer - remember, as a private citizen, their is no means to enforce this Manufacturer's requirement except where your local jurisdiction is subject to such regulations having ammended Federal requirements. If you choose to pursue training, 'adequate training' (as far as the requirements for meeting Federal regulations goes, which is a helpful benchmark for bare-minimum definition of competency for Operating Earthmoving equipment) would be achieved by either of the following: either by a competent, qualified, experienced trainer you're friends with, or by a professional trainer (by searching online for local equipment training facilities, or finding one through the recommendation of a local equipment rental company). It's worth the money if you have no experience with equipment like this, as it could save your life, or at the least it is insurance you won't destroy your driveway or similar incidences as you try to get the equipment to the area of work. Here is an example of the subject matter training material your course would cover, tailored specifically for the type of equipment you would be getting certified to operate.
Please keep in mind: As others will also tell you, your rental agency is insured against you or a damaged party suing them for their equipment's involvement in an unsafe incident. That shouldn't be encouraging. Their insurance doesn't cover you, and generally you should expect to be agreeing to indemnify the rental company for any damages to equipment or otherwise upon accepting receipt of the equipment. It's like renting a car. If you drive inebriated in a rental car, you still go to jail. With the rental car, you have to have liability insurance. For the equipment, if you don't have an individual umbrella policy, homeowners or rental policy that covers the types of incidents you might cause, it's all on you baby.

I think it's fair to assume you have no experience with heavy equipment. I would like to share some of my experience, but I want to talk to you about understanding the whole environment you'll be operating the equipment in, not just the hazards to you as the equipment operator because the chance of you getting hurt is far less than the chance of someone else getting hurt from something you've done with the equipment.
I am truly not trying to insult you. I am going to try and give you some perspective on just how deeply out of your depth you sound like you might be. I get it, you are an adult, and this could be a fun experience where no one got hurt, but you could also kill someone. Since I have no idea whether you are on a farm with no chance of someone random walking across your path, or if you are in a crowded neighborhood with a little old neighbor who might go searching frantically for her missing dog in the middle of the night and find herself at the bottom of a pit dug in your yard (real story, years of litigation), I'll assume the higher end of trouble just in case.
OSHA is bare minimum (see 1926.602 for reference). A number of people here have advised you to search through their tools and regulations. I have an OSHA 10 cert (twice), an OSHA 30, and over 80 hours of university level practical instruction on writing an employer safety manual for commercial construction, and two decades work experience. Many DIYers will disagree with me, but looking through OSHA should be the very lowest thing you look to if you want to learn how to safely and effectively operate equipment. OSHA does not prescribe how to operate safely, it is literally regulations describing activities you will be fined for. Looking to OSHA for learning how to safely operate heavy equipment is like memorizing speed limits of roads in your area. That's not going to make you a better, more defensive driver. I say this because it's extremely common to start reading through the OSHA website.
Similarly, ANSI Standards cover the benchmark for best practice. It is all still guidelines. It's not meant to tell you how to do it safely, it's meant to define 'safe operation' in detail in legally actionable terms. But, ANSI Standards would have you take an operator certification course - professionally taught, and licensed/accredited as competent and qualified instruction (usually that means that the manufacturer has trained and certified their trainers in the specific equipment they will train you on). I think you should get trained, but do you have to? I mean, if the company rents it to you, then no you don't have to, especially as a homeowner, but you should be aware that the issues aren't just the dangers of operating heavy machinery...

Please, before you put the key in the ignition, thoroughly and deeply understand the following:
You need to understand the hazards throughout your entire jobsite (your work area), including the dangers to the driver, if you truly want to work responsibly. For example, are you up to current best practice on protecting open excavations. At a much more basic level, do you know to locate utilities before you dig, and how far away you need to start digging with hand tools only? Are you aware of the personal/criminal negligence you are liable for in the event of harm even if you claim to not know you were doing something dangerous? Did you know in general throughout the USA, if someone sneaks into a jobsite even with all the barricades and safety precautions you think you have, if they hurt themselves you still can end up legally responsible? Tangentially related to operating the machine, and as much the responsibility of you as the operator as safe operation, are you sure you understand all the regulations that govern the work you are undertaking? Does your jurisdiction have temp erosion and sediment controls? You should look into the cost of how much you can get fined for violating runoff regulations. On a very basic level, do you know what kind of fuel your equipment takes? How about where to find the operators manual in the cab? In my opinion, you won't be competent to 'safely' operate an excavator until you know the answers to these questions.
What I'm saying is that there's a lot to worry about far beyond just "How tippy is this thing."
Now on the other end of things, heavy machinery are super fun to operate (until they become your job and then it's just a thing you do for work). They can also destroy anything you accidentally bump or run over in an instant, faster than you can react, including a life. Being hydraulic, they can also cause damage if parked improperly... and, fun fact, they will cause severe chemical burns if you get the hydraulic fluid on you!
Happy operating!
Comment: Not a down-voter, but this is a bit doom-and-gloom for someone that just wants to rent a small excavator for a job around the house.  Safety and technical training are important on the job because you are being forced to use the machine, and use it somewhat quickly or you lose your job.  For a home-gamer, you can just take it slow, and if it feels like you can't handle it, call in a pro.  So, I think this is good advice... for a pro that is going to be using the machine day in, day out in unknown environments, but its a bit much for a renter working at home.
Comment: Agreed with @JPhi1618 that this answer is a bit doom-and-gloom. Tons of small rental shops rent out mini excavators every day throughout the US, and plenty are used by people with little to no training without issue. If everyone operating one needed hours and hours of training, rental shops would have a hard time renting them, and they would be uninsurable to do so. Yes, they can be dangerous, but going slow and thinking things through will suffice for most DIYers.
Comment: Absolutely this. 20 years ago we though nothing of renting a mini digger and landscaping our garden. We were lucky, it didn't roll on anyone or fall into its own hole. Last year we hired a guy with a digger: quicker, safer, cleaner and he had his own insurance.
Comment: Yes @J... and like RedSonja is saying, the propensity to get distracted by the notion that a tool can do something amazing (like boost productivity) or be super fun or both of these, people out of their depth don't know how out of their depth they are. For example, if you over excavate, you don't just have to put the dirt back, you have to put orders of magnitude more dirt back and you have to get equipment to compact, OP likely doesn't know what proper compaction for bearing is, how to measure it, the steps or the cost to achieving it... the potential for cascading failure is immense.
Comment: This.  An internet Q&A site cannot possibly substitute for proper training.  Even the best and most experienced person here cannot effectively teach excavator operation in a three paragraph answer.  This is not the place to learn how to operate heavy equipment.
Comment: @Jon you come to a DIY Q&A site - where people ask questions about doing things themselves - and tell someone asking a question that if he has to ask a question he shouldn't be doing it himself. The whole answer is incredibly condescending and passive aggressive. There's a helpful way to tell someone to get training first and an unhelpful way, and you picked the unhelpful way. You are essentially telling OP he has to become a professional to use one of these, which is not realistic.
Comment: I'm curious, I got a downvote, would whomever downvoted me be willing to share feedback so I can improve my answer?
Comment: @Jon -- I think this answer buries the lede, come to think of it -- providing a more positive-guidance answer up front with regards to finding training resources and how to approach them (do equipment-rental places offer courses for a nominal fee?  are they better off contacting a manufacturer's rep for a referral to a trainer? what should I expect to go thru in such a training program?) would improve it quite drastically
Comment: @whatsisname, I feel like I already commented to JPhi1618 that I agree with your sentiment to a point... so I'm wondering, is there something you would like me to add to my post or you just wanted to mention that renters rent so it must be all good? Just like I said to JPhi1618: You're not wrong, you're just irresponsible if you think that's all there is to it. Are you arguing that I shouldn't call attention to the ASTM standards and the Manufacturer's guidelines for every piece of Federally regulated heavy construction equipment operated in the USA because it's a buzzkill?
Comment: Let's play 'change the context'. Any Range Safety Officers want to chime in? Mom and pop rental companies rent heavy machinery to unqualified untrained homeowners all the time, so it must be fine, right? Same deal with guns. You don't need training. You can have a good time. @whatsisname "If everyone operating [a gun] needed hours and hours of training, [gun sellers] would have a hard time renting them, and they would be uninsurable to do so. Yes, [guns] can be dangerous, but going slow and thinking things through will suffice for most [inexperienced untrained first time gun users]."
Comment: I encourage anyone that even thinks they could potentially see a reason to downvote this answer to do so, get it to the bottom of the list, flag it, get it deleted if you think it doesn't have any business being here. It's no fun, and what is this DIY site all about if not having fun? Let's not ruin OP's fun, plus is it even appropriate to go beyond the specific question(s) OP asked? Who is this Jon, to assume OP doesn't already know this doom and gloom, to have the audacity to suggest OP shouldn't move forward oblivious to the entire industry of safety standards built on destroyed lives?
Comment: ... oh zaen... :( So downvote this answer and write that post. DIY question here, "what are the dangers of [underwater welding. I am aware that it is quite dangerous [...], but assuming I can clear the area[...], what are some common dangers to be aware of that could cause harm to the [diver]? [...]" go ahead, tell OP they shouldn't strongly consider training cuz they might as well go do it for the rest of their life if they take one couple hour course.
Answer: Blacksmith37 has a great answer.
I would add as I could run a blooper reel with things I have seen from excavators and bobcats...  Just one piece of advice.   Do not dig outside a large hole.   For instance if you are doing a pool, dig from within and build yourself a nice ramp at a gentle angle out.
It is easy to get 6-8 feet down and everything is fun and games and going smooth, bucket catches a rock and you go rocking.   I mean I can't tell you how many times we had to "help" an excavator out of something.   Maybe it was the quality of crews and money (lack of) I used to spend on these things but I have to feel that a new operator would have same issues.
Comment: A new operator would be worse because they have zero experience.  Heavy equipment operators can read the ground and have an intuitive understanding of how the soil and earth are reacting to the dig.  They can feel when they're pushing too far for the conditions and adjust accordingly.  A noob would much more readily dig themselves into a catastrophe because they *wouldn't recognize the problem forming around them* before it was too late.
Comment: @J... - The hard part is its an excavator but it doesn't have the anchor qualities of a regular excavator.   You can lean forward quite a bit - especially with anchor arms - in a commercial excavator... these small models tip so easy it isn't funny.   I always tell my guy dig from within once you get 4' down.   I know there are cases where you can't... but then we rope off area and hire someone with experience.
Comment: Indeed.  Anything without stabilizer legs is just an accident waiting to happen, I agree.  Way too easy to overextend yourself, and definitely not friendly to a novice.
Answer: Something touched on by the other posts is tipping. If you'll note, the excavator you intend to rent has treads that are no wider than the cab. There's two reasons for this

Weight. You want this thing to be light enough to fit on a double-axle trailer and be towed by a decently powered truck or van. This is weekend-warrior stuff and a lot of rental places will happily load one onto a trailer for you and send you on your merry way
Size. It needs to fit on said standard trailer without sticking out (street legal reasons)

The catch there is it makes the cab really REALLY prone to tipping because you have nothing to offset the weight and the treads are close to the center of gravity.
We do live in the age of YouTube, however, and there's a ton of good videos on how to drive and use one safely, but this video in particular goes over a number of mistakes new operators make. I'd make it a point to watch them, as you can glean a LOT of free advice from pros by watching.
Comment: While on the Tube of You, go search out "stupid excavator tricks" (or something like that) to see all the things you _shouldn't_ be doing. You can learn a lot from _other's_ mistakes, too.
Comment: @FreeMan The video I linked to is just that. It's not "laugh while you watch this guy tip his excavator into a hole", it's a pro showing how easy they are to tip and then explaining how to avoid tipping.
Comment: A lot of mini-diggers these days have wind-out treads, giving stability whilst working and also easier to get through narrow gaps and load on a trailer.  Of course they're still prone to tip because they've not got a big footprint or much mass to hold them down, but it's a good start.  On the downside though, I've seen people forget to wind the treads out and wonder why they're a bit unstable *facepalm*.
Comment: Gotcha. I didn't actually watch it. I've seen _more_ than enough YT videos linked on Facebook to know there are a million and one out there.
Answer: Here's one to add the endless list of what could go wrong.  I rented a digger almost exactly like the one you show in order to dig some trenches for drainage in my garden.  I had no training whatsoever.
I had the door open, I don't recall but I suppose there must be some kind of clip to hold the door in the open position.
I was driving the digger forwards down a steep incline.  The digger was angled so far forwards that I put my left hand on the door frame to hold myself back in the seat.  The door came swinging round and hit my fingers.  To this day I'm amazed that I suffered nothing worse than some badly bruised fingers.  They could (should) easily have been crushed.
Answer: This is more of a danger to your property than to you, but be aware of how much that thing weighs.  It's not uncommon for that to be the heaviest thing that's ever rolled/driven across that specific piece of land.  The mass is spread out over two wide treads, but it can still be enough weight to crack a thin concrete slab (sidewalk or driveway) or crush irrigation lines (some are only buried a few inches below the surface).  I've heard tales of operators unknowingly cracking sprinkler lines, only to have them leak and fill up their hole with water as they were digging it.
Along the same lines, you'll only be as stable as the ground that you're operating on.  Ground that feels firm under your feet can move around a bit when you're in a vehicle that weighs over a ton.  If your soil isn't dry and well-compacted, make sure that you aren't going to sink into the ground when you load up the bucket.  If the heavy side sinks into the ground and the other doesn't, you'll increase the chances of tipping over.  The mini excavators don't always have the stabilizer legs that the larger ones have.
Answer: I'll add one more, having spent 6 months with a small and medium digger.
In mud or poor surface, a smaller digger is more than capable of being pulled by an object instead of pulling/lifting the object. If you dig in a muddy claylike area, and drag the bucket up or towards you, the digger itself can move, bed in, or tilt instead. Like, into a trench you're doing to the side.
If you use a light digger, you may need to secure it against lateral movement (I found that a piece of heavy timber braced against hammered-in stakes was useful, laid alongside the tracks, so it couldn't move sideways in very sticky mud. Worked well). You may also want to lay something on the surface to give the treads, better traction, if the ground is loose or muddy.
Also, use lowering the front blade to slightly dig in and anchor/brace yourself if needed. That can help in soft ground.
Comment: This is some terrible advice in the context of avoiding dangers. You're essentially saying the lesson learned isn't to prepare a safe and stable base, which you can easily do with quarry spalls and eliminating drainage problems, it is to compound an unstable working surface by allowing yourself to *increase* the force acting to destabilize your machinery. In other terms, what you're saying is exactly the same as "Is your ladder too short? What I do is lash it to a second ladder or put it on a forklift and lift it up." Actually, forget I said anything - doom and gloom, total downer. Party on.
Comment: Sounds like the "key takeaway" is "dig from the front, not from the side". Pivot to the side only for dumping the bucket.
Comment: It's certainly going to be more stable that way, because of the longer front-back track base, blade capability, and centre of mass further behind the bucket mounting, compared to sideways use.  Whether that's always practical is uncertain.


Ruby: How to check if a string contains multiple items?

Question: I'm familiar with Ruby's include? method for strings, but how can I check a string for multiple things?
Specifically, I need to check if a string contains "Fwd:" or "FW:" (and should be case insensitive)
Example string would be: "FWD: Your Amazon.com Order Has Shipped"
Answer: the_string =~ /fwd:|fw:/i

You could also use something like
%w(fwd: fw:).any? {|str| the_string.downcase.include? str}

Though personally I like the version using the regex better in this case (especially as you have to call downcase in the second one to make it case insensitive).
Comment: Thanks. Using the regex...how would you translate that line to say "if the_string does NOT have fwd:|fw:"?
Comment: There's the `!~` operator which is exactly the same as negating the result of `=~`. Using `=~` is usually just referred to as matching against a regex. Don't know whether that counts as an official term.
Comment: And also, is there an official term for the use of `=~`


Hide an element on several pages, what is wrong with my syntax?

Question: It seems that the display: none is applied to the whole pages and not only .apss-social-share
Thanks
body.page-id-15425,
body.page-id-15206,
body.page-id-15246,
body.page-id-15423,
body.page-id-1452
.apss-social-share {
    display : none ;
}

Comment: you're missing a comma
Comment: In CSS, commas separate each and every selector that the following css rules will be applied to.
Answer:
, has lower precedence than the descendant combinator. This formatting might make what happens more obvious:
body.page-id-15425,
body.page-id-15206,
body.page-id-15246,
body.page-id-15423,
body.page-id-1452 .apss-social-share {
    display : none ;
}

Specify .apss-social-share for each one:
body.page-id-15425 .apss-social-share,
body.page-id-15206 .apss-social-share,
body.page-id-15246 .apss-social-share,
body.page-id-15423 .apss-social-share,
body.page-id-1452 .apss-social-share {
    display : none ;
}

Answer: In CSS, commas separate each and every selector that the following css properties/values will be applied to. To make this totally clear:
selector1,
selector2,
selector3 .sub-element-class {
    display: none;
}

is identical to
selector1 {
    display: none;
}
selector2 {
    display: none;
}
selector3 .sub-element-class {
    display: none;
}

Variation 1 ist just shorter to write, especially if applying not only one but a larger amount of CSS properties.


How do I design a beautiful 6 month calendar view with 15+ event types?

Question: I have designed a calendar web application at my work, and it has been well recieved. So well that multiple departments of my company has adapted it, and requested their own categories for their respective events. It has also been made available to our customers.
My problem is that what started out as a nice design, with four different colors, has turned in to an orgy of distracting colors, which frankly looks like someone puked up skittles (if skittles had 15 colors). I have tried multiple color schemes, but it always end up looking worse than it did. Here is the calendar as it looks now:

The idea is that all departments can select their relevant categories by choosing visibility from the menu on the left. But I would like the calendar to look good, even with all categories visible.
I tried to create a palette with 20 colors to choose from, but it ended up looking even worse. I'm starting to think that more colors might not be the best options, and that different options, like radial or striped colors, like here, might be the best option. I would however, very much like to get some examples or visualisations on options that might work. I'm also very much open to redesigning the whole table layout, like dropping the black border between columns and/or events.
I have tried finding good examples myself, but I could only find Google calendar-like month views, or empty six month calendar views for printing.
By the way, I am not expecting anyone to design this for me. I just have a feeling that somewhere out there, there are great examples or inspiration, and that I just haven't been able to find it myself.
UPDATE, TWO YEARS LATER:
I now have a brand new design. We accepted the fact that you cannot make this many colors work. Then we grouped the similar categories into a total of 7 colors, inkluding grey and white. Users can still select visibility of individual categories, but now it looks more professional, and less like unicorn barf.
Comment: Colors indicate different categories.. or departments ? why does the user choose a color in the first place ? at any point of time for one user, does the calendar view 'only' show one department related events ?
Comment: What does a user want to see when they look at this? What is their goal? It seems like you are trying to "do it all" with a single view, but you may now need to branch out into multiple views / lenses. For example, a "free/busy" view, a "personal appointments" view, a "low priority appointments" view...
Comment: This calendar represents releases of code, or similar events, like service windows (planned downtime) etc. One color for each release type. There are also other events, like frozen zones and holidays. I control all of the colors, so none but me can add categories. The users select which categories they want to be visible, so each user will only see a limited number of events, except for release managers, who need them all. My boss keeps mentioning that he loves the functionality, but would like the design to change, and quite frankly, I am at a loss of how to do it. Maybe it's impossible.
Comment: What questions do people try to answer when they go to this calendar? A manager might ask, "is my team overloaded?" or "are releases too close together?" A developer might ask "what are my deadlines?" or "when can I expect code I depend on?" or "how many days until I have to ship this?" If you write out these questions, you can provide views into the data that help answer them.
Comment: 1. Planning releases that doesn't interfere with other releases (Release managers' work should be distributed evenly).
2. Provide deadlines for developers (Pack dates).
3. Provide customers with information about when releases arrive.

Now details about what the different releases contain, and their progress is also a part of this system. That is however deeper in the page hierarchy, accessed by clicking on the individual events. The main calendar pretty much just needs a single line of text, symboling which release category it is. So far, these are also symbolised by one color each.
Comment: I understand that you need 6 months. However, is there a reason why you need to show all 6 months at the same time? If, so, I'm sorry but you're overloaded with information, so there's not much you can do. Personally, I'd research on segmentation of information. For what I see in your image, there's no need for all 6 months at the same time (but this is a wireframe, so who knows), thus showing a time range, like 20 or 30 days would be perfect. Again, I don't have all the information, but something has to give: either you segment info, either you'll get something like that
Comment: Do most users need to see which events belong to which departments? Or is it enough for them to see that something is scheduled that conflicts with something they want to do? If the latter is true, then for most users (except the PMs) you could have one color for the user's department and another color for everything not in their department.
Comment: Using striped colors won't make it look better, it'll just make things worse.
Answer: There are some improvements you can make without changing much:

Make all the borders of the table white instead of black.
Remove the teal background from headers (it only adds another colour for users to process without adding any extra information). I would revert to black text on a white background.
Change the red row headers to use red numbers on a white background instead of a red background.
Go pick new colours for the calendars, perhaps try looking for colour schemes using Kuler or ColourLovers or other similar sites.
If you can, try rendering the calendar with each day having only a small swatch (square or circular) of colour in front of the label instead of filling the whole cell with colour.
I'm not sure if you have a reason to condense the information so densely, but you would improve the readability if you add extra padding to the bottom of each cell (and vertically align each cell's content to the top).
Comment: 1. I did try that. Wasn't pretty. 2. The header is a company standard, unfortunately. 3.I like that idea! 4. Also something I would like to try. 5. Maybe the best suggestion yet. 6. I do not understand what you mean by that one. Half of these suggestions are very very interesting! Thanks!
Answer: I don't believe you can create something that is beautiful or functional with the requirements of a calendar view for 6 months (day by day) with 15+ different event types.
What you should do is use what you know about the use cases to build functional interfaces to the larger event database.
For example, if you want to make sure that when planning releases they don't overlap you should do a few things probably:

Warn people when they try to schedule a release that overlaps with another one in the 'create release' interface
Trigger notifications to the appropriate release owners (and overall admin) when a release is scheduled that overlaps
Have a dashboard that outlines releases that overlap in the near term

You should test this with the users of the system and start building small pieces to make sure it helps their day-to-day. If you are still seeing people using the huge list you are probably missing a needed scenario.
Since this is likely a dashboard for the different users of the system you may want to read through the Information Dashboard Design by O'Reilly. It is an older book, but really stresses how you create interfaces that are useful rather than just beautiful/colorful or contain every little piece of information possible.
Comment: I believe you might be right about your first statement, but at least I'm going to make it as good as I can. The other things you mention is unfortunately not relevant to me at this point, as most of them are already in place, and I still need the half year view to look as good as possible. Nice little notice about the Dashboard Design book though! I'll have a look at it!
Answer: As pointed out by Kit Grose, the cells should not be entirely filled with the color. In addition to the idea of the square or circle, I often use a stripe along one side. Here's an example from Mingle, which is an ALM tool, but the same idea would work for a calendar.
Answer: Oh, you have many different strategies at your disposal, but it depends what is your end goal.
I will throw some of ideas, grouped by different types of implementation, and problem they address. It might not help at all, or it might give you some new ideas.
Frequency
Event grouping
You can use same color for every event, but when the events stack, you can use lighter colors (heat map kind of thing) and with that it would be really easy to spot out days with 50 events VS normal days with 2-3.
Alternative representation of events
There are some calendars that show events in minimal manner, see this link, first image.
The number of events during the day is represented by the line length. Some other calendars use dots, since its easier to count them. (.... vs ----)
Filtering
Maybe instead of filtering by people you can start filtering by teams, or some other meaningful unit (you might already do that, but its hard to tell from your screenshot)
Colors
If you want safe colors, go to http://colorbrewer2.org/ , the only downside is that the maximum colors you can pick is 12, but that is also expected, you can't have 300 easily distinguishable colors.
Wild Stuff - Fisheye view
Now, disclaimer, those two examples are UGLY :D

https://tulip.labri.fr/TulipDrupal/sites/default/files/uploadedFiles/images/pixel_oriented_view_fisheye.preview.png
http://jcsites.juniata.edu/faculty/rhodes/ida/images/Figure_10_4.jpg
http://tulip.labri.fr/TulipDrupal/sites/default/files/uploadedFiles/images/scatterplot_view_detail_fisheye.preview.png

But, you get the idea, not ALL parts of the canvas are of same importance, maybe you could use this to have functionality that you can select one column (month?) or single cell, and expand it bit more, shrink others and show more and detailed data in that column or cell.
Comment: Thanks. Heat map will not be relevant in this case, unfortunately, as it is the specific events, not the amount of events that is important. Likewise, the alternative representation of events won't work, as I need to be able to print the calendar, and the users also need to be able to get a complete overview. They can do that as it is now, and the functionality of it is working as intended, it is just fairly ugly to look at. Thanks for all the examples anyway. None of them are applicable, but it makes me more convinced that the requirements, not my design, is the main problem of my application
Answer: Depending on how the users use your UI, it might be useful for them, and also embellish the view, to display all of them with a transparent background and allow the user to highlight the departments she is interested in by clicking toggle buttons with the department's name and color.
This could be useful only if the users want to check one or two departments at a time.
Comment: Already implemented, but a few people still need all elements visible at all times.
Comment: @KjetilNordin you might make those who need to see it all happy by providing an additional "show all" button. And maybe happier by remembering the selection across sessions.
Comment: Already implemented, @JuanLanus. The layout when showing all, is the issue.


output my object as in css structure

Question: I have a procedure that create/update this object:
style={
    "p2":{
        'color':'#fff',
        'background':'red'

    },
    "p3":{
        'color':'#fff',
        'background':'red'

    },
    "h2":{
        'color':'#fff',
        'background':'red'

    }
}

How can I output this object for display in css structure to be able to copy and paste it into css file?
Comment: Why is your CSS an object to begin with?
Comment: Maybe [`JSON.stringify`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) making use of the `space` parameter, though it's a little unclear exactly what you're asking.
Comment: @JamesThorpe that leaves some commas to change to semicolon, some colons and quotes to remove, etc.
Comment: @DenysSéguret Yeah that's true.  As I said, a bit unclear :)
Comment: @ThiefMaster Puzzled as to why this is "too broad", and why two votes sufficed to close. Was this marked as "too broad" in the sense it is sometimes used on questions asking for code with no effort?
Answer: Just iterate through the object's keys and output it somewhere:
var output = "";
for (var key in style) {
    if (style.hasOwnProperty(key)) {
        output += key + " { \n";
        for (var prop in style[key]) {
            if (style[key].hasOwnProperty(prop)) {
                output += prop + ": " + style[key][prop] + ";\n";
            }
        }
        output += "}\n";
    }
}
console.log(output);
document.write(output);

// Not sure if below works
var styleEl = document.createElement("style");
styleEl.innerHTML = output;
document.body.appendChild(styleEl);

Here is a JSBin.
Comment: @shlomy, no problem. If this answered the question, feel free to mark it as such.

output my object as in css structure