Search Results

Search found 1557 results on 63 pages for 'daniel gollas'.

Page 46/63 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Is something along the lines of nested memoization needed here?

    - by Daniel
    System.Transactions notoriously escalates transactions involving multiple connections to the same database to the DTC. The module and helper class, ConnectionContext, below are meant to prevent this by ensuring multiple connection requests for the same database return the same connection object. This is, in some sense, memoization, although there are multiple things being memoized and the second is dependent on the first. Is there some way to hide the synchronization and/or mutable state (perhaps using memoization) in this module, or perhaps rewrite it in a more functional style? (It may be worth nothing that there's no locking when getting the connection by connection string because Transaction.Current is ThreadStatic.) type ConnectionContext(connection:IDbConnection, ownsConnection) = member x.Connection = connection member x.OwnsConnection = ownsConnection interface IDisposable with member x.Dispose() = if ownsConnection then connection.Dispose() module ConnectionManager = let private _connections = new Dictionary<string, Dictionary<string, IDbConnection>>() let private getTid (t:Transaction) = t.TransactionInformation.LocalIdentifier let private removeConnection tid = let cl = _connections.[tid] for (KeyValue(_, con)) in cl do con.Close() lock _connections (fun () -> _connections.Remove(tid) |> ignore) let getConnection connectionString (openConnection:(unit -> IDbConnection)) = match Transaction.Current with | null -> new ConnectionContext(openConnection(), true) | current -> let tid = getTid current // get connections for the current transaction let connections = match _connections.TryGetValue(tid) with | true, cl -> cl | false, _ -> let cl = Dictionary<_,_>() lock _connections (fun () -> _connections.Add(tid, cl)) cl // find connection for this connection string let connection = match connections.TryGetValue(connectionString) with | true, con -> con | false, _ -> let initial = (connections.Count = 0) let con = openConnection() connections.Add(connectionString, con) // if this is the first connection for this transaction, register connections for cleanup if initial then current.TransactionCompleted.Add (fun args -> let id = getTid args.Transaction removeConnection id) con new ConnectionContext(connection, false)

    Read the article

  • What is '=>'? (C# Grammar Question)

    - by Daniel
    I was watching a Silverlight tutorial video, and I came across an unfamiliar expression in the example code. what is = ? what is its name? could you please provide me a link? I couldn't search for it because they are special characters. code: var ctx = new EventManagerDomainContext(); ctx.Events.Add(newEvent); ctx.SubmitChanges((op) => { if (!op.HasError) { NavigateToEditEvent(newEvent.EventID); } }, null);

    Read the article

  • A simple group-by (no count) in Django

    - by Daniel Quinn
    If this were raw-SQL, it'd be a no-brainer, but in Django, this is proving to be quite difficult to find. What I want is this really: SELECT user_id FROM django_comments WHERE content_type_id = ? AND object_pk = ? GROUP BY user_id It's those last two lines that're the problem. I'd like to do this the "Django-way" but the only thing I've found is mention of aggregates and annotations, which I don't think solve this issue... do they? If someone could explain this to me, I'd really appreciate it.

    Read the article

  • Detect main class

    - by Daniel
    Hoe can I detect the main class of my application? The one, which is either given on the command line or loaded from the jar given at the command line? If this is not possible, why not?

    Read the article

  • Can you safely rely upon Yahoo Pipes to offload ETL for your application?

    - by Daniel DiPaolo
    Yahoo Pipes are a very intriguing choice for sort of a poor-man's server-free ETL solution, but would it be a good idea to build an application around one or many Pipes? I've really only used them for toy things here and there, with the only thing I've used longer than a week or two being one amalgamated and filtered RSS feed that I've plugged into Google Reader (which has worked great, but if it goes out for a while I wouldn't notice). So, my question is, would building an application around Yahoo Pipes be reliable (available most of the time)? Ideally it'd be something I could rely on being up 99+% of the time. It looks like the Pipes Terms of Use permit building apps around it, but I am unfamiliar with anyone building anything significant using them.

    Read the article

  • OpenGL Performance Questions

    - by Daniel
    This subject, as with any optimisation problem, gets hit on a lot, but I just couldn't find what I (think) I want. A lot of tutorials, and even SO questions have similar tips; generally covering: Use GL face culling (the OpenGL function, not the scene logic) Only send 1 matrix to the GPU (projectionModelView combination), therefore decreasing the MVP calculations from per vertex to once per model (as it should be). Use interleaved Vertices Minimize as many GL calls as possible, batch where appropriate And possibly a few/many others. I am (for curiosity reasons) rendering 28 million triangles in my application using several vertex buffers. I have tried all the above techniques (to the best of my knowledge), and received almost no performance change. Whilst I am receiving around 40FPS in my implementation, which is by no means problematic, I am still curious as to where these optimisation 'tips' actually come into use? My CPU is idling around 20-50% during rendering, therefore I assume I am GPU bound for increasing performance. Note: I am looking into gDEBugger at the moment Cross posted at Game Development

    Read the article

  • Is DOM not being loaded ?

    - by Daniel
    I went through episode 88 (Dynamic menus) of the railscasts and when I try to load my *js.erb file in the browser shows me that my fetched data from the controller is getting there Controller def dynamic_departments @departments = Department.all end localhost:3000/javascripts/dynamic_departments.js var departments = new Array(); departments.push(new Array(1,'????',1)); departments.push(new Array(2,'???-???',2)); function facultySelected(){ faculty_id = $('falculty_id').getValue(); options = $('department_id').options; options.length = 1; departments.each(function(department){ if(department[0] == faculty_id){ options[options.length] = new Option(department[1],department[2]) } }); if(options.length == 1){ $('department_field').hide(); } else { $('department_field').show(); } } document.observe('dom:loaded', function(){ alert("DOM loaded"); //$('department_field').hide(); //$('faculty_id').observe('change',facultySelected); }); My routes.rb has the match ':controller/:action.:format' Still...after the page's loaded and I change the value of my collection_select or select nothing happens.What am I missing? *I called the 'alert' and commented the rest to test it....still nothing.

    Read the article

  • Encrypting password in compiled C or C++ code

    - by Daniel
    Hello!, I know how to compile C and C++ Source files using GCC and CC in the terminal, however i would like to know if its safe to include passwords in these files, once compiled. For example.. i check user input for a certain password e.g 123, but it appears compiled C/C++ programs is possible to be decompiled. Is there anyway to compile a C/C++ source file, while keeping the source completely hidden.. If not, could anyone provide a small example of encrypting the input, then checking against the password e.g: (SHA1, MD5)

    Read the article

  • aacplus frame alignment problems

    - by Daniel Mošmondor
    I have an application that rips aac+ audio streams, cutting them at every regular interval (i.e. 10 minutes). Sometimes files are playable OK, but sometimes, Windows Media Player just closes when trying to build DirectShow graph. I am using Orban aacplus plugin, and it works under directshow. When I play this file with winamp or vlc, that have it's own aacplus decoding engine, it works fine. However, I need it to work under directshow. Anyway, problematic file is here: http://www.videophill.com/files/00272-20100418100002.aac I know that there is frame alignment error and I confirmed my theory by filling first 256 bytes with 0x00, tried to play it again, and it worked. Is there any info on aacplus frames available on the web, so I can try to find the beginning of the frame manually and cut the rest off?

    Read the article

  • Is there an alternative to Microsoft.SqlServer.Management.Smo.SqlDataType that includes a value for

    - by Daniel Schaffer
    The Microsoft.SqlServer.Management.Smo.SqlDataType enum has a value for the timestamp type but not rowversion. I'm looking for an updated version of the assembly or an alternate enum type that supports it. The existing enum has a value for Timestamp, but according to the rowversion documentation, timestamp is "deprecated and will be removed in a future version". I prefer to avoid using deprecated things :)

    Read the article

  • Transfering a set with a Wildcarded Generic to a List in Java

    - by Daniel Bingham
    I have a data type that contains a set and a method that expects List<? extends MyClass>. The data type has Set<? extends MyClass>. I need to be able to move the stuff out of the set and into the List. The order it goes into the list doesn't matter, it just needs to start keeping track of it so that it can be reordered when displayed. Suffice to say that changing the Set into a List in the data type is out of the question here. This seems pretty easy at first. Create a new method that takes a Set instead of a List, changes it into a list and then passes it on to the old method that just took a list. The problem comes in changing the set to a list. public void setData(Set<? extends MyClass> data) { List<? extends Myclass> newData = ArrayList< /* What goes here? */ >(); for(ConcordaEntityBean o : data) { newData.add(o); } setData(newData); } Obviously, I can't instantiate an ArrayList with a wildcard, it chokes. I don't know the type at that point. Is there some way to pull the type out of data and pass it to ArrayList? Can I just instantiate it with MyClass? Is there some other way to do this?

    Read the article

  • what's the best way to learn C++ and Qt at the same time?

    - by Daniel Hill
    Hi I did A Google search and couldn't find anything, so I wanna learn Qt/C++ my University (I'm a first year CompSci Student) won't be teaching C++ next year which is a big disappointment I already know Python and dabbled in LaTeX, Javascript, C++ I'm currently helping out a free software project Clementine but it's programmed in Qt/C++ and I don't know enough of both to help out enough. Is there any tips, Tutorial, howtos out there?

    Read the article

  • On XP, how do I get the tooltip to appear above a transclucent form?

    - by Daniel Stutzbach
    I have an form with an Opacity less then 1.0. I have a tooltip associated with a label on the form. When I hover the mouse over the label, the tooltip shows up under the form instead of over the form. If I leave the Opacity at its default value of 1.0, the tooltip correctly appears over the form. However, my form is obviously no longer translucent. ;-) I have tried manually adjusting the position of the ToolTip with SetWindowPos() and creating a ToolTip "by hand" using CreateWindowEx(), but the problem remains. This makes me suspect its a Win32 API problem, not a problem with the Windows Forms implementation that runs on top of Win32. Why does the tooltip appear under the form, and, more importantly, how can I get it to appear over the form where it should? Edit: this appears to be an XP-only problem. Vista and Windows 7 work correctly. I'd still like to find a workaround to get the tooltip to appear above the form on XP. Here is a minimal program to demonstrate the problem: using System; using System.Windows.Forms; public class Form1 : Form { private ToolTip toolTip1; private Label label1; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } public Form1() { toolTip1 = new ToolTip(); label1 = new Label(); label1.Location = new System.Drawing.Point(105, 127); label1.Text = "Hover over me"; label1.AutoSize = true; toolTip1.SetToolTip(label1, "This is a moderately long string, " + "designed to be very long so that it will also be quite long."); ClientSize = new System.Drawing.Size(292, 268); Controls.Add(label1); Opacity = 0.8; } }

    Read the article

  • How to enable i18n from within setup_app in websetup.py ? (formatted resend)

    - by daniel
    From within the setup_app function (websetup.py) of a pylons i18n application, which is making use of a db, I was trying to initiate multilingual content to be inserted into the db. To do so the idea was something like: #necessary imports here def setup_app(command, conf, vars): .... for lang in langs: set_lang(lang) content=model.Content() content.content=_('content') Session.add(content) Session.commit() Unfortunately it seems that it doesn't work. the set_lang code line is firing an exception as follows: File ".. i18n/translation.py", line 179, in set_lang translator = _get_translator(lang, **kwargs) File ".. i18n/translation.py", line 160, in _get_translator localedir = os.path.join(rootdir, 'i18n') File ".. /posixpath.py", line 67, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith' Actually I'm even not sure it could be possible launching i18n mechanisms from within this setup_app function without an active request object. Anyone has tried some trick on a similar story ?

    Read the article

  • What do you consider good API documentation?

    - by Daniel
    I have always liked the documentation on Java APIs, generally speaking, but I know some people consider them lacking. So I'm wondering, what do you consider a good example of API documentation? Please, include a link or an actual example in any answer. I want to have references that I (and others, of course) can use to improve our own documents.

    Read the article

  • Why SELECT N + 1 with no foreign keys and LINQ?

    - by Daniel Flöijer
    I have a database that unfortunately have no real foreign keys (I plan to add this later, but prefer not to do it right now to make migration easier). I have manually written domain objects that map to the database to set up relationships (following this tutorial http://www.codeproject.com/Articles/43025/A-LINQ-Tutorial-Mapping-Tables-to-Objects), and I've finally gotten the code to run properly. However, I've noticed I now have the SELECT N + 1 problem. Instead of selecting all Product's they're selected one by one with this SQL: SELECT [t0].[id] AS [ProductID], [t0].[Name], [t0].[info] AS [Description] FROM [products] AS [t0] WHERE [t0].[id] = @p0 -- @p0: Input Int (Size = -1; Prec = 0; Scale = 0) [65] Controller: public ViewResult List(string category, int page = 1) { var cat = categoriesRepository.Categories.SelectMany(c => c.LocalizedCategories).Where(lc => lc.CountryID == 1).First(lc => lc.Name == category).Category; var productsToShow = cat.Products; var viewModel = new ProductsListViewModel { Products = productsToShow.Skip((page - 1) * PageSize).Take(PageSize).ToList(), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = productsToShow.Count() }, CurrentCategory = cat }; return View("List", viewModel); } Since I wasn't sure if my LINQ expression was correct I tried to just use this but I still got N+1: var cat = categoriesRepository.Categories.First(); Domain objects: [Table(Name = "products")] public class Product { [Column(Name = "id", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)] public int ProductID { get; set; } [Column] public string Name { get; set; } [Column(Name = "info")] public string Description { get; set; } private EntitySet<ProductCategory> _productCategories = new EntitySet<ProductCategory>(); [System.Data.Linq.Mapping.Association(Storage = "_productCategories", OtherKey = "productId", ThisKey = "ProductID")] private ICollection<ProductCategory> ProductCategories { get { return _productCategories; } set { _productCategories.Assign(value); } } public ICollection<Category> Categories { get { return (from pc in ProductCategories select pc.Category).ToList(); } } } [Table(Name = "products_menu")] class ProductCategory { [Column(IsPrimaryKey = true, Name = "products_id")] private int productId; private EntityRef<Product> _product = new EntityRef<Product>(); [System.Data.Linq.Mapping.Association(Storage = "_product", ThisKey = "productId")] public Product Product { get { return _product.Entity; } set { _product.Entity = value; } } [Column(IsPrimaryKey = true, Name = "products_types_id")] private int categoryId; private EntityRef<Category> _category = new EntityRef<Category>(); [System.Data.Linq.Mapping.Association(Storage = "_category", ThisKey = "categoryId")] public Category Category { get { return _category.Entity; } set { _category.Entity = value; } } } [Table(Name = "products_types")] public class Category { [Column(Name = "id", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)] public int CategoryID { get; set; } private EntitySet<ProductCategory> _productCategories = new EntitySet<ProductCategory>(); [System.Data.Linq.Mapping.Association(Storage = "_productCategories", OtherKey = "categoryId", ThisKey = "CategoryID")] private ICollection<ProductCategory> ProductCategories { get { return _productCategories; } set { _productCategories.Assign(value); } } public ICollection<Product> Products { get { return (from pc in ProductCategories select pc.Product).ToList(); } } private EntitySet<LocalizedCategory> _LocalizedCategories = new EntitySet<LocalizedCategory>(); [System.Data.Linq.Mapping.Association(Storage = "_LocalizedCategories", OtherKey = "CategoryID")] public ICollection<LocalizedCategory> LocalizedCategories { get { return _LocalizedCategories; } set { _LocalizedCategories.Assign(value); } } } [Table(Name = "products_types_localized")] public class LocalizedCategory { [Column(Name = "id", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)] public int LocalizedCategoryID { get; set; } [Column(Name = "products_types_id")] private int CategoryID; private EntityRef<Category> _Category = new EntityRef<Category>(); [System.Data.Linq.Mapping.Association(Storage = "_Category", ThisKey = "CategoryID")] public Category Category { get { return _Category.Entity; } set { _Category.Entity = value; } } [Column(Name = "country_id")] public int CountryID { get; set; } [Column] public string Name { get; set; } } I've tried to comment out everything from my View, so nothing there seems to influence this. The ViewModel is as simple as it looks, so shouldn't be anything there. When reading this ( http://www.hookedonlinq.com/LinqToSQL5MinuteOVerview.ashx) I started suspecting it might be because I have no real foreign keys in the database and that I might need to use manual joins in my code. Is that correct? How would I go about it? Should I remove my mapping code from my domain model or is it something that I need to add/change to it? Note: I've stripped parts of the code out that I don't think is relevant to make it cleaner for this question. Please let me know if something is missing.

    Read the article

  • Dynamic upsert in postgresql

    - by Daniel
    I have this upsert function that allows me to modify the fill_rate column of a row. CREATE FUNCTION upsert_fillrate_alarming(integer, boolean) RETURNS VOID AS ' DECLARE num ALIAS FOR $1; dat ALIAS FOR $2; BEGIN LOOP -- First try to update. UPDATE alarming SET fill_rate = dat WHERE equipid = num; IF FOUND THEN RETURN; END IF; -- Since its not there we try to insert the key -- Notice if we had a concurent key insertion we would error BEGIN INSERT INTO alarming (equipid, fill_rate) VALUES (num, dat); RETURN; EXCEPTION WHEN unique_violation THEN -- Loop and try the update again END; END LOOP; END; ' LANGUAGE 'plpgsql'; Is it possible to modify this function to take a column argument as well? Extra bonus points if there is a way to modify the function to take a column and a table.

    Read the article

  • C# / Entity Framework / Linq question regarding calling a method when a class is accessed...

    - by Daniel
    So this is probably really basic, but I'm fairly new to all this. I am using Entity Framework with POCO entities. I want to call a method when a class property is set. I am trying to build an advertisement platform. I have a Customer class, a Venue class and an Advertisement class. I have my indexes set up in such a way that I can call customer.venue. However, I want to be able to call Customer.Venue.CurrentAdvertisement and have it execute a method (if CurrentAdvertisement is null) and return the current advertisement. I know I can explicitly set it every time, but I want to be able to override my classes so that whenever the CurrentAdvertisement property is accessed via LINQ it runs that method to return an ad. In order to do this I need to pass the Venue class a variable (venue name).

    Read the article

  • Build server polling vs. event-driven builds

    - by Daniel T.
    Why do build servers poll for changes instead of SVN firing off an event (or a post-commit step) that tells the build server to start a build? It seems terribly inefficient to poll for changes, especially when the number of projects increases and the polling period is set to a very low value (for example, 30 seconds).

    Read the article

  • How do I track a branch of another repository on the same machine?

    - by Daniel Stutzbach
    I have two private repositories on one machine. Let's call them repo-A and repo-B, which are the directories ~/repo-A and ~/repo-B, respectively. repo-A has two relevant branches: master and live. I'd like to set up repo-B to track repo-A's live branch, so that git pull will pull any updates from repo-A's live branch into repo-B's master branch. Right now, I have the following in repo-B's .git/config: [remote "origin"] url = /home/stutzbach/repo-A/ fetch = +refs/heads/live:refs/remotes/origin/live [branch "master"] remote = origin merge = refs/heads/master However, when I run git pull, it seems to pull from repo-A's master branch. Obviously, I don't have it set up right. What's the right way?

    Read the article

  • iPad Simulator View

    - by Daniel
    I am looking to increase the size of my iPad simulator when it is fired up on my mac, how would I go about doing this? The size of the simulator right now is very very small, I can't even see the text on it!

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >