Search Results

Search found 1714 results on 69 pages for 'adam stone'.

Page 53/69 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Left Join only returning one row

    - by Adam
    I am trying to join two tables. I would like all the columns from the product_category table (there are a total of 6 now) and count the number of products, CatCount, that are in each category from the products_has_product_category table. My query result is 1 row with the first category and a total count of 68, when I am looking for 6 rows with each individual category's count. <?php $result = mysql_query(" SELECT a.*, COUNT(b.category_id) AS CatCount FROM `product_category` a LEFT JOIN `products_has_product_category` b ON a.product_category_id = b.category_id "); while($row = mysql_fetch_array($result)) { echo ' <li class="ui-shadow" data-count-theme="d"> <a href="' . $row['product_category_ref_page'] . '.php" data-icon="arrow-r" data-iconpos="right">' . $row['product_category_name'] . '</a><span class="ui-li-count">' . $row['CatCount'] . '</span></li>'; } ?> I have been working on this for a couple of hours and would really appreciate any help on what I am doing wrong.

    Read the article

  • need help understanding a function.

    - by Adam McC
    i had previously asked for help writing/improving a function that i need to calculate a premium based on differing values for each month. the premium is split in to 12 months and earned on a percentage for each month. so if the policy start in march and we are in jan we will have earned 10 months worth. so i need to add up the monthly earning to give us the total earned. wach company wil have differeing earnings values for each month. my original code is Here. its ghastly and slow hence the request for help. and i was presented with the following code. the code works but returns stupendously large figures. begin set @begin=datepart(month,@outdate) set @end=datepart(month,@experiencedate) ;with a as ( select *, case calmonth when 'january' then 1 when 'february' then 2 when 'march' then 3 when 'april' then 4 when 'may' then 5 when 'june' then 6 when 'july' then 7 when 'august' then 8 when 'september' then 9 when 'october' then 10 when 'november' then 11 when 'december' then 12 end as Mnth from tblearningpatterns where clientname=@client and earningpattern=@pattern ) , b as ( select earningvalue, Mnth, earningvalue as Ttl from a where Mnth=@begin union all select a.earningvalue, a.Mnth, cast(b.Ttl*a.earningvalue as decimal(15,3)) as Ttl from a inner join b on a.Mnth=b.Mnth+1 where a.Mnth<=@end ) select @earningvalue= Ttl from b inner join ( select max(Mnth) as Mnth from b ) c on b.Mnth=c.Mnth option(maxrecursion 12) SET @earnedpremium = @earningvalue*@premium end can someone please help me out?

    Read the article

  • Audible Audio (.aa) file spec?

    - by Adam
    Does anyone know of a good resource on the Audible Audio (.aa) file spec? I'm trying to write a program that can use them, if no one knows of a resource, any tips on reverse engineering the spec my self? I opened it up in a Hex editor and poked around, looks like an MP3 but with a ton more header info.

    Read the article

  • WebView load javascript on the fly

    - by ADAM
    I have the following code which loads and html file into a webview - (void)awakeFromNib{ NSString *resourcesPath = [[NSBundle mainBundle] resourcePath]; NSString *htmlPath = [resourcesPath stringByAppendingString:@"/main.html"]; [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]]]; } How would i dynamically load a css file (in the most efficient manner) as it does not suit to have the css file link in the html file

    Read the article

  • JSON to display text -- Freezes UI

    - by Adam Storr
    Hi everyone, I currently have a very simple view which displays info from a JSON feed. The problem I'm facing is the few second pause I encounter once I press this tab. How can I make this view load instantly and then have the label.text areas load after? Preferable with an activity indicator? Should I use threads? Thanks in advance! Code: - (NSString *)stringWithUrl:(NSURL *)url { NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:30]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error]; return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]; } - (id)objectWithUrl:(NSURL *)url { SBJsonParser *jsonParser = [SBJsonParser new]; NSString *jsonString = [self stringWithUrl:url]; return [jsonParser objectWithString:jsonString error:NULL]; } - (NSDictionary *)downloadStats { id response = [self objectWithUrl:[NSURL URLWithString:@"http://www.example.com/JSON"]]; NSDictionary *feed = (NSDictionary *)response; return feed; [feed release]; } - (void)viewDidLoad { [super viewDidLoad]; [GlobalStatsScrollView setScrollEnabled:YES]; [GlobalStatsScrollView setContentSize:CGSizeMake(320, 360)]; } - (void)viewWillAppear:(BOOL)animated { NSLog(@"View appears"); // Download JSON Feed NSDictionary *feed = [self downloadStats]; totalproduced.text = [feed valueForKey:@"Produced"]; totalno.text = [feed valueForKey:@"Total"]; mostcommon.text = [feed valueForKey:@"Most Common"]; }

    Read the article

  • Is there a way to have element behind a div (links) clickable in areas where the div is "transparent

    - by Adam
    I have a block element that is positioned absolutely and some other elements on page that are positioned fixed. The effect is the block on top floats over the page which works well. The links in the elements at the bottom underneath are not clickable. They shouldn't be when the content of the div is over them, but when the "marginal" areas which are transparent are over the links they are visible, but clicks only register to the covering div. The problem only happens when the padding covers the div. But if I just rely on the margin the bottom margin is ignored by browser so the scroll doesn't go high enough up. To solve this I resort to padding at the bottom. This is the problem. Is there a clean way around this? I realize I could have the underneath elements doubled and place on top, but opacity set to 0. That is an undesirable solution however. Sample of the problem: <!DOCTYPE html> <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'> <head> <style> #top, #bottom { position: fixed; border: 1 px solid #333; background-color: #eee; left: 100px; padding: 8px; } #top { top: 0; z-index: 1; } #bottom { bottom: 0; z-index: 2; } #contentWrapper { position: absolute; margin: 100px 0 0 0; /* Padding is used to make sure the scroll goes up further on the page */ padding: 0 0 100px 0; width: 600px; z-index: 3; } #content { border: 1 px solid #333; background-color: #eee; height: 1000px; } </style> </head> <body> <div id='top'><a href="#">Top link</a></div> <div id='bottom'><a href="#">Bottom link</a></div> <div id='contentWrapper'> <div id='content'>Some content</div> </div> </body> </html>

    Read the article

  • localhost/live - detect by HTTP_HOST

    - by Adam Kiss
    Hello, let's say I develop locally and debug small things on live server. Is it good idea to have something like this in my code? : $is_local = (strpos($_SERVER['http_host'], 'localhost') !== false); define ('DEBUG',$is_local); And then use it through my code, when setting stuff? $mysql_settings = (DEBUG) ? array(/*localhost settings*/) : array(/*live settings*/); This way, I can use the same files live and on localhost, so I can sync without any fear of having wrong e.g. connection settings on live server. Is it good or wrong idea?

    Read the article

  • Footprint of Lua on a PPC Micro

    - by Adam Shiemke
    We're developing some code on Freescale PPC micros (5517 and 5668 at the moment), and I was wondering if we could put Lua on them. The devices need to be easily programmed/reconfigured in the field, and the current product uses a proprietary interpreted logic language that can be loaded in, and our software (written in C) runs an interpreter. I would like to move to a better language (the implementation is a bit buggy and slow), so I'm considering Lua, but the memory footprint must be very low. For the 5517 (which we may not use), the maximum RAM is 80K. Things are better on the 5668, with 592K of RAM. So does anyone know if I can put Lua on bare metal? We're effectively not running an OS. If so, are there any estimates on what kind of memory footprint we might see? How much effort it would take? Failing this, does anyone know of any kind of interpreter that might be better in a memory-constrained environment without an OS? Or are we better just rolling our own?

    Read the article

  • Rails and a development domain

    - by Adam
    I'm trying to use http://ls1.bigseapreview.com as a domain for a Rails project. The problem is it doesn't seem to be correctly mapping any routing apart from the home page. I have added /about but you can see that you will just get a 404, but it works locally. What do I have to do to fix this?

    Read the article

  • Regular Expression to match a string

    - by Adam Witko
    Hi, I've got two possible string inputs that my application will receive, and if it matches the following two strings, I need it regex.ismatch() to return true: "User * has logged out" "User * has joined" I'm not that good at regex and just can't figure out how to go about matching the above. Any help would be great!!!

    Read the article

  • Upcasting in C#: Making a Fruit a Pear

    - by Adam Kane
    Why can't I upcast (?) a Fruit to a Pear? public static class PearGenerator { public static Pear CreatePear () { // Make a new generic fruit. Fruit genericFruit = new Fruit(); // Upcast it to a pear. (Throws exception: Can't cast a Fruit to a Pear.) Pear pear = (Pear)genericFruit; // Return freshly grown pear. return ( pear ); } } public class Fruit { // some code } public class Pear : Fruit { public void PutInPie () { // some code } } Thanks!

    Read the article

  • hibernate.properties classpath conflict

    - by Adam B
    I have a jar on the classpath which contains a hibernate.properties. This causes problems when my app starts because hibernate tries to use the settings from this file. Is there a way to explicitly specify the file that hibernate should look for, or tell it to ignore the properties file in the dependency jar?

    Read the article

  • serve static play2.x content from CDN

    - by Adam Lane
    In development mode I would like to have assets served locally and when deployed in production I would like them served from the CDN. Anyone using play2 and serving content from CDN be willing to share how they are doing it? // Thinking of something like this in the routes file... @if(play.Play.isDev()) { GET /assets/*file controllers.Assets.at(path="/public", file) } else { GET CDNPATH/assets/*file controllers.Assets.at(path="CDNPATH", file) } (Note: using 2.0.2 because of the headers fix https://github.com/playframework/Play20/pull/276)

    Read the article

  • Ruby On Rails -

    - by Adam S
    I am trying to create a collection_select that is dependent on another collection_select, following the railscasts episode #88.. The database includes a schedule of all cruise ships arrival dates. See attached schema diagram,... (The arrow side of the lines indicate has_many, the non-pointy side indicates belongs_to) In the "booking/new" view I have a collection_select for choosing a cruiseline, then another collection_select will appear for selecting a ship, then another for selecting the date that ship is in. If I ONLY put a collection_select for shipshedule it works fine(because of the direct association with the bookings model). However, if I try to add a collection_select for cruiselines....it breaks(Im assuming because their isnt a direct association). The collection_select for cruiselines returns an undefined method error for "cruiseline_id".....if I simply use "id" the collection_select works, but of course isnt fully functional due to incorrect naming of the form field. I have tried "has_many :shipschedules, :through = :cruiseships" in the cruiseline model and "has_many :bookings, :through = :shipschedules" in the cruiseships model... As you can see in the diagram, I need to access the cruiseships and cruiselines model through the bookings model. I have the models set up so a cruiseline has_many cruiseships, a cruiseship has_many shipschedules, and a shipschedule has_many bookings. But, the bookings model cant directly access the cruiseline model. How do I accomplish this? THANKS!!! http://www.adamstockland.com/common/images/RoRf/PastedGraphic-2.png http://www.adamstockland.com/common/images/RoRf/PastedGraphic-1.png

    Read the article

  • C# directory to "play with"

    - by Adam S
    Simple question here. I have a C# program which needs to stores some files onto the hard drive, but I don't need them to be anywhere useful to the end-user, only somewhere that the program can read/write from. Is there a directory that I can reference programmatically to be my "filespace playground" - that is, that I can read/write freely to and from? EDIT: Also, if I use a temp directory, how long are the files guaranteed to be there? I don't want the them to disappear while my program is still running!

    Read the article

  • Replacing multiple `-` with one `-` without regexp

    - by Adam Kiss
    I've seen so many misuses of RegExp, I don't really like it :) I have string (as a result of two str_replaces) that might look something like this: .?This iš my ".stRiNg."! | V --this-is-my---string--- Is there any way better than $string = trim(preg_replace('/[-]+/u','-', $string),'-'); to get: this-is-my-string ?

    Read the article

  • How do you deal with breaking changes in a Rails migration?

    - by Adam Lassek
    Let's say I'm starting out with this model: class Location < ActiveRecord::Base attr_accessible :company_name, :location_name end Now I want to refactor one of the values into an associated model. class CreateCompanies < ActiveRecord::Migration def self.up create_table :companies do |t| t.string :name, :null => false t.timestamps end add_column :locations, :company_id, :integer, :null => false end def self.down drop_table :companies remove_column :locations, :company_id end end class Location < ActiveRecord::Base attr_accessible :location_name belongs_to :company end class Company < ActiveRecord::Base has_many :locations end This all works fine during development, since I'm doing everything a step at a time; but if I try deploying this to my staging environment, I run into trouble. The problem is that since my code has already changed to reflect the migration, it causes the environment to crash when it attempts to run the migration. Has anyone else dealt with this problem? Am I resigned to splitting my deployment up into multiple steps?

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >