Search Results

Search found 2613 results on 105 pages for 'undefined'.

Page 14/105 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • PHP & MySQL - Undefined variable problem?

    - by TaG
    I keep getting the following error Undefined variable: password on line 33 how do I correct this problem? So this error will stop showing. Here is the php code. $first_name = mysqli_real_escape_string($mysqli, $purifier->purify(htmlentities(strip_tags($_POST['first_name'])))); $password1 = mysqli_real_escape_string($mysqli, $purifier->purify(strip_tags($_POST['password1']))); $password2 = mysqli_real_escape_string($mysqli, $purifier->purify(strip_tags($_POST['password2']))); // Check for a password and match against the confirmed password: if ($password1 == $password2) { $sha512 = hash('sha512', $password1); $password = mysqli_real_escape_string($mysqli, $sha512); } else { echo '<p class="error">Your password did not match the confirmed password!</p>'; } //If the table is not found add it to the database if (mysqli_num_rows($dbc) == 0) { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"INSERT INTO users (user_id, first_name, password) VALUES ('$user_id', '$first_name', '$password')"); } //If the table is in the database update each field when needed if ($dbc == TRUE) { $dbc = mysqli_query($mysqli,"UPDATE users SET first_name = '$first_name', password = '$password' WHERE user_id = '$user_id'"); echo '<p class="changes-saved">Your changes have been saved!</p>'; }

    Read the article

  • undefined method `code' for nil:NilClass message with rails and a legacy database

    - by Jude Osborn
    I'm setting up a very simple rails 3 application to view data in a legacy MySQL database. The legacy database is mostly rails ORM compatible, except that foreign key fields are pluralized. For example, my "orders" table has a foreign key field to the "companies" table called "companies_id" (rather than "company_id"). So naturally I'm having to use the ":foreign_key" attribute of "belongs_to" to set the field name manually. I haven't used rails in a few years, but I'm pretty sure I'm doing everything right, yet I get the following error when trying to access "order.currency.code": undefined method `code' for nil:NilClass This is a very simple application so far. The only thing I've done is generate the application and a bunch of scaffolds for each of the legacy database tables. Then I've gone into some of the models to make adjustments to accommodate the above mentioned difference in database naming conventions, and added some fields to the views. That's it. No funny business. So my database tables look like this (relevant fields only): orders ------ id description invoice_number currencies_id currencies ---------- id code description My Order model looks like this: class Order < ActiveRecord::Base belongs_to :currency, :foreign_key=>'currencies_id' end My Currency model looks like this: class Currency < ActiveRecord::Base has_many :orders end The relevant view snippet looks like this: <% @orders.each do |order| %> <tr> <td><%= order.description %></td> <td><%= order.invoice_number %></td> <td><%= order.currency.code %></td> </tr> <% end %> I'm completely out of ideas. Any suggestions?

    Read the article

  • PHP - Undefined index error

    - by user1815290
    This is my form with a file input field named "photo": <form action = "spremi-film.php" method = "POST" enctype = "multipart/form-data"> <div class="grid_2">Naslov:</div> <div class="grid_10"><input type="text" name="naslov" value="" /></div> <div class="grid_2">Žanr: </div> <div class="grid_10"><?php izborZanra(); ?></div> <div class="grid_2">Godina: </div> <div class="grid_10"><?php izborGodine(); ?></div> <div class="grid_2">Trajanje:</div> <div class="grid_10"><input type="text" name="trajanje" value="" /></div> <div class="grid_2">Izbor slike:</div> <!--<input type="hidden" name="MAX_FILE_SIZE" value="30000" />--> <div class="grid_10"><input type="file" name="photo" /></div> <div class="grid_12"><input type="submit" value="SPREMI" /></div> </form> After that i put this code: $uploaddir = '/slike'; $uploadfile = $uploaddir . basename($_FILES['photo']['name']); //echo '<pre>'; if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) { echo 'Slika je uspješno spremljena!'; } else { echo 'Slika nije spremljena!'; } //print_r($_FILES); //echo '</pre>'; When i run this i have an undefined index: photo notice in my browser. Help, please.

    Read the article

  • Undefined method 'size' for #<File:text.txt> (NoMethodError)

    - by user1354456
    This is the code I am running, it does fine until I get to line 15. The command I run is: ruby ex16.rb text.txt. This is a practice sample I'm writing which is meant to be a simple little text editor: filename = ARGV.first script = $0 puts "We're going to erase #{filename}." puts "if you don't want that, hit CTRL-C (^C)." puts "If you do want that, hit RETURN." print "? " STDIN.gets puts "Opening the file..." target = File.open(filename, 'w') puts "Truncating the file. Goodbye!" target.truncate(target.size) puts "Now I'm going to ask you for three lines." print "line 1: "; line1 = STDIN.gets.chomp() print "line 2: "; line2 = STDIN.gets.chomp() print "line 3: "; line3 = STDIN.gets.chomp()undefined method 'size' puts "I'm going to write these to the file." target.write(line1) target.write("\n") target.write(line2) target.write("\n") target.write(line3) target.write("\n") puts "And finally, we close it." target.close()

    Read the article

  • Needing forward declaration in Ruby

    - by dbarbosa
    Hi, I am trying to write a Ruby script in one file. I would like to know if it is possible to write the "main" function in the beginning, having the other functions that are used by main, defined after it. In other words, I would like to call a not yet defined function, so that they do not depends on definition order. Just changing the order is not possible because it gives an "undefined method" error. In C/C++ we use forward declarations... is there something similar in Ruby or another solution to this?

    Read the article

  • Is it safe to catch an access violation in this scenario?

    - by Eloff
    I've read a lot, including here on SO that suggests this is a very bad idea in general and that the only thing you can do safely is exit the program. I'm not sure that this is true. This is for a pooling memory allocator that hands off large allocations to malloc. During pool_free() a pointer needs to be checked it it belongs to a pool or was allocated with malloc. By rounding the address down to the nearest 1MB boundary, I get a pointer to the beginning of a block of memory in the pool, or undefined if malloc was used. In the first case I can easily verify that the block of memory belongs to the pool, but, if it does not I will either fail this verification, or I will get an access violation (note that this is a read-only process). Could I not catch this with SEH (Windows) or handle the signal (POSIX) and simply treat it as a failed verification? (i.e. this is only possible if malloc was used, so pass the ptr to free())

    Read the article

  • What wording in the C++ standard allows static_cast<non-void-type*>(malloc(N)); to work?

    - by ben
    As far as I understand the wording in 5.2.9 Static cast, the only time the result of a void*-to-object-pointer conversion is allowed is when the void* was a result of the inverse conversion in the first place. Throughout the standard there is a bunch of references to the representation of a pointer, and the representation of a void pointer being the same as that of a char pointer, and so on, but it never seems to explicitly say that casting an arbitrary void pointer yields a pointer to the same location in memory, with a different type, much like type-punning is undefined where not punning back to an object's actual type. So while malloc clearly returns the address of suitable memory and so on, there does not seem to be any way to actually make use of it, portably, as far as I have seen.

    Read the article

  • How do you set a double value to a "non-value"

    - by Ankur
    I have two double data elements in an object. Sometimes they are set with a proper value and sometimes not. When the form field from which they values are received is not filled I want to set them to some value that tells me, during the rest of the code that the form fields were left empty. I can't set the values to null as that gives an error, is there some way I can make them 'Undefined'. PS. Not only am I not sure that this is possible, it might not also make sense. But if there is some best practice for such a situation I would be keen to hear it.

    Read the article

  • AS3 function running before variables are defined!

    - by Jeffrey
    I am trying to add an init() function to a MovieClip, but when I run the function from scene1 the variables that were set in the MovieClip are not defined yet... The MovieClip was dragged to the stage from the library. scene1: mc.init(null); MovieClip: var _default = 5; function init(num) { if(num == null) { trace(_default); } else { trace(num); } } This is tracing "undefined" instead of "5"; Is there a way of fixing this problem?

    Read the article

  • Is it legal for a C++ reference to be NULL?

    - by BCS
    A while back I ran into a bug the looked something like this: void fn(int &i) { printf(&i == NULL ? "NULL\n" : "!NULL\n"); } int main() { int i; int *ip = NULL; fn(i); // prints !NULL fn(*ip); // prints NULL return 0; } More recently, I ran into this comment about C++ references: [References arguments make] it clear, unlike with pointers, that NULL is not a possible value. But, as show above, NULL is a possible value. So where is the error? In the language spec? (Unlikely.) Is the compiler in error for allowing that? Is that coding guide in error (or a little ambiguous)? Or am I just wandering into the minefield known as undefined behavior?

    Read the article

  • i get error when i try to upload a file?

    - by getaway
    I keep getting an error:Notice: Undefined index: on line 35 line 35: $handle = new Upload($_FILES['my_field']); this is my input field <input type="file" size="32" name="my_field" value="" /> I do not understand this error, thanks!!! EDIT: <form name="upload" id="upload" enctype="multipart/form-data" method="post" action="actions/upload.php" /> <p><input type="file" size="32" name="my_field" value="" /></p> <p class="button"><input type="hidden" name="action" value="image" /> <br> <input style="margin-left:224px;" type="submit" name="submit" value="upload" />

    Read the article

  • Common reasons for the &lsquo;Sys is undefined&rsquo; error in ASP.NET Ajax applications

      In this blog I will try to summarize the most common reasons for getting the famous 'Sys is undefined' error when running an Ajax enabled web site or application (there are almost one milion results on Google for that phrase). Where does it come from? In every Ajax web pages source you will see a code like this: <script type="text/javascript"> //<![CDATA[ Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1')); Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90); //]]> </script>   This is the initialization script of the ScriptManager. So, if for some reason the Sys namespace is not available when the code executes you get the Sys is undefined error. Here are the most common reasons and solutions for that problem:   1. The error occurs when you have added a control from RadControls for ASP.NET AJAX, but your application is not configured to use ASP.NET AJAX. For example, in VS 2005 you created a new Blank Site instead of a new Ajax-Enabled Web Site and the Sys is undefined message pops up. To fix it you need to follow the steps described at Configuring ASP.NET Ajax article (check the topic called Adding ASP.NET AJAX Configuration Elements to an Existing Web Site) or simply create the Ajax-Enabled Web Site. You can also check my other blog post on the matter: Visual Studio 2008: Where is the new ASP.NET Ajax-Enabled Web Site template?   2. Authentication - as the website denies access to all pages to unauthorized users, access to the Telerik.Web.UI.WebResource.axd handler is unauthorized (this is the default handler of RadScriptManager). This causes the handler to serve the content of the login page instead of the combined scripts, hence the error. To solve it - add a <location> section to the application configuration file to allow access to Telerik.Web.UI.WebResource.axd to all users, like: <configuration> ... <location path="Telerik.Web.UI.WebResource.axd"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> ... </configuration>   Note that the access to the standard ScriptResource.axd and WebResource.axd is automatically allowed for all users (authenticated and unauthenticated), so if you use the ScriptManager instead of RadScriptManager - you will not face this problem. The authentication problem does not manifest when you disable script combining or use the CDN. Adding the above configuration section will make it work with RadScriptManagers combined script.   3. The IE6 browser fails to load the compressed script. The problem does not appear in any other browser. There is a well known bug in the older versions of IE6 which lose the first 2,048 bytes of data that are sent back from a Web server that uses HTTP compression. Latest versions of RadScriptManager does not compress the output at all if the client is IE6, but in the previous versions you need to manually disable the output compression to prevent the error. So, if you get the Sys is undefined error in IE6 - update to the latest version of RadControls or simply disable the output compression.   4. Requests to the *.axd files returns Error Code 404 - Not Found. This could  be fixed easily: Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed:     Also check if the Verify if file exists checkbox is unchecked (click on the Edit button appearing in the previous screenshot to check). More information can be found in our troubleshooting article and from the ASP.NET QA team blog post   5. The virtual directory in IIS is not marked as Web Application. Converting it to Web Application should fix the problem.   6. Check for the <xhtmlConformance mode="Legacy"/> option in your web.config and remove it. It would be rather rare to become a victim of this exact case, but still have it in mind. Scott Guthrie describes it in more details   In the above points I mentioned several times the terms web resources, javascript output, compressed script. If you want to find out more about these please see the Web Resources Demystified series of my friend and colleague Atanas Korchev   I hope that one of the above solutions will help you get rid of the Sys is undefined error.   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

  • GWT Javascript Exception in Hosted Mode: Result of expression 'doc.getBoxObjectFor' [undefined] is

    - by holmes
    Anyone ever seen this exception? I'm running in hosted mode on GWT 1.6.4 on a mac. I'm using the AutoSuggest and it's throwing this exception trying to show the popup. It works fine in compiled mode, but obviously hosted mode is rather important. [ERROR] Uncaught exception escaped com.google.gwt.core.client.JavaScriptException: (TypeError): Result of expression 'doc.getBoxObjectFor' [undefined] is not a function. line: 71 sourceId: 1152617088 sourceURL: jar:file:/Users/holmes/.m2/repository/com/google/gwt/gwt-user/1.6.4/gwt-user-1.6.4.jar!/com/google/gwt/dom/client/DOMImplMozillaOld.java expressionBeginOffset: 288 expressionCaretOffset: 307 expressionEndOffset: 313 at com.google.gwt.dom.client.DOMImplMozillaOld.getAbsoluteLeftImpl(Native Method) at com.google.gwt.dom.client.DOMImplMozillaOld.getAbsoluteLeft(DOMImplMozillaOld.java:29) at com.google.gwt.dom.client.Element$.getAbsoluteLeft$(Element.java:86) at com.google.gwt.user.client.DOM.getAbsoluteLeft(DOM.java:646) at com.google.gwt.user.client.ui.UIObject.getAbsoluteLeft(UIObject.java:487) at com.google.gwt.user.client.ui.PopupPanel.position(PopupPanel.java:1015) at com.google.gwt.user.client.ui.PopupPanel.access$5(PopupPanel.java:958) at com.google.gwt.user.client.ui.PopupPanel$1.setPosition(PopupPanel.java:811) at com.google.gwt.user.client.ui.PopupPanel.setPopupPositionAndShow(PopupPanel.java:700) at com.google.gwt.user.client.ui.PopupPanel.showRelativeTo(PopupPanel.java:809) at com.google.gwt.user.client.ui.SuggestBox.showSuggestions(SuggestBox.java:768) at com.google.gwt.user.client.ui.SuggestBox.access$3(SuggestBox.java:738) at com.google.gwt.user.client.ui.SuggestBox$1.onSuggestionsReady(SuggestBox.java:281) at com.google.gwt.user.client.ui.MultiWordSuggestOracle.requestSuggestions(MultiWordSuggestOracle.java:225) at com.google.gwt.user.client.ui.SuggestBox.showSuggestions(SuggestBox.java:640) at com.google.gwt.user.client.ui.SuggestBox.refreshSuggestions(SuggestBox.java:713) at com.google.gwt.user.client.ui.SuggestBox.access$6(SuggestBox.java:705) at com.google.gwt.user.client.ui.SuggestBox$1TextBoxEvents.onKeyUp(SuggestBox.java:678) at com.google.gwt.event.dom.client.KeyUpEvent.dispatch(KeyUpEvent.java:54) at com.google.gwt.event.dom.client.KeyUpEvent.dispatch(KeyUpEvent.java:1) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52) at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116) at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90) at com.google.gwt.user.client.ui.TextBoxBase.onBrowserEvent(TextBoxBase.java:193) at com.google.gwt.user.client.ui.Composite.onBrowserEvent(Composite.java:54) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320) at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)

    Read the article

  • undefined reference to `main' collect2: ld returned 1 exit status

    - by sobingt
    I am working on this QT project and i am making test cases for my project. Here is a small test case #include <QApplication> #include <QPalette> #include <QPixmap> #include <QSplashScreen> #include <qthread.h> #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> #include <boost/make_shared.hpp> # include <boost/thread.hpp> #include "MainWindow.h" namespace { const std::string dbname = "Project.db"; struct SongFixture { SongFixture(const std::string &fixturePath) { // Create the Master file Master::creator(); // Create/open file std::pair<int, SQLiteDbPtr> result = open( dbname, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (result.first != SQLITE_OK) { throw SQLiteError(result.first, sqlite3_errmsg(result.second.get())); } SQLiteDbPtr &spDb = result.second; // Execute all the SQL from the fixture file execSQLFromFile(spDb, fixturePath); } }; std::auto_ptr<SongFixture> pf; } class I : public QThread { public: static void sleep(unsigned long secs) { QThread::sleep(secs); } }; void free_test_function() { BOOST_CHECK(true ); } test_suite* init_unit_test_suite(int argc, char *argv[]) { // Create a fixture for the peer: // Manage fixture creation manually instead of using // BOOST_FIXTURE_TEST_CASE because the fixture depends on runtime args. std::ostringstream fixturePathSS; fixturePathSS << PROJECT_DIR << "/test/songs_fixture.sql"; std::string fixturePath = fixturePathSS.str(); pf.reset(new SongFixture(fixturePath)); QApplication app(argc, argv); MainWindow window("artists"); window.show(); framework::master_test_suite().add( BOOST_TEST_CASE( &free_test_function )); return app.exec(); } Well i am getting any error /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference tomain' collect2: ld returned 1 exit status pls help me you have a lead..thankz I tired adding #define BOOST_TEST_MAIN then i get ../test/UI/main.cpp: In function ‘boost::unit_test::test_suite* init_unit_test_suite(int, char**)’: ../test/UI/main.cpp:75:31: error: redefinition of ‘boost::unit_test::test_suite* init_unit_test_suite(int, char**)’ /usr/local/include/boost/test/unit_test_suite.hpp:223:1: error: ‘boost::unit_test::test_suite* init_unit_test_suite(int, char**)’ previously defined here Well the program is working in Windows but in Linux the above mention problem is observed

    Read the article

  • Form data sent to Node via Post is undefined

    - by user185812
    I know this has been asked countless times on here, however I tried all the solutions and am still having the issue. Most people say to set the content-type (which I did) and to name the inputs that I wish to Post to node. I have done both of these things, yet still get "undefined" when trying to send data from an HTML form to node. JADE Templating HTML Code (Sorry I can't seem to get the indenting to show up here, however I think I should leave the code intact when posting here instead of converting it to normal HTML so that if the error is in here, you are still able to help) Form(action="/registration", method="post", enctype="application/x-www-form-urlencoded") div(class="control-group-Username") label(class="control-group", for="username") Username: div.controls input#Username(id="Username", type="text", placeholder="Username Here", maxlength="23", name="username") //Other divs and stuff here button.btn#submit_button(type="submit") Submit app.js code /** * Module dependencies. */ express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path'); app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine','jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('your secret here')); app.use(express.session()); app.use(app.router); app.use(require('less-middleware')({ src: __dirname + '/public' })); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } app.use(express.static(__dirname + '/public')); app.get('/', routes.index); app.get('/users', user.list); app.get('/register', routes.register); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); }); require('./Register.js'); register.js code app.post('/registration', function(req, res) { var Email=req.body.username console.log(username); });

    Read the article

  • jquerymobile conflict with autocomplete : $this.attr("href") is undefined

    - by sweets-BlingBling
    When I use jquery ui autocomplete version 1.8.5 with jquery mobile alpha 2. I get an error when I click an item from the autocomplete list: $this.attr("href") is undefined. Does anyone know any fix for it? EDITED: <html> <head> <link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.8.custom.css"> <link rel="stylesheet" type="text/css" href="css/autocomplete.css"> </head> <body> <div id="formWrap"> <form id="messageForm" action="#"> <fieldset> <label id="toLabel">select:</label> <div id="friends" class="ui-helper-clearfix"> <input id="to" type="text"> </div> </fieldset> </form> </div> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery.mobile-1.0a2.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript"> $(function(){ var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; //attach autocomplete $("#to").autocomplete({ source:availableTags , //define select handler select: function(e, ui) { var contact = ui.item.value; createSpan(contact); $("#to").val("").css("top", 2); return false; } }); }); function createSpan(contact){ //create formatted friend span = $("<span>").text(contact) //add contact to contact div span.insertBefore("#to"); } </script> </body> </html>

    Read the article

  • More GCC link time issues: undefined reference to main

    - by vikramtheone
    Hi Guys, I'm writing software for a Cortex-A8 processor and I have to write some ARM assembly code to access specific registers. I'm making use of the gnu compilers and related tool chains, these tools are installed on the processor board(Freescale i.MX515) with Ubuntu. I make a connection to it from my host PC(Windows) using WinSCP and the PuTTY terminal. As usual I started with a simple C project having main.c and functions.s. I compile the main.c using GCC, assemble the functions.s using as and link the generated object files using once again GCC, but I get strange errors during this process. An important finding - Meanwhile, I found out that my assembly code may have some issues because when I individually assemble it using the command as -o functions.o functions.s and try running the generated functions.o using ./functions.o command, the bash shell is failing to recognize this file as an executable(on pressing tab functions.o is not getting selected/PuTTY is not highlighting the file). Can anyone suggest whats happening here? Are there any specific options I have to send, to GCC during the linking process? The errors I see are strange and beyond my understanding, I don't understand to what the GCC is referring. I'm pasting here the contents of main.c, functions.s, the Makefile and the list of errors. Help, please!!! Vikram main.c #include <stdio.h> #include <stdlib.h> int main(void) { puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ return EXIT_SUCCESS; } functions.s * Main program */ .equ STACK_TOP, 0x20000800 .text .global _start .syntax unified _start: .word STACK_TOP, start .type start, function start: movs r0, #10 movs r1, #0 .end Makefile all: hello hello: main.o functions.o gcc -o main.o functions.o main.o: main.c gcc -c -mcpu=cortex-a8 main.c functions.o: functions.s as -mcpu=cortex-a8 -o functions.o functions.s Errors ubuntu@ubuntu-desktop:~/Documents/Project/Others/helloworld$ make gcc -c -mcpu=cortex-a8 main.c as -mcpu=cortex-a8 -o functions.o functions.s gcc -o main.o functions.o functions.o: In function `_start': (.text+0x0): multiple definition of `_start' /usr/lib/gcc/arm-linux-gnueabi/4.3.3/../../../crt1.o:init.c:(.text+0x0): first defined here /usr/lib/gcc/arm-linux-gnueabi/4.3.3/../../../crt1.o: In function `_start': init.c:(.text+0x30): undefined reference to `main' collect2: ld returned 1 exit status make: *** [hello] Error 1

    Read the article

  • Uncaught TypeError: Cannot read property 'length' of undefined

    - by AnApprentice
    I'm working to built a contact list that is grouped by the first letter of the contact's last name. After a succesfull ajax request, the contact is pushed to addContact: Ajax success: ko.utils.arrayForEach(dataJS.contactList, function(c) { contactsModel.addContact(c); }); contactsModel.addContact: //add a contact in the right spot under the right letter contactsModel.addContact = function(newContact) { //grab first character var firstLetter = (newContact.lname || "").charAt(0).toUpperCase(); //if it is a number use # if (!isNaN(firstLetter)) { firstLetter = "#"; } //do we already have entries for this letter if (!this.letterIndex[firstLetter]) { //new object to track this letter's contacts var letterContacts = { letter: firstLetter, contacts: ko.observableArray([]) }; this.letterIndex[firstLetter] = letterContacts; //easy access to it //put the numbers at the end if (firstLetter === "#") { this.contactsByLetter.push(letterContacts); } else { //add the letter in the right spot for (var i = 0, lettersLength = this.contactsByLetter().length; i < lettersLength; i++) { var letter = this.contactsByLetter()[i].letter; if (letter === "#" || firstLetter < letter) { break; } } this.contactsByLetter.splice(i, 0, letterContacts); } } var contacts = this.letterIndex[firstLetter].contacts; //now we have a letter to add our contact to, but need to add it in the right spot var newContactName = newContact.lname + " " + newContact.fname; for (var j = 0, contactsLength = contacts().length; j < contactsLength; j++) { var contactName = contacts()[j].lName + " " + contacts()[j].fName; if (newContactName < contactName) { break; } } //add the contact at the right index contacts.splice(j, 0, newContact); }.bind(contactsModel); The contacts json object from the server looks like this: { "total_pages": 10, "page": page, "contactList": [{ "photo": "http://homepage.mac.com/millhouse/Family%20Tree/images/PersonListIcon.png", "lname": "Bond", "id": 241, "fname": "James", "email": "[email protected]"}, While this works in jsfiddle, when I try it locally, I get the following error during the first push to addContact: Uncaught TypeError: Cannot read property 'length' of undefined jQuery.jQuery.extend._Deferred.deferred.resolveWithjquery-1.5.1.js:869 donejquery-1.5.1.js:6591 jQuery.ajaxTransport.send.callbackjquery-1.5.1.js:7382 Ideas? Thanks

    Read the article

  • jQuery AJAX POST gives undefined index

    - by Sebastian
    My eventinfo.php is giving the following output: <br /> <b>Notice</b>: Undefined index: club in <b>/homepages/19/d361310357/htdocs/guestvibe/wp-content/themes/yasmin/guestvibe/eventinfo.php</b> on line <b>11</b><br /> [] HTML (index.php): <select name="club" class="dropdown" id="club"> <?php getClubs(); ?> </select> jQuery (index.php): <script type="text/javascript"> $(document).ready(function() { $.ajax({ type: "POST", url: "http://www.guestvibe.com/wp-content/themes/yasmin/guestvibe/eventinfo.php", data: $('#club').serialize(), success: function(data) { $('#rightbox_inside').html('<h2>' + $('#club').val() + '<span style="font-size: 14px"> (' + data[0].day + ')</h2><hr><p><b>Entry:</b> ' + data[0].entry + '</p><p><b>Queue jump:</b> ' + data[0].queuejump + '</p><br><p><i>Guestlist closes at ' + data[0].closing + '</i></p>'); }, dataType: "json" }); }); $('#club').change(function(event) { $.ajax({ type: "POST", url: "http://www.guestvibe.com/wp-content/themes/yasmin/guestvibe/eventinfo.php", data: $(this).serialize(), success: function(data) { $('#rightbox_inside').hide().html('<h2>' + $('#club').val() + '<span style="font-size: 14px"> (' + data[0].day + ')</h2><hr><p><b>Entry:</b> ' + data[0].entry + '</p><p><b>Queue jump:</b> ' + data[0].queuejump + '</p><br><p><i>Guestlist closes at ' + data[0].closing + '</i></p>').fadeIn('500'); }, dataType: "json" }); }); </script> I can run alerts from the jQuery, so it is active. I've copied this as is from an old version of the website, but I've changed the file structure (through to move to WordPress) so I suspect the variables might not even be reaching eventinfo.php in the first place... index.php is in wp-content/themes/cambridge and eventinfo.php is in wp-content/themes/yasmin/guestvibe but I've tried to avoid structuring issues by referencing the URL in full. Any ideas?

    Read the article

  • jQuery Validation Plugin: Packer undefined error?

    - by Rosarch
    I'm using the jQuery validation plugin from bassistance.de. It works fine. From <head>: <script type="text/javascript" src="/static/JQuery.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.validate.pack.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.validate.additional-methods.js"></script> At first, this was the only validation code I had, and it worked: $("form").validate(); $("#form-username").rules("add", { required: true, email: true, }); It was validating this HTML: <form id="form-username-form" action="api/user_of_email" method="get"> <p> <label for="form-username">Email:</label> <input type="text" name="email" id="form-username" /> <input type="submit" value="Submit" id="form-submit" /> </p> </form> Great, everything works. But then I add this JS: $("#form-choose-options input[type='text']").rules("add", { number: true, }); to validate this markup: <form id="form-choose-options" action="api/set_options" method="get"> <p> <label for="form-min-credits">Min credits per term:</label><input type="text" name="min_credits" id="form-min-credits" /> <br /> <label for="form-optimal-credits">Optimal credits per term:</label><input type="text" name="optimal_credits" id="form-optimal-credits" /> <br /> <label for="form-max-credits">Max credits per term:</label><input type="text" name="max_credits" id="form-max-credits" /> <br /> <label for="form-low-GPA">Lowest acceptable GPA:</label><input type="text" name="low_GPA" id="form-low-GPA" /> <br /> <label for="form-high-GPA">Highest realistic GPA:</label><input type="text" name="high_GPA" id="form-high-GPA" /> <br /> <input type="hidden" class="user-pk" name="pk"/> <input type="submit" value="Submit" /> </p> </form> This causes a javascript error on document load: $.data(f.form, "validator") is undefined The error is from the packer function. What am I doing wrong?

    Read the article

  • PHP & MySQL Undefined variable problem

    - by comma
    I keep getting the following error Undefined variable: id on line 91 can some one help me correct this problem? The error is on this line. $query2 = "INSERT INTO users_skills (skill_id, user_id, date_created) VALUES ('$id', '$user_id', NOW())"; MySQL database tables. CREATE TABLE tags ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill VARCHAR(255) NOT NULL, experience VARCHAR(255) NOT NULL, years VARCHAR(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE users_skills ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill_id INT UNSIGNED NOT NULL, user_id INT UNSIGNED NOT NULL, date_created DATETIME UNSIGNED NOT NULL, PRIMARY KEY (id) ); Here is the PHP & MySQL code. if (isset($_POST['info_submitted'])) { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT learned_skills.*, users_skills.* FROM learned_skills INNER JOIN users_skills ON learned_skills.id = users_skills.skill_id WHERE user_id='$user_id'"); if (!$dbc) { print mysqli_error($mysqli); return; } $user_id = '5'; $skill = $_POST['skill']; $experience = $_POST['experience']; $years = $_POST['years']; $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT learned_skills.*, users_skills.* FROM learned_skills INNER JOIN users_skills ON users_skills.skill_id = learned_skills.id WHERE users_skills.user_id='$user_id'"); if (mysqli_num_rows($dbc) == 0) { if (isset($_POST['skill']) && trim($_POST['skill'])!=='') { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $query1 = mysqli_query($mysqli,"INSERT INTO learned_skills (skill, experience, years) VALUES ('" . $skill . "', '" . $experience . "', '" . $years . "')"); if (mysqli_query($mysqli, $query1)) { print mysqli_error($mysqli); return; } $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT id FROM learned_skills WHERE id='" . $skill . "' AND experience='" . $experience . "' AND years='" . $years . "'"); if (!$dbc) { print mysqli_error($mysqli); } else { while($row = mysqli_fetch_array($dbc)){ $id = $row["id"]; } } $query2 = "INSERT INTO users_skills (skill_id, user_id, date_created) VALUES ('$id', '$user_id', NOW())"; } }

    Read the article

  • No Method Error Undefined method 'save' for nil:NilClass

    - by BennyB
    I'm getting this error when i try to create a "Lecture" via my Lecture controller's create method. This used to work but i went on to work on other parts of the app & then of course i come back & something is now throwing this error when a user tries to create a Lecture in my app. I'm sure its something small i'm just overlooking (been at it a while & probably need to take a break)...but I'd appreciate if someone could let me know why this is happening...let me know if i need to post anything else...thx! The error I get NoMethodError in LecturesController#create undefined method `save' for nil:NilClass Rails.root: /Users/name/Sites/rails_projects/app_name Application Trace | Framework Trace | Full Trace app/controllers/lectures_controller.rb:13:in `create' My view to create a new Lecture views/lectures/new.html.erb <% provide(:title, 'Start a Lecture') %> <div class="container"> <div class="content-wrapper"> <h1>Create a Lecture</h1> <div class="row"> <div class="span 6 offset3"> <%= form_for(@lecture) do |f| %> <%= render 'shared/error_messages', :object => f.object %> <div class="field"> <%= f.text_field :title, :placeholder => "What will this Lecture be named?" %> <%= f.text_area :content, :placeholder => "Describe this Lecture & what will be learned..." %> </div> <%= f.submit "Create this Lecture", :class => "btn btn-large btn-primary" %> <% end %> </div> </div> </div> </div> Then my controller where its saying the error is coming from controllers/lectures_controller.rb class LecturesController < ApplicationController before_filter :signed_in_user, :only => [:create, :destroy] before_filter :correct_user, :only => :destroy def index end def new @lecture = current_user.lectures.build if signed_in? end def create if @lecture.save flash[:success] = "Lecture created!" redirect_to @lecture else @activity_items = [ ] render 'new' end end def show @lecture = Lecture.find(params[:id]) end def destroy @lecture.destroy redirect_to root_path end private def correct_user @lecture = current_user.lectures.find_by_id(params[:id]) redirect_to root_path if @lecture.nil? end

    Read the article

  • Undefined template methods trick ?

    - by Matthieu M.
    A colleague of mine told me about a little piece of design he has used with his team that sent my mind boiling. It's a kind of traits class that they can specialize in an extremely decoupled way. I've had a hard time understanding how it could possibly work, and I am still unsure of the idea I have, so I thought I would ask for help here. We are talking g++ here, specifically the versions 3.4.2 and 4.3.2 (it seems to work with both). The idea is quite simple: 1- Define the interface // interface.h template <class T> struct Interface { void foo(); // the method is not implemented, it could not work if it was }; // // I do not think it is necessary // but they prefer free-standing methods with templates // because of the automatic argument deduction // template <class T> void foo(Interface<T>& interface) { interface.foo(); } 2- Define a class, and in the source file specialize the interface for this class (defining its methods) // special.h class Special {}; // special.cpp #include "interface.h" #include "special.h" // // Note that this specialization is not visible outside of this translation unit // template <> struct Interface<Special> { void foo() { std::cout << "Special" << std::endl; } }; 3- To use, it's simple too: // main.cpp #include "interface.h" class Special; // yes, it only costs a forward declaration // which helps much in term of dependencies int main(int argc, char* argv[]) { Interface<Special> special; foo(special); return 0; }; It's an undefined symbol if no translation unit defined a specialization of Interface for Special. Now, I would have thought this would require the export keyword, which to my knowledge has never been implemented in g++ (and only implemented once in a C++ compiler, with its authors advising anyone not to, given the time and effort it took them). I suspect it's got something to do with the linker resolving the templates methods... Do you have ever met anything like this before ? Does it conform to the standard or do you think it's a fortunate coincidence it works ? I must admit I am quite puzzled by the construct...

    Read the article

  • SignalR cannot read property client of undefined

    - by polonskyg
    I'm trying to add SignalR to my project (ASPNET MVC 4). But I can't make it work. In the below image you can see the error I'm receiving. I've read a lot of stackoverflow posts but none of them is resolving my issue. This is what I did so far: 1) Ran Install-Package Microsoft.AspNet.SignalR -Pre 2) Added RouteTable.Routes.MapHubs(); in Global.asax.cs Application_Start() 3) If I go to http://localhost:9096/Gdp.IServer.Web/signalr/hubs I can see the file content 4) Added <modules runAllManagedModulesForAllRequests="true"/> to Web.Config 5) Created folder Hubs in the root of the MVC application 6) Moved jquery and signalR scripts to /Scripts/lib folder (I'm not using jquery 1.6.4, I'm using the latest) This is my Index.cshtml <h2>List of Messages</h2> <div class="container"> <input type="text" id="message" /> <input type="button" id="sendmessage" value="Send" /> <input type="hidden" id="displayname" /> <ul id="discussion"> </ul> </div> @section pageScripts { <!--Reference the SignalR library. --> <script src="@Url.Content("~/Scripts/jquery.signalR-1.0.0-rc1.min.js")" type="text/javascript"></script> <!--Reference the autogenerated SignalR hub script. --> <script type="text/javascript" src="~/signalr/hubs"></script> <script src="@Url.Content("~/Scripts/map.js")" type="text/javascript"></script> } This is my IServerHub.cs file (located inside Hubs folder) namespace Gdp.IServer.Ui.Web.Hubs { using Microsoft.AspNet.SignalR.Hubs; [HubName("iServerHub")] public class IServerHub : Hub { public void Send(string name, string message) { Clients.All.broadcastMessage(name, message); } } } And this is map.js $(function () { // Declare a proxy to reference the hub. var clientServerHub = $.connection.iServerHub; // Create a function that the hub can call to broadcast messages. clientServerHub.client.broadcastMessage = function (name, message) { $('#discussion').append('<li><strong>' + name + '</strong>:&nbsp;&nbsp;' + message + '</li>'); }; // Get the user name and store it to prepend to messages. $('#displayname').val(prompt('Enter your name:', '')); // Set initial focus to message input box. $('#message').focus(); // Start the connection. $.connection.hub.start().done(function () { $('#sendmessage').click(function () { // Html encode display name and message. var encodedName = $('<div />').text($('#displayname').val()).html(); var encodedMsg = $('<div />').text($('#message').val()).html(); // Call the Send method on the hub. clientServerHub.server.send(encodedName, encodedMsg); // Clear text box and reset focus for next comment. $('#message').val('').focus(); }); }); }); The DLL's I see references for SignalR are: Microsoft.AspNet.SignalR.Core Microsoft.AspNet.SignalR.Owin Microsoft.AspNet.SignalR.SystemWeb Any ideas how to get it work? Should I make any change because the scripts are in /Script/lib folder? NOTE I'm following the instruction found here on how to set up Windsor Castle to make it work with SignalR, and again, seems that the proxy cannot be created and I'm getting the same error: Cannot read property client of undefined meaning that the proxy to the hub was not created This is how I have it in the server public class IncidentServerHub : Hub and like this in the client var clientServerHub = $.connection.incidentServerHub; Again, I can see the dynamically created file here: /GdpSoftware.Server.Web/signalr/hubs So, Why the proxy is not created? Thanks in advance!!! Guillermo.

    Read the article

  • 'undefined method init for Mysql:Class'

    - by sscirrus
    I've been having problems with a MySQL Server installation that got messed up after a power outage. Configuration Intel i5 Mac running OS X 10.6.5 Ruby 1.9.2 installed Rails 3.0.1 installed MySQL Server (finally) installed and running I completely reinstalled MySQL, which deleted the local development/test/production databases. So, I have run create database development; in MySQL to get the dev database ready for a migration. Current Goal Run rake db:migrate to get my databases back again. (I cannot currently access my databases or Mysql at all from Rails.) Error Using the gem 'mysql', '2.8.1' and run rake db:migrate, I get the error: rake aborted! undefined method 'init' for Mysql:Class Stack Trace: /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:30:in 'mysql_connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in 'new_connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:238:in 'checkout_new_connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:194:in 'block (2 levels) in checkout' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in 'loop' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in 'block in checkout' /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in 'mon_synchronize' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:189:in 'checkout' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in 'connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:318:in 'retrieve_connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in 'retrieve_connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in 'connection' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/migration.rb:486:in 'initialize' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in 'new' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in 'up' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/migration.rb:415:in 'migrate' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/railties/databases.rake:142:in 'block (2 levels) in <top (required)>' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in 'call' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in 'block in execute' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in 'each' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in 'execute' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:597:in 'block in invoke_with_call_chain' /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in 'mon_synchronize' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:590:in 'invoke_with_call_chain' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:583:in 'invoke' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2051:in 'invoke_task' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in 'block (2 levels) in top_level' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in 'each' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in 'block in top_level' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in 'standard_exception_handling' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2023:in 'top_level' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2001:in 'block in run' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in 'standard_exception_handling' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:1998:in 'run' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/bin/rake:31:in '<top (required)>' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in 'load' /Users/sscirrus/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in '<main>'

    Read the article

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