BeautifulWork Project
http://www.beautifulwork.org
LEARNING PROCESSTue, 30 Sep 2014 20:11:09 +0000en-UShourly1http://wordpress.org/?v=3.6.1Hacking with conversions of decimal and binary
http://www.beautifulwork.org/2014/09/30/hacking-with-conversions-of-decimal-and-binary/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-with-conversions-of-decimal-and-binary
http://www.beautifulwork.org/2014/09/30/hacking-with-conversions-of-decimal-and-binary/#commentsTue, 30 Sep 2014 20:11:09 +0000adminhttp://www.beautifulwork.org/?p=15974
$./app
Sign detection [1]
Power of two [2]
Counting No. of bits set [3]
Set or clear bits without branching[4]
Find maximum value[5]
Finding least common multiple[6]
Finding the greatest commom divisor[7]
Finding if a number is an Armstrong number or not[8]
Finding if a given number is prime number[9]
Finding the number of twin prime numbers[10]
Finding if a number is palindrome or not[11]
Finding prime factor of a number[12]
Finding the value of M^N[13]
Finding factorial of a number[14]
Finding the sum of the series 1! + 2! +...+N! [15]
Finding the sume of the series 1 + 2 +...+N [16]
Finding Parity of an Integer [17]
Finding the biggest among three numbers [18]
Finding the sum of even and odd numbers up to a number N [19]
Finding the sum and number of integers divisible by 5 [20]
Swapping Values [21]
Finding the decimal value for a binary [22]
Finding the reverse of an integer [23]
Finding a way for user authentication [24]:
Finding the binary equivalent of a decimal number and count no. of 1's in binary number [25]
Option: 25
Enter a decimal integer
25
Input number is 25
It's binary equivalent is 11001
No. of 1s in the binary number is 3
$./app
Sign detection [1]
Power of two [2]
Counting No. of bits set [3]
Set or clear bits without branching[4]
Find maximum value[5]
Finding least common multiple[6]
Finding the greatest commom divisor[7]
Finding if a number is an Armstrong number or not[8]
Finding if a given number is prime number[9]
Finding the number of twin prime numbers[10]
Finding if a number is palindrome or not[11]
Finding prime factor of a number[12]
Finding the value of M^N[13]
Finding factorial of a number[14]
Finding the sum of the series 1! + 2! +...+N! [15]
Finding the sume of the series 1 + 2 +...+N [16]
Finding Parity of an Integer [17]
Finding the biggest among three numbers [18]
Finding the sum of even and odd numbers up to a number N [19]
Finding the sum and number of integers divisible by 5 [20]
Swapping Values [21]
Finding the decimal value for a binary [22]
Finding the reverse of an integer [23]
Finding a way for user authentication [24]:
Finding the binary equivalent of a decimal number and count no. of 1's in binary number [25]
Option: 22
Enter a binary number : 11001
The binary number is : 11001
It's decimal equivalent is: 25
$
]]>http://www.beautifulwork.org/2014/09/30/hacking-with-conversions-of-decimal-and-binary/feed/0How to write an algorithm to reverse an integer ?
http://www.beautifulwork.org/2014/09/26/how-to-write-an-algorithm-to-reverse-an-integer/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-write-an-algorithm-to-reverse-an-integer
http://www.beautifulwork.org/2014/09/26/how-to-write-an-algorithm-to-reverse-an-integer/#commentsFri, 26 Sep 2014 13:52:38 +0000adminhttp://www.beautifulwork.org/?p=15971
/* Part of this work is copied from http://www.sanfoundry.com/c-program-to-reverse-a-given-number/ */
#include <stdio.h>
revint()
{
long num, reverse = 0, temp, remainder;
printf("Enter the number \n");
scanf("%ld",&num);
temp = num;
while ( num > 0 )
{
remainder = num % 10;
reverse = reverse * 10 + remainder;
num /= 10;
}
printf("Given number = %ld \n", temp);
printf("It's reverse = %ld \n", reverse);
}
/* http://stackoverflow.com/questions/15349723/reversing-an-integer-in-java-using-a-for-loop */
/* http://math.stackexchange.com/questions/480068/how-to-reverse-digits-of-an-integer-mathematically */
]]>http://www.beautifulwork.org/2014/09/26/how-to-write-an-algorithm-to-reverse-an-integer/feed/0Hacking with an algorithm to reverse an integer
http://www.beautifulwork.org/2014/09/26/hacking-with-an-algorithm-to-reverse-an-integer/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-with-an-algorithm-to-reverse-an-integer
http://www.beautifulwork.org/2014/09/26/hacking-with-an-algorithm-to-reverse-an-integer/#commentsFri, 26 Sep 2014 13:41:22 +0000adminhttp://www.beautifulwork.org/?p=15969
$./app
Sign detection [1]
Power of two [2]
Counting No. of bits set [3]
Set or clear bits without branching[4]
Find maximum value[5]
Finding least common multiple[6]
Finding the greatest commom divisor[7]
Finding if a number is an Armstrong number or not[8]
Finding if a given number is prime number[9]
Finding the number of twin prime numbers[10]
Finding if a number is palindrome or not[11]
Finding prime factor of a number[12]
Finding the value of M^N[13]
Finding factorial of a number[14]
Finding the sum of the series 1! + 2! +...+N! [15]
Finding the sume of the series 1 + 2 +...+N [16]
Finding Parity of an Integer [17]
Finding the biggest among three numbers [18]
Finding the sum of even and odd numbers up to a number N [19]
Finding the sum and number of integers divisible by 5 [20]
Swapping Values [21]
Finding the decimal value for a binary [22]
Finding the reverse of an integer [23]
23
Enter the number
47124907242424245782424578
Given number = 9223372036854775807
It's reverse = 7085774586302733229
$
]]>http://www.beautifulwork.org/2014/09/26/hacking-with-an-algorithm-to-reverse-an-integer/feed/0Calculus – The Fundamental Theorem, Part 1
http://www.beautifulwork.org/2014/09/23/calculus-the-fundamental-theorem-part-1/?utm_source=rss&utm_medium=rss&utm_campaign=calculus-the-fundamental-theorem-part-1
http://www.beautifulwork.org/2014/09/23/calculus-the-fundamental-theorem-part-1/#commentsTue, 23 Sep 2014 16:27:54 +0000adminhttp://www.beautifulwork.org/?p=15965

]]>http://www.beautifulwork.org/2014/09/23/calculus-the-fundamental-theorem-part-1/feed/0Lec 1 | MIT 6.002 Circuits and Electronics, Spring 2007
http://www.beautifulwork.org/2014/09/22/lec-1-mit-6-002-circuits-and-electronics-spring-2007/?utm_source=rss&utm_medium=rss&utm_campaign=lec-1-mit-6-002-circuits-and-electronics-spring-2007
http://www.beautifulwork.org/2014/09/22/lec-1-mit-6-002-circuits-and-electronics-spring-2007/#commentsMon, 22 Sep 2014 14:49:38 +0000adminhttp://www.beautifulwork.org/?p=15961

]]>http://www.beautifulwork.org/2014/09/22/lec-1-mit-6-002-circuits-and-electronics-spring-2007/feed/0How to write an algorithm to do a binary to decimal conversion ?
http://www.beautifulwork.org/2014/09/20/how-to-write-an-algorithm-to-do-a-binary-to-decimal-conversion/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-write-an-algorithm-to-do-a-binary-to-decimal-conversion
http://www.beautifulwork.org/2014/09/20/how-to-write-an-algorithm-to-do-a-binary-to-decimal-conversion/#commentsSat, 20 Sep 2014 16:25:14 +0000adminhttp://www.beautifulwork.org/?p=15959
/* part of work copied from http://www.sanfoundry.com/c-program-binary-number-into-decimal/ */
#include <stdio.h>
btd()
{
int num, binary_val, decimal_val = 0, base = 1, rem;
printf("Enter a binary number : ");
scanf("%d",&num);
binary_val = num;
while ( num > 0 )
{
rem = num % 10;
decimal_val = decimal_val + rem * base;
num = num / 10;
base = base * 2;
}
printf("The binary number is : %d \n",binary_val);
printf("It's decimal equivalent is: %d \n",decimal_val);
}
/* http://numbermonk.com/ */
/* remainder -- a part that is still to come to make things perfect
(or make something working fully) */
/* http://www.mathsisfun.com/definitions/remainder.html */
/* "num" is considered as a number which has to be broken
into 10 pieces beacuse the resulting number is built
using a maximum of 10 building blocks.
]]>http://www.beautifulwork.org/2014/09/20/how-to-write-an-algorithm-to-do-a-binary-to-decimal-conversion/feed/0How to write an algorithm to swap values ?
http://www.beautifulwork.org/2014/09/16/how-to-write-a-program-to-swap-values/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-write-a-program-to-swap-values
http://www.beautifulwork.org/2014/09/16/how-to-write-a-program-to-swap-values/#commentsTue, 16 Sep 2014 15:29:45 +0000adminhttp://www.beautifulwork.org/?p=15954
/* part of work copied from http://www.sanfoundry.com/c-program-swap-values/ */
#include <stdio.h>
swap_values()
{
int temp;
int *ptr1, *ptr2;
int a, b;
printf("Enter integer values to be swapped: ");
scanf("%d %d",&a,&b);
ptr1 = &a;
ptr2 = &b;
temp = *ptr1;
*ptr1 = *ptr2;
*ptr2 = temp;
printf("Swapped values are: %d %d \n",a,b);
}
/* http://www.programmingsimplified.com/c-program-swap-two-numbers */
/* http://betterexplained.com/articles/swap-two-variables-using-xor/ */
/* http://www.science.unitn.it/~fiorella/guidelinux/tlk/node27.html */
]]>http://www.beautifulwork.org/2014/09/16/how-to-write-a-program-to-swap-values/feed/0Hacking with integer divisibility
http://www.beautifulwork.org/2014/09/16/hacking-with-integer-divisibility/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-with-integer-divisibility
http://www.beautifulwork.org/2014/09/16/hacking-with-integer-divisibility/#commentsTue, 16 Sep 2014 13:36:12 +0000adminhttp://www.beautifulwork.org/?p=15948
/* work copied from http://www.sanfoundry.com/c-program-number-divisible-by-5/ */
#include <stdio.h>
numberdivi()
{
int i, num1, num2, count = 0, sum = 0;
printf("Enter the value of num1 and num2 : ");
scanf("%d %d",&num1,&num2);
for (i = num1; i < num2 ; i++)
{
if ((i % 5) == 0)
{
printf("%3d,",i);
count++;
sum = sum + i;
}
}
printf("\n Number of integers divisible by 5 between %d and %d = %d \n",num1,num2,count);
printf("The sum of all integers that are divisible by 5 = %d\n",sum);
}
/* http://en.wikipedia.org/wiki/Divisibility_rule */
/* http://stackoverflow.com/questions/18473730/algorithm-in-hardware-to-find-out-if-number-is-divisible-by-five */
]]>http://www.beautifulwork.org/2014/09/16/hacking-with-integer-divisibility/feed/0Hacking with a binary using file and strip commands
http://www.beautifulwork.org/2014/09/10/hacking-with-a-binary-using-file-and-strip-commands/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-with-a-binary-using-file-and-strip-commands
http://www.beautifulwork.org/2014/09/10/hacking-with-a-binary-using-file-and-strip-commands/#commentsWed, 10 Sep 2014 19:49:24 +0000adminhttp://www.beautifulwork.org/?p=15946
$file simple | awk '{ print $(NF-1) $(NF-0) }'
notstripped
$du -h simple
8.0K simple
$./simple
Hello World
$strip ./simple
$du -h simple
8.0K simple
$./simple
Hello World
$file simple | awk '{ print $(NF-1) $(NF-0) }'
BuildID[sha1]=6cf0bed752a904372cd42a85bc560c266a7c91b3,stripped
$
]]>http://www.beautifulwork.org/2014/09/10/hacking-with-a-binary-using-file-and-strip-commands/feed/0Hacking with debian netselect-apt command
http://www.beautifulwork.org/2014/08/31/hacking-with-debian-netselect-apt-command/?utm_source=rss&utm_medium=rss&utm_campaign=hacking-with-debian-netselect-apt-command
http://www.beautifulwork.org/2014/08/31/hacking-with-debian-netselect-apt-command/#commentsSun, 31 Aug 2014 17:26:00 +0000adminhttp://www.beautifulwork.org/?p=15929] 3,50,858 110KB/s in 3.1s 2014-08-31 23:00:11 (110 KB/s) - ‘/tmp/netselect-apt.Pjgwxz’ saved […]]]>
$sudo netselect-apt -t 2 -c IN
Using distribution stable.
Retrieving the list of mirrors from www.debian.org...
--2014-08-31 23:00:07-- http://www.debian.org/mirror/mirrors_full
Resolving www.debian.org (www.debian.org)... 140.211.15.34, 128.31.0.51
Connecting to www.debian.org (www.debian.org)|140.211.15.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 350858 (343K) [text/html]
Saving to: ‘/tmp/netselect-apt.Pjgwxz’
100%[====================================================================================>] 3,50,858 110KB/s in 3.1s
2014-08-31 23:00:11 (110 KB/s) - ‘/tmp/netselect-apt.Pjgwxz’ saved [350858/350858]
Choosing a main Debian mirror using netselect.
(will filter only for mirrors in country IN)
Running netselect to choose 2 out of 4 addresses.
...........
Only found 1 hosts out of 2 requested.
The fastest 2 servers seem to be:
http://debian.mirror.net.in/debian/
Of the hosts tested we choose the fastest valid for HTTP:
http://debian.mirror.net.in/debian/
Writing sources.list.
sources.list exists, moving to sources.list.1409506243
Done.
$
]]>http://www.beautifulwork.org/2014/08/31/hacking-with-debian-netselect-apt-command/feed/0