I am creating a messaging system but the problem I face is that when users try and enter certain characters like ' into the message, the database doesnt want to allow it.
Any idea what this is?
Hey guys, the following code shows what i am trying to do.
private void btnEdit_Click(object sender, EventArgs e)
{
iDeliverySelected = lstDeliveryDetails.SelectedIndex;
bool addEdit = false;
}
The selectedindex is throwing up the following error..
'System.Windows.Forms.ListView' does not contain a definition for 'SelectedIndex' and no extension method 'SelectedIndex' accepting a first argument of type 'System.Windows.Forms.ListView' could be found (are you missing a using directive or an assembly reference?)
Any ideas why? First time I have tried to use SelectedIndex, not sure if i am using it correctly?
I am having issues adding an image across a view while moving finger across the screen.
Currently it is adding the image multiple times but squeezing them too close together and not really following my touch.
Here is what I am trying:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch * touch = [touches anyObject];
touchPoint = [touch locationInView:imageView];
if (touchPoint.x > 0 && touchPoint.y > 0) {
_aImageView = [[UIImageView alloc] initWithImage:aImage];
_aImageView.multipleTouchEnabled = YES;
_aImageView.userInteractionEnabled = YES;
[_aImageView setFrame:CGRectMake(touchPoint.x, touchPoint.y, 80.0, 80.0)];
[imageView addSubview:_aImageView];
[_aImageView release];
}
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[self touchesBegan:touches withEvent:event];
}
Any suggestions is much appreciated.
EDIT:
What I want:
After taking or choosing an image, the user can then select another image from a list. I want the user to touch and move their finger across the view and the selected image will appear where they drag their finger, without overlapping, in each location.
Are there any examples on the web of how to monitor delayed_job with Monit?
Everything I can find uses God, but I refuse to use God since long running processes in Ruby generally suck. (The most current post in the God mailing list? God Memory Usage Grows Steadily.)
Update: delayed_job now comes with a sample monit config based on this question.
I understand that when the C# compiler sees a linq query comprehension, it basically does a straight translation to the corresponding Linq Extension methods and lambdas. i.e.
from x in list
select x.property
gets translated to:
list.Select(x => x.property)
my question is what do let clauses get translated to. for example how would this get translated by the compiler.
from x in list
let v = SomeComplexExpressionDependingOnx
select v
(p.s. i know this could be reduced to just select SomeComplexExpressionDependingOnx but i want to know how this is done in general)
Thanks!
The following SQL query isn't working. I think the error is on the first line.
SELECT SUBSTRING(tbl_news.comment, 1, 250) as tbl_news.comment,
tbl_news.id, tbl_news.date, tbl_news.subject, tbl_users.username FROM tbl_news
INNER JOIN tbl_users ON tbl_news.creator = tbl_users.id
ORDER BY date DESC
I have seen it but dont know how to achieve it.
The idea is that I have a drop down menu and when something is selected, something else will appear. Is it AJAX?
Any ideas?
When working remotely, our team only has access to our source code by remote desktop into our office PCs so we never really work in offline mode. Does a distributed version control system like Mercurial or Git still give us advantages over our current centralized Subversion set up? If so, what are they? Are there any drawbacks or pitfalls? I've read in numerous places that shifting to distributed version control requires a change in thinking. Can someone explain what needs to change in this regard?
I just tried the Apache Wicket "Hello, world" application and I noticed that in the rendered HTML output, Wicket is exposing it's internal attributes.
This is what the rendered HTML looks like in the 'view source' of the browser:
<html>
<body>
<span wicket:id="message" id="message">Hello World!</span>
</body>
</html>
How do I get rid of the wicket:id="message" attribute in the rendered HTML output?
Here's the method i want to write:
public static IEnumerable<String> GetTableNames(this IQueryable<T> query)
{
//...
}
where the IQueryable is a linq-to-sql query (is there a more specific interface i should use?).
then if i had a query like this
var q = from c in db.Customers
from p in db.Products
where c.ID = 3
select new {p.Name, p.Version};
q.GetTableNames();// return ["Customers", "Products"]
basically it would show all the tables that this query touches in the db, it is ok to execute the query to figure this out too (since that is going to happen anyway)? any ideas?
Im passing function GetCurrentDate() the pointer to a tm struct.
Within that function I printf the uninitialized data, then the initialized. Expected results.
However when i return the tm struct appears uninitialized.
See console output bellow. What am i doing wrong?
uninitialized date:??? ???-1073908332
01:9448278:-1073908376 -1217355836
initialized date:Wed May 5 23:08:40
2010
Caller date:??? ???-1073908332
01:9448278:-1073908376 -121735583
int main()
{
test();
}
int test()
{
struct tm* CurrentDate;
GetCurrentDate(CurrentDate);
printf("Caller date:%s\n",asctime (CurrentDate));
return 1;
}
int GetCurrentDate(struct tm* p_ReturnDate)
{
printf("uninitialized date:%s\n",asctime (p_ReturnDate));
time_t m_TimeEntity;
m_TimeEntity = time(NULL); //setting current time into a time_t struct
p_ReturnDate = localtime(&m_TimeEntity); //converting time_t to tm struct
printf("initialized date:%s\n",asctime (p_ReturnDate));
return 1;
}
I have put together the following code, the problem is that each while loop is only returning one set of data.
$result = mysql_query("SELECT date FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' GROUP BY date");
$i = 1;
echo "<table cellspacing=\"10\" style='border: 1px dotted' width=\"300\" bgcolor=\"#eeeeee\">";
while ($row = mysql_fetch_assoc($result))
{
$date=date("F j Y", $row['date']);
echo $date;
echo "
<tr>
<td>Fixture $i - Deadline on $date</td>
</tr>
";
$result = mysql_query("SELECT * FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' AND date = '$row[date]' ORDER BY date");
while ($row = mysql_fetch_assoc($result))
{
extract ($row);
echo "
<tr>
<td>$home_user - $home_team V $away_user - $away_team</td>
</tr>
";
}
$i++;
}
echo "</table>";
I should get many dates, and then each set of fixture below.
At the moment, the first row from the first while loop is present, along with the data from the second while loop.
However, it doesn't continue?
Any ideas where I can correct this?
Thanks
We want to use the same page to service the desktop, iPhone, and BlackBerry, so we have to come up with a way for the different devices to load different stylesheets.
So, is there a way to specify a stylesheet to run on BlackBerry?
For example, iPhone's use the media attribute:
<link media="only screen and (max-device-width: 320px)" href="style.css" ...
I am able to successfully add a resource to a file using UpdateResource and then remove it using: UpdateResource(HANDLE, "TYPE", "NUMER", 1033, IntPtr.Zero, 0);
When I add a resource to the file it will add another even though there is an existing resource exactly the same, also I cannot remove any existing resources. When I try to remove an existing resource using that line I get the error ERROR_INVALID_PARAMETER.
Any ideas?
So I have a query, can someone let me know if it looks ok content wise?
"INSERT INTO ".TBL_MESSAGES." (NULL, 'Your ranking points have changed',
'Due to your recent activity, your ranking points have increased by $r', '2', '$u',
'0', '0', '0', '0', NULL, NULL, NULL, NULL, now())";
I can add further information if the query doesnt appear to have a problem?
Thanks
I'm trying to determine what instances of sql server/sql express I have installed (either manually or programmatically) but all of the examples are telling me to run a SQL query to determine this which assumes I'm already connected to a particular instance.
Hi there, my company's software product has a feature that allows users to generate forms from Word templates. The program auto fills some fields from the SQL database and the user can fill in other data that they desire. So we have a .dotx template that holds the design of the form, and then the user gets the .docx file to fill out when they call it from our program.
The problem we're having is that some of our users have been finding that the forms take an exceptionally long time to open up and then, once open, are so slow to respond (scroll around, etc) that they're unusable. So in my investigations so far, I've found out that the problem systems are one with lower powered CPUs (unfortunately it happens for systems above our system requirements) and the Word forms that cause the problems are ones with large amount of ActiveX style checkboxes on them. I verified that reducing the ActiveX checkboxes fixes the form loading problems.
So I have the following questions about solutions (we're using Word 2007):
1) Is there any way to configure Word, or some other settings, so that there won't be such a strain opening a Word form with lots of ActiveX checkboxes? Any way of speeding up Word's opening?
2) Using Legacy style checkboxes instead of the ActiveX ones makes the forms load fine, but it looks like the user has to double-click the checkbox and change Default Value-Checked. Is there a way to configure it so that they can simply click on the checkbox to tick it? "Legacy Forms" checkbox as a name kind of worries me (Legacy…), does that mean a future version of word at some point wouldn't load the checkboxes because they're "legacy"?
3) Yes, it became clear to me after a little bit of research into solutions that Word is not the tool for the job for forms like I'm describing. InfoPath seems to be exactly what we should have been using all along but unfortunately I wasn't involved in the decision making or development of these forms, just tasked with coming up with a solution.
I'd appreciate answers to any of these, or if anyone has any other ideas for solutions to this problem.
Thanks
I am looking at redesigning my website and was wondering if I could get some opinions.
I know that the rule is usually to design with users without JS first and foremost, but having looked at the stats, it appears 95% of the users online have JS enabled.
Would you recommend designing the website using JS and not bothering about people without it?
if ($num_rows > 0)
{
while($row=mysql_fetch_assoc($res))
{
$fromuser=$row['username'];
$comment=$row['comment'];
$commentdate=$row['date'];
$date=strtotime($commentdate);
$final_date=date("g:i a", $date);
$final_date2=date("F j Y", $date);
?>
<table align="center" width="100%"style='border-top: 1px dotted;'bgcolor="#eeeeee" >
<tr><td><?echo "<a href=\"userprofile.php?user=$fromuser\"><b>$fromuser</b></a> commented:\n";?></td></tr>
<tr><td><?echo "at $final_date on $final_date2\n";?></td></tr>
<tr bgcolor="#ffffff"><td><?echo "$comment\n";?></td></tr>
</table><br>
<?
}
}
else
{
echo"There are currently no comments on this user";
}
?>
I am looking for a way to add a number to each comment. So 1, 2, 3, 4, etc in DESC order.
I can't think how I can do this?
So I am trying to understand OOP more and use it.
The following code was written before i started using OOP.
//loop through all the users
$game = "$_POST[Game]_teams";
$result = mysql_query("SELECT username FROM `users`") or die(mysql_error());
while( $row=mysql_fetch_assoc($result) )
{
$u[] = $row['username'];
}
I have put the query into my database page like following:
function selectAllUsers()
{
$q = "SELECT username FROM ".TBL_USERS."";
mysql_query($q, $this->connection);
}
I'm a little confused about how the rest could be different?
Would it be? Is it possible for anyone to help me without more code or understanding of my structure?
I have two arrays with two sets of values in ($a[] and $b[])
I want to do something like the following:
$a[0] - $b[0]
$a[0] - $b[1]
$a[1] - $b[0]
$a[1] - $b[1]
This will continue until the arrays reach the end.
So i want a hyphen to seperate the two arrays, with the first array staying the same until the second array has looped through.
I am trying to get this in a dropdown with option value.
How could i achieve this?
I never tried doing any loops with two varaibles like that before, I literally have no idea at all!
Thankyou
I'm in the process of creating a game where the user will be presented with 2 sets of colored tiles. In order to ensure that the puzzle is solvable, I start with one set, copy it to a second set, then swap tiles from one set to another. Currently, (and this is where my issue lies) the number of swaps is determined by the level the user is playing - 1 swap for level 1, 2 swaps for level 2, etc. This same number of swaps is used as a goal in the game. The user must complete the puzzle by swapping a tile from one set to the other to make the 2 sets match (by color). The order of the tiles in the (user) solved puzzle doesn't matter as long as the 2 sets match.
The problem I have is that as the number of swaps I used to generate the puzzle approaches the number of tiles in each set, the puzzle becomes easier to solve. Basically, you can just drag from one set in whatever order you need for the second set and solve the puzzle with plenty of moves left. What I am looking to do is after I finish building the puzzle, calculate the minimum number of moves required to solve the puzzle. Again, this is almost always less than the number of swaps used to create the puzzle, especially as the number of swaps approaches the number of tiles in each set.
My goal is to calculate the best case scenario and then give the user a "fudge factor" (i.e. 1.2 times the minimum number of moves). Solving the puzzle in under this number of moves will result in passing the level.
A little background as to how I currently have the game configured:
Levels 1 to 10: 9 tiles in each set. 5 different color tiles.
Levels 11 to 20: 12 tiles in each set. 7 different color tiles.
Levels 21 to 25: 15 tiles in each set. 10 different color tiles.
Swapping within a set is not allowed.
For each level, there will be at least 2 tiles of a given color (one for each set in the solved puzzle).
Is there any type of algorithm anyone could recommend to calculate the minimum number of moves to solve a given puzzle?
I have a Queue that contains a collection of objects, one of these objects is a class called GlobalMarker that has a member called GlobalIndex.
What I want to be able to do is find the index of the queue where the GlobalIndex contains a given value (this will always be unique).
Simply using the .contains function shown bellow returns a bool. How can I obtain the queue index of this match?
RealTimeBuffer.OfType<GlobalMarker>().Select(o => o.GlobalIndex).Contains(INT_VALUE);
I have an NSTextField that I would like to enable "as-you-type" spell checking. When I load my application I can do this from the Menu Bar Edit Spelling and Grammar Check Spelling While Typing.
I would like this option to be enabled by default. Within IB I can enable this for a NSTextView but I would like to use NSTextField for this part of the UI.
Thank you.