Daily Archives

Articles indexed Monday February 28 2011

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

  • Best way to block "comment spam" postings to web forms? [closed]

    - by David Jones
    Possible Duplicate: Make your site anti-bot? I have a custom web form on my PHP-based site. Recently it is getting a regular stream of comment-spam postings from a few specific IP addresses. Question: What is a good way to block a small set of blacklisted IP addresses from accessing my site? I was thinking it should be possible using .htaccess to respond with status code 403 (Forbidden) for all HTTP requests from the blacklisted IP addresses, ... but I am not sure exactly how to do that. If anyone knows the .htaccess syntax needed to accomplish this, ... please let me know. thanks in advance,

    Read the article

  • Do we still need to avoid using frame/iframe for good SEO?

    - by Marco Demaio
    I thought frame and iframe are something bad for SEO. Today I was doing some search and searching for "numismatica" in Google.it and the 3rd site is www.lemonete.com (ranks high also in Google.com). It's all made with frames. A competitor site (www.nummus.com) that is all done with no frames ranks much lower when searching for the same word: "numismatica" So can we use frame, don't they hit SEO ranking anymore? Any explanation (possibly simple) would be appreciated also about the fact the 2nd site ranks much lower. :) UPDATE: thanks for all the replies , I noticed now I wrote down the wrong url, it was not lemonete.it (which is just a spam site) but lemonete.com.

    Read the article

  • is a merchant account a requirment for a website to take payments..

    - by calum
    Hi, I have had a quick look but couldn't see anything related. Basically, if we were to accept payments for events on our website, via paypal (essentially a Buy it now! button), as a business, do we need a merchant's account, or will a regular bank account be acceptable? I may have some confusion in terms. My understanding is you need a merchant's account to accept credit card payments, but as we are using PayPal, is this necessary? Thank you for any clarification. disclaimer - I've read What are some options for taking payments on my website? but it doesn't explicitly say if we require a merchant account or not. Thank you.

    Read the article

  • Facebook Game database design

    - by facebook-100000781341887
    Hi, I'm currently develop a facebook mafia like PHP game(of course, a light weight version), here is a simplify database(MySQL) of the game id-a <int3> <for index> uid <chr15> <facebook uid> HP <int3> <health point> exp <int3> <experience> money <int3> <money> list_inventory <chr5> <the inventory user hold...some special here, talk next> ... and 20 other fields just like reputation, num of combat... *the number next to the type is the size(byte) of the type For the list_inventory, there have 40 inventorys in my game, (actually, I have 5 these kind of list in my database), and each user can only contain 1 qty of each inventory, therefore, I assign 5 char for this field and each bit of char as 1 item(5 char * 8 bit = 40 slot), and I will do some manipulation by PHP to extract the data from this 5 byte. OK, I was thinking on this, if this game contains 100,000 user, and only 10% are active, therefore, if use my method, for the space use, 5 byte * 100,000 = 500 KB if I use another method, create a table user_hold_inventory, if the user have the inventory, then insert a record into this table, so, for 10,000 active user, I assume they got all item, but for other, I assume they got no item, here is the fields of the new table id-b <int3> <for index> id-a <int3> <id of the user table> inv_no <int1> <inventory that user hold> for the space use, ([id] (3+3) byte + [inv_no] 1 byte ) * [active user] 10,000 * [all inventory] * 40 = 2.8 MB seems method 2 have use more space, but it consume less CPU power. Please comment these 2 method or please correct me if there have another better method rather than what I think. Another question is, my database contain 26 fields, but I counted 5 of them are not change frquently, should I need to separate it on the other table or not? So many words, thanks for reading :)

    Read the article

  • How to improve batching performance

    - by user4241
    Hello, I am developing a sprite based 2D game for mobile platform(s) and I'm using OpenGL (well, actually Irrlicht) to render graphics. First I implemented sprite rendering in a simple way: every game object is rendered as a quad with its own GPU draw call, meaning that if I had 200 game objects, I made 200 draw calls per frame. Of course this was a bad choice and my game was completely CPU bound because there is a little CPU overhead assosiacted in every GPU draw call. GPU stayed idle most of the time. Now, I thought I could improve performance by collecting objects into large batches and rendering these batches with only a few draw calls. I implemented batching (so that every game object sharing the same texture is rendered in same batch) and thought that my problems are gone... only to find out that my frame rate was even lower than before. Why? Well, I have 200 (or more) game objects, and they are updated 60 times per second. Every frame I have to recalculate new position (translation and rotation) for vertices in CPU (GPU on mobile platforms does not support instancing so I can't do it there), and doing this calculation 48000 per second (200*60*4 since every sprite has 4 vertices) simply seems to be too slow. What I could do to improve performance? All game objects are moving/rotating (almost) every frame so I really have to recalculate vertex positions. Only optimization that I could think of is a look-up table for rotations so that I wouldn't have to calculate them. Would point sprites help? Any nasty hacks? Anything else? Thanks.

    Read the article

  • Python Core Library and PEP8

    - by Szymon Guz
    I was trying to understand why Python is said to be a beautiful language. I was directed to the beauty of PEP 8... and it was strange. In fact it says that you can use any convention you want, just be consistent... and suddenly I found some strange things in the core library: request() getresponse() set_debuglevel() endheaders() http://docs.python.org/py3k/library/http.client.html The below functions are new in the Python 3.1. What part of PEP 8 convention is used here? popitem() move_to_end() http://docs.python.org/py3k/library/collections.html So my question is: is PEP 8 used in the core library, or not? Why is it like that? Is there the same situation as in PHP where I cannot just remember the name of the function because there are possible all ways of writing the name? Why PEP 8 is not used in the core library even for the new functions?

    Read the article

  • Nested Model/Routes in Rails 3

    - by mbreedlove
    I have a simple blogging functionality in my Rails 3 app. I am trying to add commenting to each post. The BlogComment model has a property, blog_post_id, to be able to find the corresponding comments for each post. I already setup my associations in the model, I also nested BlogComments under BlogPost in the routes file. However, I can't figure out how to give each BlogPost access to its respective comments through the controller so that they can be shown later in the view.

    Read the article

  • Python - network buffer handling question...

    - by Patrick Moriarty
    Hi, I want to design a game server in python. The game will mostly just be passing small packets filled with ints, strings, and bytes stuffed into one message. As I'm using a different language to write the game, a normal packet would be sent like so: Writebyte(buffer, 5); // Delimit type of message Writestring(buffer, "Hello"); Sendmessage(buffer, socket); As you can see, it writes the bytes to the buffer, and sends the buffer. Is there any way to read something like this in python? I am aware of the struct module, and I've used it to pack things, but I've never used it to actually read something with mixed types stuck into one message. Thanks for the help.

    Read the article

  • Locking individual elements in a static collection?

    - by user638474
    I have a static collection of objects that will be frequently updated from multiple threads. Is it possible to lock individual objects in a collection instead of locking the entire collection so that only threads trying to access the same object in the collection would get blocked instead of every thread? If there is a better way to update objects in a collection from multiple threads, I'm all ears.

    Read the article

  • C++: Get char after space character instead or return carriage.

    - by Kzone272
    Okay this is similar to my last question but what I ended up doing was way too complex for something as simple as this. I simply need to get a single character or number (I will know which of these I am receiving) from the console after I press space, instead of pressing enter. I'm sure there must be a way to have the terminal read input after a space instead of a '\n'. I need to read inputs from the console in which the succeeding data types will vary depending on what the first input is, and I think reading the entire line, parsing it into strings, then parsing some of those into ints is a bit unnecessary. So Is this actually not possible in C++ or have I just not found it yet?

    Read the article

  • C++ -- How can we call "delete this; " in a const-member function?

    - by q0987
    Hello all, I saw the code snippet as follows: class UPNumber { public: UPNumber(); UPNumber(int initValue); ... // pseudo-destructor (a const member function, because // even const objects may be destroyed) void destroy() const { delete this; } // why this line is correct??? ... private: ~UPNumber(); }; First, I am sure that above class definition is correct. Here is my question, why we can define the function 'destroy' as above? The reason being asking is that why we can modify 'this' in a const-member function? Thank you

    Read the article

  • Forces to prompt download box IE

    - by Bruno Costa
    Hello, I'm having a problem with some reports in the application I'm doing manutention I've a button that does a postback to the server and do some information and then get back to the cliente and open a popup to download the report. private void grid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { ... ClientScript.RegisterClientScriptBlock(this.GetType(), "xxx", "<script>javascript:window.location('xx.aspx?m=x','xxx','width=750,height=350,directories=no,location=no,menubar=no,scrollbars,status=no,toolbar=no,resizable=yes,left=50,top=50');</script>"); } Then in xxx.aspx I've the code: Response.ClearContent(); Response.ClearHeaders(); Response.TransmitFile(tempFileName); Response.Flush(); Response.Close(); File.Delete(tempFileName); Response.End(); This works fine if IE option Automatic prompting for file downloads is enabled. But by default this is disabled and I need to force the download box to be prompting. Can I do anything without change a lot of code? Thanks.

    Read the article

  • Having trouble hiding keyboard using invisible button which sits on top of uiscrollview

    - by phil
    I have 3 items in play... 1) UIView sits at the base of the hierarchy and contains the UIScrollview. 2) UIScrollview that is presenting a lengthy user form. 3) An invisible button on the UIScrollview that I'm using to provide "hide the keyboard" features. Notice in the code below that I'm registering to be notified when the keyboard is going to appear and again when it's going to disappear. These are working great. My problem is seemingly one of "layers". See below where I insert the button into the view atIndex:0. This causes the button to be activated and "stuffed" behind the scrollview so that when you click on it, the scrollview grabs the touch and the button is unaware. There is no way to "reach" the button and suppress the keyboard. However, if I insert atIndex:1, the button gets super imposed on top of the text entry fields and so any touch at all is acted upon by the button, which immediately suppresses the keyboard and then disappears. How do I insert the button on top of the UIScrollview but behind the UITextfields that sit there? other logistics: I have a -(void) hidekeyboard function that I have setup with the UIButtion as an IBAction(). And I have the UIButton connected to "files owner" via a ctrl-drag/drop. (Do I need both of those conventions?) This code in ViewDidLoad()... [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:nil usingBlock:^(NSNotification *notification){ [self.view insertSubview:self.keyboardDismissalButton atIndex:0]; }];

    Read the article

  • ruby on rails group by with null values problem

    - by winter sun
    I have an hour table in witch I store user time tracking information, the table consists from the following cells project_id task_id (optional can be null) worker_id reported_date working_hours each worker enters sevral records per day so generally the table is looking like this id project_id worker_id task_id reported_date working hours; == =========== ========= ========= ============= ============== 1 1 1 1 10/10/2011 4 2 1 1 1 10/10/2011 14 3 1 1 10/10/2011 4 4 1 1 10/10/2011 14 the task_id is not a must field so there can be times when the user is not selecting it and ther task_id cell is empty now i need to display the data by using group by clouse so the resualt will be somthing like this project_id worker_id task_id working hours ========== ========= ========= ============== 1 1 1 18 1 1 18 I did the folowing group by condition @group_hours=Hour.group('project_id,worker_id,task_id)').select('project_id, task_id ,worker_id,sum(working_hours)as working_hours_sum') My view looks like this <% @group_hours.each do |b| % <%= b.project.name if b.project % <%= b.worker.First_name if b.worker % <%= b.task.name if b.task % <%= b.working_hours_sum % <%end% This it is working but only if the task_id is not null when task id is null it present all the records without grouping them like this project_id worker_id task_id working hours =========== ========= ========= ============== 1 1 1 18 1 1 4 1 1 14 I will appreciate any kind of solution to this problem

    Read the article

  • Acceptable name for extension method that accept null

    - by GaryX
    Hi, I really don't like to call String.IsNullOrEmpty(str). That makes me need to think "String" class first, then call it on the object "str". I like to call str.IsNullOrEmpty(), which doesn't need me to think "String" class. The problem is that extension method accept null instance to call on, which is not the usual case when you call a normal method. My question what do you think will be a convetion name for extension methods that accept null? For string, that is easy, "IsNullOrEmpty()" (anything that contains "IsNull") sounds good for me. For others, like GetDisplayName(), do we name it as "NullOrGetDisplayName" ?

    Read the article

  • How to format complex chained Linq statements for readibility?

    - by Joan Venge
    I have some code like this: var effects = xElement.Elements ( "Effects" ).Elements ( "Effect" ).Select ( e => new Effect ( ( EffectType ) Enum.Parse ( typeof ( EffectType ), ( string ) e.Elements ( "Type" ).FirstOrDefault ( ) ), e.Elements ( "Options" ).Any ( ) ? e.Elements ( "Options" ).Select ( o => ( object ) o.Elements ( "Option" ).Select ( n => n.Value ).First ( ) ) : null ) ) .ToList ( ); But currently this doesn't look as readable and I am not sure where I should add a new line and/or indent for readability. Any suggestions I could use to make consistent, readable linq blocks?

    Read the article

  • Rebuilding an Opensource Iphone Project but got too many errors

    - by user482473
    Downloaded an opensource sample Iphone project and when I compiled, everything is OK. This project has alot of C files. So, I try to rebuilding this project from scratch just to see if I can duplicate it. I make sure all the inlcudes files there, the path is correct, all the libraries there. I check original project settings and make sure if they have any specific search path and I need to follow. Anyway, I follow the exact settings but this time my duplicated project got some 1500 errors. alot of them generated from inside those C files. So, what's wrong? everyone got some tips on that why I got so many errors? I followed everything I follow from the original project.

    Read the article

  • Why is my PHP upload script not working?

    - by Turner
    Hello all, I am doing some simple work with uploading a file. I am ignoring error checking and exceptions at this point just to get my uploads working. I have this HTML form: <form action='addResult.php' method='post' enctype='multipart/form-data' target='results_iFrame' onsubmit='startUpload();'> Entry: <input type='text' id='entry' /> Stop: <input type='text' id='stop' /> Final: <input type='text' id='final' /> Chart: <input type='file' id='chart' /> <input type='submit' value='Add' /></form> As you can see, it calls 'addResult.php' within the iFrame 'results_iFrame'. The Javascript is just for animation purposes and to tell me when things are finished. addResult.php has this code in it (along with processing the other inputs): $upload_dir = "../img/"; $chart_loc = $upload_dir.basename($_FILES['chart']['name']); move_uploaded_file($_FILES['chart']['tmp_name'], $chart_loc); print_r($_FILES); It uses the 'chart' input from the form and tries to upload it. I have the print_r() function to display some information on $_FILES, but the array is empty, thus making this fail. What could I be doing wrong?

    Read the article

  • Bouncy Castle, RSA : transforming keys into a String format

    - by Rami W.
    Hi, iam using RSA(Bouncy Castle API) in my c# porject. Igenerated the keypair with this method RsaKeyPairGenerator r = new RsaKeyPairGenerator(); r.Init(new KeyGenerationParameters(new SecureRandom(), 1024)); AsymmetricCipherKeyPair keys = r.GenerateKeyPair(); AsymmetricKeyParameter private_key = keys.Private; AsymmetricKeyParameter public_key = keys.Public; now i want to save them in txt file but the problem is that i can't convert them to a string format. i read in another post that keys must be serialized using PrivateKeyInfo k = PrivateKeyInfoFactory.CreatePrivateKeyInfo(private_key); byte[] serializedKey = k.ToAsn1Object().GetDerEncoded(); Is it the right way ? if yes, what should i do after this ? just convert them from byte[] to String ? thx for any help.

    Read the article

  • Flex - Flash Builder Design View not showing embedded fonts correctly

    - by Crusader
    Tools: Air 2, Flex SDK 4.1, Flash Builder, Halo component set (NO Spark being used at all) Fonts work perfectly when running the appliction, but not in design view. This effectively makes design view WORTHLESS because it's impossible to properly position components or labels without knowing what the true size is (it changes depending on font...) ... CSS included in root component like so: <fx:Style source="style.css"/> CSS file: /* CSS file */ @namespace mx "library://ns.adobe.com/flex/mx"; global { font-family:Segoe; font-size:14; color:#FFFFFF; } mx|Application, mx|VBox, mx|HBox, mx|Canvas { font-family:Segoe; background-color:#660000; border-color:#222277; color:#FFFFFF; } mx|Button { font-family:Segoe; fill-colors:#660000, #660000, #660000, #660000; color:#FFFFFF; } .... Interestingly (or buggily?), when I try pasting the style tag into a subcomponent (lower than the top level container), I get a bunch of warnings in the subcomponent editor view stating that CSS type selectors are not supported in.. (all the components in the style sheet). Yet, they do work when the application is executed. Huh? This is how I'm embedding the fonts in the root level container: [Embed(source="/assets/segoepr.ttf", fontName="Segoe", mimeType="application/x-font-truetype", embedAsCFF='false')] public static const font:Class; [Embed(source="/assets/segoeprb.ttf", fontName="Segoe", mimeType="application/x-font-truetype", fontWeight="bold", embedAsCFF='false')] public static const font2:Class; So, is there a way to get embedded fonts to work in design view or what?

    Read the article

  • AVAudioPlayer lag when calling play

    - by joec
    I have set up an AVAudioPlayer object in viewDidLoad, as per the Apple guidelines, calling prepareToPlay as the last line in viewDidLoad (i have tried in awakeFromNib also). When i press my play button, there is a pause, as it would appear to load the file, then it plays. In audioPlayerDidFinishPlaying, i reload the player with a different sound, and when clicking play for a second time, the file plays instantly. What would cause the player to lag on the first play? Thanks.

    Read the article

  • jquery fancy box

    - by André Alçada Padez
    Hi, i'm using fancy box for some content editing in my backoffice. I recently added an image manager wich i create with javascript. It's kind of like a fancybox, but i had to do it from scractch for it to be able to overlay the first one. My problem is this: I want to have the user being able to press the escape key to close my manager, but if i use $(window).keypress when i press the esc key, both the boxes close. I have tried $(window).unbind('keypress') when i start loading my box, and i have tried to look through the fancybox js file, but it is minimized. Does anyone know how i can disable and afterwards enable the escape key (during runtime) on the fancybox? Thanx

    Read the article

  • How to add JSTL to Maven?

    - by La Chamelle
    I'm working on a JSF 2.0 project using Mojarra, PrimeFaces and Tomcat 6.x. I need to use c:forEach for some primefaces component like dynamic number of p:tab but i have problem with the c:forEach. All the other tag of JSTL work nice. I have the following error : java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTagStatus I use the following xmlns:c="http://java.sun.com/jsp/jstl/core", i tried to replace with xmlns:c="http://java.sun.com/jstl/core" but nothing display with the second. This is the exact version of lib: <dependency> <groupId>javax.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.0.2-FCS</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.0.4-b03</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> <version>2.2</version> </dependency> How i can fix it ? I can give more specific information if needed.

    Read the article

  • Copying a Polymorphic object in C++

    - by doron
    I have base-class Base from which is derived Derived1, Derived2 and Derived3. I have constructed an instance for one of the the derived classes which I store as Base* a. I now need to make a deep copy of the object which I will store as Base* b. As far as I know, the normal way of copying a class is to use copy constructors and to overload operator=. However since I don't know whether a is of type Derived1, Derived2 or Derived3, I cannot think of a way of using either the copy constructor or operator=. The only way I can think of to cleanly make this work is to implement something like: class Base { public: virtual Base* Clone() = 0; }; and the implement Clone in in the derived class as in: class Derivedn : public Base { public: Base* Clone() { Derived1* ret = new Derived1; copy all the data members } }; Java tends to use Clone quite a bit is there more of a C++ way of doing this?

    Read the article

  • Extract Data from a Website using PHP

    - by 01jayss
    I am trying to get PHP to extract the TOKEN (the uppercase one), USERID (uppercase), and the USER NAME (uppercase) from a web page with the following text. {"rsp":{"stat":"ok","auth":{"token":"**TOKEN**","perms":"read","user":{"id":"**USERID**","username":"**USER NAME**","fullname":"**NAME OF USER**"}}}} (This is from the RTM api, getting the authentication token of the user). How would I go about doing this? Thanks!

    Read the article

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