Search Results

Search found 203 results on 9 pages for 'brett alton'.

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

  • How can Windows 7 be set to sleep at 8pm and wake at 8am every day?

    - by Brett Alton
    I'm trying to figure out how to get Windows 7 to sleep at 8pm and wake at 8am on a daily basis. I'm looking at Windows' services and there is a Shutdown.exe that can run, but it only seems to have a /h flag for hibernation. For waking from sleep, there is a "wake Windows from sleep to run this task" option, but it never seems to work. There is also a Sleep.exe program I can download but it comes with 13MB of other libraries from Microsoft. Is there a C# program I can write to make this work?

    Read the article

  • MATLAB Builder NE (.NET Assembly) Data type question

    - by Brett
    Hi coders, I am using MATLAB Builder NE (MATLAB's integrated .NET assmebly builder), but I am having an issue with data types. I have compiled a small, very simple, function in matlab and build it for .NET. I am able to call the namespace and even the function just fine. However, my function returns a value, and MATLAB defaults to returning it as an "object[]" data type. However, I know that the value is an integer, but I can't figure out how to cast it. My MATLAB function looks like this: function addValue = Myfunction(value1, value2) addValue=value1+value2; end Pretty simple right? And then in .NET I can call it as: xClass.addValue (1, 3, 4); where xClass is the name of the MATLAB built class but when I try: int x = xClass.addValue (1, 3, 4); C# errors out. Typical .NET casting (int) doesn't work. The compiler states it cannot convert object[] to int. Does anyone have experience with the .NET builder in MATLAB that can help me with this? It is really throwing me for a loop. I have scanned through most of the MATLAB BUILDER doc (484 pages!) with zero help. Thank you, Brett

    Read the article

  • Linq Query to Update Nested Array Items?

    - by Brett
    I have an object structure generated from xsd.exe. Roughly, it consists of 3 nested arrays: protocols, sources and reports. The xml looks like this: <protocols> <protocol> <source> <report /> <report /> </source> <source> <report /> <report /> </source> </protocol> <!-- more protocols --> </protocols> I need to update a single "Report" within the data structure. A brute force algorithm is shown below. I know that this could be done using XDocument and Linq, but I'd prefer to update the data structure and then serialize the structure back to disk. Thoughts? Brett bool updated = false; foreach (ProtocolsProtocol protocol in protocols.Protocol) { if (updated) break; foreach (ProtocolsProtocolSource source in protocol.Source) { if (updated) break; for (int i = 0; i < source.Report.Length; i++) { ProtocolsProtocolSourceReport currentReport = source.Report[i]; if (currentReport.Id == report.Id) { currentReport.Attribute1 = report.Attribute1; currentReport.Attribute2 = report.Attribute2; updated = true; break; } } } }

    Read the article

  • Convert string to decimal retaining the exact input format

    - by Brett
    Hi All, I'm sure this is a piece of cake but I'm really struggling with something that seems trivial. I need to check the inputted text of a textbox on the form submit and check to see if it's within a desired range (I've tried a Range Validator but it doesn't work for some reason so I'm trying to do this server-side). What I want to do is: Get the value inputted (eg. 0.02), replace the commas and periods, convert that to a decimal (or double or equivalent) and check to see if it's between 0.10 and 35000.00. Here's what I have so far: string s = txtTransactionValue.Text.Replace(",", string.Empty).Replace(".", string.Empty); decimal transactionValue = Decimal.Parse(s); if (transactionValue >= 0.10M && transactionValue <= 35000.00M) // do something If I pass 0.02 into the above, transactionValue is 2. I want to retain the value as 0.02 (ie. do no format changes to it - 100.00 is 100.00, 999.99 is 999.99) Any ideas? Thanks in advance, Brett

    Read the article

  • Updating UIView subclass contents

    - by Brett
    Hi; I am trying to update a UIView subclass to draw individual pixels (rectangles) after calculating if they are in the mandelbrot set. I am using the following code but am getting a blank screen: //drawingView.h ... -(void)drawRect:(CGRect)rect{ CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(context, r, g, b, 1); CGContextSetRGBStrokeColor(context, r, g, b, 1); CGRect arect = CGRectMake(x,y,1,1); CGContextFillRect(context, arect); } ... //viewController.m ... - (void)viewDidLoad { [drawingView setX:10]; [drawingView setY:10]; [drawingView setR:0.0]; [drawingView setG:0.0]; [drawingView setB:0.0]; [super viewDidLoad]; [drawingView setNeedsDisplay]; } Once I figure out how to display one pixel, I'd like to know how to go about updating the view by adding another pixel (once calculated). Once all the variables change, how do I keep the current view as is but add another pixel? Thanks, Brett

    Read the article

  • Need help revolving a 2D array

    - by Brett
    Pretty much all I'm trying to do is revolve my 2D Array by its container. I'm using this array for a background and I seem to be having problems with it revolving. public class TileTransformer : GridConstants { public Tile[,] Tiles; ContentManager Content; public TileTransformer(ContentManager content) { Content = content; } public Tile[,] Wraping(Tile[,] tiles,Point shift) { Tiles = tiles; for (int x = shift.X; x < 0; x++)//Left shift { for (int X = 0; X < GridWidth; X++) { for (int Y = 0; Y < GridHeight; Y++) { if (X + 1 >GridWidth-1) { Tiles[0, Y].Container =tiles[X, Y].Container; } else { Tiles[X+1, Y].Container =tiles[X, Y].Container; } } } } for (int x = shift.X; x > 0; x--)//right shift { for (int X = 0; X < GridWidth; X++) { for (int Y = 0; Y< GridHeight; Y++) { if (X-1==-1) { Tiles[GridWidth-1, Y].Container =tiles[0, Y].Container; } else { Tiles[X - 1, Y].Container =tiles[X, Y].Container; } } } } for (int y = shift.Y; y > 0; y--)//shift up { for (int X = 0; X < GridWidth; X++) { for (int Y = 0; Y < GridHeight; Y++) { if (Y - 1 == -1) { Tiles[X, GridHeight-1].Container = tiles[X, Y].Container; } else { Tiles[X, Y - 1].Container = tiles[X, Y].Container; } } } } for (int y = shift.Y; y < 0; y++)//shift down { for (int X = 0; X < GridWidth; X++) { for (int Y = 0; Y < GridHeight; Y++) { if (Y + 1 == GridHeight) { Tiles[X, 0].Container = tiles[X, Y].Container; } else { Tiles[X, Y + 1].Container = tiles[X, Y].Container; } } } } return Tiles; } Now the Problems that I'm having is either when I shift up or left it seems the whole array is cleared back to the default state. Also when I'm revolving the array it appears to stretch it upon the sides of the screen that it is shifting towards.

    Read the article

  • Good online auction software

    - by Brett
    We are looking for some PHP-based auction software to start off with and I have have been scouring the net many times and am almost ready to purchase phpprobid as this seems to be the best and most feature rich of the lot; only bad things I have read is the lack of after-sales customer service. Others I have also looked at include: AJ Auction Software WeBid GuruScript Auction PHP Auction (enuuk). Many of them turn me off by having unprofessional sites which makes me think their software will be the same and be rubbish. Many also don't go into detail with the feature set like PHP Pro Bid does. So before we purchase PHP Pro Bid I was wondering if I missed something good? Thanks!

    Read the article

  • Please recommend a patterns book for iOS development

    - by Brett Ryan
    I've read several books on iOS development and Objective-C, however what a lot of them teach is how to work with interfaces and all contain the model inside the view controller, i.e. a UITableViewController based view will simply have an NSArray as it's model. I'm interested in what the best practices are for designing the structure of an application. Specifically I'm interested in best practices for the following: How to separate a model from the view controller. I think I know how to do this by simply replacing the NSArray style example with a specific model object, however what I do not know how to do is alert the view when the model changes. For example in .NET I would solve this by conforming to INotifyPropertyChanged and databinding, and similarly with Java I would use PropertyChangeListener. How to create a service model for my domain objects. For example I want to learn the best way to create a service for a hypothetical Widget object to manage an internal DB and also services for communicating with remote endpoints. I need to learn the best ways to do this in a way that interface components can subscribe to events such as widgetUpdated. These services should be singleton classes and some how dependency injected into model/controller objects. Books I've read so far are: Programming in Objective-C (4th Edition) Beginning iOS 5 Development: Exploring the iOS SDK The iOS 5 Developer's Cookbook: Expanded Electronic Edition: Essentials and Advanced Recipes for iOS Programmers Learn Objective-C on the Mac: For OS X and iOS I've also purchased the following updated books but not yet read them. The Core iOS 6 Developer's Cookbook (4th edition Programming in Objective-C (5th Edition) I come from a Java and C# background with 15 years experience, I understand that many of the ways I would do things in these languages may not fit to the ObjC way of developing applications. Any guidance on the topic is very much appreciated.

    Read the article

  • Physics/Graphics Components

    - by Brett Powell
    I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to start creating the actual components I am a bit confused. When I think of them in terms of HealthComponent or something that would basically just be a property, it makes perfect sense. When it is something more general as a Physics/Graphics component, I get a bit confused. My Object class looks like this so far (If you notice any changes I should make please let me know, still new to this)... typedef unsigned int ID; class GameObject { public: GameObject(ID id, Ogre::String name = ""); ~GameObject(); ID &getID(); Ogre::String &getName(); virtual void update() = 0; // Component Functions void addComponent(Component *component); void removeComponent(Ogre::String familyName); template<typename T> T* getComponent(Ogre::String familyName) { return dynamic_cast<T*>(m_components[familyName]); } protected: // Properties ID m_ID; Ogre::String m_Name; float m_flVelocity; Ogre::Vector3 m_vecPosition; // Components std::map<std::string,Component*> m_components; std::map<std::string,Component*>::iterator m_componentItr; }; Now the problem I am running into is what would the general population put into Components such as Physics/Graphics? For Ogre (my rendering engine) the visible Objects will consist of multiple Ogre::SceneNode (possibly multiple) to attach it to the scene, Ogre::Entity (possibly multiple) to show the visible meshes, and so on. Would it be best to just add multiple GraphicComponent's to the Object and let each GraphicComponent handle one SceneNode/Entity or is the idea to have one of each Component needed? For Physics I am even more confused. I suppose maybe creating a RigidBody and keeping track of mass/interia/etc. would make sense. But I am having trouble thinking of how to actually putting specifics into a Component. Once I get a couple of these "Required" components done, I think it will make a lot more sense. As of right now though I am still a bit stumped.

    Read the article

  • Change from Bullet/OgreAnim to Havok?

    - by Brett Powell
    I have been working on a game in Ogre for the last 6 months or so. It started as a learning project, and after a few rewrites it actually turned into a real game project. Physics scared me, and using Bullet with its lack of documentation was a nightmare, but I was able to atleast get some basics added and learned a lot. So as of now I am using Ogre with its default animation system (fairly basic) and Bullet Physics. I had always wanted to use Havok when I started out, but due to lack of integration information on the Ogre forums, and lack of tutorials on the net, I decided against it. Now that I am actually at the point where Bullet is just too much of a headache to proceed with (staring at forum threads praying someone answers) and the Ogre animation system is so basic, I am considering switching to Havok for Physics and Animation. The Physics system looks extremely polished and easy to use. The animation system looks incredible with the retargeting/blending/etc. The documentation is incredibly detailed as well (I guess when you come from Bullet, any documentation looks amazing) So my question is, as I am still somewhat of a 'newbie' to game development, should I just stick with what I am using now or should I make the switch over to Havok? The physics looks like I could get my project back to where it is now with minimal effort, and be able to expand much faster. The animation aspect looks extremely daunting as far as integrating it with Ogre.

    Read the article

  • libgdx - removing the circle outline rendered on Box2d CircleShape

    - by Brett
    How can I remove the outline on the circleshape below.. CircleShape circle = new CircleShape(); circle.setRadius(1f); ... using ... batch.draw(textureRegion, position.x - 1, position.y - 1, 1f, 1f, 2, 2, 1, 1, angle); I use this to set the body for a Box2d collision but I get a silly circle shape around my texture in libGdx, i.e. my textured sprite (ball) has a circle over the top of it with a line running from center along the radius. Any ideas on how to remove the overlying circle lines?

    Read the article

  • What is the convention for the star location in reference variables?

    - by Brett Ryan
    Have been learning Objective-C and different books and examples use differing conventions for the location of the star (*) when naming reference variables. MyType* x; MyType *y; MyType*z; // this also works Personally I prefer the first option as it illustrates that x is a "pointer type of MyType". I see the first two used interchangeably, and sometimes in the same code I've seen differing uses of both. I want to know what is the most common convention It's been a very long time since I've programmed in C (15 years) so I can't remember if all variants are legal for C also or if this is Objective-C specific. I'd prefer answers which state why one is better than the other, as how I explained how I read it above.

    Read the article

  • How do I get Paypal or a merchant account for a marketplace style web site?

    - by Brett G
    I'm having trouble getting approved for a merchant account for my website. Basically I have expert users and users. Expert users provide a service through my website which they set their own rates. Users purchase the services, then pay me, I give 90% to the expert users. I have been told this is factoring.. Is the way around this, a system like freelancer.com does? Where users deposit money into their freelancer account, then pay for the services they won? What are the negatives to this system? What about sites like 99designs? They accept CC payments and then pay the winning designer. How are some sites doing this but I'm having so much trouble getting approved?

    Read the article

  • I am trying to figure out the best way to understand how to cache domain objects

    - by Brett Ryan
    I've always done this wrong, I'm sure a lot of others have too, hold a reference via a map and write through to DB etc.. I need to do this right, and I just don't know how to go about it. I know how I want my objects to be cached but not sure on how to achieve it. What complicates things is that I need to do this for a legacy system where the DB can change without notice to my application. So in the context of a web application, let's say I have a WidgetService which has several methods: Widget getWidget(); Collection<Widget> getAllWidgets(); Collection<Widget> getWidgetsByCategory(String categoryCode); Collection<Widget> getWidgetsByContainer(Integer parentContainer); Collection<Widget> getWidgetsByStatus(String status); Given this, I could decide to cache by method signature, i.e. getWidgetsByCategory("AA") would have a single cache entry, or I could cache widgets individually, which would be difficult I believe; OR, a call to any method would then first cache ALL widgets with a call to getAllWidgets() but getAllWidgets() would produce caches that match all the keys for the other method invocations. For example, take the following untested theoretical code. Collection<Widget> getAllWidgets() { Entity entity = cache.get("ALL_WIDGETS"); Collection<Widget> res; if (entity == null) { res = loadCache(); } else { res = (Collection<Widget>) entity.getValue(); } return res } Collection<Widget> loadCache() { // Get widgets from underlying DB Collection<Widget> res = db.getAllWidgets(); cache.put("ALL_WIDGETS", res); Map<String, List<Widget>> byCat = new HashMap<>(); for (Widget w : res) { // cache by different types of method calls, i.e. by category if (!byCat.containsKey(widget.getCategory()) { byCat.put(widget.getCategory(), new ArrayList<Widget>); } byCat.get(widget.getCatgory(), widget); } cacheCategories(byCat); return res; } Collection<Widget> getWidgetsByCategory(String categoryCode) { CategoryCacheKey key = new CategoryCacheKey(categoryCode); Entity ent = cache.get(key); if (entity == null) { loadCache(); } ent = cache.get(key); return ent == null ? Collections.emptyList() : (Collection<Widget>)ent.getValue(); } NOTE: I have not worked with a cache manager, the above code illustrates cache as some object that may hold caches by key/value pairs, though it's not modelled on any specific implementation. Using this I have the benefit of being able to cache all objects in the different ways they will be called with only single objects on the heap, whereas if I were to cache the method call invocation via say Spring It would (I believe) cache multiple copies of the objects. I really wish to try and understand the best ways to cache domain objects before I go down the wrong path and make it harder for myself later. I have read the documentation on the Ehcache website and found various articles of interest, but nothing to give a good solid technique. Since I'm working with an ERP system, some DB calls are very complicated, not that the DB is slow, but the business representation of the domain objects makes it very clumsy, coupled with the fact that there are actually 11 different DB's where information can be contained that this application is consolidating in a single view, this makes caching quite important.

    Read the article

  • Enabling/disabling proftpd accounts with PHP and WHM

    - by Brett G
    I have a VPS with WHM/CPanel which is being used just by me. It's utilizing proftpd. I'd like to, via a PHP script, disable/enable a specific FTP account. I've done this by having PHP call a bash script which removes/adds the user account line to /etc/proftpd/USERNAME password file. However, in order to do this I have to give other write rights to /etc/proftpd/USERNAME. This isn't ideal, and I'd be willing to do it another way. It also seems like WHM is automatically resetting these permissions on a regular basis. Does anybody have any ideas on a better way to deal with this?

    Read the article

  • Alt-Tab in 12.04 requires pressing Enter to select app, can I disable that?

    - by Brett Hoerner
    Alt+Tab quickly opens the switcher for me, but tabbing over to the next app and releasing the keys will just leave it selected, not switch to it. I have to press Enter to actually switch to the app. How do I make it automatically switch when I release like every other switcher out there? Same behavior occurs when using Super+Tab with either the Compiz Ring Switcher or Shift Switcher. This seems different from the 11.10 behavior.

    Read the article

  • What patterns book for iOS development contains this specific information? [closed]

    - by Brett Ryan
    I've read several books on iOS development and Objective-C, however what a lot of them teach is how to work with interfaces and all contain the model inside the view controller, i.e. a UITableViewController based view will simply have an NSArray as it's model. I'm interested in what the best practices are for designing the structure of an application. Specifically I'm interested in best practices for the following: How to separate a model from the view controller. I think I know how to do this by simply replacing the NSArray style example with a specific model object, however what I do not know how to do is alert the view when the model changes. For example in .NET I would solve this by conforming to INotifyPropertyChanged and databinding, and similarly with Java I would use PropertyChangeListener. How to create a service model for my domain objects. For example I want to learn the best way to create a service for a hypothetical Widget object to manage an internal DB and also services for communicating with remote endpoints. I need to learn the best ways to do this in a way that interface components can subscribe to events such as widgetUpdated. These services should be singleton classes and some how dependency injected into model/controller objects. Books I've read so far are: Programming in Objective-C (4th Edition) Beginning iOS 5 Development: Exploring the iOS SDK The iOS 5 Developer's Cookbook: Expanded Electronic Edition: Essentials and Advanced Recipes for iOS Programmers Learn Objective-C on the Mac: For OS X and iOS I've also purchased the following updated books but not yet read them. The Core iOS 6 Developer's Cookbook (4th edition Programming in Objective-C (5th Edition) I come from a Java and C# background with 15 years experience, I understand that many of the ways I would do things in these languages may not fit to the ObjC way of developing applications. Would someone be able to provide me with the book on this topic containing this specific subject matter?

    Read the article

  • Is it better to have multiple domains for cities or one single TLD?

    - by Brett
    I make websites for small businesses, and for some reason business owners love to have several domains with the same website but the TLD containing the city name. For example: 1. smallbizname.com 2. clevelandsmallbizname.com 3. columbussmallbizname.com 4. cincinnatismallbizname.com ... and so on. I've seen questions about localization per country aspects, but this is a much smaller scale, so I don't think the same rules apply. The problem I have is the companies never want to write separate content per domain, just have the same website hosted several times at each domain. I feel this probably hurts SEO for two reasons: 1. Traffic gets scattered throughout domains, could be boosting just one domain. 2. Duplicate content penalty because the content is identical. My question boils down to this... Should I redirect all the city domains to the main business name domain, or does having these separate sites help to rank better per city? And if they are redirected, how does google rank the redirects? Thanks for any input on this issue!!

    Read the article

  • Need in obtaining a specific local telephone number [closed]

    - by Brett
    I am wanting a local phone number that I like. I have found one that I like. When I call the number that I want it says "this number has not been allocated" I have looked up and found the company that owns that number. How do I go about acquiring that number from the company. I spoke with someone who sells major phone packages and he said that if I signed up with them he could get the number for me. He said that there is a change of ownership form that the send to get the number. So I know it can be done. I am hoping that someone with industry specific knowledge in this area can guide me in getting this number.

    Read the article

  • Separating portion of website to its own server

    - by Brett
    So my job is to take the homepage (or maybe I should say "homesite" because it encompasses a few interrelated pages) and drag this onto its own Apache server. The problem I'm having right now is being able to weed out jumbled/bundled files (such as folders of js, css, and other files that i cant even identify) and knowing what is necessary to keep the homesite running. I'm new to this stuff (I'm an intern) so feel free to ask questions if I'm leaving vital information out. What I'm asking of you guys here is basically any pointers or tips you may be able to give me in order to get the job done. I could use some advice from people with a little more experience in web development. btw: This question may appear as though I have not completed any prior research and that is, for the most part, true. But the problem is I really am not sure how to research this. If you guys could throw me some keywords to play with that would really be helpful. Thanks!

    Read the article

  • Need some constructive criticism on my SSE/Assembly attempt

    - by Brett
    Hello, I'm working on converting a bit of code to SSE, and while I have the correct output it turns out to be slower than standard c++ code. The bit of code that I need to do this for is: float ox = p2x - (px * c - py * s)*m; float oy = p2y - (px * s - py * c)*m; What I've got for SSE code is: void assemblycalc(vector4 &p, vector4 &sc, float &m, vector4 &xy) { vector4 r; __m128 scale = _mm_set1_ps(m); __asm { mov eax, p //Load into CPU reg mov ebx, sc movups xmm0, [eax] //move vectors to SSE regs movups xmm1, [ebx] mulps xmm0, xmm1 //Multiply the Elements movaps xmm2, xmm0 //make a copy of the array shufps xmm2, xmm0, 0x1B //shuffle the array subps xmm0, xmm2 //subtract the elements mulps xmm0, scale //multiply the vector by the scale mov ecx, xy //load the variable into cpu reg movups xmm3, [ecx] //move the vector to the SSE regs subps xmm3, xmm0 //subtract xmm3 - xmm0 movups [r], xmm3 //Save the retun vector, and use elements 0 and 3 } } Since its very difficult to read the code, I'll explain what I did: loaded vector4 , xmm0 _ p = [px , py , px , py ] mult. by vector4, xmm1 _ cs = [c , c , s , s ] _____________mult---------------------------- result,______ xmm0 = [px*c, py*c, px*s, py*s] reuse result, xmm0 = [px*c, py*c, px*s, py*s] shuffle result, xmm2 = [py*s, px*s, py*c, px*c] ___________subtract---------------------------- result, xmm0 = [px*c-py*s, py*c-px*s, px*s-py*c, py*s-px*c] reuse result, xmm0 = [px*c-py*s, py*c-px*s, px*s-py*c, py*s-px*c] load m vector4, scale = [m, m, m, m] ______________mult---------------------------- result, xmm0 = [(px*c-py*s)*m, (py*c-px*s)*m, (px*s-py*c)*m, (py*s-px*c)*m] load xy vector4, xmm3 = [p2x, p2x, p2y, p2y] reuse, xmm0 = [(px*c-py*s)*m, (py*c-px*s)*m, (px*s-py*c)*m, (py*s-px*c)*m] ___________subtract---------------------------- result, xmm3 = [p2x-(px*c-py*s)*m, p2x-(py*c-px*s)*m, p2y-(px*s-py*c)*m, p2y-(py*s-px*c)*m] then ox = xmm3[0] and oy = xmm3[3], so I essentially don't use xmm3[1] or xmm3[4] I apologize for the difficulty reading this, but I'm hoping someone might be able to provide some guidance for me, as the standard c++ code runs in 0.001444ms and the SSE code runs in 0.00198ms. Let me know if there is anything I can do to further explain/clean this up a bit. The reason I'm trying to use SSE is because I run this calculation millions of times, and it is a part of what is slowing down my current code. Thanks in advance for any help! Brett

    Read the article

  • How to Retrieve a File's "Product Version" in VBScript

    - by Aaron Alton
    I have a VBScript that checks for the existance of a file in a directory on a remote machine. I am looking to retrieve the "Product Version" for said file (NOT "File Version"), but I can't seem to figure out how to do that in VBScript. I'm currently using Scripting.FileSystemObject to check for the existence of the file. Thanks much.

    Read the article

  • Why is only the suffix of work_index hashed?

    - by Jaroslav Záruba
    I'm reading through the PDF that Brett Slatkin has published for Google I/O 2010: "Data pipelines with Google App Engine": http://tinyurl.com/3523mej In the video (the Fan-in part) Brett says that the work_index has to be a hash, so that 'you distribute the load across the BigTable': http://www.youtube.com/watch?v=zSDC_TU7rtc#t=48m44 ...and this is how work_index is created: work_index = '%s-%d' % (sum_name, knuth_hash(index)) ...which I guess creates something like 'mySum-54657651321987' I do understand the basic idea, but is why only one half of work_index is hashed? Is it important to hash only part of it leaving the suffix out? Would it be wrong to do md5('%s-%d' % (sum_name, index)) so that the hash would be like '6gw8....hq6' ? I'm Java guy so I would use md5 to hash, which means I get id like 'mySum' + 32 characters. (Obviously I want my ids/keys to be as short as possible here.) If I could hash the whole string my id would be just 32 chars. Or would you suggest to use something else to do the hashing with?

    Read the article

  • Apache 2.2 and FastCGI stops responding, warnings, crashes

    - by Brett
    I've seen this question posted a few times using a Google search, with no real answers. I have a multi-threaded FastCGI application running with Apache 2.2 on FreeBSD 7.2. There are a few issues with it, and I am unable to really figure out the source of the problem even after poking through a bunch of the mod_fastcgi source code. My FastCGI application gets anywhere from 2 to 15 or so hits per second, and mostly services a back-end API (the majority of web server usage is for this, and not actually serving content). Everything seems to work ok under normal conditions, but recently this problem has been becoming worse. It starts out with the FastCGI process manager apparently trying to close unneeded processes, sending them a SIGTERM signal. I catch the signal, clean up some stuff, and exit (by calling exit()) with status code 0. This process seems to result in three log messages in my httpd error log: [Tue Jun 01 14:03:31 2010] [warn] FastCGI: (dynamic) server "/home/program/wwwroot/domains/www.mydomain.com/cgi-bin/program.cgi" (pid 98182) termination signaled [Tue Jun 01 14:03:31 2010] [warn] FastCGI: (dynamic) server "/home/program/wwwroot/domains/www.mydomain.com/cgi-bin/program.cgi" (pid 98182) terminated by calling exit with status '0' [Tue Jun 01 14:03:31 2010] [warn] FastCGI: (dynamic) server "/home/program/wwwroot/domains/www.mydomain.com/cgi-bin/program.cgi" restarted (pid 98294) I am not sure why it says it is restarting the process, but in any case no core dump is ever generated so I do believe it is the FastCGI process manager doing it's thing. This makes sense because it begins to happen after the initial load increase from restarting Apache. Since it's down for a few seconds, it gets hit with a couple of hundred requests over the first few seconds it's running again (sometimes even hitting the upper limit of MAXCLIENTS in Apache), and this seems to be the process manager doing the work of spawning more processes to handle the increased load. So this all seems fine, but here is where things get weird. There are really two problems that I see. First, my multithreaded FastCGI process spawns 25 worker threads, and all seem to be used according to my internal log files (multiple processes are clearly using multiple threads to do work). However it seems that 3 or 4 FastCGI processes is not enough to handle the 5 to 15 hit per second load, even though the requests take about .02s or so to process internally. In order to be at all responsive, it seems I need 50 or more FastCGI processes, leading me to believe that FastCGI does not realize that my program is multithreaded. I've read the documentation at http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html and do not see any option pertaining to multithreaded-ness, and my internal code is more or less set up just like the examples provided by the FastCGI library. The second problem I am having is that once process termination has happened a bunch of times as above (and seemingly at random), I begin getting a lot of these messages in my error log: [Tue Jun 01 14:06:22 2010] [warn] (32)Broken pipe: FastCGI: write() to PM failed (ignore if a restart or shutdown is pending) The messages occur for about half the hits I get to the server, and it completely kills the responsiveness of my application - it seems FastCGI will look for a working "pipe" until it finds one, and fail to realize that whatever application it is trying to contact is dead. It does still work though, it's just incredibly unresponsive - sometimes taking up to 40 or so seconds to process a request. I recompiled mod_fastcgi with some extra debugging around the point of the error message, and it appears that the error happens when it tries to write() to the application. The call to write() fails with a -1 return code, and sets errno to EPIPE. I am noticing that the issue happens mostly when either a crash occurs in one of the FastCGI processes, or a bunch of them are seemingly terminated by the process manager. I haven't had any core dumps though, except for one, where the backtrace outputted by gdb is just a single call to free() at address 0x0000000000000000 with nothing else in the stack trace, so I don't really know what to make of that. I'm thinking it happens sometime after the SIGTERM signal is caught, maybe some global variable not being cleaned up properly or something.

    Read the article

  • Cisco adaptive security appliance is dropping packets where SYN flag is not set

    - by Brett Ryan
    We have an apache instance sitting inside our DMZ which is configured to proxy requests to an internal NATed tomcat instance inside our network. It works fine, but then all of a sudden requests from apache to the tomcat instance stop getting through with the following in the apache logs: [error] (70007)The timeout specified has expired: ajp_ilink_receive() can't receive header Investigating into the Cisco log viewer reveals the following: Error Message %ASA-6-106015: Deny TCP (no connection) from IP_address/port to IP_address/port flags tcp_flags on interface interface_name. Explanation The adaptive security appliance discarded a TCP packet that has no associated connection in the adaptive security appliance connection table. The adaptive security appliance looks for a SYN flag in the packet, which indicates a request to establish a new connection. If the SYN flag is not set, and there is not an existing connection, the adaptive security appliance discards the packet. Recommended Action None required unless the adaptive security appliance receives a large volume of these invalid TCP packets. If this is the case, trace the packets to the source and determine the reason these packets were sent. All are machines are virtualised using VMware, and by default machines have been using the Intel E1000 emulated NIC. Our network administrator has changed this to a VMXNET3 driver in an attempt to correct the problem, we just have to wait and see if the problem persists as it's an intermittent problem. Is there something else that could be causing this problem? This isn't the first service where we have had similar issues. Our apache host is running Ubuntu 11.10 with a kernel version of 3.0.0-17-server. We have also had this issue on RHEL5 (5.8) running kernel 2.6.18-308.16.1.el5, this machine also has the E1000 NIC. NOTE: I am not a network administrator and am a software architect and analyst programmer responsible for these systems.

    Read the article

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