input
stringlengths
51
42.3k
output
stringlengths
18
55k
Can I modify git-add's hunk size? <p>I have a file that I've been working on and then realized that I had a mistake in it a few lines above where I've been working. I quickly fixed the mistake and want to commit it before I commit the rest of my work. Great, this is where git add --patch comes in!</p> <p>Except, I'm b...
<p>In addition to 'y' and 'n', one of the answers you can give when it asks you about a hunk is 's', for 'split this hunk in to smaller hunks'. The full list:</p> <pre><code>y - stage this hunk n - do not stage this hunk q - quit, do not stage this hunk nor any of the remaining ones a - stage this and all the remainin...
Access Query Memo field truncation due to "distinct" <p>I am having problems running a query without either truncating the note field in NotesTbl or returning repeated entries.</p> <p>UID is not unique for AccessTbl. When I leave out "distinct" notes will return multiple times because I am joining with AccessTbl on a...
<p>The Access database engine normally determines uniqueness of text ('String') data using only the first 255 characters and that is why <code>DISTINCT</code> and <code>GROUP BY</code> will truncate. </p> <p>This suggestion is a bit long winded but it does work: split the <code>MEMO</code> into chunks of 255 character...
Unnest an SQL statement <p>I have this working SQL statement:</p> <pre><code>select oriseqs.newID from oriseqs WHERE oriseqs.singlets=1 AND oriseqs.newID not in (select newID from cleanreport WHERE trash!="") </code></pre> <p>My question is how to avoid doing one select inside another in this particular case. I mean...
<pre><code>SELECT oriseqs.newID FROM oriseqs AS o LEFT JOIN cleanreport AS cr ON o.newID = cr.newID WHERE oriseqs.singlets=1 AND trash != "" AND cr.newID IS NULL </code></pre> <p>What are the PKs?</p>
Parse a JavaScript string best practice <p>I have this</p> <pre><code> var checkBox = e.target; var tableRow = checkBox.parentNode.parentNode; var key = tableRow.attributes["key"]; var aKey = key.nodeValue; </code></pre> <p>at this point aKey = "[123]"</p> <p>what the best way to return 123 as an int ...
<p>As long as your key fits into an int without overflowing, you could do</p> <pre><code>numericKey = parseInt(aKey.substr(1, aKey.length - 2)) </code></pre>
MySQL query to get non-data for unassigned dates <p>I have a table with weekly data that looks like:</p> <pre><code>userID Site date ------ ------ ------ Smith Ferris Wheel 2009-07-13 Jones Outerspaceland 2009-07-13 LChar Ferris Wheel 2009-07-14 Smith Underw...
<p>Easy! Flip the query around!</p> <p>That is:</p> <ol> <li>Create a lookup table with the days of the week</li> <li>Sculpt a query that performs a LEFT_OUTER_JOIN on the lookup table and your table DAYNAME(field). That is, it will return all rows from the lookup table and only those that match in your table,,,</li...
Google DataStore not storing child objects <p>I have an entity Course that has a key to another entity (Document) inside. </p> <pre><code>@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") public class Course{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) ...
<ul> <li>What does the Document class look like?</li> <li>what does the DocumentServiceImpl class look like?</li> <li>What does your unit test for saveAndGetKey() look like? Does it check that the return value is a valid key? can you then look up that document in the datastore?</li> <li>Are your ServiceImpl classes P...
Can the Android handset LED be manipulated without using a Notification object? <p>I want to control the LED on an Android device with more control than is offered by the Notification class. Notifications allow you to change the rate of flashing; e.g. 300 milliseconds on, 1000 milliseconds off, but that's it.</p> <p>...
<p>I haven't tried this in code, but the SDK shows this:</p> <ul> <li>To turn the LED off, pass 0 in the alpha channel for colorARGB or 0 for both ledOnMS and ledOffMS.</li> <li><strong>To turn the LED on, pass 1 for ledOnMS and 0 for ledOffMS.</strong></li> <li>To flash the LED, pass the number of milliseconds that i...
nullify object that is part of ArrayList java <p>I have an array list:</p> <pre><code>private ArrayList&lt;PerfStatBean&gt; statFilterResults; </code></pre> <p>I want to iterate through it like: </p> <pre><code>Iterator&lt;PerfStatBean&gt; statsIterator = statFilterResults.iterator(); while(statsIterator.hasNext()){...
<p>This probably isn't a great optimisation. If the memory requirements are large, then you probably don't want to store them all in a list in the first place - process the objects as they are created.</p> <p>However, taking the question literally, <code>ListIterator.set</code> is the method for you.</p> <pre><code>f...
SQL Server missing tables and stored procedures <p>I have an application on a client's site that processes data each night, last night SQL Server 2005 gave the error "Could not find stored procedure 'xxxx'". The stored procedure does exist in the database, has the right permission as far as I can tell, the application ...
<p>I would try using SQL Database Recovery tool (you can download a trial for free) at <a href="http://www.mssqldatabaserecovery.com/" rel="nofollow">http://www.mssqldatabaserecovery.com/</a>. It uses high-end scanning mechanisms to ensure in-depth scanning of damaged database and complete data retrieval and it's reall...
Lightweight validation framework for WPF using M-V-VM <p>In implementing M-V-VM in a project and following advice of <a href="http://karlshifflett.wordpress.com/mvvm/input-validation-ui-exceptions-model-validation-errors/" rel="nofollow">Karl Shifflett</a> about implementing a validation framework, but don't really wan...
<p>I can only speak from the experience of <em>not</em> using a full validation framework, in as much as I've simply stuck to using what WPF natively offers.</p> <p>In my project, I implemented the IDataError interface on my entity/data classes, as well as implemented the partial "OnValidate" method that Linq-To-Sql o...
parameterized Grails validation messages <p>In the messages.properties file in a Grails application I've seen examples of validation messages such as:</p> <pre><code>User.password.size=Size of bar must be between {0} and {1} </code></pre> <p>which applies to</p> <pre><code>class User { String password stati...
<p>I did some experimentation and I discovered that for a constraint such as:</p> <pre><code>class User { String password static constraints = { password(size:5..15) } } </code></pre> <p>The values of the placeholders are:</p> <pre><code> 0. Name of the class (User) 1. Name of the property (...
jQuery and $ questions <p>I am modifying some code that has a lot of jQuery but I am not sure what some of the jQuery statements are doing.</p> <p>At the top of the jQuery code there is </p> <pre><code>jQuery.noConflict </code></pre> <p>*1. I understand that. But then there is a some code that has:</p> <pre><code>&...
<p>Example 1:</p> <p>I think you missed out on some code:</p> <pre><code>(function($) { $(document).ready(function() { jQuery.fn.fixEmail = function() { { return $(this).each(function() { var $s = $(this); ...code... } } )(jQuery); //This line was missing in yo...
How to Detect Hardware Acceleration for OpenGL on Windows <p>Is there a Win32 API call that detects the current Hardware Acceleration level of a user's system? I have no need to change the setting, but I'd like to scale back the level of detail for my OpenGL display if hardware acceleration is disabled.</p>
<p>From the FAQ: <a href="http://www.opengl.org/resources/faq/technical/mswindows.htm#0030" rel="nofollow">How do I know my program is using hardware acceleration on a Wintel card?</a></p> <blockquote> <p>If you are using the Win32 interface (as opposed to GLUT), call DescribePixelFormat() and check the returned...
Fill entire SQL table column <p>I just added a new column in my DB which I need to propagate with a specific text value (Confirmed). Is there a simple way to apply to all my data entries so I don't have to go through all my rows and type the value in?</p> <p>Thanks</p>
<p>you run the statement:</p> <pre><code>UPDATE whateveryourtableis SET whateveryourcolumnis = 'whatever'; </code></pre>
Where is the best documentation of Microsoft Excel Chart Biff format <p>I am looking for the best documentation of Microsoft Excel's chart file format - 1997 - > 2003.</p> <p>I am not looking for ooxml. I am not looking for the format of worksheets/workbooks. I am looking for the format of Excel <strong>charts</strong...
<p>Microsoft <a href="http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx" rel="nofollow">published these</a> about a year ago in <strong>P A I N F U L</strong> detail. Are you sure you don't want to just use the XML formats ? ;-)</p>
C# Singleton with constructor that accepts parameters <p>I want to create a static class or singleton class that accepts a reference to another object in its constructor. Static classes are out, but I figured I could create a singleton that accepts parameters in its constructor. So far I haven't had any luck figuring o...
<p>This is generally considered a bad idea because if you are going to accept either an object reference or a type argument that you plan on wrapping in a singleton-like wrapper you cannot guarantee that you hold the only instance of that type in the AppDomain.</p> <p>The whole point of the singleton pattern is to con...
Method Parameter Dilemma <p>I always come to a halt when creating classes. I'm fairly intermediate to architecture so bear with me. Here's my dilemma. I come to a point eventually in a class where I have to ask myself, "Does this method need parameters when I can just get what I need from the class's property or pri...
<p>less coffee, fewer words ;-)</p> <h1>to summarize</h1> <p>when to use parameters in methods?</p> <h1>short answer</h1> <p>when the information needed is <em>not</em> available already in the object, in accordance with the Don't Repeat Yourself principle</p> <p>parameterless methods are fine, there's no need to ...
Does Python have anonymous classes? <p>I'm wondering if Python has anything like the C# anonymous classes feature. To clarify, here's a sample C# snippet:</p> <pre><code>var foo = new { x = 1, y = 2 }; var bar = new { y = 2, x = 1 }; foo.Equals(bar); // "true" </code></pre> <p>In Python, I would imagine something lik...
<p>The pythonic way would be to use a <code>dict</code>:</p> <pre><code>&gt;&gt;&gt; foo = dict(x=1, y=2) &gt;&gt;&gt; bar = dict(y=2, x=1) &gt;&gt;&gt; foo == bar True </code></pre> <p>Meets all your requirements except that you still have to do <code>foo['x']</code> instead of <code>foo.x</code>. </p> <p>If that's...
(Rails) Protecting code and licensing for independently deployed Rails applications...? <p>I'm writing a Rails application which will have reasonably regular updates -- nothing abnormal here. I face a problem, however, due to the distribution model. Basically the application will be sold for stand-alone "intranet" in...
<p>We are using <a href="http://rubyencoder.com/" rel="nofollow" title="Ruby Encoder">Rubyencoder</a>.</p>
How do you drop a default value or similar constraint in T-SQL? <p>I know the syntax:</p> <pre><code>ALTER TABLE [TheTable] DROP CONSTRAINT [TheDefaultConstraint] </code></pre> <p>but how to I drop the default constraint when I don't know its name? (That is, it was autogenerated at <code>CREATE TABLE</code> time.)</p...
<p>You can use this code to do it automatically:</p> <pre><code>DECLARE @tableName VARCHAR(MAX) = '&lt;MYTABLENAME&gt;' DECLARE @columnName VARCHAR(MAX) = '&lt;MYCOLUMNAME&gt;' DECLARE @ConstraintName nvarchar(200) SELECT @ConstraintName = Name FROM SYS.DEFAULT_CONSTRAINTS WHERE PARENT_OBJECT_ID = OBJECT_ID(@tableNam...
Why do we need typename here? <pre><code>template&lt;class T&gt; class Set { public: void insert(const T&amp; item); void remove(const T&amp; item); private: std::list&lt;T&gt; rep; } template&lt;typename T&gt; void Set&lt;T&gt;::remove(const T&amp; item) { typename std::list&lt;T&gt;::iterator it = // q...
<p>In general, C++ needs <code>typename</code> because of the unfortunate syntax [*] it inherits from C, that makes it impossible without non-local information to say -- for example -- in <code>A * B;</code> whether <code>A</code> names a type (in which case this is a declaration of <code>B</code> as a pointer to it) o...
How to create a custom UIButton (with images) but still use setTitle? <p>I've tried creating a UIButton with UIButtonTypeCustom. Then afterwards used the following methods to adjust the look of it</p> <pre><code>[sendButton setImage:[UIImage imageNamed:@"sendButtonOff.png"] forState:UIControlStateNormal]; [sendButton ...
<p>If you want the title to display over the image, try using this:</p> <pre><code>[sendButton setBackgroundImage:[UIImage imageNamed:@"sendButtonOff.png"] forState:UIControlStateNormal]; [sendButton setBackgroundImage:[UIImage imageNamed:@"sendButtonOn.png"] forState:UIControlStateHighlighted]; [sendButton setB...
Visual Studio 2008 Help System <p>Is there any way to make the Visual Studio 2008 help system more object aware when querying a property?</p> <p>Let me explain. In good old fashioned VB6, if I create a winsock control, and type winsock1.close and then highlight the close and hit f1, it brings up the help for the clos...
<p>Did you try to post bug to <a href="http://connect.microsoft.com" rel="nofollow">Microsoft Connect</a>? I think that it is IDE bug and should be fixed.</p>
IDataErrorInfo and the property validation of an object <p>Since I am trying to learn WPF I see more and more the use of the interface <strong>IDataErrorInfo</strong> to bind the error to the interface. My problem is that I usually put the validation of the data in the setter of the property and not in a method like ID...
<p>If you throw an exception in the setter, then <code>IDataErrorInfo</code> is redundant since it can't (in theory) <strong>get into</strong> an illegal state. <code>IDataErrorInfo</code> allows you to accept all input, but tell the user that there is a problem. The nice thing about this is that it allows less interru...
Which is more fluent - longer or shorter syntax? <p>I am trying to create my first fluent interface and I was just wondering what other poeple thought was more fluent and which one they would prefer to use?</p> <pre><code>Check.Field().Named("est").WithValueOf("sdsd").IsNotNull() Check.Field("est").WithValueOf("sdsd"...
<p>Last one definitely:</p> <pre><code>Check.Field("est").WithValue("sdsd").IsNotNull() </code></pre>
How to expand the treeview by a fullpath? <p>I think this is common in treeview, it has a number of level, and I have a path, say:</p> <pre><code>Level1 &gt; Level2 &gt; Level3 &gt; Level4 </code></pre> <p>How can I expand the treeview to Level 4 by using the path? Any built-in function?</p> <p>Thanks.</p>
<p>Purely based on documentation</p> <pre><code>TreeNode mynode = treeView1.FindNode(pathToNode); mynode.Select(); mynode.Expand(); </code></pre> <p>I hope you get the starting point from here.</p>
How to lock a critical section in Django? <p>I can't find a good clean way to lock a critical section in Django. I could use a lock or semaphore but the python implementation is for threads only, so if the production server forks then those will not be respected. Does anyone know of a way (I am thinking posix semapho...
<p>If you use RDBMS, you can use its "LOCK" mechanism. For example, while one "SELECT FOR UPDATE" transaction locks a row, the other "SELECT FOR UPDATE" transactions with the row must wait.</p> <pre><code># You can use any Python DB API. [SQL] BEGIN; [SQL] SELECT col_name FROM table_name where id = 1 FOR UPDATE; [Pr...
How to dynamically insert rows in Silverlight 3 datagrid with different header/column layout? <p>Say I have the DataGrid control from Silverlight 3 and I want to dynamically create some free space between two rows to show more details. How can I do that? </p> <pre><code>Header1 | Header2 | Header3 | Header4 ---------...
<p>You will need a collection of the type class (i.e Cell) with a property .Foos collection exposed on the cell. (example properties in short hand)</p> <pre><code>Class Foo Property FooName as String End Class Class Cell Property CellName as String ReadOnly Property Foos as Generic.List(of Foo) End Class </c...
HttpWebRequest Limitations? Or bad implementation <p>I am trying to build a c# console app that will monitor about 3000 urls (Just need to know that HEAD request returned 200, not necessarily content, etc.) </p> <p>My attempt here was to build a routine the checks the web URLS, looping and creating threads each execut...
<p>Just remember, you asked.</p> <h1>Very bad implementation.</h1> <ol> <li><p>Do not go creating threads like that. It does very little good to have more threads than processor cores. The extra threads will pretty much just compete with each other, especially since they're all running the same code.</p></li> <li><p>...
Why is this being garbage collected <p>My developers and I are having an issue with objects being garbage collected in our application when we don't want them to be. We are using Java with Weblogic 10g3. We are programming a singleton pattern to handle all of our JMS connections.</p> <p>There are two classes involve...
<blockquote> <p>Since the JMSFactory has a reference to them why would the gc destroy them?</p> </blockquote> <p>Well, are any objects still holding reference to the JMSFactory at this point?</p> <p>Typical singleton pattern keeps the reference to the singleton object in a static member:</p> <pre><code>public clas...
What are the differences between the two common implementations of a queue? <p>In Java, one of the implementations of queue is "circular array" and the other one is "linked list". What are their differences?</p>
<p>In terms of how they're used, there is virtually no difference at all, except when you get to the size limit of the queue (which I'll explain in a sec...)</p> <p>As for other considerations:</p> <ul> <li><p>A linked list approach is advantageous because you can dynamically resize the queue with no extra effort - t...
Listview Binding <p><strong>xaml code</strong> </p> <blockquote> </blockquote> <pre><code> &lt;ListView Name="lvw" VirtualizingStackPanel.IsVirtualizing="True" ItemsSource="{Binding Source={StaticResource MyList}}" &gt; &lt;ListView.View&gt; &lt;GridView AllowsColumnReorder="true" Virtualiz...
<p>Is MyList a static data? you can use asynchronous binding by setting IsAsync property <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.binding.isasync.aspx" rel="nofollow">Binding.IsAsync Property</a> or asynchronous data loading see <a href="http://msdn.microsoft.com/en-us/library/system.windows...
Why use SysV or POSIX shared memory vs mmap()? <p>Needing to use IPC to pass large-ish amounts of data (200kb+) from a child process to a parent on OS X 10.4 and above, I read up on shared memory on Unix, specifically System V and POSIX shared memory mechanisms. Then I realized that mmap() can be used with the MAP_ANO...
<p>If you have a parent/child relationship, it's perfectly fine to use mmap.</p> <p>sysv_shm is the original unix implementation that allows related and unrelated processes to share memory. posix_shm standardized shared memory. </p> <p>If you're on posix system without mmap, you'd use posix_shm. If you're on a unix w...
Change the action when clicking on a list item <p>I would like to change the destination URL when clicking on a list item / item title so it will no send me to view the item but will send me to a different URL base on the item. I am not looking to replace the Links list but to use the list title as URL query filter. Th...
<p>You will need to do it using the custom Page / Customize the View Page in the SharePoint Designed. Please refer to <a href="http://blogs.msdn.com/sharepointdesigner/archive/2007/04/24/spdatasource-and-rollups-with-the-data-view.aspx" rel="nofollow">this</a> article on how you can achieve it using the SPGridView cont...
Populating ArrayCollection with HTTPService <p>I am creating a RSS Feed application based on a data, and I have the following:</p> <p>I have an ArrayCollection that is pre-populated with data. I am sorting through the ArrayCollection, get 1 piece of data (condition), and need to connect to an RSS feed which returns me...
<p>First make a result event on httpservice in that only you will access the result for the request.</p> <p>In that method you will get resultEvent from that take out the required value if it return the response as xml you can directly do like this <strong>lastResult.article.title</strong></p> <pre><code>&lt;mx:HTTPS...
How to find the return value of last executed command in UNIX? <p>How to find the return value of last executed command in UNIX?</p>
<p>You can use the shell variable <code>$?</code></p> <p>Such as:</p> <pre><code>ghostdog$ true ; echo $? 0 ghostdog$ false ; echo $? 1 </code></pre>
javascript // what is going on here? <p>Im looking at a javascript file trying to figure out a timer issue, but im lost as to what exactly is happening here. Could someone break down this code into bite sizes and explain what is going on?</p> <pre><code>Timer=0; function countdown(auctionid) { var auctions; va...
<p>Every second, this script will update the time left for each of the "auctions" on the page. The second argument to setTimeout() is the time to wait in milliseconds, thus 1000 = 1 second.</p> <p>Also, on the 1st second, and every 10s afterwards, it will make an AJAX call to retrieve a set of auctions in double-pipe ...
display the active member details <p>I have one database which contains username, password and IsActive (data type is "bit") columns. </p> <p>My requirement is that I have to display the user details when the user name and password is correct and when the active column of that user is true. </p> <p>How can I check t...
<p>How about something like the following? </p> <pre><code>SELECT username, password FROM UsersTable WHERE IsActive &gt; 0 AND username = 'admin' AND password = '1234' </code></pre>
How to ensure http requests originate from a specific location? <p>HTTP Referer is the way I'm doing it at the moment. As everyone who's used this method knows it is not 100% accurate as the Referer header is optional and maybe fiddled with.</p> <p>Looking at <a href="http://stackoverflow.com/questions/848788/how-to-e...
<p>If you really want to secure who can load your iframe, then one way to do this is via 2-legged <a href="http://oauth.net/" rel="nofollow">OAuth</a> (i.e. have your trusted partner "sign" the iframe GET request). Then your server can grant access based on a cryptographically valid signature and a known signing party....
Projects for C++ Beginner/Intermediate? <p>I really want to learn more about C++. I know the basics, and I know the concepts, and I have even been able to create C++ projects myself, but my problem is being able to view, fix, and add to code I haven't written myself. I have looked at some open source projects on source...
<p>If you are already able to create own projects, I think the best way to learn how to read&amp;change someone's code is to get job in software company. They even will pay for it :)</p>
How to structure an if-else statement in an IBAction method <p>I don't know how to make an if-else statement within an IBAction! I can only make them in the button clicks... what I want it to do is check for which # the int question is at and make the appropriate changes. please help!</p> <p><strong>MainView.h</strong...
<p>I would suggest making use of the sender parameter of the IBAction-call. Everytime a IBAction-method is called the object making the call is sent along with it making it easy to determine which button was clicked.</p> <pre><code>- ( IBAction ) buttonClicked:( id ) sender { if( [ sender tag ] == answer ) { ...
Am I using new operator correctly? <p>I have the following pointer.</p> <pre><code>char **x = NULL; </code></pre> <p>x is will point to an array of pointers. So is the following code correct?</p> <pre><code>x = new (nothrow) (*char)[20]; </code></pre> <p>and we will dealocate it using</p> <pre><code>delete[] x; </...
<p>Apart from the pointer-syntax mentioned by unwind, it is equivalent: an array of 20 char* will be allocated and deleted in both cases.</p> <p>C++-adept warning: use <code>std::vector&lt; std::string > </code> instead :) No memory management needed.</p>
problem with single xml file when we select the different songs <p>Actually in my website www.musicking.in when the user selects songs one player window will open and that will access the corresponding selected songs xml playlist and the player will play those songs.</p> <p>actually its working fine. but sometimes the...
<p>I think the problem you're having is that multiple users are sharing the same .xml file.</p> <p>You can easily get around this by one of these methods:</p> <ol> <li>Store the XML in a database (or directly in the session) and access it via the session ID.</li> <li>Use the session id as part of the filename</li> </...
How do I share an object between UIViewControllers on iPhone? <p>My application is a tab bar application, with a separate view controller for each tab.</p> <p>I have an object in my first view controller (A) which contains all my stored application data (Please ignore NSUserDefaults for this) which needs to be accesse...
<p>One option you have is to declare your date model as instance variables of your app delegate (as mentioned by other commenters).</p> <p>Instead of referencing the app delegate as suggested by nevan an alternative is to add a property to your view controller classes (A and B) for your data model.</p> <p>Say you wan...
ListBox doesn't refresh after property changed <p>I'm trying to bind two <code>ListBox</code>es:</p> <pre><code>&lt;ListBox SelectionChanged="lbApplications_SelectionChanged" ItemsSource="{Binding Path=Applications, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" /&gt; &lt;ListBox D...
<p>Let's just look at one of the ListBoxes, since they're both the same, basically.</p> <p>The code we're concerned about is this:</p> <pre><code>&lt;ListBox ItemsSource="{Binding Path=Applications, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" /&gt; </code></pre> <p>Since you're new...
Sample application with .Net and Java EE <p>I need a sample application where the UI part is made with .Net (Windows) and the database handling logic/Business Logic part is handled by Java EE.</p>
<p>A better question is how would I do this?</p> <p>One way would be to write the business logic in Java and expose it to the .NET client via a Web service, perhaps using <a href="http://ws.apache.org/axis/" rel="nofollow">Apache Axis</a> on the Java side.</p> <p>On the .NET side <a href="http://msdn.microsoft.com/en...
if(!empty) issues <p>What is wrong with this? The code in the "if statement" runs if $forwardformat isn't empty empty, but the "else" code doesn't run if $forwardformat is empty. Any ideas?!</p> <pre><code>while ($row = mysql_fetch_array($forwardresult)) { $forward = $row["id"]; $forwardformat = str_replace(" ...
<p>see the list of thing that empty consider as empty </p> <p>Returns FALSE if var has a non-empty and non-zero value. </p> <pre><code>The following things are considered to be empty: ■"" (an empty string) ■0 (0 as an integer) ■"0" (0 as a string) ■NULL ■FALSE ■array() (an empty array) ■var $var; (a v...
how to add the value of 3 arrays into one array <p>I have 3 arrays meat,veg and sauce, I was wondering how to add their values to a new array called food.</p> <p>thanks for any help</p>
<p>You can use the <a href="https://developer.mozilla.org/en/Core%5FJavaScript%5F1.5%5FReference/Global%5FObjects/Array/concat" rel="nofollow">concat function</a>.</p> <pre><code>var food = meat.concat(veg,sauce); </code></pre>
.htaccess file is not working on Apache Server <p>I have hosted my site on www.hostmoster.com, I have written .htaccess file for URL rewritting, it was working properly since last 1 year.. but today they have made some upgrade in their Apache Server.. and now my .htaccess file is not working properly. the contents of m...
<p>Maybe ...</p> <blockquote> <p>Note:</p> <p>If you want to call your .htaccess file something else, you can change the name of the file using the AccessFileName directive. For example, if you would rather call the file .config then you can put the following in your server configuration file:</p> ...
Any ideas why QHash and QMap return const T instead of const T&? <p>Unlike std::map and std::hash_map, corresponding versions in Qt do not bother to return a reference. Isn't it quite inefficient, if I build a hash for quite bulky class?</p> <p><strong>EDIT</strong></p> <p>especially since there is a separate method ...
<p>const subscript operators of <code>STL</code> containers can return a reference-to-const because they flat out deny calls to it with indexes that do not exist in the container. Behaviour in this case is undefined. Consequently, as a wise design choice, <code>std::map</code> doesn't even provide a const subscript ope...
Possible to call an entire page with ajax jquery and no refresh? <p>Is it possible to load an entire page head and all with ajax/jquery? Without a reload. I want to be able to slide a page in iphone like. I need to load the head as it contains javascript specific to each page.</p> <p>Thanks. </p>
<pre><code>$("#tag_id").load("page.html"); </code></pre> <p>This will load page.html into a DIV tag or any other tag with the ID tag_id. </p>
Socket? python -m SimpleHTTPServer <p><strong>Problem:</strong> to get the command working <a href="http://www.commandlinefu.com/commands/view/71/serve-current-directory-tree-at-httphostname8000" rel="nofollow">here.</a> My domain is <a href="http://cs.edu.com/user/share_dir" rel="nofollow">http://cs.edu.com/user/share...
<p>Your URL is incorrect. The port number should be specified after the domain name:</p> <p><a href="http://cs.edu.com:8000/">http://cs.edu.com:8000/</a></p> <p>Some other things you should keep in mind:</p> <ol> <li>If this is a shared host, port 8000 might already be in use by someone else</li> <li>The host might ...
Vbulletin Users integration with a .NET site <p>Does anyone know how to integrate the vbulletin forums users with an existing .net site that it has its own users and login, and to maintain the session between the two sites, so when a user logs in, he stays logged in when browsing the forum?</p>
<p>In the past I've implemented user integration between disparate systems sharing a cookie with some encrypted information that each system take care to decode and auto-login the user if they match.</p> <p>You have to put each system in the same domain to be able to share the cookie.</p>
Why differ(!=,<>) is faster than equal(=,==)? <p>I've seen comments on SO saying "<code>&lt;&gt;</code> is faster than <code>=</code>" or "<code>!=</code> faster than <code>==</code>" in an <code>if()</code> statement.</p> <p>I'd like to know why is that so. Could you show an example in asm?</p> <p>Thanks! :)</p> <p...
<p>I'd claim that this is flat out wrong except perhaps in very special circumstances. Compilers can refactor one into the other effortlessly (by just switching the <code>if</code> and <code>else</code> cases).</p>
ASP.NET MVC: Submit renders the same page <p>I'm trying to add simple login page to ASP.NET MVC app. I actually use Sharp Arch template project. So, I added 3 methods Login(), Logout(), and DoLogin() to UsersController, where Login() just does return View("Login");</p> <p>Now, when I navigate to /Users/Login, my aspx ...
<p>Must be a routing issue. Can you paste your routes, you could also try <a href="http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx" rel="nofollow">this</a> route debugger</p>
Is this a bug in GMP 4.1.2 or is it something I'm doing wrong? <p>To this bit of code I pass the string <code>"kellogs special k"</code> and I get <code>1</code> which means that the string is an integer. What on earth am I doing wrong? Or is it a GMP problem? </p> <pre><code>#define F(x) mpf_t (x); mpf_init( (x) ); ...
<p>You should check the return value of <code>mpf_set_str</code>. It returns <code>0</code> on success and <code>-1</code> on failure. In this case it would have returned a failure and <code>n1</code> is left untouched. <code>mpf_init</code> initialized it to zero, so testing whether zero is an integer with <code>mpf_i...
Jquery - multiple checkbox and multiple textbox <p>I have 4 check box when i select anyone of the check box need to display the respective check box and text box.</p> <p>input type="checkbox" id="acheck[]" value='name' </p> <p>input type="textbox" id="productfield" value=' '</p> <p>jquery Code:</p> <pre><code>$(doc...
<p>It's not clear from the question, but I guess you want something to appear when you click the checkbox? This should get you started.</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; #appear_div ...
How can I find path to given file? <p>I have a file, for example "something.exe" and I want to find path to this file<br> How can I do this in python?</p>
<p>Perhaps <code>os.path.abspath()</code> would do it:</p> <pre><code>import os print os.path.abspath("something.exe") </code></pre> <p>If your <code>something.exe</code> is not in the current directory, you can pass any relative path and <code>abspath()</code> will resolve it.</p>
PDF text position, page left margin <p>I want to write an application to validate a PDF file. The validation that is required is to verify that all the text and images in the PDF should start after 0.5" margin from left and 0.5" margin from the right. If any of the text is going outside this margin then application sho...
<p>In addition to R Ubben's answer : <code>reader.getPageSize(pageNumber)</code> is exactly the same as <code>reader.getBoxSize(pageNumber,"media")</code>.</p> <p>That's how it's implemented in iTextSharp. You can see it in <a href="http://www.java2s.com/Open-Source/CSharp/PDF/iTextSharp/iTextSharp/text/pdf/PdfReader....
How to get XML representation of a fluent mapping - is it possible? <p>As the title says, is it possible to get hands on the XML representation of a fluent nhibernate mapping? And if it is, can this be used directly with Hibernate for Java?</p>
<p>There's a <a href="http://wiki.fluentnhibernate.org/show/FluentConfiguration" rel="nofollow">section in the Fluent NHibernate wiki</a> covering the export of the xml mapping. Section at the bottom headed 'Exporting hbm.xml mappings'</p> <p>Have not tried it but don't see any reason why the mapping file shouldn't wo...
gwt maven plugin - unable to run archetype generated sample project in eclipse <p>I'm trying to setup a new gwt project in Eclipse (3.4 Ganymede) using maven with the codehause gwt-mave-plugin (v. 1.1).</p> <p>I have installed the Google Eclipse Plugin including the Google App Engine Java SDK 1.2.2, the Google Plugin ...
<p>The solution was embarrassingly simple. I had forgotten to mark the eclipse project as a GWT project (done by right-clicking on the project, choosing Google -> Web Toolkit Settings and checking a box). This caused the required classes to appear in the classpath as expected.</p>
Elevation without restarting an application? <p>Has anyone managed to get administration rights through the UAC without restarting the application or embedding a manifest file?</p> <p>I'd like to write to some files that only administrators can modify, without relying to another elevated application. Is it possible to...
<p>As stated in this other question, it is not possible, you have can eleveate COM object or another process, but not the current process.</p> <p><a href="http://stackoverflow.com/questions/17533/request-vista-uac-elevation-if-path-is-protected/17544#17544">http://stackoverflow.com/questions/17533/request-vista-uac-el...
Trouble with a LINQ 'filter' code throwing an error <p>I've got the following code in my Services project, which is trying to grab a list of posts based on the tag ... just like what we have here at SO (without making this a meta.stackoverflow.com question, with all due respect....)</p> <p>This <em>service code</em> c...
<p>Try with <a href="http://msdn.microsoft.com/en-us/library/bb534972.aspx" rel="nofollow"><code>Any</code></a>:</p> <pre><code>public static IQueryable&lt;Post&gt; WithTag(this IQueryable&lt;Post&gt; query, string tag) { // 'TagList' (property) is an IList&lt;string&gt; return from p in query w...
Adding a custom tab and page MOSS MySites that everyone can see <p>On MOSS mysites I want to be able to create a new tab that every mysite user can view, it should show a web part page.</p> <p>How can I do this?</p>
<p>Create a site collection as a parent to all the MySites. Or to put it the other way, make the MySites a subsite to a site collection that has the site that you want all the MySites to see.</p>
join query returning odd results <p>I use this query to display a list of songs and show what songs have been clicked as a favorite by a user.</p> <pre><code>$query = mysql_query( sprintf(" SELECT s.*, UNIX_TIMESTAMP(`date`) AS `date`, f.userid as favoritehash FROM songs s LEFT J...
<p>I had a similar issue I think if you change the And F.userid = %s to Where f.userid = %s it should fix it?.</p>
Tiled Background Image: Can I do that easily with UIImageView? <p>I have a fullscreen background image that is tiled, i.e. it has to be reproduced a few times horizontally and vertically in order to make a big one. Like in the browsers on ugly home pages ;)</p> <p>Is UIImageView my friend for this?</p>
<p>If I understand your question correctly you can use <code>colorWithPatternImage:</code> on <code>UIColor</code> then set the background color on a <code>UIView</code>.</p> <p>If you must use a <code>UIImageView</code> you can do the same but whatever image you place in the image view will draw in front of the tiled...
Setting the default page for ASP.NET (Visual Studio) server configuration <p>When I build and run my application I get a directory listing in the browser (<strong>also happens for sub folders</strong>), and I have to click on Index.aspx. It's making me crazy.</p> <p>Visual Studio 2008 ASP.NET Development Server 9.0.0...
<p>Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.</p>
Why isn't MVC using Error.aspx? <p>I'm trying to add some security to my ASP.NET 1.0 MVC app (VB), but I can't get it to work. At the top of my controller, I've got:</p> <pre><code>&lt;HandleError()&gt; _ Public Class HomeController </code></pre> <p>I'm overriding OnActionExecuting and throwing a SecurityException if...
<p>do you have customErrors=On in your web.config</p> <p><a href="http://stackoverflow.com/questions/619582/asp-net-mvc-handleerror-not-catching-exceptions">here</a></p>
Move Documents error with SharePoint 3 & FrontPage Extensions <p>Firstly, the simple question - has anyone had any experience programmatically renaming/moving a folder in a directory structure in SharePoint?</p> <p>The background:</p> <p>I have inherited some work, and am in the throws of fixing a few defects in it. ...
<p>I believe that the <code>move document</code> method only works within the same list and isn't for moving between locations. It should really be called <code>rename document</code>. This would explain why you are receiving the 'destination already exists' error.</p> <p>It appears that the company HubKey have develo...
how to convert a single row into Column in SQL Server 2005 <p>I have a table, and it is returning the data as -</p> <pre><code>Column1 Column2 Column3 Column4 Column5 Column6 ------------------------------------------------------------------- 6 Joy Mycity NZ 123456 myemail@gamil.co...
<p>I'd make the query continue to return the data as you currently are, as individual columns, and instead make the UI code format it as it needs it. Makes it more flexible so you can have x different displays of the same data, all using the one, same query as the data source.</p>
Generation of Email Validation Links <p>For a Web Application I'd like to generate an email validation link and send it to the user. Like on many public websites, the user should click it to validate his email address. Looks similar to this:</p> <p><a href="http://www.foo.bar/validation?code=421affe123j4h141k2l3bjkbf4...
<p>Some suggestions to get you started:</p> <ul> <li>Use GUIDs</li> <li>Use some sort of salted hash (MD5, SHA1, etc)</li> <li>Use a random string of characters (the more characters the less likely you'll have collisions)</li> <li>Store it in a database temporarily, and timestamp it so that it expires after a certain ...
C# DirectoryEntry Error? <p>I have a Web setup project. In the setup I have an input field where the user can insert a connectionstring. When I run the setup I get this error:</p> <p>Error 1001. Unknown error (0x8000x5000)</p> <p>To track where the error exists I create a file and in every method I write something to...
<pre><code>if (m_targetSite.StartsWith("/LM/")) m_targetSite = m_targetSite.Substring(4); </code></pre> <p>use above code before this :-</p> <pre><code>// Retrieve "Friendly Site Name" from IIS for TargetSite DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/" + m_targetSite); m_siteName = entry.Proper...
Sending mail reliably and doing it on a large scale <p>my web application supposed to send email reminders in some point it will send large scale but i do not what that the email servers that receive the email from my site will be marked and put to the black / spam list . how can it be avoided ?</p>
<ol> <li>Handle bounces religiously. You will want to use a mailserver that supports something like <a href="http://en.wikipedia.org/wiki/Variable%5Fenvelope%5Freturn%5Fpath">VERP</a> to make this easier. Don't continue to send reminders to addresses that bounce consistently.</li> <li>Allow people to unsubscribe.</li...
Why does flock occasionally take a long time on Windows / NTFS? <p>I use the file system to create a application wide persistent singleton (application does not use a database). Occasionally a page will take 1-2 minutes to load and I have narrowed the problem down to the use of flock in the function that gets an insta...
<p>Who closes the $fh in the if {} clause? Isn't it left open? in that case it might take a long time to unlock. Otherwise it will hang open for at least the duration of the script.</p>
sharepoint accessibility <p>How compatible / compliant is sharepoint with current accessibility rules. </p> <p>Also how compliant is it with the UK disability act?</p>
<p>I don't believe there's been a court case yet to establish exactly what level of accessibility is required to comply with the Act. However I worked on a UK site requiring accessibility last year and found that MOSS 2007 is certainly lacking in this area out of the box.</p> <p>We were aiming for <a href="http://www....
How to generate pseudo random number in FPGA? <p>How to generate pseudo random number in FPGA?</p>
<p>This has been covered (I'd go for an LFSR): <a href="http://stackoverflow.com/questions/757151/random-number-generation-on-spartan-3e">http://stackoverflow.com/questions/757151/random-number-generation-on-spartan-3e</a></p>
How do I use jQuery to select all children except a select element <p>I have a div (let's say the id is "container") with many elements in it, including a select element. I'd like to select all everything in the div except the select. Things I've tried: </p> <pre><code>$("#container *:not(select)") $("#container *:not...
<p>You can simply omit the wildcard as it is optional in this case, but keep the space:</p> <pre><code>$('#container :not(select)'); </code></pre> <p>Alternatively, use the .not() method to filter out the select after selecting all children:</p> <pre><code>$('#container').children().not('select'); </code></pre> <p>...
How can I split a comma delimited string into an array in PHP? <p>I need to split my string input into an array at the commas.</p> <p>How can I go about accomplishing this?</p> <h3>Input:</h3> <pre><code>9,admin@example.com,8 </code></pre>
<p>Try <a href="http://us2.php.net/manual/en/function.explode.php">explode</a>:</p> <pre><code>$myString = "9,admin@example.com,8"; $myArray = explode(',', $myString); print_r($myArray); </code></pre> <p>Output :</p> <pre><code>Array ( [0] =&gt; 9 [1] =&gt; admin@example.com [2] =&gt; 8 ) </code></pre>
Python documentation generator <p>I'm looking for a documentation generator for Python. I'm familiar with <a href="http://en.wikipedia.org/wiki/Javadoc"><code>javadoc</code></a>, and I tried <a href="http://en.wikipedia.org/wiki/Doxygen"><code>Doxygen</code></a>, but it seems quite unfit and counter-intuitive for Pyth...
<p>The classic tool for API doc is <a href="http://epydoc.sourceforge.net/">epydoc</a>. It handles javadoc, docstrings, etc... But I find API docs tools to be quite poor. I much prefer tool which focus around the documentation itself, and enables to inject additional documentation extracted from the code. <a href="http...
Print out rounded floating point number in MIPS <p>I am not sure how to print out a floating point single with one decimal place. </p> <p>I get '88.09999847' instead of '88.1'. Please advise</p> <p>For example: if I have register $f10 = '88.09999847' </p> <pre><code>mov.s $f12, $f10 li $v0, 2 syscall </code>...
<p>1) Multiply the number by 10 (since you're rounding to one decimal place.)<br> 2) Push the number to the stack (or appropriate register.)<br> 3) Round is a system call (on my machine, the code is <code>call roundf</code>)<br> 4) Divide the result by 10<br></p>
how to contact a single peer in a wcf p2p cloud? <p>I'm using WCF to let multiple peers connect to each other using the NetPeerTcpBinding.</p> <p>Is there a way to contact a single peer in this mesh?</p> <p>Preferably I would like to contact this peer transparently, so that the receiver simply continues to listen to ...
<p>WCF peer-to-peer does not have a built-in way to target an individual node in the mesh, but Microsoft has provided some recommendations on how to get it done.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms733062.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms733062.aspx</a></p>
Best tools / formats for documenting XML API? <p>We are developing XML over HTTP service and we need a way to document the XML interface. Our supported XMLs generally are subsets of some industry standard XML API, which unfortunately lacks any good documentation. It has XSDs though with some annotations, so we use th...
<p>How do you currently generate the documentation from the XSDs? Are the results not good because of the tool you're using to generate it, or because the annotations themselves aren't great?</p> <p>I'm not being all that helpful, but I can only suggest looking <a href="http://stackoverflow.com/questions/237938/how-to...
open a new html page through php <p>I want my php to open a new html page. </p> <p>I have a html page, where a member can login by typing her username and password and then click on button. </p> <p>if the username password is correct, i want my php to open a different html page in the same window. </p> <p>how can i ...
<p>Try using the header function.</p> <pre><code>header("Location: $url"); </code></pre>
Silverlight: Programmatically binding control properties <p><em>The big picture:</em> I have a custom child control that generates various textboxes, datepickers, combo etc based on properties that I set. This control is embedded in various places within my SL application. </p> <p>I generally use the MVVM pattern, and...
<p>Lets assume you have created a simple TextBox dynamically and you want to add a binding on the Text property:-</p> <pre><code> Binding binding = new Binding("SomeProperty"); binding.Mode = BindingMode.TwoWay; txtBox.SetBinding(TextBox.TextProperty, binding); </code></pre> <p>Where txtBox is the dynamically crea...
Programming customized tab completion for zsh <p>Sorry if my google fu is too weak, but: I simply want to adjust zsh so that I can tab complete</p> <pre><code>someappname -s </code></pre> <p>using the contents (filenames) of ~/somedir</p> <p>For example:</p> <pre><code>someapp -s f&lt;tab&gt; </code></pre> <p>shou...
<p>A simpler approach:</p> <pre><code>compdef "_files -W ~/somedir -/" someappname </code></pre>
How can NHibernate use the database-default value when saving a new entity? <p>Consider the following simple C# class:</p> <pre><code>public class Entity { public Entity() { } public virtual int Id { get; private set; } public virtual DateTime DateCreated { get; private set; } } </code></pre> <p>Mapped wi...
<p>You can specify that the property is generated by the database:</p> <p><a href="https://ayende.com/blog/3936/nhibernate-mapping-property" rel="nofollow">NHibernate Mapping - property</a></p> <p>So for your case you would want to specify:</p> <pre><code>generated="insert" </code></pre> <p>This way NHibernate know...
Multi-user Web Application Database Design <p>I'm working on a web application that will be a hosted, multi-user solution when it is finished. I'm trying to figure out the best way to handle the database design for my app. Specifically, I need to figure out how to handle multiple, separate accounts.</p> <p>The way I...
<p>I've almost always gone with option #1. If you design it right you may only need your 'user' column in a few key tables that are your entry point and then everything else can be joined off of those key tables. </p>
Is it possible to create a faster computer from many computers? <p>How can I use several computers to create a faster environment? I have about 12 computers with 4GB each and 2GHz each. I need to run some time consuming data transform and would like to use the combined power of these machines. They are all running Win2...
<p>Yes, it's called <a href="http://www.gridforum.org/" rel="nofollow">Grid Computing</a> or more recently, Cloud Computing.</p> <p>There are many programming toolkits that are available to distribute your operations across a network. Everything from doing builds to database operations to complex mathematics libraries...
How to find the width of a String (in pixels) in WIN32 <p>Can you measure the width of a string more exactly in WIN32 than using the GetTextMetrics function and using tmAveCharWidth*strSize?</p>
<p>Try using <a href="http://msdn.microsoft.com/en-us/library/dd144938(VS.85).aspx">GetTextExtentPoint32</a>. That uses the current font for the given device context to measure the width and height of the rendered string in logical units. For the default mapping mode, MM_TEXT, 1 logical unit is 1 pixel.</p> <p>Howev...
What was the design decision for variadic functions needing an array? <p>I am curious and hopefully someone can shed somelight on this - but why do the C# functions that take 'params' have to be an array?</p> <p>I get that the objects in the parameters list are entered into an array but what if someone wants to create...
<p>The functionality is already there, no need to resort to boxing:</p> <pre><code>private int SumAll(params int[][] args) { int result = 0; for (int x = 0; x &lt; args.Length; x++) { for (int y = 0; y &lt; args[x].Length; y++) { result += args[x][y]; } } return ...
Recusive transformations using xslt, xpath:document() and mediawiki <p>I want to use the <a href="http://en.wikipedia.org/w/api.php" rel="nofollow">wikipedia API</a> to find the French pages including the ''<strong>Template:Infobox Scientifique</strong>'' missing in the english version. So, my idea was to process the ...
<p>You should try:</p> <pre><code>&lt;xsl:value-of select="count(document($uri1)/api/query/pages/page/langlinks/ll)"/&gt; </code></pre> <p>On a different note - what is </p> <pre><code>translate(@title,&amp;apos; &amp;apos;,&amp;apos;_&amp;apos;) </code></pre> <p>supposed to mean? What's wrong with:</p> <pre><code...
How to get network adapter stats in linux/Mac OSX? <p>I'm looking for a way to get hold of network stats in C on Linux and MacOSX. Specifically, I need to monitor the number of bytes uploaded and downloaded from each network adapter on the system - I don't need to do packet inspection, or differentiate between protocol...
<p>The Darwin netstat source code uses sysctl. Here's some code that prints the number of bytes in and out on OSX:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #include &lt;sys/sysctl.h&gt; #include &lt;netinet/in.h&gt; #include &lt;net/if.h&gt; #include &lt;net/route.h&gt; int main (int argc, const char * ...
How can I auto increment the C# assembly version via our CI platform (Hudson)? <p>Myself and my group are horrendous at incrementing assembly version numbers and we frequently ship assemblies with 1.0.0.0 versions. Obviously, this causes a lot of headaches.</p> <p>We're getting a lot better with our practices via our...
<p>Here's what I did, for stamping the AssemblyFileVersion attribute.</p> <p>Removed the AssemblyFileVersion from AssemblyInfo.cs</p> <p>Add a new, empty, file called AssemblyFileInfo.cs to the project.</p> <p>Install the <a href="https://github.com/loresoft/msbuildtasks" rel="nofollow">MSBuild community tasks</a> t...
Is it possible to go into ipython from code? <p>For my debugging needs, <code>pdb</code> is pretty good. However, it would be <em>much</em> cooler (and helpful) if I could go into <code>ipython</code>. Is this thing possible?</p>
<p>There is an <code>ipdb</code> project which embeds iPython into the standard pdb, so you can just do:</p> <pre><code>import ipdb; ipdb.set_trace() </code></pre> <p>It's installable via the usual <code>easy_install ipdb</code>.</p> <p><code>ipdb</code> is pretty short, so instead of easy_installing you can also cr...
Need ways to speed up PHP methods <p>I ended up creating my own HTML class, mainly to keep all our output consistent. The code is below.</p> <pre><code>&lt;?php /** * A class to generate html tags * @author Glen Solsberry */ class HTML { private $isOpen; /** * holds all information about tags *...
<p>You should be using real <a href="http://us2.php.net/book.dom" rel="nofollow">dom methods</a> to parse HTML. They are written in C and will be orders of magnitude faster than anything you can code up in naively.</p>
asp.net Membership : confirmation email blank <p>I'm using stock Asp.net membership with built in Login controls, etc. Problem is that the confirmation email that is send by registering has a body that is blank. It should have a link in it that the user clicks on to confirm their email and register. The email does send...
<p>Are you assigning the content of the message to the message body?</p> <p>message.Body = "Dear Subscriber, ...";</p>
How to find how many people are online in a website <p>I have to show how many people are online in that site. The site has developed by using ASP.NET 2.0. Currently I am using the Session start (increase by 1) and Session End Event (decrease by 1) in Global.asax. But the Session_End Event not calling properly most of...
<p>You're not going to get much better then incrementing in <code>Session_Start</code> and decrementing in <code>Session_End</code> unless you use some other means like a database.</p> <p>When you are authenticating your requests you could update a timestamp in the database to show that the user has been active, and a...
How do I data mine various news sources? <p>I'm working on a free web application that will analyze top news stories throughout the day and provide stats. Most news websites offer RSS feeds, which works fine for knowing which stories to retrieve. However, the problems arise when attempting to get the full news story fr...
<p>I know this isn't a great answer, but I forget the name of the startup here in Colorado that can take unstructured/semistructured data and parse it into a structured format. I think if you search the coloradostartups blog for 'data' you might find it.</p>
Dojo Drag and drop: how to format a dropped item? <p>I'm using Dojo trying to build an application with dojo's dnd. I've looked around for an answer to this problem but I'm just not sure how to accomplish this. I have a Source object in which there are a bunch of products formatted with html/css in a certain way. When ...
<p>You do this via passing a <code>creator</code> function ref to your Source object.</p> <p>Assuming you have dojo 1.3 and can use <code>dojo.create.</code></p> <p>In your JS:</p> <pre><code>function myCreator( item, hint ) { var myDiv = dojo.create( 'div', { innerHTML: item.name }); if (hint == 'avatar') { ...
IIS hosting issue <p>whenever I hosted my application in IIS I used to get error. I have followed the following steps:</p> <ol> <li>InetMgr</li> <li>default web site(right click)</li> <li>add virtual directory</li> <li>physical path</li> <li>selected permissions(read)</li> <li>browse</li> </ol> <p>there I used to get...
<p>You need to open the web.config file for your application and look for the element <a href="http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx" rel="nofollow"><code>&lt;customerrors&gt;</code></a> under <code>&lt;system.web&gt;</code>. If it's not there add it in, and if it is there make sure <code>mode="Off"</co...