Daily Archives

Articles indexed Friday March 18 2011

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

  • Advertisement programs that allow "clickjacking" (earning advertisement revenues by popups generated by clicks on the website)?

    - by Tom
    Whether clickjacking is an ethically responsible way of earning advertisement revenues is a subjective discussion and should not be discussed here. However, it appears that quite a lot of popular sites generate "popups" when you click either of their links or buttons. An example is the Party Poker advertisement (I am sure many of you will have seen this one). I wonder though, what kind of advertisement companies allow such techniques? Surely Google Adsense does not? But which do, and are they reliable partners?

    Read the article

  • Multisites Network SEO::Can self-referencing canonical tag(rel="canonical") inside article improve google rating?

    - by user5674576
    Hi, Can self-referencing canonical tag(rel="canonical") inside article improve google rating? The Case: Company have 40 sites with original content and 1 main site with some of 40 sites articles. Main site have rel="canonical" in each article Should article in original site have also rel="canonical" for self-referencing? example: inside main network site(reference to other site):<link href="http://site7.com/article25" rel="canonical" /> inside original network site(self-reference):<link href="http://site7.com/article25" rel="canonical"/> Thanks in advance

    Read the article

  • How likely are IE9 jumplists to be useful?

    - by Grant Palin
    Having installed the Internet Explorer 9 release, I've experimented with the jumplists feature available in Windows 7 - drag a site tab down to the taskbar to create a jumplist. Works for Facebook and Twitter, anyway. I have my suspicions about the utility of this feature - it's a neat and possibly useful feature, yet is limited to the combination of IE9 and Windows 7, plus sites implementing the appropriate code. Given the relatively small audience at this point, is there any value in adding code to support this feature? And would it likely be more useful for a web application (e.g. Twitter, Facebook) than a typical website?

    Read the article

  • How to protect your real time online shooter from potential bots

    - by Zaky German
    I'm looking to create a multiplayer top down shooter. While i've read about different topics, i can see them i've got some real challenges ahead, but i'm all up for it. One thing i can't understand is how am i supposed to be protecting the game from people who try to create bots? What i mean is, as far as i understand, it's impossible to protect the network traffic in a way that players won't be able to create programs that listen to what's going on and understand it. So what worries me is that people can create bots that listen to the current location of rival players, and send communication that mimic as if the player is shooting in the exact "perfect" location to win that match. So what kind of techniques are used to protect real time games from such bots? Also i'd like to mention that i've tried searching for discussions (as this sounds like something many people struggle with), but couldn't find anything about it specifically, only as a part of broader questions about networking in real time games. If i should have looked harder feel free to put me in my place :) Thanks alot!

    Read the article

  • What version of Java should I target for applets?

    - by Christopher Horenstein
    I recently deployed an applet that seems to require Java 6 Update 24. I assume the reason for this requirement is the matching JDK version I used to create the applet (I am new to Java). The fact that my applet requires a Java download/update for users who already have some version of Java installed is a big concern for me; the applets I'm creating slip into a web comic, so it's very disruptive. Having used the most recent version of Java, it seems as though I am able to assume that most of the readers I get will have to update Java to continue reading/playing. Is there a best practice concerning which version of Java to use to make the process of using an applet easy for end-users? Any reading material on this would be very helpful. Should I be using an older version of Java if I don't require new features? I am using Slick for 2D games.

    Read the article

  • Should I be using Lua for game logic on mobile devices?

    - by Rob Ashton
    As above really, I'm writing an android based game in my spare time (android because it's free and I've no real aspirations to do anything commercial). The game logic comes from a very typical component based model whereby entities exist and have components attached to them and messages are sent to and fro in order to make things happen. Obviously the layer for actually performing that is thin, and if I were to write an iPhone version of this app, I'd have to re-write the renderer and core driver (of this component based system) in Objective C. The entities are just flat files determining the names of the components to be added, and the components themselves are simple, single-purpose objects containing the logic for the entity. Now, if I write all the logic for those components in Java, then I'd have to re-write them on Objective C if I decided to do an iPhone port. As the bulk of the application logic is contained within these components, they would, in an ideal world, be written in some platform-agnostic language/script/DSL which could then just be loaded into the app on whatever platform. I've been led to believe however that this is not an ideal world though, and that Lua performance etc on mobile devices still isn't up to scratch, that the overhead is too much and that I'd run into troubles later if I went down that route? Is this actually the case? Obviously this is just a hypothetical question, I'm happy writing them all in Java as it's simple and easy get things off the ground, but say I actually enjoy making this game (unlikely, given how much I'm currently disliking having to deal with all those different mobile devices) and I wanted to make a commercially viable game - would I use Lua or would I just take the hit when it came to porting and just re-write all the code?

    Read the article

  • Velocity collision detection (2D)

    - by ultifinitus
    Alright, so I have made a simple game engine (see youtube) And my current implementation of collision resolution has a slight problem, involving the velocity of a platform. Basically I run through all of the objects necessary to detect collisions on and resolve those collisions as I find them. Part of that resolution is setting the player's velocity = the platform's velocity. Which works great! Unless I have a row of platforms moving at different velocities or a platform between a stack of tiles.... (current system) bool player::handle_collisions() { collisions tcol; bool did_handle = false; bool thisObjectHandle = false; for (int temp = 0; temp < collideQueue.size(); temp++) { thisObjectHandle = false; tcol = get_collision(prevPos.x,y,get_img()->get_width(),get_img()->get_height(), collideQueue[temp]->get_position().x,collideQueue[temp]->get_position().y, collideQueue[temp]->get_img()->get_width(),collideQueue[temp]->get_img()->get_height()); if (prevPos.y >= collideQueue[temp]->get_prev_pos().y + collideQueue[temp]->get_img()->get_height()) if (tcol.top > 0) { add_pos(0,tcol.top); set_vel(get_vel().x,collideQueue[temp]->get_vel().y); thisObjectHandle = did_handle = true; } if (prevPos.y + get_img()->get_height() <= collideQueue[temp]->get_prev_pos().y) if (tcol.bottom > 0) { add_pos(collideQueue[temp]->get_vel().x,-tcol.bottom); set_vel(get_vel().x/*collideQueue[temp]->get_vel().x*/,collideQueue[temp]->get_vel().y); ableToJump = true; jumpTimes = maxjumpable; thisObjectHandle = did_handle = true; } /// /// ADD CODE FROM NEXT CODE BLOCK HERE (on forum, not in code) /// } for (int temp = 0; temp < collideQueue.size(); temp++) { thisObjectHandle = false; tcol = get_collision(x,y,get_img()->get_width(),get_img()->get_height(), collideQueue[temp]->get_position().x,collideQueue[temp]->get_position().y, collideQueue[temp]->get_img()->get_width(),collideQueue[temp]->get_img()->get_height()); if (prevPos.x + get_img()->get_width() <= collideQueue[temp]->get_prev_pos().x) if (tcol.left > 0) { add_pos(-tcol.left,0); set_vel(collideQueue[temp]->get_vel().x,get_vel().y); thisObjectHandle = did_handle = true; } if (prevPos.x >= collideQueue[temp]->get_prev_pos().x + collideQueue[temp]->get_img()->get_width()) if (tcol.right > 0) { add_pos(tcol.right,0); set_vel(collideQueue[temp]->get_vel().x,get_vel().y); thisObjectHandle = did_handle = true; } } return did_handle; } (if I add the following code {where the comment to do so is}, which is glitchy, the above problem doesn't happen, though it brings others) if (!thisObjectHandle) { if (tcol.bottom > tcol.top) { add_pos(collideQueue[temp]->get_vel().x,-tcol.bottom); set_vel(get_vel().x,collideQueue[temp]->get_vel().y); } else if (tcol.top > tcol.bottom) { add_pos(0,tcol.top); set_vel(get_vel().x,collideQueue[temp]->get_vel().y); } } How would you change my system to prevent this?

    Read the article

  • Question regarding common class

    - by Rocky Singh
    I have following two classes: public class A : System.Web.UI.WebControls.Button { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } and public class B : System.Web.UI.WebControls.TextBox { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } As you must be seeing the class A and B have exactly the same code , my question is how can I make a common class for it and use these two classes.

    Read the article

  • JPA/Hibernate Parent/Child relationship

    - by NubieJ
    Hi I am quite new to JPA/Hibernate (Java in general) so my question is as follows (note, I have searched far and wide and have not come across an answer to this): I have two entities: Parent and Child (naming changed). Parent contains a list of Children and Children refers back to parent. e.g. @Entity public class Parent { @Id @Basic @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "PARENT_ID", insertable = false, updatable = false) private int id; /* ..... */ @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY) @JoinColumn(name = "PARENT_ID", referencedColumnName = "PARENT_ID", nullable = true) private Set<child> children; /* ..... */ } @Entity public class Child { @Id @Basic @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "CHILD_ID", insertable = false, updatable = false) private int id; /* ..... */ @ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER, optional = false) @JoinColumn(name = "PARENT_ID", referencedColumnName = "PARENT_ID") private Parent parent; /* ..... */ } I want to be able to do the following: Retrieve a Parent entity which would contain a list of all its children (List), however, when listing Parent (getting List, it of course should omit the children from the results, therefore setting FetchType.LAZY. Retrieve a Child entity which would contain an instance of the Parent entity. Using the code above (or similar) results in two exceptions: Retrieving Parent: A cycle is detected in the object graph. This will cause infinitely deep XML... Retrieving Child: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: xxxxxxxxxxx, no session or session was closed When retrieving the Parent entity, I am using a named query (i.e. calling it specifically) @NamedQuery(name = "Parent.findByParentId", query = "SELECT p FROM Parent AS p LEFT JOIN FETCH p.children where p.id = :id") Code to get Parent (i.e. service layer): public Parent findByParentId(int parentId) { Query query = em.createNamedQuery("Parent.findByParentId"); query.setParameter("id", parentId); return (Parent) query.getSingleResult(); } Why am I getting a LazyInitializationException event though the List property on the Parent entity is set as Lazy (when retrieving the Child entity)?

    Read the article

  • Regex: How to match a unix datestamp?

    - by Jono
    I'd like to be able to match this entire line (to highlight this sort of thing in vim): Fri Mar 18 14:10:23 ICT 2011. I'm trying to do it by finding a line that contains ICT 20 (first two digits of the year of the year), like this: syntax match myDate /^*ICT 20*$/, but I can't get it working. I'm very new to regex. Basically what I want to say: find a line that contains "ICT 20" and can have anything on either side of it, and match that whole line. Is there an easy way to do this?

    Read the article

  • Approach for parsing file and creating dynamic data structure for use by another program

    - by user275633
    All, Background: I have a customer who has some build scripts for their datacenter based on python that I've inherited. I did not work on the original design so I'm sort of limited to some degree on what I can and can't change. That said, my customer has a properties file that they use in their datacenter. Some of the values are used to build their servers and unfortunately they have other applications that also use these values so I cannot change them to make it easier for me. What I want to do is make the scripts more dynamic to distribute more hosts so that I don't have to keep updating the scripts in the future and can just add more hosts to the property file. Unfortunately I can't change the current property file and have to work with it. The property file looks something like this: projectName.ClusterNameServer1.sslport=443 projectName.ClusterNameServer1.port=80 projectName.ClusterNameServer1.host=myHostA projectName.ClusterNameServer2.sslport=443 projectName.ClusterNameServer2.port=80 projectName.ClusterNameServer2.host=myHostB In their deployment scripts they basically have alot of if projectName.ClusterNameServerX where X is some number of entries defined and then do something, e.g.: if projectName.ClusterNameServer1.host != "" do X if projectName.ClusterNameServer2.host != "" do X if projectName.ClusterNameServer3.host != "" do X Then when they add another host (say Serve4) they've added another if statement. Question: What I would like to do is make the scripts more dynamic and parse the properties file and put what I need into some data structure to pass to the deployment scripts and then just iterate over the structure and do my deployment that way so I don't have to constantly add a bunch of if some host# do something. I'm just curious to feed some suggestions as to what others would do to parse the file and what sort of data structure would they use and how they would group things together by ClusterNameServer# or something else. Thanks

    Read the article

  • Passing data between objects in Chain of Responsibility pattern

    - by AbrahamJP
    While implementing the Chain of Responsibility pattern, i came across a dilemma om how to pass data between objects in the chain. The datatypes passed between object in the chain can differ for each object. As a temporary fix I had created a Static class containing a stack where each object in the chain can push the results to the stack while the next object in the chain could pop the results from the stack. Here is a sample code on what I had implemented. public interface IHandler { void Process(); } public static class StackManager { public static Stack DataStack = new Stack(); } //This class doesn't require any input to operate public class OpsA : IHandler { public IHandler Successor {get; set; } public void Process() { //Do some processing, store the result into Stack var ProcessedData = DoSomeOperation(); StackManager.DataStack.Push(ProcessedData); if(Successor != null) Successor(); } } //This class require input data to operate upon public class OpsB : IHandler { public IHandler Successor {get; set; } public void Process() { //Retrieve the results from the previous Operation var InputData = StackManager.DataStack.Pop(); //Do some processing, store the result into Stack var NewProcessedData = DoMoreProcessing(InputData); StackManager.DataStack.Push(NewProcessedData); if(Successor != null) Successor(); } } public class ChainOfResponsibilityPattern { public void Process() { IHandler ProcessA = new OpsA(); IHandler ProcessB = new OpsB(); ProcessA.Successor = ProcessB; ProcessA.Process(); } } Please help me to find a better approach to pass data between handlers objects in the chain.

    Read the article

  • Total row count for pagination using JPA Criteria API

    - by ThinkFloyd
    I am implementing "Advanced Search" kind of functionality for an Entity in my system such that user can search that entity using multiple conditions(eq,ne,gt,lt,like etc) on attributes of this entity. I am using JPA's Criteria API to dynamically generate the Criteria query and then using setFirstResult() & setMaxResults() to support pagination. All was fine till this point but now I want to show total number of results on results grid but I did not see a straight forward way to get total count of Criteria query. This is how my code looks like: CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Brand> cQuery = builder.createQuery(Brand.class); Root<Brand> from = cQuery.from(Brand.class); CriteriaQuery<Brand> select = cQuery.select(from); . . //Created many predicates and added to **Predicate[] pArray** . . select.where(pArray); // Added orderBy clause TypedQuery typedQuery = em.createQuery(select); typedQuery.setFirstResult(startIndex); typedQuery.setMaxResults(pageSize); List resultList = typedQuery.getResultList(); My result set could be big so I don't want to load my entities for count query, so tell me efficient way to get total count like rowCount() method on Criteria (I think its there in Hibernate's Criteria).

    Read the article

  • How to make Firefox extension auto install in nav bar?

    - by S M
    I'm working on a Firefox extension. I'd like to make it auto-install in the far right position on the nav bar when a user installs it. As it stands, a user has to go to View Toolbars Customize... and drag the extension to the nav bar once it's installed. I'd like to eliminate this step. The extension is here: http://madan.org/tickertool The XUL for my extension looks basically like this and it overlays browser.xul: <overlay id="my-ext-overlay" ... > <toolbarpalette id="BrowserToolbarPalette"> <toolbaritem id="my-ext-container" ... > <toolbarbutton id="my-ext-customize-image" ... /> <textbox id="my-ext-textbox" ... /> <hbox id="my-ext-buttons"> <image id="my-ext-button1" ... /> <image id="my-ext-button2" ... /> <image id="my-ext-button3" ... /> </hbox> </toolbaritem> </toolbarpalette> </overlay> I've seen code here ( https://developer.mozilla.org/en/Code_snippets/Toolbar ) that supposedly does what I'm looking for, but this code is if your extension is just a single button and I can't get it to work for me. The answer to my question is likely some modification of this code, but I haven't figured it out.

    Read the article

  • Getting a date value in a postgres table column and check if it's bigger than todays date

    - by Roland
    I have a Postgres table called clients. The name column contains certain values eg. test23233 [987665432,2014-02-18] At the end of the value is a date, I need to compare this date, and return all records where this specific date is younger than today I tried select id,name FROM clients where name ~ '(\d{4}\-\d{1,2}\-\d{1,2})'; but this isn't returning any values. How would I go about to achieve the results I want?

    Read the article

  • Ruby on Rails: strange voting increment behavior

    - by Justin Meltzer
    So I have an up and a downvote button that inserts a vote with a value of 1 or -1 into the database. This works correctly. Then, I display the total vote count for that element by summing up its votes' values. However, this isn't working correctly, because the vote sum display is acting really strange: The first vote on a video doesn't seem to increment it at all. Then the second vote does. If I go from an upvote to a downvote, it increments up once, and then the next downvote is down. This is difficult to explain, but maybe you can figure out what is wrong with my code. I have this function in my Video model (the element that is voted on, it has_many video_votes): def vote_sum read_attribute(:vote_sum) || video_votes.sum(:value) end I also have this in my VideoVote model: after_create :update_vote_sum private def update_vote_sum video.update_attributes(:vote_sum => video.vote_sum + value) end What am I doing wrong?

    Read the article

  • Type problem with Observable.Create from Boo

    - by Tristan
    I'm trying to use Reactive Extensions from Boo and am running into type problems. Here's the basic example: def OnSubscribe(observer as IObservable[of string]) as callable: print "subscribing" def Dispose(): print "disposing" return Dispose observable = System.Linq.Observable.Create[of string](OnSubscribe) observer = System.Linq.Observer.Create[of string]({x as string | print x}) observable.Subscribe(observer) The Subscribe here gives a System.InvalidCastException: Cannot cast from source type to destination type. The issue appears to be with how I'm creating the observable, but I've struggled to see where the type problem arises from. Ideas?

    Read the article

  • How to terminate a particular Azure worker role instance

    - by Oliver Bock
    Background I am trying to work out the best structure for an Azure application. Each of my worker roles will spin up multiple long-running jobs. Over time I can transfer jobs from one instance to another by switching them to a readonly mode on the source instance, spinning them up on the target instance, and then spinning the original down on the source instance. If I have too many jobs then I can tell Azure to spin up extra role instance, and use them for new jobs. Conversely if my load drops (e.g. during the night) then I can consolidate outstanding jobs to a few machines and tell Azure to give me fewer instances. The trouble is that (as I understand it) Azure provides no mechanism to allow me to decide which instance to stop. Thus I cannot know which servers to consolidate onto, and some of my jobs will die when their instance stops, causing delays for users while I restart those jobs on surviving instances. Idea 1: I decide which instance to stop, and return from its Run(). I then tell Azure to reduce my instance count by one, and hope it concludes that the broken instance is a good candidate. Has anyone tried anything like this? Idea 2: I predefine a whole bunch of different worker roles, with identical contents. I can individually stop and start them by switching their instance count from zero to one, and back again. I think this idea would work, but I don't like it because it seems to go against the natural Azure way of doing things, and because it involves me in a lot of extra bookkeeping to manage the extra worker roles. Idea 3: Live with it. Any better ideas?

    Read the article

  • Exception handling - what happens after it leaves catch

    - by Tony
    So imagine you've got an exception you're catching and then in the catch you write to a log file that some exception occurred. Then you want your program to continue, so you have to make sure that certain invariants are still in a a good state. However what actually occurs in the system after the exception was "handled" by a catch? The stack has been unwound at that point so how does it get to restore it's state?

    Read the article

  • Loop through multiple tables to execute same query

    - by pcvnes
    Hi, I have a database wherein per day a table is created to log process instances. The tables are labeled MESSAGE_LOG_YYYYMMDD Currently i want to sequentially execute the same QUERY against all those tables. I wrote the PL/SQL below, but got stuck at line 10. How can i execute the SQL statement against successfully against all tables here ? DECLARE CURSOR all_tables IS SELECT table_name FROM all_tables WHERE TABLE_NAME like 'MESSAGE_LOG_2%' ORDER BY TABLE_NAME ; BEGIN FOR msglog IN all_tables LOOP SELECT count(*) FROM TABLE msglog.TABLE_NAME ; END LOOP; END; / Cheers, Peter

    Read the article

  • SQLite MYSQL character encoding

    - by Lee Armstrong
    I have a strange situation where the following code works however XCode warns it is deprecated... NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0)]; However as that is the deprecated method if I set an encoding the string comes out wrong! I have tried all the encodings but none work! NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0) encoding:NSASCIIStringEncoding];

    Read the article

  • Programmatically Creating fieldset, ol/ul and li tags in ASP.Net, C#

    - by Matt
    Hi, I need to write an ASP.Net form which will produce the following HTML: <fieldset> <legend>Contact Details</legend> <ol> <li> <label for="name">Name:</label> <input id="name" name="name" class="text" type="text" /> </li> <li> <label for="email">Email address:</label> <input id="email" name="email" class="text" type="text" /> </li> <li> <label for="phone">Telephone:</label> <input id="phone" name="phone" class="text" type="text" /> </li> </ol> </fieldset> However, the fields which are to be added to the form will be determined at runtime, so I need to create the fieldset at runtime and add an ordered list and listitems to it, with labels, textboxes, checkboxes etc as appropriate. I can’t find standard ASP.Net objects which will create these tags. For instance, I’d like to do something like the following in C#: FieldSet myFieldSet = new FieldSet(); myFieldSet.Legend = “Contact Details”; OrderedList myOrderedList = new OrderedList(); ListItem listItem1 = new ListItem(); ListItem listItem2 = new ListItem(); ListItem listItem3 = new ListItem(); // code here which would add labels and textboxes to the ListItems myOrderedList.Controls.Add(listItem1); myOrderedList.Controls.Add(listItem2); myOrderedList.Controls.Add(listItem3); myFieldSet.Controls.Add(myOrderedList); Form1.Controls.Add(myFieldSet); Are there any standard ASP.Net objects which can produce this, or is there some other way of achieving the same result? Matt

    Read the article

  • How to set Content-Type header charset in OpenRasta

    - by Sergey Mirvoda
    When I return my object as JSON via JsonDataContractCodec OpenRasta sets Content-Type header to application/json but ignores charset part of content type. When I use Chrome it sends GET request with folowing header: Accept-Charset:windows-1251,utf-8;q=0.7,*;q=0.3 and all my utf-8 encoded json objects goes wrong. I tried to override OperationResult with no luck. OpenRasta overwrites my header with codec's one.

    Read the article

  • Is it possible reinstall packages in Ubuntu without an internet connection?

    - by javamatt
    Hi everyone, While experiencing some massive problems with MYSQL, I completely removed a package called rsyslog, and I can no longer get on the internet to use the package manager to correct my mistake. I also got rid of librdf0 as well (oops). I would like to download the missing packages onto a CD with another computer, and manually reinstall them on my Ubuntu platform. Any ideas where to find these? (I am assuming this is the package I need. Either way, I still need to get access to the correct packages and install them). Thank you all very much in advance. Matt

    Read the article

  • Why does ganglia think my host is down?

    - by NZKoz
    I have ganglia set up to monitor our staging server, it's working great but I'm confused by the definition of 'down' to ganglia. There's a single node, running gmetad, gmond and the web frontend, but some small percentage of the time the web frontend shows some confusing output. Despite the fact that it's a single server in the cluster, and that server is the one serving the web interface, the dashboard output insists that the host is down. Then below that it has a graph which shows 50% down, 50% up. You can see an example of this here: http://i.imgur.com/MCWaS.jpg There's obviously something confusing ganglia somewhere, but I'm not sure where to start looking. Unfortunately googling for any combination of 'ganglia' 'down' 'metric name' seems return nothing but other people's ganglia installations displaying the same nonsense. Any tips on where to start looking would be greatly appreciated

    Read the article

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