Windows, heroku config | grep MONGOLAB_URI - heroku

I'm developing a MEAN stack app in windows and the example code I've been given to connect my mongoDB to heroku says on linux and mac the config | grep command in the title would display the full URI. On windows I get the error grep not recognized as an internal or external command, operable program or batch file. I know nothing about the grep command. What would be an alternate method to do this on windows?

grep is just a way to filter the output to make it easy to see the information you're looking for. The Windows equivalent would be 'findstr' (http://technet.microsoft.com/en-us/library/bb490907.aspx). But I would just try leaving it out altogether and using your eyes to find where "MONGOLAB_URI" appears. Assuming you don't have a ton of config, it should be easy to spot:
> heroku config

Related

PTC integrity CLI no commands are recognized

I have PTC integrity installed on my PC, but I would like to use CLI commands.
Unforonutaly, no PTC command is recognized in my console. Probably I have to set up some system env variables?
Or do I need some extra software/server installed besides?
I tried the next commands so far:
man imabout
man "im about"
man "im"
No manual entry for
im
si
'im' is not recognized as an internal or external command, operable
program or batch file.
when im is not recognized by your system, then
1) PTC is not running
or
2) your environmental variable is missing the entry:
C:\Program Files\Integrity\Lifecyle Manager Client\bin
First, check if you are using the client network if yes then use the
respective VPN with pulse secure or any VPN set-up with the
respective client VPN.
Second, if its in local n/w or at server location use the below basic
command
mksapiviewer --iplocal --xml im connect --hostname=HOSTNAME --port=7001
--user=ALM_USER --password=PASSWORD > Filename.txt
This will give you output in the text file and which is generated in the user folder or you can give manual file location.
If XML's exit code is coming "0" then it means the command run successfully.
This issue occurs when Tool path is not added into the PATH variable, please add the upto the Client_Install_Dir/bin directory.

grep cf logs from windows machine

I am using the CloudFoundry CLI tool to tail logs from a remote cloudfoundry server. As per the cloud foundry log docs the command is
cf logs **app_name** --recent | grep RTR.
When i run this i get the error, grep is not recognized as a command. I believe this only works in a Unix based system. How can i use a grep like functionality from Windows CF CLI?
cf logs app_name --recent | findstr RTR
Findstr is capable of finding the exact text you are looking for in
any ASCII file or files. However, sometimes you have only part of the
information that you want to match, or you want to find a wider range
of information. In such cases, findstr has the powerful capability to
search for patterns of text using regular expressions.
Microsoft Technet
other solution would be that you install GNU grep on Windows. There are several ports available.
The Windows command prompt does not natively support bash prior to Windows 10, which is required for commands like grep. To use grep, you either have to use the git-bash shell provided during a git install, or in current releases of Windows, use the bash command in a Windows Command Prompt after installing the Windows Linux Subsystem. Windows Reference Documentation here
Perhaps you can use the git-bash if you have git installed on your machine. The git-bash comes with UNIX tools such as grep, so you would just open the git-bash instead of the Windows console and enter your command there.

Perl in Windows 8

I am trying to get Strawberry perl running on my windows 8 machine. This is my first attempt ever to use perl and I am going through the readme file to try and get it up and running. At the moment i have got as far as typing
c:\>perl
and i get access denied message. Am i misunderstanding the readme or do i need to make some further adjustments to get it to work?
The instrustions for the readme are
1. run any perl script by launching
c:\> perl c:\path\to\script.pl
i have also tried
c:\>perl c:\perls\ex1.pl
where perls is the folder on C: in which the script ex1 is located. Also get access denied message.
Posting comment as answer.
The command
c:\>perl
in the windows cmd shell is an instruction to redirect the output of the command c:\ to a file named perl. The > character is the one that does that.
I was going to say that it fails because you probably have a directory named perl there, but I notice on my system that it fails even though I have no such directory.
The problem is that the readme had included the prompt in their sample command. The default prompt in windows cmd looks like that: C:\> So, like I mentioned in the comments, the command you need to run perl is simply perl. For example:
perl -e "print 'Hello world!'"
It could be either the fact that Perl isn't in your PATH, or permissions issue.
If it's the PATH, to troubleshoot and fix:
Find the directory where you installed Perl (say, "c:\program files\strawberry\perl\bin\" as an example)
Run Perl as full path: `"c:\program files\strawberry\perl\bin\perl c:\perls\ex1.pl".
If that works, you will simply need to add Perl's directory to PATH variable, so that running "perl" without a path will search for it in that directory. To do that, here are the references:
Window add Java to Path
https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them
http://www.itechtics.com/customize-windows-environment-variables/
If it's permissions, here's a reference: http://windows.microsoft.com/en-us/windows7/how-do-i-open-a-file-if-i-get-an-access-denied-message

'chcp' is not recognized as an internal or external command, operable program or batch file. on a Windows PC

I am receiving the error message below in the command prompt when using the git init command. I'm using a Windows PC running Windows 7.
C:\rails_projects\first_app>git init
'chcp' is not recognized as an internal or external command,
operable program or batch file.
Reinitialized existing Git repository in C:/rails_projects/first_app/.git/
'chcp' is not recognized as an internal or external command,
operable program or batch file.
I'm new to Ruby on Rails and I'm trying to create a repository for my Rails project. When I use a command such as rails new first_app or rails server I don't receive the message, only when I used the git init command does it show up. Also, as you can see the command still functions correctly (i.e. Reinitialized existing Git repository in C:/rails_projects/first_app/.git/), however, it's annoying to see the error message every time I make a command.
Does anyone have any idea how to fix this problem? I found a link that told me I need to switch the console to Windows-1252 http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html#charsets_1252 but that didn't work.
I appreciate any help, thanks!
See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH
;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
Add the above if not there.
Once added, open a new cmd / bash and try:
where chcp
It should give the path.
Then try with the git init again
Edit
If you need help to find where to add it
You have broken PATH (check with SET PATH), chcp is internal Windows-command, which can be found in $Windows\system32\ dir
I copied the file from windows/system32 into the Vmware CLI/bin directory which resolved it for me.
Looks like this same issue. The link has some ideas on how to fix it. In the link, the issue was created by Git being installed standalone, and with rails.
Go to \RailsInstaller\Git\cmd then open the git (command prompt file) with a text editor or word pad (by right clicking the file and selecting edit) now there would be two lines which would look like
#chcp %cp_ansi% > nul < nul
and
#chcp %cp_oem% > nul < nul
delete both of them, and save the file . This should resolve the problem

Is it possible to ssh into Windows (through a cygwin sshd) and start a program on a logged in Windows user's desktop?

Is it possible to ssh into Windows (through a cygwin sshd) and start a program on a logged in Windows user's desktop?
Put another way, say a user ABC is logged in on windows and a remote user logs in with ABC's login/password over ssh, can remote ABC pop up an app on the local ABC user's desktop?
I am asking this on Stackoverflow and not Serverfault because the motivation for doing this is programmatic in nature. The remote call will be coming from a Linux box so while it may be possible(?) to do this using WMI or some other approach, ssh seemed like the simplest.
Happy to hear simpler/better alternatives though.
Thanks!
If your cygwin sshd is running under a privileged account, it can get a handle to the current desktop and put windows on it. See the desktop parameter of STARTUPINFO for CreateProcess.
My own solution. Tested on windows XP (but I think it should run in any windows environment with a little effort).
You need to use the psexec and quser command.
First, put psexec and quser in a directory included in the cygwin's PATH environment variable. Just copy these files into the bin directory under cygwin.
You can find the quser.exe in your %system32%\dllcache dir. But for any reason I can't access to it (or access to the mentioned directory) through cygwin commands (i.e. ls, cp, etc), so I made a copy using the microsoft's copy command to the cygwin\bin folder.
Notes: I think it's helpful to have the suite psutils all in the bin folder of cygwin. The first time you run either of these utilities will have to accept a license agreement from Microsoft warning, so run psexec from Windows explorer the first time.
Then create these alias in your .bash_profile file:
alias winrun='psexec \\\\YOU_USERNAME_HERE -d -i `quser | grep YOU_USERNAME_HERE | grep console | awk "{print \\\$3}"`'
alias explorethis='winrun explorer $(cygpath -w `pwd`)'
Remember that you will need to translate the current directory using cygpath if you need to pass it as argument of a command ("explorethis" is an example of that).

Resources