Content Developer II at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
121468 stories
·
29 followers

Posting binary data using HttpClient on Android

1 Share

There is an issue folks have encountered when using the .NET HttpClient service to do a POST to an ASP.NET Core controller, where the payload of the post is binary data.

For example:

      var client = new HttpClient();
      var content = new ByteArrayContent(serialized);
      var httpResponse = await client.PostAsync(
        "<server url>",
        content);

The result is an exception: Unable to read beyond end of stream

It turns out that the problem is that the default HttpClient configuration on Android sends the data over the network with the wrong HTTP Content-Type header.

The Content-Type should be either application/octet-stream or left off completely since that is the default.

Instead, what is sent is application/x-www-form-urlencoded. Totally invalid in this context.

As a result, the ASP.NET Core server doesn’t properly handle the binary payload, because it is following the instructions based on the incorrect Content-Type header.

How do you solve this?

Configure the HttpClient service differently on the client:

  var client = new HttpClient(new SocketsHttpHandler()));

The SocketsHttpHandler properly handles the ByteArrayContent content object and sends the correct header to the server.

Because I think this is a bug in the default HttpClient implementation on Android, I’ve filed a bug:

https://github.com/dotnet/maui/issues/21933

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

Daily Reading List – April 18, 2024 (#300)

1 Share

Three hundred issues of this little daily post! I’m sure I’ll really find my voice by the time I reach issue eight hundred. A few of the items today really got me thinking and I hope you enjoy the list.

[article] AI Product Management. Building AI apps (not platforms) comes with risks to consider and plan for. This is a great article for teams about to embark on that journey.

[blog] Flutter Made Easy: 5 Tools to Build Better Apps Faster. I’ve given up on ever getting into frontend work, but maybe better tools and generative AI assistance will get me there.

[blog] Security, Maintainability, Velocity: Choose One. Tyler says that without careful consideration, you’ll find yourself choosing security, maintainability, or velocity for your software development.

[site] Build the future of AI with Meta Llama 3. Meta shipped the latest version of their Llama model with some impressive performance numbers. Relatedly, you can try it out on Google Cloud’s Vertex platform.

[blog] What you missed from Firebase at Cloud Next ‘24! The Firebase booth was PACKED with people looking at tech and asking questions. Check this out for videos of their talks.

[blog] Securing Prometheus with Istio Ambient. Quick post, but it highlights the “it just works” outcome of the new data plane in the Istio service mesh.

[blog] Optimize Applications with Performance Configuration Testing. Can you A/B test infrastructure setups in production? That’s what Bruno proposes here, and cloud platforms make it easier to run such experiments.

[blog] Use Log Analytics for BigQuery Usage Analysis on Google Cloud. It doesn’t matter if you generate tons of logs if you have to way to use them. This post shows how to more easily analyze logs produced by your data warehouse.

[blog] Tune Gemini Pro in Google AI Studio or with the Gemini API. While tuning a model can feel intimidating, it really does seem like we’re making this very approachable.

[blog] Introducing LLM fine-tuning and evaluation in BigQuery. While the previous example is for experimentation, this post shows more of a production-grade fine tuning scenario.

[article] Java services hit hardest by third-party vulnerabilities, report says. Plenty of risk to go around, but pay special attention to your (patched) dependencies for Java.

##

Want to get this update sent to you every day? Subscribe to my RSS feed or subscribe via email below:



Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

Vivaldi is Bringing Its Browser to Windows on Arm Too

1 Share

You can add Vivaldi to the growing list of companies that will offer a native version of their web browsers on Windows on Arm. It's still early days, but it's happening.

The post Vivaldi is Bringing Its Browser to Windows on Arm Too appeared first on Thurrott.com.

Read the whole story
alvinashcraft
6 hours ago
reply
West Grove, PA
Share this story
Delete

Electron 30.0.0

1 Share

Electron 30.0.0 has been released! It includes upgrades to Chromium 124.0.6367.49, V8 12.4, and Node.js 20.11.1.


The Electron team is excited to announce the release of Electron 30.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

Notable Changes

Highlights

  • ASAR Integrity fuse now supported on Windows (#40504)
    • Existing apps with ASAR Integrity enabled may not work on Windows if not configured correctly. Apps using Electron packaging tools should upgrade to @electron/packager@18.3.1 or @electron/forge@7.4.0.
    • Take a look at our ASAR Integrity tutorial for more information.
  • Added WebContentsView and BaseWindow main process modules, deprecating & replacing BrowserView (#35658)
    • BrowserView is now a shim over WebContentsView and the old implementation has been removed.
    • See our Web Embeds documentation for a comparison of the new WebContentsView API to other similar APIs.
  • Implemented support for the File System API (#41827)

Stack Changes

Electron 30 upgrades Chromium from 122.0.6261.39 to 124.0.6367.49, Node from 20.9.0 to 20.11.1, and V8 from 12.2 to 12.4.

New Features

  • Added a transparent webpreference to webviews. (#40301)
  • Added a new instance property navigationHistory on webContents API with navigationHistory.getEntryAtIndex method, enabling applications to retrieve the URL and title of any navigation entry within the browsing history. (#41662)
  • Added new BrowserWindow.isOccluded() method to allow apps to check occlusion status. (#38982)
  • Added proxy configuring support for requests made with the net module from the utility process. (#41417)
  • Added support for Bluetooth ports being requested by service class ID in navigator.serial. (#41734)
  • Added support for the Node.js NODE_EXTRA_CA_CERTS CLI flag. (#41822)

Breaking Changes

Behavior Changed: cross-origin iframes now use Permission Policy to access features

Cross-origin iframes must now specify features available to a given iframe via the allow attribute in order to access them.

See documentation for more information.

Removed: The --disable-color-correct-rendering command line switch

This switch was never formally documented but its removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.

Behavior Changed: BrowserView.setAutoResize behavior on macOS

In Electron 30, BrowserView is now a wrapper around the new WebContentsView API.

Previously, the setAutoResize function of the BrowserView API was backed by autoresizing on macOS, and by a custom algorithm on Windows and Linux. For simple use cases such as making a BrowserView fill the entire window, the behavior of these two approaches was identical. However, in more advanced cases, BrowserViews would be autoresized differently on macOS than they would be on other platforms, as the custom resizing algorithm for Windows and Linux did not perfectly match the behavior of macOS's autoresizing API. The autoresizing behavior is now standardized across all platforms.

If your app uses BrowserView.setAutoResize to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS. If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.

Removed: params.inputFormType property on context-menu on WebContents

The inputFormType property of the params object in the context-menu event from WebContents has been removed. Use the new formControlType property instead.

Removed: process.getIOCounters()

Chromium has removed access to this information.

End of Support for 27.x.y

Electron 27.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E30 (Apr'24)E31 (Jun'24)E32 (Aug'24)
30.x.y31.x.y32.x.y
29.x.y30.x.y31.x.y
28.x.y29.x.y30.x.y

What's Next

In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

You can find Electron's public timeline here.

More information about future changes can be found on the Planned Breaking Changes page.

Read the whole story
alvinashcraft
6 hours ago
reply
West Grove, PA
Share this story
Delete

The rule of three with Ellen Lupton

1 Share

S02E15 (#325). Ellen Lupton, designer, educator and author, helps us stock up our toolbox of design principles and methods, starting off with storytelling in visual design, and the “rule of three” before we move on to linear and non-linear experiences. Will we follow the rule of three and have a third topic?

We talk about IKEA and The Wizard of Oz, labyrinths and mazes. The use of colour to craft a narrative within larger experiences. The importance of pace, and that sometimes a challenge is good for the experience.

“[Seven] is a beautiful number. It’s a prime number, it has an elegance within the sequence from one to ten. That’s very attractive. And of course, people can remember seven things, not me anymore.”

– Ellen Lupton

(Listening time: 31 minutes, transcript)

References:

The post The rule of three with Ellen Lupton appeared first on UX Podcast.





Download audio: https://media.blubrry.com/uxpodcast/content.blubrry.com/uxpodcast/uxpodcast-s02e15-325-ellen-lupton.mp3
Read the whole story
alvinashcraft
6 hours ago
reply
West Grove, PA
Share this story
Delete

Foundations of Design for Developers with Kathryn Grayson Nanz

1 Share

Kathryn Grayson Nanz Is a designer who's written an ebook called Quote Foundations of design for developers. She understands that developers need to participate in the design process, and often developers can identify that something is wrong with the design but they can't figure out why. In this episode she talks to Scott about how engineers and developers can learn design and even become actively interested in the topic!





Download audio: https://r.zen.ai/r/cdn.simplecast.com/audio/24832310-78fe-4898-91be-6db33696c4ba/episodes/8985c62b-24ff-42f3-bd94-e2647fd88254/audio/66f8b306-eefd-4165-87f2-4100d44550f8/default_tc.mp3?aid=rss_feed&feed=gvtxUiIf
Read the whole story
alvinashcraft
6 hours ago
reply
West Grove, PA
Share this story
Delete
Next Page of Stories