Daily Archives

Articles indexed Monday May 31 2010

Page 15/98 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • creating xml element with two namespaces using libxml APIs

    - by iSight
    Hi, I want to create an xml element having two namespace as below: element name="Root" xmlns:xsi="myXSI" xmlns:xsd="myXSD" I have checked out with the existing APIs, but it is not getting in this form. I am getting as Root xmlns:xsd:xsi="myXSI" xmlns:xmlns:xsd="myXSD" I am using this APIss as below: xmlTextWriterWriteAttributeNS(xmlWriter, BAD_CAST "xmlns:xsd", BAD_CAST "xsi" , BAD_CAST "myXSD", BAD_CAST "myXSI");

    Read the article

  • How is ImmutableObjectAttribute used?

    - by Thomas Levesque
    I was looking for a built-in attribute to specify that a type is immutable, and I found only System.ComponentModel.ImmutableObjectAttribute. Using Reflector, I checked where it was used, and it seems that the only public class that uses it is System.Drawing.Image... WTF? It could have been used on string, int or any of the primitive types, but Image is definitely not immutable, there are plenty of ways to alter its internal state (using a Graphics or the Bitmap.SetPixel method for instance). So the only class in the BCL that is explicitly declared as immutable, is mutable! Or am I missing something?

    Read the article

  • who wrote 250k tests for webkit?

    - by amwinter
    assuming a yield of 3 per hour, that's 83000 hours. 8 hours a day makes 10,500 days, divide by thirty to get 342 mythical man months. I call them mythical because writing 125 tests per person per week is unreal. can any wise soul out there on SO shed some light on what sort of mythical men write unreal quantities of tests for large software projects? thank you. update chrisw thinks there are only 20k tests (check out his explanation below). PS I'd really like to hear from folks who have worked on projects with large test bases

    Read the article

  • Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)

    - by MusiGenesis
    I have a program with two methods. The first method takes two arrays as parameters, and performs an operation in which values from one array are conditionally written into the other, like so: void Blend(int[] dest, int[] src, int offset) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i + offset] = src[i] > rdr? src[i] : rdr; } } The second method creates two separate sets of int arrays and iterates through them such that each array of one set is Blended with each array from the other set, like so: void CrossBlend() { int[][] set1 = new int[150][75000]; // we'll pretend this actually compiles int[][] set2 = new int[25][10000]; // we'll pretend this actually compiles for (int i1 = 0; i1 < set1.Length; i1++) { for (int i2 = 0; i2 < set2.Length; i2++) { Blend(set1[i1], set2[i2], 0); // or any offset, doesn't matter } } } First question: Since this apporoach is an obvious candidate for parallelization, is it intrinsically thread-safe? It seems like no, since I can conceive a scenario (unlikely, I think) where one thread's changes are lost because a different threads ~simultaneous operation. If no, would this: void Blend(int[] dest, int[] src, int offset) { lock (dest) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i + offset] = src[i] > rdr? src[i] : rdr; } } } be an effective fix? Second question: If so, what would be the likely performance cost of using locks like this? I assume that with something like this, if a thread attempts to lock a destination array that is currently locked by another thread, the first thread would block until the lock was released instead of continuing to process something. Also, how much time does it actually take to acquire a lock? Nanosecond scale, or worse than that? Would this be a major issue in something like this? Third question: How would I best approach this problem in a multi-threaded way that would take advantage of multi-core processors (and this is based on the potentially wrong assumption that a multi-threaded solution would not speed up this operation on a single core processor)? I'm guessing that I would want to have one thread running per core, but I don't know if that's true.

    Read the article

  • Load a CSV file into a DataGrid

    - by Calanus
    I'm having a go at moving one of our simpler apps to Silverlight (a bit of a learning exercise). I've quickly come unstuck as I can't figure out how to load (or bind maybe?) a csv file to a datagrid (i.e. so you can point the app at a local csv file and display it to the user). I do have boilerplate code to parse a csv file and return a datatable but I'm shocked to discover that Silverlight doesn't even support DataTable (wtf!). Any ideas at all how to do this? How do people bind data to a datagrid anyhow? I'm using Silverlight 3.0 included in VS2010.

    Read the article

  • Executing Javascript without a browser?

    - by Daniel
    I am looking into Javascript programming without a browser. I want to run scripts from the Linux or Mac OS X command line, much like we run any other scripting language (ruby, php, perl, python...) $ javascript my_javascript_code.js I looked into spider monkey (Mozilla) and v8 (Google), but both of these appear to be embedded. Is anyone using Javascript as a scripting language to be executed from the command line? If anyone is curious why I am looking into this, I've been poking around node.js

    Read the article

  • Assignments failing

    - by Andrei Krotkov
    I'm debugging part of a large project in Visual Studio 2005, and stepping through the code line by line. int speed = this->values.speed; int ref = this->values.ref_speed; After stepping past the first line, values.speed has a value of 61, but for some reason, speed is getting assigned the value 58. After the second line, values.ref_speed has a value of 58, but ref gets assigned the value 30. When paused, you can see that the original values are in fact 61 and 58 respectively, but the values getting stored are different. What is causing this behaviour?

    Read the article

  • & ' " < > blah & ' " < > blah & ' " < > blah

    - by cfaweflj
    testr question couldn't be submitted because: * body must be at least 15 characters; you entered 4 * title too short; minimum length 15 r question couldn't be submitted because: * body must be at least 15 characters; you entered 4 * title too short; minimum length 15 r question couldn't be submitted because: * body must be at least 15 characters; you entered 4 * title too short; minimum length 15

    Read the article

  • How can this code throw a NullReferenceException?

    - by Davy8
    I must be going out of my mind, because my unit tests are failing because the following code is throwing a null ref exception: int pid = 0; if (parentCategory != null) { Console.WriteLine(parentCategory.Id); pid = parentCategory.Id; } The line that's throwing it is: pid = parentCategory.Id; The console.writeline is just to debug in the NUnit GUI, but that outputs a valid int. Edit: It's single-threaded so it can't be assigned to null from some other thread, and the fact the the Console.WriteLine successfully prints out the value shows that it shouldn't throw. Edit: Relevant snippets of the Category class: public class Category { private readonly int id; public Category(Category parent, int id) { Parent = parent; parent.PerformIfNotNull(() => parent.subcategories.AddIfNew(this)); Name = string.Empty; this.id = id; } public int Id { get { return id; } } } Well if anyone wants to look at the full code, it's on Google Code at http://code.google.com/p/chefbook/source/checkout I think I'm going to try rebooting the computer... I've seen pretty weird things fixed by a reboot. Will update after reboot. Update: Mystery solved. Looks like NUnit shows the error line as the last successfully executed statement... Copy/pasted test into new console app and ran in VS showed that it was the line after the if statement block (not shown) that contained a null ref. Thanks for all the ideas everyone. +1 to everyone that answered.

    Read the article

  • Drawing rubber band line during user drag

    - by Pete W
    In my iPhone app, I would like the user to be able to "connect" two of my views by: 1) starting a drag in View A 2) as they drag towards View B, a straight line with one end in View A and the other end under at the current drag point, animates in a rubber-band fashion 3) when/if they release in View B, the line is then shown between the two views I've seen examples of dragging and dropping views, and other examples of animations, but I haven't seen one that is a simple example of this kind of user-directed animation. Any pointers towards examples or the specific docs I should be looking at would be appreciated. If this turns out to be trivial - my apologies. Although I've done quite a bit of development, I'm just getting started in the iPhone SDK and Core Graphics.

    Read the article

  • How to get a detailed report of scans performed by spam-assassin?

    - by aquero
    Hi, I am planning to setup spam-assassin in my mail server for filtering out spam mails. I would like to get a detailed report of spam checks performed on incoming mails. This will help me in creating custom rules , so that legitimate mails wont be labeled as spam. Please tell me how to configure spam-assassin so that i get a detailed report of scans ?

    Read the article

  • Apache mod_deflate not compressing responses from Adobe BlazeDS

    - by DumCoder
    Hello, I have following setup Apache Box <=> Weblogic Box1 <=> Weblogic Box2 Apache Box : mod_weblogic(weblogic apache plugin), mod_deflate Weblogic Box1 : Weblogic 10.3 Weblogic Portal, Adobe BlazeDS Weblogic Box2 : Weblogic 10.3 SUN Jersey for REST API Apache forwards the request to Box1, where some of the REST requests get forwarded to Box 2 by Adobe BlazeDS. On Apache i have setup mod_deflate and mod_weblogic as follows: <IfModule mod_weblogic.c> WebLogicHost portalappeng.xxx.com WebLogicPort 7001 </IfModule> <Location /Portal> SetHandler weblogic-handler SetOutputFilter DEFLATE </Location> but when i look at the Apache deflate log i only see the jsp responses from Box1 being compressed, but the responses which BlazeDS forwarded to Box 2 are not compressed. Also the .js and .css files which are served from Box1 are not compressed Here are sample from log file, first response came directly from Box1 and got compressed, second and third also from Box1 but not compressed. Fourth one came from Box 2 to Box 1(BlazeDS) and then to Apache, not compressed. What am i missing? "GET /Portal/resources/services/userService/users?AppId=CM&CMUserType=ContentProducer&token=PSWNV8kb8db4WMBgWUjAbw%3D%3D&UserId=user123 HTTP/1.1" 711/7307 (9%) "GET /Portal/css/jquery-ui-1.7.2.custom.css HTTP/1.1" -/- (-%) "GET /Portal/framework/skins/shared/js/console.js HTTP/1.1" -/- (-%) "POST /Portal/messagebroker/http HTTP/1.1" -/- (-%)

    Read the article

  • WTF is wtf? (in WebKit code base)

    - by Motti
    I downloaded Chromium's code base and ran across the WTF namespace. namespace WTF { /* * C++'s idea of a reinterpret_cast lacks sufficient cojones. */ template<typename TO, typename FROM> TO bitwise_cast(FROM in) { COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_wtf_reinterpret_cast_sizeof_types_is_equal); union { FROM from; TO to; } u; u.from = in; return u.to; } } // namespace WTF Does this mean what I think it means? Could be so, the bitwise_cast implementation specified here will not compile if either TO or FROM is not a POD and is not (AFAIK) more powerful than C++ built in reinterpret_cast. The only point of light I see here is the nobody seems to be using bitwise_cast in the Chromium project. I see there's some legalese so I'll put in the little letters to keep out of trouble. /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

    Read the article

  • Why does Cache.Add return an object that represents the cached item?

    - by Pure.Krome
    From MSDN about the differences between Adding or Inserting an item the ASP.NET Cache: Note: The Add and Insert methods have the same signature, but there are subtle differences between them. First, calling the Add method returns an object that represents the cached item, while calling Insert does not. Second, their behavior is different if you call these methods and add an item to the Cache that is already stored there. The Insert method replaces the item, while the Add method fails. [emphasis mine] The second part is easy. No question about that. But with the first part, why would it want to return an object that represents the cached item? If I'm trying to Add an item to the cache, I already have/know what that item is? I don't get it. What is the reasoning behind this?

    Read the article

  • making cookies persistent in IE8

    - by Jamie Stevens
    There's a website I sign into frequently, and I'm getting sick of entering my username and password every time. The website can remember who I am so long as I don't close my browser (Internet Explorer 8), but when I do it forgets me, and asks me to login again. I'm guessing this is because it's using a cookie (and perhaps a session) that expires when I close my browser. Is there anyway to make this information persistent across each time I load my browser? (I tried exporting the cookies to a file, and then importing them as soon as the browser was reloaded, but that didn't work either... I'm thinking the cookie text file needs to be modified somehow.) (FYI The website is http://blackboard.unh.edu, but you won't have access unless you happen to be a student there :-) NOTE: I'm not interested in using any password remembering features in the browser. The only solution I'm open to is making the cookie / session persistent somehow!

    Read the article

  • [symbian Qt] phoneGap files not found in QT-creator

    - by user339865
    Hi, i'm new to Qt, i just install all in one QT-SDK beta with QT-creator as described here. I tried to import PhoneGap example files like from there (I use Qt-creator coz when I try to do it on Carbide, as described, it said that my EPOCROOT is wrong, but it isn't). When I want to debug or run project it said that there is no some files, but i see them in files-tree (look). Any dieas what's going on?

    Read the article

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