Parse.exe crashing and no creating necessary files - parse-platform

I'm trying to start learning parse cloud code. When I launch the parse.exe via my command line, various terrible things happen. For example, if I try to launch it using any kind of a command, but it's not set to "launch as administrator", I will see no text from the program(it will expect me to input my email and password, yet I will see no text I would see if I launched it as administrator). If I run it as administrator, it ends up consistently crashing during any activity. For example, if I try to go for >parse list, I will get to login, the list of apps appears and then the window instantly closes. Strictly following the tutorial(https://www.parse.com/apps/quickstart#cloud_code/windows) crashes midway as well. Doing >parse new for my existing app creates parse.local and parse.project files in the specified directory, but none of the rest files expected. I cannot seem to find the I'm pretty much lost here. Am I doing something wrong? I have the latest parse.exe thing, redownloaded it from multiple locations provided by parse.

Related

Mac OS X app running shell script but no terminal window

I am fairly new to Mac OSX, and am trying to create an .app file to run in the Applications folder. I'm using MacOS Big Sur, and this will just be run on a Mac (it doesn't need to be cross platform). There is a jar file that executes by running a shell script, as well as a few extra resource files, so ultimately I'd like to bundle this all together in something like a dmg so that I can share it easily with a few other people.
I followed the advice given here and here to set it all up, and almost everything works. The program starts when I double click on the .app file, but without a terminal window. Unfortunately I need the terminal window to open because I use it to log messages to the user.
Terminal is the default app for the shell script, and a terminal does open when I run the shell script directly by double-clicking on it. The script file works with an .sh extension and without one, though I get an error trying to run the .app if the script has an .sh extension. Everything has execute permissions. I went through the Info.plist docs but couldn't find anything about the Terminal. I also tried creating the .app with Automator, but with the same result.
Any suggestions would be very much appreciated, as at the moment I'm completely stuck. As I said, ultimately I want to have a way of sharing this with others who may not be very computer-savvy (e.g. they're used to just downloading things from the App Store and wouldn't be able to install things using the command line). So if I'm going about this all wrong or there's an easier way, then let me know that too.
Unfortunately I need the terminal window to open because I use it to log messages to the user.
If this is all you want the Terminal app for then you don’t need it all.
The Terminal app is a GUI app which runs a shell using standard OS calls, passes keyboard input to that shell (and hence any commands it in turns invokes) via a pipe, and reads the output of the shell (and hence...) and displays it in a window.
You can run your shell script direct from your own app, collect the output, and dimply that output in a window in your app.
In Objective-C the classes you want to look up are NSTask, to run a shell passing it your shell script, and NSPipe, to create pipes needed.
There are plenty of Q & A’s on SO about NSTask/NSPipe, here is one and here is another which uses Swift.
Note that both of the above read all of the output before converting it to a string which can then be displayed in a window or otherwise processed. This is not required and if you have a long running shell script and wish to display output as it runs you can read shorter chunks from the pipe. Read the documentation to see how to do this.
I'm posting my solution in case it helps anyone in the future. As the comments/answers said, what I really needed to know was how to get my app to open a terminal window. Obviously by creating the app manually (creating the folder structure and minimal Info.plist) I was missing some key elements.
I tried to generate one using Xcode. I'm sure it's pretty straightforward, but I got bogged down trying to work out the Swift code.
What worked for me was creating an AppleScript using Script Editor. The script simply tells the Terminal program to run my bash script:
tell application "Terminal"
do script "/Applications/{name of app}/Contents/MacOS/run.sh;exit"
end tell
The key is that Script Editor can save this as an app to the Applications folder, which means it creates the necessary folder structure and files. After that I could just copy my program files into the MacOS folder, which is where my bash script looks for everything.
One option might be to give the script file the extension .command, e.g., and then open that, e.g.:
open myscript.command
The myscript.command file needs execute permissions (chmod a+x myscript.command).
These .command files can also be double-clicked in Finder to execute them in a new Terminal window.

Registering my application to URI Scheme and fetching the command that launched it

Windows allows me to register my application to a URI Scheme as defined here. If the application is already running clicking on the URI should bring it to the foreground. For some reason, GetCommandLineW() keeps giving me the original command that launched the application.
Is there some way I could get the new URI that brought my window to the foreground.
I'm aware Win messages could be used to get the command line arguments. Is there some way to associate my URI commands with a win message.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\myapp]
#="URL:myapp"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\myapp\DefaultIcon]
#="<Path To App>,2"
[HKEY_CLASSES_ROOT\myapp\shell]
[HKEY_CLASSES_ROOT\myapp\shell\open]
[HKEY_CLASSES_ROOT\myapp\shell\open\command]
#="\"<Path To App>" \"%1\""
Firstly, thanks a lot everyone for your comments. Sorry, I'm a bit of a newbie and it took me some time to grasp what was being stated from the beginning. I'll leave this comment here in case someone wants to check back.
As suggested, my app did launch a new window. It found an instance of my app that was already running. And as a result terminated.
What I changed? Before this newly launched instance is terminated, I send a new message to the previously running instance of my application. In order to pass the contents of the command line I used named shared memory.
The receiving app just listened to this message. On receiving it, it retrieves the command line from the shared memory and allows me to handle the command line.
Thanks again.

Taking over the Windows Run command on 'File not found'

When you hit the WIN+R (Run command) in windows, you get the Run Box:
How can I get a handle to this command incase an entry for what I am typing is not found?
For example, this works great when you type cmd or calc.
But when you type: thisawesomething and hit the return key, you are greeted with this:
What I want to do is either of these two:
Whenever the file, folder or resource is not found via RUN, a default program (which I specify) is fired.
OR
If I can have a program running in the background which listens to an event raised by Windows when it can't find a file, what event am I looking for?
Is this even possible?
I have tried searching for this quite a bit but have hit a wall. Any help or a push in the right direction would be appreciated.
Note:
This article mentions that if I fire the RUN command programatically, there is a way to handle the notification of which program is about to be run. However, I am looking to modify (or patch) the default Windows Run functionality and not fire this programatically from another app. Thanks.

Configure launch command in Code::Blocks

I recently discovered Emscripten, and after downloading it, I decided to see if I could get it to work with Code::Blocks, so that I could easily test my applications to see how they performed when running as JavaScript.
I created a new compiler configuration, and set up all of the toolchain executables, except for the resource compiler (which doesn't seem to give me any problems), and the debugger. I wasn't really sure what to put in the debugger, because I remembered the debugger field as being a text-box. But when I looked, all that was there was a drop-down menu.
I managed to find a "Debugger" menu in the "Settings" menu, and when I opened it, there was a button called "Create config".
I created a new configuration, and pointed the executable path to "node.exe" (which runs .js files). I then went back to the compiler settings, and chose my new debugger in the drop-down.
I then tried to build and run a simple hello world application. But once it finished building, it gave me the message Execution of '[my file] ' in '[my project folder] 'failed. The actual build seemed to be successful, so I decided to manually run node.exe from the command line to see if I had configured the debugger incorrectly. And as I expected, it ran successfully.
While I was glad that I had successfully configured the compiler, I still was confused as to why the app didn't want to run. I also set Emscripten to create HTML files instead, to see if Code::Blocks would somehow recognize the appropriate program, and open it in the web browser instead. Of course that didn't work either.
What I am trying to figure out, is how I configure Code::Blocks' run command. Perhaps the debugger isn't even the right place to be looking. But I really need someone to help me figure out how I can configure this in Code::Blocks, as this is currently the only thing that is really giving me any trouble.
Thanks.
Possible but less ideal solution:
After some time, I was able to come up with a solution. However, I am sure that there are better alternatives.
To use this method:
Create a new build target called RunScript.
Set the compiler to No Compiler.
In the project properties, set the type to Console application.
Uncheck Auto-generate filename extension, and set the output filename to RunButton.bat.
Create a new file called RunButton.bat (or whatever you entered as the output filename).
Whatever you put in RunButton.bat will now be executed when you click the run button.
I also created a new virtual target that contained my RunScript target, and my main target, so that I don't have to switch targets whenever I want to test my application.
Problems with this method:
While this method does work, it is not ideal, as it requires you to have two extra targets (including the virtual target that I made for convenience). I would rather be able to just have everything contained in one target.
Slightly better solution:
A new solution that I decided to use, is to simply use the configure tools menu to create a tool that points to a batch file that runs my compiled programs.
To use this method:
Go to Tools>Configure Tools...>Add.
Fill in the name, and point the executable to the script that you want to run when this tool is used.
Fill in any needed parameters. You can use the built in ${TARGET_OUTPUT_FILE} macro to pass your output application as a parameter.
You can now use your tool by going to Tools>{My tool}, but you can set a hotkey by going to Settings>Editor...>Keyboard shortcuts.
Click the plus button by Tools, and click on your tool to set a shortcut for you tool.
Problems with this method:
While this method does eliminate the extra build targets, it doesn't let you run your script or run non-executable files by clicking the run button; which was the original intent. On top of this, you have to create a new tool anytime you want to add a new script.
I am hoping that someone else will be able to show me a better way of doing this, but for now this will work.
Might be a little late, but I was able to get the codeblocks run button to run any command by using a few post-build steps. The reason I need this is because my laptop has nvidia "optimus" and in order for my output program to see the discreet graphics card, I have to run it with the optirun prefix. So I added the following to the post-build steps in build options:
mv $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE)_bin
echo #!/bin/sh > $(TARGET_OUTPUT_FILE)
echo optirun $(TARGET_OUTPUT_FILE)_bin >> $(TARGET_OUTPUT_FILE)
chmod +x $(TARGET_OUTPUT_FILE)
It basically renames the output binary and creates a script replacing the original output binary name. When pressing the run button, the script is executed instead of the output.
On windows, you might have an issue running an exe extensioned file as a batch script so what if you generate the output file with a bat extension like in your first method, but with compilation and then rename it to exe in the post-build like this:
move $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).exe
echo [WHATEVER YOU NEED TO RUN] > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bat

put application in startup

I am planning to start my application whenever the user starts the computer. ASFA I know, there are two options available to me:
put the application link to startup folder
Keep a the startup-registry location updated with application path
However, the problem is, AVs like Kasperesky reports the registry paths (if added by an app) as keyloggers. Just wanted to hear from you people, which is better? Adding a shortcut to startup folder or using the registry way.
I really would prefer that you didn't force my app to start whenever I reboot. So, if you really insist, then please put it in the Startup folder and don't hide it in the Windows registry where I will never be able to find it. There may be times when I need this thing not to start up every time, so please let me do the choosing by putting the shortcut where I can see it and manage it. Otherwise, if it gives me too much trouble, I may just start up Control Panel > Add or Remove Programs, and you really don't want that, do you?

Resources