« first day (1528 days earlier)      last day (3414 days later) » 

F4z
12:41 AM
Is there a nother way of testing multiple if statements without needing to actually debug the program and run each task related to the if statement? e.g. If i was to check whether a textbox is not empty and whether the passwords match and whether the password lengths are mroe than 12 etc. is there a way of doing this faster than debugging and going through these each time?
 
1:37 AM
Everyone asleep?
 
1:49 AM
@RodrigoSilva hi
 
@Stacykeb Hallo :)
 
0
Q: How to remove all columns after the column name: LAYER in text file

Stacy kebI am trying to remove all the columns after the column name "LAYER" My input text files have a more than 10 columns which are tab delimited Designator MAX PN Footprint Center-X(mm) Center-Y(mm) Layer Fitted Orentation Design level So i want to delete all the columns after t...

@RodrigoSilva can u help me please
 
@Stacykeb Do you want to delete just the first line (the column headers), the content of all the colums after layer or everything?
 
Why checkbox takes lots of space in wpf?
I just does not take ~30px by defauly
*default
and width and height is not working as well
 
he content of all the colums after layer
@RodrigoSilva he content of all the colums after layer
 
1:54 AM
@Stacykeb Do you know at which position the layer column is? You seem to be checking the positions, will the file be modified by the user?
I'm not sure what you mean, if you want to delete the content after one column whose position you already know, just split by \t and remove what you don't need
 
@RodrigoSilva 6th column
@RodrigoSilva headerArrary[5] && headerArrary.Length == 6
this the layer column
in my code
 
@Stacykeb But you don't want to delete the headers... Right? Then ignore the first line, split the lines by \t (tab) and delete the elements starting at index 12
 
@RodrigoSilva yea that's what i need.. i am not getting.. i know the position and want to delete all the contents.. column wise.. after the column LAYER
yea i want to delete the header too
after layer
every thing after layer.. i am speaking in column wise
 
`Designator MAX PN Footprint Center-X(mm) Center-Y(mm) Layer Fitted Orentation Design level`

Splitting that into an array by "\t" will produce:

0-Designator
1-MAX PN
2-Footprint
3-Center-X
...
So, if the actual content lines are also separated by "\t", take from 0 to 5
 
2:13 AM
@RodrigoSilva can u show the code please
 
@Stacykeb Check your question.
That should do what you asked for, just change it to read from the text file ofc.
Gotta sleep now :P
See you tomorrow
 
 
4 hours later…
6:18 AM
@BradleyDotNETthe wpf app that I have developed crashed with generic Windows error saying "program stopped..." when I run it on a different computer. Is there a method to find out what's causing the error?
I checked dot net version and all but how would you know really
 
 
2 hours later…
8:28 AM
Anyone knows reference for LongRunningOperation...
 
8:54 AM
is that a Sharepoint or WF thing?
 
9:20 AM
Is there a room for EF questions, or am I in the right place?
 
You could always try asking in here, they is a high probability/risk that someone in here has used EF too.
 
Totally. I'm a heavy EF user.
@Rabskatran what's up?
 
Thanks
I'll be back soon ;-)
 
Morning All
 
Guten morgen, @CustomizedName
 
9:28 AM
Lol
Basically I was adding this code..
http://stackoverflow.com/questions/3607359/stop-executing-code-in-thread-after-30s
 
We are not alone @ work ;-)
 
@Squiggle and as I worked with SPLongOperation... before , so I thought it's a builtin function
Now I am struggling with something else though
class Program
{
    static void Main(string[] args)
    {
        if (RunWithTimeout(LongRunningOperation, TimeSpan.FromMilliseconds(3000)))
        {
            Console.WriteLine("Worker thread finished.");
        }
        else
        {
            Console.WriteLine("Worker thread was aborted.");
        }
    }

    static bool RunWithTimeout(ThreadStart threadStart, TimeSpan timeout)
    {
        Thread workerThread = new Thread(threadStart);

        workerThread.Start();

        bool finished = workerThread.Join(timeout);
 
@CustomizedName gotchya.
 
BTW, WebEssential has stopped to work for me. Any idea how I can get it back to work ? Is the last version buggy ? (No browser link, every menu grey, this has come as an illness : some pages were still working then a few days later every page was infected :-)
 
I'm not fond of that method of silent thread aborting. Ideally, a Timeout exception should thrown and handled accordingly.
unless it's a really non-critical operation and you absolutely don't care if it fails
 
9:31 AM
@Squiggle that's what it really is :)
is this function "LongRunningOperation" putting main thread into sleep ?
 
Yes. It's a dreadful solution.
 
I want main thread to continue once the sub-thread get's done or times out, currently I am making it sleep for Thread.Sleep(1000 * 60 * 6); minutes, but I need to put it back to 5000 miliseconds
 
eh. Hang on. It's just not a nice example.
It's a bit retro, as well. The later .Net framework has the concept of an async Task, which is much nicer to use.
 
I thought about it, but then I want to lock main thread only until sub-thread gets done
maybe I can use locks
 
Best solution is to spawn the 'worker' task, wait for completion or catch the timeout exception and process accordingly.
 
9:36 AM
can you find me an example for it please or what keywords should I use on google
 
one sec.
 
Thread.Abort is always wrong and always bad.
 
Waiting for Tasks.
1. Spawn task.
2. task.WaitOne(timeout) in main thread
 
Lovely, gonna check, thanks
 
C# is getting better with parallelism, but it's still a bit clunky.
 
9:39 AM
maybe they should add how much max resources could be used by a thread at a time as well, but it itself doesn't sounds like best way of doing things
Trouble comes in when we use third party products
.
 
I thown a bottle in the sea : stackoverflow.com/questions/27570428/…
This a problem I got with EF...
 
what is the output of float data type and double data type? means how many digits before and after .(dot)?
 
@VIPULPARMAR, the question is bad. Are you asking about precision? The formatting differs depending on the value and the current locale (not everyone uses dots).
@VIPULPARMAR, doubles are 64-bit floating-point values. According to the docs it has approximate range of ±5.0 × 10−324 to ±1.7 × 10308 msdn.microsoft.com/en-us/library/678hzkk9.aspx
 
@SimonSvensson yes i mean precision
float = (how many digit before).(how many digit after)
double = (how many digit before).(how many digit after)
i know 64 bit use in double
 
@VIPULPARMAR, you're still asking the question that indicates that you do not know how floating-point values work. "Floating point" basically means that the point can "float", it can go to the left, or to the right. You have about 64 bit for the total value, and it could either be lots of bits to the left and few to the right of the dot, or the other way around.
If the range of a double is up to ±1.7 × 10^308, that's over 300 digits long, while 2^64 is about 1.8 × 10^19 (about 20 digits long). That means that the maximum number in a double can not be stored exactly in 64 bit of data, but will instead be rounded.
The larger the number, the more bits go to the range, and there are less bits to the precision part. This means that larger numbers will have more rounding errors.
 
9:59 AM
@Rabskatran Don't assume that all OO designs can fit nicely with EF.
Entity Framework works best when it maps 1:1 with database fields.
 
thanks @SimonSvensson
 
@VIPULPARMAR, floating-point values are okay to use when rounding errors are accepted, and you write code that takes this into account. If you need exact values, usually when working with money, use the decimal type.
 
i want to calculate money and store in database that why
 
Then use the Decimal type instead of floating point values.
 
and in database which datatype i use?
 
10:04 AM
What database software are you using?
 
sql server
2008
 
do you mean decimal(18, 0)?
 
Perhaps. You'll need to define the precision and scale yourself so it matches your requirements.
 
ok
thanks @SimonSvensson to help me
 
10:13 AM
Wise words, Simon :)
 
I think I just learned something new!
 
morning guys :D
 
morning @SebastianL
 
Morning @SebastianL
Mornin' @scheien
 
Saw some awesome clouds this morning. Think they're called Polar stratospheric clouds.
Was like a rainbow without the bow part :p
What up @Squiggle?
Got any good candidates yet?
 
10:40 AM
i have set the textbox value in javascript now i want to get this value in code behind(C#) for insert this value in database.
how to get this value?
 
What have you tried?
 
i have three textbox when i entered value in  first and second textbox then function calculate value and set in third textbox. and i want to enter all textbox value to database.
below is my function:

    <script type="text/javascript">
        function CalculateValue()
        {
            var mrp = Number(document.getElementById("txtMRP").value);
            var selling = Number(document.getElementById("txtSellingPrice").value);
            var seller = Number(document.getElementById("txtSellerPrice").value);
in codebehind

        decimal a = Convert.ToDecimal(txtMRP.Text);
        decimal b = Convert.ToDecimal(txtSellingPrice.Text);
        decimal c = Convert.ToDecimal(txtSellerPrice.Text);
It give me error :
"Input string was not in a correct format."
in below:
decimal c = Convert.ToDecimal(txtSellerPrice.Text);
 
What is the value of txtSellerPrice.Text?
 
100.00 ,80.00, 64.00
when i enter txtMRP.Text=100.00, txtSellingPrice.Text=80, then function set value of txtSellerPrice.Text=64.00
 
how can I get variable returned by DoSomething method here ?
Task taskB = Task.Factory.StartNew(() => DoSomeWork(10000000));
            taskB.Wait(100); //Wait for 100 ms.
would it be like this,

string result:
Task taskB = Task.Factory.StartNew(() => result = DoSomeWork(10000000));
            taskB.Wait(100); //Wait for 100 ms.
 
10:53 AM
this is my aspx page code
<asp:RadioButton ID="rbSelling" GroupName="price" Checked="true" runat="server" onclick = "RadioCheck();" TabIndex="12"></asp:RadioButton>
<asp:RadioButton ID="rbSeller" GroupName="price" runat="server" onclick = "RadioCheck();" TabIndex="13" ></asp:RadioButton>

<asp:TextBox ID="txtMRP" runat="server" placeholder="MRP" onchange="CalculateValue()" TabIndex="14"></asp:TextBox>
<asp:TextBox ID="txtSellingPrice" runat="server" onchange="CalculateValue()" placeholder="Selling price" TabIndex="15" ></asp:TextBox>
@SimonSvensson do you have any idea?
 
@scheien sorry. Was knee-deep in CSS.
Yes, managed to find some good CVs. It's hard to find AngularJS experience in the banking sector, but lined up some interviews for after Christmas.
 
That's great :)
 
@CustomizedName return values from Tasks the way you're doing it is tricky. You're going to be best off using the Task async/await functionality.
 
@scheien can you seen my code above.
 
Have you tried parsing with decimal.TryParse()?
 
11:04 AM
@CustomizedName msdn.microsoft.com/en-us/library/hh156513.aspx is a nice short example of it's use. It's pretty elegant :)
 
but in txtSellingPrice.text return null how to get values that set in javascript.
first two text box returns its value but third is calculated in function and set in its value
 
If you inspect the request (AllKeys) are the values present there?
Request.AllKeys["name"]
 
when i use this in C# page?
when i run page then all the values are display in all three text box but third text box values cant fetch in c#.
 
11:40 AM
How can i call StoreAsync Method to store refresh and access token of Google analytics?
 
11:51 AM
@Wasfa that's a bit of a disjointed question. Can you rephrase it with a bit more context?
 
12:10 PM
See y'all in the new year.
 
Cheers
 
12:40 PM
Howdy
 
Is it normal to not be able to understand anything that goes on over here?
 
For me? Yes!
 
12:54 PM
I am authenticating a user request to google analytics api.It stores its refresh token token and access token in a file and stores this file in AppData folder which is outside my source code folder
 
Hi
Adding to double values makes the value to truncate
 
My goal is to store that file inside my application appData folder,for this purpose i am implementing LocalFileDataStore which is custom implementation of IDataStore
 
How to add two add double values without truncation
 
@sameer Please give an example of what you're facing
 
12:57 PM
my problem is that it is not creating a file which stores refresh and access token.
how i can save refresh and access token in a file?
 
How do I give a method an optional parameter
I don't understand the answers here:
http://stackoverflow.com/questions/199761/how-can-you-use-optional-parameters-in-c
Is it just using an '=' operator?
 
Looks so...
if you're using C# 4.0
 
How do I know what version I'm using - is the .net framework version what defines the C# version?
 
I think so...
 
@James the '=' is for a default vaule. to achieve 'optional parameter' overloading is the 'better' way
 
1:04 PM
On a side note, can you not just use a overloaded method in place of optional parameters?
 
@James .NET and C# usually get released at the same time. .NET includes the C# compiler of the current version when it was released.
2
 
@mer
 
@Meraj99 You can, overloads are a superset of optional params
 
@Meraj99 @SebastianL I can use overloads, I didn't realise they were the better method
 
@James They aren't better
They are objectively more expressive, but not subjectively better
 
1:05 PM
@KendallFrey why?
 
is it better practice, to use properties, rather than fields?
 
@Meraj99 Usually you should use properties for public APIs
 
0
Q: How to call third party method and then if failed remove all resources its using

Customized NameI am trying this code to convert a document using aspose word, I am trying to terminate the process of conversion of document when it takes too long (as it leads to memory leak and eats up all system resources), I never looked at threading or async before, but now as our production server is brok...

 
1:23 PM
What is this called in C#? It is not a method or a variable is it?
 public event PropertyChangedEventHandler PropertyChanged;
 
It's an event
 
Ah ok, thanks. I've never come across them before - will do some research now.
 
It can be viewed as a delegate field (simplistic), or a special type of property with add/remove instead of get/set (more specific).
 
@KendallFrey Ok, thank you. Just doing some reading now.
 
I wish if we never use third party apis
 
1:28 PM
Haha, looks like I need to learn what a delegate is first :-s
 
@James It can be viewed as a variable holding a function (simplified) or a variable holding a collection of functions (more specific)
 
I didn't knew killing a process would be this huge problem in c#
 
2:07 PM
@CustomizedName it's not huge its maximum 3 - 15 lines depending on what youwant to achieve
 
@SebastianL yes, but I am struggling to find anything really
I posted my question above
 
@CustomizedName is any solution acceptable?
@CustomizedName because the only solution i can think of for now is the one Eric Lippert mentioned in his edit
 
2:24 PM
Some help please; the following code sets a property of my class called TermsCollection, the property code is:
public ObservableCollection<Term> TermsCollection
        {
            get { return TermName; }
            set {
                    TermName = value;
                    TermDescription = value;
                    NotifyPropertyChanged();
                }
        }
When this is set it is used in combination with DataContext so that I can bind to elements in my view.
To actually set this property I use a method called displayLaunchTerms, the working version of which is below:
 public async Task<ObservableCollection<Term>> displayLaunchTerms(string searchValue)
        {
            ObservableCollection<Term> test = null;

            Search loadSearch = new Search();
            test = await loadSearch.QueryRequest(searchValue);
            TermsCollection = test;
            return TermsCollection;
        }
The value passed to 'test' from loadSearch.QueryRequest is a collection. Exactly this same value is passed to TermsCollection. I thought I could therefore save a line by doing the following but if I do it doesn't work and I can't see why.
 Search loadSearch = new Search();
            TermsCollection = await loadSearch.QueryRequest(searchValue);
            return TermsCollection;
 
2:38 PM
happy happy monday, you jolly SOBs
 
@Steve yo
 
any estimated release date for C# 6.0? I need the initialize properties thing so badly...
 
@Steve Monday is awesome... If you're on vacations ( ͡° ͜ʖ ͡°)
 
;)
i am not.
 
I figured :P
I was just teasing you hehe
 
2:50 PM
...as programmer in a small-medium company you dont get the days before christmas off... if you dont have kids
 
lol ^
right on the money
 
I don't see why not, it's not like any work is going to get done anyway
I mean, unless you're maintaining an ecommerce site. Then yeah.
 
I'm on school break @SebastianL
It's funny how you use "I'm on" in this phrase, translating to Portuguese sounds a bit weird
 
i'm maintaining an ecommerce site :( and on devops
 
okay ^^ (it's kind of akward, but i used to be a pupil like you, but then i got a Collegedegree)
 
2:58 PM
Basically everyone from our office bailed on friday and aren't back until jan
we have nothing live, so doesn't matter
 
@TomW yo, just because you said it to me and i didn't respond and don't want you to think i ignored you :)
 
@TomW lucky bastard. I got a message on friday like this:''Hey Sebastian, here is this new Project we talked about, be sure to complete it before christmas, have a nice day!''
 
I'm getting this warning on one of my class constructors:
warning this call is not awaited, execution of the current method continues
Sorry some bad copy and pasting there :-s
 
@SebastianL It's study time anyways, exams in a few weeks :P
 
@James on a constructor? Erm.
 
3:01 PM
I've been doing some reading which suggested that you shouldn't use async with constructors, is there something I should change?
All the constructor is doing is calling one method.
 
I didn't even know you could
 
The method it calls is async.
 
@James there is your problem
 
Hi Guys, can anyone let me know how to create a good difference viewer in c#
 
a constructor is 'construtcing' an object, it shouldn'T have to wait for anything
 
3:03 PM
@AkshayChoudhary Write it. What else?
 
haha
 
public async ClassName() { /*do things*/ } - if that compiles I'd be surprised. But I guess that's what would be required to await in a constructor
 
@AkshayChoudhary im using winmerge so far
 
@SebastianL Ahh, ok - I think I know what I can change.
 
async/await are syntactic sugar for a pattern you could do with straight method calls though IIRC
 
3:04 PM
i wish githubs diff tool didn't suck so bad
 
Morning everyone.
 
the problem is I can't use third party components/tools I have to make it
 
@AkshayChoudhary why is that?
 
client's requirement
 
more work => more money?
 
3:06 PM
Does the client have a requirement to not be a moron?
 
@SebastianL If one of my async methods is returning a ObservableCollection task, how to I convert that into a 'normal' ObservableCollection? The method that my constructor calls should return a ObservableCollection, but the method it itself calls is async and returns a task.
 
If he did, I would be happiest guy in this world, these over qualified not too much technical guys really sucks
 
@James DoStuffAsync().Result
2
 
Amazing, thanks @TomW! I just realised that for a few of my methods I've needlessly been making them async because I didn't know how to properly get the values from the async methods they called :-s
Can do some cleaning up now!
 
Any guidance how to start it ? I have some good knowledge of regex but didn't figure out how it will work for exact comparison of tow unknown strings
 
3:22 PM
@AkshayChoudhary I would compare char by char
 
Read up to the first newline of each file into a char buffer, and xor the buffers together. If !=0, the lines are different.
 
@TomW why not await?
 
@JohanLarsson why not await what?
 
var collection = await DoStuffAsync();
 
@JohanLarsson question was specifically about calling an async method synchronously
In this case, in a constructor
 
3:32 PM
ålrejt
kinda smelly imo
start a thread and then block wait for it
 
You can't await in a constructor, how else would you do it?
AFAIK anyway
 
true
one way can be to have a class that manages awating and notifies when there is a resyult
 
Anything that needs awaiting called in a constructor is doing it wrong imho. Unless the particular API is async only, anything that benefits from being asynchronous doesn't belong in a constructor
I try to avoid anything not in the form _member = arg;, in fact. Although for some objects I accept that the setup logic can be slightly more complicated
 
Dumb question, how do you return a View with Temporary Data.
So, you click it- it loads a popup, and uses Temporary Data.
 
@TomW reason being tests?
 
3:44 PM
you guys hear of the latest git bug?
 
@JohanLarsson that would be a reason. Really though, it's because it's a constructor. It's very easy to blur the boundaries and have business logic going on in there
> Invalid state should be unrepresentable
^ @JohanLarsson, the other day.
Worth quoting. I suppose if your class is a complex state machine that needs putting in a valid initial state then the constructor is the place to do that, as you can't create one without initialising it then
 
I must afk
 
Anyone familiar with Model View Controller?
 
Yeah, kinda
 
3:59 PM
Same here but I'm not very smart or talented.
 
Hey guys, is there someone who know AS3 ?
 
I've got this:
$('#btnAddNewCard').click(function () {
    LaunchPopup($('#Popup'), "@Url.Content("~/Popup/PopupLayout?view=save")");
});
That LaunchPopup builds a Ajax Call.
Then when it hits:
        [HttpGet]
        public ActionResult PopupLayout(string view)
        {
            switch (view)
            {
                case "save":
                    return WithSave(this.RedirectToAction("/Popup/Index"), String.Empty);

                case "update":
                    return WithUpdate(this.RedirectToAction("/Popup/Index"), String.Empty);

                case "add":
                    return WithAdd(this.RedirectToAction("/Popup/Index"), String.Empty);

                default:
Problem is, it breaks the pop up by actually navigating.
 
can someone point me where flahs developers are talking?
 
@Greg If you are using a button, #btnAddNewCard it's default behavior is to submit the page.
return false; might help
 
@Dave But this is for a popup and linking to a separate controller.
 
4:19 PM
@Greg Still, a button on the browser submits the page client side. You could try placing the click event on something else just to see if it fixes the problem.
 
4:30 PM
That isn't the problem, the button does what it is told. It loads the data, the problem is return WithSave(this.RedirectToAction("/Popup/Index"), String.Empty); when it redirects to Controller. As it launches like a new page.
 
I didn't think [HttpGet] would redirect the browser, even with the RedirectToAction, but maybe I just don't understand MVC well enough.
My question is... my web api project returns XML in the browser, and Json in my windows store app. Does that make any sense? Is the web api designed to detect the client and send different format to each?
 
@Dave I would need more information.
 
If I enter the URL of my web API in the browser, it returns XML.
But this:
returns json
        var response = await client.GetAsync(new Uri("http://www.mysite.com/api/mymethod"));
        var result = await response.Content.ReadAsStringAsync();
In my windows app.
 
4:52 PM
is there a less-code way to check if console.readline() is equal to something without storing 'something' in a variable?
 
@ton.yeung Any thoughts on my dilemma above?
 
I found the answer to my question. "ASP.NET Web API can automatically serialize your model to JSON, XML, or some other format,... the client can indicate which format it wants by setting the Accept header in the HTTP request message."
 
$('#btnAddNewCard').click(function () {
    LaunchPopup($('#Popup'), "@Url.Content("~/Popup/PopupLayout?view=save")");
});
function LaunchPopup(element, uri) {
    var request = new XMLHttpRequest();
    request.onreadystatechange = function () {
        if (request.readyState != 4 || request.status !== 200) {
            return;
        }

        element.innerHTML = request.responseText;
        element.style.display = 'block';
    }

    request.open('GET', uri);
    request.send();
}
        [HttpGet]
        public ActionResult PopupLayout(string view)
        {
            switch (view)
            {
                case "save":
                    return WithSave(View("/Popup/Index"), String.Empty);

                case "update":
                    return WithUpdate(this.RedirectToAction("/Popup/Index"), String.Empty);

                case "add":
                    return WithAdd(this.RedirectToAction("/Popup/Index"), String.Empty);

                default:
                    return View();
@ton.yeung Once you hit the PopupLayout it shows save it hits the proper case, but when it returns WithSave it basically goes to another page. Rather then return in the div called Popup.'
        public ActionResult WithSave(ActionResult result, string message)
        {
            ShowSave(message);
            return result;
        }

        public void ShowSave(string message)
        {
            TempData["UI_Save"] = message;
        }
@ton.yeung To become more familiar with it.
What would I need to do to fix? Why wouldn't it work?
 
Always try something simple first so the next guy can guess how stuff works when it lands in his lap.
 
Well, the partial View works correctly.
 
5:04 PM
Greetings
 
But, I hate having to design the same data for three separate Views when it really could be one.
 
A shared view model perhaps?
 
@ton.yeung Well, the popup is identical.
@ton.yeung Okay.
 
er, how do i test a field (thats in an object) from another class?
because i have a method that uses that field?
 
do they teach coding as standard in most schools yet?
 
5:14 PM
blackbox? if you mean console...
 
@ton.yeung Yeah, perhaps.
@ton.yeung I hear you, I was trying to simplify for designer.
@ton.yeung Having issues with this dumb popup.
 
@James I thought the mandatory ICT curriculum had coding in it BUT when a teacher remembered that the kids should not learn HTML, CSS or JavaScript for coding their websites or at least understanding how the web works, she started following the syllabus by discontintuing all the coding they were going to do and their exam requires to edit pages using Microsoft FrontPage and that is the standard order of the day for IGCSE students.
 
@ton.yeung well, whitebox?
um, playerStats player = new playerStats(); now, from another class, i can't access player.AdminAccess
 
@TravisJ You there?
 
5:32 PM
I simply HATE “The breakpoint will not currently be hit. The source code is different from the original version.”
this kills all my appreciation of writing code
All my wish from new year is, all my breakpoints will currently be hit.
 
@ton.yeung er, testing as in, using it like this: if(player.AdminAccess){...} and, i've declared it as such: public bool AdminAccess;
 
5:49 PM
The name 'player' does not exist in the current context
 
:)
 
mmm
thanks...
 

« first day (1528 days earlier)      last day (3414 days later) »