Search Results

Search found 1863 results on 75 pages for 'matt fordham'.

Page 49/75 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • Static nested class visibility issue with Scala / Java interop

    - by Matt R
    Suppose I have the following Java file in a library: package test; public abstract class AbstractFoo { protected static class FooHelper { public FooHelper() {} } } I would like to extend it from Scala: package test2 import test.AbstractFoo class Foo extends AbstractFoo { new AbstractFoo.FooHelper() } I get an error, "class FooHelper cannot be accessed in object test.AbstractFoo". (I'm using a Scala 2.8 nightly). The following Java compiles correctly: package test2; import test.AbstractFoo; public class Foo2 extends AbstractFoo { { new FooHelper(); } } The Scala version also compiles if it's placed in the test package. Is there another way to get it to compile?

    Read the article

  • Python sorting problem

    - by matt
    I'm sure this is simple but I can't figure it out. I have a list of strings like this(after using sorted on it): Season 2, Episode 1: A Flight to Remember Season 2, Episode 20: Anthology of Interest I Season 2, Episode 2: Mars University Season 2, Episode 3: When Aliens Attack .... Season 3, Episode 10: The Luck of the Fryrish Season 3, Episode 11: The Cyber House Rules Season 3, Episode 12: Insane in the Mainframe Season 3, Episode 1: The Honking Season 3, Episode 2: War Is the H-Word How can I make them sort out properly? (by episode #, ascending)

    Read the article

  • XML Serializing a class with a Dictionary<string, List<string>> object

    - by Matt
    Is it possible to implement IXmlSerializable and in my XML file capture an object of type Dictionary ? I have the following public class coolio : IXmlSerializable { private int a; private bool b; private string c; private Dictionary<string, List<string>> coco; public coolio(int _a, bool _b, string _c, Dictionary<string, List<string>> _coco) { a=_a; b=_b; c=_c; coco=_coco; } public System.Xml.Schema.XmlSchema GetSchema() { return null; } public void WriteXml(XmlWriter writer) { const string myType = "coolio"; writer.WriteStartElement(myType); writer.WriteAttributeString("a", a.ToString()); writer.WriteAttributeString("b", b.ToString()); writer.WriteAttributeString("c", c); // How do I add a subelement for Dictionary<string, List<string>> coco? writer.WriteEndElement(); } public void ReadXml(XmlReader reader) { if (reader.MoveToContent() != XmlNodeType.Element || reader.LocalName != "coolio") return; a= int.Parse(reader["a"]); b = bool.Parse(reader["b"]); c= reader["c"]; // How do I read subelement into Dictionary<string, List<string>> coco? } } But I am stumped as to how I could add the Dictionary (XML seriliazed to my XML file)

    Read the article

  • Best way to store 3 pieces of data as a single entry

    - by Matt
    For a game server, I want to record details when a player makes a kill, store this, and then at intervals update to a sql database. The part i'm interested in right now is the best method of storing the kill information. What i'd like to pass to the sql server on update would be {PlayerName, Kills, Deaths}, where the kills and deaths are a sum for the period between updates. So i'm assuming i'd build a list along the lines of {bob, 1, 0} {frank, 0, 1} {tom, 1, 0} {frank, 0, 1} then on update, consolidate the list to {frank, 14, 3}etc Can someone offer some advice please?

    Read the article

  • Which are the most important media queries to use in creating mobile responsive design?

    - by Matt
    There are a lot different media queries for mobile screen sizes. It can be overwhelming to accomodate all of them when designing a responsive mobile site. Which are the most important ones to use when designing for mobile? I found this article that does a pretty good job of outlining the available media queries: http://css-tricks.com/snippets/css/media-queries-for-standard-devices/. /* Smartphones (portrait and landscape) ----------- */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ } /* Smartphones (landscape) ----------- */ @media only screen and (min-width : 321px) { /* Styles */ } /* Smartphones (portrait) ----------- */ @media only screen and (max-width : 320px) { /* Styles */ } /* iPads (portrait and landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { /* Styles */ } /* iPads (landscape) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */ } /* iPads (portrait) ----------- */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { /* Styles */ } /* Desktops and laptops ----------- */ @media only screen and (min-width : 1224px) { /* Styles */ } /* Large screens ----------- */ @media only screen and (min-width : 1824px) { /* Styles */ } /* iPhone 4 ----------- */ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { /* Styles */ }

    Read the article

  • Can I make Visual Studio's code completion window more like Eclipse (Java)?

    - by Matt
    Is it possible to make Visual Studio 2010's code completion window more like that of Eclipse (Java)? In particular, I'd love the code completion window to give me a variable's type, and a method's return type and expected parameters, without needing to hover the highlight over that particular variable/method. VS's code completion's little icons that indicate if something is a property, method etc are useful, but they just aren't enough.

    Read the article

  • Any C/C++ to non-native bytecode compiler/interpreters?

    - by Matt
    As the title indicates, are there any C/C++ bytecode compilers/interpreters? I'm writing an application in an interpreted language that depends on certain libraries that are fully cross-compilable (there are no special flags to indicate code changes during compilation for a certain platform) but are written in C and C++. Rather than shipping n-platform-specific-libs with each platform, it would be nice to ship one set of libs which are interpreted by one platform specific interpreter. Possible and/or available?

    Read the article

  • Find slow/ineffecient method calls in dotnet

    - by Matt Thrower
    Hi, I'm faced with a big old stack of method calls in some legacy code, one or some of which is creating a bottleneck and really slowing things down. Is there any quick way I can get a report on which method calls are taking the time, short of running in debug, stepping through and seeing where the cursor pauses?

    Read the article

  • Function template overloading: link error

    - by matt
    I'm trying to overload a "display" method as follows: template <typename T> void imShow(T* img, int ImgW, int ImgH); template <typename T1, typename T2> void imShow(T1* img1, T2* img2, int ImgW, int ImgH); I am then calling the template with unsigned char* im1 and char* im2: imShow(im1, im2, ImgW, ImgH); This compiles fine, but i get a link error "unresolved external symbol" for: imShow<unsigned char,char>(unsigned char *,char *,int,int) I don't understand what I did wrong!

    Read the article

  • iphone core data loop array and save each

    - by Matt Facer
    I have a core data model with two tables (meal and ingredients). I am trying to save ONE meal with MANY ingredients. I have the code below which loops through an array of ingredients. I'm trying to save it, but I cannot redeclare the "entity" below. How do I do it? I've tried releasing it, but that didn't work! Thanks for any help. for (x=0;x<ingredients;x++) { NSEntityDescription *entity = [NSEntityDescription insertNewObjectForEntityForName:@"Ingredient" inManagedObjectContext:managedObjectContext]; entity.name = @"test"; } (this method does work saving ONE record out of the loop.. so that's not the problem)

    Read the article

  • How can I optimize retrieving lowest edit distance from a large table in SQL?

    - by Matt
    Hey, I'm having troubles optimizing this Levenshtein Distance calculation I'm doing. I need to do the following: Get the record with the minimum distance for the source string as well as a trimmed version of the source string Pick the record with the minimum distance If the min distances are equal (original vs trimmed), choose the trimmed one with the lowest distance If there are still multiple records that fall under the above two categories, pick the one with the highest frequency Here's my working version: DECLARE @Results TABLE ( ID int, [Name] nvarchar(200), Distance int, Frequency int, Trimmed bit ) INSERT INTO @Results SELECT ID, [Name], (dbo.Levenshtein(@Source, [Name])) As Distance, Frequency, 'False' As Trimmed FROM MyTable INSERT INTO @Results SELECT ID, [Name], (dbo.Levenshtein(@SourceTrimmed, [Name])) As Distance, Frequency, 'True' As Trimmed FROM MyTable SET @ResultID = (SELECT TOP 1 ID FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @Result = (SELECT TOP 1 [Name] FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @ResultDist = (SELECT TOP 1 Distance FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @ResultTrimmed = (SELECT TOP 1 Trimmed FROM @Results ORDER BY Distance, Trimmed, Frequency) I believe what I need to do here is to.. Not dumb the results to a temporary table Do only 1 select from `MyTable` Setting the results right in the select from the initial select statement. (Since select will set variables and you can set multiple variables in one select statement) I know there has to be a good implementation to this but I can't figure it out... this is as far as I got: SELECT top 1 @ResultID = ID, @Result = [Name], (dbo.Levenshtein(@Source, [Name])) As distOrig, (dbo.Levenshtein(@SourceTrimmed, [Name])) As distTrimmed, Frequency FROM MyTable WHERE /* ... yeah I'm lost */ ORDER BY distOrig, distTrimmed, Frequency Any ideas?

    Read the article

  • How do you deal with duplicate street suffixes?

    - by Matt
    I have a system where users need to enter addresses. I am trying to limit duplicates of course and something I started noticing was becoming a big problem was some users putting in "Road" and others "Rd", therefore duplicates were creeping in. I looked up the list of USPS street suffix abbreviations but I still have a question which I can't find an answer to. Can I replace all words in a street address with the USPS standard abbreviation? An example would be "123 Forest Hill Road". If I were to replace it with the abbreviations it would then be "123 Frst Hl Rd" or does the "street suffix" that USPS is referring to mean they only want you to make go as far as "123 Forest Hill Rd"?

    Read the article

  • What interprocess locking calls should I monitor?

    - by Matt Joiner
    I'm monitoring a process with strace/ltrace in the hope to find and intercept a call that checks, and potentially activates some kind of globally shared lock. While I've dealt with and read about several forms of interprocess locking on Linux before, I'm drawing a blank on what to calls to look for. Currently my only suspect is futex() which comes up very early on in the process' execution. Update0 There is some confusion about what I'm after. I'm monitoring an existing process for calls to persistent interprocess memory or equivalent. I'd like to know what system and library calls to look for. I have no intention call these myself, so naturally futex() will come up, I'm sure many libraries will implement their locking calls in terms of this, etc. Update1 I'd like a list of function names or a link to documentation, that I should monitor at the ltrace and strace levels (and specifying which). Any other good advice about how to track and locate the global lock in mind would be great.

    Read the article

  • Problems finding classes in namespace and testing extend expected parent

    - by Matt
    So I am in the process of building a site in ASP.Net MVC, and in the process I am adding certain things to my Site.Master I want to make sure that all of my model classes extend a certain base class that contains all of the pieces the Site.Master needs to be operable. I want to test to make sure this assumption isn't broken (I believe this will save me time when I forget about it and can't figure out why a new combination isn't working.) I wrote a test that I thought would help with this, but I am running into two problems. First it isn't finding the one example model class I have so far in the LINQ call all of a sudden, I am admittedly still a bit new to LINQ. Second, I had it finding the class earlier, but I couldn't get it to verify that the class inherits from the base class. Here is the example test. [Test] public void AllModelClassesExtendAbstractViewModel() { var abstractViewModelType = typeof (AbstractViewModel); Assembly baseAssembly = Assembly.GetAssembly(abstractViewModelType); var modelTypes = baseAssembly.GetTypes() .Where(assemblyType => (assemblyType.Namespace.EndsWith("Models") && assemblyType.Name != "AbstractViewModel")) .Select(assemblyType => assemblyType); foreach (var modelType in modelTypes) { Assert.That(modelType.IsSubclassOf(abstractViewModelType), Is.True , modelType.Name + " does not extend AbstractViewModel"); } }

    Read the article

  • On Solaris, how do you mount a second zfs system disk for diagnostics?

    - by Matt Ball
    I've got two hard disks in my computer, and have installed Solaris 10u8 on the first and Opensolaris 2010.3 (dev onnv_134) on the second. Both systems uses ZFS and were independently created with a zpool name of 'rpool'. While running Solaris 10u8 on the first disk, how do I mount the second ZFS hard disk (at /dev/dsk/c1d1s0) on an arbitrary mount point (like /a) for diagnostics?

    Read the article

  • Is it possible to destroy a CDI scope?

    - by Matt Ball
    I'm working on a Java EE application, primarily JAX-RS with a JSF admin console, that uses CDI/Weld for dependency injection with @ApplicationScoped objects. Minor debugging issues aside, CDI has worked beautifully for this project. Now I need some very coarse-grained control over CDI-injected object lifecycles. I need the ability to: Remove an injected object from the application context, or Destroy/delete/clear/reset/remove the entire application context, or Define my own @ScopeType and implementing Context in which I could provide methods to perform one of the two above tasks. I'm fully aware that this is across, if not against, the grain of CDI and dependency injection in general. I just want to know Is this remotely possible? If yes, what is the easiest/simplest/quickest/foolproofiest way to get the job done?

    Read the article

  • Mocking HtmlHelper throws NullReferenceException

    - by Matt Austin
    I know that there are a few questions on StackOverflow on this topic but I haven't been able to get any of the suggestions to work for me. I've been banging my head against this for two days now so its time to ask for help... The following code snippit is a simplified unit test to demonstrate what I'm trying to do, which is basically call RadioButtonFor in the Microsoft.Web.Mvc assembly in a unit test. var model = new SendMessageModel { SendMessageType = SendMessageType.Member }; var vd = new ViewDataDictionary(model); vd.TemplateInfo = new TemplateInfo { HtmlFieldPrefix = string.Empty }; var controllerContext = new ControllerContext(new Mock<HttpContextBase>().Object, new RouteData(), new Mock<ControllerBase>().Object); var viewContext = new Mock<ViewContext>(new object[] { controllerContext, new Mock<IView>().Object, vd, new TempDataDictionary(), new Mock<TextWriter>().Object }); viewContext.Setup(v => v.View).Returns(new Mock<IView>().Object); viewContext.Setup(v => v.ViewData).Returns(vd).Callback(() => {throw new Exception("ViewData extracted");}); viewContext.Setup(v => v.TempData).Returns(new TempDataDictionary()); viewContext.Setup(v => v.Writer).Returns(new Mock<TextWriter>().Object); viewContext.Setup(v => v.RouteData).Returns(new RouteData()); viewContext.Setup(v => v.HttpContext).Returns(new Mock<HttpContextBase>().Object); viewContext.Setup(v => v.Controller).Returns(new Mock<ControllerBase>().Object); viewContext.Setup(v => v.FormContext).Returns(new FormContext()); var mockContainer = new Mock<IViewDataContainer>(); mockContainer.Setup(x => x.ViewData).Returns(vd); var helper = new HtmlHelper<ISendMessageModel>(viewContext.Object, mockContainer.Object, new RouteCollection()); helper.RadioButtonFor(m => m.SendMessageType, "Member", cssClass: "selector"); If I remove the cssClass parameter then the code works ok but fails consistently when adding additional parameters. I've tried every combination of mocking, instantiating concrete types and using fakes that I can think off but I always get a NullReferenceException when I call RadioButtonFor. Any help hugely appreciated!!

    Read the article

  • protect_from_forgery & Unobtrusive Javascript

    - by Matt Grande
    Hi all, I have some javascript making an ajax call in my Rails site: $.ajax({type: "PUT", url: url, data: { dummy: data }, complete: function(data) {}}); When Rails gets it, it throws back an ActionController::InvalidAuthenticityToken Error. I'd like to keep the protect_from_forgery stuff in there, if possible... But I'm at a loss for how can I pass the auth token from a javascript file? Can anyone help me out?

    Read the article

  • PHP: Assigning values to a variable inside IF statement

    - by Matt
    Hi guys, I was wondering if i could assign values to a variable inside an IF statement. My code is as follows: <?php if ((count($newArray) = array("hello", "world")) == 0) { // do something } ?> So basically i want assign the array to the $newArray variable, then count newArray and check to see if it is an empty array. I know i can do this on several lines but just wondered if i could do it on one line Thanks M

    Read the article

  • Maximizing the number of threads to fully utilize all available resources without hindering overall

    - by Matt
    Let's say I have to generate a bunch of result files, and I want to make it as fast as possible. Each result file is generated independently of any other result file; in fact, one could say that each result file is agnostic to every other result file. The resources used to generate each result file is also unique to each. How can I dynamically decide the optimal number of threads to run simultaneously in order to minimize the overall run time? Is my only option to write my own thread manager that watches performance counters and adjust accordingly or does there exists some solid classes that already accomplish this?

    Read the article

  • Can't access font resource in Silverlight class library

    - by Matt
    I have a reasonably large Silveright 3.0 project on the go, and I'm having issues accessing a couple of custom font resources from within one of the assemblies. I've got a working test solution where I have added a custom font as a resource, and can access it fine from XAML using: <TextBlock Text="Test" FontFamily="FontName.ttf#Font Name" /> The test solution consists of the TestProject.Application and the TestProject.Application.Web projects, with all the fun and games obviously in the TestProject.Application project However, when I try this in my main solution, the fonts refuse to show in the correct type face (instead showing in the default font). There's no difference in the way the font has been added to project between the test solution and the main solution, and the XAML is identical. However, there is a solution layout difference. In the main solution, as well as having a MainApp.Application and MainApp.Application.Web project, I also have a MainApp.Application.ViewModel project and a MainApp.Application.Views project, and the problem piece of XAML is the in the MainApp.Application.Views project (not the .Application project like the test solution). I've tried putting the font into either the .Application or .Application.Views project, tried changing the Build Action to Content, Embedded Resource etc, all to no avail. So, is there an issue accessing font resources from a child assembly that I don't know about, or has anyone successfully done this? My long term need will be to have the valid custom fonts being stored as resources in a separate .Application.FontLibrary assembly that will be on-demand downloaded and cached, and the XAML controls in the .Application.Views project will need to reference this FontLibrary assembly to get the valid fonts. I've also tried xcreating this separate font library assembly, and I can't seem to get the fonts from the second assembly. As some additional information, I've also tried the following font referencing approaches: <TextBlock Text="Test" FontFamily="/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;component/FontName.ttf#Font Name" /> And a few similar variants with different assembly references/sub directories/random semi colons. And so far nothing works... anyone struck this (and preferably solved it)?

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >