Can you have custom #info colors? - string

In Julia, I have a project where I have many calculations. Next is a tiny extract of what it could look like:
[ Info: Benders Solving with subtour constraints --- ./Instances/tiny_instance_10.txt ---
[ Info: Spent 0.039s in Benders decomposition
[ Info: Spent 0.035s in Master problem
[ Info: Spent 0.004s in subproblem
Objective : 47.80267061445823
[ Info: 4 Optimality Constraints created
[ Info: 4 Subtour Constraints created
[ Info: MILP Creating Model --- ./Instances/tiny_instance_10.txt ---
I mainly use #info to output data on console. [ Info: is in teal color, which is great and I would like to know if there exists a convenient way to get other colors? That would be better to read given I have many lines with #info to print.
Something like: #info red "MyString"?
I could not find in the Julia documentation.
I believe if it is not easily makeable with #info, I will have to create my own print function?

You could write it yourself
macro myinfo(color, what)
quote
printstyled($what,color=$color)
end
end
And now:

Related

How to create grouped task lists in Markdown?

When creating different task lists in Markdown for Gitlabs templates, Gitlabs consider all the tasks from checklist as an individual count and shows count as total number of tasklist.
Like for below template -
## PR Checklist
Please check if your PR fulfills the following requirements:
- [X] The commit message follows our guidelines:
- [X] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
## PR Type
What kind of change does this PR introduce?
- [X] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [X] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] angular.io application / infrastructure changes
- [ ] Other... Please describe:
## Does this PR introduce a breaking change?
- [ ] Yes
- [X] No
It shows 5 of the 14 tasks completed. Ideally, I only want first three task lists to be considered as a task by Gitlabs and it should show 2 of the 3 tasks completed. Please let me know if there is something in the markdown or Gitlabs by which I can achieve the desired output.
Do not use task list syntax for things for non-tasks.
See the vendor documentation for task lists.
You can use labels to categorize issues with regard to feature vs bug fix, or breaking versus non-breaking change.
As already pointed out, the docs on task lists specify that a "task" will always add to the task counter.
If you want to keep a similar formatting to encourage users to mark which items apply, then you can use parentheses like so:
- ( ) task
The formatting is not as pretty, but it'll work.

Ubuntu 14.04 arbtt-stats index to large error

I've recently installed arbtt which seems to be an intersting, rule based, automatic time tracker. http://arbtt.nomeata.de/#what
I've got it working for the most part, but after 30 minutes or so of gathering stats, I end up with the following error.
Processing data [=>......................................................................................................................................................................................] 1%
arbtt-stats: Prelude.(!!): index too large
Does anyone have any suggestions on ways I can troubleshoot this issue, or better yet, solve it? I have 0 experience with the coding language used to create the rules (Haskell I believe). All I've done to this point is follow the documentation as closely as possible.
This error ultimately renders the tool useless since it doesn't gather data any longer than 30 minutes. To fix it, I have to delete the log and start from scratch. I'm primarily interested in the notion of having a customizable, rule based time tracker but I'm by no means tied to using arbtt.
Based on the comments below, I'm including some more information below.
When I try to run arbtt-recover I get a long list of errors that look like this. All of them seem to be related to an Unsupported TimeLogEntry.
Trying at position 1726098.
Failed to read value at position 1726098:
Unsupported TimeLogEntry version tag 0
As for the configuration file, here is what I have so far.
$idle > 30 ==> tag inactive,
-- A rule that matches on a list of strings
current window $program == ["Chrome", "Firefox"] ==> tag Web,
current window $program == ["skype"] ==> tag Skype,
current window $program == ["jetbrains-phpstorm"] ==> tag PhpStorm,
( current window $title =~ m!Inbox! ||
current window $title =~ m!Outlook! ) ==> tag Emails,
( current window $title =~ m!AdWords! ||
current window $title =~ m!Analytics! ) ==> tag Adwords,
It goes on further, but I'm fairly confident I've followed this same syntax for all other lines. The rest of the lines are following the same format but are project/client specific for me. If required, I'm happy to include the rest of the file.
As discussed in the comments: This is a case of a corrupt ~/.arbtt/capture.log. You can usually fix this by
running arbtt-recover
and then moving ~/.arbtt/capture.log.recovered to ~/.arbtt/capture.log.
The second manual step is required to avoid accidentially deleting too much data. You can test that the recovered file is better by making arbtt-stats using the recovered file by passing --logfile=~/.arbtt/capture.log.recovered to it.
Data corruption happens for example when there is an unclean shutdown, or other undetermined reasons. But the log file format is such that even after a corruption (e.g. a partial write of one sample), further samples will be written correctly and should be picked up by arbtt-recover, so you did not lose more than a few samples.

Change color based on pcolor - NetLogo

I am trying to create a function in NetLogo that will allow me to use clickable "color swatches" to determine the color of a turtle. Here is my code so far:
if mouse-down?
[ ask patch mouse-xcor mouse-ycor
[ if pcolor != 0 mod 10
[ show pcolor
ask turtle whichturtle
[ set color pcolor]
]
]
]
(I have created a drop-down with the global variable which allows the user to select which turtle they would like to change.)
However, when I run this code, the specified turtle changes its color to the color of the patch it's currently standing on, rather than that of the patch the user clicked on.
How would I fix this problem? Any help is much appreciated.
You need to use myself to refer the patch that's asking the turtle to change its color:
ask turtle whichturtle [
set color [pcolor] of myself
]
It can get confusing, sometimes: learning to keep track of the context that you are doing things in is an important part of mastering NetLogo...
One way to avoid getting lost in the different levels of asking is to assign things to local variables at a place in the code execution where you know exactly where you are. In your case, it could have been something like:
if mouse-down? [
ask patch mouse-xcor mouse-ycor [
if pcolor != 0 mod 10 [
let chosen-color pcolor
ask turtle whichturtle [
set color chosen-color
]
]
]
]

What code language is this?

I know, silly question, but I am not a programmer and really need to known...
to look-for-food
if food > 0
[ set color orange + 1
set food food - 1
rt 180
stop ]
if (chemical >= 0.05) and (chemical < 2)
[ uphill-chemical ]
end
Thanks
This language is called LOGO. It's often used with Turtle -- drawing lines on the screen.
Related Anecdote:
My first encounter with a computer was around 1985, in my classroom we had an Apple (Apple ][ probably?). This was one of the main programs that was available. I had learned how to do to in order to define a subroutine. I tried it once, but I couldn't remember the syntax for defining the specifics. And then when I tried to exit the to routine definition context, I couldn't remember how to exit it. The teacher could sense that I was confused, and was coming over to help me. I figured I'd be in trouble for straying beyond the scope of the exercise that I was supposed to be working on, and figured the teacher wouldn't know how to recover either. I panicked and powered off the computer. My first "did you try turning it off and on again?" experience! :)

colorful console output by unix pipe filter

while examining the console output and logging messages of different software it is sometimes difficult to keep the overview. It would be much easier to make the output colorful and highlight the text phrases which are currently important.
Is there a program for Linux/UNIX shell which could be used as a filter by utilizing unix pipes to make the console output colorful according to predefined patterns and colors?
p.ex.
pattern definition:
INFO=green
WARN=yellow
ERROR=red
\d+=lightgreen
to highlight the severity of the message and also numbers.
usage:
$ chatty_software | color_filter
11:41:21.000 [green:INFO] runtime.busevents - SensorA state updated to [lightgreen:17]
11:41:21.004 [green:INFO] runtime.busevents - SensorB state updated to [lightgreen:20]
original output:
11:41:21.000 INFO runtime.busevents - SensorA state updated to 17
11:41:21.004 INFO runtime.busevents - SensorB state updated to 20
we use a sed script along these lines:
s/.* error .*/^[[31m&^[[0m/
t done
s/.* warning .*/^[[33m&^[[0m/
t done
:done
and invoke it by
sed -f log_color.sed
I guess you could do something similar?

Resources