<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Absolute Bits &#38; Beats</title>
	<atom:link href="https://wabdelwahab.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://wabdelwahab.wordpress.com</link>
	<description></description>
	<lastBuildDate>Fri, 02 Jan 2015 01:08:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">1367470</site><cloud domain='wabdelwahab.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s2.wp.com/i/webclip.png</url>
		<title>Absolute Bits &#038; Beats</title>
		<link>https://wabdelwahab.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://wabdelwahab.wordpress.com/osd.xml" title="Absolute Bits &#38; Beats" />
	<atom:link rel='hub' href='https://wabdelwahab.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Read in 2014</title>
		<link>https://wabdelwahab.wordpress.com/2015/01/02/read-in-2014/</link>
					<comments>https://wabdelwahab.wordpress.com/2015/01/02/read-in-2014/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Fri, 02 Jan 2015 01:08:00 +0000</pubDate>
				<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=303</guid>

					<description><![CDATA[1. The Fastlane – MJ DeMaro – 4-star 2. One up on wall-street – Peter Lynch – 3-star 3. OS internals and design principles – William Stallings – 3-star 4. Rich Dad Poor Dad – Robert Kiyosaki – 4-star 5. The Startup Playbook – David Kidder and Reid Hoffman – 3-star 6. Getting Real – [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>1. The Fastlane – MJ DeMaro – 4-star<br />
2. One up on wall-street – Peter Lynch – 3-star<br />
3. OS internals and design principles – William Stallings – 3-star<br />
4. Rich Dad Poor Dad – Robert Kiyosaki – 4-star<br />
5. The Startup Playbook – David Kidder and Reid Hoffman – 3-star<br />
6. Getting Real – 37 Signals – 4-star<br />
7. Running Lean – Ash Maurya – 5-star<br />
8. Algorithms in a Nutshell – George H., Gray P. and Stanley S. – 4-star<br />
9. Delivering Happiness – Tony Hsieh – 4-star<br />
10. A bug Hunter’s Diary – Tobias Klein – 4-star<br />
11. The Art of Software Security Assessment – Mark Dowd, John McDonald and Justin Schuh – 2-star<br />
12. Yes! – Noah Goldstein, Steve Martin, Robert Cialdini – 3-Star<br />
13. Never Eat Alone – Keith Ferrazzi, Thal Raz – 4-Star<br />
14. Basic Economics – Thomas Sowell – 3-Star<br />
15. Functional JavaScript – Michael Fogus – 3-Star<br />
16. Data Smart – John W. Foreman – 4-Star</p>
<p>Ratings: 5-Star: Must read; 1-Star: Don’t waste your time</p>
<p>This was the list of books I was fortunate to read last year, I hope you find them inspiring and useful.</p>
<p>Happy New Year!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2015/01/02/read-in-2014/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">303</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>Node.js Web Applications Security Risks &#8211; CRSF</title>
		<link>https://wabdelwahab.wordpress.com/2014/07/16/node-js-web-applications-security-risks-crsf/</link>
					<comments>https://wabdelwahab.wordpress.com/2014/07/16/node-js-web-applications-security-risks-crsf/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Wed, 16 Jul 2014 02:12:12 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=282</guid>

					<description><![CDATA[As more node.js web applications are deployed into production, the high performance gains should never come at the expense of security, it&#8217;s crucial to validate your app against the common web application vulnerabilities like the top 10 risks defined by OWASP and know how they manifest in the node.js environment. Injection Broken authentication and session management [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>As more node.js web applications are deployed into production, the high performance gains should never come at the expense of security, it&#8217;s crucial to validate your app against the common web application vulnerabilities like <a href="https://www.owasp.org/index.php/Top_10_2013-Top_10" target="_blank">the top 10 risks defined by OWASP</a> and know how they manifest in the node.js environment.</p>
<ol>
<li>Injection</li>
<li>Broken authentication and session management</li>
<li>Cross-site scripting (XSS)</li>
<li>Insecure direct object references</li>
<li>Security misconfiguration</li>
<li>Sensitive data exposure</li>
<li>Missing function level access</li>
<li><strong>Cross-site request forgery (CRSF)</strong></li>
<li>Using components with known vulnerabilities</li>
<li>Unvalidated redirects and forwards</li>
</ol>
<p>In this post I will cover the node.js specific mitigation and prevention techniques against the cross-site request forgery (CRSF). A CSRF attack forces a logged-on victim’s browser to send a forged HTTP request, including the victim’s session cookie and any other automatically included authentication information, to a vulnerable web application. This allows the attacker to force the victim’s browser to generate requests the vulnerable application thinks are legitimate requests from the victim.</p>
<p>Before I get to the mitigation techniques used for node.js and express, let&#8217;s take a look at how to exploit a CRSF vulnerability. In this example I will use the <a href="http://nodegoat.herokuapp.com/login" target="_blank">node goat</a> application as our target.</p>
<p><a title="node goat application" href="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png"><img data-attachment-id="283" data-permalink="https://wabdelwahab.wordpress.com/1/" data-orig-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png" data-orig-size="913,938" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="1" data-image-description="" data-image-caption="" data-large-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=480" class="alignnone  wp-image-283" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=465&#038;h=477" alt="1" width="465" height="477" srcset="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=292 292w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=465 465w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=146 146w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=768 768w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png 913w" sizes="(max-width: 465px) 100vw, 465px" /></a></p>
<p>Assuming the victim is already logged in and the session cookie is available, an attacker that previously learned about the behavior of the authenticated areas in this application could take advantage of the victim&#8217;s session information to send a request using a forged form or using an image embedded in a linked HTML page.</p>
<p><a title="the victim is already logged in" href="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png"><img data-attachment-id="284" data-permalink="https://wabdelwahab.wordpress.com/2/" data-orig-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png" data-orig-size="913,938" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="2" data-image-description="" data-image-caption="" data-large-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=480" class="alignnone  wp-image-284" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=467&#038;h=480" alt="2" width="467" height="480" srcset="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=292 292w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=467 467w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=146 146w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=768 768w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png 913w" sizes="(max-width: 467px) 100vw, 467px" /></a></p>
<p>For example, in this vulnerable application the victim has a form where the payroll contributions percent can be changed.</p>
<p><a title="payroll contributions percent form" href="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png"><img data-attachment-id="285" data-permalink="https://wabdelwahab.wordpress.com/3/" data-orig-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png" data-orig-size="913,938" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="3" data-image-description="" data-image-caption="" data-large-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=480" class="alignnone  wp-image-285" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=463&#038;h=475" alt="3" width="463" height="475" srcset="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=292 292w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=463 463w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=146 146w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=768 768w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png 913w" sizes="(max-width: 463px) 100vw, 463px" /></a></p>
<p>The attacker can change the victims contributions by hosting a forged form like the below. once the victim&#8217;s submits this form, a request with the user&#8217;s session information will be sent to the vulnerable application and lead to an unintended change to the victims contributions.</p>
<blockquote>
<pre>&lt;html lang="en"&gt;<br /> &lt;head&gt;&lt;/head&gt;<br /> &lt;body&gt;<br />  &lt;form method="POST" action="http://TARGET_APP_URL_HERE/contributions"&gt;<br />  &lt;h1&gt; You are about to win a brand new iPad!&lt;/h1&gt;<br />  &lt;h2&gt; Click on the win button to claim it...&lt;/h2&gt;<br />  &lt;input type="hidden" name="pretax" value="30"/&gt;<br />  &lt;input type="hidden" name="roth" value="0"/&gt;<br />  &lt;input type="hidden" name="aftertax" value="0"/&gt;<br />  &lt;input type="submit" value="Win !!!"/&gt;<br />  &lt;/form&gt;<br /> &lt;/body&gt;<br />&lt;/html&gt;</pre>
</blockquote>
<p>When this form is submitted, the vulnerable application will handle it as a legitimate request since it has no validation for the source of the request and it will update the victim&#8217;s contributions to the submitted values.</p>
<p><a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png"><img loading="lazy" data-attachment-id="286" data-permalink="https://wabdelwahab.wordpress.com/4/" data-orig-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png" data-orig-size="913,938" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="4" data-image-description="" data-image-caption="" data-large-file="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=480" class="alignnone  wp-image-286" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=464&#038;h=476" alt="4" width="464" height="476" srcset="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=292 292w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=464 464w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=146 146w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=768 768w, https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png 913w" sizes="(max-width: 464px) 100vw, 464px" /></a></p>
<p><strong>How to prevent this attack in Node.js web apps?</strong></p>
<p>There are two easy approaches, one is using csrf middleware that&#8217;s provided with the Express (version 2 or 3) and the second is to using <a href="https://www.npmjs.org/package/csurf">csurf</a> directly as an external middleware from.</p>
<p>Add the CSRF module to the express app configuration, Then create a custom middleware to generate new token using req.csrfToken(); and exposes it to view by setting it in res.locals. The CSRF middleware depends on session support to save the CSRF token on the server so it has to be initialized after the session module.</p>
<blockquote>
<pre>app.configure(function(){<br /> app.set('port', process.env.PORT || 3000);<br /> app.set('views', __dirname + '/views');<br /> app.set('view engine', 'jade');<br /> app.use(express.favicon());<br /> app.use(express.logger('dev'));<br /> app.use(express.bodyParser());<br /> app.use(express.methodOverride());<br /> app.use(express.cookieParser('your secret here'));<br /> app.use(express.session());</pre>
<pre>// enable csrf protection<br />app.use(express.csrf());</pre>
<pre>app.use(function(req, res, next){<br /> res.locals.token = req.session._csrf;<br /> next();<br />});</pre>
<pre> app.use(app.router);<br /> app.use(express.static(path.join(__dirname, 'public')));<br />});</pre>
</blockquote>
<p>once this is complete, a variable will be available to the templates to set a hidden form field in the your view as below:</p>
<blockquote>
<pre>&lt;input type="hidden" name="_csrf" value="{{ csrftoken }}"&gt;</pre>
</blockquote>
<p>An example for the hidden field in a form in a jade template:</p>
<blockquote>
<pre>form(action='/form',method='post')<br /> input(type='hidden', name='_csrf', value=token)<br /> label(for='color') Color:<br /> input(type='text',name='color',size='50')<br /> button(type='submit') Save</pre>
</blockquote>
<p>After we start the application and view the source of this basic form in the browser, we should see our request&#8217;s unique csrf value.</p>
<blockquote>
<pre>&lt;form action="/form" method="post"&gt;<br /> &lt;input type="hidden" name="_csrf" value="Ju0W8XT1IZVERTf5NQrGpo3oc"&gt;<br /> &lt;label for="color"&gt;Color:&lt;/label&gt;<br /> &lt;input type="text" name="color" size="50"&gt;<br /> &lt;button type="submit"&gt;Save&lt;/button&gt;<br />&lt;/form&gt;</pre>
</blockquote>
<p>The CSRF middleware will look for the CSRF token in three locations. First, it will check for a _csrf property in the request body (req.body._csrf), next it will check for it on the query string (req.query._csrf), and finally, it will check the request headers (req.headers[&#8216;x-csrf-token&#8217;]). If any other request type is made and this csrf value is missing, the middleware will reject the request with an 403 &#8211; Forbidden status.</p>
<p>Express CSRF middleware ignores verifying tokens on HTTP GET, OPTIONS, and HEAD requests (which is correct) however there&#8217;s a caveat.</p>
<blockquote>
<pre>GET / HTTP/1.1<br />[..]<br />_method=POST</pre>
</blockquote>
<p>As a result, it is possible to bypass the security control by sending a GET request with a POST MethodOverride header or parameter like in the above code.</p>
<blockquote>
<pre>app.use(csrf()) // #1<br />app.use(methodOverride()) // #2<br />// vulnerable code!</pre>
</blockquote>
<p>If the methodoverride module was configured after the csrf module like above, it would lead to this vulnerability since the csrf module needs to know the method of the request first. The workaround is clearly to disable methodOverride or make sure that it takes precedence over other middleware declarations.</p>
<p> </p>
<p>References:</p>
<p><a href="http://www.securitytube.net/video/196" target="_blank">Cross Site Request Forgery (CSRF) Tutorial</a></p>
<p><a href="https://github.com/expressjs/csurf/issues/8" target="_blank">Always check CSRF token if request has body</a></p>
<p><a href="http://www.securityninja.co.uk/application-security/improve-your-security-testing-with-the-fuzzdb/" target="_blank">Improves your security testing with fuzzdb</a></p>
<p><a href="http://sporcic.org/2012/10/csrf-with-nodejs-and-express-3/" target="_blank">CSRF with NODEJS and EXPRESS 3</a></p>
<p><a href="http://www.mircozeiss.com/using-csrf-with-express-and-angular/" target="_blank">Using CSRF protection with Express and AngularJS</a></p>
<p><a href="https://www.owasp.org/index.php/Top_10_2013-Top_10" target="_blank">OWASP top ten web application risks</a></p>
<p><a href="http://nodegoat.herokuapp.com/login" target="_blank">OWASP Node Goat Project</a></p>
<p><a href="http://fluentconf.com/fluent2014/public/schedule/detail/32664" target="_blank">Top overlooked security threats to Node.js web applications</a></p>
<p> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2014/07/16/node-js-web-applications-security-risks-crsf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">282</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/1.png?w=292" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/2.png?w=292" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/3.png?w=292" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2014/07/4.png?w=292" medium="image">
			<media:title type="html">4</media:title>
		</media:content>
	</item>
		<item>
		<title>Read in 2013</title>
		<link>https://wabdelwahab.wordpress.com/2013/12/31/read-in-2013/</link>
					<comments>https://wabdelwahab.wordpress.com/2013/12/31/read-in-2013/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Tue, 31 Dec 2013 00:29:46 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=262</guid>

					<description><![CDATA[1. Advanced Programming in the UNIX Environment SE – Richard Stevens and Stephen Rago – 5-Star 2. API Design for C++ &#8211; Martin Reddy – 5-Star 3. Founders at work – Jessica Livingston – 4-Star 4. Version Management with CVS – Per Cederqvist – 3-Star 5. The C Programming Language – Brian Kernighan, Dennis Ritchie [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>1.	Advanced Programming in the UNIX Environment SE  – Richard Stevens and Stephen Rago – 5-Star<br />
2.	API Design for C++ &#8211; Martin Reddy – 5-Star<br />
3.	Founders at work – Jessica Livingston – 4-Star<br />
4.	Version Management with CVS – Per Cederqvist – 3-Star<br />
5.	The C Programming Language – Brian Kernighan, Dennis Ritchie – 5-Star<br />
6.	The power of habit – Charles Duhigg &#8211; 3-Star<br />
7.	Permission Marketing – Seth Godin – 3-Star<br />
8.	Built to Sell – John Warrilow – 5-Star<br />
9.	The sun also rises – Ernest Hemingway – 3-Star<br />
10.	Computer Security principles and practice – Stallings – 4-Star<br />
11.	Cryptography Engineering – Ferguson, Schneier, Kohno – 3-Star<br />
12.	Counter Hack Reloaded – Skoudis, Liston – 5-Star<br />
13.	HTML5 Game Development – Jesse Freemen – 3-Star<br />
14.	Moonwalking with Einstein – Joshua Foer – 4-Star<br />
15.	JQuery Mobile up and running – Maximiliano Firtman – 5-Star<br />
16.	The $100 Starup – Chris Guillebeau – 5-Star<br />
17.	Lean Startup – Eric Ries – 4-Star<br />
18.	 4-Star &#8211; الفيل الأزرق – أحمد مراد</p>
<p>Ratings: 5-Star: Must read; 1-Star: Don’t waste your time</p>
<p>I hope you find them inspiring and useful. I have the books available if anyone wants any of them. </p>
<p>Happy New Year!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2013/12/31/read-in-2013/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">262</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>Built to Sell</title>
		<link>https://wabdelwahab.wordpress.com/2013/02/26/built-to-sell/</link>
					<comments>https://wabdelwahab.wordpress.com/2013/02/26/built-to-sell/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Tue, 26 Feb 2013 01:56:50 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Built To Sell]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=275</guid>

					<description><![CDATA[It’s been awhile since I was into a book that much. It’s not amazingly written but its story has kept me engaged from the beginning to end, every night after work, listening to its audio book on my commutes, and dedicate a full weekend for it – the weekend is priceless for a software engineer [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/B004IYISQW/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B004IYISQW&amp;linkCode=as2&amp;tag=absbitbea-20" target="_blank"><img loading="lazy" style="margin:5px 15px 10px 0;display:inline;border-width:0;" title="Built To Sell" border="0" alt="Built To Sell" align="left" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/builttosell.jpg?w=151&#038;h=242" width="151" height="242" /></a> It’s been awhile since I was into a book that much. It’s not amazingly written but its story has kept me engaged from the beginning to end, every night after work, listening to its audio book on my commutes, and dedicate a full weekend for it – the weekend is priceless for a software engineer as you all might know. I highly recommend this book for all the value creators.</p>
<p>The book is a fictional story about Alex Stapleton, an advertising agency owner, and his struggle to convert his business into a sellable one. With the help of his friend Ted, he converts the business from a struggling one that relies too heavily upon him and a single, overly demanding client, to a highly-focused one that thrives without his constant low-level involvement.    <br />If you&#8217;ve read many business books on the subject of entrepreneurship and management, these concepts will seem very familiar, but set in a slightly different context. Throughout the book, I felt that the content borrowed heavily from the E-Myth &#8211; who the author credits in the appendix. The important variation from E-Myth is that the owner is preparing to sell the business. Everything he does in terms of automating and streamlining the operations is done within the framework of the question: &quot;How will this help me sell this company?&quot;</p>
<p>After the story concludes, the author summarizes the key points, which seems a little redundant but helpful, along with some personal experiences. The greatest flaw of this book is that it never addresses the problems you might have at different points along this process. Again, I highly recommend this book and I hope I get the time to read again next year.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2013/02/26/built-to-sell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">275</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/builttosell.jpg" medium="image">
			<media:title type="html">Built To Sell</media:title>
		</media:content>
	</item>
		<item>
		<title>Aldostour party App, PhoneGap in action</title>
		<link>https://wabdelwahab.wordpress.com/2013/02/16/aldostour-party-app-phonegap-in-action/</link>
					<comments>https://wabdelwahab.wordpress.com/2013/02/16/aldostour-party-app-phonegap-in-action/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Sat, 16 Feb 2013 14:59:17 +0000</pubDate>
				<category><![CDATA[App Development]]></category>
		<category><![CDATA[Egypt]]></category>
		<category><![CDATA[Aldostour party]]></category>
		<category><![CDATA[Appcelerator]]></category>
		<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[حزب الدستور]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=273</guid>

					<description><![CDATA[Two months ago I was invited to a meeting with the Egyptian activists and Aldostour party supporters Sherif Mansour, Zaid Salah, and Amgad Abdelhafez at one of the Egyptian cafes at the Arabic Steinway in Astoria. We were discussing our local plan, projects and activities for the upcoming months. Among other projects we agreed on [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Two months ago I was invited to a meeting with the Egyptian activists and Aldostour party supporters Sherif Mansour, Zaid Salah, and Amgad Abdelhafez at one of the Egyptian cafes at the Arabic Steinway in Astoria. We were discussing our local plan, projects and activities for the upcoming months. Among other projects we agreed on initiating an effort to build a mobile app for the party and help provide another means of communication for a growing mobile user community.</p>
<p><a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_2.jpg"><img loading="lazy" style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="wide_screenshot_2" border="0" alt="wide_screenshot_2" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_2_thumb.jpg?w=482&#038;h=302" width="482" height="302" /></a></p>
<p>The technical goals for the app development can simply be summarized in: </p>
<p>1. Cross platform mobile development: One codebase – easier development, testing and maintenance. The app should be Installed as a native app for as many devices as possible, this includes iOS, Android, Windows Phone, Blackberry, etc.</p>
<p>2. Wide contributor base: building a web-based app in a native wrapper would let us use existing expertise. Almost everyone can help with JavaScript, and web technologies.&#160; It would make it very easy for the tech volunteers to join the app dev team, add new features and help with bug fixing.</p>
<p><a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_1.jpg"><img loading="lazy" style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="wide_screenshot_1" border="0" alt="wide_screenshot_1" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_1_thumb.jpg?w=482&#038;h=302" width="482" height="302" /></a> </p>
<p>The existence of many frameworks like <a href="www.rhomobile.com">RhoMobile</a>, <a href="http://phonegap.com/">PhoneGap</a>, <a href="http://www.appcelerator.com/">Appcelerator</a>, <a href="http://www.mosync.com/">Mosync</a>, <a href="http://www.coronalabs.com/">Corona</a>, etc. – <a href="http://moblearn.blogspot.com/2011/07/best-tools-for-cross-platform-app.html">more info here</a> – made it a little hard to pick one in the limited time we had. Based on the online reviews and recommendations, I have narrowed this down to PhoneGap and Appcelerator.</p>
<p><a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_3.jpg"><img loading="lazy" style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="wide_screenshot_3" border="0" alt="wide_screenshot_3" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_3_thumb.jpg?w=482&#038;h=302" width="482" height="302" /></a> </p>
<p>Both have a good wide range of APIs – accelerometer, GPS/location, camera, sound, etc. PhoneGap was ready for almost all available platforms with an easy and smooth cloud-based build engine, where Appcelerator was ready to support iOS and Android with a promise to support others in the future. PhoneGap looked a lot simpler for this project as it takes the HTML/CSS/JavaScript as is into a web container, however the Appcelerator analyzes and compiles it into the representative symbols of the native code and the UI is built by using the phone’s native resources which might eventually lead to writing specific code for each platform. </p>
<p align="center"><a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_1.jpg"><img loading="lazy" style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="small_screenshot_1" border="0" alt="small_screenshot_1" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_1_thumb.jpg?w=199&#038;h=307" width="199" height="307" /></a> <a href="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_2.jpg"><img loading="lazy" style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="small_screenshot_2" border="0" alt="small_screenshot_2" src="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_2_thumb.jpg?w=199&#038;h=307" width="199" height="307" /></a> </p>
<p>The App is still a work-in-progress. We are planning to release a beta version by the end of March. Please contact me <a href="http://twitter.com/waleedeg">@waleedeg</a> if you would like to join the development team or know more.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2013/02/16/aldostour-party-app-phonegap-in-action/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">273</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_2_thumb.jpg" medium="image">
			<media:title type="html">wide_screenshot_2</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_1_thumb.jpg" medium="image">
			<media:title type="html">wide_screenshot_1</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/wide_screenshot_3_thumb.jpg" medium="image">
			<media:title type="html">wide_screenshot_3</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_1_thumb.jpg" medium="image">
			<media:title type="html">small_screenshot_1</media:title>
		</media:content>

		<media:content url="https://wabdelwahab.wordpress.com/wp-content/uploads/2013/02/small_screenshot_2_thumb.jpg" medium="image">
			<media:title type="html">small_screenshot_2</media:title>
		</media:content>
	</item>
		<item>
		<title>Read in 2011</title>
		<link>https://wabdelwahab.wordpress.com/2011/12/31/read-in-2011/</link>
					<comments>https://wabdelwahab.wordpress.com/2011/12/31/read-in-2011/#comments</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Sat, 31 Dec 2011 23:14:31 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=260</guid>

					<description><![CDATA[Voyage through time – Ahmed Zeweil – 3-Star Developer&#8217;s Workshop to COM and ATL 3.0 – Andrew W. Troelsen – 3-Star Advanced Windows Debugging – Hewardt and Pravat – 4-Star The Data Warehouse ToolKit &#8211; Margy Ross – 4-Star The Google Resume – Gayle McDowell – 5-Star Inside the Microsoft Build Engine &#8211; Sayed Hashimi [&#8230;]]]></description>
										<content:encoded><![CDATA[<ol>
<li>Voyage through time – Ahmed Zeweil – 3-Star </li>
<li>Developer&#8217;s Workshop to COM and ATL 3.0 – Andrew W. Troelsen – 3-Star </li>
<li>Advanced Windows Debugging – Hewardt and Pravat – 4-Star </li>
<li>The Data Warehouse ToolKit &#8211; Margy Ross – 4-Star </li>
<li>The Google Resume – Gayle McDowell – 5-Star </li>
<li>Inside the Microsoft Build Engine &#8211; Sayed Hashimi – 4-Star </li>
<li>Learning Perl (the llama book) – Randal Schwartz – 4-Star </li>
<li>Large Scale C++ Software Design – John Lakos – 3-Star </li>
<li>Exceptional C++ &#8211; Herb Sutter – 4-Star </li>
<li>Into the wild – Jon Krakauer – 3-Star </li>
<li>The big 5-oh – Sandra D. Bricker – 2-Star </li>
<li>Be your own best publicist – Jessica Kleiman and Meryl Cooper – 3-Star </li>
<li>Automating System Administration with Perl – David Blank-Edelman – 1-Star </li>
<li>Windows Internals 5<sup>th</sup> edition – Mark Russinovish – 3-Star </li>
<li>Emotional Intelligence 2.0 – Travis Bradberry and Jean Greaves – 2-Star </li>
<li>Windows via C/C++ &#8211; Jeffrey M. Richter, Christophe Nasarre &#8211; 5-Star </li>
<li>More Exceptional C++ &#8211; Herb Sutter &#8211; 3-Star </li>
<li>Programming Windows Azure &#8211; Sriram Krishnan &#8211; 4-Star </li>
<li>Azure in Action – Chris Hay and Brain Prince – 1-Star </li>
<li>Introducing HTML5 – Bruce Lawson and Remy Sharp – 3-Star </li>
<li>Outliers – Malcolm GladWell – 4-Star </li>
</ol>
<p>Ratings: 5-Star: Must read; 1-Star: Don’t waste your time</p>
<p>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. </p>
<p>Happy New Year!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2011/12/31/read-in-2011/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">260</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell extensions in c++, step by step</title>
		<link>https://wabdelwahab.wordpress.com/2011/09/05/shell-extensions-in-c-step-by-step/</link>
					<comments>https://wabdelwahab.wordpress.com/2011/09/05/shell-extensions-in-c-step-by-step/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 08:49:04 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[shell extensions]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/2011/09/05/shell-extensions-in-c-step-by-step/</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Writing shell extensions is one of those programming tasks in which C++ (with the help of a library like ATL) excels – an MSFT explained <a href="http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/1428326d-7950-42b4-ad94-8e962124043e/">here</a> why it is better to avoid .NET for writing shell extensions.</p>
<p>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:</p>
<ol>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide1.aspx">A step-by-step tutorial on writing shell extensions.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide2.aspx">A tutorial on writing a shell extension that operates on multiple files at once.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide3.aspx">A tutorial on writing a shell extension that shows pop-up info for files.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide4.aspx">A tutorial on writing a shell extension that provides custom drag and drop functionality.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide5.aspx">A tutorial on writing a shell extension that adds pages to the properties dialog of files.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide6.aspx">A tutorial on writing a shell extension that can be used on the Send To menu.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide7.aspx">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.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide8.aspx">A tutorial on adding columns to Explorer&#8217;s details view via a column handler shell extension.</a></li>
<li><a href="http://www.codeproject.com/KB/shell/shellextguide9.aspx">A tutorial on writing an extension to customize the icons displayed for a file type.</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2011/09/05/shell-extensions-in-c-step-by-step/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">259</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint List Web-Services, delete all items</title>
		<link>https://wabdelwahab.wordpress.com/2011/06/10/sharepoint-list-web-services-delete-all-items/</link>
					<comments>https://wabdelwahab.wordpress.com/2011/06/10/sharepoint-list-web-services-delete-all-items/#comments</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Fri, 10 Jun 2011 17:25:42 +0000</pubDate>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Development]]></category>
		<category><![CDATA[SharePoint WebServices]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/2011/06/10/sharepoint-list-web-services-delete-all-items/</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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 <a href="http://www.victorshi.com/post/2010/04/20/How-to-bulk-delete-in-SharePoint.aspx">CAML</a> (<a href="http://twitter.com/ahmedig">@AhmedIG</a>) or by using <a href="http://msdn.microsoft.com/en-us/library/ee857094(office.14).aspx">CSOM</a> (<a href="http://about.me/haytham">Haytham</a>), 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.</p>
<p>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)</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:220px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">Batch</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>   <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">Method</span> <span style="color:#ff0000;">ID</span><span style="color:#0000ff;">='1'</span> <span style="color:#ff0000;">Cmd</span><span style="color:#0000ff;">='Delete'</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">Field</span> <span style="color:#ff0000;">Name</span><span style="color:#0000ff;">='ID'</span><span style="color:#0000ff;">&gt;</span> TheMissingID <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">Field</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>   <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">Method</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">Batch</span><span style="color:#0000ff;">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>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. </p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> ArrayList GetListIDs(String ListName)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     WS_TopDealLists.Lists listService = <span style="color:#0000ff;">new</span> WS_TopDealLists.Lists();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     listService.Credentials =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>         <span style="color:#0000ff;">new</span> NetworkCredential(<span style="color:#006080;">&quot;username&quot;</span>, <span style="color:#006080;">&quot;PASS****&quot;</span>, <span style="color:#006080;">&quot;domain&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     listService.Url = </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#006080;">&quot;http://SPServer/sites/SiteCollection/sandbox/_vti_bin/Lists.asmx&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     XmlDocument xmlDoc = <span style="color:#0000ff;">new</span> System.Xml.XmlDocument();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     XmlNode ndViewFields =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>         xmlDoc.CreateNode(XmlNodeType.Element, <span style="color:#006080;">&quot;ViewFields&quot;</span>, <span style="color:#006080;">&quot;&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     ndViewFields.InnerXml = <span style="color:#006080;">&quot;&lt;FieldRef Name='ID' /&gt;&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     XmlNode ndListItems =</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>         listService.GetListItems(ListName, <span style="color:#0000ff;">null</span>, <span style="color:#0000ff;">null</span>,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>         ndViewFields, <span style="color:#0000ff;">null</span>, <span style="color:#0000ff;">null</span>, <span style="color:#0000ff;">null</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     <span style="color:#008000;">//convert String to XMLReader</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     XmlReaderSettings settings = <span style="color:#0000ff;">new</span> XmlReaderSettings();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     settings.ConformanceLevel = ConformanceLevel.Fragment;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     settings.IgnoreWhitespace = <span style="color:#0000ff;">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>     settings.IgnoreComments = <span style="color:#0000ff;">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     XmlReader xmlReader = </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>     XmlReader.Create(<span style="color:#0000ff;">new</span> StringReader(ndListItems.OuterXml), settings);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>     ArrayList IDsList = <span style="color:#0000ff;">new</span> ArrayList();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>     <span style="color:#0000ff;">while</span> (xmlReader.Read())</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>         <span style="color:#0000ff;">if</span> (xmlReader.Name == <span style="color:#006080;">&quot;z:row&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>             IDsList.Add(xmlReader.GetAttribute(<span style="color:#006080;">&quot;ows_ID&quot;</span>).ToString());</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>     <span style="color:#0000ff;">return</span> IDsList;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>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.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> DeleteItems(String ListName, ArrayList IDs)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">if</span> (IDs.Count == 0)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>         <span style="color:#0000ff;">return</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     WS_TopDealLists.Lists listService = <span style="color:#0000ff;">new</span> WS_TopDealLists.Lists();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     listService.Credentials = </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#0000ff;">new</span> NetworkCredential(<span style="color:#006080;">&quot;username&quot;</span>, <span style="color:#006080;">&quot;PASS****&quot;</span>, <span style="color:#006080;">&quot;domain&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     listService.Url = </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     <span style="color:#006080;">&quot;http://SPServer/sites/SiteCollection/sandbox/_vti_bin/Lists.asmx&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     <span style="color:#0000ff;">string</span> strBatch = <span style="color:#006080;">&quot;&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     <span style="color:#0000ff;">foreach</span> (String ID <span style="color:#0000ff;">in</span> IDs)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>         strBatch += <span style="color:#006080;">&quot;&lt;Method ID='1' Cmd='Delete'&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>             <span style="color:#006080;">&quot;&lt;Field Name='ID'&gt;&quot;</span> + ID + <span style="color:#006080;">&quot;&lt;/Field&gt;&lt;/Method&gt;&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     XmlDocument xmlDoc = <span style="color:#0000ff;">new</span> System.Xml.XmlDocument();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     XmlElement elBatch = xmlDoc.CreateElement(<span style="color:#006080;">&quot;Batch&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>     elBatch.InnerXml = strBatch;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>     listService.UpdateListItems(ListName, elBatch);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span> }</pre>
<p><!--CRLF--></div>
</div>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:fe366b5b-7662-4fbe-b084-84bd91d5e9a4" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint" rel="tag">SharePoint</a>,<a href="http://technorati.com/tags/SharePoint+WebServices" rel="tag">SharePoint WebServices</a>,<a href="http://technorati.com/tags/SharePoint+Development" rel="tag">SharePoint Development</a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2011/06/10/sharepoint-list-web-services-delete-all-items/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">255</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>SharePoint List Web-Services, list item insertion</title>
		<link>https://wabdelwahab.wordpress.com/2011/06/07/sharepoint-list-web-services-list-item-insertion/</link>
					<comments>https://wabdelwahab.wordpress.com/2011/06/07/sharepoint-list-web-services-list-item-insertion/#comments</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Tue, 07 Jun 2011 20:12:34 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Development]]></category>
		<category><![CDATA[SharePoint Web Services]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/?p=233</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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..</p>
<p>&#160;</p>
<p>  </p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:490px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> WS_TopDealLists.Lists lists = <span style="color:#0000ff;">new</span> WS_TopDealLists.Lists();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#008000;">// Impersonating the context to use a user with a contribute access on the list</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> lists.Credentials = <span style="color:#0000ff;">new</span> NetworkCredential(<span style="color:#006080;">&quot;username&quot;</span>,<span style="color:#006080;">&quot;PASS****&quot;</span>,<span style="color:#006080;">&quot;domain&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> <span style="color:#008000;">// This line must be included – the webservice reference already has it I know,</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> <span style="color:#008000;">// otherwise the GetList method will throw Exception </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> <span style="color:#008000;">// of type 'Microsoft.SharePoint.SoapServer.SoapServerException'.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> lists.Url = <span style="color:#006080;">&quot;http://SPServer/sites/SiteCollection/sandbox/TopDeals/_vti_bin/Lists.asmx&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> <span style="color:#008000;">// Use these two lines to learn about the actual static names of the list fields</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> <span style="color:#008000;">//XmlNode xmlNode = lists.GetList(&quot;LIST_NAME&quot;);</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span> <span style="color:#008000;">//System.IO.File.WriteAllText(&quot;Top10.xml&quot;, xmlNode.OuterXml);</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> <span style="color:#0000ff;">string</span> strBatch = <span style="color:#006080;">&quot;&lt;Method ID='1' Cmd='New'&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Title'&gt;WaleedsTitle&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Deal_x0020_Size'&gt;1,000,000&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Step'&gt;Technical Win&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Rep'&gt;TJ&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Partner'&gt;WaleedTMC&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Special_x0020_Needs'&gt;support from the presales&lt;/Field&gt;&quot;</span> +</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     <span style="color:#006080;">&quot;&lt;Field Name='Product_x0020_Status'&gt;Running in Staging&lt;/Field&gt;&lt;/Method&gt;&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>     </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span> XmlDocument xmlDoc = <span style="color:#0000ff;">new</span> System.Xml.XmlDocument();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> XmlElement elBatch = xmlDoc.CreateElement(<span style="color:#006080;">&quot;Batch&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span> elBatch.InnerXml = strBatch;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span> lists.UpdateListItems(<span style="color:#006080;">&quot;LIST_NAME&quot;</span>, elBatch);</pre>
<p><!--CRLF--></div>
</div>
<p>Some helpful resources:</p>
<p><a title="http://stackoverflow.com/questions/85392/sharepoint-how-do-insert-new-items-using-the-list-web-service" href="http://stackoverflow.com/questions/85392/sharepoint-how-do-insert-new-items-using-the-list-web-service">http://stackoverflow.com/questions/85392/sharepoint-how-do-insert-new-items-using-the-list-web-service</a></p>
<p><a title="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx" href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx">http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx</a></p>
<p><a title="http://msdn.microsoft.com/en-us/library/lists.lists.getlist(v=office.12).aspx" href="http://msdn.microsoft.com/en-us/library/lists.lists.getlist(v=office.12).aspx">http://msdn.microsoft.com/en-us/library/lists.lists.getlist(v=office.12).aspx</a></p>
<p><a title="http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/777310c3-009f-4efd-8006-783480dd1ee8" href="http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/777310c3-009f-4efd-8006-783480dd1ee8">http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/777310c3-009f-4efd-8006-783480dd1ee8</a></p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ccedb50a-6b24-466f-8f7f-5a278e82afe8" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/SharePoint+SharePoint+WebServices+SharePoint+Development" rel="tag">SharePoint SharePoint WebServices SharePoint Development</a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2011/06/07/sharepoint-list-web-services-list-item-insertion/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">233</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
		<item>
		<title>Functors, Function Pointers, and Templates</title>
		<link>https://wabdelwahab.wordpress.com/2011/04/25/functors-function-pointers-and-templates/</link>
					<comments>https://wabdelwahab.wordpress.com/2011/04/25/functors-function-pointers-and-templates/#respond</comments>
		
		<dc:creator><![CDATA[Waleed Abdelwahab Ali]]></dc:creator>
		<pubDate>Mon, 25 Apr 2011 14:33:38 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[c++ templates]]></category>
		<category><![CDATA[function pointers]]></category>
		<category><![CDATA[functors]]></category>
		<guid isPermaLink="false">http://wabdelwahab.wordpress.com/2011/04/25/functors-function-pointers-and-templates/</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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 &#8211; they both look like function calls &#8211; so the code in the function will compile fine.</p>
<p>For example, let&#8217;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. </p>
<div id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> std::vector&lt;<span style="color:#0000ff;">int</span>&gt; find_matching_numbers </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> (std::vector&lt;<span style="color:#0000ff;">int</span>&gt; vec, <span style="color:#0000ff;">bool</span> (*pred)(<span style="color:#0000ff;">int</span>)) </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> { </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     std::vector&lt;<span style="color:#0000ff;">int</span>&gt; ret_vec; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     std::vector&lt;<span style="color:#0000ff;">int</span>&gt;::iterator itr = vec.begin(), </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     end = vec.end(); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#0000ff;">while</span> ( itr != end ) </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     { </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>         <span style="color:#0000ff;">if</span> ( pred( *itr ) )  </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>         {  </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>             ret_vec.push_back( *itr ); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>         } </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>         ++itr; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     } </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> } </pre>
<p><!--CRLF--></div>
</div>
<p>We could convert this function to allow either functors or function pointers by templating on the type of the second argument:</p>
<div id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">template</span> &lt;<span style="color:#0000ff;">typename</span> FuncType&gt; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> std::vector&lt;<span style="color:#0000ff;">int</span>&gt; find_matching_numbers</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> ( std::vector&lt;<span style="color:#0000ff;">int</span>&gt; vec, FuncType pred ) </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> { </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     std::vector&lt;<span style="color:#0000ff;">int</span>&gt; ret_vec; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     std::vector&lt;<span style="color:#0000ff;">int</span>&gt;::iterator itr = vec.begin(), </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     end = vec.end(); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#0000ff;">while</span> ( itr != end ) </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     { </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>         <span style="color:#0000ff;">if</span> ( pred( *itr ) )  </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>         {  </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>             ret_vec.push_back( *itr ); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>         } </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>         ++itr; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     } </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span> } </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>&#160; </pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://wabdelwahab.wordpress.com/2011/04/25/functors-function-pointers-and-templates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">229</post-id>
		<media:content url="https://1.gravatar.com/avatar/d68e7abfdd9be6d0a6ad9f8496d56b08876dfa60ebca3e93dcd421d94fa51206?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waleedali</media:title>
		</media:content>
	</item>
	</channel>
</rss>
