instruction
stringlengths
0
30k
I'd like to create a progress bar to indicate the status of an a batch job in Ruby. I've read some [tutorials][1] / [libraries][2] on using ncurses, none of which were particularly helpful in explaining how create an "animated" progress bar in the terminal or using curses with Ruby. I'm already aware of using a separat...
Why not create a Domain object based approach to this problem: public class CustomerDownloadInfo { private string sku; private readonly ICustomer customer; public CustomerDownloadInfo(ICustomer Customer){ customer = Customer; } public void AttachSku(string ...
How to tab focus onto a dropdown field in Mac OSX
|macos|
In Windows, in any windows form / web browser, you can use the tab button to switch focus through all of the form fields. It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access them any other way without...
The way I like to do this is using the %x operator, which makes it easy (and readable!) to use quotes in a command, like so: directorylist = %x[find . -name '*test.rb' | sort] Which, in this case, will populate file list with all test files under the current directory, which you can process as expected: ...
Go to System Preferences > Keyboard and Mouse, then choose Keyboard Shortcuts. At the bottom, ensure Full Keyboard Access is set to "All controls". It's a long time since I turned it on but I think that's all you need to do
Apple Menu > System Preferences > Keyboard & Mouse > Keyboard Shortcuts: Change the radio button at the bottom from "Text boxes and lists only" to "All controls." Edit: Dammit. We're a fast group around here aren't we? :-)
This is an alternative way (DataReader is faster than this one): string s = ""; SqlConnection conn = new SqlConnection("Server=192.168.1.1;Database=master;Connect Timeout=30;User ID=foobar;Password=raboof;"); SqlDataAdapter da = new SqlDataAdapter("SELECT TOP 5 name, dbid FROM sysdatabases", conn); ...
Step one is to make your "dirty" pieces self contained user controls Step two is to embed those controls on your consuming page Step three is to wrap each user control tag in their own Asp:UpdatePanel Step four is to ensure your control gets the data it needs by having it read from properties which check again...
Check out the [RadAjax][1] control from Telerik - it allows you to avoid using UpdatePanels, and limit the amount of info passed back and forth between server and client by declaring direct relationships between calling controls, and controls that should be "Ajaxified" when the calling controls submit postbacks. ...
It's in the System Preferences - [this blog post][1] shows where the setting is. [1]: http://www.howtogeek.com/howto/apple/why-doesnt-tab-work-for-drop-down-controls-in-firefox-on-os-x/
Suggest someone with the reputation to do it revise this question to say, "What good technology podcasts are out there?" I've got all kinds of audio fiction I could recommend, but then this question really runs off into the weeds.
Check out this blog post: [Tweaking the ICallbackEventHandler and Viewstate][1]. The author seems to be addressing the very situation that you are experiencing: > So when using ICallbackEventHandler you have two obstacles to overcome to have updated state management for callbacks. First is the problem of the read-...
What good Podcasts are out there?
|podcast|
Yes, Podcasts, those nice little Audiobooks I can listen to on the way to work. With the current amount of Podcasts, it's like searching a needle in a haystack, except that the haystack happens to be the internet and is filled with too many of these "Hot new Gadgets" stuff :( Now, even though **I** am mainly a .net ...
What good technology podcasts are out there?
I have found the solution else where: SELECT SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes('MD5', 'HelloWorld')), 3, 32)
Convert HashBytes to VarChar
|sql|2005|md5|
I want to get the MD5 Hash of a string value in SQL Server 2005, I do this with the following command: SELECT HashBytes('MD5', 'HelloWorld') However, this returns a VarBinary instead of a VarChar value. If I attempt to convert "0x68E109F0F40CA72A15E05CC22786F8E6" into a VarChar I get "há ðô§*à\Â'†øæ" instead ...
|sql|
I want to get the MD5 Hash of a string value in SQL Server 2005, I do this with the following command: SELECT HashBytes('MD5', 'HelloWorld') However, this returns a VarBinary instead of a VarChar value. If I attempt to convert "0x68E109F0F40CA72A15E05CC22786F8E6" into a VarChar I get "há ðô§*à\Â'†øæ" instead ...
Probably it comes from VB6. Because with [Option Base][1] statement in VB6, you can alter the lower bound of arrays like this: Option Base 1 [1]: http://msdn.microsoft.com/en-us/library/aa266179(VS.60).aspx
Probably it comes from VB6. Because with [Option Base][1] statement in VB6, you can alter the lower bound of arrays like this: Option Base 1 Also in VB6, you can alter the lower bound of a specific array like this: Dim myArray(4 To 42) As String [1]: http://msdn.microsoft.com/en-us/library/aa266...
Read binary file into a struct C#
|c#|
I'm trying to read binary data using C#. I have all information about the layout of the data in the files I want to read. I'm able to read the data "chunk by chunk", i.e. getting the first 40 bytes of data converting it to a string, get the next 40 bytes, ... Since there are at least three slighlty different version...
All of the tech podcasts I listen to have been mentioned, but as long as we're discussing video I'd like to mention [Hak.5][1]. It is more focused on using existing programs rather than coding, but it has some good hardware segments, and it can often be an excellent source of inspiration. [1]: http://www.hak5.o...
In the StackOverflow podcast [SE-radio][1] was mentioned. Its pretty in depth. [1]: http://www.se-radio.net/
In the StackOverflow podcast [SE-radio][1] was mentioned. It's pretty in depth. Also if you are an aspiring Javascript developer, the Douglas Crockford "The JavaScript Programming Language" and "Advanced JavaScript" talks on [YUI Developer Theatre][2] are excellent. There are a few other gems on the podcast too. ...
Why not use "For Each"? That way you don't need to care what the LBound and UBound are. Dim x, y, z x = Array(1, 2, 3) For Each y In x z = DoSomethingWith(y) Next
Am I going to be downmodded for suggesting that the StackOverflow podcast is hilariously bad as a podcast? Anywho, you can find it, and a number of not-bad podcasts at: [itconversations.com][1] As this question asked for a "good" rather than "exhaustive" list, then this is obviously just my opinion. My opinion bo...
You should make your choice of server platform based on the environment as a whole, and that includes the admin/management interfaces supplied. I'm afraid that if you don't like the way Windows implements management of IIS, then that's too bad. Having said that, a bit of delving around in the WMI interfaces will ge...
I actually found both of those links you provided, but as noted they are simply describing the problem, not solving it. The author of the blog post suggests a workaround by using a different ViewState provider, but unfortunately that isn't a possibility in this case...I really need to leave the particulars of the ViewS...
You search on google or wikipedia for that particular file type. The binary file layout structure information should be included. For example, <a href = "http://en.wikipedia.org/wiki/MP3#File_structure">MP3 file layout structure</a>
I'm not sure if there's a general information source for this kind of information. I always just search on google or wikipedia for that particular file type. The binary file layout structure information should be included. For example, <a href = "http://en.wikipedia.org/wiki/MP3#File_structure">MP3 file layout st...
Try this: using (FileStream stream = new FileStream(fileName, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); StructType aStruct = (StructType)formatter.Deserialize(filestream); }
I have never come across this kind of situation, and to be honest the idea of referencing > 256 tables in a query fils me with a mortal dread. Your first question should probably by "Why so many?", closely followed by "what bits of information do I _NOT_ need?" I'd be worried that the amount of data being returne...
I'd like to see that query, but I imagine it's some problem with some sort of iterator, and while I can't think of any situations where its possible, I bet it's from a bad while/case/cursor or a ton of poorly implemented views.
Are there best practices for testing security in an Agile development shop?
|security|agile|
I'm putting together a best practices training program for agile and there are no real good resources for secure design and testing related to Agile (as far as my contextual searching ability has shown). What are the best practices for testing security per release? If it is a monthly release, are there shops doing pe...
Using the example you gave: <form> <input type="text" name="field1" /><!-- put your cursor in this field and press Enter --> <input type="submit" name="prev" value="Previous Page" /> <!-- This is the button that will submit --> <input type="submit" name="next" value="Next Page" /> <!-- But this is...
@chopeen You could change the way you're calculating these statistics, and instead keep a separate table of all per-product stats.. when an order is placed, loop through the products and update the appropriate records in the stats table. This would shift a lot of the calculation load to the checkout page rather than r...
For SQL Server 2005, I'd recommend using table variables and partially building the data as you go. To do this, create a table variable that represents your final result set you want to send to the user. Then find your primary table (say the orders table in your example above) and pull that data, plus a bit of s...
Post the query :D Also I feel like one of the possible problems could be having a ton (read 200+) of name/value tables which could condensed into a single lookup table.
How can I tell if a web client is blocking ads?
|browser|
I'd like to get some statistics on how many people coming to my site have set their browser to block ads. Any tips on the best way to do this?
I suppose you could compare the ad prints with the page views on your website (which you can get from your analytics software).
Since programs like AdBlock actually never request the advert, you would have to look the server logs to see if the same user accessed a webpage but didn't access an advert. This is assuming the advert is on the same server. If your adverts are on a separate server, then I would suggest it's impossible to do so. ...
Add the user id to the request for the ad: <img src="./ads/viagra.jpg?{user.id}"/> that way you can check what ads are seen by which users.
You need to think about the different ways that ads are blocked. The first thing to look at is whether they are running noscript, so you could add a script that would check for that. The next thing is to see if they are blocking flash, a small movie should do that. If you look at the adblock site, there is some ...
Casting: (NewType) vs. Object as NewType
|c#|.net|
What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass sc2 = SomeObject as SomeClass; Normally, they should both be explicit casts to the specified type?
The former will throw an exception if the source type can't be cast to the target type. The latter will result in sc2 being a null reference, but no exception.
The parenthetical cast throws an exception if the cast attempt fails. The "as" cast returns null if the cast attempt fails.
I've honestly never read it myself, but [Concurrent Programming in Java](http://www.amazon.com/Concurrent-Programming-Java-TM-Principles/dp/0201310090/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1217951195&sr=8-2) is a book I've heard recommended by several people.
Alright. From a theoretical point of view, given that the distortion is "arbitrary", and any solution requires you to model this arbitrary distortion, you obviously can't get an "answer". However, any solution is going to involve imposing (usually implicitly) some model of the distortion that may or may not reflect the...
I believe [DB Designer](http://www.fabforce.net/dbdesigner4/) does something like that. And I think they even have a free version. *edit* Never mind. Michael's link is much better.
Try MySQL Workbench, formally DBDesigner 4: [http://dev.mysql.com/workbench/][1] This has a "Reverse Engineer Database" mode as far as I remember, [1]: http://dev.mysql.com/workbench/
[http://www.cilk.com/multicore-e-book/][1] That's a nice general overview of the sitution, if you're looking for tuorials and books it might be best to specify a language as a starting point so you can mess around with some code. [1]: http://www.cilk.com/multicore-e-book/
They'll throw different exceptions. <br> () : NullReferenceException <br> as : InvalidCastException <br> Which could help for debugging. The "as" keyword attempts to cast the object and if the cast fails, null is returned silently. The () cast operator will throw an exception immediately if the cast fails. "On...
The two self-balancing BSTs I'm most familiar with are red-black and AVL, so I can't say for certain if any other solutions are better, but as I recall, red-black has faster insertion and slower retrieval compared to AVL. So if insertion is a higher priority than retrieval, red-black may be a better solution.
Most of the people use .NET serialization (there is faster binary and slower XML formatter, they both depend on reflection) However, if you want the fastest (unsafe) way - go ahead: Writing: YourStruct o = new YourStruct(); byte[] buffer = new byte[Marshal.SizeOf(typeof(YourStruct))]; GCHandle ha...
Most of the people use .NET serialization (there is faster binary and slower XML formatter, they both depend on reflection and are version tolerant to certain degree) However, if you want the fastest (unsafe) way - why not: Writing: YourStruct o = new YourStruct(); byte[] buffer = new byte[Marshal.Siz...
As you've said > To me, that seems a bit overkill, since viewing the site without Javascript will probably break most of it. This isn't progressive enhancement. Progressive enhancement is when the site works perfectly with JavaScript or CSS and then adding these extra technologies/code, you increase the usability...
Going at it from the other direction is sometimes referred to as graceful degradation. This is usually needed when the site is built first with the enhanced functionality afforded by the various technologies then modified to degrade gracefully for browsers with those technologies are not available. It is also grace...
Small files take up a whole node on the filesystem whatever size that is. My host tends to report all small files as 4kb in ftp but in a shell gives an accurate size so it might be a 'feature' common to ftp clients.
[Red-black](http://en.wikipedia.org/wiki/Red-black_tree) is better than AVL for insertion-heavy applications. If you foresee relatively uniform look-up, then Red-black is the way to go. If you foresee a relatively unbalanced look-up where more recently viewed elements are more likely to be viewed again, you want to use...
Take a look at Herb Sutter's "[The Free Lunch Is Over][1]" and then his series of articles on [Effective Concurrency][2]. [1]: http://www.gotw.ca/publications/concurrency-ddj.htm [2]: http://herbsutter.wordpress.com/2008/07/31/effective-concurrency-the-many-faces-of-deadlock/
See also [Unobtrusive Javascript][1] which is the bedrock progressive enhancement is built. [1]: http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
Behaviour Driven Development seems to focus more on the interaction and communication between Developers and also between Developers and testers. The Wikipedia Article has an explanation: [http://en.wikipedia.org/wiki/Behavior_Driven_Development][1] Not practicing BDD myself though. [1]: http://en.wikip...
The "Reverse Engineer Database" mode in Workbench in only part of the paid version not the free one.
Adobe Air - Using multiple SQLite databases at once
|apache-flex|actionscript-3|sqlite|air|
I have 2 SQLite databases, one downloaded from a server (server.db), and one used as storage on the client (client.db). I need to perform various sync queries on the client database, using data from the server database. For example, I want to delete all rows in the client.db tRole table, and repopulate with all rows...
It seems to me that BDD is a broader scope. It almost implies TDD is used, that BDD is the encompasing methodology that gathers the information and requirements for using, amongh other things, TDD practices to ensure rapid feedback.
Also note that you can only use the as keyword with a reference type or a nullable type ie: double d = 5.34; int i = d as int; will not compile double d = 5.34; int i = (int)d; will compile.
[The Dragon Book][1] is definitely the "building compilers" book, but if your language isn't quite as complicated as the current generation of languages, you may want to look at the Interpreter pattern from [Design Patterns][2]. The example in the book designs a regular expression-like language and is well thought t...
C# Treeview & Context Menus
|c#|treeview|
How can I find out which node in a tree list the context menu has been activated for. i.e. right-clicking a node and selecting an option from the menu. I can't use the TreeViews' SelectedNode because the its only been right-clicked and not selected.
I have been using smartassembly. Basically, you pick a dll and it returns it obfuscated. It seems to work fine and I've had no problems so far. Very, very easy to use.
&lt;input type="text" name="foo" **autocomplete="off"**&gt; doesn't that work on major browsers?
Use a non-standard name and id for the fields, so rather than "name" have "name_". Browsers will then not see it as being the name field. The best part about it is that you can do this to some but not all fields and it will autocomplete some but not all fields.
If your looking for a free one you could try DotObfuscator Community Edition that comes with Visual Studio or [Eazfuscator.NET](http://www.foss.kharkov.ua/g1/projects/eazfuscator/dotnet/)
Just set autocomplete="off". There is a very good reason for doing this: You want to provide your own autocomplete functionality! I've used this on at least two occasions.
It sounds like you are probably hitting F5 in Visual Studio when you receive this error? There are a few things you can try. The easiest is to hit the **Stop** button before hitting F5. Optionally, when you are finished debugging and starting to make changes you can go to the **Debug** menu and choose either **Sto...
It sounds like something is eating up your web server's resources. Perhaps you have some resources (file handlers, wcf proxies) that are being opened and not closed? I've had this happen to me specifically when I was not closing WCF client proxy connections. The problem is not necessarily that you have a debugger a...
XML/SWF Charts does Chart off XML: [http://www.maani.us/xml_charts/][1] [1]: http://www.maani.us/xml_charts/
I understand BDD to be more about **specification** than **testing**. It is linked to Domain Driven Design (don't you love these *DD acronyms?). It is linked with a certain way to write user stories, including high-level tests. An example by [Tom Teh Thij][1]: Story: User logging in As a user I...
Here is another article for the [c# programming language][1] c# passes its arguments **by value** (by default) private void swap(string a, string b) { string tmp = a; a = b; b = tmp; } calling this version of swap will thus have no result: string x = "foo"; string y = ...
I know you said flash, but this is a good silverlight chart api. <http://www.visifire.com/>. Always good to keep your options open right? Had to plug silverlight, but you can also take a look at [Yahoo!'s YUI charting](http://developer.yahoo.com/yui/charts/) component.
You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs. void treeView1MouseUp(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { // Select the clicked node ...
What's the best online payment processing solution?
|payment|