I am not sure if both is these works to delete?
p = new int[1];
delete p
and
delete [] p;
if both works what is the difference between above two delete?
Assign the following 25 scores to a one dimensional int array called "temp"
34,24,78,65,45,100,90,97,56,89,78,98,74,90,98,24,45,76,89,54,12,20,22,55,66
Move the scores to a 2 dimensional int array called "scores" row wise
-- meaning the first 5 scores go into row 0 etc
Is there anyway to disable the rather annoying feature that Visual Studio (2008 in my case) has of copying the line (with text on it) the cursor is on when CTRL-C is pressed and no selection is made?
I know of the option to disable copying blank lines. But this is driving me crazy as well.
ETA: I'm not looking to customize the keyboard shortcut.
ETA-II: I am NOT looking for "Tools-Options-Text Editor-All Languages-Apply cut or copy to blank lines...".
Hi All,
I have randomly generated radio button series like
<input type="radio" name="creatorusers" value="1">
<input type="radio" name="creatorusers" value="1">
<input type="radio" name="creatorusers" value="1">
<input type="radio" name="creatorusers" value="1">
.....so on
But I get only ONE radio button and execute the javascript validation given for it to chk whether the radio button is selected or not, then it doesnt work
Ples help me out in resolving this.
mycreator = -1;
for (i=frm.creatorusers.length-1; i > -1; i--) {
if (frm.creatorusers[i].checked) {
mycreator = i; i = -1;
}
}
if (mycreator == -1) {
alert("You must select a Creator User!");
return false;
}
Hello Everyone,
My question is whether it is possible to get line/multiline (very unsure of correct term for this) behaviour of the Trace.Write and Trace.WriteLine methods but using the Microsoft Instrumentation Logging framework in .NET 2.0.
Desired Output
Hello World!
Oh Hai.
What I Currently Have
Trace.Write("Hello ");
Trace.WriteLine("World!");
Trace.Write("Oh Hai.");
I would prefer to use instrumentation to log rather than writing to a log file using Debug.Trace.
EDIT: By Instrumentation Logging I mean using a 'loggingConfiguration' block in my App.config and writing Log Entries using using Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry logEntry);
Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0 for example.
Ta,
KnownColor
Hi guys,
I am having problems with Mapping.
I have two tables in my database as follows: Employee and EmployeeManagers
Employee
EmployeeId int
Name nvarchar
EmployeeManagers
EmployeeIdFk int
ManagerIdFk int
So the employee can have 0 or more Managers. A manager itself is also an Employee.
I have the following class to represent the Employee and Managers
public class Employee
{
public virtual int Id
{
get;
set;
}
public virtual string Name
{
get;
set;
}
public virtual IList<Employee> Managers
{
get;
protected set;
}
public Employee()
{
Managers = new List<Employee>();
}
}
I don't have any class to represent Manager because I think there is no need for it, as Manager itself is an Employee.
I am using autoMapping and I just can't figure out how to map this class to these two tables. I am implementing IAutoMappingOverride for overriding automappings for Employee but I am not sure what to do in it.
public class NodeMap : IAutoMappingOverride
{
public void Override(AutoMapping<Node> mapping)
{
//mapping.HasMany(x => x.ValidParents).Cascade.All().Table("EmployeeManager");
//mapping.HasManyToMany(x => x.ValidParents).Cascade.All().Table("EmployeeManager");
}
}
I also want to make sure that an employee can not be assigned the same manager twice. This is something I can verify in my application but I would like to put constraint on the EmployeeManager table (e.g. a composite key) so a same manager can not be assigned to an employee more than once.
Could anyone out there help me with this please?
Awaiting
Nabeel
I have a ListView displays information about an object. When I click a ListView Item, I open an Activity that let's me manipulate parameters of the object held in the adapter. These parameters are updated and stored remotely.
When I return to the ListView (via the back button), I want to update the ListView Item that I clicked originally by requesting the parameter values from the remote server.
I am currently doing this up updating the entire ListView by clearing it and rebuilding it.
How do I reference the ListView Item so that I can update the data for that item only?
Thanks,
Jason
I have a table that I'm querying for value 43 in the second field and I return the value of the third field
SELECT t1_field3 FROM table1 WHERE t1_field2=43
this returns 19, 39,73
t1_id t1_field2 t1_field3
----- --------- ---------
1 43 19////
2 43 39////
3 43 73////
4 73 43
5 13 40
Then I separately query a second table for additional information
SELECT * FROM table2 WHERE t2_id=t1_field3
t2_id t2_field2 t2_field3
----- --------- ---------
19 value19.2 value19.3
39 value39.2 value39.3
73 value73.2 value73.3
Is there a way I could combine both table1 and table2 in the same query?
I have a table called 'highscores' that looks like this.
id udid name score
1 1111 Mike 200
2 3333 Joe 300
3 4444 Billy 50
4 0000 Loser 10
5 DDDD Face 400
Given a specific udid, I want to return the rank of that row by their score value.
i.e. if udid given = 0000, I should return 5.
Any idea how to write this query for a MySQL database?
I’m using control that needs to be register to asynchronous events.
The events will be raised in the UI thread using the ISynchronizeInvoke interface implemented by WinForms controls
I can’t register to the event at the constructor because it will allow calling the event handler before the control is fully created. during which calls to ISynchronizeInvoke are not allowed.
Solution to that problem is to use the perform the asynchronous event registration from an event handler to the HandleCreated instead of registering from the constructor.
however, this poses another issue, in some scenations the HandleCreated event is raised multiple times as result of change at the control state.
For example, each changing of the “RightToLeft” property causes a WMCreate message that cause raising the “HandleCreated” event.
How can I prevent the multiply times of event rising?
Is there is another way to know when the control is created and display for the first time?
I can keep a boolean flag in the HandleCreated, however it feels like a hack and I am wondering if there is a better way to handle this issue.
At the moment I can get the results I need with two seperate SELECT statements
SELECT
COUNT(rl.refBiblioID)
FROM biblioList bl
LEFT JOIN refList rl ON bl.biblioID = rl.biblioID
GROUP BY bl.biblioID
SELECT
GROUP_CONCAT(
CONCAT_WS( ':', al.lastName, al.firstName )
ORDER BY al.authorID )
FROM biblioList bl
LEFT JOIN biblio_author ba ON ba.biblioID = bl.biblioID
JOIN authorList al ON al.authorID = ba.authorID
GROUP BY bl.biblioID
Combining them like this however
SELECT
GROUP_CONCAT(
CONCAT_WS( ':', al.lastName, al.firstName )
ORDER BY al.authorID ),
COUNT(rl.refBiblioID)
FROM biblioList bl
LEFT JOIN biblio_author ba ON ba.biblioID = bl.biblioID
JOIN authorList al ON al.authorID = ba.authorID
LEFT JOIN refList rl ON bl.biblioID = rl.biblioID
GROUP BY bl.biblioID
causes the author result column to have duplicate names. How can I get the desired results from one SELECT statement without using DISTINCT? With subqueries?
for example i use following command to find a record
SELECT users.mail FROM users WHERE users.uid = %s
if found an match, then i should like to delete this record, and update in the same query an another table. i can solve this with 'joins' ?
hi everyone,am trying to calculate mean and variance using 3X3 window over image(hXw) in opencv...here is my code...is there any accuracy issues with this??or is there any other efficient method to do it in one pass.?
int pi,a,b;
for(i=1;i
Hi!
I've been struggling for a while with this one; I'll try to explain it here as simply as possible.
Consider this MySQL table:
+----------+-----------+---------+--------+
|status_id |session_id |pilot_id |present |
+----------+-----------+---------+--------+
|1 |61 |901 |1 |
|2 |63 |901 |1 |
|3 |62 |901 |0 |
|4 |62 |902 |1 |
|5 |63 |903 |1 |
+----------+-----------+---------+--------+
Both session_id and pilot_id are foreign keys making reference to a primary key in another table. The same pilot_id can be associated with different session_id, but every pilot_id-session_id combination is unique.
I need to make an HTML table (in PHP) that would display the data like this:
+----------+---------+---------+---------+
| |61 |62 |63 |
+----------+---------+---------+---------+
|901 |X | |X |
|902 | |X | |
|903 | | |X |
+----------+---------+---------+---------+
Hence, rows are pilot_id and columns are session_id. When a pilot_id-session_id combination has a present value of 1, the corresponding cell should be checked. (ie. when the row-combination is zero or the combination does not exist in the MySQL table, nothing should appear in the HTML table)
Phew.
Any ideas?
Thanks!
SCENARIO
One VS solution with n projects. Project A references package Y v1, Project B references package Y v2. It is now not possible to update all references to package Y for all projects in the solution using the NuGet package manage dialog at the solution level, it is only possible to do this when all projects reference the same version of package Y. Not a big deal for only two projects, but I'm dealing with lots of projects that through poor package management are referencing many package versions when they should all reference the same version.
Before I spend the afternoon writing a console app. to auto update all package.config files for a solution so that each referenced package is only referenced via it's latest version (latest referenced, not the very latest, with exceptions/caveats etc)....is there a tool/method for doing this already? Or some other approach I am unaware of?
I'm developing an app for Android 2.1 upwards. I want to enable my users to select a profile picture within my app (I'm not using the contacts framework).
The ideal solution would be to fire an intent that enables the user to select an image from the gallery, but if an appropriate image is not available then use the camera to take a picture (or vice-versa i.e. allow user to take picture but if they know they already have a suitable image already, let them drop into the gallery and pick said image).
Currently I can do one or the other but not both.
If I go directly into camera mode using MediaStore.ACTION_IMAGE_CAPTURE then there is no option to drop into the gallery.
If I go directly to the gallery using Intent.ACTION_PICK then I can pick an image but if I click the camera button (in top right hand corner of gallery) then a new camera intent is fired. So, any picture that is taken is not returned directly to my application. (Sure you can press the back button to drop back into the gallery and select image from there but this is an extra unnecessary step and is not at all intuitive).
So is there a way to combine both or am I going to have to offer a menu to do one or the other from within my application? Seems like it would be a common use case...surely I'm missing something?
Hi, I am working on a project to perform template matching on a video captured via my webcam. I am able to create 2 template from the webcam capture, but I am unable to perform template matching for both. The program can run only with either template matching, but not both. My program sequence is:
Capture from webcam
get template 1
get template 2
perform template 1 matching with webcam capture then perform template 2 matching with webcam capture
if fail, stop.
Can any expert advice me on this?
i'm trying to create a unordered list in Flex. My issue is that within each line, i want the word NEW to be a different font color and different font size from the rest of the label text. I am unsure of how to do this INLINE within the label component. Any thoughts anyone?
<s:VGroup fontSize="15" color="#ffffff">
<s:Label text="\u2022 NEW Invite your friends!" />
<s:Label text="\u2022 NEW Features coming soon!" />
<s:Label text="\u2022 NEW Invite your friends!" />
</s:VGroup>
I am trying to display a WordPress post on the homepage of a site. It is reporting the following error:
Parse error: syntax error, unexpected '=' in /home/####/####/####/####/wp-content/themes/oceanswaves/home.php on line 105
<?php query_posts(‘p=143'); if(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endif; ?>
Thank you
Consider the following function:
void f(const char* str);
Suppose I want to generate a string using stringstream and pass it to this function. If I want to do it in one statement, I might try:
f((std::ostringstream() << "Value: " << 5).str().c_str()); // error
This gives an error: 'str()' is not a member of 'basic_ostream'. OK, so operator<< is returning ostream instead of ostringstream - how about casting it back to an ostringstream?
1) Is this cast safe?
f(static_cast<std::ostringstream&>(std::ostringstream() << "Value: " << 5).str().c_str()); // incorrect output
Now with this, it turns out for the operator<<("Value: ") call, it's actually calling ostream's operator<<(void*) and printing a hex address. This is wrong, I want the text.
2) Why does operator<< on the temporary std::ostringstream() call the ostream operator? Surely the temporary has a type of 'ostringstream' not 'ostream'?
I can cast the temporary to force the correct operator call too!
f(static_cast<std::ostringstream&>(static_cast<std::ostringstream&>(std::ostringstream()) << "Value: " << 5).str().c_str());
This appears to work and passes "Value: 5" to f().
3) Am I relying on undefined behavior now? The casts look unusual.
I'm aware the best alternative is something like this:
std::ostringstream ss;
ss << "Value: " << 5;
f(ss.str().c_str());
...but I'm interested in the behavior of doing it in one line. Suppose someone wanted to make a (dubious) macro:
#define make_temporary_cstr(x) (static_cast<std::ostringstream&>(static_cast<std::ostringstream&>(std::ostringstream()) << x).str().c_str())
// ...
f(make_temporary_cstr("Value: " << 5));
Would this function as expected?
can i have multiple iis ftp sites using something similar to web site's unasigned host headers?
i have a dedicated server in a hosting facility and want to make a web site for each of my clients. to add/ remove files and content i want ftp access to each of the sites root folders.
lets say i have 10 sites set up using unasigned host headers... how can i set up 10 analogous ftp sites on the same server? AND NOT USE A DEFINED IP ADDRESS FOR EACH FTP SITE
thanks all
This question is about what happens with the reorganizing of data in a clustered index when an insert is done. I assume that it should be more expensive to do inserts on a table which has a clustered index than one that does not because reorganizing the data in a clustered index involves changing the physical layout of the data on the disk. I'm not sure how to phrase my question except through an example I came across at work.
Assume there is a table (Junk) and there are two queries that are done on the table, the first query searches by Name and the second query searches by Name and Something. As I'm working on the database I discovered that the table has been created with two indexes, one to support each query, like so:
--drop table Junk1
CREATE TABLE Junk1
(
Name char(5),
Something char(5),
WhoCares int
)
CREATE CLUSTERED INDEX IX_Name ON Junk1
(
Name
)
CREATE NONCLUSTERED INDEX IX_Name_Something ON Junk1
(
Name, Something
)
Now when I looked at the two indexes, it seems that IX_Name is redundant since IX_Name_Something can be used by any query that desires to search by Name. So I would eliminate IX_Name and make IX_Name_Something the clustered index instead:
--drop table Junk2
CREATE TABLE Junk2
(
Name char(5),
Something char(5),
WhoCares int
)
CREATE CLUSTERED INDEX IX_Name_Something ON Junk2
(
Name, Something
)
Someone suggested that the first indexing scheme should be kept since it would result in more efficient inserts/deletes (assume that there is no need to worry about updates for Name and Something). Would that make sense? I think the second indexing method would be better since it means one less index needs to be maintained.
I would appreciate any insight into this specific example or directing me to more info on maintenance of clustered indexes.