Friday, 13 September 2013

Save Appointment task dows not fire the Grids focus Event

Save Appointment task dows not fire the Grids focus Event

I am working on saving Appointments But if I do A (new
SaveAppointmentTask()).Show()
Then it doesnot fire the Grids OnFocus event when doing a save or a
Cancel. Please Direct me to a proper step of detecting that the Xaml page
is In Focus ie the current Page.
Here's The XAML and the CS
<Grid OnFocus="Grid_Focus"></Grid>
Cs
private void OnFocus(args args){
//if I put a break point here then it does not hit
}
Please look into it.

Mobile first approach using LESS and nested media queries - looking for an IE10 alternative to conditional comments

Mobile first approach using LESS and nested media queries - looking for an
IE10 alternative to conditional comments

I'm using this great feature in LESS called nested media queries that
allows me to keep styles related to each "module" in one place. My media
queries are defined in a variables file as follows:
// Breakpoints
@breakpoint-medium: "600px";
....
// Queries
@mq-medium-and-up: ~"only screen and (min-width: @{breakpoint-medium})";
....
I can then use the media queries throughout my stylesheets in the
following way:
.module {
background: green;
@media @mq-medium-and-up {
background: yellow;
}
}
I take a mobile first approach to my CSS where I work my way up from small
screens (no media queries) to larger and larger breakpoints (using media
queries). Obviously media queries aren't supported in IE <= 8, so I would
like those browsers to fallback to having the "desktop styling".
In order to do so, I currently keep a separate less file (IE.less) where I
redefine the media queries as follows:
@mq-medium-and-up: ~"all";
@mq-large-and-up: ~"all";
which results in a media rule that older versions of IE will understand
@media all ...
So far all is good. I now have a separate IE stylesheet containing the
"desktop" styles. The problematic part of this is when it comes to how I
should include these two separate stylesheets in order to prevent older IE
versions from requesting both stylesheets (which are basically the same).
Currently I do it like this:
<link rel="stylesheet" href="site.css" />
<!--[if (lt IE 9) & (!IEMobile)]>
<link rel="stylesheet" href="ie.css" />
<![endif]-->
Would it be possible to prevent IE < 9 to download the site.css, but still
make it visible to other browsers? My initial thought was to wrap the
site.css file in another conditional comment using the NOT opeartor, but
since IE10 has dropped the support for conditional comments I guess that
is out of the question.
Any ideas?

Thursday, 12 September 2013

How can I fix these errors for this program?

How can I fix these errors for this program?

CSCI-15 Assignment #2, String processing. (60 points) Due 9/23/13
You MAY NOT use C++ string objects for anything in this program.
Write a C++ program that reads lines of text from a file using the
ifstream getline() method, tokenizes the lines into words ("tokens") using
strtok(), and keeps statistics on the data in the file. Your input and
output file names will be supplied to your program on the command line,
which you will access using argc and argv[].
You need to count the total number of words, the number of unique words,
the count of each individual word, and the number of lines. Also, remember
and print the longest and shortest words in the file. If there is a tie
for longest or shortest word, you may resolve the tie in any consistent
manner (e.g., use either the first one or the last one found, but use the
same method for both longest and shortest). You may assume the lines
comprise words (contiguous lower-case letters [a-z]) separated by spaces,
terminated with a period. You may ignore the possibility of other
punctuation marks, including possessives or contractions, like in "Jim's
house". Lines before the last one in the file will have a newline ('\n')
after the period. In your data files, omit the '\n' on the last line. You
may assume that the lines will be no longer than 100 characters, the
individual words will be no longer than 15 letters and there will be no
more than 100 unique words in the file.
Read the lines from the input file, and echo-print them to the output
file. After reaching end-of-file on the input file (or reading a line of
length zero, which you should treat as the end of the input data), print
the words with their occurrence counts, one word/count pair per line, and
the collected statistics to the output file. You will also need to create
other test files of your own. Also, your program must work correctly with
an EMPTY input file – which has NO statistics.
My test file looks like this (exactly 4 lines, with NO NEWLINE on the last
line):
the quick brown fox jumps over the lazy dog.
now is the time for all good men to come to the aid of their party.
all i want for christmas is my two front teeth.
the quick brown fox jumps over a lazy dog.
Copy and paste this into a small file for one of your tests.
Hints:
Use a 2-dimensional array of char, 100 rows by 16 columns (why not 15?),
to hold the unique words, and a 1-dimensional array of ints with 100
elements to hold the associated counts. For each word, scan through the
occupied lines in the array for a match (use strcmp()), and if you find a
match, increment the associated count, otherwise (you got past the last
word), add the word to the table and set its count to 1.
The separate longest word and the shortest word need to be saved off in
their own C-strings. (Why can't you just keep a pointer to them in the
tokenized data?)
Remember – put NO NEWLINE at the end of the last line, or your test for
end-of-file might not work correctly. (This may cause the program to read
a zero-length line before seeing end-of-file.)
This is not a long program – no more than about 2 pages of code.
Here is my solution:
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
using namespace std;
int main(int argc, char *argv[])
{
ifstream inputFile;
ofstream outputFile;
char inFile[12] = "string1.txt";
char outFile[16] = "word result.txt";
char words[100][16]; // Hods the unique words.
int counter[100]; // Holds associated counts.
char *longest[16]; // Holds longest words.
char *shortest[16]; // Holds shortest words.
int totalCount = 0; // Counts the total number of words.
int lineCount = 0; // Counts the number of lines.
totalCount = strtok(words, "."); // Tokenizes each word and removes
period.
// Get the name of the file from the user.
cout << "Enter the name of the file: ";
getline(cin, inFile);
// Open the input file.
inputFile.open(inFile);
// If successfully opened, process the data.
if(inputFile)
{
while(!inputFile.eof())
{
lineCount++; // Increment each line.
// Read every word in each line.
while(getline(inFile, words[100][16]))
{
// If there is a match, increment the associated count.
if(strcmp(words[100][16], counter[100]) == 0)
{
counter[100]++;
totalCount++; // Increment the total number of words;
totalCount = strtok(NULL, " "); // Removes the
whitespace.
// If there is a tie for longest word, get the first
or last word found.
if(strcmp(inFile, longest) == 0)
{
longest[16] = "";
}
// If there is a tie for shortest word, get the first
or last word found.
else if(strcmp(inputFile, shortest) == 0)
{
shortest[16] = "";
}
}
// Otherwise, add the word to the table and increment by 1.
else
{
words[100][16] += 1;
}
}
}
// Close the file.
inputFile.close();
}
// Otherwise, print error message.
else
{
cout << "Cannot open the file" << endl;
}
// Open the output file.
outputFile.open(outFile);
// Print the table to the output file.
outputFile << "List of words: " << endl;
outputFile << "---------------------" << endl;
// Print each word/count pair per line.
for(int i = 0; i < words[100][16]; i++)
{
outputFile << setw(10) << words[i][16] << endl;
outputFile << setw(10) << words[100][i] << endl;
}
outputFile << endl;
// Print the stats to the output file.
outputFile << "Number of Lines: " << lineCount << endl;
outputFile << "Total number of Words: " << totalCount << endl;
outputFile << "Number of Unique Words: " << words[100][16] << endl;
// Close the output file.
outputFile.close();
return 0;
}
Right now, my code has a few errors and I'm not sure how to fix them. Is
there anything I need to change?
Here are the errors:
line 20: cannot convert char[][16] to char for argument 1 to char
strtok[char, const char)
line 24: no matching function for call to getline[std:istream&, char[12]]
line 36: no matching function to call to getline[char[12], char&]
line 39: invalid conversion from char to const char
line 39: invalid conversion from int to const char
line 43: invalid conversion from char to int
line 45: cannot convert char to const char for argument 2 to int
strcmp[const char, const char]
line 50: cannot convert std:ifstream to const char for argument 1 to int
strcmp[const char, const char

COMPARE 2 COLUMNS IN 2 TABLES WITH DISTINCT VALUE

COMPARE 2 COLUMNS IN 2 TABLES WITH DISTINCT VALUE

I am now creating a reporting service with visual business intelligent.
i try to count how many users have been created under an org_id.
but the report consist of multiple org_id. and i have difficulties on
counting how many has been created under that particular org_id.
TBL_USER
USER_ID
0001122 0001234 ABC9999
DEF4545 DEF7676
TBL_ORG
ORG_ID
000 ABC DEF
EXPECTED OUTPUT
TBL_RESULT
USER_CREATED
000 - 2 ABC - 1 DEF - 2
in my understanding, i need nested SELECT, but so far i have come to nothing.
SELECT COUNT(TBL_USER.USER_ID) AS Expr1 FROM TBL_USER INNER JOIN TBL_ORG
WHERE TBL_USER.USER_ID LIKE 'TBL_ORG.ORG_ID%')
this is totally wrong. but i hope it might give us clue.

Using Facebook Connect to initiate a connection request

Using Facebook Connect to initiate a connection request

Here's what I'd like to be able to do, if it's allowed by Facebook:
Have users of my website authenticate using Facebook Connect
Access the list of their friends
Allow the user on my site to select any number of their FB friends
Fire off connection requests for my site using the FB interface.
I know that FB won't give my 3rd party application access to someone
else's email address without their permission, but does it allow me to
send 3rd party app requests in the Facebook UI?
Pinterest, Spotify, and other services will allow you to follow FB friends
that are already on these respective services, but they don't have a way
for me to invite people who aren't yet on Pinterest or Spotify.
What's the best way for me to leverage my existing FB network to drive new
member acquisition for a 3rd party app?

Change displayed view in a UIPopoverView

Change displayed view in a UIPopoverView

So I'm presenting a UIPopoverView like so:
if (self.BStatePopoverViewController == nil) {
RedStatePopoverViewController *settings =
[[RedStatePopoverViewController alloc]
initWithNibName:@"RedState"
bundle:[NSBundle mainBundle]];
UIPopoverController *popover =
[[UIPopoverController alloc] initWithContentViewController:settings];
popover.delegate = self;
self.BStatePopoverViewController = popover;
}
[BStatePopoverViewController setPopoverContentSize:CGSizeMake(320, 445)];
[self.BStatePopoverViewController presentPopoverFromRect:[sender
bounds] inView:sender
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Once the view is loaded in the popover, I have a button which I'd like to
use to present a new UIViewController within the popover. I tried just
presenting it as a modal view but this changes the parent view as opposed
to the one in the popover:
PopupDischargeViewController * dischargeview =
[[PopupDischargeViewController alloc]
initWithNibName:@"PopupDischargeViewController" bundle:nil];
[self presentModalViewController:dischargeview animated:NO];
Any help as to how I do this would be much appreciated.
Thanks!

PHP merge multidimensional array if certain values are duplicate

PHP merge multidimensional array if certain values are duplicate

I have the following PHP multidimensional array. I'd like to somehow go
though the array and see if any have 3 matching criteria and if so,
combine those into one. Any fields that are unique would use the info from
the first in the array. So in the example below, I'd like to look for
[action], [on] and [media][id]. If all three match, they would be combined
into one. However, I'd like to be able to have a count of the original
before the merge, and keep track of the [seen] values too. In the example
below I show what the original would look like, followed by the finished
array. I would really appreciate any help on this.
ORIGINAL LIKE THIS:
[0] => Array //HAS DUPLICATE
(
[action] => like
[seen] => false
[on] => photos
[from_user_id] => 2
[media] => Array
(
[id] => 3688
[path] => f2892213.jpg
[med_type] => pic
)
)
[1] => Array //HAS DUPLICATE
(
[action] => like
[seen] => true
[on] => photos
[from_user_id] => 13
[media] => Array
(
[id] => 3688
[path] => f2892213.jpg
[med_type] => pic
)
)
[2] => Array
(
[action] => like
[seen] => false
[on] => photos
[from_user_id] => 21
[media] => Array
(
[id] => 6372
[path] => H9384yhds
[med_type] => vid
)
)
[3] => Array //HAS DUPLICATE
(
[action] => like
[seen] => false
[on] => photos
[from_user_id] => 11
[media] => Array
(
[id] => 3688
[path] => f2892213.jpg
[med_type] => pic
)
)
FINISHED ARRAY SOMETHING LIKE THIS:
[0] => Array
(
[action] => like
[on] => photos
[from_user_id] => 2
[media] => Array
(
[id] => 3688
[path] => f2892213.jpg
[med_type] => pic
)
[count_before_merge] => 3
[seen_before_merge] => 1
)
[1] => Array
(
[action] => like
[seen] => false
[on] => photos
[from_user_id] => 21
[media] => Array
(
[id] => 6372
[path] => H9384yhds
[med_type] => vid
)
)