instruction
stringlengths
0
30k
I second the recommendation of the Igor naming guide. Stay away from meaningless strings of alternating vowels and consonants: altana, obito, temora, even if it seems easy and the domains are readily available. Pick something with soul and meaning. Best example: "Plan B" (also known as the morning-after pill).
@Sam I know this question was about Windows Forms, but you should definitely start looking at WPF. This sort of scenario is *really* easy in WPF with DataTemplates and TemplateSelectors.
how about you use drupal but scale down and code it according to your needs. definitely will be faster than code-from-scratch-with-framework
Can you get the control to run the way you want it in a webpage/browser? If yes (and the problem is with winforms, I'd just embed it in a browser control. If no, I'd as the creators directly.
In PHP, is there an easy way to get the first and last date of a month?
|php|
I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this?
- Linux, Web Hosted - MySQL (PostreSQL maybe) - Mainstream SME - MS SQL - Big Iron (banking etc) - Oracle Thinking about anything other than those three is masturbation - any of the other databases becomes a discussion about niche products to solve particular problems that you probably haven't encountered ye...
when you integrate the system. Just remember 2 things: 1. Login to system<br/> Check username/password with both systems. 2. Change of Password<br/> Update the password on both systems.
When you inline an initial value for a variable it will be done implicitly in the constructor anyway. I would argue that this syntax is best practice: class Person { public Person() { //do anything before variable assignment //assign initial values ...
How well does WPF blend with XNA in real life?
|wpf|interop|xna|direct3d|
I understand that there are several ways to blend XNA and WPF within the same application. I find it enticing to use WPF for all GUI and HUD stuff in my XNA games. Does anyone have any practical experience on how well this approach works in real life using .NET 3.5 SP1 ? Any pitfalls (such as the ["airspace problem"][1...
Is obfuscator Javascript enough?
|javascript|
I'm working on building a development tool that is written in Javascript. This will not be an open source project and will be sold (hopefully) as a commercial product. I'm evaluating the best way to protect my investment. Is using an obfuscator (code mangler) enough to reasonably secure the code? Are there oth...
|javascript|obfuscation|
I think that you're consistent is more important than what conventions you go with. As far as future-proofing yourself, that's a matter of the code that you're making a framework for. It's a lot easier to build on a brick house than a sand one.
You are going to be fighting a loosing battle if you try to obfuscate your code in the hopes of someone not stealing it. You may stop the casual browser getting at it, but someone dedicated would almost certinly be able to overcome any measure you use. In the past I have seen people do several things; Paste a lot of...
Is the machine you have the code deployed on a 64-bit machine? You could also be running into a [DEP][1] issue. [1]: http://en.wikipedia.org/wiki/Data_Execution_Prevention
Is the machine you have the code deployed on a 64-bit machine? You could also be running into a [DEP][1] issue. Edit >This is a 1st gen Macbook Pro with a 1st gen Core Duo 2 Intel processor. Far from 64 bits. I mentioned 64 bit, because at low levels structs from 32 bit to 64 bit do not get properly handled. ...
Is the machine you have the code deployed on a 64-bit machine? You could also be running into a [DEP][1] issue. Edit >This is a 1st gen Macbook Pro with a 1st gen Core Duo 2 Intel processor. Far from 64 bits. I mentioned 64 bit, because at low levels structs from 32 bit to 64 bit do not get properly handled. ...
From reading your code. - I noticed your eliminating the invalid vector positions at conditionAtVectorPosition then you remove the invalid rows at anotherConditionAtVector. - It seems that checking rows at anotherConditionAtVector is redundant since whatever the value of idx is, anotherConditionAtVector only ...
The bug is that both line segments should be drawn identical but they are not because the spike that is drawn within the clipping region is completely within the clipping region and should not be clipped in any way but it is. This is a very annoying but that results in any software that uses drawlines heavily + clippin...
There is well-known technique as sentinal method. To use sentinal method, you must know about the length of "array[]". You can remove "array[i] != NULL" comparing by using sentinal. int lookup(char *word, char*array[], int array_len) { int i = 0; array[array_len] = word; for (;;...
Let's see if my take adds anything (not certain by any means...) 1. I'm not sure about the "assigning a release to each one" thing. I thought the idea was to put a "price" on each story/function point/unit of development and pick what goes into the current sprint. Everything else is backlog - you can offer some indi...
beaudetious, buddy, I would really suggest you read Steve Yegge's blog called ["Good Agile, Bad Agile"][1]. It's an oldy but a goody, and I think it's a must read for anyone - like myself about 2 months ago - who gets a little let's say "over-eager" to agile-up their workplace. Agile offers a lot of good practices...
Not sure if it's the best way, but this works: <pre><code>a = ["apple", 1, "banana", 2] m1 = {} for x in (a.length / 2).times: m1[a[x*2]] = a[x*2 + 1] end b = [["apple", 1], ["banana", 2]] m2 = {} for x,y in b: m2[x] = y end </code></pre>
[Best Practices] XSD: Nested Types vs Global Types
|xml|xsd|
When defining XSD you can either choose to define your types as *nested* types or *global* types (complexType). I understand that global types are of much more use when it comes to morphism or reusing of elements. However, if you have a big data model you would have to define for each level a global complexTyp...
There's no standard way to do this. Further, the call stack must typically be recorded at the time of the exception being _thrown_; once it has been _caught_ the stack has unrolled, so you no longer know what was going on at the point of being thrown. In VC++ on Win32/Win64, you _might_ get usable-enough results ...
Yeah there is nothing different about throwing exceptions in using blocks. Remember that the using block basically translates to: IDisposable disposable = null; try { disposable = new WhateverYouWantedToMake(); } finally { disposable.Dispose() } So you will hav...
One major tip to ease the setup of an SVN server right now is to use a Virtual Appliance. That is, a virtual machine that has subversion pre-installed and (mostly) pre-configured on it - pretty much a plug & play thing. You can try [here][2], [here][3] and [here][4], or just try searching Google on "subversion virtual ...
If you don't need the default item to be selectable you can use the <code>prompt</code> property of <code>ComboBox</code> and set the <code>selectedIndex</code> to -1. That will show the string you set <code>propmt</code> to as the selected value until the user chooses another. If will not appear in the list of options...
If you don't need the default item to be selectable you can use the <code>prompt</code> property of <code>ComboBox</code> and set the <code>selectedIndex</code> to -1. That will show the string you set <code>propmt</code> to as the selected value until the user chooses another. It will not appear in the list of options...
VB.NET form Height Question
|vb.net|
I have a VB6.0 project and I want to convert it in VB.Net. In my VB6.0 application some of the MDI Child form’s height is 17000 and width is 13000. Now I want to set the same form size in VB.Net forms, but it allows maximum form width = 1036, height = 780 for resolution 1024x768. How can I increase form size ...
|winforms|vb.net|
I have a VB6.0 project and I want to convert it in VB.Net. In my VB6.0 application some of the MDI Child form’s height is 17000 and width is 13000. Now I want to set the same form size in VB.Net forms, but it allows maximum form width = 1036, height = 780 for resolution 1024x768. How can I increase form size wi...
Can you do it as a subselect, something like select * from ( SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ) ORDER BY B ASC LI...
Can you do it as a subselect, something like select * from ( SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' ) ORDER BY B ASC LIMIT 5
Figured it out (finally) Custom Component <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" x="0" y="0" width="215" height="102" styleName="leftListItemPanel" backgroundColor="#ECECEC" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:Script> <![C...
On your custom component you can listen to the button click event and then generate a custom event that holds information about the file you want to play. You can then set the bubbles property to true on the event and dispatch the custom event from your custom component. The bubbles property will make your event float ...
The [answer][1] to [another question][2] also applies here, most importantly >[Jon Works][3] said: >The most important thing about version control is: > >*JUST START USING IT* His answer goes into more detail, and I don't want to be accused of plaigerism so take a look. [1]: http://stackoverflow.com/qu...
You won't be able to get a pure CSS drop down menu with the functionality you require. You'll have to use some kind of Javascript. Either a library like JQuery that has been mentioned or by modifying the Suckerfish code to use onclick instead of onmouseover/out. But by going an all Javascript route you could be ma...
Another good option is [lxml's validation](http://codespeak.net/lxml/validation.html) which I find quite pleasant to use. A simple example taken from the lxml site: from StringIO import StringIO from lxml import etree dtd = etree.DTD(StringIO("""<!ELEMENT foo EMPTY>""")) root = etree.XML("<...
Data Auditing in NHibernate and SqlServer
|nhibernate|sql-server|data|audit|
I'm using NHibernate on a project and I need to do data auditing. I found [this article][1] on codeproject which discussed the IInterceptor interface. What is your preferred way of auditing data? Do you use database triggers? Do you use something similar to what's dicussed in the article? [1]: http://www.cod...
|sql-server|nhibernate|data|audit|
I'm using NHibernate on a project and I need to do data auditing. I found [this article][1] on codeproject which discusses the IInterceptor interface. What is your preferred way of auditing data? Do you use database triggers? Do you use something similar to what's dicussed in the article? [1]: http://www.cod...
For the GUI itself: [PyQT][1] is pretty much the reference. Another way to develop a rapid user interface is to write a web app, have it run locally and display the app in the browser. [1]: http://wiki.python.org/moin/PyQt Plus, if you go for the Tkinter option suggested by lubos hasko you may want to t...
I don't understand where this "don't use labels" rule comes from. When doing non-trivial looping logic, the test to break or continue isn't always neatly at the end of the surrounding block. outer_loop: for (...) { // some code for (...) { // some code if (...) c...
"isn't that [text manipulation] more of something that should be programmed into the application?" Usually, yes. The generally accepted "[three-tier][1]" application design for databases says that your logic should be in the middle tier, between the client and the database. However, sometimes you need some logic in ...
If you're using SOAP web services then [SOAP faults][1] are the standard way to return error details, where the fault messages can return whatever additional detail you like. [1]: http://www.w3schools.com/SOAP/soap_fault.asp
I think Darren is most likely correct - the default values provided for WCF are laughably small and if you bump into them you end up with errors that can be difficult to track down. They seem to appear as soon as you attempt to do anything beyond a simple test case. I wasted more time than I'd like to admit debugging ...
If you're integrating a bunch of different apps, and you really just want a bridge, I've had good success with the bridge from [Single-Signon.com][1]. You can see there supported apps here: [http://www.single-signon.com/en/applications.html][2] I've also used a MediaWiki extension for phpBB integration: [http://ww...
If the numeric values are seq indexes, then we could have simpler ways... Here's my code submission, My Ruby is a bit rusty input = ["cat", 1, "dog", 2, "wombat", 3] hash = Hash.new input.each_with_index {|item, index| if (index%2 == 0) hash[item] = input[index+1] } ...
If you have the values that you want to insert in another table already, then you can Insert from a select statement. INSERT INTO a_table (column_a, column_b) SELECT column_a, column_b FROM b_table; Otherwise, you can list a bunch of single row insert statements and submit several queries in bulk to save the ...
Is the machine you have the code deployed on a 64-bit machine? You could also be running into a [DEP][1] issue. Edit >This is a 1st gen Macbook Pro with a 1st gen Core Duo 2 Intel processor. Far from 64 bits. I mentioned 64 bit, because at low levels structs from 32 bit to 64 bit do not get properly handled. ...
code obfuscator is enough for something that needs minimal protection, but I think it will definitely not enough to really protect you. if you are patient you can realy de-mangle the whole thing.. and i'm sure there are programs to do it for you. That being said, you can't stop anyone from pirating your stuff becaus...
code obfuscator is enough for something that needs minimal protection, but I think it will definitely not enough to really protect you. if you are patient you can realy de-mangle the whole thing.. and i'm sure there are programs to do it for you. That being said, you can't stop anyone from pirating your stuff becaus...
How Automated is too automated when it comes to deployment?
|build-automation|production|
I have ci, so our staging environment builds itself. Should I have a script that not only builds production but does all the branching for it as well? When you have 1 code base on 2 different urls with skinning, should they be required to build at once?
I'm not a Java developer, but just from the sound of it, it seems like an IllegalArgumentException is called for if you don't want null to be an allowed value, and the NullPointerException would be thrown if you were trying to *use* a variable that turns out to be null.
Thanks! I eventually (looking at all suggestions) came to this solution, its a bit of a compromise between what I need and time. SELECT A, B, C, "1" FROM table WHERE B LIKE 'query%' LIMIT 4 UNION SELECT A, B, C, "2" FROM table WHERE B LIKE '%query%' LIMIT 6 it delivers 6 results total, sorts from...
Thanks! I eventually (looking at all suggestions) came to this solution, its a bit of a compromise between what I need and time. SELECT * FROM (SELECT A, B, C, "1" FROM table WHERE B LIKE 'query%' LIMIT 3 UNION SELECT A, B, C, "2" FROM table WHERE B LIKE '%query%' LIMIT 5) AS RS ...
Thanks! I eventually (looking at all suggestions) came to this solution, its a bit of a compromise between what I need and time. SELECT * FROM (SELECT A, B, C, "1" FROM table WHERE B LIKE 'query%' LIMIT 3 UNION SELECT A, B, C, "2" FROM table WHERE B LIKE '%query%' LIMIT 5) AS RS ...
I have had the same problem in the past on many sites I have done here at work. The only guaranteed method of making sure the user gets the email is to advise the user to add you to there safe list. Any other method is really only going to be something that can help with it and isn't guaranteed.
If it's a setter method and null is being passed to it, I think it would make more sense to throw an IllegalArgumentException. A NullPointerException seems to make more sense in the case where you're attempting to actually use the null. So, if you're using it and it's null, NullPointer. If it's being passed in and i...
T-Sql Remove Decimal Point From Money Data Type
|sql-server|t-sql|
Given the constraint of only using T-Sql in Sql Server 2005, is there a better way to remove the decimal point from a money datatype than a conversion to a varchar (here implicitly) and then a replace of the decimal point? Here is what I have currently. SELECT REPLACE(1.23, '.', ''), REPLACE(19.99, '.', '') ...
How much writing vs. reading of this table(s) do you expect? I've used a single audit table, with columns for Table, Column, OldValue, NewValue, User, and ChangeDateTime - generic enough to work with any other changes in the DB, and while a LOT of data got written to that table, reports on that data were sparse enou...
No, what you're doing is fine. Don't let those people confuse you. If you've written the web services with .net then the reference proxies generated by .net are going to be quite suitable. The situation you describe (where you are both producer and consumer) is the ideal situation. If you need to connect to a web...
You should almost certainly not be extending the session cookie to be long lived. Although not dealing specifically with rails [this article][1] goes to some length to explain 'remember me' best practices. In summary though you should: * Add an extra column to the user table to accept a large random value * S...
open up a terminal (Applications->Utilities->Terminal) and type this in: locate InsertFontHere This will spit out every file that has the name you want. Warning: there may be alot to wade through.
This has to do with how data bindings are set up in the dotnet framework, especially the BindingContext. On a high level it means that if you haven't specified otherwise each form and all the controls of the form share the same BindingContext. When you are setting the DataSource property the ComboBox will use the Bindi...
Martin Fowler wrote my favorite article on the subject, <http://martinfowler.com/articles/evodb.html>. I choose not to put schema dumps in under version control as _alumb_ and others suggest because I want an easy way to upgrade my production database. For a web application where I'll have a single production datab...
If you have the values that you want to insert in another table already, then you can Insert from a select statement. INSERT INTO a_table (column_a, column_b) SELECT column_a, column_b FROM b_table; Otherwise, you can list a bunch of single row insert statements and submit several queries in bulk to save the ...
If you have the values that you want to insert in another table already, then you can Insert from a select statement. INSERT INTO a_table (column_a, column_b) SELECT column_a, column_b FROM b_table; Otherwise, you can list a bunch of single row insert statements and submit several queries in bulk to save the ...
there is no need to put that into a <xsl:variable name="length" select="count(nodes/node)"/> though... you can just print it out as follows: <xsl:value-of select="count(nodes/node)"/> or use it in a if-clause as follows: <xsl:if test="count(comments/comment) > '0'"> <ul> ...
Good Way to Debug Visual Studio Designer Errors
|visual-studio|gui-designer|
Does anyone know a good way to debug errors in the Visual Studio Designer? In our project we have tons of UserControls and many complex forms. For the complex ones, the Designer often throws various exceptions which doesn't help much and was wondering if there's some nice way to figure out what has gone wrong. ...
I personally think that integration login systems is one of, if not the, hardest job when utilizing multiple prebuilt applications. As a fan of reuse and modularity, I find this disappointing. If anyone knows of any easy ways to handle this problem between random app X and random app Y, I would love to know.
I am most likely in the minority, but I don't mind whitespace. I LOVE WHITESPACE. Since the compiler takes it out and HD space being so cheap I like to have white space in my code. For example I like: int total = 10; int sum = 0; for (int i = 0; i < total; i++) ...
I prefer the CodeProject approach you mentioned. One problem with database triggers is that it leaves you no choice but to use Integrated Security coupled with ActiveDirectory as access to your SQL Server. The reason for that is that your connection should inherit the identity of the user who triggered the connectio...
Optimizing a search algorithm in C
|c|perfornance|optimization|algorithm|
Can the performance of this sequential search algorithm (taken from [The Practice of Programming](http://books.google.co.uk/books?id=to6M9_dbjosC&dq=the+practice+of+programming&pg=PP1&ots=3YH6Ggq0_a&sig=F2-ajdO37xA4iRec2sCyQF55Jjc&hl=en&sa=X&oi=book_result&resnum=1&ct=result)) be improved using any of C's native util...
|c|performance|algorithm|optimization|
What is the best way to make a Delphi Application completely full screen ?
|delphi|
What is the best way to make a delphi application (delphi 2007 for win32 here) go completely full screen, removing the application border and covering windows task bar ? I am looking for something similar to what IE does when you hit F11. I wish this to be a run time option for the user not a design time decisi...
What is the best way to make a delphi application (delphi 2007 for win32 here) go completely full screen, removing the application border and covering windows task bar ? I am looking for something similar to what IE does when you hit F11. I wish this to be a run time option for the user not a design time decision...
wrt [sadie's code example][1]: You gave outerloop: for (...) { // some code for (...) { // some code if (...) continue outerloop; // more code } // more code } As an example. You make a good point. My best guess would be: ...