instruction
stringlengths
0
30k
I want to allow my users to embed their own Flash animations in their posts. Usually the actual file is hosted on some free image hosting site. I wouldn't actually load the flash unless the user clicked a button to play (so that nothing auto-plays on page load). I know people can make some really annoying crap in fl...
I want to allow my users to embed their own Flash animations in their posts. Usually the actual file is hosted on some free image hosting site. I wouldn't actually load the flash unless the user clicked a button to play (so that nothing auto-plays on page load). I know people can make some really annoying crap in fl...
System.Type propertyType = typeof(Boolean); System.TypeCode typeCode = Type.GetTypeCode(propertyType); switch (typeCode) { case TypeCode.Boolean: //doStuff break; case TypeCode.String: ...
How about the following: if find /some/dir/ -maxdepth 0 -empty | read; then echo "huzzah"; fi This way there is no need for generating a complete listing of the contents of the directory. The `read` is both to discard the output and make the expression evaluate to true only when something is read (i.e. `/some...
We also encounter this a lot in our applicatins. What we have found to be a good solution: Just show all rows in the comboboxes. Then, as soon as the user enters the compobox in a specific row, adjust the rowsource (with the filter for that row). When the combobox loses the focus, you can re-set the rowsource to disp...
a more low-level appproach is [redland][1], which provides bindings to a lot of languages like Perl, PHP, Python and Ruby. redland itself is written in C. i have scripted with it in ruby to provide a simple webservice with a rdf backend instead of a classic database. [1]: http://librdf.org/
try string.match( /[$]chkChecked$/ ) alternatively, you could try string.match( /[^a-zA-Z0-9]chkChecked/ ) ( Also, make sure your using <code>//</code> around your regex, otherwise you might be matching using string literals. Not obvious tho without a larger code snippet )
It looks like it should work. There's a good [Javascript Regex Tester](http://www.regular-expressions.info/javascriptexample.html) that also says it matches.
Uses of "using" in C#
|c#|using|
User [kokos][1] answered the wonderful [Hidden Features of C#][2] question by mentioning the **using** keyword. Can you elaborate on that? What are good uses of **using**? [1]: http://stackoverflow.com/users/1065/kokos [2]: http://stackoverflow.com/questions/9033/hidden-features-of-c
|c#|using|using-statement|
I believe that you must Restrict or Find in order to get recurring appointments, otherwise Outlook won't expand them. Also, you must Sort by Start *before* setting IncludeRecurrences.
If you intend to use 7Zip only for zip and unzip take a look at the [TZip][1] component. I have written a small wrapper for my own purposes, which you can find in the [Zipper.pas][2] file, feel free to reuse. [1]: http://www.angusj.com/delphi/ [2]: https://monex.svn.sourceforge.net/svnroot/monex/trunk/Knjizn...
Not tested: mailItem.Subject = "Dept - " & mailItem.Subject mailItem.Save
VB.Net (or C#) 2008 Multi Threaded Import
|sql-server|visual-studio|vb.net|multithreading|import|
I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look at and play with the source of a *VERY* simple...
No code, but communicating with gamepads and the like is pretty straightforward with the [InputSprocket](http://developer.apple.com/DOCUMENTATION/mac/Sprockets/GameSprockets-162.html#HEADING162-0) mechanism. What was the precise problem you had?
I believe that [pyparsing][1] is based on the same principles as parsec. [1]: http://pyparsing.wikispaces.com/ "PyParsing web site"
I would say when your original design assumptions about the threads are no longer valid. Thread priority is mostly a design decision about what work is most important. So for some examples of when to reconsider: If you add a new feature that might require its own thread that becomes more important, then reconsider ...
Create a POM that has the repository settings that you want and then use a parent element in your project POMs to inherit the additional repositories. The use of an "organization" POM has several other benefits when a group of projects belong to one team.
What is characteristic to a just-in-time (JIT) compiler?
|compiler-construction|
What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand example of this?
|compiler-construction|jit|
What does a just-in-time (JIT) compiler do?
What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?
It is, as long as you put **abstract** in front, or implement the methods. public abstract string LogPath { get; private set; } public abstract string ErrorMsg { get; private set; } See <http://forums.asp.net/t/1031651.aspx>
If you use the "Analyze Code" on files, or your project in Zend Studio it will warn you about any uninitialized variables (this actually helped find a ton of misspelled variables lurking in seldom used portions of the code just waiting to cause very difficult to detect errors). Perhaps someone could at that functional...
Really, I'd choose an editor which supports this correctly, rather than wrangling it through more XML.
How to edit sessions parameters on Oracle 10g XE?
|database|oracle-database|
default is 49 how to edit to higher?
With SQL Server you really should consider using the _FOR XML_ construct in the query. If you're using .Net, just use a DataAdapter to fill a dataset. Once it's in a dataset, just use it's .WriteXML() method. That breaks your DB->object->XML rule, but it's really how things are done. You might be able to work so...
The event handler works, but I have found a simpler workaround. If you “Check Out” the file and leave it checked out, no one else has the option to edit the file. This is still not ideal, but for forcing a document to be “read only” it works.
I think you should use NTFS Change Journal or similar: > The change journal is used by NTFS to > provide a persistent log of all > changes made to files on the volume. > For each volume, NTFS uses the change > journal to **track information about > added, deleted, and modified files**. > The change journal is ...
How about appending a simple window.close() after the advertising code? That way their popup is displayed and your window closes neatly.
How about appending a simple window.close() after the advertising code? That way their popup is displayed and your window closes neatly. I'm not sure that I've ever had a browser complain that the window is being closed. This method has always worked for me. (IE, Firefox, etc.)
vpnc seems to be doing the right thing for my employer's cisco concentrator. I jump on and off the vpn, and it seems to update everything smoothly.
Ultimate++ has its own set of containers - not sure if you can use them separatelly from the rest of the library: http://www.ultimatepp.org/
In ASP.net Webforms how do you detect which Textbox someone pressed enter?
|asp.net|webforms|
In ASP.net Webforms how do you detect which Textbox someone pressed enter? Please no Javascript answers. I need to handle it all in the code behind using VB.NET.
I and a co-worker (Patricia Eromosele) came up with the following solution: (Is there a better solution?) <pre><span style="font-family:courier new;"> &lt;p&gt;</span><br /><span style="font-family:courier new;"> &lt;xsl:call-template name="prewrap"&gt;</span><br /><span style="font-family:cou...
I and a co-worker (Patricia Eromosele) came up with the following solution: (Is there a better solution?) <pre><span style="font-family:courier new;"> &lt;p&gt;</span><br /><span style="font-family:courier new;"> &lt;xsl:call-template name="prewrap"&gt;</span><br /><span style="font-family:cou...
What about using a GPS enabled phone running WM? I have the Motorola Q9c. I'm working on a GPS Data Logger so I can map my flights. The windows mobile SDK has a great C# sample to work with.
When I have done this in the past, I used [graphviz](http://www.graphviz.org/), in particular the dot tool, to generate the graph. I created the dot input file by actually traversing the control-flow graph at compile time. Graph layout is a _hard problem_, and graphviz does an excellent job. It can output to ps, p...
How do I hide pages in my ASP.NET web application from users that lack sufficient permissions?
|asp.net|forms-authentication|sitemap|
I'm using the [ASP.NET Login Controls][1] and [Forms Authentication][2] for membership/credentials for an ASP.NET web application. And I'm using a [site map][3] for site navigation. I have ASP.NET TreeView and Menu navigation controls populated using a SiteMapDataSource. But off-limits administrator-only pages are...
How do I filter nodes of TreeView and Menu controls with sitemap data sources based on user permissions?
I'm using the [ASP.NET Login Controls][1] and [Forms Authentication][2] for membership/credentials for an ASP.NET web application. And I'm using a [site map][3] for site navigation. I have ASP.NET TreeView and Menu navigation controls populated using a SiteMapDataSource. But off-limits administrator-only pages are...
I'm using the [ASP.NET Login Controls][1] and [Forms Authentication][2] for membership/credentials for an ASP.NET web application. And I'm using a [site map][3] for site navigation. I have ASP.NET TreeView and Menu navigation controls populated using a SiteMapDataSource. But off-limits administrator-only pages are...
I would subclass attr_accessor to build your to_xml and from_xml for you. Something like this (note, this is not fully functional, only an outline) <pre> class XmlFoo def self.attr_accessor attributes = {} # need to add code here to maintain a list of the fields for the subclass, to be used in to_xml and...
Yes, you're going to have to handle that yourself, same as that you're responsbile for sending the datetime in the request, so the server can determine if there was a change. I would look at the [RSS Bandit source][1] for a sample implementation. [1]: http://www.rssbandit.org/
mysql_real_escape_string is so passé... These days you should really use parameter binding instead.
mysql_real_escape_string is so passé... These days you should really use parameter binding instead. I'll elaborate by mentionning that i was referring to <a href="http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html">prepared statements</a> and provide a link to an article that demonstrates that...
To what you said I'd add: - Method/function/class name - Coverage counting tool, with exceptions (Do not count these methods) - Result of N last runs available - Mandate that ways to easily parse test results must exist
Michael Feathers of ObjectMentor was instrumental in the development of both CppUnit and CppUnitLite. He now recommends [CppUnitLite][1] [1]: www.objectmentor.com/resources/downloads.html
Michael Feathers of ObjectMentor was instrumental in the development of both CppUnit and CppUnitLite. He now recommends [CppUnitLite][1] [1]: http://www.objectmentor.com/resources/downloads.html
I find that whenever I need a code generation tool like this, I am probably writing code that could be made a little bit more generic so I only need to write it once. In your example, those getters and setters don't seem to be adding any value to the code - in fact, it is really just asserting that the getter/setter me...
Most definitely all things from your list for each individual item: - Filename - Line number - Namespace/class/function name - Test coverage - Start time and end time - And/or total time (this would be more useful for me than the top two items) - Diagnostic output such as the difference betw...
A slightly different approach would be to use xargs: find /path/to/jpgs -type f -print0 | xargs -0 jhead -v | grep 123 which I always found a bit easier to understand and to adapt (the -print0 and -0 arguments are necessary to cope with filenames containing blanks) This *might* (not tested) be more effecti...
Covering index is just an ordinary index. It's called "covering" if it can satisfy query without necessity to analyze data. example: CREATE TABLE MyTable ( ID INT IDENTITY PRIMARY KEY, Foo INT ) CREATE NONCLUSTERED INDEX index1 ON MyTable(ID, Foo) SELECT ID, Foo FROM My...
Do you really need to know what is DNS server to do a lookup? [Here][1] is a solution how to get a IP address using 2 functions: GetHostName and GetHostByName. I assume the GetHostByName function does the lookup you need for you, or am I wrong? [1]: http://delphi.about.com/od/networking/l/aa103100a.htm
Cleaning up RTF text
|.net|vb.net|word|rtf|
I'd like to take some RTF input and clean it to remove all RTF formatting except \ul \b \i to paste it into Word with minor format information. The command used to paste into Word will be something like: oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0) (with some RTF text already in the Clipboard) ...
|.net|vb.net|words|rtf|
|.net|vb.net|ms-word|rtf|
Best way to extract text from a Word doc without using COM/automation?
|python|word|
Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.) Antiword seems like it might be a reasonable option, but it seems like it might be abandoned. A Pyth...
|python|words|
|python|ms-word|
The easiest way to avoid this issue is to use rake db:schema:load on the second machine, instead of db:migrate. D:S:L uses schema.rb to load the most current version of your schema, as opposed to migrating it up form scratch. If you run into this issue when deploying to a production machine (where preserving data is...
How to safely embed any flash file (swf)?
|security|flash|embed|
I want to allow my users to embed their own Flash animations in their posts. Usually the actual file is hosted on some free image hosting site. I wouldn't actually load the flash unless the user clicked a button to play (so that nothing auto-plays on page load). I know people can make some really annoying crap in fl...
Best use of datediff and dateadd. No rounding, no approximates, no 29th of february bug, nothing but date functions 1. ageOfThePerson = DATEDIFF(yyyy, dateOfBirth, GETDATE()) 2. dateOfNextBirthday = DATEADD(yyyy, ageOfThePerson + 1, dateOfBirth) 3. daysBeforeBirthday = DATEDIFF(d, GETDATE(), date...
A warning is at place: you won't learn OO programming without learning OO design! The key concept is to define the functions operating on your data together with the appropriate data. Then you can _tell_ your objects what to do, without having to query their contents. Surely take a look at the "[Tell, don't Ask...
You get this error when you call a function that was created in a window or frame that no longer exists. If you don't know in advance if the window still exists, you can do a try/catch to detect it: try { f(); } catch(e) { if (e.number == -2146823277) // f is no lon...
Post commit hooks live in the "hooks" directory where ever you have the repository living on the server side. I don't know where you have them in your environment, so this is just an example e.g. (windows): C:\Subversion\repositories\repo1\hooks\post-commit e.g. (llinux/unix): /usr/local/subversion...
Doxygen does all of the above.
You can implement the algorithm from Google's MapReduce without having physically separate machines. Just consider each of those "machines" to be "threads." Threads are automatically distributed on multi-core machines.
You can implement the algorithm from Google's [MapReduce][1] without having physically separate machines. Just consider each of those "machines" to be "threads." Threads are automatically distributed on multi-core machines. [1]: http://labs.google.com/papers/mapreduce.html
Add your #include to the file in the normal way, but also add it to one the three "TEXTINCLUDE" sections in the file, like so: 2 TEXTINCLUDE BEGIN "#include ""windows.h""\r\n" "#include ""blah.h\r\n" "\0" END Note the following details: - Each line is contained in ...
If all you want to do is store the numbers and be able to easily to range queries, you can just take any standard tree data structure you have available in STL and serialize it to disk. This may bite you in a cross-platform environment, especially if you are trying to go cross-architecture. As far as more flexibl...
You are correct; that style is allowed. I'd look into the standard assemblies referenced. I'm not sure which you'd need to get that to compile, but I figure somewhat you're pointing to the .Net v2.0 version of csc.exe.
This is a great article: http://www.devx.com/DevX/10MinuteSolution/20365 In particular: Dim t As Thread t = New Thread(AddressOf Me.BackgroundProcess) t.Start() Private Sub BackgroundProcess() Dim i As Integer = 1 Do While True ListBox1.Items.Add("Iterations: "...
You will want to log at a tier boundary. For example, if your business tier can be deployed on a physically separate machine in an n-tier application, then it makes sense to log and throw the error in this way. In this way you have a log of exceptions on the server and don't need to go poking around client machin...
fyi: it worked! when i installed another one (with .ldf log file) then the one in question, then detached the first one again. don't ask me why....
Our app uses a background thread to download data and we didn't want that interfering with the UI thread on single-core machines, so we deliberately prioritized that lower.
C Image Library
|c|image|psp|
If you're using wxPython, you can use the following simple code: wx.Icon(sys.argv[0], wx.BITMAP_TYPE_ICO) I usually have code that checks whether it's running from an EXE or not, and acts accordingly: def get_app_icon(): if hasattr(sys, "frozen") and getattr(sys, "frozen") == "windows_exe": ...
What is the best way to add users to multiple groups in a database?
|sql|database|user|groups|
In an application where users can belong to multiple groups, I'm currently storing their groups in a column called `groups` as a binary. Every four bytes is a 32 bit integer which is the `GroupID`. However, this means that to enumerate all the users in a group I have to programatically select all users, and manually fi...