Daily Archives

Articles indexed Sunday March 14 2010

Page 28/89 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Serializing Class Derived from Generic Collection yet Deserializing the Generic Collection

    - by Stacey
    I have a Repository Class with the following method... public T Single<T>(Predicate<T> expression) { using (var list = (Models.Collectable<T>)System.Xml.Serializer.Deserialize(typeof(Models.Collectable<T>), FileName)) { return list.Find(expression); } } Where Collectable is defined.. [Serializable] public class Collectable<T> : List<T>, IDisposable { public Collectable() { } public void Dispose() { } } And an Item that uses it is defined.. [Serializable] [System.Xml.Serialization.XmlRoot("Titles")] public partial class Titles : Collectable<Title> { } The problem is when I call the method, it expects "Collectable" to be the XmlRoot, but the XmlRoot is "Titles" (all of object Title). I have several classes that are collected in .xml files like this, but it seems pointless to rewrite the basic methods for loading each up when the generic accessors do it - but how can I enforce the proper root name for each file without hard coding methods for each one? The [System.Xml.Serialization.XmlRoot] seems to be ignored. When called like this... var titles = Repository.List<Models.Title>(); I get the exception <Titlesxmlns=''> was not expected. The XML is formatted such as. .. <?xml version="1.0" encoding="utf-16"?> <Titles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Title> <Id>442daf7d-193c-4da8-be0b-417cec9dc1c5</Id> </Title> </Titles> Here is the deserialization code. public static T Deserialize<T>(String xmlString) { System.Xml.Serialization.XmlSerializer XmlFormatSerializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); StreamReader XmlStringReader = new StreamReader(xmlString); //XmlTextReader XmlFormatReader = new XmlTextReader(XmlStringReader); try { return (T)XmlFormatSerializer.Deserialize(XmlStringReader); } catch (Exception e) { throw e; } finally { XmlStringReader.Close(); } }

    Read the article

  • Warning: control reaches end of non-void function - iPhone

    - by Dave
    I keep getting 'warning: control reaches end of non-void function' with this code: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section ==0) { return [comparativeList count]; } if (section==1) { return [generalList count]; } if (section==2) { return [contactList count]; How can I get rid of this warning? Thanks.

    Read the article

  • Changing the namespace for a Web Reference in a Project to be Made Into a VS Project Template

    - by kdmurray
    When I add a web reference to a project, it comes up with a default namespace of: com.wpdevs.myservice. This is the namespace I'd have expected it to use in the application. When I add the using statement to the project, I have to add: using MyProject.com.wpdevs.myservice; I'd like to find a way to eliminate having to reference the project name in the using statement. The project I'm putting together now is destined to be converted into a VS Project template and having that rather strange reference in there, or even having a per-project reference, isn't something I'd like to have in the project.

    Read the article

  • Lua : Dynamically calling a function with arguments.

    - by Tipx
    Using Lua, I'm trying to dynamically call a function with parameters. I want to send a string to be parsed in a way that: 1st argument is a class instance "Handle" 2nd is the function to be called All that is left are arguments "modules" is a a table like { string=<instance of a class> } split() is a simple parser that returns a table with indexed strings. function Dynamic(msg) local args = split(msg, " ") module = args[1] table.remove(args, 1) if module then module = modules[module] command = args[1] table.remove(args, 1) if command then if not args then module[command]() else module[command](unpack(args)) -- Reference 1 end else -- Function doesnt exist end else -- Module doesnt exist end end When I try this with "ignore remove bob", by "Reference 1", it tries to call "remove" on the instance associated with "ignore" in modules, and gives the argument "bob", contained in a table (with a single value). However, on the other side of the call, the remove function does not receive the argument. I even tried to replace the "Reference 1" line with module[command]("bob") but I get the same result.

    Read the article

  • Mirror SVN Repository [Write-through proxying]

    - by Munim Abdul
    Hi, I have a codebase located in Europe and access this codebase from Asia. Codebase is substantially huge, downloading the whole codebase (which is required sometimes) becomes a pain. I wanted to know whether anything like this. I want a solution that "I will have a svn server locally which will sync with the main svn and serve my team as the svn is locally hosted." Thanks in advance Munim

    Read the article

  • How can I make "month" columns in Sql?

    - by Beska
    I've got a set of data that looks something like this (VERY simplified): productId Qty dateOrdered --------- --- ----------- 1 2 10/10/2008 1 1 11/10/2008 1 2 10/10/2009 2 3 10/12/2009 1 1 10/15/2009 2 2 11/15/2009 Out of this, we're trying to create a query to get something like: productId Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec --------- ---- --- --- --- --- --- --- --- --- --- --- --- --- 1 2008 0 0 0 0 0 0 0 0 0 2 1 0 1 2009 0 0 0 0 0 0 0 0 0 3 0 0 2 2009 0 0 0 0 0 0 0 0 0 3 2 0 The way I'm doing this now, I'm doing 12 selects, one for each month, and putting those in temp tables. I then do a giant join. Everything works, but this guy is dog slow. I know this isn't much to go on, but knowing that I barely qualify as a tyro in the db world, I'm wondering if there is a better high level approach to this that I might try. (I'm guessing there is.) (I'm using MS Sql Server, so answers that are specific to that DB are fine.) (I'm just starting to look at "PIVOT" as a possible help, but I don't know anything about it yet, so if someone wants to comment about that, that might be helpful as well.)

    Read the article

  • How to pass textbox value from one webform to a xtrareport ?

    - by ahmed
    Hello, I have a web form where I have a textbox in which the user will enter the number and pull the information from the table. Now I have developed a xtrareport, where I have to display the data of which the user enters in that textbox which I mentioned earlier. Everything works fine, only I need to just pass the value of the texbox(form1) to the report (form2). Now what I need is how to pass the textbox value as a parameter to the report and display the report data of the selected number.

    Read the article

  • Creating a sub site in SharePoint takes a very long time

    - by denni
    Hi, I am working in a MOSS 2007 project and have customized many parts of it. There is a problem in the production server where it takes a very long time (more than 15 minutes, sometimes fails due to timeouts) to create a sub site (even with the built-in site templates). While in the development server, it only takes 1 to 2 minutes. Both servers are having same configuration with 8 cores CPU and 8 GIGs RAM. Both are using separate database servers with the same configuration. The content db size is around 100 GB. More than a hundred subsites are there. What could be the reason why in the other server it will take so much time? Is there any configuration or something else I need to take care? Thanks a lot, all helps are appreciated.

    Read the article

  • Updated the Whiteboard Demo

    - by Bobby Diaz
    Just a quick update to let everyone know that I have updated the Whiteboard demo application.  I added a few options to make it more interesting to use!  I showed it to the kids and they loved it (even though they kept asking ME to draw pictures for them)!   Here is a list of available options: Color Picker for line color Slider for line thickness Save to XML file Open saved drawing Clear whiteboard Hold down ESC key to erase And here is a screenshot of my beautiful artwork! :) So what are you waiting for?  Go play with the Live Demo (and be sure to share with the kids) or download the source code. Enjoy!

    Read the article

  • Self-powered USB hub and power supply adapter ampere capacity

    - by galacticninja
    I am looking for a power supply adapter for my USB Hub so it can support at least 2 bus-powered external hard drives. The hub's rating is 5 volts, 2 amperes. I would like to know if it would be OK to buy a power supply adapter rated at less than 2A. I've been looking for power supply adapters and the ones that do support 2A are more expensive (more expensive than the USB hub itself) compared to those that support less than 2A. Will power supply adapter that supports less than 2A (~1-1.5A) work fine to support two external hard drives? The external hard drives are both bus-powered Western Digital My Passport Essentials 250 GB. The OS is Windows XP SP3.

    Read the article

  • Usage Tracking for Windows desktop applications ...

    - by sdaas
    Hi, I am looking for some frameworks that can be used to collect usage information for Windows desktop application and analyze it. For example, I would like to be able to answer questions like (a) how many times do people use this application in a day (b) which are their favorite menu items, etc. I looked briefly at Google Analytics and Omniture SiteCatalyst but they seem to work only on web applications. Thanks SD

    Read the article

  • Why is "while" loop really needed in Python?

    - by Tomaž Pisanski
    I was told that 95% of all loops in Python are "for" loops. Since "while" loops are clearly more "dangerous" than "for" loops, I would like to know if there are situations in which the use of a "while" loop is essential. For teaching purposes it would be useful to know if there is a systematic way of transforming "while" loops into "for" loops.

    Read the article

  • how to loop through menu and remove class and then add class to current menu item

    - by Jonathan Lyon
    Hi all I have this menu structure that is used to navigate through content slider panels. <div id="menu"> <ul> <li><a href="#1" class="cross-link highlight">Bliss Fine Foods</a></li> <li><a href="#2" class="cross-link">Menus</a></li> <li><a href="#3" class="cross-link">Wines</a></li> <li><a href="#4" class="cross-link">News</a></li> <li><a href="#5" class="cross-link">Contact Us</a></li> </ul> </div> I would like to loop through these elements and remove the highlight class and then add the highlight class to the current / last clicked menu item. Any ideas? Any help would be greatly appreciated. Thanks Jonathan

    Read the article

  • Codeigniter PHP Framework - Need to get query string

    - by Siva
    Hi, I'm creating a e-commerce site using Codeigniter. My question is, how should i get the query string. Am using a saferpay payment gateway, the gateway response will be like this http://www.test.com/registration/success/?DATA=<IDP+MSGTYPE%3D"PayConfirm"+KEYID%3D"1-0"+ID%3D"KI2WSWAn5UG3vAQv80AdAbpplvnb"+TOKEN%3D"(unused)"+VTVERIFY%3D"(obsolete)"+IP%3D" 123.25.37.43"+IPCOUNTRY%3D"IN"+AMOUNT%3D"832200"+CURRENCY%3D"CHF"+PROVIDERID%3D"90"+PROVIDERNAME%3D"Saferpay+Test+Card"+ACCOUNTID%3D"99867-94913159"+ECI%3D"2"+CCCOUNTRY%3D"XX"%2F>&SIGNATURE=bc8e253e2a8c9ee0271fc45daca05eecc43139be6e7d486f0d6f68a356865457a3afad86102a4d49cf2f6a33a8fc6513812e9bff23371432feace0580f55046c To handle the response i need to get the query string data. Help would be much appreciated. Thanks in advance. - Siva

    Read the article

  • ParallelWork: Feature rich multithreaded fluent task execution library for WPF

    - by oazabir
    ParallelWork is an open source free helper class that lets you run multiple work in parallel threads, get success, failure and progress update on the WPF UI thread, wait for work to complete, abort all work (in case of shutdown), queue work to run after certain time, chain parallel work one after another. It’s more convenient than using .NET’s BackgroundWorker because you don’t have to declare one component per work, nor do you need to declare event handlers to receive notification and carry additional data through private variables. You can safely pass objects produced from different thread to the success callback. Moreover, you can wait for work to complete before you do certain operation and you can abort all parallel work while they are in-flight. If you are building highly responsive WPF UI where you have to carry out multiple job in parallel yet want full control over those parallel jobs completion and cancellation, then the ParallelWork library is the right solution for you. I am using the ParallelWork library in my PlantUmlEditor project, which is a free open source UML editor built on WPF. You can see some realistic use of the ParallelWork library there. Moreover, the test project comes with 400 lines of Behavior Driven Development flavored tests, that confirms it really does what it says it does. The source code of the library is part of the “Utilities” project in PlantUmlEditor source code hosted at Google Code. The library comes in two flavors, one is the ParallelWork static class, which has a collection of static methods that you can call. Another is the Start class, which is a fluent wrapper over the ParallelWork class to make it more readable and aesthetically pleasing code. ParallelWork allows you to start work immediately on separate thread or you can queue a work to start after some duration. You can start an immediate work in a new thread using the following methods: void StartNow(Action doWork, Action onComplete) void StartNow(Action doWork, Action onComplete, Action<Exception> failed) For example, ParallelWork.StartNow(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }, () => { workEndedAt = DateTime.Now; }); Or you can use the fluent way Start.Work: Start.Work(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }) .OnComplete(() => { workCompletedAt = DateTime.Now; }) .Run(); Besides simple execution of work on a parallel thread, you can have the parallel thread produce some object and then pass it to the success callback by using these overloads: void StartNow<T>(Func<T> doWork, Action<T> onComplete) void StartNow<T>(Func<T> doWork, Action<T> onComplete, Action<Exception> fail) For example, ParallelWork.StartNow<Dictionary<string, string>>( () => { test = new Dictionary<string,string>(); test.Add("test", "test"); return test; }, (result) => { Assert.True(result.ContainsKey("test")); }); Or, the fluent way: Start<Dictionary<string, string>>.Work(() => { test = new Dictionary<string, string>(); test.Add("test", "test"); return test; }) .OnComplete((result) => { Assert.True(result.ContainsKey("test")); }) .Run(); You can also start a work to happen after some time using these methods: DispatcherTimer StartAfter(Action onComplete, TimeSpan duration) DispatcherTimer StartAfter(Action doWork,Action onComplete,TimeSpan duration) You can use this to perform some timed operation on the UI thread, as well as perform some operation in separate thread after some time. ParallelWork.StartAfter( () => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }, () => { workCompletedAt = DateTime.Now; }, waitDuration); Or, the fluent way: Start.Work(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }) .OnComplete(() => { workCompletedAt = DateTime.Now; }) .RunAfter(waitDuration);   There are several overloads of these functions to have a exception callback for handling exceptions or get progress update from background thread while work is in progress. For example, I use it in my PlantUmlEditor to perform background update of the application. // Check if there's a newer version of the app Start<bool>.Work(() => { return UpdateChecker.HasUpdate(Settings.Default.DownloadUrl); }) .OnComplete((hasUpdate) => { if (hasUpdate) { if (MessageBox.Show(Window.GetWindow(me), "There's a newer version available. Do you want to download and install?", "New version available", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { ParallelWork.StartNow(() => { var tempPath = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.Default.SetupExeName); UpdateChecker.DownloadLatestUpdate(Settings.Default.DownloadUrl, tempPath); }, () => { }, (x) => { MessageBox.Show(Window.GetWindow(me), "Download failed. When you run next time, it will try downloading again.", "Download failed", MessageBoxButton.OK, MessageBoxImage.Warning); }); } } }) .OnException((x) => { MessageBox.Show(Window.GetWindow(me), x.Message, "Download failed", MessageBoxButton.OK, MessageBoxImage.Exclamation); }); The above code shows you how to get exception callbacks on the UI thread so that you can take necessary actions on the UI. Moreover, it shows how you can chain two parallel works to happen one after another. Sometimes you want to do some parallel work when user does some activity on the UI. For example, you might want to save file in an editor while user is typing every 10 second. In such case, you need to make sure you don’t start another parallel work every 10 seconds while a work is already queued. You need to make sure you start a new work only when there’s no other background work going on. Here’s how you can do it: private void ContentEditor_TextChanged(object sender, EventArgs e) { if (!ParallelWork.IsAnyWorkRunning()) { ParallelWork.StartAfter(SaveAndRefreshDiagram, TimeSpan.FromSeconds(10)); } } If you want to shutdown your application and want to make sure no parallel work is going on, then you can call the StopAll() method. ParallelWork.StopAll(); If you want to wait for parallel works to complete without a timeout, then you can call the WaitForAllWork(TimeSpan timeout). It will block the current thread until the all parallel work completes or the timeout period elapses. result = ParallelWork.WaitForAllWork(TimeSpan.FromSeconds(1)); The result is true, if all parallel work completed. If it’s false, then the timeout period elapsed and all parallel work did not complete. For details how this library is built and how it works, please read the following codeproject article: ParallelWork: Feature rich multithreaded fluent task execution library for WPF http://www.codeproject.com/KB/WPF/parallelwork.aspx If you like the article, please vote for me.

    Read the article

  • Missing dependency when trying to update

    - by ant2009
    Hello, Fedora 12 2.6.32.9-67.fc12.i686 I have tried doing the recommended as its saids at the bottom. However, that didn't work. So I have to yum upgrade --skip-broken Does anyone know how to solve this problem? Many thanks nss-3.12.6-1.2.fc12.i686 from updates has depsolving problems --> Missing Dependency: nspr >= 4.8.4 is needed by package nss-3.12.6-1.2.fc12.i686 (updates) nss-3.12.6-1.2.fc12.i686 from updates has depsolving problems --> Missing Dependency: nss-util = 3.12.6 is needed by package nss-3.12.6-1.2.fc12.i686 (updates) Error: Missing Dependency: nspr >= 4.8.4 is needed by package nss-3.12.6-1.2.fc12.i686 (updates) Error: Missing Dependency: nss-util = 3.12.6 is needed by package nss-3.12.6-1.2.fc12.i686 (updates) You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest

    Read the article

  • Install GIMP 2.7.1 on Lucid Lynx using PPA

    - by Vivek
    GIMP lovers are going to be disappointed to hear that GIMP is going away in the next release of much awaited Ubuntu 10.04. Today we take a look at installing in on Lucid Lynx using PPA. The reason for getting rid of it as cited by the GIMP developers, is that GIMP is too professional a software to be included in regular desktop version of Ubuntu. And it takes up too much of space on the disk. Also, the fact that it’s too complicated for regular users. If you can’t live without it…let’s see how to install GIMP 2.7.1 on Lucid Lynx (Currently in Alpha). The new version of GIMP supports single window mode and we will also see how to enable this feature as well. First we need to add the official GIMP 2.7.1 PPA in the software sources of Ubuntu 10.04, by opening the terminal window and typing the following command: sudo sh -c “echo ‘deb http://ppa.launchpad.net/matthaeus123/mrw-gimp-svn/ubuntu lucid main’ >> /etc/apt/sources.list” Now that we have added the PPA we need to add the GPG key, so type the following in your Terminal window. sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 405A15CB Next up we have to update the software repository… sudo apt-get update All that is left is to install GIMP 2.7.1 by typing in the following… sudo apt-get install gimp Click ‘Y’ (for yes) to install GIMP Once GIMP is installed you can start it by going to Applications > Graphics > GNU Image Manipulation Program. You now have your favorite GIMP on your favorite Ubuntu 10.04. As you can see in the image below, GIMP still comes with default 3 windows, which could clog up your lower panel In Ubuntu 10.04. However, now you can run GIMP in single window mode by going to Windows > Single-Window mode. That’s all! Now you have your GIMP running in single window mode with less of hassle to manage 3 windows. It’s unfortunate that GIMP will not be included, but by following these instructions, you’ll be able to enjoy using it in Ubuntu 10.04. Similar Articles Productive Geek Tips Show the List of Installed Packages on Ubuntu or DebianHow to Install Windows Applications on Linux Using CrossoverInstall VMware Tools on Ubuntu Edgy EftInstall Adobe PDF Reader on Ubuntu EdgyInstall MySQL Server 4.1 on Ubuntu TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 PCmover Professional Stretch popurls.com with a Stylish Script (Firefox) OldTvShows.org – Find episodes of Hitchcock, Soaps, Game Shows and more Download Microsoft Office Help tab The Growth of Citibank Quickly Switch between Tabs in IE Windows Media Player 12: Tweak Video & Sound with Playback Enhancements

    Read the article

  • rules precedence in bison

    - by arbiadr
    Hi Here is the grammar rules: ProcessExpression : EventExpression "->" ProcessExpression | ProcessName ; Please can you tell me how can I tell to bison that the first rule has the highest precedence than the second one? I have tried: %nonassoc PROC %right "->" ProcessExpression : EventExpression "->" ProcessExpression | ProcessName % prec PROC; But without any result. Thank you.

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >