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 yet. If you choose anything other than the three above you will - 1. Struggle to find people to work on the project or keep the database going 2. Struggle to motivate your decision without an academic discussion 3. Someone will curse you, your ancestors and your lineage a few years down the line - and replace your choice anyway. Niche databases are not where architectural strides are made - it is technologies like middleware, messaging, cloud services etc where you can afford to (and should) go out on a limb to find good products.
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 Name = "Default Name"; //do anything after variable assignment } public string Name { get; set; } } As this gives you more clear control of the order values are assigned.
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])? Any hint on what appoach works best? [1]: http://blogs.msdn.com/nickkramer/archive/2005/07/14/438640.aspx
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 other alternatives that I am not aware of? (I'm not sure if obfuscator is the right word, it's one of the apps that takes your code and makes it very un-readable)
|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 white space at the top of the page with a message telling people that the code is unavailable, when you just need to scroll down a few pages to get at it. Second, running it through an encoder of some kind, this is so so useful as it can just be run through the decoder. Another method is to reduce variable names to one character and remove white space (this is also an efficiency thing too). There are many other methods. In the end, your efforts are only likely to stop the casual browser from seeing your stuff. If someone dedicated comes along then there is not much you will be able to do. You will have to live with this. My advice would be to make a really awesome product that attracts the most people and beat off any competition by having the best product/service/community and not the most obfusticated code.
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. Since the machines aren't 64bit, then more than likely disabling DEP would be a good logical next step. Vista did get more secure than XP SP2. [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. Since the machines aren't 64bit, then more than likely disabling DEP would be a good logical next step. Vista did get more secure than XP SP2. >Well, I've just turned DEP globally off to no avail. Same error. Well, I also read that people were getting this error after updating a machine to Vista SP1. Do these Vista installs have SP1 on them? [1]: http://en.wikipedia.org/wiki/Data_Execution_Prevention
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 depends on the row index (assuming anotherConditionAtVector has no side effects). So you can do this: - Get the valid positions first using conditionAtVectorPosition (these are the valid columns). - Then get the valid rows using anotherConditionAtVector. - Finally, use conditionAtMatrixRowCol using the valid columns and rows. I hope this helps.
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 + clipping to look unprofessional because of gaps that can appear in the polygons.
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 (;; ++i) if (strcmp(word, array[i]) == 0) break; array[array_len] = NULL; return (i != array_len) ? i : -1; }
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 indication of remaining effort (see [evidence based scheduling](http://www.fogcreek.com/FogBugz/learnmore.html?section=PredictShipDates) in FogBugz) but I don't think you should be allocating to specific sprints - you don't know what'll be in the backlog by the time you get there, for one thing. All you know is that it's going to change, so why waste time on it? 2. There should be a designated user representative. Or more than one, if domain knowledge can't be concentrated in one individual. But someone from the business domain should be in charge overall of deciding what goes into a sprint, subject to the effort available, of course. There can be a place for a Business Analyst type, but they need to be domain experts. If your user(s) can't write stories, even with your help (it's a co-operative thing, or should be) then you all need help. Consider getting a coach involved for a sprint or two. 3. You won't be writing functional specs in an Agile environment. You'll be writing code. Your user will be on hand at all times (or you're already exposed to significant risk) and they're your spec. The story tells you "what", and is going to be a small enough unit of work that you should be able to decide on "how" fairly quickly. And refactor. Always refactor. It's not an overhead, it's part of the process and your design won't evolve satisfactorily without it. 4. If you have VPs (hey, I'm a VP, we're not all bad!) who ask that sort of question, then parts of your company are not getting it yet. Choose someone (the person best able to deal with non-techies, perhaps, or maybe the person least able, since they clearly need the practice) to explain it to them. If what's built is important to them, perhaps their questions are an indication that someone's not as involved as they should be.
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, but you have to take them all with a grain of salt and adopt what you're lacking and skip out on all the other crud that might be unuseful for a particular situation - e.g. the daily scrum. If your co-worker would just like to code in quiet (read Peopleware for why this is a good thing) and she's being a productive team member quit bugging her with your scrumming a let her work in whatever way she likes most. People are usually less "hostile" about these practices if you just approach them and simply say "Do you have a sec? Listen, communication is really a problem right now, I feel like I don't know what you're doing and I really don't want to step on your toes again and spend two days writing something you already did like last week, so let's work on this. I'd like to try X, what do you think?". Be compassionate and don't tolerate "bad apples", that's literally how I agiled up my workplace, and many problems have started evaporating. We're by no means an 100% XP or 100% Scrum compliant place, because we just use whatever works and was needed. [1]: http://steve-yegge.blogspot.com/2006/09/good-agile-bad-agile_27.html
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 complexType and then create an element that references the global type. **Nested** <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="name"> <xs:complexType> <xs:sequence> <xs:element name="firstname"/> <xs:element name="lastname"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="address"> <xs:complexType> <xs:sequence> <xs:element name="street"/> <xs:element name="city"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> **Global** <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="name" type="nameType"/> <xs:element name="address" type="addressType"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="nameType"> <xs:sequence> <xs:element name="firstname"/> <xs:element name="lastname"/> </xs:sequence> </xs:complexType> <xs:complexType name="addressType"> <xs:sequence> <xs:element name="street"/> <xs:element name="city"/> </xs:sequence> </xs:complexType> Hence, my question: When are you using nested types instead of making them global? For anyone interested: My question somehow relates to this question ([XML attribute vs element][1]). [1]: http://stackoverflow.com/questions/33746/xml-attribute-vs-xml-element
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 by recording the value from the compiler intrinsic _ReturnAddress() and ensuring that your exception class constructor is __declspec(noinline). In conjunction with the debug symbol library, I think you could probably get the function name (and line number, if your .pdb contains it) that corresponds to the return address using SymGetLineFromAddr64.
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 have to roll your own catching if you want to catch anything but catching/throwing is a completely separate concern from the using. The finally is almost guaranteed to execute (save an uncatchable exception (e.g. stackoverflow or outofmemory) or someone pulling the power out of the PC).
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 appliance". [2]: http://www.vmware.com/appliances/directory/519 [3]: http://www.ytechie.com/svn-vm [4]: http://www.garghouti.co.uk/vmTrac/
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, however.
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, however.
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 with same resolution? Also I want to print this from so, I can not use auto scroll property of vb.net forms. Thaks
|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 with same resolution? Also I want to print this from so, I can not use auto scroll property of vb.net forms. Thaks
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 LIMIT 5
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> <![CDATA[ [Bindable] public var Title:String = ""; [Bindable] public var Description:String = ""; [Bindable] public var Icon:String = ""; [Bindable] public var FileID:String = ""; private function viewClickHandler():void{ dispatchEvent(new Event("viewClick", true));// bubble to parent } ]]> </mx:Script> <mx:Metadata> [Event(name="viewClick", type="flash.events.Event")] </mx:Metadata> <mx:Label x="11" y="9" text="{String(Title)}" styleName="listItemLabel"/> <mx:TextArea x="11" y="25" height="36" width="170" backgroundAlpha="0.0" alpha="0.0" styleName="listItemDesc" wordWrap="true" editable="false" text="{String(Description)}"/> <mx:Button x="20" y="65" label="View" click="viewClickHandler();" styleName="listItemButton" height="22" width="60"/> <mx:LinkButton x="106" y="68" label="Details..." styleName="listItemLink" height="18"/> <mx:HRule x="0" y="101" width="215"/> </mx:Canvas> The Repeater <mx:Canvas id="pnlSpotlight" label="SPOTLIGHT" height="100%" width="100%" horizontalScrollPolicy="off"> <mx:VBox width="100%" height="80%" paddingTop="2" paddingBottom="1" verticalGap="1"> <mx:Repeater id="rptrSpotlight" dataProvider="{aSpotlight}"> <sm:SmallCourseListItem viewClick="PlayFile(event.currentTarget.getRepeaterItem().fileName);" Description="{rptrSpotlight.currentItem.fileDescription}" FileID = "{rptrRecentlyViewed.currentItem.fileName}" Title="{rptrSpotlight.currentItem.fileTitle}" /> </mx:Repeater> </mx:VBox> </mx:Canvas> Handling function private function PlayFile(fileName:String):void{ Alert.show(fileName.toString()); }
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 up the display list and reach your main application. Now on your main application you can listen to that event and play the correct file. Hope this helps.
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/questions/2658/version-control-getting-started#2668 [2]: http://stackoverflow.com/questions/2658/version-control-getting-started [3]: http://stackoverflow.com/users/413/jon-works
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 making it easier for one group of people ("users with co-ordination difficulties") but making it difficult for others (anyone with Javascript turned off for some reason). You may want to look into adding some alternatives - mouse controlled hover menu for those comfortable with the mouse; keyboard based control via access keys and the like for others.
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("<foo/>") print(dtd.validate(root)) # True root = etree.XML("<foo>bar</foo>") print(dtd.validate(root)) # False print(dtd.error_log.filter_from_errors()) # <string>:1:0:ERROR:VALID:DTD_NOT_EMPTY: Element foo was declared EMPTY this one has content
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.codeproject.com/KB/cs/NHibernate_IInterceptor.aspx
|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.codeproject.com/KB/cs/NHibernate_IInterceptor.aspx
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 try portablepy to have your app run on Windows environment without Python.
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 (...) continue outer_loop; // more code } // more code } Yes, cases like this do happen all the time. What are people suggesting I use instead? A boolean condition like this? for (...) { // some code boolean continueOuterLoop = false; for (...) { // some code if (...) { continueOuterLoop = true; break; } // more code } if (continueOuterLoop) continue; // more code } **Yuck!** Refactoring it as a method doesn't alleviate that either: boolean innerLoop (...) { for (...) { // some code if (...) { return true; } // more code } return false; } for (...) { // some code if (innerLoop(...)) continue; // more code } Sure it's a little prettier, but it's still passing around a superfluous boolean. And if the inner loop modified local variables, refactoring it into a method isn't always the correct solution. So why are you all against labels? Give me some solid reasons, and practical alternatives for the above case.
"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 a trigger or need to index on a function, requiring that some code be placed into the database. In that case all the usual "which language should I use?" questions come up. If you only need a little logic, the most-portable language should probably be used (pl/pgSQL). If you need to do some serious programming though, you might be better off using a more expressive language (maybe pl/ruby). This will always be a judgment call. "is there any valid reason to use an untrusted language?" As above, yes. Again, putting direct file access (for example) into your middle tier is best when possible, but if you need to fire things off based on triggers (that might need access to data not available directly to your middle tier), then you need untrusted languages. It's not ideal, and should generally be avoided. And you definitely need to guard access to it. [1]: http://en.wikipedia.org/wiki/Multitier_architecture
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 problems that turned out to be related to the various configuration (size) settings on both the client and server. I think I ended up modifying almost all of them, ex. MaxBufferPoolSize, MaxBufferSize, MaxConnections, MaxReceivedMessageSize, etc. Having said that, the SvcTraceViewer utility also mentioned is great. I did run into a few cases where it wasn't as helpful as I would have liked, but overall it's a nice tool for analyzing the communications flow and errors.
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://www.mediawiki.org/wiki/Extension:PHPBB/Users_Integration][3] [1]: http://www.single-signon.com [2]: http://www.single-signon.com/en/applications.html [3]: http://www.mediawiki.org/wiki/Extension:PHPBB/Users_Integration
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] } hash #=> {"cat"=>1, "wombat"=>3, "dog"=>2}
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 time.
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. Since the machines aren't 64bit, then more than likely disabling DEP would be a good logical next step. Vista did get more secure than XP SP2. >Well, I've just turned DEP globally off to no avail. Same error. Well, I also read that people were getting this error after updating a machine to Vista SP1. Do these Vista installs have SP1 on them? >Turns out to be something completely different. Just for the sake of testing, I've disabled de UAC (note: I was not getting any prompt). Great, I was actually going to suggest that, but I figured you probably tried it already. [1]: http://en.wikipedia.org/wiki/Data_Execution_Prevention
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 because they'll eventually will break any kind of protection you create anyway. and it is espcially easy in scripted language where the code is not compiled. If you are using some other language, maybe java or .NET, You can try doing things like "calling home" to verify that a license number matches a given url. Which works if you your app is some sort of online app that is going to be connected online all the time. But having access to the source, people can easily bypass that part. In short, javascript is a poor choice for what you are doing.
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 because they'll eventually will break any kind of protection you create anyway. and it is espcially easy in scripted language where the code is not compiled. If you are using some other language, maybe java or .NET, You can try doing things like "calling home" to verify that a license number matches a given url. Which works if you your app is some sort of online app that is going to be connected online all the time. But having access to the source, people can easily bypass that part. In short, javascript is a poor choice for what you are doing. A step up from what you are doing is maybe using a webservice backend to get your data. Let the webservice handle the authentication/verification process. Requires a bit of work to make sure it is bulletproof, but it *might* work
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 the fourth "column" and gives me what I need; a natural result set (its coming over AJAX), and a wildcard result set following right after. :) /mp
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 GROUP BY B it delivers 5 results total, sorts from the fourth "column" and gives me what I need; a natural result set (its coming over AJAX), and a wildcard result set following right after. :) /mp
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 GROUP BY B ORDER BY 1 DESC it delivers 5 results total, sorts from the fourth "column" and gives me what I need; a natural result set (its coming over AJAX), and a wildcard result set following right after. :) /mp
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 it's null, IllegalArgument.
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, '.', '') Which returns the desired 123 and 1999, but I was wondering if there was a better way. Any thoughts?
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 enough that they could be run at low-use periods of the day.
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 services that is *unknown* at compile time, then you would want a more dynamic approach, where you deduce the 'shape' of the web service. But start by using the auto generated proxy class, and don't worry about it until you hit a limitation. And when you do -- come back to stack overflow ;-)
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 * Set a long lived cookie on the client which combines the user id and the random value * When a new session starts, check for the existence of the id/value cookie and authenticate the new user if they match. The author also recommends invalidating the random value and resetting the cookie at every login. Personally I don't like that as you then can't stay logged into a site on two computers. I would tend to make sure my password changing function also reset the random value thus locking out sessions on other machines. As a final note, the advice he gives on making certain functions (password change/email change etc) unavailable to auto authenticated sessions is well worth following but rarely seen in the real world. [1]: http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice
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 BindingContext to get a ConcurrenyMangager that wraps the list. The ConcurrenyManager keeps track of such things as the current selected position in the list. When you set the DataSource of the second ComboBox it will use the same BindingContext (the forms) which will yield a reference to the same ConcurrencyManager as above used to set up the data bindings. To get a more detailed explanation see [BindingContext][1]. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingcontext.aspx
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 database instance, I use two techniques: # Database Upgrade Scripts A sequence database upgrade scripts that contain the DDL necessary to move the schema from version N to N+1. (These go in your version control system.) A _version_history_ table, something like create table VersionHistory ( Version int primary key, UpgradeStart datetime not null, UpgradeEnd datetime ); gets a new entry every time an upgrade script runs which corresponds to the new version. This ensures that it's easy to see what version of the database schema exists and that database upgrade scripts are run only once. Again, these are **not** database dumps. Rather, each script represents the **changes** necessary to move from one version to the next. They're the script that you apply to your production database to "upgrade" it. # Developer Sandbox Synchronization 1. A script to backup, sanitize, and shrink a production database. Run this after each upgrade to the production DB. 2. A script to restore (and tweak, if necessary) the backup on a developer's workstation. Each developer runs this script after each upgrade to the production DB. _A caveat: My automated tests run against a schema-correct but empty database, so this advice will not perfectly suit your needs._
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 time for something that works in both Oracle and MySQL. [@Espo](http://stackoverflow.com/questions/39576/best-way-to-do-multi-row-insert-in-oracle#39602)'s solution is also a good one that will work in both Oracle and MySQL if your data isn't already in a table. It also works in both Oracle and MySQL.
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 time for something that works in both Oracle and MySQL. [@Espo](http://stackoverflow.com/questions/39576/best-way-to-do-multi-row-insert-in-oracle#39602)'s solution is also a good one that will work in both Oracle and MySQL if your data isn't already in a table.
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> <xsl:apply-templates select="comments/comment"/> </ul> </xsl:if>
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. The language is C# and we're using Visual Studio 2005. Thanks, Daisuke
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++) { sum += i; } // Next coding statement is a space below the bracket return sum; I do not like: int total = 10;int sum = 0; for (int i = 0; i < total; i++) { sum += i; } return sum; What I also put in Brackets even though technically they are not needed. The best example is the if statement. I find it greatly helps readability. if(true) // some action if(true) { // Some action } The best code to me, is one that as simple as possible. With the least comments as possible, and most importantly ***works***.
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 connection; if your application uses a named "sa" account or other user accounts, the "user" field will only reflect "sa". This can be overriden by creating a named SQL Server account for each and every user of the application, but this will be impractical for non-intranet, public facing web applications, for example.
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 utilities, e.g. if I set the i variable to be a register variable ? int lookup(char *word, char*array[]) { int i for (i = 0; array[i] != NULL; i++) if (strcmp(word, array[i]) == 0) return i; return -1; }
|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 decision by my good self.
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 by my good self. As Mentioned in the accepted answer BorderStyle := bsNone; was part of the way to do it. Strangely I kept getting a E2010 Incompatible types: 'TFormBorderStyle' and 'TBackGroundSymbol' error when using that line (another type had 'bsNone' defined). To overcome this I had to use : BorderStyle := Forms.bsNone;
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: public void lookMumNoLabels() { for (...) { // some code doMoreInnerCodeLogic(...); } } private void doMoreInnerCodeLogic(...) { for (...) { // some code if (...) return; } } But there would be examples where that kind of refactoring doesn't sit correctly with whatever logic you're doing. [1]: http://stackoverflow.com/questions/15481/java-coding-standard-best-practices-labeled-brakecontinue#15939