« first day (1875 days earlier)      last day (3074 days later) » 

12:00 AM
Because were amazing.
 
user47589
do they have a user with a pony avatar? cuz we have 2
 
hey all.. kind of a weird question, wondering if anyone knows.. Are objects in a Dictionary<int, object> pinned to a memory location?
 
they are no different than any other storage of an object
 
The Lemon Party of Canada (Parti Citron) is a frivolous Canadian party which has operated on a federal level, as well as provincially in Quebec. The party was officially registered on January 8, 1987, by then leader, Denis R. Patenaude and deregistered on November 14, 1998 for failing to have at least ten candidates stand for election. The party is headed by "Pope Terence the First", whose existence is unconfirmed. Their official agent is Mary-Gabrielle Blay II. Their 2004 national convention produced a platform of policies which were "placed in small green plastic boxes and sold to industrial...
 
user47589
no
 
12:10 AM
Great First thing i see after comming here is Lemon Party xD
 
user47589
you never know what to expect from this place. one minute you're talking about javascript, then bam! lemon party
 
Since MVC Chatroom is Empty , Anyone can tell me what should i use in my Register Page in MVC to Save the Data to Database After user Clicked the button ? should i use a Form submit thingy ?
@Amy haha ye xD
 
user47589
a form submit, yeah.
 
user47589
are you using razor?
 
yes
 
apparently repeating wasn't very compact
 
Thanks will check it now :D
 
user47589
@TravisJ hm?
 
I tried creating a blank array and reducing it to shorten the code for repeating the padding, but apparently reduce internally skips undefined values.
The only option remaining was to iterate with a for loop so my compact version is still similar to the first one
 
user47589
hehe
 
12:17 AM
function padleft(p,t,v){
for(var i=0,a="";i++<(t-1-(v+"").length);)a+=p;return (a+v);
}
 
user47589
challenge accepted. be back in a few minutes
 
user47589
function padleft(p,t,v){var a="",b=t;while(b--){a+=p;}return(a+v).slice(-t);}
 
user47589
wait, i have a bug
 
user47589
12:25 AM
no, its correct. nvm
 
:)
 
@Amy - It returns 0006351 instead of 006351
@Amy - Should end in .slice(-t+1);
 
user47589
oh, the bug WAS there.
 
still winning though
 
user47589
wait, travis. the width argument is 7, not 6.
 
12:36 AM
ah I see
winning by 4 :P
will try to improve
trying to be fancy at this point
 
user47589
me too. can only shave 1 character off my last one tho.
 
I think I made improvements :P
 
user47589
function padleft(p,t,v){v=v+"";while(v.length<t){v=p+v;}return v;}
 
nice
my improvement was too clever, and required length lol
.length makes things hard to use
 
user47589
12:46 AM
haha
 
user47589
what do you mean?
 
I found a cool way to make the repetition
var a = []; a.length = 6; a.join(0);
however, I couldn't quite work it in to save space
 
user47589
nice
 
var a=[],l="length";a[l]=t-(v+"")[l]+1;return(a.join(p)+v);
but still too long
has to get even fancier
 
user47589
fancy intensifies
 
12:55 AM
return ([].join.call({length:t},p)+v).slice(-t);
still more than your while loop though
although, the fancy on that one should get some extra credit :D still working to beat the while loop
 
user47589
i'm attempting recursion. i can't get it to work tho.
 
interesting
it would probably be very long due to the method name, but you can compact it for simplicity
 
user47589
if i can get it to work, it'll be 10 characters smaller
 
but would require another function declaration ;)
 
user47589
it can call itself
 
user47589
1:00 AM
function padleft(p,t,v){
  return t>1
    ? padleft(p,t-1,p+v)
   : v;
}
 
user47589
i can't get it to take the initial length of v into account
 
don't forget while testing recursion to always place a failsafe so it doesn't crash too hard :)
 
user47589
haha yeah
 
I usually use a simple int counter that breaks at 10000
return (v+"").length==t?v:l(p,t,p+""+v);
where l is the padLeft function
Sadly that is exactly the same count as your while loop
function l(p,t,v){return (v+"").length==t?v:l(p,t,p+""+v);}
function l(p,t,v){v=v+"";while(v.length<t)v=p+v;return v;}
oh, by 1 :P
good idea with the recursion
 
user47589
thanks
 
1:05 AM
I love recursion lol
 
oh man, code golf
bleh
 
haha
that is a padLeft function Steve :) Isn't it obvious?
 
lol no, not at all
i can't even tell
what the hell is going on
i dont think i want to
 
@Amy - If we combine both versions (with your v=v+"" optimization) this looks good
v+="";return v.length==t?v:l(p,t,p+v);
 
user47589
awesome
 
user47589
1:08 AM
nice, you got it to work :) i'm still working the kinks out of mine.
 
I don't think it gets shorter lol
perhaps to ensure there are no errors
v+="";return v.length>=t?v:l(p,t,p+v);
but it is still the same
 
user47589
gonna be hard to get shorter
 
user47589
if its even possible
 
yeah, I mean, the only thing left would be to try to work in bit shifting or something
 
user47589
whoa, i got an idea
 
1:16 AM
time to go for me :)
 
user47589
okay :)
 
@RyanTernier you never smile back :(
im pretty sure he doesn't like me very much, but thats okay i guess
 
 
7 hours later…
8:44 AM
Hi all!
does any one knows answer for this question stackoverflow.com/questions/34082124/…
 
9:06 AM
posted on December 04, 2015 by Scott Hanselman

First, a disclaimer. I have no idea what I'm talking about. I'm learning and exploring some ideas, and I wanted to see what the development process looks like today (December 2015) with Docker, ASP.NET, and Visual Studio on my Windows 10 machine. I'm also interested in your ideas in the comments, and I'll share them directly with the folks who are working on making Docker integration with Visu

 
> First, a disclaimer. I have no idea what I'm talking about.
a good first line.
@Jamaxack is it a version mismatch? mscorlib is a core .Net framework library - perhaps you're trying to use two versions of the framework, and the build is being weird. How is your build configured?
 
this question is @Dilshod 's
 
I just saw one of my projects in the solution had a different framework target and I just changed it.
now I am getting a different error. Let me look more into it
 
Update your question with the progress you're making.
 
good point!
 
9:25 AM
holy moly that's strange
mscorlib is implicitly imported by every project iirc and for that reason it usually won't let you import it again
 
9:42 AM
 
 
2 hours later…
11:20 AM
Does anyone online know how to pass data from a viewmodel to a view?
 
By passing a Model?
What do you mean specifically?
 
@Parth return View(viewModel); in your controller action
 
already have that as the return
 
well that's your answer
 
its not returning data tho
 
11:23 AM
what's 'it'?
 
are you picking it up in the view?
With @Model<.etc>
 
the view is not returning data when run;
yes we do @model BookStore.ViewModels.CheckoutViewModel at the top
 
Do you mean there is nothing displayed in the rendered HTML for that view?
 
yes
 
Let's see your view markup
 
11:26 AM
one sec
was just this: public ActionResult Complete(int? id)
{
return View(id);
}
now it is
 
no, the view, not the controller
 
oh sorry
public ActionResult Complete(int? id)
{
if(id != null && id != 0){
var allModelData = new DataContext();
var myModel = allModelData.FirstOrDefault(x => x.id == id);
}
CheckOutViewModel viewModel = myModel;
return View(viewModel);
}
 
lol
 
that made me giggle
 
my skin tingles
 
11:28 AM
someone told me that would work.. stackoverflow.com/questions/34086505/…
 
that calls the view
 
he wants to see the cshtml where you declare @model and the rest of that file
 
@Parth I'm asking for the razor markup, from the cshtml file for that view
 
@model SafariBooksGroup15.ViewModels.CheckOutViewModel
@{
ViewBag.Title = "Complete";
}

<h2>Complete</h2>

<div class="boxedForm">
@using (Html.BeginForm())
{
<h2>Checkout Summary</h2>
<fieldset>
<legend>Payment Information</legend>

@Html.ValueFor(m => m.CreditCard1)<br />
@Html.ValueFor(m => m.CreditCardType1) <br />

@Html.DisplayNameFor(Model => Model.CreditCard1)
@Html.DisplayFor(Model => Model.CreditCard1)

</fieldset>

<fieldset>
<legend>Shipping Information</legend>
</fieldset>

}
</div>
 
Yes
 
11:29 AM
oh i use safaribooks :D
great site
 
oh thats our project name :P
 
ViewBag.Title = "Complete"; Should be in the controller then <h2>@ViewBag.Title</h2> markup
 
nah
 
@Parth do you see anything? Is it just the data contained in the viewmodel that's missing, or the static content in the markup as well?
 
that gets set in the template
 
11:32 AM
Trying to establish whether the view is being rendered at all, it might be that the convention isn't picking up the presence of that markup and doing...I dunno, something else
 
i see the headers, the fieldset/legend stuff but no data comes
 
Hm. If you view source on the page can you see anything there?
 
like right click view source?
 
yeah
 
var allModelData = new DataContext();?
is DataContext Your DataContext?
 
11:33 AM
if it isn't rendering anything that would be strange
 
^
 
@juanvan yes
and im grabbing the rendered html one sec
 
place a breakpoint before you return view(...), and inspect the viewmodel before you return it
 
<h2>Complete</h2>
<div class="boxedForm">
<form action="/Checkout/Complete" method="post"> <h2>Checkout Summary</h2>
<fieldset>
<legend>Payment Information</legend>
<br />
<br />
Credit Card 1
</fieldset>
<fieldset>
<legend>Shipping Information</legend>
;
;
</fieldset>
</form></div>
 
wat
OK, I don't get why that would happen
 
11:35 AM
ya it pulls nothing about the table
 
yeah....it should atlesat be pulling something from my table right??
 
or error, yes
 
2 mins ago, by Steve G
place a breakpoint before you return view(...), and inspect the viewmodel before you return it
 
^
 
its saying FirstOrDefault doesnt exist in my datacontext, isnt that a built in function?
 
11:39 AM
it's a function for ienumerables and iqueryables
and probably a few others tbh
not data contexts
 
oh shit, ok then i have no idea what to even write in that actionResult...
 
how did you create your DataContext class?
 
wanna see it lol
 
a link to it would be nice
 
pastie?
 
11:42 AM
Does that even compile?
 
please don't dump a lot of code in here, if it's not much, feel free
 
ill upload it as a .cs
oh ya the datacontext def works because we use it for books
 
Is this a new project? does it have the right connection string?
 
@TomW i'm pretty sure it doesn't, but i'm confused, because he pasted the rendered views html
@Parth if i had to guess, i'd say you need
 
yes it has the righ connection string, it does in deed connect to our db
 
11:44 AM
var myModel = allModelData.SomeTable.FirstOrDefault(x => x.id == id);
 
we are able to edit, create, delete customer, employees, books etc
 
but, thats assuming you set up the DataContext correctly
 
 
ah, it's DataContext, not DbContext, does that make a difference?
aaah. Yeah ok that makes sense
 
no, it extends dbcontext
 
11:45 AM
it shouldnt, it inherits from DbContext
 
well, sort of
 
but yeah, you need to pick a set to query
are you querying books? or?
 
yes
 
so then you need
 
ahh
 
11:46 AM
@Parth the confusing part is that there is already a DataContext class in the framework.
 
var myModel = allModelData.Books.FirstOrDefaut(....);
 
That is what got me first, DataContext.. Wat
 
oh sorry, this is the first time we're doing a project of this scale. the hw assignments in this class were literally nothing
 
no matter, as long as everyone working on it understands that
 
End it Context then everyone will know it is the Entity Context
 
11:49 AM
@SteveG I added that and its giving me an error: Cannot implicitly convert type 'SafariBooksGroup15.Models.Book to SafariBooksGroup15.ViewModels.CheckOutViewModels

on this line: CheckOutModel viewModel = myModel;
 
is it common to name the context what the Database is in the datastore? that is what I do
 
@Parth yeah, so you have an EF model, and you need to convert it to a view model...
how would one do that
 
isnt the point of a viewmodel so that we can use parts of multiple models
 
yep
 
ugh
 
11:53 AM
yourview model should contain ALL the data and ONLY the data your view needs
 
thats how we have it set up
 
@Parth exactly. So it's a view of a CheckOutViewModel, not a view of Books. How do you go from Books to your view model?
 
pst, just put all your data in a viewbag
(don't actually do this)
 
your EF model, has a lot of other stuff in it, that your view doesn't need to know about, and you may want to combine data from multiple EF models in your view.... so you get all of your EF models, and then build a viewmodel, and populate it with data from your various EF models
 
well, it does, that page isnt complete, theres only a couple things on there b.c if we get one thing showing up we can get everything we need
@SteveG
sigh...i just wanna finish this project and be done wth my semester
 
11:57 AM
you're learning cool stuff, you should be thankful :)
i learned php :(
 
i learned basic
Mac Basic
but I did learn how to print a cereal box in code
 
that sounds neat
 
@Parth I don't see what the problem is. Don't you just have to decide what you want to do, then write some code that does that?
 
^
 
I really liked learning the MVC framework with EF
 
11:58 AM
The initial issue you had was quite weird, but I don't see how you managed to get it to run at all, it shouldn't have compiled
 
i mean we've decided what we want to do, we just arnt able to figure out how to display it lol just getting frustrated b.c this was a 3 week project and its due tomorrow and we're not done
 
How do you create a CheckOutViewModel?
where is that data meant to come from?
create one, pass it to the view, done
 
we created it from scratch and included fields from our models that were applicable
 
ok, so do that here
 
sorry? what do you mean?
 
12:02 PM
I don't see what's not clear
If you know how to create a viewmodel, then create a viewmodel
 
our viewmodel is already made
thats what we're trying to display from
 
But you have to instantiate one and populate it with the relevant values
 
ok lets step back for a second. How would you guys design a checkout process?
 
lol
 
You know what, I have no idea. I've never done e-commerce
 
12:04 PM
i mean...clearly what i tried to do isnt working, just trying to get some guidance :)
 
CheckOutViewModel viewModel = myModel;

remember, myModel is now a Book model, becaiuse you're querying books. Thats not a CheckOutViewModel
 
We can help you to write code that achieves your requirements, but we can't tell you what your requirements are
 
var myModel = allModelData.CheckOutViewModels.FirstOrDefault( x => x.TempID == id);
we already rewrote that and tried it
still nothing lol
 
Does that make sense?
Why would your database persist a list of checkouts?
 
^thats making a list of checkouts?
 
12:07 PM
that's what it says; you tell me
Put down the IDE. Talk to your project team and decide how your checkout process should work. This isn't about code anymore
IMHO
 
So this is what we discussed as our checkout process: user adds book to shopping cart, goes to shopping cart and finalizes, we create an order in backend, add cartitems to orderdetails, and now we want to generate an order summary
 
ok, so I think this page you're designing here is between 2 and 3
submitting that page will create an order
I would expect
 
yes
 
So that your hypothetical guy-in-warehouse can look at a list of things for him to go and put in boxes
So on your page, the controller accepts a post of a CheckOutViewModel with some payment details
 
mhm
by post do you mean HTTP POST
 
12:13 PM
yes
 
the part we are stuck on is the GET so havnt written a POST yet
 
Maybe in the controller you take the customer's cart, copy its entries to a new Order, add the payment details to the Order, add the Order to the Orders collection, and save the DbContext
Or something
In your GET I don't think you need to retrieve anything from the database. That's stuff the customer is telling you
You don't get it and render it to the screen, they enter it and submit the form
On the way out it can be blank; you don't know it yet
 
ok ya that makes sense
so we should infact be designing a post
 
well you have to render the form in the first place
get a page with an empty form, then post the completed form
 
so like a create or edit crud, but with filled into
info*?
 
12:17 PM
oh yeah, in MVC conventions I'm not sure which that would be
create I guess
 
for building the form theyre pretty similar i believe
 
(remember to check that the specified cart belongs to the logged-in user and they're not modifying someone else's cart :))
 
alright ill try that. Thank you guys so much for your help :)
otherwise...screw it there are other portions of the site still to be finished XD
 
not sure how much help i've been, but yw
 
np
 
12:25 PM
 
hey, it's the English language. It's almost impossible to avoid some sort of sexual innuendo.
 
:)
 
12:45 PM
I'm full of Chinese :(
food
 
oic
 
12:58 PM
Not a single error on production so far today. Either $system is working really well, or the error logging is broken.
 
mmm chinese sounds good
i want to try real chinese sometime
not this americanized shit
 
@Squiggle it has to be #2
 
@SteveG Visit Hong Kong. Best of both worlds.
 
some day
 
@TomW I thought that, but everything seems to actually be working fine. Perhaps nobody is using it.
I totally love HK.
 
1:24 PM
@SteveG i thought you are in ny? just go to the damn flushing
 
1:56 PM
<rant>jesus fucking christ man don't put two or three spaces after a period, just one. if it was consistently two I could maybe not do this rant but if you do it wrong and inconsistently at the same time.... christ in staples</rant>
 
just do regex.replace before you do anything about the string /s
 
@KendallFrey who?
 
@TomW coworker
 
again, what is wrong with the word 'colleague'?
 
too long
 
user47589
2:00 PM
peer
 
@TomW lol I know that bugs you
 
sounds like pee-er
 
user47589
or homies
 
but what's wrong with coworker
 
user47589
nothing
 
2:00 PM
seems like a neologism
what's right with it?
 
OMG sharepoint is inserting nbsps to actually make those spaces appear wtf
 
user47589
sharepoint was written by satan, and sold to microsoft
 
@TomW We work. Together (co-). We cowork. That makes us coworkers.
 
user47589
coworker is perfectly valid to describe someone who works with you
 
Aah, the Trololo plugin
 
2:02 PM
but it doesn't necessarily imply collaboration.
 
it's a 'feature'
 
I used to freelance at a co-working space. There were co-workers, we shared office space, but we did not collaborate.
 
Ha, there's an idea. Could make good money from that
Publish plugins for various applications, which are paid for obviously, that just...fuck about with stuff
As a wind-up
Sometimes it's worth paying for a really good prank
 
exactly
mate actually had one of those inflicted on him by a housemate
who glued it to the inside of his chair
 
2:06 PM
1.5" boxes that generate intermittent annoying noises. Battery can last for days. Hide them inside a wall cavity. Watch your coworkers go batshit mental.
haha
 
user47589
heh
 
Trolling is too easy :(
 
@Squiggle reviews are bad
 
user47589
2:26 PM
woohoo! i broke 10k rep last night! dance
 
gratz
 
nice
 
Hi Guys!
 
user47589
hello
 
user47589
is it possible to hide animated gifs?
 
2:39 PM
@Amy could use greasemonkey or something and write a custom script
or if you want to hide all the posted images you can add a user style img.user-image { display: none; }
 
I have a text file & used textSplit & stored in a list. I would like to seperate odd & even items. How can i do this from this point?  List<String> printGeneral = text.Split(new[] { "--/--" }, StringSplitOptions.RemoveEmptyEntries).ToList();
 
user47589
i feel like i saw that question recently on SO
 
user47589
you know how to test for odd/even using modulo?
 
@Amy That's the standard way to check for that
 
user47589
2:44 PM
@KendallFrey i know.
 
@CuddleBunny ok, thanks
 
Hey guys how can I get .mdf files from SQL server?
I see the db I need butbI need to pull the file from SQL server
 
user47589
unmount the database, then copy the mdf file out of sql server's data folder
 
or just don't ummount and copy the mdf file ;)
 
user47589
is it safe to copy with it still mounted?
 
2:53 PM
I prefer not to unmount since this is client's db
on their server
They told me to just grab the db files
from the server
 
It's so hard difficult for me not to make so many jokes here.
 
They're using Sql server 2008 R2
 
user47589
then change the version using the dropdown at the top of the page...
 
2:55 PM
yes and no, recovery can handle 99.9% of the data corruption in mdf file without losing data, but, you know, if you are really lucky to get it corrupted, go slam somebody else
while the usually practice is to take a full backup of the database instead of directly deal with the mdf file
 
Why not make a backup and restore it?
 
weird, I dont' see this path: \Program Files\Microsoft SQL Server\MSSQL10_50.<InstanceID>\
I just need the mdf files lol. Anyway I get them easiest is ideal xD
oh wait I think I know why....
 
just right click the database -> properties, in files panel, it shows all file paths
 
ok that might be easiest... I went to program files and I'm getting folders with 80,90, 100
 
is he trolling?
 
2:59 PM
I hope not :(
I have no formal training in dbs
 

« first day (1875 days earlier)      last day (3074 days later) »