How to open source file in IDE on a certain line through command line - delphi

I'm just wondering if there is some IDE command line parameter which would open a source file on a specified line (in the current view) ?
I know this is probably too much to publish as a command line parameter, but it would be great for my Assert logging system; I would just create a link (label or something) and through this link open the file on the line where the assertion has happened.
The only thing I found is the registry entry (valid for Delphi 2007)
Key:
HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Closed Files\
Value:
TSourceModule,'<FilePath>',0,<PositionX>,<PositionY>,<CursorX>,<CursorY>,0,0,,
Where:
<FilePath> - the full file path
<PositionX> - first visible char in horizontal scope
<PositionY> - first visible char in vertical scope
<CursorX> - cursor position in horizontal scope
<CursorY> - cursor position in vertical scope
The rest of this key value I don't know but it might be enough to create this key and open the file.
Thanks

Following discussion in the comments to the question, it appears that you would be satisfied with writing a small utility to generate a fake .dsk file (desktop file) and possibly a matching fake .dproj file (project file). The .dsk file would contain just enough information to trick the IDE into opening the required file and moving to the desired location within that file.

Related

Missing file from computer "opencv_core249d.dll". Resolution with eclipse Version: Mars.2 Release (4.5.2).Closed

I am facing a problem with my visual studio 2013 ultimate. i would run a open cv project but iam getting a error message like this " opencv_core249d.lib" missing from ur computer. re install the program.
Solution : It works with eclipse Version: Mars.2 Release (4.5.2).
This is a missing .dll issue, not a missing lib issue. It usually occurs when the Environment Variables have not been correctly set in your Windows environment. To take care of this problem, there are 2 methods:
1) edit Environment variables
Go to ‘My Computer’ , right-click and select ‘Properties’. A window called ‘System’ will open, containing the Windows Logo on the right. On the left margin of this window, you will find a link named ‘Advance system
settings’. Click on it.
Another window called ’System Properties’ will open. On the bottom right corner of this window, click on the button named ’Environment Variables..’.
Under the ‘System variables’ column, look for a variable by the name ‘Path’. - Select ‘Path’ and click ‘Edit..’
In the ‘variable value’ row, add the following address:
\path to\opencv\build\x86\vc12\bin;
Please Note- Ensure that the new address added by you, and the address previously written in the ‘variable value’ row, are separated by a ; DO NOT REMOVE the previous environment variable addresses.
2) Manually copy the .dll files.
In case the first approach does not work for you, go to:
\path to\opencv\build\x86\vc12\bin;
You'll find all the dll files that you're looking for. Copy those files to directory where your source code is located.

How to Auto-Alignment Shortcut Key in Keil uVision?

I want to find Auto-Alignment Shortcut Key in Keil uVision. I tried some shortcut keys but I can not find. In Visual Studio I used to: CTRL + K + D , but in keil uVision I don't know how it is work.
For example :
When you type below ( usually copied from another text file which was not tabified correctly):
Use the shortcut key Auto Alignment with this block of code can auto formatting your code as below :
Stop searching. There is no such feature.
Was able to align in uVision5 with Astyle (http://astyle.sourceforge.net/).
File must be saved so that this tool can do its work.
Instructions :
Copy the Astyle.exe file to the Keil installation directory (e.g. D:/Keil_v5/)
Then open Keil and under the Tools menu, open the Customize Tools Menu option.
Create a new Menu Content, the name can be casual .
Command selects the Astyle.exe file in the keil installation directory.
Fill in Arguments !E
You can add a shortcut key for the operation in Edit.
Cheers to this https://www.programmersought.com/article/578892324/

OpenCV 245 first building errors

I downloaded the sources of opencv-2.4.5 and I followed the tutorial (on the opencv site for windows) about the installing my own libraries everything. Ok. I created the opencv.sln file with cmake then I opened it with visual studio 2010 professional and I click the build solution but just 9 succeeded. Most of the 200 failed and most of the errors about tbbd.lib not found and opencv_core245d.lib not found with LNK1104 error. I'm trying to solve it for how many days. I've tried to show the ways of files... Anyone can help please? This is about my dissertation. (Build with No Common Language Support)
Collapse
I spent a good 15 hours or so to get the homework finished using OpenCV. 14.5 of those hours were spent just getting it setup properly. I ran through about 7 tutorial videos, several set up guides, and read hundreds of posts containing resolutions to the same erros I was getting.So I understand that simply installing OpenCV is not a trivial task and there are several steps to do this. So here is a straightforward tutorial for setting it up if you want to use openCV.
It is important to understand how things work as far as linking goes. There are three types of files, your headers that you include, the .dlls that contain the functions, and the libraries that contain instructions for how to call the functions in the .dlls. So here, rather than add just the .dlls as dependencies in the input linker, we are going to add the lib files. We will then create a System Environment variable that will tell the machine where to look for the .dll files when their corresponding library files are referenced. We will be creating a Property Sheet so that when we create a new project, we can simply add the settings to our project by clicking "Add Existing Property Sheet" instead of adding a new one. This way, we never have to go through this again.
FOLLOW THESE STEPS EXACTLY AND MAKE SURE VISUAL STUDIO IS CLOSED BEFORE CONTINUING
NOTE: When text is given in quotes with instructions to copy said text, do not include the quotes.
First of all, the easy part - download OpenCV 2.4.5 from their website. http://opencv.org/ and click OpenCV for Windows. It will download OpenCV 2.4.5.exe.
Install OpenCV
When the download finishes, double click OpenCV-2.4.5.exe to run it.
When asked where to extract the files, type ino the text box: "C:\"
C:\opencv should have been created upon completion. Navigate there to make sure.
Setup Environment Variables
WINDOWS 8 USERS:
- Right click the bottom left corner of your screen when the start icon pops up.
- Click "Command Prompt (Admin)"
- Type "SETX -m OPENCV_DIR C:\opencv\build" and press enter to set the opencv build directory as a System Environment Variable. Wait for the console to give you confirmation that it is set.
- Right click the bottom left corner of your screen when the "Start" icon pops up. Click System -> Advanced System Settings -> Environment Variables
- In the "System Variables" list box, under the "Variable" collumn, find "Path".
- Highlight the "Path" row and click edit.
- Click in the "Variable Value" text box and hit the "end" key on your keyboard to scroll to the end of the line and add a semicolon.
- Type the following: "C:\opencv\build\x86\vc10\bin;C:\opencv\build\x86\vc10" and click "OK". This will add the openCV bin directory to the system path.
WINDOWS 7 USERS:
Follow the same steps. The only difference is how you get to the command prompt and the system settings. Google how to set up an environment variable on Windows 7 if needed.
Setup Visial Studio
NOTE: I highly recommend VS2012 Professional because of advanced syntax highlighting that makes life so much easier when programming C++. This version can be downloaded and installed for free from DreamSpark. Just make and account with your student ID. However, the steps for VS2010 and VS2012 are the same.
Open Visual Studio
Click "New Project" and under "C++" select "Win32 Console Application".
When the window opens click "Next", check "Empty Project", and click "Finish". It is very important that you start with an EMPTY PROJECT without a precompiled header.
Locate the "Property Manager." By default, it should be a tab that is sometimes hard to miss. Alternatively it can be accessed by clicking from the toolbar "View" -> "Property Manager".
Right Click "Debug | Win32" and select "Add New Project Property Sheet". Name it "OpenCVProps" and click "Add".
Right Click your new property sheet and select "Properties".
From the left column, go to "C/C++" -> "General" and in the listbox on the right, select "Additional Include Directories" and click "Edit".
Add the following THREE directories:
"$(OPENCV_DIR)\include"
"$(OPENCV_DIR)\include\opencv"
"$(OPENCV_DIR)\include\opencv2"
From the left column, go to "Linker" -> "General" and in the listbox on the right, select "Additional Library Directories" and click "Edit".
Add the following directory:
"$(OPENCV_DIR)\x86\vc10\lib"
From the left column, go to "Linker" -> "Input" and in the listbox on the right, select "Additional Dependenies" and click "Edit".
Add the following .lib files to the depedencies. You may do this by copying and pasting these into that edit box. I have purposely not included a bulletpoint to make it easy for you to copy paste these.
opencv_core245d.lib
opencv_imgproc245d.lib
opencv_highgui245d.lib
opencv_ml245d.lib
opencv_video245d.lib
opencv_features2d245d.lib
opencv_calib3d245d.lib
opencv_objdetect245d.lib
opencv_contrib245d.lib
opencv_legacy245d.lib
opencv_flann245d.lib
NOTE: If building for release, these steps are the same. However, when copying and pasting these files, remove the 'd' from the end of each of them. The 'd' denotes that it is a release library and links to a release .dll.
Congrats! The difficult part is almost done! Click "OK" to close the Window.
Creating and Building a Test Project
Head over to our Solution Explorer. This can be focused from the toolbar via "View" -> "Solution Explorer"
Right click "Source Files" and select "Add" -> "New Item".
Select "C++ File (.cpp)" and name the file "main.cpp". Click "Add".
Copy and paste the following program and press "F7" on your keyboard and watch the bottom left corner of your screen to see if you get a "Build Succeeded" message. If so, only one step left before you compile and run! If not, please retrace your steps, or comment below and maybe I can help.
#include &ltopencv\cv.h&gt
#include &ltopencv\highgui.h&gt
int main(int argc, char* argv)
{ // openCV .image object
cv::Mat inputImage;
//Create a Window
cv::namedWindow("window",1);
// Initialize our image.
inputImage = cv::imread("Lenna.png");
// Always check to make sure that image has data.
if(inputImage.empty())
{
std::cout &lt&lt "Image Failed to Load.";
return -1;
}
else
{
// All is well, display me.
cv::imshow("window",inputImage);
// Wait for user to press a key to exit.
cvWaitKey(0);
}
return 0;
}
If the build succeeded, then all that is left is to add the image to your folder. The placement is very important. I have copied the directoy that I have placed mine in. Follow the same directory pattern.
"C:\Users\Josh\Documents\Visual Studio 2012\Projects\ConsoleApplication3\ConsoleApplication3\Lenna.png"
Now hit "Ctrl + F5" To build, compile, and run to observe your image in the window!!
*IF YOU HAVE A WEBCAM*
Copy and paste the following code to check if OpenCV is working without being required to add an image. This is useful because if the above code doesn't work, but this code does, then you know you put the image in the wrong folder.
#include
#include
int main(int argc, char* argv)
{ // openCV .image object
cv::Mat image;
//Create a Window
cv::namedWindow("window",1);
// Create the capture object.
cv::VideoCapture device;
// Open your webcam.
device.open(0);
while (1)
{
// Read data from your device and store it to the image frame.
device >> image;
// Always check to make sure that image has data.
if(image.empty())
{
std::cout&lt&lt "Image Failed to Load.";
return -1;
}
else
{
// All is well, display me.
cv::imshow("window",image);
// Wait for user to press a key to exit.
cvWaitKey(33);
}
}
return 0;
}
Happy Coding!! Let me know if something didn't work so I can fix it!
Quick Answer
I have managed to compile OpenCV with TBB support using the tutorial here.
Specs: Visual Studio 2012/ Win 7 (64 bit)/ OpenCV 2.4.5/ CUDA 5
I have downloaded the latest TBB zip and extracted it to C:/src/OpenCV/dep (as suggested in the tutorial linked above).
You have to use the following TBB settings in CMake (adapt depending on your file paths):
TBB_LIB_DIR :: C:/src/OpenCV/dep/tbb41_20130314oss/lib/intel64/vc11
TBB_INCLUDE_DIRS :: C:/src/OpenCV/dep/tbb41_20130314oss/include/
TBB_STDDEF_PATH :: C:/src/OpenCV/dep/tbb41_20130314oss/include/tbb/tbb_stddef.h
WITH_TBB :: checked
BUILD_TBB :: unchecked
More Information
Initially, I also wanted to install OpenCV with CUDA 5 support, but it seems that CUDA 5 is incompatible with VS2012. This is the error I got when compiling
OpenCV:
Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_matrix_operations.cu.obj
nvcc : fatal error : nvcc cannot find a supported cl version. Only MSVC 9.0 and MSVC 10.0 are supported
The good news is that you are using VS2010, which can be used with CUDA, as suggested here.
VS2012 can be set up to create projects with CUDA, but there is currently no way (AFAIK) to compile OpenCV with CUDA support for VS2012 (read this for more info).
In conclusion, people that need CUDA support should compile and use OpenCV with VS2010.
Also, when compiling OpenCV, I got the following errors:
error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm118' or greater
fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
I used the instructions here to finally compile OpenCV. I created a Property Sheet which had /Zm130 as an additional option in Common Properties > C/C++ > Command Line and added it
to all of the generated OpenCV projects.
For your reference, I also attach the CMake configuration and CMakeCache.txt file that I've used (CUDA is disabled as I am using VS2012):
CMake configuration: http://pastebin.com/8rJZGZ3T
CMakeCache.txt: http://pastebin.com/A0q8YgJg
Hope this helps and please comment if you need me to elaborate on any step.
I installed again opencv-master, opencv-2.4.5 and opencv-2.4.7 both to my new laptop. OpenCV-2.4.7's imread function returned always null but C-cvImageLoad worked well and opencv-master's cvLoadImage didn't work cvImageLoad or I missed something. But TBB's dir must be .../bin/ia32 not intel64 my OS is 64-bit but VS201x 32-bit this was my error. And I've get stitching and gpu errors and visual studio is telling about the error and this is usually memory allocation limit error and I did same things like your said #dilgenter and now it's working well but just 2.4.5 well and the python_d.lib error can be occur this is not a problem at debug mode I've read about this from a lot of forum sites. I'll try to find why 2.4.7's imread returning null Mat element. But now I'm too busy and this is

Unable to concatenate defined string and the text within the path to image file

I got a problem with setting a path to image within the resource file (.rc).
For some reasone it was not possible to concatenate defined string and the text.
e.g.
File1:
#define Path "Brand_1"
File2:
#include File1
Logo BITMAP Path "\Logo.bmp"
Borland resource compiler (5.4) throws error message: 39: Cannot open file: Brand_1
EDIT:
My question would be: Is is possible to combine the path for loading image using resource string variable and a string (file name).
Also, project I'm working on relates to a file (Logo.bmp) being present in two locations. I would like to have a switch (.bat file) to generate a different resouce file depending on requirements.
Thanks.
BRCC32 accepts -i as search path seperated by semicolon, so you could create a bat file like this
compile_res.bat
brcc32 -ic:\mypath1;c:\mypath2 resource_script
and you define your resource_script as normal, for ex:
resource_script.rc
myImg BITMAP Logo.bmp
myDOC RCDATA mydoc.doc
when you run the compile_res.bat, it will run the brcc32.exe with the search path, and having the bat file saves you from retyping the search path every time.
You're not concatenating anything. You're compiling to Logo BITMAP "Brand_1" "\Logo.bmp", and "Brand_1" isn't a valid path to a bitmap file.
#define in the resource compiler acts sort of like find/replace in a text processor - not exactly, but close enough in this case.
You might get by (untested) with removing the quotes and space between them, as long as there are no space characters in either the path or filename; otherwise, you're probably out of luck. (Not sure what you're trying to accomplish, anyway.)

Delphi .res file changer

I'm looking for a ready-to-use piece of code that would be able to read and modify Delphi .res files. The thing is that I need to create an application that will be compiling many Delphi projects at once (using the dcc32.exe file). However, it is necessary for me to change file version and language before compilation, and as far as I know, I have to modify the .res file to do that.
Have you come across any code that would give me an interface to .res files allowing me to modify the data contained in it? The thing is that I want to change only those two pieces of information keeping the rest unchanged. This is why I can't compile my own .res file based on a script.
An application executed from a command line would also be OK if it allows to be called with parameters and does what I need it to do.
Thank you very in advance!
If all you need is to add file version resource then create appver.rc file, compile it with brcc32 and in one of your app unit (for example appver.pas) add {$R appver.res} (as Marian noticed you must turn off Delphi project option to include version info).
I created command line programs that increase build numbers in .rc file, create new branch/tag in SVN with new version in branch name, compiles .rc to .res, and build application.
My .rc files with such info (Polish language) looks like:
#define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
FILEVERSION 7,28,7,17
PRODUCTVERSION 7,28,7,17
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0
{
BLOCK "StringFileInfo"
{
BLOCK "041504E2"
{
VALUE "CompanyName", "xxx\0"
VALUE "FileDescription", "yyy\0"
VALUE "ProductName", "zzz\0"
VALUE "FileVersion", "7.28.7.17\0"
VALUE "ProductVersion", "7.28.7.17\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0415, 1250
}
}
For all things .res, look at Colin Wilson's "XN Resource Editor", for which he provides the source code: http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
And probably all you need is his resource utility library:
http://www.wilsonc.demon.co.uk/d9resourceutils.htm
I haven't used this source, but if I needed it, that's the first place I'd look. His resource editor is very useful, btw.
There is ChangeRes which seems to match your needs.
Check out sources:
http://code.google.com/p/gedemin/source/browse/trunk#trunk/Gedemin/Utility/IncVerRC
It is our utility which reads .RC file with version information and increments build number. We use it inside our build process. Here is an excerpt:
incverrc.exe ..\gedemin\gedemin.rc
"%delphi_path%\brcc32.exe" -fogedemin.res -i..\images gedemin.rc
"%delphi_path%\dcc32.exe" -b gedemin.dpr
The utility uses TIncVerRc class written by Chris Morris.
Check Resource Tuner Console on www.heaventools.com. They position that product for tasks like yours. Also there's a free rcstamp tool on CodeProject.

Resources