Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 159/191 | < Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >

  • Facebook Connect iPhone StreamDialog delegate dialogDidSucceed

    - by JohnPayne
    Hey. I use FBStreamDialog to let users publish on their news feed. [fbStreamDialog show]; makes the dialog view popup, the user can press cancel or submit that message. Now...my problem is that both buttons close the dialog view and call the delegate method dialogDidSucceed. How do I find out which button was pressed? Its very important for me to know, any useful advice would be reaally really nice! Thanks, John

    Read the article

  • Parse Credit Card input from Magnetic Stripe

    - by rockinthesixstring
    Does anyone know how to parse a credit card string input from a Magnetic Card Swiper? I tried a JavaScript parser but never got it to work. This is what the input looks like. %BNNNNNNNNNNNNNNNN^DOE/JOHN ^1210201901000101000100061000000?;NNNNNNNNNNNNNNNN=12102019010106111001? The N's are the credit card number.

    Read the article

  • Issues with Rails 3.1 API with Query String to Create action on Mac OSX Mountain Lion

    - by hjaved
    Hi I've been stuck on this problem for a while and would appreciate your help. I'm writing an API to allow an external source like a Browser Query String or a smartphone to enter some model User info in a form and hit the User create action to write the data to the db. Please tell me what I'm doing wrong with the code below. I've also observed that if I have code like @user = User.new(params[:user]), that this approach only works when a user enters their data within the form. And that if I have code such as @user = User.new( name: params[:name], location: params[:location], password = params[:password], email: params[:email]), that this code ONLY works for a Query string entry, but NOT both Query string AND regular form submission. Why is that and how can I write the code above in the Users Controller Create action, so that it takes care of both situations? URL used: localhost:3000/users/create?name=John&&[email protected]&&password=secret&&location=SanFrancisco&date=06122012 The date is of type string but it doesn't show up in the database. Why? Everything else does. UsersController.rb def create @user = User.new(params[:user]) if @user.save session[:uid] = @user.id redirect_to thanks_path, notice: "Welcome #{@user.name}!" else redirect_to root_path end end New User Form: <%=u.text_field :name, placeholder: "Name"%><br> <%=u.text_field :email, placeholder: "Email"%><br> <%=u.password_field :password, placeholder: "Password"%><br> <%=u.text_field :location, placeholder: "City"%><br> <%=u.text_field :date, placeholder: "Date"%><br> <%if params[:partner_id]%> <%=u.hidden_field :partner_id, value: params[:partner_id]%> <%end%> <button class="btn btn-large btn-primary">Enter</button> I also tried to create a separate method called remotecreate for User creation for something other than a regular web form. I entered remotecreate in the Query string but it didn't work. def remotecreate @user = User.create(name: params[:name], email: params[:email], password: params[:password], location: params[:location], date: params[:date]) if @user.save session[:uid] = @user.id redirect_to thanks_path, notice: "Welcome #{@user.name}" else redirect_to root_path end end Thanks!

    Read the article

  • select similar values from mysql database

    - by mathew
    Hi I have several data s in MySQL database. In my table there is a column called rank. what I want is when some one enter a rank say 25 then the result should display names on similar(+ or -) ranks LIMIT to 10 from table. example mathew - 25 john - 26 joe - 25 stewart - 27 kelly - 24 brandon -23 magy - 22 .......etc. Thanks Mathew

    Read the article

  • What to do when you need more verbs in REST

    - by Richard Levasseur
    There is another similar question to mine, but the discussion veered away from the problem I'm encounting. Say I have a system that deals with expense reports (ER). You can create and edit them, add attachments, and approve/reject them. An expense report might look like this: GET /er/1 => {"title": "Trip to NY", "totalcost": "400 USD", "comments": [ "john: Please add the total cost", "mike: done, can you approve it now?" ], "approvals": [ {"john": "Pending"}, {"finance-group": "Pending"}] } That looks fine, right? Thats what an expense report document looks like. If you want to update it, you can do this: POST /er/1 {"title": "Trip to NY 2010"} If you want to approve it, you can do this: POST /er/1/approval {"approved": true} But, what if you want to update the report and approve it at the same time? How do we do that? If you only wanted to approve, then doing a POST to something like /er/1/approval makes sense. We could put a flag in the URL, POST /er/1?approve=1, and send the data changes as the body, but that flag doesn't seem RESTful. We could put special field to be submitted, too, but that seems a bit hacky, too. If we did that, then why not send up data with attributes like set_title or add_to_cost? We could create a new resource for updating and approving, but (1) I can't think of how to name it without verbs, and (2) it doesn't seem right to name a resource based on what actions can be done to it (what happens if we add more actions?) We could have an X-Approve: True|False header, but headers seem like the wrong tool for the job. It'd also be difficult to get set headers without using javascript in a browser. We could use a custom media-type, application/approve+yes, but that seems no better than creating a new resource. We could create a temporary "batch operations" url, /er/1/batch/A. The client then sends multiple requests, perhaps POST /er/1/batch/A to update, then POST /er/1/batch/A/approval to approve, then POST /er/1/batch/A/status to end the batch. On the backend, the server queues up all the batch requests somewhere, then processes them in the same backend-transaction when it receives the "end batch processing" request. The downside with this is, obviously, that it introduces a lot of complexity. So, what is a good, general way to solve the problem of performing multiple actions in a single request? General because its easy to imagine additional actions that might be done in the same request: Suppress or send notifications (to email, chat, another system, whatever) Override some validation (maximum cost, names of dinner attendees) Trigger backend workflow that doesn't have a representation in the document.

    Read the article

  • Returning PHP Multi-Dimension Array to Javascript/AJAX

    - by GregH
    My understanding is that in order to return a complex PHP variable to Javascript, it should be done via AJAX and json_encode. Could somebody give me an actual example (both PHP and Javascript code) of this? Lets say we have the two-dim array in PHP: $twoDArr = array( array('Greg', 44, 'Owner'), array('Joe', 23, 'Renter'), array('Susan', 39, 'Owner'), array('John', 32, 'Renter) ); How would we return this to an analogous two dimensional array in javascript using json_encode?

    Read the article

  • Piping a bash variable into awk and storing the output

    - by Andrew Smith
    Hello, To illustrate my problem, TEST="Hi my name is John" OUTP=`echo $TEST | awk '{print $3}'` echo $OUTP What I would expect this to do is pass the $TEST variable into awk and store the 3rd word into $OUTP. Instead I get "Hi: not found", as if it is expecting the input to be a file. If I pass just a string instead of a variable, however, there is no problem. What would be the best way to approach this? Thanks all!

    Read the article

  • Rails Joins and include columns from joins table

    - by seth.vargo
    I don't understand how to get the columns I want from rails. I have two models - A User and a Profile. A User :has_many Profile (because users can revert back to an earlier version of their profile): > DESCRIBE users; +----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | username | varchar(255) | NO | UNI | NULL | | | password | varchar(255) | NO | | NULL | | | last_login | datetime | YES | | NULL | | +----------------+--------------+------+-----+---------+----------------+   > DESCRIBE profiles; +----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | user_id | int(11) | NO | MUL | NULL | | | first_name | varchar(255) | NO | | NULL | | | last_name | varchar(255) | NO | | NULL | | | . . . . . . | | . . . . . . | | . . . . . . | +----------------+--------------+------+-----+---------+----------------+ In SQL, I can run the query: > SELECT * FROM profiles JOIN users ON profiles.user_id = users.id LIMIT 1; +----+-----------+----------+---------------------+---------+---------------+-----+ | id | username | password | last_login | user_id | first_name | ... | +----+-----------+----------+---------------------+---------+---------------+-----+ | 1 | john | ****** | 2010-12-30 18:04:28 | 1 | John | ... | +----+-----------+----------+---------------------+---------+---------------+-----+ See how I get all the columns for BOTH tables JOINED together? However, when I run this same query in Rails, I don't get all the columns I want - I only get those from Profile: # in rails console >> p = Profile.joins(:user).limit(1) >> [#<Profile ...>] >> p.first_name >> NoMethodError: undefined method `first_name' for #<ActiveRecord::Relation:0x102b521d0> from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.1/lib/active_record/relation.rb:373:in `method_missing' from (irb):8 # I do NOT want to do this (AKA I do NOT want to use "includes") >> p.user >> NoMethodError: undefined method `user' for #<ActiveRecord::Relation:0x102b521d0> from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.1/lib/active_record/relation.rb:373:in method_missing' from (irb):9 I want to (efficiently) return an object that has all the properties of Profile and User together. I don't want to :include the user because it doesn't make sense. The user should always be part of the most recent profile as if they were fields within the Profile model. How do I accomplish this?

    Read the article

  • Structs, strtok, segmentation fault

    - by FILIaS
    I'm trying to make a programme with structs and files.The following is just a part of my code(it;s not all). What i'm trying to do is: ask the user to write his command. eg. delete John eg. enter John James 5000 ipad purchase. The problem is that I want to split the command in order to save its 'args' for a struct element. That's why i used strtok. BUT I'm facing another problem in who to 'put' these on the struct. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 100 char command[1500]; struct catalogue { char short_name[50]; char surname[50]; signed int amount; char description[1000]; }*catalog[MAX]; int main ( int argc, char *argv[] ) { int i,n; char choice[3]; printf(">sort1: Print savings sorted by surname\n"); printf(">sort2: Print savings sorted by amount\n"); printf(">search+name:Print savings of each name searched\n"); printf(">delete+full_name+amount: Erase saving\n"); printf(">enter+full_name+amount+description: Enter saving \n"); printf(">quit: Update + EXIT program.\n"); printf("Choose your selection:\n>"); gets(command); //it save the whole command /*in choice it;s saved only the first 2 letters(needed for menu choice again)*/ strncpy(choice,command,2); choice[2]='\0'; char** args = (char**)malloc(strlen(command)*sizeof(char*)); memset(args, 0, sizeof(char*)*strlen(command)); char* curToken = strtok(command, " \t"); for (n = 0; curToken != NULL; ++n) { args[n] = strdup(curToken); curToken = strtok(NULL, " \t"); *catalog[n]->short_name=*args[1]; *catalog[n]->surname=args[2]; catalog[n]->amount=atoi(args[3]); *catalog[n]->description=args[4]; } return 0; } I get a warning (warning: assignment makes integer from pointer without a cast) for the lines: *catalog[n]->short_name=*args[1]; *catalog[n]->surname=args[2]; *catalog[n]->description=args[4]; As a result, after running the program i get a Segmentation Fault... Any help? Any ideas?

    Read the article

  • Object Literals In Java?

    - by jjacquay712
    I am learning GWT for web development and came across a piece of code I can't really understand. helloBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("Hello!"); } }); If someone could explain to me what it is doing that would be great. Thanks, John

    Read the article

  • ASP NET MVC (loading data from database)

    - by rah.deex
    hi experts, its me again... i have some code like this.. using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MvcGridSample.Models { public class CustomerService { private List<SVC> Customers { get { List<SVC> customers; if (HttpContext.Current.Session["Customers"] != null) { customers = (List<SVC>) HttpContext.Current.Session["Customers"]; } else { //Create customer data store and save in session customers = new List<SVC>(); InitCustomerData(customers); HttpContext.Current.Session["Customers"] = customers; } return customers; } } public SVC GetByID(int customerID) { return this.Customers.AsQueryable().First(customer => customer.seq_ == customerID); } public IQueryable<SVC> GetQueryable() { return this.Customers.AsQueryable(); } public void Add(SVC customer) { this.Customers.Add(customer); } public void Update(SVC customer) { } public void Delete(int customerID) { this.Customers.RemoveAll(customer => customer.seq_ == customerID); } private void InitCustomerData(List<SVC> customers) { customers.Add(new SVC { ID = 1, FirstName = "John", LastName = "Doe", Phone = "1111111111", Email = "[email protected]", OrdersPlaced = 5, DateOfLastOrder = DateTime.Parse("5/3/2007") }); customers.Add(new SVC { ID = 2, FirstName = "Jane", LastName = "Doe", Phone = "2222222222", Email = "[email protected]", OrdersPlaced = 3, DateOfLastOrder = DateTime.Parse("4/5/2008") }); customers.Add(new SVC { ID = 3, FirstName = "John", LastName = "Smith", Phone = "3333333333", Email = "[email protected]", OrdersPlaced = 25, DateOfLastOrder = DateTime.Parse("4/5/2000") }); customers.Add(new SVC { ID = 4, FirstName = "Eddie", LastName = "Murphy", Phone = "4444444444", Email = "[email protected]", OrdersPlaced = 1, DateOfLastOrder = DateTime.Parse("4/5/2003") }); customers.Add(new SVC { ID = 5, FirstName = "Ziggie", LastName = "Ziggler", Phone = null, Email = "[email protected]", OrdersPlaced = 0, DateOfLastOrder = null }); customers.Add(new SVC { ID = 6, FirstName = "Michael", LastName = "J", Phone = "666666666", Email = "[email protected]", OrdersPlaced = 5, DateOfLastOrder = DateTime.Parse("12/3/2007") }); } } } those codes is an example that i've got from the internet.. in that case, the data is created and saved in session before its shown.. the things that i want to ask is how if i want to load the data from table? i'am a newbie here.. please help :) thank b4 for advance..

    Read the article

  • How to create a dynamic width column in Twitter Bootstrap

    - by Elad
    How do you use Twitter Bootstrap to create a table-like list structure, where some columns take as much space as required to accommodate the widest element of that column, and a single column takes the remaining space? For example Id |Name |Email address 100001|Joe |[email protected] 100 |Christine|[email protected] 1001 |John |[email protected] the Id column takes just enough space to accommodate the 100001 id which is the longest id, and the Name column takes just enough space to accommodate the name Christine. The Email column takes the remaining space.

    Read the article

  • Form Closing event

    - by johnm01
    Hi all, I have a smartdevice project targeting windows mobile 6. In the top right corner is an X (provided by the controlbox). i have an event on the form_closing that i was hoping would fire when the cross is clicked. But it doesnt :-( Does anyone know why this event is not firing ??? Thanks :-) John

    Read the article

  • Separate groups of people based on members

    - by tevch
    I have groups of people. I need to move groups with at least one same member as far as possible from each other. Example: GroupA - John, Bob, Nick GroupB - Jack, Nick GroupC - Brian, Alex, Steve As you can see GroupA and GroupB overlap(they both contain Nick) I need an algorithm to set groups as GroupA-GroupC-GroupB Thank you

    Read the article

  • extjs filter editor

    - by hazimdikenli
    Hi, does extJS have any kind of visual filtering tool for its grids. there are three sample criterias in the next line which are added by the user, and an x button to remove the criteria. Sample Filter: [Business Unit=Accounting-x] [Name like 'Jo*'-x] [Age between 25-33-x] Personnel Grid (displaying the filtered data) 1 33 Josh Accounting 2 35 John Accounting

    Read the article

  • Proper binding data to combobox and handling its events.

    - by Wodzu
    Hi guys. I have a table in SQL Server which looks like this: ID Code Name Surname 1 MS Mike Smith 2 JD John Doe 3 UP Unknown Person and so on... Now I want to bind the data from this table into the ComboBox in a way that in the ComboBox I have displayed value from the Code column. I am doing the binding in this way: SqlDataAdapter sqlAdapter = new SqlDataAdapter("SELECT * FROM dbo.Users ORDER BY Code", MainConnection); sqlAdapter.Fill(dsUsers, "Users"); cbxUsers.DataSource = dsUsers.Tables["Users"]; cmUsers = (CurrencyManager)cbxUsers.BindingContext[dsUsers.Tables["Users"]]; cbxUsers.DisplayMember = "Code"; And this code seems to work. I can scroll through the list of Codes. Also I can start to write code by hand and ComboBox will autocomplete the code for me. However, I wanted to put a label at the top of the combobox to display Name and Surname of the currently selected user code. My line of though was like that: "So, I need to find an event which will fire up after the change of code in combobox and in that event I will get the current DataRow..." I was browsing through the events of combobox, tried many of them but without a success. For example: private void cbxUsers_SelectionChangeCommitted(object sender, EventArgs e) { if (cmUsers != null) { DataRowView drvCurrentRowView = (DataRowView)cmUsers.Current; DataRow drCurrentRow = drvCurrentRowView.Row; lblNameSurname.Text = Convert.ToString(drCurrentRow["Name"]) + " " + Convert.ToString(drCurrentRow["Surname"]); } } This give me a strange results. Firstly when I scroll via mouse scroll it doesn't return me the row wich I am expecting to obtain. For example on JD it shows me "Mike Smith", on MS it shows me "John Doe" and on UP it shows me "Mike Smith" again! The other problem is that when I start to type in ComboBox and press enter it doesn't trigger the event. However, everything works as expected when I bind data to lblNameSurname.Text in this way: lblNameSurname.DataBindings.Add("Text", dsusers.Tables["Users"], "Name"); The problem here is that I can bind only one column and I want to have two. I don't want to use two labels for it (one to display name and other to display surname). So, what is the solution to my problem? Also, I have one question related to the data selection in ComboBox. Now, when I type something in the combobox it allows me to type letters that are not existing in the list. For example, I start to type "J" and instead of finishing with "D" so I would have "JD", I type "Jsomerandomtexthere". Combobox will allow that but such item does not exists on the list. In other words, I want combobox to prevent user from typing code which is not on the list of codes. Thanks in advance for your time.

    Read the article

  • Ruby: Is there a way to split a string only with the first x occurrencies?

    - by zxcvbnm
    For example, suppose I have this: 001, "john doe", "male", 37, "programmer", "likes dogs, women, and is lazy" The problem is that the line is only supposed to have 6 fields. But if I separate it with split I get more, due to the comma being used improperly to separate the fields. Right now I'm splitting everything, then when I get to the 5-th index onward I concatenate all the strings. But I was wondering if there was a split(",",6) or something along these lines.

    Read the article

  • MySQL - Order results by relevancy, LEFT JOINS and more

    - by XaviEsteve
    Hi guys, I am trying to get some results ordered by total votes (where client votes count 2 points and other people votes are 1 point). tab_names: +-----------+ | Name | id | +------+----+ | John | 1 | | Paul | 2 | +------+----+ tab_votes: +--------+-----------+ | idname | ip | +--------+-----------+ | 2 | 127.0.0.1 | | 2 | 127.0.0.1 | | 2 | 82.23.5.1 | | 1 | 127.0.0.1 | +--------+-----------+ This is the MySQL query I've got but doesn't work: SELECT * COUNT(v.idname) AS totalvotes, (SELECT COUNT(v.ip) FROM tab_votes WHERE v.ip LIKE '$ip') AS uservotes FROM tab_names n LEFT JOIN tab_votes v ON n.id = v.idname GROUP BY n.name ORDER BY uservotes DESC, totalvotes DESC LIMIT 40

    Read the article

< Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >