Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

marky-b

Member Since 04 Oct 2011
Offline Last Active Aug 27 2012 07:51 PM
-----

Posts I've Made

In Topic: Replacing texst in strings

24 August 2012 - 08:45 AM

Hi All,
When I use the function Replace(unwanted, replacement) of stringBuilder, if the "replacement" string length is bigger than "unwanted" length then the method throws "OutOfRangeException". I have microframework 4.2.
Thanks in advance.


I haven't had issues with the replacement text being longer than what it is replacing.

I found a pretty interesting bug back when 4.2 was still alpha-ish; outlined here

Have you tried with a shorter base string? You could possibly be running out of memory on the netduino. Try and compile a simple .NETMF project and run it locally on your PC. If it works there, but not on your netduino, I'm guessing you're asking a bit too much from it.

Possible workaround: Look at an example on the thread I linked above (first post in that thread, iirc) that reads through one char at a time and does the replacing that way. It was Valkyrie-MT's example. [WARNING: It's not pretty] ;)

In Topic: Replacing texst in strings

24 August 2012 - 08:40 AM

Hi folks,
I can't find String.Replace in my NetDuino Plus project. This is the error:
"String does not contain a defenition for 'Replace' and no extension method...bla bla bla"

I use .Net MF 4.1


You cant actually do a <string>.Replace(), as strings don't have that method in the micro framework.

You can, however, do what bulletprooffool did and roll your own Replace() function, and call it wherever you need it. I like to have a utils.cs class to keep this kind of crap handy.

[OR]

If you don't want to get that fancy/reusable with it, you can just do it inline-ish by doing exactly what is in that function; make the String a StringBuilder, do your fiddling, and then assign it back to your original gangster String. That will look a little something like this:
String tacoString = "I like Tacos";
// "I like Tacos"
StringBuilder  tacoStringBuilder = new StringBuilder(tacoString);
tacoString = tacoStringBuilder.Replace("like","love").ToString();
// "I love Tacos"

Just be sure you get that last .ToString() in there; I don't think it will compile if you don't.

Hope this helps.

Mark

In Topic: SNMP???

17 August 2012 - 06:31 PM

From what I'm reading about the .netmf, there are hints of a simple SNMP lib being available in 4.3 (release at the time of this post is 4.2). (comments on a link (http://netmf.codeple...m/workitem/1232) previously posted in this thread. (also- i know this is an older thread-- I just thought I would update it as its the #1 result in google for "netduino snmp") Mark

In Topic: SNMP???

16 August 2012 - 07:58 PM

I just randomly came across this library that says it supports .NET MF 3.5

Sharp SNMP (#SNMP) Library

The library looks a bit large, so I'm not sure if it will fit on the netduino. However, it is open source.. so you could possibly strip it down a little.

I did not check it out yet, though. I might dive into it this weekend. I really want to poll my Airport Extreme for current throughput and use an analog gauge of some sort to display it.

Sounds simple enough.. (how most of my hair-brained ideas start)


I cant read. It's for the Compact Framework.. not Micro :(

In Topic: Speaker class and Netduino Keyboard

28 November 2011 - 08:02 PM

I see you're using O7 and O8. The code just isn't prepared for that.


Totally missed the octave range limit in the documentation. Thanks for the info (and changeset) :)

Mark

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.