tag:blogger.com,1999:blog-89865726529713195852024-02-08T12:36:49.142-08:00Amr GhoneimThinking outside the box!bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-8986572652971319585.post-83891321490076745052009-09-07T02:50:00.000-07:002009-10-02T18:25:57.857-07:00eSpace makes it into Rails Magazine<div style="text-align: left;">aking their biggest steps since they started in 2000, eSpace is taking steady steps into the community of Rails, proving its leadership in Ruby on rails solutions in Egypt. Check out the full article on <a href="http://www.railsmagazine.com/issues/4">Rails Magazine</a><br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_76NUR6_0hJU/SsHaNlTg6zI/AAAAAAAAAM0/zte698qDklQ/s1600-h/image-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_76NUR6_0hJU/SsHaNlTg6zI/AAAAAAAAAM0/zte698qDklQ/s320/image-2.png" /></a><br />
</div><br />
Here is a couple of pictures from the event, the first one shows eSpace's CTO, Mohamad Ali with Matz. The second picture of Ali giving a presentation about Neverblock, a ruby solution for concurrent operations, developed by eSpace. eSpace is using it currently in many production servers, such as <a href="http://www.alsaha.com/" target="_blank" title="Arabic Alsaha">Alsaha</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_76NUR6_0hJU/SsHpLuzNn3I/AAAAAAAAAM8/eQI6XtcmhAY/s1600-h/image-0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_76NUR6_0hJU/SsHpLuzNn3I/AAAAAAAAAM8/eQI6XtcmhAY/s320/image-0.png" /></a><br />
</div>bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com0tag:blogger.com,1999:blog-8986572652971319585.post-45032420825284482082009-07-26T03:24:00.000-07:002009-09-28T06:00:46.744-07:00Recovering MySQL root passwordHave you ever dealt with different Mysql Installations on different machines?<br/>Have you ever mixed up root passwords of different installations?<br/><br/>I recently had that happened to me, I decided to look further into it and find a good way to do a password reset for my root account.<br/><br/>Here is what we will do:<br/><ol><br/> <li>Stop the mysql daemon.</li><br/> <li>Start mysql with "--skip-grant-table" option.</li><br/> <li>login with your root account with no password.</li><br/> <li>update the mysql.users table with your new password.</li><br/> <li>restart the mysql default daemon.</li><br/></ol><br/><span style="color:#ff0000;">Step1:</span> stop the running mysql daemon<br/><pre name="code" class="bash">/etc/init.d/mysql stop</pre><br/>Output:<br/><pre name="code" class="bash">* Stopping MySQL database server mysqld [ OK ]</pre><br/>Note: Make sure it is stopped with the following command<br/><pre name="code" class="bash">ps aux | grep mysql</pre><br/>You should see only one entry for the grep command you just typed.<br/><br/><span style="color:#ff0000;">Step2:</span> we start mysql with "--skip-grant-table" option.<br/><pre name="code" class="bash">mysqld_safe --skip-grant-table</pre><br/>You should find output similar when you hit<br/><pre name="code" class="bash">ps aux | grep mysql7090 pts/1 S 0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-table7129 pts/1 Sl 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock --skip-grant-table7131 pts/1 S 0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld7246 pts/2 S+ 0:00 grep --color=auto mysql</pre><br/>You should login successfully without any password.<br/><pre name="code" class="bash">mysql -uroot</pre><br/><span style="color:#ff0000;">Step4:</span> change your root password<br/><pre name="code" class="sql">use mysql;<br/>update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';<br/>flush privileges;<br/>quit</pre><br/><pre name="code" class="bash">/etc/init.d/mysql stop/etc/init.d/mysql start</pre><br/>You should be able to login normally with your new password.bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com0tag:blogger.com,1999:blog-8986572652971319585.post-43544754497244235162009-04-20T09:25:00.000-07:002009-09-28T06:00:46.744-07:00Changing your home directory to a new Drive on UbuntuI recently was trying to install Windows with my Ubuntu on my machine. I ended up moving my /home partition to another extended one :).<br/><br/>Windows Vista can't be installed on an extended partition (or at least that is what it told me), so i had to make a new primary partition for it. Since I'm using 3 primary partitions for my linux (boot, root and home) plus the extended partition area. The total primary partition (and maximum you can have) is 4 primary partitions. I had to relocate one of my Linux partitions to an extended one. Either i move my boot partition, or the home partition. home was my choice so i did the following.<br/><br/>First you have to make a new extended partition for your home. I choose to try the reiserfs as i read it has some performance advantage over ext3. let's call it /dev/sda5.<br/><br/>Next, you should mount it and copy all your /home data to your new partition.<br/><pre name="code" class="sh"><br/>sudo mkdir /media/home_new<br/>sudo mount -t ext3 /dev/sda6 /media/home_new<br/></pre><br/>replace "sda6" with your correct drive file<br/><br/>Next copy your files:<br/>Since your "/home" directory will have soft links, hard links and nested directories, normal copy "cp" will not do the job. We can use a command similar to the one in the <a href="http://www.us.debian.org/doc/manuals/reference/ch-tips.en.html#s-archiving">Debian archiving directory </a><br/><pre name="code" class="sh"><br/>find . -depth -print0 | cpio --null --sparse -pvd /media/home_new<br/></pre><br/>After copying the data you have to edit "/etc/fstab" to make sure your "/home" is pointing to your new partition. You may find some "UUID"s instead of "/dev/..." just replace your UUID with your new drive path "/dev/sda6" or whatever it is.<br/><pre name="code" class="sh">/dev/sda6 /home reiserfs relatime 0 2</pre><br/>I just replaced the drive file and the file system as i changed both of them. It is best to keep the rest on their default settings.<br/><br/>Now Restart your machine and everything should work fine.You can even create a new primary partition for your windows installation now.bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com0tag:blogger.com,1999:blog-8986572652971319585.post-10177411204667053502008-09-25T09:40:00.000-07:002009-09-28T06:00:46.744-07:00Calling javascript from ActiveX component.<span style="font-family:georgia;">Recently I was trying to call javascript functions in a web page from an embeded activex component i'm working on (The same way a flex developer do using ExternalInterface).</span><br/><h3 style="font-family:georgia;"><span style="font-size:130%;">Problems facing this kind of action:</span></h3><br/><span style="font-family:georgia;">The problem in MFC is that life is not easy like Flex in this specific point. You have to deal with alot of COM interfaces to get what you want. So my problem was as follows.</span><br/><ol><br/> <li style="font-family:georgia;">I should get a reference to the window that the ActiveX control is embeded in (in my case, it will be an IE tab).</li><br/> <li style="font-family:georgia;">Try to get an interface from this window to an html container to be able to access html and javascript.</li><br/> <li style="font-family:georgia;">find the javascript function you want to call.</li><br/> <li style="font-family:georgia;">formulate the parameters in the way that suits the Interface.<br/><ol><br/> <li style="font-family:georgia;">Starting a normal ActiveX control application using the app wizzard, leaving all the default settings.</li><br/> <li style="font-family:georgia;">in the ActiveXCtrl class added a CComPtr which i will be using to access the javascript functions inside the web page.</li><br/> <li style="font-family:georgia;">Added a new method I called it FindMainWindow() and called it in the OnDraw()method.</li><br/> <li><span style="font-family:georgia;">the code of FindMainWindow()Is as follows.</span><br/><pre class="cpp">void FindMainWindow()<br/>{<br/> LPOLECLIENTSITE lpClientSite = NULL;<br/> lpClientSite = GetClientSite();<br/> CComPtr<IServiceProvider> serviceProvider(0);<br/> CComPtr<IWebBrowserApp> webBrowserApp(0);<br/> CComPtr<IWebBrowser2> webBrowser(0);<br/> CComPtr<IDispatch> dispatch(0);<br/> if(SUCCEEDED(lpClientSite->QueryInterface(IID_IServiceProvider,(void**)&serviceProvider))) {<br/> }<br/> if(SUCCEEDED(serviceProvider->QueryService(IID_IWebBrowserApp,IID_IWebBrowserApp,(void**)&webBrowserApp)))<br/> { }<br/> if(SUCCEEDED(webBrowserApp->QueryInterface(IID_IWebBrowser2,(void**)&webBrowser)))<br/> {<br/> webBrowser->get_Document(&dispatch);<br/> }<br/> if(SUCCEEDED(dispatch->QueryInterface(IID_IHTMLDocument2,(void**)&htmlDoc)))<br/> {<br/> LOG(_T("Found Html Document:"));<br/> }<br/>}</pre><br/>As you can see here, I needed to get first an IServiceProvider interface from theIOLEClientSite i got by calling GetClientSite().<br/>The following <a style="font-weight:bold;" href="http://msdn.microsoft.com/en-us/library/aa752127.aspx">link</a> in the msdn documentation says in the remarks section that The <span style="font-style:italic;">IWebBrowser2</span><span style="font-style:italic;"> </span>interface derives from <span style="font-style:italic;">IDispatch</span><span style="font-style:italic;"> </span>indirectly. <span style="font-style:italic;">IWebBrowser2</span><span style="font-style:italic;"> </span>derives from <span style="font-style:italic;">IWebBrowserApp</span>, which in turn derives from <span style="font-style:italic;">IWebBrowser</span>, which finally derives from <span style="font-style:italic;">IDispatch</span>. So i had to get an <span style="font-style:italic;">IWebBrowserApp</span><span style="font-style:italic;"> </span>interface then <span style="font-style:italic;">IWebBrowser2</span>. Finally getting an IDispatch interface to get the <span style="font-style:italic;">IHTMLDocumtne2</span><span style="font-style:italic;"> </span>from it.</li><br/> <li>Here we start to call a javascript methods within the <span style="font-style:italic;">IHTMLDocument2</span><span style="font-style:italic;"> </span>interface we have got earlier. we call get_script(IDispatch*) to get the script object. The following code demonstrate how to get the id of a given javascript function name, formulating the parameters and invoking the function.<br/><pre class="cpp">CComPtr spScript;<br/>if(!GetJScript(spScript))<br/>{<br/>return false;<br/>}<br/>CComBSTR bstrMember(function);<br/>DISPID dispid = NULL;<br/>HRESULT hr = spScript->GetIDsOfNames(IID_NULL,&bstrMember,1,LOCALE_SYSTEM_DEFAULT,&dispid);<br/><br/>if(FAILED(hr))<br/>{<br/>return false;<br/>}<br/><br/>CStringArray paramArray;<br/>const int arraySize = paramArray.GetSize();<br/>DISPPARAMS dispparams;<br/>memset(&dispparams, 0, sizeof dispparams);<br/>dispparams.cArgs = arraySize;<br/>dispparams.rgvarg = new VARIANT[dispparams.cArgs];<br/><br/>for( int i = 0; i < arraySize; i++)<br/>{<br/> CComBSTR bstr = paramArray.GetAt(arraySize - 1 - i); // back reading<br/> bstr.CopyTo(&dispparams.rgvarg[i].bstrVal);<br/> dispparams.rgvarg[i].vt = VT_BSTR;<br/>}<br/>dispparams.cNamedArgs = 0;<br/>EXCEPINFO excepInfo;<br/>memset(&excepInfo, 0, sizeof excepInfo);<br/>CComVariant vaResult;<br/>UINT nArgErr = (UINT)-1; // initialize to invalid arg<br/><br/>hr = spScript->Invoke(dispid,IID_NULL,0,DISPATCH_METHOD,&dispparams,&vaResult,&excepInfo,&nArgErr);<br/>if(FAILED(hr))<br/>{<br/>return false;<br/>}<br/>*pVarResult = vaResult;<br/>return true;</pre><br/></li><br/></ol><br/></li><br/><span style="font-family:georgia;">Finally call the javascript and cross fingers!</span><br/><h2 style="font-family:georgia;">Solution:</h2><br/><span style="font-family:georgia;">Here is what i succeeded in after 5 hours of searching and reading and debugging code.</span><br/><br/>I have simplified this example as it was a testing to show that javascript is called successfully.<br/>The detailed example on calling javascript from IHTMLDocument2 can be found in this <a href="http://www.codeproject.com/KB/COM/jscalls.aspx">link</a></ol>bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com0tag:blogger.com,1999:blog-8986572652971319585.post-44857335269999352662008-06-04T09:39:00.000-07:002009-09-28T06:00:46.744-07:00Introducing Goosh (Google Shell)Have you ever wondered, when can i search the web using command line?<br />Are you a command line geek?<br />Would you like to get the power of command line and the essence of web.<br /><br />I felt all that when i opened <a href="http://goosh.org/">goosh.org</a>.<br />When you open the site, you will find a simple white screen with some welcome message like what you see if you have been using a Nix shell before.<br /><br /><a href="http://bp3.blogger.com/_76NUR6_0hJU/SEbHlNJ3ZPI/AAAAAAAAADA/kOyvg24D81o/s1600-h/Goosh.PNG"><img src="http://bp3.blogger.com/_76NUR6_0hJU/SEbHlNJ3ZPI/AAAAAAAAADA/kOyvg24D81o/s400/Goosh.PNG" alt="" border="0" /></a>just type help and press enter to see what you can do with this shell.<br /><br />One of the amazing things i have tried is the translate command.<br />Here is a screenshot of the result for translating <span style="font-weight:bold;">"I'm amr and i like to talk"</span> from <span style="font-style:italic;">english </span>to <span style="font-style:italic;">arabic</span><br /><br /><a href="http://bp1.blogger.com/_76NUR6_0hJU/SEbIkBk9iqI/AAAAAAAAADI/_m8APigEexQ/s1600-h/goosh2.PNG"><img src="http://bp1.blogger.com/_76NUR6_0hJU/SEbIkBk9iqI/AAAAAAAAADI/_m8APigEexQ/s400/goosh2.PNG" alt="" border="0" /></a><br />Totally amazing? Just watch out for the other abilities as well. and share your feedbacks about it and if there is any other amazing commands you did on it.<br /><br />I will try to read the javascript of the page and share hints.<br /><br />Happy command line searchingbluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com3tag:blogger.com,1999:blog-8986572652971319585.post-79999802074177223922008-05-30T22:23:00.000-07:002009-09-28T06:00:46.744-07:00Firefox 3 to score a Guinness World RecordAn amazing idea is to aim at scoring a world record for the most downloaded software in 24 hours. Firefox team is spreading its popularity by this announcement as most of Firefox users will talk about it, more users will be interested in trying Firefox if they were not using it and Firefox will gain more popularity.<br/><br/>I have tried Firefox beta 1 and it was very inspiring. But as a developer, I needed more variety of add ons and i couldn't find some addons support for it like firebug and web developer. So i switched to Firefox 2 and waiting for the release of the amazing Firefox 3.<br/><br/>I hope they break the recordbluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com1tag:blogger.com,1999:blog-8986572652971319585.post-9660450321140559882008-05-24T11:33:00.000-07:002009-09-28T06:00:46.745-07:00A word about eventmachine gem for Rails<span style="font-weight:bold;">I</span> was working recently in a project that required special purpose server to be implemented from scratch. so i got down to business and started coding. But instead of reinventing the wheel, I started the implementation using the <a style="font-weight:bold;" href="http://rubyeventmachine.com/">event machine</a> gem for <a href="http://www.rubyonrails.org/"><span style="font-weight:bold;">Ruby On Rails</span></a> . After finishing the coding and basic testing, I got an unexpected problem. The server Always crash!!<br /><br /><span style="font-style:italic;font-weight:bold;">First</span> I tried to look back into my code, may be the problem is there. I have tried to repeat a certain request several times and log the server results. Some requests are served and some are not, then the server just stop responding. When I shut it down, It seems to be buffering the rest of the requests. So what happens is that it sends the rest of the requests and then terminate.<br /><br /><span style="font-style:italic;font-weight:bold;">The solution</span> to my problem was very simple, Switch OS!!!!!! What I did was installing the Rails environment and deploying my project on Ubuntu machine, then testing with the same sequence. It didn't crash. I even made my stress testing even more aggressive by initiating a request loop for around <span style="font-weight:bold;">10,000,000</span> requests from two different machines each and the server still <span style="font-weight:bold;">RESPONDS!</span><br /><br />I think you already have guessed what platform i was using for development. It was <span style="font-weight:bold;">WINDOWS</span> of course.<br /><br />Viva <span style="font-weight:bold;font-style:italic;">Microsoft </span>!!!bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com1tag:blogger.com,1999:blog-8986572652971319585.post-43973320319879292162008-04-29T09:59:00.000-07:002009-09-28T06:00:46.745-07:00A talk about Gamunity<span style="font-family:arial;">I've been away a little bit in the past few months as i joined the military. Military service is nice, but there is much time wasted in vain.</span><br/><br/>Anyway. I'm here to talk about something else. Something I hope it will be a great revolution in web based applications. It's called <span style="font-weight:bold;"><span style="font-style:italic;">Gamunity</span>.<br/><span style="font-weight:bold;"><br/></span></span><span style="font-style:italic;font-weight:bold;">Gamunity </span>is our next product that will be introduced in the upcoming months. It will have alot of support from many platforms.<br/><br/>Watch my blog for more information about Gamunity and an introduction about it soon.bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com2tag:blogger.com,1999:blog-8986572652971319585.post-42635978426599242152007-07-24T20:19:00.000-07:002009-09-28T06:00:46.745-07:00Getting into businessFinally, I've decided to blog!. After graduation, I have much time now to do other activities other than work. Blogging is very difficult at first, but once you get used to it, you won't stop. Simply because blogging change the way a person express his ideas and Improve his writing style.<br /><br />I'm starting my own business these days with two other enthusiastic friends and colleges. We are calling our company (LogN). Why? As a symbol of efficiency. Mainly our work will be focused firstly on developing web 2.0 products. We're working right now on a prototype of our new product. If the prototype was good (As i hope), we will get funded from a local company here. I won't mention its name now. but maybe later i will.<br /><br />We hope to finish the product before March 2008. That's before we start our military service after college.<br /><br />I hope our product come to the light soon, and with the quality i hope.bluehttp://www.blogger.com/profile/06725334491682969540noreply@blogger.com0