Posted by: sabbour on: September 28, 2011
If you are developing using Qt Creator for the MeeGo/Harmattan target, and upon launching the emulator for your application you get a message like this in the compiler window:
chmod: /opt/MeeGoApp/bin/MeeGoApp: No such file or directory
warning: aegisSessionOpen() - failed to open platsec device (ret=-1)
warning: aegisSessionOpen() - failed to open platsec device (ret=-1)
sh:
/opt/MeeGoApp/bin/MeeGoApp: not found
Killing remote process(es)...
Finished running remote process. Exit code was 127.
Make sure your project path has no spaces. For example C:\Qt Projects\MeeGoApp will fail. Notice the space in “Qt Projects”.
Posted by: sabbour on: April 19, 2011
I came across some packages compiled for 32-bit, like Adobe Air that I needed to install on my 64-bit ubuntu, the following commands will fix the flags on the .deb package to force install it on a 64-bit system.
Note that it the converted package might install but not work correctly, so you are at luck whether it will work after that or not.
cd ~/Downloads
mkdir tmp
dpkg-deb -x package_i386.deb tmp
dpkg-deb --control package_i386.deb tmp/DEBIAN
sed -i "s/i386/all/" tmp/DEBIAN/
dpkg -b tmp package_64.deb
sudo dpkg -i package_64.deb
Posted by: sabbour on: June 28, 2010
As I’m just trying out Microsoft SQL Server Azure Spatial, the following things need to be removed from any generated SQL script in order to make it run on SQL Server Azure as they are not supported:
ON [PRIMARY]
PAD_INDEX
ALLOW_ROW_LOCKS
ALLOW_PAGE_LOCKS
SORT_IN_TEMPDB
newsequentialid()
I will keep this post updated as I discover new booby traps!
For a full list, check: http://msdn.microsoft.com/en-us/library/ee336253.aspx
Posted by: sabbour on: June 28, 2010
Simply, if you get this error:
---------------------------
Microsoft Visual Studio
---------------------------
Could not load type 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException' from assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
---------------------------
OK
---------------------------

Then you probably installed Visual Studio, Visual Studio service pack, then the Team explorer. Doing it in that matter overwrites parts of Visual Studio SP hence giving you such errors.
The correct way to install would be:
To fix the error now, just re-install Visual Studio 2008 Service Pack 1.
Posted by: sabbour on: April 7, 2010
As a reminder to myself, these are the steps to deploy an Qt application on the mobile phone.
qmake && make release-gcce
make sis
Posted by: sabbour on: February 17, 2010
I’ve run across this situation multiple times, where I have for example, an ID that I get in the code behind, and I want to append it to some href in the aspx, and each time I forget how to do it, so as a reminder for myself, here is how to do it and problems I ran into:
Assuming I have a property in the code behind that returns a GUID
protected Guid CustomerId {
get { return new Guid(); }
}
And assuming I have a link in my aspx page that I want to append this property to, here is how to do it
<a href="upgrade.aspx?id=<%= CustomerId .ToString() %>">Upgrade</a>
Note that this will not work if you specify a runat=server to the href for any reason, for example. to show the link or hide it according to specific logic.
If you need to show and hide the link, you can enclose it in a place holder and access that placeholder from the code behind
<asp:PlaceHolder ID="UpdgradeLinkPlaceholder" runat="server"> <a href="upgrade.aspx?id=<%= CustomerId .ToString() %>">Upgrade</a> </asp:PlaceHolder>
Posted by: sabbour on: April 25, 2009
Today, I was trying to password protect a directory on a website that operated the cPanel software on Bluehost and I went ahead and used the “Generate Password” function which generated this nice looking password
w7WY/a3HIUx>
Now when I was trying to login with this password, whatever I tried to do it gave me a 401 Authorization required. It just didn’t accept my password. I contacted the support of Bluehost but they weren’t able to help!
After some searching, I found this forum post http://forums.cpanel.net/showthread.php?t=112117 which makes me wonder why hasn’t cPanel fixed that bug so far?
If your password or the generated password contains greater than (<) or less than (>) characters (or maybe other ones that I haven’t discovered yet), they will be filtered out by cPanel before the password is saved, effectivley changing the password you set.
As a work around if you really need to use those characters (I liked the generated password
) you can set it through the shell
htpasswd -n username New password: w7WY/a3HIUx> Re-type new password: w7WY/a3HIUx> username:hash
Then copy the last line (username:hash) into your .htpasswd file which you can find by editing the .htaccess file in the directory that you were trying to protect. (Does this make sense?)
Posted by: sabbour on: March 25, 2009
I have never been more in need of a proper PHP debugger in my whole life. I have been stuck with a very mysterious behavior with CakePHP for the past 4 hours.
I was editing a model, then saving it. For some reason, my form action was changing from
/controller/edit/1 to /controller/add
it was making me go crazy!
After seaching around (finally) I found this: https://trac.cakephp.org/ticket/5871
I came to realize that I have actually omitted the
<?= form->input('id'); ?>
from my edit view because I thought “why the hell do I need to edit the primary key?”
As it turns out, CakePHP needs a field (hidden or not) with the name ID or else it will revert to the ADD form.
Luckily though, it is smart enough to render it as a hidden field.
Google is your friend.
Posted by: sabbour on: October 20, 2008
This was my bachelor thesis that I have done as part of my studies for a B.Sc. degree in Computer Science and Engineering from the German University in Cairo.
Download presentation:
Indoor Localization Using Wireless LAN/WiFi Infrastructure
Download thesis:
Indoor Localization using Wireless LAN/WiFi Infrastructure
Abstract:
The rapid advances in wireless technology as well as in the manufacturing of portable devices caused a growing interest in location aware services. A location sensing
system responsible for locating a mobile user, is a crucial factor for the success of such services. With the prevalence of wireless hotspots and wireless area networks, the use of a wireless network infrastructure as basis for an indoor positioning system becomes a viable option. In this work, we propose an indoor guide system that provides information about points of interest and objects within the vicinity of the user. Our system can be deployed on a university campus or inside a museum equipped with a wireless network.
The system uses the fingerprinting technique to associate position dependent information such as the strength of the received signal with a location. A range based matching algorithm for matching the physical signal strength with the fingerprints in the database is used and its performance is compared to an Euclidean distance based matching algorithm. The properties of the wireless signals and their distribution under several controlled experiments are analyzed.
Posted by: sabbour on: July 24, 2008
I got asked this question during an interview last week. I think I gave a wrong answer in the interview but I decided I needed to find the correct answer! I searched and found this solution which involved bit manipulations, though I didn’t find it intuitive.
I came up with this simple solution
public class PowerOfTwo {
public static void main(String args[]){
for(int n=0,limit=16; n<Math.pow(2, limit);n++)
if(isPowerOfTwo(n))
System.out.println(n);
}
private static boolean isPowerOfTwo(int n) {
double logNbase2 = Math.log(n)/Math.log(2);
int logNbase2Integer = (int) (Math.floor(logNbase2));
if(logNbase2-logNbase2Integer==0)
return true;
else
return false;
}
}
maybe not quite as elegant as the bit hack, but I understand it!
Update:
Actually, I understood how the bit hack function below works:
private static boolean isPowerOfTwoFast(int n) {
return ((n!=0) && (n&(n-1))==0);
}
1: 000001 2: 000010 4: 000100 8: 001000 16: 010000 32: 100000
and so on, so we need to check if the number only has one bit that is set, and that the number is not 0 (because zero is not a power of two).
We can count the number of set bits (which is another interview question!), and if the number of set bits is one, then the number is a power of two. A smarter way to do it would be bitwise ANDing of the number and the number-1, and then check that the result == 0.
For example, to check that 32 is a power of 2, convert 32 to binary to be 100000, convert 31 to binary to be 011111. Bitwise ANDing of those 2 numbers would obviously result in 0.