Daily Archives

Articles indexed Sunday April 25 2010

Page 21/72 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Making a Javascript game, Having a little problem with scrolling.

    - by RobertWHurst
    I have a #wrapper div and a #grid div nested inside. currently I can scroll around with this function below. getCursorPos : function(){ // set the empty cursor object var cursor = {}; //get the offset from the left of the grid container var grid //offset loop $(function getCursorPos(){ grid = $('#grid').offset(); setTimeout(getCursorPos, game.loopSpeed); }); //continuosly get the position var that = this; $(document).mousemove(function(e){ //if game mode is menu exit if(game.mode === 'menu'){ return; } // NOTE: this looks a litle over done but don't remove anything // its like this because javascript uses floating points // and so in order to line up to the nearest hunderedth I // had to make the cursor and div position intergers by // muliplying by ten. one the two are added I reduced them // and rounded them. that.x = Math.round(((e.pageX * 10) - (grid.left * 10)) / 10); that.y = Math.round(((e.pageY * 10) - (grid.top * 10)) / 10); }); }, the problem is that the mouse coordinates only update when the mouse moves. is there any way to get the coordinates with out moving the mouse?

    Read the article

  • Prevent the groupfield from repeating every three rows

    - by Aaron
    I have a web app and I need to integrate some JasperReports in this app. So I downloaded iReport and I used the templates. I choose the LeafGreen template, but I have a problem. When I have more than 4 elemets in my list, my headers gets repeated every 4 elements (see the image:) - I don't want this; once is enough. The problem: http://i39.tinypic.com/9kcp6p.jpg This is the template: http://i44.tinypic.com/2ags1w1.jpg What I'm doing wrong?

    Read the article

  • Moving email accounts between shared-hosting servers

    - by Michal M
    I've got to move email from one shared-hosting server to another. The reason to move is my current provider doesn't support IMAP, so access to emails is only through POP. I have 5 accounts to move, with 3 of them being 500MB. Is there a way to do it? (other than downloading it all to a client and updating server settings to new server and therefore uploading the files to new server) Any suggestions?

    Read the article

  • application that copies all links in a web page

    - by user23950
    I have to download something and those 100+ links to megaupload are all in the same webpage. Do you know of a better way of copying those links instead of copy and pasting them one by one? So that it will accumulate all the links, or portion of the links that I want to get and copy it all in the clipboard then just paste it on the download manager. For windows xp or 7

    Read the article

  • How to handle error in this case? By Exceptions or boolean or something else

    - by TP
    I am trying to create a Response class in Java which has a method void setResponse(String response); Different response subclasses will have different requirements for the response. The string that is passed to the function is received from the user. What is the correct way of handling a wrong response? Should the function throw an exception like IllegalResponseException Should the function be declared like boolean setResponse(String response, String errorMsg) and return false if the response is wrong and set the error message to the appropriate value

    Read the article

  • c program output

    - by sandy101
    HELLO , I am trying some program and confused with the output of the program #include #define a(x) (x*x) int main() { int i=3,j; j=a(i+1); printf("%d",j); return 0 ; } i want to know why the program is not giving the output 16(as instead to that i an getting the output 7 for the above program )

    Read the article

  • Twitter-OAuth update_profile_*_image methods problem [EpiTwitter]

    - by KPL
    People, I have been struggling over the two methods - Update Profile Image and Update Background Image I am using EpiTwitter library. I am uploading GIFs, Twitter returns the expected result for update_profile_background_image but returns 401 for update_profile_image , but the image is not changed. Here are the headers catched from $apiObj-headers in my case while using the update_profile_background_image Array ( [Date] = Sat, 24 Apr 2010 17:51:36 GMT [Server] = hi [Status] = 200 OK [X-Transaction] = 1272131495-55190-23911 [ETag] = b6a421c01936f3547802ae6b59ee7ef3" [Last-Modified] = Sat, 24 Apr 2010 17:51:36 GMT [X-Runtime] = 0.13990 [Content-Type] = application/json; charset=utf-8 [Content-Length] = 1272 [Pragma] = no-cache [X-Revision] = DEV [Expires] = Tue, 31 Mar 1981 05:00:00 GMT [Cache-Control] = no-cache, no-store, must-revalidate, pre- check=0, post-check=0 [Set-Cookie] = *REMOVED* [Vary] = Accept-Encoding [Connection] = close ) and for update_profile_image - Array ( [Date] => Sat, 24 Apr 2010 17:57:58 GMT [Server] => hi [Status] => 401 Unauthorized [WWW-Authenticate] => Basic realm="Twitter API" [X-Runtime] => 0.02263 [Content-Type] => text/html; charset=utf-8 [Content-Length] => 152 [Cache-Control] => no-cache, max-age=300 [Set-Cookie] => *REMOVED* [Expires] => Sat, 24 Apr 2010 18:02:58 GMT [Vary] => Accept-Encoding [Connection] => close ) Can somebody help me out?

    Read the article

  • Voting on Hacker News stories programmatically?

    - by igorgue
    I decided to write an app like: http://michaelgrinich.com/hackernews/ but for Android devices, my idea will use a web application backend (because I rather code in Python and for the web than completely in Java for Android devices). What I have right now implemented is something like this: $ curl -i http://localhost:8080/stories.json?page=1\&stories=1 HTTP/1.0 200 OK Date: Sun, 25 Apr 2010 07:59:37 GMT Server: WSGIServer/0.1 Python/2.6.5 Content-Length: 296 Content-Type: application/json [{"title": "Don\u2019t talk to aliens, warns Stephen Hawking", "url": "http://www.timesonline.co.uk/tol/news/science/space/article7107207.ece?", "unix_time": 1272175177, "comments": 15, "score": 38, "user": "chaostheory", "position": 1, "human_time": "Sun Apr 25 01:59:37 2010", "id": "1292241"}] The next step (and final I think) is voting, my design is doing something like this: $ curl -i http://localhost:8080/stories/1?vote=up -u username:password Will vote up and: $ curl -i http://localhost:8080/stories/1?vote=down -u username:password Down. I have no idea how to do it though... I was planning to use Twill but the login link is always different, e.g.: http://news.ycombinator.com/x?fnid=7u89ccHKln Later the Android app will consume this API. Any experience with programmatically browsing Hacker News?

    Read the article

  • Logging into oracle db as a global user

    - by kineas
    We are trying to shape up an old, 2 tier, Delphi based application. It originally uses database authentication, we'd like to transform the db user accounts to global users, so an OID server could perform the authentication instead of the database. The Delphi program can no longer log into the database if the account is a global user. I'm trying to understand the login protocol, so far without results. Similar thing happens with SQLDeveloper, I can't connect as a global user. SQLPlus however works with both kinds of users. We checked the information flow with Wireshark. When the dbserver asks back for a password, the SQLPlus sends it, while the SQLDeveloper doesn't send a password when attempting to connect as a global user. The client sends the application name too in the login request. Is it possible that we have to store the client app name in the LDAP itself?

    Read the article

  • fork within Cocoa application

    - by liuliu
    My problem is not the best scenario for fork(). However, this is the best func I can get. I am working on a Firefox plugin on Mac OSX. To make it robust, I need to create a new process to run my plugin. The problem is, when I forked a new process, much like this: if (fork() == 0) exit(other_main()); However, since the state is not cleaned, I cannot properly initialized my new process (call NSApplicationLoad etc.). Any ideas? BTW, I certainly don't want create a new binary and exec it.

    Read the article

  • How to organize live data integrity tests and code unit tests?

    - by karlthorwald
    I have several files with code testing code (which uses a "unittest" class). Later I found it would be nice to test database integrity also. I put this into a separate directory tree. (Things like the keys have correct format, parent and child nodes are pointing correctly and such.) I use the same unittest class for the integrity tests. Now I wonder if it makes really sense to keep this separate. To test the integrity of data I often duplicate parts of code that I use to test the code that handles the data. But it is not the same. The code tests use test databases (that get deleted after each test) and the integrity tests connect to the live data and analyze it. The integrity tests I want to call from cron and send an alarm if something happens in the live database. How would you handle that? Are there standards for such a setup? What is your experience? My tendency is to put everything in the same file, which would result in the code tests also being executed by the cron on the production environment.

    Read the article

  • JDBC/OSGi and how to dynamically load drivers without explicitly stating dependencies in the bundle?

    - by Chris
    Hi, This is a biggie. I have a well-structured yet monolithic code base that has a primitive modular architecture (all modules implement interfaces yet share the same classpath). I realize the folly of this approach and the problems it represents when I go to deploy on application servers that may have different conflicting versions of my library. I'm dependent on around 30 jars right now and am mid-way though bnding them up. Now some of my modules are easy to declare the versioned dependencies of, such as my networking components. They statically reference classes within the JRE and other BNDded libraries but my JDBC related components instantiate via Class.forName(...) and can use one of any number of drivers. I am breaking everything up into OSGi bundles by service area. My core classes/interfaces. Reporting related components. Database access related components (via JDBC). etc.... I wish for my code to be able to still be used without OSGi via single jar file with all my dependencies and without OSGi at all (via JARJAR) and also to be modular via the OSGi meta-data and granular bundles with dependency information. How do I configure my bundle and my code so that it can dynamically utilize any driver on the classpath and/or within the OSGi container environment (Felix/Equinox/etc.)? Is there a run-time method to detect if I am running in an OSGi container that is compatible across containers (Felix/Equinox/etc.) ? Do I need to use a different class loading mechanism if I am in a OSGi container? Am I required to import OSGi classes into my project to be able to load an at-bundle-time-unknown JDBC driver via my database module? I also have a second method of obtaining a driver (via JNDI, which is only really applicable when running in an app server), do I need to change my JNDI access code for OSGi-aware app servers?

    Read the article

  • How to auto create a JMS topic/queue on JBoss in a portable and per-application way?

    - by Bozho
    It's simple: I have an MDB and an EJB that sends messages to a topic (or queue). JBoss complains that the topic is not bound to the JNDI context. I want to have the topic/queue to be automatically created at best, or at least to have a standard way to define it, per application (say, in ejb-jar/META-INF) this question and this blogpost show us how to do it in an application server specific way. This surely works, but: I want to use the @MessageDriven annotation I want the setting not to be global for the application server I want the setting to be portable

    Read the article

  • possible to show composition relationship in a diagram generated from PHP source code?

    - by ajsie
    i have tested several UML applications for whether they could show composition relationships in the UML diagrams generated form the PHP source code or not, and the result is they can't. i know that this is a typical problem for PHP cause we don't declare a data type when we code, so it's difficult for the UML applications to know if an instance variable is a reference to an object or not. i also tested nWire with the same result. will there never be applications that could show us a complete map over all object relationships more than just inheritance? i think it's a pity that you can't have a good view over all the relationships for an application. cause when i use an open source solution, i always want to know how the objects are related to each other. maybe we could make comments for the instance variable telling the software that this is an reference to an object? but that would mean that the mapping software is using this solution. i feel its a pity nWire/visual paradigm can't give us a complete map:(

    Read the article

  • Rotate a 2d matrix to the right

    - by adam
    I want a 2d matrix to rotate to the right, it compiles fine but when I try to the run it freezes. For example I want {{10,20,30},{40,50,60}} to rotate into {{40,10},{50,20},{60,30}} import java.util.*; public class Rotate{ public static int[][] rotate(int[][] m) { int [][] rotateM = new int[m[0].length][m.length]; for (int i= 0; i< m.length; i= i++){ for (int j= 0; j< m[0].length; j= j++){ rotateM[i][j] = m[j][m.length-i-1]; } } return rotateM; } public static void main(String[]args){ int[][]m = {{10,20,30}, {40,50,60}}; System.out.println(Arrays.toString(rotate(m))); } }

    Read the article

  • Rails running multiple delayed_job - lock tables

    - by pepernik
    Hey. I use delayed_job for background processing. I have 8 CPU server, MySQL and I start 7 delayed_job processes RAILS_ENV=production script/delayed_job -n 7 start Q1: I'm wondering is it possible that 2 or more delayed_job processes start processing the same process (the same record-row in the database delayed_jobs). I checked the code of the delayed_job plugin but can not find the lock directive in a way it should be. I think each process should lock the database table before executing an UPDATE on lock_by column. They lock the record simply by updating the locked_by field (UPDATE delayed_jobs SET locked_by...). Is that really enough? No locking needed? Why? I know that UPDATE has higher priority than SELECT but I think this does not have the effect in this case. My understanding of the multy-threaded situation is: Process1: Get waiting job X. [OK] Process2: Get waiting jobs X. [OK] Process1: Update locked_by field. [OK] Process2: Update locked_by field. [OK] Process1: Get waiting job X. [Already processed] Process2: Get waiting jobs X. [Already processed] I think in some cases more jobs can get the same information and can start processing the same process. Q2: Is 7 delayed_jobs a good number for 8CPU server? Why yes/not. Thx 10x!

    Read the article

  • SQL Server - Physical connection is not usable Error Code: 19

    - by Harry
    Having trouble working out this SqlException: A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable) Any ideas what this is about? Couldn't get any hits on google or msdn on this one. The connection is MARS and Asynchronous in my own SQL pool. But don't get all excited about that - that is old code that has been stable for a long time! Exception details pasted below: System.Data.SqlClient.SqlException occurred Message=A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable) Source=.Net SqlClient Data Provider ErrorCode=-2146232060 Class=20 LineNumber=0 Number=-1 Server=SERVER State=0 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParserStateObject.SNIWriteAsync(SNIHandle handle, SNIPacket packet, DbAsyncResult asyncResult) at System.Data.SqlClient.TdsParserStateObject.WriteSni() at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode) at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.BeginExecuteNonQuery(AsyncCallback callback, Object stateObject) at CrawlAbout.Library.SQL.SQLAdapter.<ExecuteNonQueryTask>d__12.MoveNext() in D:\Work\Projects\CrawlAbout.com 2.0\CrawlAbout.Library.SQL\SQLAdapter.cs:line 149 InnerException:

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >