I have a text file.
I read each line with sr.readline();
as i read that line, i want to search for it in a List that it should have been added to previously, then add it to a NEW list. How do i do this?
Hi,
I've been trying to debug an existing asp.net web application that requires me to debug against an IIS website.
I've installed the app and can navigate to it on localhost. However, when I start VS 2008 as an Administrator and try to debug it, I get a message "Unable to start debugging on the web server. The IIS worker process for the launched URL is not currently running."
I've looked through some of the help file contents and can't seem to figure out what is going on. Clearly, the IIS worker process IS running, since I can navigate to the site locally without VS open.
My boss has suggested that it might be because my OS is 64 bit. Any ideas?
Hi i a have created a global.h file in which i define enum Token
I get the garbage value of token if i use the value of Token other than glabal.cpp file
i have also include the "global.h" file in other file where i am using the Token value how can i correct this problem.
It is possible to repurpose a Word builtin command in Word 2007 using the customUI.xml file.
Example:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<commands>
<command idMso="Save" onAction="MySave"/>
</commands>
</customUI>
I then have to define a callback function in VBA which is used instead of the builtin function:
'Callback for Save onAction
Sub MySave(control As IRibbonControl, ByRef cancelDefault)
someFancyPreparationFunction
oldSaveFunction ' Where, how?
someOtherFancyAfterWorkFunction
End Sub
And here is my problem, if I want to reuse internal functionality in my repurposed Function, I don't know how to access it. My example is trivial and the save could be easily rebuilt by a call to ThisDocument.save but as I said, it is just an example to show the problem.
A call to CommandBars.ExecuteMso('Save') would call my repurposed function and not the original one. Any ideas on how to access the internal functionality after repurposing would be very appreciated!
I make a compiler of Tiger and I want integrate with VS2008, but I read a lot of stuff and don't say very well how i can made that. What is the type of the project that i need to make? How i register my Language/compiler in VS2008, I know that i need install the SDK, I know litle thing that i need to do but the steps more important, like What class i need to implement... Thanks for all
When globalizing a wpf application with static resx classes, it's very easy to miss the odd label or button that has its Content property set to a hard coded string in a particular language, ie English. These should of course be moved off to a {x:Static ...} so they can be localised for each culture.
Are there any tools which can spot this and warn you? Built in to VS would be ideal, but I'm thinking that 'style cop' type build tools would do the job as well.
Something weird that I've been seeing, a web application written in ASP.Net (C#) that got the source code on the production server and compile that way. So when I deploy to the server I deploy the source code.
Why does .Net have this functionality? Doesn't make sense.
ResultBox1-Text = (sin(TextBox1-Text)) * TextBox2-Text
That is what i would like to work, but im dealing with Strings
I cant seem to convert the strings, do the trig, and convert back to string for displaying properly... anyone with an example?
Is it possible to reference other projects' properties via a macro within a build event?
For example:
"Tool1" outputs to directory ..\..\bin\Release
"Component1" uses "Tool1" in its post-buildevent
To get to "Tool1", "Component1"'s project must do something like $(SolutionDir)bin\Release
This requires that Tool1 always output to ..\..\bin\Release. If this is changed this breaks the other project. I know there is no indication to this within the macro list but is there a way to reference another project? Maybe like $(OtherProject.TargetDir)...
I know WIX has a similar syntax [$(var.OtherProject.TargetDir)] but I think that may be a different mechanism.
I have been parsing xml content using the xmlreader and cannot use the xml document but so far it works getting all elementcontent except for the attribute contents. I need to parse the link below found in the following entry;
<title>XXXX UUUUUU posted a</title>
<category term="NotePosted" label="Note Posted"/>
<link rel="alternate" type="html" href="http://www.dfsddsfdsf.com/profile.php?id=sdfdfsfdsdfddfsfd&v=wall&story_dbid=dssdfasdfdasfdsafafafa"/>
<source>......... <source>
I need the href tag in the link attribute but it keeps coming back null.
While ureader.Read
If ureader.HasAttributes Then
fId = ureader.GetAttribute("href")
If fId.Contains("?v=wall&") Then
fIdList.Add(fId)
Exit While
End If
If String.IsNullOrEmpty(fId) Then
fId = "NOTHING"
End If
End If
End While
At work we have a C# solution with over 80 projects. Is it possible in VS 2010 to stop compilation as soon as an error is encountered rather than the default behaviour which is to continue as far as possible and display a list of errors in the error window?
Hi Experts,
Who can help me with this: I am working on Win7 x64, with VS.net 2008. I am developping for pocketpc.
When my application is deployed to the device emulator it can't connect to my computer / db server. Both de emulator as well the mobile device center are configured to use DMA. When I cradle the device using device manager, nothing happens.
What can I try?
Greets,
Jasper
I'm writing an application which has two classes that provide basically the same functionality but for different situations. I'd like to have three versions of the software - one where the user can change an ini file to configure the program to use one of the two classes, and then one version that only uses one of the two classes.
Right now I have it working via an ini file, but I'd like to be able to build versions that don't include the code for the unneeded class at all.
What is the best way to go about this? My current line of thinking is that since both classes derive from a common interface I'll just add a compile time conditional that looks at the active build configuration and decides whether to compile that class. What is the syntax to do that?
Thanks in advance for your help and input!
I am using VS2005 VC++ for unmanaged C++. I have VSTS and am trying to use the code coverage tool to accomplish two things with regards to unit tests:
See how much of my referenced code under test is getting executed
See how many methods of my code under test (if any) are not unit tested at all
Setting up the VSTS code coverage tool (see the link text) and accomplishing task #1 was straightforward. However #2 has been a surprising challenge for me. Here is my test code.
class CodeCoverageTarget
{
public:
std::string ThisMethodRuns() {
return "Running";
}
std::string ThisMethodDoesNotRun() {
return "Not Running";
}
};
#include <iostream>
#include "CodeCoverageTarget.h"
using namespace std;
int main()
{
CodeCoverageTarget cct;
cout<<cct.ThisMethodRuns()<<endl;
}
When both methods are defined within the class as above the compiler automatically eliminates the ThisMethodDoesNotRun() from the obj file. If I move it's definition outside the class then it is included in the obj file and the code coverage tool shows it has not been exercised at all. Under most circumstances I want the compiler to do this elimination for me but for the code coverage tool it defeats a significant portion of the value (e.g. finding untested methods). I have tried a number of things to tell the compiler to stop being smart for me and compile everything but I am stumped. It would be nice if the code coverage tool compensated for this (I suppose by scanning the source and matching it up with the linker output) but I didn't find anything to suggest it has a special mode to be turned on. Am I totally missing something simple here or is this not possible with the VC++ compiler + VSTS code coverage tool?
Thanks in advance,
KGB
I've been playing around to see how my computer works under the hood. What I'm interested in is seeing is what happens on the stack inside a function. To do this I've written the following toy program:
#include <stdio.h>
void __cdecl Test1(char a, unsigned long long b, char c)
{
char c1;
unsigned long long b1;
char a1;
c1 = 'b';
b1 = 4;
a1 = 'r';
printf("%d %d - %d - %d %d Total: %d\n",
(long)&b1 - (long)&a1, (long)&c1 - (long)&b1,
(long)&a - (long)&c1,
(long)&b - (long)&a, (long)&c - (long)&b,
(long)&c - (long)&a1
);
};
struct TestStruct
{
char a;
unsigned long long b;
char c;
};
void __cdecl Test2(char a, unsigned long long b, char c)
{
TestStruct locals;
locals.a = 'b';
locals.b = 4;
locals.c = 'r';
printf("%d %d - %d - %d %d Total: %d\n",
(long)&locals.b - (long)&locals.a, (long)&locals.c - (long)&locals.b,
(long)&a - (long)&locals.c,
(long)&b - (long)&a, (long)&c - (long)&b,
(long)&c - (long)&locals.a
);
};
int main()
{
Test1('f', 0, 'o');
Test2('f', 0, 'o');
return 0;
}
And this spits out the following:
9 19 - 13 - 4 8 Total: 53
8 8 - 24 - 4 8 Total: 52
The function args are well behaved but as the calling convention is specified, I'd expect this. But the local variables are a bit wonky. My question is, why wouldn't these be the same? The second call seems to produce a more compact and better aligned stack.
Looking at the ASM is unenlightening (at least to me), as the variable addresses are still aliased there. So I guess this is really a question about the assembler itself allocates the stack to local variables.
I realise that any specific answer is likely to be platform specific. I'm more interested in a general explanation unless this quirk really is platform specific. For the record though, I'm compiling with VS2010 on a 64bit Intel machine.
Isn't it true that every assert statement can be translated to an Assert.IsTrue, since by definition, you are asserting whether something is true or false?
Why is it that test frameworks introduce options like AreEquals, IsNotNull, and especially IsFalse? I feel I spend too much time thinking about which Assert to use when I write unit tests.
I am about to give up debugging SMTP servers to send email... My code is the following
private void SendMail()
{
SmtpClient mailClient = new SmtpClient("smtp.mail.yahoo.com", 465);
mailClient.EnableSsl = true;
MailMessage message = new MailMessage();
message.To.Add("[email protected]");
message.Subject = "i wish it would work";
MailAddress fromAddress = new MailAddress(Email.Text, Name.Text);
message.From = fromAddress;
mailClient.Send(message);
}
I always find myself needing to enclose a block of code in curly braces { }, but unfortunately that isn't included in the C# surround code snippets, which seems to be an oversight. I couldn't find anything on building your own surround snippets either (just other kinds of snippets).
I am actually running Resharper too, but it doesn't seem to have this functionality either (or I haven't figured how to activate it).
We have a coding standard of including even a single line of code after an if or else in curly braces, so if I could just make Resharper do that refactor automatically that would be even better!
I am trying to make a simple server thread in QT to accept a connection, however although the server is listening (I can connect with my test app) I can't get the newConnection() signal to be acted on.
Any help as to what I'm missing here would be much appreciated!
class CServerThread : public QThread
{
Q_OBJECT
protected:
void run();
private:
QTcpServer* server;
public slots:
void AcceptConnection();
};
void CServerThread::run()
{
server = new QTcpServer;
QObject::connect(server, SIGNAL(newConnection()), this, SLOT(AcceptConnection()));
server-listen(QHostAddress::Any, 1000); // Any port in a storm
exec(); // Start event loop
}
void CServerThread::AcceptConnection()
{
OutputDebugStringA("\n***** INCOMING CONNECTION"); // This is never called!
}
Hello,
I have a complex grammar (in antlr 2.7) which I need to extend. Having never used antlr before, I wanted to write a very simple Lexer and Parser first.
I found a very good explanation for antlr3 and tried to adapt it:
header{
#include <iostream>
using namespace std;
}
options {
language="Cpp";
}
class P2 extends Parser;
/* This will be the entry point of our parser. */
eval
: additionExp
;
/* Addition and subtraction have the lowest precedence. */
additionExp
: multiplyExp
( "+" multiplyExp
| "-" multiplyExp
)*
;
/* Multiplication and addition have a higher precedence. */
multiplyExp
: atomExp
( "*" atomExp
| "/" atomExp
)*
;
/* An expression atom is the smallest part of an expression: a number. Or
when we encounter parenthesis, we're making a recursive call back to the
rule 'additionExp'. As you can see, an 'atomExp' has the highest precedence. */
atomExp
: Number
| "(" additionExp ")"
;
/* A number: can be an integer value, or a decimal value */
number
: ("0".."9")+ ("." ("0".."9")+)?
;
/* We're going to ignore all white space characters */
protected
ws
: (" " | "\t" | "\r" | "\n") { newline(); }
;
It does generate four files without errors: P2.cpp, P2.hpp, P2TokenTypes.hpp and P2TokenTypes.txt. But now what? How do I create a working programm with that? I tried to add these files to a VS2005-WinConsole-Project but it does not compile:
p2.cpp(277) : fatal error C1010:
unexpected end of file while looking
for precompiled header. Did you forget
to add '#include "stdafx.h"' to your
source?
I am just beginning my journey into web development and I have a very basic question, but I am none the less stumped.
I have setup a new ASP.NET Empty Web Application. In this application, I have created a few *.aspx pages and a sitemap called 'Web.sitemap'.
I have placed a SiteMapPath control onto my Master page and, with no further configuration, this detected my Web.sitemap and displays the location of the page on any *.aspx page which derives from the master page.
However, whenever I add a Navigation Menu, this doesn't happen. When I bring up the Menu Tasks dialogue box, I can't select this from the Choose Data Source dropdown, my only option is to choose <New data source...> which brings up the Data Source Configuration Wizard, and from this I can create a new Site Map, however I want to use the already existing one.
How do I go about this?
Thanks
I'm running into a really annoying problem with my Linq to SQL project. When I add everything in under the web project everything goes as expected and I can tell it to use my existing connection string stored in the web.config file and the Linq code pulls directly from the ConfigurationManager.
This all turns ugly once I move the code into its own project. I’ve created an app.config file, put the connection string in there as it was in the web.config but when I try to add another table in the IDE keeps forcing me to either hardcode the connection string or creates a Settings file and puts it in there, which then adds a new entry into the app.config file with a new name.
Is there a way keep my Linq code in its own project yet still refer back to my config file without the IDE continuously hardcoding the connection string or creating the Settings file? I’m converting part of my DAL over to use Linq to SQL so I’d like to use the existing connection string that our old code is using as well as keep the value in a common location, and one spot, instead of in a number of spots.
Manually changing the mode to WebSettings instead of AppSettings works untill I try to add a new table, then it goes back to hardcoding the value or recreating the Settings file. I also tried to switch the project type to be a web project and then rename my app.config to web.config and then everything works as I’d like it to. I’m just not sure if there are any downfalls to keeping this as a web project since it really isn't one. The project only contains the Linq to SQL code and an implementation of my repository classes.
My project layout looks like this
Website
-connectionString.config
-web.config (refers to connectionString.config)
Middle Tier
-Business Logic
-Repository Interfaces
-etc.
DAL
-Linq to SQL code
-Existing SPROC code
-connectionString.config (linked from the web poject)
-app.config (refers to connectionString.config)
I have a VB.NET Project, and would like to, as with C# Projects, build and have dll files generated and dumped in the Bin/debug folder.
Currently, I have the project configured for ANY CONFIGURATION and ALL CPUS but when I do a build, I still do not have a bin folder or a debug folder containing a DLL. What am I missing here please? Thanks in advance.
I converted all my other projects fine from VS 2008 to 2010 and they run great. There is one project however for some reason after converting, when I try to run one of the .aspx pages in it, I get nothing...no error, just that it cannot display the page.
Nothing has changed. The path is still the same, and the IIS website is still the same. I even recreated the site in IIS using the VS option to create it in the web project properties.
This is a testing project..only has like one .aspx in it.
Not sure why I get nothing after converting this. I did not convert it to .NET 4.0, it's still in v3.5 in VS 2010.