Search Results

Search found 2126 results on 86 pages for 'wrapper'.

Page 54/86 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • Synchronizing access to an inner object's methods?

    - by user291701
    Suppose I have the following: public class Foo { private ReadingList mReadingList = new ReadingList(); public ReadingList getReadingList() { synchronized (mReadingList) { return mReadingList; } } } If I try modifying the ReadingList object in two threads, the synchronization above won't help me, right?: // Thread 1 foo1.getReadingList().setName("aaa"); // Thread 2 foo2.getReadingList().setName("bbb"); do I have to wrap each method I want synchronized like so: public class Foo { private ReadingList mReadingList = new ReadingList(); public synchronized void setReadingListName(String name) { mReadingList.setName(name); } public synchronized void setReadingListAuthor(String author) { mReadingList.setAuthor(author); } ... and so on for each method of ReadingList I want exposed and synched? I'd end up just writing wrapper methods for each method of ReadingList. Thanks

    Read the article

  • C# & C++, runtime error when call C++ dll from C#

    - by 5YrsLaterDBA
    I have written a C++ wrapper DLL for C# to call. The DLL was tested and worked fine with my C++ test program. now integrated with C#, I got runtime error and crashed. Cannot use debugger to see more details. The C++ side has only one method: #ifdef DLLWRAPPERWIN32_EXPORTS #define DLLWRAPPERWIN32_API __declspec(dllexport) #else #define DLLWRAPPERWIN32_API __declspec(dllimport) #endif #include "NB_DPSM.h" extern "C" { DLLWRAPPERWIN32_API int WriteGenbenchDataWrapper(string fileNameToAnalyze, string parameterFileName, string baseNameToSaveData, string logFileName, string& message) ; } in the C# side, there is a definition, [DllImport("..\\..\\thirdParty\\cogs\\DLLWrapperWin32.dll")] public static extern int WriteGenbenchDataWrapper(string fileNameToAnalyze, string parameterFileName, string baseNameToSaveData, string logFileName, ref string message); and a call: string msg = ""; int returnVal = WriteGenbenchDataWrapper(rawDataFileName, parameterFileName, outputBaseName, logFileName, ref msg); I guess there must be something wrong with the last parameter of the function. string& in C++ should be ref string in C#?

    Read the article

  • stick element to top of page until next element of that type appears

    - by aharon
    I'm having a hard time giving a good description of this, but bear with me: If I have a page structed like this <h2>Chapter 1</h2> <p>Lots of text that has mutiple screen worths of content</p> <h2>Chapter 2</h2> <p>Lots of text...</p> I'd like to have "Chapter 1" absolutely positioned or whatever at the top of the page until the user scrolls down to where "Chapter 2" starts, at which point now "Chapter 2" is displayed at the top of the page. We can add wrapper classes and divs if needed. Solutions that use JQuery would be great.

    Read the article

  • Which file is the COM++ object and how do I import it to .NET?

    - by Bad Man
    I'm trying to write a COM++ object wrapper around a Qt widget (control) I wrote so I can use it in future .NET projects. e.g.: public __gc class comWidget; In the compile directory are the .exe, an exe.intermediate.manifest, and the comWidget.obj, and also some other crap files (.pdb, etc). So what/how do I import into .NET? I feel like I'm missing an important step for registering the object or whatever, but all these tutorials are terrible outdated and ridiculously unhelpful (for instance, I'm using the old CLR syntax because I can't find any good docs on the new stuff, thx again M$ for being lazy faggots as usual)

    Read the article

  • Unable to sign an imported msi.dll assembly using tlbimp

    - by BigMoose
    This seems so trivial, yet I can't get it to work.. I have an msi.dll wrapper (named Interop.WindowsInstaller.dll) which I need to sign. The way to do it is by signing it upon import (this specific case is even documented in MSDN: http://msdn.microsoft.com/en-us/library/zec56a0w.aspx). BUT - no matter how I do it (w/ or w/o a keyfile, w/ or w/o adding "/delaysign"), the generated assemly's size is always 36,864 bytes and when viewing the DLL's properties there is no "Digital Signatures" tab (needless to say - the DLL is NOT signed). What am I missing here?? (... HELP!...)

    Read the article

  • Anonymous iterator blocks in Clojure?

    - by Checkers
    I am using clojure.contrib.sql to fetch some records from an SQLite database. (defn read-all-foo [] (with-connection *db* (with-query-results res ["select * from foo"] (into [] res)))) Now, I don't really want to realize the whole sequence before returning from the function (i.e. I want to keep it lazy), but if I return res directly or wrap it some kind of lazy wrapper (for example I want to make a certain map transformation on result sequence), SQL-related bindings will be reset and connection will be closed after I return, so realizing the sequence will throw an exception. How can I enclose the whole function in a closure and return a kind of anonymous iterator block (like yield in C# or Python)? Or is there another way to return a lazy sequence from this function?

    Read the article

  • Sound Manager Classes for Windows (C# or C++ .Net 2.0)

    - by Yakov
    Hi guys! I need some classes for playing short wav sounds, this classes would load this wav files into memory when an instance created, play sounds in background when needed, release this wav files from memory when an instance disposed. How can I do this on C# for windows (.Net 2.0)? (Win API's sndPlaySound, OpenAL or may be any wrapper) Ideally I would love to find an exist solution that simple and able to solve my task. Do you know any solutions for this issue? Thankx for your time.

    Read the article

  • Div behind another div problem.

    - by Kyle Sevenoaks
    Here is a (big) example of the massive problem I am having, when this page is live at euroworker.no/order, it is dynamically generated, I have supplied a static version for people to mess with. All I need is where it says "Endre Valg" to push the div wrapper under it down.. Sounds easy huh? I have tried many many things, I hope that some discussion and even trial and error can help us here. Sorry for the huge amount of code and stuff but this has taken me all day and I am out of ideas. Thanks.

    Read the article

  • How to properly set path to media files in Django

    - by sasquatch90
    Hello. I've got a new project, and currently I'm trying to set it correctly. But somehow I can't make my media files work. Here's my current setting : MEDIA_ROOT = os.path.normpath( '/home/budzyk/rails/fandrive/site_media/' ) templates setting work on the other hand : TEMPLATE_DIRS = ( "/home/budzyk/rails/fandrive/templates", ) Catalog with media files is ../fandrive/site-media/ so why it's not working ? Here's my base.html template with styles imported, and firebug window when my page is loaded : <head> <title>{% block title %}{% endblock %}</title> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/style.css" /> {% block pagecss %}{% endblock %} <script type="text/javascript" src="{{ MEDIA_URL }}jquery/jquery-1.4.2.min.js"></script> </head> <body> <div id="wrapper"> http://img237.imageshack.us/img237/4909/21205809.jpg

    Read the article

  • Tool that auto-generate a code for accesing a xml-file

    - by alex
    My application have a configuration xml-file. That file contains more than 50 program settings. At the present time I read and save each program setting separately. I guess It is not effi?iently for such tasks. I need something that can auto-generate a code for load and save my program settings using predefined xml-schema. I found a dataset in Add New Item dialog. Unfortunately, i cannot add new code to dataset1 such as events in set-accessors of properties because of this // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. Maybe, there is a tool that allows a user to generate a wrapper for accesing a xml-file ? Such as DataSet1, but with availability to add events.

    Read the article

  • When accessing ResultSets in JDBC, is there an elegant way to distinguish between nulls and actual z

    - by Uri
    When using JDBC and accessing primitive types via a result set, is there a more elegant way to deal with the null/0 than the following: int myInt = rs.getInt(columnNumber) if(rs.wasNull())? { // Treat as null } else { // Treat as 0 } I personally cringe whenever I see this sort of code. I fail to see why ResultSet was not defined to return the boxed integer types (except, perhaps, performance) or at least provide both. Bonus points if anyone can convince me that the current API design is great :) My solution was to write a wrapper that returns an Integer (I care more about elegance of client code than performance), but I'm wondering if I'm missing a better way to do this.

    Read the article

  • How can I center a box of unknown width in CSS?

    - by NXTBoy
    I have this html: <div class="object-box"> <img ... /> <span class="caption">This is the caption</span> </div> Which is accompanied with this CSS: .object-box .caption, .object-box img { display: block; } .object-box { border: 1px solid; } I would like the surrounding div to shrink-wrap to its contents. I can achieve this by using float: ... or display: inline-block. However, I'd also like it to be centered on the page, using margin: auto. The two approaches don't seem to be compatible. Is it possible to create such a shrink-wrapped, centered container, without adding a wrapper element?

    Read the article

  • [Java6] Same source code, Eclipse build success but Maven (javac) fails

    - by EnToutCas
    Keep getting this error when compiling using Maven: type parameters of <X>X cannot be determined; no unique maximal instance exists for type variable X with upper bounds int,java.lang.Object Generics type interference cannot be applied to primitive types. But I thought since Java5, boxing/unboxing mechanism works seamlessly between primitive types and wrapper classes. In any case, the strange thing is Eclipse doesn't report any errors and happily compiles. I'm using JDK1.6.0_12. What could possibly be the problem here?

    Read the article

  • Change function into dependencyproperty

    - by Jaya Willianto
    Hi everyone.. I am new to XAML and WPF and I am learning about DependencyProperty and Path. For example, I have a function like this public byte[] DownloadPicture() { WebClient webClient = new WebClient(); byte[] data; data = webClient.DownloadData("https://graph.facebook.com/4/picture&type=large"); return data; } and I have dependencyproperty like this public static DependencyProperty DownloadPicProperty = DependencyProperty.Register("DownloadPic", typeof(byte), typeof(ImageControl), new PropertyMetadata(false)); How can I connect the DependencyProperty with the DownloadPicture function I wrote? Any suggestions? What should I write in the CLR wrapper?

    Read the article

  • Compiler construction and DirectX

    - by otkins
    Hi! I am a beginner in the process of designing and coding a project, I already have all the ideas on my head, but I have a problem impeding me of continuing this project. I feel the code is ugly and unreadable and I cannot continue it this way. The project is a programming language I have on my mind, and it has small graphics capabilities. Even being beginner, I want to code it using DirectX because everybody wants it. And I want to code it entirely, not depend on any wrapper libraries like SDL. I did a refactoring of the DirectX module and it exposed all the weaks. There is Direct3D code everywhere, but the code itself does very little! I would start building a project like this using DirectX or I should use just GDI and the Multimedia API of Windows? This is a good progress for a beginner?

    Read the article

  • Can using non primitive Integer/ Long datatypes too frequently in the application, hurt the performance??

    - by Marcos
    I am using Long/Integer data types very frequently in my application, to build Generic datatypes. I fear that using these wrapper objects instead of primitive data types may be harmful for performance since each time it needs to create objects which is an expensive operation. but also it seems that I have no other choice(when I have to use primtives with generics) rather than just using them. However, still it would be great if you can suggest if there is anything I could do to make it better. or any way if I could just avoid it ?? Also What may be the downsides of this ? Suggestions welcomed!

    Read the article

  • setting minDate in datepicker in Rails

    - by Sakshi Jain
    I need to apply minDate attribute to the datepicker in Rails App. In _admin_controls.html.erb <%= f.input :end_date, wrapper: :append do %> <div id="datepicker" class="datepicker input-group edit-left"> <%= f.text_field :end_date, :class => "datetime form-control" %> application.js contains jQuery(document).on('focus', 'input.datetime', function() { opts = {format: 'M dd, yyyy', autoclose: true}; jQuery(this).datepicker(opts); jQuery(".datepicker").css("z-index",10000); }); What should be the javascript to do so only for _admin_controls.html.erb?

    Read the article

  • Calling C/C++ library function from PHP

    - by Anon. BlackBerry Developer
    We have a PHP web app running on a customer's machine. For an update, we have a bit of code in C that we'd like to include as a native opaque library along with the PHP web app. How does one go about calling a C/C++ lib. function from PHP? It cannot be assumed that the PHP app, called by the web server, has any sort of permission to call an exec(), eval(), or system() type of function to execute a C wrapper driver which in turn uses the C/C++ library, so it would need to be a direct C library use from within the PHP code.

    Read the article

  • Uploading or writing to files contained within s3

    - by Chase
    We have a widget that needs to be hosted on s3 due to a bunch of hoopla that isn't relevant to the issue. I'd explain if it was worth the time. Problem is it calls an external XML file for part of its content. The XML file is accessible if it is local on s3 but I cannot get my php file to write to it on s3. The widget could also be useful if I could access the xml file elsewhere but s3 does not seem to permit this. Suggestions? Here's the error I'm getting when trying to write to S3. [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections.

    Read the article

  • Call an external web service from a servlet

    - by pAkY88
    Hi, I'm developing a servlet that gets a name of a web service and could be forward the request to an external web service, for example: "http://www.webservice.com/..." I have build a response wrapper that intercept response output but I can't forward request to an external web service, it works only if I redirect the request to a servlet that is on same server. Example: request.getRequestDispatcher("aMyServlet").forward(request, response) IT WORKS request.getRequestDispatcher("http://www.webservice.com/...").forward(request, response) IT DON'T WORKS because Tomcat search "http://www.webservice.com/..." on the server as a local resource. How can I do external request? Thanks

    Read the article

  • Socket Programming for the Web

    - by Benny
    I have to interact with a legacy system that accepts socket communication and messages. My goal is to make the application cross-platform, but I need the ability to push messages to the client (i.e. - .NET's WCF, Java's Comet) and detect when the user closes out of their browser to destroy the socket. I have built a prototype of .NET wrapper + WCF + Silverlight but it is so disconnected it is difficult to manage the state of the user and seems to be a nightmare to support. All of that considered, what would be my best option?

    Read the article

  • JQuery: Read each line of an element

    - by Sarfraz
    Hello, Suppose I have this html markup: <div id="wrapper"> $(function(){ // hide all links except for the first $('ul.child:not(:first)').hide(); $("a.slide:first").css("background-color","#FF9900"); $('ul.parent a.slide').click(function(){ $('ul.parent a.slide').css("background-color","#3399FF"); $('ul.parent a.slide').mouseout(function(){ $(this).css("background-color","#3399FF"); }); $('ul.parent a.slide').mouseover(function(){ $(this).css("background-color","#66CC66"); }); }); }); </div> What is the easiest way to read each line of code present in the div. How do I extract each line of code from that div or loop over each line styling in any way I want. Thanks

    Read the article

  • Can you use POST to run a query in Solr (/select)

    - by RyanFetz
    I have queries that I am running against out solr index that sometimes have very long query parameters, I get errors when i run these queries, which i assume are do to the limit of a GET query parameters. Here is the method I use to query (JSON), this is to show I am using the Http Extensions (the client i use is a thin wrapper for HttpClient) not an end to end solution. 90% of the queries run fine, it is just when the params are large i get the 500 error from solr. I have read somewhere you can use POSt's when doing the select command but have not found examples of how to do it. Any help would be fantastic! public string GetJson(HttpQueryString qs) { using (var client = new DAC.US.Web.XmlHttpServiceClient(this.Uri)) { client.Client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential("Basic", DAC.US.Encryption.Hash.WebServiceCredintials); qs.Add("wt", "json"); if (!String.IsNullOrEmpty(this.Version)) qs.Add("version", this.Version); using (var response = client.Get(new Uri(@"select/", UriKind.Relative), qs)) { return response.Content.ReadAsString(); } } }

    Read the article

  • Does C++ require a destructor call for each placement new?

    - by Josh Haberman
    I understand that placement new calls are usually matched with explicit calls to the destructor. My question is: if I have no need for a destructor (no code to put there, and no member variables that have destructors) can I safely skip the explicit destructor call? Here is my use case: I want to write C++ bindings for a C API. In the C API many objects are accessible only by pointer. Instead of creating a wrapper object that contains a single pointer (which is wasteful and semantically confusing). I want to use placement new to construct an object at the address of the C object. The C++ object will do nothing in its constructor or destructor, and its methods will do nothing but delegate to the C methods. The C++ object will contain no virtual methods. I have two parts to this question. Is there any reason why this idea will not work in practice on any production compiler? Does this technically violate the C++ language spec?

    Read the article

  • Is there a way to ignore Cache errors in Django?

    - by Josh Smeaton
    I've just set our development Django site to use redis for a cache backend and it was all working fine. I brought down redis to see what would happen, and sure enough Django 404's due to cache backend behaviour. Either the Connection was refused, or various other errors. Is there any way to instruct Django to ignore Cache errors, and continue processing the normal way? It seems weird that caching is a performance optimization, but can bring down an entire site if it fails. I tried to write a wrapper around the backend like so: class CacheClass(redis_backend.CacheClass): """ Wraps the desired Cache, and falls back to global_settings default on init failure """ def __init__(self, server, params): try: super(CacheClass, self).__init__(server, params) except Exception: from django.core import cache as _ _.cache = _.get_cache('locmem://') But that won't work, since I'm trying to set the cache type in the call that sets the cache type. It's all a very big mess. So, is there any easy way to swallow cache errors? Or to set the default cache backend on failure?

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >