Daily Archives

Articles indexed Thursday April 12 2012

Page 8/18 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Box2D platformer movement. Should i mess with velocity?

    - by Romeo
    I have a platformer game in which I implemented the movement using a wheel attached to the hero. For jumping I use this: player.body.applyLinearImpulse(new Vec2(0, 30000000), player.body.getPosition()); The problem is that the xVelocity doesn't remain the same during the jump so it isn't looking natural. Is there any way to modify only the x velocity of the body so that before jumping I store it in a variable and after jumping I apply it to the body? I hope you understand what I am trying to say.

    Read the article

  • Zoom Layer centered on a Sprite

    - by clops
    I am in process of developing a small game where a space-ship travels through a layer (doh!), in some situations the spaceship comes close to an enemy space ship, and the whole layer is zoomed in on the two with the zoom level being dependent on the distance between the ship and the enemy. All of this works fine. The main question, however, is how do I keep the zoom being centered on the center point between the two space-ships and make sure that the two are not off-screen? Currently I control the zooming in the GameLayer object through the update method, here is the code (there is no layer repositioning here yet): -(void) prepareLayerZoomBetweenSpaceship{ CGPoint mainSpaceShipPosition = [mainSpaceShip position]; CGPoint enemySpaceShipPosition = [enemySpaceShip position]; float distance = powf(mainSpaceShipPosition.x - enemySpaceShipPosition.x, 2) + powf(mainSpaceShipPosition.y - enemySpaceShipPosition.y,2); distance = sqrtf(distance); /* Distance > 250 --> no zoom Distance < 100 --> maximum zoom */ float myZoomLevel = 0.5f; if(distance < 100){ //maximum zoom in myZoomLevel = 1.0f; }else if(distance > 250){ myZoomLevel = 0.5f; }else{ myZoomLevel = 1.0f - (distance-100)*0.0033f; } [self zoomTo:myZoomLevel]; } -(void) zoomTo:(float)zoom { if(zoom > 1){ zoom = 1; } // Set the scale. if(self.scale != zoom){ self.scale = zoom; } } Basically my question is: How do I zoom the layer and center it exactly between the two ships? I guess this is like a pinch zoom with two fingers!

    Read the article

  • Cannot convert lamda expression

    - by Kirsty White
    If I try: Groups = students.Remove(f => f.StudentID.Equals(studentID)); I get an error on this line: f => f.StudentID.Equals(studentID) I am having difficulty from my previous posts here linq deleted users still associated with groups and here Delete method in WCF So I thought maybe I could delete the students contained within groups but I get an error Cannot convert lamda expression to type Student because it is not a delegate type.

    Read the article

  • Integration tests in Continuous Integration environment: Database and filesystem state

    - by dario_ramos
    I'm trying to implement automated integration tests for my application. It's a very complex monster. You could say that its database and part of the filesystem are part of its state, because it saves image files in the hard drive, and references to those in the DB. The software needs all those, in a coherent state, to work properly. Back to writing tests: To run any relevant test, I need some image files in the filesystem, and certain records filled in the database. I thought of putting all of these in a separate folder called TestEnvironmentData in the repository, and retrieving them from the Continuous Integration Server (Team City), but a colleague said the repo is quite full as it is, and that I should set up a special directory, and databases, only in the Continuous Integration server. I don't like that because the tests success depend on me manually mantaining stuff in the server, and restoring initial state before every test becomes cumbersome. What do you guys do when you need to write integration tests for an app like this? The main goal is having an automated test harness to approach a large scale refactoring. There's lots of spaghetti code and the app's current architecture is hardly unit testable, that's why I decided on integration tests first. Any alternative approach is welcome.

    Read the article

  • Creating a new coloumn for date info with specific date format

    - by Ayan
    Dear All I am working with a file which has few years data and I am trying to create an aditional coloumn that reads the year and month info from the date coloumn (e.g. 01/01/1997 12:00) and create a new coloumn with month and year together(e.g. Jan-97). I am not sure how to proceed with this but what I am trying to code is the coloumn with name "new_date" in the following picture: my sample data = > dput(df) structure(list(date = structure(c(1L, 4L, 7L, 2L, 5L, 8L, 3L, 6L, 9L), .Label = c("01/01/1997 12:00", "01/01/1998 15:00", "01/01/1999 18:00", "01/02/1997 13:00", "01/02/1998 16:00", "01/02/1999 19:00", "01/03/1997 14:00", "01/03/1998 17:00", "01/03/1999 19:00"), class = "factor"), value = c(29L, 31L, 42L, 42L, 52L, 61L, 57L, 55L, 56L)), .Names = c("date", "value"), row.names = c(NA, -9L), class = "data.frame") I would really appreciate if you could advise me about how should I proceed with this, Many thanks, Ayan

    Read the article

  • Display a variable when a select box option is selected

    - by user782104
    For example, the select box <select><option selected="" value="">Please Select</option><option value='txt'>Text</option><option value='int'>Numbers</option><option value='bool' >Boolean</option></select> has a string $messageList=array ( 'txt'=>'text message', 'int'=>'int message','bool'=>'bool message'); What i would like to achieve is to display correspond message when the optition is select?

    Read the article

  • RESTful API Documentation

    - by PartlyCloudy
    I'm going to design a RESTful API soon, thus I need to describe it in order to enable other people to start implementing clients using it. I've looked around a bit, but unfortunately, I've not found any standardized form of describing web-based RESTful services. What I'am looking for is something like JavaDoc, although it don't have to be generated out of any sort of code. I'm also not talking about something like WADL, I rather want to have some human-readable documentation I can hand out. Due to the nature of RESTful web-based services, it should be quite easy to standardize a documentation. It should just list available ressources, corresponding URIs, allowed methods, content-types and describe the availabe actions. Do you have any suggestions therefore? Thanks in advance & Greets

    Read the article

  • Caching generated QR Code

    - by Michal K
    I use zxing to encode a qr code and store it as a bitmap and then show it in ImageView. Since the image generation time is significant I'm planning to move it to a separate thread (AsyncTaskLoader will be fine I think). The problem is - it's an image and I know that to avoid memory leaks one should never store a strong reference to it in an Activity. So how would you do it? How to cache an image to survive config changes (phone rotation) and generally avoid generating it onCreate()? Just point me in the right direction, please.

    Read the article

  • Changing background color of inputfield of editable coloumn in primefaces datatable on value change

    - by Shikha
    I have an editable coloumn in dataTable. The code is: <p:column id="articleDescription" headerText="Article Description" filterBy="#{article.description}" filterMatchMode="startsWith"> <p:inputText id="description" value="#{article.description}"style="border:none; box-shadow:none;" /> </p:column> I want to change the background color of the inputText - description on the event - valueChange. How can I change that ? Also, the default background color of it should be the same as of its parent row? Is it possible? How can it be done? Thanks, Shikha

    Read the article

  • Design pattern for mouse interaction

    - by mike
    I need some opinions on what is the "ideal" design pattern for a general mouse interaction. Here the simplified problem. I have a small 3d program (QT and openGL) and I use the mouse for interaction. Every interaction is normally not only a single function call, it is mostly performed by up to 3 function calls (initiate, perform, finalize). For example, camera rotation: here the initial function call will deliver the current first mouse position, whereas the performing function calls will update the camera etc. However, for only a couple of interactions, hardcoding these (inside MousePressEvent, MouseReleaseEvent MouseMoveEvent or MouseWheelEvent etc) is not a big deal, but if I think about a more advanced program (e.g 20 or more interactions) then a proper design is needed. Therefore, how would you design such a interactions inside QT. I hope I made my problem clear enough, otherwise don't bother complain :-) Thanks

    Read the article

  • Am I mocking this helper function right in my Django test?

    - by CppLearner
    lib.py from django.core.urlresolvers import reverse def render_reverse(f, kwargs): """ kwargs is a dictionary, usually of the form {'args': [cbid]} """ return reverse(f, **kwargs) tests.py from lib import render_reverse, print_ls class LibTest(unittest.TestCase): def test_render_reverse_is_correct(self): #with patch('webclient.apps.codebundles.lib.reverse') as mock_reverse: with patch('django.core.urlresolvers.reverse') as mock_reverse: from lib import render_reverse mock_f = MagicMock(name='f', return_value='dummy_views') mock_kwargs = MagicMock(name='kwargs',return_value={'args':['123']}) mock_reverse.return_value = '/natrium/cb/details/123' response = render_reverse(mock_f(), mock_kwargs()) self.assertTrue('/natrium/cb/details/' in response) But instead, I get File "/var/lib/graphyte-webclient/graphyte-webenv/lib/python2.6/site-packages/django/core/urlresolvers.py", line 296, in reverse "arguments '%s' not found." % (lookup_view_s, args, kwargs)) NoReverseMatch: Reverse for 'dummy_readfile' with arguments '('123',)' and keyword arguments '{}' not found. Why is it calling reverse instead of my mock_reverse (it is looking up my urls.py!!) The author of Mock library Michael Foord did a video cast here (around 9:17), and in the example he passed the mock object request to the view function index. Furthermore, he patched POll and assigned an expected return value. Isn't that what I am doing here? I patched reverse? Thanks.

    Read the article

  • OperationalError: foreign key mismatch

    - by Niek de Klein
    I have two tables that I'm filling, 'msrun' and 'feature'. 'feature' has a foreign key pointing to the 'msrun_name' column of the 'msrun' table. Inserting in the tables works fine. But when I try to delete from the 'feature' table I get the following error: pysqlite2.dbapi2.OperationalError: foreign key mismatch From the rules of foreign keys in the manual of SQLite: - The parent table does not exist, or - The parent key columns named in the foreign key constraint do not exist, or - The parent key columns named in the foreign key constraint are not the primary key of the parent table and are not subject to a unique constraint using collating sequence specified in the CREATE TABLE, or - The child table references the primary key of the parent without specifying the primary key columns and the number of primary key columns in the parent do not match the number of child key columns. I can see nothing that I'm violating. My create tables look like this: DROP TABLE IF EXISTS `msrun`; -- ----------------------------------------------------- -- Table `msrun` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `msrun` ( `msrun_name` VARCHAR(40) PRIMARY KEY NOT NULL , `description` VARCHAR(500) NOT NULL ); DROP TABLE IF EXISTS `feature`; -- ----------------------------------------------------- -- Table `feature` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `feature` ( `feature_id` VARCHAR(40) PRIMARY KEY NOT NULL , `intensity` DOUBLE NOT NULL , `overallquality` DOUBLE NOT NULL , `charge` INT NOT NULL , `content` VARCHAR(45) NOT NULL , `msrun_msrun_name` VARCHAR(40) NOT NULL , CONSTRAINT `fk_feature_msrun1` FOREIGN KEY (`msrun_msrun_name` ) REFERENCES `msrun` (`msrun_name` ) ON DELETE NO ACTION ON UPDATE NO ACTION); CREATE UNIQUE INDEX `id_UNIQUE` ON `feature` (`feature_id` ASC); CREATE INDEX `fk_feature_msrun1` ON `feature` (`msrun_msrun_name` ASC); As far as I can see the parent table exists, the foreign key is pointing to the right parent key, the parent key is a primary key and the foreign key specifies the primary key column. The script that produces the error: from pysqlite2 import dbapi2 as sqlite import parseFeatureXML connection = sqlite.connect('example.db') cursor = connection.cursor() cursor.execute("PRAGMA foreign_keys=ON") inputValues = ('example', 'description') cursor.execute("INSERT INTO `msrun` VALUES(?, ?)", inputValues) featureXML = parseFeatureXML.Reader('../example_scripts/example_files/input/featureXML_example.featureXML') for feature in featureXML.getSimpleFeatureInfo(): inputValues = (featureXML['id'], featureXML['intensity'], featureXML['overallquality'], featureXML['charge'], featureXML['content'], 'example') # insert the values into msrun using ? for sql injection safety cursor.execute("INSERT INTO `feature` VALUES(?,?,?,?,?,?)", inputValues) connection.commit() for feature in featureXML.getSimpleFeatureInfo(): cursor.execute("DELETE FROM `feature` WHERE feature_id = ?", (str(featureXML['id']),))

    Read the article

  • fire jquery .animate oninput only once

    - by luke
    http://jsfiddle.net/nFFuD/ I'm trying to animate the search field in this example using jquery, making it move to the top of it's containing div oninput. I was originally using scriptaculous effect.move to do this, but I couldn't make the event only fire once, so if someone kept typing after the first keystroke, the effect would stop and start again from it's current position in the animation for each additional keystroke, which is stupid. I'm new to new to using jquery so please, take it easy if I'm not making very much sense.

    Read the article

  • Windows Mobile 6.5 GPS Device - WaitForMultipleObjects returns 258 (timeout)

    - by wizmagister
    I’ve created a GPS program that track positions in realtime in the background for Windows mobile 6.1 in 2008-2009. It ran fine on these devices for many years. For some reason, the same code never worked perfectly on Windows Mobile 6.5. After many hour of operations (mostly when nobody use the device), I receive a “Timeout” (code 258) from the function "WaitForMultipleObjects": this.GPSEvent_WaitValue = WaitForMultipleObjects(2, this.GPSEvent_Handles, 0, 45000); Again, this can work for hours and suddenly, it's just impossible to get another position without : UPDATE: - Restarting the device (GoogleMap confirms that there's no GPS device present!) It has something to do with Windows Mobile going to sleep and slowing up my thread. Here's the core code (adapted from Microsoft SDK Sample): /// <summary> /// When "WindowsMobile" wake up the program to check for a new position /// </summary> private void OnNextGPSEvent_Callback() { int SecondsToNextWakeUp = ETL.Mobile.Device.ScheduledCallback.MINIMUM_SECONDTONEXTWAKEUP; switch (this.SleepingState) { case SleepingStateType.SleepingForNextPosition: // Get position this.GPSEvent_WaitValue = (WaitForEventThreadResultType)WaitForMultipleObjects(2, this.GPSEvent_Handles, 0, 45000); switch (this.GPSEvent_WaitValue) { case WaitForEventThreadResultType.Event_LocationChanged: // Got a new position this.FireLocationChanged(this.GetCurrentPosition()); // Manage device shutdown (save battery) if (this.PositionFrequency > MIN_SECONDS_FREQUENCY_FORDEVICE_SHUTDOWN) { // Close device this.CloseDevice(); SecondsToNextWakeUp = (this.PositionFrequency - GPSDEVICE_LOAD_SECONDS_LOAD_TIME); this.SleepingState = SleepingStateType.SleepingBeforeDeviceWakeUp; } else { // Default Wait Time this.SleepingState = SleepingStateType.SleepingForNextPosition; } break; case WaitForEventThreadResultType.Event_StateChanged: break; case WaitForEventThreadResultType.Timeout: case WaitForEventThreadResultType.Failed: case WaitForEventThreadResultType.Stop: // >>>>>>>>>>>>>> This is where the error happens <<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>> This is where the error happens <<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>> This is where the error happens <<<<<<<<<<<<<<<<<<<<<<<<<<< // Too many errors this.ConsecutiveErrorReadingDevice++; if (this.ConsecutiveErrorReadingDevice > MAX_ERRORREADINGDEVICE) { this.CloseDevice(); SecondsToNextWakeUp = (this.PositionFrequency - GPSDEVICE_LOAD_SECONDS_LOAD_TIME); this.SleepingState = SleepingStateType.SleepingBeforeDeviceWakeUp; } else { // Default Wait Time this.SleepingState = SleepingStateType.SleepingForNextPosition; } break; } #endregion break; case SleepingStateType.SleepingBeforeDeviceWakeUp: this.OpenDevice(); SecondsToNextWakeUp = GPSDEVICE_LOAD_SECONDS_LOAD_TIME; this.SleepingState = SleepingStateType.SleepingForNextPosition; break; } if (this.IsListeningGPSEvent) { // Ajustement du prochain rappel this.NextGPSEvent_Callback.SecondToNextWakeUp = SecondsToNextWakeUp; this.NextGPSEvent_Callback.RequestWakeUpCallback(); } } /// <summary> ///Create Thread /// </summary> private void StartListeningThreadForGPSEvent() { // We only want to create the thread if we don't have one created already and we have opened the gps device if (this._GPSEventThread == null) { // Create and start thread to listen for GPS events this._GPSEventThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ListeningThreadForGPSEvent)); this._GPSEventThread.Start(); } } private void ListeningThreadForGPSEvent() { this.GPSEvent_WaitValue = WaitForEventThreadResultType.Stop; this.IsListeningGPSEvent = true; // Allocate handles worth of memory to pass to WaitForMultipleObjects this.GPSEvent_Handles = Helpers.LocalAlloc(12); Marshal.WriteInt32(this.GPSEvent_Handles, 0, this._StopHandle.ToInt32()); Marshal.WriteInt32(this.GPSEvent_Handles, 4, this._NewLocationHandle.ToInt32()); Marshal.WriteInt32(this.GPSEvent_Handles, 8, this._GPSDeviceStateChanged.ToInt32()); this.Start_NextGPSEvent_Timer(this.PositionFrequency); this.SleepingState = SleepingStateType.SleepingBeforeDeviceWakeUp; this.OnNextGPSEvent_Callback(); }

    Read the article

  • OpenID authentication error

    - by Raindog
    When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click "continue" meaning that i want to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field: Unable to log in with your OpenID provider: failed to authenticate, returning Failed. Please ensure your identifier is correct and try again.

    Read the article

  • SSRS Dynamic Returning Dataset Collection Field in Expression

    - by Ray Clark
    I wrote a custom assembly to take a parameter value from the report and return a field from the dataset collection. My assembly returns the correct fields!name.value, but it shows me the string representation of it. How can I get it to resolve as the actual fields!name.value to display the actual data in the dataset? If I enter fields!name.value in manually it works fine showing me the value. If I resolve it with my custom code it display "fields!name.value" to me in the cell.

    Read the article

  • Jquery adding events

    - by JBone
    I want to add an event handler to some dynamically added elements. I simplified my problem into the basic code below. I am using the new JQuery 1.7 on feature to say "hey for all labels in the CancelSurvey id element call this notify function when they are clicked." function notify(event) { console.log(event.data.name); } $('#CancelSurvey').on('click', 'label', { name: $(this).attr("id") }, notify); I want to pass the id of the label as parameter "name". When I try to alert this it is undefined (they are defined in the html created). I believe that using the $(this) is not referencing the label selector in this case. It actually seems to be referencing the document itself. Any ideas on how to accomplish this?

    Read the article

  • using JMock to write unit test for a simple spring JDBC DAO

    - by Quincy
    I'm writing an unit test for spring jdbc dao. The method to test is: public long getALong() { return simpleJdbcTemplate.queryForObject("sql query here", new RowMapper<Long>() { public Long mapRow(ResultSet resultSet, int i) throws SQLException { return resultSet.getLong("a_long"); } }); } Here is what I have in the test: public void testGetALong() throws Exception { final Long result = 1000L; context.checking(new Expectations() {{ oneOf(simpleJdbcTemplate).queryForObject("sql_query", new RowMapper<Long>() { public Long mapRow(ResultSet resultSet, int i) throws SQLException { return resultSet.getLong("a_long"); } }); will(returnValue(result)); }}); Long seq = dao.getALong(); context.assertIsSatisfied(); assertEquals(seq, result); } Naturally, the test doesn't work (otherwise, I wouldn't be asking this question here). The problem is the rowmapper in the test is different from the rowmapper in the DAO. So the expectation is not met. I tried to put with around the sql query and with(any(RowMapper.class)) for the rowmapper. It wouldn't work either, complains about "not all parameters were given explicit matchers: either all parameters must be specified by matchers or all must be specified by values, you cannot mix matchers and values"

    Read the article

  • What happens when Npgsql connection pool reaches Max

    - by ClearCarbon
    Both the name of the connection string parameter and this blog post - http://fxjr.blogspot.co.uk/2010/04/npgsql-connection-pool-explained.html - lead me to believe that Npgsql wont exceed the MaxPoolSize value set in the connection string. However the docs (http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) say "Max size of connection pool. Pooled connections will be disposed of when returned to the pool if the pool contains more than this number of connections. Default: 20" This suggests that the pool can actually grow larger than MaxPoolSize and it is in fact just a level at which Npgsql starts to aggressively remove connections from the pool as soon as they are returned. I've been searching to try and find an answer but I can find out exactly what happens when you reach MaxPoolSize. Anyone else know? edit: I should add we are using Npgsql 2.0.6.0 due to another dependency being supported only up to that version.

    Read the article

  • SQL - Updating records based on most recent date

    - by Remnant
    I am having difficulty updating records within a database based on the most recent date and am looking for some guidance. By the way, I am new to SQL. As background, I have a windows forms application with SQL Express and am using ADO.NET to interact with the database. The application is designed to enable the user to track employee attendance on various courses that must be attended on a periodic basis (e.g. every 6 months, every year etc.). For example, they can pull back data to see the last time employees attended a given course and also update attendance dates if an employee has recently completed a course. I have three data tables: EmployeeDetailsTable - simple list of employees names, email address etc., each with unique ID CourseDetailsTable - simple list of courses, each with unique ID (e.g. 1, 2, 3 etc.) AttendanceRecordsTable - has 3 columns { EmployeeID, CourseID, AttendanceDate, Comments } For any given course, an employee will have an attendance history i.e. if the course needs to be attended each year then they will have one record for as many years as they have been at the company. What I want to be able to do is to update the 'Comments' field for a given employee and given course based on the most recent attendance date. What is the 'correct' SQL syntax for this? I have tried many things (like below) but cannot get it to work: UPDATE AttendanceRecordsTable SET Comments = @Comments WHERE AttendanceRecordsTable.EmployeeID = (SELECT EmployeeDetailsTable.EmployeeID FROM EmployeeDetailsTable WHERE (EmployeeDetailsTable.LastName =@ParameterLastName AND EmployeeDetailsTable.FirstName =@ParameterFirstName) AND AttendanceRecordsTable.CourseID = (SELECT CourseDetailsTable.CourseID FROM CourseDetailsTable WHERE CourseDetailsTable.CourseName =@CourseName)) GROUP BY MAX(AttendanceRecordsTable.LastDate) After much googling, I discovered that MAX is an aggregate function and so I need to use GROUP BY. I have also tried using the HAVING keyword but without success. Can anybody point me in the right direction? What is the 'conventional' syntax to update a database record based on the most recent date?

    Read the article

  • how can i use gwt-test-utils to work with gin?

    - by krrish
    i tried using the steps in http://code.google.com/p/gwt-test-utils/wiki/HowToUseWithGIN and i'm using testNG but it is giving fallowing error java.lang.ExceptionInInitializerError at com.riskfocus.examples.JsonReaderWriterTest.setupGIN(JsonReaderWriterTest.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107) at org.testng.TestRunner.privateRun(TestRunner.java:768) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185) at org.testng.TestNG.runSuitesLocally(TestNG.java:1110) at org.testng.TestNG.run(TestNG.java:1022) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173) Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor. at com.google.gwt.core.client.GWT.create(GWT.java:91) at com.riskfocus.examples.client.model.StockPriceJsonReaderWriter.<clinit>(StockPriceJsonReaderWriter.java:12) ... 25 more

    Read the article

  • ORDER BY giving wrong order

    - by Cody Dull
    I have an SQL statement in my C# program that looks like: SELECT * FROM XXX.dbo.XXX WHERE Source = 'OH' AND partnum = '1231202085' ORDER BY partnum, Packaging, Quantity When running this query in SQL Server Management, the results are ordered as expected. My first 3 results have the same partnum and Packaging with Quantities of 32.0, 50.8, and 51.0. However, when I run the query from my program, the result set with quantity 50.8 is the first to be returned. The datatype of Quantity is decimal(18,9). I've tried cast, it doesn't appear to be a datatype problem. I cant figure out why its getting the middle quantity.

    Read the article

  • How to open email by x-gm-msgid in Gmail with Javascript

    - by Rui J
    I'm writing an extension which surfaces links to gmail messages. As the UI loads right in Gmail, I should be able to click on one of these links and have Gmail load it (without refreshing). I have "x-gm-msgid" available and theoretically, I should just be able to navigate to "https://mail.google.com/mail/u/0/#inbox/[x-gm-msgid]". I've tried using location.hash = "#inbox/[x-gm-msgid]" I've tried using history.pushState(null, null, "/mail/u/0/#inbox/[x-gm-msgid]") Neither of which works. Gmail just thwarts any attempt to change the URL (unless it is done via user interaction) Any thoughts on how to get around this restriction?

    Read the article

  • GLKit Memory Leak copywithZone

    - by TommyT39
    Running the instruments utility against the game I'm writing shows a bunch of memory leaks related to copy with Zone when I cycle through an array and draw some simple cube objects. Im not sure the best way to track this down as I'm new to OpenGL programming. My program is using ARC and is set to build for IOS 5. I am initializing GLKit to use OPenGl 2.0 and using the BafeEffect so I don't have to write my own shaders etc.. This shouldn't be rocket science. Im guessing that I must be not releasing something within the draw function. Below is the code to my draw function. Could you guys take a look and see if anything stands out as the problem? One other thing to note is that I'm using 15 different textures, the cubes can be 1 of 15 different ones. I have a property set on the cube class for the texture and I set it as I create the cube in there array. But I do load all 15 when my programs view did load starts.They are small .jps files that are less than 75k each and each cube uses the same texture all the way around so shouldn't be too big of an issue. Here is the code to my draw function: - (void)draw { GLKMatrix4 xRotationMatrix = GLKMatrix4MakeXRotation(rotation.x); GLKMatrix4 yRotationMatrix = GLKMatrix4MakeYRotation(rotation.y); GLKMatrix4 zRotationMatrix = GLKMatrix4MakeZRotation(rotation.z); GLKMatrix4 scaleMatrix = GLKMatrix4MakeScale(scale.x, scale.y, scale.z); GLKMatrix4 translateMatrix = GLKMatrix4MakeTranslation(position.x, position.y, position.z); GLKMatrix4 modelMatrix = GLKMatrix4Multiply(translateMatrix,GLKMatrix4Multiply(scaleMatrix,GLKMatrix4Multiply(zRotationMatrix, GLKMatrix4Multiply(yRotationMatrix, xRotationMatrix)))); GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 1, 0, 0, -5, 0, 1, 0); effect.transform.modelviewMatrix = GLKMatrix4Multiply(viewMatrix, modelMatrix); effect.transform.projectionMatrix = GLKMatrix4MakePerspective(0.125*M_TAU, 1.0, 2, 0); effect.texture2d0.name = wallTexture.name; [effect prepareToDraw]; glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnableVertexAttribArray(GLKVertexAttribPosition); glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, triangleVertices); glEnableVertexAttribArray(GLKVertexAttribTexCoord0); glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinates); glDrawArrays(GL_TRIANGLES, 0, 18); glDisableVertexAttribArray(GLKVertexAttribPosition); glDisableVertexAttribArray(GLKVertexAttribTexCoord0); }

    Read the article

  • iPodMusicPlayer playbackState inaccurate after odd conditions

    - by Shane Costello
    I have a simple music player app that runs into a really weird problem. First of all, while playing music and in the locked state, I allow the user to double click the Home button and use the locked iPod music controls. I did notice however that while in the locked state, my app doesn't receive any of its registered notifications. For the most part, this is fine anyway. But, if the user is playing music for at least 15 minutes (I'm not sure why but any less and this problem doesn't occur) while in the locked state, and using some kind of headphone or aux jack, then unplugs the headphone/aux jack while the device is still playing music, the iPodMusicPlayer will auto-pause. Which is exactly what I would want it to do, but after this happens, when the user unlocks their device and gives focus to the app again, the iPodMusicPlayer's playbackState is inaccurate. - (IBAction)playPause:(id)sender { if ([musicPlayer playbackState] == MPMusicPlaybackStatePlaying) { [musicPlayer pause]; } else { [musicPlayer play]; } } where musicPlayer = [MPMusicPlayerController iPodMusicPlayer]. Under normal circumstances, this runs perfectly fine. But after these conditions, my breakpoint will hit the condition for MPMusicPlaybackStatePlaying while the music is paused, and vice versa. The only way I've been able to fix this is to either make a new selection of music or to terminate the app and reopen. I've tried tons of a workarounds to fix this problem programmatically, but nothing turns out a 100% bug free fix. Does anyone have any clue as to why this happens in the first place?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >