I have a class called Deal.
Deal has vote_scores.
I would like to see how many vote_scores are in Deal that are greater than 2.
My guess :
for vote_scores 2 in Deal
count
end
Doesn't really work :D
Is there a method to detect the value of a image rgb that is blury?
I simply want to store the blury value of my image in a variable called blury value? Is there a dedicated function?
%image1 which is rgb is stored in variable img1
img1 = imread('102.jpg');
% conversion to grayscale stored in img1_grey variable
img1_grey = rgb2gray(img1);
blury_value = function_matlab(img1)
i have two lists:
List<comparerobj> list_c = new List<comparerobj>();
List<comparerobj> list_b = new List<comparerobj>();
i'm filling lists somehow
then i'm trying to find elements in list_b which list_c doesnt contain:
foreach (comparerobj b in list_b)
{
bool lc = !list_c.Contains(b);
if (lc != true)
{
data.Add(b);
}
}
but for any b i'm getting that lc = true. what am i doing wrong?
So, I've been doing android application tutorials and everytime I create a package, for example the helloAndroid tutorial is com.example.android. When it saves this to src it creates a folder for com, another for example and one last one for android. So it gives me the error "class com.example.android does not exist" because its broken into different folders.
If anyone can help me out please email me at: [email protected]
Thank you very much.
hi, i am using NServices to send an object of the class MyMusicMessage as blow:
[Serializable]
public class MyMusicMessage:IMessage
{
public Guid EventId { set; get; }
public byte[] MusicBytes { set; get; }
}
when the size of MusicBytes is about 200k, it can be sent well.
but when the size is more than 300K,there is a "MessageQueueException".
is there any limit to the object size in NServiceBus?
thanks.
i am doing to write recursive program which calculates Ackemann function
http://en.wikipedia.org/wiki/Ackermann_function
here is code
public class Ackermann{
public static long ackermann( long m,long n){
return
(m==0)? n+1:
(m>0 && n==0)? ackermann(m-1,1):
(m>0 && n>0)? ackermann(m-1, ackermann(m,n-1));
}
public static void main(String[]args){
long m=4;
long n=2;
System.out.println(ackermann(m,n));
}
}
but it shows me mistakes
Ackermann.java:7: : expected
(m>0 && n>0)? ackermann(m-1, ackermann(m,n-1));
^
Ackermann.java:7: ';' expected
(m>0 && n>0)? ackermann(m-1, ackermann(m,n-1));
^
Ackermann.java:18: illegal start of expression
public static void main(String[]args){
^
Ackermann.java:18: ';' expected
public static void main(String[]args){
^
Ackermann.java:18: illegal start of expression
public static void main(String[]args){
^
Ackermann.java:18: ';' expected
public static void main(String[]args){
^
Ackermann.java:18: ';' expected
public static void main(String[]args){
^
Ackermann.java:26: reached end of file while parsing
}
^
8 errors
please help
Hi there!
Right now I'm logging some info of the user in my web app in a log file to observe the usage & interest for some services, but I'm interested in checking that info in a readeable way, so I'm questioning if maybe I shall save that info in a database and then retrieve it to show it in tables or whatever.
It's better to log in the database for my purposes? Or logging like now I could select/order the info of the log easily?
ia have meet following problem
suppose we have sorted array of size 2^k-1 where k is given number we should copy this array into heapsearch array b the elements in odd positions of a go in order into last half of the positions of b positions congruent to 2 modul0 4 go into b's secodn quarter and so on this is not homework and please nobody tag it as homework it is from programming pearls please any ideas
I have a bunch of types (eg. LargePlane, SmallPlane) that could be in this collection i've made, how do i print like LargePlane? I've tried like typeOf() and stuff but it doesn't work. Within like a toString()? So when i output the collection it states what type it is.
Many times when I lose connection to my development server, I just log back in and have a .swp file to deal with when I re-open. Does vim have a mod to allow deleting by initial prompt?
Thanks
I'm a programmer trying to learn some css and I've already run into a stumbling block.
I have the following HTML:
<div class="container">
<div class="span-24 last">
Header
</div>
<div class="span-4">
Left sidebar
</div>
<div class="span-16">
<div class="span-8">
Box1
</div>
<div class="span-4">
Box2
</div>
<div class="span-4 last">
Box3
</div>
<div class="span-16 last">
Main content
</div>
</div>
<div class="span-4 last">
Right sidebar
</div>
<div class="span-24 last">
Footer
</div>
</div>
In my css I have the following:
body {
background-color:#FFFFFF;
}
div.container {
background:url(/images/bck.jpg);
}
I just want to display an image for the background area for the container div but nothing shows up. If I remove the background section from the css and add background-color:#000000; then I see a black background for the container div.
What am I overlooking?
Hi,
My 1st post.
I am creating an exercise app that will record the weight used and the number of "reps" the user did in 4 "Sets" per day over a period of 7 days so the user may view their progress.
I have built the database table named FIELDS with 2 columns ROW and FIELD_DATA and I can use the code below to load the data into the db. But the code has a sql statement that says,
INSERT OR REPLACE INTO FIELDS (ROW, FIELD_DATA)VALUES (%d, '%@');
When I change the statment to:
INSERT INTO FIELDS (ROW, FIELD_DATA)VALUES (%d, '%@');
Nothing happens. That is no data is recorded in the db.
Below is the code:
#define kFilname @"StData.sqlite3"
- (NSString *)dataFilePath
{
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:kFilname];
}
-(IBAction)saveData:(id)sender;
{
for (int i = 1; i <= 8; i++)
{
NSString *fieldName = [[NSString alloc]initWithFormat:@"field%d", i];
UITextField *field = [self valueForKey:fieldName];
[fieldName release];
NSString *insert = [[NSString alloc] initWithFormat:
@"INSERT OR REPLACE INTO FIELDS (ROW, FIELD_DATA)
VALUES (%d, '%@');",i, field.text];
// sqlite3_stmt *stmt;
char *errorMsg;
if (sqlite3_exec (database, [insert UTF8String],
NULL, NULL, &errorMsg) != SQLITE_OK)
{
// NSAssert1(0, @"Error updating table: %s", errorMsg);
sqlite3_free(errorMsg);
}
}
sqlite3_close(database);
}
So how do I modify the code to do what I want? It seemed like a simple sql statement change at first but obviously there must be more. I am new to Objective-C and iPhone programming.
I am not new to using sql statements as I have been creating web apps in ASP for a number of years.
Any help will be greatly appreciated, this is driving me nuts!
Thanks in advance
Dave
I have been asked in an interview, To write a sql query which fetches the first three records with highest value on some column from a table. i had written a query which fetched all the records with highest value, but didnt get how exactly i can get only first three records of those.
could you help me in this.
thanks.
I am trying to build a search functionality which at a high level works like this.
1 - I have a Search model, controller with a search_set action and search views/partial to render the search.
2 - At the home page a serach form is loaded with an empty search object or a search object initialized with session[:search] (which contains user search preferences, zip code, proximity, sort order, per page etc). This form has a post(:put) action to search_set.
3 - When a registered user performs a set the params of the search form are collected and a search record is saved against that user. If a unregistered user performs a search then the search set action simply stores the params in the session[:search]. In either case, the search is executed with the given params and the results are displayed. At this point the url of in the location bar is something like..
http://localhost:3000/searches/search_set?stype=1
At this point if the user simply hits enter on the location bar, I get an error that says "No action responded to show" I am guessing because the URL contains search_set which uses a put method and even though I have a search_show (:get) action (which simply reruns the search in the session or saved in the database) does not get called.
How can I handle this situation where I can route a user hitting enter into the location bar to a get method?
If this does not explain the problem , please let me know I can share more details/code etc.
Thanks!
i have a table like this:
1 x y
2 a
3 b
4 c d e
i want to use a sql statement to turn it into this:
1 x
1 y
2 a
3 b
4 c
4 d
4 e
i am having trouble building the sql statement. please help!
I'm making custom events for C# and sometimes it isn't working.
This is how I'm making the event happen:
private bool isDoorOpen;
public bool IsDoorOpen {
get { return isDoorOpen;}
private set { isDoorOpen = value; DoorsChangeState(this, null);}
}
And these are the event declarations:
//events
public delegate void ChangedEventHandler(Elevator sender, EventArgs e);
public event ChangedEventHandler PositionChanged;
public event ChangedEventHandler DirectionChanged;
public event ChangedEventHandler BreaksChangeState;
public event ChangedEventHandler DoorsChangeState;
This works as long as there are methods attached to the events, but if there isn't, it throws a null ref exception. What am I doing wrong?
i am starting with this table:
SELECT [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [CountOf1 0 Preanalytical (Before Testing)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![By Number]![Text4] And [Forms]![By Number]![Text2]))
GROUP BY [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]
HAVING ((([Lab Occurrence Form].[Practice Code])<>"") AND ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0));
it selects 3 columns but i need to aggregate the comments and put it in the fourth column where the first two values are the same
i have a class:
template<class T>
class matrix
{
private:
int COLS,ROWS;
public:
inline matrix(int r,int c){
this->COLS=r;
this->ROWS=c;
}
template<class T2>
friend ostream& info(ostream& os);
};
i tried in so many ways to implement the info class.but none is succeed.
i want to use it in main function
Matrix<int> M(10,20);
cout<<info<<M;
i want to out put the Matrix class's cols, and rows information.
i have tried so many time in implementing the friend class info, but failed.
any one can tell me how can do it?
I have a picker that prompts the user to choose a gender and an age group (17-21, 22-26, etc.)
These 2 choices determine which view the user will be brought to after pressing the button, but I am having troubles writing the method for that button. The code I have so far is this:
- (IBAction) buttonPressed {
NSInteger genderRow = [genderPicker selectedRowInComponent:0];
NSString *genderSelected = [genderPickerData objectAtIndex:genderRow];
NSInteger ageRow = [agePicker selectedRowInComponent:1];
NSString *ageSelected = [agePickerData objectAtIndex:ageRow];
if (genderSelected == "Male" && ageSelected == "17-21") {
Calc2ViewController *calc2ViewController = [[Calc2ViewController alloc] initWithNibName:@"Calc2View" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:calc2ViewController animated:YES];
[calc2ViewController release];
calc2ViewController = nil;
}
}
When I run the program, and select these 2 groups (Male and 17-21) - nothing happens. What am I missing?
Suppose I have variables
$x1 = 'XX a b XX c d XX';
$x2 = 'XX a b XX c d XX e f XX';
I want a regular expression that will find each instance of letters between XX. I'm looking for a general solution, because I don't know how many XX's there are.
I tried using /XX(.*?)XX/g but this only matches "a b" for x1 and "a b", "e f" for x2 because once the first match is found, the engine has already read the second "XX".
Thanks for any help.
see following code and please clear doubts1. as ABC is template why it not showing error when we put defination of ABC class member function in test.cpp 2.if i put test.cpp code in test.h , then it working fine
// test.h
template <typename T>
class ABC {
public:
void foo( T& );
void bar( T& );
};
// test.cpp
template <typename T>
void ABC<T>::foo( T& ) {} // definition
template <typename T>
void ABC<T>::bar( T& ) {} // definition
template void ABC<char>::foo( char & ); // 1
// main.cpp
#include "test.h"
int main() {
ABC<char> a;
a.foo(); // working
a.bar(); // link error
}
div
{
margin:90px auto;
}
This code centers the div in chrome with a top margin of 90px, but the results are different in all other browsers ..
is there a common method to center the div and have a top margin at the same time ?