Thursday, July 29, 2010

Wordpress 3.0

Wordpress 3.0 looks amazing. i used it and enjoyed very much. It comes with social networking support features.

Wednesday, July 28, 2010

Windows7 skype voice problem

I am using windows 7 but there a problem with my skype running on windows7. I didn't get voice and send my voice on skype voice chat. If anybody have solutions please reply to me. Thanks in advance.

Monday, July 12, 2010

How i can open a tab from a grid every tab calling dynamic function

How i can open a tab from a grid every tab call dynamic function for items of tab [solved].


Ext.QuickTips.init();
Ext.override(Desktop.ReportsWindow, {
createProxy: {},
createWindow: function () {

var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var app = this.app;
var url = this.app.connection;
var moduleId = this.moduleId;

var myData = [
['Diagnosis registry', 'Search patients that have a particular diagnosis or ICD9 code.', 'diagnosis'],
['Medication report', 'Search patients that have been prescribed a particular medicine.', 'medication']
];

var store = new Ext.data.ArrayStore({
fields: [{
name: 'title'
},
{
name: 'description'
},
{
name: 'report_for'
}]
});

store.loadData(myData);



if (!win) {

var winWidth = desktop.getWinWidth() / 1.1;
var winHeight = desktop.getWinHeight() / 1.2;
win = desktop.createWindow({
id: moduleId,
title: 'Reports',
width: winWidth,
height: winHeight,
maximized: true,
iconCls: 'reports-icon-cls',
layout: 'fit',
items: [{
xtype: 'tabpanel',
activeItem: 0,
id: 'reportsTabPanel',
items: [{
title: 'Reports',
items: [{
xtype: 'grid',
id: 'allReportsGrid',
columnLines: true,
autoHeight: true,
stripeRows: true,
tbar: {
xtype: 'toolbar',
items: ['->',
{
text: 'Run Report',
disabled: true,
id: 'runReportBtn',
handler: this.addNewtab,
scope: this,
}, ' ']
},
viewConfig: {
forceFit: true,
},
selModel: new Ext.grid.RowSelectionModel({
listeners: {
rowselect: function (sel, row, rec) {
Ext.getCmp('runReportBtn').enable();
},
rowdeselect: function (sel, row, rec) {
Ext.getCmp('runReportBtn').disable();
}
}
}),
store: store,

columns: [{
header: 'Title',
dataIndex: 'title',
width: 100
},
{
header: 'Description',
dataIndex: 'description',
width: 200
}, ],
listeners: {
rowdblclick: this.addNewtab,
scope: this
},
}]
}]
}]
})
}
win.show();
},

addNewtab: function () {

var url = this.app.connection;
var moduleId = this.moduleId;

var tabpanel = Ext.getCmp('reportsTabPanel');
var rec = Ext.getCmp('allReportsGrid').getSelectionModel().getSelected();
var title = rec.get('title').replace(/^\s+/, '').replace(/\s+$/, '');
var tabId = title.toLowerCase();
var tabId = tabId.replace(/ /g, '_');


// varaible getting the value which function to call
var reportTab = rec.get('report_for');

if (Ext.getCmp(tabId)) {
tabpanel.setActiveTab(tabId);
return;
}

var tabs = Ext.getCmp('reportsTabPanel').add({
title: title,
id: tabId,
layout: 'fit',
closable: true,

items: this[reportTab](),
//reportTab, //calling the function according to selected record
scope: this,

});
tabpanel.setActiveTab(tabs);
},


diagnosis: function () {
var url = this.app.connection;
var moduleId = this.moduleId;
var report_item = [{
xtype: 'panel',
layout: 'border',
items: [{
xtype: 'form',
region: 'north',
autoHeight: true,
frame: true,
bodyStyle: 'padding : 10px;',
items: [{
xtype: 'fieldset',
border: false,
width: 280,
style: 'padding:0px;margin:0px; float : left',
labelWidth: 55,
items: [{
xtype: 'combo',
style: 'float:left',
fieldLabel: 'Providers',
}]
},
{
xtype: 'button',
text: 'Advance Search',
style: 'float : left',
handler: function () {
//Ext.getCmp('check').show();
}
}]
},
{
xtype: 'grid',
region: 'center',
id: 'center_grid',
viewConfig: {
forceFit: true,
},
store: new Ext.data.Store({}),
columns: [{
header: 'Patient Name',
dataIndex: ''
},
{
header: 'IDC9 Code',
dataIndex: ''
},
{
header: 'Diagnosis',
dataIndex: ''
},
{
header: 'Dx Date',
dataIndex: ''
},
{
header: 'Last Seen',
dataIndex: ''
},
{
header: 'Provider',
dataIndex: ''
}, ]
}]
}];

return report_item;

},
medication: function () {
var url = this.app.connection;
var moduleId = this.moduleId;
var medication_tab = [{
xtype: 'panel',
layout: 'border',
items: [{
xtype: 'form',
region: 'north',
autoHeight: true,
frame: true,
bodyStyle: 'padding : 10px;',
items: [{
xtype: 'fieldset',
border: false,
width: 280,
style: 'padding:0px;margin:0px; float : left',
labelWidth: 55,
items: [{
xtype: 'combo',
style: 'float:left',
fieldLabel: 'Providers',
}]
},
{
xtype: 'button',
text: 'Advance Search',
style: 'float : left',
handler: function () {

}
}]
},
{
xtype: 'grid',
region: 'center',
id: 'center_grid',
viewConfig: {
forceFit: true,
},
store: new Ext.data.Store({}),
columns: [{
header: 'Patient Name',
dataIndex: ''
},
{
header: 'Medication',
dataIndex: ''
},
{
header: 'Strength',
dataIndex: ''
},
{
header: 'Rx Start Date',
dataIndex: ''
},
{
header: 'Rx Stop Date',
dataIndex: ''
},
{
header: 'Last Seen',
dataIndex: ''
},
{
header: 'Provider',
dataIndex: ''
}, ]
}]
}];

return medication_tab;
}
})


This code calling dynamic functions for the items of tab.
items: this[reportTab]()


Thanks!
I Hope it will help
Admin

Wednesday, July 7, 2010

http://www.knowledgepedia.org

Hi Friends,
I have launched a forum website for web masters for sharing and getting their knowledge. There are many topics like extjs, cakephp, php, joomla etc. for discussion.
You can check it here: http://www.knowledgepedia.org

Thanks!
N

Friday, June 4, 2010

Validate space in Java Script


function trim() {
ogg =document.getElementById('testid').value;
ogg1 = /\S+/.test(ogg);
//return /\S+/.test(ogg);

if(ogg1==" "){alert('blank');}
else{alert(ogg1);}
}
end script

input type="text" onblur="trim();" id="testid"

Tuesday, May 18, 2010

EXTJS Hide Tab Panels

This is for hide the tab
Ext.getCmp(tabpanel_id).hideTabStripItem(tabitem_id);

This is for show the tab again
Ext.getCmp(tabpanel_id).unhideTabStripItem(tabitem_id);

Thanks!

Thursday, May 13, 2010

Prime Number Program

function IsPrime($number)
{
if ($number < 2) { /* We don't want zero or one showing up as prime */
return FALSE;
}
for ($i=2; $i<=($number / 2); $i++) {
if($number % $i == 0) { /* Modulus operator, very useful */
return FALSE;
}
}
return TRUE;
}

for($i = 0; $i < 100; $i++)
{
echo $i." is a prime number? ".IsPrime($i)."
";
}

Mysql

1 Stored Procedure
2 Cursor
3 Trigger
4 What is indexing
5 Difference between MyIsam and InnoDB.
6 Delete Duplicate entries and keep only one from the table

Friday, May 7, 2010

How to increase your session time out PHP


/*********************** Increase the session time out *****************/
$values = $_SESSION;

// keep session config
$trans = ini_get( 'session.use_trans_sid' );
if( $trans ) {
ini_set( 'session.use_trans_sid', 0 );
}
$cookie = session_get_cookie_params();

// create new session id
$id = 0;
while (strlen($id) < 32) {
$id .= mt_rand(0, mt_getrandmax());
}

$id = md5( uniqid($id, true));

// kill session
session_destroy();

$cookie['lifetime'] = 7*60; // minutes * 60

// restore config
ini_set( 'session.use_trans_sid', $trans );
session_set_cookie_params( $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'] );

session_cache_expire($cookie['lifetime'] / 60);
ini_set('session.gc_maxlifetime', $cookie['lifetime']);
// restart session with new id
session_id( $id );
session_start();
$_SESSION = $values;

/*********************************** End *******************************/
?>

Monday, April 19, 2010

Joomla solutions extension for dreamweaver

http://www.joomlaspots.com/Addons/joomla-dreamweaver-extension.php

Monday, April 12, 2010

How to use DATE_FORMAT() in mysql

$query = "SELECT DATE_FORMAT(DATETIME,'%m/%d/%Y') as NewDate,id FROM TableName ORDER BY DATETIME DESC";

result:
month(numeric)/day(numeric)/year(numeric)..

cheers :)

How to decode json response in ExtJs

//when json response is in this format {"success":true,"data":{"id":11}}
Ext.Ajax.request({
url:'connect.php',
params:{moduleId:moduleId, status:'insert',activity:'save',action:'doAction'},
success:function(res){
var response = Ext.util.JSON.decode(res.responseText);
alert(response.data.id);
}
});

Thursday, April 8, 2010

paging in PHP


$count_rec=400; //give here the total number of records
if($count_rec>0) {
$total_pages=ceil($count_rec/20);
$page=$_REQUEST['page'];
$start=($page-1)*20+1;
$end=$start+19;
$x=$start;

//foreach ($photosetList[photoset] as $setList) {
//$sizes = $f->photos_getSizes($setList[primary]);

if($end%$x<=19) {
echo "";
}
//}
}
echo "
";

if($end>$count_rec)
{
$end=$count_rec;
}

if($page==1)
{
echo "<<";
}else
{
$back=$page-1;
?>

<a class="anchorlink" href="pagingPhp.php?page="><<<</a>



$val=ceil($count_rec/20);
echo "Page :- ".$_REQUEST['page'];
if($page==$val)
{
echo " >>";
}else
{
$next=$page+1;
?>
<a class="anchorlink" href="pagingPhp.php?page=">>></a>

Saturday, April 3, 2010

ExtJs dataview refresh problem

[code]Ext.getCmp(dataview id).getStore().load({params:{}});
or
Ext.getCmp(dataview id).getStore().reload();

By using this code your dataview automatically be refreshed.[/code]
[b]NOTE: The response only come in the pure json format[/b]

If you will use this in PHP for fetching the data for
dataview you must declare $json_data['templateItems'][]= $row;
in case of no result found. Otherwise your data view not working correctly.
[code]
$result= mysql_query($query);
$json_data['templateItems'] = array();
while($row= mysql_fetch_assoc($result)){
$json_data['templateItems'][]= $row;
}
echo json_encode($json_data);exit;[/code]

[b]Data view code[/b]
[code]new Ext.DataView({
store: new Ext.data.JsonStore({
url: 'connect.php',
baseParams: {moduleId:moduleId,action:'doAction',activity:'getTemplateCats'},
autoLoad:false,
root: 'templatecats',
fields: ['templatecat_name','id']
}),
tpl: new Ext.XTemplate(
'',
'
{templatecat_name}
',
'
'
),
listeners : {
click : function(dataView,index,node,e) {
var record = dataView.getRecord(node);
var cat_name =record.get("templatecat_name");
var cat_id =record.get('id');

Ext.getCmp('cat_id_temp_s').setValue(cat_id);
Ext.getCmp('newCardS').getLayout().setActiveItem(1);
Ext.getCmp('s-templates-items').getStore().load(
{params:{moduleId:moduleId,action:'doAction',
cat_id:cat_id,templatelocation:'subjective',activity:'getTemplates'}});
}
},
id:'s-templates',
autoHeight:true,
multiSelect: true,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No templates to display'
})[/code]

Saturday, March 27, 2010

New Interview Questions

1. how to get the ip address.
2. diff. b/w echo,print, print_r.
3. ftp php (how we connect to ftp)(ans: ftp_connect() "Opens an FTP connection")
4. paypal
5. php oops
6. pconnect, connect
7. Explain join queries
8. Example of Join Query(join,left,right)
9. step of joomla template
10. function overriding and overloading.
11. array merge ans: $ab=array_merge(array('a','b'),array('c','d'));
12. find max salary and min salary using join.


mysql_pconnect() acts very much like mysql_connect() with two major differences.

First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).

This type of link is therefore called 'persistent'.

Uploading files

CREATE TABLE my_files (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(75) NOT NULL,
type VARCHAR(255) NOT NULL,
size INT(11) NOT NULL,
data MEDIUMBLOB NOT NULL,
created DATETIME,
modified DATETIME,
PRIMARY KEY (id)
);


// app/models/my_file.php
class MyFile extends AppModel {
var $name = 'MyFile';
}


// app/views/my_files/add.ctp (Cake 1.2)
echo $form->create('MyFile', array('action' => 'add', 'type' => 'file'));
echo $form->file('File');
echo $form->submit('Upload');
echo $form->end();
?>

// app/views/my_files/add.thtml (Cake 1.1)

file('File'); ?>
submit('Upload'); ?>



// app/controllers/my_files_controller.php (Cake 1.2)
class MyFilesController extends AppController {
function add() {
if (!empty($this->data) &&
is_uploaded_file($this->data['MyFile']['File']['tmp_name'])) {
$fileData = fread(fopen($this->data['MyFile']['File']['tmp_name'], "r"),
$this->data['MyFile']['File']['size']);

$this->data['MyFile']['name'] = $this->data['MyFile']['File']['name'];
$this->data['MyFile']['type'] = $this->data['MyFile']['File']['type'];
$this->data['MyFile']['size'] = $this->data['MyFile']['File']['size'];
$this->data['MyFile']['data'] = $fileData;

$this->MyFile->save($this->data);

$this->redirect('somecontroller/someaction');
}
}
}

// app/controllers/my_files_controller.php (Cake 1.1)
class MyFilesController extends AppController {
function add() {
if (!empty($this->params['form']) &&
is_uploaded_file($this->params['form']['File']['tmp_name'])) {
$fileData = fread(fopen($this->params['form']['File']['tmp_name'], "r"),
$this->params['form']['File']['size']);
$this->params['form']['File']['data'] = $fileData;

$this->MyFile->save($this->params['form']['File']);

$this->redirect('somecontroller/someaction');
}
}
}



and for download that file:

function download($id) {
Configure::write('debug', 0);
$file = $this->MyFile->findById($id);

header('Content-type: ' . $file['MyFile']['type']);
header('Content-length: ' . $file['MyFile']['size']);
header('Content-Disposition: attachment; filename="'.$file['MyFile']['name'].'"');
echo $file['MyFile']['data'];

exit();
}

how to redirect automatically Using meta tag

"start head tag here"
less than META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.example.org/articles.htm">
"end head tag here"


parvinder kumar is online.
parvinder:

BODY onLoad="redirect()">

How to bake a cake application

E:\cake_test\app>..\cake\console\cake bake