meoconmotmat
Youtube Master Race
- 28/4/07
- 2
- 0
ý bạn là sao , là tụi mình viết cái mà bạn gọi là bí đó vào cho bạn đó hả
?
?Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
?ý bạn là sao , là tụi mình viết cái mà bạn gọi là bí đó vào cho bạn đó hả?
Không biết mình post vô đây có đúng hem.
Nhưng mình cần các bạn giúp đỡ tài liệu về lập trình ngôn ngữ ASC.
Cái nào dễ hiểu 1 chút chứ trong nhiều sách loạn cả lên =.=!.
Cái nữa là mình đang học về Hệq uản trị cơ sở dữ liệu,cái môn nì mình dốt đặc nhưng bốc phải bài tập:Tạo cơ sở dữ liệu quản lí việc dăng kí sử dụng phòng thực hành.
mình không biết phải làm thế nào nữa.
Có bạn nòa chỉ giáo cho mình cái T_T.
Cám ơn các bạn .
Không biết mình post vô đây có đúng hem.
Nhưng mình cần các bạn giúp đỡ tài liệu về lập trình ngôn ngữ ASC.
Cái nào dễ hiểu 1 chút chứ trong nhiều sách loạn cả lên =.=!.
Cái nữa là mình đang học về Hệq uản trị cơ sở dữ liệu,cái môn nì mình dốt đặc nhưng bốc phải bài tập:Tạo cơ sở dữ liệu quản lí việc dăng kí sử dụng phòng thực hành.
mình không biết phải làm thế nào nữa.
Có bạn nòa chỉ giáo cho mình cái T_T.
Cám ơn các bạn .
ProxyCache/**
* ProxyCache.java - Simple caching proxy
*
* $Id: ProxyCache.java,v 1.3 2004/02/16 15:22:00 kangasha Exp $
*
*/
import java.net.*;
import java.io.*;
import java.util.*;
public class ProxyCache {
/** Port for the proxy */
private static int port;
/** Socket for client connections */
private static ServerSocket socket;
/** Create the ProxyCache object and the socket */
public static void init(int p) {
port = p;
try {
socket = new ServerSocket(port);
} catch (IOException e) {
System.out.println("Error creating socket: " + e);
System.exit(-1);
}
}
public static void handle(Socket client) {
Socket server = null;
HttpRequest request = null;
HttpResponse response = null;
/* Process request. If there are any exceptions, then simply
* return and end this thread. This unfortunately means the
* client will hang for a while, until it timeouts. */
/* Read request */
try {
BufferedReader fromClient =
new BufferedReader(new InputStreamReader(client.getInputStream()));
System.out.println("Reading request...");
request = new HttpRequest(fromClient);
System.out.println("Got request...");
} catch (IOException e) {
System.out.println("Error reading request from client: " + e);
return;
}
/* Send request to server */
try {
/* Open socket and write request to socket */
server = new Socket(request.getHost(), request.getPort());
DataOutputStream toServer =
new DataOutputStream(server.getOutputStream());
toServer.writeBytes(request.toString());
} catch (UnknownHostException e) {
System.out.println("Unknown host: " + request.getHost());
System.out.println(e);
return;
} catch (IOException e) {
System.out.println("Error writing request to server: " + e);
return;
}
/* Read response and forward it to client */
try {
DataInputStream fromServer =
new DataInputStream(server.getInputStream());
response = new HttpResponse(fromServer);
DataOutputStream toClient =
new DataOutputStream(client.getOutputStream());
toClient.writeBytes(response.toString());
toClient.write(response.body);
/* Write response to client. First headers, then body */
client.close();
server.close();
/* Insert object into the cache */
Đang Bí Chỗ này , các bạn chỉ giùm nha
} catch (IOException e) {
System.out.println("Error writing response to client: " + e);
}
}
/** Read command line arguments and start proxy */
public static void main(String args[]) {
int myPort = 0;
try {
myPort = Integer.parseInt(args[0]);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Need port number as argument");
System.exit(-1);
} catch (NumberFormatException e) {
System.out.println("Please give port number as integer.");
System.exit(-1);
}
init(myPort);
/** Main loop. Listen for incoming connections and spawn a new
* thread for handling them */
Socket client = null;
while (true) {
try {
client = socket.accept();
System.out.println("Got connection " + client);
handle(client);
} catch (IOException e) {
System.out.println("Error reading request from client: " + e);
/* Definitely cannot continue, so skip to next
* iteration of while loop. */
continue;
}
}
}
}
HttpRequest
import java.io.*;
import java.net.*;
import java.util.*;
public class HttpRequest {
/** Help variables */
final static String CRLF = "\r\n";
final static int HTTP_PORT = 80;
/** Store the request parameters */
String method;
String URI;
String version;
String headers = "";
/** Server and port */
private String host;
private int port;
/** Create HttpRequest by reading it from the client socket */
public HttpRequest(BufferedReader from) {
String firstLine = "";
try {
firstLine = from.readLine();
} catch (IOException e) {
System.out.println("Error reading request line: " + e);
}
String[] tmp = firstLine.split(" ");
method = tmp[0];
URI = tmp[1];
version = tmp[2];
System.out.println("URI is: " + URI);
if (hod.equals("GET")) {
System.out.println("Error: Method not GET");
}
try {
String line = from.readLine();
while (line.length() != 0) {
headers += line + CRLF;
/* We need to find host header to know which server to
* contact in case the request URI is not complete. */
if (line.startsWith("Host:")) {
tmp = line.split(" ");
if (tmp[1].indexOf(':') > 0) {
String[] tmp2 = tmp[1].split(":");
host = tmp2[0];
port = Integer.parseInt(tmp2[1]);
} else {
host = tmp[1];
port = HTTP_PORT;
}
}
line = from.readLine();
}
} catch (IOException e) {
System.out.println("Error reading from socket: " + e);
return;
}
System.out.println("Host to contact is: " + host + " at port " + port);
}
/** Return host for which this request is intended */
public String getHost() {
return host;
}
/** Return port for server */
public int getPort() {
return port;
}
/**
* Convert request into a string for easy re-sending.
*/
public String toString() {
String req = "";
req = method + " " + URI + " " + version + CRLF;
req += headers;
/* This proxy does not support persistent connections */
req += "Connection: close" + CRLF;
req += CRLF;
return req;
}
}
HttpResponse
/**
* HttpResponse - Handle HTTP replies
*
* $Id: HttpResponse.java,v 1.3 2004/02/16 15:21:46 kangasha Exp $
*
*/
import java.io.*;
import java.net.*;
import java.util.*;
public class HttpResponse {
final static String CRLF = "\r\n";
/** How big is the buffer used for reading the object */
final static int BUF_SIZE = 8192;
/** Maximum size of objects that this proxy can handle. For the
* moment set to 100 KB */
final static int MAX_OBJECT_SIZE = 100000;
/** Reply status and headers */
String version;
int status;
String statusLine = "";
String headers = "";
/* Body of reply */
byte[] body = new byte[MAX_OBJECT_SIZE];
/** Read response from server. */
public HttpResponse(DataInputStream fromServer) {
//public HttpResponse(InputStream is) {
/* Length of the object */
int length = -1;
boolean gotStatusLine = false;
// Test code
//BufferedReader fromServer =
// new BufferedReader(new InputStreamReader(is));
/* First read status line and response headers */
try {
String line = fromServer.readLine();
while (line.length() != 0) {
if (!gotStatusLine) {
statusLine = line;
gotStatusLine = true;
} else {
headers += line + CRLF;
}
/* Note length of content as indicated by
* Content-Length header. Unfortunately this is not
* present in every response. */
if (line.startsWith("Content-Length:") ||
line.startsWith("Content-length:")) {
String[] tmp = line.split(" ");
length = Integer.parseInt(tmp[1]);
}
line = fromServer.readLine();
}
} catch (IOException e) {
System.out.println("Error reading headers from server: " + e);
return;
}
try {
int bytesRead = 0;
byte buf[] = new byte[BUF_SIZE];
boolean loop = false;
/* If we didn't get Content-Length header, just loop until
* the connection is closed. */
if (length == -1) {
loop = true;
}
/* Read the body in chunks of BUF_SIZE and copy the chunk
* into body. Usually replies come back in smaller chunks
* than BUF_SIZE. The while-loop ends when either we have
* read Content-Length bytes or when the connection is
* closed (when there is no Connection-Length in the
* response. */
while (bytesRead < length || loop) {
/* Read it in as binary data */
int res = fromServer.read(buf, 0, BUF_SIZE);
//int res = is.read(buf, 0, BUF_SIZE);
if (res == -1) {
break;
}
/* Copy the bytes into body. Make sure we don't exceed
* the maximum object size. */
for (int i = 0;
i < res && (i + bytesRead) < MAX_OBJECT_SIZE;
i++) {
body[bytesRead + i] = buf;
}
bytesRead += res;
}
} catch (IOException e) {
System.out.println("Error reading response body: " + e);
return;
}
}
/**
* Convert response into a string for easy re-sending. Only
* converts the response headers, body is not converted to a
* string.
*/
public String toString() {
String res = "";
res = statusLine + CRLF;
res += headers;
res += CRLF;
return res;
}
}
Cái chỗ mình bí nó yêu cầu như thế này nè :
1. When the proxy gets a request, it checks if the requested object is cached, and if yes, then returns the object from the cache, without contacting the server.
2. If the object is not cached, the proxy retrieves the object from the server,
returns it to the client, and caches a copy for future requests.
híc,thế thì cơ bản quá bạn ah.T_TTạo 3 cái table:
1 cái chứa id và tên phòng thực hành
1 cái chứa id và tên giáo viên
1 cái chứa id phòng thực hành, id giáo viên và giờ đăng ký phòng.
Nhớ kiểm tra sao cho không có trường hợp nào cùng id phòng mà trùng giờ nhau ::).
Cơ bản là vậy, từ đó bạn xào nấu thêm thôi.
Anh post nguyên cái chương trình như vậy chỉ đọc hiểu là cả 1 vấn đề rồiKhông ai giúp mình với :(, làm ơn chỉ mình 1 tì đi
, ai mà viết tiếp được, ít nhất cũng phải có chú thích gì chứ, muốn giúp nhưng lực bất tòng tâmAnh định viết trên ngôn ngữ nào???Không biết mình post vô đây có đúng hem.
Nhưng mình cần các bạn giúp đỡ tài liệu về lập trình ngôn ngữ ASC.
Cái nào dễ hiểu 1 chút chứ trong nhiều sách loạn cả lên =.=!.
Cái nữa là mình đang học về Hệq uản trị cơ sở dữ liệu,cái môn nì mình dốt đặc nhưng bốc phải bài tập:Tạo cơ sở dữ liệu quản lí việc dăng kí sử dụng phòng thực hành.
mình không biết phải làm thế nào nữa.
Có bạn nòa chỉ giáo cho mình cái T_T.
Cám ơn các bạn .
vào đấy xem định nghĩaMình đang học C,ông thầy cho bài tập lớn về ceasar cipher,nhưng mình chưa rõ về thuật toán của nó,ai chỉ mình với^^

Chính xác là ADO .@KENSAMA
Mình nghĩ về ý tưởng thì không khó, cứ bắt tay vào làm thì từ từ cũng biết thôi
Còn về công cụ thì tại sao bạn không thử sử dụng đối tượng ADO xem sao, thằng này rất dể sử dụng. Các đối tượng ADO thường dùng là Connection, Recordset, Command...
chúc may mắn
(nói nhỏ mình cũng rất ngán cái môn database này:whew:)
Chính xác là ADO .
Ông thầy mới dạy dùng ADO để kết nối với database.~.~
Ý tưởng thì mình đang bí rợ.Bởi vì có 3 nhóm làm cùng đề tài ,mỗi nhóm sẽ làm 1 phần sau đó kết nối vói nhau qua modul.
Có ai biết gì về cái modul này hem ::(
mới học ko có bài tập mẫu chả hiểu motê gì hếtcài đặt lớp ngày tháng với các yêu cầu sau:
-Cài đặt các hàm constructor
-Cài đặt các hàm operator +,-,= ,>, <, ==
-Cho mot ngày a(dd/mm/yy) bất kỳ, cho biêt thứ tự của ngày này trong năm.
-Cho mot ngày a(dd/mm/yy) bất kỳ, hỏi ngày này có thuoc năm nhuận không?
-Cho 2 ngày bất kỳ, cho biêt khỏang cách giữa 2 ngày đó.
em làm được rồi đây là cái code In ra ngày tháng năm của 1 ngày mình chọn#include<iostream.h>
int max(int a, int b)
{
if(a>b)
return(a);
return(b);
}
int min(int a, int b)
{
if(a<b)
return(a);
return(b);
}
class LNgay
{
private :
int mNgay , mThang , mNam;
public :
void KhoiDong(int,int,int);
void In();
};
void LNgay::KhoiDong(int n , int t , int m)
{
static int SoNgay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
mNam = max(1,m);
mThang = min(12,t);
mThang = max(mThang,1);
mNgay = min(SoNgay[mThang],n);
mNgay = max(mNgay,1);
}
void LNgay::In()
{
static char *TenThang[]={" ","Mot","Hai","Ba","Bon","Nam","Sau","Bay","Tam","Chin","Muoi","MuoiMot","MuoiHai"};
cout << "Ngay" << mNgay << "Thang" << TenThang[mThang] << "Nam" << mNam;
}
void main()
{
LNgay sn;
sn.KhoiDong(24,9,1988);
sn.In();
LNgay Valentine;
Valentine.KhoiDong(14,2,2000);
cout << "\n";
Valentine.In();
}
ai giúp em làm bài này được ko
ngôn ngữ lập trình hướng đối tượng
em chưa làm 1 bài nào nên nếu có thể cho em cái code full nha :wink:
mới học ko có bài tập mẫu chả hiểu motê gì hết
có ai có ebook bài tập + bài giải lập trình hướng đối tượng chỉ em với ::(
em code thử phần nhập 1 ngày và in ra
em làm được rồi đây là cái code In ra ngày tháng năm của 1 ngày mình chọn
có cách nào để cho in ra 1 ngày mình nhập từ bàn phím ko
#include<iostream.h>
int max(int a, int b)
{
if(a>b)
return(a);
return(b);
}
int min(int a, int b)
{
if(a<b)
return(a);
return(b);
}
class LNgay
{
private :
int mNgay , mThang , mNam;
public :
void KhoiDong(int,int,int);
void In();
};
void LNgay::KhoiDong(int n , int t , int m)
{
static int SoNgay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
mNam = max(1,m);
mThang = max(mThang,1);
mNgay = min(SoNgay[mThang],n);
mNgay = max(mNgay,1);
}
void LNgay::In()
{
static char TenThang[13][10] = {" ","Mot","Hai","Ba","bon","nam","sau","ba","tam"," chin","muoi","muoi mot","muoi hai"};
cout << "ngay" << mNgay <<"\n"<< "thang" << TenThang[mThang]<<"\n" << "nam" << mNam;
}
void main()
{
LNgay sn;
sn.KhoiDong(1,1,2005);
sn.In();
int i;
cin>>i;
}
hỏi 1 lần luôn đi, mất công quá hà::)#include<iostream.h>
int max(int a, int b)
{
if(a>b)
return(a);
return(b);
}
int min(int a, int b)
{
if(a<b)
return(a);
return(b);
}
class LNgay
{
private :
int mNgay , mThang , mNam;
public :
LNgay();
void KhoiDong(int,int,int);
void In();
void nhapNgay();
};
////////////////////////////////////////////////
LNgay::LNgay()
{
mNgay = 1 ; mThang = 1 ; mNam = 2000;
}
void LNgay::nhapNgay()
{
int i;
while(1){
cout<< "nhap ngay:";
cin>>mNgay;
In();
cout<<"\n\n(thoat chon 1 tiep tuc chon 2):\n";
cin>>i;
cout<<"\n";
if(i == 1) return;
}
}
////////////////////////////////////////////////
void LNgay::KhoiDong(int n , int t , int m)
{
static int SoNgay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
mNam = max(1,m);
mThang = min(12,t);
mThang = max(mThang,1);
mNgay = min(SoNgay[mThang],n);
mNgay = max(mNgay,1);
}
void LNgay::In()
{
static char *TenThang[]={" ","Mot","Hai","Ba","Bon","Nam","Sau","Bay","Tam"," Chin","Muoi","MuoiMot","MuoiHai"};
cout << "Ngay" << mNgay << "\nThang" << TenThang[mThang] << "\nNam" << mNam;
}
void main()
{
LNgay sn;
//sn.KhoiDong(24,9,1988);
sn.nhapNgay();
}


#include<iostream.h>
int max(int a, int b)
{
if(a>b)
return(a);
return(b);
}
int min(int a, int b)
{
if(a<b)
return(a);
return(b);
}
class LNgay
{
private :
int mNgay , mThang , mNam;
public :
void KhoiDong(int,int,int);
void In();
void TuDauNam();
};
void LNgay::KhoiDong(int n , int t , int m)
{
static int SoNgay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
mNam = max(1,m);
mThang = min(12,t);
mThang = max(mThang,1);
mNgay = min(SoNgay[mThang],n);
mNgay = max(mNgay,1);
}
void LNgay::In()
{
static char *TenThang[]={" ","Mot","Hai","Ba","Bon","Nam","Sau","Bay","Tam","Chin","Muoi","MuoiMot","MuoiHai"};
cout << "Ngay" << mNgay << "Thang" << TenThang[mThang] << "Nam" << mNam;
}
void LNgay::TuDauNam()
{
int tongcong = 0 ;
static int SoNgay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
for (int i =1 ; i <mThang ;i++)
tongcong += SoNgay[i];
tongcong += mNgay;
cout <<"Ngay thu" <<tongcong <<"Nam"<<mNam;
}
void main()
{
LNgay sn , songay;
sn.KhoiDong(24,9,1988);
sn.In();
LNgay Valentine;
Valentine.KhoiDong(14,2,2000);
cout << "\n";
Valentine.In();
sn.TuDauNam();
songay.KhoiDong(15,3,1900);
cout <<"\n";
songay.TuDauNam();
}

cái này thì tính được thêm là ngày thứ mấy trong năm
chỉ có điều đang bí cái năm nhụân
à nếu mà post dài cho CODE vào cho khỏe nhá quote nhìn chóng mặt quá![]()
cám ơn bạn nhá , nhờ gợi ý của bạn mà mình làm được rồi \:d/
có ai biết mấy ebook hướng dẫn lập trình HĐT mà = tiếng việt thì chỉ mình với nha