Read in 2011

December 31, 2011

  1. Voyage through time – Ahmed Zeweil – 3-Star
  2. Developer’s Workshop to COM and ATL 3.0 – Andrew W. Troelsen – 3-Star
  3. Advanced Windows Debugging – Hewardt and Pravat – 4-Star
  4. The Data Warehouse ToolKit – Margy Ross – 4-Star
  5. The Google Resume – Gayle McDowell – 5-Star
  6. Inside the Microsoft Build Engine – Sayed Hashimi – 4-Star
  7. Learning Perl (the llama book) – Randal Schwartz – 4-Star
  8. Large Scale C++ Software Design – John Lakos – 3-Star
  9. Exceptional C++ – Herb Sutter – 4-Star
  10. Into the wild – Jon Krakauer – 3-Star
  11. The big 5-oh – Sandra D. Bricker – 2-Star
  12. Be your own best publicist – Jessica Kleiman and Meryl Cooper – 3-Star
  13. Automating System Administration with Perl – David Blank-Edelman – 1-Star
  14. Windows Internals 5th edition – Mark Russinovish – 3-Star
  15. Emotional Intelligence 2.0 – Travis Bradberry and Jean Greaves – 2-Star
  16. Windows via C/C++ – Jeffrey M. Richter, Christophe Nasarre – 5-Star
  17. More Exceptional C++ – Herb Sutter – 3-Star
  18. Programming Windows Azure – Sriram Krishnan – 4-Star
  19. Azure in Action – Chris Hay and Brain Prince – 1-Star
  20. Introducing HTML5 – Bruce Lawson and Remy Sharp – 3-Star
  21. Outliers – Malcolm GladWell – 4-Star

Ratings: 5-Star: Must read; 1-Star: Don’t waste your time

This was the list of books I was fortunate to read last year, I hope you find them inspiring and useful, and maybe share yours too. I’ve the books available if you want any of them for free.

Happy New Year!

Writing shell extensions is one of those programming tasks in which C++ (with the help of a library like ATL) excels – an MSFT explained here why it is better to avoid .NET for writing shell extensions.

Michael Dunn (a former Visual C++ MVP) wrote a very interesting series of tutorials on CodeProject on developing shell extensions, they are worth listing and sharing:

  1. A step-by-step tutorial on writing shell extensions.
  2. A tutorial on writing a shell extension that operates on multiple files at once.
  3. A tutorial on writing a shell extension that shows pop-up info for files.
  4. A tutorial on writing a shell extension that provides custom drag and drop functionality.
  5. A tutorial on writing a shell extension that adds pages to the properties dialog of files.
  6. A tutorial on writing a shell extension that can be used on the Send To menu.
  7. A tutorial on using owner-drawn menus in a context menu shell extensions, and on making a context menu extension that responds to a right-click in a directory background.
  8. A tutorial on adding columns to Explorer’s details view via a column handler shell extension.
  9. A tutorial on writing an extension to customize the icons displayed for a file type.

I’ve been looking for an efficient way to delete all items in a list using the SharePoint list webservice, a few friends have helped me with some good references to get it done by using CAML (@AhmedIG) or by using CSOM (Haytham), you can check them out and see if they solve the problem under your constrains, the challenging part of the problem is you usually don’t produce the item IDs for a list and just allow the SP to do the job for you, you also might discard maintaining the item IDs in your newly created or loaded items in your items collection.

In order to create the below XML batch we will need to build the delete method tags using the existing items’ IDs, so additional IDs retrieval would be required to create a single delete batch (using the GetListItems web service method, as long as we are using the SP list web-service only in our context)

   1: <Batch>

   2:   <Method ID='1' Cmd='Delete'>

   3:     <Field Name='ID'> TheMissingID </Field>

   4:   </Method>

   5: </Batch>

The solution starts here, a method returns an ArrayList of item IDs, to be used by the batch delete method. The GetListIDs method uses the GetListItems web service method to retrieve one field only – the Item ID – of all the items in the list.

   1: public static ArrayList GetListIDs(String ListName)

   2: {

   3:     WS_TopDealLists.Lists listService = new WS_TopDealLists.Lists();

   4:     listService.Credentials =

   5:         new NetworkCredential("username", "PASS****", "domain");

   6:     listService.Url = 

   7:     "http://SPServer/sites/SiteCollection/sandbox/_vti_bin/Lists.asmx";

   8:  

   9:     XmlDocument xmlDoc = new System.Xml.XmlDocument();

  10:  

  11:     XmlNode ndViewFields =

  12:         xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");

  13:     ndViewFields.InnerXml = "<FieldRef Name='ID' />";

  14:  

  15:     XmlNode ndListItems =

  16:         listService.GetListItems(ListName, null, null,

  17:         ndViewFields, null, null, null);

  18:  

  19:     //convert String to XMLReader

  20:     XmlReaderSettings settings = new XmlReaderSettings();

  21:     settings.ConformanceLevel = ConformanceLevel.Fragment;

  22:     settings.IgnoreWhitespace = true;

  23:     settings.IgnoreComments = true;

  24:     XmlReader xmlReader = 

  25:     XmlReader.Create(new StringReader(ndListItems.OuterXml), settings);

  26:  

  27:     ArrayList IDsList = new ArrayList();

  28:  

  29:     while (xmlReader.Read())

  30:     {

  31:         if (xmlReader.Name == "z:row")

  32:             IDsList.Add(xmlReader.GetAttribute("ows_ID").ToString());

  33:     }

  34:  

  35:     return IDsList;

  36: }

And here’s the Delete method which already takes the IDs ArrayList returned by the GetListIDs method then constructs one delete XML batch, and we’re done, all items are deleted in one shot.

   1: public static void DeleteItems(String ListName, ArrayList IDs)

   2: {

   3:     if (IDs.Count == 0)

   4:         return;

   5:  

   6:     WS_TopDealLists.Lists listService = new WS_TopDealLists.Lists();

   7:     listService.Credentials = 

   8:     new NetworkCredential("username", "PASS****", "domain");

   9:     listService.Url = 

  10:     "http://SPServer/sites/SiteCollection/sandbox/_vti_bin/Lists.asmx";

  11:  

  12:     string strBatch = "";

  13:  

  14:     foreach (String ID in IDs)

  15:     {

  16:         strBatch += "<Method ID='1' Cmd='Delete'>" +

  17:             "<Field Name='ID'>" + ID + "</Field></Method>";

  18:     }

  19:  

  20:     XmlDocument xmlDoc = new System.Xml.XmlDocument();

  21:     XmlElement elBatch = xmlDoc.CreateElement("Batch");

  22:  

  23:     elBatch.InnerXml = strBatch;

  24:  

  25:     listService.UpdateListItems(ListName, elBatch);

  26: }

A simple task as adding an item to a SharePoint list has a lot of good-to-know stuff attached to it, the first problem-solving track I toke was using the Windows SharePoint Services classes to construct objects like the SPSite, and SPWeb and for the good reasons this wouldn’t work as I’m doing some data integration processing on a remote integration service (pulling data from different sources, do some processing, and then inserting them into a SharePoint list), as the other objects will allow you to construct them if and only if the script will run on the SP host machine so there’s no other way except using the SharePoint Web-Services to access site-collection lists remotely. after digging here and there for the best way to do it, I finally created the following chuck of code on my pilot project – the code has some tips that would save you a few hours of debugging..

 

   1: WS_TopDealLists.Lists lists = new WS_TopDealLists.Lists();

   2:  

   3: // Impersonating the context to use a user with a contribute access on the list

   4: lists.Credentials = new NetworkCredential("username","PASS****","domain");

   5:  

   6: // This line must be included – the webservice reference already has it I know,

   7: // otherwise the GetList method will throw Exception 

   8: // of type 'Microsoft.SharePoint.SoapServer.SoapServerException'.

   9: lists.Url = "http://SPServer/sites/SiteCollection/sandbox/TopDeals/_vti_bin/Lists.asmx";

  10:  

  11: // Use these two lines to learn about the actual static names of the list fields

  12: //XmlNode xmlNode = lists.GetList("LIST_NAME");

  13: //System.IO.File.WriteAllText("Top10.xml", xmlNode.OuterXml);

  14:  

  15: string strBatch = "<Method ID='1' Cmd='New'>" +

  16:     "<Field Name='Title'>WaleedsTitle</Field>" +

  17:     "<Field Name='Deal_x0020_Size'>1,000,000</Field>" +

  18:     "<Field Name='Step'>Technical Win</Field>" +

  19:     "<Field Name='Rep'>TJ</Field>" +

  20:     "<Field Name='Partner'>WaleedTMC</Field>" +

  21:     "<Field Name='Special_x0020_Needs'>support from the presales</Field>" +

  22:     "<Field Name='Product_x0020_Status'>Running in Staging</Field></Method>";

  23:     

  24: XmlDocument xmlDoc = new System.Xml.XmlDocument();

  25: XmlElement elBatch = xmlDoc.CreateElement("Batch");

  26:  

  27: elBatch.InnerXml = strBatch;

  28:  

  29: lists.UpdateListItems("LIST_NAME", elBatch);

Some helpful resources:

http://stackoverflow.com/questions/85392/sharepoint-how-do-insert-new-items-using-the-list-web-service

http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx

http://msdn.microsoft.com/en-us/library/lists.lists.getlist(v=office.12).aspx

http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/777310c3-009f-4efd-8006-783480dd1ee8

When it comes to writing a code library and you wish to write a function that takes both function pointers and functors then it’s the right time for you to use templates. The templated function will deduce the proper type for the functor or function pointer, and both functors and function pointers are used in the exact same way – they both look like function calls – so the code in the function will compile fine.

For example, let’s say you had this simple little find_matching_numbers function that takes a vector and returns a vector of all numbers for which a given function returns true.

   1: std::vector<int> find_matching_numbers 

   2: (std::vector<int> vec, bool (*pred)(int)) 

   3: { 

   4:     std::vector<int> ret_vec; 

   5:     std::vector<int>::iterator itr = vec.begin(), 

   6:     end = vec.end(); 

   7:     while ( itr != end ) 

   8:     { 

   9:         if ( pred( *itr ) )  

  10:         {  

  11:             ret_vec.push_back( *itr ); 

  12:         } 

  13:         ++itr; 

  14:     } 

  15: } 

We could convert this function to allow either functors or function pointers by templating on the type of the second argument:

   1: template <typename FuncType> 

   2: std::vector<int> find_matching_numbers

   3: ( std::vector<int> vec, FuncType pred ) 

   4: { 

   5:     std::vector<int> ret_vec; 

   6:     std::vector<int>::iterator itr = vec.begin(), 

   7:     end = vec.end(); 

   8:     while ( itr != end ) 

   9:     { 

  10:         if ( pred( *itr ) )  

  11:         {  

  12:             ret_vec.push_back( *itr ); 

  13:         } 

  14:         ++itr; 

  15:     } 

  16: } 

  17:  

Few days ago the Egyptian tweeps have conducted the first elections for the twitter presidency, hundreds of Egyptians who dream about freedom and a democratic state for better Egypt have decided to fill their practice gap, take their dreams to the cyber space and enrich their democratic awareness, perhaps they live to see an end to the dictatorship in Egypt.

A public debate between the two presidential candidates – @abo3atef and @maboulazm – has taken place before the elections to introduce their programs and demonstrate their personal talent to the voters. Yesterday the organizers have announced @abo3atef as the first twitter president; the organizers have considered this round as an experimental trial to learn the proper channels and processes of conducting a well organized cyber election in the second round which is planned to be on the 1st of August. The adoption for technology and new ideas to eliminating voting problems and establishing a system of transparency brings to the surface the current immobility of the Egyptian national election process and Mubarak’s insistence in using methods that have been ceased decades ago to ease the election rigging, and the monopoly on power and wealth.

it’s worth mentioning that Ayman Nour – @ayman_nour – the 2005 Egypt presidential elections’ candidate has participated in this cyber election and congratulated @abo3atef through a tweet from his own twitter account.

 

Technorati Tags: ,

New York–During the last three days, Egyptian intellectuals and American academics met at New York’s City University to discuss the currently ambiguous future of Egypt. They debated issues of regime repression, especially this month’s extension of the Emergency Law. More importantly, they questioned whether to accept external pressure, namely US interference, in the process of democratic reform in Egypt.

The main organizer of the conference was the Alliance of Egyptian Americans (AEA). It invited many prominent figures from different Egyptian political parties and movements, who came to the US especially for the event, to discuss the issue. The presence of a younger generation of Egyptians living in the US among the audience, particularly members of the Egyptian Association for Change-USA, and their profound disagreement with some statements made by the older generation of speakers furthered the controversy.

After receptions, dinners and pleasantries, the most important sessions of the conference took place on Saturday. Eminent Egyptian speakers in these sessions were Hassan Nafaa, professor of political science and coordinator of ElBaradei’s National Association for Change; Yahya al-Jamal, legal and constitutional expert; and Osama al-Ghazali Harb, founder of the Democratic Front Party.

The sessions covered different critical topics, including the current constitutional crisis and the culture and modernization of Egyptian society. They started with al-Jamal’s extraordinary summary of the history of the Egyptian constitution. This history was much needed to place current demands made by ElBaradei to amend the constitution in the proper context. Afterwards, Nafaa provided elaborate insight into upcoming elections, while Harb analyzed the characteristics of the Egyptian authoritarian regime after 1952.

Nafaa affirmed that, despite anticipated fraud in the coming parliamentary elections, not all opposition parties would decide to boycott them. “Some of the official political parties will continue to conclude deals with the government as they used to do,” Nafaa predicted.

The government seeks to get rid of the Muslim Brotherhood’s MPs. Thus, in this year’s assembly elections, the regime might replace them with members of the official political parties. Through such alliances, these parties would find a good chance to gain a few more seats, which wouldn’t change their limited representation in the parliament anyway. That is what they have done over the last three decades.

As for Harb, he focused on the last five years of Egyptian political history, focusing on the limitations on freedom of media and expression in Egypt. More importantly, he insisted that external pressure on the regime after 9/11 played a major role in enhancing the margin of freedom in the country, as was evident by the state’s establishment of the National Council for Human rights and the National Council for Women.

“I personally welcome any American pressure on the regime because it had a positive effect on the Egyptian people over the last five years,” Harb opined.

During the last two decades, the most notable means of exerting such pressure has been through extending millions of dollars in funding to human rights organizations in Egypt. They also involved inviting young activists, such as bloggers and members of the 6 April youth movement, to receive training at Washington, DC think tanks, particularly Freedom House.

Harb’s statement came as a shock to the younger people in the conference room. Tension immediately rose. Many of them, who were also members of the Egyptian Association for Change-USA, disagreed.

The air in the room was even more heated with the presence of Saad Eddin Ibrahim. Ibrahim’s Ibn Khaldun Center is one of the largest recipients of such funding and a longtime advocate of US intervention in Egypt’s democratization process. Ibrahim was not officially invited to the conference, as AEA President Mahmud al-Shadhili affirmed, due to his close ties with the US administration. Nonetheless, he insisted on showing up.

Young people in the room were constantly “tweeting” and “Facebooking” each other to exchange their reactions to the ongoing debate. One of them posted Harb’s statement on his Facebook page, and immediately received angry responses from other young Egyptians living the US.

“I disagree. What did it [external pressure] do? Was the dictator removed? The answer is NO! International pressure is only a matter of cosmetics on the face of the pressuring country, nothing more,” one female commentator noted. “As a matter of fact, this old generation of Egyptian intellectuals like Osama failed to deliver anything to us and is still advocating stupid solutions that certainly did not work in the past. It is time for us as a new generation to forge our own solutions.”

The activism of young Egyptians in the US has grown so rapidly in the last few months that it is becoming an unprecedented political phenomenon of its own. These young people previously abstained from attending what seemed to them as “elite events”–such as this conference–but now their energetic spirit can be felt both inside and outside Egypt. The majority of these young forces have never been involved in politics before, but they have suddenly surfaced with ElBaradei’s fresh thrust of hope.

“Change should be one hundred percent Egyptian. International pressure comes with baggage and expectations. If we want to build the foundations of a longlasting democracy, we have to do it ourselves,” Ahmed Raslan, a young Egyptian surgeon living in Portland, Oregon argued on Facebook as Harb was speaking.

It is worth mentioning that the Kifaya movement’s Georg Ishaq was among the invited speakers. He is also heading to Washington, DC on 19 May to speak to the Egyptian community there. Beth Baron and Joseph Massad were among the American scholars who gave scholarly analytical presentations on Egyptian political affairs.

As the conference winds up its activities today, the Egyptian intellectuals and opposition figures will soon head back to Cairo. It is unclear, however, how the Egyptian regime will receive them.

[AlmasryAlyoum’s link]

http://www.almasryalyoum.com/en/news/egypts-future-debated-nyc

LiveJournal Tags: ,

Before the end of the last week Chris Nuttal and Richard Waters wrote about the battle that’s about to begin between Apple, and Google on the mobile ads.

http://www.ft.com/cms/s/0/9b1476de-434a-11df-9046-00144feab49a.html 

Apple is moving ahead on their own ad network – iAd. It is going to be very interesting to see what Apple can do with their offering for this market — in my opinion, it’s actually going to be kind of hard for them to gain some footing in the near future.

For Google Ad words, it’s a mature product and successfully becoming a cash cow for Google, it’s pretty easy to use it now and create an advertisement – two lines of text and an icon if you want. From my research on iAd, apparently it wouldn’t be that easy to create an ad.

There aren’t many things that Apple completely fails at, however iAd targets completely different customers other than what Apple has right now, they are with high standards, including a really good and established channel, powerful tools to measure their success, and cost effectiveness.

The pricing model for Google Adwords is based on an auction on words, Apple has not announced yet how it’s going to be on iAd but they have to come up with a very creative pricing model that can attract customers from Google.

Over the last year the tension between Google and Apple went to a different level when Google released a new mobile with almost the same capabilities of an iPhone, it has been considered a real competition for iPhone. With Apple’s entrance to the advertisement market and taking some shares from Google, Apple would reach strategic position that might put them in a better position in negotiating partnerships with other supporting sectors.

Now there’s already a fight on acquiring the big mobile and web ad agencies, Apple already tried to acquire AdMob but Google came in between to prevent it from happening, and now lawyers at FTC (Federal trade commission) are working on assembling evidence to build a case to block Google’s acquisition of AdMob. It seems like the next few years will be full of changes in the web and mobile advertisement market that will bring up new opportunities and investments.

 

Technorati Tags: ,,,

Ranked by: Editorial determination of companies’ reputation, products, and industry influence.

1. Adobe Systems Inc.
2. Eclipse
3. Google Inc.
4. Microsoft Corp.
5. Ruby on Rails
6. Sun Microsystems Inc.

Source Citation: "World’s Leading Software Companies in Web Development, 2009." Software Development Times, SD Times 100 (annual), June 15, 2009, p. 24. Business Rankings Annual 2010. Gale, 2010.

Chrome OS, Follow-up

November 30, 2009

A week ago Google said the first devices (they are devices now, not only the netbooks, but they said the netbooks will be the first to have it) running its new Chrome operating system will be available by the end of 2010, Sundar Pichai, a Google VP, said “the company is specifying what hardware features, such as chips and wireless cards, devices must have to run the software”

“The new operating system comes as Google looks for ways to diversify its business. Online advertising constitutes 97% of the company’s $22 billion in annual revenue and efforts to cash in on its software applications and video-sharing site YouTube have generated limited results. Analysts say Chrome OS is an ambitious long-term strategic move, but any impact on the company’s financial performance would be years away.”

“In a statement, Microsoft said Google’s product "appears to be in the early stages of development."” [WSJ]

Pichai said “Chrome OS can pull data from devices such as digital cameras and will support printing, it boots up to bring consumers right into the company’s Chrome Web browser. It stores users’ data online, allowing them to access it from other devices. But the software will have some limited ability for users to perform tasks without Internet access, such as watching videos” one of the questions raised about the software in the past.

Technorati Tags:
Follow

Get every new post delivered to your Inbox.

Join 130 other followers