venue_new "address" parameter, or "adress"? - eventbrite

Is the parameter spelled "adress" or "address"?
Here's the API doc: http://developer.eventbrite.com/doc/venues/venue_new/
Where it says:
address The venue adress (line 1).
I ask this question because I'm porting some code, and it looks like we have been using "adress" and from looking at various github repos, it looks like this is considered one of the "inconsistant" variable naming issues related to this API.
I know the misspelled parameter is working.
I want to use the API correctly if I can, and would like to use "address" and just want confirmation that the it will indeed work, and that "adress" only works to be backwards compatible.
Thanks in advance!

Great question!
I fixed the 'adress' spelling typo, but the older spelling of this input label is still allowed (in order to ensure backwords compatibility with existing apps).
We don't have any plans to drop support for the older, misspelled attribute name - but, if you are revisiting old code, it won't hurt to fix the typo on your end as well.
The change should help ensure that the venue object's schema / attribute names remain consistent on input and output.

Related

How to access a reddit post using redditkit in ruby?

I have a reddit post link here:
https://www.reddit.com/r/dankmemes/comments/6m5k0o/teehee/
I wish to access the data of this post throught the redditkit API.
http://www.rubydoc.info/gems/redditkit/
I have tried countless times and the docs don't make too much sense to me. Can someone help show how to do this through the ruby console? Or even an implementation of this in rails would be really helpful!
Looking at the #comment method on the gem, it takes a comment_full_name and performs a GET to api/info.json with that parameter as an id (seen by viewing the source for that method). If we look at the reddit api for api/info the id parameter is a full name for the object with a link to what a full name is.
Following that link, a full name for a comment is
Fullnames start with the type prefix for the object's type, followed by the thing's unique ID in base 36.
and
type prefixes
t1_ Comment
So now we know the comment_full_name should be t1_#{comment's unique id} which appears to be 6m5k0o. Here, I'm unsure if that's already base36 or if they want you to convert that into base36 before passing it. Without seeing what all you've tried, I would say
client = RedditKit::Client.new 'username', 'password'
client.comment("t1_6m5k0o")
and if that doesn't work
client.comment("t1_#{'6m5k0o' base36 encoded}")
For questions like this, it would be nice to see some of your code and what you tried/results they gave. For all I know, you've already tried this and have a reason it didn't work for you.
I would test this out for you, but I don't have a reddit account for the gem to sign in with, this is just my guess glancing at the documentation.

Grails, findBy don't work with national characters like 'å','ä','ö'

For instance, Supplier.findByName('Röde Orm') returns null even though this name exists in the field "SearchName" in table "Supplier".
Is this correct or do I have to do some reconfiguration of grails?
Well, now the problem disappeared. I don't know why I got the problem in the beginning but I know that the URLEncoder.encode was completely wrong to use here but I never thought about that and after doing some corrections in the database, still using varchar, things started to work but not until I removed the URLEncoder call.

How can I map/link/associate a UUID to a random hex number

Newbie here, wrapping my head 'round this stuff!
I'd like to use the hex number as my url (external identifier) and keep the uuid within the database for a ruby on rails application. Is this even possible?
Thanks a bunch
Many people advise you against it but, yes, it is possible. It will need some code for it, and the solution depends on which version of Rails you use and what you use for the database, which is why I'm going to answer in a generic way.
You will want to have two different fields for the model: one for the external hex representation and another one for a separate UUID. Then, you can use the hex string to find instances in your controller actions, for example.
Please take a look at the following (they don't seem to have the two fields but will point you to the right direction anyway):
Problems setting a custom primary key in a Rails 4 migration
Change Primary Key Issue Rails 4.0
http://www.speakingcode.com/2013/12/07/gracefully-using-custom-primary-keys-in-rails-4-routes-controllers-models-associations-and-migrations/
And a longer post of a similar thing to do: http://ruby-journal.com/how-to-override-default-primary-key-id-in-rails/
Also, the FriendlyId gem might do what you want.

Cant update table in using isset

I have a table called settings, when I would change or enter data into the form it did not change the data in the table. In addition on form an image upload file is not running, There may be the wrong code below.
(Solved by me)
Maybe someone can help me Related to this.
What you are doing here is tottaly in secure and your data can be hacked / manipulate really fast.
Why dont you use a framework like codeignighter there are about 100 easy frameworks that will help you manage database a lot easyer.
Are you sure that you are updating the wrond ID? where id = 1, seems to be not dynamic.
Please post your error http://www.w3schools.com/php/func_mysql_error.asp
I know it is not so related to your question, but you should see these light frameworks:
http://kohanaframework.org/
https://github.com/ElbertF/Swiftlet
http://ellislab.com/codeigniter
You're not checking the return status of of your query, so if it's not working you wouldn't know. Do this:
mysql_query("UPDATE settings SET site='$name',keywords='$keys',descrp='$desc',email='$email',fbpage='$fbpage',twitter='$twitter',gplus='$gplus',disclaimer='$disclaimer',template='$template' WHERE id=1")
or die(mysql_error());
Note: mysql_*() is deprecated: you shouldn't use it. Use mysqli_*() or PDO instead.
Also: You are susceptible to an SQL Injection attack. You should escape your input variables with mysql_real_escape_string() (or the equivalent if you switch to mysqli), or consider moving to prepared statements.

Why do some URLs contain both numeric id and name?

I am wondering why the link to profile looks like:
http://stackoverflow.com/users/ID/NAME
not simply:
http://stackoverflow.com/users/ID
or even better:
http://stackoverflow.com/users/NAME
Can there be couple users with the same name? Or can one user have many names?
All SO-URLs are of the form id/description where the ID is unique and the description is optional. So /users/12890/arne-burmeister is the same as /users/12890/huhu and /questions/420380/why-does-the-link-to-the-user-profile-have-both-id-and-name is the same as /questions/420380/foo. The retrieval just uses the ID, but it is much better for google ranking, when the user/question/what-ever-should-be-found occurs in the URL (also for humans this is much more descriptive ;-).
By the way, retrieval by ID is faster than by such a large text string. And of course, the URL remains valid if someone changes their user name or the question.
The part after the last slash seems to be SEO related (i.e. making the url more expressive).
On the urls that I tested you could replace that part with whatever you wanted, it still worked. So the url http://stackoverflow.com/users/37086/othername still points to your profile.
I would assume doing a database lookup solely on the name string would be more expensive than a numerical lookup on the primary key, even if the name column is indexed. The name is then added on to make the URLs more user and SEO friendly.
There is a uservoice request for this. If you want this to happen, uservoice is the right place to discuss / vote up.
Your name on SO is not unique click on users and type Josh, there's a whole page of us. So you have to have the ID. As for why the name everyone else's guess is as good as mine.
Try changing or removing the name and see what happens.
I think it's just so that your URLs tell you what to expect, but the application doesn't need (or actually use) that information.
Amazon does something quite similar with their books, if I remember correctly: They've got both the ASIN (their internal ID) and the name of the book in the URL, but only ever look up the ASIN.
Just speculating: The ID allows very fast retrieval of the data the profile page presents. The name is just for humans and ignored since it's easier for me to no that you are rkj and I am phihag than that your ID is 37086 and mine is 35070.

Resources