Daily Archives

Articles indexed Thursday April 8 2010

Page 3/125 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Unit test class inherited from ContextBoundObject and decorated with ContextAttribute

    - by Joel Cunningham
    I am trying to retrofit unit tests on to some existing code base. Both the class and method I want to unit test is decorated with custom attributes that are inherited from ContextBoundObject and ContextAttribute. I dont want them to run as part of the unit test. The only solution I have come up with is to compile the attribute out when I want to unit test. I dont really like this solution and would prefer to either replace it with a mocked attribute at runtime or prevent the attribute from running in a more elegant way. How do you unit test code that has class and method attributes that inherit from ContextBoundObject and ContextAttribute that you dont want to run as part of a unit test? Thanks in advance.

    Read the article

  • Dispatcher.BeginInvoke problems

    - by cmaduro
    I'm getting "An object reference is required for the non-static field, method, or property 'System.Windows.Threading.Dispatcher.BeginInvoke(System.Action)'" for this code. private void ResponseCompleted(IAsyncResult result) { HttpWebRequest request = result.AsyncState as HttpWebRequest; HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { Dispatcher.BeginInvoke( () => { try { XDocument resultsXml = XDocument.Load(sr); QueryCompleted(new QueryCompletedEventArgs(resultsXml)); } catch (XmlException e) { XDocument errorXml = new XDocument(new XElement("error", e.Message)); QueryCompleted(new QueryCompletedEventArgs(errorXml)); } }); } } }

    Read the article

  • How should I change my Graph structure (very slow insertion)?

    - by Nazgulled
    Hi, This program I'm doing is about a social network, which means there are users and their profiles. The profiles structure is UserProfile. Now, there are various possible Graph implementations and I don't think I'm using the best one. I have a Graph structure and inside, there's a pointer to a linked list of type Vertex. Each Vertex element has a value, a pointer to the next Vertex and a pointer to a linked list of type Edge. Each Edge element has a value (so I can define weights and whatever it's needed), a pointer to the next Edge and a pointer to the Vertex owner. I have a 2 sample files with data to process (in CSV style) and insert into the Graph. The first one is the user data (one user per line); the second one is the user relations (for the graph). The first file is quickly inserted into the graph cause I always insert at the head and there's like ~18000 users. The second file takes ages but I still insert the edges at the head. The file has about ~520000 lines of user relations and takes between 13-15mins to insert into the Graph. I made a quick test and reading the data is pretty quickly, instantaneously really. The problem is in the insertion. This problem exists because I have a Graph implemented with linked lists for the vertices. Every time I need to insert a relation, I need to lookup for 2 vertices, so I can link them together. This is the problem... Doing this for ~520000 relations, takes a while. How should I solve this? Solution 1) Some people recommended me to implement the Graph (the vertices part) as an array instead of a linked list. This way I have direct access to every vertex and the insertion is probably going to drop considerably. But, I don't like the idea of allocating an array with [18000] elements. How practically is this? My sample data has ~18000, but what if I need much less or much more? The linked list approach has that flexibility, I can have whatever size I want as long as there's memory for it. But the array doesn't, how am I going to handle such situation? What are your suggestions? Using linked lists is good for space complexity but bad for time complexity. And using an array is good for time complexity but bad for space complexity. Any thoughts about this solution? Solution 2) This project also demands that I have some sort of data structures that allows quick lookup based on a name index and an ID index. For this I decided to use Hash Tables. My tables are implemented with separate chaining as collision resolution and when a load factor of 0.70 is reach, I normally recreate the table. I base the next table size on this http://planetmath.org/encyclopedia/GoodHashTablePrimes.html. Currently, both Hash Tables hold a pointer to the UserProfile instead of duplication the user profile itself. That would be stupid, changing data would require 3 changes and it's really dumb to do it that way. So I just save the pointer to the UserProfile. The same user profile pointer is also saved as value in each Graph Vertex. So, I have 3 data structures, one Graph and two Hash Tables and every single one of them point to the same exact UserProfile. The Graph structure will serve the purpose of finding the shortest path and stuff like that while the Hash Tables serve as quick index by name and ID. What I'm thinking to solve my Graph problem is to, instead of having the Hash Tables value point to the UserProfile, I point it to the corresponding Vertex. It's still a pointer, no more and no less space is used, I just change what I point to. Like this, I can easily and quickly lookup for each Vertex I need and link them together. This will insert the ~520000 relations pretty quickly. I thought of this solution because I already have the Hash Tables and I need to have them, then, why not take advantage of them for indexing the Graph vertices instead of the user profile? It's basically the same thing, I can still access the UserProfile pretty quickly, just go to the Vertex and then to the UserProfile. But, do you see any cons on this second solution against the first one? Or only pros that overpower the pros and cons on the first solution? Other Solution) If you have any other solution, I'm all ears. But please explain the pros and cons of that solution over the previous 2. I really don't have much time to be wasting with this right now, I need to move on with this project, so, if I'm doing to do such a change, I need to understand exactly what to change and if that's really the way to go. Hopefully no one fell asleep reading this and closed the browser, sorry for the big testament. But I really need to decide what to do about this and I really need to make a change. P.S: When answering my proposed solutions, please enumerate them as I did so I know exactly what are you talking about and don't confuse my self more than I already am.

    Read the article

  • Need Recommendations: Network Software and Hardware Setup for small firm

    - by Rogue
    Will be starting a small graphics design firm soon, with 20 employees. Therefore need software to manage the network. Have bought a bulk license of Windows 7. I have a spare computer which can act as a server if necessary, but its an ancient Dell machine (Pentium-III). If required I would purchase an extra machine, but would like to avoid unnecessary costs at start up. Following are the main functions that I would like to perform: Need to monitor\control network traffic and internet usage, restrict access to certain websites Alerts when access to certain software's, and when trying to tamper with privileges Ability to view desktops of any computer at any given time Limit access to certain hardware like USB ports,etc Limit access to folders on the computer Log/Report of all actions including keystrokes performed on any computer Local Network chat and talk client Collaboration and Work logs Any Software available to do all of the above and also any additional hardware required besides network switches, network card's and CAT5e cables. Any other recommendations besides the above mentioned hardware setup

    Read the article

  • How to check mysql remote connectivity

    - by Mirage
    I have enable the ips in WHM for remote mysql but still i am not able to connect it. Is there any shell command for mysql which i can type to check the remote connectivity I mean any command to execute on server itself where mysql is installed or Any command to execute of local linux to check connectivity on remote MYsql server OS remote :Centos 5.4 local OS : Ubuntu

    Read the article

  • Computer POST's and draws the BIOS screens very slowly - Motherboard issue?

    - by Ssvarc
    I have a desktop that refuses to boot into Windows. I used Hitachi DFT and the HD came back OK. I then used Memtest86+ and it took hours for the test to run. After 8+ hours it was up to test number 6. I aborted and ran Memtest86. It ran at basically the same speed. I aborted and went to look at the BIOS settings. The computer is running slow at POST. It takes a long time for the keyboard to be recognized, etc. The BIOS settings takes time to be (slowly) drawn on the screen. What could be causing such behavior? EDIT: I gave back the computer a while back without ever discovering the cause so I'm closing the question.

    Read the article

  • f# naming conventions.. WTF??!!

    - by Peter Goras
    let w t f = have I missed something? do all value names in F# have to be a single char? preferably x? and do all method names have to abbreviated to a cryptic four chars?? we've had it rammed down our throats for years about descriptive variable/method names in other languages but now this doesnt apply to F#? or it is some coding 'style' bollox? Learning from code examples is hard enough with type inference. why make it harder?

    Read the article

  • WPF Applying a trigger on binding failure

    - by Aran Mulholland
    This question is a follow on from this one... I am binding to a heterogeneous collection of objects, not all objects have the same set of properties. I am doing this in a datagrid. I would like to gray out the cell if the binding fails. Is there a way to apply a trigger if a binding fails?

    Read the article

  • jquery xml exists

    - by mmcgrail
    I just want to use javescript /jquery to determine if and xml file exsists I don't need to process it I just need to know that its available or not. can seem to find simple check. thanks

    Read the article

  • What's the best practice to add default function to jQuery Dialog open/close events?

    - by BlueFox
    Hi All, I'm trying to define some default behaviours for my jQuery Dialogs like the following: (function($) { /** * Overriding default options **/ $.ui.dialog.defaults.bgiframe = true; $.ui.dialog.defaults.open = function() { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','hidden'); $('html').css('overflow-x','hidden'); } else { // disable scrollbar for other browsers $('body').css('overflow','hidden'); } }; $.ui.dialog.defaults.beforeclose = function(event, ui) { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','auto'); $('html').css('overflow-x','auto'); } else { // disable scrollbar for other browsers $('body').css('overflow','auto'); } }; })(jQuery); The above works when I have no custom open/beforeclose function specified when the dialog is created. So I'm wondering what is the best practice to add these functionality into all my dialogs, while preserving the ability to specify open/beforeclose functions.

    Read the article

  • Regex to split on successions of newline characters

    - by Beau Martínez
    I'm trying to split a string on newline characters (catering for Windows, OS X, and Unix text file newline characters). If there are any succession of these, I want to split on that too and not include any in the result. So, for when splitting the following: "Foo\r\n\r\nDouble Windows\r\rDouble OS X\n\nDouble Unix\r\nWindows\rOS X\nUnix" The result would be: ['Foo', 'Double Windows', 'Double OS X', 'Double Unix', 'Windows', 'OS X', 'Unix'] What regex should I use?

    Read the article

  • SOAP client generator for ruby/ruby on rails

    - by Sohan
    I have been looking for a fully functional WSDL client generator for ruby. I tried the one called wsdl2ruby and it didn't work. I think it has problems with detecting complex types correctly. Can someone point me to the right library if there is one? I am specifically looking to generate a full functional client for SOAP API provided by jira. I looked into jira4r but it seems to be dead now and not up to date. Any help is much appreciated. Thank you.

    Read the article

  • CSS buttons and crossbrowser issue

    - by Jason
    I have a class 'button' that I want to use for button, input and a tags. The problem is that both button and input tags have a greater line height than the anchor tag does. I have attached an example here so you can play around with it in firebug or whatever. http://28dev.com/stackoverflow/css-buttons.html But for those who just want to see the css/html, here it is: .button { font-family : helvetica, arial, sans-serif; -moz-border-radius: 3px; -webkit-border-radius: 3px; background : url(/images/ui-bg_glass_75_e6e6e6_1x400.png) repeat-x scroll 50% 50% #E6E6E6; border-color : #636363 #888888 #888888 #636363; border-right : 1px solid #888888; border-style : solid; border-width : 1px; cursor : pointer; display : block; float : left; font-size : 12px; font-weight : normal; line-height : 100%; min-width : 100px; padding : 3px 12px; text-align : center; } .button, .button a { color : #282828; text-decoration : none; } .button:hover, .button:hover a { border-color : #343434; color : #080808; } .marginR { margin-right : 5px; } <button class='button marginR' type='submit'>button.button</button> <input type="submit" value="input.button" class="button marginR" /> <a class="button" href="">a.button</a>

    Read the article

  • How to assemble a multi-project ant build system

    - by Alex Worden
    At my new gig, they use Ant and cannot be persuaded to move to Maven. I've looked everywhere for a decent example of how a multi-project ant build system should be assembled. The apache site falls short. I'm looking specifically for best practices to: Automatically build local projects that are dependencies of a project Share artifacts from project to their dependents Export a project's dependencies and generated artifacts (jars) to be inherited by dependent projects Share third-party dependencies between projects I'm sure I can do all this without using Ivy - what did people do before Ivy? I really don't want to have to set up a corporate repository or rely on external repositories - the engineers here are really against that and have all their third-party jars checked into src control. Can anyone point me at a good open source example of a multi-project ant build?

    Read the article

  • How to move child element from one parent to another using jQuery

    - by Kapslok
    I am using the jQuery DataTables plugin. I would like to move the search box (.dataTables_filter) and number of records to display dropdown (.dataTables_length) from their parent element (.dataTables_wrapper) to another div on my page without losing any registered javascript behavior. For instance the search box has a function attached to the 'keyup' event and I want to keep that intact. The DOM looks like this: <body> <div id="parent1"> <div class="dataTables_wrapper" id="table1_wrapper"> <div class="dataTables_length" id="table1_length"> <select size="1" name="table1_length"> <option value="10">10</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </div> <div class="dataTables_filter" id="table1_filter"> <input type="text" class="search"> </div> <table id="table1"> ... </table> </div> </div> <div id="parent2"> <ul> <li><a href="#">Link A</a></li> <li><a href="#">Link B</a></li> <li><a href="#">Link C</a></li> </ul> </div> </body> This is what I would like the DOM to look like after the move: <body> <div id="parent1"> <div class="dataTables_wrapper" id="table1_wrapper"> <table id="table1"> ... </table> </div> </div> <div id="parent2"> <div class="dataTables_filter" id="table1_filter"> <input type="text" class="search"> </div> <div class="dataTables_length" id="table1_length"> <select size="1" name="table1_length"> <option value="10">10</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </div> <ul> <li><a href="#">Link A</a></li> <li><a href="#">Link B</a></li> <li><a href="#">Link C</a></li> </ul> </div> </body> I've been looking at the .append(), .appendTo(), .prepend() and .prependTo() functions but haven't had any luck with these in practice. I've also looked at the .parent() and .parents() functions, but can't seem to code a workable solution. I have also considered changing the CSS so that the elements are absolutely positioned - but to be frank the page is setup with fluid elements all over, and I really want these elements to be floated in their new parents. Any help with this is much appreciated.

    Read the article

  • Windows 2003 IIS FTP Server Migration w/ User Accounts

    - by Brad
    I'm trying to figure out the best way to migrate an FTP server from old hardware to new hardware. The server is on a domain, but not all the users setup on the server (to use FTP) are domain accounts, some are local to the server. For example, I have users both ways: domain\username machinename\username The new machine name will be different. So I need to copy all the files with permissions in tact from the old server to the new server. Then I need to convert all the user accounts from the old server to the new server. Then I need to change the file permissions so that they are no longer oldserver\username but newserver\username. Can this be accomplished all with CALCS? Is there an easy way that perhaps I'm missing?

    Read the article

  • Linux is not an operating system, or is it?

    <b>Technology & Life Integration:</b> "There is a word in the English language (which I hope I am using) called context. In other words, I use the word Linux in the context of a complete Linux based distribution and believe that my readers understand that context."

    Read the article

  • Windows CE: SDK Doesn’t Show up in Visual Studio 2008

    - by Bruce Eitman
    A customer recently contacted me because after installing an SDK it didn’t show up in Visual Studio 2008.  So being a good vendor I installed VS2008 and then installed the SDK – no problem the SDK showed up and I could create projects based on it. I let the customer know that the SDK definitely works with VS2008. The customer got back to me and asked what OS I was using. Hmm, how could that play into this? I told him that I use Windows XP, and it turned out that he is way more modern than I am and is using both Windows Vista and 7. The customer opened a support case with Microsoft. The answer turns out to be that the SDK install requires the user to be logged on as an administrator when installing on Windows Vista and 7 for the SDK to show up in Visual Studio 2008. This problem does not seem to exist for Visual Studio 2005 on those operating systems. The actual instructions from Microsoft Support are: 1)      Make sure Visual Studio 2008 is not running. I also shut down the device emulator manager but you may not be using that. 2)      Open a “Visual Studio 2008 Command Prompt” as Administrator. On Windows 7 just right click the short cut and pick the “Run as administrator” option. 3)      Enter the following command: msiexec /log SDKInstallLog.txt /package <the path to your .msi file> 4)      When asked if you wish to do a custom or complete install pick custom 5)      Instruct the installer to omit the installation of the documentation. This was something I found about CE 6 SDK installation issue and may have no bearing upon your problem but I did it anyway. 6)      Install   Copyright © 2010 – Bruce Eitman All Rights Reserved

    Read the article

  • Limited SFTP access under Debian

    - by Hellnar
    Hello, under debian, I want to create a user who can only access to a specific folder (ie /home/user/some/folder/ (this folder already exists) , can do anything that he wants like modify, create delete a file) and no privilidge to any other stuff beside the given folder. How can I achieve this under the standart Debian Lenny for SFTP ?

    Read the article

  • Can't find the PHPdoc binary file

    - by ajsie
    I've downloaded the phpdoc from their site, extracted it, and put it in apache's documentroot for access through the web browser. However, I cant access the phpdoc tool from the command line. I have to add it to the PATH because I want to use the command line for automated documentation building, but considering I can't find it I can't add it to the PATH.

    Read the article

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