Search Results

Search found 1689 results on 68 pages for 'andrew 1510'.

Page 51/68 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • Logging a certain event only once in ruby

    - by Andrew Grimm
    Are there any logging frameworks in ruby that allow you to log a specific event type only once? logger = IdealLogger.new logger.log(:happy_path, "We reached the happy path") # => logs this message logger.log(:happy_path, "We reached the happy path yet again") # => Doesn't log this logger.log(:sad_path, "We've encountered a sad path!") # => logs this message Also, is there a term for the concept of logging a certain event type only once?

    Read the article

  • Selenium: How to click an HTML button element?

    - by Andrew
    I have button on the page that being used as a link to another page. So when the user clicks the button they are redirected to the right page. I am using the Selenium extension for PHPUnit and I would like to test that the button is correctly redirecting the user. Here is the HTML that I am trying to test: <button onclick="window.location='/sponsor';" value="Continue" type="button" id="sponsorContinue" name="sponsorContinue">Continue</button> I have tried a lot of different approaches to click the button, but I can't seem to get any of them to work: $this->click("//button[@id='sponsorContinue']"); This command executes and does not throw any errors, but the page isn't redirected. It works fine when I manually click the button. What should I do?

    Read the article

  • MVP pattern. Presenter requires new view instance. Best practice

    - by Andrew Florko
    I try to apply MVP pattern for win.forms application. I have 2 forms: main & child. Main has a button and when you click it - child form should appear. There are 2 views interfaces that forms implement IMainView { event OnClick; ... } IChildView { ... } There are two presenters MainPresenter(IMainView) & ChildPresenter(IChildView) MainPresenter listens to OnClick event and then should create IChildView implementation. MainPresenter { ... MainClicked() { // it's required to create IChildView instance here } } How would you implement such creation typically? Shall IMainView has factory method for IChildView or may be it should be separate Views factory. What would you advise? Or maybe there is some misunderstanding of MVP here? Thank you in advance!

    Read the article

  • What are the primary advantages of Visual Studio Team Foundation Server over the other versions?

    - by Andrew Dunaway
    We are looking into the possibility of upgrading to Team Foundation Server 2008 for our development team. One of our primary reasons is some of the deployment capabilities surrounding BizTalk 2009, but I am curious what other benefits there are for other projects outside of BizTalk. Some of our interests so far are moving to a one click build and deploy process, the addition of unit tests, and continuous integration. Some definite steps forward for the company I work for. What other benefits or information should I look at as I pitch this to upper management? I am looking for technical reasons, money is a not really a concern for this discussion.

    Read the article

  • Why can't you return a List from a Compiled Query?

    - by Andrew
    I was speeding up my app by using compiled queries for queries which were getting hit over and over. I tried to implement it like this: Function Select(ByVal fk_id As Integer) As List(SomeEntity) Using db As New DataContext() db.ObjectTrackingEnabled = False Return CompiledSelect(db, fk_id) End Using End Function Shared CompiledSelect As Func(Of DataContext, Integer, List(Of SomeEntity)) = _ CompiledQuery.Compile(Function(db As DataContext, fk_id As Integer) _ (From u In db.SomeEntities _ Where u.SomeLinkedEntity.ID = fk_id _ Select u).ToList()) This did not work and I got this error message: Type : System.ArgumentNullException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Value cannot be null. Parameter name: value However, when I changed my compiled query to return IQueryable instead of List like so: Function Select(ByVal fk_id As Integer) As List(SomeEntity) Using db As New DataContext() db.ObjectTrackingEnabled = False Return CompiledSelect(db, fk_id).ToList() End Using End Function Shared CompiledSelect As Func(Of DataContext, Integer, IQueryable(Of SomeEntity)) = _ CompiledQuery.Compile(Function(db As DataContext, fk_id As Integer) _ From u In db.SomeEntities _ Where u.SomeLinkedEntity.ID = fk_id _ Select u) It worked fine. Can anyone shed any light as to why this is? BTW, compiled queries rock! They sped up my app by a factor of 2.

    Read the article

  • Integration tests - "no exceptions are thrown" approach. Does it make sense?

    - by Andrew Florko
    Sometimes integration tests are rather complex to write or developers have no enough time to check output - does it make sense to write tests that make sure "no exceptions are thrown" only? Such tests provide some input parameters set(s) and doesn't check the result, but only make sure code not failed with exception? May be such tests are not very useful but appropriate in situations when you have no time?

    Read the article

  • Using javascript to print images

    - by andrew
    Hi all, I would like to know if it's possible to use javascript to open a popup window containing an image, and at the same time have the print dialog show. Once someone clicks on print, the popup closes. Is this easily attainable?

    Read the article

  • Batch file writing to log then ending process

    - by Andrew Service
    I have a batch file that calls a process and in that process I have: IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL% Now I wanted to upgrade this a bit and give some meaningful message to an output log when if the process fails, also I do not want the main batch to continue processing because the next processes are dependent on data from previous calls; I wonder if this would be correct but not sure: CALL Process 1 IF %ERRORLEVEL% NEQ 0 GOTO ErrorInfirstProcess /B %ERRORLEVEL% :ErrorInfirstProcess ECHO Process 1 Failed on %Date% at %Time%. >>C:\Log.txt" CALL Process 2 IF %ERRORLEVEL% NEQ 0 GOTO ErrorInSecondProcess /B %ERRORLEVEL% :ErrorInSecondProcess ECHO Process 2 Failed on %Date% at %Time%. >>C:\Log.txt" I also want to know if I still need the /B or do I need to put an EXIT command after the echo? Thanks A

    Read the article

  • Setting many key/value pairs

    - by Andrew
    Hi, I'm working on a rake task which imports from a JSON feed into an ActiveRecord called Person. Person has quite a few attributes and rather than write lines of code for setting each attribute I'm trying different methods. The closest I've got is shown below. This works nicely as far as outputing to screen but when I check the values have actually been set on the ActiveRecord itself it's always nil. So it looks like I can't use .to_sym to solve my problem? Any suggestions? I should also mention that I'm just starting out with Ruby, have been doing quite a bit of Objective-c and now need to embrace the Interwebs :) http = Net::HTTP.new(url.host, url.port) http.read_timeout = 30 json = http.get(url.to_s).body parsed = JSON.parse(json) if parsed.has_key? 'code' updatePerson = Person.find_or_initialize_by_code(parsed['code']) puts updatePerson.code parsed.each do |key, value| puts "#{key} is #{value}" symkey = key.to_sym updatePerson[:symkey] = value.to_s updatePerson.save puts "#{key}....." # shows the current key puts updatePerson[:symkey] # shows the correct value puts updatePerson.first_name # a sample key, it's returning nil end

    Read the article

  • getting userbase vote average and individual user's vote in the same query?

    - by Andrew Heath
    Here goes: T1 [id] [desc] 1 lovely 2 ugly 3 slender T2 [id] [userid] [vote] 1 1 3 1 2 5 1 3 2 2 1 1 2 2 4 2 3 4 In one query (if possible) I'd like to return: T1.id, T1.desc, AVG(T2.vote), T2.vote (for user viewing the page) I can get the first 3 items with: SELECT T1.id, T1.desc, AVG(T2.vote) FROM T1 LEFT JOIN T2 ON T1.id=T2.id GROUP BY T1.id and I can get the first, second, and fourth items with: SELECT T1.id, T1.desc, T2.vote FROM T1 LEFT JOIN T2 ON T1.id=T2.id WHERE T2.userid='1' GROUP BY T1.id but I'm at a loss as to how to get all four items in one query. I tried inserting a select as the fourth term: SELECT T1.id, T1.desc, AVG(T2.vote), (SELECT T2.vote FROM T2 WHERE T2.userid='1') AS userVote etc etc but I get an error that the select returns more than one row... Help? My reason for wanting to do this in one query instead of two is that I want to be able to sort the data within MySQL rather than one it's been split into a number of arrays.

    Read the article

  • When can argv[0] have null ?

    - by andrew-dufresne
    What I have understand about passing arguments to main() from command line is that argc has a minimum value of 1 and argv[0] will always have the program name with its path in it. If arguments are provided at the command line, then argc will have a value greater than one and argv1 to argv[argc-1] will have those arguments. Now a paragraph at this link says that argv[0] will be a string containing the program's name or a null string if that is not available. Now, how and when can argv[0] have null string? I mean program name with its path will always be available so when can it be null? Writer says that "if that is not available" but when and how it is possible that program name will not be available? Thanks for your time and support. Regards

    Read the article

  • Really basic Django E-commerce? Where do I start

    - by Andrew
    I'm trying to set up a really basic e-commerce site with Django, and am trying to figure out the best place to start. I am relatively comfortable with the framework itself, but have never done any sort of e-commerce development in any language, so I want to learn about some best practices so I don't make any huge or obvious mistakes. I've looked at Satchmo, and even went as far as installing and playing around with it, but it looks like way more than I want. I basically want to show users a list of things, and let them click a button to buy one. No cart, no shipping, just click a button, connect with Authorize.net (or something similar) to do the transaction, and then display a confirmation page. Any suggestions or online tutorials people have found helpful? Even perhaps a tutorial in another language. Or maybe a really lightweight Django plugin that doesn't try to do everything like Satchmo? I've been coming up with very little so far. Thanks!

    Read the article

  • Embed Git Commit Log in Rails App?

    - by Andrew
    So, I have a 'development blog' in a rails app I'm working on right now. I'm using Git for version control and deployment (although right now I'm the only person working on it). Now, when I make changes in Git I put a pretty decent log entry about what I've done. I'd love to have the Git commit log automatically posted to the development blog -- or otherwise available for others to read within the deployed site. Is there an automated way to pull the Git Commit Log into a view in a rails app?

    Read the article

  • Windows Forms application C# | Sending Tweet

    - by Andrew Craswell
    I've been able to get my Twitter web app working just fine, but I've recently decided to add Tweeting functionality from a Windows Form, but I'm having no luck sending tweets. No errors are thrown or anything. Mind looking over my code? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using TweetSharp; namespace TwitterAdvirtiser { public partial class Form1 : Form { private string cKey = "xxx"; private string cSecret = "xxx"; private string oToken = "xxx"; private string aToken = "xxx"; public Form1() { InitializeComponent(); OnStart(); } private void OnStart() { //Authenticate with Twitter TwitterService service = new TwitterService(cKey, cSecret); service.AuthenticateWith(oToken, aToken); service.SendTweet("testing"); } } } It seems like I'm authenticating just fine, I can walk through debug mode and see all my details in the TwitterUser structure, and yet my tweets never show up on my feed. Whats up? By the way, I'm using Visual Studios 2010, and .NET 4.0. I have verified that the oToken and aToken strings have my developer tokens.

    Read the article

  • How do you remove functionality from a program in ruby?

    - by Andrew Grimm
    You have some code you want to remove associated with an obsolete piece of functionality from a ruby project. How do ensure that you get rid of all of the code? Some guidelines that usually help in refactoring ruby apply, but there are added challenges because having code that isn't being called by anything won't break any unit tests.

    Read the article

  • Why does Google append while(1); in front of their JSON responses?

    - by Andrew Koester
    This is something I've always been curious about, is exactly why Google appends while(1); in front of their (private) JSON responses. For example, here's a response while turning a calendar on and off in Google Calendar: while(1);[['u',[['smsSentFlag','false'],['hideInvitations','false'],['remindOnRespondedEventsOnly','true'],['hideInvitations_remindOnRespondedEventsOnly','false_true'],['Calendar ID stripped for privacy','false'],['smsVerifiedFlag','true']]]] I would assume this is to prevent people from doing an eval() on it, but all you'd really have to do is replace the while and then you'd be set. I would assume eval prevention is to make sure people write safe JSON parsing code. I've seen this used in a couple other places, too, but a lot more so with Google (Mail, Calendar, Contacts, etc.) Strangely enough, Google Docs starts with &&&START&&& instead, and Google Contacts seems to start with while(1); &&&START&&&. Does anyone know what's going on here?

    Read the article

  • SEO dynamic / AJAX pages

    - by Andrew
    I have a very dynamic / ajax powered website which also includes iframes and due this reason I have a very bad SEO rank and it come in my mind to make one more additional version of the site (text based / no script) and serve it to the search engines based on the user agent . Please let me know if you think that is a feasible method and if it's not what else would you recommend me to do .. I don't want to loose any fancy ajax feature but I also need to keep the website on the google map :) thank you in advance for any answer ! btw the website is developed in asp.net c# .

    Read the article

  • "'Objects' may not respond to 'functions'" warnings.

    - by Andrew
    Hello all, for the last couple of weeks I've finally gotten into Obj-C from regular C and have started my first app. I've watched tutorials and read through a book along with a lot of webpages, but I know I've only just begun. Anyway, for most of the night and this morning, I've been trying to get this code to work, and now that it will compile, I have a few warnings. I've searched and found similar problems with solutions, but still no dice. What I'm trying to do is put an array made from a txt document into the popup list in a combo box. AwesomeBoxList.h: #import <Cocoa/Cocoa.h> @interface AwesomeBoxList : NSObject { IBOutlet NSComboBox *ComboBoz; } -(NSArray *) getStringzFromTxtz; - (void) awesomeBoxList; @end AwesomeBoxList.m: #import "AwesomeBoxList.h" @implementation AwesomeBoxList -(NSArray *)getStringzFromTxtz { ... return combind; } - (void) awesomeBoxList { [ComboBoz setUsesDataSource:YES]; [ComboBoz setDataSource: [ComboBoz getStringzFromTxtz]: //'NSComboBox' may not respond to 'getStringzFromTxtz' [ComboBoz comboBox:(NSComboBox *)ComboBoz objectValueForItemAtIndex: [ComboBoz numberOfItemsInComboBox:(NSComboBox *)ComboBoz]]]; /*'NSComboBox' may not respond to '-numberOfItemsInComboBox:' 'NSComboBox' may not respond to '-comboBox:objectValueForItemAtIndex:' 'NSComboBox' may not respond to '-setDataSource:' */ } @end So, with all of these errors and my still shallow knowledge of Obj-C, I must be making some sort of n00b mistake. Thanks for the help.

    Read the article

  • OpenGL 3.3 different colours with fragment shader [solved]

    - by Andrew Seymour
    I'm an OpenGL newbie. I'm trying to colour 3 circles but only 3 white circles are appearing. n is 3 in this example. Each vertice has 5 points, 2 for position and 3 for color Here is where I think a problem may lie: glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void*)0 ); glEnableVertexAttribArray(1); glVertexAttribPointer( 1, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void*)(2*sizeof(float)) ); glDrawElements(GL_TRIANGLES, 20 * 3 * n, GL_UNSIGNED_INT, 0); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); My shaders: #version 330 core in vec3 Color; out vec4 outColor; void main() { outColor = vec4(Color, 1.0); } #version 330 core layout(location = 0) in vec2 position; layout(location = 1) in vec3 color out vec3 Color void main(){ gl_Position = vec4(position, 0.0, 1.0); Color = color; } Thanks for taking a look Andy EDIT: layout(location = 1) in vec3 color out vec3 Color layout(location = 1) in vec3 color; out vec3 Color;

    Read the article

  • Flash Displaying Weird Text in a Dynamic Text Field

    - by Andrew M
    I am working in Flash CS5 and I have placed a text field (dynamic, classic text) on the stage. I am accessing it through Actionscript on the same frame like this: var ct:TextField = TextField(getChildByName("Temperature")); ct.text = "Hello world"; What ACTUALLY appears is this: eo wor So... The H, Ls, and D are gone. Mysteriously. Without warning. I am sitting here utterly confused. Is this just me? PS. The text field is set to Myriad Pro Bold, a font on my computer, so it isn't like it's a font problem.

    Read the article

  • Help with create action in a different show page

    - by Andrew
    Hi, I'm a Rails newbie and want to do something but keep messing something up. I'd love some help. I have a simple app that has three tables. Users, Robots, and Recipients. Robots belong_to users and Recipients belong_to robots. On the robot show page, I want to be able to create recipients for that robot right within the robot show page. I have the following code in the robot show page which lists current recipients: <table> <% @robot.recipients.each do |recipient| %> <tr> <td><b><%=h recipient.chat_screen_name %></b> via <%=h recipient.protocol_name</td> <td><%= link_to 'Edit', edit_recipient_path(recipient) %>&nbsp;</td> <td><%= link_to 'Delete', recipient, :confirm => 'Are you sure?', :method => :delete %></td> </tr> <% end %> </table> What I'd like to do is have an empty field in which the user can add a new recipient, and have tried the following: I added this to the Robots Show view: <% form_for(@robot.recipient) do |f| %> Enter the screen name<br> <%= f.text_field :chat_screen_name %> <p> <%= f.submit 'Update' %> </p> <% end %> and then this to the Robot controller in the show action: @recipient = Recipient.new @recipients = Recipient.all Alas, I'm still getting a NoMethod error that says: "undefined method `recipient' for #" I'm not sure what I'm missing. Any help would be greatly appreciated. Thank you.

    Read the article

  • How to Inserting message into View that depends on session value. ASP.NET MVC. Best practice

    - by Andrew Florko
    User have to populate multistep questionnaire web-forms and step messages depend on the option chosen by user at the very beginning. Messages are stored in web.config file. I use asp.net mvc project, strong typed views and keep business logic separated from controller in static class. I don't want to make business logic dependency on web.config. Well, I have to insert message into view that depends on session value. There are at least 2 options how to implement this: View model has property that is populated in controller/businessLogic and rendered in view like <%: Model.HelpMessage1 %>. I have to pass web.config values from controller to businessLogic that makes business logic methods signature too complex. I don't want to make configuration source abstract (in order to let business logic read configuration values from its methods directly) also. Create static helper class that is called from view like <%: ViewHelper.HelpMessage1(Model.Option1) %>. But in this case logic what to show seems to be separated into two classes: business logic & viewHelper. What will you suggest? Thank you in advance!

    Read the article

  • Why is an anonymous inner class containing nothing generated from this code?

    - by Andrew Westberg
    When run through javac on the cmd line Sun JVM 1.6.0_20, this code produces 6 .class files OuterClass.class OuterClass$1.class OuterClass$InnerClass.class OuterClass$InnerClass2.class OuterClass$InnerClass$InnerInnerClass.class OuterClass$PrivateInnerClass.class When run through JDT in eclipse, it produces only 5 classes. OuterClass.class OuterClass$1.class OuterClass$InnerClass.class OuterClass$InnerClass2.class OuterClass$InnerClass$InnerInnerClass.class OuterClass$PrivateInnerClass.class When decompiled, OuterClass$1.class contains nothing. Where is this extra class coming from and why is it created? package com.test; public class OuterClass { public class InnerClass { public class InnerInnerClass { } } public class InnerClass2 { } //this class should not exist in OuterClass after dummifying private class PrivateInnerClass { private String getString() { return "hello PrivateInnerClass"; } } public String getStringFromPrivateInner() { return new PrivateInnerClass().getString(); } }

    Read the article

  • How do I programmatically run all the JUnit tests in my Java application?

    - by Andrew McKinlay
    From Eclipse I can easily run all the JUnit tests in my application. I would like to be able to run the tests on target systems from the application jar, without Eclipse (or Ant or Maven or any other development tool). I can see how to run a specific test or suite from the command line. I could manually create a suite listing all the tests in my application, but that seems error prone - I'm sure at some point I'll create a test and forget to add it to the suite. The Eclipse JUnit plugin has a wizard to create a test suite, but for some reason it doesn't "see" my test classes. It may be looking for JUnit 3 tests, not JUnit 4 annotated tests. I could write a tool that would automatically create the suite by scanning the source files. Or I could write code so the application would scan it's own jar file for tests (either by naming convention or by looking for the @Test annotation). It seems like there should be an easier way. What am I missing?

    Read the article

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