|
Essential posted:If you were to build your first phone app, as a fun hobby project, what would you do? Go native? Xamarin? "Native" and "Xamarin" are redundant; Xamarin is native. You're calling the same APIs that would get called if you wrote the code in Swift or Java; instead, it's from .NET. The first question would be "Which platforms do you want to support?" Are you doing iOS? Android? If you're doing anything Mac related, I would say go download Visual Studio for Mac and use that instead of using VS on Windows. While you can use VS, you still need a Mac set up and connected to your PC so you can build and deploy the app, and at that point, you should do your dev work on the Mac, IMO. If you're working with Android, I've seen more people use it VS on Windows, and generally, that's the more preferred IDE. If you've done any Windows development before with XAML (WPF, UWP), you should check out Xamarin.Forms, which is cross-platform UI toolkit. It makes it quite easy to build UIs that run everywhere, and it's by far the most popular way to build an app using Xamarin. Most of the tutorials and helper libraries you'll see on the web are for Xamarin.Forms. Of course, you can build iOS and Android apps using the standard UI kits those platforms use, and use class libraries or shared projects to share code between them all. And personally, I'm becoming a big fan of Elmish.XamarinForms, which is an awesome way to leverage F# and Xamarin.Forms. I wouldn't build a production app with it yet, as it's going through a bunch of changes while it's being worked on, but it's cool to check out if you're into F# and functional programming.
|
# ? Jul 7, 2018 18:24 |
|
|
# ? May 18, 2024 05:46 |
|
Drastic Actions posted:"Native" and "Xamarin" are redundant; Xamarin is native. You're calling the same APIs that would get called if you wrote the code in Swift or Java; instead, it's from .NET. Thanks for the information this is great! I'm doing some light reading on Xamarin and I think I see what you mean with Xamarin being native. I was under the impression it was something else, with limited capabilities (such as no gps) that could only be done in the native codebase. Since I have an Android phone my thought was to start there and I'm already setup on VS for windows. I have used xaml before with Silverlight of all things. I appreciate you pointing out xamarin.Forms as well. Essential fucked around with this message at 19:15 on Jul 7, 2018 |
# ? Jul 7, 2018 19:08 |
|
Honestly. Unity no matter what you were doing.
|
# ? Jul 8, 2018 00:27 |
|
I have officially 'd onto the Cosmos DB team. Should be a nice change of pace from my old team.
|
# ? Jul 9, 2018 02:00 |
|
Munkeymon posted:How is Min(0) not working for you for 'greater than 0'? Because they're not the same thing. Min(0) is 'greater than or equal to 0'. If your number is an int, then you can just use Min(1), but if you want a decimal (float, etc.) that has to be greater than 0, there's no way to do this out of the box. LOOK I AM A TURTLE posted:workaround suggestion Thanks man. I'm quite comfortable writing my own annotation (or just using Fluent Validation), I was just surprised that this isn't one of the built-in ones. chippy fucked around with this message at 10:00 on Jul 9, 2018 |
# ? Jul 9, 2018 09:56 |
|
chippy posted:Because they're not the same thing. Min(0) is 'greater than or equal to 0'. If your number is an int, then you can just use Min(1), but if you want a decimal (float, etc.) that has to be greater than 0, there's no way to do this out of the box. If there’s min on floating point types, you could just write out the smallest representable number greater than zero..
|
# ? Jul 9, 2018 12:15 |
|
chippy posted:Because they're not the same thing. Min(0) is 'greater than or equal to 0'. If your number is an int, then you can just use Min(1), but if you want a decimal (float, etc.) that has to be greater than 0, there's no way to do this out of the box. Yeah, my bad. I do some of my worst thinking in the morning, so I inflict it on you guys rather than my codebase
|
# ? Jul 9, 2018 14:21 |
|
If min(0) equates to greater than or equal to 0, then wont min(0) and != 0 equate to greater than 0?
|
# ? Jul 9, 2018 14:44 |
|
downout posted:If min(0) equates to greater than or equal to 0, then wont min(0) and != 0 equate to greater than 0? Is there an existing annotation for != ?
|
# ? Jul 10, 2018 10:33 |
|
We have some c# code that discovers our devices on the network. To do so it needs to probe some TCP ports - different firmware versions on the devices have different ports open. We accomplish this using the following codecode:
code:
|
# ? Jul 10, 2018 21:17 |
|
chippy posted:Is there an existing annotation for != ? I couldnt figure out what i was missing. Annotation doh. Thanks
|
# ? Jul 10, 2018 21:29 |
|
fankey posted:We have some c# code that discovers our devices on the network. To do so it needs to probe some TCP ports - different firmware versions on the devices have different ports open. We accomplish this using the following code Does VS2015 not let you filter out specific exception types? I thought it did like 2017 but I might be misremembering. (Also what sadist came up with that parentheses style?)
|
# ? Jul 10, 2018 22:29 |
|
raminasi posted:Does VS2015 not let you filter out specific exception types? I thought it did like 2017 but I might be misremembering. quote:(Also what sadist came up with that parentheses style?)
|
# ? Jul 10, 2018 23:29 |
|
This depends on hpw many devices you're talking about, but you could not time out each connection task, and instead time out "IsPortOpen" as a whole. Run the tasks, wait some time, and then poll each socket to see if it is connected. If you have quite a bit of things to scan, you can "do it yourself" by sending syn packets with SharpPcap and using a packet filter for syn/acks from the interesting hosts and ports. Or you can call an external tool like masscan to do it also.
|
# ? Jul 11, 2018 08:54 |
|
fankey posted:You can filter out what exceptions to break on but AFAIK there isn't a way to filter out what exceptions are printed out which seems to be what's bogging down VS. Looks like you can also just turn off exception printing which would be too heavy of a hammer as well. When the project is started inside VS, can you see if it makes any difference if you right click the Output window and deselect "Exception messages" (or similar)? Also, you could check if you have "Enable native code debugging" checked (and in that case try unchecking it) under Debug in the project properties.
|
# ? Jul 11, 2018 10:14 |
|
VS will not print out exceptions if they are caught. Therefore, you have uncaught exceptions happening - when there is a timeout, what awaits actualTask? Nothing! So the actualTask exceptions never get caught. I do not have VS installed on this computer, so cannot verify what a solution might be, but I suggest making sure that you have no dangling tasks - you need to continue with actualTask and handle the exception even if you timeout. My first instinct would be to construct something using .ContinueWith().
|
# ? Jul 11, 2018 11:39 |
|
EssOEss posted:VS will not print out exceptions if they are caught. My VS2013 does this and it's toggled by the "Exception messages" in the output window. Maybe non ancient VS makes more sense Edit: I missed the complete stack trace. So you're right, VS2013 will not print the entire exception with a stack trace like that, it will just be a one-liner per exception.
|
# ? Jul 11, 2018 12:15 |
|
Thanks for all the ideas. Anything that removes the exception printouts from the Output window solves the problem - turning off Exception Messages, Enable Just My Code, etc. The issue is I still want other exceptions to show up - even including other SocketExeceptions. it's just these particular operations I want to mask.EssOEss posted:VS will not print out exceptions if they are caught. Therefore, you have uncaught exceptions happening - when there is a timeout, what awaits actualTask? Nothing! So the actualTask exceptions never get caught. I do not have VS installed on this computer, so cannot verify what a solution might be, but I suggest making sure that you have no dangling tasks - you need to continue with actualTask and handle the exception even if you timeout. My first instinct would be to construct something using .ContinueWith(). code:
code:
|
# ? Jul 11, 2018 16:49 |
|
Here's what VS2013 outputs when I run the above: quote:testing... How come your VS doesn't say that it's a first chance exception? I find that odd. Do you want to ignore first chance exceptions? I'm guessing yes in this case, and you can do that by right clicking the Output window and uncheck exception messages. If you get an unhandled exception (unlike the above), you will still definitely know.
|
# ? Jul 11, 2018 17:44 |
|
fankey posted:As far I a know I am fully awaiting the task and should be catching all exceptions but I still get multiple internal exceptions printed out Oh, I thought you were getting stack traces in there but upon re-reading I realize that was just additional information on the exceptions. My mistake!
|
# ? Jul 11, 2018 18:18 |
|
Mongolian Queef posted:How come your VS doesn't say that it's a first chance exception? I find that odd. Do you want to ignore first chance exceptions? I'm guessing yes in this case, and you can do that by right clicking the Output window and uncheck exception messages. Looks like I was incorrect in my previous assessment. Just disabling exception printing in the Debug output doesn't fix my issue. Only enabling 'Just My Code' does.
|
# ? Jul 11, 2018 18:38 |
|
Is there a good way to dip my toes into learning to read IL? I managed to write some F# that causes an InvalidProgramException and the issue I opened is attracting curious people posting IL and I’d like to not feel like it’s written in a foreign language.
|
# ? Jul 16, 2018 22:27 |
|
raminasi posted:Is there a good way to dip my toes into learning to read IL? I managed to write some F# that causes an InvalidProgramException and the issue I opened is attracting curious people posting IL and I’d like to not feel like it’s written in a foreign language. assuming i found the issue you posted, it looks like it's managing to push 8x 32-bit values onto the stack and then reading one of them back as a 16-bit value when its passed to the DU constructor. that's not going to work very well i have some vague familiarity with assembly from my uni days but i had to google all the IL opcodes
|
# ? Jul 17, 2018 00:15 |
|
I'm gonna sound like a broken record, but LINQPad can do that: Some of the names are straightforward and you can look up the ones that aren't
|
# ? Jul 17, 2018 17:04 |
|
Hey y'all I'm building an picture/asset management system with a web api backend, angular frontend, and storing all the assets as blobs in azure. I'm working on a feature where you can select a bunch of assets in the UI and download them as a zip file. I'd like to send a request to the web api and: - grab the blobs from blob storage - zip them up in the web server - provide the zipped up file to the angular app/directly to the browser/whatever. I'm trying to figure out the most solid approach but having a hard time. I'm running .NET 4.6.1 and as I understand the System.IO.Compression namespace was greatly improved in .NET 4.5. I could be missing something but it looks like what comes for free with .NET is exclusively for working with the filesystem, which is not what I want to do - all this poo poo runs in Azure so I don't want to be reliant on any filesystem. I've come across suggestions on stack overflow of using 3rd party libraries, but most of them seem very out of date or no longer maintained (such as this one, DotNetZip, hosted on the deprecated CodePlex platform: https://archive.codeplex.com/?p=dotnetzip) Can I build this with native .NET 4.6.1? Is there an actively maintained library (in the form of an easily installable NuGet package) for creating zip files without a file system dependency?
|
# ? Jul 17, 2018 22:03 |
|
Careful Drums posted:I could be missing something but it looks like what comes for free with .NET is exclusively for working with the filesystem, which is not what I want to do - all this poo poo runs in Azure so I don't want to be reliant on any filesystem. System.IO.Compression doesn't require a file system, you can use MemoryStream's to hold the created archive. Then, you could download each blob (In memory as a stream) and add it to the archive and then stream that out in the response. For example, creating the zip, you could: code:
|
# ? Jul 17, 2018 22:26 |
|
Careful Drums posted:I'd like to send a request to the web api and: We just implemented something very similar in one of our apis, we used SharpZipLib, and Nuget. It was pretty trivial to use, just open up a zip output stream and add new entries into it, it even comes with some nice utilities to copy streams over without having to handle them yourself.
|
# ? Jul 18, 2018 04:41 |
|
Careful Drums posted:Hey y'all You'd have a filesystem on the webserver though? Which you can use as temp staging or something.
|
# ? Jul 18, 2018 09:19 |
|
Mr Shiny Pants posted:You'd have a filesystem on the webserver though? Which you can use as temp staging or something. You're right that there technically is a file system, you can ftp into it and everything, but I don't want to rely on it if i can avoid it. Thanks for the responses, I'm going to experiment today and I'll post what approach I end up using later.
|
# ? Jul 18, 2018 14:22 |
|
Careful Drums posted:You're right that there technically is a file system, you can ftp into it and everything, but I don't want to rely on it if i can avoid it. I think it's more that, unless you can't write to the web server at all, you can write a zip to a temporary path (System.IO.Path.GetTempPath()), add files to it, serve that file and delete it when done. Even with Azure App Services, you can write to GetTempPath.
|
# ? Jul 18, 2018 14:29 |
|
What I would prefer to do is to zip the files on the fly to a temporary Azure blob. That is, do not write to filesystem, do not write to a MemoryStream in RAM, just append the data directly to the blob. This avoids using significant server resources besides the CPU and limits the range of things that can go wrong. Once the write is finished, give the user a SAS token enabled link to the blob and get rid of the blob after N hours. I do not know if this processing model works well with the Zip and Azure Storage APIs, however. I am also unsure if the ZIP file format is friendly to append-only construction.
|
# ? Jul 18, 2018 15:20 |
EssOEss posted:What I would prefer to do is to zip the files on the fly to a temporary Azure blob. That is, do not write to filesystem, do not write to a MemoryStream in RAM, just append the data directly to the blob. This avoids using significant server resources besides the CPU and limits the range of things that can go wrong. Once the write is finished, give the user a SAS token enabled link to the blob and get rid of the blob after N hours. The ZIP format keeps the directory at the end of the archive, and I believe it's legal to have junk between individual files' data streams, meaning you could easily make "multi-session" ZIP files where you add a bunch of files, write a new directory at the end pointing to all old files and new files contained, and then you just have an old directory index floating in the middle somewhere, taking up a bit of extra space. You can even "delete" files that way, just writing a new directory that no longer points to the files to be deleted. Of course this accumulates garbage over time, so if you update some archives a lot you'd need to do a complete rewrite occasionally. I don't know if any libraries exist that allow this usage pattern, but the file format itself can support it.
|
|
# ? Jul 18, 2018 16:18 |
|
nielsm posted:The ZIP format keeps the directory at the end of the archive, and I believe it's legal to have junk between individual files' data streams, meaning you could easily make "multi-session" ZIP files... I love the zip file format! For instance, what Nokia did was have a JPEG header and content (the JPEG file format allows for junk at the end), then have a .AVI file, then put the ZIP directory right at the end which points to both JPEG and AVI files. If the file suffix is .JPG then every app in the world will correctly read the JPG part. If the file suffix is .ZIP then every app in the world will correctly read it as a ZIP containing two files, a JPEG and an AVI. If you write image-viewing software then you can decide to recognize it as a live photo. Anyone who wants to copy the file has an easy time of it too - it's just a single file. When Apple did their live photos, they seem to have done it with two separate files (at least at first) which meant it was harder to store/backup/view via third party utilities.
|
# ? Jul 18, 2018 16:48 |
And this is also why, if you have a service where you let untrusted users upload files of only a limited set of formats, you need to validate those files and ideally rewrite them, especially if other users are able to download the files. If you don't rewrite the file in its purported format, by parsing and re-creating the file structure, users would probably be able to stuff other data inside them e.g. via ZIP files.
|
|
# ? Jul 18, 2018 16:59 |
|
oh my god zips are more complicated than i thought
|
# ? Jul 18, 2018 19:41 |
|
Careful Drums posted:oh my god zips are more complicated than i thought Its software, what did you expect?
|
# ? Jul 19, 2018 09:00 |
|
Let's not forget about the fact that, as a lot of people were recently made aware of, you can have relative paths inside a zip, meaning that a zip file can contain a file at ../../../../usr/bin/fart.
|
# ? Jul 19, 2018 09:28 |
|
LOOK I AM A TURTLE posted:Let's not forget about the fact that, as a lot of people were recently made aware of, you can have relative paths inside a zip, meaning that a zip file can contain a file at ../../../../usr/bin/fart. Oh for Christ's sake.
|
# ? Jul 19, 2018 11:49 |
|
The school that I'll be teaching at in September uses C# for the 16-18 year olds, so I've decided I need to learn some. I've installed Visual Studio Community for Mac and have been working my way through C# Fundamentals for Absolute Beginners on MVA which has mainly been super easy, but I'm fine with slow. I'd rather get the foundational knowledge. 1. In terms of next steps, what do people recommend? I've seen mention of "The Yellow Book", someone else suggested "The Bulgarian Book" and I've got access to Lynda.com for free through my university. My goal is a solid understanding of the foundations. My coding background is self-taught Python to an upper-beginner level. 2. How much of a hinderance is being on OS X going to be? I've already noticed a couple of mini things (like how in the Switch + Enum video the guy used a snippet on the enum so it filled out all the switch cases for him), but should I just resign myself to doing my coding in a Windows 10 VM? 3. In terms of cross-platform GUI creation, my friends who code in C# talk about WPF, which obviously doesn't work on OS X. What's the best alternative? A Google suggests Xamarin.Forms? Thanks Sad Panda fucked around with this message at 16:20 on Jul 19, 2018 |
# ? Jul 19, 2018 16:16 |
|
|
# ? May 18, 2024 05:46 |
|
Sad Panda posted:The school that I'll be teaching at in September uses C# for the 16-18 year olds, so I've decided I need to learn some. I've installed Visual Studio Community for Mac and have been working my way through C# Fundamentals for Absolute Beginners on MVA which has mainly been super easy, but I'm fine with slow. I'd rather get the foundational knowledge. 1. [edit] I can't read durr 2/3: What you need to keep in mind is that the only thing that's cross-platform from the ground up right now is .NET Core. If you're looking to do desktop GUIs, you're looking at full .NET framework. If you're looking at full .NET framework, you might as well do it on Windows and save yourself a world of pain. https://stackoverflow.com/questions/779283/is-there-a-cross-platform-gui-framework-for-c-net
|
# ? Jul 19, 2018 16:49 |