Search Results

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

Page 39/75 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • SQL select statement with increment

    - by Matt
    Currently I'm using a for statement in PHP to get all the months for this SQL statement, but would like to know if I can do it all with SQL. Basically I have to get the average listing price, and the average selling price for each month going back 1 year where the sellingdate = the month. simple with PHP, but that creates 12 database hits. I'm trying the sql statment below, but it returns listings totally out of order SELECT avg(ListingPrice), avg(SellingPrice), count(ListingDate), DATE(SellingDate) as date, MONTH(SellingDate) as month, YEAR(SellingDate) as year FROM `rets_property_resi` WHERE Area = '5030' AND Status = 'S' AND SellingDate Output: 867507.142857 877632.492063 63 1996-12-24 12 1996 971355.833333 981533.333333 60 1997-11-18 11 1997 949334.328358 985453.731343 67 1997-10-23 10 1997 794150.000000 806642.857143 70 1996-09-20 9 1996 968371.621622 988074.702703 74 1997-08-21 8 1997 1033413.366337 1053018.534653 101 1997-07-30 7 1997 936115.054795 962787.671233 73 1996-06-07 6 1996 875378.735632 906921.839080 87 1996-05-16 5 1996 926635.616438 958561.643836 73 2010-04-13 4 2010 1030224.472222 1046332.291667 72 2010-03-31 3 2010 921711.458333 924177.083333 48 1997-02-28 2 1997 799484.615385 791551.282051 39 1997-01-15 1 1997 As you can see, it pulls from random dates, I need to to pull from 2010-03, 2010-02, 2010-01, etc... any help is appreciated!

    Read the article

  • Minimum-Waste Print Job Grouping Algorithm?

    - by Matt Mc
    I work at a publishing house and I am setting up one of our presses for "ganging", in other words, printing multiple jobs simultaneously. Given that different print jobs can have different quantities, and anywhere from 1 to 20 jobs might need to be considered at a time, the problem would be to determine which jobs to group together to minimize waste (waste coming from over-printing on smaller-quantity jobs in a given set, that is). Given the following stable data: All jobs are equal in terms of spatial size--placement on paper doesn't come into consideration. There are three "lanes", meaning that three jobs can be printed simultaneously. Ideally, each lane has one job. Part of the problem is minimizing how many lanes each job is run on. If necessary, one job could be run on two lanes, with a second job on the third lane. The "grouping" waste from a given set of jobs (let's say the quantities of them are x, y and z) would be the highest number minus the two lower numbers. So if x is the higher number, the grouping waste would be (x - y) + (x - z). Otherwise stated, waste is produced by printing job Y and Z (in excess of their quantities) up to the quantity of X. The grouping waste would be a qualifier for the given set, meaning it could not exceed a certain quantity or the job would simply be printed alone. So the question is stated: how to determine which sets of jobs are grouped together, out of any given number of jobs, based on the qualifiers of 1) Three similar quantities OR 2) Two quantities where one is approximately double the other, AND with the aim of minimal total grouping waste across the various sets. (Edit) Quantity Information: Typical job quantities can be from 150 to 350 on foreign languages, or 500 to 1000 on English print runs. This data can be used to set up some scenarios for an algorithm. For example, let's say you had 5 jobs: 1000, 500, 500, 450, 250 By looking at it, I can see a couple of answers. Obviously (1000/500/500) is not efficient as you'll have a grouping waste of 1000. (500/500/450) is better as you'll have a waste of 50, but then you run (1000) and (250) alone. But you could also run (1000/500) with 1000 on two lanes, (500/250) with 500 on two lanes and then (450) alone. In terms of trade-offs for lane minimization vs. wastage, we could say that any grouping waste over 200 is excessive. (End Edit) ...Needless to say, quite a problem. (For me.) I am a moderately skilled programmer but I do not have much familiarity with algorithms and I am not fully studied in the mathematics of the area. I'm I/P writing a sort of brute-force program that simply tries all options, neglecting any option tree that seems to have excessive grouping waste. However, I can't help but hope there's an easier and more efficient method. I've looked at various websites trying to find out more about algorithms in general and have been slogging my way through the symbology, but it's slow going. Unfortunately, Wikipedia's articles on the subject are very cross-dependent and it's difficult to find an "in". The only thing I've been able to really find would seem to be a definition of the rough type of algorithm I need: "Exclusive Distance Clustering", one-dimensionally speaking. I did look at what seems to be the popularly referred-to algorithm on this site, the Bin Packing one, but I was unable to see exactly how it would work with my problem. Any help is appreciated. :)

    Read the article

  • set date error on uidatepicker

    - by Matt Facer
    Hi guys, I've been stumped by the code below. I pass a string date to a UIDatePicker which seems to work on most devices, yet on some, it crashes the app. here's the code NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"HH:mm"]; NSDate *date = [dateFormat dateFromString:dateStr]; [timePicker setDate:date]; [dateFormat release]; I have a function which passes the "dateStr" variable, as follows, dateStr = @"0:0"; I cannot see what's wrong - as it works for me! (iphone 3.1.3) but it doesnt work for my tester (ipod touch 3.1.3) Can anyone see anything wrong with the code? Thanks v much. any ideas?

    Read the article

  • Delphi Application using COMMIT and ROLLBACK for Multiple SQL Updates

    - by Matt
    Is it possible to use the SQL BEGIN TRANSACTION, COMMIT TRANSACTION, ROLLBACK TRANSACTION when embedding SQL Queries into an application with mutiple calls to the SQL for Table Updates. For example I have the following code: Q.SQL.ADD(<UPDATE A RECORD>); Q.ExecSQL; Q.Close; Q.SQL.Clear; Q.SQL.ADD(<Select Some Data>); Q.Open; Set Some Variables Q.Close; Q.SQL.Clear; Q.SQL.ADD(<UPDATE A RECORD>); Q.ExecSQL; What I would like to do is if the second update fails I want to roll back the first transaction. If I set a unique notation for the BEGIN, COMMIT, ROLLBACK so as to specify what is being committed or rolled back, is it feasible. i.e. before the first Update specify BEGIN TRANSACTION_A then after the last update specify COMMIT TRANSACTION_A I hope that makes sense. If I was doing this in a SQL Stored Procedure then I would be able to specify this at the start and end of the procedure, but I have had to break the code down into manageable chunks due to process blocks and deadlocks on a heavy loaded SQL Server.

    Read the article

  • Which CouchDB API to use for Rails?

    - by Matt Baker
    I am currently investigating possible applications of CouchDB on my current project (written in Rails) and would like to get some feedback from people who have actually used these APIs. Which would you recommend and why? ActiveCouch CouchFoo CouchRest CouchRest-Rails CouchPotato

    Read the article

  • Serial port determinism

    - by Matt Green
    This seems like a simple question, but it is difficult to search for. I need to interface with a device over the serial port. In the event my program (or another) does not finish writing a command to the device, how do I ensure the next run of the program can successfully send a command? Example: The foo program runs and begins writing "A_VERY_LONG_COMMAND" The user terminates the program, but the program has only written, "A_VERY" The user runs the program again, and the command is resent. Except, the device sees "A_VERYA_VERY_LONG_COMMAND," which isn't what we want. Is there any way to make this more deterministic? Serial port programming feels very out-of-control due to issues like this.

    Read the article

  • Scale transform in xaml (in a controltemplate) on a button to perform a "zoom"

    - by Matt B
    Hi all, I've got a button with an image in it and it's being styled by the following: <ControlTemplate x:Key="IconButton" TargetType="Button"> <Border> <ContentPresenter Height="80" Width="80" /> </Border> <ControlTemplate.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard TargetProperty="Opacity"> <DoubleAnimation From="1" To="0.5" Duration="0:0:0.5" /> <DoubleAnimation From="0.5" To="1" Duration="0:0:0.5" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="Mouse.MouseEnter"> <BeginStoryboard> <Storyboard TargetProperty="Width"> <DoubleAnimation From="80" To="95" Duration="0:0:0.2" /> </Storyboard> </BeginStoryboard> </EventTrigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Cursor" Value="Hand"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> Button is as follows: <Button Template="{StaticResource IconButton}" Name="btnExit"> <Image Source="Images/Exit.png" /> </Button> The problem is that the width doesn't change when my mouse goes over. (Or at least - the width of the image does not...) I believe there is a "scale" transform I can use to enlarge the button and all it's contents? how would I do that here...? Thanks.

    Read the article

  • ASP.NET MVC F# controller action ignoring parameter

    - by Matt H
    Hi. I have a C# ASP.NET MVC project but my controllers are written in F#. For some reason, the following code doesn't work properly. namespace MvcApplication8.Controllers open System.Web.Mvc [<HandleError>] type ImageController() = inherit Controller() member x.Index (i : int) : ActionResult = x.Response.Write i x.View() :> ActionResult The parameter of the action is seemingly ignored. http://localhost:56631/Image/Index/1 = The parameters dictionary contains a null entry for parameter 'i' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'MvcApplication8.Controllers.ImageController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters The controller otherwise works fine. I know that plenty of people have written F# mvc code, so, any ideas where I'm going wrong?

    Read the article

  • Rails Polymorphic Association with multiple associations on the same model

    - by Matt Rogish
    My question is essentially the same as this one: http://stackoverflow.com/questions/1168047/polymorphic-association-with-multiple-associations-on-the-same-model However, the proposed/accepted solution does not work, as illustrated by a commenter later. I have a Photo class that is used all over my app. A post can have a single photo. However, I want to re-use the polymorphic relationship to add a secondary photo. Before: class Photo belongs_to :attachable, :polymorphic => true end class Post has_one :photo, :as => :attachable, :dependent => :destroy end Desired: class Photo belongs_to :attachable, :polymorphic => true end class Post has_one :photo, :as => :attachable, :dependent => :destroy has_one :secondary_photo, :as => :attachable, :dependent => :destroy end However, this fails as it cannot find the class "SecondaryPhoto". Based on what I could tell from that other thread, I'd want to do: has_one :secondary_photo, :as => :attachable, :class_name => "Photo", :dependent => :destroy Except calling Post#secondary_photo simply returns the same photo that is attached via the Photo association, e.g. Post#photo === Post#secondary_photo. Looking at the SQL, it does WHERE type = "Photo" instead of, say, "SecondaryPhoto" as I'd like... Thoughts? Thanks!

    Read the article

  • C# differences between Windows Mobile and regular Windows

    - by Matt
    Are there many differences between Windows and Windows Mobile as far as C# programming is concerned? I can write some moderately complicated programs in C#, but I'm not sure if it would just run perfectly on a Windows smartphone, or if something has to be done to port it. If so, is there a tool that will automatically revise code to make it mobile-compatible? The reason I ask is that the new Windows mobile 7 will only support a few methods of app development, one of which is C#. Also, do smartphones with non-windows operating systems have C# support available? Or can C# code be converted to Symbian or iPhone or whatever? Thanks for any help you can provide.

    Read the article

  • Extract item in a list if Contains returns true

    - by Matt
    I have two lists A and B, at the beginning of my program, they are both filled with information from a database (List A = List B). My program runs, List A is used and modified, List B is left alone. After a while I reload List B with new information from the database, and then do a check with that against List A. foreach (CPlayer player in ListA) if (ListB.Contains(player)) ----- Firstly, the object player is created from a class, its main identifier is player.Name. If the Name is the same, but the other variables are different, would the .Contains still return true? Class CPlayer( public CPlayer (string name) _Name = name At the ---- I need to use the item from ListB that causes the .Contains to return true, how do I do that?

    Read the article

  • How do I stop a WCF web service?

    - by Matt
    I've stopped the website in IIS, made a change in Web.config, but the damn thing keeps writting my log events into my database! The only solution I've found is to restart IIS completely. This isn't a very good solution because then all my websites have to stop/restart.

    Read the article

  • Can I compare a template variable to an integer in App Engine templates?

    - by matt b
    Using Django templates in Google App Engine (on Python), is it possible to compare a template variable to an integer in an {% if %} block? views.py: class MyHandler(webapp.RequestHandler): def get(self): foo_list = db.GqlQuery(...) ... template_values['foos'] = foo_list template_values['foo_count'] = len(foo_list) handler.response.out.write(template.render(...)) My template: {% if foo_count == 1 %} There is one foo. {% endif %} This blows up with 'if' statement improperly formatted. What I was attempting to do in my template was build a simple if/elif/else tree to be grammatically correct to be able to state #foo_count == 0: There are no foos. #foo_count == 1: There is one foo. #else: There are {{ foos|length }} foos. Browsing the Django template documents (this link provided in the GAE documentation appears to be for versions of Django far newer than what is supported on GAE), it appears as if I can only actually use boolean operators (if in fact boolean operators are supported in this older version of Django) with strings or other template variables. Is it not possible to compare variables to integers or non-strings with Django templates? I'm sure there is an easy way to workaround this - built up the message string on the Python side rather than within the template - but this seems like such a simple operation you ought to be able to handle in a template. It sounds like I should be switching to a more advanced templating engine, but as I am new to Django (templates or any part of it), I'd just like some confirmation first.

    Read the article

  • MUD in python......

    - by matt
    how do you make a MUD in python can anyone help or start me of i dont have a clue on how to do if anyone knows any other source that i could use then plz let me know?

    Read the article

  • XML comments on delegate declared events

    - by Matt Whitfield
    I am visiting some old code, and there are quite a few events declared with delegates manually rather than using EventHandler<T>, like this: /// <summary> /// Delegate for event Added /// </summary> /// <param name="index">Index of the item</param> /// <param name="item">The item itself</param> public delegate void ItemAdded(int index, T item); /// <summary> /// Added is raised whenever an item is added to the collection /// </summary> public event ItemAdded Added; All well and good, until I come to use sandcastle to document the library, because it then can't find any XML comments for the private Added field that is generated by the event declaration. I want to try and sort that out, but what I would like to do is either: Get sandcastle to ignore the auto-generated private field without telling it to ignore all private fields entirely or Get XML comments generated for the private field Is there any way of achieving this without re-factoring the code to look like this: /// <summary> /// Delegate for event <see cref="Added"/> /// </summary> /// <param name="index">Index of the item</param> /// <param name="item">The item itself</param> public delegate void ItemAdded(int index, T item); /// <summary> /// Private storage for the event firing delegate for the <see cref="Added"/> event /// </summary> private ItemAdded _added; /// <summary> /// Added is raised whenever an item is added to the collection /// </summary> public event ItemAdded Added { add { _added += value; } remove { _added -= value; } }

    Read the article

  • Resources for getting started with Lucene.Net?

    - by Matt Dotson
    I'm building a simple site that allows users to post text content and I want to add it to a search index as it gets posted, so my site search is up to date. From what I can tell Lucene.NET is a good full text search framework. I've found very few examples of how to use it though. Can anyone post some good references for learning about Lucene?

    Read the article

  • WPF: Disable ListBox, but enable scrolling

    - by Matt Briggs
    Been banging my head against this all morning. Basically, I have a listbox, and I want to keep people from changing the selection during a long running process, but allow them to still scroll. Solution: All the answers were good, I went with swallowing mouse events since that was the most straight forward. I wired PreviewMouseDown and PreviewMouseUp to a single event, which checked my backgroundWorker.IsBusy, and if it was set the IsHandled property on the event args to true.

    Read the article

  • How test that ASP.NET MVC route redirects to other site?

    - by Matt Lacey
    Due to a prinitng error in some promotional material I have a site that is receiving a lot of requests which should be for one site arriving at another. i.e. The valid sites are http://site1.com/abc & http://site2.com/def but people are being told to go to http://site1.com/def. I have control over site1 but not site2. site1 contains logic for checking that the first part of the route is valid in an actionfilter, like this: public override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); if ((!filterContext.ActionParameters.ContainsKey("id")) || (!manager.WhiteLabelExists(filterContext.ActionParameters["id"].ToString()))) { if (filterContext.ActionParameters["id"].ToString().ToLowerInvariant().Equals("def")) { filterContext.HttpContext.Response.Redirect("http://site2.com/def", true); } filterContext.Result = new ViewResult { ViewName = "NoWhiteLabel" }; filterContext.HttpContext.Response.Clear(); } } I'm not sure how to test the redirection to the other site though. I already have tests for redirecting to "NoWhiteLabel" using the MvcContrib Test Helpers, but these aren't able to handle (as far as I can see) this situation. How do I test the redirection to antoher site?

    Read the article

  • metaclass multiple inheritance inconsistency

    - by Matt Anderson
    Why is this: class MyType(type): def __init__(cls, name, bases, attrs): print 'created', cls class MyMixin: __metaclass__ = MyType class MyList(list, MyMixin): pass okay, and works as expected: created <class '__main__.MyMixin'> created <class '__main__.MyList'> But this: class MyType(type): def __init__(cls, name, bases, attrs): print 'created', cls class MyMixin: __metaclass__ = MyType class MyObject(object, MyMixin): pass Is not okay, and blows up thusly?: created <class '__main__.MyMixin'> Traceback (most recent call last): File "/tmp/junk.py", line 11, in <module> class MyObject(object, MyMixin): pass TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases object, MyMixin

    Read the article

  • Elegant Algorithm for Parsing Data Stream Into Record

    - by Matt Long
    I am interfacing with a hardware device that streams data to my app over Wifi. The data is streaming in just fine. The data contains a character header (DATA:) that indicates a new record has begun. The issues is that the data I receive doesn't necessarily fall on the header boundary, so I have to capture the data until what I've captured contains the header. Then, everything that precedes the header goes into the previous record and everything that comes after it goes into a new record. I have this working, but wondered if anyone has done this before and has a good computer-sciencey way to solve the problem. Here's what I do: Convert the NSData of the current read to an NSString Append the NSString to a placeholder string Check placeholder string for the header (DATA:). If the header is not there, just wait for the next read. If the header exists, append whatever precedes it to a previous record placeholder and hand that placeholder off to an array as a complete record that I can further parse into fields. Take whatever shows up after the header and place it in the record placeholder so that it can be appended to in the next read. Repeat steps 3 - 5. Let me know if you see any flaws with this or have a suggestion for a better way. Seems there should be some design pattern for this, but I can't think of one. Thanks.

    Read the article

  • Fluent: Table name different from entity name

    - by Matt
    I am trying to use the automapping feature of Fluent with nHinbernate to map a class with a different name than the table itself is name. (This is purely for stylistic reasons we have a class named Foo which contains an object named Bar but the table name is FooBar. We would rather not have a property Foo.FooBar.) I can't find anything detailing how to give Fluent a clue on this change.

    Read the article

  • Encoding MySQL text fields into UTF-8 text files - problems with special characters

    - by Matt Andrews
    I'm writing a php script to export MySQL database rows into a .txt file formatted for Adobe InDesign's internal markup. Exports work, but when I encounter special characters like é or umlauts, I get weird symbols (eg Chloë Hanslip instead of Chloë Hanslip). Rather than run a search and replace for every possible weird character, I need a better method. I've checked that when the text hits the database, it's saved properly - in the database I see the special characters. My export code basically runs some regular expressions to put in the InDesign code tags, and I'm left with the weird symbols. If I just output the text to the browser (rather than prompt for a text file download), it displays properly. When I save the file I use this code: header("Content-disposition: attachment; filename=test.txt"); header("Content-Type: text/plain; charset=utf-8"); I've tried various combinations of utf8_encode() and iconv() to no avail. Can anybody point me in the right direction here?

    Read the article

  • How to I display results of phpcs in VIM?

    - by Matt
    I am presently trying to use PHP Codesniffer (PEAR) in vim for PHP Files. I have found 2 sites that give code to add into the $HOME/.vim/plugin/phpcs.vim file. I have added the code and I "think" it is working, but I cannot see the results, I only see one line at the very bottom of vim that says (1 of 32) but I cannot see any of the 32 errors. Here is my .vimrc file " Backup Options -> Some People may not want this... it generates extra files set backup " Enable Backups set backupext=.bak " Add .bak extention to modified files set patchmode=.orig " Copy original file to with .orig extention Before saving. " Set Tabs and spacing for PHP as recomended by PEAR and Zend set expandtab set shiftwidth=4 set softtabstop=4 set tabstop=4 " Set Auto-indent options set cindent set smartindent set autoindent " Show lines that exceed 80 characters match ErrorMsg '\%80v.\+' " Set Colors set background=dark " Show a status bar set ruler set laststatus=2 " Set Search options highlight, and wrap search set hls is set wrapscan " File Type detection filetype on filetype plugin on " Enable Spell Checking set spell " Enable Code Folding set foldenable set foldmethod=syntax " PHP Specific options let php_sql_query=1 " Highlight sql in php strings let php_htmlInStrings=1 " Highlight HTML in php strings let php_noShortTags=1 " Disable PHP Short Tags let php_folding=1 " Enable Ability to FOLD html Code I have tried 2 different versions of phpcs.vim, and I get the same results for both: Version 1 (found at: VIM an a PHP IDE) function! RunPhpcs() let l:filename=@% let l:phpcs_output=system('phpcs --report=csv --standard=YMC '.l:filename) " echo l:phpcs_output let l:phpcs_list=split(l:phpcs_output, "\n") unlet l:phpcs_list[0] cexpr l:phpcs_list cwindow endfunction set errorformat+=\"%f\"\\,%l\\,%c\\,%t%*[a-zA-Z]\\,\"%m\" command! Phpcs execute RunPhpcs() Version 2: (found at Integrated PHP Codesniffer in VIM ) function! RunPhpcs() let l:filename=@% let l:phpcs_output=system('phpcs --report=csv --standard=YMC '.l:filename) let l:phpcs_list=split(l:phpcs_output, "\n") unlet l:phpcs_list[0] cexpr l:phpcs_list cwindow endfunction set errorformat+="%f"\\,%l\\,%c\\,%t%*[a-zA-Z]\\,"%m" command! Phpcs execute RunPhpcs() Both of these produce identical results. phpcs is installed on my system, and I am able to generate results outside of vim. Any help would be appreciated I am just learning more about vim...

    Read the article

  • Using a debugger and curses at the same time?

    - by Matt Joiner
    I'm calling python -m pdb myapp.py, when an exception fires, and I'd normally be thrown back to the pdb interpreter to investigate the problem. However this exception is being thrown after I've called through curses.wrapper() and entered curses mode, rendering the pdb interpreter useless. How can I work around this?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >