Daily Archives

Articles indexed Thursday December 30 2010

Page 17/34 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Legal question.

    - by Kjow
    Hi all, a question bounces in my head from some time. Copyright laws are different by nation to nation, but generally which is the border line to break a copyright? Suppose to make a game that is very similar to an other come out in the past, e.g. a Pacman clone or a Space Invaders clone, but nothing from original titles are grabbed and maybe they're not made in 2d, but in 3d. The titles aren't "Pacman clone - the return" or "Space Invaders - they did it again", and not also "Pocman" or "Space Evaders" (maybe this last could be fun for some "creative financers" that need to escape from earth :D). Finally suppose to call these some thing like "Popcorn, fruit and ghosts" (or the acronym: "PFG") and "Kill all enemy" (or the acronym: "KAE"). In this case (not grab- all self-made) and no references to original titles, but with a game that feels very similar to "ispiration ones"... they could be sold to somewhere like "Valve's Steam"? Regards, Kjow

    Read the article

  • RTTI Delphi Create as TValue an n-dimensional matrix.

    - by user558126
    Good day, I had tried to make recurrent function to return a TValue as a n-dimensional. matrix(2D, 3D, 4D...) for example, this procedure will show a n-dimensional matrix(it will list all elements from a n-dimensional matrix as TValue variable): Procedure Show(X:TValue); var i:integer; begin if x.IsArray then begin for i:=0 to x.GetArrayLength-1 do show(x.GetArrayElement(i)); writeln; end else write(x.ToString,' '); end; I don't understand how to create a function to create from a TValue an n-dimensional matrix. For example i need a Function CreateDynArray(Dimensions:array of integer; Kind:TTypeKind):TValue; and the function will return a TValue which is a dynamic array how contain the dimenssions for example: Return=CreateDynArray([2,3],tkInteger); will return a TValue as tkDynArray and if i will show(Return) will list 0 0 0 0 0 0 Thank you very much, and have a nice day!

    Read the article

  • F# Interactive bug?

    - by John Reynolds
    I've tried the following code in VS2010: open System.Security.Cryptography let rsaTest1 = let ecKey = [|0uy..143uy|] // junk data for testing let ecKeyMod = ecKey.[8..8+128-1] let ecKeyExp = ecKey.[136..136+8-1] let rsa = RSAParameters(Modulus = ecKeyMod, Exponent = ecKeyExp) rsa let rsaTest2 = let ecKey = [|0uy..143uy|] // junk data for testing let rsa = RSAParameters(Modulus = ecKey.[8..8+128-1], Exponent = ecKey.[136..136+8-1]) rsa If I highlight all code and send it to F# Interactive (Alt+Enter), then rsaTest1 works, but rsaTest2 gives an error message, System.NullReferenceException: Object reference not set to an instance of an object. at <StartupCode$FSI_0004>.$FSI_0004.main@() in P:\proj\Tachograph\Project\CompuTachTest\CompuTachTest\rsaTest.fsx:line 16 However, if I change rsaTest2 from a value into a function and call it, let rsaTest2 () = let ecKey = [|0uy..143uy|] // junk data for testing let rsa = RSAParameters(Modulus = ecKey.[8..8+128-1], Exponent = ecKey.[136..136+8-1]) rsa let x = rsaTest2 () then there is no error. F# bug or my mistake?

    Read the article

  • Is this WPF error handling a good idea ?

    - by Adiel
    I have a multi threaded wpf application with various HW interfaces. I want to react to several HW failures that can happen. For example : one of the interfaces is a temperature sensor and i want that from a certain temp. a meesage would appear and notify the user that it happened. i came up with the follwing design : /// <summary> /// This logic reacts to errors that occur during the system run. /// The reaction is set by the component that raised the error. /// </summary> public class ErrorHandlingLogic : Logic { } the above class would consume ErrorEventData that holds all the information about the error that occurred. public class ErrorEventData : IEventData { #region public enum public enum ErrorReaction { } #endregion public enum #region Private Data Memebers and props private ErrorReaction m_ErrorReaction; public ErrorReaction ErrorReactionValue { get { return m_ErrorReaction; } set { m_ErrorReaction = value; } } private string m_Msg; public string Msg { get { return m_Msg; } set { m_Msg = value; } } private string m_ComponentName; public string ComponentName { get { return m_ComponentName; } set { m_ComponentName = value; } } #endregion Private Data Memebers and props public ErrorEventData(ErrorReaction reaction, string msg, string componenetName) { m_ErrorReaction = reaction; m_Msg = msg; m_ComponentName = componenetName; } } the above ErrorHandlingLogic would decide what to do with the ErrorEventData sent to him from various components of the application. if needed it would be forwarded to the GUI to display a message to the user. so what do you think is it a good design ? thanks, Adiel.

    Read the article

  • Managing a log stream in C++ in a cout-like notation

    - by Andry
    Hello! I have a class in c++ in order to write log files for an application of mine. I have already built the class and it works, it is something like this: class Logger { std::string _filename; public: void print(std::string tobeprinted); } Well, it is intuitive that, in order to print a line in the log file, for an object of Logger, it is simply necessary to do the following: Logger mylogger("myfile.log"); mylogger.print(std::string("This is a log line")); Well. Using a method approach is not the same as using a much better pattern like << is. I would like to do the following: Logger mylogger("myfile.log"); mylogger << "This is a log line"; That's all. I suppose I must overload the << operator... But overloading using this signature (the classic one): ostream& operator<<(ostream& output, const MyObj& o); But I do not have a ostream... So, should I do as follows? Logger& operator<<(Logger& output, const std::string& o); Is this the right way? Thanks

    Read the article

  • Android - Access to online Database SQlite

    - by Oneiros
    I need to open, read and insert items into an online SQLite database from an Android app. I know url, username and password. In JavaSE i would do the following: Class.forName("com.mysql.jdbc.Driver"); Connection dbConnection = DriverManager.getConnection(URL, USER, PASSWORD); I read that I can't do this in Android because there is not a JDBC Driver (there is a "SQLite.JDBCDriver" but it is not documented and not recommended). So which is the easiest way? I asked to Google but it looks like he either doesn't know.

    Read the article

  • git: How to move last N commits made to master, into own branch?

    - by amn
    Hi all, I have a repository where I had been working on master branch having last committed some 10 or so commits which I now wish were in another branch, as they describe work that I now consider experimental (i am still learning good git practices). Basically I would like to have these last 10 commits starting from a point in master to form another branch instead, so that I can have my master in a release state (which is what I strive for.) So, this is what I have (rightmost X is the last commit good for release): b--b (feature B) / X--X--X--Z--Z--Z--Z--Z--Z (master) \ a--a--a (feature A) You can see that both X and Z are on master, while I want commits marked by Z (my feature Z work) to lie on their own feature branch, and so that rightmost X is at the tip of master forming a good master branch tip. I guess this is what I want: b--b (feature B) / X--X--X (master) \ \ \ Z--Z--Z--Z--Z--Z (feature Z - the branch I want Z on) a--a--a (feature A) That way I will have my master always ready for release, and merge A, B and Z features when the time comes. Hope I am making sense here...

    Read the article

  • Matching two sections same number of times

    - by Leszczu
    Hello, i need a HTML to parse: <span>some text<span><span><span>text</span></span></span></span> I need to remove unnecessary <span> occurrences, so that output is: <span>some text<span>text</span></span> I wrote a regex, which does this once: /<SPAN>[^<]*<\/SPAN>/i How to make this work same number of times on both <span> and </span>?

    Read the article

  • How to format TimeSpan in xaml

    - by biju
    I am trying to format a textblock which is bound to a TimeSpan property.It works if the property is of type DateTime but it fails if it is a TimeSpan .I can get it done using a converter.But i am trying to find out if there is any alternatives. Sample Code public TimeSpan MyTime { get; set; } public Window2() { InitializeComponent(); MyTime = DateTime.Now.TimeOfDay; DataContext = this; } Xaml <TextBlock Text="{Binding MyTime,StringFormat=HH:mm}"/> I am expecting the textblock to show only hours and mintes.But it is showing like 19:10:46.8048860

    Read the article

  • Unusual Template Behavior with XSL

    - by bobber205
    Experiencing some very odd behavior with, what should be, a very simple use of XSL and XSLT. Here's a code sample. <xsl:template match="check"> <div class="check"> <xsl:apply-templates mode="check"> <xsl:with-param name="checkName">testVariable</xsl:with-param> </xsl:apple-templates> </div> </xsl:template> The template called above <xsl:template match="option" mode="check"> <xsl:param name="checkName" /> <div class="option"> <input type="checkbox"> </input> <label> testText </label> </div> </xsl:template> Pretty simple right? It should, for each instance of a instance in the XML create a checkbox in a with a hard coded label. However, what I'm getting is <div class="check"></div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="check"></div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> <div class="option>Checkbox stuff here</div> Here's some sample XML <check><option key="1"/><option key="0"/><option key="0"/><option key="0"/><option key="0"/></check> Anyone know what's going on? :D

    Read the article

  • how to read only english characters

    - by ralph
    I am reading a file that sometimes has chinese and characters of languages other than english. How can I write a regex that only reads english words/letters? should it just be /^[a-zA-Z]+/ ? If I do the above then words like eété will still be picked but I don't want them to be picked: "été".match(/^[a-zA-Z]+/) => #nil good I didnt want that word "eété".match(/^[a-zA-Z]+/) => #not nil tricked into picking something i did not want

    Read the article

  • Postmortem debugging with WinDBG.

    - by Drazar
    I have an WCF-service running on an server, and occasionally(1-2 times every month) it throws an COMException with the informative message ”Unknown error (0x8005008)”. When i googled for this particular error I only got threads about problems when creating virtual directories in IIS. And the source code hasn’t anything with making a virtual directory in IIS. DirectoryServiceLib.LdapProvider.Directory - CreatePost - Could not create employee for 195001010000,000000000000: System.Runtime.InteropServices.COMException (0x80005008): Unknown error (0x80005008) at System.DirectoryServices.PropertyValueCollection.PopulateList I've taken a memorydump when I catch the Exception for further analysis in WinDBG. After switching to the right thread I executed the !CLRStack command: 000000001b8ab6d8 000000007708671a [NDirectMethodFrameStandalone: 000000001b8ab6d8] Common.MemoryDump.MiniDumpWriteDump(IntPtr, Int32, IntPtr, MINIDUMP_TYPE, IntPtr, IntPtr, IntPtr) 000000001b8ab680 000007ff002808d8 DomainBoundILStubClass.IL_STUB_PInvoke(IntPtr, Int32, IntPtr, MINIDUMP_TYPE, IntPtr, IntPtr, IntPtr) 000000001b8ab780 000007ff00280812 Common.MemoryDump.CreateMiniDump(System.String) 000000001b8ab7e0 000007ff0027b218 DirectoryServiceLib.LdapProvider.Directory.CreatePost(System.String, DirectoryServiceLib.Model.Post, DirectoryServiceLib.Model.Presumptions, Services.Common.SourceEnum, System.String) 000000001b8ad6d8 000007fef8816869 [HelperMethodFrame: 000000001b8ad6d8] 000000001b8ad820 000007feec2b6c6f System.DirectoryServices.PropertyValueCollection.PopulateList() 000000001b8ad860 000007feec225f0f System.DirectoryServices.PropertyValueCollection..ctor(System.DirectoryServices.DirectoryEntry, System.String) 000000001b8ad8a0 000007feec22d023 System.DirectoryServices.PropertyCollection.get_Item(System.String) 000000001b8ad8f0 000007ff00274d34 Common.DirectoryEntryExtension.GetStringAttribute(System.String) 000000001b8ad940 000007ff0027f507 DirectoryServiceLib.LdapProvider.DirectoryPost.Copy(DirectoryServiceLib.LdapProvider.DirectoryPost) 000000001b8ad980 000007ff0027a7cf DirectoryServiceLib.LdapProvider.Directory.CreatePost(System.String, DirectoryServiceLib.Model.Post, DirectoryServiceLib.Model.Presumptions, Services.Common.SourceEnum, System.String) 000000001b8adbe0 000007ff00279532 DirectoryServiceLib.WCFDirectory.CreatePost(System.String, DirectoryServiceLib.Model.Post, DirectoryServiceLib.Model.Presumptions, Services.Common.SourceEnum, System.String) 000000001b8adc60 000007ff001f47bd DynamicClass.SyncInvokeCreatePost(System.Object, System.Object[], System.Object[]) My conclusion is that it fails when the code is calling System.DirectoryServices.PropertyCollection.get_Item(System.String). So after issuing an !CLRStack -a I get this result: 000000001b8ad8a0 000007feec22d023 System.DirectoryServices.PropertyCollection.get_Item(System.String) PARAMETERS: this = <no data> propertyName = <no data> LOCALS: <CLR reg> = 0x0000000001dcef78 <no data> My very first question is why does it display no data on the propertyname? I am kinda new on Windbg. However I executed an dumpobject on = 0x0000000001dcef78: 0:013> !do 0x0000000001dcef78 Name: System.String MethodTable: 000007fef66d6960 EEClass: 000007fef625eec8 Size: 74(0x4a) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll String: personalprescriptioncode Fields: MT Field Offset Type VT Attr Value Name 000007fef66dc848 40000ed 8 System.Int32 1 instance 24 m_stringLength 000007fef66db388 40000ee c System.Char 1 instance 70 m_firstChar 000007fef66d6960 40000ef 10 System.String 0 shared static Empty >> Domain:Value 0000000000174e10:00000000019d1420 000000001a886f50:00000000019d1420 << So when the source code wants to fetch the personalprescriptioncode from Active Directory(what is used for persistence layer) it fails. Looking back at the stack it is when issuing the Copy method. DirectoryServiceLib.LdapProvider.DirectoryPost.Copy(DirectoryServiceLib.LdapProvider.DirectoryPost) So looking in the sourcecode: DirectoryPost postInLimbo = DirectoryPostFactory.Instance().GetDirectoryPost(LdapConfigReader.Instance().GetConfigValue("LimboDN"), idGenPerson.ID.UserId); if (postInLimbo != null) newPost.Copy(postInLimbo); This code is looking for another post in OU=limbo with the same UserId and if it finds one it copies the attributes to the new post. In this case it does and it fails with personalprescriptioncode. I've looked in Active Directory under OU=Limbo and the post exist there with the attribute personalprescriptioncode=31243. Question 1: Why does it display no data for some of the PARAMETERS and LOCALS? Is it the GC who has cleaned up before the memorydump had been created. Question 2: Is there anymore i can do to get to the solution to this problem?

    Read the article

  • help with css formatting on table and div

    - by kralco626
    I have the following html (i'm also using Jquery and JqueryUI) <div style="display:none; position:fixed; z-index:100;padding:0;margin:0" class="ui-state-highlight" id="Info"> <table cellpadding="0" cellspacing="0" style="padding:0;margin:0"> <tr style="padding:0;margin:0;"> <td><span class="ui-icon ui-icon-info"></span></td> <td width = "100%" style="padding:0;margin:0;"><div id = "InfoText"></div></td> <td><button style="width:25px;height:25px;margin:0;padding:0" id="closeInfo"></button></td> </tr> </table> </div> It procudes the following: See where i circled in red? I want to get rid of that yellow space under the button, but i can't figure out how... Thanks!

    Read the article

  • How can I export an array from Dynamics AX 2009 via c#?

    - by Steve Homer
    I'm pulling data from Dynamics AX 2009 from c# using the following code snippet. This works fine, except for those cases where the underlying field type is a dimension. I want to be able to "flatten" array types when I return them but can't see any way to do this. Any ideas anyone? axRecord = ax.CreateAxaptaRecord(tableName); axRecord.ExecuteStmt(strQuery); // Loop through the set of retrieved records. using (StreamWriter sw = File.CreateText(path)) { AxaptaObject axDictTable = ax.CreateAxaptaObject("SysDictTable",axRecord.get_Field("tableid")); outputRow = null; List<int> ids = new List<int>(); for (int i = 1; i <= (int)axDictTable.Call("fieldCnt"); i++) { AxaptaObject axDictField = ax.CreateAxaptaObject("DictField", axRecord.get_Field("tableid"), axDictTable.Call("fieldCnt2ID", i)); outputRow += ((string)axDictField.Call("Name")) + ","; ids.Add((int)axDictTable.Call("fieldCnt2ID", i)); } sw.WriteLine(outputRow); while (axRecord.Found) { outputRow = null; foreach(int i in ids) outputRow += axRecord.get_Field(i).ToString().Replace(",", "") + ","; sw.WriteLine(outputRow); axRecord.Next(); } }

    Read the article

  • Mysql two table query

    - by Sergio
    I'm using two tables. First (friendlist), which contains users who are on the list of friends and the other table (members) that contains the basic data of the users. Friendlist looks like: id | myid | date | user ----------------------------------------- 001 | 50624 | 2010-01-01 | 32009 002 | 41009 | 2010-05-05 | 50624 003 | 50624 | 2010-03-02 | 23007 The column "myid" contains members who added other users (those from column "user") to their frindlist. I want to get the list of all users that I have added to list and those who add me to their friendlist. In this example, if my id is 50624, the list would look like: | allfriends | --------------- 32009 41009 23007 Then I need to check all users from "allfriend" list with data from the table "members". I want to get only the users with status 1. The members table looks like: id | status | photo -------------------------------- 32009 | 0 | 1.jpg 41009 | 1 | 2.jpg 23007 | 1 | 3.jpg How this mysql query should look like? Thanks for any help.

    Read the article

  • Compressing ASPX pageview in code or compress HTTP in IIS?

    - by DDiVita
    In the past, with pages with large viewstate I have overridden the PageStatePersister class so when the state is saved I compress it. On Load I decompress it. I have haven't really thought about it, but could IIS handle something like this better? The reason I did this was to keep my pages slimmer because I have a lot of custom controls on the page and the viewstate was huge. This is where I got my original code from: http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx?msg=1906999

    Read the article

  • How to give FTP address in java?

    - by i2ijeya
    I have written the code which downloads the file from FTP server. Since I have my FTP server locally and I want to access like "ftp://localhost/alfresco". It was alfresco's FTP. I have the following Code public class FtpTransfer { public static final void main(String[] args) { FTPClient ftp = new FTPClient(); FileOutputStream br = null; try { ftp.connect("ftp://localhost/alfresco"); ftp.login("admin", "admin"); String file = "KPUB//Admin//TMM//Pickup//TMM_TO_ARTESIA_06152010220246.xml"; br = new FileOutputStream("file"); ftp.retrieveFile("/"+file, br); System.out.println("Downloaded..."); } catch(IOException exception) { System.out.println("Error : "+exception); } } } The following exception occurs. Error : java.net.UnknownHostException: ftp://localhost/alfresco Please let me know how should I give the FTP Host Address?

    Read the article

  • Getting force close when i add view to other view when a thread is running

    - by Praveena
    Hi, I am getting the below error 12-30 05:40:40.484: ERROR/AndroidRuntime(413): Uncaught handler: thread Thread-10 exiting due to uncaught exception 12-30 05:40:40.494: ERROR/AndroidRuntime(413): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.ViewRoot.checkThread(ViewRoot.java:2629) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.ViewRoot.requestLayout(ViewRoot.java:545) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.View.requestLayout(View.java:7657) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.View.requestLayout(View.java:7657) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.View.requestLayout(View.java:7657) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.View.requestLayout(View.java:7657) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.View.requestLayout(View.java:7657) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.ViewGroup.addView(ViewGroup.java:1749) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.ViewGroup.addView(ViewGroup.java:1708) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at android.view.ViewGroup.addView(ViewGroup.java:1688) 12-30 05:40:40.494: ERROR/AndroidRuntime(413): at com.wwwww.shout.presentationLayer.Shout$1.run(Shout.java:137) and my code is myProgressDialog = ProgressDialog.show(Shout.this,"","Loading...",true); new Thread() { public void run() { String xml; xml="<spGetUserMessages><SearchLocation></SearchLocation></spGetUserMessages>"; messages =parse.GetGetUserMessages(dataparsing.ILGetUserMessages(xml)); myProgressDialog.dismiss(); ((LinearLayout)findViewById(R.id.LinearlayoutMessage)).addView(iiii); } }.start(); at the time of adding views to the layout i am getting the above error.what is the wrong in this.Please give me some suggestions.Thanks in advance

    Read the article

  • CAAnimation rotation did not give last stage?

    - by Mikhail Naimy
    hi, i am using following code to rotate the UIView through Swipe gesture .it works fine.but after rotation, it goes to beginning angle or Fromvalue.anyone can help to stop the view in last stage.if i rotate again, it must go from last stage. rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.fromValue = [NSNumber numberWithFloat:0.0 * M_PI]; rotationAnimation.toValue = [NSNumber numberWithFloat:0.5 * M_PI]; //rotationAnimation.toValue = [NSNumber numberWithFloat: 2.5 * 3.15 ]; rotationAnimation.duration = 1.5; //rotationAnimation.cumulative = YES; rotationAnimation.removedOnCompletion = NO; rotationAnimation.repeatCount = 0.0; rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; [self.view.layer addAnimation:rotationAnimation forKey:@"rotationAnimate"];

    Read the article

  • Don’t string together XML

    - by KyleBurns
    XML has been a pervasive tool in software development for over a decade.  It provides a way to communicate data in a manner that is simple to understand and free of platform dependencies.  Also pervasive in software development is what I consider to be the anti-pattern of using string manipulation to create XML.  This usually starts with a “quick and dirty” approach because you need an XML document and looks like (for all of the examples here, we’ll assume we’re writing the body of a method intended to take a Contact object and return an XML string): return string.Format("<Contact><BusinessName>{0}</BusinessName></Contact>", contact.BusinessName);   In the code example, I created (or at least believe I created) an XML document representing a simple contact object in one line of code with very little overhead.  Work’s done, right?  No it’s not.  You see, what I didn’t realize was that this code would be used in the real world instead of my fantasy world where I own all the data and can prevent any of it containing problematic values.  If I use this code to create a contact record for the business “Sanford & Son”, any XML parser will be incapable of processing the data because the ampersand is special in XML and should have been encoded as &amp;. Following the pattern that I have seen many times over, my next step as a developer is going to be to do what any developer in his right mind would do – instruct the user that ampersands are “bad” and they cannot be used without breaking computers.  This may work in many cases and is often accompanied by logic at the UI layer of applications to block these “bad” characters, but sooner or later someone is going to figure out that other applications allow for them and will want the same.  This often leads to the creation of “cleaner” functions that perform a replace on the strings for every special character that the person writing the function can think of.  The cleaner function will usually grow over time as support requests reveal characters that were missed in the initial cut.  Sooner or later you end up writing your own somewhat functional XML engine. I have never been told by anyone paying me to write code that they would like to buy a somewhat functional XML engine.  My employer/customer’s needs have always been for something that may use XML, but ultimately is functionality that drives business value. I’m not going to build an XML engine. So how can I generate XML that is always well-formed without writing my own engine?  Easy – use one of the ones provided to you for free!  If you’re in a shop that still supports VB6 applications, you can use the DomDocument or MXXMLWriter object (of the two I prefer MXXMLWriter, but I’m not going to fully describe either here).  For .Net Framework applications prior to the 3.5 framework, the code is a little more verbose than I would like, but easy once you understand what pieces are required:             using (StringWriter sw = new StringWriter())             {                 using (XmlTextWriter writer = new XmlTextWriter(sw))                 {                     writer.WriteStartDocument();                     writer.WriteStartElement("Contact");                     writer.WriteElementString("BusinessName", contact.BusinessName);                     writer.WriteEndElement(); // end Contact element                     writer.WriteEndDocument();                     writer.Flush();                     return sw.ToString();                 }             }   Looking at that code, it’s easy to understand why people are drawn to the initial one-liner.  Lucky for us, the 3.5 .Net Framework added the System.Xml.Linq.XElement object.  This object takes away a lot of the complexity present in the XmlTextWriter approach and allows us to generate the document as follows: return new XElement("Contact", new XElement("BusinessName", contact.BusinessName)).ToString();   While it is very common for people to use string manipulation to create XML, I’ve discussed here reasons not to use this method and introduced powerful APIs that are built into the .Net Framework as an alternative.  I’ve given a very simplistic example here to highlight the most basic XML generation task.  For more information on the XmlTextWriter and XElement APIs, check out the MSDN library.

    Read the article

  • dhcp3-server (dhcpd) is tampering with host NIC

    - by user61000
    Hi all, I have a debian box that is serving as a router (using iptables NAT). When first turned on, everything works fine for a few minutes. Then the dhcp server assigns an IP (other than 192.168.0.1) to its' host NIC, eth0. This is NOT what I want. I just want dhcp3-server to listen on eth0, not assign it an IP, and changes the kernel routing table. This of course ruins the NAT capablities of the box. How can I tell the dhcp3-server NOT to do this? Thanks Before dhcp3-server tampers with eth0, the IP is 192.168.0.1, and the routing table looks like this: ~# netstat -r Kernel IP routing table Destination Gateway Iface 192.168.0.0 * eth0 173.33.220.0 * eth1 default 173.33.220.1 eth1 After dhcp3-server tampers with eth0, the IP is 192.168.0.3, and the routing table looks like this: ~# netstat -r Kernel IP routing table Destination Gateway Iface 192.168.0.0 * eth0 173.33.220.0 * eth1 default 192.168.0.1 eth0 default 173.33.220.1 eth1 SETUP Outbound NIC is eth1 Internal NIC is eth0 /etc/network/interfaces ... iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 /etc/default/dhcp3-server INTERFACES="eth0"

    Read the article

  • Upgrading NAS hard drives

    - by Mihai Damian
    I was thinking of buying a NAS for home-usage. I've never used a NAS or had HDDs set up in Raids. Before I commit myself to moving all my data to a NAS I need to find out how difficult it is to upgrade and replace the NAS' hard drives. Suppose I set up a Raid 1 NAS with two 1TB hdds. At some point in the future I will use up all the space and will have to install two new 2TB hdds. Now I'll need to migrate the data from the old disks to the new ones. Will I have to hook up one of the old disks in a computer and copy all the data back in the NAS? Or can the migration be done using only the NAS? I realize the answer to the question might depend on the NAS model. Being a simple for-home solution I was thinking of getting something along the lines of D-link's 323.

    Read the article

  • yum remove doesn't remove things completely ?

    - by Shrinath
    I am trying to remove apache completely from my server,which is a ec2 instance, running Amazonian linux v2.6xx. Lets assume I have a file in /etc/httpd/conf/xyz.txt I am using the following code : yum remove httpd when I try to cd /etc/httpd I get "there is no such directory" error. Next, if I install httpd again, using this : yum install httpd, and then if I look in /etc/httpd/conf/ I still have that file as it is.. untouched.. How is this possible ? How do I "Clean" this ?

    Read the article

  • KVM Virtual guest Paused on Reboot

    - by David Hamilton
    I'm running REHL 6 and just installed a Ubuntu Server Guest via KVM set to start at boot. This works correctly and the guest loads, but it loads "paused" and requires that I manually un-pause it. Can someone give me a hint as to how I can I get the Guest OS to actually become active on boot? Here is the libvert dump as requested...Also tried libvert auto-start --- no effect. <domain type='kvm' id='1'> <name>MailServer</name> <uuid>a61dae75-1f5c-d536-718f-3c615d9b4868</uuid> <memory>4194304</memory> <currentMemory>4194304</currentMemory> <vcpu>4</vcpu> <os> <type arch='x86_64' machine='rhel6.0.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/home/MailServer/MailServer-1.img'/> <target dev='hda' bus='ide'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='52:54:00:cd:f9:9f'/> <source bridge='br0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/1'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/1'> <source path='/dev/pts/1'/> <target port='0'/> <alias name='serial0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes'/> <sound model='ac97'> <alias name='sound0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> <seclabel type='dynamic' model='selinux'> <label>system_u:system_r:svirt_t:s0:c211,c271</label> <imagelabel>system_u:object_r:svirt_image_t:s0:c211,c271</imagelabel> </seclabel></domain>

    Read the article

  • Question regarding IPv6 - Solicited-Node Address with a Link local scope

    - by Pulse
    Situation: A small LAN comprising a Windows 7 Ultimate x54 PC, 2 XP Pro x86 PCs and an Asus router.The Win 7 box has IPv6 enabled. There are no other IPv6 enabled devices on the LAN. In my firewall I see numerous requests originating from the Win 7 PC, which are for the Multicast address ff02::1:ff.... which is a Solicited-Node address query and has a scope of 2 which equates to the local link. As far as I knew local link addresses are filtered by routers, hence local link. Given that situation I'm wondering why I'm seeing these queries being generated to various addresses? Any ideas? Thanks.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >