input
stringlengths
51
42.3k
output
stringlengths
18
55k
Keyboard shortcut for "Connect to Server" in Management Studio <p>Is there a keyboard shortcut for the "Connect to Server" modal window in Microsoft SQL Server Server Management Studio? </p> <p>The modal window that is displayed when you first opened up SQL Server Management Studio from the Start Menu or shortcut. </...
<p>F8 (Object Explorer), Alt + F (File Menu), E (Connect Object Explorer)</p>
How do you deal with the "special" characters that MS Word adds? <p>I'm wondering how you clean the special characters that MS Word as, such as m- and n-dashes and curly quotes?</p> <p>I often find myself copying content from clients from Word and pasting into a static HTML page, but the content ends up with weird cha...
<p><strong>With regards to clients posting copy/pasted text from Word in textareas:</strong></p> <p>The most reliable way to ensure that the client sends you text in any particular encoding (thus hopefully doing any conversion from CP-1252 [or whatever Word uses] for you), is to add the <code>accept-charset="..."</cod...
Regular Expression to find the start end of a list in HTML <p>I have a TextBox in a webpage that i'm using javascript to parse and modify to format for HTML. 90% of it works really well, the last main thing i'm trying to be able to support is copying and pasting from a word document. I got it mostly completely, i ju...
<blockquote> <p>Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. -- Jamie Zawinski</p> </blockquote> <ol> <li><p>Regular expressions and HTML are a particularly bad fit.</p></li> <li><p>This is 2009, use closing tags in your HTML. (That alone wi...
How to set up Python in a web server? <p>Not exactly about programming, but I need help with this.</p> <p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how t...
<p>Django is not a web server, but a web application framework.</p> <p>If you want a bare-bones Python webserver capable of some dynamic and some static content, have a look at <a href="http://www.cherrypy.org/">CherryPy</a>.</p>
SQL: delete all the data from all available tables <p>I am using oracle DB to maintain more than 30 tables, how can I delete all the data from all the tables? I only want to delete the data but not drop the tables.</p>
<p>There is no command 'ALTER TABLE XXX DISABLE ALL CONSTRAINTS'</p> <p>I propose this;</p> <pre><code>BEGIN FOR c IN (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type = 'R') LOOP EXECUTE IMMEDIATE ('alter table ' || c.table_name || ' disable constraint ' || c.constraint_name); ...
MySQL: How to get results of stored procedure inside a stored function? <p>I have a stored procedure that makes very complex joins and returns 1 row of data (LIMIT 1 is used). In my application I then use that data to make some calculations. This way I try to keep business logic out of stored procedures. But now I need...
<p>Instead of a stored procedure, make it a view. That should solve your problems.</p> <p>EDIT:</p> <p>To be precise, what you want to do is create a view which contains all of the columns which you use in your calculations. A view is similar to a stored procedure in that it allows the underlying DB engine to optim...
How to track views on an item a la YouTube? <p>I would like to be able to track views of an item in a way that I can see what items were the most viewed yesterday, last week or any given period. How can I do that using either PHP or Rails? Is there a plugin for this in Rails, or is there a simple way of doing this usin...
<p>As Rémy says, you can make this simple and have a database table tracking individual page views, although this can incur a bit of write load on views, which might be undesirable.</p> <p>A compromise could be to write a row for each view to an intermediate, in-memory table, and periodically (perhaps via a cron job,...
Reinitialize a view controller - iPhone <p>I have a multi view application with individual UIViewControllers and xibs. I have one view that is the game view and every time I call it I want it to re-initialize, by that I mean restart at it's initial condition and not in the state I last left it in. </p> <p>Here is th...
<p>I assume your view is displaying some data stored in model (game state). So wouldn't you want to reset the game state and let the view display it? The view is managed (loaded/released/reloaded) by the system when it needs to be displayed or released when memory on phone is low. So if you handle your game state separ...
How Do I Script a Database To a Text File So That It Can Be Created Again By Anyone? <p>I have a database that I have created using SQL Server Developer 2008.</p> <p>I want to script it to a file so that it can be recreated by anyone at any time.</p> <p>Any Ideas?</p>
<p>You can follow the steps at Pinal's site. Be careful to select all the options you want:</p> <p><a href="http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/" rel...
How to serialize classes that were not designed to be serialized? <p>I need to save some classes and data structures to a file. My first reflex was to use XML or Binary serialization but this is turning into a nightmare. I have a set of classes that were not meant to be serialize (private setters, no parameterless cons...
<p>Use the JavaScriptSerializer. It's in the System.Web.Script.Serialization namespace and is implemented in the 3.5 framework in the System.Web.Extensions.dll assembly.</p> <p>With this class, you can serialize any POCO whether it's marked as [Serializable] or not. Your program does not have to be a web application t...
Teaching programming and formal methods <p>Here's a sort of odd question. I'm in the process of writing a book on learning to program using formal methods, and I'm going to target it toward people with some programming experience. The idea is to teach them to be high-quality programmers.</p> <p>The basic notation is...
<p>Charlie,</p> <p>I have always associated Dijkstra's masterpiece with a model of programming in which center stage is occupied by loops and arrays. If you're sticking close to Dijkstra (e.g., computing weakest preconditions) I think you'll find functional languages are not a great fit. Of the popular languages tha...
WPF Font: Why are some characters missing? <p>I'm writing a WPF app and the font that I am using <em>only</em> has problems running in WPF - it works fine using it in anything else (notepad, wordpad, etc.). The problem with WPF is that it falls back to another font <em>sometimes</em>. By "sometimes" I mean that only ...
<p>From <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.fontfamily.aspx">MSDN</a>:</p> <blockquote> <p><strong>Font Fallback</strong></p> <p>Font fallback refers to the automatic substitution of a font other than the font that is selected by the client application. There are two prim...
PHP Form code mangled <p>I am generating a simple form with php. The following code has been reduced to showcase the problem.</p> <pre><code>&lt;?php $blah = "&lt;h1&gt;Well&lt;/h1&gt;"; $test = "&lt;h2&gt;Done&lt;/h2&gt;"; echo '&lt;script type="text/javascript" src="fetchlayers.js"&gt;&lt;/script&gt;'; $formcode = "...
<p>It's because of your quotes in the onclick. Use single quotes instead: </p> <pre><code>"onclick=\"setTimeout(function() { sendInfo('$blah', '$test'); }, 1250);\" " </code></pre> <p>The way it is now, your onclick attribute actually reads like this:</p> <pre><code>onclick="setTimeout(function() { sendInfo(" </code...
Mistake or confusion in Apple SDK documentation on NSURLConnection? <p>I have recently been learning the Apple SDK (for iPhone, etc) and came across something I can't understand. In the docs for "Using NSURLConnection" from <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/Using...
<p>There is no race condition. The download is started in the background on a separate thread, but the messages sent to the delegate to inform you of the download progress are always called on the thread that started the download.</p> <p>You can certainly allocate the NSData before the connection is created, if that's...
Stripping HTML tags in Java <p>Is there an existing Java library which provides a method to strip all HTML tags from a String? I'm looking for something equivalent to the <code>strip_tags</code> function in PHP. </p> <p>I know that I can use a regex as described in <a href="http://stackoverflow.com/questions/44078/st...
<p>Use <a href="http://jsoup.org/" rel="nofollow">JSoup</a>, it's well documented, available on Maven and after a day of spending time with several libraries, for me, it is the best one i can imagine.. My own opinion is, that a job like that, parsing html into plain-text, should be possible in one line of code -> other...
Even if an img tag appoints id and class, it is ineffective. . is it true? <p>Even if I appointed id and a class to an img tag of the html by a rumor and appointed it in css, it came when it was ineffective.</p> <pre><code>img id="hogehoge_id" class="fugafuga_class" src="example.gif" / #hogehoge_id{ float:left; } .f...
<p>if you ask if you can apply css properties to ID and classes of the same tag at the same time, the answer is yes. No problem :-)</p>
Modern C++ Game Programming Examples <p>To what extent are modern C++ features like:</p> <ol> <li>polymorphism, </li> <li>STL, </li> <li>exception safety/handling, </li> <li>templates with policy-based class design, </li> <li>smart pointers</li> <li>new/delete, placement new/delete</li> </ol> <p>used in game studios?...
<p>I've worked in 2 game companies, seen a number of codebases, and observed a number of debates on matters such as these among game developers, so I might be able to offer some observations. The short answer for each point is that it varies highly from studio to studio or even from team to team within the same studio...
How to scroll the window using JQuery $.scrollTo() function <p>I'm trying to scroll down 100px every time the user gets near the top of the document.</p> <p>I have the function executing when the user gets close to the top of the document, but the .scrollTo function isn't working.</p> <p>I put an alert after and befo...
<pre><code>$('html, body').animate({scrollTop: $("#page").offset().top}, 2000); </code></pre>
Beginner Actionscript reference <p>My eight years old son asks to "teach him programming in Flash". Can somebody refer on good Actionscript learning resource online? The Flash version we have is "Flash MX".</p> <p>Thank you in advance.</p>
<p>see if this fits your bill:</p> <p><a href="http://www.scribd.com/doc/9409007/ADOBE-FLASH-ACTIONSCRIPT-BOOK" rel="nofollow">http://www.scribd.com/doc/9409007/ADOBE-FLASH-ACTIONSCRIPT-BOOK</a></p>
Programmatically lock and unlock iPhone screen <p>How do I programmatically lock and unlock the main screen (i.e. the device itself) of an iPhone?</p>
<p>It's not possible. However, you can "prevent" your phone from locking when your app is running. <code>[UIApplication sharedApplication].idleTimerDisabled = YES</code> should do it.</p>
Why do I get a "Platform Not Supported Exception" while adding new Response Header? <p>Why do I get a "Platform Not Supported Exception" while adding a new Response Header? I am debugging a website using Visual Studio web server.</p> <pre><code>Response.Headers["X-XRDS-Location"] = url </code></pre> <p>Exception Mess...
<p>Response.Headers.Add() works only in IIS7 integrated pipeline mode. Use Response.AddHeader() instead. This method will work on all platforms.</p>
Spring 2.5 in EJB container <p>I would like to use the spring framework within an EJB3 project. In detail I would like to use the JDBC template class which should be instantinated from a given data source. When I put the spring.jar to my Jboss lib directoy everything is working fine. But when I put the JAR inside my EA...
<p>This smells like an EAR config problem not an Spring problem. Are you sure that the jar is in the EJB's classpath? You might want to check the MANIFEST.MF file of the EJB's jar to verify this.</p>
Linux space check <p>Collectively check space of files in linux...</p> <p>I have nearly more than 100 of files ...to check the size collectively...</p> <p><hr></p> <p><em>Edit</em>: What I need is: I have a folder containing 1000 files and I need something so that I can calculate the total sum [<em>of what?</em>] o...
<p>This command will give you the size in kilobytes of all the individual files/directories in the current directory:</p> <pre><code>du -ks * </code></pre> <p>This command will give you the combined total size of the current directory:</p> <pre><code>du -ks . </code></pre> <p>If you need to recurse and get more det...
Handy F# snippets <p>There are already <a href="http://stackoverflow.com/questions/35940/elegant-snippets-of-f">two</a> <a href="http://stackoverflow.com/questions/832569/list-of-functional-code-snippets-for-procedural-programmers">questions</a> about F#/functional snippets.</p> <p>However what I'm looking for here ar...
<p><strong>Perl style regex matching</strong></p> <pre><code>let (=~) input pattern = System.Text.RegularExpressions.Regex.IsMatch(input, pattern) </code></pre> <p>It lets you match text using <code>let test = "monkey" =~ "monk.+"</code> notation.</p>
iPhone No Saved Photo Album created on iPhone <p>I am using iPhone 2.0 SDK. I used the API UIImageWriteToSavedPhotosAlbum to save an image. A Saved Photos album gets created on the iPhone Simulator when I save an image but tested on the device the image gets added in the Camera Roll album. While debugging, no errors oc...
<p>It's just different naming conventions between simulator (and I image iPod touch) and iPhone. Since the iPhone has a camera, the Saved Album is called "Camera Roll". Since the simulator doesn't have a camera, the Saved Album is called "Saved Photos" (or whatever). </p> <p>Using UIImageWriteToSavedPhotosAlbum() shou...
Div not fading with effect in Mozilla <p>I am using the following to fade a div with slideffect.</p> <pre><code>$('div.clsBlue').eq(2).fadeOut(1000, function() { }); </code></pre> <p>This fades with animation in IE7 perfectly but not in mozilla 3. Any suggestions?</p>
<p>I got the same problem: IE 6 worked fine, but FFox 3 didn't.</p> <p>I solved this problem setting the container DIV</p> <blockquote> <p>height: auto</p> </blockquote> <p>Regards.</p>
Calculate time between 2 TDateTime, with a twist <p>I need to find out how to get the time between 2 times, but only if it is within work hours(Stored in a database)</p> <p>This is what I got for now, but it is totally wrong. the total won't bee correct.</p> <pre><code>int __fastcall Organisasjon::CalculateResponseti...
<p>What do you want to see in <code>total</code>?</p> <p>Try this example:</p> <pre><code>TDateTime MailTimeEnd = TDateTime::CurrentTime();; MailTimeEnd += 1.0 / 24; TDateTime MailTimeStart = TDateTime::CurrentTime(); TDateTime dt = TDateTime((MailTimeEnd - MailTimeStart)); unsigned short milli; unsigned short sec; u...
How to change data display in a TextBox from a DropDownList selection? <p>Hi guys as the subject i posted. I really need to know, how to get result from DDL that can automatically changes the display in the TextBox. Our each item has got more than one size and sometimes the price will be different when you click on a d...
<p>can you specify just alittle more, you want to take the dropdown value and put it in a textbox? is this going to be in a server control(ie gridview, datalist, etc....)</p>
how to change identity increment of column <p>Following statement can reset seed</p> <p>DBCC CHECKIDENT ('TableName', RESEED, 1)</p> <p>but this time I have to change its increment .</p>
<p>Or you can use Sql Server Management Studio:</p> <p><img src="http://i546.photobucket.com/albums/hh430/aleris149/identity%5Fincrement.png" alt="Identity Increment in Sql Server Management Studio" /></p> <p>Using this approach will most likely recreate the table.</p>
Display a .swf file as ASP .Net Page header <p>I have an ASP. Net 2.0 website with C# 2005 as the programming language. I am using CSS for the layout. Currently I am using a plain/static .Gif image as my header. I would like to enhance the look by using some animation in the header. I used some flash utilities to desig...
<p>I haven't done this, but I found some sample code on <a href="http://www.codeproject.com/KB/aspnet/playSwf.aspx" rel="nofollow">CodeProject</a>.</p> <pre><code>&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19...
how to Pass multiple parameters via Command Parameter in WPF? <p>how to Pass multiple parameters via Command Parameter in WPF?? Do we have to create an object and pass if so can someone help me with an example</p>
<p>Maybe you can use MultiBinding with a converter that will create an object for you...</p>
Developement platform for j2EE/Flex under linux? <p>At work we run vista for all the laptop. I dont like it very much. XP is not an option because of licence ( and money ) issues. The boss and the team is ok to whatever, since the work is done.</p> <p>So i wish to switch my developement plateform to a linux ( i dont ...
<p>Try the <a href="http://axdt.org/" rel="nofollow">AXDT</a> plugin for a gratis alternative to FlexBuilder.</p>
Gridview row editing - dynamic binding to a DropDownList <p>I'm trying to get an ASP.NET 3.5 GridView to show a selected value as string when being displayed, and to show a DropDownList to allow me to pick a value from a given list of options when being edited. Seems simple enough?</p> <p>My gridview looks like this (...
<p>Quite easy... You're doing it wrong, because by that event the control is not there:</p> <pre><code>protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow &amp;&amp; (e.Row.RowState &amp; DataControlRowState.Edit) == DataControlRowState.E...
Php PDO::bindParam data types.. how does it work? <p>I'm wondering what the declaration of the data type in the bind parameter (or value) is used for...</p> <p>I mean, I thought that if I define a param like int, PDO::PARAM_INT, the param must be converted to an int, something like</p> <pre><code>$delete-&gt;bindPara...
<p>In other DB abstraction frameworks in other languages it can be used for things like making sure you're doing the proper escaping for in-lining values (for drivers that don't support proper bound parameters) and improving network efficiency by making sure numbers are binary packed appropriately (given protocol suppo...
Problem with my Session variables in asp.net 2.0 <p>I keep a Session variable when the user is logged in. So that when the user click on btnLogout it must clear all my sessions and Log the User out for GOOD!!!</p> <p>It does clear my sessions but if i click the BACK button in IE right after i logged out then i am stil...
<p>You could put this in the Page_Init of your Master:</p> <pre><code>Response.Cache.SetNoServerCaching(); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00)); </code></pre> <p>This is, e.g., what most bank websit...
Text is not getting Highlighted in Combobox when selectedindex changed through code <p>I am using combobox which contains three value-NSW,TIC,VIA. in page load i m setting selectedindex = 1 for the combobx , the value shown as TIC which is correct but it is not getting highlighted. I can see that when user selects diff...
<p>Your combobox does not receive the focus after setting the selected index. Set the focus using the Focus() method.</p>
In .Net, is it possible to use Response.Write in a class that does not inherit from System.Web.UI.Page <p>Just been asked this question as a true / false in a telephone job interview and was a little stumped. Any ideas?</p>
<p>You can get hold of the Response object from the HttpContext static object:</p> <pre><code>System.Web.HttpContext.Current.Response.Write("Some Text") </code></pre> <p>If current returns null then the code is not being run as part of a page request. If you get asked the question again then that's the answer but a f...
Saving Word File as a Picture Programmatically <p>I'd like to save the first page of a Word document as a picture. What methods are there for doing this with C#?</p>
<p>You can print the word document to an XPS document, open it in a WPF (.Net 3.5) app and convert the first internal FixedPage object to a bitmap using the document and imaging functionality of the WPF framework. The XPS document printer is available if you have the .Net 3 framework installed (maybe 3.5, I'm not sure)...
Custom Types in/with DLLImport'ed / P/Invoke'd win32 dll? <p>Good afternoon,</p> <p>i am currently wrestling with an old .dll which functionality I have to re-use in a .Net application &amp; I came so far to import the basic/easy functions/methods that return bool etc, but some do in fact also expect (or return) an ty...
<p>By "type", I assume you mean struct, otherwise you'll have to find out how to map a struct in memory to your type.</p> <p>You'll have to create the same struct in your .NET application, and mark it with the <code>StructLayout</code> attribute (<code>LayoutKind.Sequential</code> is the most common). Then you should ...
sql server 2005 question <p>I need to work with sql server 2005, I need server and developer tools.</p> <p>my database contain 2 million records, 20 tables and 30 users.</p> <p>what version of sql server 2005 I need ?</p>
<p>First of all, you need to learn to write better subject lines. I've noticed this is a habit with you. It's why I downvoted.</p> <p>SQL Server 2005 Express would work for you. SQL Server 2005 Developer Edition would be good for use by your developers, but cannot be used in production.</p> <p>Why not use SQL Server ...
JS object to JSON string? <p>How can I convert a JavaScript object to a JSON string in a JavaScript function? I need the JSON string to pass to a JSP page.</p>
<p>There are two sample methods in Crockford's library (as raised by @Anonymous):</p> <p>JSON string to object: </p> <pre><code>var obj = JSON.parse('{ "property":"value" }'); alert (obj.property); // value </code></pre> <p>Object to JSON string: </p> <pre><code>var str = JSON.stringify({ "property":"value" }) ale...
MVC - Getting membership provider to work <p>I have MVC 1.0 app developing with VS2008. Brave!</p> <p>I have developer edition of SQL 2005 installed.</p> <p>I ran the aspnet_regsql.exe to add membership schema to my DB.</p> <p>When i try to register a user I get this error:</p> <p>The user instance login flag is no...
<p>This a misconfiguration. It looks like the connection string being used is trying to create or use a database that doesn't exist. Make sure your connection string is pointing to the right database. By default the application services (Membership, Profile, Roles) use the ApplicationServices connection string in yo...
Java String.replaceAll regex <p>What is the regex to strip the MY-CORP\ part of na inputed string like MY-CORP\My.Name with the java <code>String.replaceAll</code> method so I can get only the My.Name part?</p> <p>I tried</p> <pre><code>public static String stripDomain(String userWithDomain) { return userWithDoma...
<p>Your problem is that the backslash has special meaning both in Java strings and in regexes. So you need four slashes in the Java source code, passing two to the regex parser to get one literal one in the regex:</p> <pre><code>return userWithDomain.replaceAll("^.*\\\\", ""); </code></pre>
Get UserControl or VisualTree in DataValidation of TextBlock <p>I have a validator set on the text property of a textblock. For a correct validation I would need the parent usercontrol of the textblock, but the only things I have in the validator are the value object (a string) and the culture (doesn't help either).</p...
<p>You could try validating using two validation properties built into the <code>Binding</code> class: <code>ValidatesOnExceptions</code> and <code>ValidatesOnDataErrors</code>.</p> <p>With <code>ValidatesOnExceptions</code>, the binding is invalid if an exception is thrown during the conversion process. In this case,...
Visual Studio Post Build Event - Copy to Relative Directory Location <p>On a successful build, I wish to copy the contents of the output directory to a different location under the same <strong>"base"</strong> folder. This parent folder is a relative part and can vary based on Source Control settings.</p> <p>I have li...
<p>Here is what you want to put in the project's Post-build event command line:</p> <pre><code>copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)lib\$(ProjectName).dll" </code></pre> <p>EDIT: Or if your target name is different than the Project Name.</p> <pre><code>copy /Y "$(TargetDir)$(TargetName).dll" "$(So...
Finding out which locks that are acquired in a query on SQL Server? <p>I have a SQL statement from my application. I'd like to know which locks that statement acquires; how can I do that with SQL server? The statement has been involved in a deadlock, which I'm trying to analyze; I cannot reproduce the deadlock. I'm run...
<p>You can run the statement in a transaction, but not commit the transaction. Since the locks will be held until the transaction is committed, this gives you time to inspect the locks. (Not indefinitely, but like 5 minutes by default.)</p> <p>Like:</p> <pre><code>BEGIN TRANSACTION select * from table </code></pre>...
How do I make a button caption bold in MFC? <p>I have a button on an MFC dialog. How can I make the text bold?</p>
<pre><code>class CYourDialog : CDialog { public: virtual BOOL OnInitDialog(); // override private: CButton m_button; CFont m_font; }; BOOL CYourDialog::OnInitDialog() { __super::OnInitDialog(); CFont* font = m_button.GetFont(); LOGFONT logFont; font-&gt;GetLogFont(&amp;logFont); ...
How do you persist a tomcat session? <p>i have a JSP web page that refreshes every 1 minute. on each refresh, the session object is checked for validity. When the tomcat web server restarts, the session goes away...and when the page refreshes, it says "invalid". anyone has a solution to my problem?</p>
<p>Have a look at the configuration in your Tomcat config file. The documentation is at <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html" rel="nofollow">http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html</a> Look for the section on persistent managers ...</p>
Custom dropdown box using javascript and css <p>Is it possible to create a custom dropdown box using javascriit and css.</p> <p>for which i need to place a background-image for dropdown box using javascript</p> <p>If yes or no ? if yes . give any suggestion ? </p> <p>without using JQuery</p>
<p>You can check out <a href="http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/" rel="nofollow">jQTransform</a></p>
Possible problems switching from "ncalrpc" to "ncacn_np" <p>I have an application that uses RPC for interprocess communications. Turns out that synchronous RPC pipes used with "ncalrpc" protocol sequence are not alowed on Vista. I want to switch to "ncacn_np" and use RpcServerRegisterEpEx() with RPC_IF_ALLOW_LOCAL_ONLY...
<p>You've seen this information about flag usage :<br></p> <p><a href="http://msdn.microsoft.com/en-us/library/aa373954%28VS.85%29.aspx" rel="nofollow">...When this interface flag is registered, the RPC runtime rejects calls made by remote clients. All local calls using ncadg_* and ncacn_* protocol sequences are also ...
How to do fuzzy string search without a heavy database? <p>I have a mapping of catalog numbers to product names:</p> <pre><code>35 cozy comforter 35 warm blanket 67 pillow </code></pre> <p>and <strong>need a search that would find misspelled, mixed names like "warm cmfrter"</strong>.</p> <p>We have code using edi...
<p>Apparently the only way to make fuzzy comparisons fast is to do less of them ;)</p> <p>Instead of writing another n-gram search or improving the one in Whoosh we now keep a word index, retrieve all entries that have at least one (correctly spelled) word in common with the query, and use difflib to rank those. Works...
Why would I use Perl anonymous subroutines instead of a named one? <p>I'm just curious why one would choose to use an anonymous subroutine, versus a named one, in Perl. Thanks.</p>
<ul> <li>You can store anonymous subs in arrays, hashes and scalars.</li> <li>You can build them at runtime</li> <li>You can pass them as arguments to other functions.</li> <li>You get to keep variables in the surrounding scope.</li> </ul> <p>The last point is probably the most important, because it's often the most u...
How to get the name of a subreport from a Crystal Report in C#? <p>How do i get subreport name in C# ?<br /> i have one main report and one subreport.In my C# code i need to get the subreportName. </p> <pre><code>rptDynamicReport rpt = new rptDynamicReport(); // CrystalReport //i need somethig like this string repor...
<pre><code>using CrystalDecisions.CrystalReports.Engine; //snip //Where report is the parent rpt of type ReportDocument (or a subclass of ReportDocument) foreach(ReportDocument subreport in rpt.Subreports) { if(subreport.Name = "Multiple") { //Not the most elegant solution, but should work Subr...
analysis of filesystem <p>So, trying to find some utility(ies) to give us statistical information on this thing.</p> <p>For example, what files were created in the last 30, 60, 90 days, 6 months, etc. What are their sizes?</p> <p>Something with sortable reports would be nice.</p> <p>I know we can do some things wit...
<p>You might look into Nagios. It more of a complete system monitoring tool than a file system auditing tool. But it has lots of plug-ins available for it.</p>
Application can't find app.config file when run at Windows Startup <p>Recently, I added a setup project to my application. In the setup project, I added a registry value that would start my application at windows startup to the HKLM\Software\Microsoft\Windows\CurrentVersion\Run key. When the application runs from this ...
<p>I believe that will be running with the system folder as the working folder. Either putting the config file in the system folder or ensuring the working folder is set should fix the problem.</p>
How do I do regex replacement with numbered groups? <p>I'm trying to do a replace of all instances of strings like</p> <pre><code>PageLocalize("Texts", "R73") </code></pre> <p>with something like</p> <pre><code>Texts.R73.Localise() </code></pre> <p>I have a regex for matching these strings:</p> <pre><code>PageLoca...
<p>It works fine in a test application:</p> <pre><code>var r = new Regex( "PageLocalize\\(\"([A-Za-z]+)\", \"([A-Za-z0-9]{0,6})\"\\)"); var s = r.Replace("PageLocalize(\"Texts\", \"R73\")", "$1.$2.Localise()"); Console.WriteLine(s); </code></pre> <p>This results in:</p> <pre><code>Texts.R73.Localise() </code></p...
Hiccups in OpenGL ES. What is the correct implementation? <p>I'm using OpenGL ES to make a game on the iPhone. <strong>Unfortunately, I see small (and irregular) hiccups.</strong> </p> <p>I use a timer with a sleep, calling the draw function every 60th of a second, in order to garantee a solid frame rate. I've tried ...
<p>You might want to read this <a href="http://dewitters.koonsolo.com/gameloop.html" rel="nofollow">article about game loops</a>, which explains a lot. Generally the best solution is to call the draw routine in an infinite loop inside a separate thread (see <a href="http://stackoverflow.com/questions/96265/what-is-a-be...
Python's FTPLib too slow? <p>I have been playing around with Python's FTP library and am starting to think that it is too slow as compared to using a script file in DOS? I run sessions where I download thousands of data files (I think I have over 8 million right now). My observation is that the download process seem...
<p>FTPlib may not be the cleanest Python API, I don't think it so bad that it run ten times slower than a DOS shell script.</p> <p>Unless you do not provide any code to compare, e.g you shell and you python snippet to batch dl 5000 files, I can't see how we can help you.</p>
linq query to join two tables and get the count from one table values from the other <p>I have two tables Customers, Orders</p> <p><strong>Customers</strong> CustomerID FName LName</p> <p><strong>Orders</strong> OrderId CustomerID OrderDate</p> <p>I want to make a linq statement that can join these two tables and ge...
<pre><code>from c in Customers join o in Orders on c.CustomerID equals o.CustomerID into g select new { c.FName, c.LName, Count=g.Count() } </code></pre>
Send mail to multiple recipients with attachment ASP.NET <p>I am building a simple e-mail application to send emails to a list of people with an attachment.</p> <p>To be able to add an attachment (from what I have found out) I need to use System.Web.Mail.</p> <p>Is there any limit to how many email addresses I can se...
<p>Email Protocol should not inherently limit the number of emails sent. Any limits you'll run into will most likely be imposed by your server or ISP.</p>
AIR application, set cursor position in form <p>I have an AIR application with a login form. What I want to do is set the cursor in the first textinput box. I only manage to set the focus on the box, but not the cursor.</p> <p>Does anyone have an idea for how I can do this?</p>
<p>To move the <em>text</em> cursor to a TextField you simply set the <a href="http://help.adobe.com/en%5FUS/AS3LCR/Flash%5F10.0/flash/display/Stage.html#focus" rel="nofollow">stage's focus property</a> to that field.</p> <p><code>stage.focus = myTextField;</code></p> <p>To move the cursor to a specific index within ...
Why does UIWebView shrink images? <p>I'm using a UIWebView to display images in base64 (<a href="http://www.abluestar.com/utilities/encode_base64/index.php" rel="nofollow">http://www.abluestar.com/utilities/encode_base64/index.php</a>). The UIWebView is set to "Scales Page To Fit" and Mode is "Left". The image might ...
<p>The best way I've found to counter this is to use this meta tag in my html head</p> <pre><code>&lt;meta name="viewport" content="width=320;height=420;user-scalable=yes;initial-scale=1.0;"&gt; </code></pre> <p>Then there's no need to compensate for the scaling effect</p>
sending email notifications for future dates in asp.net 3.5 <p>I want to develop an Online Reminder service in ASP.NET 2.0 (C#) and SQL2005. But I am not getting the concept of reminder service. What I know is using an online reminder service I can schedule a reminder for future dates, which is sent to me (who schedule...
<p>Microsoft SQL Server 2005 have scheduling (sql jobs) and email features. You may even donot need to use ASP.NET. </p>
Winforms: SuspendLayout/ResumeLayout is not enough? <p>I have a library of a few "custom controls". Essentially we have our own buttons, rounder corner panels, and a few groupboxes with some custom paint. Despite the "math" in the OnPaint methods, the controls are pretty standard. Most of the time, all we do is draw th...
<p>We've seen this problem too.</p> <p>One way we've seen to "fix" it is to completely suspend drawing of the control until we're ready to go. To accomplish this, we send the WM_SETREDRAW message to the control:</p> <pre><code>// Note that WM_SetRedraw = 0XB // Suspend drawing. UnsafeSharedNativeMethods.SendMessage(...
IE 8 dropping memory pages? <p>This question is a spin-off/evolution of <a href="http://stackoverflow.com/questions/461605/invalid-webresource-axd-parameters-being-generated">this question</a>. (That question got marked as resolved because I put a bounty on it and it auto-resolved, but it never really got answered.) ...
<p>*<em>Edit 4/1/10: *</em> Update: The 4k bug is now fixed by the IE8 Cumulative update on 3/30/2010. blogs.msdn.com/ieinternals/archive/2010/04/01/</p> <p>The Internet Explorer team has been investigating this issue. </p> <p>-=Impact=-</p> <p>Thus far, we believe the problem has no impact on the end-user's experi...
Using marker classes to control logic flow <p>I have been going through some code seen that a colleague of mine is using 'marker classes' to control program logic (see contrived example below). It seems to work well, and the code reads really nicely, but there is just something about it that smells...</p> <pre><code>n...
<p>Marker <strong><em>interfaces</em></strong> are a better practice as they offer much more flexibility.</p> <p>However in this specific case I think that virtual dispatch is a better solution.</p> <pre><code>using System; namespace ConsoleApplication4983 { public class MyClass { static void Main() ...
awk: Either modify or append a line, based on its existence <p>I have a small awk script that does some in-place file modifications (to a Java <code>.properties</code> file, to give you an idea). This is part of a deployment script affecting a bunch of users.</p> <p>I want to be able to set defaults, leaving the rest ...
<pre><code>BEGIN { defaults["some.value"] = "SOME VALUE" defaults["other.value"] = "OTHER VALUE" } { for (key in defaults) { pattern = key gsub(/\./, "\\.", pattern) if (match($0, "^" pattern "=.*")) { gsub(/=.*/, "=" defaults[key]) delete defaults[key] ...
Internet Explorer Drop down border <p>Is there a way to hide the border of a drop down menu in IE (to make it look flat, blend into the background)? In Firefox it's simple enough to just set the border to 0px, but IE still renders a border even if you set the border to 0px.</p>
<p>This isn't possible in IE. They don't allow styling of the drop-down component of a list, except for the text inside it (ie. red text).</p> <p>IE actually uses a Windows-level control, not a browser-based one, so it is rather limited.</p> <p><strong>Edit</strong>: When this post was originally made, a stable vers...
VIEWS and Fluent NHibernate? <p>It's possible to map a VIEW using Fluent NHibernate? If so, how?</p>
<p>I would think you could just replace your the table name with your view name using the WithTable method:</p> <pre><code>WithTable("myview"); </code></pre> <p><strong>Edit:</strong> Just to update this answer, Fluent NHibernate now uses:</p> <pre><code>Table("myview"); </code></pre>
How do you get the users phone number with PhoneGap (on the iPhone)? <p>So there's a plist boolean in PhoneGap referencing the user's phone number? Can this be acquired? This StckOverflow question suggests not: <a href="http://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-iphone-os">http...
<p>The wording of this is perhaps a bit ambiguous. If you look at the documentation for the UIWebView property detectsPhoneNumbers in the XCode documentation browser, you'll see that it doesn't detect the user's phone number, but rather identifies phone numbers in the HTML.</p> <p>Here's a snippet from the relevant d...
Is this hWnd a child of mine? <p>How can I tell if an hWnd belongs to one of my child controls?</p> <p>I want to do something like:</p> <pre><code>if(this.Controls.Find(hWnd) != null) return false; </code></pre>
<p>There's a Win32 function for this: <a href="http://pinvoke.net/default.aspx/user32/IsChild.html" rel="nofollow">IsChild</a></p>
Can I use perltidy's HTML formatter in my automated Perl build? <p>I'm using Module::Build to perform build, test, testpod, html, &amp; install actions on my Perl module that I'm developing. The HTML files that are generated are okay, but I'd be much happier if I could somehow configure Module::Build to use the perlti...
<p>Well, the action is implemented in </p> <pre><code>htmlify_pods </code></pre> <p>in <a href="http://cpansearch.perl.org/src/EWILHELM/Module-Build-0.33/lib/Module/Build/Base.pm" rel="nofollow">Module::Build::Base</a>.</p> <p>It should be possible to override that method.</p> <p><strong>Much Later ...</strong></p>...
How would std::ostringstream convert to bool? <p>I stumbled across this code.</p> <pre><code> std::ostringstream str; /// (some usage) assert( ! str ); </code></pre> <p>What does <strong><code>ostringstream</code></strong> signify when used in a <strong><code>bool</code></strong> context?</p> <p>Is this possibly a...
<p>It tells you if the stream is currently valid. This is something that all streams can do. A file stream, for example, can be invalid if the file was not opened properly.</p> <p>As a side note, this functionality (testing a stream as a bool) is achieved by overloading <code>explicit operator bool</code> <em>in C++1...
Change the language of a website in Sharepoint 2007? <p>I have been working in my development machine with a Sharepoint installed in English. So the website I created and am woking on appears in English, I have created variations in different languages too (Spanish, Catalan, Basque, Galician). Now I realise that the a...
<p>You should be very careful with modifying the database... not only is it not recommended but it will make your SharePoint environment unsupportable by Microsoft. Good for laughs, not much else.</p> <p>So to give you the official answer, you cannot do what you are attempting without recreating the website. To quote ...
Ruby on Rails Question - Answer Website <p>Does anyone know of a good tutorial or application for asking and answering questions for Ruby on Rails, much like this site (although it probably will be for a very different purpose in the end)?</p>
<p>If you're serious about building this application, I can only suggest to just learn Ruby on Rails and build it yourself, instead of looking for a tutorial. There's plenty of great learning material, and assuming you've got a decent understanding of programming in Ruby, Rails is incredibly easy to get started with. A...
How to do SQL Like % in Linq? <p>I have a procedure in SQL that I am trying to turn into Linq:</p> <pre><code>SELECT O.Id, O.Name as Organization FROM Organizations O JOIN OrganizationsHierarchy OH ON O.Id=OH.OrganizationsId where OH.Hierarchy like '%/12/%' </code></pre> <p>The line I am most concerned with is:</p> ...
<pre><code>.Where(oh =&gt; oh.Hierarchy.Contains("/12/")) </code></pre> <p>You can also use <code>.StartsWith()</code> or <code>.EndsWith()</code>.</p>
Multiproc builds in VS2008 <p>I remember reading somewhere about multiproc builds in VS2008, only I can't find the article now. Does anyone know how to turn this on, or even if it is possible?</p>
<p>There are two ways to parallelize a build in VS2008.</p> <p>The first is to run several project builds in parallel. The setting is in Tools->Options->Projects and Solutions->Build and Run, called "Maximum number of parallel project builds". Note that each project will only build one file at a time.</p> <p>The se...
Why is App window only opening once and then not opening again? <p>I am creating a app from a tutorial in a book, but I noticed a problem, when the preference window i created is opened and then closed it won't open again, how can i fix this?</p> <p>Thanks.</p> <p>EDIT: I saw another post about this but was still un-...
<p>In Interface Builder, make sure <strong>Release on close</strong> is turned off in the Window's attributes. Also double check that the connections to and from the window from your window controller are hooked up okay.</p>
How to do a full text search in Cocoa? <p>I need something like Lucene to do an optimized full text search in Cocoa. I am working on an Iphone app to search through a database.</p> <p>Anybody has any luck with other databases. Any help is appreciated.</p> <p>So far, I can only find this.</p> <p><a href="http://githu...
<p>According to your comment: "..I am not sure if I explained myself properly. I am looking to build an Iphone app that can do searches by passing the search phrases to a remote server..."</p> <p>You could just use the Java (or .NET) version of Lucene server side and pass the search query to the server from the phone ...
Java on Linux: Listening to broadcast messages on a bound local address <p>I have a somewhat weird requirement to be able to listen to a number of network interfaces from Java on a Linux machine and determine if one of them receives UDP packets of a certain type. The output data which I need is the IP address of the in...
<p>This was an IPV6 Linux kernel issue in the end. Usually I have disabled IPV6, because it causes all kind of headaches. However in Ubuntu 9.04 it is so hard to disable IPV6 that I gave up, and that bit me. </p> <p>To listen to broadcast messages from a certain interface, I'll first create the "broadcast version" of ...
How do you resolve a URN? <p>I have an XML schema file which references a urn based location. Is there some way to resolve this into a url, or some way to actually read the file it refers to.</p> <pre><code>&lt;xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclGrp.xsd:1.1"/&gt; </code></pre>
<p>The schemaLocation is in this case the location. If you have a file named exactly like this in the same directory it should be resolved. It is even include the urn: part so the complete string. It is just convienient to name the file after the schema namespace. Confusing at first I must admit.</p> <p>Btw. the urn i...
Django validation array of errors <p>I am using </p> <pre><code>rf['email'].errors </code></pre> <p>As said in docs, I can use it to have array of errors. </p> <pre><code>[str(e) for e in rf['email'].errors] #give me ["&lt;django.utils.functional.__proxy__&gt;"] </code></pre> <p>If repr or str - it gives ul's or s...
<p>You have a couple options depending on the output you'd like.</p> <p>Option one, use the unicode constructor to convert the data:</p> <pre><code>list_of_error_texts = [unicode(e) for e in rf['email'].errors] </code></pre> <p>(Django's proxy object implements a method that responds to unicode.)</p> <p>Option two,...
Is there any way to get the "Me" card from iPhone Address Book API? <p>So I'm stumped on this one. </p> <p>In Mac OS X there is an easy way to get the "Me" card (the owner of the Mac/account) from the built-in address book API. </p> <p>Has anyone found a way to find out which contact (if it exists) belongs to the o...
<p>You could use the undocumented user default:</p> <pre><code>[[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"]; </code></pre> <p>and then search the address book for the card with that phone number.</p> <p>Keep in mind that since the User Default is undocumented, Apple could change at ...
How do i lock an asp.net page from multi-user editing? <p>i have a page with a series of checkboxes that authenticated users can change. I need to make this page only editable by one person at a time. So if a user goes into it and edits one of the checkboxes, noone else can go into the page and change other checkboxe...
<p>We have this functionality on an older ASP app. The user will load data with some type of primary key. We put in a DB entry to "lock" that page. If they correctly move through the site, it will unlock the resources at that time.</p> <p>Other users opening this page will receive indication that the page is locked...
Change font size and style in Visual Studio 2008 <p>Where is the setting to change the font size and font type in Visual Studio 2008?</p>
<p>Use menu <em>Tools</em> -> <em>Options</em> -> Inside <em>Environment</em> -> <em>Fonts and Colors</em>:</p> <p><img src="http://i.stack.imgur.com/hKRWW.png" alt="Screenshot of the options dialog in Visual Studio, invoked by menu command Tools/Options."></p>
Flex: Label.addChild() not working? <p>I want to make a label that has a tiny title above it, for example so the label say <strong>$1,000</strong> with a small <em>retail price</em> or <em>our price</em> above it. I am trying to add the title label to the display list of the main label. I get no error but the title doe...
<p>If you add children to a Flex component that is not a container, then you have to manually manage sizing and positioning of those children. Containers do a lot of that work for you.</p> <p>Here's what you should do:</p> <ol> <li><p>Move the creation of your child Label into an override of the <code>createChildren(...
IE8 stalls after 302 in new window <p>My client's website opens external links in new windows (with target="_blank"). The links are also routed through a logger which responds with a 302 redirect to the desired page.</p> <p>For example, instead of</p> <pre><code>&lt;a href="http://stackoverflow.com"&gt;...&lt;/a&gt; ...
<p>I know it's just a workaround, but... use JS redirection if the browser is IE8?</p>
Splitting a String (especially in Java with java.util.regex or something else) <p>Does anyone know how to split a string on a character taking into account its escape sequence?</p> <p>For example, if the character is ':', "a:b" is split into two parts ("a" and "b"), whereas "a\:b" is not split at all.</p> <p>I think...
<p><code>(?&lt;=^|[^\\]):</code> gets you close, but doesn't address escaped slashes. (That's a literal regex, of course you have to escape the slashes in it to get it into a java string)</p> <p><code>(?&lt;=(^|[^\\])(\\\\)*):</code> How about that? I think that should satisfy any ':' that is preceded by an even nu...
Why are lowercase characters in CentOS rendering as blocks? <p>I've been checking up on who's been signing up for one of my websites by using the brute-force <code>SELECT * FROM tblUsers;</code></p> <p>I hash user passwords, so they don't render as cleartext, and I noticed a strange artifact upon the display of one of...
<p>I would guess that one or more characters in the hashed passwords are being interpreted as special commands which change the terminal's encoding. Try <code>cat</code>'ing a binary file and you're likely to <a href="http://www.unix.com/unix-dummies-questions-answers/13767-cat-binary-file-terminal-gibberish.html" rel=...
CSS2 DIV Presentation Issue <p>I need to create a page that has quotes side-by-side for a large number of rows.I am looking for a clean CSS2 presentation where the quotes of each row line up vertically and don't run below each other.Also, I am looking for a solution with the least amount of code and preferably one that...
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Title&lt;/title&gt; &lt;style type="text/css"&gt; body { font-family:Verdana; font-s...
how to use built in list function "filter" <p>Please help me with using the DrScheme built-in function "filter". </p> <p>"create a function "hello" that consumes a number 'Max', and a list of numbers 'L', produce a list of numbers in 'L' that are smaller than 'Max'."</p> <p><strong>edit</strong> Taken from the commen...
<p>Using your <code>smaller?</code> definition, I would go for something like</p> <pre><code>(define (hello Max L) (filter (lambda (n) (smaller? n Max)) L)) </code></pre> <p>This uses a lambda function which is a closure over the Max argument to the hello function. So it "embeds" <code>Max</code> inside the lambda ...
Flex: How do I space out items in a HorizontalList control (using a custom ItemRenderer) <p>I have a HorizontalList control that uses a custom ItemRenderer to represent each item as a toggle-button. The list allows drag and drop, and I used <a href="http://stackoverflow.com/questions/589840/flex-as3-drag-drop-custom-dr...
<p>How about writing your item renderer as a container (either Canvas or HBox) and placing the Button element inside?</p>
Opening File paths with spaces in Delphi 5 <p>(Using Delphi 5)</p> <p>I am attempting to open a log file using the following code:</p> <pre><code>// The result of this is: // C:\Program Files\MyProgram\whatever\..\Blah\logs\mylog.log fileName := ExtractFilePath(Application.ExeName) + '..\Blah\logs\mylog.log'; // The...
<p>I'm pretty sure that Delphi 5 handles spaces in filenames ok but it has been a very long time since I have used that specific version. Is the file currently open by another process? It also could be a permissions issue. Can you instead of loading it into a tStringList, try opening it with a tFileStream with the f...
Debugging commands (step over/into) cause unhandled exceptions <p>I'm using Visual Studio 2008 on a 64-bit version of Vista. After my program stops on one of my breakpoints, I can't step over or into the current line without either an Illegal Instruction exception or an Access Violation exception being thrown by my ap...
<p>Mos, I was wondering have you resolved this problem (since I also have it with VS2005 and VS2008 on 64-bit Win7)?</p> <p>Edit: "Uncheck Tools/Options/Debugging/Native/Enable RPC debugging" was suggested in comment, and seems to be the answer.</p>
Graph Edges Rails <p>I found this recently when trying to do bidirectional relationships in rails (<a href="http://www.dweebd.com/sql/modeling-bidirectional-graph-edges-in-rails/" rel="nofollow">http://www.dweebd.com/sql/modeling-bidirectional-graph-edges-in-rails/</a>)</p> <pre><code>class Befriending &lt; ActiveReco...
<ol> <li>I'm a user</li> <li>I have friends</li> <li>My friends are also users</li> </ol> <p>The way to model this using a graph (http://en.wikipedia.org/wiki/Graph_%28mathematics%29) is with</p> <ul> <li>nodes that represent users/friends</li> <li>edges that represent friendship links</li> </ul> <p>So yes: in datab...
Scrolling to the previous div in jQuery <p>I'm using the scrollTo plugin for jQuery on a website. I made a vertical scrolling div wher I can scroll to different div by clicking on buttons. And now I need to make a back button to return to the previous div.</p> <p>what I want is the opposite of </p> <pre><code>this.ne...
<p><code>this</code> is a raw element reference - you'll need to wrap it in a jQuery object before you can use jQuery methods like <a href="http://docs.jquery.com/Traversing/prev" rel="nofollow"><code>prev()</code></a>: <code>$(this).prev()</code> </p>
"Gotchas" in Facebook Application development <p>I've been throwing myself at Facebook dev for a couple of weeks now and its been... challenging. Not from a "how does this work?" point of view, but from a "why doesn't this work!" one.</p> <p>I'm curious as to what "gotchas", unexpected behavior, or just straight-up b...
<p>I have run into several when creating a Desktop Application, I ended up creating a special <a href="http://wiki.developers.facebook.com/index.php/Desktop%5FApplication" rel="nofollow">Desktop page on the Facebook Wiki</a> to make it easier for others. The two biggest 'gotchas' I found were getting the app to show up...
How do I remove colons from a list of MAC addresses? <p>I'm having a hard time trying to remove the colons in a list of MAC addresses.</p> <p>My file:</p> <pre><code>00:21:5A:28:62:BF 00:24:81:0A:04:44 </code></pre> <p>Expected Output:</p> <pre><code>00215A2862BF 0024810A0444 </code></pre> <p>Any ideas on how coul...
<p>Given your tags, you want to accomplish this in a shell:</p> <pre><code>cat file | sed s/://g </code></pre> <p>edit: you don't really need the <code>cat</code> either if you are reading from a file:</p> <pre><code>sed s/://g file </code></pre>
Smooth lines in OpenGL <p>I'm trying to a draw a more-or-less smooth multi-segment line in OpenGL. However I find that if the line is over a thickness about 3 then the joins between the segments are not seamless. They sometimes have gaps between them. Is there a good way of making these joins smooth and gapless? I'm lo...
<p>The most consistent and portable way to draw think lines using OpenGL is to use camera aligned (otherwise know as billboarded) polygons. Different implementations of the OpenGL API handle the end points of the lines differently and <code>GL_LINE_SMOOTH</code> produces drastically different results depending on the ...
What is the method for optimizing individual functions in a file in GCC 4.1.1? <p>Various C / C++ compilers have <code>#pragma</code>s to control optimization.</p> <p>For example:</p> <p><strong>CodeWarrior</strong></p> <pre><code>#pragma optimization_level 0 void func_no_opt() { // Some Work - not optimized } ...
<p>Looks like the <code>__attribute__((optimize(...)))</code> is the only means to control optimization per-function basis in GCC. Thus with GCC 4.1.1 splitting out a separate library of functions to be optimized is indeed your only option.</p>