Need VB.NET Resource Files clarification - vb.net

In a VB project I can add a resource via the project properties resources tab, or I can right-click the project in the solution explorer, click add, then click add existing item.
What are the differences?
If I want to add a DLL file and include it as an embedded resource, do I have to add the file via both methods? Only one?
Thanks.

What you are describing is linked and embedded resources.
Check out this page which describes the differences:
Linked vs. Embedded Resources
From the MSDN link above:
Embedded Resources
Embedded resources are the best choice if you need to share application resource (.resx) files between multiple projects.
For example, if you have a common resource file that contains your company's logos, trademark information, and such, using embedded resources means you only have to copy the .resx file and not the associated resource data files.
You cannot edit embedded resources directly. If you try to edit an embedded resource, you will receive a message prompting you to convert the item to a linked resource in order to edit it; conversion is recommended but optional. You must export them, make your modifications in an external program, and then import them back into your project.
Linked Resources
Linked resources (the default) are the best choice for ease of use.
Resources can be edited directly inside the project, and you can easily add or remove resources as needed.
Edit
You would only need to add your DLL using one method. Which one you select depends on which method best fits your needs (as per the descriptions above)

Related

Programmatically set default column values based on folder in SharePoint Online

I'm working on enhancing metadata in our SharePoint online (O365) environment. Since a portion of my user base is used to foldering (explorer style), I've started using default column values to automatically set values on any files added to that specific folder (we have content organized categorically by folder currently). An example is our HR documents library - we have separate folders for recruiting, payroll, personnel files, etc. that automatically categorize files added to that folder with the same categories (recruiting, payroll, personnel, etc.). This supports both "search" and "click" users and makes adoption WAY easier while getting important metadata.
I want to implement this in a larger, more dynamic fashion, so manually setting default column values on each folder is not going to be scalable.
How can I reference the top level folder within the library (or even the current folder) for each newly added file and populate the "category" field for that new file with that folder name? I can do some very basic C# or Java code copy/paste, but bonus points for non-coding solutions =)
This problem can be solved through no coding.You can use the workflow to implement this by SharePoint Designer.
Create different view for different function team, and then use the view filter to show the document.
If you upload a file, use the workflow to set the metadata of the file. There are some known limitations: if you upload multiple files at the same time, the metadata for the file maybe does not work well; or if you upload a folder, the meta will not work for it and the file in the folder may not be set to right metadata.
I was actually able to use MS Flow to accomplish this in a pretty simple and straightforward fashion without managing custom views per team. The concept at a high level was:
(Trigger) When a new document is created in a folder in the library
Get the link of the parent folder of the newly added document
Create a variable (or just code it out in the Flow step) to parse out the name of the parent folder from the parent folder link (should be all text to the right of the last "/")
Set the category field as the variable
I'm sure that you could do the same right in a SharePoint designer workflow, but I prefer flow due to the visual aspect of it and being far easier to troubleshoot.

vb.net linked vs embedded resources weird result - VS 2017 CE

This suppose to be a simple issue; not to be posted as a question in stack overflow!
Following this article: How to: Create Embedded Resources
I had created a new and fresh Form1.vb to test in Visual Studio 2017 community edition.
Added a big testfile.WAV file as a test resource.
Checked the link type is set to default value: "Linked at compile
time" Default Value.
Clean/Build/Rebuild the application.
Still no matter what I do, the result.exe file is so big and reflect the big testfile.wav file size, and can't at any situation find the wav file as a linked resources in separate file in bin\Debug folder!
Tried to alter almost everything everywhere; yet no success!
What I expect is to have both result.exe and testfile.wav in bin\Debug folder separately linked and not embedded.
Looks very weird to me? is it a bug in VS or in app setting?
Thank you so much
Appreciated any hint
Note: What I was trying to reach is to create a different themes for my application, where users can chose the appearance; and my efforts break in the above scenario. It doesn't make sense that result.exe ends in 10s of MB if it will include resources inside it!
TL;DR: If you want it as a loose file then you need to have it as a loose file. Resources are always embedded in the application.
If you add the resource via Project Properties > Resources then it will always be embedded in your application.
If you want it as a loose file then you shall just import it to your project via Add Existing Item and set the Copy to Output Directory property of the item to Copy Always. Then you reference it by doing for example:
Dim WavPath As String = Path.Combine(Application.StartupPath, "yourfile.wav")
Dim WavFile As Byte() = File.ReadAllBytes(WavPath)
Linked vs Embedded only make a difference at design time. Linked resources are still embedded in your application, but at design time you may edit them and can easily add or remove other resources.
Embedded resources however are embedded in a .resx file even at design time, and to edit such resources you have to export them or change them into a linked resource. Embedded resources are mostly used when you need to share the same resources in multiple projects. The resources are then embedded in the .resx file so you only need to copy that and not every included file.

Xpages : Possible to inherit all Select 2 components

I have got Select2 working. Awesome, awesome component.
We have a db with some common elements which we inherit to databases. I would like to add Select2 to this db, so it will be easily available to databases, but don't know how to do that, as you have to put some items in the package explorer.
Any way to do this?
It is possible if you inherit the whole template:
create a database with all design elements you want to have as default in a database including Select2 parts in WebContent folder
define this database as template "CommonElements" (or another unique template name) in database properties
define the template "CommonElements" as "Inherit design from master template" in every database where those design elements are needed
and make sure that every additional design element has set "Prohibit design refresh"
or inherits from a design template.
In case you have additional elements in WebContent folder set "Prohibit design refresh" flag to those design elements with File > Application > Set Prohibit Refresh Properity... too
All design elements including all WebContent folders are inherited from master template when you execute File > Application > Refresh Design... or when designer process runs on server.
I don't think that is possible. You could set up a central "resources.nsf" with the select2 components and load all the resources you need (manually) from all other databases.
Unless your users do not have internet access (either fire-walled or offline) you may as well just use a CDN. That way all your users will have a cached version of the download library on all of your sites and you don't have to worry about hosting it somehow.
https://cdnjs.com/libraries/select2
for example
It might also be worth looking at the Import and Export from Domino Designer project on OpenNTF. It allows you to create an portlist.xml file, which tells the plugin which files to import. It still requires a manual action to import, but will allow you to overwrite files.
Although using plugins is the place to aim to get to, this is a perfectly valid and good practice method for handling copying all relevant files into an NSF. It's used in XPages OpenLog Logger project on OpenNTF, for the NSF-based option.

NSBundle, can it be used to save a project document?

I'm building a Mac OS X application that can be used to create 'projects'. When a user saves a project, they will be saving many resources: image files, text files, sqlite files etc.
I can either create a folder in Documents for each project, and within that folder I can place all the project assets, and just include a single project file that is used to open the project.
I've read about NSBundle which I'd like to use. But I've only read about them in the context of application bundles. Is it possible to use NSBundle in this way? Where the user only sees a single file, and can move it wherever they like.
Does it make sense to do what I'm trying, using NSBundle? Or is there another way to do this?
(I'm fairly new to MacOS X programming)
UPDATE
I believe iPhoto uses this method to store the "iPhoto Library", this is what I'd like to do with my application, is NSBundle what I should be looking into?
Yes, it is possible and was used in quite a few apps in the past. The method is described in this document. Once it's clearly declared in your app's Info.plist, Finder will show the resulting bundle as one file.
However, I can't recommend you to do that. Apple's own Keynote was using the bundle approach in the past, but it no longer uses it any more. Similarly, OmniGraffle (which is a diagramming app on OS X with a long history) used bundles to save projects, but it stopped doing that, too.
The reason is that the bundle is still seen as a directory by the non-Apple email software, or any browser, etc, although the Finder shows it as a file. It would be a mess if a user wants to attach your document in the bundle format to an email s/he is composing in Gmail inside a browser, say. That confused a lot of people.
So, it's possible, but I don't recommend it. One way out is to use the zipped bundle as the user-visible file, and to unzip it when the user opens it into a temporary directory. Then you can use NSBundle and/or NSFileWrapper apis to access files inside it.
Apple's File Wrapper sample seems to be what you want:
http://developer.apple.com/library/mac/#samplecode/PersistentDocumentFileWrappers/Introduction/Intro.html
It also demonstrates how to save a Core Data persistent store in the bundle. You can leave that part out if you just want to store resources.
The NSBundle class represents the application bundle, and can be used to access resources within the applicationm but you would you it for application data, not user data.
For each of the resources you mention, there's a way of saving this type, for example, for image files, you could use NSData to save the image data to disk, and for text files you could use the method writeToFile:atomically:encoding:error:.
You may very well want to take a look at Core Data (http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/CoreData/cdProgrammingGuide.html), a very good framework for managing the user's data model, to see if this would fit your needs.

Is _mmServerScripts necessary?

When developing sites using Dreamweaver, it creates a _mmServerScripts directory on the root of your site. We've been reading that this folder contains SQL statements that are vulnerable to attack. We would like to avoid this all together, if possible. Is this folder even necessary? Can you do anything to Dreamweaver to tell it to never create these folders?
Thanks in advance.
When you're creating dynamic pages with Dreamweaver, it creates files in the _mmServerScripts folder. Those files are used to obtain information about your database, such as table names, table columns, and column types. This information is used within the built-in server behaviors (and possibly third-party extensions) in order to generate the appropriate code to insert into your page. One such server behavior would be the Recordset server behavior. This interface allows you to select a data source, table name, and column names to include in the recordset.
If you do not use any of the dynamic data functions within Dreamweaver, it probably does not create the _mmServerScripts folder, but if you use that functionality, it will create that folder. If you want to remove the files in this folder, which is hidden within the Dreamweaver Files panel by default (show hidden files: Files panel option menu on the upper right of the panel, View -> Show Hidden Files) by selecting:
Site -> Advanced -> Remove Connection Scripts
I do not have a very extensive knowledge of the contents of the files, so I can't comment knowledgeably about what, if any, vulnerabilities exist within the files within the folder, but it would be good to include links to such discussions you've been reading about.