Daily Archives

Articles indexed Monday May 24 2010

Page 12/108 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Cast into new Object, Copy values by Property Name

    - by Alex
    Hello, I have the following: Class 1 (Text, State, Level) Class 2 (Text, State, Level, Ident) Is there a way for me to cast an object of Class 2 into into Class 1, and not having to do the usual cast code (Text = c.Text, State = c.State etc.)? Possibly by identifying the property names of each class and copying the value over?

    Read the article

  • Git ignore file for vb.net projects

    - by John C
    Placing a vb.net project under git control in windows (was previously under VSS - long sad story of repository corruption, etc). How should I set up the ignore file? The exclusions I'm thinking of using are: *.exe *.pdb *.manifest *.xml *.log (is git case sensitive on windows? Should I exclude *.Log as well?) *.scc (I gather these were left over from VSS - maybe I should delete them?) Is this a sensible list? Should I be excluding directories?

    Read the article

  • Rails Functional Test Failing Due to Association

    - by Koby
    I have an accounts model that holds some basic account info (account name, website, etc). I then have a user model that has the following in the app/models/user.rb belongs_to :account I also have the following in my routes.rb map.resources :account, :has_many => [:users, :othermodel] the problem I'm facing is that the following test is failing: test "should create user" do assert_difference('User.count') do post :create, :user => { } #this is the line it's actually failing on end assert_redirected_to user_path(assigns(:user)) #it doesn't get here yet end The error it gives is "Can't find Account without ID" so I kind of understand WHY it's failing, because of the fact that it doesn't have the account object (or account_id as it were) to know under what account to create the user. I have tried variations of the following but I am completely lost: post :create, :user => { accounts(:one) } #I have the 'fixtures :accounts' syntax at the top of the test class post :create, [accounts(:one), :user] => { } post :create, :user => { accounts(:one), #other params for :user } and like I said, just about every variation I could think of. I can't find much documentation on doing this and this might be why people have moved to Factories for doing test data, but I want to understand things that come standard in Rails before moving onto other things. Can anyone help me get this working?

    Read the article

  • why is this dictionary line number count not working?

    - by jad
    i have this piece of code the last bit of the code starting from d = {} im trying to print the words with its line number located in the text but it is not working its only printing the words anyone know why ??? need help ASAP import sys import string text = [] infile = open(sys.argv[1], 'r').read() for punct in string.punctuation: infile = infile.replace(punct, "") text = infile.split() dict = open(sys.argv[2], 'r').read() dictset = [] dictset = dict.split() words = [] words = list(set(text) - set(dictset)) words = [text.lower() for text in words] words.sort() d = {} counter = 0 for lines in text: counter += 1 if word not in d: d[words] = [counter] else: d[words.append[counter] print(word, d)

    Read the article

  • RMagick transparent_color deprecated? What's the alternative?

    - by user315975
    I'm developing an app that does a fair amount of generating transparent pngs on the fly. These are used as overlays, to show areas of interest in a graphic, so they have to have transparent backgrounds. I am developing in Ruby on Rails, deploying on Heroku. What works fine in development is not working in production. I get this error when I call a drawing routine using RMagick: NotImplementedError (the `transparent_color=' method is not supported by ImageMagick 6.2.4): /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.17/lib/RMagick.rb:1691:in `transparent_color=' I'm using RMagick version 2.12.1 on the development machine, but I'm not exactly certain how to discover the version of ImageMagick that it's running, so I'm not sure if this is a case of my local code being behind or ahead. I'm hoping behind, because perhaps then there'll be a replacement for this call. Does anyone know what the fix is here? What's required to generate a transparent background, if not the call I'm using? I can't find this in the documentation: in fact, it was on a third-party site that I found mention of this capability.

    Read the article

  • JQuery UI question, how do you add variables into the dialog box

    $('.openDialog').click(function(event){ var width=$(this).attr('width'); var height=$(this).attr('height'); alert(width + ' ' + height); event.preventDefault(); $("#dialog").dialog({autoOpen: false, modal: true}); $('#dialog').dialog('option', 'width', width); $('#dialog').dialog('open'); $('#dialog p').load('http://pagetoload.com/page.html .content'); }); As you can see above i'm trying to open a dialog box with a passed in parameter of width and height, however when I try and pass in the value of width on this line: $('#dialog').dialog('option', 'width', width); it doesn't work, any ideas why or how to get around that? Thanks

    Read the article

  • MAMP & localhost email

    - by stef
    how does one go about getting email to work in a default MAMP installation? not sure if this is relevant but im trying to send emails from a codeigniter app and whatever protocol i use (mail, sendmail, or smtp), emails never arrive anyone?

    Read the article

  • SimpleModal bug when positioning HTML5 video

    - by Damon Morda
    I recently Simple Modal Test <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="jquery.simplemodal-1.3.5.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(function ($) { $('.simple-clicker').click(function (e) { $("#simple-container").modal(); }); }); </script> View preview Header Description of video

    Read the article

  • Problem updating a database field from my controller

    - by ben
    I have an update method in my users controller that I call from a HTTPService in Flex 4. The update method is as follows: def updateName @user = User.find_by_email(params[:email]) @user.name = params[:nameNew] render :nothing => true end This is console output: Processing UsersController#updateName (for 127.0.0.1 at 2010-05-24 14:12:49) [POST] Parameters: {"action"="updateName", "nameNew"="ben", "controller"="users", "email"="[email protected]"} User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."email" = '[email protected]') LIMIT 1 Completed in 20ms (View: 1, DB: 1) | 200 OK [http://localhost/users/updateName] But when I check my database, the name field is never updated. What am I doing wrong? Thanks for reading.

    Read the article

  • How to see a branch created in master

    - by richard
    Hi, I create a branch in my master repository (192.168.1.2). And in my other computer, I did '$ git pull --rebase ', I see Unpacking objects: 100% (16/16), done. From git+ssh://[email protected]/media/LINUXDATA/mozilla-1.9.1 62d004e..b291703 master -> origin/master * [new branch] improv -> origin/improv But when I do a 'git branch' in my local repository, I see only 1 branch and I did '$ git checkout improv ' $ git branch * master $ git checkout improv error: pathspec 'improv' did not match any file(s) known to git. Did you forget to 'git add'?

    Read the article

  • What is the best way to organize directories within a large grails application?

    - by egervari
    What is the best way to organize directories within a large grails application? In a typical Spring application, we'd have myproject/domain/ and myproject/web/controllers and myproject/services Since grails puts these artifacts in their own directories... and then just uses the same base project package for everything, what is the best practice? Use the same sub package name for domain objects, controllers, services too? Ken

    Read the article

  • ms-access: changing the link to a database

    - by every_answer_gets_a_point
    i have an ms-access database front end that connects to an access backend. i have changed the location of the backend and i need to be able to update the link to it. how do i do this? when i open the front end and try to see data, it says "the microsoft office access database engine cannot open or write to the file ......... "

    Read the article

  • error to send SMS

    - by deni
    i have a problem with that code.. i got a error when i execute CommSetting.comm.SendMessage(pdu); the error is Phone reports generic communication error or syntax error can u tell me how to solve my problem?? thx i develop with c#, VS 2008

    Read the article

  • Trying to install an old program on Windows XP and getting an error message

    - by computergeek
    Hello I'm trying to install an older application named headline.exe. I'm getting an error message saying the the program has to end and asking if I want to notify Microsoft. The event logs says "Faulting application _untitled.exe version 1.0.0.1591, faulting module flash6.ocx, version 6.0.88.0, fault address blah blah blah. I uninstalled flash and installed version 6 of Flash and nothing changed. Any thoughts? Thanks

    Read the article

  • Most efficient way to update attribute of one instance

    - by Begbie00
    Hi all - I'm creating an arbitrary number of instances (using for loops and ranges). At some event in the future, I need to change an attribute for only one of the instances. What's the best way to do this? Right now, I'm doing the following: 1) Manage the instances in a list. 2) Iterate through the list to find a key value. 3) Once I find the right object within the list (i.e. key value = value I'm looking for), change whatever attribute I need to change. for Instance within ListofInstances: if Instance.KeyValue == SearchValue: Instance.AttributeToChange = 10 This feels really inefficient: I'm basically iterating over the entire list of instances, even through I only need to change an attribute in one of them. Should I be storing the Instance references in a structure more suitable for random access (e.g. dictionary with KeyValue as the dictionary key?) Is a dictionary any more efficient in this case? Should I be using something else? Thanks, Mike

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >