by http://webgeektutorials.blogspot.com
Showing posts with label Tricks. Show all posts
Showing posts with label Tricks. Show all posts

Tuesday, July 10, 2012

Reload / Refresh Page in jQuery

Here is the code to refresh the page when u click on a button component. Its just like you press "F5" button to refresh page.
=======================Code begins =========================
<!doctype html>
<html lang="en-us">
<head>
<title>Reload/Refresh a Page in jQuery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"> </script>

<script type="text/javascript">
$(document).ready(function() {
$('#Refresh').click(function() {
$("p").append("<strong>Now Refreshing page..</strong>");
location.reload();
});
});
</script>

Thursday, June 28, 2012

Oracle DBA script: Monitor user activity on the DB

Code :


set linesize 80
set verify off message off echo off pause off timing off time off
set feedback off
column o format a8 heading 'O/S|User'
column u format a10 heading 'Oracle|Userid'
column s format a12 heading 'R-S|Name'
column txt format a45 heading 'Current Statement' word

Oracle DBA script: tablespace usage in %, blocks used etc

Code :
SELECT RPAD(t.name,18,' ') tablespace ,
LPAD(TO_CHAR(CEIL( (SUM(s.blocks)*COUNT(*)) / (SUM(f.blocks) *
POWER(COUNT(DISTINCT(f.file#)),2)) * 100 )),3) Pct ,
LPAD(TO_CHAR(TRUNC(SUM(f.blocks) * t.blocksize *
COUNT(DISTINCT(f.file#)) /
( COUNT(*) * 1024 * 1024 * 1024 ),2)),6) vol_G ,
LPAD(TO_CHAR(SUM(f.blocks) * t.blocksize * COUNT(DISTINCT(f.file#)) /
( COUNT(*) * 1024 * 1024 )),8) volume_M ,
TRUNC(SUM(s.blocks) * t.blocksize /
( 1024 * 1024 * COUNT(DISTINCT(f.file#))),2) taken_M ,
TRUNC( ( SUM(f.blocks) * t.blocksize * COUNT(DISTINCT(f.file#))
/ ( COUNT(*) * 1024 * 1024 ) )
- ( NVL(suM(s.blocks),0) * t.blocksize
/ ( 1024 * 1024 * COUNT(DISTINCT(f.file#)) ) ),2) remain_M
FROM sys.seg$ s, sys.ts$ t, sys.file$ f
WHERE s.ts# (+) = t.ts#
AND f.ts# = t.ts#
AND f.status$ = 2
GROUP BY t.name, t.blocksize
ORDER BY 1;

Oracle DBA script: List the UGA and PGA used by each session

column name format a25
column total format 999 heading 'Cnt'
column bytes format 9999,999,999 heading 'Total Bytes'
column avg format 99,999,999 heading 'Avg Bytes'
column min format 99,999,999 heading 'Min Bytes'
column max format 9999,999,999 heading 'Max Bytes'
ttitle 'PGA = dedicated server processes - UGA = Client machine process'


compute sum of minmem on report
compute sum of maxmem on report
break on report

select se.sid,n.name, 
max(se.value) maxmem
from v$sesstat se,
v$statname n
where n.statistic# = se.statistic#
and n.name in ('session pga memory','session pga memory max',
'session uga memory','session uga memory max')
group by n.name,se.sid
order by 3
/

Oracle DBA Script : Monitor and veryfy deadlocks

Monitor and Verify DEAD Locks: Holding and Waiting Sessions

Code: 

set lines 80 echo on ver off timing on term on pages 60 feed on head on
spool DEAD_LOCK_WAITERS.LST

col " " for A25
col "Holding Session Info" for A25
col "Waiting Session Info" for A25

Thursday, June 21, 2012

Check DirectX version with DirectX Diagnostic Tools in Windows

How to detect DirectX version installed in Windows.

Microsoft DirectX is a group of technologies designed to make Windows-based PCs an ideal platform for running and displaying applications rich in multimedia elements such as full- color graphics, 3D animation, video and rich audio.

DirectX includes security and performance updates, along with many new features across all technologies, which can be accessed by applications using the DirectX APIs.

Monday, May 21, 2012

jQuery: Disable context menu on right click

Using jQuery you can disable context menu when you right click on any HTML page. To do so add a very small   script in <HEAD> section of HTML page after linking it to jQuery.

Here is the script : 

<script type="text/javascript">
 $(function(){
 $("form").form();
 $(this).bind("contextmenu", function(e) {
e.preventDefault();
 });
});
</script> 

Friday, February 17, 2012

Data Pump in Oracle Database 10g

Oracle Data Pump is a newer, faster and more flexible alternative to the "exp" and "imp" utilities used in previous Oracle versions. In addition to basic import and export functionality data pump provides a PL/SQL API and support for external tables.

Getting Started

For the examples to work we must first unlock the SCOTT account and create a directory object it can access:
CONN sys/password@db10g AS SYSDBA
ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;
GRANT CREATE ANY DIRECTORY TO scott;
 
CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
GRANT READ, WRITE ON DIRECTORY test_dir TO scott;

Table Exports/Imports

The TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax:
expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR 
dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log
 
impdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR 
dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log


For example output files see expdpEMP_DEPT.log and impdpEMP_DEPT.log.

The
TABLE_EXISTS_ACTION=APPEND parameter allows data to be imported into existing tables.

Schema Exports/Imports

The OWNER parameter of exp has been replaced by the SCHEMAS parameter which is used to specify the schemas to be exported. The following is an example of the schema export and import syntax:
expdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR 
dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
 
impdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR 
dumpfile=SCOTT.dmp logfile=impdpSCOTT.log
For example output files see expdpSCOTT.log and impdpSCOTT.log.

Friday, January 6, 2012

SQL Server database : Regular maintenance

If you are a DBA it is very important for you to know maintenance plan in SQL Server. Generally we use SQL Enterprise Manager to perform regular maintenance of SQL database.

The information below does not cover everything you can do to maintain your SQL database in SQL Enterprise Manager. Before you must See your SQL documentation for details on what else you can do to maintain your database.

Backing up the transaction log is not compatible with simple recovery. If you have multiple databases with different recovery models, you can create separate database maintenance plans for each recovery model. In this way you can include a step to backup your transaction logs only on the databases that do not use the simple recovery mode.

Change recovery model to simple

Simple recovery mode is recommended because it prevents the transaction logs from swelling. In simple recovery, once a checkpoint is complete, the transaction logs for the time before the checkpoint are dropped from the active database. A checkpoint automatically occurs when the backup is made. We recommend having a database maintenance plan that performs a backup of the ePO database, together with "Simple Recovery". In this way, once a backup is successfully created, the portion of the transaction log in the active database will be dropped as it is no longer needed since a backup file exists.

Monday, October 24, 2011

Facebook tips: Secure Facebook

As per alexa.com, Facebook is the world number 1 most popular social networking site, and its world wide ranking is 2nd after google.com. It stores our personal data like contact info, images etc. and now it is your open ID, So it becomes necessary to secure our accounts.

Facebook provides HTTPS secure browsing by default. If you use HTTPS browsing, all the data shared between your web browser and Facebook server will be in encrypted.













How to enable https in facebook: ( in simple 4 steps )


Friday, August 5, 2011

Javascript to get URL of page

In my project, today i need to get the URL of the page, i used a small Javascript to implement it. In Javascript location object contains information about the current URL. It is supported by all the major browsers.
The location object is part of the window object and is accessed through the window.location property. Quite simple script to do this is :


<script language="javascript" type="text/javascript">
    document.write (document.location.href);
</script>

Properties of Location Object
 hash  Returns the anchor portion of a URL
 host  Returns the hostname and port of a URL
 hostname  Returns the hostname of a URL
 href  Returns the entire URL
 pathname  Returns the path name of a URL
 port  Returns the port number the server uses for a URL
 protocol  Returns the protocol of a URL
 search  Returns the query portion of a URL

Note : Please note that this won't work if you are using frames in your page.

Thursday, June 16, 2011

Facebook google : Wanna chat in Hindi?

Here is a small script you can bookmark in your browser. After it Open facebook and then just clicking on the bookmark will enable you typing in Hindi... To disable typing in Hindi just click on bookmark again.

javascript:(t13nb=window.t13nb||function(l){var t=t13nb,d=document,o=d.body,c="createElement",a="appendChild",w="clientWidth",i=d[c]("span"),s=i.style,x=o[a](d[c]("script"));if(o){if(!t.l){t.l=x.id="t13ns";o[a](i).id="t13n";i.innerHTML="Loading transliteration";s.cssText="z-index:99;font-size:18px;background:#FFF1A8;top:0";s.position=d.all?"absolute":"fixed";s.left=((o[w]-i[w])/2)+"px";x.src="http://t13n.googlecode.com/svn/trunk/blet/rt13n.js?l="+l}}else setTimeout(t,500)})('hi');

Ok , here i'm gonna tell you how to add a bookmark in Chrome and Firefox 4 in 3-4 easy steps.

Tuesday, February 15, 2011

Static Twitter Follow Me Badge For Any Web In 5 Easy Steps

Twitter is large social networking site and has a million's of users. Many Bloggers/Webmasters are using twitter to promote their blogs. So here i'm sharing how to include Twitter follow me badge in easy 5 steps for blogger user, but it doesn't mean this post is not useful for other webmasters , even for them its very easy ( Please follow only 4,5 step). 

Steps are
  1. Login into your account first.
  2. After successful login you are at Dashboard, now select Design 
  3. Now select tab Edit HTML.
  4. Find (Ctrl + F) "</head>" tag.
  5. Paste the code Just before it, Now in place of "UID" ( second line of code )write your twitter User Name ( ie webgeektutorial ) let others be same and save your work,  its Done !
CODE: 
<!-- HTML Codes by http://webgeektutorials.blogspot.com -->
<a href='http://www.twitter.com/UID' rel='nofollow' style='display:scroll;position:fixed;top:250px;right:5px;z-index:10' target='_blank' title='Follow Us On Twitter'>
<img alt='by http://webgeektutorials.blogspot.com' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl38NVMDrq1uBbLJVpzIOIwYBaVRI2bWVFKBfu0BMTF4dY5gLj5ampvKm3UCCEdTOwghN1uRRQU29QfSGEmR-VHCOGKipR_W8QArGuNQMGNIo8xUlRaajjZDXXIoFxJ143KNsEqU6Iddg/s104/twitter_fm.jpg'/>
</a>

If you like my post. Please do not remove Html comment line.  

Sharing is Caring :) So keep sharing.

Friday, February 11, 2011

How well you know Interactive Ruby Shell?

The Interactive Ruby Shell, more commonly known as IRB, is one of Ruby's most popular features, especially with new developers. You can bash out a one-liner, try a method you've just learned about, or even build a small algorithm or two without going the whole way to writing a complete program.
I've started learning ruby, so while I've been digging through some of the best content I can find on IRB learning all about its internals and ways to get more out of it and big thanks to all of those guys who contributed great knowledge on web, thought I should share some of best contents gathered :

Try out some trick in your IRB console:

irb> Kernel.methods.each do |method| puts method; system "/usr/local/bin/ri --no-pager Kernel##{method}"; ch = STDIN.getc; break if (ch.chr == 'q') end

Once you enter this just keep hit enter until you want to quit, at that point hit ‘q’ and enter.


How to clear IRB console ?

On Mac OS X or Linux you can use Ctrl + L to clear the IRB screen. But in windows i don't know how but yes i know the dos command 'cls' which clears screen. so simply i'm calling this command using system.

HTML5 Visual Cheat Sheet

HTML5 is the new language of the web. This reference lists the various tags available to the web designer, as well as a selection of useful character entities, attributes and events.
The HTML5 cheat sheet is a printable document, designed to provide a quick reference for HTML5. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size HTML5 cheat sheet.

PART 1  ( Click on image to Enlarge )

Thursday, February 10, 2011

Photoshop Glass Text Effect

How to create a glass text effect? Its a simple effect using the Blending Options.
This tutorials is divided into two parts. Big thanks goes to the up loader.

Part-1


How to Create Magical Effects

HD video to assist how one can create magical effects using Photoshop.

3D text in Photoshop CS5

How to create 3D effects within PhotoShop CS5. Though not as indepth as say a strictly 3D modeling program, this works fine for print and web purposes. The Process is fairly simple to learn, here are some good video resources.



With Photoshop CS5 Extended, you can create 3D logos and artwork from any text layer, selection, or layer mask with new Adobe Repoussé technology. Twist, rotate, extrude, bevel, and inflate these designs, and then easily apply rich materials like chrome, glass, and cork to explore different looks. And take your designs even further by leveraging the Adobe 3D Forge engine for advanced editing of your 3D models.

Thursday, January 27, 2011

Photoshop Retouching video tutorial

Best part of Adobe Photoshop is, it is best go-to tool for digital artists when it comes to professionally retouching images. Enhancing and retouching photos in Photoshop is an effective way to "work with what you’ve got".
There are many tips, tricks, and tutorials for improving things like skin tone and imperfections, and enhancing the photo subject’s features. This article shares a huge variety of photo retouching tutorials for Photoshop users with brief descriptions of each.One example video, all credit goes to the up-loader.


This is the beauty of Photoshop. If you like this tutorial, thumps up and download from youtube.com

Tuesday, January 4, 2011

Some useful JS tricks in Webdev

Hey all, here i want to share some small but useful browser side javascripts ticky codes..

1. Javascript to check when a static page was last modified:
                 javascript:document.write(document.lastModified);
2. These take you forward or back one page.
                 javascript: back();
                 javascript: forward();
3. Replace 'message here' with your message (Example: 'hi') or your expression.
                 javascript: alert('message here');