« first day (1288 days earlier)      last day (3657 days later) » 

12:05 AM
help fix? :D
private double prev = 0;
private void button1_Click(object sender, EventArgs ea)
{
timer1.Start();
WebClient wc = new WebClient();
Stopwatch sw = new Stopwatch();

wc.DownloadProgressChanged += (s, e) =>
{
timer1.Tick += (i, o) =>
{
if (timer1.Interval > 0)
{
if (e.BytesReceived != 0)
{
double dl_speed = (e.BytesReceived - prev) / (timer1.Interval / 1000);
this.Text = DL_Speed((long)dl_speed);
}

}

};

label1.Text = ConvertBytes(e.BytesReceived);
label2.Text = ConvertBytes(e.TotalBytesToReceive);
 
have a good weekend guys
 
 
9 hours later…
8:49 AM
anyone here can help me out of my lambda?
var gp_lt = gridData.Where(n => n.Profit != "-" && Convert.ToInt32(n.Profit) >= 0).Select(o => new { o.Profit });
double grossprofit_LT = gp_lt.Sum(o => Convert.ToDouble(o.Profit));
Profit was string
it says invalid string format
 
9:20 AM
I think ToDouble expects a decimal point
* too lazy to check
 
pass a culture?
pretty sure it works without a point
 
aaah. maybe difference between , and .?
 
would be my guess
 
10:12 AM
can anyone help me to convert my mp3 file to wav file?
I tried using Alvas.audio.dll and lame_enc.dll. but having small error in that
 
 
2 hours later…
11:55 AM
One quick question about asp.net....does every request go via the UrlRoutingModule, or is it just extension-less url that do so?
 
 
1 hour later…
1:08 PM
anyone here.....
 
 
3 hours later…
4:05 PM
> According to some reports, one email exchange cited in the lawsuit shows Eric Schmidt, former chief executive of Google, telling Steve Jobs the former boss of Apple that a Google recruiter who solicited an Apple employee would be fired.

Mr Jobs forwarded that note to the a top human resources executive at Apple with a smiley face.

Another exchange shows Google's human resources directors asking Mr Schmidt about sharing the no-cold call pact with other competitors.

"Schmidt responded that he preferred it be shared 'verbally, since I don't want to create a paper trail over which we can b
...ah.
Nice work, Schmidt.
saying 'I hope we don't get sued lol' doesn't look great when you get sued
 
chat so quiet today :O
 
Weekend... It's usually like this
 
!!saturday
 
@KendallFrey That didn't make much sense. Use the !!/help command to learn more.
 
4:17 PM
Damn, so deep, much lyrics
@KendallFrey is that your jam?
 
no :P
 
Hm, doesn't she have a song called friday?
 
lmao yes
Everyone knows that
 
Is she going through the entire week?
 
It's the most hated song of all time.
 
4:19 PM
!!urban Rebecca Black
 
@RodrigoSilva Rebecca Black Accomplished musical artist renowned for her skills in reciting the days of the week while having lots of FUN FUN FUN. Her life has been characterized by a series difficult decisions, such as picking a seat on the way to school.
 
Hm, seems like a very tough life
@KendallFrey in your game-dev adventures, which engine did you use?
 
@RodrigoSilva XNA mostly
 
4:35 PM
I'm intrigued, when designing stuff... Did you learn general design development?
 
what?
"design development" design and development are 2 different things
 
Hm, your characters, scenarios, etc
 
user1804599
Development is a superset of design.
 
I mean, design as in: graphic stuff
Design in my language has a graphic conotation
 
Oh, I didn't do much of that
I can make a bit of pixel art
My brother made the models for my game though
 
4:37 PM
Ah, sadly I have no brother with modelling skills
 
me neither :P
 
He was just a bit better than me
He doesn't do it anymore though
 
user1804599
Model–View–Controller skills.
 
@rightfold I didn't mean it in that way. It was a poor choice of words, sorry.
I meant like art stuff
 
user1804599
4:38 PM
Model–Model–Model.
 
I'm lost now
 
He's trolling, ignore him
 
user1804599
@RodrigoSilva I think you are looking for the view then. :D
 
user1804599
I wish JavaScript had threads.
 
user1804599
Callbacks are really suck.
 
4:40 PM
it does
 
For example, I've checked out the Unity's 2D tutorial. I would never be able to do the art stuff
At least, now
 
web workers I think they're called
 
user1804599
Web works have trouble with I/O, IIRC.
 
@rightfold also promises
the new big thing
 
user1804599
Pfft.
 
user1804599
4:41 PM
Erlang has been doing it right since 1986. :P
 
user1804599
I have been thinking of implementing a tool that translates a high-level language into JavaScript with CPS for every function call.
 
user1804599
With a single exception which is the async function.
 
colleague of mine was preaching about Erlang the other day
he was teaching a message-passing model in the spirit of how (he says) Erlang works, in C#. It's really good.
having never used Erlang I cannot confirm or deny, but the C# version works really well
 
user1804599
You can do it in C# with threads an queues.
 
yep, that's the gist.
@rightfold my messy attempt, cobbled together from code I wrote while listening to him talk, maybe interesting? github.com/TWolverson/Dispatcher
n.b. the example has a really blatant and crippling bug :)
 
user1804599
4:49 PM
It seems very complicated.
 
the concept in general, or my implementation?
 
user1804599
Implementation.
 
Hm, really?
the generic typing stuff is intentionally done explicitly rather than using interface variance to munge types
 
user1804599
gimme a sec
 
I can't see what other aspect of it uses any more code than you'd need
 
user1804599
4:58 PM
 
Aha, I see what you mean.
There is a lot more functionality in this, pub/sub, retry mechanism, etc etc
that gist is elegant though
a lot of the cruft in Dispatcher is for munging generic types
 
5:16 PM
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Rows[0].Cells[0].Value = textBox1.Text;
dataGridView1.Rows[0].Cells[1].Value = textBox2.Text;
dataGridView1.Rows[0].Cells[2].Value = textBox3.Text;
dataGridView1.Rows[0].Cells[3].Value = textBox4.Text;


}
this is my code. i want to add rows in grid view when adding data through a form . advice pleas
using C#.net
currently it saving data in first time only
 
5:35 PM
@s_fdo Explain more?
 
@jyrka : i have a registration form and i want to display the data which enterd through the form in gridview using c#.net
i have use the above code for submit button on my form. very first time when im enter data its displaying on grid , but rows are not incrementing when values adding continuosly.
please advice
i just try it using a "for condition" as well.
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
dataGridView1.Rows[i].Cells[1].Value = textBox2.Text;
dataGridView1.Rows[i].Cells[2].Value = textBox3.Text;
dataGridView1.Rows[i].Cells[3].Value = textBox4.Text;
}

}
 
why not use a listbox?
 
but still not working. im new to c#.net
 
@s_fdo tip #1: Don't say c#.net. There's no such thing - the language's name is C#
 
@jyrka
without using gridview , isnt it ?
 
5:39 PM
Rather than trying things randomly, how about looking at the code and understanding what it does
If you modify the first row, then it's not going to add a new row
 
user1804599
440
A: Why do I need an IoC container as opposed to straightforward DI code?

Ben ScheirmanWow, can't believe that Joel would favor this: var svc = new ShippingService(new ProductLocator(), new PricingService(), new InventoryService(), new TrackingRepository(new ConfigProvider()), new Logger(new EmailLogger(new ConfigProvider()))); over this: var svc = IoC.Resolve<IShip...

 
user1804599
I think I don’t really understand this answer.
 
user1804599
var svc = new ShippingService(new ProductLocator(),
   new PricingService(), new InventoryService(),
   new TrackingRepository(new ConfigProvider()),
   new Logger(new EmailLogger(new ConfigProvider())));
 
user1804599
How would say ConfigProvider even know where to get the configuration from if nothing is passed as an argument?
 
@KendallFrey : i didnt get. please kindly explain
 
user1804599
5:41 PM
Same for ProductLocator and the product data.
 
user1804599
Is it common to use globals (beh)?
 
@s_fdo Look at your first code snippet. Which row are you modifying?
 
@rightfold I suppose if you are derp and like explicitly creating dependencies, maybe :P
 
user1804599
No, listen.
 
@KendallFrey : first row, according to first code snippet
 
user1804599
5:42 PM
How does the ProductLocator passed to the ShippingService know where to locate products?
 
@s_fdo Is that the row you want to modify?
 
@KendallFrey :no , i want to add rows , when entering data
 
Then why would you expect it to work?
 
@rightfold hardcoded?
 
user1804599
OIC.
 
5:44 PM
ok @KendallFrey , then i try this ,
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
dataGridView1.Rows[i].Cells[1].Value = textBox2.Text;
dataGridView1.Rows[i].Cells[2].Value = textBox3.Text;
dataGridView1.Rows[i].Cells[3].Value = textBox4.Text;
}
 
And which row is that updating?
 
but still not working . please advice
 
you must add columns before rows
 
@rightfold I think it was a contrived example to demonstrate the 'too much noise' argument, it just indicates how dumb having so many chained constructors looks
 
columns are added, using gridview in design
 
user1804599
5:45 PM
I don’t see why you would create more than one ShippingService anyway.
 
user1804599
You create those once in your main function and pass them to whatever depends on them.
 
@jyrka : i create gridview with columns using GUI design interface in c#, do i need to add the code as well
i just right click on gridview and add the columns
 
user1804599
(And whether that code is written manually or automatically is not very relevant to me.)
 
then no, you dont have to add with code
 
user1804599
Just for clarity: would IoC.Resolve<T>() create a new object of type T every time it is called?
 
5:48 PM
@jyrka : then how can i proceed this . please advice
 
@rightfold it depends. IoC containers usually support configurable scope, so that Resolve() could return the same instance each time, one instance per thread, or a new instance per call, depending on config
 
user1804599
Oh, nice.
 
I've seen named instances and heuristics for deciding which types get which dependencies injected as well, that gets pretty wacky
 
user1804599
And what would IoC be? A static class? :v
 
I hope not - that smells like Service Locator
 
user1804599
5:52 PM
@TomW I don’t mind wiring up dependencies manually.
 
user1804599
I do mind passing them around all the time.
 
yeah, I've seen cases of really deep object trees that just pass IWhatevers down and down and down...
I don't think there's an easy answer to that problem except don't do that
 
user1804599
Implicit arguments work well IME.
 
user1804599
Can be achieved through monads.
 
user1804599
But a pain in languages that are not Haskell. OTOH web development is a pain in Haskell. So I’m stuck. :P
 
5:56 PM
Grasping functional idioms is probably too much effort for enterprise devs who have to ship something, preferably this year
I've been trying to understand monads for years. I can probably recite the definition (don't make me do that) but that doesn't help me understand what the point is
 
@s_fdo you want to add row only when something is in text box? (sry if i dont get it atm, i have such a headache :P)
 
user1804599
@TomW Monads are a generalisation of functions.
 
user1804599
IME that’s the best way to think about them.
 
user1804599
Functions cannot have side-effects and are limited to constants and their parameters.
 
@jyrka : yes when filling for text boxes and click submit it should add a row with data
 
user1804599
5:58 PM
With monads you can emulate side-effects and implicit inputs, as well as customising what happens between invocation of actions.
 
@jyrka : yes when filling four text boxes and click submit it should add a row with data
 
some smartass published a graph of popularity of functional languages vs. number of monad tutorials. I loled.
I think I'd have to personally encounter the problems one has when not using monads, in order to grok monads
 
user1804599
For example, with regular functions foo(); bar() would be equivalent to just bar(), because the output of foo is not used.
 
user1804599
If foo() and bar() were monadic actions, and ; bound them, then the action foo() could affect the behaviour of the action bar().
 
can you define 'bound'?
 
user1804599
6:01 PM
It’s an operation that is specific for each monad.
 
user1804599
It takes an action and a function returning an action, and applies the function to the result of the first action.
 
user1804599
In C# if you do foo(); bar(); then they are both guaranteed to be executed (ignoring non-returning functions).
 
user1804599
But monadic bind can say “well I’m not interested in the result of bar() anymore so let’s just skip it.”
 
user1804599
data Maybe a = Just a | Nothing
(Just _) >> x = x
Nothing >> _ = Nothing
foo = Just 42
bar = Nothing
baz = Just 314
foo >> bar >> baz -- result is Nothing
foo >> baz -- result is Just 314
 
user1804599
do { foo; bar } happens to be syntactic sugar for foo >> bar.
 
user1804599
6:05 PM
This particular example could be used for primitive error handling (if any of these actions fail, just fail as a whole, otherwise return the result of the last action).
 
I've tried to learn a little Haskell (I guess that's what that is) but you jumped very quickly into idioms you couldn't guarantee I'd understand there :P
if you care, for honing your pedagogical technique
 
user1804599
You can use monads to emulate state or carry read-only data. This are in particular interesting for dependency injection-like behaviour.
 
user1804599
data User = User String

class Monad m => InsertUser m where
    insertUser :: User -> m UserID

createUser :: InsertUser m => String -> m (Either String UserID)
createUser "" = return (Left "invalid user name")
createUser name = Right `fmap` insertUser (User name)
 
user1804599
Now you can call createUser wherever a value of type m (Either String UserID) is expected.
 
@s_fdo : private void button3_Click(object sender, EventArgs e)
{
if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")
{
dataGridView1.Rows.Add(1);
dataGridView1.Rows[0].Cells[0].Value = textBox1.Text;
dataGridView1.Rows[0].Cells[1].Value = textBox2.Text;
dataGridView1.Rows[0].Cells[2].Value = textBox3.Text;
dataGridView1.Rows[0].Cells[3].Value = textBox4.Text;
}
}
 
user1804599
6:10 PM
And wherever m UserID is expected, insertUser can be called, because that’s what insertUser returns.
 
@rightfold nope, you've lost me. I think monads must be just as much an artefact of functional languages as IoC containers are of statically typed, object oriented languages
although I know they have a pure mathematical definition
 
user1804599
Usage: createUser "rightfold". No dependencies explicitly passed!
 
user1804599
All you have to do is overload insertUser for some monad m.
 
user1804599
And the correct overload is automatically picked based on where createUser is used.
 
OK, bear with me. class Monad up there describes a data structure that takes an m, and returns the result of calling InsertUser on m, where InsertUser is any function that takes an m
is that right?
where 'takes' and 'returns' are OOP idioms that have no place here
 
user1804599
6:16 PM
class Monad m => InsertUser m where describes a type class InsertUser of which instances must be instances of Monad too.
 
user1804599
Monad m => is a constraint.
 
user1804599
It is kind of similar to interface InsertUser : Monad { … } in C#.
 
does that mean something different to => describing a lambda expression, or do they describe the same idea?
 
user1804599
=> doesn’t do lambdas in Haskell.
 
user1804599
-> is for lambdas.
 
user1804599
6:17 PM
=> is for constraints (think where in C#).
 
hnngh. That must be considered a deliberate gotcha
although only in the same way that [] and () mean totally different things in C#, I suppose
that is, not at all.
 
user1804599
Wait, let me write this in C#.
 
This thing that I am unfamiliar with is obviously terrible and wrong and that which I am familiar with is obviously better, so say the internet
I need to tell someone how much I want to buy this ebay.co.uk/itm/…
consider staging an intervention for me guys - please
 
@jyrka : now its adding empty row in each submit and data changing only on gridview first row. data not display on seperate rows . please advice
 
@s_fdo testing atm.
 
7:21 PM
What does this return, and how do I access the properties?
ah, JObject
 
7:36 PM
Anyone any good at Karma testing in Angular?
 
7:56 PM
Anyone know how can i get that icon from windows, thats used for the Information messagebox ?
i guess its in imageres.dll , but how to get it from there?
 
icofx might be able to extract it
 
i mean use it straight from the dll
 
oh, idk
Scumbag Microsoft, put a class in .NET but make it only work on Windows 8.
 
I hope Windows 9 wont be that tablet pc crap :/
nm. found it.
[DllImport("Shell32.dll", EntryPoint = "ExtractIconExW", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
 
8:49 PM
dafuq? the tree icon should have index 42 ( i.stack.imgur.com/ox0ZH.png ) but i get it with 41 o.O
 
@jyrka zero-based indexing
 
i dont get it
oh it starts from 0
 
9:17 PM
@CCInc have you ever written anything simple in wpf?
 
9:27 PM
@JohanLarsson You mean.. have I ever not tried to go over the top on my first try?
 
yeah all the things you have asked about have been really advanced
 
Well, no. I don't think I have written anything simple
 
10:18 PM
Someone should build a phone OS that looks just like Windows 3.1.
 
@Ryan Thatd be pretty hipster
 
Have any of you ever used web sockets in C#?
 
Yeah I used them on one project
 
Which implementation?
 
i have tried using them :P
 
10:25 PM
@Kendall Let me check...
 
i tried make this (as my first project): youtube.com/watch?v=BDVfpPq3weo
 
I used Listeners
 
@OutlawLemur What's that? Is it a third party library?
 
@KendallFrey No... I meant System.Net.Sockets.TcpListener... appearently the udp was third party though
 
So you implemented it yourself?
 
10:29 PM
Yeah with some help from the internet... I have used HttpListener more extensively
 
Are you sure you're talking about the right thing?
WebSocket is a protocol providing full-duplex communications channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C. WebSocket is designed to be implemented in web browsers and web servers, but it can be used by any client or server application. The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request. The WebSocket protocol makes possible more interaction betwe...
 
Yeah I implemented a realtime game server, which for the master server I used Http and the games used either tcp for chat or udp for the information about the players
The udp code was not very original though...
 
It sounds like you weren't using WebSocket.
 
Ah yeah sorry I was thinking sockets in general
My bad
 
WebSocket
 
10:34 PM
Close enough :)
 
@KendallFrey SignalR uses Websockets, btw. And if it's a browser that doesn't support WebSockets, it gracefully degrades to HTTP.
Never used it though. I just know that is the case.
 
I'm making a client though
 
I have no idea how to do client-side websockets. I was actually thinking about that today. Considering if it'd be cool to do that with an AngularJS app.
 
@Ryan I've heard it is bad practice to use AngularJS.... but I don't know anything about it
 
10:38 PM
It seems to be the best out there, but it may not fit my app well
 
I've heard exactly the opposite, Outlaw.
 
@Ryan Huh... I just heard that from minitech
 
!!opinion
 
Haha
 
10:41 PM
Perfect. haha.
 
Yeah I don't know much about JS... or even too much about C#;)
 
You can never know too much.
 
JS is shit. It's like going from driving a 2015 Lexus to an '83 Honda.
 
Except for the story I was told about a guy that was so smart his brain popped.
!!tell RyanJMcGowan opinion
 
10:43 PM
I personally love JS
 
Yeah but you're a masochist.
 
Yes, but the two are unrelated
I write JS because I enjoy it, I write REBEL because it's hard.
 
I'll love it too when it's ECMA 6.
 
What do you mean 'when'?
ECMA 6 is already being adopted.
 
I was just looking at the compatibility chart and it was a mass of red.
Look at the "class" row. Depressing...
 
11:40 PM
guys, with EnvDTE, is it possible to parse in-memory C#-code string to get the FileCodeModel?
I don't want to mess up with project file by adding a temporary file, get its ProjectItem, do stuff and then delete the file. It will touch the project file, which would lead the source control to observe the changes.
@RyanJMcGowan, see this connect.microsoft.com/IE/feedback/details/814466/…. You can vote there by clicking on I can too.
 
They are working on that "bug" but very slowly. It's crazy that it took this long to get ECMA up to speed with the rest of the programming world. JavaScript is like working in 1980s syntax.
 
Well even other browsers aren't up to the task yet. So compare to what they are slow, its beyond me..
 
@RyanJMcGowan How is JavaScript syntax like working in the 1980's?
JavaScript is very expressive.
 
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
It's a notch more expressive than Regex.
 
11:56 PM
Speaking of other browsers and JS conformance, see how IE11 (or even IE10) performs in official ECMA tests, compare to the edge versions of top browsers: test262.ecmascript.org ...
personally I don't like stats much, but sometimes they come handy to eradicate misconceptions :)
 
@RyanJMcGowan What the heck is that? It's certainly not idiomatic JS.
> Somebody essentially assist to make significantly posts I'd state. That is the first time I frequented your web page and thus far? I amazed with the research you made to create this actual submit amazing. Wonderful task!
Epic blog comment
 

« first day (1288 days earlier)      last day (3657 days later) »