instruction
stringlengths
0
30k
Have a separate helper EXE that takes command-line params (or pipe to its StandardInput) that does what is required and call that from your main app. This keeps the MAPI stuff outside of your main app's process space. OK, you're still mixing MAPI and .NET but in a very short-lived process. The assumption is that MAPI and the CLR start causing issues with longer-running processes. We use Dmitry Streblechenko's superb [Redemption Data Objects][1] library which allows us to write such "shim" code in JScript and invoke that, which keeps the CLR and MAPI worlds in separate processes, but in a supported fashion. @[Chris Fournier](#18691) re. writing an unmanaged DLL. This won't work because the issue is mixing MAPI and managed code *in the same process*. [1]: http://www.dimastr.com/redemption/
According to this article http://www.iunknown.com/2008/05/ironruby-and-rails.html. In may performance was nowhere near where they expected it to be. I heard in http://altnetpodcast.com/episodes/9-state-of-ironruby (3 days ago) that they're still working on performance. I guess they put compatability first and are now trying to get the performance up to par with other ruby implementations out there. As far as I understand they're not nearly as performant as Iron Python that is developed by the same team. I don't know if this is because Iron Ruby is using the DLR a lot more and that still needs to be optimized or if they need to optimize the Iron Ruby implementation itself more. But I guess it is good news because they can get it a lot faster. So if you're already happy with performance you'll get a lot happier.
Best Practices for versioning web site?
|version-control|
What's are the best practices for versioning web sites? - Which revision control systems are well suited for such a job? - What special-purpose tools exist? - What other questions should I be asking? - etc...
Even if it is somewhat possible to intercept the paste event in many browsers (but not all as shown at the link on the previous answer), that is quite unreliable and posible not complete (depending on the browser / OS it may be possible to do the paste operation in different ways that may not be trappable by javascript code). [Here][1] is a collection of notes regarding paste (and copy) in the context of rich text editors that may be applied also elsewhere. [1]: http://discerning.com/topics/software/ttw.html#copy_and_paste "Here"
Right, The two answers and a little thought got me to something approaching an answer. First a little more clarification: The app is written in C# (2.0+) and uses ADO.NET to talk to SQL Server 2005. The mirror setup is two W2k3 servers hosting the Principal and the Mirror plus a third server hosting an express instance as a monitor. The nice thing about this is a failover is all but transparent to the app using the database, it will throw an error for some connections but fundamentally everything will carry on nicely. Yes we're getting the odd false positive but the whole point is to have the system carry on working with the least amount of fuss and mirror *does* deliver this very nicely. Further, the issue is not with serious server failure - that's usually a bit more obvious but with a failover for other reasons (c.f. the false positives above) as we do have a couple of things that can't, for various reasons, fail over and in any case so we can see if we can identify the circumstance where we get false positives. So, given the above, simply checking the status of the boxes is not quite enough and chasing through the event log is probably overly complex - the answer is, as it turns out, fairly simple: sp_helpserver The first column returned by sp_helpserver is the server name. If you run the request at regular intervals saving the *previous* server name and doing a comparison each time you'll be able to identify when a change has taken place and then take the appropriate action. The following is a console app that demonstrates the principal - although it needs some work (e.g. the connection ought to be non-pooled and new each time) but its enough for now (so I'd then accept this as "the" answer"). Parameters are Principal, Mirror, Database using System; using System.Data.SqlClient; namespace FailoverMonitorConcept { class Program { static void Main(string[] args) { string server = args[0]; string failover = args[1]; string database = args[2]; string connStr = string.Format("Integrated Security=SSPI;Persist Security Info=True;Data Source={0};Failover Partner={1};Packet Size=4096;Initial Catalog={2}", server, failover, database); string sql = "EXEC sp_helpserver"; SqlConnection dc = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(sql, dc); Console.WriteLine("Connection string: " + connStr); Console.WriteLine("Press any key to test, press q to quit"); string priorServerName = ""; char key = ' '; while(key.ToString().ToLower() != "q") { dc.Open(); try { string serverName = cmd.ExecuteScalar() as string; Console.WriteLine(DateTime.Now.ToLongTimeString() + " - Server name: " + serverName); if (priorServerName == "") { priorServerName = serverName; } else if (priorServerName != serverName) { Console.WriteLine("***** SERVER CHANGED *****"); Console.WriteLine("New server: " + serverName); priorServerName = serverName; } } catch (System.Data.SqlClient.SqlException ex) { Console.WriteLine("Error: " + ex.ToString()); } finally { dc.Close(); } key = Console.ReadKey(true).KeyChar; } Console.WriteLine("Finis!"); } } } I wouldn't have arrived here without a) asking the question and then b) getting the responses which made me actually **think** Murph
> is there a way to choose which processor or core it is launched on? You can use the task manager to tell windows what CPU(s) your program should be allowed to run on. Normally this is only useful for troubleshooting legacy programs which have broken implementations of multi-threading. To do this, * Run task manager * Find your process in the `Processes` window. * Right click and choose `Set Affinity...` * Tick the checkboxes next to the CPU's you want to allow your application to run on. Windows will then only schedule threads from that process onto those particular CPU's If I recall correctly, windows will 'remember' these settings for subsequent times your process is run, but please don't quote me on that - run some tests yourself :-) You can also do this programatically in .NET after your program has launched using using the [System.Diagnostics.Process.ProcessorAffinity](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity.aspx) property, but I don't think it will 'remember' the settings, so there will always be a short period in which your app is run on whichever CPU windows sees fit. I don't know how to do this in java sorry. Note: This applies at the entire process level. If you set affinity for CPU0 only, and then launch 50 threads, all 50 of those threads will run on CPU0, and CPU1, 2, 3, etc will sit around doing nothing. Just to reiterate the point, this is primarily useful for troubleshooting broken legacy software. If your software is not broken, you really shouldn't mess with any of these settings, and let windows decide the best CPU(s) to run your program on, so it can take the rest of the system's performance into account. ---- As for the 'shared memory' model, it works the same, but there are more things that can go subtly wrong when your app is running on multiple CPU's as opposed to just timeslices on a single one. For an eye-opening example, read [this ridiculousfish article about CPU's and Memory Barriers](http://ridiculousfish.com/blog/archives/2007/02/17/barrier/). It's aimed at OSX development on PowerPC, but general enough that it should apply everywhere. IMHO it's one of the top ten 'all developers should read this' articles I've read.
In Oracle the default mode of operation is the *Read committed* isolation level where a select statement is not blocked by another transaction modifying the data it's reading. From [Data Concurrency and Consistency][1]: > Each query executed by a transaction sees only data that was committed before the query (not the transaction) began. An Oracle query never reads dirty (uncommitted) data. [1]: http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm
Is using the existing hashcode from the byte array field not good enough? Also note that in the Equals method you should check that the arrays are the same size before doing the compare.
Some details here on why it does it and how you can overcome it: http://vishaljoshi.blogspot.com/2007/12/tips-tricks-start-up-options-and.html > There are instances when you might have many web applications or web sites in the same solution and you may be actually debugging only one of them... In such scenario it might not be desirable to have multiple instances of ASP.NET Development Server running... VS provides an explicit setting in the property grid of web application/site called Development Web Server - "Always Start When Debugging" which is set to True by default... If you set this Property to be False only one web server instance will be created for the start up web project...
You seem to have got confused with use of a variable (which is just $variable) and Attribute Value Templates, which allow you to put any XPath expression in some attributes, e.g. <newElement Id="{@Id}"/> They can obviously be combined, so you can include a variable in an Attribute Value Template, such as <newElement Id="{$myId}"/>
You seem to have got confused with use of a variable (which is just $variable) and Attribute Value Templates, which allow you to put any XPath expression in some attributes, e.g. <newElement Id="{@Id}"/> They can obviously be combined, so you can include a variable in an Attribute Value Template, such as: <newElement Id="{$myId}"/>
// str.ToEnum<EnumType>() T static ToEnum<T>(this string str) where T : Enum { return (T) Enum.Parse(typeof(T), str); }
// str.ToEnum<EnumType>() T static ToEnum<T>(this string str) { return (T) Enum.Parse(typeof(T), str); } @keith thanks. I took it out.
I have also been highly annoyed by that behavior. The only solution I have found is to manually change the properties page for each web appllication so it hits a real running instance in IIS. I prefer this anyway, because debugging with the integrated web server can give you a very false impression of how your application will interact with the IIS security model.
Easy installation method for windows/ Batch Reference needed?
|windows|installation|batch-file|ms-dos|
I have a bunch of files that I need to be able to transport and install quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome. My idea for a solution would be to write up a quick script to move files around that I could just click on. I've done some bash before but batch scripting is a little odd to me. Does anyone have a good online reference guide I could use? An alternative soulution I could accept would be a program that makes an installer for you, though I'm a bit against that as I would lose a lot of control. However, I'd be alright with it if it was extremely simple,
Are you testing in Firefox or IE? We have a similar issue where the entire page refreshes in Firefox (but not IE). To get around it we use a hidden asp:button with the useSubmitBehavior="false" set. <asp:Button ID="btnRefresh" runat="server" OnClick="btnRefresh_Click" Style="display: none" UseSubmitBehavior="false" />
You need to specify what you mean by "best" - to some, speed is all that matters and would qualify an answer as "best" - for others, they might forgive a few hundred milliseconds if the solution was more readable. "Best" is subjective unless you are more specific. ---------- That said: Iterate through the numbers, for each number search the list for that number and when you reach the number that returns only a 1 for the number of search results, you are done.
It means that the task is re-entrant - items declared within the task are dynamically allocated rather than shared between different invocations of the task. You see - some of us do Verilog... (ugh)
Another suggestion for tracking tables that have been written to is to use [Red Gate SQL Log Rescue][1] (free). This tool dives into the log of the database and will show you all inserts, updates and deletes. The list is fully searchable, too. It doesn't meet your criteria for researching reads into the database, but I think the SQL Profiler technique will get you a fair idea as far as that goes. [1]: http://www.red-gate.com/products/SQL_Log_Rescue/index.htm
To fix condition 1 try: s/[^:]\bBoolean\b(?!")/bool/g The [^:] says to match any character other than ":".
Continue your efforts to involve the other developer. Remember you are the one who wants to make this change. Ask for help with problems you have. Invite them to the daily stand up meeting. I currently do the planning for the daily stand up and I make sure all the pigs and chickens are invited. If you are the lead on the project it is up to you to address the situation and take a risk. Put yourself out there.
I would say that using a sorting algorithm and then going through the sorted list to find the number is a good way to do it. And now the problem is finding "the best" sorting algorithm. There are a lot of sorting algorithms, each of them with its strong and weak points, so this is quite a complicated question. The [Wikipedia entry][1] seems like a nice source of info on that. [1]: http://en.wikipedia.org/wiki/Sorting_algorithm
Here's an example: <pre><code> #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include &lt;iterator&gt; using namespace std; int main() { const char* list[] = {"zip", "zam", "bam"}; const size_t len = sizeof(list) / sizeof(list[0]); for (size_t i = 0; i &lt; len; ++i) { cout &lt;&lt; list[i] &lt;&lt; "\n"; } const vector&lt;string&gt; v(list, list + len); copy(v.begin(), v.end(), ostream_iterator&lt;string&gt;(cout, "\n")); } </code></pre>
Here's an example: <pre><code> #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include &lt;iterator&gt; using namespace std; int main() { const char* const list[] = {"zip", "zam", "bam"}; const size_t len = sizeof(list) / sizeof(list[0]); for (size_t i = 0; i &lt; len; ++i) { cout &lt;&lt; list[i] &lt;&lt; "\n"; } const vector&lt;string&gt; v(list, list + len); copy(v.begin(), v.end(), ostream_iterator&lt;string&gt;(cout, "\n")); } </code></pre>
Do session variables work if you hit http://www.myIsv.com/myWebSite/ directly? It would seem to me that the server config would dictate whether or not sessions will work. However, if you're starting a session on www.mysmallwebsite.com somehow (doesn't look like you're using PHP, but maybe you are), you're not going to be able to transfer session data without writing some backend logic that moves the session from server to server.
The prompt you're getting doesn't look like Subversion asking you for a password, it looks like ssh asking for a password. So my guess is that you have checked out an svn+ssh:// checkout, not an svn:// or http:// or https:// checkout. IIRC all the options you're trying only work for the svn/http/https checkouts. Can you run svn info to confirm what kind of repository you are using ? If you are using ssh, you should set up key-based authentication so that your scripts will work without prompting for a password.
I can't recommend Dmitry Streblechenko's [Redemption Data Objects][1] library highly enough. It's a COM component that provides a sane API to Extended MAPI and is a joy to use. The Exchange API goalposts move from one release to the next: “Use the M: drive! No, use WebDAV! No, use ExOLEDB!… No, use Web Services!” with the only constant being good old MAPI. [1]: http://www.dimastr.com/redemption/
Stick a session_start() at the beginning of your script and see if you can access the variables again.
Well, this is a hard question. There are generally 3 fonts that are in some form or other always supported. These fonts are Adobe Times, Adobe Helvetica, and Adobe Courier. The problem is that while every system and foundry have a clone of these, they have different names. They are also not entirely the same, but have the same metrics. The windows trio: Arial, Times New Roman, and Courier New are the monotype clones of them. On linux these have been provided as bitmap fonts by adobe, and as outlines in form of the URW Nimbus {Sans, Roman, Mono} clones. The outlines however are not pretty on screen (they are on a printer) as they lack hinting. The solution would be to go for a multichoice for websites. As microsoft has at some point made the ["core fonts"][1] available for redistribution, many unix/linux systems do have those fonts available. So go with them. The liberation fonts are straight clones of the MS/monotype fonts, so should go ok as alternatives with a similar experience. Then go for "Helvetica", "Times", and "Courier" before the sans/serif/mono choice that puts you in the user's hands. [1]: http://corefonts.sourceforge.net/
Here's a Mozilla developer that's tried to do this: [Version controlling my home dir][1], there's a couple of suggestions in the comments. [1]: http://www.silfreed.net/blog/2008/07/Version-controlling-my-home-dir
It's not working because on the client sessions are per-domain. All the cookies are being saved for mysmallwebsite.com, so myIsv.com cannot access them.
@pix0r www.myIsv.com/myWebSite/ -> session variable work www.mysmallwebsite.com -> session variable doesn't work @Alexandru Unfortunately this is not on the same webserver
i assume that you are wanting get to some of the attributes that are set against the LDAP account - role - department etc. for coldfusion check this out [http://www.adobe.com/devnet/server_archive/articles/integrating_cf_apps_w_ms_active_directory.html][1] and the cfldap tag [http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p69.htm#wp1100581][2] As to other languages - others will do it with there respective APIs [1]: http://www.adobe.com/devnet/server_archive/articles/integrating_cf_apps_w_ms_active_directory.html [2]: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p69.htm#wp1100581
I've used clickatell in the past and found them very good also. However, You could build your own to get messages VERY cheap. All you need is: a contract which gives loads of (or unlimited) messages; windows mobile phone; and a bit of socket programming. Write a web service (pass the number and the message) which makes a call to a program on the mobile which sends the message. I know of at least FTSE100 company which went this route.
I think the way to do(get around) this problem is to develop a "./configure && make" script that your client uses to install, specify and compile the binaries. That would offcourse require that the client has all the source-code installed on his server or you can make it available on an NFS share.
There is [Castle.Components.Validator][1] module in Castle project. It's very agile and powerfull. It generates validation rules based on model attributes (or any other source) and even able to generate JS validation using jQuery, Prototype Validation, fValidate and other. Of course it's wise to abstract validator away behind IValidationEngine interface. [1]: http://209.85.135.104/search?q=cache:EzaP2dgUM9cJ:hammett.castleproject.org/%3Fp%3D114+Castle.Components.Validator&hl=ru&ct=clnk&cd=2&gl=ru&client=firefox-a
The "Robert C Martin" book, which was actually written by Michael Feathers ("Uncle Bob" is, it seems, a brand name these days!) is a must. It's near-impossible - not to mention insanely time-consuming - to put unit tests into an application not developed with them. The code just won't be amenable. But that's not a problem. Refactoring is about changing design without changing function (I hope I haven't corrupted the meaning too badly there) so you can work in a much broader fashion. Start out with big chunks. Set up a repeatable execution, and capture what happens as the expected result for subsequent executions. Now you have your app, or part of it at least, under test. Not a very good or comprehensive test, sure, but it's a start and things can only get better from there. Now you can start to refactor. You want to start extracting your data access code so that it can be replaced with ORM functionality without disturbing too much. Test often: with legacy apps you'll be surprised what breaks; cohesion and coupling are seldom what they might be. I'd also consider looking at Martin Fowler's [Refactoring](http://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Technology/dp/0201485672/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1219407968&sr=1-2), which is, obviously enough, the definitive work on the process.
I have been doing that with a nokia phone, connected to a linux machine. I have a cron job and a script that would check a database table for new messages and use <a href="http://www.gnokii.org/">gnokii</a> to send messages. It works great if the number of sms you are goig to send isn't to big.
Try the <code>./configure</code> option <code>--enable-mods-shared="all"</code>, or <code>--enable-mods-shared="&lt;list of modules&gt;"</code>. See further [details in Apache 2.2 docs][1]. [1]: http://httpd.apache.org/docs/2.2/programs/configure.html#otheroptfeat
Try the <code>./configure</code> option <code>--enable-mods-shared="all"</code>, or <code>--enable-mods-shared="&lt;list of modules&gt;"</code> to compile modules as shared objects. See further [details in Apache 2.2 docs][1] To just compile Apache with the ability to load shared objects (and add modules later), use <code>--enable-so</code>, then consult the documentation on compiling modules seperately in the [Apache 2.2. DSO docs][2]. [1]: http://httpd.apache.org/docs/2.2/programs/configure.html#otheroptfeat [2]: http://httpd.apache.org/docs/2.2/dso.html
One more compression thought: If the bit array is not crazy long, you could try applying the [Burrows-Wheeler transform][1] before using any repetition encoding, such as Huffman. A naive implementation would take O(n^2) memory during (de)compression and O(n^2 log n) time to decompress - there are almost certainly shortcuts to be had, as well. But if there's any sequential structure to your data at all, this should really help the Huffman encoding out. You could also apply that idea to one block at a time to keep the time/memory usage more practical. Using one block at time could allow you to always keep most of the data structure compressed if you're reading/writing sequentially. [1]: http://en.wikipedia.org/wiki/Burrows-Wheeler
This seems close to what you want: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>untitled</title> <meta name="generator" content="TextMate http://macromates.com/"> <meta name="author" content="Sören Kuklau"> <!-- Date: 2008-08-31 --> <style type="text/css" media="screen"> #foo { background: red; max-height: 100px; overflow-y: hidden; } .bar { background: blue; width: 100px; height: 100px; float: left; margin: 1em; } </style> </head> <body> <div id="foo"> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> </div> </body> </html>
you can use the `clip` property: #container { position: absolute; clip: rect(0px,200px,100px,0px); overflow: hidden; background: red; note the `position: absolute` and `overflow: hidden` needed in order to get `clip` to work.
You may put an inner div in the container that is enough wide to hold all the floated divs. <div id="container" style="background-color:red;overflow:hidden;width:200px"> <div id="inner" style="overflow:hidden;width: 2000px"> <div style="float:left;background-color:blue;width:50px;height:50px"> </div> <div style="float:left;background-color:blue;width:50px;height:50px"> </div> <div style="float:left;background-color:blue;width:50px;height:50px"> </div> ... </div> </div>
If you're on an intranet, Windows authentication can be handled for "free" by configuration alone. If this isn't appropriate, token services work just fine, but for some situations they may be just too much. The application I'm working on needed bare-bones authentication. Our server and client run inside a (very secure) intranet, so we didn't care too much for the requirement to use an X.509 certificate to encrypt the communication, which is required if you're using username authentication. So we added a [custom behavior][1] to the client that adds the username and (encrypted) password to the message headers, and another custom behavior on the server that verifies them. All very simple, required no changes to the client side service access layer or the service contract implementation. And as it's all done by configuration, if and when we need to move to something a little stronger it'll be easy to migrate. [1]: http://www.winterdom.com/weblog/2006/10/02/CustomWCFBehaviorsThroughAppConfig.aspx
This isn't necessarily an answer to your question, but I've had great success using [MacPorts](http://macports.org) for installing Perl stuff on OS X. It's much smoother than trying to use CPAN because it knows that it's installing for OS X and will patch modules appropriately. Definitely recommended.
You can use a tuple for a lot of things where you would use a struct in C (something like x,y coordinates or RGB colors for example). For everything else you can use dictionary, or a utility class like [this one][1]: >>> class Bunch: ... def __init__(self, **kwds): ... self.__dict__.update(kwds) ... >>> mystruct = Bunch(field1=value1, field2=value2) [1]: http://code.activestate.com/recipes/52308/
You can use a tuple for a lot of things where you would use a struct in C (something like x,y coordinates or RGB colors for example). For everything else you can use dictionary, or a utility class like [this one][1]: >>> class Bunch: ... def __init__(self, **kwds): ... self.__dict__.update(kwds) ... >>> mystruct = Bunch(field1=value1, field2=value2) I think the "definitive" discussion is [here][2], in the published version of the Python Cookbook. [1]: http://code.activestate.com/recipes/52308/ [2]: http://www.ubookcase.com/book/Oreilly/Python.Cookbook.2nd.edition/0596007973/pythoncook2-chp-4-sect-18.html
Not to whore myself horribly but I wrote a couple F# overview posts on my blog [here](http://www.codegrunt.co.uk/blog/?p=58) and [here](http://www.codegrunt.co.uk/blog/?p=81). Chris Smith (guy on the F# team at MS) has an article called 'F# in 20 minutes' - [part 1](http://blogs.msdn.com/chrsmith/archive/2008/05/02/f-in-20-minutes-part-i.aspx) and [part 2](http://blogs.msdn.com/chrsmith/archive/2008/05/09/f-in-20-minutes-part-ii.aspx). Note you have to be careful as the latest CTP of F# (version 1.9.6.0) has some seriously breaking changes compared to previous versions, so some examples/tutorials out there might not work without modification. Here's a quick run-down of some cool stuff, maybe I can give you a few hints here myself which are clearly *very* brief and probably not great but hopefully gives you something to play with!:- First note - most examples on the internet will assume 'lightweight syntax' is turned on. To achieve this use the following line of code:- #light This prevents you from having to insert certain keywords that are present for OCaml compatibility and also having to terminate each line with semicolons. Note that using this syntax means indentation defines scope. This will become clear in later examples, all of which rely on lightweight syntax being switched on. If you're using the interactive mode you have to terminate all statements with double semi-colons, for example:- > #light;; > let f x y = x + y;; val f : int -> int -> int > f 1 2;; val it : int = 3 Note that interactive mode returns a 'val' result after each line. This gives important information about the definitions we are making, for example 'val f : int -> int -> int' indicates that a function which takes two ints returns an int. Note that only in interactive do we need to terminate lines with semi-colons, when actually defining F# code we are free of that :-) You define functions using the 'let' keyword. This is probably the most important keyword in all of F# and you'll be using it a lot. For example:- let sumStuff x y = x + y let sumStuffTuple (x, y) = x + y We can call these functions thus:- sumStuff 1 2 3 sumStuffTuple (1, 2) 3 Note there are two different ways of defining functions here - you can either separate parameters by whitespace or specify parameters in 'tuples' (i.e. values in parentheses separated by commas). The difference is that we can use 'partial function application' to obtain functions which take less than the required parameters using the first approach, and not with the second. E.g.:- let sumStuff1 = sumStuff 1 sumStuff 2 3 Note we are obtaining a function from the expression 'sumStuff 1'. When we can pass around functions just as easily as data that is referred to as the language having 'first class functions', this is a fundamental part of any functional language such as F#. Pattern matching is pretty darn cool, it's basically like a switch statement on steroids (yeah I nicked that phrase from another F#-ist :-). You can do stuff like:- let someThing x = match x with | 0 -> "zero" | 1 -> "one" | 2 -> "two" | x when x < 0 -> "negative = " + x.ToString() | _ when x%2 = 0 -> "greater than two but even" | _ -> "greater than two but odd" Note we use the '_' symbol when we want to match on something but the expression we are returning does not depend on the input. We can abbreviate pattern matching using if, elif, and else statements as required:- let negEvenOdd x = if x < 0 then "neg" elif x % 2 = 0 then "even" else "odd" F# lists (which are implemented as linked lists underneath) can be manipulated thus:- let l1 = [1;2;3] l1.[0] 1 let l2 = [1 .. 10] List.length l2 10 let squares = [for i in 1..10 -> i * i] squares [1; 4; 9; 16; 25; 36; 49; 64; 81; 100] let square x = x * x;; let squares2 = List.map square [1..10] squares2 [1; 4; 9; 16; 25; 36; 49; 64; 81; 100] let evenSquares = List.filter (fun x -> x % 2 = 0) squares evenSqares [4; 16; 36; 64; 100] Note the List.map function 'maps' the square function on to the list from 1 to 10, i.e. applies the function to each element. List.filter 'filters' a list by only returning values in the list that pass the predicate function provided. Also note the 'fun x -> f' syntax - this is the F# lambda. Note that throughout we have not defined any types - the F# compiler/interpreter 'infers' types, i.e. works out what you want from usage. For example:- let f x = "hi " + x Here the compiler/interpreter will determine x is a string since you're performing an operation which requires x to be a string. It also determines the return type will be string as well. When there is ambiguity the compiler makes assumptions, for example:- let f x y = x + y Here x and y could be a number of types, but the compiler defaults to int. If you want to define types you can using type annotation:- let f (x:string) y = x + y Also note that we have had to enclose x:string in parentheses, we often have to do this to separate parts of a function definition. Two really useful and heavily used operators in F# are the pipe forward and function composition operators |> and >> respectively. We define |> thus:- let (|>) x f = f x Note that you can define operators in F#, this is pretty cool :-). This allows you to write things in a clearer way, e.g.:- [1..10] |> List.map (fun x -> x * x) |> List.filter (fun x -> x % 2 = 0) Will allow you to obtain the first 10 even squares. That is clearer than:- List.filter (fun x -> x % 2 = 0) (List.map (fun x -> x * x) [1..10]) Well, at least I think so :-) Function composition defined by the >> operator is defined as follows:- let (>>) f g x = g(f(x)) I.e. you forward-pipe an operation only the parameter of the first function remains unspecified. This is useful as you can do the following:- let mapFilter = List.map (fun x -> x * x) >> List.filter (fun x -> x % 2 = 0) Here mapFilter will accept a list an input and return the list filtered as before. It's an abbreviated version of:- let mapFilter = l |> List.map (fun x -> x * x) |> List.filter (fun x -> x % 2 = 0) If we want to write recursive functions we have to define the function as recursive by placing 'rec' after the let. Examples below. *Some cool stuff:-* **Factorial** let rec fact x = if x <= 1 then 1 else x * fact (x-1) **nth Fibonacci Number** let rec fib n = if n <= 1 then n else fib (n-1) + fib (n-2) **FizzBuzz** let (/%) x y = x % y = 0 let fb = function | x when x /% 15 -> "FizzBuzz" | x when x /% 3 -> "Fizz" | x when x /% 5 -> "Buzz" | x -> x.ToString() [1..100] |> List.map (fb >> printfn "%s") Anyway that's a *very* brief overview, hopefully it helps a little!!
It is also worth noting the `sorted()` function: for x in sorted(list): print x This returns a new, sorted version of a list without changing the original list.
It's hard to find much about Hive, but I found this [snippet][1] on the Hive site that leans heavily in favor of HBase (bold added): Hive is based on Hadoop which is a batch processing system. Accordingly, this system does not and **cannot promise low latencies on queries**. The paradigm here is strictly of submitting jobs and being notified when the jobs are completed as opposed to real time queries. As a result it should not be compared with systems like Oracle where analysis is done on a significantly smaller amount of data but the analysis proceeds much more iteratively with the response times between iterations being less than a few minutes. **For Hive queries response times for even the smallest jobs can be of the order of 5-10 minutes and for larger jobs this may even run into hours.** Since HBase and HyperTable are all about performance (being modeled on Google's BigTable), they sound like they would certainly be much faster than Hive, at the cost of functionality and a higher learning curve (e.g., they don't have joins or the SQL-like syntax). [1]: http://wiki.apache.org/hadoop/Hive
Here is one solution: struct BaseData { const string my_word; const int my_number; }; class Base { public: Base(const BaseData* apBaseData) { mpBaseData = apBaseData; } const string getMyWord() { return mpBaseData->my_word; } int getMyNumber() { return mpBaseData->my_number; } private: const BaseData* mpBaseData; }; class Derived : public Base { public: Derived() : Base(&sBaseData) { } private: static BaseData sBaseData; } BaseData Derived::BaseData = { "Foo", 42 };
s/[^:]\bBoolean\b[^"]/bool/g Edit: Rats, beaten again. +1 for beating me, good sir.
requiredfield validator is preventing another form from submitting
|asp.net|
I have a page with many forms in panels and usercontrols, and a requiredfield validator I just added to one form is preventing all of my other forms from submitting. what's the rule that I'm not following?
Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it. Look at the stack trace ... If the exception appears when calling a method on an object in a library, you are most likely using separate versions of the library when compiling and running. Make sure you have the right version both places. If the exception appears when calling a method on objects instantiated by classes _you_ made, then your build process seems to be faulty. Make sure the class files that you are actually running are updated when you compile.
Order of operations in an expression, such as: foo * (bar + baz^2 / foo) - **B**rackets first - **O**rders (ie Powers and Square Roots, etc.) - **D**ivision and **M**ultiplication (left-to-right) - **A**ddition and **S**ubtraction (left-to-right) source: [http://www.mathsisfun.com/operation-order-bodmas.html][1] [1]: http://www.mathsisfun.com/operation-order-bodmas.html
Order of operations in an expression, such as: foo * (bar + baz^2 / foo) - **B**rackets first - **O**rders (ie Powers and Square Roots, etc.) - **D**ivision and **M**ultiplication (left-to-right) - **A**ddition and **S**ubtraction (left-to-right) source: [http://www.mathsisfun.com/operation-order-bodmas.html][1] [1]: http://www.mathsisfun.com/operation-order-bodmas.html
You should be setting ValidationGroup property to a different value for each group of elements. Your validator's ValidationGroup must only be same with the control that submit its form.
You should also check out [Facelets](https://facelets.dev.java.net/); there is a [good introductory article](http://www.ibm.com/developerworks/java/library/j-facelets/) on DeveloperWorks.
You should also check out [Facelets](https://facelets.dev.java.net/); there is a [good introductory article](http://www.ibm.com/developerworks/java/library/j-facelets/) on DeveloperWorks. The Facelets <code>&lt;ui:insert/&gt;</code> tag is comparable to the ASP.NET <code>&lt;asp:ContentPlaceHolder/&gt;</code> tag used in master pages; it lets you provide default content for that area of the page, but this can be overridden. To fill the Facelets template in another page, you start with a <code>&lt;ui:composition/&gt;</code> element that points to the template file. This is roughly equivalent to declaring the MasterPageFile attribute in an ASP.NET page. Inside the <code>&lt;ui:composition/&gt;</code> element, you use <code>&lt;ui:define/&gt;</code> elements to override the template defaults, similar to the way an <code>&lt;asp:Content/&gt;</code> tag is used. These elements can contain any kind of content - from simple strings to JSF elements. So, to bring it all together... In *master.xhtml*: <!-- HTML header content here --> <ui:insert name="AreaOne">Default content for AreaOne</ui:insert> <ui:insert name="AreaTwo">Default content for AreaTwo</ui:insert> <!-- HTML footer content here --> In *page.xhtml*: <ui:composition template="/WEB-INF/templates/master.xhtml"> <ui:define name="AreaOne">Here is some new content</ui:define> <ui:define name="AreaTwo"> <p>Some new content here too</p> </ui:define> </ui:composition> And this will render as: <!-- HTML header content here --> Here is some new content <p>Some new content here too</p> <!-- HTML footer content here --> You also get some other benefits with Facelets, such as the ability to reuse page components with different data. (Edited to provide more information.)
Darren Thomas gives a good answer. However, one big difference between the Java and Python approaches is that with reference counting in the common case (no circular references) objects are cleaned up immediately rather than at some indeterminate later date. For example, I can write sloppy, non-portable code in CPython such as def parse_some_attrs(fname): return open(fname).read().split("~~~")[2:4] and the file descriptor for that file I opened will be cleaned up immediately because as soon as the reference to the open file goes away, the file is garbage collected and the file descriptor is freed. Of course, if I run Jython or IronPython or possibly PyPy, then the garbage collector won't necessarily run until much later; possibly I'll run out of file descriptors first and my program will crash. So you SHOULD be writing code that looks like def parse_some_attrs(fname): with open(fname) as f: return f.read().split("~~~")[2:4] but sometimes people like to rely on reference counting to always free up their resources because it can sometimes make your code a little shorter. I'd say that the best garbage collector is the one with the best performance, which currently seems to be the Java-style generational garbage collectors that can run in a separate thread and has all these crazy optimizations, etc. The differences to how you write your code should be negligible and ideally non-existent.
If your changes are done to the SharePoint object model, you can use the fact that changes are not committed until you call the `Update()` method of the modified object, such as `SPList.Update()` or `SPWeb.Update()`. Otherwise, I would use the *Command* Design Pattern. Chapter 6 in [Head First Design Patterns][1] even has an example that implements the undo functionality. [1]: http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124
I wrote a blog article on this a while back, so for more info, [see here][1] <div class="item_with_border"> <div class="border_top_left"></div> <div class="border_top_right"></div> <div class="border_bottom_left"></div> <div class="border_bottom_right"></div> This is the text that is displayed </div> <style> div.item_with_border { border: 1px solid #FFF; postion: relative; } div.item_with_border > div.border_top_left { background-image: url(topleft.png); position: absolute; top: -1px; left: -1px; width: 30px; height: 30px; z-index: 2; } div.item_with_border > div.border_top_right { background-image: url(topright.png); position: absolute; top: -1px; right: -1px; width: 30px; height: 30px; z-index: 2; } div.item_with_border > div.border_bottom_left { background-image: url(bottomleft.png); position: absolute; bottom: -1px; left: -1px; width: 30px; height: 30px; z-index: 2; } div.item_with_border > div.border_bottom_right { background-image: url(bottomright.png); position: absolute; bottom: -1px; right: -1px; width: 30px; height: 30px; z-index: 2; } </style> It works quite well. No Javascript needed, just CSS and HTML. With minimal HTML interfering with the other stuff. It's very similar to what Mono posted, but doesn't contain any IE 6 specific hacks, and after checking, doesn't seem to work at all. Also, another trick is to make the inside portion of each corner image transparent so it doesn't block text that is near the corner. The outer portion must not be transparent so it can cover up the border of the non-rounded div. Also, once CSS3 is widely supported with border-radius, that will be the official best way of making rounded corners. [1]: http://www.kibbee.ca/Blog/viewComments.php?blogid=354
There are a number of solutions. 1) For GDI+, [check out this article at MSDN][1]. 2) For WPF (.NET 3.0), see the [System.Windows.Media][2] namespace. There are a number of different classes, such as the [BitmapEncoder][3], that have the concept of a [ColorContext][4], which "Represents the International Color Consortium (ICC) or Image Color Management (ICM) color profile that is associated with a bitmap image." Both of these seem pretty complex, so there's always the option of buying somebody else's code. Atalasoft's [DotImage Photo Pro][5] has ICC profile setting capabilities built in. The code is expensive; a dev license is almost 2k. But based on their participation in the dotnet community, I'd give them a whirl. [1]: http://support.microsoft.com/kb/317825/en-us [2]: http://msdn.microsoft.com/en-us/library/system.windows.media.color.colorcontext(VS.85).aspx [3]: http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapencoder.aspx [4]: http://msdn.microsoft.com/en-us/library/system.windows.media.colorcontext.aspx [5]: http://www.atalasoft.com/products/dotimage/photopro/default.aspx
PHP : session variable aren't usable when site is redirected
|php|
I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with this content: <html> <head> <title>www.mysmallwebsite.com</title> </head> <frameset> <frame src="http://www.myIsv.com/myWebSite/" name="redir"> <noframes> <p>Original location: <a href="www.myIsv.com/myWebSite/">http://www.myIsv.com/myWebSite/</a> </p> </noframes> </frameset> </html> It works fine, but some features like PHP Session variables doesn't work anymore! Anyone has a suggestion for correcting that? Thanks
|php|
I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with this content: <html> <head> <title>www.mysmallwebsite.com</title> </head> <frameset> <frame src="http://www.myIsv.com/myWebSite/" name="redir"> <noframes> <p>Original location: <a href="www.myIsv.com/myWebSite/">http://www.myIsv.com/myWebSite/</a> </p> </noframes> </frameset> </html> It works fine, but some features like PHP Session variables doesn't work anymore! Anyone has a suggestion for correcting that? Edit: This doesn't work both on IE and on Firefox (no plugins) Thanks
The load time and the memory utilization are still the two weakest points in IronRuby. Once a particular piece of code has been loaded and is running in a sort of steady-state mode -- that is, little to no new source is being evaluated -- then the performance should be quite good. To answer your specific question, consider [this data][1]. [1]: http://blog.prokrams.com/2008/08/27/ironruby-vs-jruby-vs-mri-performance-mini-shootout/
Firstly you can - and should - use a revision control system, most will handle binary files although unlike text files you can't merge two different set of changes so you may want to set the system up to lock these files whilst they are being changed (assuming that that's not the default mode of operation for you rcs in the first place). Where things get a bit more interesting for Websites is managing those files that are required for the site but don't actually form part of the site - the most obvious example being something like .psd files from which web graphics are produced but which don't get deployed. We therefore have a tree for each site which has two folders: assets and site. Assets are things that aren't in the site, and site is - well the site. What you have to watch with this is that designers tend to have their own "systems" for "versioning" graphic files (count the layers in the PSD). You don't need necessarily to stop them doing this but you do need to ensure that they commit each change too. Other questions? Deployment. We're still working on this one (-: But we're getting better (I'm happier now with what we do!) Murph
I have used this in a couple programs because my core 0 was kinda messed up. // Programmatically set process affinity var process = System.Diagnostics.Process.GetCurrentProcess(); // Set Core 0 process.ProcessorAffinity = new IntPtr(0x0001); // Set Core 1 process.ProcessorAffinity = new IntPtr(0x0002); More on this [here](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity.aspx).
I have used this in a couple programs because my core 0 was kinda messed up. // Programmatically set process affinity var process = System.Diagnostics.Process.GetCurrentProcess(); // Set Core 0 process.ProcessorAffinity = new IntPtr(0x0001); or // Set Core 1 process.ProcessorAffinity = new IntPtr(0x0002); More on this [here](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity.aspx).
The only way I can think of doing this is by doing something like alert('you have a new message') when the message is received. This will flash the taskbar if the window is minimized, but it will also open a dialog box, which you may not want.
Event handling in Dojo
|javascript|dojo|
Hello All: Apologies in advance for the appaling long post (and pretty applaing code, too). Taking Jeff Atwood's [advice](http://www.codinghorror.com/blog/archives/001163.html), I decided to use a JavaScript library for the very basic to-do list application I'm writing. I picked the [Dojo toolkit](http://dojotoolkit.org/), version 1.1.1. At first, all was fine: the drag-and-drop code I wrote worked first time, you can drag tasks on-screen to change their order of precedence, and each drag-and-drop operation calls an event handler that sends an AJAX call to the server to let it know that order has been changed. Then I went to add in the email tracking functionality. Standard stuff: new incoming emails have a unique ID number attached to their subject line, all subsequent emails about that problem can be tracked by simply leaving that ID number in the subject when you reply. So, we have a list of open tasks, each with their own ID number, and each of those tasks has a time-ordered list of associated emails. I wanted the text of those emails to be available to the user as they were looking at their list of tasks, so I made each task box a Dijit "Tree" control - top level contains the task description, branches contain email dates, and a single "leaf" off of each of those branches contains the email text. First problem: I wanted the tree view to be fully-collapsed by default. After searching Google quite extensively, I found a number of solutions, all of which seemed to be valid for previous versions of Dojo but not the one I was using. I eventually figured out that the best solution would seem to be to have a event handler called when the Tree control had loaded that simply collapsed each branch/leaf. Unfortunately, even though the Tree control had been instantiated and its "startup" event handler called, the branches and leaves still hadn't loaded (the data was still being loaded via an AJAX call). So, I modified the system so that all email text and Tree structure is added server-side. This means the whole fully-populated Tree control is available when its startup event handler is called. So, the startup event handler fully collapses the tree. Next, I couldn't find a "proper" way to have nice formatted text for the email leaves. I can put the email text in the leaf just fine, but any HTML gets escaped out and shows up in the web page. Cue more rummaging around Dojo's documentation (tends to be out of date, with code and examples for pre-1.0 versions) and Google. I eventually came up with the solution of getting JavaScript to go and read the SPAN element that's inside each leaf node and un-escape the escaped HTML code in it's innerHTML. I figured I'd put code to do this in with the fully-collapse-the-tree code, in the Tree control's startup event handler. However... it turns out that the SPAN element isn't actually created until the user clicks on the expando (the little "+" symbol in a tree view you click to expand a node). Okay, fair enough - I'll add the re-formatting code to the onExpand() event handler, or whatever it's called. Which doesn't seem to exist. I've searched to documentation, I've searched Google... I'm quite possibly mis-understanding Dojo's "publish/subscribe" event handling system, but I think that mainly because there doesn't seem to be any comprehensive documentation for it anywhere (like, where do I find out what events I can subscribe to?). So, in the end, the best solution I can come up with is to add an onClick event handler (not a "Dojo" event, but a plain JavaScript event that Dojo knows nothing about) to the expando node of each Tree branch that re-formats the HTML inside the SPAN element of each leaf. Except... when that is called, the SPAN element still doesn't exist (sometimes - other times it's been cached, just to further confuse you). Therefore, I have the event handler set up a timer that periodically calls a function that checks to see if the relevant SPAN element has turned up yet before then re-formatting it. // An event handler called whenever a "email title" tree node is expanded. function formatTreeNode(nodeID) { if (dijit.byId(nodeID).getChildren().length != 0) { clearInterval(nodeUpdateIntervalID); messageBody = dijit.byId(nodeID).getChildren()[0].labelNode.innerHTML if (messageBody.indexOf("<b>Message text:</b>") == -1) { messageBody = messageBody.replace(/&gt;/g, ">"); messageBody = messageBody.replace(/&lt;/g, "<"); messageBody = messageBody.replace(/&amp;/g, "&"); dijit.byId(nodeID).getChildren()[0].labelNode.innerHTML = "<b>Message text:</b><div style=\"font-family:courier\">"+messageBody+"</div>"; } } } // An event handler called when a tree node has been set up - we changed the default fully-expanded to fully-collapsed. function setupTree(theTree) { dijit.byId("tree-"+theTree).rootNode.collapse(); messageNode = dijit.byId("tree-"+theTree).rootNode.getChildren(); for (pl = 0; pl < messageNode.length; pl++) { messageNode[pl].collapse(); messageNode[pl].expandoNode.onclick = eval("nodeUpdateIntervalID = setInterval(\"formatTreeNode('"+messageNode[pl].id+"')\",200); formatTreeNode('"+messageNode[pl].id+"');"); } } The above has the feel of a truly horrible hack, and I feel sure I must have taken a wrong turn somewhere early on in my thought process. Can someone please tell me: * The correct way to go about putting nicely-formatted text inside a Dojo/Dijit Tree control. * The correct way to handle Dojo events, like where I can figure out what events are available for me to subscribe to. * A better JavaScript library to use (can I do what I want to with JQuery and avoid the all-around-the-houses approach seen above?). PS: If you're naming a software project, give thought to its name's uniqueness in Google - I'm sure searching for "Dojo" documentation in Google would be easier without all the martial arts results getting in the way. PPS: Firefox spellchecker knows how to spell "Atwood", correcting me when I put two 'T's instead of one. Is Jeff just that famous now?
How to make Ruby or Python web sites to use multiple cores?
|python|ruby|multithreading|multicore|
Even though [Python][1] and [Ruby][2] have one kernel thread per interpreter thread, they have a global interpreter lock (GIL) that is used to protect potentially shared data structures, so this inhibits multi-processor execution. Even though the portions in those languajes that are written in C or C++ can be free-threaded, that's not possible with pure interpreted code unless you use multiple processes. What's the best way to achieve this? [Using FastCGI][3]? Creating a [cluster or a farm][4] of virtualized servers? Using their Java equivalents, JRuby and Jython? [1]: http://twistedmatrix.com/pipermail/twisted-python/2004-May/007896.html [2]: http://www.reddit.com/comments/6wmum/thread_safe_ruby_on_rails_in_22_release/ [3]: http://blogs.codehaus.org/people/tirsen/archives/001041_ruby_on_rails_and_fastcgi_scaling_using_processes_instead_of_threads.html [4]: http://blog.innerewut.de/files/images/stage_2.png
Scala supports actors. But I would not call scala intentionally similar to Erlang. Nonetheless scala is absolutely worth taking a look!
The HTML renders with those sort of IDs because its ASP.NET's way of preventing ID collisions. Each container control, such as a Master page or Wizard control, will prefix IDs in its children. In the case of your bullet list, the ListView provides a nice middle ground. You can still bind it to a datasource, but it gives you much tighter control over the rendered HTML. Scott Gu has a nice intro to the ListView here: [http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx][1] [1]: http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx
The HTML renders with those sort of IDs because its ASP.NET's way of preventing ID collisions. Each container control, such as a Master page or Wizard control, will prepend an "ID_" on its childrens' IDs. In the case of your bullet list, the ListView provides a nice middle ground. You can still bind it to a datasource, but it gives you much tighter control over the rendered HTML. Scott Gu has a nice intro to the ListView here: [http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx][1] [1]: http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx
Also [kilim][1] is a library for java, that brings erlang style message passing/actors to the Java language. [1]: http://www.malhar.net/sriram/kilim/
If you aren't absolutely set on diving into Django and don't mind trying something else as a start, you might want to give [WSGI][1] a shot, which allows you to template your application your own way using a [third party engine][2], rather than having to go exactly by Django's rules. This also allows you to peek at a lower level of handling requests, so you get a bit better understanding of what Django is doing under the hood. [1]: http://www.python.org/dev/peps/pep-0333/ [2]: http://pypi.python.org/pypi/Tenjin/0.6.2
There's been a lot of philosophical discussions (more like arguments) about this issue. Personally, I believe the worst thing you can do is swallow exceptions. The next worst is allowing an exception to bubble up to the surface where the user gets a nasty screen full of technical mumbo-jumbo.
Why does int main() {} compile?
|c++|program-entry-point|return|int|
(I'm using Visual C++ 2008) I've always heard that main() is _required_ to return an integer, but here I didn't put in `return 0;` and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main(), the compiler complains saying 'blah' must return a value. Sticking a `return;` also causes the error to appear. But leaving it out completely, it compiles just fine. #include <iostream> using namespace std; int main() { cout << "Hey look I'm supposed to return an int but I'm not gonna!\n"; } Could this be a bug in VC++?
Preview theme in Wordpress
|html|
In the latest version of Wordpress it gives you the opportunity to view a preview of what your site would look like using a different heme. You basically just click on the theme and it takes over the screen and you have a chance to activate it or close it (and return to the previous screen, which is grayed out in the background). I have seen a similar technique used on a number of websites recently for display images as well. I'm wondering what technology/code they use to do this?
|html|jquery|wordpress|
How would you abbriviate XHTML to an arbitrary number of words?