Key mapping for putty or putty alternative - telnet

at my work we're trying to find a replacement for an old telnet client that we use to connect to an SCO Unix server running an old program. I have found that I can almost get putty to do everything required - setting it to SCO function keys lets me use the F1 to F12 correctly and setting the translation character set to CP437 draws all the lines correctly.
The problem is that the program we use on the server pretty much requires the use of custom key mapping. That is we need to be able to map the home key to ";$", the end key to "exit^M", the F-10 key to ";}" etc. Putty doesn't allow custom mapping. We've tried to edit the source code of putty to change its behaviour, but had no luck.
Does anyone know if there is a modified version of putty somewhere that allows key binding? Or another free terminal program that does? Or instructions for what to change in the putty source code? If we can't find a solution we're probably going to end up buying ZOC, but we'd rather not if we can find an open alternative.
Thanks a lot,
Alex

Never mind, in the end we were able to modify the Putty source code as required to add the custom keys.

Related

Emacs SSH - Enforce read-only

Is there any possibility to connect to an SSH server using /ssh:user#server with read-only access, even if the account has write access? I need this to prevent accidental write.
Here is the function I use to connect:
(defun connect-b2b ()
(interactive)
(find-file-other-window "/ssh:user#server:/")
buffer-read-only)
(global-set-key (kbd "C-c C-d") 'connect-b2b)
Note that buffer-read-only does not help, neither does vc-toggle-read-only.
Update: Just to be clear what I want to achieve, I have an account with read+write access, however since this is a business critical server I wanted to prevent accidental changes. Unfortunately I cant change permissions on the user account itself, therefore I wanted to enforce this locally.
Third suggestion: Use sshfs to provide the remote filesystem locally, and mount it read-only, and then point Emacs at that.
That way you're not subject to all of the pitfalls of being able to run commands directly on the remote server as a user who has write-permissions.
If I've interpreted the question rightly, directory-local variables are a potential workaround. This would be overridden if there were dir-local configs nearer to the path in question, however, so YMMV.
(dir-locals-set-class-variables
'read-only
'((nil . ((buffer-read-only . t)))))
(dir-locals-set-directory-class "/ssh:user#server:/" 'read-only)
I'm still able to for example touch a file in the specified directory.
That's got nothing to do with Emacs. You're asking for Emacs to employ OS-level access controls, which it can't do, because it's not the OS. In your case it's not even running on the same machine.
You need to create a new user with more limited access, and connect as that user instead.

Where to find a thorough list of node_redis commands?

I'm using redis to store the userId as a key and the socketId as the value. What's more important is that the userId doesn't change, but the socketId constantly changes. So I want to edit the socketId value inside redis, but I'm not sure what node_redis command to use. I'm currently just editing by using .set(userId, mostRecentSocketId).
In addition, I haven't found a good node_redis API anywhere with a complete list of commands. I briefly looked at the redis-commands package, but it still doesn't seem to have a full list of complete commands.
Any help is appreciated; thanks in advance :)
The full list of Redis commands can be found at https://redis.io/commands. After finding a proper command it wouldn't be hard to find how is it proxied in binding ("api") you use.
Upd. To make it clear: you have Redis Server, its commands are listed at the doc I provided. Then you have redis-commands - it's a library for working with redis (I called it a "binding"). My point was that redis-commands may have not all the commands that redis-server can handle, and also the names of some commands can differ a bit. Some other bindings can offer slightly different set of commands. So it's better to examine the list of commands that Redis Server handles, and then select a binding that allowes calling that command (I guess all the bindings have set method)

Process.Start does not always work

I created a protocol generation tool that reads some data from a websource, allows the user to filter some of the fields an generate a protocol based on given filterdata. The protocol is generated as a word document that is edited multiple times, on multiple layers, before shown to the user.
For some users the line:
Process.Start(pathtowordfile)
does not open Word, for others it works fine.
Even more strange: if the useres try to generate the protocol the first time it opens. if they change one of the filters and generate again, the file does not open. But it is generated correctly, you are able to open it manually.
We are using Windows 7 on all machines and, in general, the User has no administrativ privileges on the machine.
Are there any alternatives to
Process.Start()
?
Not sure how the code can sometimes work, but the critical bit I think would be to make sure you set UseShellExecute=true when you are trying to Process.Start a file that is not an executable.
https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.useshellexecute%28v=vs.110%29.aspx
I haven't looked into it in quite awhile, but last I checked shell execute relies on the Word application to be properly registered with DDE so Windows knows what to do with a .doc(x) file. Word may not be installed "properly".
after trying varios things, including Wonko's hint, I dicided to use the interop.Word.Wordapplication to display the document. It doesn't explain why process.start not does the job but anyway, now everybody of the users is happy^^

Access vi history

I just accidentally pasted a $200 SSL certificate in the private key file and saved in vi. The private key is now lost. I know I yanked the existing data before replacing it and saving. Is it possible to retrieve this data somehow? I think no, but I figured I'd ask.
If you haven't quit vi, you can just 'p'.. no?
If your vi session is still running, and you haven't written your file yet, just do [esc]:q! and you should be back to your original file.
Or just hit p to paste the stuff you yanked previously.
You might have an id.rsa~ file hanging around. If so, that is your backup file.
It sounds like you've already written your file, so you are probably out of luck. Can you generate a new keypair and ask your cert vendor to re-issue the cert?
In the future, you might want to look into setting the backup option in vim. This used to be a default setting in Linux distributions back in the day, but it definitely isn't the default on my mac now.
If you yanked the data before you overwrote it, it probably should still be accessible using registers (:help registers):
:registers
will show you the contents of all registers.
If you find the lost text, it can be yanked by using the number displayed at the beginning of the line, e.g. by issuing "3p in normal mode.
UPDATE: The question was about vi, not vim, right? Then the command registers might not exist; I think the yank registers 0-9 are a vim extension.
I don't suppose you have backups set do you (doc)? If not, can't you do u?

Stop Linq2SQL using Named Pipes?

I have a nice little Linq2SQL project however when deployed the database is on another server. I keep getting a named pipe error that the remote server doesn't exist - yet it does, it has Named Pipes enabled (protocol + surface) SQL 2005. TCP connections work fine.
I've tried setting the library in the connection string to a TCP one, I tried forcing TCP in the server name however Linq is always and only using Named Pipes and just won't work.
Any idea how to force Linq2SQL to use TCP/IP only, if possible?
thanks
My guess is that you are not setting the connection string to None on the DBML designer file which is creating the typed data context for you. Set the connection string to None (make sure nothing on the designer is selected) and then pass in the connection string manually, to assure that you have complete control over it.
As noted in the comments, you can't set the connection string to none.
In this case, there is still an overload of the typed DataContext which takes a connection string as a parameter. I would recommend using a hard-coded one first to see if it works. If it does, then you know it is the resolution of the item from the config file. Otherwise, you know to look at the connection string itself.
Also, if it is a problem with resolution in the config file, I usually place this in my connection string section FIRST to clear entries from the machine.config file:
<clear />
How about changing the protocol order in the SQLConfiguration manager or using the command tool, cliconfig on the client and changing it there.
I've seen this happen when (any of these):
The SQL client version isn't the one you expect
Windows Authentication is being used, often unintentionally
The connection information you provide doesn't match with the server's own name. (That is, select ##server_name doesn't return the same as the NETBIOS name. Fix using sp_dropserver and sp_addserver)
Sometimes reinstalling MDAC on the client machine helps, apparently because the driver looked like it was there but wasn't fully working.
Hope this helps...