Search Results

Search found 1672 results on 67 pages for 'andrew dyer'.

Page 48/67 | < Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >

  • Intel MKL memory management and exceptions

    - by Andrew
    Hello everyone, I am trying out Intel MKL and it appears that they have their own memory management (C-style). They suggest using their MKL_malloc/MKL_free pairs for vectors and matrices and I do not know what is a good way to handle it. One of the reasons for that is that memory-alignment is recommended to be at least 16-byte and with these routines it is specified explicitly. I used to rely on auto_ptr and boost::smart_ptr a lot to forget about memory clean-ups. How can I write an exception-safe program with MKL memory management or should I just use regular auto_ptr's and not bother? Thanks in advance. EDIT http://software.intel.com/sites/products/documentation/hpc/mkl/win/index.htm this link may explain why I brought up the question UPDATE I used an idea from the answer below for allocator. This is what I have now: template <typename T, size_t TALIGN=16, size_t TBLOCK=4> class aligned_allocator : public std::allocator<T> { public: pointer allocate(size_type n, const void *hint) { pointer p = NULL; size_t count = sizeof(T) * n; size_t count_left = count % TBLOCK; if( count_left != 0 ) count += TBLOCK - count_left; if ( !hint ) p = reinterpret_cast<pointer>(MKL_malloc (count,TALIGN)); else p = reinterpret_cast<pointer>(MKL_realloc((void*)hint,count,TALIGN)); return p; } void deallocate(pointer p, size_type n){ MKL_free(p); } }; If anybody has any suggestions, feel free to make it better.

    Read the article

  • How to save email as draft in Outlook 2003 programmatically?

    - by Andrew
    I am working on an VB.NET app which constructs emails programmatically. This app can be used by different people at the same time so I thought that having a "central" email mailbox would be appropriate. The users would then have "links" (not sure of the correct term) to that central mailbox through their local copy of Outlook. I want to be able to save these emails so that all users can see the generated emails in the "Drafts" folder of their Outlook so that they can check the emails first for any errors and then send it off. I was originally simply talking directly to the Outlook app on the server using Microsoft.Office.Interop but have since read that it is not recommended for use in this sort of scenario. Any ideas?

    Read the article

  • Is it worth investing time in learning to use emacs?

    - by Andrew
    Right up front: I do not want to start a religious war. I've used vi for as long as I can remember, and the few times I've tried to pick up emacs I've been so lost so quickly I've given up. Lots of people find emacs very powerful, however. Its programmability is somewhat legendary. I'm primarily doing Solaris+Java development, and I'd like to ask a simple question: will my productivity increase if I invest time in getting my head around emacs? Is the functionality that it offers over vim going to be paid back in productivity increases in a reasonable timeframe? Repeat: I don't want a "my editor is better than yours". I just want a yes or no answer as to whether it's worth investing the time or not. Will my productivity really increase?

    Read the article

  • mysql_query -- question about results "location"

    - by Andrew Heath
    Forgive me if this is a particularly stupid question! mysql_query($query) returns a boolean, but you can also assign it to a variable $results = mysql_query($query) and then use the other mysql_ functions to extract data. Out of curiosity, how does mysq_query($query) act as both a boolean and a data container at the same time? What's happening "under the hood" during these steps? (yes, I am a n00b..., please be kind!)

    Read the article

  • wordpress servlet mapping not working

    - by Andrew
    I have the latest wordpress running in tomcat 6.0.26 virtual host with Quercus Servlet php servlet. It works, except when I try to use perm links. A url such as /index.php/my-page-name doesn't seem to ever hit the php server. It gets a browser error that request resource is not available. It's like it isn't matching the servlet urlmapping. I'm using a standard method in the web.xml <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> I see nothing showing up either in the tomcat logs when I use that url above. Any ideas please?

    Read the article

  • php error reporting - having trouble matching local & web server settings

    - by Andrew Heath
    I'm trying to add a custom error handler to my site, but in doing so have discovered that my webhost's PHP error reporting settings and those of my localhost (default XAMPP) vary considerably. While I thought I was programming to E_STRICT like a good little boy, adding the error handler to my webhost revealed craploads of Runtime Notices. Example: Runtime notice strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead In /home/... Clearly this isn't a red-alert, showstopping error. But what bothers me is that it doesn't show up on my localhost. I'd certainly like to improve my code by addressing these sorts of issues if I could see them! I've looked through both php.ini files, and my webhost's setting is error_reporting = E_ALL & ~E_NOTICE whereas mine was error_reporting = E_STRICT, which I had thought was better. However, changing mine to match and rebooting the server doesn't seem to have accomplished anything. Could someone please point me in the right direction?

    Read the article

  • query structure - ignoring entries for the same event from multiple users?

    - by Andrew Heath
    One table in my MySQL database tracks game plays. It has the following structure: SCENARIO_VICTORIES [ID] [scenario_id] [game] [timestamp] [user_id] [winning_side] [play_date] ID is the autoincremented primary key. timestamp records the moment of submission for the record. winning_side has one of three possible values: 1, 2, or 0 (meaning a draw) One of the queries done on this table calculates the victory percentage for each scenario, when that scenario's page is viewed. The output is expressed as: Side 1 win % Side 2 win % Draw % and queried with: SELECT winning_side, COUNT(scenario_id) FROM scenario_victories WHERE scenario_id='$scenID' GROUP BY winning_side ORDER BY winning_side ASC and then processed into the percentages and such. Sorry for the long setup. My problem is this: several of my users play each other, and record their mutual results. So these battles are being doubly represented in the victory percentages and result counts. Though this happens infrequently, the userbase isn't large and the double entries do have a noticeable effect on the data. Given the table and query above - does anyone have any suggestions for how I can "collapse" records that have the same play_date & game & scenario_id & winning_side so that they're only counted once?

    Read the article

  • Launching external console application from JAVA

    - by Andrew
    Hi in a java application i need to run an external console application. With the window's ones everything is OK: try { System.out.println("Running..."); Runtime.getRuntime().exec("notepad.exe"); System.out.println("End."); } catch(Exception e) { System.out.println(e.getMessage()); } launches notepad successfully. But if I put "D:\MyProg.exe" or ".bat" or even "cmd.exe" (which is it PATH as notepad is) it does not work. Without any exeptions. Just: Running... End. Can somebody help? Thanx.

    Read the article

  • Bash loop command until file contains n duplicate entries (lines)

    - by Andrew
    Hello, I'm writing a script and I need to create a loop that will execute same commands until file does contain a specified number of duplicate entries. For example, with each loop I will echo random string to file results. And I want loop to stop when there are 10 lines of of the same string. I thought of something like while [ `some command here (maybe using uniq)` -lt 10 ] do command1 command2 command3 done Do you have any idea how can this problem be solved? Using grep can't be done since I don't know what string I need to look for. Thank you for your suggestions.

    Read the article

  • Keeping asp.net mvc site IIS6 always ready to accept requests

    - by Andrew Florko
    I have asp.net mvc intranet site that is deployed to IIS6. Site is used rarely so app pool tends to shutdown. When user click the page for the very first time 5-10 seconds are passed till page appears (app pool started and site is compiled). Situation repeats for the next page and so on. AFAIK IIS7 has option to disable App pool shutdown but IIS6 lacks it. Nowadays i have special utility that pings site periodically (10 pages) in order to determine if pages are available and keeps site always ready for users this way. Is it normal or may be I've missed something in IIS6 configuration? Do you use such pinger apps in production to notify support/admins if site is not available? Thank you in advance!

    Read the article

  • Page not rewriting in ExpressionEngine

    - by Andrew
    I recently just launched an ExpressionEngine site and one of the last steps I take is removing index.php from the URL. In the case of this site, the default template group is called "site". Long story short, after removing index.php from the URL, all pages continue to work great with the exception of my contact page, which also lives in the "site" template group. Going to http://example.com/contact/ gives me a 404 while going to http://example.com/site/contact produces the desired result. In past ExpressionEngine site setups (including my own) this has never happened, so does anyone have thoughts on why this might not be working?

    Read the article

  • Presenting collection of structures of strings in grid or similar in WPF - Example? Ideas?

    - by Andrew
    Hi, I have a collection of structures. The structure is just some strings. Example public struct ReportLine { public string Name; public string Address; public string Phone; ...// about 10 other strings } I can't change this part. What I want to do is display it in a simple grid or simlar in WPF. My only requirements are: a) need column headers b) rows must alternate in color c) columns big enough to hold largest datum (which is not know until run time) Can someone point me to an example to get me started? Is the GridView the way to go? Or DataGrid? Or perhaps just the grid? I have the book Pro WPF in C# 2008 and it covers binding ListBox's to collections, but the collections always seem to be collections of one field (ex. a collection of 40 names). Here I have a collection (an array in fact) of a structure. How do I setup the databinding? As you can see, I'm new to this and probably would most benefit from a reference to an article. I've found articles covering collections of 1 field, but no examples covering binding to an array of structures. Also, my intitial research indicates c) can't be easily done, if you demand that the column is big enough for all the data in that column, not just the visible data. Thanks, dave

    Read the article

  • Creating a ListView/TreeView using Category (Control Panel-Like) View

    - by Andrew Moore
    I currently have an application which uses a regular ListView with groups to show a bunch of modules. I would like to use a Category view. Category view is the new view introduced in Windows Vista for the Control Panel: Is there a third party control or a way (via API) to create a ListView which mimics the behavior of the Windows 7 Control Panel? Categories with icons and action links. Separate events for Category Click and Action Click. One or two column layout Separators between action links or lines EDIT: Seems like Windows is using a TreeView (SysTreeView32) control internally for this.

    Read the article

  • ASP.NET MVC. Hot to guess autogenerated id value ?

    - by Andrew Florko
    My web form contains list of dynamic fields that are generated like this: <% for (int i = 0; i < Model.Options.Count; i++) { %> ... <%= Html.Hidden("Options[" + i + "].Id", Model.Options[i].Id)%> <%= Html.CheckBox("Options[" + i + "].Selected", Model.Options[i].Selected)%> ... This maps perfectly on array of controller method parameters as described in Model Binding To A List article. I want to add label for checkboxes to title them, but I have to guess their ids in hmtl layout. Options[" + i + "].Selected turns into Options_0__Selected How can I avoid hardcoding Id generation in-built asp.net mvc rules? Thank you advance.

    Read the article

  • VB.net Enter Key

    - by Andrew
    I was given the following pseudo code in order to get the form that has focus and only allow the form I want to be submitted: <script> var currentForm = document.forms[0];</script> <form ...><input onfocus="currentForm = this.form;"/></form> <form ...><input onfocus="currentForm = this.form;"/></form> function globalKeyPressed(event) { if (event.keyCode == ENTER) { // This is pseudo-code, check how to really do it currentForm.submit(); } } How would I do this for VB.net because VB.net doesn't accept System.Windows.Forms.KeyPressEventArgs. I also wanted to add that I can't have multiple forms on my website as it disrupts the loginview. So my 2 seperate 'forms' are really just a loginview and then an asp:textbox and asp:button by themselves without a form.

    Read the article

  • Getting invalid context errors

    - by Andrew
    I don't have much code thus far, only this to start: UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); CGMutablePathRef outerPath; CGMutablePathRef highlightPath; CGRect outerRect = rectForRectWithInset(bounds, 1); CGRect highlightRect = CGRectMake(outerRect.origin.x, outerRect.origin.y + 1, outerRect.size.width, outerRect.size.height); And then the problematic bit, which when commented out, the error goes away: CGContextSaveGState(context); CGContextAddPath(context, highlightPath); CGContextSetFillColorWithColor(context, [[UIColor colorWithWhite:1.0 alpha:0.05]CGColor]); CGContextFillPath(context); CGContextRestoreGState(context); Below that is simply: UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

    Read the article

  • Div width: auto and IE

    - by Andrew Heath
    I'm using the jQuery qTip to show individual users and their votes when an average rating is mousedover. qTip calls a PHP file which grabs all the users and votes for the item from the MySQL database and builds a 3 column table, which appears as the tooltip. In Firefox, the tooltip displays properly. In IE7 (haven't tested on IE8 yet), the tooltip is the proper height, but the width is only 2 or 3 characters - not the entire table. If I set the width of the div to a fixed number, say width: 300px; I can coax IE into displaying it properly. However, the length of my users' names varies considerably, and I'd rather not nail down the div to its maximum possible width and then have a crapload of whitespace when you look at an item voted on only by "Joe". Using width: auto; has no effect in IE7. Are there alternatives? Sorry if I've overlooked a similar question. I searched for a bit before posting but didn't find anything suitable. EDIT TO ADD CODE: <div style="-moz-border-radius: 0pt 0pt 0pt 0pt; position: absolute; width: 358px; display: none; top: 384.617px; left: 463.5px; z-index: 6000;" class="qtip qtip-defaults" qtip="0"> <div style="position: relative; overflow: hidden; text-align: left;" class="qtip-wrapper"> <div style="overflow: hidden; background: none repeat scroll 0% 0% white; border: 1px solid rgb(211, 211, 211);" class="qtip-contentWrapper"> <div class="qtip-content qtip-content" style="background: none repeat scroll 0% 0% white; color: rgb(17, 17, 17); overflow: hidden; text-align: left; padding: 5px 9px;"> <div id="WhoResults"> <table> <tbody> <tr> <td>guy1</td> <td>guy2</td> <td>guy3</td> </tr> <tr> <td>guy4</td> <td>guy5</td> <td>guy6</td> </tr> </tbody> </table> </div> </div> </div> </div> </div> I have applied no CSS styling. That's all been handled by qTip. I tried to format it as best I could. Thanks for any help you can provide.

    Read the article

  • getting number of hours until the next event

    - by Andrew Heath
    I've got a table with this data: [ID] [event_name] [last_event] 1 stats 2011-01-01 01:47:32 last_event is a timestamp. The event occurs every 48 hours (it's a cron job). I'd like to show my users the number of hours until the event executes again. So far I've got: SELECT (lastFinish + INTERVAL 48 HOUR) FROM `cron_status` which gives me the exact time and date of the next occurence: 2011-01-03 01:47:32. So I figured if I subtracted the current datetime... SELECT ((lastFinish + INTERVAL 48 HOUR) - SYSDATE()) FROM `cron_status` which (I think?) gives me the difference in unix time: 1980015. But if I divide that by 3600 to convert the seconds to hours... SELECT (((lastFinish + INTERVAL 48 HOUR) - SYSDATE())/3600) FROM `cron_status` I get numbers an order of magnitude too high: 549.99. Where am I going wrong? The target is returning the number of hours until the next execution. Thank you!

    Read the article

  • Can C++ do something like an ML case expression?

    - by Nathan Andrew Mullenax
    So, I've run into this sort of thing a few times in C++ where I'd really like to write something like case (a,b,c,d) of (true, true, _, _ ) => expr | (false, true, _, false) => expr | ... But in C++, I invariably end up with something like this: bool c11 = color1.count(e.first)>0; bool c21 = color2.count(e.first)>0; bool c12 = color1.count(e.second)>0; bool c22 = color2.count(e.second)>0; // no vertex in this edge is colored // requeue if( !(c11||c21||c12||c22) ) { edges.push(e); } // endpoints already same color // failure condition else if( (c11&&c12)||(c21&&c22) ) { results.push_back("NOT BICOLORABLE."); return true; } // nothing to do: nodes are already // colored and different from one another else if( (c11&&c22)||(c21&&c12) ) { } // first is c1, second is not set else if( c11 && !(c12||c22) ) { color2.insert( e.second ); } // first is c2, second is not set else if( c21 && !(c12||c22) ) { color1.insert( e.second ); } // first is not set, second is c1 else if( !(c11||c21) && c12 ) { color2.insert( e.first ); } // first is not set, second is c2 else if( !(c11||c21) && c22 ) { color1.insert( e.first ); } else { std::cout << "Something went wrong.\n"; } I'm wondering if there's any way to clean all of those if's and else's up, as it seems especially error prone. It would be even better if it were possible to get the compiler complain like SML does when a case expression (or statement in C++) isn't exhaustive. I realize this question is a bit vague. Maybe, in sum, how would one represent an exhaustive truth table with an arbitrary number of variables in C++ succinctly? Thanks in advance.

    Read the article

  • Recommendations for Open Source Parallel programming IDE

    - by Andrew Bolster
    What are the best IDE's / IDE plugins / Tools, etc for programming with CUDA / MPI etc? I've been working in these frameworks for a short while but feel like the IDE could be doing more heavy lifting in terms of scaling and job processing interactions. (I usually use Eclipse or Netbeans, and usually in C/C++ with occasional Java, and its a vague question but I can't think of any more specific way to put it)

    Read the article

  • How to implement parent-child windows and pass values from child to parent?

    - by Andrew
    I am working on an ASP.NET MVC 2 application. In one of my data entry forms, I have an "employer" field which has a "search" link next to it. When a user clicks on this link, another window is opened with a search form. The user uses the search form to search for the correct employer. A list of employers is shown to the user. Currently, the user has to then copy and paste the correct employer from the child window into the original window. I want to implement it so that each employer search result in the child window is a hyperlink. The user would then click on the correct employer and then the correct employer value would be populated in the original parent window employer field. How would I go about implementing this in ASP.NET MVC 2?

    Read the article

  • anti-if campaign

    - by Andrew Siemer
    I recently ran against a very interesting site that expresses a very interesting idea - the anti-if campaign. You can see this here at www.antiifcampaign.com. I have to agree that complex nested IF statements are an absolute pain in the rear. I am currently on a project that up until very recently had some crazy nested IFs that scrolled to the right for quite a ways. We cured our issues in two ways - we used Windows Workflow Foundation to address routing (or workflow) concerns. And we are in the process of implementing all of our business rules utilizing ILOG Rules for .NET (recently purchased by IBM!!). This for the most part has cured our nested IF pains...but I find myself wondering how many people cure their pains in the manner that the good folks at the AntiIfCampaign suggest (see an example here) by creating numerous amounts of abstract classes to represent a given scenario that was originally covered by the nested IF. I wonder if another way to address the removal of this complexity might also be in using an IoC container such as StructureMap to move in and out of different bits of functionality. Either way... Question: Given a scenario where I have a nested complex IF or SWITCH statement that is used to evaluate a given type of thing (say evaluating an Enum) to determine how I want to handle the processing of that thing by enum type - what are some ways to do the same form of processing without using the IF or SWITCH hierarchical structure? public enum WidgetTypes { Type1, Type2, Type3, Type4 } ... WidgetTypes _myType = WidgetTypes.Type1; ... switch(_myType) { case WidgetTypes.Type1: //do something break; case WidgetTypes.Type2: //do something break; //etc... }

    Read the article

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