« first day (1377 days earlier)      last day (3570 days later) » 

12:11 AM
posted on July 24, 2014 by Visual Studio Blog

Today we released the Node.js Tools for Visual Studio 1.0 Beta 2 which is now available for download. NTVS is Microsoft’s free Visual Studio add-on that enables a rich experience for working with Node.js apps, giving developers the power of the Visual Studio code editor including support for IntelliSense, the Visual Studio debugger, and for running Node.js apps on Microsoft Azure We

 
 
7 hours later…
7:06 AM
Good morning people.
 
morning @RoelvanUden
 
Hi. I'm in WPF and I would like to ask if there is way to create schema in xaml for example for button where I would set background color, textcolor, font. And when I create new button I would like to refer to that scheme. Can someone provide me some links pleasE?
 
7:54 AM
@Marek It's called an user control. You can reference to them and set their properties.
 
8:06 AM
@RoelvanUden thanks for the reply. I know. Is it possible to create scheme or template for button and reference to that scheme when creating button in xaml?
 
0
Q: Not able to find the web control on code behind?

ramanI have some controls on a page and i am not able to access the controls in code behind, it is coming in scientific intelligence. I am getting the cause of that. here is my HTML code of web control: <%@ Control Language="c#" AutoEventWireup="false" Inherits="DNNInfo.Modules.Classifieds.Contro...

please help me experts
 
@raman, Page.FindControl will only look in your page, it wont recurse into all controls.
 
@SimonSvensson i have tried in simple way too sir
it still returning null
@SimonSvensson may i use this.FindControl the place of this.page.FindControl
?
 
@Marek That's the very definition of a user control o_o
 
@RoelvanUden , uh sorry, Thanks!
 
 
4 hours later…
11:55 AM
What possible causes are there for a WCF fault other than an unhandled exception in the service?
 
user1804599
@KendallFrey bugs
 
@KendallFrey serialization errors, perhaps?
or hosting issues, perhaps. What sort of fault are you getting?
 
I have no idea, I've never observed it happen.
 
The Endpoint port could be already in use and not configured for sharing, or an invalid configuration setting, or a wrong assembly version in a dependency
WCF errors are fairly good at explaining what went wrong though. Can I help?
 
It seems to be working at one point, and at a later time it tells me it's faulted.
No reporting of the fault that I could find.
 
user1804599
12:01 PM
I/O error.
 
user1804599
Hardware failure.
 
If the code it exposes throws an unhandled exception then the WCF service will become faulted and unusable.
 
> The underlying secure session has faulted before the reliable session fully completed. The reliable session was faulted.
@Squiggle I know. I can't find it though.
Part of the problem is that I can't reproduce it in the debugger
 
user1804599
You are invoking undefined behavior somewhere!
 
@KendallFrey what binding you using?
 
12:03 PM
HTTP?
 
are you transmitting large data?
 
I don't think it's super large, don't know what's all happening though
 
what sort?
 
What do you mean?
 
BasicHttp, WSHttp, something else?
 
12:04 PM
Uhhh
 
Enable logging if you can. It's REALLY useful for debugging WCF.
Dumps out all WCF states and calls to a .svclog file, allows you to see the request sizes and inner exceptions
 
Maybe I can get something out of ETW, let me try that
 
@KendallFrey do you know what a binding is?
msdn.microsoft.com/en-us/library/ms733051(v=vs.110).aspx the first section of xml should resemble the web.config of the host
<endpoint binding=???> ...[some config]...
 
I don't know where that XML is
I found an app.config that has basic and mex http bindings
No idea if it's the right one, but it is probably accurate
 
interesting. BasicHttp doesn't support sessions
is it faulting all the time or only some of the time?
 
12:13 PM
All the time, in a certain situation
 
common google result suggests that fault goes off when the message size is too large, that's another possibility. How big is the message?
 
I have no idea when it's faulting.
It seems to indicate it's faulting at the same time as it fails, but I would have thought it reports the fault, not the fact that it's faulted
And I'm pretty sure it's not sending anything over the configured max message size
 
Yes, the config with the basic and mex bindings is the one which defines the endpoints of your service.
(mex is just an 'extra' endpoint for providing the service schema, like a SOAP .wsdl)
srsly, get the diagnostics tracing configured.
that'll tell you why it faults
 
hi guys
 
I configure that in the exe's .config, right?
What if I told you this is in a unit test?
Also, apparently I've forgotten how to ETW
 
12:25 PM
I would like to clarify on the use of xml rpc with asp.net mvc as used in this blog -> michael-mckenna.com/Blog/… vs using a webapi and adding it to mvc app.Which one is an easier or direct implementation
?
 
You're unit testing a WCF service integration?
 
I think so
 
:S
then the config will go in the unit test assembly's .config file (you might have to create one), and even then it's dependent on how you execute the tests
wait no
how are you hosting the WCF service?
 
Is "self-hosted" what you mean?
 
Probably. Self-hosted within a unit test?
 
12:28 PM
I don't know what that means
 
i.e. what is the process within which your WCF service is hosted?
 
It's started by the tests
the same as the tests
 
hrrm.
(don't do that)
 
Noted. Ignored. Next, please :P
 
12:40 PM
Oh dear, now it's not faulting reliably anymore.
 
:-/
with the same payload?
 
AFAIK, nothing I did changed
 
are you running multiple unit tests concurrently?
 
I don't think that's possible
 
which test runner are you using? Default Visual Studio MSTest?
 
12:42 PM
yeah
 
morning folks
 
@KendallFrey it's likely that your WCF service has a lifetime of the execution of the test suite, so the state of your service will be altered by each test
and the tests are not guaranteed to be run in any particular order
 
Yes, I know that
(shoot me)
VS runs tests in some fucked-up order, I have no idea what it is, but it's deterministic
And it's playing havoc with my tests
 
it's best to treat it as random.
 
But that's not important now
 
12:46 PM
I think I am straddling a line between usefully clever and dangerously cryptic. I have a Dice object for my rogue-like, and I just wrote an operator static implicit operator int(Dice d) that rolls the dice when used is a number context.
 
I think that's too cryptic for production code
 
it's my code for a game that I am likely to be the only coder ever on, it gives me both an awesome clever feeling and an icky bad feeling
I guess I should stick to Dice.Roll
 
@DreadPiratePeter if it works, document it with summary comments and move on.
 
reminds me of my early C++ days in college where the newness of operator overloading led to much overuse and unfathomable code
 
@KendallFrey any closer to a solution?
 
12:54 PM
sigh
For some reason I'm not getting ETW logs
 
they need to be configured within the .config of the hosting process - which is probably your unit tests.
 
No, I mean the ones I'm generating
 
ah
can you debug?
 
No :(
the test passes then
Oh god Weird Al you make me laugh
 
my recommendation is to not unit test this stuff. Unit test the code within the service, but not via the WCF interface.
 
12:59 PM
We need to test the whole workflow
I don't think I could convince my team otherwise
 
How are you consuming the WCF service?
 
What do you mean?
 
we do something similar here, btw
 
I didn't know there was more than one way to consume a service
 
you know the principles of dependency injection, right?
 
1:02 PM
Ish...
 
and the WCF service is defined in an interface labelled with a [ServiceContract]
and implemented with a concrete class somewhere
 
yeap
 
are you consuming your service with a client created by ChannelFactory<IServiceBlah>?
 
Never heard of ChannelFactory
 
how are you creating the client that calls the WCF service?
 
1:05 PM
good question...
 
The quick way is to use
IFooService service = new ChannelFactory<IFooService>();
and have your endpoint/bindings defined in the app.config
 
serviceClient = new MyServiceClient(binding, endpoint);
 
ah. How retro :)
;)
 
I didn't write this :handsoff:
 
but in unit tests this is no good, because as you've discovered it relies on a hosted service which has a lifetime greater than that of your tests
and state 'bleeds' into the rest of the test suite and breaks stuff
 
1:08 PM
I haven't discovered this, it's common knowledge and intentional
 
yeah
intentional?
 
The whole point of what I'm working on now is to share more state
 
between unit tests?
 
performance
yeah
 
then I'm not sure I can help you
:(
 
1:10 PM
loling @ Weird Al
 
perhaps try an integration test framework like SpecFlow that allows you to orchestrate a long series of assertions
rather than hoping that your unit tests will run in the right order
 
It's important that TFS supports it for gated builds
 
I'm running SpecFlow and gated builds right now
 
cool
 
Specflow is nice
VS tooling not that intuitive
but it's a start
 
1:17 PM
In a WCF service, I have a class with a constructor that accepts two parameters. But the constructor does not show in my Winform when using it as a service ref
Any ideas why
 
Do WCF services even support constructors?
I would have thought you need to use an initialization method
 
You can't 'construct' WCF services.
they are hosted processes
 
Oh right
this was my class
[DataContract]
public class LoginRequest
{
[DataMember]
public string Email { get; set; }

[DataMember]
public string Password { get; set; }

private string IpAddress { get; set; }

public LoginRequest()
{

}

public LoginRequest(string sEmail, string sPassword)
{
this.Email = sEmail;
this.Password = sPassword;
}
}
 
oh if it's just a DataContract, then it's different
 
any ideas
 
1:21 PM
why are you overloading the constructor like that?
are Email and Password mandatory?
 
Yes
 
I'd recommend you mark the fields with [Required] attributes
 
I understand that
But how can I get this working;
public LoginRequest(string sEmail, string sPassword)
{
this.Email = sEmail;
this.Password = sPassword;
}
 
and call it like
new LoginRequest { EMail = "blah@foo", Password = "asdf" };
is your WCF client auto-generated?
 
Yes
I add the service reference
 
1:25 PM
Yeah - so the overloaded constructor isn't part of the contract. Your LoginRequest in your winforms app is just a POCO that resembles the original.
 
Well, my in-process event logger appears to have worked. I see things!
 
\o/
 
yeah that is correct. How caN I get the overloaded constructor to appear in my winform app
 
@Tommo1977 is your WCF service and winforms app in the same solution?
 
No
 
1:28 PM
then you'll have to share the original library, and use ChannelFactory or something to create the service client, rather than a Service Reference
but tbh I'd recommend you not bother with overloading constructors there
don't put logic in your POCO data contracts
they're just data transfer objects. They should be serializable and that's it.
 
ok thanks for your help
 
1:47 PM
have fun with the rest :)
 
2:25 PM
@Squiggle Your pretty good with Web-Forms, is there a clean way to do the following within a <asp:repeater>. When you call a column, if it detects content it will add a link that says "Show or Hide". Unfortunately because the identifier is generic it triggers them all for the page.
 
2:44 PM
I'd just apply a css style and do the show/hide with jQuery
 
@ton.yeung I spaced it to.
 
infact you could probably do the entire thing with jQuery...
 
....?
Example?
 
@Greg, why not a ListView with an EmptyDataItemTemplate?
Or is it just a property of your data object which is empty, and not the complete object?
 
So basically name it and walk through the node?
@ton.yeung So you just do $(this.parentNode).next basically?
 
2:58 PM
@KendallFrey can u help with Regex?
 
@ton.yeung Is there a way for when you wrap the Eval in a method to find that element created by the method?
 
@jyrka possibly...
 
@Greg sorry - just being busy
 
Is this correct way to check for a number between barackets " {0} " ranging from 0 to 9.999.999 ? \{[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]\}
@KendallFrey
 
\{\d{1,7}} like that?
 
3:02 PM
Well, I guess best way to find that class?
 
@KendallFrey - thx. i'll try get this to work in a script (it's in Squirrel)
 
<div class="Content-Summary"><%# Eval("ShortDescription") %><a href="#" class="Description-Expand">&nbsp; Show / Hide...</a></div>
I want that "show or hide" to only appear if it has a description that requires show or hide.
 
Everyone who'd like to contribute I've asked a new meta question and I'd like your opinion/input.
 
Could I just do:

$(".Content-Summary").next("a").text("Show / Hide");

Something like that?
???
Problem is, it doesn't find the correlating item as the repeater is building, it just executes on all.
Your pretty good with Web-Forms, is there a clean way to do the following within a <asp:repeater>. When you call a column, if it detects content it will add a link that says "Show or Hide". Unfortunately because the identifier is generic it triggers them all for the page.
 
@BenjaminGruenbaum nothing I could add to what's already been said there.
 
3:14 PM
@Squiggle thanks anyway
 
@ton.yeung An Eval, that is a database column.
@ton.yeung Yeah, on the Show Hide click.
@ton.yeung The whole thing:

    <asp:Repeater ID="rpContent" runat="server" DataSourceID="sdsCourses">
        <ItemTemplate>

            <div>
                <div class="Course-Text-To-Display"><a href="<%# Eval("CourseLink") %>"><%# Eval("CourseLinkTextToDisplay") %></a></div>
                <div class="Tooltip-Text-To-Display"><%# CleanCourseLink(Eval("CourseLink").ToString()) %></div>
            </div>

            <div class="PlattU-Container">
                <br />
                <div class="Training-Course"><%# Eval("CourseTitle") %></div>
@ton.yeung The Description-Expand is what should hold the "Show / Hide".
 
<div class="PlattU-Container">
                <br>
                <div class="Training-Course">Customer Course Data Update.</div>
                <div class="Training-Course">8 Credit Hours</div>
                <br>
                <div class="Content-Summary">Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, Customer Course data insert.<a href="#" class="Description-Expand"></a></div>
                <div class="Content-Description"></div>
                <br>
            </div>
 
3:31 PM
Good morning/evening/afternoon
Parallel.ForEach with CancellationToken, will always throw an exception if cancellation is requested, right?
 
@ton.yeung Nobody likes feedback anyway
 
Hey, I have a Wcf Service running on a service in UK and the same service running in JP. I wondered what is the best way to add a Service reference back to the UK service, so that certain methods are run on the UK service when called on the JP service.
I tried adding the service, but the compiler was complaining about namespaces
 
@ton.yeung Yeah, I can't get it to anchor to just a single element
As it is created.
 
@Darek Looks like it does from C# reference code, not sure though
 
Right, that's what I was afraid
it makes it silly to have to enclose every Parallel in a try/catch
Providing a CancellationToken to a Parallel method enables the operation to be exited early. Code external to the operation may cancel the token, and if the operation observes the token being set, it may exit early by throwing an OperationCanceledException.
So the only other option is to use loopstate
but to trigger loopstate state change, for which I can use CancellationToken or AutoResetEvent
any other brilliant ideas?
like in Task factory I have an option to .ContinueWith(onError)
 
3:45 PM
Hey guys
any idea if tasks are slower in creating objects than the main ui thread?
 
Why would they be?
It's the same machine code
 
they should not be @Boyen
 
Hmm yes I was wrong
Is there a way to load your objects from your query one by one?
I have this part
while (objReader.Read())
{

var objArtikel = new Artikel
{

SubGroepId = IntDbTester(objReader["SubgroepId"]),
HoofdGroepId = IntDbTester(objReader["HoofdgroepId"]),
AdviesPrijsIncl = DecimalDbTester(objReader["ArtikelAdviesPrijsIncl"]),
AdviesPrijsExcl = DecimalDbTester(objReader["ArtikelAdviesPrijsExcl"]),
BtwPercentage = IntDbTester(objReader["ArtikelBtwPercentage"]),
Naam = StringDbTester(objReader["ArtikelNaam"]),
OldId = StringDbTester(objReader["ArtikelOldId"]),
Id = IntDbTester(objReader["ArtikelId"]),
 
I'd appreciate brutally honest responses for my next questions: am I nuts to code like this?
    internal class Program
    {
        private static void Main(string[] args)
        {
            var cts = new CancellationTokenSource();
            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(100);
                cts.Cancel();
            });
            Pipeline<bool, bool> pipeline = Pipeline.Create(new Func<bool, bool>(i => i));
            var l = new List<bool>();
            new Action(() => l.AddRange(pipeline.Process(Infinite(), cts.Token))).Cancellable();
 
I'm pretty new to C#, so excuse my obvious ignorance, but when you've got a class, inside of it, you can do things like public void somethingHere() -- where "void" is, what's that called? a type?
 
3:54 PM
The main focus on the Cancellable
 
Can't edit that one anymore
 
@ton.yeung That worked, thank you. Question for you...
 
I have this code :
while (objReader.Read())
                    {

                        var objArtikel = new Artikel
                        {

                            SubGroepId = IntDbTester(objReader["SubgroepId"]),
                            HoofdGroepId = IntDbTester(objReader["HoofdgroepId"]),
                            AdviesPrijsIncl = DecimalDbTester(objReader["ArtikelAdviesPrijsIncl"]),
                            AdviesPrijsExcl = DecimalDbTester(objReader["ArtikelAdviesPrijsExcl"]),
                            BtwPercentage = IntDbTester(objReader["ArtikelBtwPercentage"]),
 
@NickDugger That's the return type.
 
Bloody hell
it won't format
 
3:55 PM
@NickDugger It's the return type, or in this case, void, which specifies no type
 
@NickDugger When used as the return type for a method, void specifies that the method doesn't return a value.

void isn't allowed in the parameter list of a method. A method that takes no parameters and returns no value is declared as follows:
 
Alright, "Return type" is what I was looking for. Thanks
 
There is actually a System.Void type, but it's never used
 
@ton.yeung If I wanted the text to vary if it is(':hidden') or is(':visible') could I add that?
 
Has anyone on here ever created a virus before, even if it was just to see if they can?
 
3:56 PM
    $(this.parentNode).next(".Content-Description").fadeToggle(function () {
        $(".Description-Expand").text($(this).is(':hidden')? ' Show More...' : ' Hide...').css({ textDecoration: 'none' });
        $(".Description-Expand").text($(this).is(':visible')? ' Hide...' : ' Show More...').css({ textDecoration: 'none' });
    });
 
Why is @KendallFrey always causing me to look up weird !@#$ like that
@Aeron I created one last week
 
That is what I had in place, which did it on all elements. But could I do it so that it was only for that element based on what you provided?
 
sat in the water when it was cold
:P
But it was nasty
 
@Darek My favourite internal .NET thing was the LOGIC class in .NET 2.0
 
had to take all kinds of medicine
 
3:58 PM
lol. You're better now though, I hope?
 
Damn you @KendallFrey .. another one
 
It contained a complete reeimplementation of boolean equality
 
So am I nucking futs to create the Cancellable extension?
 
@ton.yeung Yeah.
 
Is it still illegal to create a virus even if you make it so that it doesn't spread and you don't send/give it to anyone and it doesn't do anything malicious to anybody else?
 
3:59 PM
When reading a database with OleDbDataReader, and turning every record into an object, is it a good idea to make a new task for making the objects in the while objReader.Read() loop?
 
@ton.yeung It just can't affect the multiple elements that appear on the screen.
 
I like how viruses "infect" other files. I've always found that to be really interesting
 

« first day (1377 days earlier)      last day (3570 days later) »