instruction
stringlengths
0
30k
Something wrong in the datatime format.
|c#|
When i compile the application in my laptop it runs fine but when i run the same application in the server something is wrong with the date format. But when i checked the system date time format wit my laptop and server it the same format. Can anyone tell me what is wrong.
Something wrong in the datetime format
Assign variables with a regular expression
|.net|regex|string|parsing|
I'm looking for a method to assign variables with patterns in regular expressions with C++ .NET something like String^ speed; String^ size; "command SPEED=[speed] SIZE=[size]" Right now I'm using IndexOf() and Substring() but it is quite ugly
I often like to add a "SortOrder" column to results that I want to sort in a way other than is provided by the data. I usually use an integer and just add it when I am getting the data. I don't show this column and only use it for the purposes of establishing the order. I'm not sure if this is what you are looki...
Longer passwords, or pass-phrases, are harder to crack simply based on length, and easier to remember than requiring a complex password.<br><br> Probably best to go for a fairly long (10+) minimum length, restricting the length useless.
You also have to check the default culture set in the laptop and the server. Are they running in the same culture? Different culture settings will have different default time formats.
I recommend using Apache [HTTPClient][1] instead, because it's a nicer API. But to solve this current problem: try calling connection.setDoOutput(true); after you open the connection. StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservlet's URL"); ...
I recommend using Apache [HTTPClient][1] instead, because it's a nicer API. But to solve this current problem: try calling `connection.setDoOutput(true);` after you open the connection. StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservlet's URL"); ...
Try using the t-sql ISNUMERIC function. That will show you which ones are/are not numeric. You may also need to TRIM or REPLACE spaces to get what you want. For example, to find valid phone numbers, replace spaces with '', test with ISNUMERIC, and test with LEN. Although I will warn you, this will be tedious ...
With simple JavaScript: var split = 'john smith~123 Street~Apt 4~New York~NY~12345'.split('~'); var name = split[0]; var street = split[1]; etc...
I concur -- set your svn tree up, and use rsync over ssh to copy the tree out to the remote locations. rsync will make it fast and efficient, only copying changes rather than full files. You want to export your svn tree to some directory, then rsync from there to the remote host's directory tree.
Is there any good tool for working on Dabtabase apart from Toad which requires license and DBVisualiser not supportive
|sql|database|
Is there any good tool for working on Dabtabase apart from Toad which requires license and DBVisualiser not supportive
Is there any good tool for working on Database apart from Toad which requires license and DBVisualiser not supportive
You can split App.config into multiple configuration files. You just specify the name of the file that contains the config section. Change app.config: <SomeConfigSection> <SettingA/> <SettingB/> </SomeConfigSection> <OtherSection> <SettingX/> </OtherSection> Into app.c...
It also depends on what you care about for your application. For n-tier apps GUIDs/UUIDs are simpler to implement and are easier to port between different databases. To produce Integer keys some database support a sequence object natively and some require custom construction of a sequence table. Integer keys proba...
How to select consecutive elements that match a filter
|javascript|jquery|
Given this example: <img class="a" /> <img /> <img class="a" /> <img class="a" id="active" /> <img class="a" /> <img class="a" /> <img /> <img class="a" /> _(I've just used img tags as an example, that's not what it is in my code)_ Using jQuery, how would you select the i...
Careful with the flatten approach, if search() returned nested arrays then unexpected behaviour might result. profiles = ProfileResource.search(params) profiles = [profiles] if !profiles.respond_to?(:collect) output = profiles.collect do |profile| profile.to_hash end
I think this is fairly simple - monitor so that you can be warned early enough before something goes wrong. That means monitor dependencies and the application itself. It's really hard to provide specifics if you're not going to give details on the application you're monitoring, so I'd say use that as a general rule...
According to the OpenGL Spec: void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar ) Aspect should be a function of your window width and height. Specifically width divided by height (but watch out for division by zero). Perha...
vertical alignment of elements in a div
|html|css|
I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the css needed for this to work on all common browsers? <div id=header"> <img src=".." ></img> ...
Boost::For_each is by far your best bet. The nifty thing is that what they actually give you is the macro BOOST_FOREACH() which you can then wrap and #define to whatever you would really like to call it in your code. Most everyone will opt for the good old "foreach", but other shops may have different coding standards,...
Unless you are willing to duplicate the code in the xref proc, there is no way to avoid using a cursor.
You can't overload methods by varying just the return type. You can use different names: static AObject GetAObject(string id); static BObject GetBObject(string id); Or you can create a class with casting operators: class AOrBObject { string id; AOrBObject(string id) {this.id = id...
Yes, it is possible. This is usually a feature provided by <a href="http://en.wikipedia.org/wiki/Continuous_integration">continuous integration tools</a>. Typically they will get the latest source from version control, build the project, test it (running unit tests) and possibly deploy it on a (test) server. If you...
If you log in to the "Shared Services administration" through the "Central Admin Tool" there is an option "Profile services policies". You can define in here what fields are user-overridable. Hope this helps. Andrew
You are not crazy. It is used internally and not even stored in the database. I wondered the same thing when I first started using FogBugz, but found a forum entry to answer my question. As of today, I still don't think they have implemented it. Jump over to FogCreek and submit a request, if you would like to make ...
In my own wiki I check all the links (without caching), but my wiki is only used by a few people internally. You should benchmark stuff like this.
The only two I have experience with are SVN and Mercurial. For Mercurial, you specify which branch you want it to update from (let's say default) and then whenever you merge a branch into default, you can just have the server run: hg update Which updates your repository to the latest version of the branch you...
No, it's not possible to cache https directly. The whole communication between the client and the server is encrypted. A proxy sits between the server and the client, in order to cache it, you need to be able to read it, ie decrypt the encryption. You can do something to cache it. You basically do the SSL on your pr...
I do it only when it helps with separation of concerns. Like maybe cross-project I would provide an interface for implementers in one of my library project and the implementing project would inject whatever specific implementation they want in. But that's about it... all the other cases it'd just make the system ...
The main difference is that a JSPX file (officially called a 'JSP document') may be easier to work with because the requirement for well-formed XML may allow your editor to identify more typos and syntax errors as you type. However, there are also disadvantages. For example, well-formed XML must escape things like l...
There is no single set of colours that everyone finds legible, but tools exist to formalise the variation and help you to make informed choices. Anyone doing UI should know about automated colour checking for accessibility. Anytime you have text that people need to read, pop the foreground and background colours into t...
I use ApexSQL Diff. It is an excellent tool for doing just what you're describing...compare schema, compare data, generate change scripts. It not free, but it works well.
I use ApexSQL Diff. It is an excellent tool for doing just what you're describing...compare schema, compare data, generate change scripts. It not free, but it works well. *NOTE: ApexSQL Diff only works with SQL Server.*
Hey, look at what I found! http://gafter.blogspot.com/2007/03/compact-object-comparator.html This is exactly what I was looking for.
Think about your design. DI allows you to change how your code functions via configuration changes. It also allows you to break dependencies between classes so that you can isolate and test objects easier. You have to determine where this makes sense and where it doesn't. There's no pat answer. A good rule of th...
> Right now I believe it would make sense for me to target about 2 resolutions and latter learn my customers best needs through feedback? It's a chicken and egg problem. *Ideally* before you develop the product you already know what your customers use/need. *Often* not even the customers know what they need ...
I'd say store the state somewhere on the server and correlate it to the user's session. While a cookie could ostensibly be an equal place to store things, if you consider security and data size, keeping as much data on the server as possible becomes a good thing. For example, in a public terminal setting, would it b...
I'd say store the state somewhere on the server and correlate it to the user's session. While a cookie could ostensibly be an equal place to store things, if you consider security and data size, keeping as much data on the server as possible becomes a good thing. For example, in a public terminal setting, would it b...
Use a byte code cache (ideally APC) so that PHP doesn't need to parse the libraries on each page load. Be aware that using autoload will negate the benefits of using a byte code cache (you can read more about this [here][1]). [1]: http://pooteeweet.org/blog/538/
Could this link be of some help? [Using Templated Controls Programmatically][1] Generating the Templates at Design-Time (in order to persist them in the aspx file) is a little bit trickier. [1]: http://iridescence.no/post/Using-Templated-Controls-Programmatically.aspx
Could this link be of some help? [Using Templated Controls Programmatically][1] Generating the Templates at Design-Time (in order to persist them in the aspx file) is a little bit trickier, but the DataBinding will work automatically. [1]: http://iridescence.no/post/Using-Templated-Controls-Programmatically.asp...
There is an easy way using .Net Framework 3.5 : the library **UI Automation** provides an event focus changed that fires every time the focus change to a new control. [Page on MSDN](http://msdn.microsoft.com/en-us/library/system.windows.automation.automationfocuschangedeventargs.aspx) Sample: public void S...
Are properties accessed by fields still lazy-loaded?
|nhibernate|lazy-loading|
I'm using the field.camelcase in my mapping files to setting things like collections, dependant entities, etc. Will these still be lazy-loaded?
|nhibernate|lazy-loading|c#|.net|
|c#|.net|nhibernate|lazy-loading|
I'm using the field.camelcase in my mapping files to setting things like collections, dependant entities, etc. and exposing the collections as readonly arrays. I know the access strategy does not affect the lazy loading, I just want confirm that this will still be cached: private ISet<AttributeValue> attribute...
OSX Security Framework NameAndPassword sample application
|macos|sfauthorizationpluginview|mac|cocoa|
I am investigating security plugins using SFAuthorizationPluginView under Mac OSX and as a first step looking at the NameAndPassword sample application. The app builds OK but I cannot get it to authenticate. So does anyone have any experience of SFAuthorizationPluginView or any other examples.
For Pointers: I found [this post][1] had very thoughtful discussion about pointers. Maybe that would help. Are you familar with refrences such as in C#? That is something that actually *refers* to something else? Thats probably a good start for understanding pointers. [1]: http://stackoverflow.com/questions/920...
For Pointers: I found [this post][1] had very thoughtful discussion about pointers. Maybe that would help. Are you familar with refrences such as in C#? That is something that actually *refers* to something else? Thats probably a good start for understanding pointers. Also, look at Kent Fredric's post below on an...
What's the best way to determine if a character is a letter in VB6?
|vb6|
Need a function that takes a character as a parameter and returns true if it is a letter (member of the set a..z or A..Z).
Need a function that takes a character as a parameter and returns true if it is a letter.
Learn assembly language and then learn C. Then you will know what the underlying principles of machine are (and thefore pointers). Pointers and classes are fundamental aspects of C++. If you don't understand them then it means that you don't really understand C++. Personally I held back on C++ for several yea...
You'll want to look into JavaScript's [substr][1] or [split][2] as this is not really a task suited for jQuery [1]: http://devguru.com/technologies/javascript/10819.asp [2]: http://devguru.com/technologies/javascript/10816.asp
What's the most current, good practice, and easiest way to use sessions in PHP?
|php|session|
Sessions in PHP seemed to have changed since the last time I used them, so I'm looking for a simple way of using sessions but at the same time for it to be relatively secure and a good common practice.
sp_who2 stored procedure in the master table is nice for this from a database side. It will show you connections to the database. If you're looking for more data try profiling as well.
If you can't see anything that isn't using SSL, then this is usually down to a broken SSL certificate somewhere. I don't know of anything off-hand that will tell you what exactly what the problem is, but you can get a list of everything that's loaded easily enough. The media tab on Firefox's 'page info' dialog (righ...
You can use ssh to forward ports onto somewhere else. If you have two computers, one you browse from, and one which is free to access websites, and is not logged (ie. you own it and it's sitting at home), then you can set up a tunnel between them to forward http traffic over. For example, I connect to my home com...
This is such an open ended question, but I would start with physical measurements. <br /> 1. Are all the machines I think are hosting this site pingable.<br /> 2. Are all the machines who should be serving content serving some content. (Ideally this would be hit from an external network.<br /> 3. Is each expected se...
There are more important considerations when choosing which language you use than the size of the integer. Simply check your input if you don't know if the value is in bounds, or use exception handling if the case is extremely rare.
I believe looping is your best bet. But you could try, each active, and then move before and after until the condition breaks, which if the set is large enough would be faster.
I think I have your poison : http://sourceforge.net/projects/xmlite Cheers
How does one load a URL from a .NET client application
|c#|.net|windows|client|
What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.
System.IO.Path.Combine is the one you're looking for. There's quite a few useful methods on the Path class.
$(window).keypress(function(event) { if (!(event.which == 115 && event.ctrlKey)) return true; alert("Ctrl-S pressed"); event.preventDefault(); return false; }); Key codes can differ between browsers, so you may need to check for more than just 115.
Usually, you would be creating Build projects/scripts in some form or another for your Production, and so putting together another Solution file doesn't come in the picture. It would be easier to train everyone to use project references, and create a directory under the project file structure for external assembly r...
Looking at [your response](http://stackoverflow.com/questions/14614/static-methods-in-an-interfaceabstract-class#14655) I am thinking along the following lines: * You could just have a static method that takes a type parameter and performs the expected logic based on the type. * You could create a virtual method in...
I doubt many VCSs provide this ability directly, however it should be very simple to script. Either a date or branch based checkout.
If you're using XSLT 2.0, it's easy: <xsl:variable name="extension" select="tokenize($filename, '\.')[last()]"/> If you're not, it's a bit harder. There's a good example from the [O'Reilly XSLT Cookbook][1]. Search for "Tokenizing a String." I believe there's also an EXSLT function, if you have that ava...
@Arcturus: > ... clog up your memory and make your > application really slow when they are > not garbage collected. That's blindingly obvious, and I don't disagree. However: > ...you are leaking memory to object > that you no longer use... because > there is a reference to them. "memory is allocated t...
I use revision control for just about all of my documents for any purpose. I'm using Mercurial, so setting up a new repository in a given directory is a matter of a simple "hg init", which I found much less of a hassle than setting up a new Subversion repository. I've also found that RCS is great in any situati...
Implement a service that all connections are created, opened and closed through. Hold a counter there. Log with your logging framework each time a connection is opened or closed.
Pretend a pointer is an array address. x = 500; // memory address for hello; MEMORY[x] = "hello"; print MEMORY[x]; its a graphic oversimplification, but for the most part as long as you never want to know what that number is or set it by hand you should be fine. Back when I understood C I had...
Pretend a pointer is an array address. x = 500; // memory address for hello; MEMORY[x] = "hello"; print MEMORY[x]; its a graphic oversimplification, but for the most part as long as you never want to know what that number is or set it by hand you should be fine. Back when I understood C I had...
We use file templates such as MyApp.config.template and MyWeb.config.template with NAnt properties for the bits that are different between environments. So the template file might look a bit like this: <MyAppConfig> <DbConnString>${DbConnString}</DbConnString> <WebServiceUri uri="${WebServiceUr...
Developing UI in JavaScript using TDD Principles
|user-interface|javascript|tdd|
I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this?
|javascript|tdd|user-interface|
I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual elements first, and then write tests and then code for functional...