Quick paypal payment form
This is quick paypal payment form.
<form name="paypalform" action="url ; ?>" method = "post" >
<input type="hidden" name="business" value="email ; ?>" />
<input type="hidden" name="return" value="site-/en/" />
<input type="hidden" name="cancel_return" value="cancel_url ; ?>" />
<input name="amount" type="hidden" value="amount ; ?>"/>
<input name="item_name" type="hidden" value="name ; ?>" />
<input name="item_number" type="hidden" value="rowid ; ?>" />
<input name="notify_url" type="hidden" value="notify_url ; ?>" />
Finding a valid file file extention with joomla
This function actually finds where a file extension is a valid extension or not.
/** input parameter
/* $name : is the name of the file you want to check i,e : inpour.php
/* $valid : is an array of valid extentions like: array(‘png’ , ‘bmp’ , ‘jpeg’ );
/* returns true if is valid extention or false otherwise.
/* This function is helpful when you are uploading a image file and want to be safe from your
/* side
function validExtention( $name , $valid ){
jimport(‘joomla.filesystem.file’);
$ext = JFile::getExt( $name );
$this->ext = $ext;
return in_array($ext , $valid ) ;
}
Tips about joomla
Well I found this thing today, so why not share it with others.
- In joomla 1.5 there is a file called default.php in every component/{any view}/tmp/default.php
- This file actually used to show the html content for the component.
- Now if I want to make another file to show something other than default.php, the way is
- First name name like default_something.php
- Then call the function parent::display(‘something’); from view.html.php file.
- And you are done.
- Isn’t it simple!
Tips about making custom menu module
I speant 3 hours today to make a custom menu module and at last i succeded. On one point i was get stucked is that, i was not being able to find the active menu. After a long time testing and testing i got that Jmenu class actually sets the active menu. And we have to pass the menu id in the variable ‘Itemid’. After passing the menu id then my modules get the active menu and everything worked fine.
Nachos user process
Well today now i will describe you how a nachos usre process runs.
- We can run a user process in userprog folder by executing this command ./nachos -x ../test/halt
- When nachos is run in -x then in main.cc a StartProcess(char *name) function is called with the filename as parameter.StartProcess(char* name) is located in progtest.cc .
- In the StartProcess(char *name) function, the file is opened and a addressSpace is created for that process.
- Then the new procesinfo class is created and the current thread’s process id , and status is stored.
- Then register’s are initialized and states are restored.Then machine->run() function is called.
- This machine->run() function creates simulated MIPS architecture.
- In the run function OneInstruction(Instruction* instruction) is called with a Instruction pointer for each instruction to execute.
- In this function the instruction is loaded from memory by read register function with the register number PCReg. PCReg is a global variable which is located in machine.h which stores the current instructions memory address.
- If system call is found then raiseException() in called with the exception type as parameter.RaiseException is located in machine.cc
- ExceptionHandler() is then called with the exception type.
- In the ExcepTtionHandler() function the exceptions code value is retrieved from the register number 2.
- Then for the appropriate exception the corresponding funciton is executed.
And this is the workflow of a runnig a user process. Hope this will help you a lot!!!!!!
Again nachos
- Nachos has 40 registers 16k memory
- OneInstruction() actually does the main work of executing a instruction. It fetches the instruction from memory decodes it and finally executes it .
- Each user process will have its own page table.
- And switching a user process needs to switch the page table also.
Nachos second part
Important thing to remember
- In Machine class there are some important functions such as
- readRegister( int number ) -> this function actually reads the data in the specified number register.
- writeRegister(int value , int number ) -> this function actually writes the value to the register.
- readMem(), writeMem() are also same as the previous one .
- Important thing to remember is that in nachos memory is maintained as an array of bytes .
thats all for today hope it will help somebody to learn nachos.
Important nachos tips
Well today i am very busy with nachos multiprogramming, so why not make it easy for the next comers!!! So i am giving some tips!!! about nachos. May be nobody will find it important (hah ha !!!)
1. nachos starts up by threads/main.cc in main() function.
2.Only halt syscall is implemented.
3.Have to implement multiprogramming.
4.Have to implement console.
Important:
1.in excexpion.cc all the syscalls are there.
2. have to look addressspace.cc , machine::pagetable
3.If -x is given then main function calls the StartProcess to execute that file.
4.new_console->put_char() this function writes output to the console.
5.new_console->get_char() this function reads input from console.
Required reading:
1.translate.h/.cc
2.addrspace.h/.cc
3.progtest.cc