Search Results

Search found 370 results on 15 pages for 'merlyn morgan graham'.

Page 10/15 | < Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Why is calling close() after fopen() not closing?

    - by Richard Morgan
    I ran across the following code in one of our in-house dlls and I am trying to understand the behavior it was showing: long GetFD(long* fd, const char* fileName, const char* mode) { string fileMode; if (strlen(mode) == 0 || tolower(mode[0]) == 'w' || tolower(mode[0]) == 'o') fileMode = string("w"); else if (tolower(mode[0]) == 'a') fileMode = string("a"); else if (tolower(mode[0]) == 'r') fileMode = string("r"); else return -1; FILE* ofp; ofp = fopen(fileName, fileMode.c_str()); if (! ofp) return -1; *fd = (long)_fileno(ofp); if (*fd < 0) return -1; return 0; } long CloseFD(long fd) { close((int)fd); return 0; } After repeated calling of GetFD with the appropriate CloseFD, the whole dll would no longer be able to do any file IO. I wrote a tester program and found that I could GetFD 509 times, but the 510th time would error. Using Process Explorer, the number of Handles did not increase. So it seems that the dll is reaching the limit for the number of open files; setting _setmaxstdio(2048) does increase the amount of times we can call GetFD. Obviously, the close() is working quite right. After a bit of searching, I replaced the fopen() call with: long GetFD(long* fd, const char* fileName, const char* mode) { *fd = (long)open(fileName, 2); if (*fd < 0) return -1; return 0; } Now, repeatedly calling GetFD/CloseFD works. What is going on here?

    Read the article

  • Drag Drop copy file

    - by Graham Warrender
    I've perhaps done something marginally stupid, but can't see what it is!! string pegasusKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Pegasus\"; string opera2ServerPath = @"Server VFP\"; string opera3ServerPath = @"O3 Client VFP\"; string opera2InstallationPath = null; string opera3InstallationPath = null; //Gets the opera Installtion paths and reads to the string opera*InstallationPath opera2InstallationPath = (string)Registry.GetValue(pegasusKey + opera2ServerPath + "System", "PathToServerDynamic", null); opera3InstallationPath = (string)Registry.GetValue(pegasusKey + opera3ServerPath + "System", "PathToServerDynamic", null); string Filesource = null; string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string File in FileList) Filesource = File; label.Text = Filesource; if (System.IO.Directory.Exists(opera3InstallationPath)) { System.IO.File.Copy(Filesource, opera3InstallationPath); MessageBox.Show("File Copied from" + Filesource + "\n to" + opera3InstallationPath); } else { MessageBox.Show("Directory Doesn't Exist"); } The user drags the file onto the window, I then get the installation path of an application which is then used as the destination for the source file.. When the application is runs, it throws the error directory not found. But surely if the directory doesn't exists is should step into the else statement? a simple application that is becoming a headache!!

    Read the article

  • Entity Framework insert error ("The Version field is required.")

    - by Graham
    I am using Silverlight 4 and RIA services. When I try to insert into my database, I get the following error: "Submit operation failed validation. Please inspect Entity.ValidationErrors for each entity in EntitiesInError for more information." Upon inspecting the ValidationErrors, I see: "The Version field is required." Isn't the Version field updated and maintained by the framework? If so, why is it null? If not, how am I supposed to set it?

    Read the article

  • How to make write operation idempotent?

    - by Morgan Cheng
    I'm reading article about recently release Gizzard sharding framework by twitter(http://engineering.twitter.com/2010/04/introducing-gizzard-framework-for.html). It mentions that all write operations must be idempotent to make sure high reliability. According to wikipedia, "Idempotent operations are operations that can be applied multiple times without changing the result." But, IMHO, in Gazzard case, idempotent write operation should be operations that sequence doesn't matter. Now, my question is: How to make write operation idempotent? The only thing I can image is to have a version number attached to each write. For example, in blog system. Each blog must have a $blog_id and $content. In application level, we always write a blog content like this write($blog_id, $content, $version). The $version is determined to be unique in application level. So, if application first try to set one blog to "Hello world" and second want it to be "Goodbye", the write is idempotent. We have such two write operations: write($blog_id, "Hello world", 1); write($blog_id, "Goodbye", 2); These two operations are supposed to changed two different records in DB. So, no matter how many times and what sequence these two operations executed, the results are same. This is just my understanding. Please correct me if I'm wrong.

    Read the article

  • Define the base class or base functionality of a dynamic proxy (e.g. Castle, LinFu)

    - by Graham
    Hi, I've asked this in the NHibernate forumns but I think this is more of a general question. NHibernate uses proxy generators (e.g. Castle) to create its proxy. What I'd like to do is to extend the proxy generated so that it implements some of my own custom behaviour (i.e. a comparer). I need this because the following standard .NET behaviour fails to produce the correct results: //object AC is a concrete class collection.Contains(AC) = true //object AP is a proxy with the SAME id and therefore represents the same instance as concrete AC collection.Contains(AP) = false If my comparer was implemented by AP (i.e. do id's match) then collection.Contains(AP) would return true, as I'd expect if proxies were implicit. (NB: For those who say NH inherits from your base class, then yes it does, but NH can also inherit from an interface - which is what we're doing) I'm not at all sure this is possible or where to start. Is this something that can be done in any of the common proxy generators that NH uses?

    Read the article

  • Matlab GUI - How to get the previous value entered from a callback function?

    - by Graham
    Hi, I know that this is probably a simple problem but I am new to Matlab GUI's and basically want to get the old value which used to be stored in the text box to replace the value which has just been entered. E.g. Text box contains a valid string, User enters invalid string, Callback func, validates input and realises new input is an error and reverts to the old previous value. How should this be implemented or done? Atm I am just using the get and set property values. Below is some sample code: function sampledist_Callback(hObject, eventdata, handles) % hObject handle to sampledist (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of sampledist as text % str2double(get(hObject,'String')) returns contents of sampledist as a double input = str2double(get(hObject,'String')); if(input < 0 || input > 500) errordlg('Sampled Dist. must be > 0 and < 500','Sample Dist - Input Error'); set(handles.sampledist,'String',['10']); %<--- I would like this value 10 to be the previous entry! guidata(hObject,handles); else set(handles.sampledist,'String',['',input]); guidata(hObject,handles); end

    Read the article

  • Visual Studio C++ Solution in Maven2

    - by graham.reeds
    A new project is coming up that will require interaction between Java and C++. It's been decided that the project will be built via Maven2. Unfortunately I don't know anything about Maven and the Java guys don't know anything about C++. They have their build chain all set up with various reports being emitted for each part related to CheckStyle, Findbugs, Corbortura(?) etc. and they want the same to be done with the C++ side. Currently we have 4 apps that need building: 2 services, a tray app and a simple dialog based application. I've been told I need to have a pom for each and configure each to output to a target directory, have the tool chain produce the reports - the most particular being the code coverage which the client wants 100%. I have sourced the tools - Bullseye and QA-C++ and requested eval copies - but I am dismayed to find there is very little information on C++ & Maven, and what little there is seems to be horror stories. Does anyone on SO have a good story about it (or have link to blog post)? Is there a simple explanation anywhere for configuring a Visual Studio solution (preferably C++) to be Mavenized? I am expecting pain but I am getting increasingly wary of this venture - but unfortunately the project manager is Java side and seems hell-bent on Mavenizing it.

    Read the article

  • Trying to output a list using class

    - by captain morgan
    Am trying to get the moving average of a price..but i keep getting an attribute error in my Moving_Average class. ('Moving_Average' object has no attribute 'days'). Here is what I have: class Moving_Average: def calculation(self, alist:list,days:int): m = self.days prices = alist[1::2] average = [0]* len(prices) signal = ['']* len(prices) for m in range(0,len(prices)-days+1): average[m+2] = sum(prices[m:m+days])/days if prices[m+2] < average[m+2]: signal[m+2]='SELL' elif prices[m+2] > average[m+2] and prices[m+1] < average[m+1]: signal[m+2]='BUY' else: signal[m+2] ='' return average,signal def print_report(symbol:str,strategy:str): print('SYMBOL: ', symbol) print('STRATEGY: ', strategy) print('Date Closing Strategy Signal') def user(): strategy = ''' Which of the following strategy would you like to use? * Simple Moving Average [S] * Directional Indicator[D] Please enter your choice: ''' if signal_strategy in 'Ss': days = input('Please enter the number of days for the average') days = int(days) strategy = 'Simple Moving Average {}-days'.format(str(days)) m = Moving_Average() ma = m.calculation(gg, days) print(ma) gg is an list that contains date and prices. [2013-10-01,60,2013-10-02,60] The output is supposed to look like: Date Price Average Signal 2013-10-01 60.0 2013-10-02 60.0 60.00 BUY

    Read the article

  • What's the best way to store Logon User information for Web Application?

    - by Morgan Cheng
    I was once in a project of web application developed on ASP.NET. For each logon user, there is an object (let's call it UserSessionObject here) created and stored in RAM. For each HTTP request of given user, matching UserSessoinObject instance is used to visit user state information and connection to database. So, this UserSessionObject is pretty important. This design brings several problems found later: 1) Since this UserSessionObject is cached in ASP.NET memory space, we have to config load balancer to be sticky connection. That is, HTTP request in single session would always be sent to one web server behind. This limit scalability and maintainability. 2) This UserSessionObject is accessed in every HTTP request. To keep the consistency, there is a exclusive lock for the UserSessionObject. Only one HTTP request can be processed at any given time because it must to obtain the lock first. The performance and response time is affected. Now, I'm wondering whether there is better design to handle such logon user case. It seems Sharing-Nothing-Architecture helps. That means long user info is retrieved from database each time. I'm afraid that would hurt performance. Is there any design pattern for long user web app? Thanks.

    Read the article

  • Find directories not containing a specific directory

    - by Morgan ARR Allen
    Been searching around for a bit and cannot find a solution for this one. I guess I'm looking for a leaf-directory by name. In this example I'd like to get a list of directories call 'modules' that do NOT have a subdirectory called module. modules/package1/modules/spackage1 modules/package1/modules/spackage2 modules/package1/modules/spackage3/modules modules/package1/modules/spackage3/modules/spackage1 modules/package2/modules/ The list I desire would contain modules/package1/modules/spackage3/modules/ modules/package2/modules/ All the directories named module that do not have a subdirectory called module I started with trying something this with no luck find . -name modules \! -exec sh -c 'find -name modules' \; -exec works on exit code, okay lets pass the count as exit code find . -name modules -exec sh -c 'exit $(find {} -name modules|grep -n ""|tail -n1|cut -d: -f1)' \; This should take the count of each subdirectory called modules and exit with it. No such love.

    Read the article

  • Filter Datagrid onLoad

    - by Morgan Delvanna
    My data grid successfully filters when I select a month from a dropdown list, however when I try to filter it onLoad it just doesn't filter. The dropdown successfully displays the current month, and the grid should also show the current month data. <script type="text/javascript"> dojo.require("dojox.grid.DataGrid"); dojo.require("dojox.data.XmlStore"); dojo.require("dijit.form.FilteringSelect"); dojo.require("dojo.data.ItemFileReadStore"); dojo.require("dojo.date"); theMonth = new Date(); dojo.addOnLoad(function() { dojo.byId('monthInput').value = month_name[(theMonth.getMonth()+1)]; var filterString='{month: "' + theMonth.getMonth() + '"}'; var filterObject=eval('('+filterString+')'); dijit.byId("eventGrid").filter(filterObject); } ); var eventStore = new dojox.data.XmlStore({url: "events.xml", rootItem: "event", keyAttribute: "dateSort"}); function monthClick() { var ctr, test, rtrn; test = dojo.byId('monthInput').value; for (ctr=0;ctr<=11;ctr++) { if (test==month_name[ctr]) { rtrn = ctr; } } var filterString='{month: "' + rtrn + '"}'; var filterObject=eval('('+filterString+')'); eventGrid.setQuery(filterObject); } </script> </head> <body class="tundra"> <div id="header" dojoType="dijit.layout.ContentPane" region="top" class="pfga"></div> <div id="menu" dojoType="dijit.layout.ContentPane" region="left" class="pfga"></div> <div id="content" style="width:750px; overflow:visible" dojoType="dijit.layout.ContentPane" region="center" class="pfga"> <div dojotype="dojo.data.ItemFileReadStore" url="months.json" jsID="monthStore"></div> <div id="pagehead" class="Heading1" >Upcoming Events</div> <p> <input dojoType="dijit.form.FilteringSelect" store="monthStore" searchAttr="month" name="id" id="monthInput" class="pfga" onChange="monthClick()" /> </p> <table dojoType="dojox.grid.DataGrid" store="eventStore" class="pfga" style="height:500px; width:698px" clientSort="true" jsID="eventGrid"> <thead> <tr> <th field="date" width="80px">Date</th> <th field="description" width="600px">Description</th> </tr> <tr> <th field="time" colspan="2">Details</th> </tr> </thead> </table> </div> <div id="footer"></div>

    Read the article

  • How to check whether user is login in web application?

    - by Morgan Cheng
    I want to learn the whole details of web application authentication. So, I decided to write a CodeIgniter authentication library from scratch. Now, I have to make design decision about how to determine whether one user is login. Basically, after user input username & password pair. A cookie is set for this session, following navigations in the web application will not require username & password. The server side will check whether the session cookie is valid to determine whether current user is login. The question is: how to determine whether cookie is valid cookie issued from server side? I can image the most simple way is to have the cookie value stored in session status as well. For each HTTP request, compare the value from cookie and the value from server session. (Since CodeIgniter session library store session variables in cookies, it is not applicable without some tweak.) This method requires storage in server side. For huge web application that is deployed in multiple datacenters. It is possible that user input username & password when browsing in one datacenter, while he/she access the web application in another datacenter later. The expected behavior is that user just input username & password once. As a result, all datacenters should be able to access the session status. That is possible not applicable even the session status is stored in external storage such as database. I tried Google. I login Google with Asian proxy which is supposed to direct me to datacenters in Asian. Then I switch to North American proxy which should direct me to datacenters in North America. It recognize my login without asking username and password again. So, is there any way to determine whether user is login without server side session status?

    Read the article

  • OOP design issue: Polymorphism

    - by Graham Phillips
    I'm trying to solve a design issue using inheritance based polymorphism and dynamic binding. I have an abstract superclass and two subclasses. The superclass contains common behaviour. SubClassA and SubClassB define some different methods: SubClassA defines a method performTransform(), but SubClassB does not. So the following example 1 var v:SuperClass; 2 var b:SubClassB = new SubClassB(); 3 v = b; 4 v.performTransform(); would cause a compile error on line 4 as performTransform() is not defined in the superclass. We can get it to compile by casting... (v as SubClassA).performTransform(); however, this will cause a runtime exception to be thrown as v is actually an instance of SubClassB, which also does not define performTransform() So we can get around that by testing the type of an object before casting it: if( typeof v == SubClassA) { (cast v to SubClassA).performTransform(); } That will ensure that we only call performTransform() on v's that are instances of SubClassA. That's a pretty inelegant solution to my eyes, but at least its safe. I have used interface based polymorphism (interface meaning a type that can't be instantiated and defines the API of classes that implement it) in the past, but that also feels clunky. For the above case, if SubClassA and SubClassB implemented ISuperClass that defined performTransform, then they would both have to implement performTransform(). If SubClassB had no real need for a performTransform() you would have to implement an empty function. There must be a design pattern out there that addresses the issue.

    Read the article

  • How to design data storage for partitioned tagging system?

    - by Morgan Cheng
    How to design data storage for huge tagging system (like digg or delicious)? There is already discussion about it, but it is about centralized database. Since the data is supposed to grow, we'll need to partition the data into multiple shards soon or later. So, the question turns to be: How to design data storage for partitioned tagging system? The tagging system basically has 3 tables: Item (item_id, item_content) Tag (tag_id, tag_title) TagMapping(map_id, tag_id, item_id) That works fine for finding all items for given tag and finding all tags for given item, if the table is stored in one database instance. If we need to partition the data into multiple database instances, it is not that easy. For table Item, we can partition its content with its key item_id. For table Tag, we can partition its content with its key tag_id. For example, we want to partition table Tag into K databases. We can simply choose number (tag_id % K) database to store given tag. But, how to partition table TagMapping? The TagMapping table represents the many-to-many relationship. I can only image to have duplication. That is, same content of TagMappping has two copies. One is partitioned with tag_id and the other is partitioned with item_id. In scenario to find tags for given item, we use partition with tag_id. If scenario to find items for given tag, we use partition with item_id. As a result, there is data redundancy. And, the application level should keep the consistency of all tables. It looks hard. Is there any better solution to solve this many-to-many partition problem?

    Read the article

  • Jquery code breaks page Javascript

    - by Graham
    I required a function to remove URLs from <a> divs found within <div class="rj_insertcode">. Not being familiar with with direction to tackle this, I eventually mustered up the following Jquery code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('div.rj_insertcode a').each(function() { $(this).replaceWith($(this).html()); }); }); </script> </head> My site uses Joomla CMS and I was able to add the above script to the bottom of the template index.php. It works quite well and removes the links generated between the defined tags. My problem: Pages that also include JavaScript do not operate correctly. JavaScript appears to be disabled or not functioning. What can I change to ensure JavaScript still operates correctly, or is there another method I could adopt?

    Read the article

  • mod_rewrite with anchor link

    - by Graham
    Hi, thanks for looking. I know you can't redirect anchor URLs to another page, but is it possible to redirect a URL to only a single anchor? So http://www.example.com/video/{title} always gets sent to http://www.example.com/video.php?title={title}#player The only thing that changes is the title, anchor is always the same... I need to redirect to a certain slide on a coda slider

    Read the article

  • Calling a Add-in function from Excel's VBA

    - by graham
    I am using an Excel Add-in for an Erlangs: http://abstractmicro.com/erlang/helppages/ref-erlbblockage.htm I try to call the Erlang-B function within the Add-in from within VBA thus: Function Erl(Erlangs As Double, Capacity As Double) Erl = Application.WorksheetFunction.ErlbBlockage(Capacity, Erlangs) End Function ...but it doesn't work. I get #VALUE! returned in the Excel cell. I think it is because the function is not part of standard Excel (it is in the Add-in). So how do I call it?

    Read the article

  • Locked visible cells Excel problem

    - by graham.reeds
    I have a problem with an Excel Template in Excel 2007. I need to remove a row from a summary report but the developer who created this report has somehow managed to set it so that only certain number of rows & columns are visible (in case you are interested it is A1:G30) - no headers, no grid, just blue nothingness. Deleting the offending line just peels back the white-ness. I want to change the resolution of the visible grid to A1:G29. I would ask on google but I haven't the foggiest what the tool would be called to do this (if I did I probably wouldn't be asking). Giving generic terms gives very generic results. I've been through every ribbon and came up blank. Help me out my misery - please!

    Read the article

  • Why Windows Live Spaces Fetch Image Through HTTPS?

    - by Morgan Cheng
    I happens to find that, when a live space page is loaded, inline images are fetched by https protocol instead of http protocol. This doesn't make sense. The text part of live space is not fetched by https, why images are fetched with https? I bet the https way to fetch image just make the page loaded slower. Is there any special advantage to choose https over http in this case?

    Read the article

  • jQuery UI Draggable 'stop' event called too many times?

    - by Graham
    I have a feeling I'm either misunderstanding the 'stop' event or not doing it right, but it seems to be called several times while the element is bound to is being dragged. makeAllDragable = function () { $(".test-table").draggable({ start: function (event, ui) { $(this).click(); }, stop: function (event, ui) { foo() } }).click(function () { selectTable($(this)); }); } foo = function () { alert("test"); } In this example foo is called about 30 times, shouldn't is just be when I release the draggable? The jQuery docs don't actually say one where or another though.

    Read the article

  • Multiple key map in c++

    - by Morgan
    Hi, I'm wondering if any of you know of a c++ associative map container type which I can perform multiple key lookups on. The map needs to have constant time lookups but I don't care if it's ordered or unordered. It just needs to be fast. For example, I want to store a bunch of std::vector objects in a map with an integer and a void* as the lookup keys. Both the int and the void* must match for my vector to be retrieved. Does anything like this exist already? Or am I going to have to roll my own. If so, any suggestions? I've been trying to store a boost::unordered_map inside another boost::unordered_map, but I have not had any success with this method yet. Maybe I will continue Pershing this method if there is no simpler way. Thanks!

    Read the article

  • Deleting partial data from a field in MySQL

    - by Graham
    I am trying to remove a specific set of data from a MySQL database field, however I am not sure what the best statement would be for this. For example, if I have a data in a field such as... The use of a secondary password will allow you to gain access to your account from a non-authenticated computer. A non-authenticated computer is any computer that is not your primary computer, an elected authenticated computer or a computer that automatically deletes cookies. <p>This is a test</p> ...and I want to remove <p>This is a test</p> from the field, what statement would be best?

    Read the article

  • Where does the delete control go in my Cocoa user interface?

    - by Graham Lee
    Hi, I have a Cocoa application managing a collection of objects. The collection is presented in an NSCollectionView, with a "new object" button nearby so users can add to the collection. Of course, I know that having a "delete object" button next to that button would be dangerous, because people might accidentally knock it when they mean to create something. I don't like having "are you sure you want to..." dialogues, so I dispensed with the "delete object". There's a menu item under Edit for removing an object, and you can hit Cmd-backspace to do the same. The app supports undoing delete actions. Now I'm getting support emails ranging from "does it have to be so hard to delete things" to "why can't I delete objects?". That suggests I've made it a bit too hard, so what's the happy middle ground? I see applications from Apple that do it my way, or with the add/remove buttons next to each other, but I hate that latter option. Is there another good (and preferably common) convention for delete controls? I thought about an action menu but I don't think I have any other actions that would go in it, rendering the menu a bit thin.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >