Daily Archives

Articles indexed Saturday March 20 2010

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

  • Sliding Response after a Point-Square Collision

    - by mars
    In general terms and pseudo-code, what would be the best way to have a collision response of sliding along a wall if the wall is actually just a part of an entire square that a point is colliding into? The collision test method used is a test to see if the point lies in the square. Should I divide the square into four lines and just calculate the shortest distance to the line and then move the point back that distance?If so, then how can I determine which edge of the square the point is closest to after collision?

    Read the article

  • JAVA: POST data via HTTPS does not seem to get sent?

    - by ostollmann
    Hi guys (and girls), I have a problem POSTing data via HTTPS in Java. The server response is the same whether or not I send 'query'. Maybe someone can point out what the problem is... Thanks! Main class: package bind; public class Main { public static final String urlString = "https://www.sms.ethz.ch/cgi-bin/sms/send.pl"; public static void main(String[] args) { Message msg = new Message("Alles klar?"); URL url = new URL(urlString); String[][] values = new String[3][2]; values[0][0] = "action"; values[0][1] = "listoriginators"; values[1][0] = "username"; values[1][1] = "xxxxxx"; values[2][0] = "password"; values[2][1] = "xxxxxx"; Query query = new Query(values); System.out.println("Query: " + query.getQuery()); Request request = new Request(url.getURL(), query.getQuery()); } } Request class: package bind; public class Request { static private int ic = 0; private URL url; protected Request(java.net.URL URL, String query){ ic++; if(CONSTANTS.SHOW_LOGS) { System.out.println("log: new instance of 'Message'"); } // connect try { System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); javax.net.ssl.HttpsURLConnection connection = (javax.net.ssl.HttpsURLConnection) URL.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setRequestMethod("POST"); connection.setFollowRedirects(true); connection.setRequestProperty("Content-Length", String.valueOf(query.length())); connection.setRequestProperty("Content-Type", "application/x-www- form-urlencoded"); connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); java.io.DataOutputStream output = new java.io.DataOutputStream(connection.getOutputStream()); output.writeBytes(query); // <<-- NOTHING CHANGES IF I COMMENT THIS OUT OR NOT !!??!?! System.out.println("log: response code: " + connection.getResponseCode()); System.out.println("log: response message: " + connection.getResponseMessage()); java.io.DataInputStream input = new java.io.DataInputStream(connection.getInputStream()); for(int i = input.read(); i != -1; i = input.read()) { System.out.print((char)i); } System.out.print("\n"); input.close(); } catch(java.io.IOException e) { if(CONSTANTS.SHOW_LOGS) { System.out.println("error: unable to connect"); System.out.println(e); e.printStackTrace(); } } } } URL Class: public class URL { static private int ic = 0; private String URLString; private java.net.URL url; protected URL(String a_url){ ic++; if(CONSTANTS.SHOW_LOGS) { System.out.println("log: new instance of 'URL'"); } setURLString(a_url); createURL(); } private void setURLString(String a_url) { URLString = a_url; } private void createURL() { try { url = new java.net.URL(URLString); } catch(java.net.MalformedURLException e) { System.out.println("error: invalid URL"); System.out.println(e); e.printStackTrace(); } } private void showURL() { System.out.println("URL: " + url.getHost() + url.getPath()); } public java.net.URL getURL() { return url; } } PS: mostly from here: http://www.java-samples.com/java/POST-toHTTPS-url-free-java-sample-program.htm

    Read the article

  • Essential topics to be discussed in Linux 101

    - by zengr
    Hi, We are organizing a Linux 101 Workshop for undergrad and grad students. Can you share some ideas/topics that are must for people who are just starting with Linux. Preconditions: No knowledge of Linux OS, philosophy and technical aspects (kernel, shell, commands) Post conditions: A basic crash course of Linux which will give them a good start and answer some basic questions asked on it.

    Read the article

  • NHibernate with nothing but stored procedures

    - by ChrisB2010
    I'd like to have NHibernate call a stored procedure when ISession.Get is called to fetch an entity by its key instead of using dynamic SQL. We have been using NHibernate and allowing it to generate our SQL for queries and inserts/updates/deletes, but now may have to deploy our application to an environment that requires us to use stored procedures for all database access. We can use sql-insert, sql-update, and sql-delete in our .hbm.xml mapping files for inserts/updates/deletes. Our hql and criteria queries will have to be replaced with stored procedure calls. However, I have not figured out how to force NHibernate to use a custom stored procedure to fetch an entity by its key. I still want to be able to call ISession.Get, as in: using (ISession session = MySessionFactory.OpenSession()) { return session.Get<Customer>(customerId); } and also lazy load objects, but I want NHibernate to call my "GetCustomerById" stored procedure instead of generating the dynamic SQL. Can this be done? Perhaps NHibernate is no longer a fit given this new environment we must support.

    Read the article

  • extract all urls from a string

    - by codemonkey12
    I have a string of text that contains html, and I need to extract each url (most likely in img or a tags) to create a generic list of string objects. Is there an easy way to do this or will I have to resort to regular expressions? If I have to resort to regular expressions, would you mind helping me out with that as well? :)

    Read the article

  • Sending Illegal XML Characters in Soap Request

    - by SK
    I am trying to send special (&, ' (single quote)) characters in the Soap Request. I am using axis 1.4. The webservice client is in weblogic server and the webservice server is an ibm mainframe (COBOL program). The request data from the client contains special character (& symbol) which is converted to &amp; I tried to enclose it with CDATA as <![CDATA[Some Name & Some Data ]]> which got converted to &lt;![CDATA[Some Name &amp; Some Data]]&gt; The webservice client is generated from wsdl, so I couldn't use CDATA api to construct the request. I am able to set it as string value, and it is getting converted. Any help on this would be greatly appreciated. Please let me know if you need any more information on this.

    Read the article

  • Anyone else being hit by traffic on TCP port 11370

    - by Jakub
    I've been watching my logs (Ubuntu 9.10 server) and dunno about any of you but I am getting a ton of traffic from sources like Russia, Romania, etc.. on port 11370 (my iptables are logndrop'ing it. But was just curious). Some googling revealed this info: http://www.keysigning.org/sks/ -which seems to use port 11370 & 11371 Could that be the service they are scanning for (i don't run it)? ICS shows this: https://isc.incidents.org/port.html?port=11370 Just curious what you guys think and if anyone has seen this before? If need be I can post my log on here, but its just a dropped log of TCP port 11370 from various IPs. Thought it was strange as thats the ONLY Port I seem to repeatedly be hit on (from logs). I'm running on a Linode (VPS) if that matters to annyone.

    Read the article

  • Synchronize the position of two ScrollView views

    - by Billy
    I am trying to synchronize the positions of two ScrollViews. I'm trying to do this to display a tv guide listing. I have created a custom class that extends RelativeLayout to display the guide. This relative layout has four children: an imageview in the top left corner, a HorizontalScrollView to display the column headers in the top right, a ScrollView to display the row headers at the bottom left, and a ScrollView in the bottom right that contains the listings. This ScrollView then contains a HorizontalScrollView, which in turn contains a LinearLayout with multiple child views that display the data. I hope this explains it clearly, but here's a diagram to make it clearer: ____________ |__|___hsv___| | | | | | sv -> | | | hsv -> | |sv| ll -> | | | etc | | | | |__|_________| I set it up like this because I wanted the guide listings to scroll both horizontally and vertically, but there's no scroll view that does this. Also, I want the row and column headers to display no matter what position the guide listings are at, but I want them to be lined up properly. So I'm trying to find a way to synchronize the positions of the two hsv's, and to also synchronize the positions of the two sv's. I'm also trying to do it in a way that avoids just running a handler every few milliseconds to poll one view and call scrollTo on the other. I'm in no way sure that this is the best way to do it, but this is what I've come up with. If anybody has any other suggestions, please feel free!

    Read the article

  • Options for Linux OS executable archive files - self installers

    - by Matt1776
    I am looking to create a web-project that is able to install with a program. The user should be able to download an archive file or tar file, run it (executable), and the setup script would ask for paths and configurable values and then unpack its 'payload' and sorting out the contents for deployment. This would be a Linux version of the MSI installer. Is there such a thing for Linux operating systems? This does not involve kernel level manipulations. All it needs to do is copy directories and files on the filesystem, which should cover about 80% if not more of all the *nix distributions.

    Read the article

  • Using MD5 to generate an encryption key from password?

    - by Charles
    I'm writing a simple program for file encryption. Mostly as an academic exercise but possibly for future serious use. All of the heavy lifting is done with third-party libraries, but putting the pieces together in a secure manner is still quite a challenge for the non-cryptographer. Basically, I've got just about everything working the way I think it should. I'm using 128-bit AES for the encryption with a 128-bit key length. I want users to be able to enter in variable-length passwords, so I decided to hash the password with MD5 and then use the hash as the key. I figured this was acceptable--the key is always supposed to be a secret, so there's no reason to worry about collision attacks. Now that I've implemented this, I ran across a couple articles indicating that this is a bad idea. My question is: why? If a good password is chosen, the cipher is supposed to be strong enough on its own to never reveal the key except via an extraordinary (read: currently infeasible) brute-force effort, right? Should I be using something like PBKDF2 to generate the key or is that just overkill for all but the most extreme cryptographic applications?

    Read the article

  • Two collections and a for loop. (Urgent help needed) Checking an object variable against an inputted

    - by Elliott
    Hi there, I'm relatively new to java, I'm certain the error is trivial. But can't for the life of me spot it. I have an end of term exam on monday and currently trying to get to grips with past papers! Anyway heregoes, in another method (ALGO_1) I search over elements of and check the value H_NAME equals a value entered in the main. When I attempt to run the code I get a null pointer exception, also upon trying to print (with System.out.println etc) the H_NAME value after each for loop in the snippet I also get a null statement returned to me. I am fairly certain that the collection is simply not storing the data gathered up by the Scanner. But then again when I check the collection size with size() it is about the right size. Either way I'm pretty lost and would appreciate the help. Main questions I guess to ask are: from the readBackground method is the data.add in the wrong place? is the snippet simply structured wrongly? oh and another point when I use System.out.println to check the Background object values name, starttime, increment etc they print out fine. Thanks in advance.(PS im guessing the formatting is terrible, apologies.) snippet of code: for(Hydro hd: hydros){ System.out.println(hd.H_NAME); for(Background back : backgs){ System.out.println(back.H_NAME); if(back.H_NAME.equals(hydroName)){ //get error here public static Collection<Background> readBackground(String url) throws IOException { URL u = new URL(url); InputStream is = u.openStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader b = new BufferedReader(isr); String line =""; Vector<Background> data = new Vector<Background>(); while((line = b.readLine())!= null){ Scanner s = new Scanner(line); String name = s.next(); double starttime = Double.parseDouble(s.next()); double increment = Double.parseDouble(s.next()); double sum = 0; double p = 0; double nterms = 0; while((s.hasNextDouble())){ p = Double.parseDouble(s.next()); nterms++; sum += p; } double pbmean = sum/nterms; Background SAMP = new Background(name, starttime, increment, pbmean); data.add(SAMP); } return data; } Edit/Delete Message

    Read the article

  • 2D colliding n-body simulation (fast Collision Detection for large number of balls)

    - by osgx
    Hello I want to write a program for simulating a motion of high number (N = 1000 - 10^5 and more) of bodies (circles) on 2D plane. All bodies have equal size and the only force between them is elastic collision. I want to get something like but in larger scale, with more balls and more dense filling of the plane (not a gas model as here, but smth like boiling water model). So I want a fast method of detection that ball number i does have any other ball on its path within 2*radius+V*delta_t distance. I don't want to do a full search of collision with N balls for each of i ball. (This search will be N^2.) PS Sorry for loop-animated GIF. Just press Esc to stop it. (Will not work in Chrome).

    Read the article

  • Java - How to make a set of JInternalFrame independant of each other?

    - by Amokrane
    Hello, I'm programming a short Paint program like and I'm trying to make an MDI architecture for it. To make that happen, I used JInternalFrame inside a JDesktopPane. Although I kind of obtain multiple frames, there are not really working properly. Basically, if I have 2 JInternalFrame I can draw only on the last one. The other one seems to be disabled. Here is a short video illustrating the problem. http://bit.ly/9ydiwM Here are some part of the code. Panneau.java public class Panneau extends JDesktopPane { /** La liste de fenêtres ouvertes */ private static ArrayList<Cadre> cadres; /** Le pannel comportant la liste des formes à dessiner*/ private Pannel pannel; /** La barre d'outils */ private ToolBox toolBox; public Panneau() { this.setLayout(new BorderLayout()); // Initialisations des listes de cadres cadres = new ArrayList<Cadre>(); // En haut ToolBox toolBox = new ToolBox(); this.add(toolBox, BorderLayout.NORTH); **// Intialisation de la première internal frame Cadre cadre = new Cadre(); this.add(cadre, BorderLayout.CENTER);** cadres.add(cadre); // Ajout du pannel à gauche pannel = new Pannel(); this.add(pannel, BorderLayout.WEST); } /** * Crée une nouvelle fenêtre de dessin * */ **public void createNewInternalFrame() { Cadre cadre = new Cadre(); this.add(cadre, BorderLayout.CENTER); cadres.add(cadre); }** } public class Cadre extends JInternalFrame { /** Largeur par d'une fenêtre interne */ private int width; /** Hauteur d'une fenêtre interne */ private int height; /** Titre d'une fenêtre interne */ private String title; /** Toile associée à la fenêtre interne */ private Toile toile; public Cadre() { width = 400; height = 400; title = "Form"; toile = new Toile(); this.setTitle(title); this.setSize(width, height); this.setEnabled(true); this.setResizable(true); this.setAutoscrolls(true); this.setClosable(true); this.setIconifiable(true); this.setDoubleBuffered(true); this.setContentPane(toile); this.setVisible(true); this.pack(); } } Basically, Panneau is the main Window that contains all the differents parts of the GUI. I can create as much JInternalFrame that I want, using : Panneau.createNewInternalFrame(). Toile is basically where I draw my shapes. Any idea ? Thanks

    Read the article

  • Mocking ImportError in Python

    - by Attila Oláh
    I'm trying this for almost two hours now, without any luck. I have a module that looks like this: try: from zope.cpomonent import queryUtility # and things like this except ImportError: # do some fallback operations <-- how to test this? Later in the code: try: queryUtility(foo) except NameError: # do some fallback actions <-- this one is easy with mocking # zope.component.queryUtility to raise a NameError Any ideas?

    Read the article

  • asp.net windows forms - best place to persist application data

    - by mikeh
    For Windows.Forms, I have an application that needs to get a unique install id for each install from my server, and then persist this data so once registered, the install ID is included on all communications back to the server. The application is in occasional contact with the server. How can I persist this data on the client in a way that is not easily tampered with?

    Read the article

  • perfmon.exe itself taking 52.71% of cpu on windows 7 after chrome dies?

    - by jamesmoorecode
    On my Windows 7 machine (build 7100, x64, Dell XPS M1710 laptop), I'm getting horrible performance after chrome crashes. I kill the chrome process from the Resource Monitor, but after that perfmon.exe itself is shown as taking about 50% of the cpu (52.31% right now). Quitting Performance Monitor, then starting it again, shows perfmon starting out with a reasonable CPU, but it quickly (ten seconds) shoots right back up. Suggestions? So far a reboot seems to be the only way to solve the problem. I'm assuming that the perfmon issue is just a symptom of the real problem. (Update, much later: this never got resolved. I'm not seeing the problem in the RTM Win7 + latest Chrome. Yes, it was a core 2 duo, so presumably Chrome was running full blast on one cpu.)

    Read the article

  • Airport Extreme and Windows PC via regular LAN (not WIFI)

    - by Mr AJL
    So I got an airpoort extreme, and everything works beautifully on the mac, but my windows 7 PC which is connected via a regular ethernet cable can't see any network. The Win7 PC says there's no cable connected. Any ideas? Is there some kind of setting you have to enable with the Airport utility? I looked everywhere but can't find anything. Thanks!

    Read the article

  • SQLAuthority News – Microsoft SQL Server Protocol Documentation Download

    - by pinaldave
    The Microsoft SQL Server protocol documentation provides detailed technical specifications for Microsoft proprietary protocols (including extensions to industry-standard or other published protocols) that are implemented and used in Microsoft SQL Server to interoperate or communicate with Microsoft products. The documentation includes a set of companion overview and reference documents that supplement the technical specifications with conceptual background, overviews of inter-protocol relationships and interactions, and technical reference information. Microsoft SQL Server Protocol Documentation Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Legitimate SEO Strategies - Which to Follow and Not to Follow?

    There are various SEO techniques which can help your business to get recognition on the internet. These techniques are mainly divided into two categories i.e. legitimate search engine optimization and illegitimate search engine optimization. Using legitimate search engine optimization techniques will guarantee a top spot and there will be nothing at risk. Whereas the illegitimate SEO has many risks attached to it.

    Read the article

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