Today I needed to be able to POST
to a form in order to submit for values as well as upload a file. All using HTTP POST.
The first step was finding out that there does not seem to be a native way to post both form parameter and upload a file together.
allows for the parameter name/value pairs, but sets it’s encoding type to
which is incorrect for file uploads. The code for this would look something like this:
I found that
*BUT* there is no way to post parameters, and the request is not properly formatted. To clarify, it will work fine with a IIS webserver, but any other real webserver (Apache, Tomcat) would choke on the malformed output. Microsoft does not do standards too well if you have not noticed. Microsoft — if you are reading this, kindly go read RFC1867. The call would look like this
does set content type to
My main issue is not the incompatibility in this instance, but rather that I cannot post parameters and the file in the same post.
In order to solve this, I found a excellent class written by Gregory Prentice. I compiled the c# class and included a reference to it in my vb.net app. Then it was a simple matter of adding the reference
and adding this code:
And booyah it works!
Additional Link Dump:
Uploading a file over HTTP in .NET
Three ways to use C# within a VB.NET project
How to post a file via HTTP post in vb.net
Upload files with HTTPWebrequest (multipart/form-data)
Freebase is a pretty cool site which has a massive amount of data on a wide variety of topics. It also has a developer API including REST services.
Kind of like data.gov but the data seems more accessible.
Today I had a Cacti server just stop polling out of the blue. It happened around the same time a coworker added a device to monitor though I’m not sure if this has anything to do with it. The box needed a reboot anyway, so I went ahead and gave it a reboot to see if that would be a easy fix. Nope.
Disabled the newly added host, but still no dice. I checked the log file and found:
So the poller was running, but not actually polling… a ls-lah of the RRD directory shows the files have been updated, and have the correct permissions set. The graphs are seemingly being updated with null values.
Forced a run of the cacti poller (ran as sudo or I’d need to run as www-data):
Tail’d the log — note changing the setting under Settings -> General -> Poller Logging Level directly affects what gets logged here so it can he helpful to increase when troubleshooting.
Looks like it updated… not sure why it stopped. I sort of remember having to do this once before in the past and forcing the re-run fixed it then to IIRC.
Now that it did the full update… letting it poll to see if it does it again as it should…
UPDATE: It is still polling correctly — going to re-enable the host mentioned at the beginning and see what happens.
UPDATE 2: Everything is working good so far… increased my Poller threads from 1 to 2 and enabled process load balancing.
Found on a forum and it’s pretty cool: uhfhdtvantenna.blogspot.com/
If you don’t want to spend upwards of 70 bucks like I did on a not so great performing Yagi style antenna. Then build this diy hdtv antenna for almost nothing and get better results. My Yagi style antenna I got from ebay was pulling about 60-85 signal strength on most channels and ALWAYS would have continual dropouts making it impossible to watch Free OTA (over the air) digital HDTV. It always dropped out at the most inconvienent time. Another thing I hated about the yagi was it came with a rotor but the rotor had NO INDICATOR! You had no way of telling when the antenna was pointed in the right direction!!! That might work for analog signals you can watch come and go but is just ridiculous for digital signals! Digital signals are choppy, latent and very slow to respond with a moving antenna. Pointing must be very accurate for a strong digital signal. I found it was quite impossible to use a rotor without an indicator when positioning for a certain station. That is why you can see I have an old timey rotor in the setup. I built this bowtie style antenna in about an hour and can’t believe the way it out performs that other antenna. Swear to GOD! I am hitting 88 to 99 signal strength on all my channels now with NO DROPOUTS AT ALL!!!!