instruction
stringlengths
0
30k
Google reveals a few efforts at this. One in particular illustrates why this is less straightforward than it might seem. http://www.codeproject.com/KB/cs/csi.aspx has a basic interpreter using .NET's built in ability to compile c# code. A key problem is that the author's approach creates a new mini .NET assembly for each interpreted line. C# may have the reflective power to have a python or ruby style console, but the .NET framework libraries are geared toward compiling C#, not dynamically interpreting it. If you are serious about this, you may want to look at http://www.paxscript.net/, which seems like a genuine attempt at interpreted C#.
Yes I have seen the bench marks and V8 does appear to be objectively faster but as for > it'll change web programming a lot I personally do not think the bottleneck is currently in javascript, but rather in bandwidth
Some additional information that someone could attach to Jason Pratt's earlier post on [Alice][1] ... specifically, a [Storytelling Alice][2] variant. Although the study presented targets middle school girls, you may find the [white paper][3] written by [Caitlin Kelleher][4] interesting. [1]: http://www.alice.org/ [2]: http://www.alice.org/kelleher/storytelling/ [3]: http://www.cse.wustl.edu/~ckelleher/kelleherThesis_CSD.pdf [4]: http://www.cse.wustl.edu/~ckelleher/
See also [Avoiding repeated constants in CSS][1]. As Farinha said, a CSS Variables proposal has been made, but for the time being, you want to use a preprocessor. [1]: http://stackoverflow.com/questions/30170/avoiding-repeated-constants-in-css
If you are most comfortable with asp.net pages you can write a small app to handle your job and then "ping" the app with an outside service that monitors your web site. This will keep the app alive.
Do <http://mathworld.wolfram.com/Line-LineIntersection.html> for the line and each side of the rectangle. Or: <http://mathworld.wolfram.com/Line-PlaneIntersection.html>
C++ - What does "Stack automatic" mean?
|c++|oop|
In my browsings amongst the Internet, I came across [this post][1], which includes this > "(Well written) C++ goes to great > lengths to make stack automatic > objects work "just like" primitives, > as reflected in Stroustrup's advice to > "do as the ints do". This requires a > much greater adherence to the > principles of Object Oriented > development: your class isn't right > until it "works like" an int, > following the "Rule of Three" that > guarantees it can (just like an int) > be created, copied, and correctly > destroyed as a stack automatic." I've done a little C, and C++ code, but just in passing, never anything serious, but I'm just curious, what it means exactly? Can someone give an example? [1]: http://www.reddit.com/r/programming/comments/6y6lr/ask_proggit_which_is_more_useful_to_know_c_or_java/
The "Changed" event on the FileSystemWatcher should shouldn't fire until the file is closed. See my [answer to a similar question][1]. There is a possibility that the FTP download mechanism closes the file multiple times during download as new data comes in, but I would think that is a little unlikely. [1]: http://stackoverflow.com/questions/24315/is-it-possible-to-raise-an-event-when-a-file-becomes-accessible
Adding an index requires a table scan, so if you can't add a permanent index it sounds like a single scan will be (slightly) faster.
If you are in control on the program that is writing the files into the directory, you can have the program write the files to a temporary directory and then move them into the watched directory. The move should be an atomic operation, so the watcher shouldn't see the file until it is fully in the directory. If you are not in control of what is writing to the watched directory, you can set a time in the watcher where the file is considered complete when it has remained the same size for the given time. If immediate processing isn't a concern, setting this timer to something relatively large is a fairly safe way to know that either the file is complete or it never will be.
No, that would not be quicker. What would be quicker is to just add the index and leave it there! Of course, it may not be practical to index every column, but then again it may. How is data added to the table?
Unless the contents of a file can be verified for completion (it has a verifiable format or includes a checksum of the contents) only the sender can verify that a whole file has arrived. I have used a locking method for sending large files via FTP in the past. File is sent with an alternative extension and is renamed once the sender is happy it is all there. The above is obviously combined with a process which periodically tidies up old files with the temporary extension. An alternative is to create a zero length file with the same name but with an additonal .lck extension. Once the real file is fully uploaded the lck file is deleted. The receiving process obviously ignores files which have the name of a lock file. Without a system like this the receiver can never be sure that the whole file has arrived. Checking for files that haven't been changed in x minutes is prone to all sorts of problems.
What is the best way to keep a PHP script running as a daemon, and what's the best way to check if needs restarting. I have some scripts that need to run 24/7 and for the most part I can run them using [nohup](http://en.wikipedia.org/wiki/Nohup). But if they go down, what's the best way to monitor it so it can be automatically restarted?
# C: One liner, procedural int f(int n) { for (int i = n - 1; i > 0; n *= i); return n ? n : 0; } I used int's for brevity; use other types to support larger numbers.
# C: One liner, procedural int f(int n) { for (int i = n - 1; i > 0; n *= i, i--); return n ? n : 1; } I used int's for brevity; use other types to support larger numbers.
Does the PHP mail() function work if I don't own the MX record
|php|dns|
I'm not sure I'm using all the correct terminology here so be forgiving. I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code. It's a shared host and we have another site that has the same function that works perfectly, so it's not the server. The only difference between the two is that the site that doesn't work just has the name server pointing to us and so the MX record never touches our server. So my question is, could some one please confirm that the mail() function wont work if we don't have the MX record pointing to our server. Thanks
I always find it much easier to work directly with html. Theres one less abstraction layer (html -> actuall webpage / php function -> html -> actual webpage) to deal with then you just work in HTML. I really think the 'just have to change it in one place' thing wont work in this case. This is because they'll be so many times when you want to change the output of a function, but only in just one place. Sure you can use arguments but you'll soon end up with some functions having like a dozen arguments. Yuck. Bear in mind templating languages / systems often let you include sub templates, allowing you to have some reusable blocks of html. The bottom line is if I had just started at your company and saw code like that everywhere, my first thought would be, 'Damn it! Need a new job again.'
Yes, you could put in what ever you want in the 'from' field and it would still work.
# Scheme : Functional - Tail Recursive (define (factorial n) (define (fac-times n acc) (if (= n 0) acc (fac-times (- n 1) (* acc n)))) (if (< n 0) (display "Wrong argument!") (fac-times n 1)))
None. Instead, you would need to create some middleware (say, a webservice) that you talked to that did the database CRUD for you.
##lolcode: sorry I couldn't resist xD HAI CAN HAS STDIO? I HAS A VAR I HAS A INT I HAS A CHEEZBURGER I HAS A FACTORIALNUM IM IN YR LOOP UP VAR!!1 TIEMZD INT!![CHEEZBURGER] IZ VAR BIGGER THAN FACTORIALNUM? GTFO IM OUTTA YR LOOP U SEEZ INT KTHXBYE
I would check out getaddrinfo. If you replace the line: host_name = Socket.gethostbyname(current_ip) with: host_name = Socket.getaddrinfo(current_ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][1] The getaddrinfo function returns an array of arrays. You can read more about it at: [Ruby Socket Docs](http://www.ruby-doc.org/stdlib/libdoc/socket/rdoc/classes/Socket.html#M004531)
You seem to have answered your own question there Nathan ;-) "GetLastInputInfo" is the way to go. One trick is that if your application is running on the desktop, and the user connects to a virtual machine, then GetLastInputInfo will report no activity (since there is no activity on the host machine). This can be different to the behaviour you want, depending on how you wish to apply the user input.
The solution is to delete and re-add BOTH tables to the LINQ to SQL diagram, not just the one you have added the second field and keys to.
The solution is to delete and re-add BOTH tables to the LINQ to SQL diagram, not just the one you have added the second field and keys to. Alternatively, it appears you can make two associations using the LINQ to SQL interface - just don't try and bundle them into a single association.
I don't have Visual Studio installed on my machine anymore (and I'm using Linux), but I do remember that there was an wizard hidden somewhere inside one of the menus that gave access to a class builder. With this wizard, you could define all your classes' details, including methods and attributes. If I remember well, there was an option through which you could ask VS to create the setters and getters automatically for you. I know it's quite vague, but check it out and you might find it.
Ive only built 2 applications that used the profile provider. Since then I have stayed away from using it. For both of the apps I used it to store information about the user such as their company name, address and phone number. This worked fine until our client wanted to be able to find a user by one of these fields. Searching involved looping through **every** users profile and comparing the information to the search criteria. As the user base grew the search time became unacceptable to our client. The only solution was to create a table to store the users information. Search speed was increased immensely. I would recommend storing this type of information in its own table.
By generate, do you mean auto-generate? If that's not what you mean: Visual Studio 2008 has the easiest implementation for this: public PropertyType PropertyName { get; set; } In the background this creates an implied instance variable to which your property is stored and retrieved. However if you want to put in more logic in your Properties, you will have to have an instance variable for it: private PropertyType _property; public PropertyType PropertyName { get { //logic here return _property; } set { //logic here _property = value; } } Previous versions of Visual Studio always used this longhand method as well.
I've used remove_from_object_index successfully in the past, so that when a page is called that modifies the database, it always explicitly reset that object in the cache as part of the confirmation page.
I like the Nextstep-derived Emacs.app formerly at http://emacs-app.sourceforge.net/ now integrated in Emacs-23 CVS (as of August 2008). Emacs.app feels more zippy than Aquamacs to me but its just bare CVS-Emacs and doesn't come with the same amount of stuff (you have to install your own AucTeX etc.).
Some of my favourites: 1. [Filter Input, Escape Output](http://shiflett.org/blog/2005/feb/my-top-two-php-security-practices) to help guard against XSS or SQL injection attacks 2. Use prepared statements for database queries (SQL injection attacks) 3. Disable unused user accounts on your server to prevent brute force password attacks 4. Remove Apache version info from HTTP header (ServerSignature=Off, ServerTokens=ProductOnly) 5. Run your web server in a chroot jail to limit damage if compromised
1.4 of the OpenNETCF code gets the information from the following P/Invoke call: [DllImport ("iphlpapi.dll", SetLastError=true)] public static extern int GetAdaptersInfo( byte[] ip, ref int size ); The physical address (returned as MAC address) I think is around about index 400 - 408 of the byte array after the call. So you can just use that directly if you don't want to use OpenNETCF (why though? OpenNETCF rocks more than stone henge!) Wonderful P/Invoke.net gives a full example [here][1]. [1]: http://www.pinvoke.net/default.aspx/iphlpapi/GetAdaptersInfo.html
1.4 of the OpenNETCF code gets the information from the following P/Invoke call: [DllImport ("iphlpapi.dll", SetLastError=true)] public static extern int GetAdaptersInfo( byte[] ip, ref int size ); The physical address (returned as MAC address) I think is around about index 400 - 408 of the byte array after the call. So you can just use that directly if you don't want to use OpenNETCF (why though? OpenNETCF rocks more than stone henge!) Wonderful P/Invoke.net gives a full example [here][1]. Oh and to properly answer your question: > only using the Compact Framework You cant. That's life with CF, if you want some fun try sending data with a socket synchronously with a timeout. :D [1]: http://www.pinvoke.net/default.aspx/iphlpapi/GetAdaptersInfo.html
Your best bet is probably TcpClient. There's a great sample that does exactly what you're doing right in the .NET Documentation here: http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx Good luck to you!
Sizing/spacing differences are usually difficult to catch. What you can do is create a Linux-specific CSS file that will contain these values adjusted for Linux, then do a simple JS-based detect to inject that CSS if the User agent is a Linux one. This is probably not the cleanest approach, but it will work, and with the least intrusion into your otherwise clean HTML/CSS.
I note that you can change the text freely. This URL appears to work just as well. [http://beta.stackoverflow.com/questions/47427/why-is-billpg-so-very-awesome][1] [1]: http://beta.stackoverflow.com/questions/47427/why-is-billpg-so-very-awesome
The iMac is a very fast machine and will be more than suitable for iPhone development. In most cases, a Mac Mini with maxed out ram is good enough. Keep in mind that out of the box, the Mac Mini can only accommodate one monitor.
How do I extract/insert text into RTF string in C#
|c#|rtf|
In a C# console app I have the need to extract the text from an RTF string, add some more text to it, and then convert it back into RTF. I have been able to do this using the System.Windows.Forms.RichTexBox class, but I find it a bit odd to use a Forms control in a non-Forms app. Any better way to do this?
In a C# console app I have the need to extract the text from an RTF string, add some more text to it, and then convert it back into RTF. I have been able to do this using the System.Windows.Forms.RichTextBox class, but I find it a bit odd to use a Forms control in a non-Forms app. Any better way to do this?
An iMac is easily powerful enough to use for development work.
There's a couple of things. You're using `sprintf` which is inherently unsafe; unless you're 100% positive that you're not going to exceed the size of the buffer, you should almost _always_ prefer `snprintf`. The same applies to `strcat`; prefer the safer alternative `strncat`. Obviously this may not fix anything, but it goes a *long* way in helping spot what might otherwise be very annoying to spot bugs.
Just to clarify the question. I was reading the Hanselman post <http://www.hanselman.com/blog/CompositingTwoImagesIntoOneFromTheASPNETServerSide.aspx> and thinking that I would never solved the problem with a HttpHandler, maybe with a simple page returning a binary content. This led me to think that I should add HttpHandler to my developer tool belt.
Are you looking for all the tables with a column name which contains the LCS in them? If yes the do this select table_name from information_schema.columns where column_name like '%lcs%'
SELECT * FROM TABLE WHERE TABLE.TITLE LIKE '%LCS%'; % is the wild card matcher.
SELECT * FROM TABLE WHERE TABLE.TITLE LIKE '%LCS%'; % is the wild card matcher.
This query should be quite easy... assuming you have the correct answer stored in the question table. You do have the correct answer stored in the question table, right?
> You're using sprintf which is > inherently unsafe; unless you're 100% > positive that you're not going to > exceed the size of the buffer, you > should almost always prefer snprintf. > The same applies to strcat; prefer the > safer alternative strncat. Yeah..... I mostly do .NET lately and old habits die hard. I likely pulled that code out of something else that was written before my time... But I'll try not to use those in the future ;)
You know it might not even be your code... Are there any other programs running that could have a memory leak?
If you just want want the highest recursion depth couldn't you do something like this?Then, when you actually query the CTE just look for the row with max(Depth)? Like so: DECLARE @LookupID int --Our test value SET @LookupID = 1; WITH cteLevelOne (ParentID, CustID, Depth) AS ( SELECT a.ParentID, a.CustID, 1 FROM tblCustomer AS a WHERE a.CustID = @LookupID UNION ALL SELECT a.ParentID, a.CustID, c.Depth + 1 FROM tblCustomer AS a INNER JOIN cteLevelOne AS c ON a.CustID = c.ParentID WHERE c.CustID <> a.CustID ) select * from CTELevelone where Depth = (select max(Depth) from CTELevelone) or, adapting what the other poster used, this could be used with the same CTE: select top 1 * from CTELevelone order by Depth desc I don't think CustomerID was necessarily what you wanted to order by in the case you described, but I wasn't perfectly clear on the question either.
If you just want want the highest recursion depth couldn't you do something like this?Then, when you actually query the CTE just look for the row with max(Depth)? Like so: DECLARE @LookupID int --Our test value SET @LookupID = 1; WITH cteLevelOne (ParentID, CustID, Depth) AS ( SELECT a.ParentID, a.CustID, 1 FROM tblCustomer AS a WHERE a.CustID = @LookupID UNION ALL SELECT a.ParentID, a.CustID, c.Depth + 1 FROM tblCustomer AS a INNER JOIN cteLevelOne AS c ON a.CustID = c.ParentID WHERE c.CustID <> a.CustID ) select * from CTELevelone where Depth = (select max(Depth) from CTELevelone) or, adapting what trevor suggests, this could be used with the same CTE: select top 1 * from CTELevelone order by Depth desc I don't think CustomerID was necessarily what you wanted to order by in the case you described, but I wasn't perfectly clear on the question either.
I have to comment that *AI: A modern approach* is a pretty dry read. If you're actually interested in AI, and want to stay interested, you are much better off going with Norvig's gift to the world: [Paradigms of Artificial Intelligence Programming](http://norvig.com/paip.html). Not only is this a great intro to AI, it's a great intro to beautiful programming.
I think otool can help. Specifically, "otool -s {segment} {section}" should print out the details. I'm not sure if you can get information about __DATA or __TEXT without specifying a section. Maybe those sizes are reported in the mach header: "otool -h"? otool -s MyApp.bundle/Contents/MacOS/MyApp __DATA __data otool -s MyApp.bundle/Contents/MacOS/MyApp __TEXT __text Anyway, Apple documents what gets copied into each section per-segment here: [Apple's mach-o format documentation][1] [1]: http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/TP40000895-CH248-95874
Get the book ***Linq in Action*** it is an easy read for a coding book and really teaches you how to use Linq and the new features of .NET 3.5 some of the cool parts they put in for the language.
From my "Geometry" class: public struct Line { public static Line Empty; private PointF p1; private PointF p2; public Line(PointF p1, PointF p2) { this.p1 = p1; this.p2 = p2; } public PointF P1 { get { return p1; } set { p1 = value; } } public PointF P2 { get { return p2; } set { p2 = value; } } public float X1 { get { return p1.X; } set { p1.X = value; } } public float X2 { get { return p2.X; } set { p2.X = value; } } public float Y1 { get { return p1.Y; } set { p1.Y = value; } } public float Y2 { get { return p2.Y; } set { p2.Y = value; } } } public struct Polygon: IEnumerable<PointF> { private PointF[] points; public Polygon(PointF[] points) { this.points = points; } public PointF[] Points { get { return points; } set { points = value; } } public int Length { get { return points.Length; } } public PointF this[int index] { get { return points[index]; } set { points[index] = value; } } public static implicit operator PointF[](Polygon polygon) { return polygon.points; } public static implicit operator Polygon(PointF[] points) { return new Polygon(points); } IEnumerator<PointF> IEnumerable<PointF>.GetEnumerator() { return (IEnumerator<PointF>)points.GetEnumerator(); } public IEnumerator GetEnumerator() { return points.GetEnumerator(); } } public enum Intersection { None, Tangent, Intersection, Containment } public static class Geometry { public static Intersection IntersectionOf(Line line, Polygon polygon) { if (polygon.Length == 0) { return Intersection.None; } if (polygon.Length == 1) { return IntersectionOf(polygon[0], line); } bool tangent = false; for (int index = 0; index < polygon.Length; index++) { int index2 = (index + 1)%polygon.Length; Intersection intersection = IntersectionOf(line, new Line(polygon[index], polygon[index2])); if (intersection == Intersection.Intersection) { return intersection; } if (intersection == Intersection.Tangent) { tangent = true; } } return tangent ? Intersection.Tangent : IntersectionOf(line.P1, polygon); } public static Intersection IntersectionOf(PointF point, Polygon polygon) { switch (polygon.Length) { case 0: return Intersection.None; case 1: if (polygon[0].X == point.X && polygon[0].Y == point.Y) { return Intersection.Tangent; } else { return Intersection.None; } case 2: return IntersectionOf(point, new Line(polygon[0], polygon[1])); } int counter = 0; int i; PointF p1; int n = polygon.Length; p1 = polygon[0]; if (point == p1) { return Intersection.Tangent; } for (i = 1; i <= n; i++) { PointF p2 = polygon[i % n]; if (point == p2) { return Intersection.Tangent; } if (point.Y > Math.Min(p1.Y, p2.Y)) { if (point.Y <= Math.Max(p1.Y, p2.Y)) { if (point.X <= Math.Max(p1.X, p2.X)) { if (p1.Y != p2.Y) { double xinters = (point.Y - p1.Y) * (p2.X - p1.X) / (p2.Y - p1.Y) + p1.X; if (p1.X == p2.X || point.X <= xinters) counter++; } } } } p1 = p2; } return (counter % 2 == 1) ? Intersection.Containment : Intersection.None; } public static Intersection IntersectionOf(PointF point, Line line) { float bottomY = Math.Min(line.Y1, line.Y2); float topY = Math.Max(line.Y1, line.Y2); bool heightIsRight = point.Y >= bottomY && point.Y <= topY; //Vertical line, slope is divideByZero error! if (line.X1 == line.X2) { if (point.X == line.X1 && heightIsRight) { return Intersection.Tangent; } else { return Intersection.None; } } float slope = (line.X2 - line.X1)/(line.Y2 - line.Y1); bool onLine = (line.Y1 - point.Y) == (slope*(line.X1 - point.X)); if (onLine && heightIsRight) { return Intersection.Tangent; } else { return Intersection.None; } } }
Not directly, but I use the [Agent Smith][1] plugin for R# to do this. Unfortunately, R# isn't free. [1]: http://www.agentsmithplugin.com/
Take a look at [ReSharper][1]. It's an awesome tool and a definite must-have. Version 4.0 has the code formatting and clean-up feature that you are looking for. [1]: http://www.jetbrains.com/resharper
It wouldn't be. Creating an index is more complex than simply scanning the column, even if the computational complexity is the same. That said - how many columns do you have? Are you sure you can't just create an index for each of them if the query time for a single find is too long?
I dont´t know ASP.NET MVC, but I am very familiar with MVC pattern. I don´t see another way to build professional applications without MVC. And it has to be MVC model 2, like Spring or Struts. By the way, how you people were building web applications without MVC? When you have a situation that some kind of validation is necessary on every request, as validating if user is authenticated, what is your solution? Some kind of include(validate.aspx) in every page?
I'm no DBA, but I would guess that building the index would require scanning the table anyway. Unless there are going to be multiple queries on that column, I would recommend not creating the index. Best to check the explain plans/execution times for both ways, though!
The database I did most of my work on used 'Y' / 'N' as booleans. With that implementation, you can pull off some tricks like: 1. Count rows that are true: SELECT SUM(CASE WHEN BOOLEAN_FLAG = 'Y' THEN 1 ELSE 0) FROM X 2. When grouping rows, enforce "If one row is true, then all are true" logic: SELECT MAX(BOOLEAN_FLAG) FROM Y Conversely, use MIN to force the grouping false if one row is false.
PHP and JavaScript regex
|javascript|php|regex|
After my webform is submitted, regex will be applied to user input on the server side (via PHP). I'd like to have the identical regex running in real-time on the client side to show the user what the real input will be. This will be pretty much the same as the Preview section on the Ask Question pages on StackOverflow except with PHP on the back-end instead of .NET. What do I need to keep in mind in order to have my PHP and JavaScript regular expressions act exactly the same as each other?
As long as strings can be viewed directly as a char array it's going to be really hard to convince me that std::string represents strings as first class citizens in C++. Besides, combining allocation and boundedness seems to be a bad idea to me anyways. MSN
Variables in C++ can either be declared on the stack or the heap. When you declare a variable in C++, it automatically goes onto the stack, unless you explicitly use the new operator (it goes onto the heap). MyObject x = MyObject(params); // onto the stack MyObject * y = new MyObject(params); // onto the heap This makes a big difference in the way the memory is managed. When a variable is declared on the stack, it will be deallocated when it goes out of scope. A variable on the heap will not be destroyed until delete is explicitly called on the object.
Yes, the whole point of the test name is that it tells you what doesn't work when the test fails.
Is there a best .NET algorithm for credit card encryption?
|.net|security|encryption|cryptography|
The .NET `System.Security.Cryptography` namespace has a rather bewildering collection of algorithms that I could use for encryption of credit card details. Which is the best? It clearly needs to be secure for a relatively short string.
The .NET `System.Security.Cryptography` namespace has a rather bewildering collection of algorithms that I could use for encryption of credit card details. Which is the best? It clearly needs to be secure for a relatively short string. EDIT: I'm in the UK, where I understand we're OK storing encrypted credit card details so long as the three-digit CVV number is never stored. And thanks all for the great responses.
If you're writing a VM in C, it turns out that using (gcc's) computed gotos like this: <pre><code>char run(char *pc) { void *opcodes[3] = {&&op_inc, &&op_lda_direct, &&op_hlt}; #define NEXT_INSTR(stride) goto *(opcodes[*(pc += stride)]) NEXT_INSTR(0); op_inc: ++acc; NEXT_INSTR(1); op_lda_direct: acc = ram[++pc]; NEXT_INSTR(1); op_hlt: return acc; }</code></pre> works much faster than the conventional switch inside a loop.
To add to kamen's great answer, I would say that on some browsers, the parse time for larger js resources grows non-linearly. That is, a 1 meg JS file will take longer to parse than two 500k files. So if a lot of your traffic is people who are likely to have your JS cached (return visitors), and all your JS files are cache-stable, it may make sense to break them up even if you end up loading all of them on every pageview.
Do a Console.ReadKey(). If you get a Tab, look at what you have in the command buffer, and loop through your available commands. If <code>someCommand.Name.BeginsWith(currentinput)</code>, you have a winner, and you can write to screen a list of possible commands. If _there is only one(TM)_ you can substitute it with what the user had typed :)
If you are using a 3rd party payment gateway, you don't need to store the numbers. There is no point.
$obj->dbi_commit(); may be what you are looking for if you have uncompleted transactions. However, this is not very likely the case, as it tends to complete any lingering transactions automatically on destruction. When you do this: Music::Artist->purge_object_index_every(2000); You are telling it to examine the object cache every 2000 object loads and remove any dead references to conserve memory use. I don't think that is what you want at all. Furthermore, Music::DBI->clear_object_index(); Removes all objects form the live object index. I don't know how this would help at all; it's not flushing them to disk, really. It sounds like what you are trying to do should work just fine the way you have it, but there may be a problem with your SQL or elsewhere that is preventing the INSERT or UPDATE from working. Are you doing error checking for each database query as the perldoc suggests? Perhaps you can begin there or in your database error logs, watching the queries to see why they aren't being completed or if they ever arrive. Hope this helps!
If you are using Visual Studio 2005 and up you can create a setter/getter real fast using the insert snippet command. Right click on your code click on Insert Snippet (Ctrl+k,x) and then choose "prop" form the list. Hope this helps.
1. A function that calls itself 2. When a function can be (easily) decomposed into a simple operation plus the same function on some smaller portion of the problem. I should say, rather, that this makes it a good candidate for recursion. 3. They do! The canonical example is the factorial which looks like: int fact(int a) { if(a==1) return 1; return a*fact(a-1); } In general, recursion isn't necessarily fast (function call overhead tends to be high because recursive functions tend to be small, see above) and can suffer from some problems (stack overflow anyone?). Some say they tend to be hard to get 'right' in non-trivial cases but I don't really buy into that. In some situations, recursion makes the most sense and is the most elegant and clear way to write a particular function.
1. A function that calls itself 2. When a function can be (easily) decomposed into a simple operation plus the same function on some smaller portion of the problem. I should say, rather, that this makes it a good candidate for recursion. 3. They do! The canonical example is the factorial which looks like: int fact(int a) { if(a==1) return 1; return a*fact(a-1); } In general, recursion isn't necessarily fast (function call overhead tends to be high because recursive functions tend to be small, see above) and can suffer from some problems (stack overflow anyone?). Some say they tend to be hard to get 'right' in non-trivial cases but I don't really buy into that. In some situations, recursion makes the most sense and is the most elegant and clear way to write a particular function. It should be noted that some languages favor recursive solutions and optimize them much more (LISP comes to mind).
Rather than using ctrl+k,x you can also just type `prop` and then hit tab twice
A recursive function is one which calls itself. The most common reason I've found to use it is traversing a tree structure. For example, if I have a TreeView with checkboxes (think installation of a new program, "choose features to install" page), I might want a "check all" button which would be something like this (pseudocode): function cmdCheckAllClick { checkRecursively(TreeView1.RootNode); } function checkRecursively(Node n) { n.Checked = True; foreach ( n.Children as child ) { checkRecursively(child); } } So you can see that the checkRecursively first checks the node which it is passed, then calls itself for each of that node's children. You do need to be a bit careful with recursion. If you get into an infinite recursive loop, you will get a Stack Overflow exception :) I can't think of a reason why people shouldn't use it, when appropriate. It is useful in some circumstances, and not in others. I think that because it's an interesting technique, some coders perhaps end up using it more often than they should, without real justification. This has given recursion a bad name in some circles.
Visual Studio also has a feature that will generate a Property from a private variable. If you right-click on a variable, in the context menu that pops up click on the "Refactor" item. Then choose encapsulate field. This will create a getter/setter property for a variable. I'm not too big a fan of this technique as it is a little bit awkward to use if you have to create a lot of getters/setters, and it puts the property directly below the private field, which bugs me because I usually have all of my private fields grouped together, and this Visual Studio feature breaks my class' formatting.
> You might also want to look into Comet. > I thought everyone used cometd for this sort of thing. BOSH is a standard for transporting XMPP over HTTP. It involves Comet for pushing data to the client.
I've encountered this bug, and while I don't know how to solve it, you can work around it by pressing `<down><up>`
I've never used Makepp personally, but since it's a drop-in replacement for GNU Make, you should be able to do something like: build: foo.h foo.cpp g++ $(CFLAGS) foo.cpp -o $(LFLAGS) foo foo.h foo.cpp: foo.lzz lzz foo.lzz Also not sure about the lzz invocation there, but that should help. You can read more about this at [http://theory.uwinnipeg.ca/gnu/make/make_37.html][1]. [1]: http://theory.uwinnipeg.ca/gnu/make/make_37.html
There isn't much information on this out there but it seems to be their own custom controls plus an IE component (and not Qt like Google Earth). [This forum thread][1] has a little bit of information. [1]: http://www.customizetalk.com/forums/viewtopic.php?t=841&postdays=0&postorder=asc&start=0
There isn't much information on this out there but it seems to be their own customized controls plus an IE component (and not Qt like Google Earth). [This forum thread][1] has a little bit of information. [1]: http://www.customizetalk.com/forums/viewtopic.php?t=841&postdays=0&postorder=asc&start=0
Check out [this thread][1] for a discussion on the reasons behind this behavior (including that, according to Guido, it's [not likely to change][2]). [1]: http://mail.python.org/pipermail/python-3000/2007-September/010209.html [2]: http://mail.python.org/pipermail/python-3000/2007-September/010222.html
Check out [this thread][1] for a discussion on the reasons behind this behavior (including that Guido likes it, and it's [not likely to change][2]). [1]: http://mail.python.org/pipermail/python-3000/2007-September/010209.html [2]: http://mail.python.org/pipermail/python-3000/2007-September/010222.html
I've had good luck using the DocLibHelper wrapper class described here: [http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html][1] [1]: http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
It really comes down to the nature of your database and application. What kind of application(s) are hitting SQL Server? In my experience, it only handles 5-10 users with a heavy read/write application.
Windows is not the usual place to deploy production Rails apps, but there are people who do it. Mongrel was originally written to give better deployment options for Windows. As it turned out the UNIX deployment options weren't that good either. :) Start with the Ruby One Click installer so you have a sane installation of ruby and rubygems. From there, you install the rails gem and the gem for your database like you normally would. Most if not all of the databases have Windows gems. Make sure to install mongrel_service to be able to control each mongrel like a normal windows service. See `mongrel_rails service::install -h` for details. Once you have your mongrels set up, it's similar to a UNIX deployment. You set up a reverse proxy, such as Apache2 and you're set. You might run into some gems (such as [BackgroundRB][1]) that will not work under Windows because they have C code that either rely on UNIX libraries or expect a UNIX-like build system at installation time. However, all of the really important Rails gems, such as Mongrel and the database adapters, have gems with pre-built binaries available, so you'll be fine. [1]: http://backgroundrb.rubyforge.org/
##lolcode: sorry I couldn't resist xD HAI CAN HAS STDIO? I HAS A VAR I HAS A INT I HAS A CHEEZBURGER I HAS A FACTORIALNUM IM IN YR LOOP UP VAR!!1 TIEMZD INT!![CHEEZBURGER] UP FACTORIALNUM!!1 IZ VAR BIGGER THAN FACTORIALNUM? GTFO IM OUTTA YR LOOP U SEEZ INT KTHXBYE
Agree with @SCdF, create a service in php or any other language that takes a modified query from flash, executes it and returns the DB response. Make sure that it only takes a connection from its own local IP address or something like that to prevent "unintentional use".
Yes. It will work just fine. I have a PHP script using the mail() function with the MX records set to Google Apps. If the two scripts are on different hosts (it's a bit unclear from your post), then make sure that the host doesn't block some of the custom headers. I had issues with this when creating my script, but removing all but the From header fixed the problem.