Search Results

Search found 3484 results on 140 pages for 'chris dubois'.

Page 80/140 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • C malloc assertion help

    - by Chris
    I am implementing a divide and conquer polynomial algorithm so i can bench it against an opencl implementation, but i can't seem to get malloc to work. When I run the program it allocates a bunch of stuff, checks some things, then sends the size/2 to the algorithm. Then when I hit the malloc line again it spits out this: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)-bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) = (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)-size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed. Aborted The line in question is: int *out, .....other vars....; out = (int *)malloc(sizeof(int) * size * 2); I have checked size with fprintf and it is a positive int (usually 50 at that point). I have tried calling malloc with a plain number as well and i still get the error. I'm just stumped at what's going on, and nothing from google that I have found so far has been too helpful. Any ideas what's going on? I'm trying to figure out how to compile a newer GCC in case it's a compiler error, but i really doubt it.

    Read the article

  • Using XStream to deserialize an XML response with separate "success" and "failure" forms?

    - by Chris Markle
    I am planning on using XStream with Java to convert between objects and XML requests and XML responses and objects, where the XML is flowing over HTTP/HTTPS. On the response side, I can get a "successful" response, which seems like it would map to one Java class, or a "failure" response, which seems like it would map to another Java class. For example, for a "file list" request, I could get an affirmative response e.g., <?xml version="1.0" encoding="UTF-8"?> <response> <success>true</success> <files> <file>[...]</file> <file>[...]</file> <file>[...]</file> </files> </response> or I could get a negative response e.g., <?xml version="1.0" encoding="UTF-8"?> <response> <success>false</success> <error> <errorCode>-502</errorCode> <systemMessage>[...]AuthenticationException</systemMessage> <userMessage>Not authenticated</userMessage> </error> </response> To handle this, should I include fields in one class for both cases or should I somehow use XStream to "conditionally" create one of the two potential classes? The case with fields from both response cases in the same object would look something like this: Class Response { boolean success; ArrayList<File> files; ResponseError error; [...] } Class File { String name; long size; [...] } Class ResponseError { int errorCode; String systemMessage; String userMessage; [...] } I don't know what the "use XStream and create different objects in case of success or error" looks like. Is it possible to do that somehow? Is it better or worse way to go? Anyway, any advice on how to handle using XStream to deal with this success vs. failure response case would be appreciated. Thanks in advance!

    Read the article

  • Stack overflow code golf

    - by Chris Jester-Young
    To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome. ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative solution relatively trivially by a decent compiler won't be counted. :-P ETA2: I've now selected a “best answer”; see this post for rationale. Thanks to everyone who contributed! :-)

    Read the article

  • Custom UITableViewCell changing indexPath While Scrolling ?

    - by Chris
    I have a custom UITableViewCell which I created in Interface Builder. I am successfully Dequeuing cells, but as I scroll, the cells appear to begin calling different indexPaths. In this example, I am feeding the current indexPath.section and indexPath.row into the customCellLabel. As I scroll the table up and down, some of the cells will change. The numbers can be all over the place, but the cells are not skipping around visually. If I comment out the if(cell==nil), then the problem goes away. If I use a standard cell, the problem goes away. Ideas why this might be happening? // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"CalendarEventCell"]; if (cell == nil) { NSLog(@"Creating New Cell !!!!!"); NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CalendarEventCell" owner:self options:nil]; cell = (UITableViewCell *)[nib objectAtIndex:0]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } // Set up the cell... [customCellLabel setText:[NSString stringWithFormat:@"%d - %d",indexPath.section, indexPath.row]]; return cell; }

    Read the article

  • Android Home Screen Widget Failing with EditText

    - by Chris
    Whenever I add an EditText widget to the layout of my home screen widget (confusing how the term "widget" is being used twice in the Android lexicon :-/ ), I receive the "Problem Loading Widget" error box. Here is the layout I'm attempting; if you remove the EditText, it works... < RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" <Button android:id="@+id/button_generate" android:layout_width="54px" android:layout_height="54px" android:text="Generate" android:textSize="10sp" android:gravity="center" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/edittext_key"> </Button> <TextView android:id="@+id/textview_hash" android:layout_width="75px" android:layout_height="45px" android:text="Password" android:textSize="11sp" android:gravity="left" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/edittext_key"> </TextView> <EditText android:id="@+id/edittext_data2" android:layout_width="200px" android:layout_height="50px" android:textSize="12sp" android:layout_marginTop="20px" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"> </EditText> </RelativeLayout> Now, the Google Search home screen widget has an EditText, so it's obviously legal to implement. Any thoughts on why this is not working?

    Read the article

  • Design: Website calling a webservice on the same machine

    - by Chris L
    More of a design/conceptual question. At work the decision was made to have our data access layer be called through webservices. So our website would call the webservices for any/all data to and from the database. Both the website & the webservices will be on the same machine(so no trip across the wire), but the database is on a separate machine(so that would require a trip across the wire regardless). This is all in-house, the website, webservice, and database are all within the same company(AFAIK, the webservices won't be reused by another other party). To the best of my knowledge: the website will open a port to the webservices, and the webservices will in turn open another port and go across the wire to the database server to get/submit the data. The trip across the wire can't be avoided, but I'm concerned about the webservices standing in the middle. I do agree there needs to be distinct layers between the functionality(such as business layer, data access layer, etc...), but this seems overly complex to me. I'm also sensing there will be some performance problems down the line. Seems to me it would be better to have the (DAL)assemblies referenced directly within the solution, thus negating the first port to port connection. Any thoughts(or links) both for and against this idea would be appreciated P.S. We're a .NET shop(migrating from vb to C# 3.5)

    Read the article

  • Rich Text Editor with Tab and Table Support

    - by Chris W.
    We are developing a project for a client that requires a rich text editor that supports both tables and "real" tabs for indentation. Of the editors we've looked at, both TinyMCE and FreeRichTextEditor are very close fits, but indenting with tab seems to only work in WebKit-based browsers. Is there a (preferably free) cross-browser compatible rich text editor that supports both of these features, or a way of 'fixing' tab support in Trident and Mozilla-based browsers?

    Read the article

  • 'foreach' failing when using Parallel Task Library

    - by Chris Arnold
    The following code creates the correct number of files, but every file contains the contents of the first list. Can anyone spot what I've done wrong please? private IList<List<string>> GetLists() { // Code omitted for brevity... } private void DoSomethingInParallel() { var lists = GetLists(); var tasks = new List<Task>(); var factory = new TaskFactory(); foreach (var list in lists) { tasks.Add(factory.StartNew(() => { WriteListToLogFile(list); })); } Task.WaitAll(tasks.ToArray()); }

    Read the article

  • HttpModule to Write Out JavaScript Script References to the Response

    - by Chris
    On my page in the Page_Load event I add a collection of strings to the Context object. I have an HttpModule that will fire EndRequest and retrieve the collection of strings. What I then do is write out a script reference tag (based on the collection of strings) to the response. The problem is that the page reads the script reference but doesn't retrieve the contents of the file (I imagine because this is occurring in the EndRequest event). I can't fire the BeginRequest event because I won't have access to the Context Items collection. I tried to also registering an HttpHandler which Processes the request of the script reference but I can't access the collection of strings in the Context.Items from there. Any suggestions? Page_Load: protected void Page_Load(object sender, EventArgs e) { Context.Items.Add("ScriptFile", "/UserControls.js"); } HttpModule: public void OnEndRequest(Object s, EventArgs e) { HttpApplication app = s as HttpApplication; object script = app.Context.Items["ScriptFile"]; app.Response.Write("<script type='text/javascript' src='" + script + "'></script>"); }

    Read the article

  • What is the root directory OR how do I set the directory in DotNetZip

    - by Chris
    where does DotNetZip get it's root directory for saving. All the save examples don't show the directory. My goal is to recurse a folder and subfolders. In each folder I want to zip all the files into one zip and delete the source files. private void CopyFolder(string srcPath, string dstPath) { if (!Directory.Exists(dstPath)) Directory.CreateDirectory(dstPath); string[] files = Directory.GetFiles(srcPath); string msg; string zipFileName; using (ZipFile z = new ZipFile(Path.Combine(srcPath,String.Format("Archive{0:yyyyMMdd}.zip", DateTime.Now)))) { z.ReadProgress += new EventHandler<ReadProgressEventArgs>(z_ReadProgress); foreach (string file in files) { FileInfo fi = new FileInfo(file); AddLog(String.Format("Adding {0}", file)); z.AddFile(file); } //z.Save(Path.Combine(srcPath, String.Format("Archive{0:yyyyMMdd}.zip", DateTime.Now))); z.Save(); if (deleteSource) { foreach (string file in files) { File.Delete(file); } } zipFileName = z.Name; } if (!compressOnly) File.Copy(Path.Combine(srcPath,zipFileName), Path.Combine(dstPath, Path.GetFileName(zipFileName))); string[] folders = Directory.GetDirectories(sourcePath); foreach (string folder in folders) { string name = Path.GetFileName(folder); string dest = Path.Combine(dstPath, name); Console.WriteLine(ln); log.Add(ln); msg = String.Format("{3}{4}Start Copy: {0}{4}Directory: {1}{4}To: {2}", DateTime.Now.ToString("G"), name, dest, ln, Environment.NewLine); AddLog(msg); if (recurseFolders) CopyFolder(folder, dest); msg = String.Format("Copied Directory: {0}{4}To: {1}\nAt: {2}{3}", folder, dest, DateTime.Now.ToString("G"), Environment.NewLine); AddLog(msg); } }

    Read the article

  • Overriding Object.Equals() instance method in C#; now Code Analysis / FxCop warning CA2218: "should

    - by Chris W. Rea
    I've got a complex class in my C# project on which I want to be able to do equality tests. It is not a trivial class; it contains a variety of scalar properties as well as references to other objects and collections (e.g. IDictionary). For what it's worth, my class is sealed. To enable a performance optimization elsewhere in my system (an optimization that avoids a costly network round-trip), I need to be able to compare instances of these objects to each other for equality – other than the built-in reference equality – and so I'm overriding the Object.Equals() instance method. However, now that I've done that, Visual Studio 2008's Code Analysis a.k.a. FxCop, which I keep enabled by default, is raising the following warning: warning : CA2218 : Microsoft.Usage : Since 'MySuperDuperClass' redefines Equals, it should also redefine GetHashCode. I think I understand the rationale for this warning: If I am going to be using such objects as the key in a collection, the hash code is important. i.e. see this question. However, I am not going to be using these objects as the key in a collection. Ever. Feeling justified to suppress the warning, I looked up code CA2218 in the MSDN documentation to get the full name of the warning so I could apply a SuppressMessage attribute to my class as follows: [SuppressMessage("Microsoft.Naming", "CA2218:OverrideGetHashCodeOnOverridingEquals", Justification="This class is not to be used as key in a hashtable.")] However, while reading further, I noticed the following: How to Fix Violations To fix a violation of this rule, provide an implementation of GetHashCode. For a pair of objects of the same type, you must ensure that the implementation returns the same value if your implementation of Equals returns true for the pair. When to Suppress Warnings ----- Do not suppress a warning from this rule. [arrow & emphasis mine] So, I'd like to know: Why shouldn't I suppress this warning as I was planning to? Doesn't my case warrant suppression? I don't want to code up an implementation of GetHashCode() for this object that will never get called, since my object will never be the key in a collection. If I wanted to be pedantic, instead of suppressing, would it be more reasonable for me to override GetHashCode() with an implementation that throws a NotImplementedException? Update: I just looked this subject up again in Bill Wagner's good book Effective C#, and he states in "Item 10: Understand the Pitfalls of GetHashCode()": If you're defining a type that won't ever be used as the key in a container, this won't matter. Types that represent window controls, web page controls, or database connections are unlikely to be used as keys in a collection. In those cases, do nothing. All reference types will have a hash code that is correct, even if it is very inefficient. [...] In most types that you create, the best approach is to avoid the existence of GetHashCode() entirely. ... that's where I originally got this idea that I need not be concerned about GetHashCode() always.

    Read the article

  • Can't get SFTP to work in PHP

    - by Chris Kloberdanz
    I am writing a simple SFTP client in PHP because we have the need to programatically retrieve files via n remote servers. I am using the PECL SSH2 extension. I have run up against a road block, though. The documentation on php.net suggests that you can do this: $stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r'); However, I have an ls method that attempts to something similar public function ls($dir) { $rd = "ssh2.sftp://{$this->sftp}/$dir"; $handle = opendir($rd); if (!is_resource($handle)) { throw new SFTPException("Could not open directory."); } while (false !== ($file = readdir($handle))) { if (substr($file, 0, 1) != '.'){ print $file . "\n"; } } closedir($handle); } I get the following error: PHP Warning: opendir(): Unable to open ssh2.sftp://Resource id #5/outgoing on remote host This makes perfect sense because that's what happens when you cast a resource to string. Is the documentation wrong? I tried replacing the resource with host, username, and host and that didn't work either. I know the path is correct because I can run SFTP from the command line and it works fine. Has anyone else tried to use the SSH2 extenstion with SFTP? Am I missing something obvious here? UPDATE: I setup sftp on another machine in-house and it works just fine. So, there must be something about the server I am trying to connect to that isn't working.

    Read the article

  • Best way to optimize queries like this in Django

    - by chris
    I am trying to lower the amount of queries that my django app is using, but I am a little confused on how to do it. I would like to get a query set with one hit to the database and then filter items from that set. I have tried a couple of things, but I always get queries for each set. let's say I want to get all names from my DB, but also separate out the people just named Ted. Both the names and the ted set will be used in the template. This will give me two sets, one with all names and one with Ted.. but also hits the database twice: namelist = People.objects.all() tedList = namelist.filter(name='ted') Is there a way to filter the first set without hitting the data base again?

    Read the article

  • asp.net: deploying local resources - is embedding possible?

    - by chris
    I have an asp.net app with some local resources. These resources are used in the aspx and code-behind files: aspx: <asp:TextBox ID="TextBox1" runat="server" Text="<%$ Resources:testTag %>" /> .vb: TextBox1.Text = GetLocalResourceObject("testTag").ToString If I deploy the .resx files with the app, there are no problems. However, if I change the build action on the resx file to "Embedded Resource", the resources aren't available, even though they're in the DLL that gets built. Is it possible to deploy resources in a DLL, or am I stuck with managing & deploying resx files on the server?

    Read the article

  • NHibernate criteria query question

    - by Chris
    I have 3 related objects (Entry, GamePlay, Prize) and I'm trying to find the best way to query them for what I need using NHibernate. When a request comes in, I need to query the Entries table for a matching entry and, if found, get a) the latest game play along with the first game play that has a prize attached. Prize is a child of GamePlay and each Entry object has a GamePlays property (IList). Currently, I'm working on a method that pulls the matching Entry and eagerly loads all game plays and associated prizes, but it seems wasteful to load all game plays just to find the latest one and any that contain a prize. Right now, my query looks like this: var entry = session.CreateCriteria<Entry>() .Add(Restrictions.Eq("Phone", phone)) .AddOrder(Order.Desc("Created")) .SetFetchMode("GamePlays", FetchMode.Join) .SetMaxResults(1).UniqueResult<Entry>(); Two problems with this: It loads all game plays up front. With 365 days of data, this could easily balloon to 300k of data per query. It doesn't eagerly load the Prize child property for each game. Therefore, my code that loops through the GamePlays list looking for a non-null Prize must make a call to load each Prize property I check. I'm not an nhibernate expert, but I know there has to be a better way to do this. Ideally, I'd like to do the following (pseudocode): entry = findEntry(phoneNumber) lastPlay = getLatestGamePlay(Entry) firstWinningPlay = getFirstWinningGamePlay(Entry) The end result of course is that I have the entry details, the latest game play, and the first winning game play. The catch is that I want to do this in as few database calls as possible, otherwise I'd just execute 3 separate queries. The object definitions look like: public class Entry { public Guid Id {get;set;} public string Phone {get;set;} public IList<GamePlay> GamePlays {get;set;} // ... other properties } public class GamePlay { public Guid Id {get;set;} public Entry Entry {get;set;} public Prize Prize {get;set;} // ... other properties } public class Prize { public Guid Id {get;set;} // ... other properties } The proper NHibernate mappings are in place, so I just need help figuring out how to set up the criteria query (not looking for HQL, don't use it).

    Read the article

  • Where to go after Informix 4GL?

    - by Chris Harris
    We have a large homegrown ERP system written in Informix 4GL. Currently we are running on old Sun hardware, Solaris 8, and a ten year old version of 4GL and Informix. We need to move on, and one option obviously is to get the latest versions of 4GL & Informix, installed on new hardware (probably Linux/Intel). However I believe there are options for migrating 4GL programmes to other development platforms. Does anyone have experience of that? If so, what platforms, how did it go, what are the pros and cons?

    Read the article

  • How does memory protection in SASOS works?

    - by chris
    I'd like to know how it works - whether it checks if process can read/write/execute memory on every access, or it does it only once? But when it does it only once, and all processes are in a single address space, how are these other hostile processes are prevented from accessing memory from not their's areas?

    Read the article

  • Looking for a good text parsing library for C#

    - by Chris Stewart
    Has anyone run across a quality library that will parse, line by line, CSV, tab-delimited, and Excel files? I've started to do it manually but have noticed some of the intricacies in parsing a comma-delimited file. Such as situations where a cell has a comma in it as part of the data (blah,\"LastName, Jr.\",blah,blah).

    Read the article

  • wpf display staggered content

    - by Chris Cap
    I am trying to display a rather dynamic list of data in WPF. I have essentially a LineItem class that contains a list of strings and a line type. The line type separates different categories of line items. All line items with the same type should be displayed the same and their data should line up. For example, this list will contain an order summary. And the there will be a line type that represents something with a width and height. The width and height must line up vertically. However, there may be other line types that don't have to line up vertically. I want to produce a table similar to what you see below: ------------------------------------------------------------------ | some content here | some more content here | last content here | |----------------------------------------------------------------| | some content here | | last content here | |----------------------------------------------------------------| | spanning content that is longer then most | last content here | |----------------------------------------------------------------| | some content that can span a really long distance | ------------------------------------------------------------------ I attempted to do this by creating ListView with a single column that had a datatemplate that contained a grid with a fixed number of fields and then bind to the Colspan value. Unfortunately, this didn't work. I ended up with incorrect or overlapping content anytime I tried to do a column span. Here's the XAML I was working with <ListView ItemsSource="{Binding}" > <ListView.View> <GridView> <GridViewColumn Header="Content"> <GridViewColumn.CellTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Grid.ColumnSpan="{Binding Path=Tokens[0].ColumnSpan}" Text="{Binding Path=Tokens[0].Content}" ></TextBlock> <TextBlock Grid.Column="1" Grid.ColumnSpan="{Binding Path=Tokens[1].ColumnSpan}" Text="{Binding Path=Tokens[1].Content}" ></TextBlock> <TextBlock Grid.Column="2" Text="{Binding Path=Tokens[2].Content}"></TextBlock> </Grid> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> And here's the classes I was binding to public class DisplayLine { public LineType Linetype { get; set; } public List<Token> Tokens { get; set; } public DisplayLine() { Tokens = new List<Token>(); } } public class Token { public string Content { get; set; } public bool IsEmpty { get { return string.IsNullOrEmpty(Content); } } public int ColumnSpan { get; set; } public Token() { ColumnSpan = 1; } } Does anyone have any suggestions of maybe a way of making this work. I may be taking the wrong approach. I'm trying to avoid any solutions where I explcitily build something in the code behind as I'm using the MVVM pattern so it has to be something that I can bind from exposed through the controller. My intial plan was to create a factory and separate classes that display the data differently based on type. However, I'm struggling coming up with a strategy for this using MVVM as I really can't just build something and display it. I have toyed with the idea of making some kind of UI service class that is injected, but it would still require some pretty detailed UI information from the controller to do it's work.

    Read the article

  • How to use "Nppexec" for Notepad++?

    - by Chris Smullian
    Hi everybody! Is there anybody who shows me how to configure nppexec-plugin for Notepad++? I actually want npp to compile my c-files, run them and to show me their output. I already downloaded the plugin, but I wasn't able to configure it. Maybe anyone out there who is able to show me how? kind regards

    Read the article

  • Use only alpha channel of texture in OpenGL?

    - by Chris
    Hey, I'm trying to draw a constant color to the framebuffer and blend it using the alpha channel from an RGBA texture. I've been looking at glBlendFunc and glBlendColor, but can't seem to figure out a way to ignore the RGB values from the texture. I'm thinking I'll have to pull out the alpha values myself and make a second texture with GL_ALPHA. Is there a better way to do this? Thanks!

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >