get

Encapsulation C# newbie

混江龙づ霸主 提交于 2019-11-30 23:39:05
New to C#, and I understand that encapsulation is just a way of "protecting data". But I am still unclear. I thought that the point of get and set accessors were to add tests within those methods to check to see if parameters meet certain criteria, before allowing an external function to get and set anything, like this: private string myName; public string MyName;// this is a property, speical to c#, which sets the backing field. private string myName = "mary";// the backing field. public string MyName // this is a property, which sets/gets the backing field. { get { return myName; } set { if

How to grab data from post to a class

爱⌒轻易说出口 提交于 2019-11-30 22:29:01
If I have a form such as (not all the code just one field and my input): <div id="login_form"> <form id="registration" method="post" action="results.php"> <label for="first_name"> First Name: </label> <input type="text" id="first_name" name="first_name" maxlength="100" tabindex="1" /> <input type="submit" id="login_submit" name="submit" value="Submit"/ align="right"> </form> </div> Is it possible to grab the data from the form and then output that data to another page. The way I have it now I am just echoing the post from a form to a page: <?php $first_name = $_POST['first_name']; $last_name =

Saving a file using libcurl in C

喜夏-厌秋 提交于 2019-11-30 21:46:15
I'm expanding from perl to C and I'm trying to use curl's library to simply save a file from a remote url but I'm having a hard time finding a good example to work from. Also, I'm not sure if I should be using curl_easy_recv or curl_easy_perform karlphillip I find this resource very developer friendly. I compiled the source code below with: gcc demo.c -o demo -I/usr/local/include -L/usr/local/lib -lcurl Basically, it will download a file and save it on your hard disk. File demo.c #include <curl/curl.h> #include <stdio.h> void get_page(const char* url, const char* file_name) { CURL* easyhandle

Fetching HTTP GET variables in Python

给你一囗甜甜゛ 提交于 2019-11-30 21:20:55
I'm trying to set up a HTTP server in a Python script. So far I got the server it self to work, with a code similar to the below, from here . from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class MyHandler(BaseHTTPRequestHandler): def do_GET(self): print("Just received a GET request") self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() self.wfile.write('Hello world') return def log_request(self, code=None, size=None): print('Request') def log_message(self, format, *args): print('Message') if __name__ == "__main__": try: server = HTTPServer((

How to pass GET and POST data to the php executable?

余生颓废 提交于 2019-11-30 21:20:27
I am writing a web server in C# and I'm trying to add support for PHP. I have it mostly working, except I don't know how to past GET and POST data to the PHP executable when i pass the file to it. I've been testing with GET since I haven't gotten to getting POST requests handled on the server, and I have the string of the arguments that gets passed separated, but I don't know how to feed the information to the php parser. Some tips would be appreciated. For GET: The Easy Way (That i've found): php-cgi.exe <script-file-name> <parameter1>=<value1> <parameter2>=<value2> [...] <parameterN>=<valueN

Express.js: how to make app.get('/[:userId]i'..) in req.param?

核能气质少年 提交于 2019-11-30 20:57:12
I m using nodejs 0.8.21 and express 3.1.0 I need to read userId from url like http://mysite.com/39i . It means userId=39 . How to do? Thank you. Sample: app.get('/:userId_i', function(req, res) { }); app.param('userId', function(req, res, next, id){ }); travis Assuming you have a numerical id followed by an i and you want the id coming back as just the numerical. app.get("/:id([0-9]+)i", function (req, res) {...}); This will match a numeric followed by an i and will give you just the numeric in req.params.id . Example: curl -XGET localhost:8080/124i Gives me the following in req.params [ 'id':

How secure is a HTTP GET when the data is URL Encoded?

我怕爱的太早我们不能终老 提交于 2019-11-30 20:56:49
If the data is Url Encoded, is it secure enough to send login credentials over HTTP GET? Not at all. URL encoded is easily reversible. You should encrypt the transport layer (i.e. use HTTPS) No - URL encoding is meant to make sure all the characters you try to send with a GET request can actually arrive at the other end. It is actually designed to be easily encoded and decoded to prepare data for transport, not for security. URL encoding is not any kind of encryption, it just prepares the string to be sent through the network. If your data is sensitive, GET should be completely out of question

Https POST / GET with Qml/Qt

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 20:40:14
Recently I'm working on Nokia mobiles using Qt-Qml. I have to make a POST request to a given HTTPS Url. I'm using QML and I'm trying to do it in Javascript without any luck. Anyone has an idea about it? It's possible to do it using Javascript in QML? Any advise on how to make it in QT? I tried calling a function like this: var http = new XMLHttpRequest() var url = "myform.xsl_submit"; var params = "num=22&num2=333"; http.open("POST", url, true); //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http

get returned values from jquery get?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 20:33:52
问题 I am making jquery calls to get and getJSON, but cannot access returned values outside of callback function. How can I access the returned data? var firstid; var nextid; $.get(callUrl, function(data) { // call to add node var n = data.indexOf("id-"); var m = data.indexOf("id-"); firstid = data.substr(n+3,m - (n+3)); nextid = data.substr(m+3); alert("firstid:" + firstid); // returns correct value }); alert("firstid:" + firstid); // returns undefined for firstid how can I get firstid outside

Difference between Properties with get; set; and without get; set; [duplicate]

↘锁芯ラ 提交于 2019-11-30 20:22:49
问题 This question already has answers here : Difference between Property and Field in C# 3.0+ (10 answers) Closed 6 years ago . I do not understand the difference between static properties: public static int intId; and get;set; properties: public int intId { get { return intId; } set { intId = value; } } What is the difference between these two? They work like same or different? 回答1: Your first sample is a field, not a property. It's a good practice to always make fields private, and wrap them in