Command line: search and replace in all filenames matched by grep

I'm trying to search and replace a string in all files matched by grep: grep -n 'foo' * will give me output in the form: [filename]:[line number]:[text] For each file returned by grep, I'd like...

extract fileName using Regex

If I want to match only fileName, i.e, in C://Directory/FileName.cs, somehow ignore everything before FileName.cs using Regex. How can I do it? I need this for a Compiled UI I am working on ......

Retrieve filename from file descriptor in C

Is it possible to get the filename of a file descriptor (Linux) in C?

How to get the original variable name of variable passed to a function

Is it possible to get the original variable name of a variable passed to a function? E.g. foobar = "foo" def func(var): print var.origname So...

Kill some processes by .exe file name

How can I kill some active processes by searching for their .exe filenames in C# .NET or C++?

Get just the filename from a path in a Bash script

How would I get just the filename without the extension and no path? The following gives me no extension, but I still have the path attached: source_file_filename_no_ext=${source_file%.*}

What is the correct way to join multiple path components into a single complete path in emacs lisp?

Suppose I have variables dir and file containing strings representing a directory and a filename, respectively . What is the proper way in emacs lisp to join them into a full path to the file? For...

Easiest way to check if an arbitrary String is a valid filename

In my application the user can enter a filename. Before processing I'd like to check if the input String is a valid filename on Windows Vista. Whats the easiest way to do that? By valid I'm...

Enforcing method order in a Python module

What is the most Pythonic way to deal with a module in which methods must be called in a certain order? As an example, I have an XML configuration that must be read before doing anything else...

Converting byte array to string and printing out to console

public void parse_table(BinaryReader inFile) { byte[] idstring = inFile.ReadBytes(6); Console.WriteLine(Convert.ToString(idstring)); } It is a simple snippet: read the first 6 bytes of...

Python Logging (function name, file name, line number) using a single file

I am trying to learn how an application works. And for this I am inserting debug commands as the first line of each function's body with the goal of logging the function's name as well as the line...

AppleScript cURL

I'm having hard times getting the following script working. So what it's supposed to do is: I want to set a timer for the script to safe a jpg version of www.url.com/picture.aspx on my HDD with a...

Get the Gmail attachment filename without downloading it

I'm trying to get all the messages from a Gmail account that may contain some large attachments (about 30MB). I just need the names, not the whole files. I found a piece of code to get a message...

how to print logs into only one file by google glog

I'm now using google glog. When I'm debugging the program, every time the process restart, a new log file generated, identified by the new pid as filename's sufix, like...

Improper use of __new__ to generate classes?

I'm creating some classes for dealing with filenames in various types of file shares (nfs, afp, s3, local disk) etc. I get as user input a string that identifies the data source (i.e....

WordPress custom field outside of loop

I currently have a banner image on a site which is pulled in via the featured image. The code below that does this works: if ( has_post_thumbnail() ) { $thumb = wp_get_attachment_image_src(...

SSL operation failed with code 1 Codeigniter does not send email

A PHP Error was encountered Severity: Warning Message: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL...

Using reactive form validation with <input type="file"> for an Angular app

I'm writing a component with a file picker that uploads a file to our CDN. I'm trying to add a reactive form on this component to validate the image input, so I can check against file...

What exactly is current working directory?

My book states: Every program that runs on your computer has a current working directory, or cwd. Any filenames or paths that do not begin with the root folder are assumed to be under the current...

Why is my WebAssembly function slower than the JavaScript equivalent?

Apologies for the broad question! I'm learning WASM and have created a Mandelbrot algorithm in C: int iterateEquation(float x0, float y0, int maxiterations) { float a = 0, b = 0, rx = 0, ry =...

C# Filestream denied access

I'm trying to use C# to create a file, and read files back to fill out a rich text block. right now my problem is in creating/writing to the file. FileStream fs = File.Create(@".\\tmp\" +...

Python Globbing a directory of images

I am working on a project currently and so far I have generated a folder of images (png format) where I need to iterate through each image and do some operation on it using PIL. I have the...

Installing PyHook python 3.7 64 bit

I’ve been trying to pip install pyHook for about 3 hours and tried every method that I can possibly think of or find but I can’t seem to get it to work. I get the error: Requirement...

rpmbuild check-rpath reports error that path is not absolute, incorrectly

I've been building RPMs using CMake & CPack 3.13.4 on OEL7 for several months without issue. My CMake configuration contained these lines: SET(CMAKE_SKIP_BUILD_RPATH ...

VS Code Markdown - is there a clever way to make links intellisense?

I've started using VisualStudio Code and Markdown as a note-taking tool - something akin to Zettelkasten. As part of this note-taking system, notes should always be linking to other...

youtube-dl filename formatting lowercase and dashes

I'm using youtube-dl frequently and have a quite simple file-naming scheme: lower case only and things of the same group are connected with "-" (minus, dash, etc.) while different things are...

Spatial merge/combine of multiple netcdf with xarray or satpy

I have two spatial dataset in netcdf format. They have same time, dimensions, coordinates, and data variable. But they are for different spatial coordinates. In below I tried to show my two...

im trying to use hashcat on a hash from hackthebox with rule and i get the output of Exhausted every time

The hash is an SHA1 hash that i need to append 2020 to the end of each password: The rule.txt file input is: "$2 $0 $2 $0" The command: hashcat -a 0 -m 100 hash.txt...

python33.dll not found Error while using Python4Delphi component

I'm working on a project with Python4Delphi component and also i want to use embedded version of python which is better to use as needs no installation. I've set the correct path and filename to...

Azure Devops yml pipeline if else condition with variables

I am trying to use if else conditions in Azure Devops yml pipeline with variable groups. I am trying to implement it as per latest Azure Devops yaml pipeline build. Following is the sample code...