Visual C# Upload File/Image via PHP with Squid-Cache in the Network
Info.Tech, Linux System Administration, PHP, Software Development, Visual C# View CommentsToday, I’ve been developing an oDesk-like activity monitoring application but for local network for my company, Innermax Support, and I came across with a problem of an errors:
- An exception occurred during a WebClient request.
- The remote server returned an error: (417) Expectation failed.
And during my search in Google — from forums, MSDN and other developers’ resources — they face same problem. The common issue was the 100-Continue problem passing to a network with squid-cache. So there’s a websites that I combined their codes and luckily it works. Just forgot the URLs, I can’t credit thank-you’s to them.. hehehe!
The setup is like this… there’s a firewall which has squid-cache in the local network and my server where I will upload my file/image is at the other network with public IP address. I will directly upload the file/image to my server using the assigned public IP address via PHP script.
Here’s my code to solve the problems;
public void uploadFile()
{
try
{
// decleration of webclient
ServicePointManager.Expect100Continue = false;
System.Net.WebClient webby = new System.Net.WebClient();
//initiate credentials
webby.UseDefaultCredentials = false;
webby.Credentials = new NetworkCredential("anonymous", "");
//add headers
webby.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.832)");
webby.Headers.Add("Content-Type", "binary/octet-stream");
//initiate upload file
Byte[] result = webby.UploadFile("http://120.0.0.1/upload.php", "POST", @filename);
string s = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
MessageBox.Show(s);
webby.Dispose();
}
catch (Exception)
{
// do nothing...
MessageBox.Show("Upload failed!");
}
}
So far, it works fine with me and satisfied of my solution. Hope this will help your problem too…
PROTECT IP / SOPA Breaks The Internet from Fight for the Future on Vimeo.
Tell Congress not to censor the internet NOW! – fightforthefuture.org/pipa
PROTECT-IP is a bill that has been introduced in the Senate and the House and is moving quickly through Congress. It gives the government and corporations the ability to censor the net, in the name of protecting “creativity”. The law would let the government or corporations censor entire sites– they just have to convince a judge that the site is “dedicated to copyright infringement.”
The government has already wrongly shut down sites without any recourse to the site owner. Under this bill, sharing a video with anything copyrighted in it, or what sites like Youtube and Twitter do, would be considered illegal behavior according to this bill.
According to the Congressional Budget Office, this bill would cost us $47 million tax dollars a year — that’s for a fix that won’t work, disrupts the internet, stifles innovation, shuts out diverse voices, and censors the internet. This bill is bad for creativity and does not protect your rights.
Biden on Internet Freedom = Anti-SOPA from Fight for the Future on Vimeo.
Joe Biden filled in for Hillary Clinton at the London Conference on Cyberspace (LCC) on November 1st, giving a speech on the importance of freedom in cyberspace and talking up the importance of freedom on the internet and not regulating the internet. Meanwhile, the Obama Administration stands with congress in full support of H.R 3261, the Stop Online Piracy Act, which would give copyright holders the ability to censor websites on the net. We need to stand up now and let Congress know that they shouldn’t mess with the Internet!
[REPOST] 7 Ways To Fail When Outsourcing To The Philippines by John Jonas
Info.Tech, Madness, Personal View CommentsMy co-worker sent me a link and found it very true of most of the employers in Online Jobs. They maltreated Filipinoes as their virtual assistant, they want to do everything and finish it in a day or hour or a second. And I found it as stupidity tasks coz we are not Superman! I would like to re-post this good article by John Jonas.
When it comes to outsourcing your business (or yourself!) to the Philippines, there’s definitely a learning curve.
Here are 7 ways you can guarantee failure for yourself :
(Hint: Don’t do these things!)
1. Try To Hire Someone To Do Everything
Here’s an actual email I got this week

So wait…you want a programmer, graphic designer, webmaster, who is fluent in english and likes to write, who can write sales copy, autoresponders, forum posts, ebooks, and reports.
Oh yeah, sure, let me help you find that person!
Oh wait, that person doesn’t exist.
Hire someone to do a specific task! Then train them to be able to do everything.
2. Hire A Project Manager
Filipinos don’t know how to run your business for you.
Don’t try to hire a project manager first along with 6 others, and expect that “project manager” to manage those other 6 and get things done. They don’t know how.
YES! They’re very capable of being project managers, but very rarely will you find someone who has been involved in enough internet business that you can just turn a project over to them and have them manage other people for you.
Eventually…yes! After you’ve trained them and they’ve seen how the business is supposed to work.
3. Hire Someone And Ignore Them
You have to train the person you hire. They don’t know how to run your super-niche internet marketing business. Don’t expect to hire someone and just let them go do everything themselves. Expect to spend some time working with them.
4. Ask Someone To Do Work Before You Offer Them A Job
This is my favorite.
I get an email that says
Can you please tell me why I can’t successfully hire someone, they all keep disappearing.
Here’s the email I send them:
I want you to start by doing a trial task.
Write 20 articles, submit them to article directories, do a bunch of directory submissions for me, build me a website and write all the content for it.
Then, I’ll evaluate your work and see if it’s going to work out.
hahahahaha.
Yeah right!
They’re not going to do work until AFTER they know they have a full-time job working for you.
Don’t give them a test task. Give them a job. Tell them the first month is a probationary period.
5. Expect Immediate Results
This is a long-term proposal here. I’ve been doing it for 4 years. You’re not going to see the same results in 4 days.
Don’t expect it.
6. Search and Search and Search For The Right Person, Then Email Them
Hey John,
I searched for 3 days and I found the perfect candidate. They can do everything you said wasn’t possible back up in #1 on this blog post. Why won’t they respond to me?
Why?
Because they already have a job and they’re loyal to their current employer.
Instead of trying to find the perfect person up front, try contacting 20 potential fits, see who responds, then sort through them.
7. Set The Wrong Expectations
When you hire them, don’t tell them you expect them to be totally self-directed and to work without supervision and to be able to figure everything out on their own.
If you do, you’ll never hear from them again.
Try telling them
I expect you to try to figure things out, but I understand that I’m going to give you tasks that you won’t know how to do, and sometimes there won’t be any way to figure it out. In these cases, please know that I’m here to answer your questions. I’m here to help you. Please don’t hesitate to ask me when you get stuck.
Otherwise, when they don’t know how to do something they get embarrassed and will never talk to you again.
If you set the right expectation with them about asking for help, they’ll ask, you’ll help, and all will be happy and good.
These aren’t hard things to avoid…you just have to know about them to avoid them.
There’s more good stuff like this as a member of ReplaceMyself.com.
Author: John Jonas
Article Reference: http://www.jonasblog.com/7-ways-to-fail-when-outsourcing-to-the-philippines
Recent Comments