Search Results

Search found 4717 results on 189 pages for 'namespace'.

Page 39/189 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • windows service

    - by zubin71
    I need to write a windows service which executes an application after a certain amount of time. I have checked out the code in MSDN and found an example in which the System.ServiceProcess.ServiceBase class is sub-classed. I did the following. created a new C# console application copied the code from the MSDN example Run I get the following error The type or namespace name 'ServiceProcess' does not exist in the namespace 'System'(are you missing an assembly reference?) As i had copied the example from MSDN, i have no idea why the code still does not work. This is my first experience writing services and i`d love some guidance. thnkx!

    Read the article

  • writing a Simplest XML DeSerialization class for the simplest xml file. How to avoid the nesting? de

    - by Enggr
    Hi, I want to deserialize an xml file which has to be just in this form <Basket> <Fruit>Apple</Fruit> <Fruit>Orange</Fruit> <Fruit>Grapes</Fruit> </Basket> Out of the examples I read on internet the least possible format I could find was the following <Basket> <FruitArray> <Fruit>Apple</Fruit> </FruitArray> <FruitArray> <Fruit>Orange</Fruit> </FruitArray> <FruitArray> <Fruit>Grapes</Fruit> </FruitArray> </Basket> and that has the following deserialization class for converting it into a class object. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace XMLSerialization_Basket { [System.Xml.Serialization.XmlRootAttribute("Basket", Namespace = "BasketNamespace", IsNullable = false)] public class Basket { /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("FruitArray")] public FruitArray[] objFruitArray; } /// <remarks/> [System.Xml.Serialization.XmlTypeAttribute(Namespace = "BasketNamespace")] public class FruitArray { /// <remarks/> private string _Fruit; public string Fruit { get { return _Fruit; } set { _Fruit = value; } } } } Can I add something like the following directly under top class private string _Fruit; public string Fruit { get { return _Fruit; } set { _Fruit = value; } } and avoid the array nesting? my goal is to deserialize an xml of following format <Basket> <Fruit>Apple</Fruit> <Fruit>Orange</Fruit> <Fruit>Grapes</Fruit> </Basket>

    Read the article

  • WPF - How do I expose namespaces throughout a project

    - by Mark Pearl
    Sorry... I hope this isnt a really dumb question... but I couldnt find the answer anywhere. I have a WPF application, in each of my usercontrols / windows I am currently putting the following code in xaml in the header... xmlns:properties="clr-namespace:MaxCut2.Properties" This particular properties namespace I use in every window / usercontrol in my project and I would have thought that if I had put the code in my App.xaml, it would have been exposed to all the child windows/uc's - but it doesn't seem to work. Is there a way that I can expose this without having to declare it in every file in XAML?

    Read the article

  • Why am I getting "too many include files : depth = 1024"?

    - by BeeBand
    I'm using Visual Studio 2008 Express edition, and keep getting the following error: "Cascadedisplay.h(4) : fatal error C1014: too many include files : depth = 1024. Obviously I'm doing something very wrong with include files, but I just can't see what. Basically, I have an interface class, StackDisplay, from which I want to derive CascadeDisplay in another file: #if !defined __BASE_STACK_DISPLAY_H__ #define __BASE_STACK_DISPAY_H__ #include <boost\shared_ptr.hpp> #include "CascadeDisplay.h" namespace Sol { class StackDisplay { public: virtual ~StackDisplay(); static boost::shared_ptr<StackDisplay> make_cascade_display(boost::shared_ptr<int> csptr) { return boost::shared_ptr<StackDisplay>(new CascadeDisplay(csptr)); } }; } #endif and then in CascadeDisplay.h: #if !defined __CASCADE_DISPLAY_H__ #define __CASCADE_DISPAY_H__ #include "StackDisplay.h" #include <boost\shared_ptr.hpp> namespace Sol { class CascadeDisplay: public StackDisplay { public: CascadeDisplay(boost::shared_ptr<int> csptr){}; }; } #endif So what's up with that?

    Read the article

  • Project. Properties.Settings versus plain old appSettings?

    - by BryanG
    I have an assembly built that uses appSettings in the app.config...pretty straight forward. however, I'm referencing this assembly in a web service, and that web service contains the nAnt build file for this service plus being the entry point for everything. Ideally I'd like to be able to set the assembly's appConfig values from the build file, but is this possible? Or do I have to switch to using the Settings values of the assembly and do something like this in the build: <xmlpoke file="${PublishLocation}\web.config" xpath="//applicationSettings/Namespace.AssemblyClass.Properties.Settings/setting[@name='ExchangeServer']/value" value="${ServerName}" /> You get the idea. Is this possible with just a config? My ideal situation would be to keep the settings more flexible in the appConfig so that when everything is on the server, if frogs rain down, I can update the assembly's config values without rebuilding the solution. Is this even possible (the xpath is wrong, it's just an example of what I'd like to do): <xmlpoke file="${PublishLocation}\web.config" xpath="//appSettings/Namespace/AssemblyClass/add[@key = 'ExchangeServer']/@value" value="${a}" />

    Read the article

  • More elegant way to make a C++ member function change different member variables based on template p

    - by Eric Moyer
    Today, I wrote some code that needed to add elements to different container variables depending on the type of a template parameter. I solved it by writing a friend helper class specialized on its own template parameter which had a member variable of the original class. It saved me a few hundred lines of repeating myself without adding much complexity. However, it seemed kludgey. I would like to know if there is a better, more elegant way. The code below is a greatly simplified example illustrating the problem and my solution. It compiles in g++. #include <vector> #include <algorithm> #include <iostream> namespace myNS{ template<class Elt> struct Container{ std::vector<Elt> contents; template<class Iter> void set(Iter begin, Iter end){ contents.erase(contents.begin(), contents.end()); std::copy(begin, end, back_inserter(contents)); } }; struct User; namespace WkNS{ template<class Elt> struct Worker{ User& u; Worker(User& u):u(u){} template<class Iter> void set(Iter begin, Iter end); }; }; struct F{ int x; explicit F(int x):x(x){} }; struct G{ double x; explicit G(double x):x(x){} }; struct User{ Container<F> a; Container<G> b; template<class Elt> void doIt(Elt x, Elt y){ std::vector<Elt> v; v.push_back(x); v.push_back(y); Worker<Elt>(*this).set(v.begin(), v.end()); } }; namespace WkNS{ template<class Elt> template<class Iter> void Worker<Elt>::set(Iter begin, Iter end){ std::cout << "Set a." << std::endl; u.a.set(begin, end); } template<> template<class Iter> void Worker<G>::set(Iter begin, Iter end){ std::cout << "Set b." << std::endl; u.b.set(begin, end); } }; }; int main(){ using myNS::F; using myNS::G; myNS::User u; u.doIt(F(1),F(2)); u.doIt(G(3),G(4)); } User is the class I was writing. Worker is my helper class. I have it in its own namespace because I don't want it causing trouble outside myNS. Container is a container class whose definition I don't want to modify, but is used by User in its instance variables. doIt<F> should modify a. doIt<G> should modify b. F and G are open to limited modification if that would produce a more elegant solution. (As an example of one such modification, in the real application F's constructor takes a dummy parameter to make it look like G's constructor and save me from repeating myself.) In the real code, Worker is a friend of User and member variables are private. To make the example simpler to write, I made everything public. However, a solution that requires things to be public really doesn't answer my question. Given all these caveats, is there a better way to write User::doIt?

    Read the article

  • What are the pros/cons to these 2 ways of defining parameters for a web service method

    - by Antony Scott
    I have an existing web service I need to expand, but it has not gone into production yet. So, I am free to change the contracts as I see fit. But I am not sure of the best way to define the methods. I am leaning towards Method 2 for no other reason than I cannot think of good names to give the parameters classes! Are there any major disadvantages to using Method 2 over Method 1? Method 1 [DataContract(Namespace = Constants.ServiceNamespace)] public class MyParameters { [DataMember(Order = 1, IsRequired = true)] public int CompanyID { get; set; } [DataMember(Order = 2, IsRequired = true)] public string Filter { get; set; } } [ServiceContract(Namespace = Constants.ServiceNamespace)] public interface IMyService { [OperationContract, FaultContract(MyServiceFault)] MyResult MyMethod(MyParameters params); } Method 2 public interface IMyService { [OperationContract, FaultContract(MyServiceFault)] MyResult MyMethod(int companyID, string filter); }

    Read the article

  • Idiomatic approach for structuring Clojure source code

    - by mikera
    I'm interested in how people structure their Clojure source code. Being used to Java, I'm pretty familiar with the paradigm of one class per source code file, bundling all the data and method definitions with appropriate comments and annotations etc. However Clojure offers a lot more flexibility, and I'm not sure how I should structure my project (likely to end up as a medium sized app, maybe 5,000 lines with three or four distinct subsystems) In particular I'm wrestling with: What guidelines should I use to determine whether code should be in a single namespace vs. separated out into different namespaces? Should each protocol/datatype have it's own namespace + source file with associated set of functions? When should I require vs. use other namespaces?

    Read the article

  • Symfony2 Syntax Errors (in vendor files)

    - by user1665246
    To maintain code integrity across our servers we'd like to keep the /vendor/* directory under source control, rather than use composer to download files each time we roll out onto another server - i.e. we can be certain that the /vendor/* files are identical. We run a syntax checker against all files committed to source control and run across the following error: File '/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php' failed the PHP syntax check with the following error: PHP Parse error: syntax error, unexpected '}', expecting T_NS_SEPARATOR in /vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/bundle/Bundle.php on line 3 Is the "error" in this file intentional ? Any help appreciated. File contents below: <?php namespace {{ namespace }}; use Symfony\Component\HttpKernel\Bundle\Bundle; class {{ bundle }} extends Bundle { }

    Read the article

  • why is there different id syntax in the Android docs?

    - by darren
    This page in the Android documentation defines an element id as follows: <TextView android:id="@+id/label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Type here:" /> However this page defines it as: <EditText id="text" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@color/opaque_red" android:text="Hello, World!" /> I thought I had a decent understanding of what was going on until I saw this second example. In the first case, you need the + character so that id 'label' is added to the R file, correct? In the second case, would the EditText's id not be added to the R file because it does not contain the + character? Also, the second example does not include the android namespace on the id. Does having or not having the Android namespace affect whether that id will be added to the R file? Thanks for any clarification.

    Read the article

  • Getting fields of a class through reflection

    - by Water Cooler v2
    I've done it a gazillion times in the past and successfully so. This time, I'm suffering from lapses of amnesia. So, I am just trying to get the fields on an object. It is an embarrassingly simple and stupid piece of code that I am writing in a test solution before I do something really useful in production code. Strangely, the GetFieldsOf method reports a zero length array on the "Amazing" class. Help. class Amazing { private NameValueCollection _nvc; protected NameValueCollection _myDict; } private static FieldInfo[] GetFieldsOf(string className, string nameSpace = "SomeReflection") { Type t; return (t = Assembly.GetExecutingAssembly().GetType( string.Format("{0}.{1}", nameSpace, className) )) == null ? null : t.GetFields(); }

    Read the article

  • wcf service on mobile 5.0

    - by user554271
    hi everyone, I have writed a primitive wcf (vs 2010) service and created proxy files by svcutil. Later I created a mobile project on vs2008 and added proxy files on project but this error occured. Error 1 The type or namespace name 'ServiceContractAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?) C:\Users\Abb\Documents\Visual Studio 2008\Projects\WCF\MobileService\MobileClient\Sample.cs the proxy files runs well on console application (vs 2008) but there is errors on mobile. System.ServiceModel doesnot support ServiceContractAttribute.

    Read the article

  • How can I push a string from one client connected to a WCF service to another connected as well?

    - by Sergio Tapia
    Here's what I have so far: IService: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace ServiceLibrary { [ServiceContract(SessionMode = SessionMode.Allowed, CallbackContract = typeof(IServiceCallback))] public interface IService { [OperationContract(IsOneWay = false, IsInitiating = true, IsTerminating = false)] void Join(string userName); } interface IServiceCallback { [OperationContract(IsOneWay = true)] void UserJoined(string senderName); } } Service: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace ServiceLibrary { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)] public class Service:IService { IServiceCallback callback = null; public void Join(string userName) { callback = OperationContext.Current.GetCallbackChannel<IServiceCallback>(); } } } Just a simple string passed from one client to another.

    Read the article

  • Access inner function variables in Javascript

    - by Elazar Leibovich
    In many frameworks, internal function variables are used as private variables, for example Raphael = (function(){ var private = function(a,b) {return a+b;}; var public = function(a) {return private(a,a);} var object = {mult2:public}; return object; })(); here, we cannot access from the global namespace the variable named private, as it is an inner variable of the anonymous function in the first line. Sometimes this function is contains a big Javascript framework, so that it wouldn't pollute the global namespace. I need to unit tests some object Raphael uses internally (in the above example, I wish to run unit tests on the object private). How can I test them?

    Read the article

  • How to specify schema location in an xsd file?

    - by Manoj
    I have an xsd file Foo.xsd. I tried following ways to refer it in a WSDL file but it doesnt work. 1) placed the xsd file in local file system and imported it as <xsd:import namespace="http://ws.test.com/" schemaLocation="file:///D:/wsdl/Foo.xsd"></xsd:import> 2) Placed the xsd file in web root folder and imported as <xsd:import namespace="http://ws.test.com/" schemaLocation="http://localhost:8080/Xfire/Foo.xsd"></xsd:import> When I run the client I get null for the fields of response object. But this works when I embed the type definition inside the WSDL itself. How do we specify the path to external xsds? I am using xFire 1.2.6 for generating webservices. Client is generated using xFire WSGen ant task.

    Read the article

  • How Flask loads blueprint internaly?

    - by Ignas B.
    I'm just interested how Flask's blueprints gets imported. It still imports the python module at the end of all the stuff done by Flask and if I'm right python does two things when importing: registers the module name in the namespace and then initialize it if needed. So if Flask blueprint is initialized when it gets registered, so all the module then is in memory and if there are lots of blueprints to register, the memory just gets wasted, because in one request basically you use one blueprint. Not a big loss but still... But if it is only registered in the namespace and initialized only when needed (when the real request reaches it), then it make sense to register them all at once (as is the recommended way I understood). This is I guess the case here :) But just wanted to ask and understand a bit deeper.

    Read the article

  • Is there a limit to the number of DataContracts that can be used by a WCF Service?

    - by Chris
    Using WCF3.5SP1, VS2008. Building a WCF service that exposes about 10 service methods. We have defined about 40 [DataContract] types that are used by the service. We now experience that adding an additional [DataContract] type to the project (in the same namespace as the other existing types) does not get properly exposed. The new type is not in the XSD schemas generated with the WSDL. We have gone so far as to copy and rename an existing (and working) type, but it too is not present in the generated WSDL/XSD. We've tried this on two different developer machines, same problem. Is there a limit to the number of types that can exposed as [DataContract] for a Service? per Namespace?

    Read the article

  • FlexBuilder 3 Linked folders not picking up as files.

    - by Jafin
    I am using Flex Builder 3 to write a flex component. I have created a real folder path \common. Under common I create a Linked Folder to Session. Session points to a shared source folder with a item with a namespace of common\Session\ClassName. When I go to compile the project FlexBuilder warns that it was unable to find the type. if I stop using Linked folders and create a physical \common\Session\ in my project and place SessionInfo.as in the folder then it works. just in case my textual explanation is a bit obscure here is the layout. \src\common\Session\SessionInfo.as namespace of SessionInfo is common.Session. If you need any further info just let me know.

    Read the article

  • ASP.NET Compiles on page load, but not on Ctrl+Shift+B

    - by Steve Syfuhs
    during debug in cassini the code runs fine, but when I explictly build it, the compile breaks on an object saying it can't find the reference. During a breakpoint shows the proper reference to the object, and I can view the debug intellisense. The code itself is simple using CFTW.Controls; ... controls_LatestPresentations c = LoadControl("~/controls/LatestPresentations.ascx") as controls_LatestPresentations; c.loadContent(); return RenderControl(c); The control is a simple user control, with the namespace CFTW.Controls. The calling code is in a webcontrol, which lives in the same folder. I even tried adding the calling code to the same namespace.

    Read the article

  • Build Path issue with Java Android project when starting Eclipse

    - by Matt Smith
    I booted up eclipse to start on a project, and without typing in a word I already have several errors. package department.namespace; import android.app.Activity; import android.os.Bundle; public class DepartmentActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } At package department.namespace, it says: multiple marks at this line and the type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files The import android.os cannot be resolved. Override cannot be resolved as a type The method OnCreate(Bundle) is undefined for the type Activity R. cannot be resolved as a variable. Since this JUST came up when I started Eclipse, how do I fix this?

    Read the article

  • Simplest way to extend doctrine for MVC Models

    - by RobertPitt
    Im developing my own framework that uses namespaces. Doctrine is already integrated into my auto loading system and im now at the stage where ill be creating the model system for my application Usually i would create a simple model like so: namespace Application\Models; class Users extends \Framework\Models\Database{} which would inherit all the default database model methods, But with Doctrine im still learning how it all works, as its not just a simple DBAL. I need to understand whats the part of doctrine my classes would extend where i can do the following: namespace Application\Models; class Users Extends Doctrine\Something\Table { public $__table_name = "users"; } And thus within the controller i would be able to do the following: public function Display($uid) { $User = $this->Model->Users->findOne(array("id" => (int)$id)); } Anyone help me get my head around this ?

    Read the article

  • Display xml data in silverlight datagrid, vb.net

    - by Aishwarya
    I want to display an xml file data in silverlight datagrid. im using the below code but it doesnt work.Please help. My vb.net code: Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Windows Imports System.Windows.Controls Imports System.Xml.Linq Namespace SilverlightApplication1 Public Partial Class Page Inherits UserControl Public Sub New() InitializeComponent() End Sub Private Sub Page_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) DataGrid1.ItemsSource = GetPunchReport() End Sub Public Function GetStatusReport() As List(Of Table) Dim statusReport As New List(Of Table)() Dim doc As XElement = XElement.Load("Data/PunchReport.xml") report = (From row In doc.Elements() _ Select GetStatus(row)).ToList() Return statusReport End Function Private Function GetReport(ByVal row As XElement) As Table Dim s As New Table() s.JobID= row.Attribute("JobID").Value s.VenueName= row.Attribute("VenueName").Value) Return s End Function End Class End Namespace

    Read the article

  • What is the "Entity" reffering to in fluent Nhibernate Mapping Configuration?

    - by percent20
    I am trying to learn fluent nhibernate better so am doing a basic sample application from scratch, instead of using someone elses framework. However, I am finding I really don't understand what is going on in assigning mapping files. I have seen a lot of code examples which are all showing the same code, but nothing that spells it out. No description of how it works just that it works. Here is a code example that I see often. return Fluently.Configure() .Database(config) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entity>()) .BuildSessionFactory(); So in the code example what is Entity? and how does that piece of code work? Part of me thinks it is the name of the assembly, but seeing as how the namespace I am using is usually the name of the assembly the compiler complains that I am using a namespace as a type. I feel this is important and am rather flustered by the fact I can't figure it out. Thanks

    Read the article

  • mod_rewrite to change my urls

    - by user319859
    Hi, I've been fighting with mod-rewrite for a while. Basically, I have a website that I'm moving to a difference namespace/directory. What I'd like to do is change urls that look like this: http://mydomain.com/index.php?a=xxxxxxxxxx These urls will always have "index.php?a=". I have a different/new site that also has an index.php file, so it's important that I do a rewrite only when a= is in the URL. The new url should be like http://mydomain.com/ns1/index.php?a=xxxxxxxxxxx Seems pretty simple, but i can't seem to get mod_rewrite to do it for me, here's what I have: # rewrite old urls to new namespace RewriteRule ^/index.php\?a=(.*)$ /gc1/index.php\?x=1&a=$1 [R=301,L] See anything wrong?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >