I am running Nix on top of Devuan GNU/Linux system (x86_64), with following ~/.nixpkgs/config.nix, as documented in Nix Pills:
{
packageOverrides = pkgs: {
coreutils = pkgs.coreutils.override {
aclSupport = false;
attrSupport = false;
selinuxSupport = false;
};
coreutils2 = pkgs.coreutils.override {
aclSupport = false;
attrSupport = false;
selinuxSupport = false;
};
w3m = pkgs.w3m.override {
graphicsSupport = false;
imlib2 = null;
x11Support = false;
mouseSupport = true;
};
};
}
But when I run nix-env -iA nixpkgs.coreutils, Nix installs stock version of coreutils, with optional features enabled:
$ nix-env -iA nixpkgs.coreutils
replacing old 'coreutils-8.31'
installing 'coreutils-8.31'
$ ldd /home/iu/.nix-profile/bin/ls |grep libattr
libattr.so.1 => /nix/store/5xwmn6ai8c42j84k6gdzja0lnkdi3c60-attr-2.4.48/lib/libattr.so.1
(0x00007f0354e7f000)
But if I refer to same derivation (referential transparency) via other name:
$ nix-env -iA nixpkgs.coreutils2
Nix starts rebuild from source, which results in binaries, compiled without optional features, just as requested. What is even more mysterious, overriding build options for w3m works and do trigger rebuild.
Also, I noticed same strange behavior with gnutar. Is is somehow related to the fact that coreutils and gnutar are essential to Nix itself? How can I make coreutils in expected way?
This happens because one final overlay is applied after your overlays. (You're using packageOverrides which becomes essentially the first user overlay)
To quote the commit:
The stdenvOverrides overlay is used to bring packages forward during
bootstrapping via stdenv.overrides. These packages have already had
the overlays applied to them in the previous boostrapping stage. If
stdenvOverrides is not last in the overlays stack, all remaining
overlays will windup being applied again to these packages.
gnutar is also set by this overlay.
$ nix repl '<nixpkgs>'
nix-repl> lib.attrNames (stdenv.overrides pkgs pkgs)
[ "acl" "attr" "bash" "binutils" "binutils-unwrapped" "bzip2" "coreutils" "diffutils" "findutils" "gawk" "gcc" "glibc" "gnugrep" "gnumake" "gnupatch" "gnused" "gnutar" "gzip" "patchelf" "pcre" "xz" "zlib" ]
The "good" news is you can use a normal overlay to configure the last overlay. It's convoluted but it works:
nix-repl> (import <nixpkgs> { overlays = [ (self: super: { stdenv = super.stdenv // { overrides = self2: super2: super.stdenv.overrides self2 super2 // { coreutils = "put your coreutils here"; }; }; }) ]; }).coreutils
"put your coreutils here"
I recommend using overlays instead of packageOverrides to make sure this happens in the last "user" overlay.
So your overlay would be similar to:
_: super:
let
coreutils = pkgs.coreutils.override {
aclSupport = false;
attrSupport = false;
selinuxSupport = false;
};
in
{
# Overrides for stuff from stdenv go here. They're applied last
# so we use the same stdenv for builds but a custom coreutils etc for
# our system. This allows use to still use cache.nixos.org.
stdenv = super.stdenv // {
overrides = self2: super2: super.stdenv.overrides self2 super2 // {
inherit coreutils;
};
};
w3m = ...;
}
Related
I'm using the following Swift code to limit my GUI app on macOS to a single instance:
func IsAnotherInstanceRunning() -> Bool
{
let thisApp = NSRunningApplication.current
let thisBundleID = thisApp.bundleIdentifier
let thisPID = thisApp.processIdentifier
let workspace = NSWorkspace.shared
let apps = workspace.runningApplications.filter { (app) -> Bool in
if(app.bundleIdentifier == thisBundleID &&
app.processIdentifier != thisPID)
{
return true;
}
return false;
};
//Found any?
if(apps.count > 0)
{
return true
}
return false
}
I also have a console application written in C++. How can I do the same in pure C++?
Mainly how do I call anything related to NSRunningApplication and NSWorkspace?
I believe you can use named mutexes to achieve what you want.
You create a mutex with a specific name. If mutex already exists you quit.
https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutexattr_getpshared.html
For crossplatform implementation make sense to take a look on https://theboostcpplibraries.com/boost.interprocess-synchronization
named_mutex.
I have installed latest version of magento in my localhost.
After login to admin panel dashboard keeps loading.
Here is the image-
Please help to solve this error.
First Go to magento root directory then :
vendor/magento/framework/view/element/tempalate/file/validator.php (dont exactly copy this url just follow this path)
open this file using any editor and change this line
$realPath = $this->fileDriver->getRealPath($path); //you can comment this out
with this one
$realPath = str_replace('\\','/',$this->fileDriver->getRealPath($path));
then goto to
app/etc/di.xml
and search for view_preprocessed
you will find a whole line like this :
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
and change the Symlink with Copy
Magento 2.3
go to \lib\internal\Magento\Framework\View\Element\Template\File
go to the function isPathInDirectories and replace the function with following
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
//$realPath = $this->fileDriver->getRealPath($path);
$realPath = str_replace('\\','/',$this->fileDriver->getRealPath($path));
foreach ($directories as $directory) {
//$realDirectory = $this->fileDriver->getRealPath($directory);
$realDirectory = str_replace('\\','/',$this->fileDriver->getRealPath($directory));
if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
return true;
}
}
return false;
}
go to app/etc/di.xml then search for view_preprocessed
you will find a whole line like this :
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and change to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
#1. go to vendor/magento/framework/View/Element/Template/File/Validator.php#
#2. go to the function isPathInDirectories and replace the function with following:#
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
//$realPath = $this->fileDriver->getRealPath($path);
$realPath = str_replace('\\','/',$this->fileDriver->getRealPath($path));
foreach ($directories as $directory) {
//$realDirectory = $this->fileDriver->getRealPath($directory);
$realDirectory = str_replace('\\','/',$this->fileDriver->getRealPath($directory));
if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
return true;
}
}
return false;
}
#3. go to app/etc/di.xml then search for view_preprocessed
you will find a whole line like this :
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and change to
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy #
I am looking for automating a windows application,and researching on what tools to be used. I have come across Appium/WinAppDriver, but not sure if it has a good usage anywhere so far....Appreciate suggestions on this.
I'm currently using the WinAppDriver to automate a WPF program. It's very similar to Selenium, if you have any experience with that then I'd advise using the WinAppDriver over something like White. You also get to use the Selenium WebDriverWait which was a massive bonus.
There is also a tool known as 'Inspect' that comes with the Windows SDK that allows you to inspect a windows application similar to the web-browser dev tools.
You simply initiate a driver (similar to Selenium) however you also need to start the WinApp process.
C# example:
protected WindowsDriver<WindowsElement> GetWindowsDriver()
{
var appCapabilities = new DesiredCapabilities();
appCapabilities.SetCapability("app",
PathHelper.GetClientInstallPath() + "APPLICATION.exe");
appCapabilities.SetCapability("deviceName", "WindowsPC");
if (!IsWinAppDriverProcesssRunning())
{
StartWinAppProcessRunning();
}
var driver = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appCapabilities);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
return driver;
}
private static bool IsWinAppDriverProcesssRunning()
{
const string processName = "WinAppDriver";
var existingProcesses = Process.GetProcessesByName(processName);
return existingProcesses.Any();
}
private static void StartWinAppProcessRunning()
{
const string winAppDirectory = #"C:\Program Files (x86)\Windows Application Driver";
var winAppProcess =
new Process
{
StartInfo =
{
FileName = Path.Combine(winAppDirectory, "WinAppDriver.exe"),
WindowStyle = ProcessWindowStyle.Hidden,
WorkingDirectory = winAppDirectory
}
};
winAppProcess.Start();
}
Can somebody help setup this?
In my instance (RHEL), installed Varnish it work well.
Then setup varnish-devicedetect,
yum list installed | grep varnish
varnish.x86_64 3.0.5-1.16.amzn1 #amzn-main
varnish-libs.x86_64 3.0.5-1.16.amzn1 #amzn-main
varnish-release.noarch 4.0-3.el6 installed
When I tried add any code example to defaul.vcl, Varnish fails to start. This code is OK:
include "devicedetect.vcl";
sub vcl_recv {
call devicedetect;
}
But after this Varnish fails to start:
sub vcl_backend_response {
if (bereq.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
set beresp.http.Vary = "X-UA-Device";
} elsif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
}
# comment this out if you don't want the client to know your classification
set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
}
Tried, even empty:
sub vcl_backend_response {
}
Caused same problem.
What I missed?
It seems found answer: need use rules from Varnish ver. 3, used this set:
sub vcl_fetch {
if (req.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
set beresp.http.Vary = "X-UA-Device";
} elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
}
set beresp.http.X-UA-Device = req.http.X-UA-Device;
}
sub vcl_deliver {
if ((req.http.X-UA-Device) && (resp.http.Vary)) {
set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent");
}
}
Found here: https://www.varnish-cache.org/docs/3.0/tutorial/devicedetection.html
You could have found the error by trying to compile your vcl:
varnishd -C -f default.vcl (or whatever the path is to your vcl file)
This will tell you if your vcl has valid syntax or not - which will let varnish start without failure.
I have a code which works on one server but not on the other. Basically we have written a template file which should be used if URL is discussion_forum but it shows page not found.
/* discussion forum templates */
$querystring=$_GET['q'];
echo $querystring; // THIS PRINTS page-not-found
$querystring=explode('&',$_GET['q']);
if(!isset ($vars['node']) && $querystring[0]=='discussion-forum'){
$vars['template_files'] = array();
$vars['template_files'][] = 'page-discussion_forum';
}
if (!isset ($vars['node']) && $querystring[0]=='discussion_forum_answer') {
$_SESSION['question_id']=$querystring[1];
$vars['template_files'] = array();
$vars['template_files'][] = 'page-discussion_forum_answer';
}
if(!isset ($vars['node']) && $querystring[0]=='discussion_forum_search'){
$vars['template_files'] = array();
$vars['template_files'][] = 'page-discussion_forum_search';
}
when I give page-not-found in place of discussion-forum in $querystring[0]=='discussion-forum'. It shows the the page properly. Don't know whats happening here. Its working fine on other servers.
To add custom tpl I usually add the theme suggestions in the preprocess node.
$vars['theme_hook_suggestions'][] = 'node____'.$vars['view_mode'];
So yours should be
function THEME_preprocess_node(&$vars, $hook)
$vars['theme_hook_suggestions'][] = 'page-discussion_forum_search';
}
It would help if you identify which version of drupal are you using because some of these things change between versions.