Search Results

Search found 759 results on 31 pages for 'matthew carroll'.

Page 25/31 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Prevent PHP sesison hijack, are these good ideas?

    - by matthew Rhodes
    I'm doing a simple shopping cart for a small site. I plan to store cart items as well as logged in user_id in session variables. to make things a little more secure, I thought I'd do this: sha1() the user_id before storing it in the session. Also sha1() and store the http_user_agent var with some salt, and check this along with the user_id. I know there is more one can do, but I thought this at least helps quite a bit right? and is easy for me to implement.

    Read the article

  • How should I define a JavaScript 'namespace' to satisfy JSLint?

    - by Matthew Murdoch
    I want to be able to package my JavaScript code into a 'namespace' to prevent name clashes with other libraries. Since the declaration of a namespace should be a simple piece of code I don't want to depend on any external libraries to provide me with this functionality. I've found various pieces of advice on how to do this simply but none seem to be free of errors when run through JSLint (using 'The Good Parts' options). As an example, I tried this from Advanced JavaScript (section Namespaces without YUI): "use strict"; if (typeof(MyNamespace) === 'undefined') { MyNamespace = {}; } Running this through JSLint gives the following errors: Problem at line 2 character 12: 'MyNamespace' is not defined. Problem at line 3 character 5: 'MyNamespace' is not defined. Implied global: MyNamespace 2,3 The 'Implied global' error can be fixed by explicitly declaring MyNamespace... "use strict"; if (typeof(MyNamespace) === 'undefined') { var MyNamespace = {}; } ...and the other two errors can be fixed by declaring the variable outside the if block. "use strict"; var MyNamespace; if (typeof(MyNamespace) === 'undefined') { MyNamespace = {}; } So that works, but it seems to me that (since MyNamespace will always be undefined at the point it is checked?) it is equivalent to the much simpler: "use strict"; var MyNamespace = {}; JSLint is content with this but I'm concerned that I've simplified the code to such an extent that it will no longer function correctly as a namespace. Is this final formulation sensible?

    Read the article

  • When I change templates in Netbeans, why doesn't anything happen?

    - by Matthew
    I want to modify the "Java class" template, so that the class javadoc comment includes more than just the author. In Netbeans 6.8., I go to Tools Templates Java Java Class, and modify the template. However, nothing seems to change. I tried restarting Netbeans, just in case, but the old template is still used. How do I get Netbeans to recognize changes to the template for Java Classes?

    Read the article

  • Cannot install windows service

    - by Matthew Dalton
    I have created a very simple window service using visual studio 2010 and .Net 4.0. This service has no functionality added from the default windows service project, other than an installer has been added. If i run installutil.exe appName.exe on my dev box or other windows 2008 R2 machines in our domain the windows service installs without issue. When i try to do this same thing on our customer site, it fails to install with the following error. Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\TestService\WindowsService1.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515). This solution has only 1 project and no dependencies added. I have tried it on multiple machines in our environment and two in our customers. The machines are all windows 2008 R2, both fresh installs. One machine has just .net 2.0 and .net 4.0. The other .net 2, 3, 3.5 and 4. I am a local admin on each of the machines. I have also tried the 64bit installer but get the following error, so i think the 32 bit one is the one to use. System.BadImageFormatException Any guidance would be appreciated. Thanks.

    Read the article

  • Rolling back or re-creating the master branch in git?

    - by Matthew Savage
    I have a git repo which has a few branches - there's the master branch, which is our stable working version, and then there is a development/staging branch which we're doing new work in. Unfortunately it would appear that without thinking I was a bit overzealous with rebasing and have pulled all of the staging code into Master over a period of time (about 80 commits... yes, I know, stupid, clumsy, poor code-man-ship etc....). Due to this it makes it very hard for me to do minor fixes on the current version of our app (a rails application) and push out the changes without also pushing out the 'staged' new features which we don't yet want to release. I am wondering if it is possible to do the following: Determine the last 'trunk' commit Take all commits from that point onward and move them into a separate branch, more or less rolling back the changes Start using the branches like they were made for. Unfortunately, though, I'm still continually learning about git, so I'm a bit confused about what to really do here. Thanks!

    Read the article

  • Testing + production server and syncing MySQL data

    - by Matthew
    I have a web application running on LAMP with a testing server and a production server. Is there a standard practice for keeping the data on the testing server in sync with the production server? The data on the testing server gets out of date pretty quick and I feel like there must be an easier way than just dumping the production server and copying it onto the testing server every so often. It's not important that the data is in total sync, just that the testing server represents the production enviornment as accurately as possible.

    Read the article

  • Organize array in PHP from mysql

    - by Matthew Carter
    Hi i have a social networking website. what i want it to do is pull out my friends status updates. basically what it does is i have a mysql query that pulls out all of my friends and in that while loop there is another mysql query that pulls out the status's from my friends. i want it to be in order of date but since its one while loop in another what it does is pull out all status's from friend 1 then 2 then 3 and not in order by date. i even tried ORDER BY DATE but that just ordered it by date within the friend.. my thought is that i could putt it all in an array and friends is one thing and the values is the stats. then just sort by values would this work and how could i do it. THANKS SO MUCH

    Read the article

  • php mailer attachments

    - by Matthew
    I have been using this script to send emails to certain staff but because of changes to my system i have to now send attachements with the email and i have tried multipul peices of code to accomplish this but have been unsuccessful... I still recive the email but without the attachement which is quite pointless in this case i have placed the script i am using bellow i have removed the real addresses i was using and smtp server require("PHPMailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "SMTP.SErver.com"; $mail->From = "[email protected]"; $mail->FromName = "HCSC"; $mail->AddAddress("[email protected]", "Example"); $mail->AddReplyTo("[email protected]", "Hcsc"); $mail->WordWrap = 50; $mail->IsHTML(false); $mail->Subject = "AuthSMTP Test"; $mail->Body = "AuthSMTP Test Message!"; $mail->AddAttachment("matt.txt"); //this is basicly what i am trying to attach as a test but will be using excel spreadsheets in the production if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; i have also tried a few other emtods of attaching the file but none seem to work any help is greatly appricated

    Read the article

  • NSDirectoryEnumerator And Subfolders

    - by Matthew Roberts
    I have an iPhone app that searches a folder, collates an an array of all the audio files, and lets them be played back. The problem is that if there is a subfolder within the folder I am searching, it will just skip over it/not go into its contents. My code is as follows: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager] enumeratorAtPath:documentsDirectory]; NSString *pname; while (pname = [direnum nextObject]) { [musicArray addObject:[pname stringByDeletingPathExtension]]; } What I want to do is continue to search its subfolders, how would I go about doing that?

    Read the article

  • How to access Session values from layers beneath the web application layer.

    - by Matthew Vines
    We have many instances in our application where we would like to be able to access things like the currently logged in user id in our business domain and data access layer. On log we push this information to the session, so all of our front end code has access to it fairly easily of course. However, we are having huge issues getting at the data in lower layers of our application. We just can't seem to find a way to store a value in the business domain that has global scope just for the user (static classes and properties are of course shared by the application domain, which means all users in the session share just one copy of the object). We have considered passing in the session to our business classes, but then our domain is very tightly coupled to our web application. We want to keep the prospect of a winforms version of the application possible going forward. I find it hard to believe we are the first people to have this sort of issue. How are you handling this problem in your applications?

    Read the article

  • How can I write a null ASCII character (nul) to a file with a Windows batch script?

    - by Matthew Murdoch
    I'm attempting to write an ASCII null character (nul) to a file from a Windows batch script without success. I initially tried using echo like this: echo <Alt+2+5+6> which seems like it should work (typing <Alt+2+5+6> in the command window does write a null character - or ^@ as it appears), but echo then outputs: More? and hangs until I press <Return>. As an alternative I tried using: copy con tmp.txt >nul <Alt+2+5+6><Ctrl+Z> which does exactly what I need, but only if I type it manually in the command window. If I run it from a batch file it hangs until I press <Ctrl+Z> but even then the output file is created but remains empty. I really want the batch file to stand alone without requiring (for example) a separate file containing a null character which can be copied when needed.

    Read the article

  • OpenGL fast texture drawing with vertex buffer objects. Is this the way to do it?

    - by Matthew Mitchell
    Hello. I am making a 2D game with OpenGL. I would like to speed up my texture drawing by using VBOs. Currently I am using the immediate mode. I am generating my own coordinates when I rotate and scale a texture. I also have the functionality of rounding the corners of a texture, using the polygon primitive to draw those. I was thinking, would it be fastest to make a VBO with vertices for the sides of the texture with no offset included so I can then use glViewport, glScale (Or glTranslate? What is the difference and most suitable here?) and glRotate to move the drawing position for my texture. Then I can use the same VBO with no changes to draw the texture each time. I could only change the VBO when I need to add coordinates for the rounded corners. Is that the best way to do this? What things should I look out for while doing it? Is it really fastest to use GL_TRIANGLES instead of GL_QUADS in modern graphics cards? Thank you for any answer.

    Read the article

  • C# - Bug in Code Logic

    - by Matthew
    I have some code which keeps track of the number of times a button has been clicked. As a matter of fact, when the page first loads, a counter is set to 0. On every postback, the counter is incremented by 1. I have only one button on the page. The main idea behind this is to allow the user to enter some details 4 times. If he enters invalid details for 4 times, he is redirected to an error page. Otherwise, he is redirected to a confirmation page. This is my code: if (!this.IsPostBack) { Session["Count"] = 0; } else { if (Session["Count"] == null) { Session.Abandon(); Response.Redirect("CheckOutErrorPage.htm"); } else { int count = (int)Session["Count"]; if (count == 3) { Session.Abandon(); Response.Redirect("CheckOutFailure.aspx"); } else { count++; Session["Count"] = count; } } } Everything works as it should except that if the user enter invalid details for 3 times and then he enters VALID details on the 4th time, the user is redirected to the Error Page (because he has tried 4 times) instead of the confirmation page. How can I solve this please?

    Read the article

  • twitter bootstrap navbar fixed top overlapping site

    - by Matthew Berman
    I am using bootstrap on my site and am having issues with the navbar fixed top. When I am just using the regular navbar, everything is fine. However, when i try to switch it to navbar fixed top, all the other content on the site shifts up like the navbar isn't there and the navbar overlaps it. here's basically how i laid it out: .navbar.navbar-fixed-top .navbar-inner .container .container .row //yield content i tried to copy bootstraps examples exactly but still having this issue only when using navbar fixed top. what am I doing wrong?

    Read the article

  • Freestanding ARM C++ Code - empty .ctors section

    - by Matthew Iselin
    I'm writing C++ code to run in a freestanding environment (basically an ARM board). It's been going well except I've run into a stumbling block - global static constructors. To my understanding the .ctors section contains a list of addresses to each static constructor, and my code simply needs to iterate this list and make calls to each function as it goes. However, I've found that this section in my binary is in fact completely empty! Google pointed towards using ".init_array" instead of ".ctors" (an EABI thing), but that has not changed anything. Any ideas as to why my static constructors don't exist? Relevant linker script and objdump output follows: .ctors : { . = ALIGN(4096); start_ctors = .; *(.init_array); *(.ctors); end_ctors = .; } .dtors : { . = ALIGN(4096); start_dtors = .; *(.fini_array); *(.dtors); end_dtors = .; } -- 2 .ctors 00001000 8014c000 8014c000 00054000 2**2 CONTENTS, ALLOC, LOAD, DATA <snip> 8014d000 g O .ctors 00000004 start_ctors <snip> 8014d000 g O .ctors 00000004 end_ctors I'm using an arm-elf targeted GCC compiler (4.4.1).

    Read the article

  • How do I change the radio button icon in extjs?

    - by Matthew Sowders
    I have two Ext.menu.CheckItem's in a group. How would I change the checked item's disc icon to something else? I would like to retain the radio button functionality (only one selected), but have a check mark instead of the disc. var options = new Ext.Button({ allowDepress: false, menu: [ {checked:true,group:'labels',text:'Option 1'}, {checked:false,group:'labels',text:'Option 2'} ] });

    Read the article

  • Attaching methods to prototype from within constructor function

    - by Matthew Taylor
    Here is the textbook standard way of describing a 'class' or constructor function in JavaScript, straight from the Definitive Guide to JavaScript: function Rectangle(w,h) { this.width = w; this.height = h; } Rectangle.prototype.area = function() { return this.width * this.height; }; I don't like the dangling prototype manipulation here, so I was trying to think of a way to encapsulate the function definition for area inside the constructor. I came up with this, which I did not expect to work: function Rectangle(w,h) { this.width = w; this.height = h; this.constructor.prototype.area = function() { return this.width * this.height; }; } I didn't expect this to work because the this reference inside the area function should be pointing to the area function itself, so I wouldn't have access to width and height from this. But it turns out I do! var rect = new Rectangle(2,3); var area = rect.area(); // great scott! it is 6 Some further testing confirmed that the this reference inside the area function actually was a reference to the object under construction, not the area function itself. function Rectangle(w,h) { this.width = w; this.height = h; var me = this; this.constructor.prototype.whatever = function() { if (this === me) { alert ('this is not what you think');} }; } Turns out the alert pops up, and this is exactly the object under construction. So what is going on here? Why is this not the this I expect it to be?

    Read the article

  • Apples, oranges, and pointers to the most derived c++ class

    - by Matthew Lowe
    Suppose I have a bunch of fruit: class Fruit { ... }; class Apple : public Fruit { ... }; class Orange: public Fruit { ... }; And some polymorphic functions that operate on said fruit: void Eat(Fruit* f, Pesticide* p) { } void Eat(Apple* f, Pesticide* p) { ingest(f,p); } void Eat(Orange* f, Pesticide* p) { peel(f,p); ingest(f,p); } OK, wait. Stop right there. Note at this point that any sane person would make Eat() a virtual member function of the Fruit classes. But that's not an option, because I am not a sane person. Also, I don't want that Pesticide* in the header file for my fruit class. Sadly, what I want to be able to do next is exactly what member functions and dynamic binding allow: typedef list<Fruit*> Fruits; Fruits fs; ... for(Fruits::iterator i=fs.begin(), e=fs.end(); i!=e; ++i) Eat(*i); And obviously, the problem here is that the pointer we pass to Eat() will be a Fruit*, not an Apple* or an Orange*, therefore nothing will get eaten and we will all be very hungry. So what I really want to be able to do instead of this: Eat(*i); is this: Eat(MAGIC_CAST_TO_MOST_DERIVED_CLASS(*i)); But to my limited knowledge, such magic does not exist, except possibly in the form of a big nasty if-statement full of calls to dynamic_cast. So is there some run-time magic of which I am not aware? Or should I implement and maintain a big nasty if-statement full of dynamic_casts? Or should I suck it up, quit thinking about how I would implement this in Ruby, and allow a little Pesticide to make its way into my fruit header?

    Read the article

  • Can I improve performance by refactoring SQL commands into classes?

    - by Matthew Jones
    Currently, my entire website does updating from SQL parameterized queries. It works, we've had no problems with it, but it can occasionally be very slow. I was wondering if it makes sense to refactor some of these SQL commands into classes so that we would not have to hit the database so often. I understand hitting the database is generally the slowest part of any web application For example, say we have a class structure like this: Project (comprised of) Tasks (comprised of) Assignments Where Project, Task, and Assignment are classes. At certain points in the site you are only working on one project at a time, and so creating a Project class and passing it among pages (using Session, Profile, something else) might make sense. I imagine this class would have a Save() method to save value changes. Does it make sense to invest the time into doing this? Under what conditions might it be worth it?

    Read the article

  • In Node.JS, how do I return an entire object from a separate .js file?

    - by Matthew Patrick Cashatt
    Thanks for looking. I am new to Node.js and trying to figure out how to request an object from a separate file (rather than just requesting a function) but everything I try--exports,module-exports,etc--is failing. So, for example, if I have foo.js: var methods = { Foobar:{ getFoo: function(){return "foo!!";}, getBar: function(){return "bar!!";} } }; And now I want to call a function within an object of foo.js from index.js: var m = require('./Methods'); function fooMain(){ return m.Foobar.getFoo(); }; How do I do this? I have tried all sorts of combinations of exports and module-exports but they seem to only work if I call a discrete function that is not part of an object. Thanks!

    Read the article

  • Calculate total time between Dates in Hours and Minutes

    - by matthew parkes
    Hi I’m trying to resolve a problem using VB and I need some assistance. I’m very new to the language (1 week). The problem is I have created a user form to show how many hours and minutes has elapsed between two different times similar to a time sheet. The user form consists of two calendars, and under each calendar there are two text boxes; one box each to record the Hour and Minute they left and two further boxes to record the time they arrived back. I have used the code to minus the calendars together (e.g calendar in – calendar out) then times this by 24 to indicate the hours away. Then under the calendar out I have a text box for the user to type in the hour they left. Then I minus the 24 by the Hour out e.g. if it was 24 -15 it will appear 9 ( 9 hours of that day ) then I would add that to the figure they inserted in the text box Hour in (Return Time). e.g 14. Then I would add them to together e.g. 9 + 14 = 23 and have this displayed in another text box Total Hours. Therefore it would display 23 meaning 23 hours. I have then want to show another two text boxes to indicate minutes. One for Minutes Out then Minutes In. I have the problem to convert these minutes for instance if it is the out time is 15:50 and the in time the next day is at 15:55 it displays as 24 (in one text box) and 105 minutes (in the other text box). I would like the minutes added to the hour and have the balance of the remaining minutes in the minute text box. This should display 24 (in one text box) and 5 (in another text box). The ultimate aim is to get a result that shows a person was absent for a number of days, hours and minutes, eg, 2 days, 5 hours and 10 minutes. Any ideas on how I can modify my code to achieve this? Here’s my code. Please Help Dim number1 As Date Dim number2 As Date Dim number3 As Integer Dim number4 As Integer Dim Number5 As Integer Dim Number6 As Integer Dim answer As Integer Dim answer2 As Integer Dim answer3 As Integer Dim answer4 As Integer Dim answer5 As String number1 = DTPicker1 number2 = DTPicker2 number3 = Txthourout number4 = TxtHourin Number5 = TxtMinuteout Number6 = TxtMinuetIn answer = number2 - number1 answer2 = answer * 24 answer3 = answer2 - number3 answer4 = answer3 + number4 answer5 = Number5 + Number6 TextBox1.Text = answer4 TextBox2.Text = answer5 End Sub

    Read the article

  • How do I keep JTextFields in a Java Swing BoxLayout from expanding?

    - by Matthew
    I have a JPanel that looks something like this: JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); ... panel.add (jTextField1); panel.add (Box.createVerticalStrut(10)); panel.add (jButton1); panel.add (Box.createVerticalStrut(30)); panel.add (jTextField2); panel.add (Box.createVerticalStrut(10)); panel.add (jButton2); ... //etc. My problem is that the JTextFields become huge vertically. I want them to only be high enough for a single line, since that is all that the user can type in them. The buttons are fine (they don't expand vertically). Is there any way to keep the JTextFields from expanding? I'm pretty new to Swing, so let me know if I'm doing everything horribly wrong.

    Read the article

  • PHP: Regular Expression to get a URL from a string

    - by Matthew Iselin
    I'm working on some PHP code which takes input from various sources and needs to find the URLs and save them somewhere. The kind of input that needs to be handled is as follows: http://www.youtube.com/watch?v=IY2j_GPIqRA Try google: http://google.com! (note exclamation mark is not part of the URL) Is http://somesite.com/ down for anyone else? Output: http://www.youtube.com/watch?v=IY2j_GPIqRA http://google.com http://somesite.com/ I've already borrowed one regular expression from the internet which works, but unfortunately wipes the query string out - not good! Any help putting together a regular expression, or perhaps another solution to this problem, would be appreciated.

    Read the article

  • Can I improve performance by refactoring SQL commands into C# classes?

    - by Matthew Jones
    Currently, my entire website does updating from SQL parameterized queries. It works, we've had no problems with it, but it can occasionally be very slow. I was wondering if it makes sense to refactor some of these SQL commands into classes so that we would not have to hit the database so often. I understand hitting the database is generally the slowest part of any web application For example, say we have a class structure like this: Project (comprised of) Tasks (comprised of) Assignments Where Project, Task, and Assignment are classes. At certain points in the site you are only working on one project at a time, and so creating a Project class and passing it among pages (using Session, Profile, something else) might make sense. I imagine this class would have a Save() method to save value changes. Does it make sense to invest the time into doing this? Under what conditions might it be worth it?

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31  | Next Page >