StackOverflow.com
Random snippets of all sorts of code
Merge earlier Mercurial changeset with tip
Recent Questions - Stack Overflow | 22 May 2012, 3:21 am
I have a local Mercurial project. The tip revision is 562.
In revision 549 I made changes to 4 files in the project. These files have had other changes made in from revisions 550 through 562.
How can I compare and merge revision 562 (tip) with the changes made in revision 549? Basically I want to add back the code I deleted in revision 549 to the tip.
SQL Server join Unrelated Tables
Recent Questions - Stack Overflow | 22 May 2012, 3:20 am
I want to join this this two unrelated table:table 1id *name* age 1 a 9 2 b 11 3 c 10
table 2id *school* address 1 aa abc 1 bb efg 2 cc hij
and the result is like this:id *school* address *age* name 1 aa abc 9 a 1 bb efg 9 a 2 cc hij 11 b 3 NULL NULL 10 c
How can I get this result?
php - delete words from array by matching external text file
Recent Questions - Stack Overflow | 22 May 2012, 3:20 am
I have an array and an external file, both contains lots of words. I want to match strings in the array with the entire external file. Then if there are identical words, I want to delete the word from the array.
Much shorten example:
$words = {"apple", "orange", "banana", "grape", "peach"}The external text file is a pure list of words
applebananamelon...I'd like to delete the words that are in the external file, and finally get this.
$words = {"orange", "grape", "peach"}Should I call the external file, slice every line, then save them to another array? Then compare with the source array?What is the most effective way to compare the array and a text file? I'd appreciate your wisdom!
Jpeg wireless transfer with fwrite(); Need to handle lost packets
Recent Questions - Stack Overflow | 22 May 2012, 3:19 am
I am developing a device that takes a picture and transfers that picture to desktop computer receiver wirelessly through radio waves. On the receiver end, I am using C and fwrite() to rebuild the image file sent by split packets of data. Receiving a packet executes:
fwrite(&data[3], size, 1, filename);data[3] is an unsigned 8 bit integer, data type u08.
I confirm that wired file transfer works. If the transmitter and receiver are directly connected, there is no problem.
However, the radio signal is not strong enough to guarantee that all packets will be received. In my testing, lost in transmission packets are common. If even one packet is lost, the image file becomes corrupt. Received rate is roughly 85%.
Every packet is numbered. If the received packet number is greater than the expected packet number, then the receiver knows that a packet has been dropped.
My solution is to loop and replace missing packets with a default packet while incrementing the expected packet number counter. Basically, I plan to fill lost pixels with black pixels, using the received packets to create the most completely picture possible. I do not know how to do this. I tried simply setting data[3] to 0 if the received packet number and expected packet number do not match up, but this did not work.
I welcome other proposed solutions.
How to setup the Fabric.js?
Recent Questions - Stack Overflow | 22 May 2012, 3:19 am
guys.
I am very new to fabric.js. I have downloaded the fabric.js. But I don't know how to start it. For example :
<html><head><script src="all.min.js"></script></head> <body> <canvas id="canvas" width="800" height="450" style="border:1px solid #000000"></canvas> <script> </html>I couldn't see anything... Can you please some body give the full sample code for me?? Then I will understand.
The header file of RWTexture2D
Recent Questions - Stack Overflow | 22 May 2012, 3:19 am
I got the error of identifier "RWTexture2D" is undefined but nowhere to find the hearder file of RWTexture2D. Does any bodyknow that or any other solution?
How to show the sql django runs?
Recent Questions - Stack Overflow | 22 May 2012, 3:19 am
Yep, so there is a question like this on SO already, with the answer:
>>> from django.db import connection>>> connection.queries[{'sql': 'SELECT polls_polls.id,polls_polls.question,polls_polls.pub_date FROM polls_polls','time': '0.002'}]
the problem is, i have no idea what that means. I can see it is being run from a console, but my django project, well, it runs as a django project!
Where do i put this code? In the html view? In the view.py? In the model.py?
thanks!
Creating an app similar to istorybooks
Recent Questions - Stack Overflow | 22 May 2012, 3:18 am
I currently have a set of storybook applications which I have developed for Android phones. The problem is I have them as individual apps which quickly fill up the App drawer thus inconveniencing the user. Since this apps all borrow from the same template (set of classes like MediaPlayer, ViewFlipper etc), I need help with developing something like the "istorybooks" android app. Many of the storybook applications on Android use the same process which allows them develop a single library-like app then multiple storybooks which the user can download to their device for use. Once downloaded, these apps are readable via the single library-like app and can also be removed.
how to build the chromium icu on linux separately?
Recent Questions - Stack Overflow | 22 May 2012, 3:18 am
the official icu can't handle some chinese like "镕". the chromium icu work well,but i just compiled the chromium on windows. i don't want to compiled the chromium again on the linux.so how to build icu on the linux separately with gyp http://code.google.com/p/gyp?
i tried like this:
gyp icu.gyp
then i got this error:
could not automatically locate src directory. use --depth as a workaround
thanks!
Two Django projects conflicting with one another
Recent Questions - Stack Overflow | 22 May 2012, 3:18 am
I have two separate Django projects, one at / and the other at /foo. Intermittently, if I attempt to access the project at /, it will raise a PageNotFound exception and show the URL file from the /foo project, and vice versa. I'm assuming there's some sort of conflict with Apache or mod_wsgi, but I can't really find what it is. Is there a way to avoid this? I don't really want to run each project on a separate domain, which seems to work.
Recent Questions - Stack Overflow