Search Results

Search found 250 results on 10 pages for 'isaac moore'.

Page 8/10 | < Previous Page | 4 5 6 7 8 9 10  | Next Page >

  • Creating an AJAX Form for a Polymorphic Object in Rails

    - by Isaac Yerushalmi
    I am trying to create an AJAX form for a polymorphic associated model. I created "Comments" which have a polymorphic association with all objects you can comment on (i.e. user profiles, organization profiles, events, etc). I can currently add comments to objects using a form created by: form_for [@commentable, @comment] do |f| I am trying to make this form via Ajax but I keep getting errors. I've tried at least ten different pieces of code, using remote_form_tag, remote_form_for, etc..with all different options, and nothing works. The comment does not get inserted into the database. Can anyone please tell me how I can make the above form ajax-enabled?

    Read the article

  • mysql_affected_rows() returns 0 for UPDATE statement even when an update actually happens

    - by Alex Moore
    I am trying to get the number of rows affected in a simple mysql update query. However, when I run this code below, PHP's mysql_affected_rows() always equals 0. No matter if foo=1 already (in which case the function should correctly return 0, since no rows were changed), or if foo currently equals some other integer (in which case the function should return 1). $updateQuery = "UPDATE myTable SET foo=1 WHERE bar=2"; mysql_query($updateQuery); if (mysql_affected_rows() > 0) { echo "affected!"; } else { echo "not affected"; // always prints not affected } The UPDATE statement itself works. The INT gets changed in my database. I have also double-checked that the database connection isn't being closed beforehand or anything funky. Keep in mind, mysql_affected_rows doesn't necessarily require you to pass a connection link identifier, though I've tried that too. Details on the function: mysql_affected_rows Any ideas? SOLUTION The part I didn't mention turned out to be the cause of my woes here. This PHP file was being called ten times consecutively in an AJAX call, though I was only looking at the value returned on the last call, ie. a big fat 0. My apologies!

    Read the article

  • Declaring an array of character pointers (arg passing)

    - by Isaac Copper
    This is something that should be easy to answer, but is more difficult for me to find a particular right answer on Google or in K&R. I could totally be overlooking this, too, and if so please set me straight! The pertinent code is below: int main(){ char tokens[100][100]; char str = "This is my string"; tokenize(str, tokens); for(int i = 0; i < 100; i++){ printf("%s is a token\n", token[i]); } } void tokenize(char *str, char tokens[][]){ //do stuff with string and tokens, putting //chars into the token array like so: tokens[i][j] = <A CHAR> } So I realize that I can't have char tokens[][] in my tokenize function, but if I put in char **tokens instead, I get a compiler warning. Also, when I try to put a char into my char array with tokens[i][j] = <A CHAR>, I segfault. Where am I going wrong? (And in how many ways... and how can I fix it?) Thanks so much!

    Read the article

  • How to avoid nested functions when using AJAX?

    - by Fletcher Moore
    Sequential Asynchronous calls are gross. Is there a more readable solution? The problem is this is hard to follow: ajaxOne(function() { // do something ajaxTwo(function() { // do something ajaxThree() }); }); where the anonymous functions are callbacks that are called on server response. I'm using a third party API to make the AJAX calls, so I need a generic solution.

    Read the article

  • vbsript and excel delete all worksheets except last one

    - by matthew moore
    I am trying to delete all worksheet in excel exept last one and save it then move its location. I can not get it took work as it deletes all other worksheets but errors out with and out of range error. Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.DisplayAlerts = False Set objWorkbook = objExcel.Workbooks.Open("C:\M-tek 10-31-12_Tony.xlsx") i = objWorkbook.Worksheets.Count Do while i = i i = i - 1 objWorkbook.Worksheets(i).Delete Loop

    Read the article

  • How can I make this cookie persistent? (Classic ASP)

    - by Isaac Levin
    Hello, I am maintaining a classic asp website that uses cookies throughout. We have had some issues where users are losing these cookies after they close the browser. I have verified in IE and Firefox that the cookie expires when the session does. The issue is that I have a extent the life of the cookie with the following Response.Cookies("foocookie").Expires = dateadd("d",1,now) What am I doing wrong? All I want this cookie to do is be persistent. Any help would be great. Thanks

    Read the article

  • Is there any difference between var name = function() {} & function name() {} in Javascript?

    - by Fletcher Moore
    Suppose we are inside a function and not in the global namespace. function someGlobalFunction() { var utilFunction1 = function() { } function utilFunction2 () { } utilFunction1(); utilFunction2(); } Are these synonymous? And do these functions completely cease to exist when someGlobalFunction returns? Should I prefer one or the other for readability or some other reason?

    Read the article

  • Time fields in Rails coming back blank

    - by Isaac Cambron
    I have a simple Rails 3.b1 (Ruby 1.9.1) application running on Sqlite3. I have this table: create_table :time_tests do |t| t.time :time end And I see this behavior: irb(main):001:0> tt = TimeTest.new => #<TimeTest id: nil, time: nil> irb(main):002:0> tt.time = Time.zone.now => Mon, 03 May 2010 20:13:21 UTC +00:00 irb(main):003:0> tt.save => true irb(main):004:0> TimeTest.find(:first) => #<TimeTest id: 1, time: "2000-01-01 20:13:21"> So, the time is coming back blank. Checking the table, the data looks OK: sqlite> select * from time_tests; 1|2010-05-03 20:13:21.774741 I guess it's on the retrieval part? What's going on here?

    Read the article

  • Generic object load function for scala

    - by Isaac Oates
    I'm starting on a Scala application which uses Hibernate (JPA) on the back end. In order to load an object, I use this line of code: val addr = s.load(classOf[Address], addr_id).asInstanceOf[Address]; Needless to say, that's a little painful. I wrote a helper class which looks like this: import org.hibernate.Session class DataLoader(s: Session) { def loadAddress(id: Long): Address = { return s.load(classOf[Address], id).asInstanceOf[Address]; } ... } So, now I can do this: val dl = new DataLoader(s) val addr = dl loadAddress(addr_id) Here's the question: How do I write a generic parametrized method which can load any object using this same pattern? i.e val addr = dl load[Address](addr_id) (or something along those lines.) I'm new to Scala so please forgive anything here that's especially hideous.

    Read the article

  • can't create partial objects with accepts_nested_attributes_for

    - by Isaac Cambron
    I'm trying to build a form that allows users to update some records. They can't update every field, though, so I'm going to do some explicit processing (in the controller for now) to update the model vis-a-vis the form. Here's how I'm trying to do it: Family model: class Family < ActiveRecord::Base has_many :people, dependent: :destroy accepts_nested_attributes_for :people, allow_destroy: true, reject_if: ->(p){p[:name].blank?} end In the controller def check edited_family = Family.new(params[:family]) #compare to the one we have in the db #update each person as needed/allowed #save it end Form: = form_for current_family, url: check_rsvp_path, method: :post do |f| = f.fields_for :people do |person_fields| - if person_fields.object.user_editable = person_fields.text_field :name, class: "person-label" - else %p.person-label= person_fields.object.name The problem is, I guess, that Family.new(params[:family]) tries to pull the people out of the database, and I get this: ActiveRecord::RecordNotFound in RsvpsController#check Couldn't find Person with ID=7 for Family with ID= That's, I guess, because I'm not adding a field for family id to the nested form, which I suppose I could do, but I don't actually need it to load anything from the database for this anyway, so I'd rather not. I could also hack around this by just digging through the params hash myself for the data I need, but that doesn't feel a slick. It seems nicest to just create an object out of the params hash and then work with it. Is there a better way? How can I just create the nested object?

    Read the article

  • Routing algorithm

    - by isaac
    Hello, I'm giving a presentation about computer routing and I want to make a good analogy with a real-world situation. However, I could not find it. Do you have in mind any of the situations like the computer routing. If yes, could you please provide me with it

    Read the article

  • How early can I call kalloc in an arm linux kernel?

    - by Isaac Sutherland
    I would like to dynamically allocate memory from the machine_init function in my arm linux kernel. Calling kalloc can result in a complete failure of the system to boot. My debugging tools are very limited so I can't give much more information regarding the failure. Simply put, is it legal to call kalloc from a machine_init function in arm linux, and, if not, is there an alternative?

    Read the article

  • Android onFling not responding

    - by Kevin Moore
    I am new to android first of all so think of any newbie mistakes first I am trying to add a fling function in my code. public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback, OnGestureListener { private MainThread thread; private Droid droid; private Droid droid2; private static final String TAG = gameView.class.getSimpleName(); private GestureDetector gestureScanner; public MainGamePanel(Context context){ super(context); getHolder().addCallback(this); droid = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 270, 300); droid2 = new Droid(BitmapFactory.decodeResource(getResources(), R.drawable.playerbox2), 50, 300); thread = new MainThread(getHolder(), this); setFocusable(true); gestureScanner = new GestureDetector(this); } public boolean onTouchEvent(MotionEvent event){ return gestureScanner.onTouchEvent(event); } @Override protected void onDraw(Canvas canvas){ canvas.drawColor(Color.BLACK); droid.draw(canvas); droid2.draw(canvas); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { droid.setX(50); droid.setY(50); Log.d(TAG, "Coords: x=" + e1.getX() + ",y=" + e2.getY()); return true; } @Override public boolean onDown(MotionEvent e) { droid2.setX((int)e.getX()); droid2.setY((int)e.getY()); Log.d(TAG, "Coords: x=" + e.getX() + ",y=" + e.getY()); return false; } I got the gestureListener to work with: onDown, onLongPress, and onShowPress. But i can't get any response with onFling, onSingleTapUp, and onScroll. What mistake am I making? does it have to do with views? I don't know what code would be useful to see.... so any suggestions would be much appreciated. Thank You!

    Read the article

  • Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)

    - by AKE
    The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing): "Use comments sparingly. Programs are self-documenting, with a modicum of help from mnemonics. Comments should say WHAT the program is doing, not HOW." My question: Should comments say WHY the program is doing what it is doing? Update: In addition to the answers below, these two provide additional insight. Beginner's guide to writing comments? http://programmers.stackexchange.com/a/98609/62203

    Read the article

  • "Half of everything you know will be obsolete in 18-24 months" = ( True, or False? )

    - by blunders
    Just ran across this, and wondering if anyone has a way to prove or disprove this statement: Something to keep in mind ... what's the half-life of knowledge in high tech? It tracks with Moore's Law: half of everything you know will be obsolete in 18-24 months. SOURCE: Within answer by Craig Trader to this question "What is the single most effective thing you did to improve your programming skills?"

    Read the article

  • Aligning music notes using String matching algorithms or Dynamic Programming

    - by Dolphin
    Hi I need to compare 2 sets of musical pieces (i.e. a playing-taken in MIDI format-note details extracted and saved in a database table, against sheet music-taken into XML format). When evaluating playing against sheet music (i.e.note details-pitch, duration, rhythm), note alignment needs to be done - to identify missed/extra/incorrect/swapped notes that from the reference (sheet music) notes. I have like 1800-2500 notes in one piece approx (can even be more-with polyphonic, right now I'm doing for monophonic). So will I have to have all these into an array? Will it be memory overloading or stack overflow? There are string matching algorithms like KMP, Boyce-Moore. But note alignment can also be done through Dynamic Programming. How can I use Dynamic Programming to approach this? What are the available algorithms? Is it about approximate string matching? Which approach is much productive? String matching algos like Boyce-Moore, or dynamic programming? How can I assess which is more effective? Greatly appreciate any insight or suggestions Thanks in advance

    Read the article

  • The only constant is change

    Isaac Asimov was once quoted as saying The only constant is change. That has certainly been true of my time with the DotNetNuke project. Over the last seven years of working on the DotNetNuke project and working at DotNetNuke Corporation I have held a number of different roles within the organization. I have defined and coded major product features, built and managed the DotNetNuke Marketplace, managed the release process, managed both OpenForce Conferences, oversaw the QA function, and created...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • need to print 5 column list in alpha order, vertically

    - by Brad
    Have a webpage that will be viewed by mainly IE users, so CSS3 is out of the question. I want it to list like: A D G B E H C F I Here is the function that currently lists like: A B C D E F G H I function listPhoneExtensions($group,$group_title) { $adldap = new adLDAP(); $group_membership = $adldap->group_members(strtoupper($group),FALSE); sort($group_membership); print " <a name=\"".strtolower($group_title)."\"></a> <h2>".$group_title."</h2> <ul class=\"phone-extensions\">"; foreach ($group_membership as $i => $username) { $userinfo = $adldap->user_info($username, array("givenname","sn","telephonenumber")); $displayname = "<span class=\"name\">".substr($userinfo[0]["sn"][0],0,9).", ".substr($userinfo[0]["givenname"][0],0,9)."</span><span class=\"ext\">".$userinfo[0]["telephonenumber"][0]."</span>"; if($userinfo[0]["sn"][0] != "" && $userinfo[0]["givenname"][0] != "" && $userinfo[0]["telephonenumber"][0] != "") { print "<li>".$displayname."</li>"; } } print "</ul><p class=\"clear-both\"><a href=\"#top\" class=\"link-to-top\">&uarr; top</a></p>"; } Example rendered html: <ul class="phone-extensions"> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> </ul> Any help is appreciated to getting it to list alpha vertically.

    Read the article

  • Google I/O 2012 - Maps for Good

    Google I/O 2012 - Maps for Good Rebecca Moore, Dave Thau Developers are behind many cutting-edge map applications that make the world a better place. In this session we'll show you how developers are using Google Earth Builder, Google Earth Engine, Google Maps API and Android apps for applications as diverse as ethno-mapping of indigenous cultural sites, monitoring deforestation of the Amazon and tracking endangered species migrations around the globe. Come learn about how you can partner with a non-profit to apply for a 2012 Developer Grant and make a positive impact with your maps. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 739 7 ratings Time: 54:23 More in Science & Technology

    Read the article

  • Dartisans Ep. 7 - Dart news and special guests

    Dartisans Ep. 7 - Dart news and special guests In this episode of Dartisans, we talk to Kevin Moore and Bob Nystrom about the latest language changes as Dart heads to M1. We'll also chat about Dart's package manager and Kevin's proposed package structure. If we're lucky, we'll get a sneak peek at the Seattle Dart Hackathon (on July 14th) and Bob's Dart talk at OSCON. Learn more at www.dartlang.org From: GoogleDevelopers Views: 211 12 ratings Time: 42:04 More in Science & Technology

    Read the article

  • Verizon Business Delivers New Sales and Support Tools

    - by michael.seback
    Verizon Business Delivers New Sales and Support Tools and Improves System Performance by 35% Verizon Business, a unit of Verizon Communications, is a global leader in communications and IT solutions. With one of the world's most connected internet protocol networks, Verizon Business delivers communications, IT, security, and network solutions to many of the largest businesses and governments. ..."Our work with Accenture to upgrade our Oracle systems has improved system performance significantly. In a recent survey, 84% of users said performance was 'faster' or 'much faster.' Plus, our sales and support staff have new tools to improve productivity and customer service, which ultimately drives customer retention and revenue." - Rob Moore, Director Verizon Business ...Read more.

    Read the article

< Previous Page | 4 5 6 7 8 9 10  | Next Page >