Search Results

Search found 2492 results on 100 pages for 'dave maple'.

Page 57/100 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • Adding / Removing values for an Email based daily stock value reporter - made inPHP

    - by Dave
    Hi, i'm buidling a very simple email based website that users can, when registering list out all the stocktickers they're intersted in following. The program then on a daily basis goes and fetches that information and sends it out to every user. i have the portion which fetchs the information from the stock websites, but i'm looking for an "infrastructure" that allows: (a) a user to send an email to [email protected] with the subject "Subscribe" and with the body containing stockticker values, (b) user to send email to service@... with subject "unsubscribe" and body containing similar values. Looking for code in php please. Any insights?

    Read the article

  • Scala 2.8 TreeMap and custom Ordering

    - by Dave
    I'm switching from scala 2.7 and ordered to scala 2.8 and using ordering. It looks quite straight forward but I was wondering could I make it a little less verbose. For example: scala> case class A(i: Int) defined class A scala> object A extends Ordering[A] { def compare(o1: A, o2: A) = o1.i - o2.i} defined module A If I then try to create a TreeMap I get an error scala> new collection.immutable.TreeMap[A, String]() <console>:10: error: could not find implicit value for parameter ordering: Ordering[A] new collection.immutable.TreeMap[A, String]() ^ However if I explicitly specify the object A as the ordering it works fine. scala> new collection.immutable.TreeMap[A, String]()(A) res34: scala.collection.immutable.TreeMap[A,String] = Map() Do I always have to explicitly specify the ordering or is there a shorter format? Thanks

    Read the article

  • How to programmatically bind to a Core Data model?

    - by Dave Gallagher
    Hello. I have a Core Data model, and was wondering if you know how to create a binding to an Entity, programmatically? Normally you use bind:toObject:withKeyPath:options: to create a binding. But I'm having a little difficulty getting this to work with Core Data, and couldn't find anything in Apple's docs regarding doing this programmatically. The Core Data model is simple: An Entity called Book An Attribute of Book called author (NSString) I have an object called BookController. It looks like so: @interface BookController : NSObject { NSString *anAuthor; } @property (nonatomic, retain) NSString *anAuthor; // @synthesize anAuthor; inside @implementation I'd like to bind anAuthor inside BookController, to author inside a Book entity. This is how I'm attempting to wrongly do it (it partially works): // A custom class I made, providing an interface to the Core Data database CoreData *db = [[CoreData alloc] init]; // Creating a Book entity, saving it [db addMocObject:@"Book"]; [db saveMoc]; // Fetching the Book entity we just created NSArray *books = [db fetchObjectsForEntity:@"Book" withPredicate:nil withSortDescriptors:nil]; NSManagedObject *book = [books objectAtIndex:0]; // Creating the binding BookController *bookController = [[BookController alloc] init]; [bookController bind:@"anAuthor" toObject:book withKeyPath:@"author" options:nil]; // Manipulating the binding [bookController setAnAuthor:@"Bill Gates"]; Now, when updating from the perspective of bookController, things don't work quite right: // Testing the binding from the bookController's perspective [bookController setAnAuthor:@"Bill Gates"]; // Prints: "bookController's anAuthor: Bill Gates" NSLog(@"bookController's anAuthor: %@", [bookController anAuthor]); // OK! // ERROR HERE - Prints: "bookController's anAuthor: (null)" NSLog(@"Book's author: %@", [book valueForKey:@"author"]); // DOES NOT WORK! :( When updating from the perspective of the Book entity, things work fine: // ------------------------------ // Testing the binding from the Book's (Entity) perspective (this works perfect) [book setValue:@"Steve Jobs" forKey:@"author"]; // Prints: "bookController's anAuthor: Steve Jobs" NSLog(@"bookController's anAuthor: %@", [bookController anAuthor]); // OK! // Prints: "bookController's anAuthor: Steve Jobs" NSLog(@"Book's author: %@", [book valueForKey:@"author"]); // OK! It appears that the binding is partially working. I can update it on the side of the Model and it propagates up to the Controller via KVO, but if I update it on the side of the Controller, it doesn't trickle down to the Model via KVC. Any idea on what I'm doing wrong? Thanks so much for looking! :)

    Read the article

  • How should I setup my Visual Studio projects/solutions in a Mercurial repository?

    - by Dave A
    At my company we have a few different web apps that each share some common libraries. The Visual Studio setup looks like this. Website 1 Solution Website 1 Shared Library 1 Project Shared Library 2 Project Website 2 Solution Website 2 Shared Library 1 Project Shared Library 2 Project Windows Service Solution Windows Service Project Shared Library 1 Project Shared Library 2 Project Shared Library Solution Shared Library 1 Project Shared Library 2 Project All Projects Solution Website 1 Website 2 Windows Service Project Shared Library 1 Project Shared Library 2 Project We want to start using Mercurial for source control, but I'm still not sure the best way to do it. From what I've read you're supposed to use a separate repository for each project. No problem there, but where do the Visual Studio solution files (.sln) go? Should there be a separate repository with just an .sln file? Ideally the projects that use the shared libraries should all use the same version, and the solution "All Projects Solution" should build without errors, but sometimes we need to branch the shared libraries. What is the best way to do this, and how would the repositories be setup? How do I get a working copy of a certain branch/tag of the Website 1 solution when every project is in a separate repository. Do I have to pull each one separately, or write a script to do it all at once? Can tortoise hg do that for me? Any other tips to make this process easier?

    Read the article

  • Time Saving Minutiae

    - by Dave Jarvis
    What little tricks do you use to save time when developing? For example: In JDeveloper, change the default editor to Source view from Design view for JSP files.   Tools » Preferences » File Types » Default Editors » JSP Tag File By default, JDeveloper opens JSP files in Design view, which can take 10 to 15 seconds to begin editing a file. Opening files in Source view only takes 2 seconds.

    Read the article

  • How To Create Per-Request Singleton in Pylons?

    - by dave mankoff
    In our Pylons based web-app, we're creating a class that essentially provides some logging functionality. We need a new instance of this class for each http request that comes in, but only one per request. What is the proper way to go about this? Should we just create the object in middleware and store in in request.environ? Is there a more appropriate way to go about this?

    Read the article

  • Write binary stream to browser using PHP

    - by Dave Jarvis
    Background Trying to stream a PDF report written using iReport through PHP to the browser. The general problem is: how do you write binary data to the browser using PHP? Working Code The following code does the job, but (for many reasons) it is not as efficient as it should be (the code writes a file then sends the file contents the browser). // Load the MySQL database driver. // java( 'java.lang.Class' )->forName( 'com.mysql.jdbc.Driver' ); // Attempt a database connection. // $conn = java( 'java.sql.DriverManager' )->getConnection( "jdbc:mysql://localhost:3306/climate?user=$user&password=$password" ); // Extract parameters. // $params = new java('java.util.HashMap'); $params->put('DistrictCode', '101'); $params->put('StationCode', '0066'); $params->put('CategoryCode', '010'); // Use the fill manager to produce the report. // $fm = java('net.sf.jasperreports.engine.JasperFillManager'); $pm = $fm->fillReport($report, $params, $conn); header('Cache-Control: no-cache private'); header('Content-Description: File Transfer'); header('Content-Disposition: attachment, filename=climate-report.pdf'); header('Content-Type: application/pdf'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . strlen( $result ) ); $path = realpath( "." ) . "/output.pdf"; $em = java('net.sf.jasperreports.engine.JasperExportManager'); $result = $em->exportReportToPdfFile($pm,$path); readfile( $path ); $conn->close(); Non-working Code To remove the slight redundancy (i.e., write directly to the browser), the following code looks like it should work, but it does not: $em = java('net.sf.jasperreports.engine.JasperExportManager'); $result = $em->exportReportToPdf($pm); header('Content-Length: ' . strlen( $result ) ); echo $result; Content is sent to the browser, but the file is corrupt (it begins with the PDF header) and cannot be read by any PDF reader. Question How can I take out the middle step of writing to the file and write directly to the browser so that the PDF is not corrupted? Thank you!

    Read the article

  • Objective-C Array/List Question

    - by Dave C
    What is the best practice, even in general programming, when you have an undefined, possibly infinite, amount of items that you need in an array but don't have defined bounds. Can you define an endless array in objective c that you can keep pushing items onto, like other lanaguages have a list item. Thanks for any help.

    Read the article

  • Does .NET Regex support global matching?

    - by Dave
    I haven't been able to find anything online regarding this. There's RegexOptions, but it doesn't have Global as one of its options. The inline modifiers list also doesn't mention global matching. In a nutshell, I've got a regex to parse something like --arga= "arg1" --argb ="arg2" into separate argument name/value pairs using this regex: --(\\w+)\\s*=\\s*\"(\\w+)\"\\s* but the .NET Regex class doesn't do it globally (iteratively). So in order for me to get this to work, I'd have to do a match, then remove this from the argument string, and loop over and over again until I've exhausted all of the arguments. It would be nicer to run the regex once, and then loop over the match groups to get the name value pairs. Is this possible? What am I missing?

    Read the article

  • Dismissing UIImagePickerController from UITabBarController

    - by Dave
    I have a tab bar application whereby one tab uses a navigation controller to move through a series of views. On the final view, there is a button to add a photo, which presents a UIImagePickerController. So far, so good - however when I finish picking the image, or cancel the operation, the previous view is loaded, but without the tab bar. I'm sure I'm missing something elementary, but any suggestions on how to properly release the UIImagePickerController would be much appreciated. The code is as follows: ImagePickerViewController *aController = [[ImagePickerViewController alloc]; initWithNibName:@"ImagePickerViewController" bundle:[NSBundle mainBundle]]; [self presentModalViewController:aController animated:YES]; [aController release]; //viewDidLoad self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]){ imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; } else { imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } [window addSubview:imagePickerController.view]; //ImagePickerViewController imagePickerControllerDidCancel - FinalViewController is the last view in the stack controlled by a navigation controller which contains the button to present the UIImagePickerController [picker dismissModalViewControllerAnimated:YES]; FinalViewController *aController = [[FinalViewController alloc initWithNibName:@"FinalViewController" bundle:[NSBundle mainBundle]]; [picker presentModalViewController:aController animated:YES]; [aController release];

    Read the article

  • Most efficient way to check if a date falls between two dates?

    - by Dave Jarvis
    Given: Start Month & Start Day End Month & End Day Any Year What SQL statement results in TRUE if a date lands between the Start and End days? 1st example: Start Date = 11-22 End Date = 01-17 Year = 2009 Specific Date = 2010-01-14 TRUE 2nd example: Start Date = 11-22 End Date = 11-16 Year = 2009 Specific Date = 2010-11-20 FALSE 3rd example: Start Date = 02-25 End Date = 03-19 Year = 2004 Specific Date = 2004-02-29 TRUE I was thinking of using the MySQL functions datediff and sign plus a CASE condition to determine whether the year wraps, but it seems rather expensive. Am looking for a simple, efficient calculation. Update The problem is the end date cannot simply use the year. The year must be increased if the end month/day combination happens before the start date. The start date is easy: Start Date = date( concat_ws( '-', year, Start Month, Start Day ) The end date is not so simple. Thank you!

    Read the article

  • Multiple outliers for two variable linear regression

    - by Dave Jarvis
    Problem Building on my previous question, the "extreme" outliers in the following graph are somewhat obvious: Question Given: T - Set of all temperatures Y - Set of all years ST - Sum of temperatures. SY - Sum of years. N - Number of elements T(n) - Temperature of the nth element in the temperature set How would you implement an efficient MySQL stored procedure or user-defined function (UDF) to determine if T(n) is an outlier? (If such an implementation already exists, that would be good to know as well.) Related Sites I am slowly working through these sites to get a better understanding of the problem: Multiple Outliers Detection Procedures in Linear Regression M-estimator Measure of Surprise for Outlier Detection Ordinary Least Squares Linear Regression Many thanks!

    Read the article

  • Simple PHP Regex question

    - by Dave Kiss
    Hi all, I'd like to validate a field in a form to make sure it contains the proper formatting for a URL linking to a Vimeo video. Below is what I have in Javascript, but I need to convert this over to PHP (not my forte) Basically, I need to check the field and if it is incorrectly formatted, I need to store an error message as a variable.. if it is correct, i store the variable empty. // Parse the URL var PreviewID = jQuery("#customfields-tf-1-tf").val().match(/http:\/\/(www.vimeo|vimeo)\.com(\/|\/clip:)(\d+)(.*?)/); if ( !PreviewID ) { jQuery("#cleaner").html('<div id="vvqvideopreview"><?php echo $this->js_escape( __("Unable to parse preview URL. Please make sure it's the <strong>full</strong> URL and a valid one at that.", 'vipers-video-quicktags') ); ?></div>'); return; } The traditional vimeo url looks like this: http://www.vimeo.com/10793773 Thanks!

    Read the article

  • Align UItextFields one below the other in interface builder

    - by Dave
    How to align 2 textfields one below the other in a tool bar and display a button on the left side (or right side) in the vertical middle of those two fields? Please see the image to know what I am talking about. http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/art/ui_textfields.jpg

    Read the article

  • Choosing a source control system: logical next steps after VSS

    - by Dave
    I've been using Git for the past few months and love it. I looked into how to host it in a corporate environment. Considering a 10 person team who use Visual SourceSafe, programming in Coldfusion, Powerbuilder, PHP and a bit of .NET, I found, to my surprise, that the Git 'server' tooling is still fairly rudimentary. http://stackoverflow.com/questions/1761054/git-in-a-company-hosting-own-server Question Apart from SVN, what other source control options would be a logical next step after VSS? Paid options are fine. Something with nice tooling, that isn't scary would be great :-)

    Read the article

  • Spark View Engine: How to set default master page name?

    - by Dave
    I use Spark View Engine with nested master pages. I have Application.spark which defines the basic layout of the website. Then there are several other masters which themselves use Application.spark as master page (Default.spark, SinlgeColumn.spark, Gallery.spark, ...) If no master page is specified in a view file, then automatically Application.spark is choosen by the Spark View Engine. Since almost all my pages use "Default.spark" as master, is there a way to configure this globally? The other possibilities would be: Set the master in each spark file individually <use master="Default" />. But that's really annoying. Rename my master files (Default.spark <- Application.spark) but that really doesn't make any sense in naming.

    Read the article

  • Reversed Latitude/Longitude US Tiger/Line Shape File to MySQL w/ OGR2OGRP

    - by Dave LeJeune
    Hi - I've downloaded the latest set (2010) of TIGER edge shape files (ESRI shapefile format) from the US Census website and am loading them into MySQL using the GDAL ogr2ogr utility. A new table (geotest) does get created with a SHAPE column that has the geometry defined as a LINESTRING. However, I am seeing reversed latitude and longitude values that get reversed when running the following command: ogr2ogr -f "MySQL" MySQL:"geo,user=lejeuned,host=localhost,password=cnickl234" -nln geotest -nlt LINESTRING -append -a_srs "EPSG:4326" -lco engine=MYISAM tl_2010_01021_edges.shp Mapping the latitude/longitude (after reversing them of course) they appear to be spot on so I suspect there is just something I am doing wrong or flag I am missing which is causing the latitude and longitudes to be transposed. When I select the SHAPE column using astext() I get the following result: LINESTRING(-86.69863 32.973164,-86.69853 32.97302,-86.69856 32.97287,-86.698613 32.972825,-86.6988 32.972825,-86.6989 32.972892,-86.6989 32.973002,-86.69874 32.97316,-86.69864 32.97318,-86.69863 32.973164) Any ideas what I am doing wrong?

    Read the article

  • Is it possible to configure a Spring session scoped bean with attributes from the session?

    - by Dave G
    I'm trying to create a service bean that when referenced will be initialized with HttpSession based attributes. Let's say for sake of argument that my webapp would do the following: Establish a session Request login & password When service is requested (it is scope="session" and has init-method="init()") a new instance is created for the session. In the init method, can I reference the HttpSession either through passing it in as a parameter and referencing it by EL? Any ideas on this would be appreciated.

    Read the article

  • Create date efficiently

    - by Dave Jarvis
    On Pavel's page is the following function: CREATE OR REPLACE FUNCTION makedate(year int, dayofyear int) RETURNS date AS $$ SELECT (date '0001-01-01' + ($1 - 1) * interval '1 year' + ($2 - 1) * interval '1 day'):: date $$ LANGUAGE sql; I have the following code: makedate(y.year,1) What is the fastest way in PostgreSQL to create a date for January 1st of a given year? Pavel's function would lead me to believe it is: date '0001-01-01' + y.year * interval '1 year' + interval '1 day'; My thought would be more like: to_date( y.year||'-1-1', 'YYYY-MM-DD'); Am looking for the fastest way using PostgreSQL 8.4. (The query that uses the date function can select between 100,000 and 1 million records, so it needs speed.) Thank you!

    Read the article

  • Why is button background defaulting to grey when IsPressed is true

    - by Dave Colwell
    Hey all, I have a simple problem. Using the IsPressed trigger i want to be able to set the background color of a button to something other than the default grey. Here is what the button looks like when it is not pressed and here is what it looks like when it is clicked Here is the trigger for the button. I know the trigger is firing correctly because of the glow effect around the edge of the button when it is clicked. I also know that the brush is correct because i tried it out as a background brush to see what it looked like. <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="{DynamicResource ButtonHoverBrush}"/> <Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/> </Trigger> <!-- This is the trigger which is working but the background color wont change --> <Trigger Property="IsPressed" Value="True"> <Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/> <Setter Property="Background" Value="{DynamicResource ButtonPressedBrush}" /> </Trigger> </Style.Triggers>

    Read the article

  • Having trouble getting MEF imports to be resolved

    - by Dave
    This is sort of a continuation of one of my earlier posts, which involves the resolving of modules in my WPF application. This question is specifically related to the effect of interdependencies of modules and the method of constructing those modules (i.e. via MEF or through new) on MEF's ability to resolve relationships. First of all, here is a simple UML diagram of my test application: I have tried two approaches: left approach: the App implements IError right approach: the App has a member that implements IError Left approach My code behind looked like this (just the MEF-related stuff): // app.cs [Export(typeof(IError))] public partial class Window1 : Window, IError { [Import] public CandyCo.Shared.LibraryInterfaces.IPlugin Plugin { get; set; } [Export] public CandyCo.Shared.LibraryInterfaces.ICandySettings Settings { get; set; } private ICandySettings Settings; public Window1() { // I create the preferences here with new, instead of using MEF. I wonder // if that's my whole problem? If I use MEF, and want to have parameters // going to the constructor, then do I have to [Export] a POCO (i.e. string)? Settings = new CandySettings( "Settings", @"c:\settings.xml"); var catalog = new DirectoryCatalog( "."); var container = new CompositionContainer( catalog); try { container.ComposeParts( this); } catch( CompositionException ex) { foreach( CompositionError e in ex.Errors) { string description = e.Description; string details = e.Exception.Message; } throw; } } } // plugin.cs [Export(typeof(IPlugin))] public class Plugin : IPlugin { [Import] public CandyCo.Shared.LibraryInterfaces.ICandySettings CandySettings { get; set; } [Import] public CandyCo.Shared.LibraryInterfaces.IError ErrorInterface { get; set; } [ImportingConstructor] public Plugin( ICandySettings candy_settings, IError error_interface) { CandySettings = candy_settings; ErrorInterface = error_interface; } } // candysettings.cs [Export(typeof(ICandySettings))] public class CandySettings : ICandySettings { ... } Right-side approach Basically the same as the left-side approach, except that I created a class that inherits from IError in the same assembly as Window1. I then used an [Import] to try to get MEF to resolve that for me. Can anyone explain how the two ways I have approached MEF here are flawed? I have been in the dark for so long that instead of reading about MEF and trying different suggestions, I've added MEF to my solution and am stepping into the code. The part where it looks like it fails is when it calls partManager.GetSavedImport(). For some reason, the importCache is null, which I don't understand. All the way up to this point, it's been looking at the part (Window1) and trying to resolve two imported interfaces -- IError and IPlugin. I would have expected it to enter code that looks at other assemblies in the same executable folder, and then check it for exports so that it knows how to resolve the imports...

    Read the article

  • Static Javascript files not loaded in Express app

    - by Dave Long
    I have an express app that has a bunch of static javascript files that aren't being loaded even though they are registered in my app.js file. Even public scripts (like jQuery: http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js) aren't processing. I can see the script tags in the generated html, but none of the functionality runs and I can't see the files loading in the web inspector. Here is the code that I have: app.js var express = require('express') var app = module.exports = express.createServer(); // Configuration var port = process.env.PORT || 3000; app.configure(function(){ app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); app.configure('development', function(){ app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.configure('production', function(){ app.use(express.errorHandler()); }); // Routes app.get('/manage/new', function(req, res){ res.render('manage/new', { title: 'Create a new widget' }); }) app.listen(port); console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); /views/manage/layout.jade !!! 5 html(lang="en") head title= title link(rel="stylesheet", href="/stylesheets/demo.css") link(rel="stylesheet", href="/stylesheets/jquery.qtip.css") script(type="text/javascript", href="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js") body!= body script(type="text/javascript", href="/javascripts/jquery.formalize.js") script(type="text/javascript", href="/javascripts/jquery.form.js") script(type="text/javascript", href="/javascripts/jquery.qtip.js") script(type="text/javascript", href="/javascripts/formToWizard.js") script(type="text/javascript", href="/javascripts/widget.js") /views/manage/new.jade h1= title div(style="float:left;") form(action="/manage/generate", method="post", enctype="multipart/form-data", name="create-widget") .errors fieldset legend Band / Album Information fieldset legend Social Networks fieldset legend Download All of my javascript files are stored in /public/javascripts and all of my static CSS files are being served up just fine. I'm not sure what I've done wrong.

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >