I am working with RavenDb and am stuck at a brick wall.
I had an old class that I was persisting and it was all working fine. But during development I added an additional property to this class. Now when I persist the class all the old properties get persisted but the new property added is not appearing when I brows the repository using web browser.
Is there anything specific that needs to be done if the class changes for raven to serialise this new property?
I am on version 426.
User544550,
If you have [DataMember] properties, it will use those and ignore anything not marked with [DataMember]
Either remove all [DataMember] attributes, or add [DataMember] to the new prop.
Related
So I'm attempting to add localization to the UWP application I'm working on. From what I've researched online I'm able to add it using the Mulitlingual App Toolkit. The one issue I run into is duplicate values in the resource file. For example imagine I need to label 2 different controls with the same value. The controls are a button (using the property button.Content) and a text block (using textBlock.Text). I'd like to only have one name/value pair in the resource file that can be used for both of these controls. Is there a way to do this? Also I'd like to be able to set these values in xaml. Thanks in advance.
Localization for UWP in general
First, the default way of internationalization (i18n) and localization (l10n) is by using different .resw (or .resx for other environments like Xamarin) per language. In these files you store translated strings with some identifier key.
The Mulitlingual App Toolkit is a tool to facilitate and somewhat manage (e.g. tracking review status) the surrounding processes of actually translating the strings with people that possibly are not part of the actual dev team. But in the end, it too just generates the .resw files like you could have done manually. So you don't HAVE to use the MAT in order to localize your App.
Implementing it
The way to achieve what you want would be to use some sort of Binding.
I personally like to use a custom markup extension to be able to distinguish between actual dynamic data and hardcoded internationalized strings. Furthermore it keeps the Binding short. This would then look something like Title="{i18n:Translate GlossaryPageTitle}".
Unfortunately, Markup Extensions don't seem to be available in UWP as of yet (source).
So the way to go (simpler anyway) is to use a Converter and pass the Key for the desired Text as a parameter.
Like this:
Title="{x:Bind Converter={StaticResource LocalizationConverter}, ConverterParameter=GlossaryPageTitle}".
Where the implementation of the converter would look like this:
public class LocalizationConverter : IValueConverter
{
private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForViewIndependentUse("/Resources");
public object Convert(object value, Type targetType, object parameter, string language)
{
if (parameter is string resourceId)
{
return _resourceLoader.GetString(resourceId);
}
return DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotSupportedException();
}
}
Then register the Converter somewhere in your App (either per view or globally) and you're good to go.
"Base class <baseclassname1> specified for class
'' cannot be different from the base class
'' of one of its other partial types"
The problem is that I only declared the class in one place, the actual class file, and only declared it once, non partially.
All my other classes that inherit from "DialogBase" work fine, but one file with the most code just stopped working.
What else could be the problem? Could it be declared partial somewhere else?
Class CostDialog inherits DialogBase(This works fine)
Class Blend inherits DialogBase(This errors)
Blend is only written as Public Class Blend in the Blend.vb file ONCE
This error makes no sense
You may have multiple code behind files with the same class name. I was converting a web site to a web application and found that there were two instances of Home. So Project/abc/home.aspx /aspx.vb and Project/def/home.aspx/ /aspx.vb will cause a conflict if both home.aspx.vb files have the same class name.
My fix was to leave all the file names untouched but modify the class name to abc_home and def_home in their respective code behind file and then change the Inherits property at the top of their .aspx pages.
Highly doubt this is still an issue for you, but maybe for someone else.
I'm trying to create a virtual wiki but I already struggle with
In your Class Editor, create a new class called "XWikiServerClass"
Further reading in the DevGuide / DataModel shows that I'm not alone. I understand the words saying but I don't get the how-to as there is no option in the class-editior of creating new classes. Navigating to class editor shows an info box
No class is defined in this wiki document. You can create one by adding properties from the panel on your right, or you can choose another class to edit from the list below.
Ok, I added 'XWikiServerClass' and would have expected to be able to add a type class but that's not possible. I've tried a few properties but nothing shows up as a class in class editor.
Can you give more info on how you set up your wiki ?
As far as I know, you should have installed xwiki-enterprise-manager-web-x.y.war and modify your setup to fit your needs.
Second, you should have imported "xwiki-enterprise-manager-wiki-administrator-x.y.xar into your empty instance.
This xar archive already contains the XWikiServerClass and a very handy set of pages to automate the creation of virtual wikis.
I'm developing a plugin that takes all enums in workspace that implements certain interface (IDomain) parses the code (Using AST) does some modification over the enum and marks it as processed with an annotation (#IDomainInfo).
For example, it takes someting like this:
public
enum SomeEnum implements IDomain {
// ...
}
And generates something like this:
public #IDomainInfo(domainId = 1)
enum SomeEnum implements IDomain {
// Some changes here...
}
The idea behind of the #IDomainInfo is that annotated enums have not to be processed anymore by the plugin.
Basically what I do to accomplish the task is to make a search with JavaSearch API to find all the enums implementing IDomain (easy task), and as result I get a list of IJavaElements (which are in fact instances of IType). Then I call a method that iterates through the resulting list and creates a new list of all the IType instances that are not annotated with #IDomainInfo and then process the resulting list: For each non annotated IType do some work, annotate the IType with the #IDomainInfo annotation (Using AST) and then save back the results to file (using IFile, so I can see the changes without refresh, and in fact, if I have the enum open in the editor I see it refreshed instantly :-)
All that works fine, but if I open an #IDomainInfo annotated enum (just for testing) then remove the #IDomainInfo, save the file (I'm sure) and then call the action that does all the job I've described before, when I get to the part that filters annotated IType from non annotated ones, code is something like this:
for (IType type : typeList) {
IAnnotation annotation = type.getAnnotation(“IDomainInfo”);
if (!annotation.exists()) {
// The annotation does not exist, so add the type to the
// list of elements to update and go on...
ret.add(type);
continue;
}
// Something else here...
}
Well, it results that for the file I've just saved the IType detects the annotation I've just removed as if it's still there. If I close and reopen eclipse all works normally.
Now, I've just checked and triple checked my code, so I'm sure that I'm not keeping a stale copy of the old IType unedited still with the annotation version (all my IType come from a fresh java search call every time I run the action).
So the question is, what might I be doing wrong? I mean, I've just read the JavaCore API many times to check If I might be using it wrong or if I have some conceptual flaw there but really I have no clue, it's like if eclipse would be caching the IType ignoring the changes I've just made in the editor :-/
If any one have an idea I would appreciate it a lot :-)
When or how is your plugin called ? Did you register a resource listener or is it a project builder or something else ? If it is called by a resource listener, your plugin may be reading the 'primary copy' for your IType, which has not been saved yet. Hence your changes are still in the Working Copy.
Why can't I create a class in VB.NET that inherits System.IO.Directory? According to Lutz Roeder, it is not declared as NotInheritable!
I want to create a utility class that adds functionality to the Directory class. For instance, I want to add a Directory.Move function.
Please advise and I will send you a six pack. OK nevermind I'm not sending you anything but if you come to the bar tonight I will hook you up and then beat you in pool.
From the Meta Data of .NET
namespace System.IO
{
// Summary:
// Exposes static methods for creating, moving, and enumerating through directories
// and subdirectories. This class cannot be inherited.
[ComVisible(true)]
public static class Directory
You cannot inherit from a Static Class.
Are you using C# 3.0 VB.NET 2008 -- then you could add an Extension Method
If you use the DirectoryInfo class, you will have access to a MoveTo function.
EDIT: I'll correct myself... The static Directory class already has a Move method.
I'd guess that Reflector isn't picking up the sealed attribute correctly for VB (or perhaps just not displaying it properly). If you look at the IL, it is sealed:
class public abstract auto ansi sealed beforefieldinit Directory