instruction
stringlengths
0
30k
⌀
What is the correct way of getting the start and end date of a ISO week number in TSQL?
|t-sql|datetime|iso|
I have the ISO week and year but how do I correctly convert that into two dates representing the start and end of that week?
I would say it depends on the application of your database. The biggest problem is, where do you store the encryption key? Because if the hacker has excess to anything more than your DB, all your efforts are probably wasted. (Remember, your application will need that encryption key to decrypt and encrypt so eventual...
My Java experience is not that high either, so anyone feel free to correct me. But AFAIK, the general convention is to write two methods like so: public string getMyString() { // return it here } public void setMyString(string myString) { // set it here }
I don't think there is any work around for the integrated windows authentication. What you could possibly do is save the files to a generic unprotected folder and, in the case of swfupload, use a handler to move the file when its fully uploaded
The instance of the inner class is created when instance of the outer class is created. Therefore the members and methods of the inner class have access to the members and methods of the instance (object) of the outer class. When the instance of the outer class goes out of scope, also the inner class instances cease to...
substr($string, strpos(wordwrap($string, $your_desired_witdh), "\n"));
By using the [wordwrap][1] function. It splits the texts in multiple lines such that the maximum width is the one you specified, breaking at word boundaries. After splitting, you simply take the first line: substr($string, 0, strpos(wordwrap($string, $your_desired_width), "\n")); One thing this oneliner doesn...
Stack: - Stored in computer RAM like the heap. - Variables created on the stack can go out of scope. - Faster to allocate in comparison to variables on the heap. - Implemented with an actual stack data structure. - Stores local data, return addresses, used for parameter passing Heap: - Stor...
Stack: - Stored in computer RAM like the heap. - Variables created on the stack will go out of scope and automatically deallocate. - Much faster to allocate in comparison to variables on the heap. - Implemented with an actual stack data structure. - Stores local data, return addresses, used for paramet...
Stack: - Stored in computer RAM like the heap. - Variables created on the stack will go out of scope and automatically deallocate. - Much faster to allocate in comparison to variables on the heap. - Implemented with an actual stack data structure. - Stores local data, return addresses, used for paramet...
We are using SourceForge Enterprise Edition 4.4 in one of our project. My question is, in CollabNet SFEE (SourceForge Enterprise Edition 4.4), how will we get attachments associated with an Artifacts Using SFEE SOAP API? We have made our own .net 2.0 client. We are not using .net SDK provided by Collabnet,
I think I thought of a solution that would work: D = data to encrypt h1 = hash(userpassword) h2 = hash(companyPassword) k = h1 concat h2 E = function to encrypt //C is the encrypted data C = E_h1(h2) concat E_h2(h1) concat E_k(D) Then either person can decrypt the hash of t...
Yes, all that stuff should be fine (motherboard and CPU hardware, motherboard drivers, video card drivers).
Ping google.com though each NIC.
I've got to disagree with Josh. What happens if you're using a huge hierarchical structure like a company organization. People can join/leave the company, change reporting lines, etc... Maintaining the "distance" would be a big problem and you would have to maintain two tables of data. This query (SQL Server 2005 ...
One or Two Primary Keys in Many-to-Many Table?
|database|data-structures|schema|indexing|
I have the following tables in my database that have a many-to-many relationship, which is expressed by a connecting table that has foreign keys to the primary keys of each of the main tables: - Widget: WidgetID (PK), Title, Price - User: UserID (PK), FirstName, LastName Assume that each User-Widget combinat...
Because of Perl operator precedence the statement is being parsed as: ($condition ? $a= 2 : $a ) = 3 ; Because the ?: operator produces an assignable result, 3 is assigned to the result of the condition. When $condition is true this means $a=2=3 giving $a=3 When $condition is false this means $a=3 givin...
Because of Perl operator precedence the statement is being parsed as: ($condition ? $a = 2 : $a ) = 3 ; Because the ?: operator produces an assignable result, 3 is assigned to the result of the condition. When $condition is true this means $a=2=3 giving $a=3 When $condition is false this means $a=3 givi...
You could use Silverlight or Flash or some custom plugin to allow managed uploads, where you can display a progress bar for example. There isn't much you can do about upload speeds but you can at least show them progress while it's going on. I don't know of any canned upload programs you can use but it shouldn't be ...
I know Adobe Flex has a few graph visualization components out there, and of course that would enable the app to run on Flash which has an excellent penetration rate into your potential userbase. I'd Google up the Flex SpringGraph component, and check that out. There are a ton of graphing components in the wild for Fle...
A good reference book to check out is "Microsoft Mobile Development Handbook" by Wigley, Moth, and Foot. It covers a lot of topics in mobile development with the .NET compact framework, and also the Windows Mobile platform. You also might want to learn about Windows CE, which Windows Mobile is a flavor of. A good...
Also, you might try adding the scrollbar once your textfield is initialized from a separate function similar to this: private function assignScrollBar(tf:TextField, sb:UIScrollBar):void { trace("assigning scrollbar"); sb.move(tf.x + tf.width, tf.y); sb.setSize(15, tf.height...
REST is a fundamentally different paradigm from SOAP. A good read on REST can be found here: [How I explained REST to my wife][1]. If you don't have time to read it, here's the short version: REST is a bit of a paradigm shift by focusing on "nouns", and restraining the number of "verbs" you can apply to those nouns...
Your app likely hadn't finished printing yet when you quit it. If you're using evince to print a PDF or other document, this is a known bug--there is no visual confirmation that the printing operation is underway. If the print job has been submitted, a printer icon will appear in your system tray until the actual pri...
User smart pointers everywhere you can! Whole classes of memory leaks just go away.
How do I get ms-access to connect to ms-sql as a different user?
|ms-access|odbc|ms-sql|
How do I get ms-access to connect (through ODBC) to an ms-sql as a different user than their Active Directory ID? I don't want to specify an account in the ODBC connection, I want to do in the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to the original situati...
|sql-server|ms-access|odbc|
How do I get ms-access to connect (through ODBC) to an ms-sql database as a different user than their Active Directory ID? I don't want to specify an account in the ODBC connection, I want to do it on the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to the orig...
How do I get ms-access to connect (through ODBC) to an ms-sql database as a different user than their Active Directory ID? I don't want to specify an account in the ODBC connection, I want to do it on the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to the orig...
In some cases this is obsolete due to optimisations performed by the compiler, but the general issue is that code like: string myString=""; for(int i=0;i<x;i++) { myString += "x"; } will act as below (each step being the next loop iteration): 1. construct a string object of length ...
In some cases this is obsolete due to optimisations performed by the compiler, but the general issue is that code like: string myString=""; for(int i=0;i<x;i++) { myString += "x"; } will act as below (each step being the next loop iteration): 1. construct a string object of length ...
int same_sign = !( (x >> 31) ^ (y >> 31) ); if ( same_sign ) ... else ...
That Rake task can be provided by the db-populate plugin: http://github.com/joshknowles/db-populate/tree/master
My best advice would be that there is no standard tree data structure because there are so many ways you could implement it that it would be impossible to cover all bases with one solution. The more specific a solution, the less likely it is applicable to any given problem. I even get annoyed with LinkedList<T> - wha...
**Stack:** - Stored in computer RAM like the heap. - Variables created on the stack will go out of scope and automatically deallocate. - Much faster to allocate in comparison to variables on the heap. - Implemented with an actual stack data structure. - Stores local data, return addresses, used for par...
The easiest way I've handled this on apps in the past is to just store the date as a string in yyyy-mm-dd format. It's unambigious and doesn't get automatically translated by anything. Yes, it's a pain...
I had a similar problem where I was specifying the path to the SiteMap from within my DataSource control. I tried removing it and it worked. Try removing the path from the SiteMapDataSource and ensure that web.sitemap is in the root directory and see if that fixes it.
What can cause Web.sitemap to not be found?
|asp.net|
I have a asp:menu object which I set up to use a SiteMapDataSource but everytime I try to run the site, I get a yellow screen from firefox saying it cannot find the web.sitemap. Here's the code for the sitemapdatasource and the menu. The Web.sitemap file is sitting in the root directory of the website. <code> <div> ...
Similar to many above, my current favorite is the keystroke [alt]. (Alt and "." keys together) this is the same as $! (Inserts the last argument from the previous command) except that it's immediate and for me easier to type. (Just can't be used in scripts) eg: mkdir -p /tmp/test/blah/oops/something cd [...
How does a Rails developer talk to Flex front ends?
|ruby-on-rails|apache-flex|
I'm looking at Rails development as a backend to a Flex application and am trying to figure out the communication layer between the Rails app and the Flash Player. All of the things I am finding suggest using SOAP web services to communicate. However, Flash supports AMF which is nice and fast (and native). Is ther...
I think what you want to do is create a linked server as per [this][1] msdn article. You would then select using a 4 part object name eg: Select * From ServerName.DbName.SchemaName.TableName [1]: http://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx
Declare your arguments as `Optional Variants`, then you can test to see if they're missing using `IsMissing()` or check their type using `TypeName()`, as shown in the following example: Public Function Foo(Optional v As Variant) As Variant If IsMissing(v) Then Foo = "Missing argument"...
If you're using eclipse then it has the capabilities to auto generate the getter and setter method for the internal attributes, it can be a usefull and timesaving tool.
Can you use the Data Transformation Services to do the job? This provides all sorts of bolt-together tools for doing this kind of thing.
Can you use the Data Transformation Services to do the job? This provides all sorts of bolt-together tools for doing this kind of thing. You can download the SQL Server 2005 feature pack from Microsoft's website [here][1] [1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-...
Counting occurrences in vim
|vim|
In order to know how many times a pattern exists in current buffer, I do: :%s/pattern-here/pattern-here/g It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status. Is there a more elegant way to count?
The bean convention is to write code like this: private int foo; public int getFoo() { return foo; } public void setFoo(int newFoo) { foo = newFoo; } In some of the other languages on the JVM, e.g., Groovy, you get overridable properties similar to C#, e.g., int fo...
You might consider [SQLite][1]. It's almost as simple as flat files, but you do get a SQL engine for querying. It [works well with PHP][2] too. [1]: http://www.sqlite.org/ [2]: http://ca3.php.net/sqlite
>>@Flubba, does this allow me to have folders inside my include directory? flat include directories give me nightmares. as the whole objects directory should be in the inc directory. Oh yes, absolutely. So for example, we use a single layer of subfolders, generally: require_once('library/string.class.php') ...
Why not grab one of the AJAX scripting libraries, they abstract away a lot of the cross browser DOM scripting black magic and make life a hell of a lot easier.
Like so: date --date='1 days ago' '+%a' And similar phrases.
In SQL: create table numbers(n int not null) insert into numbers(n) values(1),(1), (2), (2), (3), (4) select distinct num1.n+num2.n sum2n from numbers num1 inner join numbers num2 on num1.n<>num2.n order by sum2n
In SQL: create table numbers(n int not null) insert into numbers(n) values(1),(1), (2), (2), (3), (4) select distinct num1.n+num2.n sum2n from numbers num1 inner join numbers num2 on num1.n<>num2.n order by sum2n C# LINQ: List<int> num = new List<int>{ 1, 1, 2, 2, ...
Just to clarify private static IEnumerator<TextBox> FindTextBoxes(Control rootControl) Changes to private static IEnumerable<TextBox> FindTextBoxes(Control rootControl) That should be all :-)
date --date='1 days ago' '+%a' It's not a very compatible solution. I will work only in Linux, I think. At least, it didn't worked in Aix and Solaris.
date --date='1 days ago' '+%a' It's not a very compatible solution. It will work only in Linux. At least, it didn't worked in Aix and Solaris. It works in RHEL: date --date='1 days ago' '+%Y%m%d' 20080807
Some built-in Leopard tools that I find useful are iChat AV and Screen Sharing. Also, Google Docs, especially spreadsheets and forms are nice (and free).
If you want to exclude classes and other random objects that may have a `__call__` method, and only check for functions and methods, these two functions in the [`inspect` module][1] inspect.isfunction(obj) inspect.ismethod(obj) should do what you want. [1]: http://docs.python.org/lib/module-inspec...
If you want to exclude classes and other random objects that may have a `__call__` method, and only check for functions and methods, these three functions in the [`inspect` module][1] inspect.isfunction(obj) inspect.isbuiltin(obj) inspect.ismethod(obj) should do what you want in a future-proof way. ...
Remove "values" when you're appending a group of rows, and remove the extra parentheses. You can avoid the circular reference by using an alias for avg(CurrencyColumn) (as you did in your example) or by not using an alias at all. If the column names are the same in both tables, your query would be like this: INS...
It's almost never necessary to know how many bytes are in the pipe: perhaps you just want to do a non-blocking read() on the pipe, ie. to check if there are any bytes ready, and if so, read them, but never stop and *wait* for the pipe to be ready. You can do that in two steps. First, use the select() system call to...
How to fix an MFC Painting Glitch?
|c++|mfc|paint|
I'm trying to implement some drag and drop functionality for a material system being developed at my work. Part of this system includes a 'Material Library' which acts as a repository, divided into groups, of saved materials on the user's hard drive. As part of some UI polish, I was hoping to implement a 'highlight'...
I have a asp:menu object which I set up to use a SiteMapDataSource but everytime I try to run the site, I get a yellow screen from firefox saying it cannot find the web.sitemap. Here's the code for the sitemapdatasource and the menu. The Web.sitemap file is sitting in the root directory of the website. <div> ...
You need to specify in web.config to use XmlSiteMapProvider and provide it with correct path to .sitemap file.
The work around I've found for this is to search the registry for references to Delphi 2009 and remove the parent Key containing them when the key only refers to Delphi 2009, or remove the values when it's a general Delphi folder) so other Delphi installs won't be corrupted. For good measure, I did the same for all ...
The problems seem to originate with the web installer not having all the files needed. Download the 2009 ISO: http://cc.codegear.com/item/26049 Mounted it using this free tool from Microsoft: http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe (You ...
Most of my time in Eclipse has been spent doing ColdFusion so I can't speak to ANT scripts or compilation. I too noticed that odd things would be more likely to happen if Eclipse was left running for an excessive amount of time. Aside from that, most other buggy-ness could be resolved by making sure that my JRE was the...
Check out [Erlang][1]. Google for it, and watch the various presentations and videos. Many of the programmers and architects I respect are quite taken with its scalability. We're using it where I work pretty heavily... [1]: http://www.erlang.org/
This will return the first 200 characters of words: preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, 201));
Error Lookup (ErrLook.exe) in your %PROGRAMFILES%\[Some version of Visual Studio]\Tools Common7\ folder will give you the error message often, but not always: <pre> |---------------------------------------------------| | [] Error Lookup | |------------------------------...
As a technical note, bit-twiddly solutions are going to be much more efficient than multiplication, even on modern architectures. It's only about 3 cycles that you're saving, but you know what they say about a "penny saved"...
Trying to understand web services performance
|asp.net|web-services|
I bought an ASP.NET script about a year ago to retrieve FedEx shipping values. It builds an XML string that passes to the FedEx server using an HttpWebRequest, then parses the raw XML. The average response time for the script is about 900 milliseconds. So the other day I was poking around in the FedEx develope...
|asp.net|performance|web-services|
At work we have used the excellent [Chartdirector](http://www.advsofteng.com/). It's not free, but is very cheap (maybe 50 bucks or so). The cost is well worth it, as the API and docs are both excellent (way better than GD!), so easily saved more than that amount of my time. There's also a free version, which inc...
Depends on what you want to do, I regularly use all of them: - Shell for simple batching of commands with perhaps a loop or an if-statement. - Perl when I'm munching files and do some text replacement and souch things. - Python when need more logic. Under *nix you should use the right tool for the right work, w...
When choosing a scripting language to help automate your linux / unix environment, the most important thing in my opinion is... your replacement :-) By which I mean the next / other sysadmins who may have to maintain your scripts. I am currently working in an environment where the lead Unix guy is a real script head...
There is a "standard" pattern for getters and setters in Java, called [bean properties][1]. Basically any method starting with `get`, taking no arguments and returning a value, is a property getter for a property named as the rest of the method name (with a lowercased start letter). Likewise `set` creates a setter of a...
Ok, I'll try to help here : First a module is not a class, it allows you to mix behaviour in a class. second see the following example : module A module B module Error def foobar puts "foo" end end end end class StandardError...
I'd also like to note that "Games for Windows", which XNA uses on windows with its Live! networking APIs is now free ... which means that if you write an XNA game that uses the networking features, your users **do not** have to have a gold membership :-) [http://www.engadget.com/2008/07/22/games-for-windows-live-now...
That progression sounds painful. If you're going to include MS products (especially the for-pay SQL Server) in there anywhere, you may as well use the whole stack, since you only have to pay for the last of these: SQL Server Compact -> SQL Server Express -> SQL Server Enterprise (clustered). If you target ...
You can only translate Managed C++ code (and C++/CLI code) to C# if the C++ code is pure managed. If it is not -- i.e. if there is native code included in the sources -- tools like .NET Reflector won't be able to translate the code for you. If you do have native C++ code mixed in, then I'd recommend trying to move ...
I have found that the best fix for Intellisense in VS2005 is to install SP1, and then this hotfix: [947315][1]. It has the added benefit of fixing most of the multi-core build issues. This hotfix also includes the ability to control Intellisense via Macros. More information [here][2]. As for making SP1 more fr...
I have to admit that I have no experience fighting spambots and don't really know how sophisticated they are. That said, I don't see anything in the jQuery article that couldn't be accomplished purely on the server. To rephrase the summary from the jQuery article: 1. When generating the contact form on the serve...
If the base class is non-abstract, then there is no way to force it to be overridden at compile time. The best you can probably do is something like: virtual void Clone() { throw gcnew NotSupportedException(); } With this, derived classes would have to override the method or your applicatio...