How to add external references in MonoDevelop? - linux

I've downloaded a charting library called NPlot and I have no idea how to add it as a reference in a GTK# application I'm currently making in MonoDevelop. There is no option in the Edit References window that you could add an external reference apart from the listed ones.
How do you add an external reference in MonoDevelop?

Being fairly new to Ubuntu (consequently, to using apps), I found it quite challenging to grapple with the dilemma above. After hours of searching (almost half a day actually), I found the answer. I created this post for others who might be facing this problem too.
Before proceeding, make sure you have your dll file to add as a reference.
First, create a .pc file containing the following:
Name:
Description:
Version:
Libs: -r:<where your dll is>
Example:
Name: NPlot
Description: Creates charts.
Version: 0.9.9.2
Libs: -r:/home/xxx/Downloads/NPlot/nplot-gtk-0.9.9.2/NPlot.dll
Hat tip to this site.
Remember where you've saved your .pc file. I've saved my file in /home/xxx/Documents. Next, copy the .pc file to /usr/lib/pkgconfig. I'm not sure with other Linux distros, but Ubuntu is preventing me to directly copy paste the file to the folder, so I have to use this command on the terminal:
sudo cp <source> <destination>
Example:
sudo cp /home/xxx/Documents/NPlot.pc /usr/lib/pkgconfig
It is now included in the Edit References window.
If the reference does not show, please refer to this question.

Unzip the NPlot zip file and extract the dll you need.
In the Edit References dialog select the .Net Assembly tab.
Click the Browse button and browse to the NPlot dll file and select Open.
Click OK on the Edit References dialog.

Related

Visual C++ for Linux: copy content files to build directory?

I have a Visual C++ for Linux project in VS2017 that I'm building on a Raspberry Pi running Raspbian. This project consists of a single source file (main.c) and an image (test.jpg). When building the project, I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this
The image file's Content property is set to True, as is Included in Project. In the project properties, under Copy Sources, Sources to Copy is set to "#(SourcesToCopyRemotely)" and Copy Sources is set to "Yes". However, when I build, only main.c is copied to the Pi, and the compiler output is just a single .out file. I hoped to also see test.jpg there, but alas.
This article mentions that #(SourcesToCopyRemotely) defaults to all files in the project. However, when I evaluate the value of #(SourcesToCopyRemotely, it evaluates to just "main.c".
How do I make sure content files in my projects also end up in the build directory, along with the .out file? Preferably without having to manually enter each filename in a post-build step.
It turns out this is a bug in VC++ for Linux. A workaround, currently, is to use Additional Sources to copy. There's a caveat though: it doesn't work with remote paths that start with ~. So you can't use $(RemoteRootDir) if the Remote Build Root Directory setting is set to the default of "~/projects".
I've currently got Remote Build Root Directory set to "/home/pi/projects" and for each file I want to copy to the build directory I set Additional Sources to Copy to "[filename]:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$Configuration)/[filename]". For instance:
firstimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/firstimage.png;secondimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/secondimage.png
Right-clicking on the non-source code file to open it's properties page and flagging as Content in the General tab will cause the file to be copied to the remote. There is no need to add anything to the Copy Sources tab. The Copy Sources page of the project properties must show the default of #(SourcesToCopyRemotely). And when you edit this setting the macro should show an expansion with the additional files included.
I have found that it necessary to refresh the macro by clearing Source to Copy and then restoring it to the default after you have marked the additional files as content.
I have encountered problems when the additional files are not in the same folder as the C++ source files on the Windows host and/or you want to put them somewhere else on the remote. There are several open issues on the VCLinux GitHub site like this one so it will be worth reporting any problems you have on there.
[VCLinux 1.0.6 on VS Pro 2017 + Debian Jessie remote]
The "Pre-Build Event" section of the project properties offers "Additional Files To Copy". Addressing my file there (relative to the solution) showed following in the output when building:
Copying file 'C:\myfilepath\resource.png' to '/home/pi/projects/myproject/resource.png'
It is possible to move the files to the final destination then with Remote Post-Build Events (mv source destination). Not the most elegant way, but the first thing I got working..

Where are the default packages in Sublime Text 3 on Ubuntu?

I'm migrating from Sublime Text 2 to 3. In Sublime Text 2, I changed a lot of the default settings of the editor -- such as the tab bar height, sidebar color, etc. -- by modifying the Default.sublime-theme file in sublime-text-2/Packages/Theme - Default. I was also able to modify the colors of the default color schemes in a similar fashion. I've been trying to figure out how to do this for Sublime Text 3, but can't seem to find these files. ~/.config/sublime-text-3 only seems to contain overrides for user settings, not the default settings.
This link on the Sublime Text forums seems to give the location for Windows and Mac, but not for Ubuntu. I've searched a bit to no avail. Does anyone have suggestions?
Thank you!
To amplify on #skuroda's answer - ST3 contains all of its data that, in ST2, was stored in Packages/PackageName, in PackageName.sublime-package files that are basically just zip files, or "Resources" as they're now known. Using PackageResourceViewer, you can easily edit the individual files contained within the resource, then save it back again. When saved, the proper directory structure under Packages/PackageName will be created, allowing you to edit the file directly next time. The way file precedence works in Sublime, any file that exists in ~/.config/sublime-text-3/Packages/PackageName/ will override any file of the same name stored in PackageName.sublime-package.
However, since you don't want these files to be accidentally overwritten, I would suggest creating ~/config/sublime-text-3/Packages/User/Themes/ and User/Color Schemes directories and storing your customized files there instead. The User/ directory is protected from overwrites during upgrades, etc., and unless you're planning on creating a customized theme or color scheme for redistribution through Package Control, it's best practice to keep your files in there.
EDIT
I just realized you hadn't gotten an answer to your original question - where are the files stored? If you installed the .deb file from sublimetext.com, all the .sublime-package files are in /opt/sublime_text/Packages.
If you want the easiest way to save your customized settings first copy all the default settings and paste into a new file named Preferences.sublime-settings.
Then make your changes and save the file to:
/home/**username**/.config/sublime-text-3/Packages/User
In order to see the .config folder you will have to enable show hidden files.
The instructions are written at the top of the default settings list in case you are wondering where got this from.
In the ST console, try entering sublime.executable_path(). This should get you close to where you need to be. Also, you should copy the content of the file out and move them (under a new name to the packages folder). You probably don't want your modifications to be reverted on subsequent update. An alternative method is to try overriding the files you need to. I haven't done that for theme files, so I'm unsure if everything will work as it should. If you take the override route, I'd recommend using PackageResourceViewer. I wrote it to help with browsing/overriding package files in ST3.
You can use
dpkg -L <package name>
For example
dpkg -L subli<tab>
Just open up sublime text, hit ctrl+` to open sublime text console, then run these command accordingly
sublime.packages_path() to see user installed packages directory
sublime.installed_packages_path() to see zipped packages (with .sublime-package file type) directory
Mostly likely, you'll find the Default package inside zipped packages directory.
You can use PackageResourceViewer to see zipped packages's contents as #MattDMo suggested, but more over, you can actually extract zipped packages into user installed package directory directly using PackageResourceViewer's extract command.

Corflags.exe cf001 Could not open file for wiriting

I am trying to edit the corflags file so that I can run 32bit applications on a 64 bit pc but everytime I try to edit the file using something like corflags.exe assembly /32bit+ it comes up with the error message cf001 could not open file for writing.
Now I have tried a lot of different options such as:
Running in administrator mode;
Finding the file using a search and checking read only is not ticked
Checking that user full control is ticked
Tried to set the whole folder to non read only
When trying the whole folder, it goes through looking like it has set read-only, but then I click OK and re-right click on the whole folder, the box is filled in (not ticked) does this mean that part of the folder is read only and why does it reset to read only?
I just faced the same problem and have tried the same things.
Run cornflags from an elevated ("Run as administrator") Visual Studio Command Prompt. I did the same for a copy of the original .exe just to make sure no other process was using the program.
Create a copy of the file you intend to target with CorFlags.
(e.g. "WcfServiceHost.exe" --creates--> "WcfServiceHost - Copy.exe")
Rename the original file to something else:
(e.g. "WcfServiceHost.exe" --> "WcfServiceHose_Original.exe")
Rename to copy to the original file name
(e.g. "WcfServiceHose - Copy.exe" --> "WcfServiceHost.exe"
For my purposes, I created copies and named them describing their configuration:
Example:
WCFServiceHost_With32BitOn.exe
WCFServiceHost_With32BitOff.exe
Now I can destroy the WCFServiceHost.exe files and create them from these pre-modified copies. No more CorFlags operations necessary.
Note: this is basically a more verbose version of #RMalke answer and that answer should be marked as the answer.
I realise this is years later, but for anyone else looking, I found that the quickest way was to copy cmd and corflags.exe into the same folder as the one you want to edit. Then run cmd as admin from there.

Editing and compiling install_name_tool

I want to add an LC_LOADDYLIB command to my mach o binary file present inside the ipa file. The install_name_tool is used to change any existing library linked to another library. I want to add a new library to the ipa. So i thought if I edit the install_name_tool.c file i will be able to add this functionality. I downloaded the cctools project from Apple open source. The problem is that I am not able to compile the c file. I am getting errors. Can anyone please suggest any solution to link libraries to IPA or compile install_name_tool file.
Install the Xcode command line tools, and you should be able to compile it.
install_name_tool can only do in place editing of library paths in existing LC_LOAD_DYLIB commands. Adding a command requires you to do a lot more...

Adding CORE PLOT HEADER to the XCODE PROJECT

I can't seem to make Xcode find the Core Plot header. I've done the following:
Clone the hg repo;
Drag the CorePlot-CocoaTouch.xcodeproj file into my project;
Opened the CP project and compiled it successfully;
Dragged the lib file into the target's static link list;
Added CorePlot-CocoaTouch as a direct dependency for the target.
But I'm still getting the "CorePlot-CocoaTouch.h: No such file or directory" error on compile. I've been googling around trying to find an answer, but only seem to find a few people having the same problem but no clear solution. What have I missed?
Please help me getting out of it.....
Thanks
Make sure your header search paths contain a reference to the core-plot source directory.
In your targets Build Settings set Header Search Paths to the core-plot/framework directory. For example when your core-plot directory is placed next to your project directoy the search path would contain a value of ../core-plot/framework/** (I'm using a recursive reference here, thus the ** at the end).
Do not miss :-
1-Do not forget to add the library to Target dependance under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.
2- Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.
3 Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions). -Header Search Paths : you must put the relative path for libCorePlot-CocoaTouch.a and it is too much important to check the recursive check-box.
Finally the following link may can help you...
http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications
maybe this blog might help more than the google source page of CorePlot.
For newbies it might be helpful to use the mac shell to get the relative path of the libCorePlot-CocoaTouch.a. Just open the Terminal and insert following line:
mdfind -name libCorePlot-CocoaTouch.a
you will get listed all paths that contain the file named "libCorePlot-CocoaTouch.a"

Resources