Mailbox directory not changed after IMAP account switch - mutt

In my configuration I have two online IMAP accounts, say A and B.
My simplified configuration file looks like that:
## Account A settings
source ~/.mutt/a/config
folder-hook 'a.com' 'source ~/.mutt/a/config'
## Account B settings
folder-hook 'b.com' 'source ~/.mutt/b/config'
macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/a/config<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/b/config<enter><change-folder>!<enter>'
Configuration files of both accounts are similar and looks like this:
set imap_user = usera
set imap_pass = userasecret
unset folder
set folder = "imaps://mail.a.com/"
set spoolfile = "+INBOX"
mailboxes "+INBOX"
and
set imap_user = userb
set imap_pass = userbsecret
unset folder
set folder = "imaps://mail.b.com/"
set spoolfile = "+INBOX"
mailboxes "+INBOX"
I can switch between accounts using F2 nad F3 keys, but the problem is when I try to change the mailbox. At the beginning (i.e., before using F-key) pressing c? gives me the list of available IMAP folders. However, when I switch to the second account - by pressing F3 - and then try to list IMAP folders there is an error. Mutt try to fetch folders from the first server: imaps://mail.a.com and fails because of the wrong credentials (as imap_user is already set to userb). I have to wait a while, then press c again and change the directory name to the current folder variable value. After this operation I can list the folders again. Until the next switch...
Why is mutt sticking with the old directory path after changing the folder and how can I change this behaviour?

I don't know if you still care, but I found this solution:
With the above shortcuts (or with the sidebar) you will find that changing folders (with c by default) is not contextual, i.e. it will not list the folders of the current mailbox, but of the one used the last time you changed folders. To make the behaviour more contextual, the trick is to press = or + for current mailbox. You can automate this with the following macro:
macro index 'c' '<change-folder>?<change-dir><home>^K=<enter>'
See the website: https://wiki.archlinux.org/index.php/Mutt

Related

RegisterEventSource(0, "App1.exe") => what if there are multiple "App1.exe"s under ...\Eventlog registry key?

I am trying to use the Windows Event Logging service and in struggle with RegisterEventSource owing to the insufficient/ambiguous description.
Let's assume "App1.exe" is the event source name that will be used from an application program App1.exe.
And I will use my own custom event log subkey named "MyCustLog" under which "App1.exe" subkey will be created.
So, my custom event log subkey for App1.exe will look like "... \MyCustLog\App1.exe" under which EventMessageFile/CategoryMessageFile/CategoryCount will be set as "App1.exe"/"App1.exe"/3, respectively.
Now, there happens and/or will happen to be another "App1.exe" event source name registered under a 3rd party custom event log key as shown below:
HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Services
Eventlog
Application
Security
System
3rdPartyLog
App1.exe
After I create my own custom event log key it looks like:
HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Services
Eventlog
Application
Security
System
3rdPartyLog
App1.exe
MyCustLog
App1.exe
Now, I call RegisterEventSource follows:
HANDLE hEvtSrc = RegisterEventSource(0, "App1.exe");
=> returns an event log handle to hEvtSrc, but how can I be sure that the handle is returned for MyCustLog's App1.exe, not 3rdPartyLog's App1.exe?
What I have tried:
I tried the following:
HANDLE hEvtSrc2 = RegisterEventSource(0, "MyCustLog\\App1.exe");
=> this also successfully returns an event log handle but not sure if it is for MyCustLog's App1.exe, nonetheless. Moreover, an event fired by the following ReportEvent with this handle shows failure description in its property window from Windows Event Log Viewer.
CONST LPCTSTR pBadCommand = _T("The command that was not valid");
DWORD dwEventDataSize = ((DWORD)_tcslen(pBadCommand) + 1) * sizeof(TCHAR);
BOOL bRet = ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, UI_CATEGORY, MSG_INVALID_COMMAND, NULL, 0, dwEventDataSize, NULL, (LPVOID)pBadCommand);
The failure message says: The description for event id MSG_INVALID_COMMAND cannot be found from the source MyCustLog\App1.exe
I also tried the third way:
HANDLE hEvtSrc3 = RegisterEventSource(0, "MyCustLog/App1.exe");
=> this again successfully returns an event log handle, but still an event fired by ReportEvent with this handle shows the almost the same failure description in its property window from event viewer. The only difference in failure message is MyCustLog/App1.exe instead of MyCustLog\App1.exe.
Therefore, "MyCustLog\App1.exe" or "MyCustLog/App1.exe" cannot be used instead of "App1.exe" to get the right handle of my own for RegisterEventSource. So we are back to the square one again.
So, once again, how can I be sure the returned handle for RegisterEventSource(0, "App1.exe") is for MyCustLog\App1.exe, not for 3rdPartyLog\App1.exe?
Below is shown the .mc file in use for App1.exe.
[Message file]
; // App1.mc
; // This is the header section.
SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
Warning=0x2:STATUS_SEVERITY_WARNING
Error=0x3:STATUS_SEVERITY_ERROR
)
FacilityNames=(System=0x0:FACILITY_SYSTEM
Runtime=0x2:FACILITY_RUNTIME
Stubs=0x3:FACILITY_STUBS
Io=0x4:FACILITY_IO_ERROR_CODE
)
LanguageNames=(English=0x409:MSG00409)
; // The following are the categories of events.
MessageIdTypedef=WORD
MessageId=0x1
SymbolicName=NETWORK_CATEGORY
Language=English
Network Events
.
MessageId=0x2
SymbolicName=DATABASE_CATEGORY
Language=English
Database Events
.
MessageId=0x3
SymbolicName=UI_CATEGORY
Language=English
UI Events
.
; // The following are the message definitions.
MessageIdTypedef=DWORD
MessageId=0x100
Severity=Error
Facility=Runtime
SymbolicName=MSG_INVALID_COMMAND
Language=English
The command is not valid.
.
MessageId=0x101
Severity=Error
Facility=System
SymbolicName=MSG_BAD_FILE_CONTENTS
Language=English
File %1 contains content that is not valid.
.
MessageId=0x102
Severity=Warning
Facility=System
SymbolicName=MSG_RETRIES
Language=English
There have been %1 retries with %2 success! Disconnect from
the server and try again later.
.
MessageId=0x103
Severity=Informational
Facility=System
SymbolicName=MSG_COMPUTE_CONVERSION
Language=English
%1 %%4096 = %2 %%4097.
.
; // The following are the parameter strings */
MessageId=0x1000
Severity=Success
Facility=System
SymbolicName=QUARTS_UNITS
Language=English
quarts%0
.
MessageId=0x1001
Severity=Success
Facility=System
SymbolicName=GALLONS_UNITS
Language=English
gallons%0
.
If there are multiple App1.exe event sources, there is no way to tell RegisterEventSource() which source to use. RegisterEventSource() only accepts a source name, not a log name.
In fact, the Event Sources documentation says:
You cannot use a source name that has already been used as a log name. In addition, source names cannot be hierarchical; that is, they cannot contain the backslash character ("").
Which is why registering MyCustLog\App1.exe doesn't work, as it is an illegal source name. And why registering MyCustLog/App1.exe doesn't differentiate App1.exe between multiple logs, as / is not a hierarchy delimiter so RegisterEventSource() treats MyCustLog/App1.exe as the entire source name, not as App1.exe underneath MyCustLog.
So, since the source name for both logs is just App1.exe, you must use RegisterEventSource("App1.exe"), and so it will use the the first App1.exe it finds. And if it doesn't find any, it will fallback to using the Application log, which doesn't support category/message files.
So, make sure your event source is named uniquely. For instance, by NOT using your app's filename, but rather more descriptive names, eg:
HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Services
Eventlog
My Custom Log
My Custom App Name
You can point My Custom App Name to the actual App1.exe file in its EventMessageFile/CategoryMessageFile values as needed.
And then you can use RegisterEventSource("My Custom App Name").
You should have a look at your local Registry to see how other apps register their event sources. It is actually rare for filenames to be used as key names. For example, here is what is registered in the eventlog key on my local system. As you can see, none of the log keys or app keys use filenames for their names:

sg-cookie-optin extension throws No class named SGalinski\SgCookieOptin\Hook\LicenceCheckHook

Downloaded this https://packagist.org/packages/sgalinski/sg-cookie-optin
Copied the file to the server, activated the extension in ext manager.
Suddenly front & backend not working anymore.
Deleted the extension manually from PackageStates.php according to
https://docs.typo3.org/m/typo3/guide-installation/master/en-us/ExtensionInstallation/Index.html
Frontend now working, backend still throws the error
No class named SGalinski\SgCookieOptin\Hook\LicenceCheckHook
in /home/sc/wwn/typo3_src-10.4.10/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 3340
throw new \InvalidArgumentException($errorMsg, 1294585865);
}
} else {
$errorMsg = 'No class named ' . $parts[0];
throw new \InvalidArgumentException($errorMsg, 1294585866);
}
} elseif (function_exists($funcName) && is_callable($funcName)) {
// It's a function
$content = call_user_func_array($funcName, [&$params, &$ref]);
I did set up the key and the output folder in the config file
what I didn't do since backend not working anymore :
3. Add the static TypoScript named "Cookie Optin" to your instance with the "Template" backend module.
Open up the "Template" module in the backend of TYPO3.
Go to your root site page within the page tree.
Choose "Info/Modify" at the select on the top.
Click on the button "Edit the whole template record".
Select the tab "Includes".
Choose the template "Cookie Optin (sg_cookie_optin)" on the multi select box with the name "Include static (from extensions)"
Save
4. Go into the "Cookie Opt In" backend module, configure it and save it once.
Any idea how i can fix that? Pretty stuck atm.
The install tool of your installation should still work. Try to open yourdomain.tld/typo3/install.php.
To enable the Install Tool, the file ENABLE_INSTALL_TOOL must be created in the directory typo3conf/. Make sure that the file has no file extension like .txt.
Then log in to the install tool and go to Maintenance => Flush TYPO3 and PHP Cache and flush all caches.
Then the backend should work.
If the install tool is not accessible, try to find a folder var/Cache. Most probably it will be located in typo3temp. Delete all files and subfolders from the Cache folder.

Power Query : How to handle "DataSource.NotFound: File or Folder: We couldn't find the folder " error

I'm trying to get the folder contents using the query below and also handles the error. But still I'm getting the text with a warning icon - "DataSource.NotFound: File or Folder: We couldn't find the folder"
See the M-code below:
let
Source = Folder.Files("\\serverpath\Desktop\"),
AlternativeOutput=#table(type table [Name=text,Extension=text,Availability=text], {{"Error", "Error", "Folder not available"}}),
TestForError= try Source,
Output =
if TestForError[HasError] then AlternativeOutput
else Source
in
Output
This is likely a bug, which explains why try...otherwise also doesn't work. The HasError field is returning false even though we get a DataSource.NotFound error. I've filed an item on our end to track this issue.
You need to force evaluation of the Folder.Files at each try / otherwise attempt, using Table.Buffer
= try Table.Buffer(Folder.Files(path1)) otherwise Folder.Files(path2)
you can then evaluate multiple paths, such as the same onedrive account if used on different computers having different login credentials i.e named username on one pc, but user.name on another (e.g personal computer, work computer)
= let SourceA = try Folder.Files("C:\Users\Username\OneDrive\Documents\"),
SourceB = try Folder.Files("C:\Users\User.name\OneDrive\Documents\"),
DynamicSource = try Table.Buffer(SourceA[Value])
otherwise Table.Buffer(SourceB[Value])
in DynamicSource 

DropNet returning metadata for root folder not folder requested

Problem: GetMetaData for the folder that I need returns the root folder metadata.
Background:
I'm trying to write a small app to download a folder that is too large (many thousand files and multiple GB) to download from the Dropbox web interface. It tries to recurse through the subdirectories of the directory given, downloading all the files.
What actually happens is an endless loop. The app (incorrectly) gets the root folder metadata, iterates through the directories until it hits the directory I need and then starts working through the root directory as that is the metadata set that it receives.
The directory name "/Apps" works fine but the one I need doesn't. The folder name has an underscore and a mix of upper and lower case letters (no other characters) similar to "/XYX_DataFolder".
My app has "Full Dropbox" permission and I authorized with the account that the api key was acquired under.
Changing the directory name is not an option for me.
I'm using VS2012 and the DropNet was added through NuGet.
Any input on this issue would be welcome. Thanks!
Edit:
Runtime Version v4.0.30319
Version 1.10.23.0
As reported in the Visual Studio properties page for the reference.
I authorize which works fine and then use the code below. Some directories work fine but when I try to GetMetaData on the folder mentioned above, I get the metadata from the root folder.
private void DownloadDirectory( string serverDirectory, string clientDirectory ) {
var meta = m_client.GetMetaData( serverDirectory, false, false );
foreach ( var item in meta.Contents ) {
var destinationPath = Path.Combine( clientDirectory, item.Name );
if ( item.Is_Dir && item.Path == m_serverRootDirectory ) {
DownloadDirectory( item.Path, destinationPath );
}
else {
//var fileBytes = m_client.GetFile( item.Path );
//File.WriteAllBytes( destinationPath, fileBytes );
//textBox1.Text += Environment.NewLine + destinationPath;
}
}
}
Ok, so I downloaded the source and found my problem right away. I was missing a null for the hash in the GetMetaData call, so it was using the wrong overload. Sorry to waste your time... Thanks for the response!

R Markdown with Shiny Server change host parameter

I am running RStudio on a server and I created a RMarkdown (.Rmd) file. It works fine if I create it as a static HTML but it does not work if I want it to be interactive (by adding runtime:shiny).
The issue is that when I add runtime:shiny and press the Run Document button the application will try to open at 127.0.0.1:xxxx (here xxxx is a random port). In order to make it work I would have to be able to change the host parameter to '0.0.0.0'. This is an option in the runApp function from the shiny package but I don't know how to add this option in RMarkdown.
Can anyone help me with this?
Thank you.
The ::run command from rmarkdown invokes shiny::runApp internally. You can set the option shiny.host before running the document:
options(shiny.host="0.0.0.0")
rmarkdown::run("myfile.Rmd")
You an also pass arbitrary paramters to runApp, so this should work too:
rmarkdown::run("myfile.Rmd", shiny_args=list(host="0.0.0.0"))
Neither of these will work with the Run Document button; that button starts a new R session in which to render the document. To change the shiny.host option in that session, you'll need to add the option to your .Rprofile.
Set the default values you want to initialize in (~/.Rprofile) under user directory
Sys.setenv(TZ = "UTC") # for Timezone
options(shiny.port = 9999)