instruction stringlengths 0 30k ⌀ |
|---|
I am looking to develop a kernel module which can hook directly into the TCP stack on a FreeBSD machine. I have read the tutorials and anything else I could find on developing KLD's which isn't much of a problem, but can anyone tell me, for example, how I could obtain the src and dest address of a packet that is being ... |
|c|tcp|stack|bsd|freebsd| |
It's not just a capture I'm looking to do here. I want to first capture the packet, then in real time, check the payload for specific data, remove it, inject a signature and reinject the packet into the stack to be sent on as before.
I had a read of the ipfw divert sockets using IPFW and it looks very promising. Wha... |
Ubiquity Hack |
|ubiquity|hacks|firefox|efficiency| |
What's the most useful hack you've discovered for Mozilla's new [Ubiquity][1] tool?
[1]: http://labs.mozilla.com/2008/08/introducing-ubiquity/ |
|firefox|efficiency|hacks|ubiquity| |
|firefox|efficiency|hacks|ubiquity| |
|firefox|ubiquity| |
I use Perl for anything beyond extremely simple scripts.
I also 'use warnings', 'use strict', avoid backticks, call system as 'system($command, @and_args)'. And because I like it to be maintainable: IPC::Run (for pipes), File::Fu (for filenames, tempfiles, etc), YAML (for configs or misc data), and Getopt::Helpful... |
In the Oracle world the general order of devlopment should be:
Wherever possible do it purely with SQL.
If you need more than SQL do it with PL/SQL.
If you need something that PL/SQL can't do, then use Java.
If all else fails use C.
If you can't do it with C, back slowly away from the problem....
PL/SQL store... |
One problem I've run into is that embedded Win Forms controls do not participate in any transform operations applied to their WPF container. This results in visual flashing effects and the embedded control appearing in an innappropriate location. I worked around this by binding the visibility of the Windows Forms Hos... |
You can try ScreenweaverHX:
http://haxe.org/com/libs/swhx
It's the haXe-based successor of the old Screenweaver. However, it's not as simple as the old version used to be. Most likely you need to take a look to the basics of haXe and Neko, the 2 technologies it's based on.
There's another project on top of SWH... |
I think you are overcomplicating things... you might consider a scripting language that you can use against all 3. I know Ruby could be used to test Java via JRuby, and C# via IronRuby, but I don't know about AS3.
I have never needed to do this myself, but I imagine a dynamic language like Ruby could really let you... |
What View Engine are you using with ASP.NET MVC? |
|asp.net-mvc| |
I know you can use several different view engines with ASP.NET MVC:
- ASPX, obviously
- NVelocity
- Brail
- NHaml
- et al...
The default ASPX view engine seems to make the most sense to me, coming from an ASP.NET WebForms background.
But, I wanted to get an idea of the pros and cons of each and... |
|asp.net-mvc|mvc| |
|asp.net|asp.net-mvc|mvc| |
When should you use java stored procedures with an Oracle database ... what are the drawbacks? |
|java|oracle-database|stored-procedures|plsql| |
PL/SQL is not my native tongue. Oracle supports writing stored procedures in Java. What are the advantages of doing this over writing the stored procedures in PL/SQL |
As a side note, you could also try writing a compiler of sorts, much like FogCreek's (in)famous Wasabi language, then you could write both your code and tests in that language, and have the compiler do your work.... this of course would probably be overcomplicated, but I think it would be a lot better than attempting t... |
There are tons of references on this (of course, Stevens' book comes to mind), but I found the [Beej guide][1] to be incredibly useful for getting started. It's meaty enough that you can understand what's really happening, but it's simple enough that it doesn't take you several days to write a 'hello world' udp client... |
I think your question would be more likely to receive answers if you edited it to say what you've tried and give the errors you received.
Good luck! |
Thanks for revising the question.
It looks like a definite linker issue. I see that the first undefined symbol is related to webdav. Are you sure you have that library in the right place? I see you give a nice long path with lots of svn libs, maybe it's possible you overlooked just one? |
easy:
<br/>include sys/socket.h
<br/>include sys/types.h
int socket(int protocolFamily, int Type, int Protocol) // returns a socket descriptor
<br/>
int bind(int socketDescriptor, struct sockaddr* localAddress, unsigned int addressLength) // returns 0
<br/>
...etc.
it's all in sys/socket.h |
I faced this issue some time back.. most of the clients (including web) block HTML! We just created a web version of the email and added this to the footer of the email "If you are not able to view the message click here (link to web version). It was simply because some people think that its not safe to display images ... |
You do this the exact same way you would in regular C, there is no C++ specific way to do this in the standard library.
The tutorial I used for learning this was <http://beej.us/guide/bgnet/>. It was the best tutorial I found after looking around, it gave clear examples and good explanations of all functions it desc... |
Qt's control is HTML, not RTF (though foobar may just mean rich text, in which case it would be fine) |
Good question... it's one that has many solutions, because this type of problem comes
up many times in Graphical and Scientific applications.
Depending on the solution you require it may be rather complex under the hood, in this
case less code doesn't necessarily mean faster.
*"but this makes it quite tedious... |
[It's All Text!][1]
From the extension page:
> At the bottom right corner of any edit
> box, a little edit button will appear.
> Click it. If this is the first time
> you've used "It's All Text!" then you
> will be asked to set your preferences,
> most importantly the editor.
>
> The web page will pop u... |
http://support.microsoft.com/default.aspx?scid=kb;EN-US;918483
Walks through the user rights required to pin pages |
Shove the list of images in a file, one per line. Then use mf://@filename |
Create instance of generic type in Java? |
|java|generics| |
Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is "no" (due to type erasure), but I'd be interested if anyone can see something I'm missing:
private static class SomeContainer<E>
{
E createContents()
{
retur... |
Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is "no" (due to type erasure), but I'd be interested if anyone can see something I'm missing:
class SomeContainer<E>
{
E createContents()
{
return what???
... |
Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is "no" (due to type erasure), but I'd be interested if anyone can see something I'm missing:
class SomeContainer<E>
{
E createContents()
{
return what???
... |
The "It's all Text" extension, perhaps?
http://addons.mozilla.org/en-US/firefox/addon/4125 |
Listening to your recovery feed could also have a potential impact on a network level. As pjz mentioned, your NIC and IP stack will have more frames/packets to process. In addition, more of your available bandwidth is being used up by data that is not being used by your application; this could lead to dropped frames if... |
Fool some class or module telling it has required something that it really hasn't required:
$" << "something"
This is useful for example when requiring A that in turns requires B but we don't need B in our code (and A won't use it either through our code):
For example, Backgroundrb's `bdrb_test_helper requ... |
I would load the feed into an XmlDocument and use XPATH instead of regex, like so:
XmlDocument doc = new XmlDocument();
HttpWebRequest request = WebRequest.Create(feedUrl) as HttpWebRequest;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamRea... |
You should take a look at the SuperTabNavigator component from the [FlexLib][1] project:
- [SuperTabNavigator example][2]
- [SuperTabNavigator documentation][3]
- [FlexLib Component list][4]
If you don't want all of the tabs to have close buttons (I understand from the question that you don't) it looks like ... |
How do I convert jstring to wchar_t |
|c++|java-native-interface| |
Let's say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows:
const char* ansiString = env->GetStringUTFChars(myString, 0);
is there a way of getting
const wchar_t* unicodeString = ... |
use anything that responds to `===(obj)` for case comparisons:
case foo
when /baz/
do_something_with_the_string_matching_baz
when 12..15
do_something_with_the_integer_between_12_and_15
when Bar
do_something_with_the_instance_of_Bar
when some_object
do_something_wit... |
use anything that responds to `===(obj)` for case comparisons:
case foo
when /baz/
do_something_with_the_string_matching_baz
when 12..15
do_something_with_the_integer_between_12_and_15
when lambda { |x| x % 5 == 0 }
# only works in Ruby 1.9 or if you alias Proc#call as Proc#==... |
I would absolutely recommend to just do a plain HTTP request to your website. Everything else is bound to fail.
I'd make a HTTP GET request to a certain page on your site containing the version of the local application.
like
http://www.example.com/update?version=1.2.4
Then you can return what ever you w... |
I would absolutely recommend to just do a plain HTTP request to your website. Everything else is bound to fail.
I'd make a HTTP GET request to a certain page on your site containing the version of the local application.
like
http://www.example.com/update?version=1.2.4
Then you can return what ever you w... |
As long as you are using locks to control access to the variable, you do not need volatile on it. In fact, if you're putting volatile on any variable you're probably already wrong.
[http://softwareblogs.intel.com/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/][1]
[1]: http://softwareblogs... |
What language are you using? In Python, Pygame can do this for you. Use the RenderUpdates Group and some Sprite objects with image and rect attributes.
For example:
#!/usr/bin/env python
import pygame
class DirtyRectSprite(pygame.sprite.Sprite):
"""Sprite with image and rect attribu... |
Try splitting your code into an unsigned jar and a signed jar. |
Yet another vote for Oracle SQl Developer. But TOAD works too. |
Personally, I think you might be better off handling this with something like FxCop. You should be able to write a rule that check so see if when an object is created that implements IDisposable that you use a using statement.
It seems a little dirty (to me) to automatically dispose an object. |
I answered my own question after waiting SECONDS for an answer here :-)
You can indeed have different colors for different data elements. For example:
http://http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t:1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c... |
I answered my own question after waiting SECONDS for an answer here :-)
You can indeed have different colors for different data elements. For example:
http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t:1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c,ffff00... |
In 7.0 or 2000, you can modify and use the following code:
SELECT convert(varchar(100),
'GRANT ' +
CASE WHEN actadd & 32 = 32 THEN 'EXECUTE'
ELSE
CASE WHEN actadd & 1 = 1 THEN 'SELECT' + CASE WHEN actadd & (8|2|16) > 0 THEN ',... |
The NetDataContract works because the NetDataContractSerializer includes type information.
The KnownType attribute instructs the DataContractSerializer how to deserialize the message. Being implementation specific, this is information over-and-above that defined by the public contract and doesn't belong in the WSDL.... |
Unit testing IHttpModule |
|c#|asp.net|unit-testing|mvc|mocking| |
How do you unit test a HttpModule in asp.net given that HttpApplication and HttpContext do no implement an interface ? |
|c#|asp.net|unit-testing|mocking| |
Escaping strings with jQuery |
|javascript|jquery|mvc| |
Does anyone know of an easy way to escape HTML from strings in [jQuery][1]? I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks). I'm sure it's possible to extend jQuery to do this, but I don't know enough about the frame... |
|javascript|jquery| |
I'm using Zend_Test to completely test all controllers. It's quite simple to set up, as you only have to set up your bootstrap file (the bootstrap file itself should NOT dispatch the front controller!). My base test-case class looks like this:
abstract class Controller_TestCase extends Zend_Test_PHPUnit_Controll... |
I would absolutely recommend to just do a plain HTTP request to your website. Everything else is bound to fail.
I'd make a HTTP GET request to a certain page on your site containing the version of the local application.
like
http://www.example.com/update?version=1.2.4
Then you can return what ever you w... |
No. That's the whole point of overriding. |
Web services, such as those created by WCF, are often best used in a "stateless" way, so each call to a Web service starts afresh. This simplifies the server code, as there's no need to have a "session" that recalls the state of the client. It also simplifies the client code as there's no need to hold tickets, cookies,... |
In the Oracle world the general order of development should be:
Wherever possible do it purely with SQL.
If you need more than SQL do it with PL/SQL.
If you need something that PL/SQL can't do, then use Java.
If all else fails use C.
If you can't do it with C, back slowly away from the problem....
PL/SQL stor... |
It sure sounds nice but I have yet to see it implemented in a practially working way.
I hold it like this: The Code is the model. That way your model and your code are always up to date :-) |
If you've got some SQL chops, you could prune relevant bits from [F\_TABLE\_DATE][1]. Or, if you like having a monster function around, you could just use the whole shebang. You'd have to manufacture a sensible start and end date to pass into F\_TABLE\_DATE though.
[1]: http://www.sqlteam.com/forums/topic.asp?TOPI... |
As far as I *know* (without any legal training) - if you list the text or code or whathaveyou as "anonymous", you're OK.
I believe that by listing it as anonymous you're indicating you do not know where it came from, but you're admitting you didn't create it as original work.
Extending from that, you should be o... |
Python and User input |
|python|input| |
How do I have a Python script that can accept user input (assuming this is possible) and how do I make it read in arguments if run from the command line? |
The open source Python package,[SciPy][1], has quite a large set of optimization routines including some for multivariable problems with constraints (which is what fmincon does I believe). Once you have SciPy installed type the following at the Python command prompt
help(scipy.optimize)
The resulting document is... |
I'd suggest just doing window.onload:
<script type="text/javascript">
(function() {
var private = "private var";
window.onload = function() {
console.log(private);
}
})();
</script> |
If you don't want to use an IDE/text editor with automatic indenting, you can use the pindent.py script that comes in the Tools\Scripts directory. It's a preprocessor that can convert code like:
def foobar(a, b):
if a == b:
a = a+1
elif a < b:
b = b-1
if b > a: a = a-1
end if
e... |
If you consider a call frame to be a process, and the stack to be your Unix machine, you could consider a fork bomb to be a *parallel* program to create a stack overflow condition. Try this 13-character bash number. No saving to a file is necessary.
:(){ :|:& };:
|
Depends what you want to do, but to avoid polluting the global namespace, you could attach your code to the element you care about.
e.g.
<div id="special">Hello World!</div>
<script>
(function(){
var foo = document.getElementById('special');
foo.mySpecialMethod = function(otherID... |
> Private variables/properties are not
> serialized in XML serialization, but
> are in binary serialization.
I believe this also gets you if you are exposing the private members through public properties - the private members don't get serialised so the public members are all referencing null values. |
No, you're wrong. The documentation states clearly that under non-GC, -drain is equivalent to -release, meaning the NSAutoreleasePool will **not** be leaked. |
Emacs! Seriously, its use of "tab is a *command*, not a *character*", is absolutely perfect for python development. |
Just to be different (and to avoid using a where statement) you could also do:
var numbers = Enumerable.Range(0, n).Select(i => i * 3 + 9);
|
Just to be different (and to avoid using a where statement) you could also do:
var numbers = Enumerable.Range(0, n).Select(i => i * 3 + 9);
**Update** This also has the benefit of not running out of numbers. |
Perforce gets my vote as well. I've not used it on such large projects, but it's absolutely rock solid in my environment. It also has an impressive resume of large projects, as well.
[rumor]I've heard tell that Microsoft used it for Vista.[/rumor] Apparently it was a customised version for them, but it doesn't get ... |
Is it possible for SelectNodes on an XmlDocument to return null? |
|.net|xml| |
Is it possible for SelectNodes() called on an XmlDocument to return null?
My predicament is that I am trying to reach 100% unit test code coverage; ReSharper tells me that I need to guard against a null return from the SelectNodes() method, but I can see no way that an XmlDocument can return null (and therefore, no ... |
|.net|xml|unit-testing|resharper| |
On the advantages front, integration with everything is quite nice :) Seriously, I'm a huge fan of the experimental integration with Visual Studio Team System (screenshots [here][1]). I think that really lowers the bar for those new to unit testing.
The only disadvantage from my perspective *so far* is the fact tha... |
What happens if you create a service. That service is configure to interact with the desktop. Configure it to run a some user and to start automatic. From the service CreateProcess on this other application. I'd guess this is quick to try using C# (C/C++ was alot of code to even be a service if I recall). Would that wo... |
When we evaluated Gallio, we experienced stability issues with large projects. Our smaller projects ran beautifully, however. Great concept...I think it will generate a big buzz once it's a bit more refined.
I might want to add that Resharper support was missing (or broken) for a while, but I've heard it's back. |
You want to use `Restrictions.disjuntion()`. Like so
session.createCriteria(Whatever.class)
.add(Restrictions.disjunction()
.add(Restrictions.eq("name", queryString))
.add(Restrictions.eq("address", queryString))
.add(Restrictions.eq("phoneNumber", queryString))
... |
If you want to just create it that way to begin with, just say
area = {
"Texas": ['Austin','Dallas','San Antonio']
}
and so on. If you're asking how to take an existing object and convert it into this, just say
states = {}
for(var j=0; j<area.length; j++)
states[ area[0].St... |
Is it necessary to reach 100% code coverage? Indeed, is it even possible under normal (i.e. controllable, testable) circumstances?
We often find that using "syntactic sugar" constructions like the `using {}` block, there are "hidden" code paths created (most likely `finally {}` or `catch {}` blocks) that can't be e... |