|
So I'm on .NET 4.5 and apparently it doesn't like to sign things the old 4.0 way, even if I publish it as a 4.0 app. WTF.
|
# ¿ Jul 11, 2014 18:23 |
|
|
# ¿ May 2, 2024 05:41 |
|
Gul Banana posted:4.5 is not fully backwards compatible with 4.0 - there are other issues like this I just didn't sign, since it's an internal app. I did see indications that there are ways to just make a key with the old algo and use that, though.
|
# ¿ Jul 13, 2014 02:11 |
|
So I finally felt like playing with LINQ code:
Why is the where executing before my select?
|
# ¿ Jul 15, 2014 19:02 |
|
Ithaqua posted:It isn't. It works fine in an arbitrary console application. What's this "Dump" extension method? For linqpad, so I can see the output. Otherwise it just runs and doesn't display anything. What's happening in my app is apparently hyphenated DLNs arenot passing through the masking. However, the select SHOULD strip hyphens out first. Do you think that the hyphens that I'm taking as input might be different from the hyphens I'm using in the inlined defined list for my linqpad?
|
# ¿ Jul 15, 2014 19:26 |
|
Ithaqua posted:Entirely possible. – is a different character from -. My hunch was correct. gently caress FONTS. EDIT: NOPE I'M EVEN DUMBER gently caress ME The split wasn't working right and had a whitespace before the H. So, because I had a ^ at the start of my regex it didn't match, since it was looking for the start of a string. It wasn't, it was a whitespace. Welp I fixed it. Fuck them fucked around with this message at 19:47 on Jul 15, 2014 |
# ¿ Jul 15, 2014 19:34 |
|
Is there any rule of thumb as far as MessageBox.show vs actually throwing up some markup and code-behind if you're doing something in WPF? I'm displaying what amounts to a list of "YO these numbers are invalid or were entered wrong" and would rather avoid mucking with markup whenever possible. OTOH if it's now idiomatic to do something else besides a modal popup I might as well get busy.
|
# ¿ Jul 18, 2014 19:12 |
|
crashdome posted:How about a validation error on the control instead of a modal? Are you just validating data entry? That's literally it, EXCEPT that they want a big fat textbox where they can enter any number of driver's license numbers (DLNs) and I just separate them out by newline/whitespace/whatever, match them to a regex, then go search by them. This is basically just a little tool for clerks to get a bunch of driving record PDFs out of a state ran REST service. They then print out all of those PDFs. Since it's just one big fat text blob, if I want to say THESE specific numbers I figured just pop up a window saying "X, Y, Z is invalid." If they decide to change the design to a fixed number of smaller text boxes I could do something fancier, but the impression I've gotten is that they want to be able to do really big batches of this. They probably just want to come back later and go "oh, these were entered wrong/aren't valid/whatever" rather than going some-small-number-at-a-time. AFAIK this is basically something ran at end of day for the next, or start of day, so the Judges can have copies of people's records for traffic related proceedings. Mr. Crow posted:I'm not really following you're question, but as your application evolves and becomes more complex you'll find you probably want/need to roll your own dialog window, which is pretty simple (is this your question??). Nah I'm trying to program by committee of judges, clerks and bikeshedders and basically flying solo less than two years in. It's me.
|
# ¿ Jul 18, 2014 19:34 |
|
Also since it's, uh, terrible, and huge, and crossposting is something I'd rather not do (unless truly warranted) I'm trying to go through some threaded stuff: the old worker thread and wait window idiom! Click here for green forum action. I seriously want to unfuck this. That thread.sleep(100) poo poo makes me feel ashamed and I'm not the one who wrote it.
|
# ¿ Jul 18, 2014 20:08 |
|
Ithaqua posted:Is it Winforms? I honestly don't know I thought XAML == WPF but googled first. Now I know that is not the case. Edit: I think. Double Edit: Thinking that yes, it is, given that I pass messages in and out of it with a method call, and there's no bindings to anything in the XAML idiomatic way. No DependencyProperties or anything. Fuck them fucked around with this message at 20:25 on Jul 18, 2014 |
# ¿ Jul 18, 2014 20:21 |
|
crashdome posted:I get a bit anal about UI sometimes. My approach would be to dynamically add text boxes after each license was entered and validated. Auto-switching focus even. If I was a user and had to enter two dozen licenses and learned only after the fact that I was entered one of them wrong that I had to hunt down both in my notes and also in the textbox OR alternatively that my zero key wasn't working and I had to go back and replace zeros in most of the lines, I would be pissed. The benefit of this method is you code the validation once and the UI behavior once. The drawback is you have to concern yourself with all of the validation markup instead of a single method/event. I thought of that, but then I realized a few things: • Coding dynamically added textboxes made me cringe, but could be fun. • Non-technical clerks probably just want to dump a big fat load of DLNs and get some printable PDFs, really. Like, a whole day's worth of dockets for traffic court etc. • I have no way to validate until after a hit to the service is made. All I can do is see if it matches (1 letter)(12-13 numbers). Now, if it DOES turn out they're entering some sane number at a time and it's not just a huge batch, then I guess I could do something asynchronously so upon entry, if it matches the regex, it then makes a call to the REST to see if it's valid or not. Then when they push the big fat "get the pdfs" button it actually requests all that big data. Basically I'm in hurry up and wait mode, but if that turns out to be what they had in mind that does sound like a good idea. So, given that - how the hell would you even dynamically make a new textbox, and a way to programmatically expose the string in that text box?
|
# ¿ Jul 18, 2014 20:32 |
|
Ithaqua posted:In WinForms, assuming you just have a stupid form that has a textbox that shows whatever text you set with the "SetText" method: I feel like I haven't adequately explained what the real problem is. The XY problem also just left me a voice mail. It does work IFF something slow and long is going on before it calls .EndWaiting(). If it basically just goes "welp there's nothing to do here" and quickly calls .EndWaiting() it ends up with a null THIS. Also, the wait window never actually pops up, making me think it was never constructed before the worker thread beep-boops along and realizes there's no need to call the longRunningthing. I could work around this by checking if there's even any reason to call longRunningThing before bothering to fire up the wait window, but I'd rather solve the problem itself entirely.
|
# ¿ Jul 18, 2014 20:41 |
|
Ithaqua posted:No, I understand the problem. The root cause is that the approach the code is taking is dumb. Instead of keeping the UI responsive and doing the work on a different thread, it locks the UI thread doing the work and makes its own temporary special snowflake UI thread to report progress. So it's a full on anti pattern, nice. I've worked around now that I've chewed on it more but I think a refactor to do it right is in order. God knows I have the time to spare. Mr. Crow posted:Have you considered... talking with the customer and actually figuring out what they want and plan to use it? Yes. I speak to the managers above me frequently! I've yet to speak with a clerk here except when I was paying a traffic ticket. I should just go take the initiative on that.
|
# ¿ Jul 18, 2014 20:54 |
|
So I just wasted time making a .asmx service trying to fit with the rest of this poo poo old website and got sick of my json being wrapped in a single XML String, even with json.NET and such. And everything I could imagine to change the web config. gently caress it. I basically want to have a searchable, jQuery datatables type Table that shows results from about ~1200 total rows of a DB which come down to "metadata about admin orders and a file path to a scan of the Judge's order bla bla bla." Do I want a WCF data service or a WCF service? Is there even a real difference? I was assuming just fork over the entire table and search/paginate, but I've also seen tutorials where every time someone changes the search string it actually queries the DB every time and sends the results. Maybe it's how green I am but it seems like if the list of rows is that low you'd be better off just sending it all once at page load, especially if it's an intranet app. I have total freedom with what I'm setting out to do and picked jQuery from familiarity. Is there any reason to instead do the .NET gridview (or whatever) instead?
|
# ¿ Jul 25, 2014 18:02 |
|
Ithaqua posted:Part of the fun is that I'm absolutely terrible at HTML and CSS. I have to resist the urge to use tables for layout. LESS is your friend and so is bootstrap. I still hate it but bootstrap layouts helped immensely and LESS helps you cut down on the CSS poo poo. Then again I also basically had to spend a month cleaning up my project's 5 cooks spoiling the soup and just had to deal with it. I hate web poo poo. But all I do is web poo poo.
|
# ¿ Jul 25, 2014 18:21 |
|
Just what exactly are ALL of the places one can change how requests are returned in .NET? I've gone through every single decorator I can find for my methods in .svc and .asmx and .whatever files, and I want to return JSON, and I keep either returning a single XML string which itself contains JSON, or I return JSON in a SOAP envelope. Is there something in web.config I've overlooked? I've scoured MDSN, stack overflow, google, and even tried restarting VS a few times, and it's getting very frustrating. I just want to spit out a JSON string
|
# ¿ Jul 27, 2014 05:06 |
|
RICHUNCLEPENNYBAGS posted:Why can't you just return a JsonResult? Or use Content if it's already a JSON string? I was working within an asp.net forms template that basically underpins the rest of the project. It wasn't fun. I had gone through MSDN/Stack Overflow/Google writ large trying to figure it out and it was basically just configuration and decoration voodoo. gariig posted:Stop using ASMX. It's really freaking old. If you are starting fresh today you want to use Web API. That's the easiest way to send json or XML over HTTP to a client. If you can't use Web API use WCF. I tried with WCF and I kept getting everything wrapped up in a SOAP envelope. On monday (or tomorrow if I get bored) I'm going to just use WebAPI. My last job was MVC (WOO!) and I could just burp up my JSON from my controllers and it was all pretty awesome. Trying to work with all this old poo poo the way it was done is pretty crappy. At least I can say I tried. My Senior Dev hasn't ever done MVC so I figured "welp ok why not learn a little old school poo poo" and it really wasn't a great idea.
|
# ¿ Jul 27, 2014 06:57 |
|
I finally just used WebAPI for my JSON needs and I should have done this in the first place. Holy crap this is better.
|
# ¿ Jul 28, 2014 16:09 |
|
This is going to be one of those drat weeks, I can feel it. I have a webapi project and an asp.net forms template in the same solution. Despite setting both to start at the same time and having the webapi project referenced in the website I can't actually call the controller from the webapi project. I can however copy and paste the paths with port numbers and just get the json right into my browser.
|
# ¿ Jul 28, 2014 16:54 |
|
Drastic Actions posted:I don't use WebAPI much, so I may be misunderstanding how it works, but why would you call the controller directly from the API? The controller calls the API, requests for something, and the API returns the data to whoever called it. The API should not know anything about the controllers. I wanted for some javascript (jquery datatables) on my page to be able to call /api/controllername and get json from it. I meant to say the webapi project's controller object isn't something I can reference from my web page. The two separate projects didn't work. Trying to do it all in one project didn't work. But since I'm apparently trying to learn about 5 different ways of doing something on asp since I'm working alone and trying to take my MVC knowledge and match it with this workplace's old-hat asp stuff and it's making me mash my face as flat as a pug while the only other programmer here comes and goes like a drat housecat I'm just going to copy/paste from a tutorial until I get my poo poo working then do tutorials to look busy. What really kills me is I'm allowed to waste so much time here. There's no accountability and I'm not really sure a year from now me (or a few years from now me) would want me to spend the time to learn how to do poo poo from 2003.
|
# ¿ Jul 28, 2014 17:12 |
|
I'm going to start over and state my issue and desired solution from scratch so I don't go completely insane. Because I already feel that I'm about to just start breaking things. I don't know poo poo about asp.net forms. I've done MVC on a project with knockout holding everything together and had controllers just firing off json. I used very little razor. I was part of a team, the project was well architected, we used source control (WOO!) and it was generally nice. I picked up and went right along. I just wish management and HR where I worked wasn't poo poo and I could have stayed. Right now I'm completely on my own and I've gleaned that we basically just host individual web pages and start from an empty template. My attempts at taking what I knew and combining it with web forms has been an exercise and mashing my face into something resembling a pug dog. I'm done wasting time and watn to figure out how to do this right All I want to do is take data from a database and get a searchable, paginated table out of it. For whatever reason I've spent days just chasing my tail like a moron. I try to look online at how to do this and I see poo poo from 2003. It's 2014 and I'd like to think there's a sane way to do this. I looked at the spaghetti poo poo that is how we do it in the existing way. I see a mess of code behind and <%eval%> poo poo and my eyes popped out of my head. Sr. Dev was here on one of his odd days in and said "it's bad, we had like 3 interns do it over and over, just re do it." He then disappeared again. So in TYOOL 2014 how do I do this without trying to mix and match different versions of .NET and different idioms from over a decade? What's the current, correct way to do this in forms?
|
# ¿ Jul 28, 2014 17:27 |
|
Drastic Actions posted:So you're call something like $.get('/api/controllername',...) on your webpage, and it won't hit the api, but if you directly put in "http://somethingbutts.jp/api/controller" in the browser, that works? I just give the gently caress up. I just want one clear clean way to do that that's documented top to bottom. I know where the DB is. I can touch the DB. But I don't know poo poo about forms or old asp anything, apparently. Edit: I've never even seen $.get() before in use, anyway. I'm flying blind and just throwing together a mish mash of methods I don't know is making me go crazy. Double Edit: The fact that there are dozens of ways to do anything with web poo poo is what's so frustrating. There's no one correct way, and the only thing I've seen where I work is admittedly poo poo. There's no clear way to see what the current or recommended idiom for anything is. I see tutorials with jquery here, or EF there, or some shambling monster of code behind and $.get() and all sorts of bad practice with "Well we're on gigabit intranet so it's OK to hit the table every time someone types a key and do a walk along search!" sprinkled on top by the only other developer who is also not even here. When I realized what I was getting into was NOT what the interview led me to believe I've had a lot of people say "heh just gtfo" and I probably should have already. I guess I have to just cargo cult poo poo and hope for the best before I split just like the last few people who sat at this desk. Fuck them fucked around with this message at 17:36 on Jul 28, 2014 |
# ¿ Jul 28, 2014 17:28 |
|
Well I grit my teeth and did this tutorial and don't understand a drat thing. But it Just Works™ with the actual data from the actual DB, so there's that. I hate having magic behind the scenes do things for me, but hey, whatever, I did it. My big question was more about "should I use asp controls to make the table and sort and search it" vs "should I just json the stuff and use data tables" and with regards to that should I do server side or client side filtering. I think my uneasiness about doing it the way I actually know how to and learned from my prior job is because here it's all spaghetti .net 2.0 and I don't want to be johnny come lately turning poo poo on its head. I don't want to be the next HOW. I can't even talk to the sr dev to ask if he likes a thing, it just ends up at the desk of the non-technical manager who either yays or nays it. Then again I'm the only one here right now.
|
# ¿ Jul 28, 2014 18:21 |
|
So I've just bitten the drat bullet and learned a little asp. I don't much like the magic of all these tags just magically doing poo poo for me when my past experience of ko/jQuery and some controller actions was so easy to learn and debug, but it's mostly working now. I've just got a few "WTFs" left. SearchExpressions don't much like to search on an integer column. Do I really need a CustomExpression? WTF? I've gone through the API wondering what the magic incantation of "cast it to an int" is and have yet to find it. Do I need some property to say "hey, pass an int into the magic SQL you're generating" or is it worse than that? I'm also wondering how to handle date columns. There's some datepicker hiding somewhere. The users like a "walk along search", that is, as you type, every lift of your key makes the current string in the searchbox fire a search event. Right now this is done with an incomprehensible mishmash of codebehind, <%eval%> magic, and $get() from the ajaxtoolkit I confused with jQuery for a long time. And their own custom gridview that was opaque and undocumented. And reams of commented out code. So, if my understanding is correct, I just want some magic to basically click the search button/fire that event for me whenever someone puts a character into any search field on the page, what's the most sensible, understandable, maintanable manner to do this? I should add the Senior Dev is not present right now, but I did finally grab his ear and get a bit of a walkthrough of what this undocumented custom stuff actually is and see some of their idioms. I showed him some samples of the ko/jquery/controller action/MVVM stuff I did from the last job and his eyes lit up. So, maybe this will only be a maintenance issue when the non technical managers decide to get away from this aspshit. at least I'm being offered full time, since I'm persistent about actually trying. But the pile of "WTF" the past few contractors who came and went have left me is really, really grueling to figure out.
|
# ¿ Jul 31, 2014 17:20 |
|
That's not quite what they want. They want the grid that shows search results (paged, to boot, since until you put anything into the text boxes for search strings it returns the entire table from the db) to update on each and every keystroke. Looks good, though.
|
# ¿ Jul 31, 2014 18:21 |
|
They're pretty big on doing things with their asp.net controls. Which is why the codebehind/aspgridviewautogeneratedwtf/ajaxcontrol $get(<%EVAL LOL%>) monster was there in the first place. I'd just as soon json the entire table and sort it client side. The thing is, the non technical bosses are saying "bla bla no mvc use forms " so I might just do a jQuery table and just style it like what the gridview generates.
|
# ¿ Jul 31, 2014 19:21 |
|
This really is getting kind of old. I have a query extender containing search expressions to search by any given column in a grid view table. If I want to search by columns which are of type int, I get an error of parameter type being wrong. In the control parameter if I say DbType="Int32" it still just shits itself. Is this because the column is nullable? If it is, how do I fix that? code:
Edit: no more breaking tables! Edit2: CustomExpression should let me do this. Do I inline stuff on the .aspx page or do I put it in the code behind? I've heard lots of voices saying "NEVER USE CODE BEHIND" so I'd like to do this right. I don't want to just recreate the same monster as before. Fuck them fucked around with this message at 21:57 on Jul 31, 2014 |
# ¿ Jul 31, 2014 21:28 |
|
Scaramouche posted:Is this an internal app or a public facing one? A lot of the "never use code behind" is because of speed concerns, AXD chicanery, etc. I don't really get the hate for it myself; I've built enterprise scale sites (e.g. 1 million uniques a day) that use code-behind and not really had a problem with it. There's some session management and program flow gotchas, but once you learn to work around them it's really not a big deal. I THINK public. It's basically a table that lets you search through ~1200 or so administrative orders, that is, Judge says "do this from now in in my court(house)." Basically it lets you search by date, name, book/page number (still no clue what that actually MEANS) and the user eventually gets directed to a pdf scan of the order. Not worried about speed, just doing it cleanly, maintainably, and in a manner that doesn't cause a week long headache to the next developer to look at it.
|
# ¿ Jul 31, 2014 23:18 |
|
JSON and datatables saved my sanity. Sr Dev saw the light Our old lovely .net 2.0 custom gridview automagically did some CSS for us, so I get to poke around in that, but hey guess what isn't a huge pain in the rear end? <%eval()%> mixed up with onkeyup mixed with codebehind!
|
# ¿ Aug 2, 2014 04:32 |
|
Never done EF before, found some old code left by a good contractor who split since govt doesn't pay what this guy was worth. Great code though. Anyway this is all EF and I don't even know where to begin trying to find where the connection string either in the .edmx file by hand or using the designer. It's basically WebAPI that emits JSON for some jQuery/KO sitting in a web forms page. I can open the designer and look at object models but I've tried googling and poking for the frigging connection strings and apparently called in stupid this morning. EDIT: I didn't scroll far enough right, it's in web.config. Fuck them fucked around with this message at 17:03 on Aug 20, 2014 |
# ¿ Aug 20, 2014 16:53 |
|
code:
|
# ¿ Aug 20, 2014 17:18 |
|
I still don't know LINQ to SQL for poo poo.code:
Furthermore, I'm not quite sure how to make it into a nice easy to handle associative array to serialize for some knockout for a selectedOptions binding. XYProblem Explanation: I've got a big hunk of lovely data. Meh. I want to allow the user to select a bunch of "types" to help drill down queries. Most of the types in the types table are never used. So, select distinct on the actual table of crap, find the unique types that are actually used, join them on the type table to see the description of them, pass that to user. Also, a lot of the types are duplicated - there are three which are categorized as "File", three as "FILE," etc. Input validation didn't occur to anyone apparently! Trying to help drill down with that might be fun. I figure I just might let the user select "File" and just return for all 3 types that match, etc. Nobody has any documentation about it, they just want it to work. Soon. I usually use sprocs and ADO.net, but figured I might as well use a little LINQ and make use of the EF scaffolding this project has in it, as I've never done it before and thought I might learn some new things. I'll get a LINQ book (or just a good .net book) tomorrow when I finally get that first direct hire paycheck Fuck them fucked around with this message at 19:34 on Aug 28, 2014 |
# ¿ Aug 28, 2014 19:29 |
|
Ithaqua posted:Pedantic terminology note: LINQ to SQL is not interchangeable with Entity Framework, they are similar-but-different ORM platforms. L2S is dead, EF is not. You probably mean LINQ to Entities. I'm the only one here who actually cares about staying current at all, so that's actually useful knowledge to have for when I decide to take the next step and leave this bubble!
|
# ¿ Aug 28, 2014 19:36 |
|
I think stopping to take a break helped me get it. FIGURES.code:
I really need to nag work into getting me a linqpad license.
|
# ¿ Aug 28, 2014 19:41 |
|
Knyteguy posted:Ah sorry forgot it was VB. I'd like to forget it is too
|
# ¿ Aug 28, 2014 19:45 |
|
Holy poo poo the generated SQL from this: http://pastebin.ca/2836448
|
# ¿ Aug 28, 2014 19:59 |
|
Starting to not feel the linq right now. I kept getting "don't do this For Each because the list doesn't have any elements." Ok! I'll throw in a drat if statement to make sure the list has a count greater than zero. So on the line where I go "If (items.Count > 0) Then" "ArgumentException not handled by user code Count must have a non-negative value." I have no clue what is going on. I'm going to just wrap it in a try catch, but honestly, what the hell is going on?
|
# ¿ Sep 8, 2014 16:54 |
|
At home for lunch, so paraphrasing. dim return = LinqToEntities (Or LinqToSql? It's old) if (return.Count < 0) then return no results found else return the actual data end if at "if (return.Count < 0)" it says count must be non negative. When I look at the actual "return" it says the count is 2. When I get back to work I'll post the whole code. Fuck them fucked around with this message at 17:39 on Sep 8, 2014 |
# ¿ Sep 8, 2014 17:31 |
|
Mr. Crow posted:This is sage advice and generally the right thing to do when youre frustrated with a problem, you're gonna go far! I'll be the best pokemon trainer ever, gotta catch them all!
|
# ¿ Sep 8, 2014 17:33 |
|
Drastic Actions posted:You can use "items.Any()", which returns a bool if it contains any elements. What's so loving frustrating is that it says the count is wrong IN AN IF STATEMENT. How is an if statement throwing an exception on list.count???
|
# ¿ Sep 8, 2014 17:33 |
|
|
# ¿ May 2, 2024 05:41 |
|
FrantzX posted:if return.Count is zero, then the if statement becomes 0 < 0, which is false. You want (return.Count == 0). code:
|
# ¿ Sep 8, 2014 18:13 |