instruction
stringlengths
0
30k
What are the correct pixel dimensions for an apple-touch-icon?
|iphone|favicon|apple-touch-icon|
I'm not sure what the correct size should be. Many sites seem to repeat that the apple-touch-icon should be 57x57 pixels but site a broken link as their source. [Hanselman][1]'s and [playgroundblues][2]'s comments suggest different sizes including 163x163 and 60x60. Apple's own [apple.com icon][3] is 129x129! ...
I don't think there is a "correct size". Since the iPhone really is running OSX, the icon rendering system is pretty robust. As long as you give it a high-quality image with the right aspect ratio and a resolution at least as high as the actual output will be, the OS will downscale very cleanly. My site uses a 158x158 ...
Best way to copy a database in SQL Server 2005/8?
|sql-server|
I always create a new empty database and then do a backup and restore of the existing database into it, but is this really the best way? As it seems very error prone and over complicated to me.
In all honesty, a combination of print and print_r() to print out the variables. I know that many prefer to use other more advanced methods but I find this the easiest to use. I will say that I didn't fully appreciate this until I did some Microprocessor programming at Uni and was not able to use even this.
The best way I can think of would be to use **Cygwin** over an **OpenSSH** connection. Here's a document that explains how to do just that: <http://www.ucl.ac.uk/cert/openssh_rdp_vnc.pdf>
Depends on how much detail you want it to have, it needs to have the aspect ratio of 1:1 (basically - it needs to be square) I would go with the Apple's own 129*129
I would check both IP and User Agent to see if they change if ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'] || $_SESSION['user_ip'] != $_SERVER['REMOTE_ADDR']) { //Something fishy is going on here? }
Some info on Tapestry: I'm familiar with Tapestry 4 and find it to be a great framework. The two biggest problems it has are 1) the mental model is rather different from those of other frameworks, so if you're familiar with one of them, you may have to "unlearn what you have learned;" 2) backwards compatibility breakag...
Some info on Tapestry: I'm familiar with Tapestry 4 and find it to be a great framework. The two biggest problems it has are 1) the mental model is rather different from those of other frameworks, so if you're familiar with one of them, you may have to "unlearn what you have learned;" 2) backwards compatibility breakag...
How do I prevent replay attacks?
|asp.net|encryption|hacking|
This is related to [another question I asked](/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field). In summary, I have a special case of a URL where, when a form is POSTed to it, I can't rely on cookies for authentication or to maintain the user's session, but I somehow need to know who they are, and...
The 3.5 SP1 update has support for browser history and back button in ASP.NET ajax now.
Giant NodeManagerLogs from hibernate in weblogic
|weblogic|logging|
One of our weblogic 8.1s has suddenly started logging giant amounts of logs and filling the disk. The logs giving us hassel resides in mydrive:\bea\weblogic81\common\nodemanager\NodeManagerLogs\generatedManagedServer1\managedserveroutput.log I cant find any debug settings set anywhere. Ive looked in the ...
One of our weblogic 8.1s has suddenly started logging giant amounts of logs and filling the disk. The logs giving us hassel resides in mydrive:\bea\weblogic81\common\nodemanager\NodeManagerLogs\generatedManagedServer1\managedserveroutput.log and the entries in the logfile is just the samekinds of entrires...
|logging|hibernate|weblogic|
Dig in and find out? Stick a debugger on that bastard! I can see at least the following possibilities: 1. the logging system hangs; 3. the thread exited just fine but the service is still running because some other part has a logic error. And maybe, but almost certainly not, the following: * Sleep() hangs....
You could enumerate all the network adapters, get their IP addresses and compare the part covered by the subnet mask with the sender's address. Like: foreach( adapter in EnumAllNetworkAdapters() ) { adapterSubnet = adapter.subnetmask & adapter.ipaddress; senderSubnet = adapter.subnetmas...
I'm confused... The images from ASP would be compressed on the server side--not client side. I'm sure your web server is not running on Windows CE, so I don't think your concern is warranted.
I'm confused... The images from ASP would be compressed on the server side--not client side. I'm sure your web server is not running on Windows CE, so I don't think your concern is warranted. **EDIT:** Seems as though you can run a web server on Windows CE: [http://www.microsoft.com/windows/embedded/produc...
How to find a Java Memory Leak
|java|memory|
How do you find a memory leak in Java (using for example JHat)? I have tried to load the heap dump up in JHat to take a basic look. However I do not understand how I am supposed to be able to find the root reference ([ref][1]) or whatever it is called. Basically I can tell that there are several hundred meg of hash tab...
|java|memory|jhat|
How do you find a memory leak in Java (using for example JHat)? I have tried to load the heap dump up in JHat to take a basic look. However I do not understand how I am supposed to be able to find the root reference ([ref][1]) or whatever it is called. Basically I can tell that there are several hundred meg of hash tab...
How do you find a memory leak in Java (using for example JHat)? I have tried to load the heap dump up in JHat to take a basic look. However I do not understand how I am supposed to be able to find the root reference ([ref][1]) or whatever it is called. Basically I can tell that there are several hundred meg of hash tab...
Here's another good resource from MSDN: [Data Binding Overview][1]. [1]: http://msdn.microsoft.com/en-us/library/ms752347.aspx
Instead of J#, I would rather prefer IKVM (http://www.ikvm.net/) to convert my JARs to .NET assemblies as well as access Java APIs in C#.
@jatan > Thanks for you answer. It makes sense. Can you please explain me MathContext in the context of BigDecimal#round method. There's nothing special about `BigDecimal.round()` *vs.* any other `BigDecimal` method. In all cases, the `MathContext` specifies the number of significant digits and the rounding tech...
There are no standards for REST other than HTTP. There are established REST services out there. I suggest you take a peak at them and get a feel for how they work. For example, we borrowed a lot of ideas from Amazon's S3 REST service when developing our own. But we opted not to use the more advanced security model ...
Of Memory Management, Heap Corruption, and C++
|c++|memory|heap|stack|
So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based off the fact that I added a `std::string` to a class and assigning it a value from another `std::string`: std::string hello = "Hello, world.\n"; /* exampleString = "Hello, world....
I don't think there such a feature out of the box. However, you could write a RS plugin that does this. But this would be another question...
If your only objective is to stop FxCop from yelling at you, then you have found the best practice. The best practice for signing your assemblies is something that is completely dependent on your objectives and needs. We would need more information like your intended deployment: * For personal use * For use o...
If your only objective is to stop FxCop from yelling at you, then you have found the best practice. The best practice for signing your assemblies is something that is completely dependent on your objectives and needs. We would need more information like your intended deployment: * For personal use * For use o...
Who else is involved in the database? Are you the only person making schema changes (creating new objects, releasing new stored procedures, permissioning new users)? - Make sure that the number of users doing anything that could impact performance is reduced to as close to zero as possible, ideally including you....
This is related to [another question I asked](http://beta.stackoverfow.com/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field). In summary, I have a special case of a URL where, when a form is POSTed to it, I can't rely on cookies for authentication or to maintain the user's session, but I somehow ne...
This is related to [another question I asked](http://stackoverflow.com/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field). In summary, I have a special case of a URL where, when a form is POSTed to it, I can't rely on cookies for authentication or to maintain the user's session, but I somehow need t...
I think always, always, always add logging when there is an exception, including the message and full stack trace. Beyond that, I think it's pretty subjective to whether or not you use the logs often or not... I often try to only add logging in critical places where what I am logging should very rarely hit, otherwi...
You could enumerate all the network adapters, get their IP addresses and compare the part covered by the subnet mask with the sender's address. Like: IPAddress FindLocalIPAddressOfIncomingPacket( senderAddr ) { foreach( adapter in EnumAllNetworkAdapters() ) { adapterSubnet ...
Anthony Cramp's answer looked good to me. As he mentions the DCT transforms the data into the frequency domain. The DCT is heavily used in video compression as the human visual system is must less sensitive to high frequency changes, therefore zeroing out the higher frequency values results in a smaller file, with litt...
At the place where I work, we decided to move from SVN to Bazaar (after evaluating git and mercurial). Bazaar was easy to start off, with simple commands (not like the 140 commands that git has) The advantages that we see is the ability to create local branches and work on it without disturbing the main version. Als...
vmware-cmd causes "perl.exe - Ordinal Not Found" error
|vmware|
My automated script for staring and stopping VMWare Server virtual machines has stopped working. vmware-cmd has started raising the error: "The ordinal 3288 could not be located in the dynamic link library LIBEAY32.dll." I am not aware of any specific change or update when this started happening. I have foun...
@Sergio and @Rowan Yes, we're **not** talking about loading and transforming data into the database (like a SSIS tool would do). That's solved using out integration platform.
@Sergio and @Rowan Yes, we're **not** talking about loading and transforming data into the database (like a SSIS tool would do). That's solved using our integration platform.
In **ZFC**, either the axiom of foundation [as mentioned] or the axiom (scheme) of comprehension will prohibit this. The first, for obvious reasons; the second, since it basically says that for given *z* and first-order property *P*, you can construct { *x* ∈ *z* : *P*(*x*) }, but to generate the Russell set, you would...
I haven't used the AuthorizeAttribute that comes in Preview 4 yet. I rolled my own, because I have been using the MVC framework since the first CTP. I took a quick look at the attribute in reflector and it is doing what I mentioned above internally, except they use the hex equivalent of 401. I will need to look furt...
According to the [`Timer`](http://java.sun.com/javase/6/docs/api/java/util/Timer.html) documentation, in Java 1.5 onwards, you should prefer the [`ScheduledThreadPoolExecutor`]( http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html) instead. (You may like to create this executor us...
According to the [`Timer`](http://java.sun.com/javase/6/docs/api/java/util/Timer.html) documentation, in Java 1.5 onwards, you should prefer the [`ScheduledThreadPoolExecutor`]( http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html) instead. (You may like to create this executor us...
I suggest [TeamCity][1]. :) [1]: http://www.jetbrains.com/teamcity/
I would probably rely on an issue tracking system for this purpose, and make sure to tag each change that needed to be brought forward into the trunk code. You can then ensure that check-in comments for each change reference the relevant issue, and are clear in expressing the intent of the code change so that it can be...
From [Wikipedia][1] > At the time when octal originally > became widely used in computing, > systems such as the IBM mainframes > employed 24-bit (or 36-bit) words. > Octal was an ideal abbreviation of > binary for these machines because > eight (or twelve) digits could > concisely display an entire machine ...
The article [here][1] (Day-to-day with Subversion) mentions that one method is to constantly update version 2 with data from the version 1.1 build. In the article, the guy says to do this every day. The part you'll want to read is titled "Waiter, There's a Bug in my Trunk!". It's about halfway though the article. ...
I recently had to write network protocol code that accesses 3-bit fields. Octal comes in handy when you want to debug that. Just for effect, can you tell me what the 3-bit fields of this are? 0x492492 On the other hand, this same number in octal: 022222222 Now, finally, in binary (in groups of...
What do you want to do with the data? Store it? Pass it around? Display it? These questions should drive your search for an appropriate technology. Simply asking how you should format your data is like asking what language you should program in, without specifying what you want to accomplish. For most data tasks, w...
|c++|memory|stack|heap|
So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based off the fact that I added a `std::string` to a class and assigning it a value from another `std::string`: std::string hello = "Hello, world.\n"; /* exampleString = "Hello, world....
Why don't you use Microsoft ATL's regex library? Kenny Kerr has written a [short article][1] on that recently. Hope it helps. [1]: http://weblogs.asp.net/kennykerr/archive/2008/07/18/visual-c-in-short-regular-expressions.aspx
The code was simply an example of where my program was failing (it was allocated on the stack, Jim). I'm not actually looking for 'what have I done wrong', but rather 'how do I diagnose what I've done wrong'. Teach a man to fish and all that. Though looking at the question, I haven't made that clear enough. Thank goodn...
The code was simply an example of where my program was failing (it was allocated on the stack, Jim). I'm not actually looking for 'what have I done wrong', but rather 'how do I diagnose what I've done wrong'. Teach a man to fish and all that. Though looking at the question, I haven't made that clear enough. Thank goodn...
Oh, if you want to know how to debug the problem, that's simple. First, get a dead chicken. Then, [start shaking it](http://c2.com/cgi/wiki?VoodooChickenCoding). Seriously, I haven't found a consistent way to track these kinds of bugs down. Because there's so many potential problems, there's not a simple checklis...
DOS filename escaping for use with *nix commands
|dos|scripting|shell|
Earlier today I wanted to escape a DOS filename so I could use it with sed. I had a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt) I found that the backslashes in %FIL...
I want to escape a DOS filename so I can use it with sed. I have a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt) I found that the backslashes in %FILENAME% are just e...
|scripting|dos|shell|
I want to escape a DOS filename so I can use it with sed. I have a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt) I found that the backslashes in %FILENAME% are just e...
Because you've already made a typedef for the struct (because you used the 's1' version), you should write: foo test; rather than struct foo test; That will work in both C and C++
mysql software: any suggestions to oversee my mysql replication server?
|mysql|
I've had a tough time setting up my replication server. Is there any program (OS X, Win, Linux or php no problem) that lets me monitor and resolve replication issues? (btw, for those -uhm- following, ive been on this issue [here][1], [here][2], [here][3] and [here][4]. Either i'm going about this the wrong way or i mus...
Try this: http://www.freedownloadscenter.com/Programming/Delphi_Tools_and_Components/PowerPoint_ActiveX.html This is an ActiveX component that embeds powerpoint into an OCX. Since you are using just IE6/7 you can embed this component into the HTML.
I'm assuming you are using GNU ls? try \ls It will unalias the usual ls (ls --color=auto).
ls -U will do the ls without sorting.
Keith's approach seems nice. I put together a more naive approach using lists. This has error checking so hopefully should pick up most problems:- public List<int> parsePageNumbers(string input) { if (string.IsNullOrEmpty(input)) throw new InvalidOperationException("Input string is empty."); ...
By default, the entities will use all fields for checking concurrency when making edits. That's what's throwing the InvalidOperationException. This can be setting the Update Check property for all fields to Never. This must be done on all fields to attach the entity as modified. If this is done, an additional cal...
Technically, you don't need a Mac. Applications in OS X just require a [specific folder structure][1] and an [XML file][2]. However, the Mac has a really nice tool called [Jar Bundler][3]. In addition to setting up the bundle directories and XML file, it creates a C executable that launches your java application via...
Any document that proves switching will lower costs. Failing that, multi-colored graphs and charts. Maybe a power-point presentation.
The best argument would have to be the reason why you want them to switch to subversion. :) I know absolutely nothing about VSS, but the phrase "if it ain't broken don't fix it" comes to mind. You have to show your managers that VSS is broken and needs fixing. Even better if you can show management how it would s...
The only place I come across octal literals these days is when dealing with the permission bits on files in Linux, which are normally represented as 3 octal digits, where each digit represents the permissions for the file owner, group and other users respectively. e.g. 0755 (also just 755 with most command line tool...
VSS totally relies on the clients to manage the database. If a client drops connection in the middle of a write over the network at just the wrong time, your file is trashed on the server. Not just the tip, but all the history. Hope you have a good backup. I've been through it. It's bad news. VSS usage over VPN or o...
How different are the host names? These hosts can share cookies. - mail.xyz.com - www.xyz.com - logon.xyz.com But there can not. - abc.com - xyz.com - www.tre.com In the former case you can bang out a cookie based solution. Think GUID and a database session table.
Tom's article is very old. It only discusses the DATE type. If you use TIMESTAMP types then date arithmetic is built into PL/SQL. [http://www.akadia.com/services/ora_date_time.html][1] DECLARE ts_a timestamp; ts_b timestamp; diff interval day to second; BEGIN ts_a := systimestam...
Looks like it can't be done from `bash` If you using `zsh` then ls **/*.rb will produce the correct result. Otherwise you can hijack the `ruby` interpreter (and probably those of other languages) ruby -e "puts Dir.glob('**/*.rb')" Thanks to Chris and Gaius for your answers.
If you use [WinMerge](http://winmerge.org/) it has added support for merging Word and Excel binary files.
Make sure you bind the DefaultView to the Controls Datasource, after you set the Sort property, and not the table: myCombo.DataSource = this.typedDataSet.Tables["Table1"].DefaultView; myCombo.DisplayMember = "ColumnB"; myCombo.ValueMember = "ColumnA";
How to submit a form when the return key is pressed?
|javascript|html|
Can someone please tell me how to submit an HTML form when the return key is pressed and if there are no buttons in the form? The submit button is not there. I am using a custom div instead of that.
Why don't you just apply the div submit styles to a submit button? I'm sure there's a javascript for this but that would be easier.
Here is how I do it with jQuery j(".textBoxClass").keypress(function(e) { // if the key pressed is the enter key if (e.which == 13) { // do work } }); Other javascript wouldnt be too different. the catch is checking for keypress argument of "13", which is the enter key