Search Results

Search found 7801 results on 313 pages for 'lazy loading'.

Page 57/313 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • Loading saved byte array to memory stream causes out of memory exception

    - by user2320861
    At some point in my program the user selects a bitmap to use as the background image of a Panel object. When the user does this, the program immediately draws the panel with the background image and everything works fine. When the user clicks "Save", the following code saves the bitmap to a DataTable object. MyDataSet.MyDataTableRow myDataRow = MyDataSet.MyDataTableRow.NewMyDataTableRow(); //has a byte[] column named BackgroundImageByteArray using (MemoryStream stream = new MemoryStream()) { this.Panel.BackgroundImage.Save(stream, ImageFormat.Bmp); myDataRow.BackgroundImageByteArray = stream.ToArray(); } Everything works fine, there is no out of memory exception with this stream, even though it contains all the image bytes. However, when the application launches and loads saved data, the following code throws an Out of Memory Exception: using (MemoryStream stream = new MemoryStream(myDataRow.BackGroundImageByteArray)) { this.Panel.BackgroundImage = Image.FromStream(stream); } The streams are the same length. I don't understand how one throws an out of memory exception and the other doesn't. How can I load this bitmap? P.S. I've also tried using (MemoryStream stream = new MemoryStream(myDataRow.BackgroundImageByteArray.Length)) { stream.Write(myDataRow.BackgroundImageByteArray, 0, myDataRow.BackgroundImageByteArray.Length); //throw OoM exception here. }

    Read the article

  • Loading package html + resources into webview

    - by mobileopen
    I would like to know how I can display a HTML page in webview with references to relative/local images. The goal is to have the html page and all linked images contained in the android application package itself. Where would I need to place the assets (assets directory?) and how do I reference these so they load into the webview? Thanx! Sven

    Read the article

  • Disable Spring URL resource loading in context file

    - by drewzilla
    I have the need to specify a URL in a Spring context file but don't want Spring to turn it into a resource, i.e. I want the URL to be passed as a String to the bean that I'm creating in the context file rather than it being converted into a Resource object. How can I avoid Spring creating a Resource? Thanks, Andrew

    Read the article

  • Loading multiple copies of a group of DLLs in the same process

    - by george
    Background I'm maintaining a plugin for an application. I'm Using Visual C++ 2003. The plugin is composed of several DLLs - there's the main DLL, that's the one that the application loads using LoadLibrary, and there are several utility DLLs that are used by the main DLL and by each other. Dependencies generally look like this: plugin.dll - utilA.dll, utilB.dll utilA.dll - utilB.dll utilB.dll - utilA.dll, utilC.dll You get the picture. Some of the dependencies between the DLLs are load-time and some run-time. All the DLL files are stored in the executable's directory (not a requirement, just how it works now). The problem There's a new requirement - running multiple instances of the plugin within the application. The application runs each instance of a plugin in its own thread, i.e. each thread calls The plugin's code, however, is nothing but thread-safe - lots of global variables etc.. Unfortunately, fixing the whole thing isn't currently an option, so I need a way to load multiple (at most 3) copies of the plugin's DLLs in the same process. Option 1: The distinct names approach Creating 3 copies of each DLL file, so that each file has a distinct name. e.g. plugin1.dll, plugin2.dll, plugin3.dll, utilA1.dll, utilA2.dll, utilA3.dll, utilB1.dll, etc.. The application will load plugin1.dll, plugin2.dll and plugin3.dll. The files will be in the executable's directory. For each group of DLLs to know each other by name (so the inter-dependencies work), the names need to be known at compilation time - meaning the DLLs need to be compiled multiple times, only each time with different output file names. Not very complicated, but I'd hate having 3 copies of the VS project files, and don't like having to compile the same files over and over. Option 2: The side-by-side assemblies approach Creating 3 copies of the DLL files, each group in its own directory, and defining each group as an assembly by putting an assembly manifest file in the directory, listing the plugin's DLLs. Each DLL will have an application manifest pointing to the assembly, so that the loader finds the copies of the utility DLLs that reside in the same directory. The manifest needs to be embedded for it to be found when a DLL is loaded using LoadLibrary. I'll use mt.exe from a later VS version for the job, since VS2003 has no built-in manifest embedding support. I've tried this approach with partial success - dependencies are found during load-time of the DLLs, but not when a DLL function is called that loads another DLL. This seems to be the expected behavior according to this article - A DLL's activation context is only used at the DLL's load-time, and afterwards it's deactivated and the process's activation context is used. I haven't yet tried working around this using ISOLATION_AWARE_ENABLED. Questions Got any other options? Any quick & dirty solution will do. :-) Will ISOLATION_AWARE_ENABLED even work with VS2003? Comments will be greatly appreciated. Thanks!

    Read the article

  • Loading user control dynamically looses data

    - by user228777
    I have a created a user control. This user control I dynamically load on a page inside Telerik Panelbar control. I have done all necessary coding to save the viewstate and load this dynamically created usercontrol every time page loads. On this User control I have a asp panel. By default this panel is invisible. When user clicks a button on this user control panel is made visible. On page load of this user control I populate all the controls on this panel. Everything works fine if I don’t load this use control dynamically but when I load this user control dynamically and if I make panel visible by default then only all fields on the panel are populated. But if I make by default invisible and on button click make panel visible none of the text boxes or comboboxes are populated. I populate comboboxes on page load of the userControl but inbetween postbacks all the comboboxes on the user control loose data. ON the parent page I am saving the viewstate This is my code on parent page to dynamically load userControl ( which has panel on it) Dim ucPiggyBank As SubscriberSetupPages_UserControls_PiggyBank = CType(LoadControl("~/SubscriberSetupPages/UserControls/PiggyBank.ascx"), SubscriberSetupPages_UserControls_PiggyBank) With ucPiggyBank .PiggyBankID = account.Id .ID = account.Id.ToString 'Setting up following 3 properties here to avoid database trips .PiggyBankEligibleAccounts = piggyBankEligibleAccountCollection .MemorizedNames = memorizednames .Period = period End With radPanelNewChild.Controls.Add(ucPiggyBank) radPanelNew.Items.Add(radPanelNewChild) radPanelNew.Expanded = True ‘this is the Panel item on parent page of Telerik Panelbar control. Dim radPanelPiggyBank As RadPanelItem = DirectCast(pnlbarPiggyBank.FindItemByValue("TestItem"), RadPanelItem) With radPanelPiggyBank .Items.Add(radPanelNew) .DataBind() End With ‘I am doing everything for saving viewstate on parent control This is the code on page load of userControl If Not IsPostBack Then If m_PiggyBankID <> Guid.Empty Then 'Load data Call GetPiggyBankDetails() End If I have a edit button on the user control which makes panel visible. It makes panel visible but with no data. Can you please tell me what’s happening? Thanks in advance.

    Read the article

  • Dynamically loading modules in Python (+ threading question)

    - by morpheous
    I am writing a Python package which reads the list of modules (along with ancillary data) from a configuration file. I then want to iterate through each of the dynamically loaded modules and invoke a do_work() function in it which will spawn a new thread, so that the code runs in a separate thread. At the moment, I am importing the list of all known modules at the beginning of my main script - this is a nasty hack I feel, and is not very flexible, as well as being a maintenance pain. This is the function that spawns the threads. I will like to modify it to dynamically load the module when it is encountered. The key in the dictionary is the name of the module containing the code: def do_work(work_info): for (worker, dataset) in work_info.items(): #import the module defined by variable worker here... t = threading.Thread(target=worker.do_work, args=[dataset]) # I'll NOT dameonize since spawned children need to clean up on shutdown # Since the threads will be holding resources #t.daemon = True t.start() Question 1 When I call the function in my script (as written above), I get the following error: AttributeError: 'str' object has no attribute 'do_work' Which makes sense, since the dictionary key is a string (name of the module to be imported). When I add the statement: import worker before spawning the thread, I get the error: ImportError: No module named worker This is strange, since the variable name rather than the value it holds are being used - when I print the variable, I get the value (as I expect) whats going on? Question 2 As I mentioned in the comments section, I realize that the do_work() function written in the spawned children needs to cleanup after itself. My understanding is to write a clean_up function that is called when do_work() has completed successfully, or an unhandled exception is caught - is there anything more I need to do to ensure resources don't leak or leave the OS in an unstable state? Question 3 If I comment out the t.daemon flag statement, will the code stil run ASYNCHRONOUSLY?. The work carried out by the spawned children are pretty intensive, and I don't want to have to be waiting for one child to finish before spawning another child. BTW, I am aware that threading in Python is in reality, a kind of time sharing/slicing - thats ok Lastly is there a better (more Pythonic) way of doing what I'm trying to do?

    Read the article

  • Dynamically Loading a DLL

    - by TooFat
    I am trying to simply load a dll written in C# at run time and create an instance of a class in that dll. Assembly a = Assembly.LoadFrom(@"C:\Development\DaDll.dll"); Type type = a.GetType("FileReleaseHandler", true); TestInterface.INeeedHelp handler = Activator.CreateInstance(type) as TestInterface.INeeedHelp; No errors are thrown, and if I step through the code I can walk though the FileReleaseHandler Class as it executes the constructor but the value of handler is always null. What am I missing here? or even is there a better way I should be going about this?

    Read the article

  • View Loading Problem

    - by riteshkumar1905
    Hello I Using a tab bar with navigation bar with navigation bar.We have a list of songs in song list no navigation bar and no tab bar. when i select a song and then load xib with (tab bar+navigation bar) in this xib i creat a segment for going to list. - (void)segmentAction:(id)sender{ if([sender selectedSegmentIndex] == 0) { [MainController1 release]; songs *mainController=[[songs alloc]init]; [self.navigationController pushViewController:mainController animated:NO]; [mainController release]; } } this code load list of song but navigation bar and tab bar is still there. so, how i load our list.

    Read the article

  • Loading images from Facebook in Flash Builder

    - by wannax
    Hi, I'm doing a Facebook App where I'd like to pull out all the possible images from a user's album. What I'm trying to do at the moment is a fql query so that i can find all the images that belong to that specific user. it goes something like that: protected function loadFromFacebook(event:MouseEvent):void { var fql:String = "select src_small from photo where owner = me()"; Facebook.fqlQuery(fql, handleGetPhotosResponse); } private function handleGetPhotosResponse(event:Object, fail:Object):void { if (event != null){ facebookPhotos = new ArrayCollection(event as Array); } } I store this images in an array collection but I don't know how to proceed after that. How can I load those images into, say, a Tile List or a Loader? Any help would be much appreciated, thanks

    Read the article

  • "Detecting" and loading of "plugins" in GAE

    - by Patrick Cornelissen
    Hi! I have a "plugin like" architecture and I want to create one instance of each class that implements a dedicated interface and put these in a cache. (To have a singleton-ish effect). The plugins will be provided as jars and put into the app engine war file before the app is uploaded. I have tried to use the ClassPathScanningCandidateComponentProvider as I'm using spring anyway, but this didn't work. The provider complained that it was not able to find the HttpServletResponse class file while scanning the classpath. I can't get around this, when I add the servlet jar, then I'll get of course problems, because the same jar is also provided by the GAE. If I don't, I'm getting the error above... So I tried to add a static initialization code, but of course this doesn't work, because the class is initialized when it's instantiated for the first time. (Well I knew that but it was worth a try) The last chance I currently see is that I create a properties file with all plugin classes when the package is created, but this requires writing of a maven plugin etc. and I'd like to avoid that. Is there something that I am missing?

    Read the article

  • div loading is not proper while using ajax

    - by sadesh
    i have to load a div with a list of check boxes using ajax. I have writen ajax code to fetch the string containing the list of check boxes.` document.getElementById("roleCheckBoxes").innerHTML=""; $('#roleCheckBoxes').append(xmlhttp.responseText.toString()); the data are fetching properly but the display alone not reflecting the string which i gave instead it displays a the list of check boxes with all checked... can you help me in it..

    Read the article

  • Loading UINavigationController subclass from a Nib

    - by Rits
    My situation is as follows: My class SettingsViewController is a subclass of UINavigationController. That class contains the logic of its rootViewController. For example, it acts as the delegate and data source for two table views in that root view controller. I have no problem setting this up programmatically. In the initializer of SettingsViewController, I can create an additional UIViewController to serve as the root view controller, position the table views in its view, and set their delegates and data sources to self. But I want to load that root view via a Nib. The problem is, I do not know how to connect that Nib with my SettingsViewController, how to set the delegates and data sources. The SettingsViewController is not accessible from within the Nib. 'File Owner' represents the root view controller, not the SettingsViewController. How do I access my UINavigationController subclass from within my root view controllers Nib? Thanks in advance.

    Read the article

  • Eager loading in EF1.0

    - by Dave Swersky
    I have a many-to-many relationship: Application - Applications_Servers - Server This is set up in my Entity Data Model and all is well. My problem is that I'd like to eager-load the whole graph of Applications so that I have an IEnumerable<Applications>, each Application member populated with the Servers collection associated by the many-to-many relationship. Normally this wouldn't be a problem, but according to my research there must be a navigation property between Application and Server. This is not the case for me because my Applications_Servers join table has more in it than just the two keys. Therefore, there is no navigation property directly between Application and Server, and this doesn't work: var apps = (from a in context.Application.Include("Server") select a).ToList(); I get an error saying there is no navigation property on Application called "Server", and that's correct, there is none. How do I write the query to eager-load my Applications with their Servers in this case?

    Read the article

  • Multiple flash video players on w3c-valid page is slow

    - by vect
    I have a web site that displays a column of flash videos. The page is w3c-valid. The problem is that the page loads very slowly and sometimes crashes my web browser. Until the page is fully loaded, the videos are slow to respond and play. Is there a way to make these videos load their preview images only? What should I do to speed the page up? The videos are 360x264.

    Read the article

  • Captcha loading problem in popup

    - by Dev
    I am using jquery.load() to load a page on click of a button. The page that will be loaded contains a captcha. When that page is getting loaded due to the captcha it is making the page to reload again and it is not showing anything. If i am removing the captcha from the load page it is working fine. I am using ASP.NET. Can anyone help me?

    Read the article

  • Loading a Windows DLL in Java and initiate a class from it

    - by Joy
    I have a Windows DLL file from .NET namely "System.Management.dll". I work with it using the code I write below: ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk WHERE Name = 'C:'"); foreach (ManagementObject queryObj in searcher.Get()) { Console.WriteLine("Win32_LogicalDisk instance: "); if (queryObj["VolumeSerialNumber"] != null) { Console.WriteLine("Drive Name : " + queryObj["Name"]); Console.WriteLine("VolumeSerialNumber:", queryObj["VolumeSerialNumber"]); SysdriveSerial = queryObj["VolumeSerialNumber"].ToString(); } } Now I need this piece of code to be in Java. So can I do this? Without anything like c++ unmanaged code. I don't want to use c++ unmanaged code to call to this dll. I want something like this : public class CallToCsharp { private static native void ManagementObjectSearcher(); public static void main(String[] args) { System.loadLibrary("System.Management"); System.out.println("Loaded"); ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk WHERE Name = 'C:'"); } }

    Read the article

  • Jquery prettyPhoto and star conflict....DOM not loading?

    - by Dustin
    I'm working on an online ordering system for photography clients: Here. (Forgive the requirement of having to sign in). After signing in, the user is able to rate pictures using the stars listed below each picture, then subsequently view 3 star pics, or 4 star pics, etc. However, when the user clicks on an image, a lightbox expands (prettyPhoto namely) which contains the picture as well as the stars listed below. I want users to be able to star a picture within the lightbox, but the javascript is not being passed after the prettyPhoto lightbox is initialized. Consequently, they can't rate pictures within the lightbox. I've heard of something similar to this, but have no idea about how to go about tackling the problem. Any help would be appreciated. Thanks!

    Read the article

  • jquery with php loading file

    - by Marcus Solv
    I'm trying to use jquery with a simple php code: $('#some').click(function() { <?php require_once('some1.php?name="some' + index + '"'); ?> }); It shows no error, so I don't know what is wrong. In some1 I have: <?php //Start session session_start(); //Include database connection details require_once('../sql/config.php'); //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $name = clean($_GET['name']); ?> It's not complete because I want to make a sql command (insert). I want when I click in #some to execute that file (create a entry in the table that isn't define yet).

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >