Search Results

Search found 163 results on 7 pages for 'timothy kane'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • OOP C# Question: Making a Fruit a Pear

    - by Adam Kane
    Given that I have an instance of Fruit with some properties set, and I want to get those properties into a new Pear instance (because this particular Fruit happens to have the qualities of a pear), what's the best way to achieve this effect? For example, what we can't do is simple cast a Fruit to a Pear, because not all Fruits are Pears: 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! Update: I don't control the "new Fruit()" code. My starting point is that I've got a Fruit to work with. I need to get that Fruit into a new Pear somehow. Maybe copy all the properties one by one?

    Read the article

  • NET Framework Validation Library

    - by Kane
    As I see it most applications have a requirement for some form of validation and a number of fantastic free offerings are available (I.E., Fluent Validation, Validation Block, Spring, Castle Windsor, etc). My question is why does the .NET Framework not include any inbuilt validation libraries? I am aware the .NET Framework allows a developer the ability to build their own validation libraries/methods/etc. and anything provided as part of the .NET Framework would not always meet everyone’s needs. But surely something could have been included? ASP.NET has a minimal set of validators but these have not really been extended since .NET 2.0 was released.

    Read the article

  • How to you password protect a page with Wicket?

    - by Kane
    I want to password protect a webpage in Wicket so the user may only access it if he/she has logged in. I'd also like the page to show the login page, and then after logging in the original page the user was trying to get to. How is this done with wicket? I've already created a login page and extended the session class.

    Read the article

  • How to get RSS feed item count?

    - by Adam Kane
    Hello, In C#, .NET 3.5, in a Windows Forms application... How does one get the integer count of the number of items that a given RSS url returns? Example: For my blog at: http://forgefx.blogspot.com/feeds/posts/default The expected result would be: postCount = 25 Thanks!

    Read the article

  • AES and CBC in PHP

    - by Kane
    I am trying to encrypt a string in php using AES-128 and CBC, but when I call mcrypt_generic_init() it returns false. $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '',MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $res = mcrypt_generic_init($cipher, 'aaaa', $iv); //'aaaa' is a test key Can someone tell me why is returning 0/false? I read the php documentation and seems correct (http://us.php.net/manual/en/mcrypt.examples.php)

    Read the article

  • Examples of Wicket ChoiceFilteredPropertyColumn?

    - by Kane
    I'd really like some kind of filter I can use on my AjaxFallbackDefaultDataTable. It seems that I may be able to implement that with a ChoiceFilteredPropertyColumn, however I cannot seem to find any examples on how to use it, or just demos of what it does. Can someone point me to, or show me how to implement a ChoiceFilteredPropertyColumn?

    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

  • Tim Berners-Lee indigné par le programme PRISM, le père du web dénonce l'hypocrisie occidentale sur l'espionnage

    Tim Berners-Lee indigné par le programme PRISM, le père du web dénonce l'hypocrisie occidentale sur l'espionnageSir Timothy John Berners-Lee était en Grande-Bretagne cette semaine pour recevoir le Queen Elizabeth Price en ingénierie. Lors de la cérémonie, le « père d'internet » a été abordé pour partager son ressenti face à l'actualité qui secoue les médias du monde entier : l'affaire Edward Snowden et les espionnages sur internet à l'échelle gouvernemental qu'il a dénoncés . Tim Berners-Lee dénonce l'hypocrisie des gouvernements occidentaux, grands donneurs de leçons, qui ne manquent pas une seul...

    Read the article

  • Google I/O 2012 - Getting Started with Google+ History API [CONF]

    Google I/O 2012 - Getting Started with Google+ History API [CONF] Timothy Jordan, Daniel Dulitz Google+ history presents new opportunities to increase traffic to your site and engagement with your content by allowing users to connect their Google profile to your site. This session will explore the value of Google+ history and review basic implementation. Special guests will be on hand to describe their early success with this new service. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 92 6 ratings Time: 33:56 More in Science & Technology

    Read the article

  • Google I/O 2010 - Google Buzz, location, and social gaming

    Google I/O 2010 - Google Buzz, location, and social gaming Google I/O 2010 - Surf the stream: Google Buzz, location, and social gaming Social Web 201 Bob Aman, Timothy Jordan Google Buzz has a feature-rich API that allows you to do all kinds of interesting things with conversations and location. In this session we'll build a Buzz-tastic mobile game using App Engine, HTML5, and the Buzz API for social awesomeness. For all I/O 2010 sessions, please go to code.google.com From: GoogleDevelopers Views: 2 0 ratings Time: 31:18 More in Science & Technology

    Read the article

  • Denormalization Strategies

    In building a database, typically we want a well normalized design. However there are cases for considering options for denormalization in complex systems. Timothy Claason gives you some thoughts on the subject.

    Read the article

  • Improving Strategic Financial Planning at Wyndham Worldwide

    Timothy Koropsak, Manager of Corporate Financial Planning at $3B hospitality company Wyndham Worldwide, talks with Nigel Youell, Product Marketing Director for Enterprise Performance Management at Oracle about their implementation of Hyperion solutions and how this has helped them improve their strategic financial planning processes. Tim highlights how they now have Operating and Treasury forecasts on one common platform and can produce fully integrated financial statements with GAAP accounting integrity and ensures that the strategic plans consolidating from their three business units are reliable and accurate.

    Read the article

  • C# Bind DataTable to Existing DataGridView Column Definitions

    - by Timothy
    I've been struggling with a NullReferenceException and hope someone here will be able to point me in the right direction. I'm trying to create and populate a DataTable and then show the results in a DataGridView control. The basic code follows, and Execution stops with a NullReferenceException at the point where I invoke the new UpdateResults_Delegate. Oddly enough, I can trace entries.Rows.Count successfully before I return it from QueryEventEntries, so I can at least show 1) entries is not a null reference, and 2) the DataTable contains rows of data. I know I have to be doing something wrong, but I just don't know what. private void UpdateResults(DataTable entries) { dataGridView.DataSource = entries; } private void button_Click(object sender, EventArgs e) { PerformQuery(); } private void PerformQuery() { DateTime start = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, 0, 0, 0); DateTime stop = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month, dateTimePicker2.Value.Day, 0, 0, 0); DataTable entries = QueryEventEntries(start, stop); UpdateResults(entries); } private DataTable QueryEventEntries(DateTime start, DateTime stop) { DataTable entries = new DataTable(); entries.Columns.AddRange(new DataColumn[] { new DataColumn("event_type", typeof(Int32)), new DataColumn("event_time", typeof(DateTime)), new DataColumn("event_detail", typeof(String))}); using (SqlConnection conn = new SqlConnection(DSN)) { using (SqlDataAdapter adapter = new SqlDataAdapter( "SELECT event_type, event_time, event_detail FROM event_log " + "WHERE event_time >= @start AND event_time <= @stop", conn)) { adapter.SelectCommand.Parameters.AddRange(new Object[] { new SqlParameter("@start", start), new SqlParameter("@stop", stop)}); adapter.Fill(entries); } } return entries; } Update I'd like to summarize and provide some additional information I've learned from the discussion here and debugging efforts since I originally posted this question. I am refactoring old code that retrieved records from a database, collected those records as an array, and then later iterated through the array to populate a DataGridView row by row. Threading was originally implemented to compensate and keep the UI responsive during the unnecessary looping. I have since stripped out Thread/Invoke; everything now occurs on the same execution thread (thank you, Sam). I am attempting to replace the slow, unwieldy approach using a DataTable which I can fill with a DataAdapter, and assign to the DataGridView through it's DataSource property (above code updated). I've iterated through the entries DataTable's rows to verify the table contains the expected data before assigning it as the DataGridView's DataSource. foreach (DataRow row in entries.Rows) { System.Diagnostics.Trace.WriteLine( String.Format("{0} {1} {2}", row[0], row[1], row[2])); } One of the column of the DataGridView is a custom DataGridViewColumn to stylize the event_type value. I apologize I didn't mention this before in the original post but I wasn't aware it was important to my problem. I have converted this column temporarily to a standard DataGridViewTextBoxColumn control and am no longer experiencing the Exception. The fields in the DataTable are appended to the list of fields that have been pre-specified in Design view of the DataGridView. The records' values are being populated in these appended fields. When the run time attempts to render the cell a null value is provided (as the value that should be rendered is done so a couple columns over). In light of this, I am re-titling and re-tagging the question. I would still appreciate it if others who have experienced this can instruct me on how to go about binding the DataTable to the existing column definitions of the DataGridView.

    Read the article

  • CA2000 passing object reference to base constructor in C#

    - by Timothy
    I receive a warning when I run some code through Visual Studio's Code Analysis utility which I'm not sure how to resolve. Perhaps someone here has come across a similar issue, resolved it, and is willing to share their insight. I'm programming a custom-painted cell used in a DataGridView control. The code resembles: public class DataGridViewMyCustomColumn : DataGridViewColumn { public DataGridViewMyCustomColumn() : base(new DataGridViewMyCustomCell()) { } It generates the following warning: CA2000 : Microsoft.Reliability : In method 'DataGridViewMyCustomColumn.DataGridViewMyCustomColumn()' call System.IDisposable.Dispose on object 'new DataGridViewMyCustomCell()' before all references to it are out of scope. I understand it is warning me DataGridViewMyCustomCell (or a class that it inherits from) implements the IDisposable interface and the Dispose() method should be called to clean up any resources claimed by DataGridViewMyCustomCell when it is no longer. The examples I've seen on the internet suggest a using block to scope the lifetime of the object and have the system automatically dispose it, but base isn't recognized when moved into the body of the constructor so I can't write a using block around it... which I'm not sure I'd want to do anyway, since wouldn't that instruct the run time to free the object which could still be used later inside the base class? My question then, is the code okay as is? Or, how could it be refactored to resolve the warning? I don't want to suppress the warning unless it is truly appropriate to do so.

    Read the article

  • C# locale-aware MaskedTextBox mask for DateTime values

    - by Timothy
    C# locale-aware MaskedTextBox mask for DateTime values I'm working through FXCop/Code Analysis's Globalization warnings and would like to know the proper, locale-aware way to set and get DateTime values through a MaskedTextBox. My form has a MaskedTextBox element with its Culture property set to "en-US", and its Mask property set to "00/00/0000" (the predefined Short date format). maskedTextBox.Text = now.ToString() displays without leading-zeros as "42/42/010_", yet I would like it to be represented as "04/24/2010".

    Read the article

  • LINQ-to-SQL: How can I prevent 'objects you are adding to the designer use a different data connecti

    - by Timothy Khouri
    I am using Visual Studio 2010, and I have a LINQ-to-SQL DBML file that my colleagues and I are using for this project. We have a connection string in the web.config file that the DBML is using. However, when I drag a new table from my "Server Explorer" onto the DBML file... I get presented with a dialog that demands that do one of these two options: Allow visual studio to change the connection string to match the one in my solution explorer. Cancel the operation (meaning, I don't get my table). I don't really care too much about the debate as why the PMs/devs who made this tool didn't allow a third option - "Create the object anyway - don't worry, I'm a developer!" What I am thinking would be a good solution is if I can create a connection in the Server Explorer - WITHOUT A WIZARD. If I can just paste a connection string, that would be awesome! Because then the DBML designer won't freak out on me :O) If anyone knows the answer to this question, or how to do the above, please lemme know!

    Read the article

  • QTcpServer not emiting signals

    - by Timothy Baldridge
    Okay, I'm sure this is simple, but I'm not seeing it: HTTPServer::HTTPServer(QObject *parent) : QTcpServer(parent) { connect(this, SIGNAL(newConnection()), this, SLOT(acceptConnection())); } void HTTPServer::acceptConnection() { qDebug() << "Got Connection"; QTcpSocket *clientconnection = this->nextPendingConnection(); connect(clientconnection, SIGNAL(disconnected()), clientconnection, SLOT(deleteLater())); HttpRequest *req = new HttpRequest(clientconnection, this); req->processHeaders(); delete req; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); HTTPServer http(0); http.listen(QHostAddress::Any, 8011); qDebug() << "Started: " << http.isListening() << http.serverAddress() << ":" << http.serverPort(); return a.exec(); } According to the docs my acceptConnection() slot should be called whenever there is a new connection. I can connect into this tcp port with a browser or telnet, and I don't get any errors, so I know it's listening, execution never goes to my acceptConnection() function? And yes my objects inherit from QObject, I've just stripped the code down to the essential parts above. There's no build errors....

    Read the article

  • ctypes and PySide

    - by Timothy Baldridge
    I'm building an app with PySide, there's some image manipulation that needs to be done and using Python code for this is way too slow. Therefore I hacked out a .dll file that will do it for me. The function definition is as follows: extern "C" { QRectF get_image_slant(QImage *img, float slantangle, float offset) { Now I can load this function in via ctypes. But I can't seem to get ctypes to accept a QImage. I tried calling it like this: ext.get_image_slant(QImage(), 0, 0) And the reply I get is: File "<stdin>", line 1, in <module> ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1 I tired casting the QImage to a c_void_p and it doesn't like that either. From what I can tell QImage() in python should map exactly to a QImage * in C, but Python doesn't seem to understand that.. Is there any way to force the casting?

    Read the article

  • How can I prevent 'objects you are adding to the designer use a different data connection...'?

    - by Timothy Khouri
    I am using Visual Studio 2010, and I have a LINQ-to-SQL DBML file that my colleagues and I are using for this project. We have a connection string in the web.config file that the DBML is using. However, when I drag a new table from my "Server Explorer" onto the DBML file... I get presented with a dialog that demands that do one of these two options: Allow visual studio to change the connection string to match the one in my solution explorer. Cancel the operation (meaning, I don't get my table). I don't really care too much about the debate as why the PMs/devs who made this tool didn't allow a third option - "Create the object anyway - don't worry, I'm a developer!" What I am thinking would be a good solution is if I can create a connection in the Server Explorer - WITHOUT A WIZARD. If I can just paste a connection string, that would be awesome! Because then the DBML designer won't freak out on me :O) If anyone knows the answer to this question, or how to do the above, please lemme know!

    Read the article

  • Rails fields_for :child_index option explanation

    - by Timothy
    I have been trying to create a complex form with many nested models, and make it dynamic. Now I found that making a nested model isn't difficult with accepts_nested_attributes_for, but making it nested and dynamic was seemingly impossible if there were multiple nested models. I came across http://github.com/ryanb/complex-form-examples/blob/master/app/helpers/application_helper.rb which does it very elegantly. Could anyone shed some light on lines 13 and 16? 13 form_builder.object.class.reflect_on_association(method).klass.new and 16 form_builder.fields_for(method, options[:object], :child_index => "new_#{method}") do |f| From intuition, line 13 instantiates a new object, but why must it do so many method calls? I couldn't find any documentation for the :child_index option on line 16. When the form is created, a very large number is used as an index for new models, whereas existing models are indexed by their id. How does this work?

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >