Search Results

Search found 2677 results on 108 pages for 'michael cummings'.

Page 85/108 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Is directly executing SQL bad app design?

    - by Michael Lowman
    I'm developing an iOS application that's a manager/viewer for another project. The idea is the app will be able to process the data stored in a database into a number of visualizations-- the overall effect being similar to cacti. I'm making the visualizations fully user-configurable: the user defines what she wants to see and adds restrictions. She might specify, for instance, to graph a metric over the last three weeks with user accounts that are currently active and aren't based in the United States. My problem is that the only design I can think of is more or less passing direct SQL from the iOS app to the backend server to be executed against the database. I know it's bad practice and everything should be written in terms of stored procedures. But how else do I maintain enough flexiblity to keep fully user-defined queries? While the application does compose the SQL, direct SQL is never visible or injectable by the user. That's all abstracted away in UIDateTimeChoosers, UIPickerViews, and the like.

    Read the article

  • Show or hide fields depending on the Acl9 role - Ruby on Rails

    - by Michaël
    Hi, I am using Acl9 to manage the roles and I want to hide the checkbox usertype if the user has the role :customer and show it if the role is :manager. I want that just the :manager can edit all the fields and some for the :customer. Thank you for your help! <h1>Editing user</h1> <% form_for(@user) do |f| %> <%= f.error_messages %> <p> <%= f.label :usertype %><br /> <%= f.check_box :usertype %> </p> <p> <%= f.label :surname %><br /> <%= f.text_field :surname %> </p> <p> <%= f.label :firstname %><br /> <%= f.text_field :firstname %> </p> <p> <%= f.label :phone %><br /> <%= f.text_field :phone %> </p> <p> <%= f.label :email %><br /> <%= f.text_field :email %> </p> <p> <%= f.label :registrationdate %><br /> <%= f.datetime_select :registrationdate %> </p> <p> <%= f.label :login %><br /> <%= f.text_field :login %> </p> <p> <%= f.label :password %><br /> <%= f.text_field :password %> </p> <p> <%= f.submit 'Update' %> </p> <% end %> <%= link_to 'Show', @user %> | <%= link_to 'Back', users_path %>

    Read the article

  • Creating a "virtual" path (/bla) in Mac OS X and Linux that calls custom code

    - by Michael Stum
    Just something I'd like to play with, I would like to create a "virtual" file/directory in the File System of Linux or Mac OS X (Not sure if I can share the same code - does POSIX help?), for example /foo and then perform custom code when something is read or written to it. Similar how /dev/null allows for stuff like echo "Hello!" > /dev/null I don't care if it's in /dev, /proc or anywhere else, as said it's mainly something to play with...

    Read the article

  • How do you deploy your Rails application?

    - by Michael Sync
    Do you upload your rail application to your host via FTP first? I'm currently using Passenger and Capistrano. If I do "cap deploy" in my local machine then I think Capistrano should upload my rail application to my host, right? Someone from my host is saying that I need to run "cap deploy" in server. I think it doesn't make sense.

    Read the article

  • Perl ENV variable contains newline and tab

    - by Michael
    Say I have an environment variable myvar myvar=\tapple\n when the following command will print out this variable perl -e 'print "$ENV{myvar}"' I will literally have \tapple\n, however, I want those control chars to be evaluated and not escaped. How would I achieve it? In the real world $ENV residing in substitution, but I hope the answer will cover that.

    Read the article

  • Question about fwrite API

    - by michael
    Hi, In C++, there is a fwrite() which writes a buffer to a file on disk: http://www.cplusplus.com/reference/clibrary/cstdio/fwrite/ Can you please tell me if there is any buffer inside that fwrite implementation? i.e. if I call fwrite() multiple times (say 10 times), does it actually invoke file i/o 10 different times? Thank you.

    Read the article

  • android ListView question

    - by michael
    Hi, I have a ListView in my android application. If I flick up/down the ListView, which method will return my 'selected' element in my list View? How about if I use the track ball to navigate up/down my list view, which method will return the index of my selected element? Thank you.

    Read the article

  • How to create DataSource dependency property on a wpf User Control

    - by Michael Hedgpeth
    I have a user control that wraps a grid. I want to be able to set the underlying grid's data source, but through the user control, like this: <my:CustomGrid DataSource="{Binding Path=CollectionView}" /> I have set this up in the grid like this: private static readonly DependencyProperty DataSourceProperty = DependencyProperty.Register("DataSource", typeof(IEnumerable), typeof(CustomGrid)); public IEnumerable DataSource { get { return (IEnumerable)GetValue(DataSourceProperty); } set { SetValue(DataSourceProperty, value); underlyingGrid.DataSource = value; } } But this doesn't work (it doesn't give me an error either). The data source is never set. What am I missing?

    Read the article

  • regular expression repeating subexpression

    - by Michael Z
    I have the following text <pattern name="pattern1"/> <success>success case 1</success> <failed> failure 1</failed> <failed> failure 2</failed> <unknown> unknown </unknown> <pattern name="pattern2"/> <success>success case 2</success> <otherTag>There are many other tags.</otherTag> <failed> failure 3</failed> And the regular expression <failed>[\w|\W]*?</failed> matches all the lines contains failed tag. What do I need to to if I want to include the lines contains pattern tag as well? Basically, I want the following output: <pattern name="pattern1"/> <failed> failure 1</failed> <failed> failure 2</failed> <pattern name="pattern2"/> <failed> failure 3</failed> I am doing this in javascript, I do not mind of doing some intermediate steps.

    Read the article

  • Java Null Pointer Exception :-(

    - by John-Michael Reed
    I've got a Null Pointer Exception in my main that just won't go away and I'm totally out of ideas. The error is on the line "Board[x][y].color = 2;" in which Board is a public, static array of piece objects that contain instance variables like the one "color" that is being set to 2 in the above statement. Pieces is not static - that is there are many different copies of pieces, each with its own data, but only one board. The array has been initialized and defined as both public Piece[][] Board = new Piece[8][8] and public static Piece[][] Board = new Piece[8][8], but no matter how I mess around with it (getting rid of static, putting the variable in another object, etc.), I can't seem to get the error to go away. Help?

    Read the article

  • Greasemonkey script, that creates Kineticjs drag and drop canvas over every website

    - by Michael Moeller
    I'd like to put a drag and drop canvas over every website I visit in Firefox. My Greasemonkey script puts a drag and drop canvas under every page: kinetic.user.js: // ==UserScript== // @name kineticjs_example // @description Canvas Drag and Drop // @include * // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // @require http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.2.min.js // ==/UserScript== var div = document.createElement( 'div' ); with( div ) { setAttribute( 'id', 'container' ); } // append at end document.getElementsByTagName( 'body' )[ 0 ].appendChild( div ); var stage = new Kinetic.Stage({ container: 'container', width: 1000, height: 1000 }); var layer = new Kinetic.Layer(); var rectX = stage.getWidth() / 2 - 50; var rectY = stage.getHeight() / 2 - 25; var box = new Kinetic.Rect({ x: rectX, y: rectY, width: 100, height: 50, fill: '#00D2FF', stroke: 'black', strokeWidth: 4, draggable: true }); // add cursor styling box.on('mouseover', function() { document.body.style.cursor = 'pointer'; }); box.on('mouseout', function() { document.body.style.cursor = 'default'; }); layer.add(box); stage.add(layer); How can I drag and drop this shape over the entire website?

    Read the article

  • How can I enable a debugging mode via a command-line switch for my Perl program?

    - by Michael Mao
    I am learning Perl in a "head-first" manner. I am absolutely a newbie in this language: I am trying to have a debug_mode switch from CLI which can be used to control how my script works, by switching certain subroutines "on and off". And below is what I've got so far: #!/usr/bin/perl -s -w # purpose : make subroutine execution optional, # which is depending on a CLI switch flag use strict; use warnings; use constant DEBUG_VERBOSE => "v"; use constant DEBUG_SUPPRESS_ERROR_MSGS => "s"; use constant DEBUG_IGNORE_VALIDATION => "i"; use constant DEBUG_SETPPING_COMPUTATION => "c"; our ($debug_mode); mainMethod(); sub mainMethod # () { if(!$debug_mode) { print "debug_mode is OFF\n"; } elsif($debug_mode) { print "debug_mode is ON\n"; } else { print "OMG!\n"; exit -1; } checkArgv(); printErrorMsg("Error_Code_123", "Parsing Error at..."); verbose(); } sub checkArgv #() { print ("Number of ARGV : ".(1 + $#ARGV)."\n"); } sub printErrorMsg # ($error_code, $error_msg, ..) { if(defined($debug_mode) && !($debug_mode =~ DEBUG_SUPPRESS_ERROR_MSGS)) { print "You can only see me if -debug_mode is NOT set". " to DEBUG_SUPPRESS_ERROR_MSGS\n"; die("terminated prematurely...\n") and exit -1; } } sub verbose # () { if(defined($debug_mode) && ($debug_mode =~ DEBUG_VERBOSE)) { print "Blah blah blah...\n"; } } So far as I can tell, at least it works...: the -debug_mode switch doesn't interfere with normal ARGV the following commandlines work: ./optional.pl ./optional.pl -debug_mode ./optional.pl -debug_mode=v ./optional.pl -debug_mode=s However, I am puzzled when multiple debug_modes are "mixed", such as: ./optional.pl -debug_mode=sv ./optional.pl -debug_mode=vs I don't understand why the above lines of code "magically works". I see both of the "DEBUG_VERBOS" and "DEBUG_SUPPRESS_ERROR_MSGS" apply to the script, which is fine in this case. However, if there are some "conflicting" debug modes, I am not sure how to set the "precedence of debug_modes"? Also, I am not certain if my approach is good enough to Perlists and I hope I am getting my feet in the right direction. One biggest problem is that I now put if statements inside most of my subroutines for controlling their behavior under different modes. Is this okay? Is there a more elegant way? I know there must be a debug module from CPAN or elsewhere, but I want a real minimal solution that doesn't depend on any other module than the "default". And I cannot have any control on the environment where this script will be executed...

    Read the article

  • How to access a subset of XML data in Java when the XML data is too large to fit in memory?

    - by Michael Jones
    What I would really like is a streaming API that works sort of like StAX, and sort of like DOM/JDom. It would be streaming in the sense that it would be very lazy and not read things in until needed. It would also be streaming in the sense that it would read everything forwards (but not backwards). Here's what code that used such an API would look like. URL url = ... XMLStream xml = XXXFactory(url.inputStream()) ; // process each <book> element in this document. // the <book> element may have subnodes. // You get a DOM/JDOM like tree rooted at the next <book>. while (xml.hasContent()) { XMLElement book = xml.getNextElement("book"); processBook(book); } Does anything like this exist?

    Read the article

  • Implementing a Version check between an Abstract class and it's implementation

    - by Michael Stum
    I have this abstract class and concrete implementation (they are in different assemblies): public abstract class MyAbstractClass { private static readonly int MyAbstractClassVersion = 1; public abstract int ImplementedVersion { get; } protected MyAbstractClass() { CheckVersion(); } private void CheckVersion() { var message = string.Format( "MyAbstractClass implements Version {0}, concrete is Version {1}", RepositoryVersion, ImplementedVersion); if (!MyAbstractClassVersion.Equals(ImplementedVersion)) throw new InvalidOperationException(message); } } public class ConcreteClass : MyAbstractClass { public ConcreteClass() : base() { // ConcreteClass is guaranteed to have // a constructor that calls the base constructor // I just simplified the example } public override int ImplementedVersion { get { return 2; } } } As you see, I call CheckVersion() from the abstract constructor, to get rid of the "virtual member call in base constructor" message, but I am not sure if that's really the way to do it. Sure, it works, but that doesn't mean it will always work, will it? Also, I wonder if I can get the name of the Concrete Type from the CheckVersion() function? I know that adding new abstract members will force an error anyway (System.TypeLoadException) and I'm not sure if I want this type of strict Versioning, but I'm just curious how it would be done properly given only the abstract class and an implementation (I know I could do it by using interfaces and/or a Factory pattern).

    Read the article

  • Python NameError when attempting to use a user-defined class

    - by Michael Herold
    I'm getting a weird instance of a NameError when attempting to use a class I wrote. In a directory, I have the following file structure: dir/ ReutersParser.py test.py reut-xxx.sgm Where my custom class is defined in ReutersParser.py and I have a test script defined in test.py. The ReutersParser looks something like this: from sgmllib import SGMLParser class ReutersParser(SGMLParser): def __init__(self, verbose=0): SGMLParser.__init__(self, verbose) ... rest of parser if __name__ == '__main__': f = open('reut2-short.sgm') s = f.read() p = ReutersParser() p.parse(s) It's a parser to deal with SGML files of Reuters articles. The test works perfectly. Anyway, I'm going to use it in test.py, which looks like this: from ReutersParser import ReutersParser def main(): parser = ReutersParser() if __name__ == '__main__': main() When it gets to that parser line, I'm getting this error: Traceback (most recent call last): File "D:\Projects\Reuters\test.py", line 34, in <module> main() File "D:\Projects\Reuters\test.py", line 19, in main parser = ReutersParser() File "D:\Projects\Reuters\ReutersParser.py", line 38, in __init__ SGMLParser.__init__(self, verbose) NameError: global name 'sgmllib' is not defined For some reason, when I try to use my ReutersParser in test.py, it throws an error that says it cannot find sgmllib, which is a built-in module. I'm at my wits' end trying to figure out why the import won't work. What's causing this NameError? I've tried importing sgmllib in my test.py and that works, so I don't understand why it can't find it when trying to run the constructor for my ReutersParser.

    Read the article

  • How to return a 'read-only' copy of a vector

    - by michael
    Hi, I have a class which has a private attribute vector rectVec; class A { private: vector<Rect> rectVec; }; My question is how can I return a 'read-only' copy of my Vector? I am thinking of doing this: class A { public: const vect<Rect>& getRectVec() { return rectVect; } } Is that the right way? I am thinking this can guard against the callee modify the vector(add/delete Rect in vector), what about the Rect inside the vector?

    Read the article

  • Linq Order By a subtable

    - by Michael
    Hello, My question is how to sort a Linq query by a sub table: Table Apps: - app_id - name Table AppStatus: - app_status_id - app_id - severity - status_date I would like to have a query with all the apps, sorted by the last status severity: app_id name 1 first 2 second 3 third app_status_id app_id severity status_date 1 1 5 12-4-2010 2 1 2 15-4-2010 3 2 7 10-4-2010 4 3 3 13-4-2010 Now i want it sorted like: app_id name 3 third 1 first 2 second Can anyone help me with a LINQ query for this. I tried the following already, but that didn't work: var apps = from apps in dc.Apps orderby apps.AppStatus.LastOrDefault().severity select apps;

    Read the article

  • Deselecting an element in jQuery

    - by Michael Itzoe
    I have a collection of span elements. In the code I have a global variable that represents the "selected" object. Using the click event when a span is clicked I reset the object's class, reset the global variable, then set the object to the variable and change its class (to make it "highlighted"). This effectively toggles selection when clicking an object. var currentItem = null; $( ".item" ).click( function() { if( $( this ).hasClass( "selected" ) ) { $( this ).removeClass( "selected" ) currentItem = null; } else { if( $( ".item" ).hasClass( "selected" ) ){ $( ".item" ).removeClass( "selected" ) } $( this ).addClass( "selected" ); currentItem = $( this ); } } ); What I'd like to be able to do is unselect when clicking on an empty area of the page. I tried creating a click event on the body object, but that overrode the span click event so nothing was selected. I'm a complete jQuery noob and not sure where to go with this.

    Read the article

  • Start a thread using a method pointer

    - by Michael
    Hi ! I'm trying to develop a thread abstraction (POSIX thread and thread from the Windows API), and I would very much like it to be able to start them with a method pointer, and not a function pointer. What I would like to do is an abstraction of thread being a class with a pure virtual method "runThread", which would be implanted in the future threaded class. I don't know yet about the Windows thread, but to start a POSIX thread, you need a function pointer, and not a method pointer. And I can't manage to find a way to associate a method with an instance so it could work as a function. I probably just can't find the keywords (and I've been searching a lot), I think it's pretty much what Boost::Bind() does, so it must exist. Can you help me ?

    Read the article

  • How to find kth minimal element in the union of two sorted arrays?

    - by Michael
    This is a homework question. They say it takes O(logN + logM) where N and M are the arrays lengths. Let's name the arrays a and b. Obviously we can ignore all a[i] and b[i] where i k. First let's compare a[k/2] and b[k/2]. Let b[k/2] a[k/2]. Therefore we can discard also all b[i], where i k/2. Now we have all a[i], where i < k and all b[i], where i < k/2 to find the answer. What is the next step?

    Read the article

  • What is the proper method to stop loading a Flex Module before it has completely loaded?

    - by Michael Prescott
    I seem to recall that Loader.unload() could once be used to stop loading a swf before it had finished loading. I can no longer find documentation or the blog where I read this. Perhaps it was an unofficial feature. Anyhow, IModuleInfo, returned by ModuleManager.getModule() has an unload() method. If I want to halt loading a Flex Module that is in progress, do I just call iModuleInfo_instance.unload()?

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >