How to name a method properly? [closed] - objective-c

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
It's more a question about English grammar, but nevertheless, can you tell me which one is a correct method name? This ambiguity drives me crazy.
Method linesNumber returns number of "rows" in some sort of table.
I personally like "numberOfLines" variant, but linesNumber is shorter...
#pragma mark - RCGroupDataSource methods
- (NSUInteger)linesNumber { // ???: or numberOfLines or lineNumbers
return 2;
}

Always give full name as you can.
Method linesNumber returns number of "rows" in some sort of table.
why not use numberOfRowsInTable
You can refer AppleDocumentation and CocoaDevCentral

Describe what is being done:-
getNumberOfLines
The other could be ambiguous
getLineNumbers
Sound more like a plural, ie an array of numbers.

Related

Whats wrong in this sql query? It throws error [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
SELECT *
FROM ItemTable
WHERE item_link not in 'http://foo.com', 'http://bar.com'
It throws error..
in requires parenthesis:
in (...)
You missed the () after IN
SELECT * FROM ItemTable
WHERE item_link not in ('value1', 'value2')

sql query returning results not in 'between' clause [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I have the following in a where clause of a select statement:
InvoiceDate BETWEEN CONVERT (DATETIME, '01.01.2011', 104) AND CONVERT(DATETIME, '01.08.2011', 104)
and I'm receiving results all the way back to 2008. What's wrong with my query?
Posting Jonathan's comment as an Answer so that this question can be answered and come off the unanswered list:
Do you have an or condition in your where clause that may be including the additional results?

SQL to Rails Query [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can anyone Convert my Sql query into Rails Query???
SELECT DISTINCT conversation_cbgs.* FROM "conversation_cbgs"
INNER JOIN "message_cbgs"
ON "message_cbgs"."conversation_cbg_id" = "conversation_cbgs"."id"
INNER JOIN "user_message_cbgs"
ON "user_message_cbgs"."message_cbg_id" = "message_cbgs"."id"
WHERE "user_message_cbgs"."user_id" = 1
ORDER BY conversations_cbgs.updated_at DESC
Assuming you have your models built correctly - which would be helpful for those answering your questions, by the way - you would have something like:
Conversation.select("DISTINCT conversation_cbgs.*")
.joins(:messages)
.joins(:user_messages)
.where("user_message_cbgs.user_id = ?", 1)
.order("conversations_cbgs.updated_at DESC")
There are other ways using scopes and merges, etc. but you haven't posted any models for us to show you.
You have to first establish association between tables.If association is there then show it in question.
Or
You can execute this query by Model.find_by_sql(sql_query)
ConversationCbg.find(:all, :conditions=>["user_message_cbgs.user_id=?",1], :joins=>"As conversation_cbgs inner join message_cbgs on message_cbgs.conversation_cbg_id=conversation_cbgs.id inner join user_message_cbgs on user_message_cbgs.message_cbg_id=message_cbgs.id" , :select=>"Distinct conversation_cbgs.*", :order=> "conversations_cbgs.updated_at desc")

What does the <> operator do? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I came across the <> operator in some C code and couldn't figure out for sure what it ment.
I'm guessing it's equal to != (not equal to) operator?
Could somebody please enlighten me?
Am i right to think that <> and != are the same or...?
EDIT:
Ow this is embarrassing :$ I was looking in an SQLite3 statement in C code. So what i ment was SQLite3 and not C :$ Sorry for the confusion..!
There is no <> operator in C.
In SQL, <> means NOT EQUAL TO.
In Visual Basic means Not equal but it does not exist in C!
in c you may have << or >> which are binary shift left and right respectivelly
C has Greater than operator > and Less than operator <. It does not have any diamond operator <>. See here for more reference on C operators.
Ya, the <> operator indicates "Not Equal to" symbol but used in VB.net. I dont think this symbol is present in C language.

sql stored procedures [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I have table called "product review" with columns productreviewid , productid ,shopperid, review , rating .
I want to create the stored procedure for productreviewfetch with input parameter productreview ID
Can Any one pls help me out ?
You're not very clear about what you're trying to do - but something like this might get you started:
CREATE PROCEDURE dbo.FetchReviews #ProductReviewID INT
AS
SELECT
ProductReviewID, ProductID, ShopperID, Review, Rating
FROM
dbo.ProductReview
WHERE
ProductReviewID = #ProductReviewID
Does that give you the expected results??
It will return the values for those five columns, if your ProductViewID exists, and all NULL values, if that ID is not in your table.
Microsoft SQL Server provides the stored procedure mechanism to simplify the database development process by grouping Transact-SQL statements into manageable blocks.
More here : SQL Stored Procedures