Search Results

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

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

  • Printing the "source" class in a log statement with a log4j wrapper

    - by Dur4ndal
    My application has a homebrew logging class that I'm migrating to using log4j under the covers. However, since I'm using the homebrew class to pass the rest of the application's logging statements to log4j, the output statements are logged as coming from the wrapper class instead of the source class. Is there a way to ensure that the "correct" source is being shown besides creating new org.apache.log4j.Logger instances for every log statement? I've also tried using the Logger.log(String callerFQCN, Priority level, Object message, Throwable t) method, but it doesnt seem to be working, for example: public class Logger2 { public static org.apache.log4j.Logger log4JLogger = org.apache.log4j.Logger.getLogger(Logger2.class); public static void warning(Object source, String message) { log(source, message, Level.WARN, null) } private static void log(Object source, String message, Level level, Throwable t) { String className = source.getClass().getName(); System.out.println("Logging class should be " + className); log4JLogger.log(className, loggingLevel, message, t); } } When called by: public void testWarning() { Logger2.warning(new Integer(3), "This should warn"); } Prints: Logging class should be java.lang.Integer 2010-05-25 10:49:57,152 WARN test.Logger2 - This should warn

    Read the article

  • MySQLi Wrapper -- will this slow down performance?

    - by Kerry
    I found the following code on php.net. I'm trying to write a wrapper for the MySQLi library to make things incredibly simple. If this is going to slow down performance, I'll skip it and find another way, if this works, then I'll do that. I have a single query function, if someone passes in more than one variable, I assume the function has to be prepared. The function that I would use to pass in an array to mysqli_stmt_bind_param is call_user_func_array, I have a feeling that is going to slow things down. Am I right? <?php /* just explaining how to call mysqli_stmt_bind_param with a parameter array */ $sql_link = mysqli_connect('localhost', 'my_user', 'my_password', 'world'); $type = "isssi"; $param = array("5", "File Description", "File Title", "Original Name", time()); $sql = "INSERT INTO file_detail (file_id, file_description, file_title, file_original_name, file_upload_date) VALUES (?, ?, ?, ?, ?)"; $sql_stmt = mysqli_prepare ($sql_link, $sql); call_user_func_array('mysqli_stmt_bind_param', array_merge (array($sql_stmt, $type), $param); mysqli_stmt_execute($sql_stmt); ?>

    Read the article

  • Loading external pngs into an AS2 swf that is loaded into an AS3 swf wrapper

    - by James Fassett
    I have a Wrapper SWF that loads a series of AS2 movies. Each AS2 movie loads a series of .png files. AS3_wrapper.swf |-> AS2_1.swf |-> image_1.png |-> image_2.png |-> AS2_2.swf |-> image_1.png |-> image_2.png Inside of the AS2 I listen for the load of the pngs using onLoadInit and update my UI. This works fine for the first AS2 swf. But when I load the second AS2 swf the onLoadInit isn't triggered for the pngs. My guess is that the images are in a cache or something like that. I put a random string on the end of the request to try and avoid the cache but that doesn't seem to work. The code in the as2 looks roughly like this: var flagLoader:MovieClipLoader = new MovieClipLoader(); var listener:Object = new Object(); listener.onLoadInit = Delegate.create(this, handleImageLoad); flagLoader.addListener(listener); var row:MovieClip = frame1["row" + (numLoaded + 1)]; flagLoader.loadClip(predictionData[numLoaded].flag + "?r="+Math.random(), row.flag); I'm making sure to load only one image at a time (I've read anecdotal evidence loading more than one thing at a time can confuse the MovieClipLoader). For the first as2 file everything works great. When I load the second as2 file the handleImageLoad never gets called. Update: Even more perplexing is if I reload the first AS2 movie (after the second AS2 movie fails to load the images) the first AS2 movie loads the images again fine. Update 2: After trying to change from using a MovieClipLoader to polling (as was helpfully suggested) I have found some more evidence that is relevant. When I load the first AS2 files and trace from the top level clip it prints out _root. The second AS2 file when loaded traces the same _root. This lead me to check if they were clashing on names and they are. Both have a child called frame. The first one, when I trace it comes out as _root.frame as expected. The second AS2 file traces _level0.instance3.instance118.instance111.frame. I'm guessing this is related to the problem. Flash is keeping the _root of the two files the same but it is changing the locations of their children (for subsequently loaded files that have children with the same names). So either the onLoad is going to the wrong clip or the events about it loading are.

    Read the article

  • HTML wrapper div over embedded flash object cannot be "clickable" by jQuery

    - by Michael Mao
    Hi all: I've been trying to do as the client requested : redirect to campaign page then to destination page once a customer clicks on the top banner in swf format. You can check what's been done at :http://ausdcf.org If you are using Firefox, Chrome or Safari, I suspect you can reach the destination page. However, if you are using IE or Opera, I doubt it. I think to cause of such a weird problem is: The swf ojbects don't have a link to url, SO I have to hack the theme template file like this : <div id="header">'; /* * A quick and dirty way to put some swf into PHP, and rotate among them ... */ //available banners $banners = array( 'http://localhost/smf/flash/banner_fertalign_1.swf', 'http://localhost/smf/flash/banner_fertalign_2.swf', 'http://localhost/smf/flash/banner_fertalign_3.swf' ); //get random banner srand((double) microtime() * 1000000); $rand = rand(0,count($banners)-1); echo '<div id="top_banner_clickable">'; echo '<div id="top_banner_wrapper">'; echo '<object width="400" height="60">'; echo '<param name="wmode" value="transparent">'; echo '<embed wmode="transparent" src="'.$banners[$rand].'" '; echo 'width="400" height="60" type="application/x-shockwave-flash"'; echo 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" />'; echo '</object>'; echo '</div>'; echo '</div>'; And the related jQuery code is like this: /* master.js */ $(document).ready(function() { $("#top_banner_clickable").click(function() { window.location ="http://ausdcf.org/campaign/"; }); }); I absolutely know nothing about Flash or embedded objects. I guess that's the cause of this problem. Plus, I don't know why it works with some browsers but not all... I even tried to add a z-index to the wrapper div in css like this: #top_banner_clickable { z-index : 100; } No this wouldn't do, either... Is there a way to go around this issue? Many thanks in advance.

    Read the article

  • CSS: right wrapper dropping off the end of the page

    - by user310606
    I have an issue with a site I am working on where the right wrapper keeps dropping down below the site. Obviously I want it to stay on the right hand side. I've coded up a test case which shows my issue (I think) and I'm wondering if there is a better way to do things. The website url is http://www.musicworkshop.co.nz/ Below is the test case which (I think) is the cause of my issue, however it may not be. The pink box drops down if it does not fit within the page width. Is there a better way to do this? John <html> <head> <title> Test page </title> <link rel="stylesheet" href="test.css" type="text/css" /> </head> <body> <div id="superbox"> <div id="box1"> </div> <div id="box2"> </div> <div id="box3"> </div> <div id="box4"> </div> <div id="box5"> </div> <div id="box6"> </div> </div> </body> </html> #outsidebox{ width: 100%; } #superbox{ width: 1000px; height: 100px; margin: 0 auto; } #box1{ height: 100px; width: 200px; background: red; float: left; } #box2{ height: 100px; width: 200px; background: yellow; float: left; } #box3{ height: 100px; width: 200px; background: blue; float: left; } #box4{ height: 100px; width: 200px; background: green; float: left; } #box5{ height: 100px; width: 200px; background: grey; float: left; } #box6{ height: 100px; width: 200px; background: pink; float: left; }

    Read the article

  • SwingWorker exceptions lost even when using wrapper classes

    - by Ti Strga
    I've been struggling with the usability problem of SwingWorker eating any exceptions thrown in the background task, for example, described on this SO thread. That thread gives a nice description of the problem, but doesn't discuss recovering the original exception. The applet I've been handed needs to propagate the exception upwards. But I haven't been able to even catch it. I'm using the SimpleSwingWorker wrapper class from this blog entry specifically to try and address this issue. It's a fairly small class but I'll repost it at the end here just for reference. The calling code looks broadly like try { // lots of code here to prepare data, finishing with SpecialDataHelper helper = new SpecialDataHelper(...stuff...); helper.execute(); } catch (Throwable e) { // used "Throwable" here in desperation to try and get // anything at all to match, including unchecked exceptions // // no luck, this code is never ever used :-( } The wrappers: class SpecialDataHelper extends SimpleSwingWorker { public SpecialDataHelper (SpecialData sd) { this.stuff = etc etc etc; } public Void doInBackground() throws Exception { OurCodeThatThrowsACheckedException(this.stuff); return null; } protected void done() { // called only when successful // never reached if there's an error } } The feature of SimpleSwingWorker is that the actual SwingWorker's done()/get() methods are automatically called. This, in theory, rethrows any exceptions that happened in the background. In practice, nothing is ever caught, and I don't even know why. The SimpleSwingWorker class, for reference, and with nothing elided for brevity: import java.util.concurrent.ExecutionException; import javax.swing.SwingWorker; /** * A drop-in replacement for SwingWorker<Void,Void> but will not silently * swallow exceptions during background execution. * * Taken from http://jonathangiles.net/blog/?p=341 with thanks. */ public abstract class SimpleSwingWorker { private final SwingWorker<Void,Void> worker = new SwingWorker<Void,Void>() { @Override protected Void doInBackground() throws Exception { SimpleSwingWorker.this.doInBackground(); return null; } @Override protected void done() { // Exceptions are lost unless get() is called on the // originating thread. We do so here. try { get(); } catch (final InterruptedException ex) { throw new RuntimeException(ex); } catch (final ExecutionException ex) { throw new RuntimeException(ex.getCause()); } SimpleSwingWorker.this.done(); } }; public SimpleSwingWorker() {} protected abstract Void doInBackground() throws Exception; protected abstract void done(); public void execute() { worker.execute(); } }

    Read the article

  • How to fix notifyDataSetChanged/ListView problems in dynamic Adapter wrapper Android

    - by ipaterson
    Summary: Trying to dynamically add heading rows to a ListView via a custom adapter wrapper. ListView is having trouble keeping the scroll position in sync. Runnable demo project provided. I would like to dynamically add items to a list based on the values in a CursorAdapter, several positions ahead of what the user is currently viewing. To do this, I have an adapter that wraps the CursorAdapter and keeps the new content indexed in a SparseArray. The ListView needs to be updated when items are added to the custom adapter, but I have met a lot of pitfalls trying to get that to work and would love some advice. The demo project can be downloaded here: http://dl.dropbox.com/u/15334423/DynamicSectionedList.zip In the demo, the headings are added dynamically by looking ahead 10 places to find the correct position where the list items switch to the next letter. Each implementation of notifyDataSetChanged has problems as described: Demo 1 This demo shows the importance of notifyDataSetChanged(). On clicking anything, the app will crash. This is due to some sanity checking in ListView... mItemCount != adapter.getItemCount(). Moral is, we need to notify the list that data has changed. Demo 2 The natural next step is to notify the ListView of changes when changes occur. Unfortunately, doing so while the ListView is scrolling firmly breaks all touch interaction until the app switches out of touch mode. You will need to "fling scroll" far enough to generate new headings in order to notice this. Tapping the screen will not cause the scroll to stop, and once stopped none of the list items will be clickable. This is due to some if (!mDataChanged) { /* do very important stuff */ } code in AbsListView.onTouchEvent(). Demo 3 To fix this, Demo 3 introduces a pendingChanges flag and the custom Adapter gains a notifyDataSetChangedIfNeeded() which can be called by the ListView once it has entered a "safe" state for changes. The first point where changes must be notified is in ListView.layoutChildren(), so I overrode that method to first notify of changes if needed, then call through. Fling past at least one heading then click a list item. This doesn't quite work right, though I'm not totally sure why. Tapping or selecting an item with the keyboard/trackball causes the list to refresh without properly syncing the old position. It scrolls to the top of the list which is not acceptable. Demo 4 The scroll problem in Demo 3 can be conquered, at least in touch mode. By adding a call to notifyDataSetChangedIfNeeded() on touch down, the data change happens to take place at such a time that all touch interaction works as expected and the list position is properly synced. However, I can't find an analog for that when the device is not in touch mode, not to mention the fact that it definitely seems like a hack. The list almost always scrolls back to the top, I can't find out what causes it to occasionally maintain the correct position. Since Android is fighting me at each step of the way, I feel like there should be a better approach. Please try the demo, if any fixes can be applied to get it working that would be great! Many thanks to anyone who can look into this, hopefully if we can get the code working it will be useful for others trying to accomplish the same optimization for lists with headings.

    Read the article

  • java: List wrapper where get()/set() is allowed but add/remove is not

    - by Jason S
    I need to wrap a List<T> with some class that allows calls to set/get but does not allow add/remove calls, so that the list remains "stuck" at a fixed length. I think I have a thin wrapper class (below) that will work, but I'm not 100% positive. Did I miss anything obvious? import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; class RestrictedListWrapper<T> implements List<T> { static <T> T fail() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } static private class IteratorWrapper<T> implements ListIterator<T> { final private ListIterator<T> iter; private IteratorWrapper(ListIterator<T> iter) { this.iter = iter; } static public <T> RestrictedListWrapper.IteratorWrapper<T> wrap(ListIterator<T> target) { return new RestrictedListWrapper.IteratorWrapper<T>(target); } @Override public void add(T e) { fail(); } @Override public boolean hasNext() { return this.iter.hasNext(); } @Override public boolean hasPrevious() { return this.iter.hasPrevious(); } @Override public T next() { return this.iter.next(); } @Override public int nextIndex() { return this.iter.nextIndex(); } @Override public T previous() { return this.iter.previous(); } @Override public int previousIndex() { return this.iter.previousIndex(); } @Override public void remove() { fail(); } @Override public void set(T e) { this.iter.set(e); } } final private List<T> list; private RestrictedListWrapper(List<T> list) { this.list = list; } static public <T> RestrictedListWrapper<T> wrap(List<T> target) { return new RestrictedListWrapper<T>(target); } @Override public boolean add(T arg0) { return fail(); } @Override public void add(int index, T element) { fail(); } @Override public boolean addAll(Collection<? extends T> arg0) { return fail(); } @Override public boolean addAll(int arg0, Collection<? extends T> arg1) { return fail(); } /** * clear() allows setting all members of the list to null */ @Override public void clear() { ListIterator<T> it = this.list.listIterator(); while (it.hasNext()) { it.set(null); it.next(); } } @Override public boolean contains(Object o) { return this.list.contains(o); } @Override public boolean containsAll(Collection<?> c) { return this.list.containsAll(c); } @Override public T get(int index) { return this.list.get(index); } @Override public int indexOf(Object o) { return this.list.indexOf(o); } @Override public boolean isEmpty() { return false; } @Override public Iterator<T> iterator() { return listIterator(); } @Override public int lastIndexOf(Object o) { return this.list.lastIndexOf(o); } @Override public ListIterator<T> listIterator() { return IteratorWrapper.wrap(this.list.listIterator()); } @Override public ListIterator<T> listIterator(int index) { return IteratorWrapper.wrap(this.list.listIterator(index)); } @Override public boolean remove(Object o) { return fail(); } @Override public T remove(int index) { fail(); return fail(); } @Override public boolean removeAll(Collection<?> c) { return fail(); } @Override public boolean retainAll(Collection<?> c) { return fail(); } @Override public T set(int index, T element) { return this.list.set(index, element); } @Override public int size() { return this.list.size(); } @Override public List<T> subList(int fromIndex, int toIndex) { return new RestrictedListWrapper<T>(this.list.subList(fromIndex, toIndex)); } @Override public Object[] toArray() { return this.list.toArray(); } @Override public <T> T[] toArray(T[] a) { return this.list.toArray(a); } }

    Read the article

  • Interacting with system commands using a web dev language

    - by Jamie
    Hi all, First of all, sorry for the vague title. Let me explain. At work we're currently using SunGrid I've been assigned a project to create a web interface wrapper for interacting with the engine. i.e. displaying users jobs, submitting jobs via a nice GUI etc. (most of the sgrid commands output xml which is nice) My question for you chaps is the following: What web dev language would you use to interact with the system? i.e. use the language to do a system call and evaluate the response. I'm not after an argument on which language is best, I just would like to know which language is specifically good for interacting with the system and is also good for web dev.

    Read the article

  • Bluetooth server application accepting connections from mobile devices

    - by Bruno Reis
    Hello, I'd like to develop a desktop application (on Windows, and preferably on .NET) that accepts bluetooth connections from mobile devices, that would then send commands to this application. I've never worked with bluetooth before. I've looked for open-source examples of such applications, but I had no luck. I've actually found on Microsoft a managed (.NET) wrapper for the bluetooth stack on Windows CE, but wasn't able to use it on my Windows 7. Do you know of any good texts discussing this topic? Any other source of information on the subject? Where should I start? Thanks.

    Read the article

  • Any simple Java way to pass parts of a hashmap to another hashmap?

    - by Arvanem
    Hi folks, For my trading program, a Merchant object has a qualities HashMap of enumerated Qualities with Boolean values. public class Merchants { private Map<Qualities, Boolean> qualities = new HashMap<Qualities, Boolean>(); I would like to give each Merchant object a further ratedQualities HashMap of True Qualities with Byte or Integer values representing the Rating of those Qualities. For example, a given Merchant could have a "1" Rating associated with their True Stockbroking Quality. The problem is Java does not let me do this easily. The following code demonstrates my intentions but doesn't compile: private Map<qualities-TRUE, Byte> ratedQualities = new HashMap<qualities-TRUE, Byte>(); According to this link text one solution is to create a Wrapper for the qualities HashMap. Is this the only solution or is there a better way? Thanks in advance for your help.

    Read the article

  • Combining Cocoa and MySQL

    - by BryCry
    Hey guys, i was searching SO for help on this, but i can't seem to find a concrete solution. Is, or isn't it possible to connect to a mysql database with Cocoa? Because i'm working on a program that i'd like to extend to a database, but i sure as hell don't know how! I mean, that cocoa-mysql package is heavily outdated, and i dont even know what a C wrapper is! Can someone please tell me how to do this, or atleast burst my bubble to tell me that it can't be done? Thanks!

    Read the article

  • Can a function defined in a bookmarklet be called from a page-level script?

    - by Soviut
    I have a bookmarklet that needs to open a new window/tab. In order to avoid the popup blocker, I need to call the window.open() method directly in the bookmarklet ie: at the browser-level. However, I want to keep the bookmarklet updatable by loading external Javascript files. To do this, the bookmarklet needs to append script nodes to the DOM. If i were to put window.open() code in one of these externally loaded scripts, the popup blocker would block it since its page-level. What I want to know is if I can create a wrapper function around window.open() in my bookmarklet, then call it from the externally loaded script? What is the scope and what are the permissions on a wrap such as this?

    Read the article

  • Integer v/s int

    - by Siddhartha
    Read this on the oracle docs java.lang page: Frequently it is necessary to represent a value of primitive type as if it were an object. The wrapper classes Boolean, Character, Integer, Long, Float, and Double serve this purpose. I'm not sure I understand why these are needed. It says they have useful functions such as equals(). But if I can do (a==b), why would I ever want to declare them as Integer, use more memory and use equals()? How does the memory usage differ for the 2?

    Read the article

  • how to use ByteArrayOutputStream and DataOutputStream simultaneously (Java)

    - by Manuel
    Hi! I'm having quite a problem here, and I think it is because I don't understand very much how I should use the API provided by Java. I need to write an int and a byte[] into a byte[] I thought of using a DataOutputStream to solve the data writing with writeInt(int i) and write(byte[] b), and to be able to put that into a byte array, I should use ByteArrayOutputStream's method toByteArray(). I understand that this classes use the Wrapper pattern, so I had two options: DataOutputStream w = new DataOutputStream(new ByteArrayOutputStream()); or ByteArrayOutputStream w = new ByteArrayOutputStream(new DataOutputStream()); but in both cases, I "loose" a method. in the first case, I can't access the toByteArray method, and in the second, I can't access the writeInt method. How should I use this classes together?

    Read the article

  • COM-Objects containing maps / content error(0)

    - by Florian Berzsenyi
    I'm writing a small wrapper to get familiar with some important topics in C++ (WinAPI, COM, STL,OOP). For now, my class shall be able to create a (child) window. Mainly, this window is connected to a global message loop that distribute messages to a local loop of the right instance (global is static, local is virtual). Obviously, there are surely better ways to do that but I'm using std::maps to store HWND and their instance pointer in pairs (the Global loop looks for the pointer with the HWND-parameter, gets itself the pointer from the map and calls then the local loop). Now, it appears that the map does not accept any values because of a unknown reason. It seems to allocate enough space but something went wrong anyway [ (error) 0 is displayed instead of the entries in visual C++). I've looked that up in google as well and found out that maps cause some trouble when used in classes AND DLLs. May this be the reason and is there any solution?? Protected scope of class: static std::map<HWND,MAP_BASE_OBJECT*> m_LoopBuf Implementation in .cpp-file: std::map<HWND,MAP_BASE_OBJECT*> HWindow::m_LoopBuf;

    Read the article

  • Boost's "cstdint" Usage

    - by patt0h
    Boost's C99 stdint implementation is awfully handy. One thing bugs me, though. They dump all of their typedefs into the boost namespace. This leaves me with three choices when using this facility: Use "using namespace boost" Use "using boost::[u]<type><width>_t" Explicitly refer to the target type with the boost:: prefix; e.g., boost::uint32_t foo = 0; Option ? 1 kind of defeats the point of namespaces. Even if used within local scope (e.g., within a function), things like function arguments still have to be prefixed like option ? 3. Option ? 2 is better, but there are a bunch of these types, so it can get noisy. Option ? 3 adds an extreme level of noise; the boost:: prefix is often = to the length of the type in question. My question is: What would be the most elegant way to bring all of these types into the global namespace? Should I just write a wrapper around boost/cstdint.hpp that utilizes option ? 2 and be done with it? Also, wrapping the header like so didn't work on VC++ 10 (problems with standard library headers): namespace Foo { #include <boost/cstdint.hpp> using namespace boost; } using namespace Foo; Even if it did work, I guess it would cause ambiguity problems with the ::boost namespace.

    Read the article

  • Bad idea to have the same object, have a different side effect after method call.

    - by Nathan W
    Hi all, I'm having a bit of a gesign issue(again). Say I have this Buttonpad object: now this object is a wrapper object over one in a com object. At the moment it has a method on it called CreateInto(IComObject). Now to make a new button pad in the Com Object. You do: ButtonPad pad = new ButtonPad(); pad.Title = "Hello"; // Set some more properties. pad.CreateInto(Cominstance); The createinfo method will excute the right commands to buid the button pad in the com object. After it has been created it any calls against it are foward to the underlying object for change so: pad.Title = "New title"; will call the com object to set the title and also set the internal title variable. Basically any calls before the CreateInfo method only affect the .NET object anything after has the side effect of calling the com object also. I'm not very good at sequence diagrams but here is my attempt to explain whats going on: This doesn't feel good to me, it feels like I'm lying to the user about what the button pad does. I was going to have a object called WrappedButtonPad, which is returned from CreateInto and the user could make calls against that to make changes to the Com Object, but I feel having two objects that almost do the same thing but only differ by names might be even worse. Are these valid designs, or am I right to be worried? How else would you handle a object the can create and query a com object?

    Read the article

  • Cutting down repeating code in c# Class

    - by Tom Gullen
    This is a wrapper for an API I'm working on, am I doing it sort of right? I'm not particularly fond of all the repeating code in the constructor, if someone can show me if I can reduce that it would be very helpful! public class WebWizForumVersion { // Properties of returned data public string Software { get; private set; } public string Version { get; private set; } public string APIVersion { get; private set; } public string Copyright { get; private set; } public string BoardName { get; private set; } public string URL { get; private set; } public string Email { get; private set; } public string Database { get; private set; } public string InstallationID { get; private set; } public bool NewsPad { get; private set; } public string NewsPadURL { get; private set; } public WebWizForumVersion(XmlReader Data) { try { Data.ReadToFollowing("Software"); this.Software = Data.ReadElementContentAsString(); Data.ReadToFollowing("Version"); this.Version = Data.ReadElementContentAsString(); Data.ReadToFollowing("ApiVersion"); this.APIVersion = Data.ReadElementContentAsString(); Data.ReadToFollowing("Copyright"); this.Copyright = Data.ReadElementContentAsString(); Data.ReadToFollowing("BoardName"); this.BoardName = Data.ReadElementContentAsString(); Data.ReadToFollowing("URL"); this.URL = Data.ReadElementContentAsString(); Data.ReadToFollowing("Email"); this.Email = Data.ReadElementContentAsString(); Data.ReadToFollowing("Database"); this.Database = Data.ReadElementContentAsString(); Data.ReadToFollowing("InstallID"); this.InstallationID = Data.ReadElementContentAsString(); Data.ReadToFollowing("NewsPad"); this.NewsPad = bool.Parse(Data.ReadElementContentAsString()); Data.ReadToFollowing("NewsPadURL"); this.NewsPadURL = Data.ReadElementContentAsString(); } catch (Exception e) { } } }

    Read the article

  • Async friendly DispatcherTimer wrapper/subclass

    - by Simon_Weaver
    I have a DispatcherTimer running in my code that fire every 30 seconds to update system status from the server. The timer fires in the client even if I'm debugging my server code so if I've been debugging for 5 minutes I may end up with a dozen timeouts in the client. Finally decided I needed to fix this so looking to make a more async / await friendly DispatcherTimer. Code running in DispatcherTimer must be configurable whether it is reentrant or not (i.e. if the task is already running it should not try to run it again) Should be task based (whether or not this requires I actually expose Task at the root is a gray area) Should be able to run async code and await on tasks to complete Whether it wraps or extends DispatcherTimer probably doesn't really matter but wrapping it may be slightly less ambiguous if you don't know how to use it Possibly expose bindable properties for IsRunning for UI

    Read the article

  • Need help with Swift mailer with Kohana wrapper

    - by alex
    My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('[email protected]' => 'Alex')) ->setTo(array('[email protected]' => 'Alex')) ->setBody('hello') ->attach(Swift_Attachment::fromPath(DOCROOT . 'assets/attachments/instructions.pdf')); $swift->send(); The email::connect() returns an instance of SwiftMailer. As per these docs, it would seem that it should work. However, I get an error Fatal error: Call to undefined method Swift_Mailer::setSubject() in /home/user/public_html/application/classes/controller/properties.php on line 45 I've seen that email::connect() does exactly what the example code in the docs does. That is include the correct file return an instance of the library What am I doing wrong? Thanks

    Read the article

  • Properly clean up excel interop objects revisited: Wrapper objects

    - by chiccodoro
    Hi all, Excel 2007 Hangs When Closing via .NET How to properly clean up Excel interop objects in C# How to properly clean up interop objects in C# All of these struggle with the problem that C# does not release the Excel COM objects properly after using them. There are mainly two directions of working around this issue: Kill the Excel process when Excel is not used anymore. Take care to assign each COM object used explicitly to a variable and to Marshal.ReleaseComObject all of these. Some have stated that 2 is too tedious and there is always some uncertainty whether you forget to stick to this rule at some places in the code. Still 1 seems dirty and dangerous to me, also I could imagine that in an environment with restricted access killing processes is not allowed. So I've been thinking about solving 2 by creating another proxy object model which mimics the Excel object model (for me, it would suffice to implement the objects I actually need). The principle would look as follows: Each Excel Interop class has its proxy which wraps an object of that class. The proxy releases the COM object in its destructor. The proxy mimics the interface of the Interop class (maybe by inheriting it). Any methods that usually return another COM object return a proxy instead. The other methods simply delegate the implementation to the inner COM object. This is a rough sketch of the code: public class Application : Microsoft.Office.Interop.Excel.Application { private Microsoft.Office.Interop.Excel.Application innerApplication = new Microsoft.Office.Interop.Excel.Application innerApplication(); ~Application() { Marshal.ReleaseCOMObject(innerApplication); } public Workbooks Workbooks { get { return new Workbooks(innerApplication.Workbooks); } } } public class Workbooks { private Microsoft.Office.Interop.Excel.Workbooks innerWorkbooks; Workbooks(Microsoft.Office.Interop.Excel.Workbooks innerWorkbooks) { this.innerWorkbooks = innerWorkbooks; } ~Workbooks() { Marshal.ReleaseCOMObject(innerWorkbooks); } } My questions to you are in particular: Who finds this a bad idea and why? Who finds this a gread idea? If so, why hasn't anybody implemented/published such a model yet? Just due to the effort, or am I missing a killing problem with that idea? Is it impossible/bad/dangerous to do the ReleaseCOMObject in the destructor? (I've only seen proposals to put it in a Dispose() rather than in a destructor - why?) If the approach makes sense, any suggestions to improve it?

    Read the article

  • Best FTP Objective-C wrapper for iPhone

    - by jamone
    I know you use the C based networking API to do FTP communication but I'd prefer to use something a little higher level. I've seen a few Objective-C based wrappers but I'm not sure what to use. I don't need that complex of FTP interaction. Its just the typical create/delete dirs, upload/download files... What do you recommend?

    Read the article

  • MSI wrapper for msdeploy?

    - by Nate
    Just moved to vs2010 and found that deployment is quite different. The old way I did things (vs2008) was as follows: 1) I right-click on my web app and "Add web deployment project" 2) Start a web setup project, dump that web deployment project output in it, and add any custom installer actions (connection strings or other user input) as necessary using the custom installer class. Easy! Now that I don't have the "Add web deployment project" option (or can't find it!?!?), msdeploy seems to be the thing to do. I have successfully got this to work via command line, but I still need some custom actions. In this example, we have separated our web services deployment from our UI deployment (Silverlight) so that they can be hosted separately or together. So... during/after install I need to know from the user where the web services are located. So I tried this: 1) Start a web setup project, and include all of the deploy package files (.deploy.cmd, /setparameters.xml, etc) 2) Gather user input in my custom installer class, and shell execute the deploy.cmd. Problem is... the deploy fails on deleting the zip file since it's use by another process (I assume it's my installer). Anyone have any ideas on how to get around this? Or is there a better way to accomplish this task? Any input would be appreciated! Nate

    Read the article

  • Flex 4 IntelliJ IDEA wrapper html crashes browser

    - by user347641
    I'm building an Flex 4 application using IntelliJ IDEA generated sample Flex application. I replace the mxml with the following code from the book Hello Flex 4. It simply crashes the browser when I run it. I tried it on both FF and Chrome. Any clues? [Bindable] public var _bread:Number = Number.NaN; ]]></fx:Script> <fx:Declarations> <s:RadioButtonGroup id="moralityRBG"/> <s:RadioButtonGroup id="restaurantRBG" selectedValue="{_theory.length % 2 == 0 ? 'smoking' : 'non'}"/> </fx:Declarations> <s:Panel width="100%" height="100%" title="Simple Components!"> <s:layout> <s:HorizontalLayout paddingLeft="5" paddingTop="5"/> </s:layout> <s:VGroup> <s:TextArea id="textArea" width="200" height="50" text="@{_theory}"/> <s:TextInput id="textInput" width="200" text="@{_theory}"/> <s:HSlider id="hSlider" minimum="0" maximum="11" liveDragging="true" width="200" value="@{_bread}"/> <s:VSlider id="vSlider" minimum="0" maximum="11" liveDragging="true" height="50" value="@{_bread}"/> <s:Button label="{_theory}" width="200" color="{alarmTB.selected ? 0xFF0000 : 0}" click="_bread = Math.min(_theory.length, 11)"/> <s:CheckBox id="checkBox" selected="{_bread % 2 == 0}" label="even?"/> </s:VGroup> <s:VGroup> <s:RadioButton label="Good" value="good" group="{moralityRBG}"/> <s:RadioButton label="Evil" value="evil" group="{moralityRBG}"/> <s:RadioButton label="Beyond" value="beyond" group="{moralityRBG}"/> <s:RadioButton label="Smoking" value="smoking" group="{restaurantRBG}"/> <s:RadioButton label="Non-Smoking" value="non" group="{restaurantRBG}"/> <s:ToggleButton id="alarmTB" label="ALARM!"/> <s:NumericStepper id="numericStepper" value="@{_bread}" minimum="0" maximum="11" stepSize="1"/> <s:Spinner id="spinner" value="@{_bread}" minimum="0" maximum="11" stepSize="1"/> </s:VGroup> </s:Panel>

    Read the article

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