Daily Archives

Articles indexed Wednesday June 2 2010

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

  • VB.NET template instance - passing a variable data type

    - by FerretallicA
    As the title suggests, I'm tyring to pass a variable data type to a template class. Something like this: frmExample = New LookupForm(Of Models.MyClass) 'Works fine Dim SelectedType As Type = InstanceOfMyClass.GetType() 'Works fine repoGeneric = New Repositories.Repository(Of SelectedType) 'Ba-bow! repoGeneric = New Repositories.Repository(Of InstanceOfMyClass.GetType()) 'Ba-bow! I'm assuming it's something to do with the template being processed at compile time but even if I'm off the mark there, it wouldn't solve my problem anyway. I can't find any relevant information on using Reflection to instance template classes either. (How) can I create an instance of a dynamically typed repository at runtime?

    Read the article

  • Recommended way to support backward/forward compatibility in iPhone app?

    - by MrAleGuy
    I'm in the early stages of an iPhone app and I have a question. I did some searching but did not find what I was looking for. There are features in iPhone OS4 that I would like to take advantage of, but I would like for my app to also run on 3.X. It looks like I want to develop against the 4.0 SDK and do the following: Create a "weak link" to any new (4.0) frameworks Call respondsToSelector: for any new method in an existing framework or any method in a new framework before making that call Am I close? What's recommended? Pointers to similar questions welcome.

    Read the article

  • Mysql stored procedures

    - by Richard M
    Hello, I have a unique issue that I need advice on. I've been writing asp.net apps with SQL Server back ends for the past 10 years. During that time, I have also written some PHP apps, but not many. I'm going to be porting some of my asp.net apps to PHP and have run into a bit of an issue. In the Asp.net world, it's generally understood that when accessing any databases, using views or stored procedures is the preferred way of doing so. I've been reading some PHP/MySQL books and I'm beginning to get the impression that utilizing stored procedures in mysql is not advisable. I hesitate in using that word, advisable, but that's just the felling I get. So, the advice I'm looking for is basically, am I right or wrong? Do PHP developers use stored procedures at all? Or, is it something that is shunned? Thanks in advance.

    Read the article

  • How to get if the object already retrieved in inject

    - by zerkms
    Is it possible to know that particular dependency already has been satisfied by ninject kernel? To be clear: Let's suppose we have this module: Bind<IA>().To<A>(); Bind<IB>().To<B>(); And some "client"-code: var a = kernel.Get<IA>(); // how to get here "true" for assumption: "IA was requested (once)" // and "false" for: "IB was not requested ever"

    Read the article

  • How to exit grid with ctrl-TAB when grid is on a tabpage (onkeydown works when grid not on tabpage)

    - by Charles Hankey
    winforms .net 3.5 Ultrawingrid 9.2 In my subclass of Ultrawingrid.Ultragrid : Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs) If e.KeyCode = Windows.Forms.Keys.Tab andalso e.control = True then SetFocusToNextControl(True) End if Mybase.OnKeyDown(e) End Sub This works fine. But when the grid is dropped on a TabControl tabpage, the ctrl-tab looks very different to the sub above. e.keycode is seen as controlkey {17} I realize that by default cntrl-Tab moves between tabpages. I need to override this behavior. My thought is I probably need a subclass of the tabControl which will pass the keycombo through just as the form does but I confess to being clueless as to how to accomplish that. I tried to override the onkeydown of a tabcontrol subclass and just issuing a return and not and base call to onkeydown if the ctrl-tab combo was pressed but it seemed to see the e.keycode as controlkey as well. FWIW I tried a different combination like ctrl-E and got pretty much the same result with focus disappearing from the grid but not going anywhere I could detect. The sub still saw the e.control as controlkey. Oddly, ctrl-X, ctrl-A etc all work in the grid and a ctrl-Delete combo I put in the subclass for deleting a row works fine. Once again - grid directly on form and it all works. I'm definitely over my head on this one. Guidance much appreciated. vb or c# fine. TIA

    Read the article

  • Great Circle & Ray intersection

    - by Karl T
    I have a Latitude, Longitude, and a direction of travel in degrees true north. I would like to calculate if I will intersect a line defined by two more Lat/Lon points. I figure the two points defining the line would create my great circle and my location and azimuth would define my ray (or possibly a small circle). Any ideas?

    Read the article

  • Visual Studio: Lost CD

    - by JamesBrownIsDead
    I have my original CD housing for my copy of Visual Studio 2008 Standard. Therefore I still have my key. I have trial versions of 2008 and 2010, and Express versions of both, but can't find a place to enter my CD key. What am I suppose to do? I lost my CD. Should I just call MSFT and ask them what to do?

    Read the article

  • Finding the last focused element

    - by Joshua Cody
    I'm looking to determine which element had the last focus in a series of inputs, that are added dynamically by the user. This code can only get the inputs that are available on page load: $('input.item').focus(function(){ $(this).siblings('ul').slideDown(); }); And this code sees all elements that have ever had focus: $('input.item').live('focus', function(){ $(this).siblings('ul').slideDown(); }); The HTML structure is this: <ul> <li><input class="item" name="goals[]"> <ul> <li>long list here</li> <li>long list here</li> <li>long list here</li> </ul></li> </ul> <a href="#" id="add">Add another</a> On page load, a single input loads. Then with each add another, a new copy of the top unordered list's contents are made and appended, and the new input gets focus. When each gets focus, I'd like to show the list beneath it. But I don't seem to be able to "watch for the most recently focused element, which exists now or in the future." To clarify: I'm not looking for the last occurrence of an element in the DOM tree. I'm looking to find the element that currently has focus, even if said element is not present upon original page load. So in the above image, if I were to focus on the second element, the list of words should appear under the second element. My focus is currently on the last element, so the words are displayed there. Do I have some sort of fundamental assumption wrong?

    Read the article

  • fetching from a specified index in a set using python

    - by tipu
    I'm using pagination on a values from a set. So what this results in is me needing to get values from x to x + 20 which can be in the middle of a set with 50,000 entries. Is it possible that I can fetch these values by grabbing by the space in the set? Would it make more sense to do result = [] my_dict = dict(very_big_set) for i in range(30000, 30020) result.append(my_dict[i])

    Read the article

  • Dynamically adding @property in python

    - by rz
    I know that I can dynamically add an instance method to an object by doing something like: import types def my_method(self): # logic of method # ... # instance is some instance of some class instance.my_method = types.MethodType(my_method, instance) Later on I can call instance.my_method() and self will be bound correctly and everything works. Now, my question: how to do the exact same thing to obtain the behavior that decorating the new method with @property would give? I would guess something like: instance.my_method = types.MethodType(my_method, instance) instance.my_method = property(instance.my_method) But, doing that instance.my_method returns a property object.

    Read the article

  • Memory Profiling: How to detect which application/package is consuming too much memory

    - by malvim
    Hi, I have a situation here at work where we run a JEE server with several applications deployed on it. Lately, we've been having frequent OutOfMemoryException's. We suspect some of the apps might be behaving badly, maybe leaking, or something. The problem is, we can't really tell which one. We have run some memory profilers (like YourKit), and they're pretty good at telling what classes use the most memory. But they don't show relationships between classes, so that leaves us with a situation like this: We see that there are, say, lots of Strings and int arrays and HashMap entries, but we can't really tell which application or package they come from. Is there a way of knowing where these objects come from, so we can try to pinpoint the packages (or apps) that are allocating the most memory? Thank you in advance.

    Read the article

  • Javascript: Whitespace Characters being Removed in Chrome (but not Firefox)

    - by Matrym
    Why would the below eliminate the whitespace around matched keyword text when replacing it with an anchor link? Note, this error only occurs in Chrome, and not firefox. For complete context, the file is located at: http://seox.org/lbp/lb-core.js To view the code in action (no errors found yet), the demo page is at http://seox.org/test.html. Copy/Pasting the first paragraph into a rich text editor (ie: dreamweaver, or gmail with rich text editor turned on) will reveal the problem, with words bunched together. Pasting it into a plain text editor will not. // Find page text (not in links) -> doxdesk.com function findPlainTextExceptInLinks(element, substring, callback) { for (var childi= element.childNodes.length; childi-->0;) { var child= element.childNodes[childi]; if (child.nodeType===1) { if (child.tagName.toLowerCase()!=='a') findPlainTextExceptInLinks(child, substring, callback); } else if (child.nodeType===3) { var index= child.data.length; while (true) { index= child.data.lastIndexOf(substring, index); if (index===-1 || limit.indexOf(substring.toLowerCase()) !== -1) break; // don't match an alphanumeric char var dontMatch =/\w/; if(child.nodeValue.charAt(index - 1).match(dontMatch) || child.nodeValue.charAt(index+keyword.length).match(dontMatch)) break; // alert(child.nodeValue.charAt(index+keyword.length + 1)); callback.call(window, child, index) } } } } // Linkup function, call with various type cases (below) function linkup(node, index) { node.splitText(index+keyword.length); var a= document.createElement('a'); a.href= linkUrl; a.appendChild(node.splitText(index)); node.parentNode.insertBefore(a, node.nextSibling); limit.push(keyword.toLowerCase()); // Add the keyword to memory urlMemory.push(linkUrl); // Add the url to memory } // lower case (already applied) findPlainTextExceptInLinks(lbp.vrs.holder, keyword, linkup); Thanks in advance for your help. I'm nearly ready to launch the script, and will gladly comment in kudos to you for your assistance.

    Read the article

  • FTP Upload multiple files without disconnect using .NET

    - by DK39
    I'm uploading multiple files using FtpWebRequest. But for every file I'm opening and closing a connection. How can I upload multiple files using the same connection? Like a ftp client application, connect using username and password, change directory, upload file1, upload file2, upload file3, disconnect.

    Read the article

  • using .htaccess to redirect from friendly url to actual file

    - by Kohalza
    I have the following RewriteRule in my .htaccess to redirect from a friendly url to my main application file: RewriteRule ^\/(.*).html$ home/www/page.php?p=$1 [L] This should send any url that points to a html page to page.php with the url as a parameter that will be parsed by the app. This works for urls that look like http://www.example.com/hello.html The problem is that I get a 404 error when the url contains a directory path, for example: http://www.example.com/category/hello.html The error reads: "File does not exist: /home/www/category" Seems it is first looking for the 'category' path instead of processing the .htaccess Any ideas how to solve this?

    Read the article

  • How to create a project template for Ruby on Rails projects?

    - by wgpubs
    When I build Rails applications I find myself doing the same things over and over again. This includes adding the same gems/plugins, configuration info and custom initializers, rake tasks etc... etc.... This can't be a good thing. So, is there a way to package all this repetitive code into some sort of project template ... so that I can do a "rails myapp" and have everything good to go from there? Btw, running 2.3.5 if that matters :) thanks

    Read the article

  • Help with a sort method

    - by Capsud
    Hi there, If i have an array of strings for example Static final String[] TEST = new String[] { "g","a","b","t","e" }; How would i go about sorting this in alphabetical order please?

    Read the article

  • SNEAK PEEK: Another Silverlight theme pack preview

    Building on the positive feedback of the previous Silverlight application themes released last month (Cosmopolitan, Accent Color, and Windows) the design team is working on another theme targeting business application developers. We dont yet have an official name for this one yet (and to mitigate the confusion of internal code names again, Ill spare you the code name), but I wanted to put up a preview. Were turning this theme around FAST and I wanted to throw it out here in an initial iteration for...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • kickstart ks.cfg: Where should 'url' point?

    - by Stefan Lasiewski
    I have a kickstart file (ks.cfg) on a floppy (Old style). I am trying to install CentOS 5.4. The top of my ks.cfg says this: install # Install from local cdrom or over the network. #cdrom url --url http://kickstart.example.org/pub/centos/5.4/ On the Apache server side, this command is failing with these 404s: kickstart.example.org 192.168.16.180 - - [01/Jun/2010:17:24:30 -0700] "GET /pub/centos/5.4///disc1/.discinfo HTTP/1.1" 404 314 "-" "urlgrabber/3.1.0" kickstart.example.org 192.168.16.180 - - [01/Jun/2010:17:24:43 -0700] "GET /pub/centos/5.4/repodata/repomd.xml HTTP/1.1" 404 316 "-" "urlgrabber/3.1.0 yum/3.2.22" It seems that the value of my url doesn't match the directory structure on the server. I swear this worked a few months ago. Someone else maintains the Yum repository, and they say nothing has changed. What should the value of url URL be? Should this only include the OS (/pub/centos/5.4/), or should it include the architecture (/pub/centos/5.4/os/x86_64 )? I see that Kickstart is trying to grab a file called 'repomd.xml', but why is it looking in '/pub/centos/5.4/repodata/repomd.xml', when these files actually exist at '/pub/centos/5.4/os/x86_64/repodata/repomd.xml' and other locations at '/pub/centos/5.4/*/$ARCH/repodata/repomd.xml'? I don't see this documented or explained well in the [RedHat 5 Installation Guide1]

    Read the article

  • Programmatically Set a QueryStringFilterWebPart / ExcelWebRenderer Connection

    - by user355972
    Code: public static void ChartPageConnector(SPWeb web, string pageURL, string providerWpId, string consumerWpId, string mappedName) { SPFile file = web.Files[pageURL]; SPLimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared); TransformableFilterValuesToFilterValuesTransformer transformer = new TransformableFilterValuesToFilterValuesTransformer(); transformer.MappedConsumerParameterName = mappedName; //QueryStringFilterWebPart provider = (QueryStringFilterWebPart)mgr.WebParts[providerWpId]; //ExcelWebRenderer consumer = (ExcelWebRenderer)mgr.WebParts[consumerWpId]; JWP.WebPart provider = mgr.WebParts[providerWpId]; JWP.WebPart consumer = mgr.WebParts[consumerWpId]; ProviderConnectionPoint pcp = null; foreach (ProviderConnectionPoint ppoint in mgr.GetProviderConnectionPoints(provider)) { if (ppoint.InterfaceType == typeof(Microsoft.SharePoint.WebPartPages.ITransformableFilterValues)) { pcp = ppoint; break; } } ConsumerConnectionPoint ccp = null; foreach (ConsumerConnectionPoint cpoint in mgr.GetConsumerConnectionPoints(consumer)) { if (cpoint.InterfaceType == typeof(IFilterValues)) { ccp = cpoint; break; } } //mgr.SPConnectWebParts(provider, pcp, consumer, ccp); mgr.SPConnectWebParts(provider, pcp, consumer, ccp, transformer); file.Update(); web.Update(); } Error: The connection point "IFilterValues" on "g_33d68e82_6478_4629_a079_5a7e02ac4695" is disabled. Any Ideas Why?

    Read the article

  • CherryPy configuration tools.staticdir.root problem

    - by Alan Harris-Reid
    Hi there, How can I make my static-file root directories relative to my application root folder (instead of a hard-coded path)? In accordance with CP instructions (http://www.cherrypy.org/wiki/StaticContent) I have tried the following in my configuration file: tree.cpapp = cherrypy.Application(cpapp.Root()) tools.staticdir.root = cpapp.current_dir but when I run cherrpy.quickstart(rootclass, script_name='/', config=config_file) I get the following error builtins.ValueError: ("Config error in section: 'global', option: 'tree.cpapp', value: 'cherrypy.Application(cpapp.Root())'. Config values must be valid Python.", 'TypeError', ("unrepr could not resolve the name 'cpapp'",)) I know I can do configuration from within the main.py file just before quickstart is called (eg. using os.path.abspath(os.path.dirname(file))), but I prefer using the idea of a separate configuration file if possible. Any help would be appreciated (in case it is relevant, I am using CP 3.2 with Python 3.1) TIA Alan

    Read the article

  • AVDs that exist do not get listed in the "Target Tab"

    - by Abhi
    I am using emulator Android 2.1 with Eclipse. For few days I had the emulator working ... was able to debug... I had 2 AVDs created and was using one of them. Earlier today I had to move my classes to a different package. Ever since I did that the configuration that I had has disappeared . So now I had to create configuration - I select Android Application and then click New - gave it a name TestPrjCfg - when I go to the "Target" tab - I see "No AVD available" but when I click manager I see two AVDs listed. I tired refresh in the "Target" tab - the existing AVDs do not show up. I used the Manager and created a third AVD that did not help either. Please let me know what am I missing here? What should I do so that the existing AVDs showup in the "Target" tab- Thank you for the time and effort abhi

    Read the article

  • MySQL Trigger with Update

    - by Matthew
    I'm trying to update a row when it gets updated to keep one of the columns consistant, CREATE TRIGGER user_country BEFORE UPDATE ON user_billing FOR EACH ROW BEGIN IF NEW.billing_country = OLD.billing_country AND NEW.country_id != OLD.country_id THEN SET NEW.billing_country = cms.country.country_name WHERE cms.country.country_id = NEW.country_id; END IF; END But I keep recieving error #1064, Is there a way to update a row based on another row's data when the row is getting updated?

    Read the article

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