Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts

Sunday, December 15, 2013

(Software) Architecture

(Software) Architecture: "The art of drawing lines, with the interesting rule that once you've drawn the lines all dependencies that cross that line go in the same direction" -- Robert C. Martin

Tuesday, July 16, 2013

Using your own Pre-populated SQLite database in (Xamarin.)Android applications

Problem:

Most of Sqlite-net samples – at least the ones I came across – address creating new databases and populating them with data at runtime through calling web services, or else. Nothing on the other side address the situations when you need to start with a pre-populated database.

Solution:

Thanks to this post, and other questions on StackoverFlow and Xamarin Forums, find below the C# version of the code on the mentioned post. Note that I only “translated” the part that copies the database file from the assets folder to your package data directory. That – off course – requires your SQLite database to be added to you Android project assets folder as an “Android Asset”.

Thursday, September 13, 2012

Visual Studio 2012 launch, MEA-ALM community, etc

If you haven't noticed already, Visual Studio 2012 launch was yesterday. It was such a buzz yesterday on Twitter. Our way in MEA-ALM community was to launch Hands-on Visual Studio website; a fairly large collection of guided, multi-lingual and real-life labs to experience, learn & practice Visual Studio 2012. I contributed a couple of videos too ;)

We had our own little twitter buzz too!

Remember, Visual Studio 2012 will be launched in Egypt by the End of September.

Wednesday, March 23, 2011

Client-side Form Validation using jQuery Mobile

Lately, I've been involved in a project which is mainly targeting mobile browsers. The decided to use kinda "new" jQuery mobile "library". jQuery Mobile is a ……built over jquery, css, js, multiple browser support, etc…… It's still in beta? Yet, it renders pretty fine, and we didn't have more than a couple of issues with it. But it save us loads of time rendering on a nice range of supported mobile browsers.

For eg, I stepped into a problem with client-side validation lately. When jQuery Mobile renders input of type submit (i.e. a submit button for a form), it actually hides the "input" tag, and replace it with an anchor? (ie "a" tag).

Say, you want to add function to handle "onclick" event, validate the form, before hitting the server-side, and prevent it from submitting if it failed; something like:

<input type="submit" onclick="return ValidateForm()" />

The  function is actually never called because the actual input tag is as jQuery Mobile hides and replaces it by an anchor.

Adding the validation function via js/jquery after the document is ready to the anchor, will allow you to call it on clicking the anchor. Yet, it won't stop the form being submitted.

A nice alternative, is to use an input tag of type button, that is:

 <input type="button" onclick="ValidateForm();" />

And submit the form inside the function handling "onclick", rather than returning true/false, like:

   1:  function ValidateOwnerId() {                
   2:      if (/*form is valid*/) {
   3:          $('#myForm').submit(); // Submit from
   4:      }
   5:      else//not valid
   6:      {
   7:          /*show some error message without submitting form*/
   8:      }
   9:  }

Thursday, March 03, 2011

"Note in (Google) Reader" issue Fix

Probably you're familiar with the sharing button (at least on Firefox and Chrome) offered by Google reader to help you share stuff that don't have feeds. Today, for some reason I realized that mine wasn't working!

GReader

 

After tweeting about it, thanks to Flavio Gomes and @mtobis, I realized what went wrong. Seems like the JavaScript file used by the button was updated, without updating the button script accordingly.

 

To solve this, all you have to do is set _IS_MULTILOGIN_ENABLED a variable that's not defined (but used) in the script file in the button script. So add something like:

_IS_MULTILOGIN_ENABLED=true;
// or
_IS_MULTILOGIN_ENABLED=false;
// or better
_IS_MULTILOGIN_ENABLED=((typeof(_IS_MULTILOGIN_ENABLED)=="undefined")?false:_IS_MULTILOGIN_ENABLED);

 

at the beginning of the button script, just to set _IS_MULTILOGIN_ENABLED before it's accessed as "undefined" in the script.

Sunday, January 09, 2011

How to force undo checkout? #TFS

Sometimes you'd pop into cases where you find yourself in a situation where you have to force undo pending code changes of someone else (say a colleague who is no more around, or even temporarily) or your own pending changes if say your machine (along with your workspace on it).

Well, there a Visual Studio tool for that.. That's tf command-line utility, which you can look for in your VS directory under Common7\IDE..

Using tf has lots and lots of uses, here's a really LONG list of them. Note: there's 3 sub-lists for VS2005, 2008, 2010. But for our tiny problem here, we mainly have to options, I'm using here the most straight forward ones:

Undoing pending changes for a specific file:

That will need mainly main parameters to start with: The name/path of the file checkout, User name (of the user who did the checkout), and the Workspace in which the checkout was done (usually your machine name if you didn't create an new workspace).

You could have an issue with the third one (workspace name), so you might have to check the Workspaces command for more details, but generally a small command like the one below will do just ok in most cases:

tf workspaces /owner:UserName

Knowing the above you can easily undo the pending changes as below, note: parameters are in squiggly braces like {these}:

tf undo {file path} /workspace:{workspace};{username} /server:{TFS name/IP}

Of course the "/server" part can be removed if you're on the same server running TFS. An example with some data will look like:

tf undo $/myProject/myFile.cs /workspace:mySpace;FCIH\shady /server:FCIH_TFS

Deleting the whole workspace:

The other option is to delete the whole workspace, which in turn delete any related checkouts. A simple command for that could be:

tf workspace /delete {workspace};{username} /server:{TFS name/IP}

which with some example parameters might look like:

tf workspace /delete Shady-PC;FCIH\shady /server:10.0.0.2

UPDATE:

After a comment by Meligy, I think I needed to add this: Most of the above needs you to be logged in as an account with TFS admin privileges, check the exact required permissions for Undo, Workspace and Workspaces commands.

If you're not logged in as the appropriate account, you can append {/login:username, [password]} to provide the authorized username and password.

Meligy, also, mentioned another tool called TFS Sidekicks that can do similar stuff.

Friday, December 24, 2010

A late brief review of #GEgypt

G-Egypt was a 3 day event held by Google on Dec 8th-10th at Dusit Thani (New Cairo). I've attended Day 2, and 3 (Day 2: targeting Software Developers, Day 3: targeting Entrepreneurs and Software Developers), & knew about what happened on Day 1 (targeting Academia) from my brother and a couple of my younger friends from the community/FCIH.

Most of the sessions was too simple (may be except for Day 1, as mostly the attendees were younger/students) and sometimes they seemed even dull too, as most of the speakers seem to be software developers who aren't much exposed to speak on similar events before.

Yet, the same speakers were much more interactive, answering questions at the pods. There were 5 pods on the open area for most of the speakers of each day + one for Cairo-GTUG (Google Technology User group).

The Keynotes was mainly talking about Google's plan on targeting MENA , and what they're offering (especially in Arabic) lately, with some demos (stuff like search, translate, Ejabat, Maps, AppEngine, with a note that Android Arabization is in there plan, but no dates announced). Stressing on that one of their main issues is the lack of "well-formatted" Arabic content, that's mostly buried in forums (which is not the best place to put your content SEO-wise), asking for developers of the region to help them with that.

The sessions about AppEngine (Google's cloud computing offering, and the main reason I attended the event) was one of the most attended sessions, yet the session presenters were pretty boring and later on, many of the attendees either left for the other parallel session or stayed not paying much attention.

Yet, Again, to get the audience attention, the AppEngine speakers (there were 2 of them) announced a technical contest (only on day 1, 2) for creating apps using AppEngine (+ using other Google Technologies) which was judged by the end of each day with the best app awarded a Google Nexus!

On Day 2, the most attended and most lively session, by far, was the mobile (Android) development session. There was another couple of sessions by Site Clinic team, analyzing real sites of some of the audience from an SEO (and sometimes a little security) point of view. There was a rather dull session about Chrome extensions too.

There was a couple of session about the benefits of working with open source and using open standards on Day 2, 3 (which were generally favored by most of the people I talked to about). Also, on Day 2, there was a session by adopters of Google development technologies (Android, Maps), talking about their experience using it, and starting their new businesses on top of it.

There was a multitude of sessions about maps and their applications on Day 2, 3 with a business (possible uses of maps, no code) sessions about the topic on Day 3.

On Day 3, the most attended and tweeted about sessions (actually throughout the whole 3-day-event) was the session and panel discussion about Entrepreneurship,. There was another Entrepreneurship panel discussion on day 2, but that too dull compared to Day 3.

Concerning logistics, the event was held on four areas: Main Auditorium, Breakout sessions room, an open area, and the dining area. The open area has many entertaining stuff like the ones you'd see on a typical "Life at Google" video; stuff like Wii, Beanbags, seats, Sofas. Also, the speakers’ pods were at this area. Also, there weren’t many giveaways, only t-shirts at the end of every day, and a couple of Google-branded mugs during the sessions. No attendee-kit, only a notebook and a pen on the seats during sessions.

The main organizer/host of the whole event is a French guy called Sebastian. He is a very lively person; probably most of the attendees will remember him and G-Egypt as synonyms (especially the ones not familiar with Google, before the event).

The event has a major drawback is that on every single day of the three day, the schedule wasn't progressing as planned. Also, the sessions were too short. Probably those were a couple of the main reasons why most of the sessions were too simple as most of them had to wrap up too soon.

 

Let me know how did G-Egypt went with you?

Monday, September 13, 2010

Do people in non-English-speaking countries code in English?

I was reading a question with the same name on Stack-Exchange Beta site for Non-programmer-related questions (aka Programmers) when I came across this answer posted by a (probably Ukrainian) developer named Igor.

Accompanied by an earlier attempt by a colleague at work to write an enum in Arabic, I tried to write this piece of code:

Strangely enough it compiled and even ran showing the expected output (10)!! Note, the order above of the 2nd & 3rd line is mingled due to RTL issues in Gist. Visual Studio will show it in the right order (or at least, a more readable order for me, copy it & past it in your IDE to know how it looks).

Off course, I’m pretty convinced that this isn’t the best practice you should follow, (check my answer to the same question). Yet, I find this really hilarious! As a matter of fact, I took the claim that it’s bad practice too much for granted to the extent that I’ve never even tired to write such a strange piece of code :D

Wednesday, September 08, 2010

Does Google Instant really ruin SEO?

I was just reading an article I found on twitter about how Google Instant (the new Google search enhancement to be rolled out to all users soon) will ruin Search Engine Optimization (SEO) which I find kinda wrong.

First: SEO is a way to aid (content providers to provide ways to) internet users to find their way to their content. ie, it’s a mean to an end, not an end! So if Google (or Bing, etc) added new features to enhance the user experience (UX) and personalize search results that might break SEO, SEO should find a way to adapt. Killing innovation is not an option :)

SEO is not about deceiving people to direct them to your content, whether it’s relevant or not!!

Second: & that’s the main point here: As far as I can see, Google Instant is not ruining SEO as Steve claims. Search results are still gonna be shown as the good old days, the only main difference is that you won’t have to click ENTER after typing your search words. You can get instant feedback about where your search results meet your expectations or not. So if content-providers did their SEO job right, their content will show up according to the relevance of their content to the typed keywords.

So, what do you think? correct me if you can see it in any other way..

Update:

I find this tweet by @Bashmohandes more valid though:

Google Instant is cool, but I worry about advertisers, as some of their impression budgets are used while the user didn't show enough intent

Saturday, July 10, 2010

Creating a simple Open Search Provider/Plug-in

Yesterday, I needed to check/search my delicious bookmarks more than once. I then realized that delicious have its a search plug-in as a part of a tool bar (along with other bookmarking tools, few search tools, though), which -I guess- loads all your bookmarks to browser & make them available for search.
As I’m not so much into too much plug-ins, specially if they load lots of data (in contradiction to Pointy-haired Boss) , not to mention that I won’t need bookmarks when I’m offline, anyway, I decided I should create my search provider.

Creating the Provider:

Here’s an example:



Away from the fact that I badly need a WYSIWYG code hi-lighter, let’s check that XML. First the ShortName which appears in your search box, something like this:
Click to Enlarge Description and Tags are obvious, & I think optional too.
Image is the small icon that appear beside when you select your provider (check the pic above again). You can either supply it as a URL to an image file (usually .ico or .png) or you can replace it with the base 64 string of the image (though I wasted quite sometime to make that work), like:



Finally, URL note that I’m using {SearchTerms} to pass the string typed in the search box. You can send other parameters to your search page. You might want add another URL for suggestions, here I’m only providing the search URL.

Using the Provider:

To add the provider to your browser (as far as I’m concerned it works fine for Firefox & IE) you have one of two options:
Adding it as a suggested search provider: This can be done by adding a single line in your page <Head> tag, note that the attribute title in the below tag refers to the name appearing in the list as [Add “title”], check the image below the tag.



Click to Enlarge
Using JavaScript to add the provider: The other available option is to add the provider using scripting, here’s an eg of how you can do that:



Clicking a link like the one above will pop up a windows asking if you want to add the search provider.
References: http://www.opensearch.org

Friday, July 09, 2010

Changing regional settings for System accounts (including ASPNET) in Windows 7

One of the small issues I faced while switching my development machine to windows 7 was a bug/exception in an application I was working on in parsing date format.

After switching my regional settings to the “expected” format, I still got the same exception. After playing a little with the regional settings, I realized that I was switching only my account date format, not the whole machine's date format. To push those settings to other system accounts (like ASPNET, etc), I did the following steps:

After setting your your account regional settings, switch to “Administrative” tab:

Click to Enlarge

From “Welcome screen and new user accounts”, click “Copy setting”:

Click to EnlargeMake sure “Welcome screen and system accounts”  check box is checked, press ok, and Voila!

Tuesday, March 23, 2010

How to configure SQL Server for ASP.NET SQL Server Session State <sessionState mode="SQLServer" ../>

On your prompt (doesn’t matter if you’re on the SQL server machine or not), run the below command:
”system root”\Microsoft.NET\Framework\”version number”>aspnet_regsql.exe –S “server” -U sa -P “Password” -ssadd -sstype p
for eg:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe -S MySQLServerInstanceName -U sa -P password -ssadd -sstype p
OR
C:\WINNT\Microsoft.NET\Framework\v4.0.21006>aspnet_regsql.exe -S MySQLServerInstanceName -U sa -P password -ssadd -sstype p
Now you have ASPState database on your servers with the tables, stored procedures, jobs needed to handle SQL server mode session state.

Friday, January 15, 2010

Why would you need a Gender table in your DB??

A friend of mine was tweeting about how he found a drop down control in some application he’s working on that binds on a (“lookup”) table with only the 2 rows for male & female.. Check the short conversation on twitter.

In my humble opinion -as weird it may sound-  this approach (for similar, small lookups) might makes sense, in some way. Not exactly as is, may be it will make sense more if it’s within a lookup module (a single table for all lookups where every entry has a lookup type).

Other “regular” approaches (& their expected problems) :

People usually tackle such small lookups using enums, or just using an “agreed on” key/value pairs convention (not stores anywhere in code or DB, may be only a code comment here or there) which usually tend to get forgotten & you have to  trace code to know which key stands for each lookup value..

Even worse, is using a boolean for such

Benefits of a DB Table approach:

Other than the benefits of avoiding the above, using DB to explicitly state lookup values, is that they are more dynamic, ie: you can always edit them without touching much code, that would be handy in cases like:

  • Clients constantly changing small stuff like spelling, etc
  • Adding other functionalities/features, like multilingual support for eg..

Thus, I find avoiding enums, etc & using tables even for small stuff like that gender much more convenient..

Let me know what you think about it, & (hopefully) suggest a better approach..

Friday, January 08, 2010

Petitions!!

Today I came across a couple of petitions,

ScottGutoME & #iWantScottGuInCairoCamp:

The first one was about asking Scott Gu to be there on Tech·Ed ME 2010 in Dubai..

After tweeting about it, Meligy & I started a convo about it, which lead to a kinda another petition for Cairo Code Camp 2010, so go on retweet it!! :D

RT #iWantScottGuInCairoCamp if you want @scottgu to come to Egypt during #CairoCodeCamp.Make it twitter trend so that GU notices

[Ar]droid:

Another nice petition was about pushing Google to Support Arabic in Android, which is a nice petition from a user perspective, but kinda lame speaking as a developer & taking into consideration that Android is (mostly) open source.. Arab Developer community need to get more involved.. not to just "ask for Arabic support"!!

Another funny thing is that most of the comments on the issue on Android Google Code project is that almost all the comments are in pure English.. For God sake, dudes!! Google has “Google Translate”!! :D

Yet, speaking about ROI (for Google), Arabic Language is spoken by more than 280 million people as a first language, and by 250 million more as a second language.  http://en.wikipedia.org/wiki/Arabic_language

Saturday, December 05, 2009

How to create a C# Class from XML file (via xsd.exe)

A friend asked me a couple of times about how to I created the class I used in “twitter common friends” to handle xml as objects (includes reading and writing back). Actually the tool (xsd.exe) is pretty simple and takes no more than a couple of commands to create the class for me.

It’s just that I usually forget the keywords/parameters & their order (you can create a dataset or class that can be C# or VB, and there’s a couple of other option I never used before). I usually refer to its MSDN page when asked..

So I thought a post would be easier to remember. First you should create the xsd file out of the xml, using the VS command prompt:
xsd myFile.xml
That will create “myFile.xsd”, now to create “myFile.cs”, write the below line:
xsd myFile.xsd /c 
Now you can add the cs file to your project and use it as illustrated in my previous post.


Cross-posted from FCIH-Blog

Tuesday, October 20, 2009

Wondering about Project Managers

I had a couple of issues lately with a PM (Project Manager) at work which made me ask myself a couple of questions & wonder what others might be thinking of it.. I'll give my humble opinion here to start a conversation, coz I badly wanna here how others would answer them.
  • Should PMs know/ask much about technical decisions?
    • IMHO, I thing the answer is NO!! PMs should be asking for less fine details like what's the estimations for doing that option or so.. But they shouldn't be asking why we are using X, or Y technology/approach to tackle a problem.

  • In an agile process, where should PMs stand? What exactly is their Role? Should there be PMs in agile in the first place? Or Should they be replaced by a PO (Product Owner), or -may be- a Scrum Master?
    • That's a question that really confuses me a lot.. I can't give a definite answer.. Should they replace POs.. Hmm. I guess not.. On one hand, a PO should be the one directing the project, knowing what the customer want.. But still, a PO -probably- should have some technical background.. So according to my answer to the previous question, PMs can't replace POs..
    • On the other hand, Replacing a Scrum Master, is a bit too far for PMs, Scrum Master are supposed to be in favor of the development team, ie a facilitator & protector for the dev team; & PMs are notorious of failing to do so.. :D
    • Another option -that just came to me right now- is PMs replacing customer in environments where it's difficult to involve the customer.

I'm desperately waiting for your answers to either of the above questions.. I'm really confused & don't have enough knowledge actually to answer them.
I might be adding other questions but for now that's what is on my mind..
Cross posted on FCIH blog

Saturday, August 01, 2009

My first baby is still alive & kicking :D

Just realized, today, that a site I did a couple of years ago is still up & running till now.. The guys changed the look & feel a lot, added a blog, many other cool stuff.. But the same layout of controls, my general feel of the site (you know it different as dev from being a regular user) & probably the DB too (Don’t ask me how I knew it, I just love to believe so :P) seems intact..
Though, I worked much earlier with previous development stuff either at FCIH, (both at Faculty projects & other student activities), or even as a freelancer for sometimes, & though I didn’t do much development (it was made out of a starter kit, not from scratch), I’m really proud of that site. The fact that it was one of the first stuff I did which really made it to the real world & got used by real customers/users.. That fact made it like a first baby to me..
It really made my day today!!

Quote of the Moment

"Professionals see themselves as part of a community of like-minded individuals who put their professional standards above their individual self-interest or their employer’s self-interest." –Steve McConnell, Leonard Tripp

Tuesday, June 09, 2009

Community Calender

FCIH bloggers started a public calendar under the name: Community Events Calendar. It will be focused mainly on the Egyptian IT Community. A glimpse of the calendar is here below:



Also you can subscribe to calendar in many other ways, for eg the HTML version here:

Or in iCal format that can be feed to Outlook or Apple iCal, etc :

Also, as XML feed:

The calendar will include offline IT community Events held around Egypt. Also, online events both from Egypt (hopefully there will be, someday :)) & around the world.

Please, feel free to contact us (FCIH bloggers) or comment on this post, notifying us of events that need to be added to the calendar. Also, any ideas to improve it are much appreciated :)


Cross-posted from FCIH-Blog

Disclaimer

All the opinions expressed on this blog are my own and don't necessarily represent my employer's positions, strategies or opinions.