Saturday, June 29, 2019

Copying to Clipboard with Windows Subsystem for Linux

Copying to Clipboard with Windows Subsystem for Linux

EmailThis Premium lets you save unlimited bookmarks, PDF, DOCX files, PPTs and images. It also gives you a PDF copy of every page that you save. Upgrade to Premium →

This tip is 100% thanks to Ben Hillis, a developer working on the Windows Subsystem for Linux (WSL). Yesterday I needed to copy a file under WSL to the my system clipboard. If you Google for how to do this, you'll see a CLI called clip that works under Unbuntu, however, that doesn't work under WSL. If I had to guess I'd say because there's isn't a GUI involved with WSL but to be honest, I'd be guessing.

When I asked on Twitter, Ben had a simple solution - use clip.exe. I keep forgetting that WSL provides complete access to Windows executables. I knew this - heck - it's how my tip on loading VSCode Insiders from WSL worked. But I didn't even think to check if Windows had a utility to copy to the clipboard.

In case you're curious, this is how you would copy a file under WSL to your Windows clipboard:

cat report.txt | clip.exe 

And I'm sure there's numerous other ways too. Anyway, I'm mainly just blogging this so I don't forget.

Source: https://www.raymondcamden.com/2017/10/19/copying-to-clipboard-with-windows-subsystem-for-linux

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade to Premium

Tuesday, June 25, 2019

How to open new incognito window with Javascript? (Google Chrome)

How to open new incognito window with Javascript? (Google Chrome)

EmailThis Premium lets you save unlimited bookmarks, PDF, DOCX files, PPTs and images. It also gives you a PDF copy of every page that you save. Upgrade to Premium →

Chrome extensions with the tabs permission can use the chrome.windows.create method:

chrome.windows.create({"url": url, "incognito": true});

However, to access it, you'll either need to write your own extension or find an existing one which provides a suitable hook (I don't know whether this can be done with "Mouse Stroke"—I'm too scared to look).

answered Oct 13 '11 at 17:46

eggyaleggyal

100k1818 gold badges159159 silver badges204204 bronze badges

Not the answer you're looking for? Browse other questions tagged javascript google-chrome-extension or ask your own question.

Source: https://stackoverflow.com/questions/2228118/how-to-open-new-incognito-window-with-javascript-google-chrome

Please check the attached file.

EmailThis was not able to extract useful content from the website. Hence, we have saved the webpage to a PDF file. You can find that attached along with this email.

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade to Premium

Thursday, June 20, 2019

How to order 1,2,3 not 1, 10, 11, 12 in mySQL

How to order 1,2,3 not 1, 10, 11, 12 in mySQL

EmailThis Premium lets you save unlimited bookmarks, PDF, DOCX files, PPTs and images. It also gives you a PDF copy of every page that you save. Upgrade to Premium →

The following code outputs in order of 1, 10, 11, 12 of id.

I want to make it 1,2,3,4...

Could anyone tell me what I should do please.

$Q = $this->db->query('SELECT P.*, C.Name AS CatName FROM products AS P LEFT JOIN categories C ON C.id = P.category_id');

Thanks in advance.

asked Dec 2 '09 at 14:03

First, add an order by clause at the end:

ORDER BY category_id

If category_id is a string, then you must treat it like an integer. There are a few ways to do this. I usually add a zero. You can also cast it.

ORDER BY category_id + 0

answered Dec 2 '09 at 14:05

You can do an explicit cast by doing:

ORDER BY CAST(category_id AS UNSIGNED INTEGER)

But you should reconsider you database layout as a field containing only numeric values should also be of an numeric type..

Best wishes, Fabian

answered Dec 2 '09 at 14:28

As previously mentioned MySQL doesn't support alphanumeric sorting. One common trick to solve this is to first order by length:

ORDER BY LENGTH(column_name), column_name

As long as the non-numeric part of the value is the same length, this will sort 1 before 10, 10 before 100, etc.

answered Mar 24 '17 at 6:19

Make sure that the column that holds 1,2,3,4 is INT type, if it is TEXT, you will not get numerical order, but what you describe 1, 10, 11, 2, 22, 23, 31, etc;

And like others mentioned, use ORDER BY

answered Dec 2 '09 at 14:06

Order by only working for numerical values(int), not work for varchar, char

Your category_id should numerical, otherwise you need to cast values to numerical.

answered May 16 '16 at 6:52

Well, you're not setting any ORDER BY clause.

answered Dec 2 '09 at 14:05

Not the answer you're looking for? Browse other questions tagged mysql sql-order-by or ask your own question.

Source: https://stackoverflow.com/questions/1833077/how-to-order-1-2-3-not-1-10-11-12-in-mysql

Please check the attached file.

EmailThis was not able to extract useful content from the website. Hence, we have saved the webpage to a PDF file. You can find that attached along with this email.

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade to Premium