prime number using for loop in php Get link Facebook X Pinterest Email Other Apps October 04, 2012 php using prime number programfor($i=2;$i<50;$i++){$counter=0;for($j=2;$j<$i;$j++){if($i%$j==0){$counter++;break;}}// you can check instead if($i==$j)if($counter==0){echo $i.",";}} Get link Facebook X Pinterest Email Other Apps Comments
How to count duplicate characters from a sentence in java August 20, 2012 Output : DuplicateCharacter .java package com.swain.cell; import java.util.HashMap; public class DuplicateCharacter { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String str = "Character duplicate word example java" ; char ch1[]=str.toCharArray(); HashMap<Character,Integer> hm= new HashMap<Character,Integer>(); for ( int i=0; i<ch1. length ; i++) { char ch=ch1[i]; ... Read more
How to use webview in android? August 20, 2012 MainActivity.java package com.swain.cell.financial.calculator; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.webkit.WebView; public class MainActivity extends Activity { WebView wv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); wv=(WebView)findViewById(R.id.webView1); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl("file:///android_asset/playlist/index.html"); ... Read more
how to check ban-word user in put using php August 20, 2012 function banned_words_chk($phrase) { global $conn, $config; $query = “SELECT word from bans_words”; $executequery = $conn->Execute($query); $bwords = $executequery->getarray(); $found = 0; $words = explode(” “, $phrase); foreach($words as $word) { foreach($bwords as $bword) { if($word == $bword[0]) { $found++; } else { $pos2 = strpos($word, $bword[0]); if($pos2 !== false) { $found++; } } } } if($found > 0) { return true; } else { return false; } } Read more
Comments
Post a Comment