Search Results

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

Page 45/75 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • How do I call setattr() on the current module?

    - by Matt Joiner
    What do I pass as the first parameter "object" to the function setattr(object, name, value), to set variables on the current module? For example: setattr(object, "SOME_CONSTANT", 42); giving the same effect as: SOME_CONSTANT = 42 within the module containing these lines (with the correct object). I'm generate several values at the module level dynamically, and as I can't define __getattr__ at the module level, this is my fallback.

    Read the article

  • Rubyists: What is this called?

    - by Matt Darby
    Say I have a pool of enumerables that I want to group by an attribute: cars = Car.all.group_by(&:color) Then I want to iterate over those cars like so: cars.inject([]) do |stack, (color, cars)| stack << cars.each do |car| ... end end What is the term for the block variable extension (between the parentheses)?

    Read the article

  • How to obtain the root of a tree without parsing the entire file?

    - by Matt.
    I'm making an xml parser to parse xml reports from different tools, and each tool generates different reports with different tags. For example: Arachni generates an xml report with <arachni_report></arachni_report> as tree root tag. nmap generates an xml report with <nmaprun></nmaprun> as tree root tag. I'm trying not to parse the entire file unless it's a valid report from any of the tools I want. First thing I thought to use was ElementTree, parse the entire xml file (supposing it contains valid xml), and then check based on the tree root if the report belongs to Arachni or nmap. I'm currently using cElementTree, and as far as I know getroot() is not an option here, but my goal is to make this parser to operate with recognized files only, without parsing unnecessary files. By the way, I'm Still learning about xml parsing, thanks in advance.

    Read the article

  • How events are assigned in .NET

    - by Matt
    I just realized I didn't fully understand why in .NET you assign events using a += symbol. I figured this out yesterday when I needed to remove an event and without thinking I was doing someobject.onsomeevent += null thinking that would just remove the event I had previously assigned. After some investigation, I figured out I had to someobject.onsomeevent -= someeventmethod; After figuring this out, I realized I don't understand how event methods are assigned in .NET. So I have a few questions: First, does it mean that I can do someobject.onsomeevent += someeventmethod; someobject.onsomeevent += someeventothermethod; If so, when onsomeevent occurs will they both get hit, and in the order specified or simultaneously? Furthermore, how can I determine what event methods are already assigned to someobject.onsomeevent? Second, is there a way to save the events methods in some class, remove them from someobject.onsomeevent and re-assign them after some other procedures that would normally trigger the event are complete?

    Read the article

  • Unit Testing Model Classes that inherit from NSManagedObject

    - by Matt Baker
    So...I'm trying to get unit tests set up in my iPhone App but I'm having some issues. I'm trying to test my model classes but they inherit directly from NSManagedObject. I'm sure this is a problem but I don't know how to get around it. Everything is building and running as expected but I get this error when calling any method on the class I'm testing: Unknown.m:0:0 unrecognized selector sent to instance 0xc2b120 If I follow this structure (http://chanson.livejournal.com/115621.html) to create my object in my tests I end up with another error entirely but it still doesn't help me. Basically my question is this: how can I test a class that inherits from NSManagedObject?

    Read the article

  • Security of WCF endpoints

    - by Matt
    For the sake of argument, lets say that I've got a basicHttp WCF service. Besides implementing authentication (login/logout methods), what is stopping someone from just cracking open Visual Studio, adding a web reference to my website's service, and then playing playing around with my service? I'm not familiar with a method of stopping someone from doing this. The idea of someone downloading all of my Data/Operation contracts and then start playing around is keeping me up at night, and I like my sleep!

    Read the article

  • How does Bitmap.Save(Stream, ImageFormat) format the data?

    - by Matt Jacobsen
    I have a non transparent, colour bitmap with length 2480 and width 3507. Using Bitmap.GetPixel(int x, int y) I am able to get the colour information of each pixel in the bitmap. If I squirt the bitmap into a byte[]: MemoryStream ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Bmp); ms.Position = 0; byte[] bytes = ms.ToArray(); then I'd expect to have the same information, i.e. I can go to bytes[1000] and read the colour information for that pixel. It turns out that my array of bytes is larger than I anticipated. I thought I'd get an array with 2480 x 3507 = 8697360 elements. Instead I get an array with 8698438 elements - some sort of header I presume. In what format the bytes in my array stored? Is there a header 1078 bytes long followed by Alpha, Red, Green, Blue values for every byte element, or something else?

    Read the article

  • Memory leak with WPF & ItemsControl (VB.NET)

    - by Matt H.
    I have an ItemsControl that uses a DataTemplate to display properties in my customClass that implements INotifyPropertyChanged... Pretty straightforward... Some items in the DataTemplate use CommandBindings (such as buttons), and a few have some code-behind (yuck). When I empty the ItemsControl and set all instances of customClass = Nothing , no memory is released from my program. This becomes a problem pretty quickly! Any idea where I should start looking? I've even gone so far as to completely traverse the visual tree of each DataTemplate instance and set each Visual = Nothing. I'm not really if that's supposed to have any effect though.

    Read the article

  • Problems with asp:Button OnClick event...

    - by Matt
    Hi, Here is my button <asp:Button ID="myButton" Text="Click Me" OnClick="doSomething(10)" runat="server" /> Here is the server function public void doSomething(int num) { int someOtherNum = 10 + num; } When I try to compile the code I get the error "Method Name Expected" for the line: <asp:Button ID="myButton" Text="Click Me" OnClick="doSomething(10)" runat="server" /> What am I doing wrong? Am I not allowed to pass values to the server from an OnClick event?

    Read the article

  • Rails: Internationalization of Javascript Strings?

    - by Matt Rogish
    So, we have an existing Rails 2.3.5 app that does not support Internationalization at all. Now, I'm well familiar with Rails I8n stuff, but we have a LOT of output strings inside /javascripts/. I'm not a huge fan of this approach, but unfortunately it is too late to fix it now. How might we internationalize strings stored in JS files in a Rails app? Rails doesn't even serve the JS files... I'm thinking I could always have the Rails app serve up the JS files, but that seems pretty gross. Are there plugins to do this? Yikes.

    Read the article

  • wp_update_user crashes my plugin for wordpress

    - by Matt Facer
    I am trying to write a plugin which will update a user field. I can use the update user meta function OK, but when I try the wp_update_user it doesnt work. wp_update_user($user_ID, 'user_nicename', 'test'); That crashes the plugin. Do I need to include something for this function to work??

    Read the article

  • Java Applet Deployment, ClassNotFoundException (primary class)

    - by Matt
    This is driving me up the wall. I have checked and rechecked spelling and paths. I have tried just about every combination of paths, including relative, absolute, and full http paths. I continue to get the following error when trying to load a Java applet: java.lang.ClassNotFoundException: AppletClient.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.ClassNotFoundException: AppletClient.class The HTML used to load the applet: <applet width="100" height="100" archive="applet/myapplet.jar, applet/applet_dependency.jar" code="AppletClient.class"> <param value="blahblah" name="username"> <param value="false" name="codebase_lookup"> </applet> The applet is in a relative directory, "applet", from the path of the current page. I have unzipped the jar file and can see AppletClient.class. Also, in the source of the project, it is spelled that way (casing and all). I have tried with/without the parameters. I have changed the names of the archive jars in the applet include tag just to see if I get a different error for bad file names (same error). I have manually done GETs on the jars to make sure the server is responding to the requests (it is). I have tried with and without the codebase tag, with all different varieties of paths (start getting bad "magic number" errors on those). I know that this error sometimes pops up when a dependency fails to load, so it can be misleading, but all dependencies are present, accounted for, and are fetchable via manual GETs. Between each and every attempt I always clear my cache in FireFox. These problems are reproduced in IE8 and Chrome as well. Per my Java Console from the browser, I am running Java Plug-in 1.6.0_20. This is from the same machine that I develop the applet on, which runs fine via Eclipse. Finally, I kicked on Fiddler2, and I don't see a single request for the jar files anywhere The host site is running from my Visual Studio debugger, so it's running on localhost. But I see the requests for all the other resources on Fiddler. Just... no Jars. ANYWHERE. I clear the log, cleared my browser cache, and did a ctrl-R refresh. And still, not a single Jar request on the Fiddler log. I even did a delayed write (with JS) of the applet tag after the page loaded, once all the Fiddler activity slowed down. The element gets written to the document (and I can see the 100x100 Java error window), but not a single request shows up on Fiddler. Any suggestions, before I go crawl into the corner and cry myself to sleep? EDIT: From the Java console, if I hit "l" (el) to "dump classloader list", I see something that looks like this: Live entry: key=http://localhost:55446/BaseWebSite/,http://localhost:55446/BaseWebSite/applet/myappliet.jar, http://localhost:55446/BaseWebSite/applet/applet_dependency.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://localhost:55446/BaseWebSite/-threadGroup,maxpri=4]

    Read the article

  • using Applescript to retrieve movie file duration via Finder properties

    - by Matt
    When using Get Info on movie files in the Finder, I've noticed that many movie files have an accessible "Duration" property under the More Info tab. Is there an easy way to access this data using Applescript? I've tried lines like "set theTime to (duration of aFile)", but it doesn't seem to be as simple as that. Ideally I'd like to access the movie duration via the Finder properties without having to actually open the file in QuickTime. Is this possible? Edit: I seem to have figured this out... you need to use the "System Events" application, specifically the Movie File Suite of commands (and, importantly, you need to set the movie variable as a string, rather than an alias): set theMovie to (choose file with prompt "Select a movie file:") as string tell application "System Events" set theName to name of movie file theMovie set theDuration to (duration of contents of movie file theMovie) / (time scale of contents of movie file theMovie) end tell

    Read the article

  • Get All Users in an Active Directory Group

    - by Matt Hanson
    I'm using the following code sample to get a list of all users in a specified AD group (in this case, all users in the "Domain Users" group). My listed code works great, with one exception: it won't return users who have their primary group set to "Domain Users". How can I get a list of all users in the group, including those who have it set as their primary group? Private Sub GetUsers() Dim groupSearcher As New DirectorySearcher Dim groupSearchRoot As New DirectoryEntry("LDAP://OU=Users,DC=domain,DC=com") With groupSearcher .SearchRoot = groupSearchRoot .Filter = "(&(ObjectClass=Group)(CN=Domain Users))" End With Dim members As Object members = groupSearcher.FindOne.GetDirectoryEntry.Invoke("Members", Nothing) For Each member As Object In CType(members, IEnumerable) Console.WriteLine(New DirectoryEntry(member).Name.Remove(0, 3)) Next End Sub

    Read the article

  • Reading Windows ACLs from Java

    - by Matt Sheppard
    From within a Java program, I want to be able to list out the Windows users and groups who have permission to read a given file. Obviously Java has no built-in ability to read the Windows ACL information out, so I'm looking for other solutions. Are there any third party libraries available which can provide direct access to the ACL information for a Windows file? Failing that, maybe running cacls and capturing and then processing the output would be a reasonable temporary solution - Is the output format of cacls thoroughly documented anywhere, and is it likely to change between versions of Windows?

    Read the article

  • How can I display a manual efficiently in Sharepoint

    - by Matt Palfreman
    My organisiation uses Sharepoint for its 'intranet'. I have been given the task of creating a site for my department. One of the things I need on there is a procedure guide, which is basically a 150 page document, whereby each page is a separate procedure. Is there an efficient way within sharepoint that these procedures can be stored and searchable somehow, rather than dumping a 150 page document on there?

    Read the article

  • Why is this default template parameter not allowed?

    - by Matt Joiner
    I have the following class: template <typename Type = void> class AlignedMemory { public: AlignedMemory(size_t alignment, size_t size) : memptr_(0) { int iret(posix_memalign((void **)&memptr_, alignment, size)); if (iret) throw system_error("posix_memalign"); } virtual ~AlignedMemory() { free(memptr_); } operator Type *() const { return memptr_; } Type *operator->() const { return memptr_; } //operator Type &() { return *memptr_; } //Type &operator[](size_t index) const; private: Type *memptr_; }; And attempt to instantiate an automatic variable like this: AlignedMemory blah(512, 512); This gives the following error: src/cpfs/entry.cpp:438: error: missing template arguments before ‘buf’ What am I doing wrong? Is void not an allowed default parameter?

    Read the article

  • How to turn a list of tuples into a string?

    - by matt
    I have a list of tuples that I'm trying to incorporate into a SQL query but I can't figure out how to join them together without adding slashes. My like this: list = [('val', 'val'), ('val', 'val'), ('val', 'val')] If I turn each tuple into a string and try to join them with a a comma I'll get something like ' (\'val\, \'val\'), ... ' What's the right way to do this, so I can get the list (without brackets) as a string?

    Read the article

  • Cocoa app not launching on build & go but launching manually

    - by Matt S.
    I have quite the interesting problem. Yesterday my program worked perfectly, but now today I'm getting exc_bad_access when I hit build and go, but if I launch the app from the build folder it launches perfectly and there seems to be nothing wrong. The last bunch of lines from the debugger are: #0 0xffff07c2 in __memcpy #1 0x969f7961 in CFStringGetBytes #2 0x96a491b9 in CFStringCreateMutableCopy #3 0x991270cc in -[NSCFString mutableCopyWithZone:] #4 0x96a5572a in -[NSObject(NSObject) mutableCopy] #5 0x9913e6c7 in -[NSString stringByReplacingOccurrencesOfString:withString:options:range:] #6 0x9913e62f in -[NSString stringByReplacingOccurrencesOfString:withString:] #7 0x99181ad0 in -[NSScanner(NSDecimalNumberScanning) scanDecimal:] #8 0x991ce038 in -[NSDecimalNumberPlaceholder initWithString:locale:] #9 0x991cde75 in -[NSDecimalNumberPlaceholder initWithString:] #10 0x991ce44a in +[NSDecimalNumber decimalNumberWithString:] Why did my app work perfectly yesterday but not today?

    Read the article

  • How does MVC ViewData work?

    - by Matt
    I am toying around with an MVC application just to learn the technology. I am mocking up a check register application that keeps track of a checking account, what has cleared the bank and what has not. I am using EF for my model and everything seems to be working correctly insofar as Edit, Create, etc. However, I have a couple of totals at the top. One to show the bank's balance and another to show the actual balance. It works most of the time but when I do Edit's it does not always accurately reflect the new total and I need it to update everytime a change is made (i.e when something clears the bank): [Authorize(Roles = "admin, checkUser")] public ActionResult Index() { var resultSet = from myChecking in chk.tblCheckings orderby myChecking.id descending select myChecking; ViewData.Model = resultSet.Take(45).ToList(); //for balances var actualBalance = from theChecking in chk.tblCheckings select theChecking.deposit - theChecking.withdrawal; var bankBalance = from theChecking in chk.tblCheckings where theChecking.cleared == true select theChecking.deposit - theChecking.withdrawal; //get bank balance ViewData["bankBalance"] = bankBalance.Sum(); //get actual balance ViewData["actualBalance"] = actualBalance.Sum(); return View(); } I am showing the actual and other balance in the Index view as follows: <td colspan="9" style="text-align: center; font-size: 11pt; color: white;"> <%= string.Format("Bank Balance: {0:c}", ViewData["bankBalance"]) %> ------ <%= string.Format("Actual Balance: {0:c}", ViewData["actualBalance"]) %> </td>

    Read the article

  • Storing uploaded content on a website

    - by Matt
    For the past 5 years, my typical solution for storing uploaded files (images, videos, documents, etc) was to throw everything into an "upload" folder and give it a unique name. I'm looking to refine my methods for storing uploaded content and I'm just wondering what other methods are used / preferred. I've considered storing each item in their own folder (folder name is the Id in the db) so I can preserve the uploaded file name. I've also considered uploading all media to a locked folder, then using a file handler, which you pass the Id of the file you want to download in the querystring, it would then read the file and send the bytes to the user. This is handy for checking access, and restricting bandwidth for users.

    Read the article

  • Using jQuery in a GridView?

    - by Matt
    I have a traditional ASP.NET GridView. Inside of it I have a Template Field with edit capabilities. I need to use a jQuery autocomplete plugin on the edit piece. It works anywhere but inside of this GridView. In other words, I know the plugin works. Here is the ASP.NET stuff (yes, I'm using a SqlDataSource): <%# Eval("INGREDIENT_CODE") % And here is the jQuery in the document.ready(): $('[id$=txtEditIngredients]').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true }); What might I be doing wrong here?

    Read the article

  • Start thread with two parameters

    - by Matt
    I've got a method that gets called on an event, which presents me with two variables varA, varB (both strings). This method gets called with new information quite frequently, thus I have created a separate method that takes in the two parameters. I want to run this method in a thread, however have struck the issue that Thread.Start will not accept parameters. I've tried a few supposed methods, but have so far had no luck.. I think my best bet is to create a separate class, and handle it there.. However I have a List which I am inserting data into, and hit a dead end when the separate class tried to access that list, since it was in a different class. Can someone help me out here please?

    Read the article

  • .NET 3.5 SP1 prerequisite, MS giving the clients 4.0

    - by Matt Bridges
    I have been using an MSI to install a WPF application using the .NET Framework 3.5 SP1. I have set up .NET 3.5 as a prerequisite in the MSI, and what has been happening for ages is that when the user does not have .NET 3.5 SP1, the MSI first has them download and install that before resuming the installation of my application. Since yesterday when MS released .NET 4.0, when users don't have .net 3.5 SP1, the MSI is directing them to install 4.0 instead. What happens though, is that after they finish installing 4.0, the MSI still detects that they don't have 3.5, and directs them to the 4.0 install site again. So the user has 4.0, but the MSI doesn't ever get to installing my application. What do I have to change in my application? This seems like an error with how MS is handling the prerequisites either on their server or in the MSI in VS 2008.

    Read the article

  • problems with Console.SetOut in Release Mode?

    - by Matt Jacobsen
    i have a bunch of Console.WriteLines in my code that I can observe at runtime. I communicate with a native library that I also wrote. I'd like to stick some printf's in the native library and observe them too. I don't see them at runtime however. I've created a convoluted hello world app to demonstrate my problem. When the app runs, I can debug into the native library and see that the hello world is called. The output never lands in the textwriter though. Note that if the same code is run as a console app then everything works fine. C#: [DllImport("native.dll")] static extern void Test(); StreamWriter writer; public Form1() { InitializeComponent(); writer = new StreamWriter(@"c:\output.txt"); writer.AutoFlush = true; System.Console.SetOut(writer); } private void button1_Click(object sender, EventArgs e) { Test(); } and the native part: __declspec(dllexport) void Test() { printf("Hello World"); } Update: hamishmcn below started talking about debug/release builds. I removed the native call in the above button1_click method and just replaced it with a standard Console.WriteLine .net call. When I compiled and ran this in debug mode the messages were redirected to the output file. When I switched to release mode however the calls weren't redirected. Console redirection only seems to work in debug mode. How do I get around this?

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >