In different assembly languages MUL (x86)/MULT (mips) refer to multiplication. It is a black box for the programmer. I am interested in how actually a CPU accomplishes a multiplication regardless of the architecture. Lets say I have two 16-bit values in my registers and I am the cpu, so I have to implement MUL using the other bit-fiddling instructions I have (and,or,xor,not,shl,shr,etc). What shall I do?
The __COUNTER__ symbol is provided by VC++ and GCC, and gives an increasing non-negative integral value each time it is used. I'm interested to learn whether anyone's ever used it, and whether it's something that would be worth standardising?
I see the word "BUFFER" everywhere, but I am unable to grasp what it exactly is. Would anybody please explain what is buffer in layman's language? When is it used? How is it used?
This part \( -name *txt -o -name *html \) confuses me in the code: find $HOME \( -name \*txt -o -name \*html \) -print0 | xargs -0 grep -li vpn Can someone explain the the brackets and -o? Is -o a command or a parameter? I know the brackets are escaped by \, but why are they for?
I'm looking for a good JavaScript equivalent of the C/PHP printf() or for C#/Java programmers, String.Format() (IFormatProvider for .NET). My basic requirement is a thousand separator format for numbers for now, but something that handles lots of combinations (including dates) would be good. I realize Microsoft's Ajax library provides a version of String.Format(), but we don't want the entire overhead of that framework.
I have a sample application which has something like below. <a href="javascript:{}" id="anchorlnk">Go</a> which javascript function does the link call?
I'm trying to narrow down the rows that are in my DataView based on a relation with another table, and the RowFilter I'm using is as follows; dv = new DataView(myDS.myTable, "id IN (SELECT DISTINCT parentID FROM myOtherTable)", "name asc", DataViewRowState.CurrentRows); "myTable" and "myOther" table are related via myTable.ID and myOtherTable.parentID, and so the idea is that the DataView should only contain rows from "myTable" which have corresponding child rows in "myOtherTable". Unfortunately, I'm getting this error; Syntax error: Missing operand after 'DISTINCT' operator. The SQL is fine a
'hello, world' is usually the first example for any programming language. I've always wondered where this sentence came from and where was it first used. I've once been told that it was the first sentence ever to be displayed on a computer screen, but I've not been able to find any reference to this. So my question is: Where does the practice to use 'hello, world' as the first example for computer languages originate from? Where was it first used? Update Although the answers are quite interesting, I should have noted that I had read the Wikipedia article. It does answer the question about the
I've been working on a web app using Django, and I'm curious if there is a way to schedule a job to run periodically. Basically I just want to run through the database and make some calculations/updates on an automatic, regular basis, but I can't seem to find any documentation on doing this. Does anyone know how to set this up? To clarify: I know I can set up a cron job to do this, but I'm curious if there is some feature in Django that provides this functionality. I'd like people to be able to deploy this app themselves without having to do much config (preferably zero). I've considered trigg
I've been Googling around with no luck. I'm looking for a way to do getc() or gets() or whatever that does not echo to the terminal. I saw kbhit() but this doesn't appear to be part of ANSI. Ideally, I'd like code that looks like char s[100]; no_echo_gets(s); /* Won't echo to screen while being typed */ printf("%s\n", s); Does anybody know a good ANSI compliant way to do this?
How do I echo one or more tab characters using a bash script? When I run this code res=' 'x # res = "\t\tx" echo '['$res']' # expect [\t\tx] I get this res=[ x] # that is [<space>x]
Suppose we have these local variables: int a = 0; int b = 1; int c = 2; int d = 3; As far as I know, these will be allocated on the system stack, like this: | | | 3 | d | 2 | c | 1 | b |_0_| a Does this mean that in order to get the value of a, the values of d, c and b must first be popped out of the stack? If so, where do these values go? Does this mean that accessing more recently declared variables will be faster? Or am I missing something (which I suspect is the case), and the whole thing works in some other way?
I have an element that already has a class: <div class="someclass"> ... </div> How can i add a class to the div (not replace, but add) with JavaScript?
I'm developing software which will be deployed using clickonce (on the website foo.com), and which will then connect to my server using WCF with an encrypted transport So I need an SSL certificate which will: Identify my foo.com website has really being my website Identify the exe I deploy using clickonce as being genuine Identify my application server has really being my application server. I also want my SSL certificate to be signed by an authority known to the public (ie, firefox or windows won't ask the user to install the authority's certificate first !) What SSL certificate should I get?
Which code-Analyzer or Code-Review tool do you suggest , For Analyzing DotNet 2.0 & 3.5 code and getting All classes , Methods , Properties , Instances , Definition , Databases & and their relation to code , I want to get print-ready Information about codes & projects , ( here I dont mean a tool for testing the code & structures ) Is there anyone with similar specifications ?
I have a huge (but finite) set of natural language strings. I need a way to convert each string to a numeric value. For any given string the value must be the same every time. The more "different" two given strings are, the more different two corresponding values should be. The more "similar" they are, the less different values should be. I do not know yet what exact definition of difference between strings I need. No natural language parsing anyway. It should probably be something Levenstein-like (but Levenstein is relative and I need absolute metric). Lets start with something simple. Update
I am writing a WordPress plugin. I want to perform a redirect (after creating database records from POST data) to another admin page. Neither header("Location: ...") nor wp_redirect() work; I receive: Warning: Cannot modify header information - headers already sent by ... How do I properly perform a redirect inside the WordPress admin?
I've been developing a java application using git as source code repository. I'd like to share the project with other java developers and hg seems to be most used by them. My question is how do I convert a git repository to hg? If I tried googling "convert git to hg" and every search hit is about converting from hg to git. I'm also using TortoiseHg.
The C standard library is notoriously poor when it comes to I/O safety. Many functions have buffer overflows (gets, scanf), or can clobber memory if not given proper arguments (scanf), and so on. Every once in a while, I come across an enterprising hacker who has written his own library that lacks these flaws. What are the best of these libraries you have seen? Have you used them in production code, and if so, which held up as more than hobby projects?
From the man page for XFillPolygon: If shape is Complex, the path may self-intersect. Note that contiguous coincident points in the path are not treated as self-intersection. If shape is Convex, for every pair of points inside the polygon, the line segment connecting them does not intersect the path. If known by the client, specifying Convex can improve performance. If you specify Convex for a path that is not convex, the graphics results are undefined. If shape is Nonconvex, the path does not self-intersect, but the shape is not wholly convex. If known by the client, specifying Nonconvex inst
I've been learning C#, and I'm trying to understand lambdas. In this sample below, it prints out 10 ten times. class Program { delegate void Action(); static void Main(string[] args) { List<Action> actions = new List<Action>(); for (int i = 0; i < 10; ++i ) actions.Add(()=>Console.WriteLine(i)); foreach (Action a in actions) a(); } } Obviously, the generated class behind the lambda is storing a reference or pointer to the int i variable, and is assigning a new value to the same reference every time the loop iterates. Is there a way to force the lamda to grab a copy instead, like the C++0x synt
I'm trying to use this code to replace spaces with _, it works for the first space in the string but all the other instances of spaces remain unchanged. Anybody know why? function updateKey() { var key=$("#title").val(); key=key.replace(" ","_"); $("#url_key").val(key); }
I've models for Books, Chapters and Pages. They are all written by a User: from django.db import models class Book(models.Model) author = models.ForeignKey('auth.User') class Chapter(models.Model) author = models.ForeignKey('auth.User') book = models.ForeignKey(Book) class Page(models.Model) author = models.ForeignKey('auth.User') book = models.ForeignKey(Book) chapter = models.ForeignKey(Chapter) What I'd like to do is duplicate an existing Book and update it's User to someone else. The wrinkle is I would also like to duplicate all related model instances to the Book - all it's Chapters and P