tag:blogger.com,1999:blog-218941462024-03-07T08:07:34.314+02:00Mohammad Alaggan"Beneath this mask there is more than flesh. Beneath this mask there is an idea, Mr. Creedy, and ideas are bulletproof" - V for VendettaMohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.comBlogger174125tag:blogger.com,1999:blog-21894146.post-90552334950389951732015-01-10T03:56:00.000+02:002015-01-10T03:56:41.824+02:00Does and explanation or an experiment qualify as a formal proof?<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<div>
The short answer is no. Read on.</div>
<div>
</div>
<div>
A formal proof is a sequence of sentences, starting from axioms, and developing using rules of inferences. Details are here: <a href="http://en.wikipedia.org/wiki/Formal_proof" target="_blank">http://en.wikipedia.org/wiki/<wbr></wbr>Formal_proof</a> .<br /></div>
An experiment is not a formal proof. A formal proof is <i>deductive</i> while an experiment is <i>inductive</i>.
Deduction is the method of inference in formal, rigorous models, such
as math, computer science, and logic. While induction is the method of
inference in observation-based models, such physics, biology, and
chimestry (and similar fields). Induction cannot give useful and
trustworthy information except if quantified correctly. The usual method
of quantifying induction is through statistics (and more recently,
machine learning). Experiments are mostly used in applied fields, where
it suffices (and is possible) to show that <i>something </i>occurs. However, it is impossible to use experiments to show that something does <i>not </i>occur.
In particular, it is impossible to show, using experiments, that a
system is secure; since it is equivalent to showing that something bad
does <i>not </i>occur. <br /><br />Explanations are something different. Explanations are just a <i>theory</i>.
Some of them may be tested, if they were falsifiable (testable, if you
wish). But to the uninitiated, they can be very deceiving. Just because
you can <i>explain </i>something, does not mean you proved it. An explanation just shows that something is <i>plausible</i>. But does not show that it is <i>unavoidable</i>. There is a cognitive bias known as <i>confirmation bias </i>(look
it up) that say we are more likely to believe things that we can
explain; which leads to serious logical fallacies. Therefore, a true
scientist (going through masters and PhD) is trained to challenge his
believes by trying to <i>prove their opposite</i>. Which is why in statistics we are usually interested in the <i>null hypothesis</i>
instead of what we are actually trying to show. However, this is still
more related to the inductive branch of inference, not the deductive
branch. <br /></div>
In computer science, and in particular
security and cryptography, deduction is the only way to show that we
have an interesting result. This is why a formal proof is need, and why
an explanation or an experiment is not. This is more serious that you
can imagine; understanding this distinction is what makes a true
scientist from a layperson.</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-89525180776311921712013-05-26T07:01:00.006+02:002013-05-26T07:01:57.271+02:00Quote <div dir="ltr" style="text-align: left;" trbidi="on">
<br /><br /><blockquote class="tr_bq">
( The INEXACT flag mandated by IEEE Standard 754 for Binary Floating–Point Arithmetic would, if MATLAB granted us access to that flag, help us discriminate between solutions x that are exactly right and those, perhaps arbitrarily wrong, whose residuals vanish by accident.) - http://www.eecs.berkeley.edu/~wkahan/ieee754status/baleful.pdf</blockquote>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-771957739232634212013-05-26T02:58:00.001+02:002013-05-26T09:04:22.798+02:00Useful commands<div dir="ltr" style="text-align: left;" trbidi="on">
<br /><br />leaks<br />heap<br />fs_usage<br />lsof<br />vm_stat<br />netstat<br />tcpdump<br />sc_usage<br />otool<br />xxd<br />pbcopy<br />pdfgrep<br />du -sh /private/var/vm/sleepimage</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-79941293924298517052013-05-03T14:29:00.005+02:002013-05-03T14:30:28.891+02:00Not having to specify DYLD_LIBRARY_PATH for your app when using Intel TBB (on Darwin/Mac OS X)<div dir="ltr" style="text-align: left;" trbidi="on">
When using Intel Threading Building Blocks, you have to link against their dynamic library. They do not provide a way for static linking, because when dynamic linking is used, their library has a shared state and they use that to prevent contention from over-threading.<br />
<br />
However, the only way they provide to load their library at run-time is by having to provide a path to their library (<span style="font-family: Courier New, Courier, monospace;">libtbb.dylib</span>) through the <br />
<span style="font-family: Courier New, Courier, monospace;">DYLD_LIBRARY_PATH</span>
environment variable. Before your application launches you are going to have to set it in the shell. They provide a handy script to do it for you too. It may be inconvenient but it is doable (especially in non-production environments like scientific experiments).<br />
<br />
However, although Valgrind is able to load their library correctly (and therefore run your program), GDB (7.5) can not do it. I am not able to debug my program because GDB says it can not load libtbb and dies.<br />
<br />
So I used my Google-fu and found a solution. Just run the following command in the <span style="font-family: Courier New, Courier, monospace;">tbb/lib</span> directory:<br />
<br />
<pre>$ install_name_tool -id /absolute/path/to/libtbb.dylib libtbb.dylib</pre>
<br />
<br />
There you go. The difference is that without doing it, LD linker only puts the library name in the binary. I.e., <span style="font-family: Courier New, Courier, monospace;">otool -L</span> shows only <span style="font-family: Courier New, Courier, monospace;">libtbb.dylib</span>, no path, no nothing. After the command, LD puts the absolute path, and therefore it gets encoded in the binary; no need for <span style="font-family: Courier New, Courier, monospace;">DYLD_LIBRARY_PATH</span> again.<br />
<br />
I found the useful information at <a href="https://dev.lsstcorp.org/trac/wiki/LinkingDarwin">https://dev.lsstcorp.org/trac/wiki/LinkingDarwin</a>.</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-28625148011772719662013-04-30T07:52:00.000+02:002013-04-30T07:52:16.900+02:00Segmentation fault<div dir="ltr" style="text-align: left;" trbidi="on">
Getting a segmentation fault out of no where after a long execution can be frustrating. One reason is that you usually do not get any information on the source of error. Another reason is that using valgrind or gdb to debug will make the program run even slower until you hit the error, <i>if </i>you hit it again. Frustrating indeed. But not all hope lost. You can modify your program to catch the segmentation fault and generate the needed debugging information for you (only for POSIX-compliant operating systems <b style="background-color: white; font-family: sans-serif; font-size: 16px; line-height: 24px;">– </b>that is like every operating system in the world, except Windows).<br />
<br />
Now when my program generates a segmentation fault that's what I get as output:<br />
<br />
<pre>Segmentation fault: Address not mapped to object
Invalid read of the address 0x0
Stack trace:
1: 0x103432c37 <attack_dataset int="" x2b7=""> (/Users/malaggan/Desktop/mac-only-ws/SVDAttack/jni/./svdattack)
2: 0x103498f8b <main x9b=""> (/Users/malaggan/Desktop/mac-only-ws/SVDAttack/jni/./svdattack)
Line number:
got symbolicator for svdattack, base address 100000000
attack_dataset(int) (in svdattack) (attack_dataset.cpp:104)
</pre>
<br />
How it is done is fairly simple. When a segmentation fault happens, the operating system sends a <i>signal </i>to the program. The program, in turn, can handle this signal and act based on it, via a signal handler. The signal handler is a function that is called by the operating system, to which it also provide useful information for debugging (and a lot more, like user-space threading, and copy-on-write, and other things). The entire state of the machine, including its general registers, and floating point registers, are recorded and sent to the signal handler. The one register we are interested about is the <i>instruction pointer </i>register, which contains the address of the instruction which caused the segmentation fault. Along with that also goes the address that the program was trying to access, and whether the program was trying to read it or write it. The operating system also gives information about that address; whether it is a totally wrong address (not mapped in the program's address space), or a valid address but the program has no permission to read (or write) it.<br />
<br />
The code I wrote to generate the message above goes next (the portion about the stack trace was taken from stackoverflow). It is written in C++11 and the machine-specific part is for Mac.<br />
<pre class="brush:cpp;">
#include <sys/ucontext.h>
#include <dlfcn.h>
#include <cxxabi.h>
#include <unistd.h>
void print(int sig, siginfo_t *info, void *c)
{
ucontext_t *context = reinterpret_cast<ucontext_t*>(c);
// defined in mach/i386/_structs.h
__darwin_mcontext64* mc = context->uc_mcontext;
__darwin_x86_thread_state64* ss = &mc->__ss;
__darwin_x86_exception_state64* es = &mc->__es;
__darwin_x86_float_state64* fs = &mc->__fs;
bool write_fault = (es->__err & 2) ? true : false;
fprintf(stderr,"\n%s: %s \n"
"Invalid %s of the address %p\n",
sys_siglist[sig],
(info->si_code == SEGV_MAPERR) ? "Address not mapped to object" : "Invalid permissions for mapped object",
(write_fault)?"write":"read",
es->__faultvaddr
);
// http://stackoverflow.com/questions/5397041/getting-the-saved-instruction-pointer-address-from-a-signal-handler
void **ip = reinterpret_cast<void**>(ss->__rip);
void **bp = reinterpret_cast<void**>(ss->__rbp);
fprintf(stderr,"\nStack trace: \n");
Dl_info dlinfo;
int f = 0;
while(bp && ip)
{
if(!dladdr(ip, &dlinfo))
break;
const char *symname = dlinfo.dli_sname;
int status;
char * tmp = abi::__cxa_demangle(symname, nullptr, 0, &status);
if (status == 0 && tmp)
symname = tmp;
fprintf(stderr,"% 2d: %p <%s+0x%lx> (%s)\n",
++f,
ip,
symname,
reinterpret_cast<unsigned long>>ip) - reinterpret_cast<unsigned long>(dlinfo.dli_saddr),
dlinfo.dli_fname);
if (tmp)
free(tmp);
if(dlinfo.dli_sname && std::string(dlinfo.dli_sname) == "main")
break;
ip = reinterpret_cast<void**>(bp[1]);
bp = reinterpret_cast<void**>(bp[0]);
}
fprintf(stderr,"\nLine number: \n");
auto load_addr = dlinfo.dli_fbase;
char str_pid[100]={0},
str_rip[100]={0},
str_load_addr[100]={0};
sprintf(str_pid, "%d", getpid());
sprintf(str_rip, "%p", ss->__rip);
sprintf(str_load_addr, "%p", load_addr);
char *argv[]={"atos","-o", "./svdattack", "-l", str_load_addr, str_rip, nullptr};
char *envp[] = { nullptr };
execve("/usr/bin/atos", argv, envp);
fprintf(stderr,"\n\n");
std::exit(1);
}
/*this is how the signal was registered*/
struct sigaction sa;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = print;
sigaction(SIGSEGV, &sa, nullptr);
sigaction(SIGBUS, &sa, nullptr);
</pre>
<br />
<br /></div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-29824254331112428652013-04-29T02:02:00.002+02:002013-04-29T02:02:39.766+02:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
OpenMP provides a keyword called THREADPRIVATE that allow thread-local storage for certain variables. That means that each thread will have its own copy of that variable. For instance:</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">int x = 0;</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">#pragma omp threadprivate(x)</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">#pragma omp parallel</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">{</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> x++; </span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> // here x will have value 1, for all threads, regardless of how many threads there are.</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> </span><span style="font-family: 'courier new', monospace;">// the next line will print n different addresses (n is the number of threads) ! </span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: 'courier new', monospace;"> // there is actually n different variables at n different memory locations.</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> cout << hex << &x << endl; </span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">}</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">// here x will be 0, untouched by the threads.</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
C++11 provides a standard way to do this, the keyword <span style="font-family: courier new, monospace;">thread_local</span>. Now things get complicated if the thread local variable has non-trivial constructors or destructors. For example:</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">struct A {</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> int x;</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> A(int _x) : x(_x) { x++; /* then print x */ }</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> void some_method() { /* do something */ }</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> ~A() { x--; /* then print x */ } </span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">};</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">thread_local A a(3);</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">int main() {</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> #pragma omp parallel</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> {</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> a.some_method();</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;"> }</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">}</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
If the number of threads is 2, then program will print:</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">4</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">4</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">3</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<span style="font-family: courier new, monospace;">3</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
Each thread executes the constructor of <span style="font-family: courier new, monospace;">a </span>(with the parameter 3 !) when it starts, and executes the destructor when it terminates. This behavior is specified in the standard. However, that is not what happens with the current implementation of OpenMP. What actually happens is that only the constructors are executed. I looked at the code and it appears that they use some sort of thread pool. However, even if they do, it should be expected that when the program terminates, all the threads are also terminated, even if they are in a thread pool. </div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
When I tired an equivalent code with pthreads, the correct behavior happened. So I compared both the disassemblies, and it appears that there is no special difference, hinting that the problem is with OpenMP binaries instead of the compiler, which is weird. I found a mention [1] in the GCC implementation of OpenMP (libgomp), and it appears they do not support dynamic construction of thread local storage (although they use pthreads as their implementation). </div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
The destruction of the threads depend on a call to __cxa_thread_atexit [2], and for some reason this is called with pthreads but not with OpenMP. I do not know why, but if the behavior of thread_local depends on external libraries, beyond the compiler itself, then this is a serious threat to its adoption. </div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
Conclusion: if you plan to use thread_local with classes having non-trivial destructors, don't (yet).</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
[1] <a href="http://gcc.gnu.org/onlinedocs/libgomp/Implementing-THREADPRIVATE-construct.html#Implementing-THREADPRIVATE-construct" style="color: #1155cc;" target="_blank">http://gcc.gnu.org/<wbr></wbr>onlinedocs/libgomp/<wbr></wbr>Implementing-THREADPRIVATE-<wbr></wbr>construct.html#Implementing-<wbr></wbr>THREADPRIVATE-construct</a> .</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 16.363636016845703px;">
[2] <a href="http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00427.html" style="color: #1155cc;" target="_blank">http://gcc.gnu.org/ml/gcc-<wbr></wbr>patches/2012-10/msg00427.html</a></div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-85745494596060669312013-04-27T23:16:00.001+02:002013-04-27T23:17:31.705+02:00<div dir="ltr" style="text-align: left;" trbidi="on">
Templates in C++ do not hinder optimizations, such as auto-vectorization, contrary to what I expected.<br />
<br />
Example:<br />
<br />
<br />
<pre>
// /dev/bin/g++ -m64 -S -std=c++11 -march=native -O3 test.cpp
#include <cmath>
constexpr int SIZE = (1L << 16);
/*
void test1(float *__restrict__ a, float *__restrict__ b)
{
int i;
float *x = (float*)__builtin_assume_aligned(a, 16);
float *y = (float*)__builtin_assume_aligned(b, 16);
for (i = 0; i < SIZE; i++)
{
x[i] += y[i];
}
}
*/
template<typename T>
void test1(T *__restrict__ a, T *__restrict__ b)
{
int i;
T *x = (T*)__builtin_assume_aligned(a, 16);
T *y = (T*)__builtin_assume_aligned(b, 16);
for (i = 0; i < SIZE; i++)
{
x[i] += y[i];
}
}
template void test1<float>(float * __restrict__ a, float * __restrict__ b);
template void test1<double>(double * __restrict__ a, double * __restrict__ b);
template void test1<int>(int * __restrict__ a, int * __restrict__ b);
template void test1<char>(char * __restrict__ a, char * __restrict__ b);
</pre>
<br />
The generated assembly file (by GCC 4.9) will be:
<pre>
.text
.align 4,0x90
.globl void test1<float>(float*, float*)
void test1<float>(float*, float*):
LFB237:
xorl %eax, %eax
.align 4,0x90
L2:
movaps (%rdi,%rax), %xmm0
addps (%rsi,%rax), %xmm0
movaps %xmm0, (%rdi,%rax)
addq $16, %rax
cmpq $262144, %rax
jne L2
rep; ret
LFE237:
.align 4,0x90
.globl void test1<double>(double*, double*)
void test1<double>(double*, double*):
LFB238:
xorl %eax, %eax
.align 4,0x90
L6:
movapd (%rdi,%rax), %xmm0
addpd (%rsi,%rax), %xmm0
movapd %xmm0, (%rdi,%rax)
addq $16, %rax
cmpq $524288, %rax
jne L6
rep; ret
LFE238:
.align 4,0x90
.globl void test1<int>(int*, int*)
void test1<int>(int*, int*):
LFB239:
xorl %eax, %eax
.align 4,0x90
L9:
movdqa (%rdi,%rax), %xmm0
paddd (%rsi,%rax), %xmm0
movdqa %xmm0, (%rdi,%rax)
addq $16, %rax
cmpq $262144, %rax
jne L9
rep; ret
LFE239:
.align 4,0x90
.globl void test1<char>(char*, char*)
void test1<char>(char*, char*):
LFB240:
xorl %eax, %eax
.align 4,0x90
L12:
movdqa (%rsi,%rax), %xmm0
paddb (%rdi,%rax), %xmm0
movdqa %xmm0, (%rdi,%rax)
addq $16, %rax
cmpq $65536, %rax
jne L12
rep; ret
LFE240:
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
.set L$set$0,LECIE1-LSCIE1
.long L$set$0
LSCIE1:
.long 0
.byte 0x1
.ascii "zR\0"
.byte 0x1
.byte 0x78
.byte 0x10
.byte 0x1
.byte 0x10
.byte 0xc
.byte 0x7
.byte 0x8
.byte 0x90
.byte 0x1
.align 3
LECIE1:
LSFDE1:
.set L$set$1,LEFDE1-LASFDE1
.long L$set$1
LASFDE1:
.long LASFDE1-EH_frame1
.quad LFB237-.
.set L$set$2,LFE237-LFB237
.quad L$set$2
.byte 0
.align 3
LEFDE1:
LSFDE3:
.set L$set$3,LEFDE3-LASFDE3
.long L$set$3
LASFDE3:
.long LASFDE3-EH_frame1
.quad LFB238-.
.set L$set$4,LFE238-LFB238
.quad L$set$4
.byte 0
.align 3
LEFDE3:
LSFDE5:
.set L$set$5,LEFDE5-LASFDE5
.long L$set$5
LASFDE5:
.long LASFDE5-EH_frame1
.quad LFB239-.
.set L$set$6,LFE239-LFB239
.quad L$set$6
.byte 0
.align 3
LEFDE5:
LSFDE7:
.set L$set$7,LEFDE7-LASFDE7
.long L$set$7
LASFDE7:
.long LASFDE7-EH_frame1
.quad LFB240-.
.set L$set$8,LFE240-LFB240
.quad L$set$8
.byte 0
.align 3
LEFDE7:
.constructor
.destructor
.align 1
.subsections_via_symbols
</pre>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-14961402424775393782013-04-17T10:18:00.002+02:002013-04-17T10:18:25.669+02:00Accessing private members in C++<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="line number1 index0 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp preprocessor" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">#define private public</code></div>
<div class="line number2 index1 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp preprocessor" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">#include "A.h"</code></div>
<div class="line number3 index2 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp preprocessor" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">#undef private</code></div>
<div class="line number4 index3 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number5 index4 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp keyword bold" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">accessPrivateState()</code></div>
<div class="line number6 index5 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number7 index6 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">A a;</code></div>
<div class="line number8 index7 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">a.x = 3;</code></div>
<div class="line number9 index8 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number9 index8 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><br /></code></div>
<div class="line number9 index8 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="cpp plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Source: http://www.drdobbs.com/cpp/testing-complex-c-systems/240147275?pgno=2</code></div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-57560842995596718482013-04-15T17:12:00.000+02:002013-04-15T17:12:07.900+02:00تعلم الرياضيات<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
حأقول رأيي بس خليك دايما عارف أن كل واحد له طريقته وكلامي مجرد اللي أشتغل معايا وممكن يختلف بأختلاف الفرد. في رأيي أن في حاجتين بيساعدوا كبداية: أول حاجة قراءة النقد لطرق التدريس الحالية، زي A mathematician's Lament، وما شابهها، عشان الواحد يطهّر تفكيره من الركام اللي تراكم بعد كل السنين ديه. وتاني حاجة قراءة نوعين مهمين من المقالات الرياضية: تاريخ الرياضيات (<a href="http://en.wikipedia.org/wiki/History_of_mathematics">http://en.wikipedia.org/wiki/History_of_mathematics</a>) والرياضيات الpopular (<a href="http://en.wikipedia.org/wiki/Popular_mathematics">http://en.wikipedia.org/wiki/Popular_mathematics</a>) (ممكن تبدأ تدور من المراجع المذكورة في الصفحات ديه مثلاً) . تاريخ الرياضيات لأنه مثلا اللي عمل حاجة معينة في الرياضيات من ألف سنة كان خلفيته قريبة جداً من خلفيتنا، (لأن الرياضيات اللي درسها تقريباً هي هي نفس الرياضيات اللي درسناها!!!!!)، وسهل نشوف أيه المشكلة اللي قابلتهم وفكروا أزاي في حلها، وهكذا، لحد ما نوصل لليوم الحالي. أما الرياضيات الشعبية (مش عارف أترجمها أزاي :D)، فتخدم هدفين: أول هدف هو تشغيل المخ في حاجات مش محتاجة خلفية كبيرة (وعادة بتبقى بعيدة عن الرموز والحاجات ديه فبتعبر عن روح الرياضيات أكتر!)، وفي علماء رياضيات كتير كانت ديه بدايتهم كأطفال، وتاني هدف مش الاستمتاع في حد ذاته، ولكن تدريب النفس على أنها تعمل ارتباط شرطي بين الرياضيات وبين المتعة، بحيث لما الواحد يشوف رياضيات بعد كدة حتى لو متقدمة أو صعبة حيحس ببعض المتعة فتكون عون له وتصبيره على ما يفهم. زائد الاستمتاع طبعاً. <br />الفيديو ده (https://www.facebook.com/photo.php?v=4565631532665) مثال للحاجات اللي حتلاقيها في تاريخ الرياضيات ! <br />أهم حاجة بلا استثناء أنك متعملش حاجة مضايقاك، يعني تقرا اللي بيشدك بس، ولو لقيت مقالة معينة خانقاك سيبها! عن علماء رياضيات كتير بيقولك أيه: القارئ بيستمتع بالمواضيع اللي مخه جاهز أنه يفهمها. فعشان تعرف تقرا أيه، جرب حاجات كتير واللي بيشدك يبقى هو اللي المفروض تكمل فيه. وتاني حاجة عشان لو قريت حاجات بتخنقك فده حيطور ارتباط شرطي بين الرياضيات وبين الخنقة، فتبقى مخنوق من الرياضيات كدة علطول من غير سبب، وعلى أيه :) !<br />وعامة لو ملقتش أي حاجة بتشدك خالص عادي برضه، يبقى مش شرط تبقى الرياضيات مجالك.. ممكن نفس الأفكار تطبق في أي مجال تاني يشدك! <br />ومش شرط لو قريت حاجة ومفهمتش أنك تسيب المقالة كلها، ممكن تبقى المقدمة مملة أو ملهاش علاقة بأهتماماتك، فممكن تسيب الجزء الممل وتقرا من الآخر، أنا بأعمل كدة كتير، والأسلوب ده بينفع جداً في الرياضيات لأن غالبا في المقدمة بيبقوا مخبيين حاجات عن القارئ، وبيبقى الجمال كله في الآخر فعلاً! <br />حاجة تانية مهمة.... متفكرش في اللي بتقراه أنه "رياضيات" أو "كيمياء" أو "فيزياء" أو "علم نفس" أو اي حاجة. التقسيم ده مصطنع، عشان المدارس والجامعات أضطروا يقسموهم بس مش أكتر لأسباب إدارية. العلم كله حاجة واحدة، وهدفه فهم الحياة والتفكير والإنسان، وإعمار الكون والتعرف على الخالق. وفي الواقع كل المجالات ديه مهما بُعدت فهي متصلة ببعضها البعض. مفيش فرع منعزل عن الباقي. مثلاً كنت بأقرا مقالة من اسبوع عن مزيج بين الهندسة التفاضلية (فرع من الرياضيات) وعلم التشريح (بتاع الطب ده)!!! أي حاجة تقراها فكر فيها كقطعة من العلم، مش مهم هي رياضيات ولا حاجة تانية، في الآخر أنت بتتعلم عن نفسك أكتر من عن الحاجة اللي بتقراها. القراءة لإرواء الفضول وإثراء التفكير، ملهاش علاقة بمجال معين. وده يعود بينا لنقطة قراءة اللي يشدك، كأن العلم بستان وبتقطف الزهور اللي عاجباك.</div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-80475655625621072892013-02-09T03:01:00.000+02:002013-02-09T03:46:37.645+02:00The future of C++, as I see it<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: arial; font-size: x-small;">The C++ syntax is too terse with no reason; very simple ideas which can be written down simply are forced to be put in an ugly and incomprehensible form. </span><br />
<div style="font-family: arial; font-size: small;">
<a href="http://cpp-next.com/archive/2011/12/a-breakthrough-for-concepts">Concepts</a> (a feature to be included in the next standard), is just a hack to put some meaningful compile-time type checking on templates, BEFORE they are instantiated.</div>
<div style="font-family: arial; font-size: small;">
The funny things is that they go again and introduce "late_check" to allow bypassing the "BEFORE" part and coming back to the original template type-checking "AT" instantiation. </div>
<div style="font-family: arial; font-size: small;">
Going back and forth, several times, just means they missed the target by a few centimeters (say, to the left) and need to "overshoot" to the other direction (the right) to hit the target. The problem is that they still miss it, again! So they overshoot to the left again! And so on. Even if they <i>eventually </i>converge (I doubt that), C++ will be overloaded with irrelevant historical hacks that no one knows why they were designed in this weird way.</div>
<div style="font-family: arial; font-size: small;">
One part of the problem is the unnecessarily terse syntax, but another part is also the perceived need to support legacy code. C++ will be much better if they stopped trying to be backwards compatible (the <a href="http://stackoverflow.com/questions/909610/experiences-with-d-programming-language">D language</a> tries to do this, but is not widely adopted yet). The way things are done currently, will turn C++ into a collection of ad-hoc hacks that need deep awareness of the historical reasons to understand: reasons which will not be relevant a few years later, if not already the case now. </div>
<div style="font-family: arial; font-size: small;">
People stick to C++ because of its pass-by-value semantics, const-correctness, compile-time generics, interoperability with C, and wide support, but they are going to abandon it to the next language with same features and better syntax and cleaner slate (with no historical burden). D turns out to be such a candidate (see a <a href="http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-than-d">comparison</a>).</div>
<div>
<br /></div>
<div style="font-family: arial; font-size: small;">
</div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-46745839995658899712012-10-17T07:09:00.002+02:002012-10-17T07:15:01.241+02:00الأرقام المركبة والكيان التجريدي للرياضيات<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
<br />
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 12.800000190734863px; line-height: 19px; text-align: start;">
السؤال بتاع هل الأرقام التخيلية موجودة حقاً سؤال محرج،ليس لأن ليس له إجابة ولكن لأن إجابته ستقتضي بأن يتم كشف حقيقة أن الرياضيات كيان تجريدي. الأرقام الحقيقية نعتبرها "موجودة" لأنها تعبر عن كميات فيزيائية، كالقياسيات (الطول وغيره). بينما الوحدة التخيلية ت لا تعبر "مباشرة" عن كمية يمكن قياسها، ولكنها مُعرفة بدقة ولها معنيين، أحدها تجريدي والآخر غير مباشر. أما المعنى التجريدي للتاء، فتخيل خط الأرقام، ولتحوّل رقم واحد لسالب واحد فإنك تقوم بتدويره في نصف دائرة مركزها الرقم صفر. لو توقفت في المنتصف فهذا هو الرقم ت: العملية اللتي إذا قمت بها مرتين حصلت على الرقم -1، وهي عملية التدوير ربع دائرة. المعنى الغير مباشر فهو أن الرقم ت يمثل دالة دورية مداها* واحد وطورها** تسعون درجة. في الواقع فإن الكيان التجريدي للرياضيات الحديثة لا يعتبر كثيراً بالمعنى ويهتم بالكيفية، فخصائص الأرقام المركبة مفيدة وجوهرية نظرياً وتطبيقيا. أكتشف علماء الرياضيات قيمة التخلي عن المعنى والتركيز على الكيفية منذ أقل من 500 عام وكان لذلك الأكتشاف أكبر الأثر في تطور الرياضيات والعلوم. للأسف لا يبدو أن فكرة التخلي عن المعنى هذه تروق لغير المتخصصين كما لم ترق للرياضيين في البداية. التخلي عن المعنى قفزة قد لا تبدو أنيقة ولكنها ضرورية.بالتالي الرياضيات الحديثة هي دراسة للكيانات التجريدية في حد ذاتها وليس للواقع الفيزيائي. ومما يستحق التدبّر هو أن تلك الكيانات التجريدية، حتى أسخفها وأبعدها عن الواقع ينتهي بعد 50 أو حتى 100 عام بتطبيق عملي في الفيزياء ! للرياضيات رونق داخلي ولكن كما أثبت التاريخ فهو ليس للأستمتاع فقط وإنما كوننا وحياتنا بها نفس الرونق الجمالي لسبب ما. هذا الترابط الغير متوقع بين الكيانات التجريدية وبين الكون والحياة يستحق التدبر في جمال خلق الله.</div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 12.800000190734863px; line-height: 19px; text-align: start;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 12.800000190734863px; line-height: 19px; text-align: start;">
* مدى = amplitude<br />** طور = phase<br />الوحدة التخيلية = i</div>
</div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-33455439953588775442012-09-04T19:38:00.001+02:002012-09-04T19:38:48.692+02:00مشكلة في توليد الأرقام العشوائية بالجافا<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="p1">
<span class="s1">for</span> (<span class="s1">int</span> i = 0; i < 1000; i ++ )</div>
<div class="p1">
{</div>
<div class="p1">
Random r = <span class="s1">new</span> Random(i);</div>
<div class="p1">
System.<span class="s2">out</span>.println(r.nextInt(8));</div>
<div class="p1">
}</div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com2tag:blogger.com,1999:blog-21894146.post-17702119279285068692012-08-16T15:26:00.001+02:002012-08-16T16:00:30.104+02:00تردد الحروف العربية<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
أستعملت ثلاثة مقالات، واحدة من ويكيبيديا وواحدة من الجزيرة وواحدة من الأهرام، بمجموع حوالي 22 ألف حرف عربي، لحساب التردد النسبي للحروف العربية. هذا التقدير تقريبي وغير صالح لأي أستخدام علمي، وإنما هو مجرد إشارة.</div>
<div dir="rtl" style="text-align: right;">
</div>
<div dir="rtl" style="text-align: right;">
<table style="background-color: white; color: #222222; margin: 5px 10px 10px 66px; padding: 8px;"><tbody>
<tr style="vertical-align: baseline;"><td style="font-family: arial, sans-serif; margin: 0px; text-align: right;"><table class="Output" style="color: black; font-family: Times; font-size: 12px; margin: 5px 10px 10px 66px; padding: 8px;"><tbody>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">{ا,إ,أ,آ,ى}→0.181314</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ل→0.109845</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">{ي,ئ}→0.0855272</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">{ت,ة}→0.0805501</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">م→0.0645274</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ر→0.0538747</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">{و,ؤ}→0.0534381</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ن→0.0475879</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">د→0.0366732</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ب→0.0361493</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ع→0.0327876</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">س→0.0265881</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ق→0.0223969</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ف→0.0222659</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ح→0.0212181</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ه→0.0188605</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ك→0.0178127</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ص→0.0142327</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">{ج,چ}→0.0137088</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ش→0.0109146</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">خ→0.00912465</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ث→0.00873172</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ط→0.00868806</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ز→0.00563196</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ض→0.00554464</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ذ→0.00497708</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ظ→0.00340537</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">غ→0.00336171</span></td></tr>
</tbody></table>
<div style="border-color: rgb(153, 153, 153); border-style: solid none none; border-width: 1px; color: black; font-family: Helvetica; font-size: 11px; margin-top: 20px; padding-top: 2px; text-align: -webkit-auto; width: 1585px;">
<a href="http://www.wolfram.com/products/mathematica/" style="color: black; text-decoration: none;"><span style="font-size: small;"><img alt="Spikey" height="21" src="HTMLFiles/spikeyIcon.png" style="border: 0px solid white; padding-right: 2px; vertical-align: middle;" width="20" /> <span style="color: #555555;">Created with</span> Wolfram <span style="font-style: italic;">Mathematica</span> 8.0</span></a><br />
<span style="font-size: small;"><br /></span>
<span style="font-size: small;"><br /></span>
<span style="font-size: small;">ثم نزلت القرآن من موقع تنزيل.نت وحسبت تردد الحروف فوجدت الآتي:</span><br />
<table class="Output" style="color: black; font-family: Times; font-size: 12px; margin: 5px 10px 10px 66px; padding: 8px;"><tbody>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">إاىآأ</span></td><td style="text-align: left;"><span style="font-size: small;">0.186902</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ل</span></td><td style="text-align: left;"><span style="font-size: small;">0.11609</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ن</span></td><td style="text-align: left;"><span style="font-size: small;">0.0822685</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">م</span></td><td style="text-align: left;"><span style="font-size: small;">0.0813341</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ؤو</span></td><td style="text-align: left;"><span style="font-size: small;">0.076572</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ئي</span></td><td style="text-align: left;"><span style="font-size: small;">0.0699051</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ه</span></td><td style="text-align: left;"><span style="font-size: small;">0.0449529</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ةت</span></td><td style="text-align: left;"><span style="font-size: small;">0.0386495</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ر</span></td><td style="text-align: left;"><span style="font-size: small;">0.0379375</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ب</span></td><td style="text-align: left;"><span style="font-size: small;">0.0348609</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ك</span></td><td style="text-align: left;"><span style="font-size: small;">0.031538</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ع</span></td><td style="text-align: left;"><span style="font-size: small;">0.0282571</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ف</span></td><td style="text-align: left;"><span style="font-size: small;">0.0262801</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ق</span></td><td style="text-align: left;"><span style="font-size: small;">0.0211335</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">س</span></td><td style="text-align: left;"><span style="font-size: small;">0.0183994</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">د</span></td><td style="text-align: left;"><span style="font-size: small;">0.0179998</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ذ</span></td><td style="text-align: left;"><span style="font-size: small;">0.0148181</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ح</span></td><td style="text-align: left;"><span style="font-size: small;">0.0131115</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ج</span></td><td style="text-align: left;"><span style="font-size: small;">0.00996584</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">خ</span></td><td style="text-align: left;"><span style="font-size: small;">0.00750217</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ش</span></td><td style="text-align: left;"><span style="font-size: small;">0.0063815</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ص</span></td><td style="text-align: left;"><span style="font-size: small;">0.00622527</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ض</span></td><td style="text-align: left;"><span style="font-size: small;">0.00506554</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ز</span></td><td style="text-align: left;"><span style="font-size: small;">0.00480415</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ء</span></td><td style="text-align: left;"><span style="font-size: small;">0.00474106</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ث</span></td><td style="text-align: left;"><span style="font-size: small;">0.00424833</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ط</span></td><td style="text-align: left;"><span style="font-size: small;">0.00382469</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">غ</span></td><td style="text-align: left;"><span style="font-size: small;">0.00366846</span></td></tr>
<tr style="vertical-align: baseline;"><td style="text-align: left;"><span style="font-size: small;">ظ</span></td><td style="text-align: left;"><span style="font-size: small;">0.00256282<br /></span></td></tr>
</tbody></table>
</div>
</td><td style="font-family: arial, sans-serif; margin: 0px; text-align: right;">چ</td></tr>
</tbody></table>
</div>
</div>
Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-34814450744393339952012-06-13T13:59:00.002+02:002012-06-13T20:08:48.002+02:00On Numbers - Abstract Algebra - Imaginary Numbers<div dir="ltr" style="text-align: left;" trbidi="on">
While reading in the magnificent book "<a href="http://press.princeton.edu/titles/8350.html">Princeton Companion to Mathematics</a>" I tend to ponder on the ideas lurking within. I was reading about solving polynomial equations (I.4 §1.2) and the author introduced square root of two in a rather intriguing way. What caught my attention is not only that we needed to prove that it exists (by the intermediate value theorem), but also that it is defined by the sole property that is the number that squares to two (if it exists) and cannot be defined by other means. He intended to highlight that numbers (or solutions) are opaque and all we care about are their properties. More on that in the next paragraph.<br />
<br />
Extrapolating on this line of thought, I ended up thinking about the fraction 2/3. It is, in fact, <i>defined </i>to be the number that, when multiplied by 3, gives you 2. That number doesn't exist in the set of integers, much as the same way square root of two doesn't exist in the set of rational numbers. Now think about the number 4/6. It is the number that when multiplied by 6 gives you 4. Although it might look intuitive to someone who went through elementary education, it is still an interesting thing to highlight: it turns out that both numbers, 4/6 and 2/3, are in fact the <i>same number</i>. What we have just stated in the last sentence is a <i>property </i>of both numbers, both of which being solutions to 3<i>x</i> = 2 and 6<i>x</i> = 4, respectively. But behind that, it is actually a property of the <i>solution</i> of the two equations. It shows that their solutions are the <i>same number</i>, even though these solutions (2/3 and 4/6) might look <i>syntactically</i> different. Put in more accurate words: they <i>define </i>the same number.<br />
<br />
What is intriguing about this is that the number <i>i </i>(the square root of negative one) is no more artificial than √2. It is just a number, that similarly to √2, which does not exist in the set of rational numbers, is a number that doesn't exist in the set of real numbers. Moreover, as being the square root of two (and nothing more) is the <i>defining property</i> of √2, and as being the number that multiplied by 3<i>n</i> gives 2<i>n</i> (for positive integer <i>n</i>) is the <i>defining property</i> of the number 2/3, so is being the square root of negative one is the defining property of <i>i. </i>All further properties could be derived from this property alone. This process is abstract in nature; we may not know what the square root of two is. For instance, did you even need to know that √2 = 1.414... in order to perform calculations in high school ? No. All you did need to know was that it squared to two. Quick, what is the solution to 3 + √341 <i>x </i>= 344 ? Simply enough, it is <i>x </i>= √341. Did you need to know the value of √341 to do that ? (I hope not!) Actually, if you've dealt with the value instead, things would have been more confusing and uglier.<br />
<br />
The study of this kind of properties of numbers which are defined this way is heart to Abstract Algebra. In fact this is exactly why it is called "Abstract" and "Algebra". Abstract Algebra may look like this: if we take the field Q (the field of all rationals) and adjoin the number √2 to it (in a process called "field extension"), we end up with the new field Q(√2) which have different structure, fully determined by the properties of √2.</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com2tag:blogger.com,1999:blog-21894146.post-13284260397697817822012-05-20T18:03:00.000+02:002012-05-21T06:49:11.036+02:00"أنتخب أبو الفتوح لأنه صاحب أقوى فرصه في النجاح" - مثال فعلي على التلاعب الإستراتيجي بالأنتخابات<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
</div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); font-family: arial, sans-serif; text-align: -webkit-auto;">
<span style="color: #666666;">توضيح: تفادي تفتيت الأصوات غرض مشروع وأتفق معه، ولكن للإتفاق على الأفضل، وليس على الأكثر شعبية.</span></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); font-family: arial, sans-serif; text-align: -webkit-auto;">
<span style="color: #666666;">توضيح2: أستخدم لفظ "التلاعب بالأنتخابات" وليس "التلاعب بالمنتخبين"، لأنه حتى وإن كان من يقوم بذلك يقوم به عن أقتناع ودون إيحاء أو توجيه من أحد فهو مازال تلاعباً بالنظام الأنتخابي.</span></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); font-family: arial, sans-serif; text-align: -webkit-auto;">
<span style="color: #666666;">توضيح3: لفظ "تلاعب" مقصود به التحايل على المقصود من النظام، حتى وإن كان عن حسن نية. المقصود من نظام الأنتخابات أن يصوت كل فرد بما يراه الأنسب والأفضل، وليس بما يراه الأكثر شعبية.</span></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
بسم الله الرحمن الرحيم</div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
كان أحدهم يشجع الناس على عدم التصويت لصباحي والتصويت لأبو الفتوح بأستعمال جمل على شاكلة:</div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<blockquote class="gmail_quote" dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; color: #222222; font-family: arial, sans-serif; margin: 0px 0.8ex; padding-left: 1ex; padding-right: 1ex; text-align: -webkit-auto;">
“إنت متخيل إن عندك رفاهية الاختيار لكن الحقيقة إنك بإختيارك لحمدين هيخليك تختار يا مرسي "مجبرا" يا فلول "ودي وحشة في حقك قوي" ففكر بعقلك”</blockquote>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
فكان ردي عليه الآتي:</div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<blockquote class="gmail_quote" dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; color: #222222; font-family: arial, sans-serif; margin: 0px 0.8ex; padding-left: 1ex; padding-right: 1ex; text-align: -webkit-auto;">
“ما تفعله الآن هو أنك تتعامل مع الأنتخابات إستراتيجياً وهو شئ سئ يهدف مجال تصميم الآليات لجعله مستحيلاً أو صعباً. الهدف من تصميم الآليات هو تصميم آلية (أنتخابية أو غير ذلك) تجبر الناس أن يدلوا بتفضيلهم الحقيقي، بدلاً من تصويتهم إستراتيجياً. شوف المقالة ديه مثلا <a href="http://t.co/uPjBnsS8" style="color: #1155cc;" target="_blank">http://t.co/uPjBnsS8</a> .المشكلة في كدة أن المرشح اللي ينجح أنصاره في أقناع الأغلبية أن "الأغلبية وراه" هو اللي حيكسب بغض النظر الأغلبية وراه فعلاً ولا لأ !!</blockquote>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
<br /></div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
عادة التفكير الإستراتيجي حاجة حلوة، بس في الأنتخابات بالذات حاجة وحشة :) أو للتوضيح لكي لا يلتبس الأمر: فكر وخطط إستراتيجياً في المرشح اللذي تراه الأفضل، ولكن لا تخطط أستراتيجاً في التلاعب بنظام التصويت <b>ذات نفسه</b>، حتى لو كان الخِصْم يتلاعب به وما تفعله مجرد رد على كيده. ليه؟ لأنه الأنتخابات لعبة عمياء (simultaneous game)، حيث لا يعرف اللاعبون (أنت وخصومك) لعبة الفريق الآخر إلا بعد النتيجة النهائية، وبعد أن يكونوا قد أختاروا ونفذوا أستراتيجيتهم. يعني أيه؟ يعني ممكن الخصم يتلاعب بيك أنت شخصياً ويوهمك بأنه حيعمل حاجة (وميعملهاش) لمجرد أنه يدفعك أنك تعمل اللي هو عاوزه بدل اللي أنت عاوزه، يبقى كدة تلاعب بيك. (اللي هو بنظام: أنا اشتريت العربية ديه عشان حماتي بتكرهها، حتى لو العربية نفسها مش عاجباني (وممكن تطلع حماتي اوهمتني بكدة وهي فعلا العربية عاجباها!) -- وهذا نظام خطأ لأننا يجب أن نقوم بالاشياء (أي اشياء) لقيمتها لدينا نحن بمعزل عن رأي الآخرين فيها)</div>
<div dir="rtl" style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto;">
قابلة نظم التصويت للتلاعب عيب من عيوبها، ونظرية "<a href="http://en.wikipedia.org/wiki/Arrow's_impossibility_theorem" style="color: #1155cc;" target="_blank">آرو</a>" تقول أنه من المستحيل تصميم نظام لا يعاني منها (بصورة مطلقة). ولكن هذا لا يعني أنه لا يمكن تصميم نظام يكون التلاعب به مستحيل "<a href="http://cacm.acm.org/magazines/2010/11/100640-using-complexity-to-protect-elections/fulltext" style="color: #1155cc;" target="_blank">حسابياً</a>" - أي أنه ليس لأحد من الاطراف القدرة الحسابية (الوقت الكافي) لحساب استراتيجيته قبل بدء التصويت. <br />
<br />
تحديث:<br />
تغريدة وجدتها على تويتر مؤخراً:<br />
<br />
<br />
<table><tbody>
<tr><td height="52" width="52"><br /></td><td><b><br /></b>MT @DinaDwidar أرجع و أقول أنا هنتخب #خالد_على مش عشان هيكسب . . أنا هنتخبة عشان يكسب<br /><a href="https://twitter.com/m_aggan/status/204432573726859265">21/05/12 06:44</a></td></tr>
</tbody></table>
<br />
<br /></div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-29209148786380188612012-05-09T16:33:00.000+02:002012-05-09T16:33:35.293+02:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" dir="rtl" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2vdsDrEvGVRj1HTbOZmMBWASBIFktCyXubujueErcmh0qfmbq6zgdPc_8ob5KP7gQp7n8lFec6VTDRt6PyEd4UKH4XBObr3a1aoRfkhgQip_idlrNWEkdQzYxHQfqc3eZ3jO2/s1600/%E2%80%8F%D9%84%D9%82%D8%B7%D8%A9+%D8%A7%D9%84%D8%B4%D8%A7%D8%B4%D8%A9+2012-05-09+%D9%81%D9%8A+16%E2%80%8E.31%E2%80%8E.08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2vdsDrEvGVRj1HTbOZmMBWASBIFktCyXubujueErcmh0qfmbq6zgdPc_8ob5KP7gQp7n8lFec6VTDRt6PyEd4UKH4XBObr3a1aoRfkhgQip_idlrNWEkdQzYxHQfqc3eZ3jO2/s320/%E2%80%8F%D9%84%D9%82%D8%B7%D8%A9+%D8%A7%D9%84%D8%B4%D8%A7%D8%B4%D8%A9+2012-05-09+%D9%81%D9%8A+16%E2%80%8E.31%E2%80%8E.08.png" width="320" /></a></div>
<div dir="rtl" style="text-align: right;">
تذكرت برنامج للعب الشطرنج رأيته منذ عدة سنوات على الأنترنت وكان يرسم خطوط تعبر عن المسارات اللتي أحتسبتها الخوارزمية بشكل منحنيات برتقالية اللون.</div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-73148487640099862732012-04-15T20:11:00.003+02:002012-04-15T20:11:56.732+02:00Decision making process and psychology<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://www.nytimes.com/2002/10/10/business/a-nobel-that-bridges-economics-and-psychology.html?pagewanted=2&src=pm" style="background-color: rgba(255, 255, 255, 0.917969); color: #1155cc; font-family: arial, sans-serif; font-size: 16px; text-align: -webkit-auto;" target="_blank">This</a><span style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 16px; text-align: -webkit-auto;"> is very interesting:</span><br />
<div style="background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 16px; text-align: -webkit-auto;">
<br /></div>
<div style="background-color: rgba(255, 255, 255, 0.917969); text-align: -webkit-auto;">
<div style="border: 0px; margin: 0px 0px 10px; padding: 0px; width: 640px;">
<blockquote class="tr_bq">
In a 1981 article, they reported results of a study in which 152 students were given hypothetical choices for trying to save 600 people from a disease. Using one strategy, exactly 200 people could be saved for certain. Using another, there would be a one-third chance everyone would live, and a two-thirds chance no one would be saved. Seventy-two percent of the subjects, preferring the less risky strategy, chose the first option. But when the researchers presented 155 other students with the same choice worded differently -- either 400 people would die for sure or there would be a one-third chance that no one would die -- only 22 percent chose the first option.</blockquote>
<blockquote class="tr_bq">
Daniel Kahneman, a professor of psychology and public affairs at Princeton University, who is also a citizen of Israel, and Vernon L. Smith, a professor of economics and law at George Mason University in Fairfax, Va., shared the Nobel prize in economics in 2002.</blockquote>
</div>
</div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-771372635104286852012-04-01T14:15:00.002+02:002012-04-01T14:27:52.664+02:00أعيدوا التفكير<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
لما عضو هيئة التدريس في جامعة حكومية بيسافر برة مصر بغرض دراسة الماجستير أو الدكتوراة (حتى لو على حسابه والدولة مش دافعة حاجة) بيبقى من حقه ياخد أجازة "دراسية" بمرتب، بدلاً من أجازة "خاصة" بدون مرتب. السؤال الأزلي: هل حياخد المرتب ده لعدد 5 أو 6 سنين حتى يُنهي دراسته وبعد كدة ميرجعش مصر؟ طب الفلوس ديه حتبقى ضاعت كدة على مصر؟ الحل الأزلي برضه أن الحكومة تعقد إجراءات أي حاجة فيها فلوس.</div>
<div dir="rtl" style="text-align: right;">
مبدأيا لازم العضو يثبت دخله بالخارج قد ايه بالضبط، ولازم يجيب حد من قرايبه لحد الدرجة الرابعة (الأب والأم درجة أولى، الأخوة درجة تانية، الأعمام والأخوال درجة ثالثة، أبناء الأعمام والأخوال درجة رابعة!) عشان يمضي تعهد مالي بأن لو العضو ده مرجعش هو حيرجع الفلوس. </div>
<div dir="rtl" style="text-align: right;">
في إجراءات كتير تانية، ويكفي أنك تعرف أني قعدت سنتين في الإجراءات ديه وكل مرة أرجع أجازة أكتشف أن الأجراءات واقفة لسبب عجيب مكنتش أعرفه. لحد ما قرفت وقدمت على أجازة خاصة بدون مرتب "مش عاوز منكوا حاجة". وعلى فكرة محدش منهم قالي أنه ممكن أقدم على أجازة خاصة رغم أني سألتهم، وعرفتها بالصدفة من عضو هيئة تدريس تاني، لولا الصدفة ديه ورق الأجازة الدراسية كان واقف ومكانش في حل غير أني أترفد! وحتى لما قلت للموظفة على حل الأجازة الخاصة قعدت تعقدلي في الموضوع وتقولي مش حينفع، ولولا أن عضو هيئة التدريس التاني ده كان خدها فعلاً وقولتلها كدة مكانش الموضوع حيمشي! (مش فاهمهم هو عاوزين أيه يعني !!)</div>
<div dir="rtl" style="text-align: right;">
المهم عاوز أتكلم في نقطة مهمة جداً. الإجراءات ديه معقدة وبتطفش العقول المصرية وتدفعهم للهجرة، يعني لو في باحث كويس يقدر يشتغل برة حيسيب البلد، واللي حيفضل في البلد ويمشي في الإجراءات ديه واحد من أتنين: يا أما باحث كويس وفعلاً يهمه البلد أكتر من نفسه، يا أما باحث مش كويس بدليل أنه مش عارف يجيب أي شغلانة تانية برة وأمله الوحيد في أكل العيش هو أنه يمشي في الأجراءات ديه. الباحثين اللي من النوع الأول قليلين جداً فالمعظم من النوع التاني. يعني النظام مُجهز بحيث أن الكويسين يطفشوا والمش كويسين يفضلوا. ديه نقطة سلبية. بس طبيعي أي نظام له سلبياته وإيجابياته اللي بيتم المفاضلة بينهم، إيجابية النظام ده أنه مش حيخلي حد يسرق البلد وياخد مرتب 6 سنين وميرجعش. المشكلة بس أن مرتب 6 سنين اللي حيهرب بيه ده ميجيش 28 الف جنيه (تمانية وعشرين ألف جنيه) بس. رقم مش كبير؛ يعني لو سهلت الإجراءات ويسرت على المسافرين يتعلموا دول، في نسبة منهم حترجع لأن الإجراءات يسيرة، وفي نسبة (فاقد) مش حترجع. خسرت شوية فلوس (طز) بس المهم كسبت شوية عقول قاعدة معاك 40 سنة قدام تعلم وتعمل أبحاث.</div>
<div dir="rtl" style="text-align: right;">
هل فعلاً المبلغ الزهيد ده أهم من رجوع العقول المصرية؟ اللي بيحصل أنه في الحكومة مينفعش يبقى في فاقد، وأي مبلغ ضايع لازم يرجع وإلا يبقى في فساد بيحصل من تحت لتحت. يعني لو قريب العضو اللي مرجعش ده مدفعش المبلغ اللي اتصرف عليه، يبقى الموظف المسئول هو اللي حيتحاسب ويتبهدل. يعني خوفاً من الفساد المالي تم تطفيش معظم العقول المصرية. بس هل ده فعلاً خلانا حكومتنا طاهرة نقية؟ مظنش... أمال أيه الحل؟</div>
<div dir="rtl" style="text-align: right;">
في رأيي أنه الأفضل هو السماح بالفساد، في 5 حيسرقوا، بس في المقابل في 50 عالم مصري حيلاقوا الإجراءات سهلة ويرجعوا. المفاضلة هنا ما بين أهمية الـfalse-positive والـfalse-negative. هل الأهم نمسك كل فاسد ونطفش العلماء البريئين ولا الأهم منطفشّ العلماء البريئين في مقابل إن في كام فاسد حينجح في سرقة (28 ألف جنيه على كل عالم يهرب!)... </div>
<div dir="rtl" style="text-align: right;">
<br /></div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-10300818482634259232012-03-14T01:58:00.001+02:002012-03-14T01:58:14.353+02:00Why use lemmas and sublemmas?<div dir="ltr" style="text-align: left;" trbidi="on">
<b id="internal-source-marker_0.05342647526413202" style="text-align: -webkit-auto;"><span style="font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Copying from : </span><a href="http://gowers.wordpress.com/2011/10/07/basic-logic-tips-for-handling-variables/#comment-12274"><span style="color: #000099; font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">http://gowers.wordpress.com/2011/10/07/basic-logic-tips-for-handling-variables/#comment-12274</span></a><span style="font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> by Terrance Tao</span><br /><span style="font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: #f8f8f8; color: #333333; font-family: Verdana; font-size: 11px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">This is one reason why it is good, when writing a lengthy argument, to encapsulate parts of the argument into lemmas and sublemmas, so that variables that are created for the sole purpose of proving one of these lemmas are automatically removed from the scene by the end-of-proof symbol, thus reducing clutter in the ambient “namespace”. (This is also why it is bad form to “reach into” the proof of such a lemma and use statements that involve variables whose scope is limited to that proof, to assist an argument outside of that proof.)</span></b></div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-84465421498592957642012-03-08T18:42:00.001+02:002012-03-08T18:42:26.882+02:00Leaky Bucket and Token Bucket<div dir="ltr" style="text-align: left;" trbidi="on">
Just a quick note to self. Both are used for traffic policing (shaping), even in a simulated setting.<br />
The main difference is that the Token Bucket allows bursts, while Leaky bucket doesn't. </div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-16063839202666046522012-03-01T01:32:00.002+02:002012-03-01T01:34:37.487+02:00مقالة قديمة<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
كنت أقلب أوراق دروس الفرنسية القديمة اليوم، ووجدت فيهم مقالة قديمة مكتوبة بخط اليد (بالعربية) وهذه التدوينة تنقلها هنا (بدون تنقيح لغوي). لا تنسوني من دعائكم.</div>
<div dir="rtl" style="text-align: right;">
<br /></div>
<blockquote class="tr_bq " dir="rtl" style="text-align: right;">
نحن أمة لم نوجد للهو بل وجدنا للعمل وإعمار الأرض. لم يمنعنا الله من وسائل اللهو المشروعة ولكن ليس هدف وجودنا على قيد الحياة هو أن نلهو. معنى ذلك أننا لا نذهب إلى العمل من أجل إحراز المال لننفقه على اللهو والراحة، بل أننا نعمل لنعمر الأرض ونطيع الله ونستعين بأرزاقنا على نفقات الحياة من مأكل ومشرب ونتصدق منه وندفع الزكاة. فنحن نُسأل عن مالنا من أين أكتسبناه وفيم أنفقناه ونُسأل أيضاً عن شبابنا فيم أفنيناه. فإن كنا أفنيناه لجمع المال للهو والنزهة والترف وما إلى ذلك حتى وإن كان من المتع الحلال فإنه لن يضيف إلى ميزانك إلا طول الحساب لأن من كثر ماله طال حسابه. وإن كان من أجل الله والعمل والأستعانة على ظروف الحياة والتصدق بارك الله فيه وزادك منه وأصبح معونة لك على دنياك ودين لك في آخرتك. فأتقوا الله وأتقنوا العمل ولا يكونن هدفكم لهو مؤقت في الحياة الدنيا فإن ما عندكم فان وما عند الله باق فأتقوا الله العظيم ينصركم وأستغفروه يغفر لكم.</blockquote>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-19864857579263189102012-02-13T09:46:00.000+02:002012-02-13T12:43:38.782+02:00العصيان المدني الغير معلن في مصر<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: right;">
نشأت على رؤية كل محاولة نظامية للإصلاح تفشل، وأي محاولة رقابية تفشل، وأي محاولة لفرض أي النظام تفشل. وعلينا التدبر في ذلك. أي نظام ما هو إلا عبارة عن مجموعة أفعال تقود لمجموعة نتائج. الرقابة تؤكد على حصول النتائج، ولكن لا تؤكد على حصول الأفعال؛ ذلك بأنه الأفعال «غير منظورة» والنتائج «منظورة». وقد تكون النتائج صورة سطحية تخبئ في طياتها الغير منظورة العديد من التقصيرات.كمثال عرض تخرج دفعة الظباط الأحتياط هو تمثيلية لا تعكس كفاءتهم؛ عارضي الكاراتيه لم يتدربوا على سواه، ولم يعرف عن الكاراتيه حرف ممن لم يعرضوه. ونفس المشكلة موجودة حتى في نظم الأمتحانات الدراسية فهي ليست بالضرورة عادلة، قد لا تعطي صاحب الحق حقه وقد تعطي فاقد الحق ما ليس له حق فيه، وقد تخصص بعض الطلبة «المتفوقين» إسما، في تقويض نظام التقييم ذلك، بأساليب ليس من ضمنها التعلم بأي مفهوم له، وليس بالضرورة أساليب غير قانونية كالغش. نقطتي هي أنه في أي نظام فيه عامل بشري، لا فكاك من الأعتماد على الضمير البشري، لأن الإنسان فاقد الضمير، مازال لديه العقل ليخدع به نظم التقييم، وفعليا لا بد من الأعتراف بأنه من المستحيل أبدا توظيف البشر كآلات وإجبارهم على العمل كما يجب وهم كارهون، مهما تشددت نظم الرقابة، بل على العكس، فسيتفننون في خداعها. وذلك الخداع ليس بالضرورة عن سوء نية، ولا حتى عن وعي، ولكن قد يكون بسبب فقدان النظام القائم للشرعية، مما يقود للـ «العناد»، كنوع من العصيان المدني الغير معلن. وكمثال ملموس: لماذا رفض كثير من الناس ربط حزام الأمان في سياراتهم عندما تم إقرار القانون؟ أليس عناداً في المشرع؟ ألم تر بنفسك كيف يربطونه قبل اللجنة بعدة أمتار ثم يفكونه بعدها بعدة أمتار، وهم في نشوة كأنهم أثبتوا لأنفسهم أنه نظام فاشل ونجحوا في خداعه؟ وفي هذا السياق أعتبر مصر فعليا في حالة عصيان مدني غير معلن منذ عقدين على الأقل، وهذا يفسر تردي حالة التعليم والصناعة والأقتصاد. فلتنظر كيف يتفنن الموظف في الإمضاء في كشف الحضور والأنصراف (المنظور) ثم تعذيب المواطنين فيما بينهما (الغير منظور)؟ أو كيف يتفنن مدرس الجامعة في الضغط (غير منظور) على طلبته لينشروا أبحاثهم بأسمه زوراً (منظور)؟ تلك الأزواجية تسببت في تراكم طبقة من النفاق في نفس المواطنين تدخلت -للأسف- حتى في حياتهم الشخصية، فأصبحوا يركزون على المظاهر وما سيقوله فلان وعلان عنهم، عوضا الأهتمام بجوهرهم، ولا حتى بأصهارهم. وتسبب أيضا في تفشي ظواهر أخرى عديدة في المجتمع منها ظاهرة «أنا ومن بعدي الطوفان»، حيث تمحور أهتمام الفرد (أو بالأحرى تم تدريبه لا شعورياً) في النجاة بنفسه وذويه في خضام ذلك النظام الغير عادل. وكلمة العدالة هنا تثير نقطة هامة جدا، فلا يذكر العدل إلا ويذكر معه القضاء. وأقول لكم النصيحة الآتية بكل إخلاص: النظر في المرأة ثلاث مرات كل يوم والتكرار «قضاء مصر شامخ» لا تجعل الجملة صحيحة بالضرورة وسأقول لك دليلاً واحداً: بصفتك مصرياً تقرأ هذه المقالة فأنت تستخدم أحد مقدمي خدمة الأنترنت المصريين، بما فيهم واحداً معيناً يقدم خدمة سيئة للغاية على عكس ما تم الأتفاق عليه، لو كنت تظن قضاء مصر شامخاً فعلا فلتقدم فيه دعوى قضائية بمخالفة العقد والمطالبة بالتعويض وسأكون سعيداً للغاية لو نجحت، خصوصاً لو نجحت في أدنى من سنتين! ليس فقط المشكلة في بطء العدالة (إن كانت صحيحة) ولكن أيضا في تطبيقها، فكم من قرار صحيح لم يتم تطبيقه! التطبيق جزء لا يتجزأ من العدالة، وبدون عدالة لا يأمن الإنسان على نفسه، وبدون أن يأمن الإنسان على نفسه لن يحرص على غيره، ولو لم يحرص على غيره قد لا يرضي ضميره في عمله، وبما أنه يعلم يقينا أن نظام العدالة لا يعطي أحداً حقه فهو يعلم أنه قادر على خداع نظام التقييم (المُعبر عن العدالة بصورة أخرى).<br />
<br />
فكرة المقالة نشأت من عدة تغريدات لي على تويتر.</div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-28597563846841732302012-01-31T01:03:00.003+02:002012-01-31T01:03:57.338+02:0011 Bitcoins = 1 $ !!<div dir="ltr" style="text-align: left;" trbidi="on">
By pure coincidence as I was running through the list of stack exchange sites I found a site called <a href="http://bitcoin.stackexchange.com/" target="_blank">Bitcoin</a>.
I didn't understand what was it at first but when I looked it up in
wikipedia it turned out to be an e-cash P2P system. Wikileaks, freenet,
and another company already use it for reception of donations and for
investments according to <a href="http://en.wikipedia.org/wiki/Bitcoin#Adoption" target="_blank">wikipedia</a>. It even has an <a href="http://www.wolframalpha.com/input/?i=bitcoin" target="_blank">exchange rate</a> to US dollars. The original paper is <a href="http://bitcoin.org/bitcoin.pdf" target="_blank">http://bitcoin.org/bitcoin.pdf</a> and there are other more recent papers. <br />
#WOW</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-72459304581084322052012-01-20T23:49:00.000+02:002012-01-20T23:51:31.989+02:00Proof that np=mq and mn>0 implies pq>0<div dir="ltr" style="text-align: left;" trbidi="on">
Implicit assumptions: q != 0 (p/q is a rational number).<br />
<br />
This is a proof that mn>0 as a definition that a rational number m/n is "positive" is a well-defined with respect to equivalence classes of rational numbers. I.e. if p/q is in the same equivalence class of m/n (i.e. np=mq) and m/n is positive (mn>0) then p/q is also positive (pq>0).<br />
<br />
<br />
First, np=mq => np-mq=0, but since mn>0 (neither m nor n is zero), and that q!=0 (by definition), then p!=0. So one of pq<0 or pq>0 is true. Assume the former towards a contradiction. First let p>0 and q<0 and let q=-q' where q' is positive. Then 0=np-mq=np+mq', but all of these are positive, so they cannot equal zero: contradiction. Same argument for p<0 and q>0, we end up with 0=-np'-mq, but the right hand side is negative: contradiction. So pq<0 cannot be true, therefore pq>0.</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0tag:blogger.com,1999:blog-21894146.post-56204190835193493142011-11-16T23:20:00.001+02:002011-11-16T23:45:13.777+02:00مصارعة الثيران<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="rtl" style="text-align: justify;">
لو أتفرجت قبل كدة على مصارعة التيران حتلاقي حاجة مثيرة للأهتمام، المصارع مش عاوز التور يضربه، فبيهز الوشاح الأحمر بحيث التور يهاجم الوشاح مش المصارع، والمصارع بيبقى حاطط الوشاح بطريقة أنه لو التور ضرب الوشاح مش حتيجي الضربة في المصارع. وده هدفه الأصلي، لأن التور كدة كدة حيضرب حاجة، فتيجي في الوشاح أحسن ما تيجي فيه هو.</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
نفس الفكرة ديه بتفكرني بحاجات بتحصل اليومين دول. تخيلوا أن المصارع هو "نقل السلطة في ابريل 2012 مش في 2013" وأن الوشاح هو "وثيقة السلمي الحاكمة للدستور". اللي حط الوثيقة ديه مش ساذج عشان يستفز الناس بوضوح النوايا اللي تسمح للجيش بالحصول على مزايا مش من حقه. لكن حاول تحط نفسك مكانهم وشوف التفكير بيمشي أزاي:</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
أ- شوف يا برنس، احنا حنحط وثيقة فيها مزايا جامدة لينا<br />ب- بس كدة الشعب حيزعل مننا</div>
<div dir="rtl" style="text-align: justify;">
أ- مهو بص هو احتمال من أتنين، يا أما الشعب حيزعل يا أما حيعديها، لو عداها يبقى قشطة</div>
<div dir="rtl" style="text-align: justify;">
ب- ولو زعل ؟</div>
<div dir="rtl" style="text-align: justify;">
أ- لو زعل يبقى حنخيرهم يا أما يحشدوا عشان نقل السلطة، يا أما عشان الوثيقة</div>
<div dir="rtl" style="text-align: justify;">
ب- أزاي ؟</div>
<div dir="rtl" style="text-align: justify;">
أ- بسيطة، لو حشدوا عشان نقل السلطة لأنها أهم من الوثيقة يبقى الوثيقة ممكن تعدي من غير حشد أوي</div>
<div dir="rtl" style="text-align: justify;">
ب- طب ولو العكس ؟</div>
<div dir="rtl" style="text-align: justify;">
أ- لو العكس يبقى خلاص نتنازل عن شوية مزايا من المزايا الجامدة اللي كدة كدة كنا عارفين اننا مش حناخدها والشعب حينام مبسوط فاكر أنه ضرب المصارع بس هو ضرب الوشاح بس</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
نفس الأسلوب ده بيتكرر في حاجات تانية، بس لو ركزت وفكرت فيهم. يعني مثلا في موضوع قضية الفلول، اللي حصل انه تم تخييرنا بين (1) تطبيق الحكم والتخلص من الفلول بس تأجيل الانتخابات أو (2) نمشي الأنتخابات حتى لو فيها فلول بسس متتأجلش. وكدة برضه عمل اللي هو عاوزة، ومش بس كدة، لأ كمان بقى أسمه طلع الحكم اللي كان مطلوب منه بعزل الفلول بس أحنا اللي رفضنا نطبقه... </div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
الفكرة العامة هي أنك تخير الشعب بين خيارين، والأتنين في مصلحتك في الآخر، وده ممكن لسببين، والسببين <span class="Apple-style-span" style="text-align: left;">الوقت عامل حاسم فيهم</span></div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
1- الاختيارين وحشين جدا، والشعب رافض الأتنين، بس مش حيقدر يحشد ضد الاتنين في نفس الجمعة، وعلى ما تيجي الجمعة اللي بعدها يبقى الموضوع أمر واقع وتبات نار تصبح رماد.</div>
<div dir="rtl" style="text-align: justify;">
2- يا أما برضه حطيت الشعب قدام الأمر الواقع والشعب عارف أنه لازم يختار واحده، دبسته يعني خلاص وسبق السيف العزل، بس الشعب مش عارف يختار مين، فبرضه مش حيقدر يحشد.</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
السبب الأول شايفينه في موضوع وثيقة السلمي، والسبب الثاني في موضوع قضية الفلول. وفي أمثلة تانية لو دورت.</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
<div dir="rtl" style="text-align: justify;">
وفي مشكلة أساسية، المجلس جهاز منظم، قادر على أتباع استراتيجية واضحة طويلة المدى، يعني لو وثيقة الجمل فشلت حيعيدها بشكل تاني في السلمي لما الشعب يهدى ألخ. لكن الشعب على العكس مش منظم وملوش منظور بعيد المدى وبيتعامل مع المعطيات الوقتية على أساس أنها آخر الدنيا، وبالتالي من الممكن مساومته على خيارات بنظام بالونة الاختبار، يا تنجح ويبقى قشطة يا تفشل وينسى، وتتعاد بعدها برضه بكام شهر لحد ما تنجح. عشان نعرف المجلس رايح فين وناوي على ايه مينفعش نبص على المتغيرات الوقتية بس، لازم نبص على افعالهم من ساعة ما مسكوا الحكم ونحاول نستخلص استراتيجيتهم، يعني نبص لما وراء الأفعال.</div>
<div dir="rtl" style="text-align: justify;">
<br /></div>
</div>Mohammad Alagganhttp://www.blogger.com/profile/00636251663295114267noreply@blogger.com0