How do I properly escape data for a Makefile?
I'm dynamically generating config.mk with a bash script which will be used by a Makefile. The file is constructed with:cat > config.mk <<CFGSOMEVAR := $value_from_bash1ANOTHER :=...
View ArticleWhat is the Windows equivalent of "pidof" from Linux?
In a batchscript, I need to get a list of process IDs with given binary path C:\path\to\binary.exe.In Linux, I can just do pidof /path/to/binary.Is there a Win32 executable which does the same,...
View ArticleAnswer by Lekensteyn for What do "!" and "*" mean in the password section in...
From the manual page shadow(5):encrypted passwordRefer to crypt(3) for details on how this string is interpreted.If the password field contains some string that is not a valid resultof crypt(3), for...
View ArticleAnswer by Lekensteyn for Show MySQL database for user
For the current logged in user, you can use SHOW DATABASES;. But, if the user has the SHOW DATABASES; privilege, he'll be able to see all databases, even if he doesn't have access to it....
View ArticleHow can I know if Leak Sanitizer is enabled at compile time?
The GCC and Clang compilers both have support for LeakSanitizer which helps finding memory leaks in C programs. Sometimes a memory leak is unavoidable (because it is being tested in a test suite for...
View ArticleAnswer by Lekensteyn for PHP to search within txt file and echo the whole line
And a PHP example, multiple matching lines will be displayed:<?php$file = 'somefile.txt';$searchfor = 'name';// the following line prevents the browser from parsing this as...
View ArticleAnswer by Lekensteyn for Confused by the report ID when using HIDAPI through USB
If your application does not include a Report ID in the HID descriptor, then there shouldn't be a Report ID prepended.As you can see in the documentation of hid_write, HIDAPI should only send 64-bytes...
View ArticleDoes a KILL signal exit a process immediately?
I'm working on a server code that uses fork() and exec to create child processes. The PID of the child is registered when fork() succeeds and cleaned up when the CHILD signal has been caught.If the...
View ArticleIs there a "break" tag to escape a loop in Liquid?
How do I break out of loop in Liquid, mainly a for-loop? I've tried {% break %}, but that fails with There were errors saving your file: Unknown tag 'break'.I'm trying to achieve something like:var...
View ArticleAnswer by Lekensteyn for Apply Bitbucket pull request as a patch
For 7.x versions you might try these links based on info from https://docs.atlassian.com/bitbucket-server/rest/7.11.1/bitbucket-rest.wadl and...
View ArticleHow can I find the full file path given a library name like libfoo.so.1?
Without implementing a linker or using ldd, how can I find the full path to a library? Is there a standard library available for that on Linux? (POSIX maybe?)Using ldd and grep on a file that is...
View ArticleHow to suggest files with tab completion using readline?
Within the Bash shell, I can use tab-completion to use suggest file and directory names. How can I achieve this with nodejs and readline?Examples:/<Tab> should suggest /root/, /bin/,...
View ArticleAnswer by Lekensteyn for PHP: fileperms() values and convert these
16804 is the decimal notation for the octal number 40644. Check 2nd example of the PHP manual for the meaning of these values.40644 extracted:4 - the file is a directory0 - padding to get the first 4...
View ArticleAnswer by Lekensteyn for How to reload a page using JavaScript
location.reload();See this MDN page for more information.If you are refreshing after an onclick then you'll need to return false directly afterlocation.reload();return false;
View ArticleAnswer by Lekensteyn for mysql check collation of a table
SHOW TABLE STATUS shows information about a table, including the collation.For example SHOW TABLE STATUS where name like 'TABLE_NAME'
View ArticleAnswer by Lekensteyn for PHP global or $GLOBALS
Use global at the top of your function. That way, you can easily see what globals are used.
View ArticleAnswer by Lekensteyn for how to replace url in css using regexp (javascript)
Replace # below with $2 if you want to get the URL with single quotes.var text = '#anything {behavior:url("csshover.htc");}'; //iam using " with urltext += ".regleft {background:transparent...
View ArticleAnswer by Lekensteyn for Unclosed or tag somewhere on page causing unwanted...
Test the URL at validator.w3.org and you'll get a response quickly:Warning Line 113, Column 314: unclosed start-tag requires SHORTTAG YES…uld end up as one of the biggest draft or waiver wire steals of...
View ArticleAnswer by Lekensteyn for PHP: json_encode changing slash to \/
It's perfectly legal JSON, see http://json.org/. \/ is converted to / when unserializing the string. Why worry about it if the output is unserialized by a proper JSON parser?If you insist on having \/...
View ArticleAnswer by Lekensteyn for Prevent the android app from running if packet...
You won't make your application more secure by disabling it when a network sniffer is installed. As a user, I would be very annoyed by such so-called security measures which are ineffective.To secure...
View Article