input
stringlengths
51
42.3k
output
stringlengths
18
55k
return eats exception <p>I found the following behavior at least <em>weird</em>:</p> <pre><code>def errors(): try: ErrorErrorError finally: return 10 print errors() # prints: 10 # It should raise: NameError: name 'ErrorErrorError' is not defined </code></pre> <p>The exception disappears when ...
<blockquote> <p>The exception disappears when you use <code>return</code> inside a <code>finally</code> clause. .. Is that documented anywhere?</p> </blockquote> <p><a href="http://docs.python.org/reference/compound_stmts.html#the-try-statement" rel="nofollow">It is:</a></p> <blockquote> <p>If finally is present,...
Why volatile is not enough? <p>I'm confused. Answers to my <a href="http://stackoverflow.com/questions/516940/can-multiple-cpus-simultaneously-write-to-the-same-ram-location">previous question</a> seems to confirm my assumptions. But as stated <a href="http://stackoverflow.com/questions/154551/volatile-vs-interlocked-v...
<p>Herb Sutter recently wrote an article on <code>volatile</code> and what it really means (how it affects ordering of memory access and atomicity) in the native C++. .NET, and Java environments. It's a pretty good read:</p> <ul> <li><a href="http://www.ddj.com/hpc-high-performance-computing/212701484" rel="nofollow">...
JMS rollback <p>I have a process which involves sending a JMS message. The process is part of a transaction. If a later part of the transaction fails, a part that is after a previous part that sent the message, I need to cancel the message. One thought I had was to somehow set on the message that it is not to be picked...
<p>What you have described is an XA transaction. This allows a transaction to scope across multiple layers i.e. JMS provider, DB or any other EIS. Most containers can be configured to use both non XA and none XA transaction so check your container settings!</p> <p>For example if you are using JMS with XA transactions ...
SharePoint Workflows - How to associate with specific content types (particularly folders)? <p>I noticed when working with SharePoint Designer that each workflow has a config xml with tags. Does anyone know how to: 1) Associate the workflow with a specific content type? 2) Know if it is possible to associate a workfl...
<p>It is possible to associate workflows with folders. Apparently Visual Studio created Windows Workflow Foundation (WWF) development is the only tried-and-true way to create custom workflows that can be associated with different content types. There are some enterprise tools that can help a lot for creating custom w...
Using MSMQ for interprocess(inter application) communication on Windows Mobile 5.0 <p>We have a Native Embedded VC (EVC4.0) application running on a Windows Mobile 5 device. Now there is a requirement to get this application to talk with a new mobile application to be developed using either EVC4.0 or .Net CF. We were ...
<p>WM_COPYDATA, sockets, memory-mapped files and point-to-point message queues are all IPC mechanisms for CE (well named events are also available). I tend to lean toward point-to-point queues or memory-mapped files. Which one depends on the nature of the data I want to share.</p>
Code reusability - App_Code or BIN or UserControls? <p>I recently had a discussion on another forum with another developer and the topic was Code Reuse in ASP.NET. The stated scenario was that he needs to update code frequently on Production servers during server uptimes, and this results in Session getting reset for a...
<p>It sounds like the main problem is that he's updating production code too frequently. Other than that, UserControls seem like a perfectly reasonable place to put business logic, especially if you have a good naming convention for them or can put them in a common folder.</p>
How do I get Team Build to show test results and coverage for xUnit.net test suite? <p>Has anybody had any success getting Team Build to show xUnit.net test results and code coverage in the build report? The MSBuild runner is running the tests just fine and the results are in the log file, but the test results and cod...
<p>TFS/TeamBuild definitely requires the test results in a particular format, they also need to be specifically published to TFS as well.</p> <p>I'm currently looking at this problem for the Gallio test runner, and can offer two potential options:</p> <ol> <li>Try wrapping the xUnit tests inside the 'Generic Test' pr...
Library resolution with autoconf? <p>I'm building my first autoconf managed package.</p> <p>However I can't find any simple examples anywhere of how to specify a required library, and find that library where it might be in various different places.</p> <p>I've currently got:</p> <pre><code>AC_CHECK_LIB(['event'], ['...
<p>autoconf script cannot guess the "optional" library locations, which may vary from one platform to another. So you can say</p> <pre><code>CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure </code></pre> <p>For <code>AC_CHECK_LIB()</code> you need to specify the fail condition explicitly in "act...
When NOT to use the Entity Framework <p>I have been playing around with the EF to see what it can handle. Also many articles and posts explain the various scenarios in which the EF can be used, however if miss the "con" side somehow. Now my question is, <strong>in what kind of scenarios should I stay away from the Enti...
<p>The <a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/">Vote of No Confidence</a> lists several missteps and/or missing bits of functionality in the eyes of those who believe they know what features, and their implementations, are proper for ORM/Datamapper frameworks. </p> <p>If ...
URLLoader annoying problem <p>i am trying to load a variable through php from a sql database but i get nothing</p> <p>here is the code</p> <pre><code>var Idfield; var loader:URLLoader = new URLLoader(); // data will come as URL encoded variables loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.load(new URLRe...
<p>I believe the variables format expects the variables in the name=value format so try something like:</p> <pre><code>echo 'id=' . $row[0]; </code></pre>
Refactor "using" directives over an entire codebase? <p>One of the things I love about Visual Studio 2008 is the ability to refactor and reorganize the "using" directives in source code files (this may have been in 2005 as well, I don't remember).</p> <p>Specifically, I'm talking about how you can have it both reorgan...
<p>I believe you can do it solution wide using <a href="http://code.msdn.microsoft.com/PowerCommands" rel="nofollow">Power Commands</a></p> <p>From PowerCommands Documentation:</p> <blockquote> <p>Remove and Sort Usings This command removes and sort using statements for all classes given a project. It is useful, ...
How to order categories in WordPress? <p>I use <code>wp_list_categories()</code> to get the list of all the categories and generate the navigation bar. Is there a way to order these categories in a particular order other than alphabetical ordering. </p> <p>eg: Connect, News &amp; Views, Q&amp;A, Hello Startup, Startup...
<p>If you don't use the Description field of the categories, ordering can also be done by entering a number in each Description field, and subsequently use Javascript / jQuery to order based on this numbering.</p> <p>The wp_list_categories function has a <strong>use_desc_for_title</strong> argument which you can set t...
COM C# Memory leak Tracing <p>Is there a way to find out the memory usage of each dll within a c# application using com dll's? Or what would you say is the best way to find out why memory grows exponentially when using a com object (IE. Whether the COM object has a memory leak, or whether some special freeing up of ob...
<p>Are you releasing the COM object after usage(<code>Marshal.ReleaseComObject</code>)? </p> <p>What type of parameters are you passing in/out of the calls?</p> <p>If you don't have the COM object source code and want to determine why its 'leaking', Run the COM object outa proc, attach WinDBG to the process and set b...
How to clear python interpreter console? <p>Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc.</p> <p>Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometime...
<p>As you mentioned, you can do a system call:</p> <pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; clear = lambda: os.system('cls') &gt;&gt;&gt; clear() </code></pre> <p>I am not sure of any other way in Windows.</p>
Is JavaScript a pass-by-reference or pass-by-value language? <p>The primitive types (Number, String, etc.) are passed by value, but Objects are unknown, because they can be both passed-by-value (in case we consider that a variable holding an object is in fact a reference to the object) and passed-by-reference (when we ...
<p>It's interesting in Javascript. Consider this example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function changeStuff(a, b, c) { a = a * 10; b.item = "changed"; c = {item: "...
How to control the target frame of reporting services (SSRS) drill down <p>I am using SQL 2005 reporting services (SSRS) with the web report viewer control. It is showing the report inside an IFRAME on the web page. If I implement a drill down functionality, by attaching a URL action to a chart elements, the navigation...
<p>hmm it appparently didnt post my last reply. You might try adding the rc:LinkTarget querystring parameter to the IFRAME src. I use "&amp;rc:LinkTarget=_blank" on some charts displayed in an IFRAME and they open the full report correctly.</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc188712.aspx" rel="n...
How can I set a form to have a transparent background <p>I am struggling to get my form to have a transparent background in vb.net </p> <p>Currently in the form New I set </p> <pre><code>Me.SetStyle(ControlStyles.SupportsTransparentBackColor, true) </code></pre> <p>But still the form shows up as having the default ...
<p>Use TransparencyKey for transparent form.</p> <p>eg.</p> <pre><code>TransparencyKey = Color.Red Button1.BackColor = Color.Red </code></pre> <p>Now run the form you will find that the button1 has a hole in it.</p> <p>So using this method you can create a mask image in paint for which part has to be transparent an...
When is it time to have a QA department? <p>The Quality Assurance (QA) department is roughly a bunch of testers debunking your app(s) all day, giving the green light for releases, handling Alpha / Beta programs. And much more.</p> <p>But without a QA department in a software company, issues arises too often in the fie...
<p>As soon as you can afford it. You will never have a product which will be as reliable without a qa department than with one. Programmers don't make good QA people, and it is always better to have a second person (or more) reviewing how the app works.</p> <p>All good software companies, and organizations with a go...
Where is a good Address Parser <p>I'm looking for a good tool that can take a full mailing address, formatted for display or use with a mailing label, and convert it into a structured object.</p> <p>So for instance:</p> <pre><code>// Start with a formatted address in a single string string f = "18698 E. Main Street\r...
<p>The Googlemaps API works pretty well for this. E.g., suppose you are given the string "120 w 45 st nyc". Pass it into the Googlemaps API like so: <code>http://maps.google.com/maps/geo?q=120+w+45+st+nyc</code> and you get this response:</p> <pre><code>{ "name": "120 w 45 st nyc", "Status": { "code": 200, ...
Possible to do a glow/shadow using partial transparency in HTML/CSS? <p>Well I guess this is a two part question.</p> <p>Firstly how can I make an image have partial transparency (I think you can do this with PNGs but don't know how -- I have photoshop just need instructions?)</p> <p>Secondly how do I use that image ...
<ol> <li>Create a new photoshop document</li> <li>Add new layers and draw on them</li> <li>Delete the layer named <em>Background</em></li> <li>File > Save for Web</li> <li>Choose a 24 bit PNG format.</li> </ol> <p>Getting it to work well in IE6 is going to be the issue. You should use a separate stylesheet that only ...
How do I control repeated Ajax 'post' submissions? <p>I do not want to stop the user from clicking the same ajax button many times, but I want to exercise some control to prevent someone from maliciously clicking the button repeatedly which would cause repeated database requests. What is simple way to handle this on a ...
<p>Why not disable the button after it is clicked, and then re-enable it once you have received the response from the server?</p>
Google Adwords API 'getKeywordVariations' not working properly <p>I'm trying to use the 'GetKeywordVariations' method of the google adwords API, documentation at <a href="http://code.google.com/apis/adwords/docs/developer/KeywordToolService.html#getKeywordVariations" rel="nofollow">this page. According to the documenta...
<p>I found the answer. i was using the older version of the API. Updating to the latest version fixed it .</p>
rotate a UIView around its center but several times <p>I'm trying to rotate some <code>UIView</code> around its center, so the simple code goes something like (in pseudocode):</p> <pre><code>[UIView beginAnimations:@"crazyRotate" context:nil]; [UIView setAnimationDuration:1.0]; someview.transform = CGAffineTransformM...
<p>You can use the following animation on your UIView's layer property. I've tested it.</p> <pre><code>UIView *viewToSpin = ...; CABasicAnimation* spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; spinAnimation.toValue = [NSNumber numberWithFloat:5*2*M...
C# Settings Rembering Settings <p>How do I get my program to remember the users settings?</p>
<p>You can either:</p> <ul> <li>write the settings to a file</li> <li><p>Create setting in VS with Project->Properties->Settings... then by using</p> <p>Properties.Settings.Default.SettingName = "something"; // Set setting</p> <p>this.Text = Properties.Settings.Default.SettingName; // Use setting</p></li> </ul>
Problem with simple full-text search on SQL Server 2005 <p>I just setup full-text search on my development database. I setup a new full-text index on a table and included 2 columns in the index. The first column is called 'description' and is a 'varchar(100)' and the other column is called 'notes' and is a 'text' colum...
<p>SQL Server considers 'another' to be a stopword (noise word). So for all intents and purposes, it is ignored when performing a <code>FULLTEXT</code> search.</p> <p>See <code>C:\WINDOWS\system32\noise.eng</code> (that is where it is installed on my system) for a full list of noise/stop words.</p>
Select Users by Total Submissions <p>I know this is an easy one, but it's driving me nuts...</p> <p>I have a users table, comments table, and pictures table.</p> <p>I want a list of the top 10 users based on submissions (total of their comments and their submitted photos).</p> <p>That's it.</p> <p>Shame me.</p> <p...
<p>Maybe something kind of like this:</p> <pre><code>select username, sum(submissions) from (select username, count(picture_id) from pictures group by username union select username, count(comment_id) from comments group by username ) group by username order by sum(sub...
Make async event synchronous in JavaScript <p>I'm using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions. My program then needs to invoke a javascript function which will make an asynchronous call. I need a way to get the result of that asynchronous call back to C# so I can proce...
<blockquote> <p>Is there a way I can make the first javascript function sleep until something happens (with out locking up the browser)?</p> </blockquote> <p>Yes - you can use the asynchronous function as it was intended to be used: pass it a callback, and let it do its thing. You should be able to pass a call...
Getting the status of a stream from FMS in ActionScript <p>I'm looking for a way to get the status of a stream from Flash Media Server to action script. I need to know if a stream has any publishers/listeners from flex/ActionScript.</p>
<p>Take a look at the Adobe Flash Media Server Administration API. There are calls that might help you, such as getNetStreams() and get NetStreamStats(). You could try writing a server-side action script class that makes these calls to the admin API, then pushes the results back to your Flex application through a callb...
Setting the width of a menu in the Windows API <p>I'm creating a custom control in wxWidgets that displays a menu as part of it, and currently working on the Windows side of things. wxWidgets doesn't have a way of setting the width of a menu. It just makes the window as wide as the longest string plus a few pixels on...
<p>With the handle of the menu, you can cycle through the menu items and call SetMenuItemInfo, indicating that you want to owner-draw the menu items. When you do this, the window that the menu is attached to will receive the <code>WM_MEASUREITEM</code> message, which you would then respond to by setting the dimensions...
Compare subselect value with value in master select <p>In MS Access, I have a query where I want to use a column in the outer query as a condition in the inner query:</p> <pre><code>SELECT P.FirstName, P.LastName, Count(A.attendance_date) AS CountOfattendance_date, First(A.attendance_date) AS FirstOfattendance_...
<p>How about:</p> <pre><code>SELECT p.FirstName, p.LastName, Count(a.attendance_date) AS CountOfattendance_date, First(a.attendance_date) AS FirstOfattendance_date, c.total FROM ( tblPeople AS p INNER JOIN tblEventAttendance AS a ON a.people_id = p.ID) INNER JOIN (SELECT people_i...
Upgrade to 3.5 SP1 & 3.5 Family Update on client systems can break my code? <p>I have a server hosting a remoting application using .NET 3.5. It has been running fine. In the last couple of days I have had numerous reports of users not being able to access the application after running the "Microsoft .NET Framework 3...
<p>SP1 for .NET 3.5 includes bug fixes and a lot new functionality.<BR> From my experience upgrading from any of the frameworks .NET 2.0 SP1 to 3.0, 3.0 SP1, 3.5<BR> to any higher framework (up to 3.5 SP1 - haven't tried the 4.0 beta) does not break anything.<BR> In fact, .NET 3.5 SP1 is actually based on .NET 2.0 SP1 ...
How do I get a simple, Hello World Java applet to work in a browser in Mac OS X? <p>I'm using Java SE 1.6 on Mac OS X 10.5.6. The code for my applet is as follows:</p> <pre><code>import java.awt.Graphics; import javax.swing.JApplet; public class HelloWorld extends JApplet { public void paint( Graphics g ) { ...
<p>You do not specify a codebase property in the applet tag, so I'd guess your class can not be found.</p> <p>Try to enable the java console output window. You can do this in "Java Settings" (use spotlight) under the extended options tab (the one with the tree and many checkboxes). Maybe you can see some more informat...
How are web servers best loaded <p>If a web server is going to serve out say 100GB per day would it be better for it to do so in 10,000 10MB sessions or 200,000 500kB sessions.</p> <p>The reason for this question is I'm wondering if there would be any advantage, disadvantage or neither to sites that mirror content to ...
<p>I suppose that not only the size of the session matters, but the duration of it is very important. I would guess that 200,000 small sessions will live shorter than 10,000 big ones. As soon as a session is completed, resources are freed to be used again. I would optimize it so that a session lasts as short as possibl...
C++ function that returns string doesn't work unless there's an endl involved...? <p>I've got a function inside of a class that returns a string. Inside this function, I can only get it to work when I add <code>cout&lt;&lt;endl</code> to the function before the return statement. Any idea why this is, or how I can fix...
<p>actually <em>getName()</em> function is probably working correctly. However, the cout 'caches' the output (i.e. it prints the output on screen when it's internal text buffer is full). 'endl' flushes the buffer and forces cout to dump the text (in cache) to screen. </p> <p>Try cout.flush() in main.cpp</p>
Beginner's guide to 3D graphics programming <p>What are the best guides / tutorials / books / websites for someone with minimal experience (or none) in the world of 3D graphics programming?</p> <p>I realize that the fundamentals of 3D graphics and mathematics apply across platform specific 3D library implementations s...
<p>I recommend that you implement a simple software based 3d rendering engine. Simple stuff like line, quads, lighting etc. You will learn a whole lot more about 3d programming in general, and it will give you a good prescriptive on 3d graphics and it's limitations.</p> <p>This should get you started: <a href="http://...
MSSQL Paging is returning random rows when not supposed too <p>I'm trying to do some basic paging in MSSQL. The problem I'm having is that I'm sorting the paging on a row that (potentially) has similar values, and the ORDER BY clause is returning "random" results, which doesn't work well.</p> <p>So for example.</p> <...
<p>Try ordering by both, e.g.: ORDER BY Rating DESC, DateEdit ASC</p>
Find the path of notepad.exe and mspaint.exe <p>What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows?</p> <p>Should I get the Windows directory via <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx" rel="nofollow...
<p>This works on every Windows box I've got access to (XP+).</p> <pre><code>c:\&gt; for %i in (cmd.exe) do @echo %~$PATH:i C:\WINDOWS\system32\cmd.exe c:\&gt; for %i in (python.exe) do @echo %~$PATH:i C:\Python25\python.exe </code></pre> <p>The great thing is, you don't <em>have</em> to use the actual <code>%PATH%</...
Difference between static class and singleton pattern? <p>What real (i.e. practical) difference exists between a static class and a singleton pattern?</p> <p>Both can be invoked without instantiation, both provide only one "Instance" and neither of them is thread-safe. Is there any other difference?</p>
<p>What makes you say that either a singleton or a static method isn't thread-safe? Usually both <em>should</em> be implemented to be thread-safe.</p> <p>The big difference between a singleton and a bunch of static methods is that singletons can implement interfaces (or derive from useful base classes, although that's...
X connection to localhost:10.0 broken (explicit kill or server shutdown) <p>why is this error comes. I started the jboss server and when i try to open the application in IE i am getting this error</p>
<p>I just had this exact problem because I was connected to my linux jboss server with putty and X forwarding activated. In putty, I unchecked the option "Connection > SSH > X11 > Enable X11 forwarding" and now it works. Hope this will help someone.</p>
Is it possible to pass a method as an argument in Objective-C? <p>I have a method that varies by a single method call inside, and I'd like to pass the method/signature of the method that it varies by as an argument... is this possible in Objective C or is that too much to hope for?</p>
<p>NSInvocation is a class for wrapping up a method calls in an object. You can set a selector (method signature), set arguments by index. You can then set a target and call invoke to trigger the call, or leave the target unset and use invokeWithTarget: in a loop of some sort to call this on many objects.</p> <p>I th...
Regular Exp instead of string split <p>hi I had an exam two days before one of the questions was to replace the letters before the @ with a new names</p> <p>so in the exam paper the we had array = "toto@yahoo.com","mimi@yahoo.com".soso@yahoo.com" so we sholud take the toto mimi soso and replace them with diffrent nam...
<p>You could use RegEx or you could do string manipulation based on Substring, IndexOf and concatenation. </p>
How can I play a youtube video in swfloader? <p>I embed a youtube video in my air application. It loaded and played well, but I cannot play more than one video at the time, only one video is played at the time, do you know why? The code is:</p> <pre><code>url:String = "http://in.youtube.com/v/fVGk5qm6Mac&amp;hl=en&amp...
<p>I'm not sure, but I guess that if you create separate SWFLoader instances for each video you want to play, it shouldn't be a problem. It's hard to tell from the code you provide if you are using 1 or more SWFLoader objects.</p>
Keeping same session with different user-agents <p>Is there a way to use the same session on different user-agents. I have a flash app that is generating a new session id on posting data to myHandler.ashx ( same happens on aspx ). Am i missing a trick here?</p>
<p>I have no experience from c# or anything like that, but when doing remoting using amfphp you will sometimes need to supply the session_id variable in your call manually, as the server will for some reason consider you two different users even though it's all going through the same browser. </p> <p>Often, the simple...
Does anybody actually use the PSP (Personal Software Process)? <p>I've been reading a bit about this recently but it looks to be a bit heavy. Does anybody have real world experience using it?</p> <p>Are there any light weight alternatives?</p>
<p>The Personal Software Process is a personal improvement process. The full-blown PSP is quite heavy and there are several forms, templates, and documents associated with it. However, a key point is that you are supposed to tailor the PSP to your specific needs.</p> <p>Typically, when you are learning about the PSP (...
ASP.NET AJAX - Check for async postback via JavaScript <p>Does anyone know the script necessary to check to see if you are in a anync postback via JavaScript?</p> <p>Thanks.</p>
<p>In the end I used the following which gave me the functionality I required:</p> <p>Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.async</p>
Newsletter: How is it possible to determine how many people opened the e-mail? <p><strong>Exact duplicate of <a href="http://stackoverflow.com/questions/185204/is-there-a-way-to-determine-whether-an-e-mail-reaches-its-destination">http://stackoverflow.com/questions/185204/is-there-a-way-to-determine-whether-an-e-mail-r...
<p>See also <a href="http://stackoverflow.com/questions/185204/is-there-a-way-to-determine-whether-an-e-mail-reaches-its-destination">Is there a way to determine whether an e-mail reaches its destination?</a>, my answer repeated below:</p> <blockquote> <p>If you make the email HTML based, you can include images in...
Network Programming: to maintain sockets or not? <p>I'm currently translating an API from C# to Java which has a network component.</p> <p>The C# version seems to keep the input and output streams and the socket open for the duration of its classes being used.</p> <p>Is this correct?</p> <p>Bearing in mind that the ...
<p>There is a trade off between the cost of keeping the connections open and the cost of creating those connections.</p> <p><strong>Creating connections</strong> costs time and bandwidth. You have to do the 3-way TCP handshake, launch a new server thread, ...</p> <p><strong>Keeping connections open</strong> costs mai...
How to assign alt + f1 key to an opened Windows application <p>I usually have more then 10 opened application windows. When I write code I need to switch fast between a browser, an IDE and terminal windows. Alt + tab is too slow, too many windows to choose from.</p> <p>Virtual desktop is a work around for me. On a fir...
<p><a href="http://www.autohotkey.com/" rel="nofollow">Autohotkey</a> I've found to be very powerful. Here is a part of my test script.</p> <pre><code>SetTitleMatchMode, 2 #z::Run http://stackoverflow.com/ ^!n:: IfWinExist Notepad WinActivate else Run Notepad return !F1:: IfWinExist Firefox WinActivate ...
screen scraping technique using php <p>How to screen scrape a particular website. I need to log in to a website and then scrape the inner information. How could this be done? </p> <p>Please guide me. </p> <p><strong>Duplicate: <a href="http://stackoverflow.com/questions/26947/how-to-implement-a-web-scraper-in-php">Ho...
<pre><code>Zend_Http_Client and Zend_Dom_Query </code></pre>
DQL return files in a Cabinet <p>Using DQL I want to return all the documents under the Cabinet <em>test</em>. How would I go about writing a query to do this?</p>
<pre><code>select r_object_id, object_name from dm_document(all) where folder('/NameOfCabinet', descend); </code></pre>
Why is there no Linq method to return distinct values by a predicate? <p>I want to get the distinct values in a list, but not by the standard equality comparison.</p> <p>What I want to do is something like this:</p> <pre><code>return myList.Distinct( (x, y) =&gt; x.Url == y.Url ); </code></pre> <p>I can't, there's n...
<p>It's annoying, certainly. It's also part of my "MoreLINQ" project which I must pay some attention to at some point :) There are plenty of other operations which make sense when acting on a projection, but returning the original - MaxBy and MinBy spring to mind.</p> <p>As you say, it's easy to write - although I pre...
script to save file as unicode <p>Do you know any way that I could programmatically or via scrirpt transform a set of text files saved in ansi character encoding, to unicode encoding?</p> <p>I would like to do the same as I do when I open the file with notepad and choose to save it as an unicode file.</p>
<p>This could work for you, but notice that it'll grab <strong>every</strong> file in the current folder:</p> <pre><code> Get-ChildItem | Foreach-Object { $c = (Get-Content $_); ` Set-Content -Encoding UTF8 $c -Path ($_.name + "u") } </code></pre> <p>Same thing using aliases for brevity:</p> <pre><code> gci | %{ $c ...
How to handle null objects in XML coming from SQL Server? <p>I have a stored procedure that returns an object as XML. How do I handle the case where the object doesn't exist?</p> <p>I can't return null or empty string as the XmlReader complains that it is not valid XML.</p> <p>If I return an empty Tag, how do I tell ...
<p>Well, a common approach is some marker attribute, such as <code>xsi:nil="true"</code> (although this is just an example).</p>
In XAML style, how to change solid background to gradient? <p>I've got a MainResources.xaml file in which I have a style that defines how each of my windows in my application look:</p> <pre><code> &lt;Style x:Key="MainBorderStyle" TargetType="{x:Type Border}"&gt; &lt;Setter Property="Background" Value="WhiteSmoke...
<p>You are missing the <code>&lt;Setter.Value&gt;</code></p> <pre><code>&lt;Style ...&gt; &lt;Setter Property="..."&gt; &lt;Setter.Value&gt; &lt;LinearGradientBrush /&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
Where is Python used? I read about it a lot on Reddit <p>I have downloaded the Pyscripter and learning Python. But I have no Idea if it has any job value , especially in India. I am learning Python as a Hobby. But it would be comforting to know if Python programmers are in demand in India.</p>
<p>Everywhere. It's used <a href="http://panela.blog-city.com/python_at_google_greg_stein__sdforum.htm">extensively by google</a> for one.</p> <p>See <a href="http://en.wikipedia.org/wiki/Python_software">list of python software</a> for more info, and also <a href="http://www.python.org/doc/essays/ppt/www8-py-www/sld0...
Disable messages in SQL2008 result set <p>further to <a href="http://stackoverflow.com/questions/483787/is-there-a-bug-in-sqldatareader-hasrows-when-running-against-sql-server-2008" rel="nofollow" title="these">these</a> <a href="http://stackoverflow.com/questions/197220/sqldatareader-hasrows-returns-false-since-sql-20...
<p>No, there's not a way to disable all messages that get sent along with the result sets. Set nocount on/off doesn't have an effect on these types of messages.</p>
jQuery If DIV Doesn't Have Class "x" <p>In jQuery I need to do an if statement to see if $this doesn't contain the class '.selected'.</p> <pre><code>$(".thumbs").hover(function(){ $(this).stop().fadeTo("normal", 1.0); },function(){ $(this).stop().fadeTo("slow", 0.3); }); </code></pre> <p>Basically when this functio...
<p>Use the <a href="http://docs.jquery.com/Selectors/not#selector">"not</a>" selector.</p> <p>For example, instead of:</p> <p><code>$(".thumbs").hover()</code></p> <p>try:</p> <p><code>$(".thumbs:not(.selected)").hover()</code></p>
.NET assemblies spanning multiple files and unit testing <p>Can anyone point me to some information on .NET assemblies spanning multiple files?</p> <p>I've found this remark on MSDN (<a href="http://msdn.microsoft.com/en-us/library/ms973231.aspx#assenamesp_topic4" rel="nofollow">here</a>):</p> <blockquote> <p>Altho...
<p>You can friend two assemblies together. Then one can see the "internal" in the other. Still can't see private.</p> <p>MSDN - <a href="http://msdn.microsoft.com/en-us/library/0tke9fxk(VS.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/0tke9fxk(VS.80).aspx</a></p>
How can I get the default value of a type in a non-generic way? <p>I know the "default" keyword returns the default value of a statically determined type, as shown for instance in <a href="http://stackoverflow.com/questions/367378/returning-a-default-value-c">this question</a>.</p> <p>However, given an instance of a t...
<p>Why do you want to avoid Activator? Basically that <em>is</em> the way of doing it.</p> <p>I mean, you could write a generic method and then call that via reflection, but that's a pretty hideous "long cut" just to avoid Activator.</p>
Is there a downloadable document available that encapsulates the core rules enforced by StyleCop? <p>Is there a downloadable document available that encapsulates the core rules enforced by StyleCop? </p> <p>We've settled on C#, and we're going to be using FxCop and StyleCop to enforce design and style guidelines. To h...
<p>The rule list is available as a <a href="http://en.wikipedia.org/wiki/HTML_help" rel="nofollow">.chm</a> file on codeplex: <a href="http://code.msdn.microsoft.com/sourceanalysis/Release/ProjectReleases.aspx?ReleaseId=1425" rel="nofollow">StyleCop 4.3 Rules Documentation</a> </p>
How can I determine property types using reflection? <p>How would I test a property of a type to see if it is a specified type?</p> <p>EDIT: My goal is to examine an assembly to see if any of the types in that assembly contain properties that are MyType (or inherited from MyType).</p> <p>Here is the track I've gone ...
<p>What type are you interested in? The return type of the method/property/event etc?</p> <p>If so, I don't think there's anything in <code>MemberInfo</code> to let you get at it directly - you'll need to cast and use <code>MethodInfo.ReturnType</code>, <code>PropertyInfo.PropertyType</code>, <code>FieldInfo.FieldType...
Hook application with .NET to capture double click events <p>How can I hook an application so that I can find out when the mouse is double clicked within it?</p> <p>Can this be done in .NET?</p> <p>Are there anythings I should be careful about? (crashing the other application, for instance)</p>
<p>The article "<a href="http://www.codingthewheel.com/archives/how-to-inject-a-managed-assembly-dll" rel="nofollow">How to inject a managed .NET assembly into a managed process</a>" will give you all you need to know to set the hook.</p> <p>The article "<a href="http://www.codingthewheel.com/archives/how-i-built-a-wo...
Will there ever be a solution for global events in .NET applications <p>In our program we use Microsoft's UserActivityHook.dll to determine when a user of our Windows Forms app has been idle for more than X seconds. This allows us to replicate an 'auto-away' behavior much like MSN/Live Messanger when there has been no...
<p>You may consider the library provided in this article.</p> <p><a href="http://www.codeproject.com/KB/cs/globalhook.aspx?display=PrintAll&amp;fid=57596&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2857159" rel="nofollow">http://www.codeproject.com/KB/cs/globalhook.aspx?display=PrintAl...
Return background color of selected cell <p>I have a spreadsheet which cells in are colored meaningfully.</p> <p>Does any body know how i can return the background color value of a current cell in Excel sheet?</p>
<p>You can use <code>Cell.Interior.Color</code>, I've used it to count the number of cells in a range that have a given background color (ie. matching my legend).</p>
T-SQL 2005: Suppress the output of the results set <p>I have some stored procedures which are used for generating Reports. I am trying to build a report dashboard that will show how many records are on each report.</p> <p>The SPs are detailed in a table which details in which order they should be run.</p> <p>I have ...
<p>I can think of one possible solution but I'm not sure if it's particularly elegant (or what you're looking for).</p> <p>Expanding on the idea of an input parameter to the SP, could you not just add some logic (CASE or IF statement) to call a Select Count() over the script when it comes from the dashboard?</p> <p>I...
Classic database insert problem <p>I have a SQL database which i use to store some info and every record has a unique id generated by the database. MY program is written in flash and runs over the web, the program runs fine and it inserts records into the database and pulls the idnumber of the last record and displays ...
<p>PHP has <a href="http://us3.php.net/manual/en/function.mysql-insert-id.php" rel="nofollow"><code>mysql_insert_id()</code></a> to return </p> <blockquote> <p>The ID generated for an <code>AUTO_INCREMENT</code> column by the previous INSERT query on success, 0 if the previous query does not generate an <code>...
Google's Imageless Buttons <p>There have been a few articles recently about Google's new imageless buttons:</p> <ul> <li><a href="http://stopdesign.com/archive/2009/02/04/recreating-the-button.html">http://stopdesign.com/archive/2009/02/04/recreating-the-button.html</a></li> <li><a href="http://stopdesign.com/eg/butto...
<p>-- EDIT -- I didn't see the link in the original post. Sorry! Will try and re-write to reflect actual question</p> <p>StopDesign has an excellent post on this <a href="http://stopdesign.com/archive/2009/02/04/recreating-the-button.html">here</a>. <strong>[edit 20091107] These were released as part of the <a href="h...
Make an existing Git branch track a remote branch? <p>I know how to make a new branch that tracks remote branches, but <strong>how do I make an existing branch track a remote branch?</strong></p> <p>I know I can just edit the <code>.git/config</code> file, but it seems there should be an easier way.</p>
<p>Given a branch <code>foo</code> and a remote <code>upstream</code>:</p> <p><strong>As of Git 1.8.0:</strong></p> <pre><code>git branch -u upstream/foo </code></pre> <p>Or, if local branch <code>foo</code> is not the current branch:</p> <pre><code>git branch -u upstream/foo foo </code></pre> <p>Or, if you like t...
IE and Memory accumulation in Javascript <p>Here is the test URL</p> <p><a href="http://edventures.com/temp/divtest.php" rel="nofollow">http://edventures.com/temp/divtest.php</a></p> <p>Procedure:</p> <ol> <li>Close all IE instances.</li> <li>Open the URL in IE7</li> <li>Open the task manager, look for memory consu...
<p>Here's how to create DOM elements and prevent memory leaks in IE.</p> <pre><code>function createDOMElement(el) { var el = document.createElement(el); try { return el; } finally { el = null; } } </code></pre> <p>You can use variations of the try/finally trick to prevent the leaks when doing other...
CSS max-height not working <p>I have a very simply problem where I need a div to expand to fit its contents unless the height reaches a certain size, when I want the div to scroll vertically instead. As a test, I created a page containing:</p> <pre><code>&lt;div style="width:300px;max-height:25px;background-color:gree...
<p>The problem is your browser. Maybe you could wrap this div in another div that has the fixed height of 25px. Of course this wouldn't be exactly the same as max-height.</p> <p><a href="http://perishablepress.com/press/2007/01/16/maximum-and-minimum-height-and-width-in-internet-explorer/">An article about a solution....
Does R have quote-like operators like Perl's qw()? <p>Anyone know if R has quote-like operators like Perl's <code>qw()</code> for generating character vectors? </p>
<p>No, but you can write it yourself:</p> <pre><code>q &lt;- function(...) { sapply(match.call()[-1], deparse) } </code></pre> <p>And just to show it works:</p> <pre><code>&gt; q(a, b, c) [1] "a" "b" "c" </code></pre>
Type of Projects where Unit Testing is useless <p>Do you believe that Unit Testing (and test driven development) must be done under any set of circumstances or should there be some exceptions. I've been working on the type of projects lately where I can't see how Unit Testing would be useful or improve design, quality...
<p>Please don't conflate unit testing (UT), which is a tool, with test-driven design (TDD), which is a methodology. <a href="http://stackoverflow.com/questions/517977/what-do-you-test-with-your-unit-tests/518165#518165">see this for more</a></p> <p>Also, remember that one of the benefits of unit tests is for regressio...
Passing a work item between threads (Java) <p>I have two threads. The producer is producing pieces of data (String objects), where the consumer processes these strings. The catch is that my application only needs the most recent data object to be processed. In other words, if the producer managed to produce two strings...
<p>I think your best answer is probably to use ArrayBlockingQueue, where the producer (you only have one producer, right?) removes any existing element before adding the new element.</p> <p>Sure, there are race conditions in this implementation: the consumer could start processing an element just before the producer r...
How to simulate Windows shutdown for debugging? <p>I have an issue with my application when Windows shuts down - my app isn't exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to see what's going on? </p> <p>Is there a way to send the Windows shutdown message(s) to my applica...
<p>There is a tool named Restart Manager (rmtool.exe) in the Microsoft's Logo Testing Tools for Windows, which can be used to send shutdown and restart messages to a process. Logo testing tools can be downloaded here:</p> <p><a href="http://download.microsoft.com/download/d/2/5/d2522ce4-a441-459d-8302-be8f3321823c/Log...
Calculate final scores in a game relative to previous scores and other players <p>Supposing a multi-player game, what you be the fairest way give final scores based on the previous scores of all players.</p> <p>For example, in a two player match, player A having two times the score of player B. "A" finishing first wou...
<p>Have you ever read about the <a href="http://en.wikipedia.org/wiki/Elo_rating_system" rel="nofollow">Elo Rating System</a>, used in chess?</p> <p>I don't think it's an exact fit for your scenario, but it might give you a few ideas.</p>
How to have favicon / icon set when bookmarklet dragged to toolbar? <p>I've made myself a bookmarklet, and it functions just fine, but when added to a toolbar in Opera or Firefox, it just takes on the default bookmark icon for the browser (a globe and a star, respectively). My site has a favicon, and the window, tab a...
<p>A bookmarklet uses the <code>javascript://</code> schema and thus do not have a domain from which a favicon may be loaded. </p> <p>So, currently there is no way for you to provide a favicon for a bookmarklet. Think about it like this: remember the whole Javascript sandbox thing - where Javascript may not access any...
How to stop onkeyup event being fired when an alert box is cleared with the enter key <p>Here's my problem...</p> <p>I have a text field which uses the javascript onkeyup event to do some "quiet" validation with a tick or cross if the value is valid.</p> <p>When the enter key is pressed, it does the same validation, ...
<p>Use the <code>keypress</code> event instead when triggering the behavior of the enter-key.</p>
Examples of good Java desktop applications <p>More of a wiki list/collection, I'm looking for a list of good Java desktop apps. I've added a couple below to get started. Please list the framework/widget toolkit being used if it's know as well.</p>
<p><a href="http://www.jetbrains.com/idea/index.html">IntelliJ IDEA</a> (Swing)</p>
Is there a good way to call a CGI script from a PHP script? <p>I saw that there is a <strong>virtual()</strong> function in PHP that will call a CGI script, but is that the best way? Can I pass any parameters to that scripts as well?</p> <p>I saw some examples using <strong><code>file_get_contents()</code></strong> o...
<p>Use <strong>exec()</strong> if you can call it locally. If it needs to be invoked as a CGI (as in the script is designed to only work within a CGI environment), then you'll need to call it via <strong>include()</strong> or <strong>file_get_contents()</strong>. <strong>virtual()</strong> will flush your buffers and a...
Decrypting RijndaelManaged Encrypted strings with CryptDecrypt <p>Ok I'm trying to use the Win32 Crypto API in C++ to decrypt a string encrypted in C# (.NET 2) with the RijndaelManaged Class. But I'm having no luck at all i get jibberish or a bad data Win32 error code. All my keys, IV and salt match, I've looked in t...
<p>Ok my fault, I didn't include the Struct def for the keyblob in the C++ and it turns out you need a contigous block of data for the key with the header but I was using the MSDN example that had a pointer to the key data. Which is wrong!</p>
Are there any libraries/frameworks for SCons? <p>Each project using SCons seems to be reinventing the wheel. I would be glad to take someones directory layout, and/or solution for variant builds(debug/release), and/or testing framework, and/or best practices.</p> <p>Even several not-too-simple examples would help. </p...
<p>You may be interested in Google's <a href="http://code.google.com/p/swtoolkit/" rel="nofollow">Software Construction Toolkit</a> that was <a href="http://google-opensource.blogspot.com/2009/02/software-construction-toolkit-released.html" rel="nofollow">made open source in February 2009</a>. It adds new features on t...
Best way to implement a stored procedure with full text search <p>I would like to run a search with MSSQL Full text engine where given the following user input: "Hollywood square"</p> <p>I want the results to have both Hollywood and square[s] in them.</p> <p>I can create a method on the web server (C#, ASP.NET) to dy...
<p>The last time I had to do this (with MSSQL Server 2005) I ended up moving the whole search functionality over to Lucene (the Java version, though Lucene.Net now exists I believe). I had high hopes of the full text search but this specific problem annoyed me so much I gave up.</p>
Rewriting URLs in ASP.NET? <p>I am using ASP.NET C#.</p> <p>How do I implement URL re-writing procedure that is similar to StackOverflow.com?</p> <pre><code>http://stackoverflow.com/questions/358630/how-to-search-date-in-sql </code></pre> <p>Also, what is the meaning of values such as "358630" in the URL? Is this th...
<p>SO is using <a href="http://asp.net/mvc" rel="nofollow">ASP.NET MVC</a>. You really need to read in details how MVC URL rewriting works, but the gist of it is that the 'questions' part in the URL is the name of the Controller class (which roughly corresponds to the 'showdetails' in your URL) and the number is a ID p...
Page displays true after running command: 'webby' <p>I'm running though the <a href="http://webby.rubyforge.org/tutorial/" rel="nofollow">webby tutorial</a> and I get to the part where you run the <strong>webby</strong> command for the first time to generate the website in the /output directory. </p> <p>I do that, an...
<p>Just to confirm - did you open output/index.html in a browser? And the "true" that you describe is what you see in your browser...?</p> <p>Before you ran the <code>webby</code> command, did you edit any of the files, especially <code>content/index.txt</code>? Can you paste the contents of <code>content/index.txt</c...
NSNumberFormatter: plusSign vs. positivePrefix <p>The NSNumberFormatter class has <code>plusSign</code> and <code>minusSign</code> properties, but also has <code>positivePrefix</code> and <code>negativePrefix</code>.</p> <p>What is the difference between these two? If I specify both, which one comes first?</p>
<p>plusSign and minusSign are used for the mathematical addition and subtraction operators. positivePrefix and suffix and negativePrefix and suffix are used to describe what characters/strings are used todisplay whether a certain numeric value is positive or negative.</p> <p>To illustrate why they are different: most ...
How do I test if a column equals empty_clob() in Oracle? <p>The naïve <code>FOO = empty_clob()</code> complains about incompatible types. I tried Googling, but (once again) had little success searching for help with Oracle. Thanks.</p>
<p>Are you just wanting to check for a CLOB that doesn't have any length? While not exactly what your asking, it's basically the same thing?</p> <pre><code>select * from bar where dbms_lob.getlength(foo) = 0; </code></pre> <p>Here is the complete test:</p> <pre><code>SQL&gt; create table bar (foo clob); Table c...
Retrieve file properties <p>When in Windows XP, if I open the properties window for the file and click the second tab, I will find a window where to add attributes or remove them.</p> <p>While developing things, I noticed there was actually something I wanted to know about the file. How to retrieve this data? It's a s...
<p>Not on an XP machine, but I think this might work</p> <pre><code>FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("path.txt"); string desc = myFileVersionInfo.FileDescription; </code></pre>
When working with domain models and POCO classes, where do queries go? <p>I am new to domain models, POCO and DDD, so I am still trying to get my head around a few ideas.</p> <p>One of the things I could not figure out yet is how to keep my domain models simple and storage-agnostic but still capable of performing some...
<p>Domain objects should be independent of storage, you should use the Repostiory pattern, or DAO to persist the objects. That way you are enforcing separation of concerns, the object itself should not know about how it is stored.</p> <p>Ideally, it would be a good idea to put query construction inside of the reposit...
How can I get only class variables? <p>I have this class definition:</p> <pre><code>class cols: name = 'name' size = 'size' date = 'date' @classmethod def foo(cls): print "This is a class method" </code></pre> <p>With __dict__ I get all class attributes (members and variables). Also there ...
<p>I wouldn't know a straightforward way, especially since from the interpreter's POV, there is not that much of a difference between a method of a class and any other variable (methods have descriptors, but that's it...).</p> <p>So when you only want non-callable class members, you have to fiddle around a little:</p>...
Theories of software engineering <p>In my career I've come across two broad types of theory: physical theories and educational/management theories:</p> <p>Physical theories are either correct (under appropriate conditions) or incorrect, as judged by the physical world.</p> <p>Educational/management theories have the ...
<p>Software engineering is ultimately about psychology, how humans manage complexity. So software engineering principles are far more like education and management theories than physical principles.</p> <p>Some software engineering has solid math behind it: O(n log n) sorts are faster than O(n^2) sorts, etc. But mos...
How do I build a OneTwoThree linked list with a minimum number of assignment operators? <p>I came across this problem while preparing for an interview and curious to know the diffrent ways it can be written. I found this at <a href="http://cslibrary.stanford.edu/103/" rel="nofollow">http://cslibrary.stanford.edu/103/</...
<p>I did it with six assignments. What do I get?</p> <pre><code>struct node { int data; struct node * next; }; struct node * build_123() { struct node * first = malloc(sizeof(*first)); struct node * second = malloc(sizeof(*second)); struct node * third = malloc(sizeof(*third)); assert(first &...
Good free offline PL/SQL formatter <p>Does anyone knows a good formatter for PL/SQL free and offline?</p> <p>Thank you very much.</p>
<p>Not really sure what you mean by "offline", however Oracle has a tool called SQL Developer that is free and can download from their website. It has some formatting options you can apply to your code.</p>
DataGridView Autogeneratecolumns as TextBox instead of label <p>How can I have a datagridview that will autogenerate a textbox instead of a label?</p>
<p>In short, you can't. You could inherit from a gridview and implement it yourself. It could look something like this:</p> <pre><code>Public Class MyGrid Inherits GridView Private Sub MyGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Me.RowDataBound I...
Differences among the methods of loading an extension in PHP <pre><code>extension="ext.so" zend_extension="/usr/lib/php4/ext.so" zend_extension_ts="/usr/lib/php4/ext.so" </code></pre> <p>What are the differences?</p>
<p>extension is used to load a user module that adds functionality into the language, such as database access, image manipulation. zend&#95;extension and zend&#95;extension&#95;ts are used to load a module that extends the underlying PHP engine. One such example would be <a href="http://xdebug.org" rel="nofollow">xdebu...
How to quantify the quality of a pseudorandom number generator? <p>This is based on <a href="http://stackoverflow.com/questions/137783/">this question</a>. A number of answers were proposed that generate non-uniform distributions and I started wondering how to quantify the non uniformity of the output. I'm not looking ...
<p>NIST has a set of documents and tools for statistically analyzing random number generators cross a variety of metrics.</p> <p><a href="http://csrc.nist.gov/groups/ST/toolkit/rng/index.html" rel="nofollow">http://csrc.nist.gov/groups/ST/toolkit/rng/index.html</a></p> <p>Many of these tests are also incorporated int...
Checking whether all enum values are mapped? <p>Is there a convenience method available in the java standard libraries to check whether all possible keys in an EnumMap are mapped to a value?</p> <p>I can write my own method like:</p> <pre><code>public static &lt;T extends Enum&lt;T&gt;&gt; boolean areAllValuesMapped(...
<p>There is no built-in way to do this that I can find in <code>EnumMap</code> (and I checked the source code to be sure). However, here is a slightly quicker method:</p> <pre><code>public static &lt;T extends Enum&lt;T&gt;&gt; boolean areAllValuesMapped(EnumMap&lt;T,?&gt; map, Class&lt;T&gt; enumClass) { return m...
How can I set the value of auto property backing fields in a struct constructor? <p>Given a struct like this:</p> <pre><code>public struct SomeStruct { public SomeStruct(String stringProperty, Int32 intProperty) { this.StringProperty = stringProperty; this.IntProperty = intProperty; } ...
<p>You need to use the "this" constructor:</p> <pre><code>public SomeStruct(String stringProperty, Int32 intProperty) : this() { this.StringProperty = stringProperty; this.IntProperty = intProperty; } </code></pre> <p>Doing this calls the default constructor and by doing so, it initializes all the fields, thu...
Read rss and show as html <p>I am using google reader for my RSS, i want to export all my shared or starred rss items to HTML to take this html and put on my website</p> <p>Do any one have an idea about? And one important thing as well, can i page through this html? i mean to export as pages not all in one html page t...
<p>With XSTL you can transform XML to any format you want, including HTML. You can do the transformation on the server, or with modern browsers like IE6+ and Firefox2+ you can do the transformation on the client side. XSTL isn't very pretty as a programming language, but the concept is pretty neat.</p> <p>I don't know...
dependency injection and logging interfaces <p>I was wondering what some of the best practices were around logging and logging frameworks and dependency injection. Specifically, if I am designing a class that needs a way to log, how should I go about getting an interface to log to keeping dependency injection in mind?<...
<p>It's great that you're looking into inversion-of-control and dependency-injection.</p> <p>But for your question, there's another concept you might want to look into: aspect-oriented programming.</p> <p>In .NET, there are some good frameworks available for doing aspect-oriented programming, including Castle, LinFu,...
Is there a way to loop through a sub section of a list in Python <p>So for a list that has 1000 elements, I want to loop from 400 to 500. How do you do it?</p> <p>I don't see a way by using the for each and for range techniques.</p>
<pre><code>for x in thousand[400:500]: pass </code></pre> <p>If you are working with an iterable instead of a list, you should use <a href="http://docs.python.org/library/itertools">itertools</a>:</p> <pre><code>import itertools for x in itertools.islice(thousand, 400, 500): pass </code></pre> <p>If you need...