1 / 56

TC KIMLIK CHECKSUM

TC KIMLIK CHECKSUM. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { long long tcKimlikNoNumber ; long long d[10] ; long long tmp1 = 0 ; long long tmp = 0 ; long long odd_sum = 0 ; long long even_sum = 0 ; long long total = 0 ;

pinedap
Download Presentation

TC KIMLIK CHECKSUM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TC KIMLIK CHECKSUM #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { long long tcKimlikNoNumber ; long long d[10] ; long long tmp1 = 0 ; long long tmp = 0 ; long long odd_sum = 0 ; long long even_sum = 0 ; long long total = 0 ; long long chkDigit1 = 0 ; long long chkDigit2 = 0 ; int i ;

  2. for(tcKimlikNoNumber = 19000000000 ; tcKimlikNoNumber < 20000000000 ; tcKimlikNoNumber++) { tmp =tcKimlikNoNumber / 100 ; tmp1 = tcKimlikNoNumber / 100 ; for (i = 9; i > 0; i--) { d[i] = tmp1 % 10 ; tmp1 = tmp1 / 10 ; } odd_sum = d[9] + d[7]+ d[5]+ d[3]+ d[1]; even_sum = d[8] + d[6] + d[4] + d[2]; total = odd_sum * 3 + even_sum; chkDigit1 = (10 - (total % 10)) % 10; odd_sum = chkDigit1 + d[8] + d[6] + d[4] + d[2]; even_sum = d[9] + d[7] + d[5] + d[3] + d[1]; total = odd_sum * 3 + even_sum; chkDigit2 = (10 - (total % 10)) % 10; tmp = tmp * 100 + chkDigit1 * 10 + chkDigit2; if (tmp != tcKimlikNoNumber) { /* printf("Gecersiz TC Kimlik Numarasi: %lld\n",tcKimlikNoNumber) ; */ ; } else { printf("Gecerli TC Kimlik Numarasi: %lld\n",tcKimlikNoNumber) ; } } return(0) ; }

  3. HTML • Hypertext Markup Language • Identifies the elements of a page so that a browser such as MS Internet Explorer or Netscape can render that page on the computer screen • Static page description • WYSIWYG web page authoring tools • MS Frontpage • Dreamweaver • Home Site

  4. HTML Example Source <HTML> <HEAD> <TITLE> Hello </TITLE> </HEAD> <BODY> <P> Hello world </P> </BODY> </HTML>

  5. HTML Form Example <HTML><HEAD> <TITLE> Hello </TITLE> </HEAD> <BODY> <FORM METHOD="GET" ACTION="http://localhost/cgi-bin/ex.cgi > <INPUT TYPE="text" NAME="word"> <INPUT TYPE="submit" VALUE="Submit word"> </FORM> </BODY> </HTML>

  6. GET and POST METHODS • GET method passes form input as part of the URL to the server side program: • http://www.yahoo.com/cgi-bin/process.cgi?firstname=ali&last=veli • POST method passes input to the standard input of the server side program: • firstname=ali • last=veli

  7. HTML5 • HTML5 is the next generation of HTML • HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. • The previous version of HTML came in 1999. The web has changed a lot since then. • HTML5 is still a work in progress. However, most modern browsers have some HTML5 support. • Examples: • http://html5demos.com/

  8. HTML5 • Some of the most interesting new features in HTML5: • The canvas element for drawing • The video and audio elements for media playback • Better support for local offline storage • New content specific elements, like article, footer, header, nav, section • New form controls, like calendar, date, time, email, url, search

  9. JAVASCRIPT • Scripting language • Browser contains Javascript interpreter which processes the commands in the script • Processed by client

  10. Javascript Example Source <HTML> <HEAD> <TITLE> Hello </TITLE> <SCRIPT LANGUAGE= "Javascript" > function sayhello() { document.writeln("<p> Hello world </p>") ; } </SCRIPT> </HEAD> <BODY ONLOAD= "sayhello()" > </BODY> </HTML>

  11. CSS (Cascading Style Sheets) • Allow you to specify the style of your page elements (spacing, margins etc) separately from the structure of your documents (section headers, body, text, links etc) • “Separation of Structure from Content” allows greater manageability and makes changing the style of the document easier.

  12. CSS Example Source • inline style (w/o CSS) <HTML> <HEAD> <TITLE> Hello </TITLE> </HEAD> <BODY> <P STYLE= “font-size: 20 pt” > Hello world </P> </BODY></HTML>

  13. CSS Example Source • css style sheet <HTML> <HEAD> <TITLE> Hello </TITLE> <STYLE TYPE = “text/css”> P {font-size: 20 pt } </STYLE> </HEAD> <BODY> <P > Hello world </P> </BODY></HTML>

  14. CSS Example Source • importing the css file: <HTML> <HEAD> <TITLE> Hello </TITLE> <LINK REL = “stylesheet” TYPE=“text/css” HREF = “styles.css” </HEAD> <BODY> <P > Hello world </P> </BODY></HTML>

  15. XML-Extensible Markup Language • HTML markup is for displaying information • XML markup is for describing data of virtually any type • XML enables creation of new markup languages to markup anything imaginable (such as mathematical formulas, records etc) • In XML, new tags can be created • Data is structured in a hierarchical manner

  16. XML example <? xml version = “1.0”> <person> <firstname> Ali </firstname> <lastname> Veli </lastname> <married> yes </married> <wife> <firstname> Ayse </firstname> <lastname> Mehmet </lastname> </wife> </person>

  17. XML Document Model • A “document model” is used to enforce structure within a document • Two types of document models for XML: • DTD – Document Type Definition • XML Schema • Document models are not required in XML

  18. Validating Parsers • A validating parser will check an XML document’s structure against a DTD or XML Schema • Documents that conform to a document model are “valid” • Validating parsers will report an error if the document does not conform to it’s document model, even if it is well-formed

  19. DTD Example: XML File • 1 <?xml version=”1.0” standalone=”yes”?> • 2 <emails> • 3 <message num=”a1” to=”joe&#64;acmeshipping.com” • 4 from=”brenda&#64;xyzcompany.com” date=”02/09/01”> • 5 <subject title=”Order 10011”/> • 6 <body> • 7 Joe, • 8 Please let me know if order number 10011 has shipped. • 9 Thanks, • 10 Brenda • 11 </body> • 12 <reply status="yes"/> • 13 </message> • 14 </emails>

  20. DTD Example: Internal DTD 1 <!DOCTYPE emails [ 2 <!ELEMENT emails (message+)> 3 <!ELEMENT message (subject?, body, reply*)> 4 <!ATTLIST message 5 num ID #REQUIRED 6 to CDATA #REQUIRED 7 from CDATA #FIXED“brenda&#64;xyzcompany.com” 8 date CDATA #REQUIRED> 9 <!ELEMENT subject EMPTY> 10 <!ATTLIST subject 11 title CDATA #IMPLIED> 12 <!ELEMENT body ANY> 13 <!ELEMENT reply EMPTY> 14 <!ATTLIST reply 15 status (yes | no) "no"> 16 ]>

  21. XML Schema • XML Schema specification released by the W3C in May 2001, and contains two parts: • Part I - structure • Part II - data types • Developed as an alternative to DTD’s and is much more powerful • Features: • Pattern matching • Rich set of data types • Attribute grouping • Supports XML namespaces • Follows XML syntax

  22. XML Schema Example 1 <?xml version=”1.0”?> 2 <message 3 xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" 4 xsi:noNamespaceSchemaLocation = "message_schema.xsd"> 5 <to>Joe Poller</to> 6 <from>Brenda Lane</from> 7 <date_sent/> 8 <subject>Order 10011</subject> 9 <body> 10 Joe, 11 Please let me know if order number 10011 has shipped. 12 Thanks, 13 Brenda 14 </body> 15 </message>

  23. XML Schema Example 1 <?xml version=”1.0”?> 2 <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”> 3 <xsd:element name=”message”> 4 <xsd:complexType> 5 <xsd:sequence> 6 <xsd:element name=”to” type=”xsd:string” minOccurs-“1” maxOccurs=”unbounded”/> 7 <xsd:element name=”from” type=”xsd:string” minOccurs=”1”/> 8 <xsd:element name=”date_sent” type=”xsd:date”/> 9 <xsd:element name=”subject” type=”xsd:string”/> 10 <xsd:element name=”body” type=”xsd:string”/> 12 </xsd:sequence> 12 </xsd:complexType> 13 </xsd:element> 14 </xsd:schema>

  24. ASP/PHP • Javascript is client side scripting language • ASP/PHP are server side scripting languages • ASP/PHP process pages on the server and return the results in the form of HTML source to the client (browser) • ASP is Microsoft product

  25. <html> <body> <?php $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $result = mysql_query("SELECT * FROM employees",$db); printf(“<p>First Name: %s</p>\n", mysql_result($result,0,"first")); printf(“<p>Last Name: %s</p>\n", mysql_result($result,0,"last")); printf(“<p>Address: %s</p>\n", mysql_result($result,0,"address")); printf(“<p>Position: %s</p>\n", mysql_result($result,0,"position")); ?> </body> </html> PHP Example 1

  26. <html> <body> <?php if ($submit) { // process form $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> First name:<input type="Text" name="first"><br> Last name:<input type="Text" name="last"><br> Address:<input type="Text" name="address"><br> Position:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php } // end if ?> </body> </html> PHP Example 2

  27. PHP-MYSQL PROGRAMMING MYSQL Commands CREATE TABLE tablename ( columnname typ modifiers, columnname typ modifiers, …..) SELECT fieldname1, fieldname2,.. FROM tablename WHERE criteria SELECT fieldname1, fieldname2,.. FROM tablename ORDER BY fieldname ASC DSC

  28. PHP-MYSQL PROGRAMMING INSERT INTO tablename (fieldname1, fieldname2,…) VALUES (‘value1’, ‘value2’, … ) UPDATE tablename SET fieldname1=‘value1’, fieldname2=‘value2’ WHERE criteria DELETE FROM tablename WHERE criteria

  29. CGI • Common Gateway Interface • Protocol to enable running programs on the web server • These programs produce HTML output which is sent to the client (browser) • Programs can be written in any language (most popular is PERL)

  30. PERL • Practical Extraction and Report Language • Became popular with CGI programs • High level – rich and easy to use pattern matching, text processing operators • Lots of free PERL modules (packages) are available that make programming easy: • networking modules • Html/XMP parser, CGI modules • Extremely useful for developing automated pograms that surf the Internet

  31. Automated Web Page Downloader #!/usr/local/bin/perl use LWP::UserAgent ; use HTML::TokeParser ; $options{"agent"} = "Mozilla/4.6 [en] (X11; I; SunOS 5.7 sun4u)"; my $agent = new LWP::UserAgent(%options); my $request = new HTTP::Request('GET' => $ARGV[0] ) ; my $response = $agent->request($request) ; if ( $response->is_success() ) { print($response->content()) ; } else { print("Error: " . $reponse->status_line() . "\n" ) ; die ; }

  32. Server receives a request for a CGI program Server creates a new process to run the CGI program Server passes information to the program: via environment variables and standard input. CGI Life Cycle

  33. CGI – Based Web Server Main Process Request for CGI1 Child process for CGI1 Child process for CGI2 Request for CGI2 Request for CGI1 Child process for CGI1

  34. Expensive to create a process for each request: requires time and significant server resources, limits the # of requests a server can handle concurrently Stateless: No history remembered A big problem for web-based development Solutions: cookies Still expensive Problems with CGI

  35. Once the CGI program starts: It cannot interact with the web server It takes advantage of the server's abilities once it begins execution Reasons: the program is running in a separate process. Example, a CGI script cannot write to the server's log file. Problems with CGI

  36. FastCGI mod_perl Other solutions Ways to Improve CGI Performance

  37. Developed by a company “Open Market” FastCGI creates a single persistent process for each FastCGI program It eliminates the need to create a new process for each request. See: http://www.fastcgi.com/ FastCGI

  38. No need to start multiple processes for different requests for the same fastcgi program Still needs one process for each cgi program. It does nothing to help the FastCGI program to interact more closely with the server. Not implemented by some of the more popular servers, i.e., Microsoft's Internet Information Server. Not very portable FastCGI

  39. FastCGI – Based Web Server Main Process Request for CGI1 Single Child process for CGI1 Request for CGI2 Single Child process for CGI2 Request for CGI1

  40. Used in the Apache web server mod_perl is a module that embeds a copy of the Perl interpreter into the Apache httpd executable Providing complete access to Perl functionality within Apache CGI scripts are precompiled by the server and executed without forking, Thus running much more quickly and efficiently. http://perl.apache.org/ Mod_perl

  41. Proprietary server extension APIsfor example: Netscape provides an internal API called NSAPI Microsoft provides ISAPI Exist within the main process of a web server Server Extension APIs

  42. Using one of these APIs, one can write server extensions that enhance or change the base functionality of the server Allowing the server to handle tasks that were once assigned to external CGI programs. Use linked C or C++ code Thus can run extremely fast; and make full use of the server's resources. Server Extension APIs Advantages

  43. Web Server with Server Extension API Main Process Request for ServerExtension1 ServerExtension1 Request for ServerExtension2 ServerExtension2 Request for ServerExtension1

  44. Difficult to develop and maintain Pose significant security and reliability hazards a crashed server extension can bring down the entire server. Proprietary server extensions are tied to the server API on a particular OS Not very portable Server Extension APIsDisadvantages

  45. JAVA • Introduced by SUN Microsystems • Object oriented programming language • Java compiler creates bytecodes that are interpreted by java bytecode interpreter • Portable bytecode • Java can be used to create dynamic content on web pages • Java applets: are programs that can be embedded in HTML documents. Browser (i.e. client) executes the applets.

  46. JAVA Servlets • A servlet is a server-side version of an applet • Servlets are executed on the server under the control of web server • Servlets are called from HTML just as with applets • Servlet receive a request and returns a response to the client in the form of an HTML source • Often used as alternative to CGI programs • Some advantages: • CGI programs start, execute and stop providing no way to save information whereas servlet continue to run (hence capable of saving information) • Large set of APIs • Can be faster than CGI

  47. Java Servlet Based Web Server Main Process Request for Servlet1 thread Servlet1 thread Request for Servlet2 JVM Servlet2 thread Request for Servlet1

  48. AJAX Technologies(Asynchronous Javascript and XML) • Ajax programming uses combination of : • XHTML/HTML and CSS for formatting. • DOM accessed with a client-side scripting language such as JavaScript to dynamically display and interact with the information presented. • XMLHttpRequest object is used to exchange data asynchronously with the web server without leaving the current page • XML is used for transferring data between the server and client, (any other format can also be used). • Example: Gmail uses ajax technologies

  49. JQUERY • jQuery is a library of JavaScript Functions. • jQuery greatly simplifies JavaScript programming • jQuery is easy to learn • jQuery is a lightweight "write less, do more" JavaScript library • http://jquery.com/

  50. JQUERY • The jQuery library contains the following features: • HTML element selections • HTML element manipulation • CSS manipulation • HTML event functions • JavaScript Effects and animations • HTML DOM traversal and modification • AJAX • Utilities

More Related