CMake definition redefinition works only if greater - cmake

I have a serious issue with a CMake project where I try to redefine a build number variable locally for a unit test, but it just failed once the real build number increased above the hardcoded one of my test.
After some testing, I am absolutely horrified to find that if I do:
set(MY_BUILD_NUMBER "3111")
add_definitions(-DMY_BUILD_NUMBER=${MY_BUILD_NUMBER})
...and later for my test I redefine it to a hardcoded value
add_definitions(-DMY_BUILD_NUMBER=3118)
The MY_BUILD_NUMBER in my test is 3111, which is logical.
But if I do:
set(MY_BUILD_NUMBER "3120")
add_definitions(-DMY_BUILD_NUMBER=${MY_BUILD_NUMBER})
...and later for my test I redefine it to a hardcoded value
add_definitions(-DMY_BUILD_NUMBER=3118)
The MY_BUILD_NUMBER in the code is 3120 and not 3118 anymore.
I could not find any documentation about this. Does anyone know what can cause such a unexpected behavior of CMake, or if it's just one more bug that to report...
Thanks !

Related

I keep getting an error from the vue compiler that ive neveer seen before

it seems to be one of my dependancies but i have no clue whats going on here and i cant find anything on the internet.
(i clearly need to know more about webpack)
any help is muchly appreciated
weirdly enough this only started happening when i cloned my repo on my work pc, i hadnt even made any changes
this is the error im getting from my console
95% emitting
WARNING Compiled with 3 warnings 2:06:09 PM
warning in C:/Users/1/Documents/GitHub/GFS/client/node_modules/webpack/buildin/global.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* C:\Users\1\Documents\GitHub\GFS\client\node_modules\webpack\buildin\global.js
Used by 2 module(s), i. e.
C:\Users\1\Documents\GitHub\GFS\client\node_modules\node-libs-browser\node_modules\punycode\punycode.js
* C:\Users\1\documents\github\gfs\client\node_modules\webpack\buildin\global.js
Used by 2 module(s), i. e.
C:\Users\1\documents\github\gfs\client\node_modules\vue\dist\vue.esm.js
warning in C:/Users/1/Documents/GitHub/GFS/client/node_modules/webpack/hot/emitter.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* C:\Users\1\Documents\GitHub\GFS\client\node_modules\webpack\hot\emitter.js
Used by 1 module(s), i. e.
C:\Users\1\Documents\GitHub\GFS\client\node_modules\webpack-dev-server\client\index.js?http://localhost:8082
* C:\Users\1\documents\github\gfs\client\node_modules\webpack\hot\emitter.js
Used by 1 module(s), i. e.
C:\Users\1\documents\github\gfs\client\node_modules\webpack\hot\dev-server.js
warning in C:/Users/1/Documents/GitHub/GFS/client/node_modules/webpack/hot/log.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* C:\Users\1\Documents\GitHub\GFS\client\node_modules\webpack\hot\log.js
Used by 1 module(s), i. e.
C:\Users\1\Documents\GitHub\GFS\client\node_modules\webpack\hot nonrecursive /^\.\/log$/
* C:\Users\1\documents\github\gfs\client\node_modules\webpack\hot\log.js
Used by 2 module(s), i. e.
C:\Users\1\documents\github\gfs\client\node_modules\webpack\hot\dev-server.js
as it turns out, all i had to do was re navigate to the project dir from my terminal and i had to make sure i was using the correct capitlization there
(git bash sucks)
i used ../Documents/github... insteda of ../documents/github...
thank you internet.
yall have a great day and thanks for the help

Find unused cases of an enum (Objective-C / Swift)

We’ve just migrated a couple of thousand localised strings in an iOS project from an old struct to an enum. We’d now like to find any which are unused.
I’m looking for a way to find any cases of an enum which are not used anywhere within my project, short of searching the project for them one by one.
We have the strings in Objective-C and Swift versions, so either will work.
Any ideas?
About your only option is to comment out each enum value and see which ones result in an error. The ones that don't aren't being used.
If you have a lot of enum values, comment them out in batches of 10 or 15. Do a compile. Scan the errors and uncomment out the values reported in an error. This leaves the unused enum values commented out.
There is a way to automate this, recently I was asked to search for unused endpoints in a large project, to make this semi-automatic:
1- run this grep command, to search for used endpoints
grep -r --include='*.swift' "EndpointEnum"
2- use a text editor (I used sublime), to sort, make unique and save into used.txt
3- add all the enum values in all.txt
4- diff between the two files, and keep the lines starting with a "-"
this will give you the unused enum values.

Grunt LESS force compile on error

I was wondering if it's possible to force grunt to compile LESS even if there is an error?
The reason I ask is I'm outputting settings from the interface (Moodle) into less so that they can be changed by users. When I try to see a colour or do some math it throws errors because it's either expecting an RGBA value or a number value.
An example of the syntax would be:
div{background-color: rgba(0,0,0,~"[[setting:blockboxshadowalpha]]");}
This works fine if I put it directly into the compiled CSS but fails when using the rgba() function or doing something like the following:
a:hover{color: darken(~"[[setting:linkcolor]]", 20%);}

Datatree MUMPS -- resolve undefined variables to null/empty string?

I'm trying to port some scripts from a modern version of Intersystems Cache back to 1980s Datatree MUMPS. It was written in the context where $ZUTIL(18,2) was set. That is, undefined variables resolve to an empty string, rather than throwing an "undefined variable" error.
Rather than refactor it all to check $DATA, does anyone know whether DTM supports a similar feature to automatically resolve undefined variables per process, or globally?
*Update: running "zzswitch +2" did the trick.
That was tricky one.
Have a look at this document:
ftp://ftp.intersystems.com/pub/cache/DTMtoCache.doc95
It says that equivalent of $ZU(18) in DTM was zzswitch +2 / -2
I obviously can't run DTM now so just try to issue zzswitch +2 and then zzswitch -2 and see how does it affect the way your undefined vars are treated.
PS: I would understand efforts of migrating from DTM to Cache, but going back? Mate it's not even necromancy, it's archeology now.

Linux Kernel Process Management

First, i admit all the things i will ask are about our homework but i assure you i am not asking without struggling at least two hours.
Description: We are supposed to add a field called max_cpu_percent to task_struct data type and manipulate process scheduling algorithm so that processes can not use an higher percentage of the cpu.
for example if i set max_cpu_percent field as 20 for the process firefox, firefox will not be able to use more than 20% of the cpu.
We wrote a system call to set max_cpu_percent field. Now we need to see if the system call works or not but we could not get the value of the max_cpu_percent field from a user-spaced program.
Can we do this? and how?
We tried proc/pid/ etc can we get the value using this util?
By the way, We may add additional questions here if we could not get rid of something else
Thanks All
Solution:
The reason was we did not modify the code block writing the output to the proc queries.
There are some methods in array.c file (fs/proc/array.c) we modified the function so that also print the newly added fields value. kernel is now compiling we'll see the result after about an hour =)
It Worked...
(If you simply extended getrlimit/setrlimit, then you'd be done by now…)
There's already a mechanism where similar parts of task_struct are exposed: /proc/$PID/stat (and /proc/$PID/$TID/stat). Look for functions proc_tgid_stat and proc_tid_stat. You can add new fields to the ends of these files.