Search Results

Search found 311 results on 13 pages for 'dominic williams'.

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

  • iPhone Web Development Image Scaling

    - by Dominic Godin
    I am developing a simple web page to be viewed after an iphone application completes. I am finding the safari degrades the image quality of the jpg so its all fuzzy. The image is background image applied to a div div.foo { background: url(../images/foo.jpg) no-repeat; width:320px; height:349px; } The width and height are exactly the same as the jpg image. Is there a way to make sure the image gets displayed in its full quality?

    Read the article

  • Processing file uploads before object is saved

    - by Dominic Rodger
    I've got a model like this: class Talk(BaseModel): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) seconds = models.IntegerField(blank = True, null = True) I want to validate before saving that the uploaded file is an MP3, like this: def is_mp3(path_to_file): from mutagen.mp3 import MP3 audio = MP3(path_to_file) return not audio.info.sketchy Once I'm sure I've got an MP3, I want to save the length of the talk in the seconds attribute, like this: audio = MP3(path_to_file) self.seconds = audio.info.length The problem is, before saving, the uploaded file doesn't have a path (see this ticket, closed as wontfix), so I can't process the MP3. I'd like to raise a nice validation error so that ModelForms can display a helpful error ("You idiot, you didn't upload an MP3" or something). Any idea how I can go about accessing the file before it's saved? p.s. If anyone knows a better way of validating files are MP3s I'm all ears - I also want to be able to mess around with ID3 data (set the artist, album, title and probably album art, so I need it to be processable by mutagen).

    Read the article

  • How to tell if a user is a fan of the fan page

    - by Dominic Godin
    Hi, I'm working on a FBML fan page for a client. I need to perform a check to see if the current user is a fan of the page. I tried using the JavaScript API but I've found this is not compatible with FBML. I have looked through the FBML page on the developer wiki and found checks for practically everything else but no is user fan check. Any pointers in the right direction would be most appreciated. Thanks in advance.

    Read the article

  • Storing a list of objects in GAE

    - by Dominic Bou-Samra
    I need to store some data that looks a little like this: xyz 123 abc 456 hij 678 rer 838 Now I would just store it as a traditional string and integer model, and put in the datastore. But the data changes regularly, and is ONLY relevant when looked at as a COLLECTION. So it needs to be store as either a list of lists, or a list of objects, both of which can't really be done without pickling as far as I know. Can anyone help? Even storing it as a text file may work :S

    Read the article

  • C++ a class with an array of structs, without knowing how large an array I need

    - by Dominic Bou-Samra
    New to C++, and for that matter OO programming. I have a class with fields like firstname, age, school etc. I need to be able to store other information like for instance, where they have travelled, and what year it was in. I cannot declare another class specifically to hold travelDestination and what year, so I think a struct might be best. This is just an example: struct travel { string travelDest; string year; }; The issue is people are likely to have travelled different amounts. I was thinking of just having an array of travel structs to hold the data. But how do I create a fixed sized array to hold them, without knowing how big I need it to be? Perhaps I am going about this the completely wrong way, so any suggestions as to a better way would be appreciated.

    Read the article

  • Python doesn't work properly when I execute a script after using Right Click >> Command Prompt Here

    - by Dominic Bou-Samra
    This is a weird bug. I know it's something funky going on with my PATH variable, but no idea how to fix it. If I have a script C:\Test\test.py and I execute it from within IDLE, it works fine. If I open up Command Prompt using Runcmd.exe and navigate manually it works fine. But if I use Windows 7's convenient Right Click on folder Command Prompt Here then type test.py it fails with import errors. I also cannot just type "python" to reach a python shell session if I use the latter method above. Any ideas?

    Read the article

  • crazy asp.net error

    - by dominic
    Hi I am having a problem debugging an issue on a website. Everything works locally, the local and server databases are the same The strange thing about the error is that it points to my local dev machine in the error stack. Is that crazy or what, The files are published and being hosted on a server machine and the error is pointing to a line of code on my local dev box. I feel like I am losing the plot. Can someone pls help be clear the air here because this is very weird Error in '/' Application. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index] System.Collections.ArrayList.get_Item(Int32 index) +10066148 System.Collections.Specialized.NameObjectCollectionBase.BaseGet(Int32 index) +17 System.Web.HttpFileCollection.get_Item(Int32 index) +9 System.Web.HttpFileCollectionWrapper.get_Item(Int32 index) +18 PitchPortal.Web.Binders.DocumentModelBinder.ValidateAndAssignPostedFile(ControllerContext controllerContext, ModelBindingContext bindingContext, Document doc) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:73 PitchPortal.Web.Binders.DocumentModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:45 System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +404 System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +140 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +658084 System.Web.Mvc.Controller.ExecuteCore() +125 System.Web.Mvc.<c_DisplayClass8.b_4() +48 System.Web.Mvc.Async.<c_DisplayClass1.b_0() +21 System.Web.Mvc.Async.<c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +15 System.Web.Mvc.Async.WrappedAsyncResult1.End() +85 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +454 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263

    Read the article

  • Explaining abstraction to a non-programmer.

    - by Dominic Bou-Samra
    Abstraction is a concept that seems difficult to explain, without reverting to using programming terminology. I've thought about it a lot, and I can't come up with a satisfactory answer. Does anyone have any very general, yet very pertinent explanations? Metaphors, similes etc are all welcome.

    Read the article

  • How do I draw the desktop on Mac OS X?

    - by Dominic Cooney
    I want to draw the desktop on Mac OS X (Snow Leopard). Specifically, I want to achieve the same effect as running: /System/Library/Frameworks/ScreenSaver.framework/Resources/ ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background (If you’re not near your computer, this displays the screensaver where you would normally see your desktop background.) I know how to make a window without a border (by subclassing NSWindow and overriding initWithContentRect:styleMask:backing:defer: to set the window style to NSBorderlessWindowMask) and without a shadow (setHasShadow:NO.) I know that I can call setLevel:kCGDesktopWindowLevel or kCGDesktopIconWindowLevel to put my window below other windows (see question 418791.) However this isn’t exactly what I want, because a window at this level is still on top of the desktop icons. I want to be on top of the desktop background, but below the icons. My view is opaque. If there is a technique that clobbers the desktop background, that is OK.

    Read the article

  • Manipulating binary data in Python

    - by Dominic Bou-Samra
    I am opening up a binary file like so: file = open("test/test.x", 'rb') and reading in lines to a list. Each line looks a little like: '\xbe\x00\xc8d\xf8d\x08\xe4.\x07~\x03\x9e\x07\xbe\x03\xde\x07\xfe\n' I am having a hard time manipulating this data. If I try and print each line, python freezes, and emits beeping noises (I think there's a binary beep code in there somewhere). How do I go about using this data safely? How can I convert each hex number to decimal?

    Read the article

  • Sticky Footers that move down when dynamic content gets loaded

    - by Dominic Rodger
    I've been using this snippet of jQuery to get a sticky footer: if($(document.body).height() < $(window).height()){ $("#footer").css({position: "absolute",top:($(window).scrollTop()+$(window).height()-$("#footer").height())+"px", width: "100%"}); } $(window).scroll(positionFooter).resize(positionFooter); However, that breaks when I've got expandable/collapsible divs lying around where the original content was less high than the window, since it is then stuck to the bottom of the window, rather than the bottom of the document. Is there a way of fixing this, or a better way of doing it? Please bear in mind that I don't have much control over the HTML, since I need to do this in Django's admin interface, which doesn't allow much injection of HTML in the places you might want to to accomplish this sort of thing (i.e. this answer and this answer don't work for me).

    Read the article

  • The new operator in C# isn't overriding base class member

    - by Dominic Zukiewicz
    I am confused as to why the new operator isn't working as I expected it to. Note: All classes below are defined in the same namespace, and in the same file. This class allows you to prefix any content written to the console with some provided text. public class ConsoleWriter { private string prefix; public ConsoleWriter(string prefix) { this.prefix = prefix; } public void Write(string text) { Console.WriteLine(String.Concat(prefix,text)); } } Here is a base class: public class BaseClass { protected static ConsoleWriter consoleWriter = new ConsoleWriter(""); public static void Write(string text) { consoleWriter.Write(text); } } Here is an implemented class: public class NewClass : BaseClass { protected new static ConsoleWriter consoleWriter = new ConsoleWriter("> "); } Now here's the code to execute this: class Program { static void Main(string[] args) { BaseClass.Write("Hello World!"); NewClass.Write("Hello World!"); Console.Read(); } } So I would expect the output to be Hello World! > Hello World! But the output is Hello World Hello World I do not understand why this is happening. Here is my thought process as to what is happening: The CLR calls the BaseClass.Write() method The CLR initialises the BaseClass.consoleWriter member. The method is called and executed with the BaseClass.consoleWriter variable Then The CLR calls the NewClass.Write() The CLR initialises the NewClass.consoleWriter object. The CLR sees that the implementation lies in BaseClass, but the method is inherited through The CLR executes the method locally (in NewClass) using the NewClass.consoleWriter variable I thought this is how the inheritance structure works? Please can someone help me understand why this is not working?

    Read the article

  • Image inside a button not positioned correctly in Firefox

    - by Dominic Rodger
    I have the following markup: <p class="managebox"> <button value="Add page"> <img src="page_add.png" alt="Add more content" /> Add Page </button> </p> And the following CSS: p.managebox { position: relative; } p.managebox button { display: block; padding: 5px 7px 4px 30px; position: relative; } p.managebox button img { position: absolute; left: 7px; } In IE 8 I get this: In Chrome 4.0 I get this: In Firefox 3.6 I get this: Does anyone know what I'm doing wrong? One thing I've just realised that may be relevant - if I use an a instead of button, it works fine.

    Read the article

  • Synchronizing in SQL Replication works when manually syncing, but not automatically

    - by Dominic Zukiewicz
    I'm using SQL Server 2005 to create a replication copy of the main databases, so that the reports can point to the replication copy instead of locking out our main databases. I have set up the 3 databases as publications and then 3 subscribers moving the transactions over to the subscribers, instantaneously I hope! What seems to be happening is that when using the "Insert Tracer" function, replication take publisher to distributor < 2 seconds, but to replicate to the subscribers can take over 7 minutes (and these are local databases on a SAN). This could be for 2 reasons: The SQL statements used to query the database are obtaining locks which are stopping the transactions updating the subscribers. The subscribers are just too busy for the replication to apply the changes. What seems to trouble me more, is that although the Replication Monitor / Insert Tracer are showing these statistics, if you use the "View Subscription Details" and then click Start, it will sync within seconds. My goal would be to have the data syncing (ideally) continuously, or every minute, perhaps I should reduce the batch size of the transactions? What am I doing wrong? [Note that the -Continuous flag is set!]

    Read the article

  • Rewriting a simple Pygame 2D drawing function in C++

    - by Dominic Bou-Samra
    I have a 2D list of vectors (say 20x20 / 400 points) and I am drawing these points on a screen like so: for row in grid: for point in row: pygame.draw.circle(window, white, (particle.x, particle.y), 2, 0) pygame.display.flip() #redraw the screen This works perfectly, however it's much slower then I expected. I want to rewrite this in C++ and hopefully learn some stuff (I am doing a unit on C++ atm, so it'll help) on the way. What's the easiest way to approach this? I have looked at Direct X, and have so far followed a bunch of tutorials and have drawn some rudimentary triangles. However I can't find a simple (draw point).

    Read the article

  • ZF2 - How to use the Hydrator/exchangeArray() to populate a nested object

    - by Dominic Watson
    I've got an object with values that are stored in my database. My object also contains another object which is stored in the database using just the ID of it (foreign key). http://framework.zend.com/manual/2.0/en/modules/zend.stdlib.hydrator.html Before the Hydrator/exchangeArray functionality in ZF2 you would use a Mapper to grab everything you need to create the object. Now I'm trying to eliminate this extra layer by just using Hydration/exchangeArray to populate my objects but am a bit stuck on creating the nested object. Should my entity have the Inner object's table injected into it so I can create it if the ID of it is passed to my 'exchangeArray' ? Here are example entities as an example. // Village id, name, position, square_id // Map Square id, name, type Upon sending square_id to my Village's exchangeArray() function. It would get the mapTable and use hydrator to pull in the square using the ID I have. It doesn't seem right to be to have mapper instances inside my entity as I thought they should be disconnected from anything but it's own entity specific parameters and functionality?

    Read the article

  • [C++] STL list - how to find a list element by its object fields

    - by Dominic Bou-Samra
    I have a list: list<Unit *> UnitCollection; containing Unit objects, which has an accessor like: bool Unit::isUnit(string uCode) { if(this->unitCode == uCode) return true; else return false; } How do I search my UnitCollection list by uCode and return the corresponding element (preferably it's index). I have looked at the find() method, but i'm not sure you can pass a boolean method in instead of a searched item parameter if that makes sense.

    Read the article

  • CaptureCameraDialog returns OK but does not save (Motorola ES400)

    - by Dominic
    Ok it seems like everyone in the world has issues with CaptureCameraDialog. In my case the result is OK, but when taking the photo there is a MessageBox that says "Error" that appears and disappears in the blink of an eye, then returns to my app (so I don't have time to actually read the error). It has not saved the file. It does not throw an error to my application. There is also another issue which is exactly the same as the issue talked about here (yet none of the fixes work for me). http://www.pcreview.co.uk/forums/thread-4025602.php Does anyone know how to get the "error message" that the dialogue box displays for an instant?

    Read the article

  • How to document a Symfony based REST API (similar to enunciate's documentation capabilities)

    - by Dominic
    If I have a REST based service written in the Symfony [symfony-project.org] framework (i.e. PHP), is there any decent tools/frameworks out there that will parse my code and generate API documentation? The Java based framework enunciate has documentation capabilities similar to what I need, you can view an example of this here: http://enunciate.codehaus.org/wannabecool/step1/index.html. I understand the premise of REST based services are supposed to be self evident, however I was after something that would generate this documentation for me without the need to manually write up all my endpoints, supported formats, sample output etc. Thanks

    Read the article

  • Reading file data during form's clean method

    - by Dominic Rodger
    So, I'm working on implementing the answer to my previous question. Here's my model: class Talk(models.Model): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) Here's my form: class TalkForm(forms.ModelForm): def clean(self): super(TalkForm, self).clean() cleaned_data = self.cleaned_data if u'mp3' in self.files: from mutagen.mp3 import MP3 if hasattr(self.files['mp3'], 'temporary_file_path'): audio = MP3(self.files['mp3'].temporary_file_path()) else: # What goes here? audio = None # setting to None for now ... return cleaned_data class Meta: model = Talk Mutagen needs file-like objects - the first case (where the uploaded file is larger than the size of file handled in memory) works fine, but I don't know how to handle InMemoryUploadedFile that I get otherwise. I've tried: # TypeError (coercing to Unicode: need string or buffer, InMemoryUploadedFile found) audio = MP3(self.files['mp3']) # TypeError (coercing to Unicode: need string or buffer, cStringIO.StringO found) audio = MP3(self.files['mp3'].file) # Hangs seemingly indefinitely audio = MP3(self.files['mp3'].file.read()) Is there something wrong with mutagen, or am I doing it wrong?

    Read the article

  • Hide JQueryUI Accordion Items with View All Option

    - by Dominic Webb
    I have a JqueryUi Accordion that is dynamically generated. However I need it to show only the first 8 items with the rest viewable by clicking a "View All" link. The code is simply a series of: <h2>Title</h2> <div>....</div> The jquery is all of: $(function() { $("#sidebar").accordion({autoHeight: false}); }); Thanks

    Read the article

  • PNG composition using GD and PHP

    - by Dominic
    I am trying to take a rectangular png and add depth using GD by duplicating the background and moving it down 1 pixel and right 1 pixel. I am trying to preserve a transparent background as well. I am having a bunch of trouble with preserving the transparency. Any help would be greatly appreciated. Thanks! $obj = imagecreatefrompng('rectangle.png'); $depth = 5; $obj_width = imagesx($obj); $obj_height = imagesy($obj); imagesavealpha($obj, true); for($i=1;$i<=$depth;$i++){ $layer = imagecreatefrompng('rectangle.png'); imagealphablending( $layer, false ); imagesavealpha($layer, true); $new_obj = imagecreatetruecolor($obj_width+$i,$obj_height+$i); $new_obj_width = imagesx($new_obj); $new_obj_height = imagesy($new_obj); imagealphablending( $new_obj, false ); imagesavealpha($new_obj, true); $trans_color = imagecolorallocatealpha($new_obj, 0, 0, 0, 127); imagefill($new_obj, 0, 0, $trans_color); imagecopyresampled($new_obj, $layer, $i, $i, 0, 0, $obj_width, $obj_height, $obj_width, $obj_height); //imagesavealpha($new_obj, true); //imagesavealpha($obj, true); } header ("Content-type: image/png"); imagepng($new_obj); imagedestroy($new_obj);

    Read the article

  • Getting the height of a div after setting it to auto in IE

    - by Dominic Godin
    Hi, I'm writing some JavaScript that changes the size of some content. To do this I need to know the size of a div within my content. If I have the following html: <div id="wrapper"> ... other stuff ... <div id="inner" style="height:400px">Some text in here</div> ... other stuff ... </div> And the following JavaScript: $('#inner').height('auto'); var height = $("#wrapper").height(); In FireFox and Chrome the height variable increases as the inner div expands to fit all the text. In IE this stays the same. I guess it doesn't redraw the div straight away. Anybody know how to get the new correct height in IE? Cheers

    Read the article

  • Returning JSON or XML for Exceptions in Jersey

    - by Dominic
    My goal is to have an error bean returned on a 404 with a descriptive message when a object is not found, and return the same MIME type that was requested. I have a look up resource, which will return the specified object in XML or JSON based on the URI (I have setup the com.sun.jersey.config.property.resourceConfigClass servlet parameter so I dont need the Accept header. My JAXBContextResolver has the ErrorBean.class in its list of types, and the correct JAXBContext is returned for this class because I can see in the logs). eg: http://foobar.com/rest/locations/1.json @GET @Path("{id}") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Location getCustomer(@PathParam("id") int cId) { //look up location from datastore .... if (location == null) { throw new NotFoundException("Location" + cId + " is not found"); } } And my NotFoundException looks like this: public class NotFoundException extends WebApplicationException { public NotFoundException(String message) { super(Response.status(Response.Status.NOT_FOUND). entity(new ErrorBean( message, Response.Status.NOT_FOUND.getStatusCode() ) .build()); } } The ErrorBean is as follows: @XmlRootElement(name = "error") public class ErrorBean { private String errorMsg; private int errorCode; //no-arg constructor, property constructor, getter and setters ... } However, I'm always getting a 204 No Content response when I try this. I have hacked around, and if I return a string and specify the mime type this works fine: public NotFoundException(String message) { super(Response.status(Response.Status.NOT_FOUND). entity(message).type("text/plain").build()); } I have also tried returning an ErrorBean as a resource. This works fine: {"errorCode":404,"errorMsg":"Location 1 is not found!"}

    Read the article

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