Thursday, July 26, 2012
Bubble Sort In C
int swap(int *x,int *y)
{
int temp=*x;
*x=*y;
*y=temp;
}
void main()
{
int num=5,ar[5]={3,54,12,55,2};
for(int i=num-2;i>=0;i--)
for(int j=0;j<=i;j++)
if(ar[j]>ar[j+1])
swap(&ar[j],&ar[j+1]);
for(i=0;i
Sunday, April 29, 2012
Locker
Quote: cls
@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDENTER PASSWORD TO OPEN
:CONFIRM
echo -----------------------------------------------------------
echo ================== Www.hackingtech.co.tv ==================
echo -----------------------------------------------------------
echo Are you sure you want to lock the folder(Y/N)
echo Press (Y) for Yes and Press (N) for No.
echo -----------------------------------------------------------
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo -----------------------------------------------------------
echo ================== Www.hackingtech.co.tv ==================
echo -----------------------------------------------------------
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== radhikakrishna goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDENTER PASSWORD TO OPEN
md Private
echo Private created successfully
goto End
:End
Saturday, March 31, 2012
Url source code fetcher
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
public class sourceFetcher
{
public static String fetchSource(String s)
{
String line,code="";
try {
URL url = new URL("http://"+s);
String temp="";
BufferedReader reader=null;
try
{
reader = new BufferedReader(new InputStreamReader(url.openStream()));
while((line=reader.readLine())!=null)
{
code=code+"\n"+line;
}
reader.close();
}catch(Exception e){return "error";}
}catch(Exception e){ return "error";}
return code;
}
}
import java.io.InputStreamReader;
import java.net.URL;
public class sourceFetcher
{
public static String fetchSource(String s)
{
String line,code="";
try {
URL url = new URL("http://"+s);
String temp="";
BufferedReader reader=null;
try
{
reader = new BufferedReader(new InputStreamReader(url.openStream()));
while((line=reader.readLine())!=null)
{
code=code+"\n"+line;
}
reader.close();
}catch(Exception e){return "error";}
}catch(Exception e){ return "error";}
return code;
}
}
Run Dos through Java
import java.io.IOException;
public class RunDos
{
public static void runCommand(String command) throws IOException, InterruptedException
{
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
}
}
public class RunDos
{
public static void runCommand(String command) throws IOException, InterruptedException
{
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
}
}
WordSeperator
public class WordSeperator
{
public static Object[] seperater(String source)
{
String word;
int start=0,end=0;
ArrayList a=new ArrayList();
for(int pos=0;pos {
if(source.charAt(pos)==' ')
{
end=pos;
word=source.substring(start, end);
if(word.length()>1)
a.add(source.substring(start, end));
start=end+1;
}
}
a.add(source.substring(end+1, source.length()));
return a.toArray();
}
}
{
public static Object[] seperater(String source)
{
String word;
int start=0,end=0;
ArrayList a=new ArrayList();
for(int pos=0;pos
if(source.charAt(pos)==' ')
{
end=pos;
word=source.substring(start, end);
if(word.length()>1)
a.add(source.substring(start, end));
start=end+1;
}
}
a.add(source.substring(end+1, source.length()));
return a.toArray();
}
}
Monday, March 19, 2012
Toast Message in Android App
package prem.firstApp;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class FirstAppActivity extends Activity implements OnClickListener
{
Button b1;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b1=(Button)findViewById(R.id.b1id);
b1.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
Toast.makeText(this, "Hello, This is my First App", Toast.LENGTH_LONG).show();
}
}
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class FirstAppActivity extends Activity implements OnClickListener
{
Button b1;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b1=(Button)findViewById(R.id.b1id);
b1.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
Toast.makeText(this, "Hello, This is my First App", Toast.LENGTH_LONG).show();
}
}
Configure Eclipse for Android Development
1. Go to http://www.eclipse.org/downloads/
2. Choose Eclipse IDE for Java Developers (32 bit/64 bit as per your choice)
3. Choose eclipse-java-indigo-SR2-win32 for better result and unzip it.
4. Open Eclipse by clicking on eclipse icon
5. Click ok when it will opt address for WorkSpace
6. Help>Install new Softwares>Add>
7. fill Name=> Android ADK
Location => http://dl-ssl.google.com/android/eclipse
8. ok and then install the software.
Now
9. Go to Windows>Preferences>Android option in left Panel>Browse
Set path of sdk locations>Apply + OK
Saturday, March 17, 2012
larger no. among 3 numbers
#include
#include
void main()
{
int a=10,b=20,c=30;
printf("%d",a>b ? a>c?a:c:b>c?b:c);
}
#include
void main()
{
int a=10,b=20,c=30;
printf("%d",a>b ? a>c?a:c:b>c?b:c);
}
Monday, January 9, 2012
isPrimeNumber
package datastructure;
import javax.swing.JOptionPane;
public class PrimeNumber
{
public static void main(String arg[])
{
JOptionPane.showMessageDialog(null, PrimeNumber.isPrime(Integer.parseInt(JOptionPane.showInputDialog("Enter Number"))));
}
public static boolean isPrime(int num)
{
if (num<4)return true;
if (num%2==0)return false;
for(int d=3; d*d<=num;d+=2)
if(num%d==0)return false;
return true;
}
}
Subscribe to:
Posts (Atom)