Search Results

Search found 1918 results on 77 pages for 'matt klein'.

Page 40/77 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Does Python's shelve module use memory-mapped IO?

    - by Matt Luongo
    Does anyone know if Python's shelve module uses memory-mapped IO? Maybe that question is a bit misleading. I realize that shelve uses an underlying dbm-style module to do its dirty work. What are the chances that the underlying module uses mmap? I'm prototyping a datastore, and while I realize premature optimization is generally frowned upon, this could really help me understand the trade-offs involved in my design.

    Read the article

  • How to visualize an XML schema ?

    - by matt
    I have made an XML Schema - all the code basically - and was wondering if there is a way that the code can generate something like this: http://www.novell.com/documentation/extend52/Docs/help/Director/books/PGImages/novell_portlet_xml_schema.gif If so how can I do it?

    Read the article

  • NSTimer as a self-targeting ivar.

    - by Matt Wilding
    I have come across an awkward situation where I would like to have a class with an NSTimer instance variable that repeatedly calls a method of the class as long as the class is alive. For illustration purposes, it might look like this: // .h @interface MyClock : NSObject { NSTimer* _myTimer; } - (void)timerTick; @end - // .m @implementation MyClock - (id)init { self = [super init]; if (self) { _myTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(timerTick) userInfo:nil repeats:NO] retain]; } return self; } - (void)dealloc { [_myTimer invalidate]; [_myTImer release]; [super dealloc]; } - (void)timerTick { // Do something fantastic. } @end That's what I want. I don't want to to have to expose an interface on my class to start and stop the internal timer, I just want it to run while the class exists. Seems simple enough. But the problem is that NSTimer retains its target. That means that as long as that timer is active, it is keeping the class from being dealloc'd by normal memory management methods because the timer has retained it. Manually adjusting the retain count is out of the question. This behavior of NSTimer seems like it would make it difficult to ever have a repeating timer as an ivar, because I can't think of a time when an ivar should retain its owning class. This leaves me with the unpleasant duty of coming up with some method of providing an interface on MyClock that allows users of the class to control when the timer is started and stopped. Besides adding unneeded complexity, this is annoying because having one owner of an instance of the class invalidate the timer could step on the toes of another owner who is counting on it to keep running. I could implement my own pseudo-retain-count-system for keeping the timer running but, ...seriously? This is way to much work for such a simple concept. Any solution I can think of feels hacky. I ended up writing a wrapper for NSTimer that behaves exactly like a normal NSTimer, but doesn't retain its target. I don't like it, and I would appreciate any insight.

    Read the article

  • ASP.NET OleDbConnection Problem

    - by Matt
    I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain. The database is a Microsoft Access database. The function that should be accessing the database is: Dim pagedData As New PagedDataSource Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs) doPaging() End Sub Function getTheData() As DataTable Dim DS As New DataSet() Dim strConnect As New OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/ArtDatabase.mdb") Dim objOleDBAdapter As New OleDbDataAdapter("SELECT ArtID, FileLocation, Title, UserName, ArtDate FROM Art ORDER BY Art.ArtDate DESC", strConnect) objOleDBAdapter.Fill(DS, "Art") Return DS.Tables("Art").Copy End Function Sub doPaging() pagedData.DataSource = getTheData().DefaultView pagedData.AllowPaging = True pagedData.PageSize = 2 Try pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString() Catch ex As Exception pagedData.CurrentPageIndex = 0 End Try btnPrev.Visible = (Not pagedData.IsFirstPage) btnNext.Visible = (Not pagedData.IsLastPage) pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount ArtRepeater.DataSource = pagedData ArtRepeater.DataBind() End Sub The ASP.NET is: <asp:Repeater ID="ArtRepeater" runat="server"> <HeaderTemplate> <h2>Items in Selected Category:</h2> </HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink runat="server" ID="HyperLink" NavigateUrl='<%# Eval("ArtID", "ArtPiece.aspx?ArtID={0}") %>'> <img src="<%# Eval("FileLocation") %>" alt="<%# DataBinder.Eval(Container.DataItem, "Title") %>t"/> <br /> <%# DataBinder.Eval(Container.DataItem, "Title") %> </asp:HyperLink> </li> </ItemTemplate> </asp:Repeater>

    Read the article

  • TinyMCE is modifying the XHTML 1.0 Strict HTML I input. How can I stop it?

    - by Matt
    The code I want to have saved through TinyMCE is as follows: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="90" id="homepage-banner"> <param name="movie" value="/images/header.swf" /> <param name="wmode" value="transparent" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="/images/header.swf" width="550" height="90"> <param name="wmode" value="transparent" /> <!--<![endif]--> <img src="/images/header.jpg" width="550" height="90" alt="" border="0" /> <!--[if !IE]>--> </object> <!--<![endif]--> </object> Sadly, what I end up with is: <object data="/images/header.swf" height="90" type="application/x-shockwave-flash" width="550"> <param name="id" value="homepage-banner" /> <param name="wmode" value="transparent" /> <param name="src" value="/images/header.swf" /> </object> The purpose of the stripped parts of the code is to provide a fallback image if flash is not available on the client. In my tinyMCE.init({ ... }); I am using verify_html: true and valid_elements is set as per this forum topic whereby all valid XHTML 1.0 Strict elements are allowed. I have checked and the above code does comply with the XHTML 1.0 Strict standard. I have tried just setting verify_html to false but it had no effect. How can TinyMCE be configured to leave my HTML alone?!

    Read the article

  • Hidden WCF endpoints

    - by Matt
    For the sake of arguement, lets say that I've got a basicHttp WCF service. Besides implementing authentication (login/logout methods), what is stopping someone from just cracking open Visual Studio, adding a web reference to my website's service, and then playing playing around with my service? I'm not familiar with a method of stopping someone from doing this. The idea of someone downloading all of my Data/Operation contracts and then start playing around is keeping me up at night, and I like my sleep!

    Read the article

  • Linq to SQL ordered child collection

    - by Matt Connolly
    Is there a way to define a default order column from a child collection? In my case, I have a Form entity that has a collection of FormItem entities called FormItems. FormItem has a property called DisplayOrder (int). I want to make sure that any Form entities I return from a method have that collection properly ordered. Is there a way to do this before returning the result? For example, I tried this but the list is not actually sorted: var form = context.Forms.FirstOrDefault(x => x.IsDeleted == false && x.FormName == formName); if (form != null) { form.FormItems.OrderBy(x => x.DisplayOrder); // I can't even figure out a way to cast this next line so that it will compile // form.FormItems = form.FormItems.OrderBy(x => x.DisplayOrder); } return form; Is there a way to do this without using DataLoadOptions?

    Read the article

  • Linq to SQL Repository ~theory~ - Generic but now uses Linq to Objects?

    - by Matt Tolliday
    The project I am currently working on used Linq to SQL as an ORM data access technology. Its an MVC3 Web app. The problem I faced was primarily due to the inability to mock (for testing) the DataContext which gets autogenerated by the DBML designer. So to solve this issue (after much reading) I refactored the repository system which was in place - single repository with seperate and duplicated access methods for each table which ended up with something like 300 methods only 10 of which were unique - into a single repository with generic methods taking the table and returning more generic types to the upper reaches of the application. My question revolves more around the design I've used to get thus far and the differences I'm noticing in the structure of the app. 1) Having refactored the code from the dark ages which used classic Linq to SQL queries: public Billing GetBilling(int id) { var result = ( from bil in _bicDc.Billings where bil.BillingId == id select bil).SingleOrDefault(); return (result); } it now looks like: public T GetRecordWhere<T>(Expression<Func<T, bool>> predicate) where T : class { T result; try { result = _dataContext.GetTable<T>().Where(predicate).SingleOrDefault(); } catch (Exception ex) { throw ex; } return result; } and is used by the controller with a query along the lines of: _repository.GetRecordWhere<Billing>(x => x.BillingId == 1); which is fine, and precisely what I wanted to achieve. ...however.... I'm also having to do the following to get precisely the result set i require in the controller class (the highest point of the app in essence)... viewModel.RecentRequests = _model.GetAllRecordsWhere<Billing>(x => x.BillingId == 1) .Where(x => x.BillingId == Convert.ToInt32(BillingType.Submitted)) .OrderByDescending(x => x.DateCreated). Take(5).ToList(); This - as far as my understanding is correct - is now using Linq to Objects rather than the Linq to SQL queries I was previously? Is this okay practise? It feels wrong to me but I dont know why. Probably because the logic of the queries is in the very highest tier of the app, rather than the lowest, but... I defer to you good people for advice. One of the issues I considered was bringing the entire table into memory but I understand that using the Iqeryable return type the where clause is taken to the database and evaluated there. Thus returning only the resultset i require... i may be wrong. And if you've made it this far, well done. Thank you, and if you have any advice it is very much appreciated!!

    Read the article

  • Will a ScheduledExecutorService create new threads as needed?

    - by Matt Ball
    I'm using Executors.newScheduledThreadPool() to create a ScheduledExecutorService, specifying the number of threads like so: int corePoolSize = 42; ScheduledExecutorService foo = Executors.newScheduledThreadPool(corePoolSize); According to the JavaDocs, the corePoolSize argument sets the number of threads to keep in the pool, even if they are idle. Does this mean that this ExecutorService implementation may create more than corePoolSize threads as needed, similar to a cached thread pool?

    Read the article

  • printf and Console.WriteLine - problems with Console.SetOut?

    - by Matt Jacobsen
    i have a bunch of Console.WriteLines in my code that I can observe at runtime. I communicate with a native library that I also wrote. I'd like to stick some printf's in the native library and observe them too. I don't see them at runtime however. I've created a convoluted hello world app to demonstrate my problem. When the app runs, I can debug into the native library and see that the hello world is called. The output never lands in the textwriter though. Note that if the same code is run as a console app then everything works fine. C#: [DllImport("native.dll")] static extern void Test(); StreamWriter writer; public Form1() { InitializeComponent(); writer = new StreamWriter(@"c:\output.txt"); writer.AutoFlush = true; System.Console.SetOut(writer); } private void button1_Click(object sender, EventArgs e) { Test(); } and the native part: __declspec(dllexport) void Test() { printf("Hello World"); } Despite my earlier ramblings (see edits) I actually think this is a problem in C# (or rather my understanding of it).

    Read the article

  • How to mimic built-in .NET serialization idioms?

    - by Matt Enright
    I have a library (written in C#) for which I need to read/write representations of my objects to disk (or to any Stream) in a particular binary format (to ensure compatibility with C/Java library implementations). The format requires a fair amount of bit-packing and some DEFLATE'd bytestreams. I would like my library, however, to be as idiomatic .NET as possible, however, and so would like to provide an API as close as possible to the normal binary serialization process. I'm aware of the ability to implement the IFormatter interface, but being that I really am unable to reuse any part of the built-in serialization stack, is it worth doing this, or will it just bring unnecessary overhead. In other words: Implement IFormatter and co. OR Just provide "Serialize"/"Deserialize" methods that act on a Stream? A good point brought up below about needing the serialization semantics for any case involving Remoting. In a case where using MarshalByRef objects is feasible, I'm pretty sure that this won't be an issue, so leaving that aside are there any benefits or drawbacks to using the ISerializable/IFormatter versus a custom stack (or, is my understanding remoting incorrectly)?

    Read the article

  • Objective-C parse nested JSON string

    - by Matt S.
    I've tried everything (every method that shows up on a SO search), but I can't get it to work. I'm trying to parse this: questions = ( { owner = { "display_name" = "Neil"; }; title = "Initialising "; "up" = 11; "view" = 92; } ); I'm trying to get the display_name under owner.

    Read the article

  • add on click event to picturebox vb.net

    - by Matt Facer
    I have a flowLayoutPanel which I am programatically adding new panelLayouts to. Each panelLayout has a pictureBox within it. It's all working nicely, but I need to detect when that picture box is clicked on. How do I add an event to the picture? I seem to only be able to find c# examples.... my code to add the image is as follows... ' add pic to the little panel container Dim pic As New PictureBox() pic.Size = New Size(cover_width, cover_height) pic.Location = New Point(10, 0) pic.Image = Image.FromFile("c:/test.jpg") panel.Controls.Add(pic) 'add pic and other labels (hidden in this example) to the big panel flow albumFlow.Controls.Add(panel) So I assume somewhere when I'm creating the image I add an onclick event. I need to get the index for it also if that is possible! Thanks for any help!

    Read the article

  • Is C# fast enough for games

    - by Matt
    Will a game written in C# have any speed issues after long periods of play, like for 24 hours at a time? I'm specifically talking about a 2D RPG similar to old Final Fantasy or Dragon Quest games. I know that languages like Python will slow down too much, curious how C# would stand.

    Read the article

  • itunes sdk list albums

    - by Matt Facer
    Hi guys, I'm working on a new test app (just out of curiosity really) which is an add on to iTunes. I'm trying fairly basic things at the mo, and have managed to control volume, pause etc etc. I have a function from some demo code which loops through all the tracks in my main library and gets their album name... I then show the individual album name in my listbox. This is FAR from the best way to do it! Is there a way to query the library to get just the album names? I ultimately want to get to a point where I can have a list of albums (with images) - I click on the album name and that loads the associated tracks.... thanks for any help! (I'm using VB.net btw)

    Read the article

  • SQL select statement with increment

    - by Matt
    Currently I'm using a for statement in PHP to get all the months for this SQL statement, but would like to know if I can do it all with SQL. Basically I have to get the average listing price, and the average selling price for each month going back 1 year where the sellingdate = the month. simple with PHP, but that creates 12 database hits. I'm trying the sql statment below, but it returns listings totally out of order SELECT avg(ListingPrice), avg(SellingPrice), count(ListingDate), DATE(SellingDate) as date, MONTH(SellingDate) as month, YEAR(SellingDate) as year FROM `rets_property_resi` WHERE Area = '5030' AND Status = 'S' AND SellingDate Output: 867507.142857 877632.492063 63 1996-12-24 12 1996 971355.833333 981533.333333 60 1997-11-18 11 1997 949334.328358 985453.731343 67 1997-10-23 10 1997 794150.000000 806642.857143 70 1996-09-20 9 1996 968371.621622 988074.702703 74 1997-08-21 8 1997 1033413.366337 1053018.534653 101 1997-07-30 7 1997 936115.054795 962787.671233 73 1996-06-07 6 1996 875378.735632 906921.839080 87 1996-05-16 5 1996 926635.616438 958561.643836 73 2010-04-13 4 2010 1030224.472222 1046332.291667 72 2010-03-31 3 2010 921711.458333 924177.083333 48 1997-02-28 2 1997 799484.615385 791551.282051 39 1997-01-15 1 1997 As you can see, it pulls from random dates, I need to to pull from 2010-03, 2010-02, 2010-01, etc... any help is appreciated!

    Read the article

  • How do I relate tables with different foreign key names in Kohana ORM?

    - by Matt H
    I'm building a Kohaha application to manage sip lines in asterisk. I'm wanting to use ORM but I'm wondering how do relate certain tables that are already well established. e.g. the table sip_lines looks like this. +--------------------+------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+------------------+------+-----+-------------------+-----------------------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | sip_name | varchar(80) | NO | UNI | NULL | | | displayname | varchar(48) | NO | | NULL | | | line_num | varchar(10) | NO | MUL | NULL | | | model | varchar(12) | NO | MUL | NULL | | | mac | varchar(16) | NO | MUL | NULL | | | areacode | varchar(6) | NO | MUL | NULL | | | per_line_astpp_acc | tinyint(1) | NO | | 0 | | | play_warning | tinyint(1) | NO | | 0 | | | callout_disabled | tinyint(1) | NO | | 0 | | | notes | varchar(80) | NO | | NULL | | | last_update | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | +--------------------+------------------+------+-----+-------------------+-----------------------------+ sip_buddies is this: +----------------+------------------------------+------+-----+-----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------------------+------+-----+-----------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | NO | UNI | | | | host | varchar(31) | NO | | | | | | | lastms | int(11) | NO | | 0 *** snip *** +----------------+------------------------------+------+-----+-----------+----------------+ The two tables are actually related as sip_lines.sip_name = sip_buddies.name How do I relate them in Kohana ORM as this wouldn't be quite right would it? <?php defined('SYSPATH') or die('No direct script access.'); /* A model for all the account information */ class Sip_Line_Model extends ORM { protected $has_one = array("sip_buddies"); } ?> EDIT: Actually, it'd be fair to say that these tables are not properly related with foreign keys! doh. EDIT: Looks like Kohana ORM is not that flexible. ORM is probably not the way to go and works best for completely new projects where the data model can be altered. The reason being that the key names must follow a specific naming convention or else they won't relate in Kohana.

    Read the article

  • Why can final object be modified?

    - by Matt McCormick
    I came across the following code in a code base I am working on: public final class ConfigurationService { private static final ConfigurationService INSTANCE = new ConfigurationService(); private List providers; private ConfigurationService() { providers = new ArrayList(); } public static void addProvider(ConfigurationProvider provider) { INSTANCE.providers.add(provider); } ... INSTANCE is declared as final. Why can objects be added to INSTANCE? Shouldn't that invalidate the use of final. (It doesn't). I'm assuming the answer has to do something with pointers and memory but would like to know for sure.

    Read the article

  • Which CouchDB API to use for Rails?

    - by Matt Baker
    I am currently investigating possible applications of CouchDB on my current project (written in Rails) and would like to get some feedback from people who have actually used these APIs. Which would you recommend and why? ActiveCouch CouchFoo CouchRest CouchRest-Rails CouchPotato

    Read the article

  • Serial port determinism

    - by Matt Green
    This seems like a simple question, but it is difficult to search for. I need to interface with a device over the serial port. In the event my program (or another) does not finish writing a command to the device, how do I ensure the next run of the program can successfully send a command? Example: The foo program runs and begins writing "A_VERY_LONG_COMMAND" The user terminates the program, but the program has only written, "A_VERY" The user runs the program again, and the command is resent. Except, the device sees "A_VERYA_VERY_LONG_COMMAND," which isn't what we want. Is there any way to make this more deterministic? Serial port programming feels very out-of-control due to issues like this.

    Read the article

  • WPF Spellcheck Engine takes up too much memory.

    - by Matt H.
    Each datatemplate in my WPF ItemsControl contains FIVE custom bindable richtextbox controls. It is a data-driven app that for authoring multiple-choice questions -- The question and four answer choices must all support: 1) Spell check 2) Rich formatting (otherwise I'd use regular textboxes) The spell check object in .NET 4 has a Friend constructor that takes a single argument of owner As TextBoxBase This means every richtextbox in the ItemsControl has 5 Spellcheck objects! This is the problem -- every spell check engine is consuming about 500k memory. So after you favor in the spellcheck, bindings, additional controls in the DataTemplate, etc.. a single multi choice question consumes more than 3MB memory. Users with 100--200 questions will quickly see the App raise it's memory consumption to 500+ MB. Management is definitely not OK with this. Is there a way to minimimze this problem? The best suggestion I've heard is to enable/disable spellcheck if the richtextbox is in the ItemsControl's scrollviewer: I haven't gotten an answer to how to go about it: (http://stackoverflow.com/questions/2869012/possible-to-implement-an-isviewportvisible-dependencyproperty-for-an-item-in-an-i) Any good ideas?

    Read the article

  • ASP.NET MVC F# controller action ignoring parameter

    - by Matt H
    Hi. I have a C# ASP.NET MVC project but my controllers are written in F#. For some reason, the following code doesn't work properly. namespace MvcApplication8.Controllers open System.Web.Mvc [<HandleError>] type ImageController() = inherit Controller() member x.Index (i : int) : ActionResult = x.Response.Write i x.View() :> ActionResult The parameter of the action is seemingly ignored. http://localhost:56631/Image/Index/1 = The parameters dictionary contains a null entry for parameter 'i' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'MvcApplication8.Controllers.ImageController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters The controller otherwise works fine. I know that plenty of people have written F# mvc code, so, any ideas where I'm going wrong?

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >