Search Results

Search found 409 results on 17 pages for 'your displayname here!'.

Page 7/17 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Syncronizing mobile phone contacts with contacts from social networks

    - by Pentium10
    I retrieve a JSON list of contacts from a social network site. It contains firstname, lastname, displayname, data1, data2, etc... What is the efficient way to quickly lookup my local phone contacts database and "match" them based on their name. Since there are firstname, lastname and displayname this can vary. What do you think, how can the best match be achieved? Also how do I make sure I don't parse for each JSON item the whole database I want to avoide having JSON_COUNT x MOBILE COUNT steps.

    Read the article

  • Parsing Complex Text File with C#

    - by David
    Hello, I need to parse a text file that has a lot of levels and characters. I've been trying different ways to parse it but I haven't been able to get anything to work. I've included a sample of the text file I'm dealing with. Any suggestions on how I can parse this file? I have denoted the parts of the file I need with TEXTINEED. (bean name: 'TEXTINEED context: (list '/text '/content/home/left-nav/text '/content/home/landing-page) type: '/text/types/text module: '/modules/TEXTINEED source: '|moretext| ((contents (list (list (bean type: '/directory/TEXTINEED ((directives (bean ((chartSize (list 600 400)) (showCorners (list #f)) (showColHeader (list #f)) (showRowHeader (list #f))))))) (bean type: '/directory/TEXTINEED ((directives (bean ((displayName (list "MTD")) (showCorners (list #f)) (showColHeader (list #f)) (showRowLabels (list #f)) (hideDetailedLink (list #t)) (showRowHeader (list #f)) (chartSize (list 600 400))))))) (bean type: '/directory/TEXTINEED ((directives (bean ((displayName (list "QTD")) (showCorners (list #f)) (showColHeader (list #f)) (showRowLabels (list #f)) (hideDetailedLink (list #t)) (showRowHeader (list #f)) (chartSize (list 600 400)))))))) Thanks!

    Read the article

  • Trouble with ASP.NET MVC auto-scaffolder template

    - by DanM
    I'm trying to write an auto-scaffolder template for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IQueryable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. Here's what I have so far: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; // How do I make this generic? var properties = items.First().GetMetadata().Properties .Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)); %> <table> <tr> <% foreach(var property in properties) { %> <th> <%= property.DisplayName %> </th> <% } %> </tr> <% foreach(var item in items) { HtmlHelper itemHtml = ????; // What should I put in place of "????"? %> <tr> <% foreach(var property in properties) { %> <td> <%= itemHtml.Display(property.DisplayName) %> </td> <% } %> </tr> <% } %> </table> Two problems with this: I'd like it to be generic. So, I'd like to replace var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; with var items = (IQueryable<T>)Model; or something to that effect. A property Html is automatically created for me when the view is created, but this HtmlHelper applies to the whole collection. I need to somehow create an itemHtml object that applies just to the current item in the foreach loop. I'm not sure how to do this, however, because the constructors for HtmlHelper don't take a Model object. How do I solve these two problems?

    Read the article

  • How to use email adresses with special chars such as Ø

    - by Sir Code-A-Lot
    By writing this: var recipient = new MailAddress("name@abcø.dk"); Notice the "ø" in the domain part. I get an exception stating: System.FormatException: The specified string is not in the form required for an e-mail address. at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) at System.Net.Mail.MailAddress.ParseValue(String address) at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) at System.Net.Mail.MailAddress..ctor(String address) The address used should be perfectly valid. So I'm guessing I have to encode the address somehow?

    Read the article

  • How to create item in SharePoint2010 document library using SharePoint Web service

    - by ybbest
    Today, I’d like to show you how to create item in SharePoint2010 document library using SharePoint Web service. Originally, I thought I could use the WebSvcLists(list.asmx) that provides methods for working with lists and list data. However, after a bit Googling , I realize that I need to use the WebSvcCopy (copy.asmx).Here are the code used private const string siteUrl = "http://ybbest"; private static void Main(string[] args) { using (CopyWSProxyWrapper copyWSProxyWrapper = new CopyWSProxyWrapper(siteUrl)) { copyWSProxyWrapper.UploadFile("TestDoc2.pdf", new[] {string.Format("{0}/Shared Documents/TestDoc2.pdf", siteUrl)}, Resource.TestDoc, GetFieldInfos().ToArray()); } } private static List<FieldInformation> GetFieldInfos() { var fieldInfos = new List<FieldInformation>(); //The InternalName , DisplayName and FieldType are both required to make it work fieldInfos.Add(new FieldInformation { InternalName = "Title", Value = "TestDoc2.pdf", DisplayName = "Title", Type = FieldType.Text }); return fieldInfos; } Here is the code for the proxy wrapper. public class CopyWSProxyWrapper : IDisposable { private readonly string siteUrl; public CopyWSProxyWrapper(string siteUrl) { this.siteUrl = siteUrl; } private readonly CopySoapClient proxy = new CopySoapClient(); public void UploadFile(string testdoc2Pdf, string[] destinationUrls, byte[] testDoc, FieldInformation[] fieldInformations) { using (CopySoapClient proxy = new CopySoapClient()) { proxy.Endpoint.Address = new EndpointAddress(String.Format("{0}/_vti_bin/copy.asmx", siteUrl)); proxy.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; proxy.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; CopyResult[] copyResults = null; try { proxy.CopyIntoItems(testdoc2Pdf, destinationUrls, fieldInformations, testDoc, out copyResults); } catch (Exception e) { System.Console.WriteLine(e); } if (copyResults != null) System.Console.WriteLine(copyResults[0].ErrorMessage); System.Console.ReadLine(); } } public void Dispose() { proxy.Close(); } } You can download the source code here . ******Update********** It seems to be a bug that , you can not set the contentType when create a document item using Copy.asmx. In sp2007 the field type was Choice, however, in sp2010 it is actually Computed. I have tried using the Computed field type with no luck. I have also tried sending the ContentTypeId and this does not work.You might have to write your own web services to handle this.You can check my previous blog on how to get started with you own custom WCF in SP2010 here. References: SharePoint 2010 Web Services SharePoint2007 Web Services SharePoint MSDN Forum

    Read the article

  • View Clipboard & Copy To Clipboard from NetBeans IDE

    - by Geertjan
    Thanks to this code, I can press Ctrl-Alt-V in NetBeans IDE and then view whatever is in the clipboard: import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JOptionPane; import org.openide.awt.ActionRegistration; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.awt.ActionID; import org.openide.util.NbBundle.Messages; @ActionID( category = "Tools", id = "org.demo.ShowClipboardAction") @ActionRegistration( displayName = "#CTL_ShowClipboardAction") @ActionReferences({ @ActionReference(path = "Menu/Tools", position = 5), @ActionReference(path = "Shortcuts", name = "DA-V") }) @Messages("CTL_ShowClipboardAction=Show Clipboard") public final class ShowClipboardAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, getClipboard(), "Clipboard Content", 1); } public String getClipboard() { String text = null; Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); try { if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) { text = (String) t.getTransferData(DataFlavor.stringFlavor); } } catch (UnsupportedFlavorException e) { } catch (IOException e) { } return text; } } And now I can also press Ctrl-Alt-C, which copies the path to the current file to the clipboard: import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.awt.ActionRegistration; import org.openide.awt.StatusDisplayer; import org.openide.loaders.DataObject; import org.openide.util.NbBundle.Messages; @ActionID( category = "Tools", id = "org.demo.CopyPathToClipboard") @ActionRegistration( displayName = "#CTL_CopyPathToClipboard") @ActionReferences({ @ActionReference(path = "Menu/Tools", position = 0), @ActionReference(path = "Editors/Popup", position = 10), @ActionReference(path = "Shortcuts", name = "DA-C") }) @Messages("CTL_CopyPathToClipboard=Copy Path to Clipboard") public final class CopyPathToClipboardAction implements ActionListener { private final DataObject context; public CopyPathToClipboardAction(DataObject context) { this.context = context; } @Override public void actionPerformed(ActionEvent e) { String path = context.getPrimaryFile().getPath(); StatusDisplayer.getDefault().setStatusText(path); StringSelection ss = new StringSelection(path); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(ss, null); } }

    Read the article

  • Superclass Sensitive Actions

    - by Geertjan
    I've created a small piece of functionality that enables you to create actions for Java classes in the IDE. When the user right-clicks on a Java class, they will see one or more actions depending on the superclass of the selected class. To explain this visually, here I have "BlaTopComponent.java". I right-click on its node in the Projects window and I see "This is a TopComponent": Indeed, when you look at the source code of "BlaTopComponent.java", you'll see that it implements the TopComponent class. Next, in the screenshot below, you see that I have right-click a different class. In this case, there's an action available because the selected class implements the ActionListener class. Then, take a look at this one. Here both TopComponent and ActionListener are superclasses of the current class, hence both the actions are available to be invoked: Finally, here's a class that subclasses neither TopComponent nor ActionListener, hence neither of the actions that I created for doing something that relates to TopComponents or ActionListeners is available, since those actions are irrelevant in this context: How does this work? Well, it's a combination of my blog entries "Generic Node Popup Registration Solution" and "Showing an Action on a TopComponent Node". The cool part is that the definition of the two actions that you see above is remarkably trivial: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import org.openide.loaders.DataObject; import org.openide.util.Utilities; public class TopComponentSensitiveAction implements ActionListener { private final DataObject context; public TopComponentSensitiveAction() { context = Utilities.actionsGlobalContext().lookup(DataObject.class); } @Override public void actionPerformed(ActionEvent ev) { //Do something with the context: JOptionPane.showMessageDialog(null, "TopComponent: " + context.getNodeDelegate().getDisplayName()); } } The above is the action that will be available if you right-click a Java class that extends TopComponent. This, in turn, is the action that will be available if you right-click a Java class that implements ActionListener: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import org.openide.loaders.DataObject; import org.openide.util.Utilities; public class ActionListenerSensitiveAction implements ActionListener { private final DataObject context; public ActionListenerSensitiveAction() { context = Utilities.actionsGlobalContext().lookup(DataObject.class); } @Override public void actionPerformed(ActionEvent ev) { //Do something with the context: JOptionPane.showMessageDialog(null, "ActionListener: " + context.getNodeDelegate().getDisplayName()); } } Indeed, the classes, at this stage are the same. But, depending on what I want to do with TopComponents or ActionListeners, I now have a starting point, which includes access to the DataObject, from where I can get down into the source code, as shown here. This is how the two ActionListeners that you see defined above are registered in the layer, which could ultimately be done via annotations on the ActionListeners, of course: <folder name="Actions"> <folder name="Tools"> <file name="org-netbeans-sbas-impl-TopComponentSensitiveAction.instance"> <attr stringvalue="This is a TopComponent" name="displayName"/> <attr name="instanceCreate" methodvalue="org.netbeans.sbas.SuperclassSensitiveAction.create"/> <attr name="type" stringvalue="org.openide.windows.TopComponent"/> <attr name="delegate" newvalue="org.netbeans.sbas.impl.TopComponentSensitiveAction"/> </file> <file name="org-netbeans-sbas-impl-ActionListenerSensitiveAction.instance"> <attr stringvalue="This is an ActionListener" name="displayName"/> <attr name="instanceCreate" methodvalue="org.netbeans.sbas.SuperclassSensitiveAction.create"/> <attr name="type" stringvalue="java.awt.event.ActionListener"/> <attr name="delegate" newvalue="org.netbeans.sbas.impl.ActionListenerSensitiveAction"/> </file> </folder> </folder> <folder name="Loaders"> <folder name="text"> <folder name="x-java"> <folder name="Actions"> <file name="org-netbeans-sbas-impl-TopComponentSensitiveAction.shadow"> <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-sbas-impl-TopComponentSensitiveAction.instance"/> <attr intvalue="150" name="position"/> </file> <file name="org-netbeans-sbas-impl-ActionListenerSensitiveAction.shadow"> <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-sbas-impl-ActionListenerSensitiveAction.instance"/> <attr intvalue="160" name="position"/> </file> </folder> </folder> </folder> </folder> The most important parts of the layer registration are the lines that are highlighted above. Those lines connect the layer to the generic action that delegates back to the action listeners defined above, as follows: public final class SuperclassSensitiveAction extends AbstractAction implements ContextAwareAction { private final Map map; //This method is called from the layer, via "instanceCreate", //magically receiving a map, which contains all the attributes //that are defined in the layer for the file: static SuperclassSensitiveAction create(Map map) { return new SuperclassSensitiveAction(Utilities.actionsGlobalContext(), map); } public SuperclassSensitiveAction(Lookup context, Map m) { super(m.get("displayName").toString()); this.map = m; String superclass = m.get("type").toString(); //Enable the menu item only if //we're dealing with a class of type superclass: JavaSource javaSource = JavaSource.forFileObject( context.lookup(DataObject.class).getPrimaryFile()); try { javaSource.runUserActionTask(new ScanTask(this, superclass), true); } catch (IOException ex) { Exceptions.printStackTrace(ex); } //Hide the menu item if it isn't enabled: putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true); } @Override public void actionPerformed(ActionEvent ev) { ActionListener delegatedAction = (ActionListener)map.get("delegate"); delegatedAction.actionPerformed(ev); } @Override public Action createContextAwareInstance(Lookup actionContext) { return new SuperclassSensitiveAction(actionContext, map); } private class ScanTask implements Task<CompilationController> { private SuperclassSensitiveAction action = null; private String superclass; private ScanTask(SuperclassSensitiveAction action, String superclass) { this.action = action; this.superclass = superclass; } @Override public void run(final CompilationController info) throws Exception { info.toPhase(Phase.ELEMENTS_RESOLVED); new EnableIfGivenSuperclassMatches(info, action, superclass).scan( info.getCompilationUnit(), null); } } private static class EnableIfGivenSuperclassMatches extends TreePathScanner<Void, Void> { private CompilationInfo info; private final AbstractAction action; private final String superclassName; public EnableIfGivenSuperclassMatches(CompilationInfo info, AbstractAction action, String superclassName) { this.info = info; this.action = action; this.superclassName = superclassName; } @Override public Void visitClass(ClassTree t, Void v) { Element el = info.getTrees().getElement(getCurrentPath()); if (el != null) { TypeElement te = (TypeElement) el; List<? extends TypeMirror> interfaces = te.getInterfaces(); if (te.getSuperclass().toString().equals(superclassName)) { action.setEnabled(true); } else { action.setEnabled(false); } for (TypeMirror typeMirror : interfaces) { if (typeMirror.toString().equals(superclassName)){ action.setEnabled(true); } } } return null; } } } This is a pretty cool solution and, as you can see, very generic. Create a new ActionListener, register it in the layer so that it maps to the generic class above, and make sure to set the type attribute, which defines the superclass to which the action should be sensitive.

    Read the article

  • Xml failing to deserialise

    - by Carnotaurus
    I call a method to get my pages [see GetPages(String xmlFullFilePath)]. The FromXElement method is supposed to deserialise the LitePropertyData elements to strongly type LitePropertyData objects. Instead it fails on the following line: return (T)xmlSerializer.Deserialize(memoryStream); and gives the following error: <LitePropertyData xmlns=''> was not expected. What am I doing wrong? I have included the methods that I call and the xml data: public static T FromXElement<T>(this XElement xElement) { using (var memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(xElement.ToString()))) { var xmlSerializer = new XmlSerializer(typeof(T)); return (T)xmlSerializer.Deserialize(memoryStream); } } public static List<LitePageData> GetPages(String xmlFullFilePath) { XDocument document = XDocument.Load(xmlFullFilePath); List<LitePageData> results = (from record in document.Descendants("row") select new LitePageData { Guid = IsValid(record, "Guid") ? record.Element("Guid").Value : null, ParentID = IsValid(record, "ParentID") ? Convert.ToInt32(record.Element("ParentID").Value) : (Int32?)null, Created = Convert.ToDateTime(record.Element("Created").Value), Changed = Convert.ToDateTime(record.Element("Changed").Value), Name = record.Element("Name").Value, ID = Convert.ToInt32(record.Element("ID").Value), LitePageTypeID = IsValid(record, "ParentID") ? Convert.ToInt32(record.Element("ParentID").Value) : (Int32?)null, Html = record.Element("Html").Value, FriendlyName = record.Element("FriendlyName").Value, Properties = record.Element("Properties") != null ? record.Element("Properties").Element("LitePropertyData").FromXElement<List<LitePropertyData>>() : new List<LitePropertyData>() }).ToList(); return results; } Here is the xml: <?xml version="1.0" encoding="utf-8"?> <root> <rows> <row> <ID>1</ID> <ImageUrl></ImageUrl> <Html>Home page</Html> <Created>01-01-2012</Created> <Changed>01-01-2012</Changed> <Name>Home page</Name> <FriendlyName>home-page</FriendlyName> </row> <row xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Guid>edeaf468-f490-4271-bf4d-be145bc6a1fd</Guid> <ID>8</ID> <Name>Unused</Name> <ParentID>1</ParentID> <Created>2006-03-25T10:57:17</Created> <Changed>2012-07-17T12:24:30.0984747+01:00</Changed> <ChangedBy /> <LitePageTypeID xsi:nil="true" /> <Html> What is the purpose of this option? This option checks the current document for accessibility issues. It uses Bobby to provide details of whether the current web page conforms to W3C's WCAG criteria for web content accessibility. Issues with Bobby and Cynthia Bobby and Cynthia are free services that supposedly allow a user to expose web page accessibility barriers. It is something of a guide but perhaps a blunt instrument. I tested a few of the webpages that I have designed. Sure enough, my pages fall short and for good reason. I am not about to claim that Bobby and Cynthia are useless. Although it is useful and commendable tool, it project appears to be overly ambitious. Nevertheless, let me explain my issues with Bobby and Cynthia: First, certain W3C standards for designing web documents are often too strict and unworkable. For instance, in some versions W3C standards for HTML, certain tags should not include a particular attribute, whereas in others they are requisite if the document is to be ???well-formed???. The standard that a designer chooses is determined usually by the requirements specification document. This specifies which browsers and versions of those browsers that the web page is expected to correctly display. Forcing a hypertext document to conform strictly to a specific W3C standard for HTML is often no simple task. In the worst case, it cannot conform without losing some aesthetics or accessibility functionality. Second, the case of HTML documents is not an isolated case. Standards for XML, XSL, JavaScript, VBScript, are analogous. Therefore, you might imagine the problems when you begin to combine these languages and formats in an HTML document. Third, there is always more than one way to skin a cat. For example, Bobby and Cynthia may flag those IMG tags that do not contain a TITLE attribute. There might be good reason that a web developer chooses not to include the title attribute. The title attribute has a limited numbers of characters and does not support carriage returns. This is a major defect in the design of this tag. In fact, before the TITLE attribute was supported, there was the ALT attribute. Most browsers support both, yet they both perform a similar function. However, both attributes share the same deficiencies. In practice, there are instances where neither attribute would be used. Instead, for example, the developer would write some JavaScript or VBScript to circumvent these deficiencies. The concern is that Bobby and Cynthia would not notice this because it does not ???understand??? what the JavaScript does. </Html> <FriendlyName>unused</FriendlyName> <IsDeleted>false</IsDeleted> <Properties> <LitePropertyData> <Description>Image for the page</Description> <DisplayEditUI>true</DisplayEditUI> <OwnerTab>1</OwnerTab> <DisplayName>Image Url</DisplayName> <FieldOrder>1</FieldOrder> <IsRequired>false</IsRequired> <Name>ImageUrl</Name> <IsModified>false</IsModified> <ParentPageID>3</ParentPageID> <Type>String</Type> <Value xsi:type="xsd:string">smarter.jpg</Value> </LitePropertyData> <LitePropertyData> <Description>WebItemApplicationEnum</Description> <DisplayEditUI>true</DisplayEditUI> <OwnerTab>1</OwnerTab> <DisplayName>WebItemApplicationEnum</DisplayName> <FieldOrder>1</FieldOrder> <IsRequired>false</IsRequired> <Name>WebItemApplicationEnum</Name> <IsModified>false</IsModified> <ParentPageID>3</ParentPageID> <Type>Number</Type> <Value xsi:type="xsd:string">1</Value> </LitePropertyData> </Properties> <Seo> <Author>Phil Carney</Author> <Classification /> <Copyright>Carnotaurus</Copyright> <Description> What is the purpose of this option? This option checks the current document for accessibility issues. It uses Bobby to provide details of whether the current web page conforms to W3C's WCAG criteria for web content accessibility. Issues with Bobby and Cynthia Bobby and Cynthia are free services that supposedly allow a user to expose web page accessibility barriers. It is something of a guide but perhaps a blunt instrument. I tested a few of the webpages that I have designed. Sure enough, my pages fall short and for good reason. I am not about to claim that Bobby and Cynthia are useless. Although it is useful and commendable tool, it project appears to be overly ambitious. Nevertheless, let me explain my issues with Bobby and Cynthia: First, certain W3C standards for designing web documents are often too strict and unworkable. For instance, in some versions W3C standards for HTML, certain tags should not include a particular attribute, whereas in others they are requisite if the document is to be ???well-formed???. The standard that a designer chooses is determined usually by the requirements specification document. This specifies which browsers and versions of those browsers that the web page is expected to correctly display. Forcing a hypertext document to conform strictly to a specific W3C standard for HTML is often no simple task. In the worst case, it cannot conform without losing some aesthetics or accessibility functionality. Second, the case of HTML documents is not an isolated case. Standards for XML, XSL, JavaScript, VBScript, are analogous. Therefore, you might imagine the problems when you begin to combine these languages and formats in an HTML document. Third, there is always more than one way to skin a cat. For example, Bobby and Cynthia may flag those IMG tags that do not contain a TITLE attribute. There might be good reason that a web developer chooses not to include the title attribute. The title attribute has a limited numbers of characters and does not support carriage returns. This is a major defect in the design of this tag. In fact, before the TITLE attribute was supported, there was the ALT attribute. Most browsers support both, yet they both perform a similar function. However, both attributes share the same deficiencies. In practice, there are instances where neither attribute would be used. Instead, for example, the developer would write some JavaScript or VBScript to circumvent these deficiencies. The concern is that Bobby and Cynthia would not notice this because it does not ???understand??? what the JavaScript does. </Description> <Keywords>unused</Keywords> <Title>unused</Title> </Seo> </row> </rows> </root> EDIT Here are my entities: public class LitePropertyData { public virtual string Description { get; set; } public virtual bool DisplayEditUI { get; set; } public int OwnerTab { get; set; } public virtual string DisplayName { get; set; } public int FieldOrder { get; set; } public bool IsRequired { get; set; } public string Name { get; set; } public virtual bool IsModified { get; set; } public virtual int ParentPageID { get; set; } public LiteDataType Type { get; set; } public object Value { get; set; } } [Serializable] public class LitePageData { public String Guid { get; set; } public Int32 ID { get; set; } public String Name { get; set; } public Int32? ParentID { get; set; } public DateTime Created { get; set; } public String CreatedBy { get; set; } public DateTime Changed { get; set; } public String ChangedBy { get; set; } public Int32? LitePageTypeID { get; set; } public String Html { get; set; } public String FriendlyName { get; set; } public Boolean IsDeleted { get; set; } public List<LitePropertyData> Properties { get; set; } public LiteSeoPageData Seo { get; set; } /// <summary> /// Saves the specified XML full file path. /// </summary> /// <param name="xmlFullFilePath">The XML full file path.</param> public void Save(String xmlFullFilePath) { XDocument doc = XDocument.Load(xmlFullFilePath); XElement demoNode = this.ToXElement<LitePageData>(); demoNode.Name = "row"; doc.Descendants("rows").Single().Add(demoNode); doc.Save(xmlFullFilePath); } }

    Read the article

  • SignalR cannot read property client of undefined

    - by polonskyg
    I'm trying to add SignalR to my project (ASPNET MVC 4). But I can't make it work. In the below image you can see the error I'm receiving. I've read a lot of stackoverflow posts but none of them is resolving my issue. This is what I did so far: 1) Ran Install-Package Microsoft.AspNet.SignalR -Pre 2) Added RouteTable.Routes.MapHubs(); in Global.asax.cs Application_Start() 3) If I go to http://localhost:9096/Gdp.IServer.Web/signalr/hubs I can see the file content 4) Added <modules runAllManagedModulesForAllRequests="true"/> to Web.Config 5) Created folder Hubs in the root of the MVC application 6) Moved jquery and signalR scripts to /Scripts/lib folder (I'm not using jquery 1.6.4, I'm using the latest) This is my Index.cshtml <h2>List of Messages</h2> <div class="container"> <input type="text" id="message" /> <input type="button" id="sendmessage" value="Send" /> <input type="hidden" id="displayname" /> <ul id="discussion"> </ul> </div> @section pageScripts { <!--Reference the SignalR library. --> <script src="@Url.Content("~/Scripts/jquery.signalR-1.0.0-rc1.min.js")" type="text/javascript"></script> <!--Reference the autogenerated SignalR hub script. --> <script type="text/javascript" src="~/signalr/hubs"></script> <script src="@Url.Content("~/Scripts/map.js")" type="text/javascript"></script> } This is my IServerHub.cs file (located inside Hubs folder) namespace Gdp.IServer.Ui.Web.Hubs { using Microsoft.AspNet.SignalR.Hubs; [HubName("iServerHub")] public class IServerHub : Hub { public void Send(string name, string message) { Clients.All.broadcastMessage(name, message); } } } And this is map.js $(function () { // Declare a proxy to reference the hub. var clientServerHub = $.connection.iServerHub; // Create a function that the hub can call to broadcast messages. clientServerHub.client.broadcastMessage = function (name, message) { $('#discussion').append('<li><strong>' + name + '</strong>:&nbsp;&nbsp;' + message + '</li>'); }; // Get the user name and store it to prepend to messages. $('#displayname').val(prompt('Enter your name:', '')); // Set initial focus to message input box. $('#message').focus(); // Start the connection. $.connection.hub.start().done(function () { $('#sendmessage').click(function () { // Html encode display name and message. var encodedName = $('<div />').text($('#displayname').val()).html(); var encodedMsg = $('<div />').text($('#message').val()).html(); // Call the Send method on the hub. clientServerHub.server.send(encodedName, encodedMsg); // Clear text box and reset focus for next comment. $('#message').val('').focus(); }); }); }); The DLL's I see references for SignalR are: Microsoft.AspNet.SignalR.Core Microsoft.AspNet.SignalR.Owin Microsoft.AspNet.SignalR.SystemWeb Any ideas how to get it work? Should I make any change because the scripts are in /Script/lib folder? NOTE I'm following the instruction found here on how to set up Windsor Castle to make it work with SignalR, and again, seems that the proxy cannot be created and I'm getting the same error: Cannot read property client of undefined meaning that the proxy to the hub was not created This is how I have it in the server public class IncidentServerHub : Hub and like this in the client var clientServerHub = $.connection.incidentServerHub; Again, I can see the dynamically created file here: /GdpSoftware.Server.Web/signalr/hubs So, Why the proxy is not created? Thanks in advance!!! Guillermo.

    Read the article

  • How to write a Mork File Format file in Java?

    - by Sumit Ghosh
    Iam working on a project which involves writing a Mork File (Mork is a database format used by Mozilla to store url history and other information.) It has been replaced by an enhanced version of SQLite in latest Mozilla 3.0. Now I have the code for parsing a Mork File , but Iam struggling a bit with this part of the the file. <(A9=3)(81=)([email protected])(80=0)(85=2)(86=4ac18267)(83=1) (87=Mark)(88=Colbath)(89=Mark Colbath)([email protected])(8B [email protected])(8C=512-282-2509)(8D=+504-9907-1342)(8E=512-282-2510) (8F=512-282-2511)(90=512-282-2512)(91=Two Blocks Past Oxen Team)(92 =Villa Alicia)(93=Siguatepeque)(94=Comayagua)(95=NA)(96=Honduras) (97=9309 Heatherwood Dr)(98=Apartment 1)(99=Austin)(9A=TX)(9B=78748) (9C=USA)(9D=Programmer)(9E=Programming)(9F=MPC Solutions)(A0 =rentaprogrammer)(A1=http://www.mpcsol.com)(A2 =http://www.jesuslovesthelittlechildren.org)(A3=Hannah)(A4=John) (A5=Faith)(A6=Timothy)(A7=Some notes go here.)(A8 [email protected])> {1:^80 {(k^C0:c)(s=9)} [1:^82(^BF=3)] [1(^83=)(^84=)(^85=)(^86=)(^87=)(^88=)(^89^82)(^8A^82)(^8B=)(^8C=) (^8D=)(^8E=0)(^8F=2)(^90=0)(^91=)(^92=)(^93=)(^94=)(^95=)(^96=) (^97=)(^98=)(^99=)(^9A=)(^9B=)(^9C=)(^9D=)(^9E=)(^9F=)(^A0=)(^A1=) (^A2=)(^A3=)(^A4=)(^A5=)(^A6=)(^A7=)(^A8=)(^A9=)(^AA=)(^AB=)(^AC=) (^AD=)(^AE=)(^AF=)(^B0=)(^B1=)(^B2=)(^B3=)(^B4=)(^B5=)(^B6=)(^B7=) (^B8=)(^B9=)(^BA=)(^BB=)(^BC^86)(^BD=1)] [2(^83^87)(^84^88)(^85=)(^86=)(^87^89)(^88=)(^89^8A)(^8A^8A)(^8B^8B) (^8C=)(^8D=)(^8E=2)(^8F=0)(^90=1)(^91^8C)(^92^8D)(^93^8E)(^94^8F) (^95^90)(^96=)(^97=)(^98=)(^99=)(^9A=)(^9B^91)(^9C^92)(^9D^93)(^9E^94) (^9F=NA)(^A0^96)(^A1^97)(^A2^98)(^A3^99)(^A4=TX)(^A5^9B)(^A6^9C) (^A7^9D)(^A8^9E)(^A9^9F)(^AA^A0)(^AB=)(^AC=)(^AD=)(^AE=)(^AF=)(^B0=) (^B1=)(^B2^A1)(^B3^A2)(^B4=)(^B5=)(^B6=)(^B7^A3)(^B8^A4)(^B9^A5) (^BA^A6)(^BB^A7)(^BC=0)(^BD=2)] [3(^83=)(^84=)(^85=)(^86=)(^87=)(^88=)(^89^A8)(^8A^A8)(^8B=)(^8C=) (^8D=)(^8E=0)(^8F=0)(^90=0)(^91=)(^92=)(^93=)(^94=)(^95=)(^96=) (^97=)(^98=)(^99=)(^9A=)(^9B=)(^9C=)(^9D=)(^9E=)(^9F=)(^A0=)(^A1=) (^A2=)(^A3=)(^A4=)(^A5=)(^A6=)(^A7=)(^A8=)(^A9=)(^AA=)(^AB=)(^AC=) (^AD=)(^AE=)(^AF=)(^B0=)(^B1=)(^B2=)(^B3=)(^B4=)(^B5=)(^B6=)(^B7=) (^B8=)(^B9=)(^BA=)(^BB=)(^BC=0)(^BD=3)]} Can someone tell me how this part of the Mork file relates to the data given below? run: NickName=,LastModifiedDate=4ac18267,FaxNumberType=,BirthMonth=,LastName=,HomePhone=,WorkCountry=,HomePhoneType=,PreferMailFormat=0,CellularNumber=,FamilyName=,[email protected],AnniversaryMonth=,HomeCity=,WorkState=,HomeCountry=,PhoneticFirstName=,PhoneticLastName=,HomeState=,WorkAddress=,WebPage1=,WebPage2=,HomeAddress2=,WorkZipCode=,_AimScreenName=,AnniversaryYear=,WorkPhoneType=,Notes=,WorkAddress2=,WorkPhone=,Custom3=,Custom4=,Custom1=,Custom2=,PagerNumber=,AnniversaryDay=,WorkCity=,AllowRemoteContent=0,CellularNumberType=,FaxNumber=,PopularityIndex=2,FirstName=,SpouseName=,CardType=,Department=,Company=,HomeAddress=,BirthDay=,SecondEmail=,RecordKey=1,DisplayName=,DefaultEmail=,DefaultAddress=,BirthYear=,Category=,PagerNumberType=,[email protected],JobTitle=,HomeZipCode=, NickName=,LastModifiedDate=0,FaxNumberType=,BirthMonth=,LastName=Colbath,HomePhone=+504-9907-1342,WorkCountry=USA,HomePhoneType=,PreferMailFormat=2,CellularNumber=512-282-2512,FamilyName=,[email protected],AnniversaryMonth=,HomeCity=Siguatepeque,WorkState=TX,HomeCountry=Honduras,PhoneticFirstName=,PhoneticLastName=,HomeState=Comayagua,WorkAddress=9309 HeatherwoodDr,WebPage1=http://www.mpcsol.com,WebPage2=http://www.jesuslovesthelittlechildren.org,HomeAddress2=VillaAlicia,WorkZipCode=78748,_AimScreenName=rentaprogrammer,AnniversaryYear=,WorkPhoneType=,Notes=Some notes go here.,WorkAddress2=Apartment 1,WorkPhone=512-282-2509,Custom3=Faith,Custom4=Timothy,Custom1=Hannah,Custom2=John,PagerNumber=512-282-2511,AnniversaryDay=,WorkCity=Austin,AllowRemoteContent=1,CellularNumberType=,FaxNumber=512-282-2510,PopularityIndex=0,FirstName=Mark,SpouseName=,CardType=,Department=Programming,Company=MPC Solutions,HomeAddress=Two Blocks Past Oxen Team,BirthDay=,[email protected],RecordKey=2,DisplayName=Mark Colbath,DefaultEmail=,DefaultAddress=,BirthYear=,Category=,PagerNumberType=,[email protected],JobTitle=Programmer,HomeZipCode=NA, NickName=,LastModifiedDate=0,FaxNumberType=,BirthMonth=,LastName=,HomePhone=,WorkCountry=,HomePhoneType=,PreferMailFormat=0,CellularNumber=,FamilyName=,[email protected],AnniversaryMonth=,HomeCity=,WorkState=,HomeCountry=,PhoneticFirstName=,PhoneticLastName=,HomeState=,WorkAddress=,WebPage1=,WebPage2=,HomeAddress2=,WorkZipCode=,_AimScreenName=,AnniversaryYear=,WorkPhoneType=,Notes=,WorkAddress2=,WorkPhone=,Custom3=,Custom4=,Custom1=,Custom2=,PagerNumber=,AnniversaryDay=,WorkCity=,AllowRemoteContent=0,CellularNumberType=,FaxNumber=,PopularityIndex=0,FirstName=,SpouseName=,CardType=,Department=,Company=,HomeAddress=,BirthDay=,SecondEmail=,RecordKey=3,DisplayName=,DefaultEmail=,DefaultAddress=,BirthYear=,Category=,PagerNumberType=,[email protected],JobTitle=,HomeZipCode=, I have been breaking my head for almost 2 days now, please someone who is part of the mozilla team can help, it would be really appreciated.

    Read the article

  • MVC 2 jQuery Client-side Validation

    - by nmarun
    Well, I watched Phil Haack’s show What's New in Microsoft ASP.NET MVC 2 and was impressed about the client-side validation (starts at 17:45) that MVC 2 offers. I tried creating the same, but Phil does not show what .js files need to be included and also I was not able to find the source code for the application that he used. In order to find out the required JavaScript file references, I added all of the files in my application to the page and ran it. Of course it worked, but this is definitely not an optimum solution. By removing one at a time and testing the app, I’ve short-listed the following ones: 1: <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script 2: <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> 3: <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script> Now, a little about the feature itself. Say, I’m working with a Book application so my model will look something like: 1: public class Book 2: { 3: [HiddenInput(DisplayValue = false)] 4: public int BookId { get; set; } 5:  6: [DisplayName("Book Title")] 7: [Required(ErrorMessage = "Book title is required")] 8: [StringLength(20, ErrorMessage = "Must be under 20 characters")] 9: public string Title { get; set; } 10:  11: [Required(ErrorMessage = "Author is required")] 12: [StringLength(40, ErrorMessage = "Must be under 40 characters")] 13: public string Author { get; set; } 14:  15: public decimal Price { get; set; } 16: 17: [DisplayName("ISBN")] 18: [StringLength(13, ErrorMessage = "Must be 13 characters")] 19: public string Isbn { get; set; } 20: } This ensures that the data passed will be validated upon post. But what would happen if you add the line (along with the above mentioned .js files): 1: <% Html.EnableClientValidation(); %> Now, this acts as ‘on-the-fly’ or ‘real-time’ validation. Now, when the user types 20 characters for the Title, the error shows up right on the 21st character. Beautiful… and you do not have to create the JavaScript function(s) for this. They’re auto-magically created for you. (Doing a ‘View Source’ on the browser page shows you the JavaScript logic that goes on behind the scenes). I bumped into another post that shows how .net 4 allows us to create custom validation attributes: Dynamic Range validation in MVC 2. This will help us attach virtually any business logic to the model itself. Please see the source code I’ve worked with.

    Read the article

  • Customizing Spaces UI

    - by vijaykumar.yenne
    In most common scenarios we stumble up on use cases to customize the Web center spaces UI. Is the Spaces UI customizable? What is the extent to which we can customize? How do i customize it? These are some questions that developers/architects normally come across. Well to clear the air, OOTB spaces comes with some default "site templates" and it also gives a flexibility to create custom site templates suiting the organization needs. The site templates concept has been introduced in the latest PS1 release of webcenter and to customize/create the the new site template, we have to leverage the Extend Spaces Project available on OTN. You could download the the project from here. Also there is white paper available on what all can be customized/extended from spaces perspective listed here . There is a specific details outlined on how to create custom site template in the Customizing Site Template white paper. One of the things the white paper high lights is "While you can create new site templates and modify the sample site templates but you cannot modify either of the out-of-the-box site templates ie the default and maximized. So if my need is to either increase the size of header to fit in a bigger logo or introduce couple of extra links on the default/maximized lay out how do i achieve this? All you need to do is customize the OOTB shell (shell-config.xml). 1. Copy the shell config's available in the Source Files Directory of the extended spaces unzipped directory into the CustomSite Template Project ExtendWebCenterSpaces\CustomSiteTemplate\custom\oracle\webcenter\webcenterapp\metadata\shell 2. Modify the appropriate shell 3. Deploy the CustomSite Template as ADF Jar 4. ensure you have the profile dependency on the aboproject int he custom webcenter spaces project 5. Deploy the Spaces Extension on the Webcenter Spaces Instance. (Details in the first white paper). You should see the changes immediately. eg: In the default shell, i have changed the height from 30 to 60 to increase the header size height="60" This is what i get to see : If you have worked on the R1 release time frame, where you created a custom shell/chrome, how do we make them compatible and make it available in the Spaces PS1 instance? All you need to do is the following: 1. Copy the custom shell in to the shell directory of the custom site template project 2. Register the shell with WCSiteTemplates.xml available in the same project. Eg : Yo can add the below entry pagePath="/oracle/webcenter/webcenterapp/view/templates/MyShellTemplate.jspx" pageDefPath="/oracle/webcenter/webcenterapp/bindings/pageDefs/oracle_webcenter_webcenterapp_view_templates_WebCenterAppShellTemplatePageDef.xml" displayName="myShell" chromeLevel="myShell"/ Note : pagePath - Absolute path of the template JSPX file. This path must be unique. So you might have to do the following to get your custom chrome working absolutely fine with no problems at all: 1. Create a jspx page, say /custom/mysite/SiteTemplate.jspx 2. Include the the default jspx in the new site template like following SiteTemplate.jspx ------------------ 3. Add the newly created site template in the WCSiteTemplate.xml file like following - pagePath="/custom/mysite/SiteTemplate.jspx" pageDefPath="/oracle/webcenter/webcenterapp/bindings/pageDefs/oracle_webcenter_webcenterapp_view_templates_WebCenterAppShellTemplatePageDef.xml" displayName="myShell" chromeLevel="myShell"/

    Read the article

  • Java Hint in NetBeans for Identifying JOptionPanes

    - by Geertjan
    I tend to have "JOptionPane.showMessageDialogs" scattered through my code, for debugging purposes. Now I have a way to identify all of them and remove them one by one, since some of them are there for users of the application so shouldn't be removed, via the Refactoring window: Identifying instances of code that I'm interested in is really trivial: import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.java.hints.ConstraintVariableType; import org.netbeans.spi.java.hints.ErrorDescriptionFactory; import org.netbeans.spi.java.hints.Hint; import org.netbeans.spi.java.hints.HintContext; import org.netbeans.spi.java.hints.TriggerPattern; import org.openide.util.NbBundle.Messages; @Hint( displayName = "#DN_ShowMessageDialogChecker", description = "#DESC_ShowMessageDialogChecker", category = "general") @Messages({ "DN_ShowMessageDialogChecker=Found \"ShowMessageDialog\"", "DESC_ShowMessageDialogChecker=Checks for JOptionPane.showMes" }) public class ShowMessageDialogChecker { @TriggerPattern(value = "$1.showMessageDialog", constraints = @ConstraintVariableType(variable = "$1", type = "javax.swing.JOptionPane")) @Messages("ERR_ShowMessageDialogChecker=Are you sure you need this statement?") public static ErrorDescription computeWarning(HintContext ctx) { return ErrorDescriptionFactory.forName( ctx, ctx.getPath(), Bundle.ERR_ShowMessageDialogChecker()); } } Stick the above class, which seriously isn't much code at all, in a module and run it, with this result: Bit trickier to do the fix, i.e., add a bit of code to let the user remove the statement, but I looked in the NetBeans sources and used the System.out fix, which does the same thing:  import com.sun.source.tree.BlockTree; import com.sun.source.tree.StatementTree; import com.sun.source.util.TreePath; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.netbeans.api.java.source.CompilationInfo; import org.netbeans.api.java.source.WorkingCopy; import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.editor.hints.Fix; import org.netbeans.spi.java.hints.ConstraintVariableType; import org.netbeans.spi.java.hints.ErrorDescriptionFactory; import org.netbeans.spi.java.hints.Hint; import org.netbeans.spi.java.hints.HintContext; import org.netbeans.spi.java.hints.JavaFix; import org.netbeans.spi.java.hints.TriggerPattern; import org.openide.util.NbBundle.Messages; @Hint( displayName = "#DN_ShowMessageDialogChecker", description = "#DESC_ShowMessageDialogChecker", category = "general") @Messages({ "DN_ShowMessageDialogChecker=Found \"ShowMessageDialog\"", "DESC_ShowMessageDialogChecker=Checks for JOptionPane.showMes" }) public class ShowMessageDialogChecker { @TriggerPattern(value = "$1.showMessageDialog", constraints = @ConstraintVariableType(variable = "$1", type = "javax.swing.JOptionPane")) @Messages("ERR_ShowMessageDialogChecker=Are you sure you need this statement?") public static ErrorDescription computeWarning(HintContext ctx) { Fix fix = new FixImpl(ctx.getInfo(), ctx.getPath()).toEditorFix(); return ErrorDescriptionFactory.forName( ctx, ctx.getPath(), Bundle.ERR_ShowMessageDialogChecker(), fix); } private static final class FixImpl extends JavaFix { public FixImpl(CompilationInfo info, TreePath tp) { super(info, tp); } @Override @Messages("FIX_ShowMessageDialogChecker=Remove the statement") protected String getText() { return Bundle.FIX_ShowMessageDialogChecker(); } @Override protected void performRewrite(TransformationContext tc) throws Exception { WorkingCopy wc = tc.getWorkingCopy(); TreePath statementPath = tc.getPath(); TreePath blockPath = tc.getPath().getParentPath(); while (!(blockPath.getLeaf() instanceof BlockTree)) { statementPath = blockPath; blockPath = blockPath.getParentPath(); if (blockPath == null) { return; } } BlockTree blockTree = (BlockTree) blockPath.getLeaf(); List<? extends StatementTree> statements = blockTree.getStatements(); List<StatementTree> newStatements = new ArrayList<StatementTree>(); for (Iterator<? extends StatementTree> it = statements.iterator(); it.hasNext();) { StatementTree statement = it.next(); if (statement != statementPath.getLeaf()) { newStatements.add(statement); } } BlockTree newBlockTree = wc.getTreeMaker().Block(newStatements, blockTree.isStatic()); wc.rewrite(blockTree, newBlockTree); } } } Aside from now being able to use "Inspect & Refactor" to identify and fix all instances of JOptionPane.showMessageDialog at the same time, you can also do the fixes per instance within the editor:

    Read the article

  • Roles / Profiles / Perspectives in NetBeans IDE 7.1

    - by Geertjan
    With a check out of main-silver from yesterday, I'm able to use the brand new "role" attribute in @TopComponent.Registration, as you can see below, in the bit in bold: @ConvertAsProperties(dtd = "-//org.role.demo.ui//Admin//EN", autostore = false) @TopComponent.Description(preferredID = "AdminTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS) @TopComponent.Registration(mode = "editor", openAtStartup = true, role="admin") public final class AdminTopComponent extends TopComponent { And here's a window for general users of the application, with the "role" attribute set to "user": @ConvertAsProperties(dtd = "-//org.role.demo.ui//User//EN", autostore = false) @TopComponent.Description(preferredID = "UserTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS) @TopComponent.Registration(mode = "explorer", openAtStartup = true, role="user") public final class UserTopComponent extends TopComponent { So, I have two windows. One is assigned to the "admin" role, the other to the "user" role. In the "ModuleInstall" class, I add a "WindowSystemListener" and set "user" as the application's role: public class Installer extends ModuleInstall implements WindowSystemListener { @Override public void restored() { WindowManager.getDefault().addWindowSystemListener(this); } @Override public void beforeLoad(WindowSystemEvent event) { WindowManager.getDefault().setRole("user"); WindowManager.getDefault().removeWindowSystemListener(this); } @Override public void afterLoad(WindowSystemEvent event) { } @Override public void beforeSave(WindowSystemEvent event) { } @Override public void afterSave(WindowSystemEvent event) { } } So, when the application starts, the "UserTopComponent" is shown, not the "AdminTopComponent". Next, I have two Actions, for switching between the two roles, as shown below: @ActionID(category = "Window", id = "org.role.demo.ui.SwitchToAdminAction") @ActionRegistration(displayName = "#CTL_SwitchToAdminAction") @ActionReferences({ @ActionReference(path = "Menu/Window", position = 250) }) @Messages("CTL_SwitchToAdminAction=Switch To Admin") public final class SwitchToAdminAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { WindowManager.getDefault().setRole("admin"); } @Override public boolean isEnabled() { return !WindowManager.getDefault().getRole().equals("admin"); } } @ActionID(category = "Window", id = "org.role.demo.ui.SwitchToUserAction") @ActionRegistration(displayName = "#CTL_SwitchToUserAction") @ActionReferences({ @ActionReference(path = "Menu/Window", position = 250) }) @Messages("CTL_SwitchToUserAction=Switch To User") public final class SwitchToUserAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { WindowManager.getDefault().setRole("user"); } @Override public boolean isEnabled() { return !WindowManager.getDefault().getRole().equals("user"); } } When I select one of the above actions, the role changes, and the other window is shown. I could, of course, add a Login dialog to the "SwitchToAdminAction", so that authentication is required in order to switch to the "admin" role. Now, let's say I am now in the "user" role. So, the "UserTopComponent" shown above is now opened. I decide to also open another window, the Properties window, as below... ...and, when I am in the "admin" role, when the "AdminTopComponent" is open, I decide to also open the Output window, as below... Now, when I switch from one role to the other, the additional window/s I opened will also be opened, together with the explicit members of the currently selected role. And, the main window position and size are also persisted across roles. When I look in the "build" folder of my project in development, I see two different Windows2Local folders, one per role, automatically created by the fact that there is something to be persisted for a particular role, e.g., when a switch to a different role is done: And, with that, we now clearly have roles/profiles/perspectives in NetBeans Platform applications from NetBeans Platform 7.1 onwards.

    Read the article

  • Dynamically Changing the Display Names of Menus and Popups

    - by Geertjan
    Very interesting thing and handy to know when needed is the fact that "menuText" and "popupText" (from org.openide.awt.ActionRegistration) can be changed dynamically, via "putValue" as shown below for "popupText". The Action class, in this case, needs to be eager, hence you won't receive the object of interest via the constructor, but you can easily use the global Lookup for that purpose instead, as also shown below. import java.awt.event.ActionEvent; import java.text.DateFormat; import java.text.SimpleDateFormat; import javax.swing.AbstractAction; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectInformation; import org.netbeans.api.project.ProjectUtils; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionRegistration; import org.openide.util.Utilities; @ActionID( category = "Project", id = "org.ptt.DemoProjectAction") @ActionRegistration( lazy = false, displayName = "NOT-USED") @ActionReference(path = "Projects/Actions", position = 0) public final class DemoProjectAction extends AbstractAction{ private final ProjectInformation context; public DemoProjectAction() { putValue("popupText", "Select Me To See Current Time!"); context = ProjectUtils.getInformation( Utilities.actionsGlobalContext().lookup(Project.class)); } @Override public void actionPerformed(ActionEvent e) { refresh(); } protected void refresh() { DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String formatted = formatter.format(System.currentTimeMillis()); putValue("popupText", "Time: " + formatted + " (" + context.getDisplayName() +")"); } } Now, let's do something semi useful and display, in the popup, which is available when you right-click a project, the time since the last change was made anywhere in the project, i.e., we can listen recursively to any changes done within a project and then update the popup with the newly acquired information, dynamically: import java.awt.event.ActionEvent; import java.text.DateFormat; import java.text.SimpleDateFormat; import javax.swing.AbstractAction; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectUtils; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionRegistration; import org.openide.filesystems.FileAttributeEvent; import org.openide.filesystems.FileChangeListener; import org.openide.filesystems.FileEvent; import org.openide.filesystems.FileRenameEvent; import org.openide.util.Utilities; @ActionID( category = "Project", id = "org.ptt.TrackProjectTimerAction") @ActionRegistration( lazy = false, displayName = "NOT-USED") @ActionReference( path = "Projects/Actions", position = 0) public final class TrackProjectTimerAction extends AbstractAction implements FileChangeListener { private final Project context; private Long startTime; private Long changedTime; private DateFormat formatter; public TrackProjectTimerAction() { putValue("popupText", "Enable project time tracker"); this.formatter = new SimpleDateFormat("HH:mm:ss"); context = Utilities.actionsGlobalContext().lookup(Project.class); context.getProjectDirectory().addRecursiveListener(this); } @Override public void actionPerformed(ActionEvent e) { startTimer(); } protected void startTimer() { startTime = System.currentTimeMillis(); String formattedStartTime = formatter.format(startTime); putValue("popupText", "Timer started: " + formattedStartTime + " (" + ProjectUtils.getInformation(context).getDisplayName() + ")"); } @Override public void fileChanged(FileEvent fe) { changedTime = System.currentTimeMillis(); formatter = new SimpleDateFormat("mm:ss"); String formattedLapse = formatter.format(changedTime - startTime); putValue("popupText", "Time since last change: " + formattedLapse + " (" + ProjectUtils.getInformation(context).getDisplayName() + ")"); startTime = changedTime; } @Override public void fileFolderCreated(FileEvent fe) {} @Override public void fileDataCreated(FileEvent fe) {} @Override public void fileDeleted(FileEvent fe) {} @Override public void fileRenamed(FileRenameEvent fre) {} @Override public void fileAttributeChanged(FileAttributeEvent fae) {} }

    Read the article

  • WPF: TreeViewItem bound to an ICommand

    - by Richard
    Hi All, I am busy creating my first MVVM application in WPF. Basically the problem I am having is that I have a TreeView (System.Windows.Controls.TreeView) which I have placed on my WPF Window, I have decide that I will bind to a ReadOnlyCollection of CommandViewModel items, and these items consist of a DisplayString, Tag and a RelayCommand. Now in the XAML, I have my TreeView and I have successfully bound my ReadOnlyCollection to this. I can view this and everything looks fine in the UI. The issue now is that I need to bind the RelayCommand to the Command of the TreeViewItem, however from what I can see the TreeViewItem doesn't have a Command. Does this force me to do it in the IsSelected property or even in the Code behind TreeView_SelectedItemChanged method or is there a way to do this magically in WPF? This is the code I have: <TreeView BorderBrush="{x:Null}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TreeView.Items> <TreeViewItem Header="New Commands" ItemsSource="{Binding Commands}" DisplayMemberPath="DisplayName" IsExpanded="True"> </TreeViewItem> </TreeView.Items> and ideally I would love to just go: <TreeView BorderBrush="{x:Null}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TreeView.Items> <TreeViewItem Header="New Trade" ItemsSource="{Binding Commands}" DisplayMemberPath="DisplayName" IsExpanded="True" Command="{Binding Path=Command}"> </TreeViewItem> </TreeView.Items> Does someone have a solution that allows me to use the RelayCommand infrastructure I have. Thanks guys, much appreciated! Richard

    Read the article

  • Exception when creating MailMessage

    - by Julien Poulin
    I'm getting a FormatException telling me the address '[email protected]' is invalid (I'm guessing because of the '-'). Here is the code I'm using: var md = new MailDefinition(); md.BodyFileName = physicalPath; md.Subject = subject; md.From = from; md.CC = cc; md.IsBodyHtml = true; MailMessage mailMessage = md.CreateMailMessage(to, replacements, owner); Is there a bug in the .Net e-mail parser? I am sure this address is valid since it belongs to a friend and I have no problem sending and receiving his e-mails with Outlook. Is there a way to fix this? EDIT: Here is the stacktrace: [FormatException: La chaîne spécifiée n'est pas de la forme requise pour une adresse de messagerie.] System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) +1141755 System.Net.Mail.MailAddress.ParseValue(String address) +240 System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +85 System.Net.Mail.Message..ctor(String from, String to) +122 System.Net.Mail.MailMessage..ctor(String from, String to) +114 System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, String body, Control owner) +1366 System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, Control owner) +290 WebNotificationManager.CreateMessage(Page owner, MessageTemplate messageTemplate, ListDictionary replacements, String to, String from, String cc, String subject) in c:\dev\SoccerMania\SoccerMania\App_Code\WebNotificationManager.cs:41 WebNotificationManager.SendMessage(Page owner, MessageTemplate messageTemplate, ListDictionary replacements, String to, String subject) in c:\dev\SoccerMania\SoccerMania\App_Code\WebNotificationManager.cs:22 inscription.bInscription_Click(Object sender, EventArgs e) in c:\dev\SoccerMania\SoccerMania\Inscription.aspx.cs:54 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

    Read the article

  • WebDav And Exchange2007 HTTP1.1 404 Ressource not Found!

    - by adrien
    i have Exchange2007. and i am using the url: "https://exchange2007.exchange.server.com/Exchange/username/calendar"; 'calendar', or 'mailbox'( in your language! example, "boite de reception" in french or "calendário" in portuguese) with that url that i'm using i can list my ressources, but can't send a mail or write an appointement! why?!? See that i get a response of the server 207multistatus and ok, but the return a HTTP/1.1 404 Resource Not Found i wish a 201 created!!! (for my appointement) someone have better ideia ? thx. Console: >>>>>>> to server --------------------------------------------------- PROPPATCH /Exchange/marcelo/calend%C3%A1rio HTTP/1.1 Authorization: Basic bWFyY2Vsb0BleGNoYW5nZTptdXN0YWZhMSQ= Content-Type: text/xml; charset=utf-8 User-Agent: Jakarta Commons-HttpClient/2.0final Host: exchange2007.exchange.snap.com.br Content-Length: 1407 <D:propertyupdate xmlns:D="DAV:"> <D:set> <D:prop> <mapi xmlns="xmlns"> http://schemas.microsoft.com/mapi/ </mapi> <Cmd xmlns="urn:"> saveappt </Cmd> <dtEnd xmlns="urn:schemas:calendar"> 2009-06-30T10:30:00.000Z </dtEnd> <contentclass xmlns="DAV"> urn:content-classes:Appointment </contentclass> <Subject xmlns="urn:schemas:httpmail"> Changed Test Appointment Subject </Subject> <Location xmlns="urn:schemas:calendar"> do </Location> <responserequested xmlns="urn:schemas:calendar"> 0 </responserequested> <saveappt xmlns="urn:schemas:calendar:cmd"> 1 </saveappt> <ressource xmlns="DAV"> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/calendárioassuntoteste.EML </ressource> <alldayevent xmlns="urn:schemas:calendar"> 0 </alldayevent> <to xmlns="urn:schemas:header"> adrien </to> <dtStart xmlns="urn:schemas:calendar"> 2009-06-30T10:00:00.000Z </dtStart> <isfolder xmlns="DAV"> 0 </isfolder> <cmd xmlns="Cmd"> saveappt </cmd> <HtmlDescription xmlns="urn:schemas:httpmail"> Let's meet here </HtmlDescription> <outlookmessageclass xmlns="http://schemas.microsoft.com/exchange/subject-utf8=Appointment"> IPM.Appointement </outlookmessageclass> <instancetype xmlns="urn:schemas:calendar"> 0 </instancetype> <meetingstatus xmlns="urn:schemas:calendar"> CONFIRMED </meetingstatus> <finvited xmlns="urn:schemas:mapi"> 0 </finvited> <BusyType xmlns="urn:schemas:calendar"> BUSY </BusyType> </D:prop> </D:set> </D:propertyupdate> ------------------------------------------------------------------------ <<<<<<< from server --------------------------------------------------- HTTP/1.1 207 Multi-Status Date: Thu, 16 Jul 2009 20:29:40 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET MS-Exchange-Permanent-URL: https://exchange2007.exchange.snap.com.br/Exchange/marcelo/-FlatUrlSpace-/b3ee92320938254c828a96e2e269a417-a6271d Repl-UID: <rid:b3ee92320938254c828a96e2e269a417000000a6282e> Content-Type: text/xml Content-Length: 825 ResourceTag: <rt:b3ee92320938254c828a96e2e269a417000000a6282eb3ee92320938254c828a96e2e269a41700545bb4844c> MS-WebStorage: 08.01.10240 <a:multistatus xmlns:a="DAV:" xmlns:b="xmlns" xmlns:c="urn:" xmlns:d="urn:schemas:calendar" xmlns:e="DAV" xmlns:f="urn:schemas:httpmail" xmlns:g="urn:schemas:calendar:cmd" xmlns:h="urn:schemas:header" xmlns:i="Cmd" xmlns:j="http://schemas.microsoft.com/exchange/subject-utf8=Appointment" xmlns:k="urn:schemas:mapi"> <a:response> <a:href> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/Calend%C3%A1rio </a:href> <a:propstat> <a:status> HTTP/1.1 200 OK </a:status> <a:prop> <b:mapi> </b:mapi> <c:Cmd> </c:Cmd> <d:dtEnd> </d:dtEnd> <e:contentclass> </e:contentclass> <f:Subject> </f:Subject> <d:Location> </d:Location> <d:responserequested> </d:responserequested> <g:saveappt> </g:saveappt> <e:ressource> </e:ressource> <d:alldayevent> </d:alldayevent> <h:to> </h:to> <d:dtStart> </d:dtStart> <e:isfolder> </e:isfolder> <i:cmd> </i:cmd> <f:HtmlDescription> </f:HtmlDescription> <j:outlookmessageclass> </j:outlookmessageclass> <d:instancetype> </d:instancetype> <d:meetingstatus> </d:meetingstatus> <k:finvited> </k:finvited> <d:BusyType> </d:BusyType> </a:prop> </a:propstat> </a:response> </a:multistatus> ------------------------------------------------------------------------ >>>>>>> to server --------------------------------------------------- PROPFIND /Exchange/marcelo/calend%C3%A1rio HTTP/1.1 Authorization: Basic bWFyY2Vsb0BleGNoYW5nZTptdXN0YWZhMSQ= Content-Type: text/xml; charset=utf-8 User-Agent: Jakarta Commons-HttpClient/2.0final Host: exchange2007.exchange.snap.com.br Content-Length: 207 Depth: 0 <D:propfind xmlns:D="DAV:"> <D:prop> <D:displayname> </D:displayname> <D:getcontentlength> </D:getcontentlength> <D:getcontenttype> </D:getcontenttype> <D:resourcetype> </D:resourcetype> <D:getlastmodified> </D:getlastmodified> <D:lockdiscovery> </D:lockdiscovery> </D:prop> </D:propfind> ------------------------------------------------------------------------ <<<<<<< from server --------------------------------------------------- HTTP/1.1 207 Multi-Status Date: Thu, 16 Jul 2009 20:29:40 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/xml Accept-Ranges: rows MS-WebStorage: 08.01.10240 Transfer-Encoding: chunked <a:multistatus xmlns:a="DAV:" xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" xmlns:c="xml:"> <a:response> <a:href> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/Calend%C3%A1rio/ </a:href> <a:propstat> <a:status> HTTP/1.1 200 OK </a:status> <a:prop> <a:displayname> Calendário </a:displayname> <a:getcontentlength b:dt="int"> 0 </a:getcontentlength> <a:resourcetype> <a:collection> </a:collection> </a:resourcetype> <a:getlastmodified b:dt="dateTime.tz"> 2009-07-16T20:29:40.098Z </a:getlastmodified> <lockdiscovery xmlns="DAV:"> </lockdiscovery> </a:prop> </a:propstat> <a:propstat> <a:status> HTTP/1.1 404 Resource Not Found </a:status> <a:prop> <a:getcontenttype> </a:getcontenttype> </a:prop> </a:propstat> </a:response> </a:multistatus>

    Read the article

  • Problem with asp.net function syntax (not returning values correctly)

    - by Phil
    I have an active directory search function: Function GetAdInfo(ByVal ADDN As String, ByVal ADCommonName As String, ByVal ADGivenName As String, ByVal ADStaffNum As String, ByVal ADEmail As String, ByVal ADDescription As String, ByVal ADTelephone As String, ByVal ADOffice As String, ByVal ADEmployeeID As String) As String Dim netBIOSname As String = Me.Request.LogonUserIdentity.Name Dim sAMAccountName As String = netBIOSname.Substring(netBIOSname.LastIndexOf("\"c) + 1) Dim defaultNamingContext As String Using rootDSE As DirectoryServices.DirectoryEntry = New DirectoryServices.DirectoryEntry("LDAP://RootDSE") defaultNamingContext = rootDSE.Properties("defaultNamingContext").Value.ToString() End Using Using searchRoot As DirectoryServices.DirectoryEntry = _ New DirectoryServices.DirectoryEntry("LDAP://" + defaultNamingContext, _ "kingkong", "kingkong", DirectoryServices.AuthenticationTypes.Secure) Using ds As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher(searchRoot) ds.Filter = String.Format("(&(objectClass=user)(objectCategory=person)(sAMAccountName={0}))", sAMAccountName) Dim sr As DirectoryServices.SearchResult = ds.FindOne() 'If sr.Properties("displayName").Count = 0 Then whatever = string.empty '' (how to check nulls when required) ' End If ADDN = (sr.Properties("displayName")(0).ToString()) ADCommonName = (sr.Properties("cn")(0).ToString()) ADGivenName = (sr.Properties("givenname")(0).ToString()) ADStaffNum = (sr.Properties("sn")(0).ToString()) ADEmail = (sr.Properties("mail")(0).ToString()) ADDescription = (sr.Properties("description")(0).ToString()) ADTelephone = (sr.Properties("telephonenumber")(0).ToString()) ADOffice = (sr.Properties("physicalDeliveryOfficeName")(0).ToString()) ' ADEmployeeID = (sr.Properties("employeeID")(0).ToString()) End Using End Using Return ADDN Return ADCommonName Return ADGivenName Return ADStaffNum Return ADEmail Return ADDescription Return ADTelephone Return ADOffice ' Return ADEmployeeID 'have commented out employee id as i dont have one so it is throwing null errors. ' im not ready to put labels on the frontend or catch this info yet End Function The function appears to work, as when I put a breakpoint at the end, the variables such as ADDN do have the correct values. Then I call the function in my page_load like this: GetAdInfo(ADDN, ADCommonName, ADGivenName, ADStaffnum, ADEmail, ADDescription, ADTelephone, ADOffice, ADEmployeeID) Then I try to response.write out one of the vars to test like this: Response.Write(ADDN) But the value is empty. Please can someone tell me what I am doing wrong. Thanks

    Read the article

  • Remove duplicates from a list of nested dictionaries

    - by user2924306
    I'm writing my first python program to manage users in Atlassian On Demand using their RESTful API. I call the users/search?username= API to retrieve lists of users, which returns JSON. The results is a list of complex dictionary types that look something like this: [ { "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "name": "fred", "avatarUrls": { "24x24": "http://www.example.com/jira/secure/useravatar?size=small&ownerId=fred", "16x16": "http://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred", "32x32": "http://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred", "48x48": "http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred" }, "displayName": "Fred F. User", "active": false }, { "self": "http://www.example.com/jira/rest/api/2/user?username=andrew", "name": "andrew", "avatarUrls": { "24x24": "http://www.example.com/jira/secure/useravatar?size=small&ownerId=andrew", "16x16": "http://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=andrew", "32x32": "http://www.example.com/jira/secure/useravatar?size=medium&ownerId=andrew", "48x48": "http://www.example.com/jira/secure/useravatar?size=large&ownerId=andrew" }, "displayName": "Andrew Anderson", "active": false } ] I'm calling this multiple times and thus getting duplicate people in my results. I have been searching and reading but cannot figure out how to deduplicate this list. I figured out how to sort this list using a lambda function. I realize I could sort the list, then iterate and delete duplicates. I'm thinking there must be a more elegant solution. Thank you!

    Read the article

  • When using Data Annotations with MVC, Pro and Cons of using an interface vs. a MetadataType

    - by SkippyFire
    If you read this article on Validation with the Data Annotation Validators, it shows that you can use the MetadataType attribute to add validation attributes to properties on partial classes. You use this when working with ORMs like LINQ to SQL, Entity Framework, or Subsonic. Then you can use the "automagic" client and server side validation. It plays very nicely with MVC. However, a colleague of mine used an interface to accomplish exactly the same result. it looks almost exactly the same, and functionally accomplishes the same thing. So instead of doing this: [MetadataType(typeof(MovieMetaData))] public partial class Movie { } public class MovieMetaData { [Required] public object Title { get; set; } [Required] [StringLength(5)] public object Director { get; set; } [DisplayName("Date Released")] [Required] public object DateReleased { get; set; } } He did this: public partial class Movie :IMovie { } public interface IMovie { [Required] object Title { get; set; } [Required] [StringLength(5)] object Director { get; set; } [DisplayName("Date Released")] [Required] object DateReleased { get; set; } } So my question is, when does this difference actually matter? My thoughts are that interfaces tend to be more "reusable", and that making one for just a single class doesn't make that much sense. You could also argue that you could design your classes and interfaces in a way that allows you to use interfaces on multiple objects, but I feel like that is trying to fit your models into something else, when they should really stand on their own. What do you think?

    Read the article

  • SMO ManagedComputer.ServiceInstances is empty

    - by Mark J Miller
    I am trying to use SMO (VS 2010, SQL Server 2008) to connect to SQL Server and view the server protocol configuration. I can connect and list the Services and ClientProtocols as well as the account MSSQLSERVER service is running under. However, the ServerInstances collection is empty. The only instance on the target server is the default (MSSQLSERVER), shouldn't that be in the collection? How can I get an instance of it so I can inspect the ServerProtocols collection? Here's the code I'm using: class Program { static void Main(string[] args) { //machine hosting installed sql server instance ManagedComputer host = new ManagedComputer("dev-it-db01.dev.interbankfx.lcl"); //ManagedComputer host = new ManagedComputer("MRW-IT-DTP69"); if (host.ServerInstances.Count != 0) { //why is this 0? Is it because only the DEFAULT instance exists? Console.WriteLine("/////////////// INSTANCES ////////////////"); foreach (ServerInstance inst in host.ServerInstances) { Console.WriteLine(inst.Name); } } Console.WriteLine("/////////////// SERVICES ////////////////"); // enumerate sql services (looking for MSSSQLSERVER) foreach (Service svc in host.Services) { Console.WriteLine(svc.Name); } Console.WriteLine("/////////////// DETAILS ////////////////"); // get name of MSSQLSERVER instance from user (pick from list above) Service mssqlserver = host.Services["MSSQLSERVER"]; // print service account: .\{account} == "local account", "LocalSystem", "NetworkService", {domain}\{account} == "domain account" Console.WriteLine("Service Account: {0}", mssqlserver.ServiceAccount); // get client protocols foreach (ClientProtocol cp in host.ClientProtocols) { Console.WriteLine("{0} {1} ({2})", cp.Order, cp.DisplayName, cp.IsEnabled ? "Enabled" : "Disabled"); } } } I've also tried: Urn u = new Urn("ManagedComputer[@Name=dev-it-db01.dev.interbankfx.lcl]/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"); ServerProtocol tcp = host.GetSmoObject(u) as ServerProtocol; if (tcp != null) { Console.WriteLine("{0}", tcp.DisplayName); } But I get an error message stating: "child expressions are not supported." Any ideas what's wrong?

    Read the article

  • Importing a WebService:

    - by Pierre
    Hi all, I'm trying to import the following web service: http://www.biomart.org/biomart/martwsdl Using curl for the service getResistry() : everything is OK: curl --header 'Content-Type: text/xml' --data '<?xml version="1.0"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mar="http://www.biomart.org:80/MartServiceSoap"> <soapenv:Header/> <soapenv:Body> <mar:getRegistry/> </soapenv:Body> </soapenv:Envelope>' http://www.biomart.org:80/biomart/martsoap it returns: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.o rg/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/ envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Body> <getRegistryResponse xmlns="http://www.biomart.org:80/MartServiceSoap"> <mart> <name xsi:type="xsd:string">ensembl</name> <displayName xsi:type="xsd:string">ENSEMBL GENES 57 (SANGER UK)</displayName> <database xsi:type="xsd:string">ensembl_mart_57</database> (...) OK. But when this service is generated using CXF/wsdl2java ( or even wsimport) mkdir src wsdl2java -keep -d src -client "http://www.biomart.org/biomart/martwsdl" javac -g -d src -sourcepath src src/org/biomart/_80/martservicesoap/MartServiceSoap_BioMartSoapPort_Client.java java -cp src org.biomart._80.martservicesoap.MartServiceSoap_BioMartSoapPort_Client the generated client returns an empty list for getRegistry(): Invoking getRegistry... getRegistry.result=[] why ? what should I do, to make this code work ? Many thanks Pierre

    Read the article

  • Issue Querying LDAP DirectoryEntry in ASP.NET

    - by davemackey
    I have users login to my application via Active Directory and then pull from their AD information to garner information about that user like so: Dim ID as FormsIdentity = DirectCast(User.Identity, FormsIdentity) Dim ticket as FormsAuthenticationTicket = ID.Ticket Dim adDirectory as New DirectoryEntry("LDAP://DC=my,DC=domain,DC=com") Dim adTicketID as String = ticket.Name.Substring(0, 5) Session("people_id") = adDirectory.Children.Find("CN=" & adTicketID).Properties("employeeID").Value Session("person_name") = adDirectory.Children.Find("CN=" & adTicketID).Properties("displayName").Value Now, I want to be able to impersonate other users...so that I can "test" the application as them, so I added a textbox and a button to the page and when the button is clicked the text is assigned to a session variable like so: Session("impersonate_user") = TextBox1.Text When the page reloads I check to see if Session("impersonate_user") has a value other than "" and then attempt to query Active Directory using this session variable like so: If CStr(Session("impersonate_user")) <> "" Then Dim adDirectory as New DirectoryEntry(LDAP://DC=my,DC=domain,DC=com") Dim adTicketID as String = CStr(Session("impersonate_user")) Session("people_id") = adDirectory.Children.Find("CN=" & adTicketID).Properties("employeeID").Value Session("person_name")= adDirectory.Children.Find("CN=" & adTicketID).Properties("displayName").Value Else [use the actual ticket.name to get this info.] End If But this doesn't work. Instead, it throws an error on the first Session line stating, "DirectoryServicesCOMException was unhandled by user code There is no such object on the server." Why? I know I'm giving it a valid username! Is something strange happening in the casting of the session? The code is essentially the same between each method except that in one method rather than pulling from ticket.Name I pull from a session variable for the login I'll be looking up with AD.

    Read the article

  • ASP.NET MVC: How do I validate a model wrapped in a ViewModel?

    - by Deniz Dogan
    For the login page of my website I would like to list the latest news for my site and also display a few fields to let the user log in. So I figured I should make a login view model - I call this LoginVM. LoginVM contains a Login model for the login fields and a List<NewsItem> for the news listing. This is the Login model: public class Login { [Required(ErrorMessage="Enter a username.")] [DisplayName("Username")] public string Username { get; set; } [Required(ErrorMessage="Enter a password.")] [DataType(DataType.Password)] [DisplayName("Password")] public string Password { get; set; } } This is the LoginVM view model: public class LoginVM { public Login login { get; set; } public List<NewsItem> newsItems { get; set; } } This is where I get stuck. In my login controller, I get passed a LoginVM. [HttpPost] public ActionResult Login(LoginVM model, FormCollection form) { if (ModelState.IsValid) { // What? In the code I'm checking whether ModelState is valid and this would work fine if the view model was actually the Login model, but now it's LoginVM which has no validation attributes at all. How do I make LoginVM "traverse" through its members to validate them all? Am I doing something fundamentally wrong using ModelState in this manner?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >