Proto file is not being recognised in command line? - protocols

Doing Google’s tutorial for Protocol Buffers: https://developers.google.com/protocol-buffers/docs/javatutorial
Trying to compile it into a java file using:
protoc -I=/home/Eggy/Desktop/Test/ --java_out=/home/Eggy/Desktop/Test/addressbook.proto
Error is: Missing input file
For some reason the file in the folder is unrecognised. If I press tab the file doesn't show in cmd.
Doing it this way: Missing input file with protoc in protocol buffer and this way https://groups.google.com/forum/#!topic/protobuf/y2mxdn1vKGY
Brings up a different error:
File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
I also created the file as a text file and saved it as a .proto if that helps in Sublime Text.

Your command is slightly off. The --java_out parameter needs to specify the destination folder, not the input file, and then you need a space before you list the input file.

Related

How to find the file path of a file in livecode

So, I'm incredibly new to LiveCode and I have an external file in the same directory as the .livecode file called 'words.txt', with english words, each on a new line. I plan to read this file into a variable and then pick a random word from that variable. However, I am stumped as to how I must find the file path and insert this into the syntax required for me to do this. My code is as follows:
put url ("binfile:" & filePathGoesHere) into dictionary
replace crlf with lf in dictionary
replace numToChar(13) with lf in dictionary
put any line of dictionary into randomword
The file path is supposed to be inserted into the code at filePathGoesHere. Once the program is compiled I will be moving it and its resources around a bit (from computer to computer), so, beyond the text file staying in the same folder as the compiled program, the file path will change. What extra code would I need to add to make this work, if the folder the compiled program and the txt file is in is called "MyProgram"?
Help is much appreciated, and if further specification is required I can provide it. I also have a folder called "resources" if moving it there can help.
If the stack you're building is for your own use, you can place external files anywhere, but if you're going to deliver your stack to other users, you need plan where you external files are going to be placed, and how.
An easy way to determine the path to a file that sits immediately outside your stack is using the stack's filename:
put the fileName of this stack into theFilePath
set the itemDel to "/"
put "words.txt" into the last item of theFilePath
Now theFilePath variable will an absolute path reference to your external file. If the file is placed inside a folder "TextFiles" you can do this:
put the fileName of this stack into theFilePath
set the itemDel to "/"
put "TextFiles/words.txt" into the last item of theFilePath
If you're going to deliver your stack to other people, you should write your external file/s into a common system folder, or you need to use an installer to define where your files/folders will be placed. Common folder paths are found using the specialFolderPath function:
put specialFolderPath("Documents") into the theFolderPath
A somewhat recent addition to LiveCode is a "Resources" folder -- specialFolderPath("Resources") -- which can be handy for delivering on desktop and mobile platforms. Also, keep in mind that few of these folders allow writing to existing files contained in them for security reasons. "Preferences" and "Documents" are two examples of folders where you can change the contents of files.
The LC dictionary contains details of each of the folders.
If you use the file: scheme instead of bindle: LiveCode will automatically convert end of line characters to LF, so that step may not be necessary. (Although you might need it if you are reading a text file produced in native Windows encoding on a Mac.) You don't even necessarily need to read it into a variable. You could do this:
put any line of URL ("file:" & specialFolderPath("resources") & "/words.txt") \
into tRandomWord

How can I pass a file to an executable, the way dragging-n-dropping allows?

Consider I have the following :
An Excel workbook, which generates a .txt file (through a macro).
An executable file (.exe) which can parse this .txt file.
My objective here is to program the following algorithm :
Get the user to enter his data in the worksheets.
Prepare the .txt file according to what the user entered.
Pass the newly created .txt file to the external program (.exe).
Now, the first two steps work perfectly, I can generate the proper .txt file. The problem comes when I need to pass it to the external executable. Here's what's tried and observed :
Calling Shell() with : "C:\path\to\program.exe" "C:\path\to\file.txt" (EDIT : as a single string) ; simple enough, yet this does not work : the external .exe doesn't like being given a path. I have also tried entering the command directly into Windows' Execute utility : same. It seems like giving the program a path to the .txt isn't enough.
Dragging the .txt file onto the program's .exe works! The external executable does its work correctly. Here, it is as if I had passed the "file" to the program, not just its path. As a UNIX user, this sound like quite a non-sense to me (without a notion of stream or pipe), so maybe I'm missing something here...
Now, here's my question. When dragging-n-dropping a file onto an executable, how does Windows "translate" it ? Obviously, it does not translate it to "pass the file's path as the program's first parameter". How can I pass the .txt file to the executable program, without just passing its path like I did with my first Shell() call ?
A few other notes :
I am using Microsoft Office Excel 2010 on Windows 7. I'm already dying from it, thanks for your concern.
This external .exe I'm talking about cannot be modified and recompiled (which would be awesome), that's the tricky thing. I have to use it as it is, whatever happens.
Using Shell() is not a problem, if you give me the proper command/fix. I have also tried calling Run on a VBA.CreateObject("WScript.Shell"), same result.
Now, here's my question. When dragging-n-dropping a file onto an
executable, how does Windows "translate" it ? Obviously, it does not
translate it to "pass the file's path as the program's first
parameter".
It does exactly that. Create a batch file:
#echo off
echo You passed parameter: %1
pause
Save it as test.bat
Browse to it in file explorer, and drag/drop something onto it:
Previous comments:
Looks like you have to send the path and filename as one parameter, e.g.:
Shell("C:\path\to\program.exe C:\path\to\file.txt")
or if the paths have spaces in them, maybe:
Shell("""C:\path\to\program.exe"" ""C:\path\to\file.txt""")
http://social.msdn.microsoft.com/Forums/en-US/a3a3d1a7-5c9a-4c91-ab96-41d367eac2fb/using-shell-function-in-vba-how-do-i-pass-a-parameter?forum=accessdev

File conversion to DAT in unix

I would like to convert a file to .dat below is my query
I have a File eg: ABC this file doesn't have an extension(when i click its propertise it says type of file: file ) I want to convert this file to a .dat by writing a unix script
Linux (and Unix) do not use the file extension to define the type of a file, though some programs to use the file extension as a guideline. Unix/Linux examines the file magic number (the first bytes) of the file to determine the file type, though the program 'file' is the best explanation of how this is done (three tests, filesystem tests, magic tests, and language tests, the first that succeeds determines the file type).
Windows makes heavy use of the file extension to determine file type, and keeps metadata which maps file extension to application(s) which understand the file.
Linux/Unix uses the file magic number, examination of the first line of the file, and hints at the file type (for human use and some program use) using the file extension.
MacOS tracks file metadata using extension, file type code and creator code (metadata kept apart from filename), although OSX is derived from a Unix-like OS, so many of the Linux/Unix notes are applicable.

How do I get gvim/vim to open a file in a path with non-ascii characters?

At first I had this path to one of my files in Windows:
C:\mine\NOTES
I renamed it such that the last part of the path i.e 'NOTES' had the U+2588 FULL BLOCK=solid
before and after it. I inserted the character using the key combination ALT+219(alt code) which is an extended ascii drawing character. I did this so that the folder could stand out from the 20 plus folders in the directory. At this point, I'm quite happy that it looks cool and does stand out. However, when the files in the folder using a text editor all hell breaks loose. These are the results when I try to open the file scheme_notes.scm in different editors:
path="C:\mine\&#brevbar NOTES &#brevbar"
(The solid character is rendered as a &#brevbar character instead of a solid block.
GVIM prints:
"path" [New directory]`
"path" E212: Can't open file for writing.
Python(IDLE) opens the file but does not display the contents which the file has and prints the following error when you try to run it(I know it's not a python file, I was testing)
IOError: [Errno 2] No such file or directory: 'C:\\mine\\\xa6 NOTES \xa6\\python_notes.py'
(The \xa6 is a &#brevbar character)
Pspad does not allow you to edit the file:
File has set attributes: Hidden ReadOnly System
Save Changes Made to File?`
Scite displays a dialog saying:
Cannot save under this name. Save under different name?
If you click yes, the dialog keeps popping up repeatedly. I had to kill the program using
powershell after there were 15 plus dialogs on the window.(and it hadn't stopped)
Jedit prints:
The following I/O operation could not be completed:
Cannot save: "path" (The system cannot find the path specified)
Netbeans:
Failed to set current directory to "path" The system cannot find the file
specified.
I want Vim to be able to open the file without resorting to renaming the folder. Does vim have a setting for opening paths with unicode characters?
I'm asking this because python was able to change to that directory when I did this:
import os
os.chdir(u"\u2588 NOTES \u2588")
os.listdir('.')`<br> `==> ['scheme_notes.scm','python_struff.py']

How to read custom values from INF file in Inno Setup?

Setup programs created with Inno Setup could read an INI file through /LOADINF option. Is it possible to read custom variables through this INI file? Is there a function to get the name of the INI file given with this option? (Then it is possible with the INI utility functions.)
The code
ExpandConstant('{param:LoadInf}')
provides the file INI file name from the command line parameters.
Use this code if the INF file is in the setup folder
AddBackslash(ExpandConstant('{src}')) + ExpandConstant('{param:LoadInf}');
We simply iterate over the commandline arguments using the ParamStr(i) function and look for an argument starting with "/LOADINF=" and then extract the file name from there.
One gotcha that got us initially was that the file name might be a relative path descriptor (e.g. just the file name). However, if you use compression then the current working directory will be some sub-folder in your %TEMP% folder rather than the directory where your setup.exe is. You should therefore make sure to detect this and prepend the given file name with AddBackslash(ExpandConstant('{src}')) if necessary.

Resources