Search Results

Search found 1971 results on 79 pages for 'matt roberts'.

Page 8/79 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • __getattr__ on a module

    - by Matt Joiner
    How can implement the equivalent of a __getattr__ on a class, on a module? Example When calling a function that does not exist in a module's statically defined attributes, I wish to create an instance of a class in that module, and invoke the method on it with the same name as failed in the attribute lookup on the module. class A(object): def salutation(self, accusative): print "hello", accusative def __getattr__(mod, name): return getattr(A(), name) if __name__ == "__main__": salutation("world") Which gives: matt@stanley:~/Desktop$ python getattrmod.py Traceback (most recent call last): File "getattrmod.py", line 9, in <module> salutation("world") NameError: name 'salutation' is not defined Evidently something is not right about my assumed implementation.

    Read the article

  • Qt, MSVC, and /Zc:wchar_t- == I want to blow up the world

    - by Noah Roberts
    So Qt is compiled with /Zc:wchar_t- on windows. What this means is that instead of wchar_t being a typedef for some internal type (__wchar_t I think) it becomes a typedef for unsigned short. The really cool thing about this is that the default for MSVC is the opposite, which of course means that the libraries you're using are likely compiled with wchar_t being a different type than Qt's wchar_t. This doesn't become an issue of course until you try to use something like std::wstring in your code; especially when one or more libraries have functions that accept it as parameters. What effectively happens is that your code happily compiles but then fails to link because it's looking for definitions using std::wstring<unsigned short...> but they only contain definitions expecting std::wstring<__wchar_t...> (or whatever). So I did some web searching and ran into this link: http://bugreports.qt.nokia.com/browse/QTBUG-6345 Based on the statement by Thiago Macieira, "Sorry, we will not support building Qt like this," I've been worried that fixing Qt to work like everything else might cause some problem and have been trying to avoid it. We recompiled all of our support libraries with the /Zc:wchar_t- flag and have been fairly content with that until a couple days ago when we started trying to port over (we're in the process of switching from Wx to Qt) some serialization code. Because of how win32 works, and because Wx just wraps win32, we've been using std::wstring to represent string data with the intent of making our product as i18n ready as possible. We did some testing and Wx did not work with multibyte characters when trying to print special stuff (even not so special stuff like the degree symbol was an issue). I'm not so sure that Qt has this problem since QString isn't just a wrapper to the underlying _TCHAR type but is a Unicode monster of some sort. At any rate, the serialization library in boost has compiled parts. We've attempted to recompile boost with /Zc:wchar_t- but so far our attempts to tell bjam to do this have gone unheeded. We're at an impasse. From where I'm sitting I have three options: Recompile Qt and hope it works with /Zc:wchar_t. There's some evidence around the web that others have done this but I have no way of predicting what will happen. All attempts to ask Qt people on forums and such have gone unanswered. Hell, even in that very bug report someone asks why and it just sat there for a year. Keep fighting with bjam until it listens. Right now I've got someone under me doing that and I have more experience fighting with things to get what I want but I do have to admit to getting rather tired of it. I'm also concerned that I'll KEEP running into this issue just because Qt wants to be a c**t. Stop using wchar_t for anything. Unfortunately my i18n experience is pretty much 0 but it seems to me that I just need to find the right to/from function in QString (it has a BUNCH) to encode the Unicode into 8-bytes and visa-versa. UTF8 functions look promising but I really want to be sure that no data will be lost if someone from Zimbabfuckegypt starts writing in their own language and the documentation in QString frightens me a little into thinking that could happen. Of course, I could always run into some library that insists I use wchar_t and then I'm back to 1 or 2 but I rather doubt that would happen. So, what's my question... Which of these options is my best bet? Is Qt going to eventually cause me to gouge out my own eyes because I decided to compile it with /Zc:wchar_t anyway? What's the magic incantation to get boost to build with /Zc:wchar_t- and will THAT cause permanent mental damage? Can I get away with just using the standard 8-bit (well, 'common' anyway) character classes and be i18n compliant/ready? How do other Qt developers deal with this mess?

    Read the article

  • Inscribe and center an image within a frame

    - by Brennan Roberts
    Given a div of arbitrary aspect ratio, what's the best way to place and style an image (also with an arbitrary aspect ratio) inside such that: It is both inscribed and centered Its dimensions and position are set using relative values so that the image will remain inscribed and centered automatically when the frame is uniformly scaled (javascript should only be required when the image is initially inserted, or if the frame's aspect ratio changes) Extra markup is minimized Here's the result we want: Here's a fiddle template, which is just: Markup Should pillarbox <div class="frame"> <img src="http://www.placekitten.com/200/300" /> </div> Should letterbox <div class="frame"> <img src="http://www.placekitten.com/300/200" /> </div> CSS .frame { width: 200px; height: 200px; border: 2px solid black; margin: 10px 0px 100px 0; }

    Read the article

  • MVC2 Clientside Validation and duplicate ID's problem

    - by Dusty Roberts
    I'm using MVC2 with VS2010 I have a view that has two partial views in it: "Login" and "Register" both partial views contains the Email address field i use the following in both partial views: <%: Html.TextBoxFor(model => model.EmailAddress ) %><br /><%: Html.ValidationMessageFor(model => model.EmailAddress) %> if i use both partial views on one page, it ends up having duplicate id's so validation happens across both views (even thopugh they are in seperate forms) how can i go about eliminating this

    Read the article

  • Selenium/NUnit run one test on multiple IP addresses.

    - by Matt Clarkson
    I have a test suite DLL written in C# that uses Selenium.This is then loaded into NUnit and tests can be performed on our embedded web server boards. Does anyone know how to run a NUnit Selenium test on multiple IPs in multiple browsers? I have tried creating multiple DefaultSelenium classes but they point to the same Internet Explorer window. I need multiple instances of the Selenium RC controlling individual Internet Explorer windows. Have been looking a lot on the Selenium User Group and in various documentation but can find a definitive answer. Cheers, Matt

    Read the article

  • Connecting private IPs

    - by Greg Roberts
    A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth. Is this true? How's this technique named? Thanks

    Read the article

  • How can I store data in a table as a trie? (SQL Server)

    - by Matt
    Hi, To make things easier, the table contains all the words in the English dictionary. What I would like to do is be able to store the data as a trie. This way I can traverse the different branches of the trie and return the most relevant result. First, how do I store the data in the table as a trie? Second, how do I traverse the tree? If it helps at all, the suggestion in this previous question is where this question was sparked from. Please make sure it's SQL we're talking about. I understood the Mike Dunlavey's C implementation because of pointers but can't see how this part (The trie itself) works in SQL. Thanks, Matt

    Read the article

  • Pass associative arrays in call_user_func_array(...)

    - by Matt
    Hey all, I'm building a templating system and I'm running in to an issue with calling functions on the fly. When I try the following: $args = array( 4, 'test' => 'hello', 'hi' ); You know.. some numerical elements some associative elements, call_user_func_array($function, $args); converts the array to something like this: $args = array( 4, 'hello', 'hi' ); Is there any way around this other than passing an array like this: $args = array( 4, array('test' => 'hello'), 'hi' ); Thanks! Matt

    Read the article

  • how can I retrieve an html document from a url from javascript?

    - by Matt
    Hi, I have a url and I want to retrieve the html dom generated when going to the url (all the code for the page) in a javascript variable. How can I do this? I'm guessing an html get or post? Can anyone give an example with jQuery? Every time I do a $.get or $.post like this: $.get("http://www.google.ca", function(result) { alert(result); alert($(result).html()); }); $.post("http://www.google.ca", function(result) { alert(result); alert($(result).html()); }, "xml"); the first alert in each call comes up blank and the second comes up as null. Any ideas? Thanks, Matt

    Read the article

  • Cocoa-Created PDF Not Rendering Correctly

    - by Matthew Roberts
    I've created a PDF on the iPad, but the problem is when you have a line of text greater than 1 line, the content just goes off the page. This is my code: void CreatePDFFile (CGRect pageRect, const char *filename) { CGContextRef pdfContext; CFStringRef path; CFURLRef url; CFMutableDictionaryRef myDictionary = NULL; path = CFStringCreateWithCString (NULL, filename, kCFStringEncodingUTF8); url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0); CFRelease (path); myDictionary = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); NSString *foos = @"Title"; const char *text = [foos UTF8String]; CFDictionarySetValue(myDictionary, kCGPDFContextTitle, CFSTR(text)); CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("Author")); pdfContext = CGPDFContextCreateWithURL (url, &pageRect, myDictionary); CFRelease(myDictionary); CFRelease(url); CGContextBeginPage (pdfContext, &pageRect); CGContextSelectFont (pdfContext, "Helvetica", 12, kCGEncodingMacRoman); CGContextSetTextDrawingMode (pdfContext, kCGTextFill); CGContextSetRGBFillColor (pdfContext, 0, 0, 0, 1); NSString *body = @"text goes here"; const char *text = [body UTF8String]; CGContextShowTextAtPoint (pdfContext, 30, 750, text, strlen(text)); CGContextEndPage (pdfContext); CGContextRelease (pdfContext);} Now the issue lies within me writing the text to the page, but the problem is that I can't seem to specify a multi-line "text view".

    Read the article

  • UIView Obscuring Other Views

    - by Matt Long
    I cannot figure out what is obscuring my buttons. The first image shows the buttons that I want to click. They are clickable while the view is contracted like this, but when the view is expanded like in the second image, the buttons are no longer clickable. There seems to be another view obscuring the buttons. Any thoughts on what might be causing that? If not, any idea how I can figure out what view is getting the tap events when I tap in that area? Thanks. -Matt

    Read the article

  • How to add a Web Reference to a SSL web service?

    - by Matt W
    Hi, I have a web service in a C#/3.5 project which has been running fine. This is until I set the "SSL port" in IIS to 443 and set the "IIS - Directory Security - Secure Communications - Require secure channel (SSL)" option to true. Now, the web reference cannot be updated and I cannot add a new web reference to the web service in that site. When I try to view the service in a browse using just HTTP I get the "This page must be viewed over a secure channel" and when viewed with HTTPS on the front I get "This web page not available." Could someone tell me how to get a Web Reference added using Visual Studio to this secure web service, please? Thanks, Matt.

    Read the article

  • How can Perl's XML::Simple ignore HTML embedded in XML?

    - by Miriam Raphael Roberts
    I have an XML file that I am pulling from the web and parsing. One of the items in the XML is a 'content' value that has HTML. I am using XML::Simple::XMLin to parse the file like so: $xml= eval { $data->XMLin($xmldata, forcearray => 1, suppressempty=> +'') }; When I use Data::Dumper to dump the hash, I discovered that SimpleXML is parsing the HTML into the hash tree: 'content' = { 'div' = [ { 'xmlns' = 'http://www.w3.org/1999/xhtml', 'p' = [ { 'a' = [ { 'href' = 'http://miamiherald.typepad.com/.a/6a00d83451b26169e20133ec6f4491970b-pi', 'style' = 'FLOAT: left', 'img' = [ etc..... This is not what I want. I want to just grab content inside of this entry. How do I do this?

    Read the article

  • Code Profiling in the Windows Sidebar Environment

    - by Matt
    Does anyone know of a way I can code-profile my Windows Sidebar Gadget? I've played around with the code-profiling tool in IE8's "Developer Tools" and the code-profiling included in Visual Studio 2010, but I can't find a way to include the System.* API, which my gadget relies on (as it is standard in the Sidebar environment). The gadget also relies on cross-domain AJAX requests; which is normally permitted in the Sidebar environment. By code-profiling I primarily mean: Function call count Function execution time Any ideas would be much appreciated. Regards, Matt

    Read the article

  • Entity Framework vs LINQ to SQL

    - by Chris Roberts
    Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now have access to the .NET entity framework. My question is this. When trying to decide between using the Entity Framework and LINQ to SQL as an ORM, what's the difference? The way I understand it, the Entity Framework (when used with LINQ to Entities) is a 'big brother' to LINQ to SQL? If this is the case - what advantages does it have? What can it do that LINQ to SQL can't do on its own?

    Read the article

  • Loosing Textbox value on postback

    - by Dusty Roberts
    Hi Peeps i have an href that once clicking on it, it opens a dialog and sets a textbox value for that dialog. however, once i click on submit in that dialog, the textbox value is null. Link: <a href="#" onclick="javascript:expand('https://me.yahoo.com'); jQuery('#openiddialog').dialog('open'); return false;"><img id="yahoo" class="spacehw" src="/Content/Images/spacer.gif" /></a> Script: <script type="text/javascript"> jQuery(document).ready(function () { jQuery("#openiddialog").dialog({ autoOpen: false, width: 600, modal: true, buttons: { "Cancel": function () { $(this).dialog("close"); } } }); }); function expand(obj) { $("#<%=openIdBox.ClientID %>").val(obj); } </script> Dialog:<div id="openiddialog" title="Log in using OpenID"> <p> <asp:Label ID="Label1" runat="server" Text="OpenID Login" /> <asp:TextBox ID="openIdBox" EnableViewState="true" runat="server" /> <asp:JButton Icon="ui-icon-key" ID="loginButton" runat="server" Text="Authenticate" OnClick="loginButton_Click" /> <asp:CustomValidator runat="server" ID="openidValidator" ErrorMessage="Invalid OpenID Identifier" ControlToValidate="openIdBox" EnableViewState="false" OnServerValidate="openidValidator_ServerValidate" /> <br /> <asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed" Visible="False" /> <asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled" Visible="False" /> </p> </div> ... sorry... can't fix formatting ?!?

    Read the article

  • Seemingly normal link does not work in MVC, IIS5, SparkView.

    - by Matt W
    I have a regular link being generated in MVC1.0 as: /Login/Logout This link does not work. The code for it is: <a href="${Links.Logout}" class="SignOut">Sign out</a> As I am using SparkView. I am using IIS5.1 on WinXP Pro. I cannot work out why the link on the page calls the MVC action if I open the link in a separate browser tab but not when I click directly on it in the original page. This feels like a browser bug (Chrome, Firefox, IE8) but they all perform the same way. Thanks, Matt.

    Read the article

  • How to access and run field events from extension js?

    - by Dan Roberts
    I have an extension that helps in submitting forms automatically for a process at work. We are running into a problem with dual select boxes where one option is selected and then that selection changes another field's options. Since setting an option selected property to true doesn't trigger the field's onchange event I am trying to do so through code. The problem I've run into is that if I try to access or run functions on the field object from the extension, I get the error Error: uncaught exception: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: chrome://webformsidebar/content/webformsidebar.js :: WebFormSidebar_FillProcess :: line 499" data: no] the line causing the error is... if (typeof thisField.onchange === 'function') The line right before it works just fine... thisField.options[t].selected=true; ...so I'm not sure why this is resulting in such an error. What surprises me most I guess is that checking for the existence of the function leads to an error. It feels like the problem is related to the code running in the context of the extension instead of the browser window document. If so, is there any way to call a function in the browser window context instead? Do I need to actually inject code into the page somehow? Any other ideas? Thanks

    Read the article

  • Can I use "Online Backup" to backup my DVS instead of pushing to an external repo?

    - by Matt Brailsford
    Hi Guys, I'm currently signed up with a third party service that hosts my mercurial repositories as a central hub to push my changes to as a sort of backup. Now, I'm looking at a system to backup my laptop and am concidering Mozy. I'm a loan developer, and work on a laptop and am usualy connected to my internet via wifi with my laptop only really being on when I'm working, so feel something like Mozy is my best option. My question is, if I'm the only developer, could I get away with just using local mercurial repos and using Mozy to backup everything up? Rather than pushing to an external repo? Many thanks Matt

    Read the article

  • How to debug .net error where message is masked in Ajax call

    - by Matt Thrower
    Hi, I'm currently working on a page which makes use of the MS Ajax UpdatePanel. However I've run into a strange problem. If I simply compile and view my page, one of the button click events results in an error. However, because the button affects items inside an UpdatePanel the actual exception is hidden from me: all I'm getting is a HTTP 500 error returned to me through the UpdatePanel Javascript. What's odd about this is that if I step through the code line by line in Visual Studio, I don't get the error. The button doesn't cause the behaviour I'm expecting, but it throws no errors. Because the step through isn't causing an error to be thrown, I'm at a loss how I can get to the actual exception message so I can find out where the error is being thrown and debug it. Suggestions gratefully received. Cheers, Matt

    Read the article

  • Make object available within php functions without passing them or making them global

    - by Matt
    Hey all, This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code: Librarian.php: $class = "slideshow"; $function = "basic"; $args = array(...); $librarian = $this; // I WOULD LIKE THIS TO BE PRESENT IN CALLED FUNCTION ... return call_user_func($class.'::'.$function, $args); ... Slideshow.php: public static function basic($args) { echo $librarian; // "Librarian Object" } Thanks! Matt Mueller

    Read the article

  • autocomplete and $.getJSON problem

    - by Dusty Roberts
    Hi There I have a script: <script type="text/javascript"> $(document).ready(function(){ $("#PrincipleMember_IdNumber").autocomplete({ close: function(event, ui) { var member = {}; member.IDNumber = $("#PrincipleMember_IdNumber").val(); $.getJSON("<%= Url.Action("MemberLookup","Member") %>", member, function(data) { $("#PrincipleMember_Firstname").val(data.FirstName); }); } }); }); A form: <fieldset class="fieldsetSection"> <legend>Principle Member</legend> <table> <tr> <td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.IdNumber)%></td> <td class="editor-field"><%= Html.AutoCompleteTextBoxFor(i => i.PrincipleMember.IdNumber, "IdNumber", "AutoComplete")%></td> <td><%=Html.ValidationMessageFor(v => v.PrincipleMember.IdNumber)%></td> </tr> <tr> <td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.Firstname)%></td> <td class="editor-field"><%=Html.TextBoxFor(t => t.PrincipleMember.Firstname)%></td> <td><%=Html.ValidationMessageFor(v => v.PrincipleMember.Firstname)%></td> </tr> </table> and finally a json result action: public JsonResult MemberLookup(Member member) { member = _memberRepository.GetMember(member.IDNumber); return this.Json(member); } my json result is executed perfectly and i get a result, but for some reason this section of the script is not executing: $("#PrincipleMember_Firstname").val(data.FirstName); i've tried replacing it with an alert();, but that too is not executing. Can anyone see what i am doing wrong here?

    Read the article

  • How is your mac setup for windows development?

    - by Matt Brailsford
    Hi Guys, I'm looking at buying a MacBook Pro to replace my tiring laptop. My day to day job is as a .NET web developer so I am looking to use VMWare Fusion to run VS and SQL server etc. As I've not run my dev environment in a VM before, I would like to know how others are setup. What apps to you have installed? In which environment? Where do you store your files? Within each environment, or some shared drive? Are there any gotchas? Or essentials I should know. Many thanks Matt

    Read the article

  • Best practices for using memcached in Rails?

    - by Matt
    Hello everybody, as database transcations in our app are getting more and more time consuming, we have started to use memcached to reduce the amount of queries passed to MySQL. All in all, it works fine and really saves a lot of time. But as caching was "silently appearing" as a workaround to give the app more juice, a lot of our models now contain code like this: def self.all_cached Rails.cache.fetch('object_name') { find( :all, :include => [associations]) } end This is getting more and more a pain as filling and flushing the cache happens in several classes accross the application. Now, I was wondering if there was a better way to abstract memcached logic to make it more powerful and easy to use across all needed models? I was thinking about having some kind of memcached-module which is included in all needed modules. But before playing around, I thought: Let's ask experts first :-) Thanks Matt

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >