Daily Archives

Articles indexed Wednesday May 19 2010

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

  • Why do I need an IoC container as opposed to straightforward DI code?

    - by Vadim
    I've been using Dependency Injection (DI) for awhile, injecting either in a constructor, property, or method. I've never felt a need to use an Inversion of Control (IoC) container. However, the more I read, the more pressure I feel from the community to use an IoC container. I played with .NET containers like StructureMap, NInject, Unity, and Funq. I still fail to see how an IoC container is going to benefit / improve my code. I'm also afraid to start using a container at work because many of my co-workers will see code which they don't understand. Many of them may be reluctant to learn new technology. Please, convince me that I need to use an IoC container. I'm going to use these arguments when I talk to my fellow developers at work.

    Read the article

  • CATiledLayer blanking tiles before drawing contents

    - by Greg Plesur
    All, I'm having trouble getting behavior that I want from CATiledLayer. Is there a way that I can trigger the tiles to redraw without having the side-effect that their areas are cleared to white first? I've already subclassed CATiledLayer to set fadeDuration to return 0. To be more specific, here are the details of what I'm seeing and what I'm trying to achieve: I have a UIScrollView with a big content size...~12000x800. Its content view is a UIView backed by a CATiledLayer. The UIView is rendered with a lot of custom-drawn lines Everything works fine, but the contents of the UIView sometimes change. When that happens, I'd like to redraw the tiles as seamlessly as possible. When I use setNeedsDisplay on the view, the tiles redraw but they are first cleared to white and there's a fraction-of-a-second delay before the new content is drawn. I've already subclassed CATiledLayer so that fadeDuration is set to 0. The behavior that I want seems like it should be possible...when you zoom in on the scrollview and the content gets redrawn at a higher resolution, there's no blanking before the redraw; the new content is drawn right on top of the old one. That's what I'm looking for. Thanks; I appreciate your ideas. Update: Just to follow up - I realized that the tiles weren't being cleared to white before the redraw, they're being taken out entirely; the white that I was seeing is the color of the view that's beneath my CATiledLayer-backed view. As a quick hack/fix, I put a UIImageView beneath the UIScrollView, and before triggering a redraw of the CATiledLayer-backed view I render its visible section into the UIImageView and let it show. This smooths out the redraw significantly. If anyone has a better solution, like keeping the redraw-targeted tiles from going away before being redrawn in the first place, I'd still love to hear it.

    Read the article

  • Intellisense in App_Code in VS2010

    - by nikok
    Hi, I've just upgrade my web application from vs2008 to vs2010, I create a new web app from vs2010, then copy across all the existing files from vs2008, then I add a new class file to App_Code folder, the intellisense is not showing up for everything and class etc is also not color in the right color. However, when I open the existing class I created earlier from vs2008, intellisense just working fine and all classes are in different color as well, if I make a copy of existing class, the copied class does not support the intellisense as well. However, if I shut my VS, and reopen it, they all appear to be support with intellisense for existing class, but once I created a new class, intellisense is not support. Can you tell me what's wrong here? Thanks

    Read the article

  • Raw Audio Conversion

    - by Walidix
    While, I'm reading gstreamer document I found this: " Audioconvert converts raw audio buffers between various possible formats. It supports integer to float conversion, width/depth conversion, signedness and endianness conversion and channel transformations." I only understand "depth" (bit number per sample) "signedness and endianness" (for data representation) And now, I'm looking for explanations of : "integer to float conversion" "width" "channel transformations" Thanks in advance

    Read the article

  • Which keycode for escape key with jQuery

    - by Shishant
    I have two functions. When enter is pressed the functions runs correctly but when escape is pressed it doesn't. What's the correct number for the escape key? $(document).keypress(function(e) { if (e.which == 13) { $('.save').click(); } // enter (works as expected) if (e.which == 27) { $('.cancel').click(); } // esc (does not work) });

    Read the article

  • Movable Type: MTEntries sort_by="title" doesn't really work

    - by kohei
    Hello Im trying to sort <MTEntries> by title. I know you can use <MTEntries sort_by="title" sort_order="ascend"> but this modifier some how prioritizes capitalized letters first to the sort. Im not sure if this is a glitch in the system but this modifier should sort by purely the alphabets(caps or no caps) used in the title. Example: I would like to sort these titles alphabetically: APRICOT Aligator ABBEY Apple If <MTEntries sort_by="title" sort_order="ascend"> is used: ABBEY APRICOT Aligator Apple But it really should be (and I want) ABBEY Aligator Apple APRICOT Would someone know how to achive this?

    Read the article

  • Building a Store Locator ASP.NET Application Using Google Maps API (Part 1)

    Over the past couple of months I've been working on a couple of projects that have used the free <a href="http://code.google.com/apis/maps/">Google Maps API</a> to add interactive maps and <a href="http://en.wikipedia.org/wiki/Geocoding">geocoding</a> capabilities to ASP.NET websites. In a nutshell, the Google Maps API allow you to display maps on your website, to add markers onto the map, and to compute the latitude and longitude of an address, among many other tasks.With some Google Maps API experience under my belt, I decided it would be fun to implement a store locator feature and share it here on 4Guys. A store locator lets a visitor enter an address or postal code and then shows the nearby stores. Typically, store locators display the

    Read the article

  • PageRank is the Best Indicator of Competition Strength For a Keyword in SEO - New Verifiable Theory

    The major argument against PageRank in SEO is that pages with zero PageRank can be in the top positions even for highly competitive keywords. However, we are left with requiring an explanation as to why "PageRank is Google's view of the importance of this page." It becomes apparent that either Google is misleading us or we have all been misinterpreting Google's statement. From extensive evaluation of the top Google search engine results pages for hundreds of keywords, the author observed that those high positioned web pages with PageRanks of zero have a home page with higher PageRanks, usually three or more.

    Read the article

  • MySQLi Prepared Statement Query Issue

    - by Benjamin Flak
    I'm relatively new to MySQLi prepared statements, and running into an error. Take this code: $user = 'admin'; $pass = 'admin'; if ($stmt = $mysqli->query("SELECT * FROM members WHERE username='$user' AND password='$pass'")) { echo $stmt->num_rows; } This will display "1", as it should. This next piece of code though, returns "0": $user = 'admin'; $pass = 'admin'; if ($stmt = $mysqli->prepare("SELECT * FROM members WHERE username=? AND password=?")) { $stmt->bind_param("ss", $user, $pass); $stmt->execute(); echo $stmt->num_rows; } Any ideas why?

    Read the article

  • A question on vectors, pointers and iterators

    - by xbonez
    Guys, I have a midterm examination tomorrow, and I was looking over the sample paper, and I'm not sure about this question. Any help would be appreciated. Let v be a vector<Thingie*>, so that each element v[i] contains a pointer to a Thingie. If p is a vector<Thingie*>::iterator, answer the following questions: what type is p? what type is *p? what code provides the address of the actual Thingie? what code provides the actual Thingie?

    Read the article

  • Installing PIL (Python Imaging Library) in Win7 64 bits, Python 2.6.4

    - by Rafael Almeida
    I'm trying to install said library for use with Python. I tried downloading the executable installer for Windows, which runs, but says it doesn't find a Python installation. Then tried registering (http://effbot.org/zone/python-register.htm) Python, but the script says it can't register (although the keys appear in my register). Then I tried downloading the source package: I run the setup.py build and it works, but when I run setup.py install it says the following: running install running build running build_py running build_ext building '_imaging' extension error: Unable to find vcvarsall.bat What can I do?

    Read the article

  • IoC, Containers, and NServiceBus confusion

    - by andy
    Hey guys, here's my setup Castle Windsor is my container NServiceBus is itself using it's own container internally, Spring by default I'm implementing the PubSub config. Ok, if I have my Bus.Publish happening within my IWantToRunAtStartup class, then everything is fine. As a test for example on Run() we can start a timer and it'll go into a Service style loop. However, what if I want to abstract NServiceBus from my app, and have my app go: new CustomPulisherClass().Notify(ISomeMessage msg); In this situation, how do I implement CustomPublisherClass. My confusion is coming from the fact that NServiceBus is already running as a Service, it's already been "Started". How to I get at the correct instance of the Bus object? cheers andy

    Read the article

  • How do I get an overview and a methodology for programming in Python

    - by Peter Nielsen
    I've started to learn Python and programming from scratch. I have not programmed before so it's a new experience. I do seem to grasp most of the concepts, from variables to definitions and modules. I still need to learn a lot more about what the different libraries and modules do and also I lack knowledge on OOP and classes in Python. I see people who just program in Python like that's all they have ever done and I am still just coming to grips with it. Is there a way, some tools, a logical methodology that would give me an overview or a good hold of how to handle programming problems ? For instance, I'm trying to create a parser which we need at the office . I also need to create a spider that would collect links from various websites. Is there a formidable way of studying the various modules to see what is needed ? Or is it just nose to the grind stone and understand what the documentation says ? Sorry for the lengthy question..

    Read the article

  • NHibernate connection string configuration

    - by user177883
    I have a c# library project, that i configured using nhibernate, and I like people to be able to import this project and use the project. I have a connection string in hibernate config file and in app.config file of another project. it would be nice for anyone to be able to set the connection string into this library project and use it. How to do this? I d like this class library to use the same database of the project that s imported. How to set hibernate connection string programatically? same idea for log4net.

    Read the article

  • Conditional Validation using JQuery Validation Plugin

    - by Steve Kemp
    I have a simple html form that I've added validation to using the JQuery Validation plugin. I have it working for single fields that require a value. I now need to extend that so that if a user answers Yes to a question they must enter something in the Details field, otherwise the Details field can be left blank. I'm using radio buttons to display the Yes/No. Here's my complete html form - I'm not sure where to go from here: <script type="text/javascript" charset="utf-8"> $.metadata.setType("attr", "validate"); $(document).ready(function() { $("#editRecord").validate(); }); </script> <style type="text/css"> .block { display: block; } form.cmxform label.error { display: none; } </style> </head> <body> <div id="header"> <h1> Questions</h1> </div> <div id="content"> <h1> Questions Page 1 </h1> </div> <div id="content"> <h1> </h1> <form class="cmxform" method="post" action="editrecord.php" id="editRecord"> <input type="hidden" name="-action" value="edit"> <h1> Questions </h1> <table width="46%" class="record"> <tr> <td width="21%" valign="top" class="field_name_left"><p>Question 1</p></td> <td width="15%" valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question1" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question1" value="No" /> No </label> <label for="Question1" class="error">You must answer this question to proceed</label> </td> <td width="64%" valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details1" class="where" name="Details1" cols="25" rows="2"></textarea></td> </tr> <tr> <td valign="top" class="field_name_left">Question 2</td> <td valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question2" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question2" value="No" /> No </label> <label for="Question2" class="error">You must answer this question to proceed</label> </td> <td valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details2" class="where" name="Details2" cols="25" rows="2"></textarea> </td> </tr> <tr class="submit_btn"> <td colspan="3"> <input type="submit" name="-edit" value="Finish"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form> </div> </body> </html>

    Read the article

  • how to parse string into a date pattern using dojo

    - by Dojouser
    Hi, I have a value as '05/17/2010' I would like to get it as May 17, 2010 by using dojo.date.locale.I have tried using the dojo.date.locale.parse as follows : x = '05/17/2010' var x= dojo.date.locale.parse(x, {datePattern: "MM/dd/yyyy", selector: "date"}); alert(x) This doesnt give me the desired date pattern I also tried replacing the pattern as datePattern : "MMMM d, yyyy" but it returns me null. Any help highly appreciated. Thanks

    Read the article

  • Python 2.6, 3 abstract base class misunderstanding

    - by Aaron
    I'm not seeing what I expect when I use ABCMeta and abstractmethod. This works fine in python3: from abc import ABCMeta, abstractmethod class Super(metaclass=ABCMeta): @abstractmethod def method(self): pass a = Super() TypeError: Can't instantiate abstract class Super ... And in 2.6: class Super(): __metaclass__ = ABCMeta @abstractmethod def method(self): pass a = Super() TypeError: Can't instantiate abstract class Super ... They both also work fine (I get the expected exception) if I derive Super from object, in addition to ABCMeta. They both "fail" (no exception raised) if I derive Super from list. I want an abstract base class to be a list but abstract, and concrete in sub classes. Am I doing it wrong, or should I not want this in python?

    Read the article

  • iPhone OS: implementing your own achievements, how do I do it?

    - by nickthedude
    I'm working on a game where really the only game part is (at least right now) that the user can unlock achievements as she does various things throughout the game. I have a database that can keep track of certain user actions and record how many times a user does something but I'm having trouble figuring out the best way to architect the app so that I have to do the least amount of work. Kind of suck with the timing because gamecenter is not ready and it seems like openfeint is changing gears, but maybe I'm wrong. I'd prefer to do everything "in house" if it is not too ridiculous. looking for suggestions. Thanks, Nick

    Read the article

  • Best Place to Store Config Files and Log Files on Windows for My Program?

    - by Dave
    I need to store log files and config files for my application. Where is the best place to store them? Right now I'm just using the current directory, which ends up putting them in the Program Files directory where my program lives. The log files will probably be accessed by the user somewhat regularly, so %APPDATA% seems a little hard to get to. Is a directory under %USERPROFILE%\My Documents the best? It needs to work for all versions of Windows from 2000 forward.

    Read the article

  • Best way to programmatically detect iPad/iPhone hardware

    - by Adam Eberbach
    The reason I need to find out is that on an iPad, a UIPickerView has the same height in landscape orientation as it does in portrait. On an iPhone it is different. The iPad programming guide introduces an "idiom" value to UIDevice: UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad } else { // iPhone } which works OK while you're in iPad (3.2) but not iPhone (3.1.3) - so it looks like there also needs to be an ifdef to conditionally compile that check, like: #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200 UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // etc. } #endif To me that's starting to look very clumsy. What's a better way?

    Read the article

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