Daily Archives

Articles indexed Monday May 31 2010

Page 8/98 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Writing a managed wrapper for unmanaged (C++) code - custom types/structs

    - by Bobby
    faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration( faacEncHandle hEncoder); I'm trying to come up with a simple wrapper for this C++ library; I've never done more than very simple p/invoke interop before - like one function call with primitive arguments. So, given the above C++ function, for example, what should I do to deal with the return type, and parameter? FAACAPI is defined as: #define FAACAPI __stdcall faacEncConfigurationPtr is defined: typedef struct faacEncConfiguration { int version; char *name; char *copyright; unsigned int mpegVersion; unsigned long bitRate; unsigned int inputFormat; int shortctl; psymodellist_t *psymodellist; int channel_map[64]; } faacEncConfiguration, *faacEncConfigurationPtr; AFAIK this means that the return type of the function is a reference to this struct? And faacEncHandle is: typedef struct { unsigned int numChannels; unsigned long sampleRate; ... SR_INFO *srInfo; double *sampleBuff[MAX_CHANNELS]; ... double *freqBuff[MAX_CHANNELS]; double *overlapBuff[MAX_CHANNELS]; double *msSpectrum[MAX_CHANNELS]; CoderInfo coderInfo[MAX_CHANNELS]; ChannelInfo channelInfo[MAX_CHANNELS]; PsyInfo psyInfo[MAX_CHANNELS]; GlobalPsyInfo gpsyInfo; faacEncConfiguration config; psymodel_t *psymodel; /* quantizer specific config */ AACQuantCfg aacquantCfg; /* FFT Tables */ FFT_Tables fft_tables; int bitDiff; } faacEncStruct, *faacEncHandle; So within that struct we see a lot of other types... hmm. Essentially, I'm trying to figure out how to deal with these types in my managed wrapper? Do I need to create versions of these types/structs, in C#? Something like this: [StructLayout(LayoutKind.Sequential)] struct faacEncConfiguration { uint useTns; ulong bitRate; ... } If so then can the runtime automatically "map" these objects onto eachother? And, would I have to create these "mapped" types for all the types in these return types/parameter type hierarchies, all the way down until I get to all primitives? I know this is a broad topic, any advice on getting up-to-speed quickly on what I need to learn to make this happen would be very much appreciated! Thanks!

    Read the article

  • Py2Exe - "The application configuration is incorrect."

    - by Hach-Que
    I've compiled my Python program using Py2Exe, and on the client's computer we've satisfied all the dependencies using dependency walker, but we still get "The application configuration is incorrect. Reinstalling the application may correct the problem." I'm also using wxPython. The client does not have administrator access. Any ideas?

    Read the article

  • Sourcecode for Paymentroll example in Robert C. Martin book

    - by bitbonk
    Throughout the book "Agile Principles, Patterns, and Practices in C#" by Robert C. Martin a small Paymentroll application is build. While most of the source code is printed in place, some classes are missing and some are incomplete. The book says on the firest page: The book includes many source code examples that are also available for download from the authors' Web site. Unfortunately this seems to be a lie. Unless either this is not the author's website (the book forgets to mention the authors website adress) or I am blind. Does anyone have the comlete source code for that book preferably in form of a Visual Studio project or knows where I can find it.

    Read the article

  • Commutative (operational transform) diffs for databases

    - by barrycarter
    What Unix program generates "diff"s between text files (or INSERT/UPDATE/DELETEs for databases) in such a way that the order that the "diff"s are applied in is irrelevant, and the result is the same regardless of order. Etherpad used to do something like this. Example (for a given document or database): % Adam makes a change X, then Bob makes a change Y, then Adam makes another change Z. % However, because of network latency, Adam sees the changes in this order: XZY, while Bob sees them in this order: YXZ. % However, the code/changes are written so that XYZ and YXZ yield the same result. Note: ideally, this can be done without having to do X/Y/Z inverse at any point. I have read http://stackoverflow.com/questions/2043165/operational-transformation-library but I'm not sure this really does what I want.

    Read the article

  • Compiler warning when passing NSError ** as a method parameter

    - by splicer
    I've been scratching my head about this for the last 4 hours, trying out all kinds of little experiments, but I can't seem to figure out what's going wrong. Could this be a compiler bug? Test.m: - (id)initWithContentsOfURL:(NSURL *)aURL error:(NSError **)error { if (!(self = [super init])) { return nil; } return self; } main.m: NSError *error; Test *t = [[Test alloc] initWithContentsOfURL:[NSURL fileURLWithPath:@"/"] error:&error]; Here's the compiler warning (from main.m): warning: incompatible Objective-C types 'struct NSError **', expected 'struct NSDictionary **' when passing argument 2 of 'initWithContentsOfURL:error:' from distinct Objective-C type I'm using the latest versions of Xcode and Snow Leopard.

    Read the article

  • Passing parameters in MVC

    - by Avinash
    Thare is two forms in a page first one for searching and another for deleting.... <table><tr><td> <% using(Html.BeginForm("ViewList","ControllerName", [values],FormMethod.Post,new{id="viewListForm"})) { %> Name: <%=Html.TextBox("Name", "[value]", new { maxlength = "250" })%> Location: <%=Html.TextBox("Location", "[Value]", new { maxlength = "250" })%> <input type="submit" id="Search" name="Search" value="Search" /> <% } %> </td></tr> <tr><td> <% using(Html.BeginForm("DeleteList","ControllerName", new { name=?,location=? },[values],FormMethod.Post, new{id="deleteListForm"})) { %> [here the code for all items displayed in a table.] <input type="submit" id="Delete" name="Delete" value="Delete" /> When delete buttom pressed i need to pass two parameters ie name and location. The values of name and location are in the above viewListForm. How i take this value from the viewListForm at run time ? <% } %> </td></tr><table>

    Read the article

  • Changes to the User Permissions Not saving

    - by anru
    I am use drupal 6. it seems like permission page can not save too many settings. I have try to save permission setting, but it is just not saved into DB. I have found out this is due to "too many fields". (use content permission module). if i uncheck some fields, and then checking lesser fields, permission will be saved. for example, if I am unchecking 2 check boxes, then checking one check box, permission will be saved. does any one know which function the permission page used to insert result into db? my php memory limit is 256M.

    Read the article

  • What's the best way to work out if a virtual server is overloaded?

    - by zemaj
    I have a series of virtual servers. I'm running a command to login to each one and take a look at the load averages using uptime. What's the best way to work out if load values represent overloading? I'm running on rackspace cloud, so the servers have burst capability and can be all different sizes. I'm a little stumped on how to come up with a consistent way of figuring out when I need to spin up new servers. I can do things like estimate the jobs running on each one, but I'd like a system that runs a little closer to the real resource use available on each instance, as it obviously varies quite a bit! Help greatly appreciated!

    Read the article

  • linksys wap54g default wpa wireless key?

    - by jack
    Hi I wrongly pressed the push button in linksys wap54g web administration. Then it restarted and stated that it's protected with WPA while I first configured it as WEP. So, my old key didn't work. What should I do? Plugin with wire cable to reconfigure it? - which is the only way? coz it was embedded in ceiling. I found no solutions in product manual and google. Thank you.

    Read the article

  • Need to eliminate GOTO in PHP script but dont know how

    - by DomingoSL
    Hello i have this code: <?php include("/LIB/error.php"); session_start(); if (isset($_POST['Submit1'])) { if (!isset($_SESSION['token'])) {goto dale;} if((time() - $_SESSION['token']) < 5) { error('Debes esperar 5 segundos para poder enviar otra informacion.'); } else { dale: $_SESSION['token'] = time(); include("/LIB/HeadSQL.php"); include("/LIB/comprueba.php"); } } ?> I want to eliminate the GOTO instruction (because as you know is supported only in the last versions of php) in order to make more compatible my code, but i really cant figure out how to change the flow of the code without the GOTO. Thanks for your help.

    Read the article

  • Merge two rows in SQL

    - by Jason
    Assuming I have a table containing the following information: FK | Field1 | Field2 ===================== 3 | ABC | *NULL* 3 | *NULL* | DEF is there a way I can perform a select on the table to get the following FK | Field1 | Field2 ===================== 3 | ABC | DEF Thanks Edit: Fix field2 name for clarity

    Read the article

  • CGImageCreateWithMask with an image as a mask

    - by Peyman
    Hi I am trying to use an image (painted as Core Graphics) to create a mask. What I am doing is this 1. creating a Core Graphics path CGContextSaveGState(context); CGContextBeginPath(context); CGContextMoveToPoint(context,circleCenter.x,circleCenter.y); //CGContextSetAllowsAntialiasing(myBitmapContext, YES); CGContextAddArc(context,circleCenter.x, circleCenter.y,circleRadius,startingAngle, endingAngle, 0); // 0 is counterclockwise CGContextClosePath(context); CGContextSetRGBStrokeColor(context,1.0,0.0,0.0,1.0); CGContextSetRGBFillColor(context,1.0,0.0,0.0,0.2); CGContextDrawPath(context, kCGPathFillStroke); 2. then I'm saving the context that has the path just painted CGImageRef pacmanImage = CGBitmapContextCreateImage (context); 3. restoring the context CGContextRestoreGState(context); CGContextSaveGState(context); 4. creating a 1 bit mask (which will provide the black-white mask) bitsPerComponent = 1; bitsPerPixel = bitsPerComponent * 1 ; bytesPerRow = (CGImageGetWidth(imgToMaskRef) * bitsPerPixel); mask = CGImageCreate(CGImageGetWidth(imgToMaskRef), CGImageGetHeight(imgToMaskRef), bitsPerComponent, bitsPerPixel, bytesPerRow, greyColorSpace, kCGImageAlphaNone, CGImageGetDataProvider(pacmanImage), NULL, //decode YES, //shouldInterpolate kCGRenderingIntentDefault); 5. masking the imgToMaskRef (which is a CGImageRef imgToMaskRef =imgToMask.CGImage;) with the mask just created imageMaskedWithImage = CGImageCreateWithMask(imgToMaskRef, mask); CGContextDrawImage(context,imgRectBox, imageMaskedWithImage); CGImageRef maskedImageFinal = CGBitmapContextCreateImage (context); returning the maskedImageFinal to the caller of this method (as wheelChoiceMadeState, which is a CGImageRef) who then updates the CALayer contents property with the image theLayer.contents = (id) wheelChoiceMadeState; the problem I am seeing is that the mask does not work properly and looks very strange indeed. I get strange patterns across the path painted by the Core Graphics. My hunch is there is something with CGImageGetDataProvider() but I am not sure. Any help would be appreciated thank you

    Read the article

  • HierarchicalDataTemplate Link By Parent

    - by Andrew Kalashnikov
    Hello colleagues. I want bind my treeview. There are a lot of samples binding treeview by object, which contains children collection. I've got domain having just Parent pointer. public class Service : BaseDomain { public virtual string Name { get; set; } public virtual string Description { get; set; } public virtual Service Parent { get; set; } } Can I bind collection of this objects to my treeView. Thanks

    Read the article

  • Behavior is different when debugger is attached

    - by Lys
    I'm using VS 2008 to debug C# program with source code access. The expected behavior happened as long as the debugger attached to the running program, but when the program ran without debugger attached the exception threw. What are the common reasons for this to happen, and how can I tell the code difference behind this? Thanks,

    Read the article

  • Why does a change of Session State provider lead to an ASPx page yielding garbage?

    - by Rory Becker
    I have an aspnet webapp which has worked very well up until now. I was recently asked to explore ways of making it scale better. I found that seperation of database and Webapp would help. Further I was told that if I changed my session providing mechanism to SQLServer, I would be able to duplicate the Web Stack to several machines which could each call back to the state server allowing the load to be distirbuted better. This sounds logical. So I created an ASPState database using ASPNet_RegSQL.exe as detailed in many locations across the web and changed the web.config on my app from: <sessionState mode="InProc" cookieless="false" timeout="20" /> To: <sessionState mode="SQLServer" sqlConnectionString="Server=SomeSQLServer;user=SomeUser;password=SomePassword" cookieless="false" timeout="20" /> Then I addressed my app, which presented me with its logon screen and I duly logged in. Once in I was presented, not with the page I was expecting, but with: I can change the sessionstate back and forth. This problem goes away and then comes back based on which set of configuration I use. Why is this happening?

    Read the article

  • image archive VS image strip

    - by DevA
    Hi, i've noticed that plenty of games / applications (very common on mobile builds) pack numerous images into an image strip. I figured that the advantages in this are making the program more tidy (file system - wise) and reducing (un)installation time. During the runtime of the application, the entire image strip is allocated and copied from FS to RAM. On the contrary, images can be stored in an image archive and unpacked during runtime to a number of image structures in RAM. The way I see it, the image strip approach is less efficient because of worse caching performance and because that even if the optimal rectangle packing algorithm is used, there will be empty spaces between the stored images in the strip, causing a waste of RAM. What are the advantages in using an image strip over using an image archive file?

    Read the article

  • Problem with futures in c++0x .

    - by Eternal Learner
    Hi, I have written a small program , to understand how futures work in c++0x. while running the code I get an error like " error: 'printEn' was not declared in this scope". I am unable to understand what the problem is..Kindly point out what I am doing wrong here and if possible write the correct code for the same.. #include <future> #include <iostream> using namespace std; int printFn() { for(int i = 0; i < 100; i++) { cout << "thread " << i << endl; } return 1; } int main() { future<int> the_answer2=async(printEn); future<int> the_answer1=async(printEn); return 0; }

    Read the article

  • Object/Module not found: RDS from VB6 app to a Win2003 server

    - by Cyberherbalist
    I have a rather legacy application EXE written in VB6 and running on a Windows 2000 server that uses RDS (Remote Data Services) to access a business object DLL (also written in VB6) running on a Windows 2003 server. The DLL has never run on this server (we're moving the component off the old W2K server), but it is registered and defined as a component on the W2k+3 server. The specific code where the DLL is being called is: Private m_rdsDS As RDS.DataSpace Dim oARImport As Object Set oARImport = m_rdsDS.CreateObject("ARBatches.BL_ARBatches", txtWebServer) MsgBox oARImport.AddBatches(m_vConnParms, arbParseString, LinesFromFile) The CreateObject appears to work fine, but calling the method AddBatches raises the error number 8209 "Internet Server Error: Object/module not found." I'm leaning towards the idea that there is a permission issue somewhere at the root of the problem, but if this were the case, why wouldn't it say "You don't have permission"? I'd really like to rewrite the whole app but "they" won't let me.

    Read the article

  • unexpected margin with very simple html

    - by Serhat Özgel
    I have a very simple html. The red div is inside the blue div and has a 10 px top margin. On non-ie browsers, the blue box is 10 px apart from the top of viewport and the red div is at the very top of the blue div. What I expect is the ie behavior: red div must be 10 px apart from the top of the blue div. Why does non-ie browsers render like this? (I suppose the wrong behavior is the IE's but why?) And, what is the correct way to do this? <html> <head> <style> body { margin:0; padding:0; } .outer { background-color: #00f; height: 50px; } .inner { height: 20px; width: 20px; background-color: #f00; margin: 10px 0 0 10px; } </style> </head> <body> <div class="outer"> <div class="inner"> </div> </div> </body> </html>

    Read the article

  • Django attribute error: 'module' object has no attribute 'is_usable'

    - by Robert A Henru
    Hi, I got the following error when calling the url in Django. It's working before, I guess it's related with some accidental changes I made, but I have no idea what they are. Thanks before for the help, Robert Environment: Request Method: GET Request URL: http://localhost:8000/time/ Django Version: 1.2 Python Version: 2.6.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'djlearn.books'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "/Users/rhenru/Workspace/django/djlearn/src/djlearn/../djlearn/views.py" in current_datetime 16. return render_to_response('current_datetime.html',{'current_date':now,}) File "/Library/Python/2.6/site-packages/django/shortcuts/__init__.py" in render_to_response 20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) File "/Library/Python/2.6/site-packages/django/template/loader.py" in render_to_string 181. t = get_template(template_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in get_template 157. template, origin = find_template(template_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in find_template 128. loader = find_template_loader(loader_name) File "/Library/Python/2.6/site-packages/django/template/loader.py" in find_template_loader 111. if not func.is_usable: Exception Type: AttributeError at /time/ Exception Value: 'module' object has no attribute 'is_usable'

    Read the article

  • SQLAuthority News Monthly Roundup of Best SQL Posts

    After receiving lots of requests from different readers for long time I have decided to write first monthly round up. If all of you like it I will continue writing the same every month. In fact, I really like the idea as I was able to go back and read all of my posts written [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Automatically start VNC server on startup

    - by Vasu
    I installed the Ubuntu desktop on a Ubuntu 9.10 VPS server and am able to connect to the server using TightVNC. However, the VNC server on this VPS can only be started by logging in through SSH and typing the following command: vncserver :1 -geometry 800x600 -depth 16 -pixelformat rgb565 If I run this command on startup or as a schedule task, it won't start. What are my options? Thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >