This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Blog(models.Model): | |
| name = models.CharField(max_length=100) | |
| tagline = models.TextField() | |
| def __unicode__(self): | |
| return self.name | |
| class Author(models.Model): | |
| name = models.CharField(max_length=50) | |
| email = models.EmailField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| urlpatterns = patterns('', | |
| (r'^$',main_page), | |
| (r'^user/(\w+)/$',user_page), | |
| (r'^login/$','django.contrib.auth.views.login'), | |
| (r'^logout/$',logout_page), | |
| (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', | |
| { 'document_root': site_media }), | |
| (r'^register/$',register_page), | |
| (r'^register/success/$',direct_to_template,{'template':'registration/register_success.html'}), | |
| # Examples: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sys = require ('sys'), | |
| url = require('url'), | |
| http = require('http'), | |
| qs = require('querystring'); | |
| http.createServer(function (req, res) { | |
| keyword=/\/keyword\/([A-Za-z0-9]+)$/ | |
| data=/\/keyword\/([A-Za-z0-9]+)\/data\/([A-Za-z0-9]+)$/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //mysql init | |
| mysql_connect('localhost', 'root', 'password'); | |
| mysql_select_db('mydb'); | |
| //Init for UTF8 | |
| mysql_query("SET NAMES utf8"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $php wayne.php | |
| <a href='javascript:;' onclick='Player.URL="video/5-AVSEQ01.dat";Player.controls.play()'><img src='style/image/play.jpg' id='play_button'></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sum(num1,num2) { | |
| return num1+num2; | |
| } | |
| result=sum(5,3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sum(num1,num2,callback) { | |
| callback(num1+num2); | |
| } | |
| sum(5,4,function(result) { | |
| output=result; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function division(num1,num2,callback) { | |
| if(num2 <=0 ) { | |
| callback("num2 shouldn't be less than or equal zero"); | |
| } | |
| callback (null,num1/num2); | |
| } | |
| division(5,4,function(err,result) { | |
| if(err==null) { | |
| console.log(result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.division=function(num1,num2,callback) { | |
| if(num2 <=0 ) { | |
| callback("num2 shouldn't be less than or equal zero"); | |
| } | |
| callback (null,num1/num2); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function callback_test(callback) { | |
| for(var i=0;i<=10;i++){ | |
| callback(i); | |
| } | |
| } | |
| callback_test(function(result) { | |
| console.log(result); | |
| callback_test(function(result2){ | |
| console.log(result2); |