« first day (1824 days earlier)      last day (3123 days later) » 

3:13 AM
private void UpdateMargin()
{
try
{

DbConnection.checkConnection();
SqlCommand cmd = new SqlCommand();
cmd.Connection = DbConnection.con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "UpdateMargin";
//cmd.Parameters.Add(new SqlParameter("@Margin", SqlDbType.NVarChar).Value = Convert.ToInt32(comboBox1.Text));
cmd.Parameters.AddWithValue("@Margin",comboBox1.ToString());
cmd.Parameters.AddWithValue("@Id",MarginID.Text);
DbConnection.con.Open();
cmd.ExecuteNonQuery();
Verification.Save();
error converting data type nvarchar to int
cmd.ExecuteNonQuery();
Verification.Save();
DbConnection.con.Close();
this line
error
error converting nvarchar to int
how to solve it
 
3:47 AM
comboBox1.ToString() should be comboBox1.Text.ToString()
Or comboBox1.SelectedText or something
 
 
2 hours later…
6:13 AM
@MirzaJhanzaib: What exception is it throwing? What is the expected value in the stored procedure, and what value are you passing to it?
 
7:08 AM
wow is he still asking the same question?
^ also comboBox1.ToString() probably doesn't return the text of the combo box.
 
isnt it comboBox1.selecteditem or something like that?
 
Correct.
SelectedValue gives you the value, selectedindex gives you the index. SelectedItem needs to be casted to whatever type it is.
iirc that is.
 
and .ToString() will get you a description of the ComboBox type
 
yep
 
does anyone here actually override .ToString()?
 
7:16 AM
i do, but mainly for debugging
 
That depends on context.
Sometimes it's useful, sometimes not.
 
that thing where you reply to an email chain and realise half the recipients have their own wikipedia entries
crikey
 
TFS plugin for Eclipse, you are absolutely, positively the worst piece of software in the world ever ever. *dies*.
 
@AvnerShahar-Kashtan given the constraints of TFS + Eclipse I honestly think it's the best it could possibly be given the circumstances
 
I bet you guys didn't even know there was a Microsoft-published TFS plugin for Eclipse. Let me assure you, you were happier in those days of blissful ignorance, 30 seconds ago.
 
7:21 AM
@AvnerShahar-Kashtan it wasn't written by MS!
 
Dunno who it was written by, but it's published by MS.
  TFS plug-in for Eclipse	12.0.2.201409181809	com.microsoft.tfs.client.eclipse.feature.feature.group	Microsoft Corporation
It's a complete recreation of VS's Team Explorer UI, which looks out of place in Eclipse, and it works horrendously slowly.
I click View History on the same file in Eclipse and VS, on a Visual Studio Online repository. Takes 2 seconds in VS, but it makes Eclipse unresponsive for 20 seconds.
 
and as with everything in Eclipse, the configuration is totally obscure
 
@Squiggle And resides in a different place than other Eclipse plug-ins. It's the wild west, baby!
Ooh, I see there's an update!
From back in July. I'll try it and see what happens.
 
yeah I've used it, on an AngularJS/Java project.
the entire thing was a beautiful cludge, only saved by some supremely elegant architecture decisions by the senior engineer
@AvnerShahar-Kashtan good luck! I'll see you in a few hours when you return from reinstalling Eclipse ;)
 
I've used Eclipse with SVN in a previous project, and now Eclipse with TFS. Being used to VS's relatively abstracted API - switching SCC providers is nearly invisible - I was struck by how each SCC plugin in eclipse does everything differently. Different menus, different workflows.
Luckily I have a lot of C# tasks, so I can work on that while eclipse goes into its seizures.
"Updating Software has encountered an error". Of course.
The error, mind you, was downloading the packages for the installation of components I explicitly deselected for upgrade.
Thank you, eclipse.
 
7:57 AM
Theclipse.
 
Eclipse, the nightmare when taking programming courses at the university.
 
have you guys tried IntelliJ idea?
 
@Alex Not for a while, but I do approve of many things that JetBrains create.
 
Have a friend who does Java for a living, and he praises it like it's some sort of god.
 
yeah last time i did java i gave it a go
 
8:04 AM
that's because it's divine compared to the old Eclipse/NetBeans
Google used IndelliJ as the base for their Android IDE, right?
 
i think so yeah
 
I've used it a bit, as a R# fan. It still felt really unwieldy, but not the frankensteinian mess that is eclipse.
 
the problem i have is i have spent way to long in VS
 
everything else feels lame by comparison?
 
yeah
by comparison VS is so polished and intuitive
 
8:19 AM
@AvnerShahar-Kashtan So you're leaving Java behind forever then? good for you :)
@Squiggle I know that feeling ... every time someone suggests a solution I can't implement in VS i'm like "meh, i'll think about it"
@Alex Literally nothing seems to match VS, the only really big upgrade I could see it needing right now is a plugin that basically put unity or similar right in VS so I could do everything in there
 
@Wardy I would really like full javascript/angular/other popular framework support inside VS.
 
@AvnerShahar-Kashtan you can already for the most part
 
Specifically, settle on a package management solution (require.js? whatever) and have IDE support for it.
 
guys I'm having trouble uninstalling VS2013 from my machine. It keeps getting stuck
 
@AvnerShahar-Kashtan have you tried the new asp.net 5 stuff?
 
8:30 AM
@Alex Not yet, no. I hope it kicks it up a notch. Earlier ASP.NET's scriptbundles was a mess, and everything else was basically downloading scripts manually and adding <script> references to them manually as well.
 
@AvnerShahar-Kashtan you now have NPM and bower, it can have gulp ad grunt automation.
you cant have a full only html/js/etc project
but its easy to make a quick (4 second) asp app that just pushes static files
 
@Alex But that means I can't deploy it without server-side ASP.NET support.
 
@AvnerShahar-Kashtan you can, you just dont deploy the ASP.Net side of things
 
@AvnerShahar-Kashtan You just need the global and VS will deal with it.
If you must have module support, why not TypeScript ;-D
 
I don't need module support necessarily, I just want something as simple as NuGet for downloading dependencies. And if the ever-mediocre NuGet is my standard to aspire for, you know things are bad. :)
 
8:38 AM
thats why they have bower and npm support
 
Yeah, if there's IDE support for browsing and pulling bower packages, I'll be happy.
 
I'd be surprised if there isn't
I'm really looking forward to it
 
well, they may add it at the moment you use a json file
 
you start typing and intellisense goes out and finds the packages and versions
you have the same thing for nuget now as well
no more CSProj files
 
8:44 AM
g'day
foreach(var key in someDictionary.Keys){someDictionary[key] = "test";}
did you know that that statement results in an exception because the enumeration was changed?
 
yes, you should use for not foreach if you need to change things
 
@Alex look closely, I'm not actually changing the enumeration I'm looping through
 
well remove/add things not change
@SteffenWinkler you are changing something
 
yes, so?
it's not in the enumeration that is used in the foreach loop
 
@SteffenWinkler you cant add/remove/replace while enumerating
 
8:48 AM
again: I'm not enumerating over the values.
 
@SteffenWinkler doesnt matter
 
uh yes.
(well apparently it doesn't matter, but it should)
 
uh no a dictionary isnt that simple
 
cmd.Parameters.AddWithValue("@Margin",comboBox1.Text.ToString()); not solve it
 
it's a two dimensional array with some logic on the first dimension
 
8:49 AM
its not just a pair of lists, when you make a change to the value it changes keys
 
You shouldn't change a collection while iterating it.
 
@scheien I'm not doing that >.<
or at least I didn't thought I would
 
someDictionary[key] = "test";
 
@SteffenWinkler: You are changing the value?
 
@scheien yes, but the Value is not part of the iteration
 
8:51 AM
@MirzaJhanzaib do you even know what you're trying to do?
 
keys is changed when you change a value
 
@SteffenWinkler: but you are modifying the collection, by changing the value. I agree with you that it is weird. :)
 
@Alex is that documented somewhere? Because I'd actually love to read up about that
 
holla if you find some docs on it
what exception does it throw?
 
@MirzaJhanzaib What are the types of the parameters?
 
8:53 AM
try
{

DbConnection.checkConnection();
SqlCommand cmd = new SqlCommand();
cmd.Connection = DbConnection.con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "UpdateMargin";
//cmd.Parameters.Add(new SqlParameter("@Margin", SqlDbType.NVarChar).Value = Convert.ToInt32(comboBox1.Text));
cmd.Parameters.AddWithValue("@Margin",comboBox1.Text.ToString());
cmd.Parameters.AddWithValue("@Id",MarginID.Text);
DbConnection.con.Open();
cmd.ExecuteNonQuery();
Verification.Save();
DbConnection.con.Close();
 
@scheien that the enumeration was changed
 
23
Q: Why cant we change Values of a dictionary while enumerating its keys?

Vitaliyclass Program { static void Main(string[] args) { var dictionary = new Dictionary<string, int>() { {"1", 1}, {"2", 2}, {"3", 3} }; foreach (var s in dictionary.Keys) { // Throws the "C...

 
error converting nvarchar to int
 
@MirzaJhanzaib YES WE KNOW
 
@MirzaJhanzaib Do you even read what we ask?
 
8:54 AM
Verification.Save();
this line
 
@MirzaJhanzaib Yes, but what are the types of the parameters
 
error
 
cmd.Parameters.Add(new SqlParameter("@Margin", SqlDbType.NVarChar).Value = Convert.ToInt32(comboBox1.Text)); and this doesn't even make sense...
 
nvarchar
 
@MirzaJhanzaib type of Margin and id?
 
8:55 AM
@MirzaJhanzaib "@Margin" and "@Id" are both parameters. What are the types of these fields in the database?
 
@scheien @Alex I just declared a List<T> above the foreach, assigned the keys to that list and enumerate over that...
 
> An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined.
 
cmd.Parameters.Add(new SqlParameter("@Margin", SqlDbType.NVarChar).Value = Convert.ToInt32(comboBox1.Text));' error input string was not in a correct format
 
@SteffenWinkler that works, or you could use for instead.
 
@MirzaJhanzaib What are the types of these fields IN THE DATABASE?
 
8:57 AM
@MirzaJhanzaib YOU ARE NOT ANSWERING OUR QUESTIONS
 
@MirzaJhanzaib please stop repeating yourself and help us to help you
 
nvarchar
 
@MirzaJhanzaib both?
 
@Alex never! That's C/C++ stuff. It looks ugly :/
 
8:57 AM
ncarchar
.net
 
and if I wanted ugly code I would code in Java
 
i am gaving your anser
 
@MirzaJhanzaib Try this:
 
Loetn
 
cmd.Parameters.Add(new SqlParameter("@Margin", SqlDbType.NVarChar).Value = comboBox1.Text);
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.NVarChar).Value = MarginID.Text);
 
8:59 AM
^ that should do it
I'm still not convinced "Id" is nvarchar.
because that would be a fugly database design
 
id in int in database
 
^ aah..
Then you have to convert MarginID.Text to int
and not Margin
 
Yep.
(but there's probably something fundamentally wrong with the design if you're entering an integer ID into a textbox...)
 
@Squiggle you would prefer byte[]?
 
;_;
also, WHY ISN'T WINDOWS FORMS DEAD ALREADY
can we, like, purge all Windows Forms codeproject HOWTOs? That might stop the rot...
 
9:06 AM
:/
i started programming with windows form...
i don't hate em
i don't love em
 
I think we all did. But it looks like people are still learning WinForms like it's the only thing out there.
 
its a wired relationship
 
@SteffenWinkler @scheien take a look at github.com/dotnet/corefx/blob/… around line 126, its the sorted dictionary from .net core it does basicaly the same thing as the normal dictionary
 
Agreed Squiggle, thats an issue
 
but then they stick StoredProcedure SqlCommands in onClick events as if they're Real Programmers and we all inherit business systems that aren't remotely fit for purpose
2
/rant
:)
I'm guilty of that too, but only because I didn't know any better. I blame tutorials.
especially codeproject stuff. They all teach quick-and-dirty programming rather than any sort of systems design.
 
9:12 AM
well not necessarily their fault
 
yeah
 
most people don't wanna push beyond their comfort
including me as well
 
@SteffenWinkler @scheien basicaly the problem is a dictionary isnt a 2d array its a list of KeyValuePairs, in a 2d array the key is preserved but with a list of KVPs the key is changed as well
 
it's not so much that - it's more a case of actually knowing there are other ways to do things. Expanding one's horizons takes effort.
 
hmm guys I need to map a string to a list of ints... that is a question to a list of possibly answers. What would be the best way to do this?
 
9:14 AM
Rather than tutorials i blame educational institutes
right now i am sitting copying thesis of another student cuz my project supervisor said so
 
@KalaJ the string is unique?
 
If so, is IDicionary<string, List<int>> an option
 
yes the strings are unique
So I want to map these questions to those answers
trying to create that quiz on my own
in asp.net mvc
 
@Rusty I had a pretty good grounding of software engineering at uni. I graduated knowing that writing SQL in the UI was probably wrong.
 
9:16 AM
@alex yeah
 
@KalaJ The answers are always the same?
 
@Loetn, yes the answers are always the same and they map to int values. so like "Not at all" maps to 0
etc..
 
@Squiggle I did not like writing SQL at HS/Uni. But now that I'm using it in the real world, I like it.
 
Maybe I should have those values as an enum? How do I map the enum to the string of questions then?
 
there are pretty bad institutes out there and i belong to the worse. Thanks goodness there is a community of great developers on the web, and pluralsight too...
so I am in favor of tutorials and code project :D
 
9:19 AM
@Loetn aye - SQL is an awesomely powerful language, in the right context. It's a different mindset to procedural programming, which makes it a little steep on the learning curve when you try to use it in depth.
Ever used R?
 
Nop, heard of it
 
@Loetn, can I show you what I have done so far just to get an idea on how to proceed
 
that's a real data processing language. Learn it and you'll never be afraid of set theory ever again ;)
 
@KalaJ Sure :)
@Squiggle If I find the time to read about/learn it :)
 
So, I'm trying to replicate the quiz I showed you before
so far i just initialized a bunch of stuff:
 
9:26 AM
@Loetn Coursera is good for stuff like that
 
Now I need to be able to tally up the values from the answers when the user answers the questions
Does the way I currently have the questions and answers setup make sense?
for a quiz?
and I should return the list of questions to my view but what about my answers?
 
how will you be recording or validating the answers in the controller/back-end?
 
Not sure, I was thinking maybe I should do it on the front end?
oh wait no
 
i.e. what is the data format you're expecting to be returned from the view?
 
I mean I will record or validate the answers on post
with a submit button
the data that will be return will be what answer the user selected
so perhaps the string
or int
 
9:38 AM
cool - but in what format?
 
of the value of the selection
what do you mean?
like json format?
 
are you posting back JSON? or is it ASP.Net MVC with model binding?
sorry if I'm confusing things for you!
 
@Squiggle With some projects I've worked on, I would have killed for something as benign as SqlCommands in OnClick events.
 
@AvnerShahar-Kashtan likewise! Over-engineering with good intentions is just as destructive, right?
 
One project had layer separation, technically. The DAL layer would access the database, structure the data hierarchically, create a WinForms TreeView and return it back to the client-side to add to the form.
Because, hey, WinForms controls are the perfect DTO, right?
 
9:40 AM
@Squiggle, kind of a side project. I was thinking about starting out small first. Like the easiest approach and I'm looking for advice. I think json might be easier no?
I was thinking maybe I don't need models ?
or do?
oh wait hmm
I mean to say, I don't want to save the records
Hmm or we can start over from scratch and figure out what's the best, easiest way to do this
 
@KalaJ my advice is to phrase things in terms of data and interactions. i.e. What information does the server require to know what the user selected for each answer? Is that a dictionary<int,int> (questionId/answerId)? Is that enough?
and what does your view need for the user to see the questions and select answers?
or you could create Question and Answer models to make it clearer
and supply a list of Questions and a list of possible Answers, and expect your view to return a list of Questions, each with a single Answer
then you can validate that each Question has an Answer, do some calculation on the results...
 
9:56 AM
I would have models from questions and anwers, with question holding a list of answers and a correct answer then have a veiwmodel pass a list of questions
 
OOP is great for describing stuff :D
 
ah ok, let me mock up the models and get back to you guys. So what make this interesting is there's no right answer
it just tallies up the answers together and sees where you fall kind of thing
 
o///////////
 
@Squiggle, now for my controller, I should instantiate my question model and set it equal to the the value of the strings in my list
and do the same for answers model with answers
pass that to the view on get
 
@KalaJ you mean like a List<Question>? where Question has an Id and a Text?
 
10:07 AM
I initially had it set up as a list of List<strings> but List<Question> sounds like a good bet
 
@Squiggle With regard to your patterns rant
Is there a good book in the context of "design patterns for dummies"?
 
@Sippy Head First Design Patterns was a good one - I think it's still current
 
Cheers
 
based on the Gang-of-four, but far less dry
 
I know a few basic design patterns, but I wouldn't be confident in every situation to say "You should use this pattern, because ..."
I also still need to read a C# book all the way through and an EF book lol
 
10:13 AM
@Sippy you know MVC :)
 
Do I?
MVC is such a distant memory ..
 
:(
 
I fear I have been assimilated.
LOLJK get me out of here.
7 weeks <3
 
@Sippy then learn MVP and be the envy of your co-workers when you create elegant WebForms applications!
 
Lol
"Oh, I don't understand that. I'm just gonna do it this way."
NO. YOU WILL LEEEEEEARN
 
10:16 AM
MVP is like MVC but with more boilerplate and actual eventing
 
@Squiggle, here's what I have done so far. I'm stuck on understanding how to set what I have above to my models. pastebin.com/XNtj8J9U
 
That's pretty cool
I wish they fucking taught patterns at my university
Might email some of this stuff to my old lecturers lol
 
@KalaJ currently your questions have no identifier, which makes things tricky
 
can I have a list of <int, strings>?
Would that help?
 
@KalaJ dictionary<int,string> would be ideal
 
10:19 AM
ah ok
I will change it
 
@Sippy FWIW I scored 21% on my SoftEng module at uni first time round ;)
I just didn't grok it
 
here's what I'm trying to model btw for reference: patient.info/doctor/patient-health-questionnaire-phq-9
@Squiggle, now I have a dictionary yay
What next?
 
@KalaJ try using Linq to convert the dictionary into a list of Questions :D
 
what? lol
mind blown, I had a list of question to dictionary now back to list? what?
 
var viewModel = questionDictionary.Select(q => new Question { Id = q.Key, Text = q.Value }).ToList();
:D
 
10:23 AM
how to redirect host_name.com to host_name.com?
 
eh, your dictionary of questions is basically your database
your list of Questions is your view model
 
ok
 
@Squiggle I did woefully as well
 
so now then I have to return my viewmodel
from my controller to view right?
What should I do with the answers?
 
My first coding exam flattened me
 
10:28 AM
@Sippy IME we learn far quick by just doing programmings
@KalaJ good question :)
so your viewmodel will need to be both the Questions and the possible Answers
 
@Squiggle: yep, practice makes perfect.
 
var viewModel = {
    Questions = questionsList,
    Answers = answersList
};
 
@Squiggle My first coding exam was handwritten code :)))))))
I abhor my lecturer for that oversight.
 
@Sippy trololol
 
She was amazing at teaching but piss poor at testing.
 
10:30 AM
kebab time. bbl.
@KalaJ ask @Sippy for help. He's like an MVC guru.
 
@Squiggle, nice. btw, for select, I get no overload for Select takes two arguments
Thank you so much for your help!
 
Roflmao
 
Hi Sippy :)
 
HEY!
 
(now kiss)
 
10:33 AM
haha
I'm trying to do this:
but "No overload for method 'Select" takes 2 arguments'
 
also protip KalaJ - your Questions should only really have one answer
 
 
ah
change the list in the model
 
@Kala What are you trying to do?
 
@KalaJ you need two separate select statements. You can't roll 'em into one.
 
10:36 AM
ok
@Sippy, I'm trying to make a questionaire
but instead of instant results, I would have the user submit their results
 
<urlMappings enabled="true">
  <add url="~/Services/CRCUpload/AirCRCDataSvc.wsdl" mappedUrl="~/AirCRCDataSvc.asmx?wsdl"/>
</urlMappings>
would that work?
 
@KalaJ No, I mean specifically with that query
 
oh I think I got it working now. I wanted to get the list of questions and answers
 
You can do that with one Select but it wouldn't look very nice.
 
okay, so here's what I have so far: pastebin.com/FDTWx1Ew
At this point, I would have to populate the model right
before selection
 
10:55 AM
Hello guys
I'm here for advice :)
 
shoot
 

« first day (1824 days earlier)      last day (3123 days later) »