Search Results

Search found 133 results on 6 pages for 'jerome wagner'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • fast, clean, C, timsort implementation?

    - by Drew Wagner
    Does anyone know of a clean implementation of timsort? The Python sources contain a description and code for the original timsort, but it is understandably full of python-specific calls. I have a smoothly varying 2D array of double floats that I would like to sort as quickly as possible. It ought to contain a lot of monotonically increasing and decreasing runs. I'd like to try timsorting the rows individually, and then merging the sorted rows. If you know of a better sort technique, I'm open to suggestions. Thanks!

    Read the article

  • Nested/Child TransactionScope Rollback

    - by Robert Wagner
    I am trying to nest TransactionScopes (.net 4.0) as you would nest Transactions in SQL Server, however it looks like they operate differently. I want my child transactions to be able to rollback if they fail, but allow the parent transaction to decide whether to commit/rollback the whole operation. A greatly simplified example of what I am trying to do: static void Main(string[] args) { using(var scope = new TransactionScope()) // Trn A { // Insert Data A DoWork(true); DoWork(false); // Rollback or Commit } } // This class is a few layers down static void DoWork(bool fail) { using(var scope = new TransactionScope()) // Trn B { // Update Data A if(!fail) { scope.Complete(); } } } I can't use the Suppress or RequiresNew options as Trn B relies on data inserted by Trn A. If I do use those options, Trn B is blocked by Trn A. Any ideas how I would get it to work, or if it is even possible using the System.Transactions namespace? Thanks

    Read the article

  • How to use Maven2 with Apache Sling?

    - by Jerome Baum
    Google doesn't help, neither does a stackoverflow.com search, and browsing through Apache Sling documentation doesn't show any solution so here goes: How can I best use Maven2 with Apache Sling? Basically as far as I see the entire application code will need to be placed in the JCR repository, but I need it versioned. There is some documentation about OSGi bundles that could contain resources, but isn't it kind of overkill to create a bundle with a bunch of Java code to talk to Sling when all I want to do is load some files to corresponding URLs? What I was hoping for is something like jetty:run that will automatically deploy a WAR into a new Jetty instance. Ideally the goal for Sling would run Sling and then load the specified content -- is there some Maven2 plugin for this right now? Or is the bundle-based solution the "canonical" way of doing this?

    Read the article

  • Does .NET have a built in IEnumerable for multiple collections?

    - by Bryce Wagner
    I need an easy way to iterate over multiple collections without actually merging them, and I couldn't find anything built into .NET that looks like it does that. It feels like this should be a somewhat common situation. I don't want to reinvent the wheel. Is there anything built in that does something like this: public class MultiCollectionEnumerable<T> : IEnumerable<T> { private MultiCollectionEnumerator<T> enumerator; public MultiCollectionEnumerable(params IEnumerable<T>[] collections) { enumerator = new MultiCollectionEnumerator<T>(collections); } public IEnumerator<T> GetEnumerator() { enumerator.Reset(); return enumerator; } IEnumerator IEnumerable.GetEnumerator() { enumerator.Reset(); return enumerator; } private class MultiCollectionEnumerator<T> : IEnumerator<T> { private IEnumerable<T>[] collections; private int currentIndex; private IEnumerator<T> currentEnumerator; public MultiCollectionEnumerator(IEnumerable<T>[] collections) { this.collections = collections; this.currentIndex = -1; } public T Current { get { if (currentEnumerator != null) return currentEnumerator.Current; else return default(T); } } public void Dispose() { if (currentEnumerator != null) currentEnumerator.Dispose(); } object IEnumerator.Current { get { return Current; } } public bool MoveNext() { if (currentIndex >= collections.Length) return false; if (currentIndex < 0) { currentIndex = 0; if (collections.Length > 0) currentEnumerator = collections[0].GetEnumerator(); else return false; } while (!currentEnumerator.MoveNext()) { currentEnumerator.Dispose(); currentEnumerator = null; currentIndex++; if (currentIndex >= collections.Length) return false; currentEnumerator = collections[currentIndex].GetEnumerator(); } return true; } public void Reset() { if (currentEnumerator != null) { currentEnumerator.Dispose(); currentEnumerator = null; } this.currentIndex = -1; } } }

    Read the article

  • fastest way to sort the entries of a "smooth" 2D array

    - by Drew Wagner
    What is the fastest way to sort the values in a smooth 2D array? The input is a small filtered image: about 60 by 80 pixels single channel single or double precision float row major storage, sequential in memory values have mixed sign piecewise "smooth", with regions on the order of 10 pixels wide Output is a flat (about 4800 value) array of the sorted values, along with the indices that sort the original array.

    Read the article

  • A PHP script to stream internet radio?

    - by Honus Wagner
    I've been searching and searching and I haven't yet come up with a solution to host my own streaming audio player. I'm looking for a way to host an internet radio player that connects to whatever streams I enter in and plays them. I'm not looking to play my MP3s or anything like that. I'm looking to play content from 181.fm or 1Club.fm, for example. I'd even settle for ShoutCast-only streams. I've been to www.wavestreaming.com but it didnt work for me. I'm guessing its because in the very first box where you enter your website url, it leads in for you: http//www. then you fill in the rest. My site is https:// and does not contain a www. in the URL. I'm guessing that has something to do with it. Any links, suggestions for search topics, or even a brief technical overview of what I should be looking into would be greatly appreciated. Thanks for your time.

    Read the article

  • Variable scoping and the jQuery.getJSON() method

    - by jerome
    The jQuery.getJSON() method seems to ignore the normal rules of scoping within JavaScript. Given code such as this... someObject = { someMethod: function(){ var foo; $.getJSON('http://www.somewhere.com/some_resource', function(data){ foo = data.bar; }); alert(foo); // undefined } } someObject.someMethod(); Is there a best practice for accessing the value of the variable outside of the getJSON scope?

    Read the article

  • Persisting complex data between postbacks in ASP.NET MVC

    - by Robert Wagner
    I'm developing an ASP.NET MVC 2 application that connects to some services to do data retrieval and update. The services require that I provide the original entity along with the updated entity when updating data. This is so it can do change tracking and optimistic concurrency. The services cannot be changed. My problem is that I need to somehow store the original entity between postbacks. In WebForms, I would have used ViewState, but from what I have read, that is out for MVC. The original values do not have to be tamper proof as the services treat them as untrusted. The entities would be (max) 1k and it is an intranet app. The options I have come up are: Session - Ruled out - Store the entity in the Session, but I don't like this idea as there are no plans to share session between URL - Ruled out - Data is too big HiddenField - Store the serialized entity in a hidden field, perhaps with encryption/encoding HiddenVersion - The entities have a (SQL) version field on them, which I could put into a hidden field. Then on a save I get "original" entity from the services and compare the versions, doing my own optimistic concurrency. Cookies - Like 3 or 4, but using a cookie instead of a hidden field I'm leaning towards option 4, although 3 would be simpler. Are these valid options or am I going down the wrong track? Is there a better way of doing this?

    Read the article

  • Removing a fields from a dynamic ModelForm

    - by Jérôme Pigeot
    In a ModelForm, i have to test user permissions to let them filling the right fields : It is defined like this: class TitleForm(ModelForm): def __init__(self, user, *args, **kwargs): super(TitleForm,self).__init__(*args, **kwargs) choices = [] # company if user.has_perm("myapp.perm_company"): self.fields['company'] = forms.ModelChoiceField(widget=forms.HiddenInput(), queryset=Company.objects.all(), required=False) choices.append('Company') # association if user.has_perm("myapp.perm_association") self.fields['association'] = forms.ModelChoiceField(widget=forms.HiddenInput(), queryset=Association.objects.all(), required=False) choices.append('Association') # choices self.fields['type_resource'] = forms.ChoiceField(choices = choices) class Meta: Model = Title This ModelForm does the work : i hide each field on the template and make them appearing thanks to javascript... The problem is this ModelForm is that each field defined in the model will be displayed on the template. I would like to remove them from the form if they are not needed: exemple : if the user has no right on the model Company, it won't be used it in the rendered form in the template. The problem of that is you have to put the list of fields in the Meta class of the form with fields or exclude attribute, but i don't know how to manage them dynamically. Any Idea?? Thanks by advance for any answer.

    Read the article

  • WebOrb - Serializing an object as a string

    - by Robert Wagner
    We have an Adobe Flex client talking to a .NET server using WebORB. Simplifying things, on the .NET side of things we have a struct that wraps a ulong like this: public struct MyStruct { private ulong _val; public override string ToString() { return _val.ToString("x16"); } // Parse method } I want the Flex client to treat this as a string. So that for the following server method: public void DoStuff(int i, MyStruct b); It can call it as DoStuff(1, "1234567890ABCDEF") I've tried playing with custom WebORB serializers, but the documentation is a bit scarce. Is this possible? If so how?

    Read the article

  • Application doesn't exit with 0 threads

    - by Bryce Wagner
    We have a WinForms desktop application, which is heavily multithreaded. 3 threads run with Application.Run and a bunch of other background worker threads. Getting all the threads to shut down properly was kind of tricky, but I thought I finally got it right. But when we actually deployed the application, users started experiencing the application not exiting. There's a System.Threading.Mutex to prevent them from running the app multiple times, so they have to go into task manager and kill the old one before they can run it again. Every thread gets a Thread.Join before the main thread exits, and I added logging to each thread I spawn. According to the log, every single thread that starts also exits, and the main thread also exits. Even stranger, running SysInternals ProcessExplorer show all the threads disappear when the application exits. As in, there are 0 threads (managed or unmanaged), but the process is still running. I can't reproduce this on any developers computers or our test environment, and so far I've only seen it happen on Windows XP (not Vista or Windows 7 or any Windows Server). How can a process keep running with 0 threads?

    Read the article

  • ShoutCast over SSL

    - by Honus Wagner
    So I've gone ahead and set up my ShoutCast server DNAS and set my DSP in Winamp on my host computer. The server listens on port 8000, so per some instructions I installed an output plugin for winamp (Shoutcast DSP) and used 8000 and the password to connect. Server accepts the connection. Now, what the heck do I do now? My host computer is SSL secured and the DNAS server is installed within the secure web directory (if that matters). My desired end result is that I want to listen to my ShoutCast setup at home (host computer) from any computer. I try browsing to my ip address and port 8000 (without using HTTPS) and it comes back with nothing. If I browse with HTTPS://my.server.com:8000, I get Error code: ssl_error_rx_record_too_long) Have I completely missed something, or am I just a total moron? Thanks.

    Read the article

  • Using a regex to determine domain using JavaScript

    - by jerome
    Hi All, If, as here at work, we have test, staging and production environments, such as: http://test.my-happy-work.com http://staging.my-happy-work.com http://www.my-happy-work.com I am writing some javascript that will redirect the browser to a url such as: http://[environment].my-happy-work.com/my-happy-video I need to be able to determine the current environment that we are in. There is the possibility that I will currently be at a url such as: http://[environment].my-happy-work.com/my-happy-path/my-happy-resource I want to be able to grab the window.location but strip it of everything but: http://[environment].my-happy-work.com And then append to that string + "/" + "my-happy-video". I am not skilled with regex, but I suppose there would be a way to parse the window.location up to the ".com" Thoughts? Thanks!

    Read the article

  • MEF part unable to import Autofac autogenerated factory

    - by Michael Wagner
    This is a (to me) pretty weird problem, because it was already running perfectly but went completely south after some unrelated changes. I've got a Repository which imports in its constructor a list of IExtensions via Autofacs MEF integration. One of these extensions contains a backreference to the Repository as Lazy(Of IRepository) (lazy because of the circular reference that would occur). But as soon as I try to use the repository, Autofac throws a ComponentNotRegisteredException with the message "The requested service 'ContractName=Assembly.IRepository()' has not been registered." That is, however, not really correct, because when I break right after the container-build and explore the list of services, it's there - Exported() and with the correct ContractName. I'd appreciate any help on this... Michael

    Read the article

  • Setting the Identity/Principal from a MessageInspector in WCF

    - by Robert Wagner
    I am developing a WCF service that receives the user's credentials in the SOAP header. These credentials are read on the server side using a MessageInspector. So far so good. I want to set the Thread.CurrentPrincipal to a custom principal (CustomPrincipal), but when I do this from the MessageInspector, it gets overridden by the time the service is invoked. When is the best time to set the principal? Also what is the best way to pass the principal, identity or credentials from the inspector to that location?

    Read the article

  • How to determine OS Platform with WMI?

    - by cary.wagner
    I am trying to figure out if there is a location in WMI that will return the OS Architecture (i.e. 32-bit or 64-bit) that will work across "all" versions of Windows. I thought I had figured it out looking at my Win2k8 system when I found the following: Win32_OperatingSystem / OSArchitecture I was wrong. It doesn't appear that this field exists on Win2k3 systems. Argh! So, is anyone aware of another field in WMI that "is" the same across server versions? If not, what about a registry key that is the same? I am using a tool that only allows me to configure simple field queries, so I cannot use a complex script to perform. Any help would be greatly appreciated! Cheers... Cary

    Read the article

  • YAQ: Yet Another Question

    - by Jerome WAGNER
    When you have to code something, you can either : start from scratch (Yet Another approach) fork another existing project participate in an existing project to add the features you miss What do you think are the keys aspects that make you choose option 1, 2 or 3 ?

    Read the article

  • Why delete-orphan needs "cascade all" to run in JPA/Hibernate ?

    - by Jerome C.
    Hello, I try to map a one-to-many relation with cascade "remove" (jpa) and "delete-orphan", because I don't want children to be saved or persist when the parent is saved or persist (security reasons due to client to server (GWT, Gilead)) But this configuration doesn't work. When I try with cascade "all", it runs. Why the delete-orphan option needs a cascade "all" to run ? here is the code (without id or other fields for simplicity, the class Thread defines a simple many-to-one property without cascade): when using the removeThread function in a transactional function, it does not run but if I edit cascade.Remove into cascade.All, it runs. @Entity public class Forum { private List<ForumThread> threads; /** * @return the topics */ @OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY) @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) public List<ForumThread> getThreads() { return threads; } /** * @param topics the topics to set */ public void setThreads(List<ForumThread> threads) { this.threads = threads; } public void addThread(ForumThread thread) { getThreads().add(thread); thread.setParent(this); } public void removeThread(ForumThread thread) { getThreads().remove(thread); } } thanks.

    Read the article

  • Display a ranking grid for game : optimization of left outer join and find a player

    - by Jerome C.
    Hello, I want to do a ranking grid. I have a table with different values indexed by a key: Table SimpleValue : key varchar, value int, playerId int I have a player which have several SimpleValue. Table Player: id int, nickname varchar Now imagine these records: SimpleValue: Key value playerId for 1 1 int 2 1 agi 2 1 lvl 5 1 for 6 2 int 3 2 agi 1 2 lvl 4 2 Player: id nickname 1 Bob 2 John I want to display a rank of these players on various SimpleValue. Something like: nickname for lvl Bob 1 5 John 6 4 For the moment I generate an sql query based on which SimpleValue key you want to display and on which SimpleValue key you want to order players. eg: I want to display 'lvl' and 'for' of each player and order them on the 'lvl' The generated query is: SELECT p.nickname as nickname, v1.value as lvl, v2.value as for FROM Player p LEFT OUTER JOIN SimpleValue v1 ON p.id=v1.playerId and v1.key = 'lvl' LEFT OUTER JOIN SimpleValue v2 ON p.id=v2.playerId and v2.key = 'for' ORDER BY v1.value This query runs perfectly. BUT if I want to display 10 different values, it generates 10 'left outer join'. Is there a way to simplify this query ? I've got a second question: Is there a way to display a portion of this ranking. Imagine I've 1000 players and I want to display TOP 10, I use the LIMIT keyword. Now I want to display the rank of the player Bob which is 326/1000 and I want to display 5 rank player above and below (so from 321 to 331 position). How can I achieve it ? thanks.

    Read the article

  • SQL Server 2008 - Keyword search using table Join

    - by Aaron Wagner
    Ok, I created a Stored Procedure that, among other things, is searching 5 columns for a particular keyword. To accomplish this, I have the keywords parameter being split out by a function and returned as a table. Then I do a Left Join on that table, using a LIKE constraint. So, I had this working beautifully, and then all of the sudden it stops working. Now it is returning every row, instead of just the rows it needs. The other caveat, is that if the keyword parameter is empty, it should ignore it. Given what's below, is there A) a glaring mistake, or B) a more efficient way to approach this? Here is what I have currently: ALTER PROCEDURE [dbo].[usp_getOppsPaged] @startRowIndex int, @maximumRows int, @city varchar(100) = NULL, @state char(2) = NULL, @zip varchar(10) = NULL, @classification varchar(15) = NULL, @startDateMin date = NULL, @startDateMax date = NULL, @endDateMin date = NULL, @endDateMax date = NULL, @keywords varchar(400) = NULL AS BEGIN SET NOCOUNT ON; ;WITH Results_CTE AS ( SELECT opportunities.*, organizations.*, departments.dept_name, departments.dept_address, departments.dept_building_name, departments.dept_suite_num, departments.dept_city, departments.dept_state, departments.dept_zip, departments.dept_international_address, departments.dept_phone, departments.dept_website, departments.dept_gen_list, ROW_NUMBER() OVER (ORDER BY opp_id) AS RowNum FROM opportunities JOIN departments ON opportunities.dept_id = departments.dept_id JOIN organizations ON departments.org_id=organizations.org_id LEFT JOIN Split(',',@keywords) AS kw ON (title LIKE '%'+kw.s+'%' OR [description] LIKE '%'+kw.s+'%' OR tasks LIKE '%'+kw.s+'%' OR requirements LIKE '%'+kw.s+'%' OR comments LIKE '%'+kw.s+'%') WHERE ( (@city IS NOT NULL AND (city LIKE '%'+@city+'%' OR dept_city LIKE '%'+@city+'%' OR org_city LIKE '%'+@city+'%')) OR (@state IS NOT NULL AND ([state] = @state OR dept_state = @state OR org_state = @state)) OR (@zip IS NOT NULL AND (zip = @zip OR dept_zip = @zip OR org_zip = @zip)) OR (@classification IS NOT NULL AND (classification LIKE '%'+@classification+'%')) OR ((@startDateMin IS NOT NULL AND @startDateMax IS NOT NULL) AND ([start_date] BETWEEN @startDateMin AND @startDateMax)) OR ((@endDateMin IS NOT NULL AND @endDateMax IS NOT NULL) AND ([end_date] BETWEEN @endDateMin AND @endDateMax)) OR ( (@city IS NULL AND @state IS NULL AND @zip IS NULL AND @classification IS NULL AND @startDateMin IS NULL AND @startDateMax IS NULL AND @endDateMin IS NULL AND @endDateMin IS NULL) ) ) ) SELECT * FROM Results_CTE WHERE RowNum >= @startRowIndex AND RowNum < @startRowIndex + @maximumRows; END

    Read the article

  • How do I correctly decode unicode parameters passed to a servlet

    - by Grant Wagner
    Suppose I have: <a href="http://www.yahoo.com/" target="_yahoo" title="Yahoo!&#8482;" onclick="return gateway(this);">Yahoo!</a> <script type="text/javascript"> function gateway(lnk) { window.open(SERVLET + '?external_link=' + encodeURIComponent(lnk.href) + '&external_target=' + encodeURIComponent(lnk.target) + '&external_title=' + encodeURIComponent(lnk.title)); return false; } </script> I have confirmed external_title gets encoded as Yahoo!%E2%84%A2 and passed to SERVLET. If in SERVLET I do: Writer writer = response.getWriter(); writer.write(request.getParameter("external_title")); I get Yahoo!â„¢ in the browser. If I manually switch the browser character encoding to UTF-8, it changes to Yahoo!TM (which is what I want). So I figured the encoding I was sending to the browser was wrong (it was Content-type: text/html; charset=ISO-8859-1). I changed SERVLET to: response.setContentType("text/html; charset=utf-8"); Writer writer = response.getWriter(); writer.write(request.getParameter("external_title")); Now the browser character encoding is UTF-8, but it outputs Yahoo!â?¢ and I can't get the browser to render the correct character at all. My question is: is there some combination of Content-type and/or new String(request.getParameter("external_title").getBytes(), "UTF-8"); and/or something else that will result in Yahoo!TM appearing in the SERVLET output?

    Read the article

  • Parse lines of integers in C

    - by Jérôme
    This is a classical problem, but I can not find a simple solution. I have an input file like: 1 3 9 13 23 25 34 36 38 40 52 54 59 2 3 9 14 23 26 34 36 39 40 52 55 59 63 67 76 85 86 90 93 99 108 114 2 4 9 15 23 27 34 36 63 67 76 85 86 90 93 99 108 115 1 25 34 36 38 41 52 54 59 63 67 76 85 86 90 93 98 107 113 2 3 9 16 24 28 2 3 10 14 23 26 34 36 39 41 52 55 59 63 67 76 Lines of different number of integers separated by a space. I would like to parse them in an array, and separate each line with a marker, let say -1. The difficulty is that I must handle integers and line returns. Here my existing code, it loops upon the scanf loop (because scanf can not begin at a given position). #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { if (argc != 4) { fprintf(stderr, "Usage: %s <data file> <nb transactions> <nb items>\n", argv[0]); return 1; } FILE * file; file = fopen (argv[1],"r"); if (file==NULL) { fprintf(stderr, "Error: can not open %s\n", argv[1]); fclose(file); return 1; } int nb_trans = atoi(argv[2]); int nb_items = atoi(argv[3]); int *bdd = malloc(sizeof(int) * (nb_trans + nb_items)); char line[1024]; int i = 0; while ( fgets(line, 1024, file) ) { int item; while ( sscanf (line, "%d ", &item )){ printf("%s %d %d\n", line, i, item); bdd[i++] = item; } bdd[i++] = -1; } for ( i = 0; i < nb_trans + nb_items; i++ ) { printf("%d ", bdd[i]); } printf("\n"); }

    Read the article

  • Wordpress : display all articles of a month on one page

    - by Jérôme
    I would like to change the default behavior of Wordpress regarding the number of articles displayed on a same page to be the following : when displaying the home page, the 10 most recent articles should be displayed, 10 being the setting which can be changed through the admin panel (posts_per_page) when displaying the articles of a specific month (given through the URL like this : ?m=200906&order=ASC, I'd like to display on the same page all articles of this month (in other words, I don't want to have to browse through articles using previous entries or next entries. EDIT : I forgot something else I'd like to change : On the page where all articles of the specified month are displayed, I would like to display the comments for each article. Is this possible to do ? How ?

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >