How To Fix PDF Forms Not Showing Contents in Okular (Linux)

I have had this problem happen twice now, and I don’t know exactly what is causing it, but I found a solution. Here’s the situation…

I received a PDF that has forms. Typically, that isn’t a problem as Okular is able to open most PDFs with forms and show both the forms and what has been entered into the forms. However, with this particular PDF, when I click on the “Show Forms” button at the top of Okular, I can see the information entered into the form like this:

(NOTE: I tried opening the PDF in Xournal and had the same problem.)

But when I click on “Hide Forms” (which is still showing on this PDF as “Show Forms” for some reason), all of the information entered into the form goes away, like this:

If I try to save the PDF as a different PDF in Okular or print it, nothing shows up. I found one website that had a suggestion for why this might be happening – the PDF may have been filled out in a web browser instead of using Adobe Acrobat Reader (or Okular) and, as a result, the PDF that was saved has some problem. I’m not sure what browser would be doing this, but that gave me an idea. If the problem is that it was filled out in a browser, perhaps I can open it in a browser then print it to PDF. So, that’s what I tried and it worked.

I opened the PDF in Brave (one of the browsers I have installed on Linux) and the PDF showed all the forms with all the information filled in:

I then printed the PDF (which flattens it and removes the forms) using the print button to a PDF:

The resulting PDF, while flattened, now showed all the information in the forms and allowed me to sign the document electronically.

I’m not sure how I solved this last time, but I figured I’d post this solution up here for the next time this happens so I can quickly take care of the problem and don’t have to try to figure out why form information isn’t showing up in my PDF on Linux using Okular.

 47 total views

Cooking Tips

I’m not a professional chef. I claim no real expertise as a cook or chef other than the fact that I cook for my little family a lot and I like to eat good food. As a result, I spend a surprising amount of time cooking. There are lots of other places where people can get cooking tips from experts and professionals. This post is just me sharing a few things I have learned over the years that I wish I had known before I started cooking. The tips are shared in no particular order.

Don’t Waste Chicken Bones (applies to other meats as well – pork, beef, fish)

We don’t eat a lot of meat in our house, but occasionally (a few times a month) we’ll have chicken and on holidays we often have a turkey. Sometimes, I buy whole chickens either pre-cooked or smoke five or six chickens at a time then freeze the chicken to use for recipes. But what to do with the chicken bones and scraps? The obvious answer is to cook them and turn that into chicken stock. But that can also take hours and hours if you cook them on the stove (many stock recipes require boiling for 4 to 6 hours).

Enter: InstantPot. Whenever I have chicken bones and scraps, I throw them into one of my InstantPots with any veggies that are on the cusp of going bad (e.g., celery that is leftover from a recipe, a spare onion, some carrots, a few cloves of garlic, etc.). I then fill the InstantPot up with water to just below the max fill line for pressure cooking, close the lid, and set the pressure cooker to manually pressure cook everything for 2 hours. That’s half the time you would normally have to boil the chicken bones and scraps and it works just as well. (NOTE: How long you pressure cook everything is flexible – if you only have 1 1/2 hours, that works; if you want to go longer, you can as well.)

When it’s done, you can let it cool on its own or release the pressure. I then use a strainer/colander to extract all the big stuff and spoon the chicken stock into mason jars. If it’s just a couple of small jars, you can store those in the fridge and use the chicken stock in the next week or so in any recipe that calls for chicken or vegetable stock. If it’s more than a few jars, these can be canned in a pressurized canner: 20 minutes at 15 pounds of pressure. Those are good for at least a year.

Chicken stock from a store costs anywhere from $0.09 to $0.34 per ounce (about $3.00 per carton). Since you’ve already bought the chicken, why not save yourself the money (and get better chicken stock in the process) by making your own? Yes, it takes a little time, but it’s mostly just letting your InstantPot do the cooking. I’m guessing my total time investment when I do this is 15 minutes for a small batch up to 30 to 45 minutes for a big batch of chicken stock (which might yield 4 to 6 quart jars of chicken stock).

Zest Your Citrus

I have a number of recipes that call for zest from citrus – lemon, lime, or even grapefruit. Zest is a great ingredient to have around for sweet breads, cheesecakes, and even soups. And the bonus bit of information is that you can freeze zest and then use that frozen zest in those same recipes.

My recommendation, then, is to zest all of your citrus before you use it or eat it. Need the juice of a lemon or lime? Zest them first, then cut them up and squeeze the juice out. Going to have a grapefruit for breakfast? Zest it first, then enjoy.

I use small, cheap plastic bags (stored inside a freezer grade plastic bag) for my zest but you could also use a mason jar or tupperware to keep your zest in. And having a handy zester on hand that you can pull out whenever needed is ideal.

Grapefruit Spoons Are Awesome!

My wife and I really like grapefruit in the morning. We slice them in half, cut around the outside, then spoon out the endocarp (the part most people eat). For years, we used a regular spoon for this. Then I was introduced to serrated spoons. Wow! Game changer! They are so much easier to use for eating grapefruit.

Do yourself a favor and pick up a few grapefruit spoons if you like grapefruit in the morning. They are far more efficient when it comes to eating grapefruit than are regular spoons.

 77 total views

Mexican Restaurants in Central Tampa

My New Year’s resolution for 2021 was to try a new Mexican restaurant (primarily food trucks and small places close to us in Wellswood) each month for all of 2021. To make the comparisons across restaurants I tried to be fairly consistent and order Mexican street tacos (at least one chicken and one steak) at every restaurant so we could compare across them (I did that at all of them except Renzo’s).

We just wrapped up the resolution with our last restaurant in December. It was a good experiment. We found three restaurants that are all very close to us that we will definitely be returning to (top three). By no means did we try even a small fraction of the Mexican restaurants in Tampa. It may well be the case that there are other, great Mexican restaurants that we need to try (if so, comment below; and if you’re a restaurant and want to comp me a meal, I’d go for that, too).

Here’s the list from best to worst (if you click on the links, you’ll see my review for that restaurant).

  1. Los Comparres – 5 stars (first place we tried; only place we’ve been back to so far – chicken tostadas are amazing!)
  2. Taqueria Mi Mexico – 4 stars (but best chicken street tacos we found)
  3. Crazy Burrito – 5 stars
  4. Chiles Mexican Restaurant – 5 stars
  5. Rocky’s Tacos Tampa – 5 stars
  6. Xtreme Tacos – 4 stars
  7. Miguelitos Taqueria & Tequilas – 4 stars
  8. Rene’s Mexican Kitchen – 4 stars
  9. Grandma’s Tacos – 4 stars
  10. Renzo’s – 4 stars (actually, Argentinean, so it really doesn’t belong on this list)
  11. Lolis Mexican Cravings – 4 stars
  12. Tacos Las Californias – 3 stars

 258 total views

Plex Playlists with Amazon Echo

My music library is stored on my NAS. On my primary desktop at home, I mount the music folder and use Clementine to listen to my music. Everywhere else, I use Plex to play my music. Playing my music through Plex via my browser at work, via my Roku in the family room, and via the Plex Amp app on my phone, all works great. What doesn’t always work great is playing plex with an Amazon Echo device.

The first issue is that sometimes after I open Plex and tell it to play something, it just ignores me and does nothing, which is really annoying. I don’t have a solution for that problem. I may try to figure that out at some point.

The second issue is the one that I finally figured out. I have a number of really generic smart playlists that I have auto-generated in Plex. Most of these are generated based on the genre of music – Folk, Classic Rock, Alternative, Classical, etc. I’m all about keeping things simple, so I originally named most of those smart playlists in Plex as just the genre. In other words, my Folk playlist was literally just named “Folk.”

Enter the problem. I would say to my Amazon Echo, “Open Plex.” Plex would open fine. Then I would say something like, “Play playlist Folk .” My Echo would then say, “I’m sorry, I didn’t catch what you wanted to play. Try asking again.” For months (maybe even years), I just assumed that the Plex Skill was subpar and couldn’t do what I wanted it to do. I even double-checked with Plex’s list of Alexa Voice Commands to make sure I was saying things exactly right. But one day, for some reason, I had an epiphany: What if my Amazon Echo is getting confused with the genre and the playlist?

It turns out, that may have been the problem all along. I don’t know that for certain, but I ran a little experiment and that may have been the case. I created the exact same smart playlist in Plex that contained all my music in the genre Folk but named it “Favorite Folk” instead of just “Folk.”

This video shows the results:

So, word of advice: If you want the Plex Skill to play your playlists, name them something unique that does not overlap with the genre. Otherwise, the Plex Skill and your Amazon Echo will get confused and not play them.

 1,083 total views

LibreOffice – address label merge (from spreadsheet)

I’ve been using LibreOffice for over a decade and have only had to do an address label merge twice in that time – both of which have been in the last month. The first time, I actually did a form letter and a label merge; the second time I just had to do an address label merge. In the process, I realized that I totally forgot how to do it after the first time. Whenever that happens, I know that means I need to create a tutorial on here so I can remind myself how to do it if I ever need to do it again. So, here is my tutorial on how to merge labels in LibreOffice. (NOTE: I’m using LibreOffice 7.1.6.2.)

The idea behind a label merge, just like a form letter merge, is that you have a bunch of address information in a spreadsheet or database and, rather than having to enter all of that separately into a document to print labels, you’ll just have the software create the labels from the data you already have. LibreOffice is fully capable of doing this, but it’s not what I would call “easy” or straightforward. And, in fact, the first step will seem unrelated to merging labels, but it is necessary.

Part 1: Register Your Database with the Address Book Data Source Wizard

Before creating any labels, the first thing you need to do is create your database. I’m assuming you have a spreadsheet with addresses, like this one:

Make sure that you have column names at the top as those can become the field names in the database. It’s always a good idea to separate out your fields like I have done: first name, last name, street, city, state, zip. Of course, if you’re outside the US, your columns will be different. Adjust accordingly.

Okay, now we get to the weird part that is going to seem unrelated to merging these addresses into labels. A quick explanation may help. Basically, you need to turn this list of addresses into a database that LibreOffice has registered so it can then pull those fields when it generates the labels. This isn’t hard to do. LibreOffice will walk you right through it with a wizard. But it seems counterintuitive that you have to do this before you can start the mail merge. Just think of this as getting everything set up.

To create your database, click on File -> Wizards -> Address Data Source:

When you click on that, you’ll get this window:

This is Step 1 of 5 for the wizard. It’s basically saying, “Hey, let’s use existing data instead of having to enter new data.” Groovy. That will save us time. Unless you have your address data stored in Firefox or Thunderbird, select “Other external data source.” Then click on “Next” and you’ll get this next screen:

This is Step 2 of 5 for the wizard. On this screen, click on “Settings” and you’ll get a completely separate window:

(Did I mention that this is a bit confusing and complicated. It’s actually really smart, when you think about what the programmers did here, but it isn’t straightforward at all that you have to do all of this first. We’re only about halfway done.)

You have a lot of options you can choose from on this screen. I’m using a Spreadsheet, so I’ll leave that selected. But you can see from this screenshot that you choose from a variety of database sources:

Once you’ve selected the source for your data (again, I’m using a spreadsheet), select “Next” and you’ll get this screen:

Here, you need to choose your data source. Click on “Browse” and go find the spreadsheet you are going to use, like this:

Click on “Open” once you’ve selected it. That will take you back to the previous screen. If you want, you can click on “Test Connection.” Assuming everything worked, you should get this nice but relatively uninformative window:

Click on “Finish” and you’ll go back to the wizard:

This is Step 4 of 5 (note, Step 3 was skipped because I only had one field in my spreadsheet). On this screen, you can click on “Field Assignment,” which will let you match the fields in your imported data to the fields that are common for addresses. (NOTE: This is not required. You can skip this step if you want. It just changes the names of the fields later.) Here’s what the screen should look like:

Just to be clear, the Data source field is what LibreOffice is currently calling the newly imported data (in the image above, it just says “Addresses”). You’ll get a chance to change this later. The Table field (mine is called “Sheet1”) is the table in your spreadsheet where the address information was stored. You can then click on the various fields below where it says “Field Assignment” and align your information with the information options given, like this:

Once you’re done, hit OK and you’ll head back to the wizard.

This is Step 5 of 5. Phew. We’re almost done with this first part. You have a couple of options here. The first is a checkbox that says “Embed this address book definition into the current document.” You can unclick that if you want. Alternatively, you can leave it checked and make it part of the spreadsheet you are working on, which is fine. It really kind of depends on what your future plans are with this data. If this is data that you think you will use repeatedly for mail merges and you’ll probably be updating the data in the future, it might be a good idea to leave that checked. The second option is the one you definitely want to leave checked because we’re going to need it accessible for the label merge we’re going to do next. That option is also a checkbox that says “Make this address book available to all modules in LibreOffice.” Finally, you can name this address book. Call it something you’ll remember. I’m going with “folk artist addresses.” This changes the name that LibreOffice had temporarily assigned it (see the screenshot just above this). Once you’ve made your selections and named your Address Data, click “Finish”:

And once you hit “Finish,” nothing, right? Well, isn’t that weird.

Something did happen, it’s just “behind the scenes.” You have created a database that is now registered with LibreOffice. It’s just not showing it to you. If you want to see it, here’s how. Click on View -> Data Sources:

You’ll then see this:

You can see that I’ve got four Data Sources registered with LibreOffice. One of those is, of course, the one I just created: folk artist addresses. You can actually work with those data sources here if you’d like. Or, if you want to delete one (say, you made one by mistake or for a tutorial and you’ll never need it again), you can right-click on any of the databases and you’ll see this menu:

If you select “Edit Database File,” the LibreOffice database software will start up. If you select “Registered databases,” you’ll see a list of your databases with an option to select them and delete them, like this:

Okay. That does it for the prep work and part 1 of the tutorial. Now, with our address book registered, we can actually do the label merge.

Part 2. Label Merge In LibreOffice

Honestly, the first part is the hardest part. This next part goes pretty quick.

From any document in LibreOffice (it can be a Calc or Writer document; doesn’t matter), click on File -> New -> Labels:

You’ll then see this window:

Some explanation is in order. The big box is where you’re going to construct your addresses. I’ll walk you through that. The little check box at the top that has “Address” next to it is kind of nifty. If you’re a good LibreOffice user, when you first installed the software, you’ll click on Tools -> Options and fill in your User Data:

If you actually did that, you can click that little check box by “Address” and you’ll see your information populate the field:

This is a really slick way to, for instance, create business cards. But that’s not what we’re trying to do. So, uncheck that box and let’s get to merging some labels. First, in the drop down menu under “Database,” select the database we just created (and now Part 1 makes sense):

In the drop down menu under “Table,” select “Sheet1” (it’s the only sheet we had; we could always have named it something else). So, your window should look like this now:

Next, we start working with the drop down menu under “Database field.” In that menu, you should see all the fields you had in your spreadsheet:

Let’s build our address label. Select “firstname” then click on the little arrow pointing left:

That will insert that field into the label box, so you’ll see this:

Now, build the rest of your label, keeping in mind that you’ll want to add spaces and punctuation in between the fields, so it looks like this:

Once you’ve got it set up how you want it, we have a few other things we need to do. At the bottom, you need to choose between “Continuous” or “Sheet.” I’m assuming the Continuous is for printers that can print on labels that are connected. I typically print on individual sheets, so I select that. On the bottom right, find the “Brand” you want and then the “Type.” (Honest Aside: LibreOffice doesn’t always have every option I need for this, but you can usually find something that will work.)

We’re almost done. At the top of that window you’ll see two other tabs: “Format” and “Options.” If you want to customize the dimensions of your label, click on the Format tab. I rarely use this option, but it might be useful if you have a custom label you want to print. There is one thing on the “Option” tab that you probably want to select: “Synchronize contents”:

This will allow you to synchronize any formatting you do to the labels later. Trust me, you’ll want this option like 99% of the time. Once you’re done and have your label selected, click on “New Document” at the bottom.

You’ll then get an entirely new Writer file with labels spread out across the document and your fields highlighted in gray:

What you won’t see, unfortunately, is the actual data in those fields. That will come later. What you’ll want to do now is customize your label formatting. So, if you want to change the font, the font size, make the text bold or italicized, now is the time to do it. And, do it all in the top-left cell. In my document, I increased the font and made everything bold:

Remember when I said to choose “Synchronize contents.” Yeah, now is when you’ll want that. You don’t have to format every individual label. Just format the first one, as I said. And when you’re ready, click on the “Synchronize Labels” button in the floating window that popped up:

When you do, the formatting from the first cell transfers to all the other labels. Way easier than formatting each cell individually.

Now, to print the labels. This part is also, unfortunately, a little confusing. Click File -> Print or just hit the printer icon on the toolbar and you’ll get this message:

“Your document contains address database fields. Do you want to print a form letter?”

What an unfortunate prompt. We’re doing a label merge, so “No.” But don’t choose No! We may not want to print a form letter, but there isn’t a separate prompt for doing a label merge. So choose “Yes.” (Nudge to LibreOffice programmers – fix this.)

When you do, you’ll get this window:

This is a little confusing, but it’s basically that same Data Source window you saw in Part 1, but now we are applying it. You’ll see your Address Data Source on the top left. If you select your sheet (Sheet1 in my screenshot) you’ll see all your addresses. You have a couple of options here. You can choose not to print all of the addresses. This is in the Records option on the bottom left. If you want to test this with a single sheet, for instance, you can choose just the first XX addresses and test this out. On the bottom right, you can choose to save this as a File or send it directly to the Printer. Up to you. If you’re wary and don’t want to waste label sheets, this might be a good option. Or if you need to print these on a different printer, that would be helpful. But if you’re ready to print, select “OK” and you’ll get one more chance to change your mind because you’re finally going to see THE LABEL MERGE! (Woot! Rejoice!):

The screenshot above shows you the final window I get before I actually print the labels. And, assuming everything worked correctly, you’ll finally see the address information merged into the labels. Success!

This is not a simple process but there is, as with all things LibreOffice, a lot of customizability, which is why I prefer LO over Microsoft products.

Anyway, that’s how you do labels merge in LibreOffice. And, bonus, if you ever need to use that same address information in the future, it’s already registered in LibreOffice so you can just do this again. If not, you can delete it as I illustrated above.

 2,103 total views

R – Finding and Setting Working Directory

R, like many software programs, likes to have a folder or directory on your computer to operate in. When you start R, depending on how you start it and whether or not you previously saved your session, it’s likely that R will set a default “working directory” or folder where it is going to look for files and folders and where it will default to storing whatever it is you are working (e.g., script files, etc.). Many R beginners don’t know that you can change the working directory AND it is really useful to do so.

There are two ways to change your working directory if you are using R with RStudio – from the console or using the menus in RStudio. I’ll show them both.

To begin with, you can use the following code to get your current working directory:

getwd()

When you enter this into the console or run this from a script file, R will indicate what the current working directory is, like this:

In the screenshot above, you can see that I had set my working directory to a folder called “new analysis” for a project I am working on, but it also shows the entire folder hierarchy to my working directory: “/home/ryan/Dropbox/Ryan/writing/transing god/new analysis”. Knowing what my working directory is, makes it much easier to change to my working directory.

To change your working directory, you can copy the folder hierarchy that R provided and simply change it to the new location. So, for instance, if I wanted to change my working directory to a different project that is stored in a different folder, I can just change the folder hierarchy with the following command:

setwd("/home/ryan/Dropbox/Ryan/writing/futurism studies/data/")

Basically, getting your working directory uses the code “getwd()” with nothing in the parentheses, and setting your working directory uses the code “setwd(“/path/to/folder/”)” with the folder hierarchy included inside quotes inside the parentheses. This is how you get and set your working directory from the console.

If you’re using RStudio to interface with R, you can also set your working directory using the point-and-click menus. Click on Session -> Set Working Directory -> Choose Directory:

Once you click on “Choose Directory,” a window will pop up that will let you select the folder that you want to be your working directory:

Navigate to the folder you want to use as your working directory, select it, and hit “Open” and that will set your working directory. You should also see the corresponding code in the console that matches what we did above.

You can, of course, check to make sure that your working directory has changed by using the code above – “getwd()”. It should now be your new working directory.

Why might you want to change your working directory? The major advantage to doing this is that you no longer have to give the full path length to files you want to import, export, or work on. You can simply give the relative path based on the working directory. For instance, if I want to save a table of data from my environment, if I have set my working directory, I don’t have to specify the entire path to the file when I save it, I can simply save it to my working directory with the name, like this:

write.csv(MyData, file = "MyData.csv")

The code above will save the environment object “MyData” as a CSV file into my working directory and call it “MyData.csv”. If I haven’t set my working directory and want to save the same object, I would have to specify the directory where I want to save it, like this:

write.csv(MyData, file = "/home/ryan/Dropbox/writing/someproject/MyData.csv")

Setting your working directory also makes it easier to import files as you only have to use the name of the file you want to import and not the entire folder hierarchy to the file. With my working directory, I could import a CSV file like this:

dataframe1 <- read.csv("MyData.csv", header=TRUE)

Contrast that code with this code that would be required if I had not set my working directory:

dataframe1 <- read.csv("/home/ryan/Dropbox/writing/someproject/MyData.csv", header=TRUE)

Using a working directory saves time and makes it much easier to import and export files from R.

BONUS:

If you ever need to find your folder hierarchy, this is relatively easy to do on Linux or Windows (no promises on Mac). On Linux, just open a file manager (like Dolphin), navigate to the folder you want, then select the folder hierarchy in your file manager, like this:

You can simply copy and paste that into R. If you want to use the console to do it, you can also navigate to the folder in a console on Linux then use the “pwd” (path to working directory) command to get your current directory:

 792 total views

Launching HandBrake 1.4.0 in Kubuntu 21.04

The fine folks at HandBrake have updated their software and distribution system to a Flatpack approach. Their Flatpack for Linux is based on Gnome, not KDE, which is fine, but it does mean that the GUI is no longer skinned with my system settings on KDE. Oh well…

The bigger issue is that, with a flatpack install, HandBrake is no longer registered with the KDE system and has to be launched from the command line. That isn’t particularly onerous, but it is annoying when I use KDE’s KRunner to launch most of my software (Alt + F2). There is a solution to this that works just fine: add HandBrake to the Applications in the Application launcher.

To do this, right-click on the Application launcher and select “Edit Applications”:

In the window that comes up, select “New Item” to add HandBrake as an Application:

You’ll get a Window to name the new item:

You can then fill in the following details in the General tab:
Name: HandBrake
Description: HandBrake
Comment: launch Handbrake from Flatpack
Command: flatpack run fr.handbrake.ghb

If you want, you can also download the Handbrake logo and select it by clicking on the little square next to Name and Description:

When you’re done, hit “Save” and HandBrake will be registered with the system as an Application.

Now, when you use KRunner (Alt + F2), HandBrake will pop up as an option:

 890 total views

LibreOffice Calc – VLookup with dates

In a different post on this blog, I showed how to use Vlookup to match lists. Someone commented on that post and indicated that it didn’t work with dates. It turns out, it does, but… There is a slight tweak required to make it work. So, if you want to learn how to use VLookup, first go to that previous post. Then come back here to see how this works with dates.

The issue with dates has to do with the format of the cells. To illustrate this, I created a spreadsheet and inserted a bunch of dates:

It’s important to make clear at this point that LibreOffice Calc, just like other spreadsheet software, has different “formats” for cells. Cells can be formatted as numbers, as text, as dates, etc. This is important because LibreOffice will treat cells with different formats differently. For instance, it’s pretty challenging to do numerical calculations with text (e.g., “apple” + 65 = ?). LibreOffice needs to know the “format” of a cell. That is the key to making vlookup work with dates.

To check the format of a cell, all you need to do is right-click on it and select “Format Cells” (or Format -> Cells from the menus at the top of the screen):

Obviously, if you’re working with dates, then the format for the cells should be “Date” and whatever specific date format you want:

Okay, back to vlookup. To find a date in a list of dates, the value you are searching for also has to be a date in the Date format – ideally, they should be formatted identically. You can see in this spreadsheet, I inserted a date to search for in my list of dates:

The vlookup formula isn’t any different. In the cell just to the right of where I inserted the date I want to search for, I added my vlookup formula. Here’s what I put into my formula:

=VLOOKUP(E1,A1:A22,1,0)

This formula calls the “vlookup” function. “E1” is the date for which we are going to search in the list of dates. “A1:A22” is the list of dates in which we are searching. The “1” after that says to use the first item in the list of items we are searching for (kind of a weird requirement). And the “0” tells LibreOffice Calc that the list is not alphabetized or sorted.

Once I put that formula in, LibreOffice Calc will search through the list to see if my date is in the list. I know that my date is there. And, typically, vlookup will return the matching date if it is there, so it should return “8/27/2021”. But, here’s what I get when I hit return on my formula:

Rather than getting the target date, I get a weird number: 44435. Knowing a little bit about LibreOffice Calc, I quickly realized what the problem is: LibreOffice Calc doesn’t know that I’m searching for a date. It found the date, but the field where it is returning the value it found is currently formatted as a “Number,” not a “Date.” See:

To show that it found the matching date, the vlookup cell also needs to be formatted as a Date. So, change the formatting for the vlookup cell:

And once you hit OK, you should now see the date it found:

In short, yes, vlookup works with Dates. You just have to make sure that the cells where the vlookup formula is located are formatted as Dates not as Numbers and you’ll see which Dates match.

 1,021 total views

R – changing mirror in RStudio

CRAN (The Comprehensive R Archive Network) is a distributed set of servers that allow people to download the various R packages from a bunch of servers that are all “mirrors” of each other. These servers or mirrors are called “repositories.” There are many advantages to this: (1) people can download from a mirror that is closer to them which should result in a faster download and (2) if a server or mirror goes down, you can switch to one that is still up.

If you ever find yourself in the situation that you are unable to update a package because CRAN is down, there is a quick and easy way to change the server you use for downloading packages.

In RStudio, click on Tools -> Global Options:

In the window that comes up, look for “Packages” on the left hand side:

To change the repository, click on “Change” and select a different location:

When you’re done, select “OK” and “OK” again. You can then try updating your packages or downloading new packages again. Assuming that mirror is up and running, that should solve your problem.

 701 total views,  1 views today

Linux FFMPEG – Flip Vertical Video to Horizontal

I was recently shooting some videos on my phone to share with someone else and accidentally flipped the phone before filming a clip. I never film vertically as I know that our playback devices are not designed to playback vertical footage. But I screwed up and got a clip that was vertical. Since I would consider sharing such a clip “bad form,” I needed a quick and easy way to flip the clip. Enter FFMPEG.

This can be done very easily with a single line of code at the console or terminal in Linux, assuming you have FFMPEG installed. Here’s the line of code:

ffmpeg -i input_video.mp4 -vf "transpose=2" output_video.mp4

Here’s what the code does. First, it calls “ffmpeg.” Then you tell it what video to input “-i input_video.mp4.” (The “-i” tells FFMPEG that what follows is the input.) If you’re not in the same directory as the video, you can simply add that information (e.g., /home/user/input_video.mp4). Next, the “-vf “transpose=2″” tells FFMPEG to first “-vf” create a filtergraph (basically, apply a filter) which is “transpose.” The “2” indicates how much to rotate the video – 90 degrees in this case. Finally, pick a name for your file and a file extension. That’s it. That will rotate your video from vertical to horizontal.

Here’s an actual example of code that I used:

ffmpeg -i /home/ryan/Desktop/vertical.mp4 -vf "transpose=2" /home/ryan/Desktop/horizontal.mp4

Sources for this post. FFMPEG’s documentation (here and here) and this post.

 1,057 total views