Just out of curiosity, can console.log() send a console command? - console

Can console.log() send an executable command to the Console? Such as, console.log('pwd')? Or is there some other method for sending Console commands from the webpage?
FYI: This is not an XY problem. I am just curious.

No it is not possible. If it would be possible, the website could run actual programs on your computer which would be a huge security issue.

Related

When does System.out not appear in the Java console?

I understood that anything to standard out (System.out) would appear in the Java Console window (when it's enabled). I spotted somewhere though that there might be situations where this isn't try, for example, from Swing apps. Is that the case?
Basically, what situations or setups wouldn't I expect to see standard output in the console? Is there a difference in behavior running on the JDK rather than explicitly on the JRE for example? javaw.exe?
ps, I understand how to display the Console in the Java settings but I'm curious as I've managed to create an application, run as an executable jar, that doesn't start the console despite some calls to System.out) on Windows 7.
The only way you wouldn't see System.out output in the console is if the method System.setOut has been invoked. This method is invoked to redirect output to the graphical Java Console, but I don't know of any other realistic circumstance in which it would be redirected away from the Java Console unless you do so voluntarily.
Depending on terminal settings it can happen that the output is not written until a newline character is sent as well. So if you do System.out.print("test") it might not appear immediately.
On Windows this is usually not the case, but on Unix terminals this is quite common.
Perhaps you use javaw to start virtual machine, this version will not show console messages. You can use java to start the virtual machine, which will show the console message.
javaw is intended for apps with windows, java is intended for console apps.
Same thing happened to me. I could not get System.out.println or Logger.debug either on console.
If you are on a huge project in Eclipse or whatever, you can read below.
Solution: I realized that I had not committed jars and some java files to SubVersioN on network. thats all. Project had not been compiled.
One situation I can think of is to invoke System.setOut(null) (orSystem.setOut(any OutputStream other than System.out or System.err)) then the console, if exists, would show nothing.

pyinstaller program not working if built without console

I have a small app that I'm trying to build against windows machines. The program creates an OpenVPN connection. If I build the program and run it it first opens a console as the program output. If I pass the -w parameter to pyinstaller to not build it with a console attached the program fails to run at all. It opens allright but the vpn connection is never created.
With the console everything works perfect.
I also have a basic logging for the application in place to see where my code might stop and nothing gets written. With console on my program spits out all kinds of logs.
I just don't know why my program could be performing perfectly with a console but doing nothing without one. Any ideas?
Gonna answer this myself. Make sure you don't print anything and also you redirect all stdout to a logger, file or whatever else instead of the console.
I was having a similar problem, but couldn't find any print/stdout statements going to console. I was using subprocess.Popen and redirecting stdout=subprocess.PIPE. I subsequently added stderr=subprocess.STDOUT and stdin=subprocess.PIPE and my program worked. This page (Python subprocess.call() fails when using pythonw.exe) on subprocess failures helped me get it working.

iMacros-like program that can run from the command line to automate browser actions?

Here's what I would like to do:
Cron execute an iMacro (or iMacro-like) script on a headless unix server - essentially doing my browser interactions for me.
Is this possible?
I'm sure cURL won't be able to traverse the DOM and trigger user events. iMacros would be perfect if I could run it in unix CLI, which you can, but I run a headless server without Xorg and obviously FF requires Xorg. iMacro with Lynx would be good but I doubt iMacro works with Lynx.
Anyone got any ideas?
Old question, but I was looking for about the same thing, and I found this post on Google. Here the answser :
There is some headless browser which can run on an Unix system without Xorg. You can try CasperJS, PhantomJS or Zombie by example.

log4net with asp.net mvc - can't watch file for changes

So in a console .Net application I can watch all my log4net events stream by with (the powershell command) get-content .\log.log -Wait which is similar to the linux tail command and I assume uses FileSystemWatcher under the hood.
For some reason, whenever I have an asp.net Mvc application this will not work. To be clear, the log file IS written to. I can get-content .\log.log as many times as I want and get the most recent results, but with the -wait parameter I never see the changes scroll past.
Does anyone have any insight into what might be going on here?
UPDATE: found a working solution for my case, not sure whether this would help you out.
Instead of using PowerShell, I downloaded win-bash and now I'm using this familiar Unix command which works perfectly for me.
tail -f access.log
I'm not that familiar with .Net programming. Could it be a working solution in your case to use win-bash project's bash.exe instead of PowerShell?
I am experiencing similar issue when trying to "tail" Apache access log in PowerShell.
Get-Content .\access.log -Wait
I noticed that when my Apache HTTP server is running, it has a handle open to acccess.log and -Wait doesn't work. Stopping HTTP server releases the handle and when I made manual changes to access.log using text editor my PowerShell window immediately reflected changes in the console.
So I assume if some other program has a handle open to the file, changes are not reflected to console. Unfortunately I haven't found a way around this issue so far.

How to debug Adobe process from adobe workbench ES2 tool

I am finding issue with adobe service invocation
i have invoked process from workbench and recorded the process.
process recording is not showing any error, document is also generated at specified path, but it is not giving sucess message. :(
i stucked into this issue.
in normal scenario we get sucess message in dialog , but in my case i am able to create document but sucess message is not comming
please help..
I guess you're invoking Output service. If so, be sure to follow the guidelines described here:
http://help.adobe.com/en_US/livecycle/9.0/programLC/help/000674.html
Also you should post the code you're executing to get a broader sense of what you're trying to achieve.

Resources