Daily Archives

Articles indexed Tuesday December 4 2012

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Path Modifier in Tower Of Defense Game

    - by Siddharth
    I implemented PathModifier for path of each enemy in my tower of defense game. So I applied fixed time to path modifier in that enemy complete their path. Like following code describe. new PathModifier(speed, path); Here speed define the time to complete the path. But in tower of defense game my problem is, there is a tower which slow down the movement of the enemy. In that particular situation I was stuck. please someone provide me some guidance what to do in this situation. EDIT : Path path = new Path(wayPointList.size()); for (int j = 0; j < wayPointList.size(); j++) { Point point = grid.getCellPoint(wayPointList.get(j).getRow(), wayPointList.get(j).getCol()); path.to(point.x, point.y); }

    Read the article

  • Architectural advice - websockets javascript/php integration

    - by Ewan Vaentine
    Myself and a friend have started making a game, he's likely to be using impact.js for the user interaction etc, but we need multiplayer functionality so some form of websockets for TCP connections etc. So we were thinking impact.js into socket.io and node.js. However, user accounts, ecommerce, session handling and social media integration will all be handled with Codeigniter (PHP), my question is, is it wise to have node.js running in parallel with Codeigniter, or if this is even possible? If not, if you were to create a multiplayer online game utilising ecomms to buy credits and user accounts, how would you go about this from a structural position and what engines/frameworks would you recommend? I'm new to this site so I apologise in advance if I'm posting something inappropriate. Cheers, Ewan

    Read the article

  • Calculating Delta time , what is wrong?

    - by SteveL
    For 2 days now i am trying to calculate the correct delta time for my game , I am starting to getting crazy since i tried all the solutions that i found on the 5 first google pages... What is wrong? I cant get the correct delta time ,whatever i tried is just not working , the delta goes from 1 to 4 and then back 1 and then to 3 even if i take the averange delta between many frames.Plus the game runs way much faster(i mean the movement) on slow devices than in fast. The game runs on android so the spikes between frames are expected. My code is this: void Game::render() { timesincestart=getTimeMil(); _director->Render(); _director->Update(); float dif=(getTimeMil()-timesincestart);//usally its about 5 milliseconds lastcheck++; sumdelta+=dif; if(lastcheck>20) { sumdelta=sumdelta/20; delta=sumdelta; sumdelta=0; lastcheck=0; } LOGI("delta:%f",delta); }

    Read the article

  • How to Fix “Error occurred in deployment step ‘Activate Features’: System.TimeoutException:”

    - by ybbest
    Problem: When deploying a SharePoint2013 workflow using Visual Studio, I got the following Error: Error occurred in deployment step ‘Activate Features’: System.TimeoutException: The HTTP request has timed out after 20000 milliseconds. —> System.Net.WebException: The request was aborted: The request was canceled. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.OnGotResponse(IAsyncResult result) — End of inner exception stack trace — at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.Workflow.Client.Ht Analysis: After reading AC’s blogpost and I find out the issue is to do with the service bus. Then I found out the following services are not started Solution: So I start the Service Bus Gateway and Service Bus Message Broker and the problem goes away. References: SharePoint 2013 Workflow – Advanced Workflow Debugging with Fiddler

    Read the article

  • Google Play Distributing to Phones only

    - by Bororo
    I read the guide Distributing to Specific Screens and i tried both <compatible-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true"/> and <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true"/> even combined (iknow... i know... :D) But i can't seem to be able to limit my app from showing up in searches from my tablet (and of course it also installs) The reverse setting works though.. <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true"/> my phone appears incompatible with the tablet version of the APK. What gives? is there something i'm not getting in the way that Google play filters using the Manifest?

    Read the article

  • Jquery (non-gem) plugin won't work in my rails 3.2 app

    - by jfdimark
    I'm trying to equalize columns in my rails 3.2 app, and while there may be a better way to do it then my current attempt, after hours of trying to make it work I'd like to see if anyone can point out specifically why this jQuery plugin (which isn't a gem) is not working. I'm not getting any errors in the developer console, so it's hard to pin point. Here's the relevant code: The index view, where I've followed the plugin's instructions: div id="column-group"> <div class="equalize span5 offset1 UserProfile"> <% if user_signed_in? %> <h3>Hello <%= current_user.name %>!</h3> </div> <div class="equalize span5 MemberDisplay"> My application.js file, where I've also included the specific js code, so it would definitely be picked up by the application: //= require jquery //= require jquery_ujs //= require bootstrap //= require equalize_column_heights //= require_tree . $(document).ready(function() { $("#column-group").equalize_column_heights("equalize"); }); The jQuery plugin code, which is saved in my vendor/assets/javascripts folder: (function ($) { $.fn.equalize_column_heights = function (equalize_class) { var tallest_column=0; parent_id = "column-group" + $(this).attr("id") + " ." + equalize_class; $(parent_id).each(function(index, value) { if (tallest_column < $(this).height()){ tallest_column = $(this).height(); } }); $(parent_id).each(function(index, value) { $(this).css({'min-height': tallest_column}); }); } }(jQuery)); I've read all the rails guides documentation on the asset pipeline and all the relevant jQuery-rails3 questions on SO, but after several hours, I just can't seem to figure this one out. If anyone can point to other tutorials on how to get non-gem jQuery plugins to work in a Rails 3.2 app then I'd be glad to take a look!

    Read the article

  • Ruby on Rails DataTable now working.

    - by Nimroo
    [Ruby on Rails DataTable guide][1]https://github.com/phronos/rails_datatables/blob/master/README.md I"m following the above and have installed the git plugin as well. All i'm getting is the <%= datatable() % returning " <script type="text/javascript"> $(function() { $('#expenses').dataTable({ "oLanguage": { "sSearch": "Search", "sProcessing": 'Processing' }, "sPaginationType": "full_numbers", "iDisplayLength": 25, "bProcessing": true, "bServerSide": false, "bLengthChange": false, "bStateSave": true, "bFilter": true, "bAutoWidth": true, 'aaSorting': [[0, 'desc']], "aoColumns": [ { 'sType': 'html', 'bSortable':true, 'bSearchable':true ,'sClass':'first' },{ 'sType': 'html', 'bSortable':true, 'bSearchable':true },{ 'sType': 'html', 'bSortable':true, 'bSearchable':true },{ 'sType': 'string', 'bSortable':true, 'bSearchable':true ,'sClass':'last' } ], "fnServerData": function ( sSource, aoData, fnCallback ) { aoData.push( ); $.getJSON( sSource, aoData, function (json) { fnCallback(json); } ); } }); }); </script>". My .html.erb looks like this: <% @page_title="User Page"%> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <%=javascript_include_tag "jquery.dataTables" %> <%=stylesheet_link_tag "jquery-ui-1.9.2.custom" %> <script> $(function() { $( "#tabs" ).tabs(); }); </script> <% if current_user %> <div id="tabs"> <ul> <li><a href="#tabs-1">Expenses</a></li> <li><a href="#tabs-2">Accountant</a></li> <li><a href="#tabs-3">Requests (<%[email protected]%>)</a></li> </ul> <div id="tabs-3"> <p> <% if @requests.count != 0 %> <h2> Accountant Requests </h2> <table > <tr> <thead> <th>First Name</th> <th>Last Name</th> <th>Email Address</th> <th>Accept</th> <th>Reject</th> </thead> </tr> <% @requests.each do |request| %> <tr> <td><%= request.accountant.first_name %></td> <td><%= request.accountant.last_name %></td> <td><%= request.accountant.email %></td> <td><%= link_to 'accept', confirm_accountant_path(:accountant_id => request.accountant_id) %></td> <td><%= link_to 'Edit', edit_expense_path(request) %></td> </tr> <% end %> </tbody> </table> <% else %> <h4> You have no pending requests <h4> <% end %> </p> </div> <div id="tabs-2"> <p> <% if @accountants.count != 0 %> <h2> Accountant Info </h2> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Email Address</th> </tr> <% @accountants.each do |accountant| %> <tr> <td><%= accountant.first_name %></td> <td><%= accountant.last_name %></td> <td><%= accountant.email %></td> </tr> <% end %> </table> <% else %> <h4> Add Accountant <h4> <p> You don't have an accountant yet, perhaps consider adding one by e-mail </p> <%= render 'add_accountant_form' %> <% end %> <% end %> </p> </div> <div id="tabs-1"> <p><% if current_user %> <h4> Submit new expense </h4> <%= render 'expenses/form' %> <% columns = [{:type => 'html', :class => "first"}, {:type => 'html'}, {:type => 'html'}, {:type => nil, :class => "last"}] %> <%= datatable(columns, {:sort_by => "[0, 'desc']", table_dom_id:"expenses" }) %> <table id="expenses" class="datatable"> <thead> <tr> <th>Entry Date</th> <th>Last Update</th> <th>Amount</th> <th>User</th> <th>Receipt</th> <th></th> <th></th> </tr> </thead> <% @expenses.each do |user_expense| %> <tbody> <tr> <td><%= user_expense.created_at %></td> <td><%= user_expense.updated_at %></td> <td><%= user_expense.amount %></td> <td><%= user_expense.user.username %></td> <% if !user_expense.receipt_img.nil? %> <td><%= image_tag user_expense.receipt_img.url(:thumb) %></td> <% else %> <td>Future Button Here</td> <% end %> <td><%= link_to 'Show', user_expense %></td> <td><%= link_to 'Edit', edit_expense_path(user_expense) %></td> </tr> </tbody> <% end %> </table> <% end %></p> </div> </div>

    Read the article

  • PHP and XPath Loop

    - by user1794852
    Thank you all in advance. I've got some great answers to my sometimes stupid questions, so thank you again. I'm trying to parse a SOAP response using PHP, Xpath (namespaces) and SimpleXML. Down below is a snippet of the Response. What I need to do is loop through each <ns1:file></ns1:file> and add it to a DB. But I'm not sure how to do that. Please help! Namespace Stuff $x = simplexml_load_string($response); $x->registerXPathNamespace('ns1', 'http://ws.icontent.idefense.com/V3/2'); Here's the response: <ns1:mal_files> <ns1:file> <ns1:id>2895144</ns1:id> <ns1:md5>2189c3d3857ba0cabd19c8aa031d63cd</ns1:md5> <ns1:sha1>c20b26148caa059ecf85e9b29df4e28e8354d655</ns1:sha1> <ns1:path>%WINDIR%\Temp\Temporary Internet Files\Content.IE5\K9ANOPQB\1219831[1].htm</ns1:path> <ns1:size>110</ns1:size> <ns1:code_available>true</ns1:code_available> <ns1:len_char>fixed</ns1:len_char> </ns1:file> <ns1:file> <ns1:id>2895147</ns1:id> <ns1:md5>a533825ef1752630a300125b3eef6825</ns1:md5> <ns1:sha1>ec7feb1414b3c2e720f6c06e2750421b73634f87</ns1:sha1> <ns1:path>%WINDIR%\Temp\Temporary Internet Files\Content.IE5\4PMB8T67\bg[1].jpg</ns1:path> <ns1:size>707</ns1:size> <ns1:code_available>true</ns1:code_available> <ns1:len_char>fixed</ns1:len_char> </ns1:file> <ns1:file> <ns1:id>2895155</ns1:id> <ns1:md5>c88724e985efcc82173c0d3aa0b77dfd</ns1:md5> <ns1:sha1>ecc042ca06aac988cd4593bb2b25fa39c4b2a819</ns1:sha1> <ns1:path>%WINDIR%\Prefetch\24604775.EXE-3ADEC0C2.pf</ns1:path> <ns1:size>44940</ns1:size> <ns1:code_available>true</ns1:code_available> <ns1:len_char>fixed</ns1:len_char> </ns1:file> <ns1:file> <ns1:id>2895158</ns1:id> <ns1:md5>422a011793af6195ea517c2c4a26bdbc</ns1:md5> <ns1:sha1>f449240c091c27e2531342d6b291d6a7e4655834</ns1:sha1> <ns1:path>%WINDIR%\Temp\Temporary Internet Files\Content.IE5\KPYV0TM7\gamesleap[1].png</ns1:path> <ns1:size>2676</ns1:size> <ns1:code_available>true</ns1:code_available> <ns1:len_char>fixed</ns1:len_char> </ns1:file> </ns1:mal_files> PHP Code $md5 = $x->xpath('//ns1:mal_files/ns1:file/ns1:md5'); // Returns array :( The PHP code returns an Array of all MD5 for every <ns1:file></ns1:file> and that's not what I need. What I need is to loop through each of the (nodes?) for each of the <ns1:file> keying on the <ns1:id> and add all their associated elements (id, md5, sha1, etc) as a record, then move onto the next <ns1:file> and repeat. And obviously the PHP I'm using returns an array, which doesn't work here. Hopefully I've made my question clear... I appreciate any help. Thanks!

    Read the article

  • Does SELECT COUNT(*) work with MySQLi prepared statements?

    - by wordman
    I'm working on a test page and am using MySQLi prepared statements in my queries after reading they make my code safe from SQL injection. I have been successful with prepared statements so far with retrieving data from my DB, that all works great. What I want to do now is count the number of galleries within a project using SELECT COUNT(*). That's it. Without using a prepared statement, my old query looked like this: // count number of galleries per project $conn = dbConnect('query'); $galNumb = "SELECT COUNT(*) FROM pj_galleries WHERE project = {$pjInfo['pj_id']}"; $gNumb = $conn->query($galNumb); $row = $gNumb->fetch_row(); $galTotal = $row[0]; But for all my reading and searching the internet, I can not find out the proper way to write this as a prepared statement. I'm no PHP whiz here, and not coding daily isn't helping my skills. If I've missed anything please ask. Many thanks!

    Read the article

  • How to use custom front at SimpleCursorAdapter for a list view at Searchable Dictionary App??? please help me

    - by user1877275
    I am new in android. this is my frist project.I am tring to make a Name dictionary in bangla so i need to change the front. I already add front into the asset folder.. private void showResults(String query) { Cursor cursor = managedQuery(DictionaryProvider.CONTENT_URI, null, null, new String[] {query}, null); if (cursor == null) { // There are no results mTextView.setText(getString(R.string.no_results, new Object[] {query})); } else { // Display the number of results int count = cursor.getCount(); String countString = getResources().getQuantityString(R.plurals.search_results,count, new Object[] {count, query}); mTextView.setText(countString); // Specify the columns we want to display in the result String[] from = new String[] { DictionaryDatabase.KEY_WORD, DictionaryDatabase.KEY_DEFINITION }; // Specify the corresponding layout elements where we want the columns to go int[] to = new int[] { R.id.word, R.id.definition }; // Create a simple cursor adapter for the definitions and apply them to the ListView SimpleCursorAdapter words = new SimpleCursorAdapter(this, R.layout.result, cursor, from, to); mListView.getAdapter(); // Define the on-click listener for the list items mListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Build the Intent used to open WordActivity with a specific word Uri Intent wordIntent = new Intent(getApplicationContext(), WordActivity.class); Uri data = Uri.withAppendedPath(DictionaryProvider.CONTENT_URI, String.valueOf(id)); wordIntent.setData(data); startActivity(wordIntent); } }); } }

    Read the article

  • Segmentation fault on instationation of more than 1 object

    - by ECE
    I have a class called "Vertex.hpp" which is as follows: #include <iostream> #include "Edge.hpp" #include <vector> using namespace std; /** A class, instances of which are nodes in an HCTree. */ class Vertex { public: Vertex(char * str){ *name=*str; } vector<Vertex*> adjecency_list; vector<Edge*> edge_weights; char *name; }; #endif When I instantiate an object of type Vector as follows: Vertex *first_read; Vertex *second_read; in.getline(input,256); str=strtok(input," "); first_read->name=str; str=strtok(NULL, " "); second_read->name=str; A segmentation fault occurs when more than 1 object of type Vector is instantiated. Why would this occur if more than 1 object is instantiated, and how can i allow multiple objects to be instantiated?

    Read the article

  • increase ssh timeout

    - by cerr
    I'm trying to connect to a mobile host connected over a 3G cell router from linux with ssh [email protected] -p 2200 and all I immediately get is (doesn't even seem to run into a timeout) ssh: connect to host 74.198.25.220 port 2200: Network is unreachable However, when I try the same IP on port 2200 with putty on Windows, it presents my with the password prompt just fine as I'd expect. What's going on here, do I need to increment my ssh timeout period to get this going or what? Thank you, Ron

    Read the article

  • sql server - bulk insert error

    - by user554134
    I am using bulk insert and getting below error: Note: The data in the load file is not beyong the configured column length Running Command: bulk insert load_data from 'C:\temp\dataload\load_file.txt' with (firstrow = 1, fieldterminator = '0x09', rowterminator = '\n',MAXERRORS = 0, ERRORFILE = 'C:\temp\dataload\load_file') Contents of load file: user_name file_path asset_owner city import_date admin C:\ admin toronto 04/12/2012 Error: Msg 4863, Level 16, State 1, Line 1 Bulk load data conversion error (truncation) for row 1, column 6 (validated). Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7330, Level 16, State 2, Line 1 Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

    Read the article

  • CSS3 Hover transition strange behavior

    - by Aleksandar Ivanov
    So I was playing around with transition/hover effects so that's the code. <pre> <code> /* HTML */ section> a href="#" title="button">CLICK!</a> // deleted the lt sign for visibility reasons! a href="#" title="button">CLICK!</a> a href="#" title="button">CLICK!</a> a href="#" title="button">CLICK!</a> /section> /********/ /* CSS */ section{ width: 700px; height: 500px; margin: 250px auto; position: relative; background: #08c; } section a{ border-radius: 51px; background: #e60; line-height: 100px; text-align: center; color: #04e; font-size: 24px; font-weight: bold; font-family: tahoma; text-decoration: none; display: block; width: 100px; height: 100px; } section a:nth-child(1){ position: absolute; top: -100px; left: -100px; -webkit-transition: left 2s ease; } section a:nth-child(2){ position: absolute; top: -100px; right: -100px; -webkit-transition: top 2s ease; } section a:nth-child(3){ position: absolute; bottom: -100px; right: -100px; -webkit-transition: right 2s ease; } section a:nth-child(4){ position: absolute; bottom: -100px; left: -100px; -webkit-transition: bottom 2s ease; } section a:nth-child(1):hover,section a:nth-child(1):focus{ left: 800px; } section a:nth-child(2):hover{ top: 600px; } section a:nth-child(3):hover{ right: 800px; } section a:nth-child(4):hover{ bottom: 600px; } /*******/ </code> </pre> BUT, I stumbled upon a strange thing. When I hover over a link its starts getting to its right position applied by the hover, but at some point (always different) the effect stops and it gets back to its original position! Have anyone seen this and know what is the problem ?

    Read the article

  • Invoke a subclass method of an anonymous class

    - by arjacsoh
    I am trying right now to dig into anonymous classes and one question was just arised I 'd prefer not to refer to much details and to pose my question straightforward: How can I invoke the method sizzle() in the following anonymous class: public class Popcorn { public void pop() { System.out.println("popcorn"); } } class Food { Popcorn p = new Popcorn() { public void sizzle() { System.out.println("anonymous sizzling popcorn"); } public void pop() { System.out.println("anonymous popcorn"); } }; public void popIt() { p.pop(); // OK, Popcorn has a pop() method p.sizzle(); // Not Legal! Popcorn does not have sizzle() } } It is known and definite in polymorphism rules that a refernce of a superclass cannot invoke methods of subclass without downcasting (even if it refers to an object of the given subclass). However in the above case what is the "key" to invoke the sizzle() method?

    Read the article

  • JAVA-SQL- Data Migration - ResultSets comparing Failing JUnit test

    - by user1865053
    I CANNOT get this JUnit Test to pass for the life of me. Can somebody point out where this has gone wrong. I am doing a data migration(MSSQL SERVER 2005), but I have the sourceDBUrl and the targetDCUrl the same URL so to narrow it down to syntax errors. So that is what I have, a syntax error. I am comparing the results of a table for the query SELECT programmeapproval, resourceapproval FROM tr_timesheet WHERE timesheetid = ? and the test always fails, but passes for other junit tests I have developed. I created 3 diffemt resultSetsEqual methods and none work. Yet, some other JUnit tests I have developed have PASSED. THE QUERY: SELECT timesheetid, programmeapproval, resourceapproval FROM tr_timesheet Returns three columns timesheetid (PK,int, not null) (populated with a range of numbers 2240 - 2282) programmeapproval (smallint,not null) (populated with the number 1 in every field) resourceapproval (smallint, not null) (populated with a number 1 in every field) When I run the query that is embedded in the code it only returns one row with the programmeapproval and resourceapproval columns and both field populated with the number 1. I have all jdbc drivers correctly installed and tested for connectivity. The JUnit Test is failing at this point according to the IDE. assertTrue(helper.resultSetsEqual2(sourceVal,targetVal)); This is the code: /*THIS IS A JUNIT CLASS****? package a7.unittests.dao; import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Types; import org.junit.Test; import artemispm.tritonalerts.TimesheetAlert; public class UnitTestTimesheetAlert { @Test public void testQUERY_CHECKALERT() throws Exception{ UnitTestHelper helper = new UnitTestHelper(); Connection con = helper.getConnection(helper.sourceDBUrl); Connection conTarget = helper.getConnection(helper.targetDBUrl); PreparedStatement stmt = con.prepareStatement("select programmeapproval, resourceapproval from tr_timesheet where timesheetid = ?"); stmt.setInt(1, 2240); ResultSet sourceVal = stmt.executeQuery(); stmt = conTarget.prepareStatement("select programmeapproval, resourceapproval from tr_timesheet where timesheetid = ?"); stmt.setInt(1,2240); ResultSet targetVal = stmt.executeQuery(); assertTrue(helper.resultSetsEqual2(sourceVal,targetVal)); }} /*END**/ /*THIS IS A REGULAR CLASS**/ package a7.unittests.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class UnitTestHelper { static String sourceDBUrl = "jdbc:sqlserver://127.0.0.1:1433;databaseName=a7itm;user=a7user;password=a7user"; static String targetDBUrl = "jdbc:sqlserver://127.0.0.1:1433;databaseName=a7itm;user=a7user;password=a7user"; public Connection getConnection(String url)throws Exception{ return DriverManager.getConnection(url); } public boolean resultSetsEqual3 (ResultSet rs1, ResultSet rs2) throws SQLException { int col = 1; //ResultSetMetaData metadata = rs1.getMetaData(); //int count = metadata.getColumnCount(); while (rs1.next() && rs2.next()) { final Object res1 = rs1.getObject(col); final Object res2 = rs2.getObject(col); // Check values if (!res1.equals(res2)) { throw new RuntimeException(String.format("%s and %s aren't equal at common position %d", res1, res2, col)); } // rs1 and rs2 must reach last row in the same iteration if ((rs1.isLast() != rs2.isLast())) { throw new RuntimeException("The two ResultSets contains different number of columns!"); } } return true; } public boolean resultSetsEqual (ResultSet source, ResultSet target) throws SQLException{ while(source.next()) { target.next(); ResultSetMetaData metadata = source.getMetaData(); int count = metadata.getColumnCount(); for (int i =1; i<=count; i++) { if(source.getObject(i) != target.getObject(i)) { return false; } } } return true; } public boolean resultSetsEqual2 (ResultSet source, ResultSet target) throws SQLException{ while(source.next()) { target.next(); ResultSetMetaData metadata = source.getMetaData(); int count = metadata.getColumnCount(); for (int i =1; i<=count; i++) { if(source.getObject(i).equals(target.getObject(i))) { return false; } } } return true; } } /END***/ /*PASTED NEW CLASS - THIS IS A JUNIT TEST CLASS*/ package a7.unittests.dao; import static org.junit.Assert.*; import java.sql.Connection; import java.sql.DriverManager; import org.junit.Test; public class TestDatabaseConnection { @Test public void testConnection() throws Exception{ UnitTestHelper helper = new UnitTestHelper(); Connection con = helper.getConnection(helper.sourceDBUrl); Connection conTarget = helper.getConnection(helper.targetDBUrl); assertTrue(con != null && conTarget != null); } } /**END***/

    Read the article

  • A non-blocking server with java.io

    - by Jon
    Everybody knows that java IO is blocking, and java NIO is non-blocking. In IO you will have to use the thread per client pattern, in NIO you can use one thread for all clients. Now my question follows: is it possible to make a non-blocking design using only the Java IO api. (not NIO) I was thinking about a pattern like this (obviously very simplified); List<Socket> li; for (Socket s : li) { InputStream in = s.getInputStream(); byte[] data = in.available(); in.read(data); // processData(data); (decoding packets, encoding outgoing packets } Also note that the client will always be ready for reading data. What are your opinions on this? Will this be suitable for a server that should at least hold a few hundred of clients without major performance issues?

    Read the article

  • Ho to add dynamic table list to a Fullcalendar page

    - by Dave Burton
    I have implemented a Fullcalendar on a RoR page. I would like to add a list (index) below the calendar showing events for the day the user selects. Click on a day and that days events list below the calendar. I'd like it to be dynamic (don't reload the whole page). Please point me in the right direction to learn how to do this. I have a subscription to Railscast. But, I'm not sure what to look for. Thanks

    Read the article

  • instantiate python object within a c function called via ctypes

    - by gwk
    My embedded Python 3.3 program segfaults when I instantiate python objects from a c function called by ctypes. After setting up the interpreter, I can successfully instantiate a python Int (as well as a custom c extension type) from c main: #import <Python/Python.h> #define LOGPY(x) \ { fprintf(stderr, "%s: ", #x); PyObject_Print((PyObject*)(x), stderr, 0); fputc('\n', stderr); } // c function to be called from python script via ctypes. void instantiate() { PyObject* instance = PyObject_CallObject((PyObject*)&PyLong_Type, NULL); LOGPY(instance); } int main(int argc, char* argv[]) { Py_Initialize(); instantiate(); // works fine // run a script that calls instantiate() via ctypes. FILE* scriptFile = fopen("emb.py", "r"); if (!scriptFile) { fprintf(stderr, "ERROR: cannot open script file\n"); return 1; } PyRun_SimpleFileEx(scriptFile, scriptPath, 1); // close on completion return 0; } I then run a python script using PyRun_SimpleFileEx. It appears to run just fine, but when it calls instantiate() via ctypes, the program segfaults inside PyObject_CallObject: import ctypes as ct dy = ct.CDLL('./emb') dy.instantiate() # segfaults lldb output: instance: 0 Process 52068 stopped * thread #1: tid = 0x1c03, 0x000000010000d3f5 Python`PyObject_Call + 69, stop reason = EXC_BAD_ACCESS (code=1, address=0x18) frame #0: 0x000000010000d3f5 Python`PyObject_Call + 69 Python`PyObject_Call + 69: -> 0x10000d3f5: movl 24(%rax), %edx 0x10000d3f8: incl %edx 0x10000d3fa: movl %edx, 24(%rax) 0x10000d3fd: leaq 2069148(%rip), %rax ; _Py_CheckRecursionLimit (lldb) bt * thread #1: tid = 0x1c03, 0x000000010000d3f5 Python`PyObject_Call + 69, stop reason = EXC_BAD_ACCESS (code=1, address=0x18) frame #0: 0x000000010000d3f5 Python`PyObject_Call + 69 frame #1: 0x00000001000d5197 Python`PyEval_CallObjectWithKeywords + 87 frame #2: 0x0000000201100d8e emb`instantiate + 30 at emb.c:9 Why does the call to instantiate() fail from ctypes only? The function only crashes when it calls into the python lib, so perhaps some interpreter state is getting munged by the ctypes FFI call?

    Read the article

  • How to pass or display mySQL data based on subscription or billing

    - by spm
    I want to build a PHP based site where, the user can view data based on the types of data they've paid for. Allow me to use something simple for an example. Let's say historical data for basketball was not readily available but could be purchased. Simple information such as the Winner, Loser, Final score and date are all stored in a mySQL table. What would be involved so that, when the user logs in, they can only see the historical data they have paid for. My theories so far about the architecture: I imagined a mySQL table storing True or False values for all historical game data they have paid for. Based on this, a 'data chart' object enables the user to view all data within their mySQL row which has a value of 'true.' Follow ups: Assuming I am correct, what methods are popular or practical for this type of service.

    Read the article

  • Unable to install gem "pg" on Ubuntu 12.10 (AMD64)

    - by Lynx_Eyes
    I've been (unsuccessfully) trying to install the "pg" gem on my ruby 1.9.3-p286 but nothing seems to work. I've already installed postgresql (9.1), libpq-dev and a few others like postgresql-server-dev-9.1. I've tried to pass the "with-pg-config" flag to the gem install but simply nothing seems to work. Every time I try to install the gem it outputs something like this: Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/lynux/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config checking for libpq-fe.h... yes checking for libpq/libpq-fs.h... yes checking for pg_config_manual.h... yes checking for PQconnectdb() in -lpq... no checking for PQconnectdb() in -llibpq... no checking for PQconnectdb() in -lms/libpq... no Can't find the PostgreSQL client library (libpq) *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/lynux/.rvm/rubies/ruby-1.9.3-p286/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pqlib --without-pqlib --with-libpqlib --without-libpqlib --with-ms/libpqlib --without-ms/libpqlib Gem files will remain installed in /home/lynux/.rvm/gems/ruby-1.9.3-p286@phisiodata/gems/pg-0.14.1 for inspection. Results logged to /home/lynux/.rvm/gems/ruby-1.9.3-p286@phisiodata/gems/pg-0.14.1/ext/gem_make.out What am I doing wrong? Is there something else that I should do before trying to install the gem? Thank you in advance. [EDIT] Ok, so joelparkerhenderson's answer set me to think that there might me something wrong with paths and libraries and a went on digging a little bit further.. I've found this awesome post and it solved! Basically the problem lies with RVM. So, my problem is solved and for anyone out there that might suffer from the same thing, follow the link!

    Read the article

  • How to add multiple files to py2app?

    - by Niek de Klein
    I have a python script which makes a GUI. When a button 'Run' is pressed in this GUI it runs a function from an imported package (which I made) like this from predictmiP import predictor class MiPFrame(wx.Frame): [...] def runmiP(self, event): predictor.runPrediction(self.uploadProtInterestField.GetValue(), self.uploadAllProteinsField.GetValue(), self.uploadPfamTextField.GetValue(), \ self.edit_eval_all.Value, self.edit_eval_small.Value, self.saveOutputField) When I run the GUI directly from python it all works well and the program writes an output file. However, when I make it into an app, the GUI starts but when I press the button nothing happens. predictmiP does get included in build/bdist.macosx-10.3-fat/python2.7-standalone/app/collect/, like all the other imports I'm using (although it is empty, but that's the same as all the other imports I have). How can I get multiple python files, or an imported package to work with py2app?

    Read the article

  • 42000 Syntax error in query when executing prepared statement

    - by Griff McGriff
    I have been pulling my hair out trying to swap my current script over to PDO. I have simplified the MySQL query for this example, but the error remains even with this version. $sql = 'SELECT * FROM :table WHERE lastUpdate > :appDate'; try{ $db = connect(); $stmt = $db->prepare($sql); $stmt->bindParam(':table', $table); $stmt->bindParam(':appDate', $appDate); foreach($tablesToCheck as $table){ $stmt->execute(); $resultset[] = $stmt->fetchAll(); } } catch(PDOException $e){ print 'Error!: '.$e->getMessage().'<br/>'; }//End try catch $stmt-errorInfo() returns: ( [0] => 42000 [1] => 1064 [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GroupName' WHERE lastUpdate > NULL' at line 1 )

    Read the article

  • List of phones that will work with Eclipse?

    - by user1058647
    I need an android phone to test my apps with that will work with Eclipse. It has to be low cost, run Gingerbread with modest memory and CPU. Thinking that any android phone would work I recently purchased a Virgin Mobil Chaser but as it turns out, it cannot be seen by either Eclipse or adb (but device manager does see the phone). Another developer has also had the same identical problem with the Chaser. I could keep buying phones and see if they work but that could be long and frustrating. I hope to find a "no contract" phone. Is there any list of phones that work with Eclipse. Does anyone know of any other Virgin Mobil phones that will work? thanks, Gary

    Read the article

  • Objective-C FontAwesome

    - by sdover102
    I'm Attempting to get FontAwesome up and running on an iOS app and could use a little assistance. I have the following code for iOS: UIBarButtonItem * viewDeckButton = [[UIBarButtonItem alloc] initWithTitle:@"\uf0c9" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleLeftView)]; NSDictionary * customTextAttrs = [NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"FontAwesome" size:14.0], UITextAttributeFont, nil]; [viewDeckButton setTitleTextAttributes:customTextAttrs forState:UIControlStateNormal]; @"\uf0c9" corresponds to the css class, icon-reorder. The font appears to be installed on my system (see http://cl.ly/image/2F1x1z2H0i2N). I'm getting the standard box character, as if the font is not loaded (see http://madmonkdev.com/badchar.png). Any help would be appreciated.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >