Is there a way to color console.log messages in WebStorm like dev tools? - intellij-idea

Is there a way to color console.log messages in WebStorm like dev tools?
see image

Yes. You could do something like:
console.log('\x1b[36m%s\x1b[0m', 'I am cyan'); //cyan
%s is where in the string gets injected.
Colors reference
Reset = "\x1b[0m"
Bright = "\x1b[1m"
Dim = "\x1b[2m"
Underscore = "\x1b[4m"
Blink = "\x1b[5m"
Reverse = "\x1b[7m"
Hidden = "\x1b[8m"
FgBlack = "\x1b[30m"
FgRed = "\x1b[31m"
FgGreen = "\x1b[32m"
FgYellow = "\x1b[33m"
FgBlue = "\x1b[34m"
FgMagenta = "\x1b[35m"
FgCyan = "\x1b[36m"
FgWhite = "\x1b[37m"
BgBlack = "\x1b[40m"
BgRed = "\x1b[41m"
BgGreen = "\x1b[42m"
BgYellow = "\x1b[43m"
BgBlue = "\x1b[44m"
BgMagenta = "\x1b[45m"
BgCyan = "\x1b[46m"
BgWhite = "\x1b[47m"
Details: https://stackoverflow.com/a/41407246/2589276

No, it's not possible; styling console output is not supported. Please vote for WEB-12349 to be notified on any progress

worked for me like this:
var red = ['color: red'].join(';');
and to output:
console.log("%c I'm RED!",red)
EDIT: Works for me only in Chrome and Firefox

Related

Requested module experienced an error while loading - Server - Data:11

Yeah So, I'm coding a Roblox game and this script gets an error every time, I even restarted roblox studio to try fixing it but it didn't work and I tried messing around with the code but I couldn't figure it out, can someone please help?
Script:
local PetModule = require(ServerModules.PetModule)
Module Code:
local module = {}
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Pet = ReplicatedStorage.Pet
function module.EquipPet(Player, PetName)
local PetModel = Pet:FindFirstChild(PetName)
if PetModel then
PetModel = PetModel:Clone()
PetModel.Parent = workspace.Pet:FindFirstChild((Player.Name))
if Player then
local Character = Player.Character
if Character then
if not Character.HumanoidRootPart:FindFirstChild("PetAttachments") then
local PetAttachments = Instance.new("Folder")
PetAttachments.Name = "PetAttachments"
PetAttachments.Parent = Character.HumanoidRootPart
local PetAttachments = Character.HumanoidRootPart:FindFirstChild("PetAttachments")
if PetAttachments then
local att0 = Instance.new("Attachment")
att0.Name = "Attachment1"
att0.Position = PetModel:FindFirstChild("AttachmentPosition").Value
att0.Parent =Character.HumanoidRootPart
local att1 = Instance.New("Attachment")
att1.Name = "Attachment2"
att1.Parent = PetModel.PrimaryPart
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Attachment0 = att0
AlignPosition.Attachment1 = att1
AlignPosition.RigidityEnabled = false
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness.Value
AlignPosition.Parent = PetModel.PrimaryPart
local AlignOrientation = Instance.new("AlignOrientation")
AlignOrientation.Attachment0 = att0
AlignOrientation.Attachment1 = att1
AlignOrientation.RigidityEnabled = false
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignOrientation.Responsiveness = PetModel.Responsiveness.Value
AlignOrientation.Parent = PetModel.PrimaryPart
game:GetService("RunService").Heartbeat:Connect(function()
att0.Position = PetModel.AttachmentPosition.Value
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness
end)
end
end
end
end
end
function module.UnequipPet(Player)
end
function module.UnequipAllPet(Player)
end
return module
end
If anyone could help me fix this it would be great.
make sure to put "return module" at the end!
return module
is within the function. Try to put it free at the end of the code and...
I'm not sure, but I think it's because you're creating an event connection within module, I had this problem right now. I just stopped creating events within the Module and the problem stopped.
Try removing this from de Code.
game:GetService("RunService").Heartbeat:Connect(function()
att0.Position = PetModel.AttachmentPosition.Value
AlignPosition.MaxForce = PetModel.MaxForce.Value
AlignOrientation.MaxTorque = PetModel.MaxForce.Value
AlignPosition.Responsiveness = PetModel.Responsiveness
end)

Changes in lua language cause error in ai script

When I run script in game, I got an error message like this:
.\AI\haick.lua:104: bad argument #1 to 'find' (string expected, got nill)
local haick = {}
haick.type = type
haick.tostring = tostring
haick.require = require
haick.error = error
haick.getmetatable = getmetatable
haick.setmetatable = setmetatable
haick.ipairs = ipairs
haick.rawset = rawset
haick.pcall = pcall
haick.len = string.len
haick.sub = string.sub
haick.find = string.find
haick.seed = math.randomseed
haick.max = math.max
haick.abs = math.abs
haick.open = io.open
haick.rename = os.rename
haick.remove = os.remove
haick.date = os.date
haick.exit = os.exit
haick.time = GetTick
haick.actors = GetActors
haick.var = GetV
--> General > Seeding Random:
haick.seed(haick.time())
--> General > Finding Script Location:
local scriptLocation = haick.sub(_REQUIREDNAME, 1, haick.find(_REQUIREDNAME,'/[^\/:*?"<>|]+$'))
Last line (104 in file) causes error and I don`t know how to fix it.
There are links to .lua files below:
https://drive.google.com/file/d/1F90v-h4VjDb0rZUCUETY9684PPGw7IVG/view?usp=sharing
https://drive.google.com/file/d/1fi_wmM3rg7Ov33yM1uo7F_7b-bMPI-Ye/view?usp=sharing
Help, pls!
When you use a function in Lua, you are expected to pass valid arguments for the function.
To use a variable, you must first define it, _REQUIREDNAME in this case is not available, haick.lua file is incomplete. The fault is of the author of the file.
Lua has a very useful reference you can use if you need help, see here

How do you configure UDPInput to work with heka-flood udp test

I am trying to test sending data to heka's UDPInput with no success. I decided to try to use the heka-flood tool to mimic UPD traffic also with no success. I am using 0.10 version of heka. My heka.toml :
[UdpInput]
address = "127.0.0.1:4880"
net = "udp"
splitter = "udp_splitter"
decoder = "ProtobufDecoder"
set_hostname = true
# I have also tried not setting this as well
[udp_splitter]
type = "HekaFramingSplitter"
[ProtobufDecoder]
[LogOutput]
type = "LogOutput"
message_matcher = "Logger == 'UdpInput'"
encoder = "PayloadEncoder"
and my flood.toml:
[udp_proto]
ip_address = "127.0.0.1:4880"
sender = "udp"
pprof_file = ""
encoder = "protobuf"
num_messages = 1000
corrupt_percentage = 0.0001
signed_percentage = 0.00011
variable_size_messages = false
ascii_only = true
max_message_size = 32000
If I add another input, like say a log tailer and add it to the message matcher for the LogOutput, those messages end up being logged out. I never see anything from the UpdInput. What am I doing wrong?

VB.Net Image is not Showing at Runtime

Button image and icon is not showing at runtime
Button Image
Me.wibtnAdd.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.wibtnAdd.DisabledImagesGrayScale = False
Me.wibtnAdd.Enabled = False
Me.wibtnAdd.Image = CType(resources.GetObject("wibtnAdd.Image"), System.Drawing.Image)
Me.wibtnAdd.ImageFixedSize = New System.Drawing.Size(24, 24)
Me.wibtnAdd.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.wibtnAdd.Location = New System.Drawing.Point(53, 302)
Me.wibtnAdd.Name = "wibtnAdd"
Me.wibtnAdd.Shape = New DevComponents.DotNetBar.RoundRectangleShapeDescriptor(2)
Me.wibtnAdd.Size = New System.Drawing.Size(61, 52)
Me.wibtnAdd.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.wibtnAdd.TabIndex = 8
Me.wibtnAdd.Text = "Add"
Form Icon
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
to make your code more clear : 1) get rid of the 'Me'
2) use a 'With' clause
(i edited)
the issue seems to be in your access to resources : are you sure
you have a resource named "wibtnAdd.Image" ? it seems 'strange'
that it has same name as your object/property... Check your
wibtnAdd.Image, it might be Nothing. Same for your Icon.
Btw why not doing this in xaml ?? it would be much more readable,
and you can edit everything while seeing results.

How to get an outline view in sublime texteditor?

How do I get an outline view in sublime text editor for Windows?
The minimap is helpful but I miss a traditional outline (a klickable list of all the functions in my code in the order they appear for quick navigation and orientation)
Maybe there is a plugin, addon or similar? It would also be nice if you can shortly name which steps are neccesary to make it work.
There is a duplicate of this question on the sublime text forums.
Hit CTRL+R, or CMD+R for Mac, for the function list. This works in Sublime Text 1.3 or above.
A plugin named Outline is available in package control, try it!
https://packagecontrol.io/packages/Outline
Note: it does not work in multi rows/columns mode.
For multiple rows/columns work use this fork:
https://github.com/vlad-wonderkidstudio/SublimeOutline
I use the fold all action. It will minimize everything to the declaration, I can see all the methods/functions, and then expand the one I'm interested in.
I briefly look at SublimeText 3 api and view.find_by_selector(selector) seems to be able to return a list of regions.
So I guess that a plugin that would display the outline/structure of your file is possible.
A plugin that would display something like this:
Note: the function name display plugin could be used as an inspiration to extract the class/methods names or ClassHierarchy to extract the outline structure
If you want to be able to printout or save the outline the ctr / command + r is not very useful.
One can do a simple find all on the following grep ^[^\n]*function[^{]+{ or some variant of it to suit the language and situation you are working in.
Once you do the find all you can copy and paste the result to a new document and depending on the number of functions should not take long to tidy up.
The answer is far from perfect, particularly for cases when the comments have the word function (or it's equivalent) in them, but I do think it's a helpful answer.
With a very quick edit this is the result I got on what I'm working on now.
PathMaker.prototype.start = PathMaker.prototype.initiate = function(point){};
PathMaker.prototype.path = function(thePath){};
PathMaker.prototype.add = function(point){};
PathMaker.prototype.addPath = function(path){};
PathMaker.prototype.go = function(distance, angle){};
PathMaker.prototype.goE = function(distance, angle){};
PathMaker.prototype.turn = function(angle, distance){};
PathMaker.prototype.continue = function(distance, a){};
PathMaker.prototype.curve = function(angle, radiusX, radiusY){};
PathMaker.prototype.up = PathMaker.prototype.north = function(distance){};
PathMaker.prototype.down = PathMaker.prototype.south = function(distance){};
PathMaker.prototype.east = function(distance){};
PathMaker.prototype.west = function(distance){};
PathMaker.prototype.getAngle = function(point){};
PathMaker.prototype.toBezierPoints = function(PathMakerPoints, toSource){};
PathMaker.prototype.extremities = function(points){};
PathMaker.prototype.bounds = function(path){};
PathMaker.prototype.tangent = function(t, points){};
PathMaker.prototype.roundErrors = function(n, acurracy){};
PathMaker.prototype.bezierTangent = function(path, t){};
PathMaker.prototype.splitBezier = function(points, t){};
PathMaker.prototype.arc = function(start, end){};
PathMaker.prototype.getKappa = function(angle, start){};
PathMaker.prototype.circle = function(radius, start, end, x, y, reverse){};
PathMaker.prototype.ellipse = function(radiusX, radiusY, start, end, x, y , reverse/*, anchorPoint, reverse*/ ){};
PathMaker.prototype.rotateArc = function(path /*array*/ , angle){};
PathMaker.prototype.rotatePoint = function(point, origin, r){};
PathMaker.prototype.roundErrors = function(n, acurracy){};
PathMaker.prototype.rotate = function(path /*object or array*/ , R){};
PathMaker.prototype.moveTo = function(path /*object or array*/ , x, y){};
PathMaker.prototype.scale = function(path, x, y /* number X scale i.e. 1.2 for 120% */ ){};
PathMaker.prototype.reverse = function(path){};
PathMaker.prototype.pathItemPath = function(pathItem, toSource){};
PathMaker.prototype.merge = function(path){};
PathMaker.prototype.draw = function(item, properties){};