|
GrumpyDoctor posted:I think you could have just used Seq.collect. (Also check out the Array.Parallel module.) I'm not sure what I'm doing either, this is my first attempt at f# and functional programming in general. However, my code does compile and returns correct results in the dataformat I'm expecting. I went from a ~6sec response going the synchronous route and with my current approach I'm at ~1.9sec.
|
# ? Jun 6, 2014 13:29 |
|
|
# ? May 6, 2024 19:47 |
|
Uziel posted:How would I have used Seq.collect? Current code that returns seq<string[]> []: code:
|
# ? Jun 6, 2014 18:41 |
|
Your solution with cleaned-up formatting:code:
code:
code:
code:
code:
raminasi fucked around with this message at 18:53 on Jun 6, 2014 |
# ? Jun 6, 2014 18:45 |
|
Thanks, I switched to this per your formatting:code:
Without the array.concat, this is what I have:
|
# ? Jun 6, 2014 19:08 |
|
Oh, I misremembered the Array.concat signature. It should be Seq.concat, which you can then combine with the previous Array.map into a Seq.collect.
|
# ? Jun 6, 2014 19:42 |
|
I have an class called Server with a method called Start that takes a delegate(delegate void Callback(int)). I want to use it to start a thread, passing in a method that matches the delegate. code:
I ended up calling Start without a thread, and making Start make a new thread instead, but I'm wondering how I should have gotten it to work.
|
# ? Jun 6, 2014 19:44 |
|
GrumpyDoctor posted:Oh, I misremembered the Array.concat signature. It should be Seq.concat, which you can then combine with the previous Array.map into a Seq.collect.
|
# ? Jun 6, 2014 19:50 |
|
bobua posted:I have an class called Server with a method called Start that takes a delegate(delegate void Callback(int)). I'm a bit confused by what you've got there, could you show more code? Also, if my limited understanding of this is correct, you may want to consider using Action<int> instead of delegate to pass your callback. EDIT: Just use the lambda syntax to define the method to start the thread, then you don't have to deal with ThreadStart at all (and the lack of type-safety that comes with it): https://dotnetfiddle.net/nxgsWg C# code:
Bognar fucked around with this message at 20:27 on Jun 6, 2014 |
# ? Jun 6, 2014 20:18 |
|
Bognar posted:I'm a bit confused by what you've got there, could you show more code? Also, if my limited understanding of this is correct, you may want to consider using Action<int> instead of delegate to pass your callback. I've already trashed the code I was trying to use but I'll try and rewrite it a bit... code:
|
# ? Jun 6, 2014 20:32 |
|
Don't use Threads directly. Use the TPL to create tasks, and let the framework handle the threads.
|
# ? Jun 6, 2014 20:33 |
|
I edited my above post, you should try using anonymous lambda syntax to start your thread. Regarding the TPL, if he's actually building a "Server" then you might need a thread devoted to handling network requests. If you know a way to do that with Tasks, let me know because I'd find that interesting. Then again, any server you might be building has probably been built better by someone else.
|
# ? Jun 6, 2014 20:36 |
|
The 'server' is just a zmq listener that listens for a network request from a c++ app and fires an event(and sends the contents of the request) off. I've never really messed with the tpl(hell this is the first time I've even had to use a delegate) but none of the examples I saw made it look attractive for this.
|
# ? Jun 6, 2014 20:45 |
|
Bognar posted:Regarding the TPL, if he's actually building a "Server" then you might need a thread devoted to handling network requests. If you know a way to do that with Tasks, let me know because I'd find that interesting. Then again, any server you might be building has probably been built better by someone else. I could be missing something, but I don't see why you couldn't use tasks for that. What's the thread doing that the task isn't (or vice versa) in the scenario you're thinking of?
|
# ? Jun 6, 2014 20:53 |
|
Huh, yeah that's true. I guess I always think about Tasks only in terms of using them to do asynchronous work that will eventually complete. It seems so wrong to me to use a Task to do something like loop indefinitely, but there's no reason you couldn't.
|
# ? Jun 6, 2014 21:18 |
|
Bognar posted:Regarding the TPL, if he's actually building a "Server" then you might need a thread devoted to handling network requests. If you know a way to do that with Tasks, let me know because I'd find that interesting. Then again, any server you might be building has probably been built better by someone else.
|
# ? Jun 7, 2014 00:03 |
|
Horn posted:What you're looking for is to use some kind of ajax calls to pull new data down from the server. This post gives a pretty basic example. Yep, this is exactly what I want and it seems pretty simple to do, too. Thanks!
|
# ? Jun 7, 2014 02:22 |
|
I'm not sure if this is something straightforward or not. If you're developing a large MVC site, is it possible to break that up into separate projects? I don't mind if the sub-projects get included into the main site at compile time or run time... it's basically to potentially solve two problems in my head (that may not even be problems, or may be solved better in other ways): 1. reuse of code across different sites via a shared library, so you just maintain one set of code 2. easy/standard way of adding functionality to a site via a sort-of plugin type of design, where new functionality can follow some sort of predefined interface or design pattern, and then the resulting DLLs and Views can just be dropped onto the web server (maybe with some updates to the web.config as necessary) without having to add it to the main project, rebuild and redeploy the entire thing. This sounds like it should be a solved problem, but all my searching hasn't turned up anything useful.
|
# ? Jun 7, 2014 21:05 |
|
1. Yes, you can use multiple projects on a MVC site, for example I have a project that does barcode decoding and encoding for some manufacturing software and I also include the project on my MVC site so I place barcodes on files printed from the website. 2. I think you need to at a look at IIS because it sounds like you want to make Sub Applications for a default website?
|
# ? Jun 7, 2014 22:08 |
|
beuges posted:I'm not sure if this is something straightforward or not. If you're developing a large MVC site, is it possible to break that up into separate projects? I don't mind if the sub-projects get included into the main site at compile time or run time... it's basically to potentially solve two problems in my head (that may not even be problems, or may be solved better in other ways): Check out nopCommerce (.net mvc). If you're asking what I think you're asking, then they organize their solution in that manner. https://nopcommerce.codeplex.com/SourceControl/latest It's probably easier to download the source and run it from Visual Studio to get a good idea of how they do it, as opposed to that web interface though.
|
# ? Jun 8, 2014 02:25 |
|
beuges posted:I'm not sure if this is something straightforward or not. If you're developing a large MVC site, is it possible to break that up into separate projects? I don't mind if the sub-projects get included into the main site at compile time or run time... it's basically to potentially solve two problems in my head (that may not even be problems, or may be solved better in other ways): Your MVC project should contain very little logic. The controllers should be extremely lightweight, and it's common (and a good practice!) to totally isolate the web application from the business logic via a RESTful service. If you have the bulk of your application isolated behind a series of appropriate services, you can just deploy those individual services as necessary.
|
# ? Jun 8, 2014 03:04 |
|
Anyone have tips for porting a Windows Form Application to a MVC site? I imagine this is going to be a rather painful experience. The application is your basic business app, input data, run SQL queries, do some calculations, then output data in a user friendly medium(tables or images). I think I am going to end up turning each Form into 2 or 3 Views to cut down the complexity.
|
# ? Jun 8, 2014 03:35 |
|
Calidus posted:Anyone have tips for porting a Windows Form Application to a MVC site? I imagine this is going to be a rather painful experience. The application is your basic business app, input data, run SQL queries, do some calculations, then output data in a user friendly medium(tables or images). I think I am going to end up turning each Form into 2 or 3 Views to cut down the complexity. That's such a broad topic, there's really no way to give you constructive advice. UI paradigms between desktop and web are very different. Also consider that the web is stateless, whereas your existing WinForms application is stateful. Like I said before, make the core application logic into a service and just consume the service via the site. If the existing application is absolutely business-critical and just has a horrible mishmash of tightly-coupled presentation/business logic and no unit tests or anything to give you any confidence that you're porting the functionality correctly, you could start by making the service and refactoring the existing application to consume the service. Once that's done and the existing application is presentation-only, writing a web interface to it probably won't be that painful. I actually took exactly that approach, albeit with porting a monster of a classic ASP site to an ASP .NET site. The logic in the existing page was byzantine, incredibly complex, and well-understood by maybe 2 or 3 people in the company. We stripped the page down to presentation-only, rewrote the business logic as a service, wrote SpecFlow tests so that the business users could actually help us generate appropriate unit tests, and once the service-backed Classic ASP site was stable and reliable, we just plopped a new UI on top of it in ASP .NET, then retired the Classic ASP version. New Yorp New Yorp fucked around with this message at 07:12 on Jun 8, 2014 |
# ? Jun 8, 2014 07:07 |
|
Knyteguy posted:Check out nopCommerce (.net mvc). If you're asking what I think you're asking, then they organize their solution in that manner. I probably wouldn't copy nopCommerce, I mean, have you seen their controllers? I've used MEF in the past to import controllers and views via a DLL, but there's no reason a standard IOC container couldn't do the same. I use the mediator pattern to lighten controllers to the point that could essentially be created dynamically and their methods dispatched within an ActionInvoker. The mediator pattern just requires you to know the type of command or query for a given action, and return a result or issue a command. Which library this happens in is up to you. I wouldn't go down this route until I've encountered enough complexity within the app though. If your controllers look like this https://nopcommerce.codeplex.com/SourceControl/latest#src/Presentation/Nop.Web/Controllers/CatalogController.cs then it's time to consider something better. (Also their dependency graph and start up time for each controller must be horrid!) Funking Giblet fucked around with this message at 09:25 on Jun 8, 2014 |
# ? Jun 8, 2014 09:21 |
|
Funking Giblet posted:I probably wouldn't copy nopCommerce, I mean, have you seen their controllers? Unfortunately yes. I have to work with their controllers nearly daily (it's awful and makes me hate my job sometimes). We have a custom eCommerce package based off their source at work. They do some stuff right and really well though. I still kind of copy their layout tree on personal projects. Maybe I'm just familiar with it though. I am going to look into this mediator pattern though. I might be able to convince the owner of the company we should spend some time on this. He's a developer so he should understand. Of course he might say "Clients don't care if the code looks pretty. We don't need to spend any time refactoring." and then we'll have to work on it later and not know what the gently caress. I think the last time he said that he also said we shouldn't add the project to source control because we can keep the project on our dropbox. [/rant] (sorry)
|
# ? Jun 8, 2014 17:49 |
|
Funking Giblet posted:I've used MEF in the past to import controllers and views via a DLL, but there's no reason a standard IOC container couldn't do the same. I like MEF for plugin discovery because it's explicitly designed with that in mind and nothing else.
|
# ? Jun 8, 2014 18:40 |
|
Knyteguy posted:Check out nopCommerce (.net mvc). If you're asking what I think you're asking, then they organize their solution in that manner. From looking at the structure of the solution there, it does look like what I'm thinking of. I'm downloading the source to look at it in more detail. But yes, what I was after was to have a bunch of related controllers and views in their own projects - I wasn't sure how to import those into a "framework" website though, so I'll see how nopCommerce does it (at least the plugin loading parts). Ithaqua posted:Your MVC project should contain very little logic. The controllers should be extremely lightweight, and it's common (and a good practice!) to totally isolate the web application from the business logic via a RESTful service. If you have the bulk of your application isolated behind a series of appropriate services, you can just deploy those individual services as necessary. Yes that's how I do things already The controllers are basically just wrappers around either a web service call or a business logic manager object. Even so, I want to be able to deploy and test different parts of this overall solution separately or together - the idea is to have a "framework" site that hosts a couple of independent but related products - an end user could subscribe to any one of them individually if they chose, but if they subscribed to a bunch of them, they can integrate nicely with each other to provide a nice seamless overall experience. Different teams may be working on different products eventually, and I also want a nice standardised way of adding new products to the system. Since the end users can subscribe to just a single product as a standalone service, I want to take the extreme stance of being able to develop it on its own in its own project (with the necessary hook point interfaces as well) to develop and test easier, and then being able to just drop it into the framework site and have the new product available with minimal changes to the framework site. Funking Giblet posted:I've used MEF in the past to import controllers and views via a DLL, but there's no reason a standard IOC container couldn't do the same. I took a look at http://mef.codeplex.com/documentation and I honestly have no idea where to start looking at how to use this thing. Is there any better documentation or tutorials available anywhere?
|
# ? Jun 8, 2014 20:14 |
|
Knyteguy posted:Check out nopCommerce (.net mvc). If you're asking what I think you're asking, then they organize their solution in that manner. Orchard also does this well. Calidus posted:Anyone have tips for porting a Windows Form Application to a MVC site? I imagine this is going to be a rather painful experience. The application is your basic business app, input data, run SQL queries, do some calculations, then output data in a user friendly medium(tables or images). I think I am going to end up turning each Form into 2 or 3 Views to cut down the complexity. Devil's advocate: recompile it for the web.
|
# ? Jun 9, 2014 04:46 |
|
chmods please posted:Devil's advocate: recompile it for the web. Totally uninformed, kneejerk reaction to that company's products based on the information on their site: It looks like a bunch of snake oil bullshit.
|
# ? Jun 9, 2014 05:01 |
|
Ithaqua posted:I like MEF for plugin discovery because it's explicitly designed with that in mind and nothing else. The only issue I have with MEF is managing the creation of an AppDomain to allow shadow copying (which would allow dynamic loading and removal of plugins). It's fine for standalone apps, but it's a pain in the rear end for Web.
|
# ? Jun 9, 2014 12:06 |
|
Ithaqua posted:Totally uninformed, kneejerk reaction to that company's products based on the information on their site: It looks like a bunch of snake oil bullshit. Yea I am just going to stick with MVC, Bootstrap and JQuery.
|
# ? Jun 9, 2014 13:52 |
|
Ithaqua posted:Totally uninformed, kneejerk reaction to that company's products based on the information on their site: It looks like a bunch of snake oil bullshit. I haven't worked directly with it, but from what I've seen of the application's prototype conversions it really is Windows Forms in your browser. Of course, depending on how your application is designed and what it does then there will be a few problem areas, like dealing with static variables, multiple exe files, local file access, printing, etc. Overall it performed much better than I'd ever have anticipated, though. AFAIK it works by having a JS "desktop OS" framework running on the client, which communicates with the server using AJAX/JSON callbacks. The server doesn't actually render any HTML, but just sends the form/control properties down to the client "OS", which then constructs the HTML to render the actual UI. That way the web traffic ends up being much smaller than you'd think as well (also since applications are 99.9% intended to be intranet only, latency isn't much of a problem in practice). That said, I'm still glad I don't have to work with it. But if you do, it probably actually works better than your gut reaction would tell you.
|
# ? Jun 9, 2014 15:56 |
|
Hoping someone here has some knowledge of opencv\emgu. I have a decent understanding of the opencv image structure cv::mat, but I'm trying to rewrite something in c#(emgu) which generally uses an Image<> type instead. In c++, I can take a regular image and 'carve out' a sub image by creating a new cv::mat from a region of the old. The important part being that the new cv::mat is just a pointer to that region, it doesn't actually do an expensive data copy. I want to do the same thing in c#... create hundreds of Image<>'s which are just regions of one underlying image, without duplicating all that data. Here's the documentation on the Image<> http://www.emgu.com/wiki/files/2.4.2/document/html/a8929aab-99c5-79cf-385c-dcec7769fea1.htm
|
# ? Jun 9, 2014 19:21 |
|
beuges posted:From looking at the structure of the solution there, it does look like what I'm thinking of. I'm downloading the source to look at it in more detail. But yes, what I was after was to have a bunch of related controllers and views in their own projects - I wasn't sure how to import those into a "framework" website though, so I'll see how nopCommerce does it (at least the plugin loading parts). I would just let these end up being independent services perhaps talking to each other where it makes sense -- especially some common core services that might provide the main building blocks of the app here.
|
# ? Jun 10, 2014 03:26 |
|
bobua posted:Hoping someone here has some knowledge of opencv\emgu. I have a decent understanding of the opencv image structure cv::mat, but I'm trying to rewrite something in c#(emgu) which generally uses an Image<> type instead. (Sorry I don't know your answer but...) Q1. Why did you go for Emgu rather than "OpenCVSharp"? I'm not sure which one to pick. Q2. Has anyone managed to get either wrapper to work in Windows8.1 or WindowsPhone8.1 projects?
|
# ? Jun 10, 2014 05:45 |
|
bobua posted:Hoping someone here has some knowledge of opencv\emgu. I have a decent understanding of the opencv image structure cv::mat, but I'm trying to rewrite something in c#(emgu) which generally uses an Image<> type instead. Looking at the docs the method GetSubRect does what you want.
|
# ? Jun 10, 2014 06:37 |
You are able to have a web.config in a subfolder for only that folder and those under it with connectionstrings in it, correct? I am trying to do that and want the server to appear in the server explorer.
Drythe fucked around with this message at 16:18 on Jun 10, 2014 |
|
# ? Jun 10, 2014 15:39 |
|
I posted a question over on stackoverflow about an issue I'm growing incredibly frustrated with: http://stackoverflow.com/questions/24143964/could-not-load-file-or-assembly-jsonfx-json-or-one-of-its-dependencies-an-att If you guys could take a look at it, that'd be swell.
|
# ? Jun 10, 2014 16:01 |
|
Per the SO question, it looks like you were able to fix it by redownloading the DLL. Were you able to see what the differences were between the two files?
|
# ? Jun 10, 2014 17:49 |
|
I feel like I'm in bizarro world right now. "knockout is just like WPF so easy!" was the selling point, and I did me a knockout. Now I'm back to wpf (WOO!!!) or really "anything that's .NET and makes a windows app." Is it just me or is it really, really loving wordy? Or am I just using an old-hat style and there are newer features that are less wordy and a pain in the rear end? I'll give an example: code:
|
# ? Jun 10, 2014 19:33 |
|
|
# ? May 6, 2024 19:47 |
|
Well, part of the problem is that you're not doing MVVM. Not that MVVM is going to make it less verbose, but you're setting yourself up for pain down the line.
|
# ? Jun 10, 2014 19:35 |