Updating a badge when a new item is added to a list

Hello I am trying to update a badge every time a new item is added to the list. I am making an Ajax call to the list and created a function with a counter; I also created a function with a setInterval calling the counter function.

 $  (document).ready(function() {      var badgeContainer = document.getElementById('services');     //Create counter     var counter = document.createElement('div');     counter.setAttribute('id', 'counter');     counter.classList.add('counter');     var counterText = document.createElement('p');     counterText.setAttribute('id', 'counterText');        $  .ajax({         url: "http://bcnet/Sandbox/juandev/_api/web/lists/GetByTitle('Qlinks')/items",         method: "GET",         headers: {             "Accept": "application/json; odata=verbose"     },     success: function(data) {         var items = data.d.results;         //console.log(items);           if (items.length > 0 ) {          badgeContainer.appendChild(counter);         counter.appendChild(counterText); 

var count = ‘ ‘;

        function changeCounter() {             count++;             var newCounterText = count;             counterText.innerHTML = newCounterText;           }//end changeCounter function             changeCounter();          function newUpdate() {         update = setInterval(changeCounter, 2000);      }//endf newUpdate function      newUpdate();      }//en if statement                  },              error: function(data) {              alert("Error: " + data);         }     }); //End Service Icons  //End Service Icons 

}); //End ready function

/*setInterval(function() { //your jQuery ajax code }, 1000 * 60 * X); // where X is your every X minutes*/

/function send(){ $ .ajax({ type: “get”, url: “test.php”, success:function(data) { //console.log the response console.log(data); //Send another request in 10 seconds. setTimeout(function(){ send(); }, 10000); } }); } //Call our function send();/

Remove type=”text/javascript” added by W3 Total Cache plugin

I added code to the functions.php file:

add_filter('script_loader_tag', 'js_atr', 10, 2); function js_atr($  tag, $  handle) {     return str_replace(array('type="text/javascript"', "type='text/javascript'"), '', $  tag); } 

After that, all text/javascript are disappeared, except those that add a plugin. It looks like this:

script src=”https://code.jquery.com/jquery-3.3.1.min.js”

script type=”text/javascript” src=”https://mydomain/files/cache/minify/65f03.js”

How to remove this type=”text/javascript”?

DSolve does not return a solution when initial condition is added

Consider the following equation $ $ y”(x) = -2e^{-y}. $ $

The following code

DSolve[y''[x] == -2 Exp[-y[x]], y[x], x] //FullSimplify 


{{y[x] -> Log[(2 (-1 + Cosh[Sqrt[C[1]] (x + C[2])]))/C[1]]},   {y[x] -> Log[(2 (-1 + Cosh[Sqrt[C[1]] (x + C[2])]))/C[1]]}} 

(They the same solution. Let’s ignore that first.) If I impose an initial condition $ y(0) = 0$ then Mathematica fails to return a solution

DSolve[{y''[x] == -2 Exp[-y[x]], y[0] == 0}, y[x], x] 

with the error message

DSolve::bvfail: For some branches of the general solution, unable to solve the conditions.

But a solution does exist. One can choose $ C[1] = 1$ and $ C[2] = \cosh^{-1}(3/2)$ in the solution and verify that $ y(0) = 0$ .

Any idea why is this the case?

Libreoffice has no menubar in Kubuntu 18.04 if Application button (for global menus) is added on window titlebar

It looks like a bug but I am not sure which program is to blame..

In Plasma 5.12 the option to add global menus in window titlebar has been removed. There is a panel widget that adds global menus to the panel, but also global menus are still available in the window titlebar as a button. I have added that button with global menus as indicated here. That’s under System Settings > Application Style > Windows Decorations > (tab) Buttons:

enter image description here

The idea is to get the global menus into a left-side button on the window upper margin; like for example in Chrome:

enter image description here

When this is done, Libreoffice has no menubar anymore. Adding the Menubar button and using it has no effect.

enter image description here

But once the “Application” button is dragged away from the titlebar at System Settings > Application Style > Windows Decorations > (tab) Buttons, the menubar in Libreoffice comes back.

enter image description here

Folder from one branch, that’s been added to my .gitignore, exists when I switch to a different branch

I’m working on two branches: branch A and branch B. The contents of each branch are as follows:

**branch A** |-parent |-folder1 |-folder2

**branch B** |-parent |-folder3 |-some_folder |-some_other_stuff |-more_stuff

I have added “some_folder” to .gitignore. New files are created and added to “some_folder” while working on branch B, hence modifying it. Even though it’s supposed to get ignored and git status doesn’t list the folder at all (as it should), when I switch to branch A, folder3 is now listed when I execute ls along with “some_folder”, but when I execute git status it says my working tree is clean. My working tree in branch A now looks like this:

|-parent |-folder1 |-folder2 |-folder3 |-some_folder

Shouldn’t “some_folder” be contained in branch B and not be carried over when switching to my other branch?

Knowing if an item was deleted vs added

Let’s suppose we have a file containing a list of my favourite hobbies (or any item really). Over time, I gain new hobbies and lose interest in others, causing me to remove or add them to my list.

Now let’s say we have two lists in separate files. Here are the files:

1) “Playing Tennis”

2) “Playing Tennis, Playing Piano”

It is impossible to know which list is more up-to-date. The first could be the old one, with me recently starting to play the piano. On the other hand, the second one could be the old one, with me recently dropping interest in the piano.

Now say instead of lists in files, it was collections of data about a user. If I wanted to merge files, what would be the best way to do so? It is possible that parts of both files are most up-to-date so simply knowing which file was created most recently does not perfectly achieve creating the most up-to-date file.

Wine installation added miscellaneous to my home folder

I recently installed Wine-stable following the guide on their website. It seems to work great. The problem is the installation has left a bunch of files that say “invalid encoding” where a file name should be, which are currently cluttering up my home directory. I attempted to move/delete the files but any attempt to get rid of them simply breaks wine. I will list the steps I followed during install. What have I done wrong?

sudo dpkg –add-architecture i386

wget -nc https://dl.winehq.org/wine-builds/winehq.key

sudo apt-key add winehq.key

sudo apt-add-repository ‘deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main’

sudo apt update

sudo apt install –install-recommends winehq-stable

How to automatically attach folder actions to all added subfolders recursively?

TL;DR How do you make a folder action that attaches folder actions to added subfolders? Is that even possible?

My end goal is to convert gps/location-based reminders of specific locations (e.g. home/work) into iBeacon-triggered reminders. I have an iBeacon reminders app, but I rarely use it mainly because it’s buggy and it’s not as convenient as asking Siri to remind me of things.

I have the iBeacon triggering of reminders for these locations worked out. But I want to be able to create the reminders using Siri, e.g. “Hey Siri, remind me to ‘X’ when I get to work”, and have that set up the iBeacon-triggered reminder. Siri will already create a location based reminder in the reminders app and I know that related files are created in ~/Library/Calendars and I know how to tell which folder there-in contains the reminder events. I even know how to parse the ics files and translate which locations correspond to which iBeacons. I can do all that, but the hard part is reliably and in a timely and efficient fashion, catching the reminder-creation event so I can do the conversion to my iBeacon reminder system. All I have to do is, when a reminder is created, copy the reminder text into the place where the iBeacon event can grab it and issue the reminder.

I could poll the contents of ~/Library/Calendars every so often, but I have a lot of large calendar files with lots of events, so it would be better if I could do this via folder actions. Each event is a separate ics file. However, they’re distributed among multiple .caldav/.calendar/ directories. And I’d like this strategy to be able to cope with the creation of new directories/calendars.

So I was thinking that I could create a folder action attached to ~/Library/Calendars that itself attaches folder actions which attach folder actions which parse .ics files to pull out the location, arrive/leave event type, and the summary to create the iBeacon reminders. But that seems kind of fragile and complex. Theoretically it seems like it could work, though I don’t know what issues I might run into. I don’t even know if a folder action can attach a folder action. Has anyone done anything remotely similar to this?

Or does anyone know of another way to have Siri create iBeacon reminders? (For those curious: I bought an app called Beecon which can trigger webhook calls based on iBeacon enter/exit events. My plan is to have it trigger IFTTT iOS notifications, among other things.)

Move photos and convert to NEF after they have been “added” and not copied

I’ve just started using Lightroom, without any formal workflow and I add my photos directly in the camera native raw format (NEF in my case) and from copies of my SD I made on my hard drive.

Now I’d like to apply a more “formal” approach, and have them stored properly in meaningful folders, and also convert them to DNG. Is this possible to do it automatically?

If not, I guess the only option would be re-import all of them with the “Copy as DNG” option. But in this case I’d need to go and re-apply all the adjustments I already did to photos. Is there a way to do it?

Facebook – someone I know added me without having mutual friends

My privacy settings enables only “friends of friends” to add me on Facebook.

Someone I know added me and it doesn’t show we have any mutual friends. How is this possible?

If I go into a stranger facebook and give him a like or something. Does this bypass the “friend of friend” restriction?