input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to determine when a time stamp does not exist in a table <p>I have a table that receives data on an hourly basis. Part of this import process writes the timestamp of the import to the table. My question is, how can I build a query to produce a result set of the periods of time when the import did not write to the t...
<p>Here's a slightly modified solution from this article in my blog:</p> <ul> <li><a href="http://explainextended.com/2009/06/11/flattening-timespans-sql-server/" rel="nofollow"><strong>Flattening timespans: <code>SQL Server</code></strong></a></li> </ul> <p>&nbsp;</p> <pre><code>DECLARE @t TABLE ( q...
unwanted "flickering" effect when using hide and show in jquery <p>I'm getting an annoying "flickering" effect in Firefox when using jQuery "show" and "hide" on some div's. Any idea when this could be happening?</p>
<p>The flicker comes from this line of the jQuery code, in the show() method:</p> <pre><code> var elem = jQuery("&lt;" + tagName + " /&gt;").appendTo("body"); </code></pre> <p>It does that to detect the CSS it should use for the display attribute, since different tags get different values (div: block, span: inline, t...
Mixed Mode Debugging <p>Update: After more digging this seems to be an issue with static methods and member variables. I found <a href="http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/962a3778-d273-4ba5-90c2-4c720bc2988d/" rel="nofollow">this post</a> on MSDN forums, but no answer.</p> <p>I am writing a C...
<p>In my case (native EXE --> mixed DLL --> managed assembly (all Visual Studio 2008)) I had to set the debug mode of the executable to 'Mixed'. With the default 'Auto' setting I could not step into the managed assembly.</p>
Connecting To SQL Server DB Using VS2008 <p>I am using VS2008, and usually I'll develop my sites from the App_Data folder and then just upload the whole site to the server.</p> <p>Now I have a site and the SQL DB is running on the server already (Not in the App_Data folder , I use SQL Studio Mgement to connect to it a...
<p>In the Server Explorer, click the "Connect to Database" button:</p> <p><img src="http://xmlvga.blu.livefilestore.com/y1pXVwv7lpWvQY0ggX2vvGjBwf2M8QBrXi5DqBrcwH%5FPIgyykP-cVfdpKRCpIBfO%5FnIMqUsqU1Dct7MSbwwEsZgyzjSXArd5Qgz/image001742.png" alt="alt text" title="Connect to Database" /></p> <p>the following dialog wil...
Pointcut not working for generic interface <p>I'm using Spring framework (2.5) and it's AOP features. I've a pointcut expression, like</p> <pre><code>@Pointcut("execution(public * org.springframework.batch.item.ItemReader+.read(..))") public void itemReaderMethods() {} </code></pre> <p>Where the <a href="http://stati...
<p>Generics don't seem to be a problem for me - I can create a test pointcut on Map operations:</p> <pre><code>@Around(value="execution(* java.util.Map.size(..))") </code></pre> <p>I didn't need to use Map+ either (I assume that is because we're using interfaces), and the generic nature of Map didn't matter either.</...
How can I get Cassini web hosting framework to work without adding it to GAC? <p>I am trying to use Cassini (from <a href="http://www.asp.net/Downloads/archived/cassini/" rel="nofollow">http://www.asp.net/Downloads/archived/cassini/</a>) to host my old style asp.net web service in-process, ideally in a WCF style. Howev...
<p>Extract the WebDev.WebHost DLL from your GAC. It has no other dependecies apart from the .NET Framework itself. You can then reference it locally, and instantiate a <code>Server</code> object from it which has a <code>Start()</code> and - hooray - a <code>Stop()</code> method.</p> <p>I normally browse to the GAC fo...
Can I set the content of a Label to a Binding Expression AND a static value? <p>Is there a way to set a Label's <code>Content</code> property to both a Binding Expression AND a static string value? I want to be able to display something like this:</p> <pre><code>"Current Value: [Value From Binding]" </code></pre> <p>...
<p>If you are using .NET 3.5 SP1, you can use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.contentstringformat.aspx">ContentStringFormat</a>:</p> <pre><code>&lt;Label Content="{Binding ElementName=SomeTextBox, Path=Content}" ContentStringFormat="Current Value: {0}" /&gt;...
Template system to create pdf in php <p>I am looking for an open source template engine in the style of smarty or dwoo (preferable dwoo due to its inheritance features) that can be used to create pdf files instead of html. I am not talking about just a pdf library that allows the creation of the function/method calls, ...
<p>Have you considered using your preferred HTML template engine and then passing the results to an HTML to PDF library Say something like <a href="http://www.rustyparts.com/pdf.php" rel="nofollow">http://www.rustyparts.com/pdf.php</a></p>
easy, programmable data plotting <p>I spend most of my time plotting data, but unfortunately I haven't found a decent solution for my plotting needs. At the moment, the most powerful and pleasant library I found that performs plotting is matplotlib. The results are stunning, but I mostly spend my time fighting with th...
<p>You may want to check out <a href="http://www.wavemetrics.com/" rel="nofollow">Igor Pro</a>. It's quite old, and quirky but it provides the most advanced plotting system I've found yet on the Mac. You can modify anything graphically, at a command line or in script files. The most powerful feature (IMO) is the abilit...
Why does the count function in SQL seem to be doing more than counting the column I ask it to? <p>I have an <code>INSERT</code> query that is pulling data from two tables and inserting that data into a third table. Everything appears to be working fine except that the <code>COUNT</code> part of the query isn't returnin...
<p>It seems logical to me that if you are joining two tables, one with 1 row and the other with 24 rows that there, is the possibility, of having a result set of 24 rows.</p> <p>I notice you have not included a WHERE clause in your SQL (perhaps for brevity), but if you don't have that you are doing a CROSS JOIN (or ca...
How do I mock my Webservice? <p>I need to make tests for my webservice project. In my webservice Interface there is a method named <code>loginuser</code> with string params <code>username</code> and <code>password</code>. It uses C#, WCF, and Visual Studio.</p> <p>How do I to test that loginuser method in my webservic...
<p>You appear to be talking about 2 different things:</p> <ul> <li>Mocking your web service</li> <li>Testing your web service</li> </ul> <p>For mocking of a web / wcf service, we normally create a service that implements the same interface, but returns hard coded values.</p> <p>For testing web services we do it in t...
How to detect inactivity/idle time since last keypressed on j2me <p>I have an application with a lot of screens (followed by MVC pattern), and I want to be able to receive in a fashion way the information that last key was pressed x seconds ago (120 sec let's say). Is there standard way to do this or I have to start a ...
<p>Yes, just record the system timer when a key is pressed.</p> <pre><code>long epoch = System.currentTimeMillis(); </code></pre> <p>When a key is pressed again, you need to check the time difference to see how long it's been idle for.</p> <p>If you need to trigger things without keypresses, then you need to start a...
Temporarily suspend the PC operating system <p>How does one programmatically cause the OS to switch off, go away and stop doing anything at all so that a program may have complete control of a PC system?</p> <p>I'm interested in doing this from both an MS Windows and Linux environments. Any languages or APIs consider...
<p>With Linux, you could use <a href="http://kerneltrap.org/mailarchive/linux-kernel/2007/7/11/114296/thread">kexec jump</a> to transfer control completely to another kernel (ie, your program). Of course, with great power comes great responsibility - it is entirely up to you to service interrupts, and avoid corrupting ...
ComboBox Binding in WPF <p>I am not able to set the selected value of a combobox. </p> <p>this is how i am doing. </p> <pre><code>ComboBox x:Name="cmbProjectStatus" ItemsSource="{Binding ItemListCollection}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding Path=Ite...
<p>but wait, your selected value is defined because you set selecteditem and selectedvaluepath ;)you don't have to set selectedvalue, and<br/><strong>EDIT</strong><br/>ItemList seted as SelectedItem exists in ItemListCollection</p> <p>This should work<br/></p> <pre><code> ComboBox x:Name="cmbProjectStatus" ItemsSou...
recursion: cut array of integers in two parts of equal sum - in a single pass <p>Using recursion, find an index that cuts an array in two parts so that both parts have equal sum.</p> <p>Cut means to cut like with a knife. All the cells with index &lt;= to the result must be equal in their sum to the all the cells with...
<p>Here's a way to do it that takes advantage of Ruby's ability to return multiple values. The first value is the index for the split (if it exists), the second is the sum of each half (or the sum of the whole array if no split is found):</p> <pre><code>def split(arr, index = 0, sum = 0) return -1, arr[index] if in...
Does openGL ES have trouble displaying text? <p>Someone told me that openGL is for graphic only, and that it's very bad at displaying good readable text. Is that true for openGL ES on iPhone OS?</p>
<p>You can render any of the iPhone fonts into a texture and if it's displayed one-to-one, it looks beautiful.</p>
Issue using List returned by webservice <p>I have a webservice that returns a list of "Clinics" near a certain lat/long. However, in my calling web, I can't compile as an error is occuring on the following code.</p> <pre><code>private static List&lt;Clinic&gt; GetClinicsNearLocation(Coordinate coordinate, int searchDi...
<p>It seems that the webservice method is defined as follows:</p> <pre><code>Clinic[] GetSearchResults(coordinate.Latitude, coordinate.Longitude, searchDistance); </code></pre> <p>If you want to convert an array to a list you can do the following:</p> <pre><code>List&lt;Clinic&gt; clinics = new List&lt;Clinic&gt;(ws...
Need help with a SQL query that combines adjacent rows into a single row <p>I need a solution to a problem that has the table structure as listed below. Input </p> <p>1 1/1/2009 Product1 <br> 2 2/2/2009 Product2 <br> 3 3/3/2009 Product3 <br> 4 4/4/2009 Product4 <br> 5 5/5/2009 Product5 <br></p> <p>Output</p> <p>1 1/...
<p>You are looking for PIVOT: <a href="http://msdn.microsoft.com/en-us/library/ms177410.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms177410.aspx</a><br /> Here is a best shot with the info you gave, I do something similar in one of my apps. You may need to use a dynamic SQL query if the pivot values ...
How do I set SuppressUnmanagedCodeSecurity for callbacks? <p>When using P/Invoke, adding [SuppressUnmanagedCodeSecurity] can speed calls from managed code into unmanaged code in trusted scenarios.</p> <p>Is there a way to accomplish the same thing in the reverse direction, to speed things up when I call from unmanaged...
<p>I haven't found anything about suppressing code security, maybe because there's no such stack-walking checks calling from the unmanaged side, but how you marshal your types has an effect on performance. Here's a link showing different ways of marshaling strings, and the perf results: <a href="http://blogs.msdn.com/...
BCP Utility <p>I need to have ability in my application to be able to export some data using the SQL Server BCP utitility. The machines where this utility would run would not have SQL Native Client installed on it, so BCP.exe won't be present by default. </p> <p>Can I put a version of BCP in the installation package. ...
<p>Thanks Kragen2uk. I had already used dependecy walker. In the end, I had to install SQL Server Native Client (Client Components) on the target machine. It's a free redistributable anyway.</p>
Why can some operators only be overloaded as member functions, other as friend functions and the rest of them as both? <p>Why can some operators only be overloaded as member functions, other as non-member "free" functions and the rest of them as both?</p> <p>What is the rationale behind those?</p> <p>How to remember ...
<p>The question lists three classes of operators. Putting them together on a list helps, I think, with understanding why a few operators are restricted in where they can be overloaded:</p> <ol> <li><p>Operators which have to be overloaded as members. These are fairly few:</p> <ol> <li>The assignment <code>operator=()...
Composite WPF EventAggregator subscriptions being lost <p>In my Composite WPF application I have an event that is published when the user double-clicks on a control. Modules subscribe to the event and perform an action when necessary.</p> <p>This event seems to stop working at random. Sometimes when I run the applicat...
<p>Turns out it was the garbage collector removing the subscriptions. I'll have to read up on the internals, but when I replaced</p> <pre><code>this.mEventAggregator.GetEvent&lt;SomeEvent&gt;().Subscribe(SomeFunction); </code></pre> <p>with</p> <pre><code>this.mEventAggregator.GetEvent&lt;SomeEvent&gt;().Subscribe( ...
Entity Framework with OleDB connection - am I just plain nuts? <p>I'm experimenting with the Entity Framework and I want to connect to an Access 2007 database.</p> <p>The following code is inspired by <a href="http://msdn.microsoft.com/en-us/library/system.data.entityclient.entityconnection.connectionstring.aspx">http...
<p>The approach you are using to build the EF connection string is correct.</p> <p>BUT...</p> <p>The Entity Framework only works with Providers (i.e. SqlClient) that support something called provider services.</p> <p>The OleDB provider doesn't support 'Provider Services' so you can't use EF with the OleDb (unless yo...
Extension method resolution <p>I wrote an extension method for String to get a char argument, <code>string.Remove(char)</code>. But when I used this, it instead called the default <code>string.Remove(int)</code> method.</p> <p>Shouldn't the presence of an actual method have higher priority than an implicit conversion?...
<p>Instance methods have priority over extension methods. Your observation is proof of the same.</p> <p>When resolving which method to call, it will always pick a matching instance method over an extension method... which is intuitive in a way.</p> <p>Paraphrased from C# in depth,</p> <blockquote> <p>When the comp...
How to reformat and sort dates stored in nvarchar <p>I am trying to display Month and YY part of the date column such that it should appear as</p> <p>Original Format </p> <pre><code>Apr 12 2009; Feb 20 2009; Dec 24 2008; May 18 2009; Jan 8 2009; Dec 6 2008; Apr 19 2009; Jan 4 2009; May 13 2009; Jan ...
<p>If you want to store the dates as strings in the datbase, you need to use a format that builds on the same principle as the ISO-8601 standard, i.e. you use numerical months and place the most significant value first.</p> <p>To be textually sortable your values would need to look something like:</p> <pre><code>08-1...
CSS - Positioning <p>a. image (960x7) b. div (width:960, padding:10)</p> <p>I want to position (a) so that it's 50px from the top, centered. I want to position (b) so that it's directly beneath (a) with no space.</p> <p>My CSS follows:</p> <pre><code>@charset "utf-8"; * {margin:0;padding:0;} body {background-color...
<p>Check out this question for the rounded edges:</p> <p><a href="http://stackoverflow.com/questions/1127227/css-rounded-corners">http://stackoverflow.com/questions/1127227/css-rounded-corners</a></p> <p>And for the positioning of the objects, I would go with something like this:</p> <pre><code>topimage { positio...
Is openGL ES on iPhone fast enough to render text that consists of little images? <p>For some very sophisticated graphics I am thinking about making a fontset out of image files. Do the openGL ES experienced people here think that this would be okay on iphone, or does performance go down quickly with this?</p> <p>The ...
<p>That is how the AtlasLabel and AtlasSprite work in the Cocos2d library, and it can hit 60 frames a second. It does it by putting all the different images into one image file and then rendering all the characters triangles from the same texture. </p>
Handling Rich Text in an MVC application <p>What are the best practices regarding working with rich text in a web application? I don't want to leave myself vulnerable to script attacks. Should the data be encoded going into the database and then decoded when displayed back to the user? Any advice on rich text editor...
<p>You should pick a whitelist of known tags and attributes, parse the user input as XML, and remove every tag or attribute that isn't in the whitelist. </p> <p><strong>EDIT</strong>: Note that if you allow hyperlinks or images, you have to validate the <code>src</code> and <code>href</code> tags. I would recommend ...
What is wrong with an inner class not using an outer class in Java? <p>I'm using a static analyzer in Eclipse to examine my code. One class, foo, has an inner class, bar. I am getting the following error:</p> <pre><code>JAVA0043 Inner class 'bar' does not use outer class 'foo' </code></pre> <p>Why is this an error?...
<p>Looks like an <a href="http://www.enerjy.com/explorer/help/rules/JAVA0043.html" rel="nofollow">Enerjy Error</a>:</p> <pre><code>// Incorrect class Log { // Position never uses the enclosing Log instance, // so it should be static class Position { private int line; private int column; Position(int ...
Where is the com.apple.Xcode.plist stored on a typical mac installation with latest xcode? <p>Can't find it. Spotlight doesn't find it either. Strange!</p>
<p>For Xcode 5, it's:</p> <p><code>~/Library/Preferences/com.apple.dt.Xcode.plist</code></p> <p>There's also some other dev tool stuff under the <code>com.apple.dt.</code> prefix:</p> <p><strong>Instruments preferences:</strong><br>  <code>~/Library/Preferences/com.apple.dt.Instruments.plist</code><br> <strong>X...
Django serialization of inherited model <p>I have a problem with serialization of Django inherited models. For example</p> <pre><code>class Animal(models.Model): color = models.CharField(max_length=50) class Dog(Animal): name = models.CharField(max_length=50) ... # now I want to serialize Dog model with Anim...
<p>You found your answer in the documentation of the patch.</p> <pre><code>all_objects = list(Animal.objects.all()) + list(Dog.objects.all()) print serializers.serialize('xml', all_objects) </code></pre> <p>However, if you change <code>Animal</code> to be an abstract base class it will work:</p> <pre><code>class Ani...
Prevent New Request While fetching previous request in jQuery <p>i want to how can i prevent new ajax request while browser is fetching previous request ! i create a system contain a table of data like this : </p> <p>col1 | col2 | col3 data1| data2| data3</p> <p>when user mouse over data fields I'm used Ajax to ret...
<p>I think you can cache the jquery ajax request object and then abort it later.</p> <pre><code>var xhr = $.ajax({...}); xhr.abort(); </code></pre>
Is it possible crawl ASP.NET pages? <p>Is there a way to crawl some ASP.NET pages that uses doPostBack as events calling?</p> <p><strong>Example:</strong></p> <p><em>Page1.aspx:</em></p> <p>Contains 1 LinkButton that redirects to Page2.aspx</p> <p>Code-behind for LinkButton Click event: </p> <pre><code> Response.R...
<p>Yes, it's possible if the code follows a well predictable pattern. You would have to gather the form data from the page and simulate what the doPostBack function does (putting some values in some hidden fields), and send a POST request to the server. What you get back would be a redirection page, so you would have t...
c# excel AddChart <p>hi i am adding chart to excel from c# as follows</p> <pre><code> Excel.Worksheet ws = (Excel.Worksheet) Globals.ThisAddIn.GetActiveWorksheet(); Excel.Shape chart = (Excel.Shape) ws.Shapes.AddChart(Type.Missing,100,100,100,100); </code></pre> <p>is it possible now to add l...
<p>You have to get to the <strong>Chart.Shapes</strong> collection and add a new Rectangle Shape. There is not a lot of documentation on VSTO, so you just have to play around.</p> <pre><code>Excel.Shape rectangle = (Excel.Shape)chart.Chart.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 5, 5,...
How to make absolute cell ref in loop work and skipping over a column in loop? <p>I ALMOST got my code working but there are still two things wrong with it (two major things anyway).</p> <p>1) The absolute cell ref. is not working as it does in <a href="http://en.wikipedia.org/wiki/Microsoft%5FExcel" rel="nofollow">Ex...
<p>Where have you defined it? Is it part of a BAS module?</p> <p>EDIT: Put Option Explicit as the first line of BAS module &amp; compile (Debug menu -> Compile).<br /> You will see that there are compilation errors.</p> <p>Remove <code>Dim myRange As Range</code> from Macro1 &amp; Macro2.<br /> Put it at the top of t...
array of integers vs. pointer to integer in c++ <p>If I have <code>int x[10]</code> and <code>int *y</code>, how can I tell the difference between the two?</p> <p>I have two ideas:</p> <blockquote> <ol> <li><p>sizeof() is different.</p></li> <li><p>&amp;x has different type --- <code>int (*p)[10] = &amp;x</code...
<p>There is no general method - you either already know the type because you have just declared the object, or the type will have decayed to a pointer and been lost. Please explain what problem you are trying to solve by differentiating between them.</p>
Odd Results from an SQL query in MS Access <p>Alright, here's an odd one from an MS Access database I'm running.</p> <p>I have a SQL query: </p> <pre><code>SELECT * FROM [Service Schedule] WHERE ID=2 AND Volume &lt;= 3000 AND Term='Monthly' AND special = 'Regular' ORDER BY volume </code></pre> <p>When I put...
<h2>Digression: A discussion of the Recordcount of DAO recordsets</h2> <p>The recordcount of a DAO recordset is not guaranteed accurate until after a .MoveLast, but if any records are returned by the recordset, .RecordCount will be 1 or more. </p> <p>Note that a table-type recordset will return an accurate .RecordCou...
Javascript include_once <p>I have coded a page that has two div one beside the other. The first one serves as a nav tree that, when clicked, loads a page in the right div with AJAX. I have to include a javascript file when one of the page is loaded.</p> <p>I have managed to do jsut that and all works perfectly but eac...
<p>You could store the names of already loaded scripts in an array, and every time a load is requested, test if the script exist in the array or not.</p> <p>You could alternatively attempt to check the src's of your script elements, if you load new scripts by appending new script elements into the document. Personally...
Would it be useful for me to learn OpenGL? <p>I have had my OpenGL Redbook on the shelf for months. I am wondering if I should finally get around to reading it and learning OpenGL. </p> <p>Is it worth it for me to spend the time to learn OpenGL?</p>
<p>It depends on if the low-level stuff is of interest to you. If so, I highly recommend reading that book. It's the canonical book on OpenGL. I refer to it myself from time to time as I use OpenGL on my own projects.</p>
How to make a specific field wider within the gridview? <p> </p> <pre><code> &lt;asp:BoundField DataField="ComputerModel" HeaderText="ComputerModel" SortExpression="ComputerModel" ItemStyle-Width="50px"/&gt; &lt;asp:CheckBoxField DataField="Leas...
<p>Try something like this:</p> <pre><code>&lt;asp:BoundField DataField="ComputerModel" ItemStyle-Width="50px"/&gt; </code></pre> <p>where <code>50px</code> is the width you need.</p>
Is it worth it using the built-in Django admin for a decent sized project? <p>I haven't been using Django too long, but I'm about to start a pretty hefty-sized project. I'm always nervous using fairly new frameworks (new to me) on large projects because I've been burned before. However, I'm pretty confident in Django.....
<p>If I understand it correctly, you want to use the django admin for all users, to let them update the site.<br /> If this is true, I think you may be using it in a different way from what was its main purpose, as you can get from the <a href="http://www.djangobook.com/en/2.0/chapter06/" rel="nofollow">Django book</a>...
Fluent nHibernate and SessionFactory <p>I am a newbie with Fluent NHibernate and have got a question that may not be asked correctly, so please bear with me.</p> <p>I am a bit confused about the best way to manage NHibernate sessions in a web application using Fluent NHibernate.</p> <p>I have read this <a href="http:...
<p>All that Fluent does is simplify the mapping and the creation of a configuration and thence a session factory. Anything you read on session management is equally applicable whether or not you use Fluent.</p>
One MinGW, many GCC versions - how to do it? <p>Is it possible to have <strong>different</strong> GCC installations working with <strong>one</strong> MinGW installation? </p> <p>By MinGW I mean the common base which is always needed regardless which version of GCC compiler we're going to install and use;</p> <ul> <l...
<p>MinGW is a GCC installation. Are you asking "can I have multiple versions of MinGW installed?" - Yes you can. Simply download and install the different MinGW vertsions in different directories. MinGW comes with a .BAT file that when run sets up the local environment for that particular version.</p> <p>If this isn't...
catching EmptyStackException vs. Testing is Stack is empty <p>I have a Stack object being worked on by multiple threads. One of the threads is a worker thread which performs a pop operation on the Stack object. I wanted to handle the case where the Stack is empty and I see two options</p> <pre><code>try{ Object ob...
<p>I would think that the better approach would be to check if the stack is empty as in your second example.</p> <p>Catching exceptions is costly!</p>
Is it of any drawback if a table has many (20+) foreign key constraints? <p>Let's says I have a table which has many fields linked to values from other "value tables". Naturally, I declare foreign key constraints on each and evary of them to enforce integrity.</p> <p>What if I finally get the number of such fields in ...
<p>When you insert a row into your child table, the DB engine will look up if the corresponding values in the parent tables exist - that will use up some CPU and some logical reads. If your parent tables are small, they will most likely be in the cache, so you would not expect many slow physical reads as soon as your c...
How do I convert a string into an integer in JavaScript? <p>How do I convert a <code>string</code> into an <code>integer</code> in JavaScript?</p>
<p><strong>parseInt</strong> or <strong>unary plus</strong> or even <strong>parseFloat with floor</strong> or <strong>Math.round</strong></p> <p>parseInt:</p> <pre><code>var x = parseInt("1000", 10); // you want to use radix 10 // so you get a decimal number even with a leading 0 and an old browser ([IE8, Firefox...
Drawing diagonal lines in Crystal Reports XI <p>I have a report where the customer would like me to draw a couple diagonal arrows to point at a box on the report. Sounds easy enough, but Crystal does not appear to support diagonal lines. Is this true?</p>
<p>that is true. You can create an arrow graphic though.</p>
Haskell: monadic takeWhile? <p>I have some functions written in C that I call from Haskell. These functions return <code>IO (CInt)</code>. Sometimes I want to run all of the functions regardless of what any of them return, and this is easy. For sake of example code, this is the general idea of what's happening curre...
<p>I don't think there is anything like a <code>takeWhileM</code> in the standard library, but you could write it yourself so that only as much IO as needed is executed:</p> <pre><code>takeWhileM :: (Monad m) =&gt; (a -&gt; Bool) -&gt; [m a] -&gt; m [a] takeWhileM _ [] = return [] takeWhileM p (a:as) = do v &lt;- a...
subsonic - collection load versus query <p>I am setting the data source of a datagridview to a subsonic collection</p> <pre><code> TcolorCollection tc = new TcolorCollection().Load(); dataGridView1.DataSource = tc; </code></pre> <p>and I've noticed that the previous code is much (way to much) slower th...
<p>Couple of thoughts...</p> <p>If you have to use a DataSet/DataTable you could just do this:</p> <p>grid.DataSource=new Select().From("tcolor").ExecuteDataSet();</p> <p>Both of the things you show above use the same core bits - not sure why one is slower than the other.</p>
Is it possible to download a binary file from JSP? <p>I think is it quite possible, but I'm not sure. </p> <p>I don't have the possibility to use servlet directly, so I'm forced to use JSP ( long history, short time, you don't want to hear ) </p> <p>So I think something like the following will do:</p> <pre><code>// ...
<p>Yes, use "application/octet-stream" for generic binary data. And remove every line break/whitespace from the import tags and around the scriptlets.</p> <pre><code>&lt;%@ page contentType="applicaton/octet-stream" %&gt;&lt;% byte[] data = getBinaryFromSomeWhere(request.getParameter("xyz")); response.setHeader("Conte...
Open Expression Web programatically <p>Is there a way to open a .html file in Expression Web programatically (C#) without accessing registry key?</p>
<pre><code>Process.Start("EXPRWD.EXE", "C:\\File.htm"); </code></pre>
Binding ItemsSource to a "proxy" collection. How to get DataContext? <p>We've got a Silverlight application with several listboxes and comboboxes that display data sorted incorrectly, which I need to fix. Most of their ItemSource properties are set through XAML. Their DataContext may not be set directly on the control,...
<p>I've stumbled across a very similar problem. I wanted to cascade parameters from one combobox into a subsequent combobox with the same design goal of no code....</p> <p>My solution is hardly elegant, but it works of a fashion :)</p> <p>Basically I have a SharedDataContext control, this has a "Value" DP i bind to t...
Rails param value with anchor appended? <p>The following link</p> <pre><code>&lt;%= link_to "Login to comment", :url =&gt; new_session_url(:return_to =&gt; request.request_uri, :anchor =&gt; 'commentForm'), :method =&gt; :get, :html =&gt; { :id =&gt; 'login_to_comment'} %&gt; </code></pre> <p>generates the following ...
<p>Because the <code>#</code> is unescaped, the anchor <code>#commentForm</code> is actually part of the URL <code>/session/new?return_to=...</code>, and <strong>not part of the URL <code>/nature_photos/sdfds</code></strong> (which is given as the value of <code>return_to</code> in the query string). This happens becau...
Is there a way to preserve the BITMAPFILEHEADER when loading a Bitmap as a Windows resource? <p>I've been working on testing a few things out using <a href="http://sfml-dev.org/" rel="nofollow">SFML 1.4</a> (Simple and Fast Multimedia Library) with C++ and Visual C++ 2008 Express Edition. To avoid having external imag...
<p>Using a custom resource type will preserve the entire file. Change the resource script to utilize the RCDATA type as opposed to the BITMAP type:</p> <pre><code>IDB_SPRITE RCDATA "sprite1.bmp" </code></pre> <p>In the FindResource function call, use RT_RCDATA instead of RT_BITMAP:</p> <pre><code>HRSRC hResInfo = F...
Rails 2.3.2.1 error with Litespeed 4.0.5 <p>I just upgraded to Rails 2.3.2.1 running Litespeed web server 4.0.5 and get the below error. I think it has something to do with setting up the Rack preference (<code>server = Rack::Handler::LSWS</code>) but not sure how to do it. </p> <p><hr /></p> <p>Also, I'm running th...
<p>I thought lightspeed was considered out of the running a while back...</p> <p>Go for <a href="http://modrails.com" rel="nofollow">Phusion's Passenger</a>. Way more flexible and easier to setup/configure. Gets rid of dealing with CGI altogether. Check it out, even if you don't go with it. </p>
Passing an array of ID's to a stored procedure <p>I have stored procedure, i want to send it an array of values. When i send more than one i'm getting an error </p> <p>Error converting data type varchar to numeric.</p> <p>Here is the code.</p> <pre><code>set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
<p>the following code cannot work:</p> <pre><code>TRANSFER_ID IN (@TRANSFER_IDS) </code></pre> <p>Several working alternatives described here:</p> <p><a href="http://www.sommarskog.se/arrays-in-sql.html" rel="nofollow">Arrays and Lists in SQL Server</a></p>
Common Rewrite Setting For Multiple VHosts <p>I am running Apache2 with multiple vhosts in the sites-enabled folder, each looks a bit like this:</p> <pre><code>&lt;VirtualHost *:80&gt; ServerName site1.com ServerAlias www.site1.com DocumentRoot /home/sites/site1/www/ &lt;Directory /home/sites/site/www...
<p>You could try a <a href="http://httpd.apache.org/docs/2.2/mod/mod%5Falias.html#aliasmatch" rel="nofollow"><code>AliasMatch</code></a>:</p> <pre><code>AliasMatch ^/(robots\.txt|favicon.ico)$ /home/sites/site1/www/mainsite_alias$0 </code></pre>
C#: A good and efficient implementation of IEnumerable<T>.HasDuplicates <p>Does anyone have a good and efficient extension method for finding if a sequence of items has any duplicates?</p> <p>Guess I could put <code> return subjects.Distinct().Count() == subjects.Count()</code> into an extension method, but kind of fe...
<pre><code>public static bool HasDuplicates&lt;T&gt;(this IEnumerable&lt;T&gt; subjects) { return HasDuplicates(subjects, EqualityComparer&lt;T&gt;.Default); } public static bool HasDuplicates&lt;T&gt;(this IEnumerable&lt;T&gt; subjects, IEqualityComparer&lt;T&gt; comparer) { HashSet&lt;T&gt; set = new HashSet...
Update URL on AJAX call? <p>Right now the biggest issue I'm having with using AJAX is the fact that if I use AJAX on a page, go to another page, then use the browser's back button to go back anything that was changed with AJAX is gone.</p> <p>I've thought about using the <a href="http://www.asual.com/jquery/address/">...
<p>Nope, this is not possible. <strong>Update: It is now possible via the HTML5 History API - see <a href="http://stackoverflow.com/a/4789054/130638">razbakov's answer</a>.</strong></p> <p>I hope you realize that you are trying to address an extremely difficult problem.</p> <p>Let's say your url looks like</p> <pre>...
Cookies on localhost with explicit domain <p>I must be missing some basic thing about cookies. On localhost, when I set a cookie on server side <em>and</em> specify the domain explicitly as localhost (or .localhost). the cookie does not seem to be accepted by some browsers.</p> <p><strong>Firefox 3.5:</strong> I check...
<p>by design domain names must have at least two dots otherwise browser will say they are invalid (see reference on <a href="http://curl.haxx.se/rfc/cookie_spec.html">http://curl.haxx.se/rfc/cookie_spec.html</a>)</p> <p>when working on localhost (!) the cookie-domain must be set to "" or NULL or FALSE instead of "loca...
VS 2008 Opens Default Browser instead of IE for SilverLight Application <p>My default browser is Chrome. When I run my web applications within VS 2008 IDE, it uses chrome.</p> <p>I want to use IE for this. Is there an option in VS 2008 to make IE the browser to load the web applications? </p> <p>I just want this when...
<p>Right click on .aspx file in your solution tree, and click Browse With... then specify your default browser.</p> <p><hr /></p>
Part of path returned from Directories Only JFileChooser is sometimes duplicated <p>In my application, I want the user to be able to select a directory to store stuff in. I have a text field that I'm using to display the directory they've chosen. If they just click on a directory (don't browse it), everything is fine. ...
<p>Seems to work for me.</p> <pre><code>import javax.swing.JFileChooser; public class FChoose { public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(...
How to load openssl.so dynamic library in PHP 5.2.1 <p>I recently installed MAMP version 1.6 on my MAC OS 10.5.7. Now I am running a script to connect to a site using ssl.</p> <p>After some research, I added the following line to my php.ini(under the extensions part)</p> <p>extension=openssl.so</p> <p>However When I...
<p>You can try using the <a href="http://php.net/dl" rel="nofollow">dl</a> function to dynamically load the openSSL extension: </p> <pre><code>dl('openssl'); </code></pre> <p>It is highly likely that MAMP does not have openSSL support enabled, in which case you might want to consider using <a href="http://macports.or...
Custom TableViewCell with TextField and first responder <p>I have a custom TableView cell that contains a TextField and I want it to become the first responder as soon as the view is shown but [textcell.textfield becomeFirstResponder] does not work. I know it's because it's a custom cell in another class and I even tri...
<p>I have a similar setup and becomeFirstResponder seems to work fine. </p> <p>My custom cell:</p> <pre><code>@interface CustomCell : UITableViewCell { IBOutlet UITextField *costField; } </code></pre> <p>And the delegate method from the controller class:</p> <pre><code>-(UITableViewCell *)tableView:(UITableVi...
How can I formulate an ldap query looking for the absence of an attribute <p>I want to query my directory for all User objects that don't contain a value for a given attribute... I have kind of hacked it up looking for things without a specific value (the potential assigned values are small, so this mostly worked) - bu...
<p>We need a few more parens when doing this:</p> <p><code> (&amp;(objectClass=User)(!(extensionAttribute1=*))) </code></p> <p>If you want to look for a particular attribute you need to remove some parens (removing the ! is not enough)</p> <p><code> (&amp;(objectClass=User)(extensionAttribute1=*)) </code></p>
Iphone Developer Program <p>Well im on the edge about paying $99 dollars to join the Iphone Developer Program, I have the sdk, but im wondering if the program comes with programming lessons or tutorials,</p> <p>If it doesnt do any of you know where i can learn to make game with opengl es for the iphone/ipod touch??</p...
<p>Paying the $99 does not give you any additional content or lessons. You already have access to the Apple-supplied sample code. The SDK only provides the ability to test your application on actual hardware, and it allows you to submit applications to the App Store.</p> <p>The best place to go for beginning tutorials...
AOP and Applying Security to UI Elements <p>I'm working on an application in which we are trying hard to keep Separation of Concerns as strongly as possible. We're finding that the cross-cutting concern of security creates a number of complications.</p> <p>However, it looks like these can be mitigated using attributes...
<p>I'd say that a view shouldn't contain much programming (or nothing at all). The idea of using AOP (or a la AOP) in a place where the P is forbidden doesn't look nice.</p> <p>Let's design it in a different way. Usually views have some control keywords to do the basic stuff: conditions and loops. More intelligence an...
How to end / Force a close to a program (in Clojure) <p>I am a pretty decent programmer in Java, however I am new to programming in Clojure.</p> <p>In Java, to force an exit of a program, the code used is <code>System.exit(0)</code>. Is there any equivalent to this code is Clojure?</p>
<p>Given that part of the attractiveness of Clojure is that you can use Java class libraries, why not just do:</p> <pre><code>(System/exit 0) </code></pre>
Google AppEngine Session Example <p>I just <a href="http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling%5FSessions">enabled Session</a> in my Google AppEngine/Java + GWT application. And how do I use it? How do I get session ID and play will all good stuff from it? Are there any real examples of s...
<p>Enabling session support gives you a standard Servlet HttpSession.</p> <p>This will be tracked by means of a cookie (called JSESSONID), which is managed by the servlet container under the covers. You do not need to care about the session id.</p> <p>You can then set attributes (server-side) that will be associated ...
In php, how do logical operators work _with non-booleans_? <p>In other programming languages (Python, Ruby, Scheme), I'm used to doing things like</p> <pre><code>$foo = $cat &amp;&amp; $dog; $bar = $fruit || $vegetable; </code></pre> <p>I would expect that $foo would get assigned to $dog if $cat were null, and $bar t...
<p>In PHP the result of a boolean comparison is always a boolean, the operands are coerced to boolean.</p> <p><a href="http://us3.php.net/manual/en/language.types.boolean.php">http://us3.php.net/manual/en/language.types.boolean.php</a></p> <p>explains which values, when they are coerced, will becomes true or false.</...
TabControlRegionAdapter bindings in the tab header are broken under silverlight 3.0 <p>This used to work fine under SL3 beta, but after I upgraded to SL3 RTM, the functionality stopped working.</p> <p>In order to reproduce, just open and compile the ViewInjectionComposition solution in Quick starts. the tab header tha...
<p>UPDATE 2:</p> <p><a href="http://compositewpf.codeplex.com/WorkItem/View.aspx?WorkItemId=4599" rel="nofollow">http://compositewpf.codeplex.com/WorkItem/View.aspx?WorkItemId=4599</a></p> <p>UPDATE:</p> <p>I think the issue is this, taken from the Silverlight Toolkit 3 page:</p> <p>HeaderedContentControl Breaking ...
ASP.NET - GridView - EditItem - Null Value for Integers? <p>I am using a GridView in asp.net 2.0 and I want to perform inline editing. I am using an object datasource. Because I want to use validation controls on the integer fields in my gridview, I have made them into <code>&lt;TemplateFields&gt;</code> and added a da...
<p>You might want to do this differently. Instead of using a bound column, create a template column... that will give you full control over the content, and allow you to write a function to format the text during display as well as set the contents to the appropriate value when editing.</p>
Can I create a wireframe for all purposes (sketch, communicate, review, document...)? <p>I was requested to create wireframes for the product UI many times, since they are for different purposes. </p> <p>We need some low-fidelity wireframes to communicate with our clients, which are non-technical people, so that they...
<p>Understand your feeling, but you have to face it. You can use all these tools to have the job done, that's why your boss hire you :-)</p> <p>Honestly I don't think there will be such a magic to meet your requirement...</p>
Java: Why can't I cast this to an Object? <p>This is bizarre... I thought every object in java had Object as an ancestor.</p> <p>I have a <code>ClassA</code> that extends my <code>ClassB</code> and implements <code>Runnable</code>.</p> <p>After creating <code>ClassA</code> I cannot cast it to an <code>Object</code>.<...
<p>Do you by chance have a class named <code>Object</code> somewhere in your code (or non-standard packages that it imports)?</p>
If you raise the price of your iPhone app do the old users have to pay to upgrade? <p>We're considering doing some experimentation with the price point on our iPhone app and I just want to make sure that if we raise the price we won't get a flood of user complaints that apple is charging them the price difference to up...
<p>No, the don't pay the upgrade. In fact, it is an interesting way to launch your app: a small price at the beginning, as a special promotion, and then increase it if you made significant improvements.</p> <p>Google "iphone app pricing strategies" for info on how other apps did in the store.</p>
Completely .NET ZerConf Implementation for XNA <p>I came across Mono.ZerConf, but from what I can tell it still relies on mDNSResponder on Windows and Avahi on Linux.</p> <p>But I'm trying to figure out if it would be possible to implement on the XBOX 360 / XNA, but I obviously can't run mDNSResponder on the 360, thou...
<p>No, this won't work because on XBox, you don't have any networking libraries available to you other than XBox Live APIs</p>
silverlight 3.0 communication with winforms <p>I would like to create a winform on the client side for interaction with Silverlight 3.0. The basic idea is using the winform browser. I definitely need both the directions of communication. Would it be impossible by using JavaScript as a midware for the interaction or som...
<p>Silverlight application can be called from JavaScript and vice versa; similarly WinForm application can call JavaScript hosted in the browser control and vice versa...so technically speaking its possible.</p> <p><a href="http://msdn.microsoft.com/en-us/library/cc645076" rel="nofollow">http://msdn.microsoft.com/en-u...
web site file write performance problem <p>Hi WE use a third party report tool. Report tool uses active-x. At first we generate and run a query accırding to filters, then one report file is created which inculdes the data (result of the query). Then client downloads the report file. But file written operation is a big...
<p>Your problem is not very clear. You said writing file is a big problem, what do you mean by that? Is it slow or what?</p> <p>Is your application designed to serve one client at a time? If not then why you saying others wait for its completion?</p> <p>I assume your application can serve multiple clients at a time. ...
How can I write this SQL better? <p>I have the tables Patient, Service, PatientStatus, Status - a Patient can have multiple statuses discriminated by a Service.</p> <p>I want to build a view that shows for each service and each patient what their current status is, even if they don't have a status for that service. </...
<p>Duh... my 1 = 1 is the same as rewriting it as a CROSS JOIN:</p> <p>from Service s cross join Patient p</p>
What is F# lacking for OO or imperative? <p>Many times I hear that F# is not suited to particular tasks, such as UI. "Use the right tool" is a common phrase. </p> <p>Apart from missing tools such as a WinForms/WPF/ORM designer, I'm not sure what exactly is missing in F# -- honestly! Yet, particularly with UI, I'm told...
<p>I'm not a huge fan of this question as it complains about F# not supporting idiomatic C#. For example, I don't think it's fair to criticize F# for using &lt;- and := for variable assignment because the language makes things immutable by default.</p> <p>Regardless, there are several imperative / object-oriented thin...
Validation on ViewModels in ASP.NET MVC <p>Most of the tips on how to implement validation in ASP.NET MVC seem to center around the Model (either building service layers between model and controller or decorating properties of the model with validation attributes).</p> <p>In my application I use ViewModels for all com...
<p>"Should I put the validation in the ViewModel itself? Or should it stay in the controller" I agree with Robert but I would add a plug for additional automation.</p> <p>If you look at a tool such as <a href="http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/">xVal</a>, you can see that...
How to generate 2TB+ size of data for Oracle, Informix & Sybase <p>I am a new to Informix and as part of my testing activity I am in need of creating 2TB+ size data for Oracle, Informix &amp; Sybase. Is there a database-neutral way of doing this?</p> <p>I am looking for any freeware or open source tools as well; I ca...
<p>I've done this sort of thing many times with some simple Python, Perl or Ruby script to either generate SQL statements or some CSV style file that a database-specific tool can import.</p> <p>Two terabytes is a lot though. You might want to do it in batches.</p>
Multiple Line String Literal in Actionscript 3 <p>How do you specify a multiple line string literal in Actionscript 3?</p> <ul> <li><a href="http://stackoverflow.com/questions/1100260/multiline-string-literal-in-c">Multiline String Literal in C#</a></li> </ul> <p>Note that this is sometimes called a <a href="https://...
<p>There is one example from this site: <a href="http://dougmccune.com/blog/2007/05/15/multi-line-strings-in-actionscript-3/">Multi-line strings in Actionscript 3</a></p> <p>Because actionscript is based on javascript, you can use the cdata tags.</p> <pre><code>private var myString:String = ( &lt;![CDATA[ Lorem ips...
how to create mobile based application in asp.net <p>how to create asp.net application that can be run on any windows mobile... what are h/w and s/w requirements for that? and list of available windows mobile in current market ???</p>
<p>You dont need any seperate hardware for it. Check this question for more information : <a href="http://stackoverflow.com/questions/59424/creating-a-mini-site-in-asp-net-that-works-on-blackberry-windows-mobile-and-iph">http://stackoverflow.com/questions/59424/creating-a-mini-site-in-asp-net-that-works-on-blackberry-...
String compare in SQL Server ! <p>I have two table T1 and T2.I used Sql server 2000.</p> <p><strong>Table T1</strong></p> <pre><code>ID WorkerName Group 1 Rahim,Karim 1 2 Kamal,Adam 3 3 Rahim,Karim 1 </code></pre> <p><strong>Table T2</strong> </p> <pre><code>WorkerID WorkerNa...
<pre><code>update T1 set WorkerName = T2.WorkerId from T1, T2 where T1.WorkerName like T2.WokerName + ',%' </code></pre>
App crashes when multiple files "write to file" simultaneously <p>Here is my code.</p> <pre><code>- (void) connectionDidFinishLoading: (NSURLConnection *) connection { //Each connection has its own "downloadedData". BOOL writeFlag = [downloadedData writeToFile: filePath atomically: YES]; } </code></pre> <p>I...
<p>I assume downloadedData is not shared between the different requests? Because that would probably not be a good idea.</p> <p>I use the <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow">ASI-HTTPRequest</a> library for my http request needs. It's easy to do things like asynchronous requests right. You m...
Images appear in simulator but not when uploading to ipod touch (3.0) <p>I created a simple test app with an image (as well as a button with an image) and it runs fine in the simulator. But when uploading to the iPod, none of the images appear. The button appears but with no image.</p> <p>A few things worth mentioni...
<p>Check the capitalization of your filenames--the devices are pickier than the simulator, so if you have a file named foo.png in one place and Foo.png or foo.PNG in another that could be it.</p>
Get System Information of a Remote Machine (Using Java) <p>As the question's title says, I want to get the system information (like OS name, version, etc.) of a remote system using Java. But before anyone answers this question, I just want to ask whether this is possible, if yes, then how?</p> <p>One more catch is tha...
<p>For Windows you should be able to access WMI on the remote machine (with some ugly JNI glue), for UNIX systems I don't know of a way (unless you somehow have shell access, then you can probably try logging in via SSH and do a <code>uname -a</code> or similar). It's going to be a lot of work in either case and Java i...
Pointer to Value in a std::map <p>I have a std::map that is used by multiple threads to store data. The map is declared like this:</p> <pre><code>std::map&lt;int, Call&gt; calls; </code></pre> <p>From each thread, I have to acquire a mutex lock, obtain a pointer or reference to the object belonging to that thread, th...
<p>You should use iterators:</p> <pre><code>mutex.lock(); std::map&lt;int, Call&gt;::iterator callptr = calls.find(id); callptr-&gt;second.foo(); ... mutex.unlock(); </code></pre> <p>Your first solution with pointers is problematic, because the lifetime of the object in the map is uncertain - it may be moved when t...
Variable length tuples in f# <p>Is it possible to write a function to accept a tuple of variable length? I'm trying to write a method that can be called like this:</p> <pre><code>let a = sum(1,2) let b = sum(1,2,3) </code></pre> <p>EDIT: Could it be interpreted as a function call with params? Or would the method need...
<p>No - tuples are by definition not variable length, and to write a function like this you'd need something like template metaprogramming in C++ - and there isn't such a thing in F#; <code>let inline</code> won't help you there either.</p> <p>Of course, if you take a list instead, it won't look that much different:</...
Create a process from a driver <p>Is there a way to create a user-mode process from kernel-mode on Windows NT platform (XP-W7)?</p> <p>EDIT: I must install only the driver. This is a specific of the project.</p>
<p>To create a valid win32 process the driver must communicate with CSRSS (what is completely undocumented). So I ended up by queuing a user-mode APC and allocating virtual memory for the APC code in the context of the existing win32 process (that code will call CreateProcess and do the job).</p> <p>It is a tricky way...
How and where to learn the changes in .net from .net 2.0 to .net 3.5? <p>I left the .net about 3 years back when I was working on .net 2.0. And in these three years I wasn't working on .net at all. Now, I have got a project which is in .net 3.5. But I have noticed there are a lot of technologies introduced between thes...
<p>For a quick overview ...</p> <p><strong>What's New in .NET Framework 3.5</strong> (<a href="http://sunnytalkstech.blogspot.com/2007/09/whats-new-in-net-framework-35.html" rel="nofollow">taken from here</a>)</p> <blockquote> <p><strong>CLR Enhancements</strong>: Although the CLR uses the same model as 2.0, you ca...
Wrap text in xml into element tags in Linq to Xml <p>I need to wrap up all the text thats in a large XElement tree, into Elements. For example:</p> <pre><code>&lt;element1&gt;hello&lt;element2&gt;there&lt;/element2&gt;my friend&lt;/element1&gt; Becomes &lt;element1&gt;&lt;text value=”hello”/&gt;&lt;element2&gt;&l...
<p>I think this does what you're after:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; class Test { static void Main() { string xml = "&lt;element1&gt;hello&lt;element2&gt;there" + "&lt;/element2&gt;my friend&lt;/element1&gt;"; ...
Regarding itemdatabound in repeater <p>I have following code in page load</p> <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then GetDetails() PopulateRepeater() End If End Sub Sub PopulateRepeater()...
<p>The ItemDataBound event is raised once for every object in the bound list, so it will be fired three times in your case; once for each file. You should not loop over your data table, but rather grab the current item from the event args.</p> <p><strong>Update</strong>: looking closer at the code I find it somewhat c...
Enable php5-curl on OpenSuse with Nginx <p>I have OpenSuse Server 10.3 with nginx for web server.</p> <p>I need to enable php5-curl. Installed it successfully. Then restarted web server, but nothing changed. </p> <p>Any ideas?</p> <p>Thank you</p>
<p>You probably didn't actually load the extension yet. Look at your phpinfo() to find out where PHP is looking for .ini files. If you have a section labelled something like "Scan this dir for additional .ini files", then make a new file in that directory ('curl.ini') with the single line:</p> <pre><code>extension=cur...
please give the command in Robocopy i should use to copy the files from primary server to the secondary server <p>I got the command in robocopy as mentioned below</p> <p>ROBOCOPY Source Destination [file…[file]…..] [Options]</p> <p>Source: Source Directory Destination: Destination Directory Files: files to copy...
<p>An example of a ROBOCOPY call would be</p> <pre><code>ROBOCOPY C:\Users \\SERVER\backup\Users /MIR /R:0 /W:0 </code></pre> <p>This copys everything under <code>C:\Users</code> to a network share at the UNC path <code>\\SERVER\backup</code>. If you don't know, what that means, <a href="http://www.google.com/search...
Repository without ORM for saving object graph <p>I know it's fairly straight forward to create Repository for retreiving domain models without ORM (<a href="http://stackoverflow.com/questions/446629/repository-pattern-without-linq-or-other-orm">http://stackoverflow.com/questions/446629/repository-pattern-without-linq-...
<p>I am too struggling to find out solution..</p> <p>DDD without ORM, is it possible.. Look at <a href="http://solveme.wordpress.com/2009/11/11/ddd-without-any-orm-tool-is-it-possible/" rel="nofollow">http://solveme.wordpress.com/2009/11/11/ddd-without-any-orm-tool-is-it-possible/</a></p>
How have your ideas about C programming practices changed in the last ten years? <p>Object-Oriented programmers seem to have all the fun. Not only are they treated to major framework revisions every two years, and new and Improved languages every five, they also get to deal with design practices tailor-made to their p...
<p>I try to use ready-made libraries for basic functionality when possible. I find <a href="http://library.gnome.org/devel/glib/stable/">glib</a> (part of the <a href="http://www.gtk.org/">GTK+ GUI framework</a>) absolutely brilliant when it comes to general data structures and such. No more writing your own <a href="h...
C# compression and JavaScript decompression <p>I've got some strings that I need to compress server-side in C#, then decompress client-side in JavaScript. What can I use to accomplish this?</p>
<p>Assuming you're fetching this data over HTTP, is there any reason you can't do this at the HTTP level? (See <a href="http://www.websiteoptimization.com/speed/tweak/compress/" rel="nofollow">this article for information about HTTP compression</a>.)</p> <p>That way you shouldn't need to do anything on the client side...
windows forms <p>cant we increase the windows form size more than 1452, 912..coz i have to show four data grid views on one single form and im not able to do it.</p>
<p>Windows will put a limit on you form/windows size. You cannot make it larger as the screen resolution.</p> <p><strong>EDIT:</strong> So you want to be able to work with a canvas of 2000x2000, and place your controls on that. I would create a usercontrol, size this 2000x2000, and work with this.</p> <p>You can add ...