How to change redis source code? - redis

I am making changes in the redis source code so that everytime the user sets a key, instead of printing "OK" it prints something else.
But this change is not getting reflected.
I also tried uninstalling redis, modifying the redis source code and then installing it again. But still it doesnt work.
Does it need to be compiled or something?

https://www.heychinaski.com/blog/2013/10/14/a-look-at-the-redis-source-code/comment-page-1/ This should help you change redis code. Here there is an excellent example given. They have added a new command "rand" to redis command set.
I'll summarize the steps to add a command in redis :
In redisCommandTable, you need to add the specifications of the new command- the command name, its args etc.
Then you need to define a prototype of the function that will be called when this command is executed in src/redis.h
Define the function in src/redis.c.
Give 'make' to compile.

Related

nuget command Source Add started to fail out of nowhere with a warning asking for a unique source

I have an c# wpf application and an additional installer project to create an installer of the application. Among many other files, the installer project has a installer.cmd file (I took over it from someone else) and a Product.wxs file. I was able to create an installer by running msbuild tools\installer.cmd /P:Library=net461 /P:Platform=x64 command on the developper comand prompt.
I was trying to create a desktop shortcut in all user's desktops and was playing with *.wxs file for that. I know you guys will roast me because of the following sentence but I don't know what else can I say. Something I did break something and somehow the msbuild starts to give error. I cannot say what I did because I tried many different things.. I went back to original project but it didn't help. So what is done is done. I will talk about the error now.
The error itself doesn't tell much:
C:\workspace\QToolInstaller\tools\installer.cmd(117,5): error MSB3073: The command "nuget Source Add -Name PkgSrc_638107674121812897 -Source C:\workspace\QToolInstaller\exports" exited with code 1.
I checked online to understand this error code but there wasn't much. However there is another line just before this erorr line:
The source specified has already been added to the list of available package sources. Provide a unique source.
Well, this wasn't in usual warning color or marked as a warning. But I think it is worth to investigate.
So the "source" mentioned here is PkgSrc_638107674121812897. I scanned the installer.cmd to see where is this coming form and saw that this file is named by using time ticks as:
<LocalSource>PkgSrc_$([System.DateTime]::UtcNow.Ticks)</LocalSource>
Although I ran the msbuild command multiple times, the name of the source is always different. I ran the command in diagnostic mode by using -verbosity:diag option. And I checked the file name among all the logs. There is no match. I tried to change the name to something ridicolous that cannot be listed anywhere but got the same error. Removed alll the files, created them again, restarted the PC etc. Nothing have changed. This name is really unique and but still I am getting this message. I wish I had logs form previous successfull runs. I cannot tell if this is the cause of the failure or not. Does any of these ring any bell fellas?
It is solved! Luckily a colleague of mine have faced with this before. I hope no one will have to deal with this problem again.
So apparently there is a bug(?). Altought that name is unique it thinks the opposite. When I do list the sources with thw followng command
nuget source
among the one that should be there, there is one extra line as PkgSrc_638107643440982987. Although my installer.cmd suppose to remove the source every time after it is done, it didn't for once. And although the new source is named differently, it doesn't care and gives that non-warning, non-error message followed by a meaningless error code 1 message. How to solve it?
We tried to remove the source by command prompt like this:
nuget source delete -Name PkgSrc_638107643440982987
But it is not deleted. So we went to the Visual Studio->Tools->NuGet Package Manager->Package Manager Settings->Package Sources. Found the guilty source and remove it. And then it is resolved.

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)

How allow only one python code process to run if same is executed at the same time

if I have two or more running python console applications at the same time of same application, but executed several times by hand or any other way.
Is there any method from python code itself to stop all extra processes, close console window and keep running only one
The solution I would use would be to have a lockfile created in the tmp directory.
The first instance would start, check for the existence of the file, create the file since it is not there, then run; the following instances will start, check for the existence of the file, then quit since it's there. The original instance would remove the lockfile as its last instruction. NOTE: If the app runs into an error and does not execute the instruction to remove the lockfile, you would need to manually remove it else the app will always see the file.
I've seen on other threads that some suggest using the ps command and look for your app's name, which would work; however, if your app will ever run on Windows, you would need to use tasklist.

How do you create persistant IntelliJ variables in run configurations in IntelliJ?

I'm using IntelliJ 15.0.3.
Update: Have also tried updating to 2016.2.4, but the issue persists.
By creating variables under Settings -> Appearence and Behaviour -> Path Variables, these can be used in a run configuration with $VARIABLE_NAME$ to indicate for example what working directory or program arguments should be used by that run configuration. This is useful if for example the same directory is used in many parts of the run configuration but is changed from run to run.
However when using $VARIABLE_NAME$ in a run configuration it doesn't seem to be persistant. If I close my IntelliJ session the value of the variable will replace the variable reference. So for example if I have the variable:
FILENAME = somefile.csv
and in my run configuration I put "$FILENAME$" under program arguments, this will only be persistant for that session. When I close and reopen IntelliJ the program argument has been set to "somefile.csv" instead of retaining the reference "$FILENAME$".
How do I ensure that the variable reference is retained over several sessions?
Edit: Added screenshots showing before and after session reset.
Before a session reset I set my program arguments to reference my FILENAME variable. This also happens if I try to for example use the working directory field instead of the program arguments field.
After restarting IntelliJ the run configuration no longer references FILENAME.
I can't reproduce the issue in v2016.2.4 (i.e. I still get the replacement value after a restart). You may want to upgrade to v15.0.6 which is the latest v15.x available and see if that resolves the issue.
The values you set are simply stored in the file .IntelliJIdea\config\options\path.macros.xml (see Directories used by the IDE to store settings, caches, plugins and logs for info on where the configs directory is located.) So you can take a look at that file and see what's going on. Maybe try adding it outside IDEA (when IDEA is closed) and see if it holds (in the event a bug is causing the that file to not save properly after editing via the IDE.)

Mono Migration Analyzer: What are all of the command line switches?

So I'm looking here and I see the command line switches. http://mono-project.com/Command_Line_MoMA
This is what I see as the total amount of switches from the site:
MoMA.exe --nogui --out C:\app\momareport\report.html C:\app\myapp.exe
One thing I see is the submit.xml going to a place I don't want during my automated build. Since it is a generated file, I want to change where it goes. Is there a switch for that?
Also, what are all of the switches for it?
If there is not a switch for moving the submit.xml to a reporting location, please consider it for future versions.
EDIT: The argument --help does not work. I tried that and a host of others to try to get some dialog from MoMA on the command line. I'm on Windows to help alleviate any confusion.
Those are the only command line switches supported by MoMA. You can see the code here.
"MoMA.exe --help" does not work because MoMA is compiled as a winforms application so that the command window is not shown. As a result, MoMA disconnects from the command window, and therefore things like Console.WriteLine will not work.
To answer your actual question, there is currently not a way to change where the .xml file gets put.
You might want to try:
MoMA.exe --help
On Linux, there should also be a manpage.
If you can't find the feature, and want to submit it to Mono, you'll want to go via the Bugzilla page.