/**
* Checks for truth in a predicate.
* http://www.victorbyte.net/
* Returns boolean value
*/
public static boolean forEachPredicate(double [] set_S)
{
for(double x:set_S)
if(!(Math.pow(x,2.0) >= x)) //predicate
return false;
return true;
}
public static boolean negateForEachPredicate(double [] set_S)
{
return !forEachPredicate(set_S);
}
public static boolean thereExistsPredicate(double [] set_S)
{
for(double x:set_S)
if (( x + 1 ) > x) // predicate
return true;
return false;
}
public static boolean negateThereExistsPredicate(double [] set_S)
{
return !thereExistsPredicate(set_S);
}
public static boolean uniquePredicate(double [] set_S)
{
int unique = 0;
for(double x:set_S)
if (( x + 1 ) > x) //predicate
unique++;
return unique == 1;
}
Check for truth in a predicate : Java
Sort int array elements from Low to High : Java
/**
* Sort int array elements from high to low.
* http://www.victorbyte.net/
* void method
*/
public static void arraySortLowToHigh(int[] array)
{
int temp = 0;
for (int loop = array.length  2, index = array.length  1; loop >= 0 ; loop)
{
if (array[index] < array[loop])
{
temp = array[index];
array[index] = array[loop];
array[loop] = temp;
}
if (loop == 0) loop = index; // reset loop
}
return;
}
Posted in arraySortLowToHigh
Leave a comment
Sort int array elements from High to Low : Java
/** * Sort int array elements from high to low. * http://www.victorbyte.net/ * void method */ public static void arraySortHighToLow(int[] array) { int temp = 0; for (int loop = array.length  2, index = array.length  1; loop >= 0 ; loop) { if (array[index] > array[loop]) { temp = array[index]; array[index] = array[loop]; array[loop] = temp; } if (loop == 0) loop = index; // reset loop } return; }
Posted in algorithms, java
Leave a comment
intro to Python GUI application
#!/usr/bin/env python3
# PyQt Application that displays "Hello World"
# http://www.victorbyte.net/
# Useful demo for beginner.
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
app = QApplication(sys.argv)
label = QLabel("Hello World");
label.show();
app.exec_();
Rapid GUI Programming with Python and Qt (Prentice Hall Open Source Software Development)
Posted in PyQt Application example
Leave a comment
Get lowest number in a Java array.
/**
* Checks for the lowest int in an int array.
* http://www.victorbyte.net/
* Returns int value
*/
public static int getMinInArray(int[] array)
{
int min = array[0];
for(int i: array) min = min < i ? min : i;
return min;
}
Posted in getMinInArray
Leave a comment
Get highest number in a Java array.
/**
* Checks for the highest int in an int array.
* http://www.victorbyte.net/
* Returns int value
*/
public static int getMaxInArray(int[] array)
{
int max = array[0];
for(int i: array) max = max > i ? max : i;
return max;
}
Check for duplicate characters in a String : Java
/**
* Checks if a String has a duplicate char.
* http://www.victorbyte.net/
* Returns boolean value
*/
public static boolean hasDuplicateChar(String str)
{
for (int index = 0, loop = 1; loop < str.length(); loop++)
{
if (str.charAt(index) == str.charAt(loop))
return true;
if (loop == str.length()  1)
loop = ++index;
}
return false;
}
Chocolate cup cake
http://thepioneerwoman.com/tastykitchen/recipes/desserts/moltenchocolatecake/
 4 pieces (squares) Semisweet Baking Chocolate
 ½ cups Butter
 1 cup Powdered Sugar
 2 whole Eggs
 2 whole Egg Yolks
 6 Tablespoons Flour
 2 cups Real Whipping Cream (seriously It’s So Much Better!)
 2 Tablespoons Sugar
Preparation Instructions
Preheat oven to 425 degrees.
Spray 4 custard cups with Pam and place on cookie sheet.
Microwave chocolate and butter in large bowl on high for about 1 minute, until butter is melted. whisk until chocolate is also melted.
Stir in sugar until well blended. Whisk in eggs and egg yolks. Stir in flour.
Divide between cups.
Bake 1314 minutes until sides are firm and center is soft. Let stand 1 minute.
Combine sugar and heavy cream and whip until stiff.
Invert cakes on dishes and top with whipped cream.
Posted in Uncategorized
Leave a comment
How to make bread easy in 13 easy steps

3 cups of lukewarm water

add 2 teaspoons of instant yeast

Stir and leave it for 3 minutes

add 2 teaspoons of salt

2 tablespoons of sugar

5 tablespoons of vegetable oil

Stir

add 4 cups of floor

(optional) add quarter cup of corn meal floor

Mix well

leave for 30 – 45 minutes for the dough to rise

Set oven to 180°C (about 325 °F )

check after 15 – 20 minutes

voila
Posted in How to make bread
Leave a comment
Vector Space Axioms
1. If u and v are objects in V, then u + v is in V
2. u + v = v + u
3. u + ( v + w) = (u + v) + w
4. There is an object 0 in V, called a zero vector for V, such that 0 + u = u + 0 = u for all u in V.
5. For each u in V , there is an object –u in V , called a negative of , such that (u) + u = u + (u) = 0 .
6. If k is any scalar and u is any object in V, then ku is in V.
7. k(u+v) = ku + kv
8. (k+m)u = ku + mu
9. k(mu) = (km)(u)
10. 1u = u
Posted in Math
Leave a comment