How to make the 'cut' command treat same sequental delimiters as one?
I'm trying to extract a certain (the fourth) field from the column-based, 'space'-adjusted text stream. I'm trying to use the `cut` command in the following manner: `cat text.txt | cut -d " " -f 4` ...
How can I shuffle the lines of a text file on the Unix command line or in a shell script?
I want to shuffle the lines of a text file randomly and create a new file. The file may have several thousands of lines. How can I do that with `cat`, `awk`, `cut`, etc?
- Modified
- 19 Jul at 04:34
How to use JavaScript regex over multiple lines?
``` var ss= "<pre>aaaa\nbbb\nccc</pre>ddd"; var arr= ss.match( /<pre.*?<\/pre>/gm ); alert(arr); // null ``` I'd want the PRE block be picked up, even though it spans over newline characters. I ...
- Modified
- 23 May at 12:2
How do you convert a time.struct_time object into a datetime object?
How do you convert a Python `time.struct_time` object into a `datetime.datetime` object? I have a library that provides the first one and a second library that wants the second one.
When should I use Memcache instead of Memcached?
It seems that PHP has two memcached libraries named [memcache](http://us3.php.net/manual/en/book.memcache.php) and [memcached](http://us3.php.net/manual/en/book.memcached.php). What is the difference ...
private final static attribute vs private final attribute
In Java, what's the difference between: ``` private final static int NUMBER = 10; ``` and ``` private final int NUMBER = 10; ``` Both are `private` and `final`, the difference is the `static` at...
- Modified
- 26 Sep at 22:10
Do try/catch blocks hurt performance when exceptions are not thrown?
During a code review with a Microsoft employee we came across a large section of code inside a `try{}` block. She and an IT representative suggested this can have effects on performance of the code. I...
- Modified
- 19 Nov at 15:46
How can I convert a hex string to a byte array?
Can we convert a hex string to a byte array using a built-in function in C# or do I have to make a custom method for this?
What's the use/meaning of the @ character in variable names in C#?
I discovered that you can start your variable name with a '@' character in C#. In my C# project I was using a web service (I added a web reference to my project) that was written in Java. One of the ...
- Modified
- 22 Jan at 08:37
Where to store my Git personal access token?
Is it necessary to store the personal access token somewhere locally on the machine after generating it in GitHub? If yes, is there any preferred way where it could be stored?
- Modified
- 17 Nov at 11:4
How to declare a variable in a template in Angular
I have the following template : ``` <div> <span>{{aVariable}}</span> </div> ``` and would like to end up with : ``` <div "let a = aVariable"> <span>{{a}}</span> </div> ``` Is there a way to do i...
Call a Vue.js component method from outside the component
Let's say I have a main Vue instance that has child components. Is there a way of calling a method belonging to one of these components from outside the Vue instance entirely? Here is an example: ``...
- Modified
- 11 Feb at 10:46
Android "elevation" not showing a shadow
I have a ListView, and with each list item I want it to show a shadow beneath it. I am using Android Lollipop's new elevation feature to set a Z on the View that I want to cast a shadow, and am alread...
- Modified
- 22 Sep at 14:52
How to suppress binary file matching results in grep
When using `grep` in linux, the result often contains a lot of "binary file XXX matches", which I do not care about. How to suppress this part of the results, or how to exclude binary files in grep?
PG::ConnectionBad - could not connect to server: Connection refused
Every time I run my rails 4.0 server, I get this output. ``` Started GET "/" for 127.0.0.1 at 2013-11-06 23:56:36 -0500 PG::ConnectionBad - could not connect to server: Connection refused Is the se...
- Modified
- 1 Mar at 10:19
Access multiple elements of list knowing their index
I need to choose some elements from the given list, knowing their index. Let say I would like to create a new list, which contains element with index 1, 2, 5, from given list [-2, 1, 5, 3, 8, 5, 6]. W...
- Modified
- 14 Nov at 01:33
Use Font Awesome Icons in CSS
I have some CSS that looks like this: ``` #content h2 { background: url(../images/tContent.jpg) no-repeat 0 6px; } ``` I would like to replace the image with an icon from [Font Awesome](http://...
- Modified
- 2 Nov at 09:17
htaccess redirect to https://www
I have the following htaccess code: ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteCond !{HTTPS} off RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST...
- Modified
- 16 Dec at 16:32
TypeError: unhashable type: 'dict'
This piece of code is giving me an error `unhashable type: dict` can anyone explain to me what the solution is? ``` negids = movie_reviews.fileids('neg') def word_feats(words): return dict([(word,...
- Modified
- 9 Mar at 00:43
Rollback a Git merge
``` develop branch --> dashboard (working branch) ``` I use `git merge --no-ff develop` to merge any upstream changes into dashboard git log: ``` commit 88113a64a21bf8a51409ee2a1321442fd08db705 Me...
- Modified
- 3 Nov at 05:34
How to center the contents of an HTML table?
I am using an HTML `<table>` and I want to align the text of `<td>` to the center in each cell. How do I center align the text horizontally and vertically?
- Modified
- 28 May at 15:22
ImportError: No module named PIL
I use this command in the shell to install PIL: ``` easy_install PIL ``` then I run `python` and type this: `import PIL`. But I get this error: ``` Traceback (most recent call last): File "<cons...
- Modified
- 21 May at 13:31
For homebrew mysql installs, where's my.cnf?
For homebrew mysql installs, where's my.cnf? Does it install one?
Delete last char of string
I am retrieving a lot of information in a list, linked to a database and I want to create a string of groups, for someone who is connected to the website. I use this to test but this is not dynamic, ...
Check if a div exists with jquery
Yes, I know this has been asked a lot. But, it confuses me, since the results on google for this search show different methods (listed below) ``` $(document).ready(function() { if ($('#DivID').le...