Daily Archives

Articles indexed Sunday December 26 2010

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

  • Edit source files with custom maven archetype

    - by Scobal
    I have created a customer maven archetype and have it setup with some custom requiredProperties: <requiredProperties> <requiredProperty key="classPrefix" /> </requiredProperties> I can use that property to name a file, like so: __classPrefix__Config.java My question is can I use that property inside the file. I've tried the following two variations but neither work: public class ${classPrefix}Config public class __classPrefix__Config

    Read the article

  • Scope of Connection Object for a Website using Connection Pooling (Local or Instance)

    - by Danny
    For a web application with connection polling enabled, is it better to work with a locally scoped connection object or instance scoped connection object. I know there is probably not a big performance improvement between the two (because of the pooling) but would you say that one follows a better pattern than the other. Thanks ;) public class MyServlet extends HttpServlet { DataSource ds; public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } void SomeWork(String sql) { Connection conn = null; try { conn = ds.getConnection(); // execute some sql ..... } finally { if(conn != null) { conn.close(); // return to pool } } } } Or public class MyServlet extends HttpServlet { DataSource ds; Connection conn;* public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { try { conn = ds.getConnection(); SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } finally { if(conn != null) { conn.close(); // return to pool } } } void SomeWork(String sql) { // execute some sql ..... } }

    Read the article

  • ASP.NET website not working properly in mobile

    - by ria
    I have created a simple app with a page having a server side form, three fields and a button that submits and performs two operations - 1) adds the form fields to the database table 2) sends an email. Now everything works fine on the web browser on my machine but when I access the app through my mobile, the page does not seem to work. the UI and all are set but the button click functionality doesnt seem to be working and also the label which is set after a successful submit is already visible and showing the "thank you" message. Am i doing something wrong here? I have checked the app on Nokia Smartphone browser, android phone, and iphone simulator.

    Read the article

  • UIView Disappears after pan gesture

    - by JulianF
    I am using the following handler for a IUPanGesture. However when the pan ends, the UIView that it is moving disappears. Do I need to add anything else to this code? - (void)pan:(UIPanGestureRecognizer *)gesture { if ((gesture.state == UIGestureRecognizerStateChanged) || (gesture.state == UIGestureRecognizerStateEnded)) { CGPoint location = [gesture locationInView:[self superview]]; [self setCenter:location]; } }

    Read the article

  • Problem loading XMLDocument with non standard tags

    - by David Conde
    Hi, I have a code needed to load an XML document from a reader, something like this: private static XmlDocument GetDocumentStream(string xmlAddress) { var settings = new XmlReaderSettings(); settings.DtdProcessing = DtdProcessing.Ignore; settings.ValidationFlags = XmlSchemaValidationFlags.None; var reader = XmlReader.Create(xmlAddress, settings); document.Load(reader); return document; } But in my XML document, I have nodes like this one: <link rel="edit-media" title="Package" href="Packages(Id='51Degrees.mobi',Version='0.1.11.9')/$value" /> Is to my understanding that the node should be like <link rel="edit-media" title="Package"></link> But, I don't create the Xml document and I certainly don't want to change it, but when I try to load the XML document, the document.Load line throws an exception. To be more specific, the XML file is the RSS source for the nuPack project. Any ideas would be very appreaciated on how to be able to read this document properly.

    Read the article

  • Building a blog: what's standard?

    - by Charlotte
    I'm generally pretty new at web stuff. I wanted to build a blog from scratch to get some practice. Few questions: Do most people add new entries of a blog by directly editing the html or is there a more dynamic way of doing this that is used more frequently? I'm assuming you can store the entries in some type of database and then display them via javascript or something similar? What are the most frequently used tools for what I'm describing? I know its about as simple as it gets, but like most things, I just need some tips to get started. Thanks!

    Read the article

  • Git & Web-design: handling multiple customized templates

    - by o_O Tync
    I'm developing a CMS (with Django, but that doesn't matter) and have chosen GIT. Installations will vary in: Configs Database contents Media Templates First 3 are not a problem with git: we simply don't need these :) While developing, I have 1 default template with related media. Later, each customer will receive his own design based on default templates (some slight customization). I'm not going to support each of the custom templates as I introduce new features. Modularity helps with this but is not a 100% solution. Do you have any experience to share?

    Read the article

  • How to convert a Java object (bean) to key-value pairs (and vice versa)?

    - by Shahbaz
    Say I have a very simple java object that only has some getXXX and setXXX properties. This object is used only to handle values, basically a record or a type-safe (and performant) map. I often need to covert this object to key value pairs (either strings or type safe) or convert from key value pairs to this object. Other than reflection or manually writing code to do this conversion, what is the best way to achieve this? An example might be sending this object over jms, without using the ObjectMessage type (or converting an incoming message to the right kind of object).

    Read the article

  • Program and debugger quit without indication of problem

    - by spender
    OK, not quite a Heisenbug but similar in nature. I'm developing a WPF application. When debugging, the logic reaches a certain point, then the application quits for no reason. VS debugger catches nothing and the only indication of a problem is the following in the output window: The program '[6228] SomeApp.vshost.exe: Managed (v4.0.30319)' has exited with code 1073741855 (0x4000001f). When debugging the release version, or indeed running the debug build out of the debugger (in fact all combos that aren't running the debug version in debugger), everything works fine. I'm trying to catch unhandled exceptions with the following code: AppDomain .CurrentDomain .UnhandledException += (sender, e) => { Debug.WriteLine("Unhandled Exception " + e.ExceptionObject); }; Application .Current .DispatcherUnhandledException += (sender1, e1) => { Debug.WriteLine("DispatcherUnhandledException " + e1.Exception); }; ...but I'm not catching anything. I'm considering peppering the app with debug output statements, but it's highly asynchronous so reading this will be both arduous and tedious. So tell me, if you can... how do I start figuring WTF is going on?

    Read the article

  • How do I use unmanaged DLL in C++ win32 application?

    - by Nick
    I have a 3rd party DLL that I am trying to use in a win32 C++ application. The DLL alone is all that I have. I believe this library is written in C and I assume is not exposed to COM. Is LoadLibrary() the function must commonly used for this task in Windows? If so can someone provide me with an example of how it is used? I created a blank win32 in VS so I don't have any of the windows specific headers included etc. Thanks!

    Read the article

  • Jquery data retrival returns null with json data

    - by user545520
    Hello Everyone, I have below sample json file: {"jsonData":{"REC":[{"TEST":"T","TEST1":"T1","TEST2":"T2"},{"R":"R","R1":"R1","R3":"R3"}], "DATA":{"FIRST":0,"SEC":1}}}. I want to retrieve data from json file,i am try like below,but it is giving null. from result object:i am retrieving data like below: to retrive the value T: this.jsonData.REC.TEST To retrieve the value R1: this.jsonData.DATA.FIRST Please correct me if i am doing any wrong. Thanks in Advance.

    Read the article

  • PHP Regexp problem...

    - by Crazy
    Hi! I want to replace this line : <img width="600" height="256" alt="javascript00" src="http://localhost/img/test.png" title="javascript00" class="aligncenter size-full wp-image-1973"> With this : <p align="center"><img width="600" height="256" alt="javascript00" src="http://localhost/img/test.png" title="javascript00"></p> By use a simple regexp. It consists to delete the image class and add a <p align="center"> around :) Thanks for help! And merry christmas :)

    Read the article

  • Haskell Lazy Evaluation and Reuse

    - by Jonathan Sternberg
    I know that if I were to compute a list of squares in Haskell, I could do this: squares = [ x ** 2 | x <- [1 ..] ] Then when I call squares like this: print $ take 4 squares And it would print out [1.0, 4.0, 9.0, 16.0]. This gets evaluated as [ 1 ** 2, 2 ** 2, 3 ** 2, 4 ** 2 ]. Now since Haskell is functional and the result would be the same each time, if I were to call squares again somewhere else, would it re-evaluate the answers it's already computed? If I were to re-use squares after I had already called the previous line, would it re-calculate the first 4 values? print $ take 5 squares Would it evaluate [1.0, 4.0, 9.0, 16.0, 5 ** 2]?

    Read the article

  • How to extract ONLY the contents of the JDK installer

    - by Abel Morelos
    I just downloaded the Java SDK/JDK versions 5 and 6, and I just need the development tools (and some libraries) contained in the installation packages, I don't need to perform an installation and that's why I was only looking for a zip package at first (for Windows there is only an exe installation file), I only need to extract the contents of the installation packages, I think this can be done from the command line but so far I haven't found how to do this (I already considered WinRar and 7-Zip, but I really want to find how to do it without using these tools) Have you done this before and how?

    Read the article

  • How to download a file from a server using Java Socket?

    - by Ada
    Hi, I have an assignment about uploading and downloading a file to a server. I managed to do the uploading part using Java Sockets however I am having a hard time doing the downloading part. I should use Range: for downloading parellel. In my request, I should have the Range: header. But I don't understand how I will receive the file with that HTTP GET request. All the examples I have seen was about uploading a file. I already did it. I can upload .exe, image, .pdf, anything and when I download them back (by my browser), there are no errors. Can you help me with the downloading part? Can you give me an example beacuse I really didn't get it.

    Read the article

  • javascript onkeypressed not giving current text box content

    - by Austin
    I have an html form like this: <form id="boxy" action="layout.html" method="get" accept-charset="utf-8"> <input type="text" id="a" onkeypress="Boxy.Check(this);"> </form> Invoking javascript like this: Boxy.Check = function() { input = document.getElementById(this.currentSelector.id).value; console.log("\"" + input + "\""); }; However, this.value is the previous value before onkeypress. For example, if I just type "A" into the form, console.log() prints "". And if I type "AA", console.log prints "A". Is there a way to get the current content of the input?

    Read the article

  • iPhone htaccess redirect redirecting the iPad

    - by Luis Armando
    how can I avoid this from happening? I currently have: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC] RewriteCond %{REQUEST_URI} !^/m/ RewriteRule ^.*$ http://www.mydomain.com/m/$0 [R=301,L] but when someone logs in with an iPad he/she gets redirected =/ to the mobile version as well and I'd like them to see the normal site (without the /m/)

    Read the article

  • What is the right way to initialize a constant in Ruby?

    - by zbrimhall
    I have a simple class that defines some constants, e.g.: module Foo class Bar BAZ = "bof" ... Everything is puppies and rainbows until I tell Rake to run all my Test::Unit tests. When it does, I get warnings: bar.rb:3: warning: already initialized constant BAZ My habit has been to avoid these warnings by making the constant initialization conditional, e.g.: ... BAZ = "bof" unless const_defined? :BAZ ... This seems to solve the problem, but it is a little tedious, and I don't ever see anyone else initializing constants this way. This makes me think I might be Doing It Wrong. Is there a better way to initialize constants that won't generate warnings?

    Read the article

  • Looking for a PHP based user management system

    - by dade
    I am presently looking for a user management system in PHP which can easily be integrated and built on. I have googled for it and i have two or three already on the list to try out, but then again i want the benefit of personal recommendation based on usage and experience with a solution. So if you know of any that has worked for you in time past, i would really appreciate if you can recommend. Thanks!

    Read the article

  • Why Does My Website Redirect me to my localhost?

    - by Noah Brainey
    Alight, my website has some issues that I'm not sure what's causing them. Visit this page http://online-file-sharing.net/tos.html and click one of the bottom footer links... it redirects you to your localhost in the address bar. I have no idea why it does this. I'm hosting this website on my own server, which is this computer, and using Xampp. If this information helps. Anyways any help would be greatly appreciated! I'm also using DYNDNS as my nameservers.

    Read the article

  • Preventing Windows version of Vim from destroying other file systems permissions

    - by dborba
    I am currently using the windows version of gVim to edit source files on a networked drive mapped to a linux system, as well as local files created in cygwin. The problem is that the windows version of gVim destroys the original file permissions on the respective systems. IE: Files on cygwin are defaulted to 077. When edited by the windows version of vim they are saved as 777.This problem doesn't even occur when using ms-notepad (as well as all other editors I've tried), so I am not quite sure why gVim does it. A possible solution would be to use cygwin's gVim for everything, but that's rather cumbersome as it requires running an x11 environment to support it, and it causes some problems when running some commands from within gVim (or vim for that matter) when working on the networked drive. Any ideas how I might be able to maintain the existing file permissions? Edit: This morning while on a different machine the problem with cygwin did not occur. Cygwin & gVim were the same version, however the other machine is running WinXP while the machine the problem is occurring on runs Win7.

    Read the article

  • What's an easy way to install a bunch of OSS apps in my home dir on my company's aging Redhat VNC servers?

    - by subopt
    My company's IT group doesn't want to install lots of common stuff on our VNC servers, which run RHEL 4. The list of stuff i want/need includes graphviz, midnight commander, various python libs, sqlite, netbeans, antlr, jdk1.6, etc. They've hobbled rpm somehow, so i can't do rpm --relocate. And i don't want the RHEL4 compatible revs of this stuff anyway. I've probably got the room to build all this stuff in my home dir, but i don't want to take forever tracking down dependencies. Looking for an easy way to get the apps/tools i need, and nothing (or very little) else. Any suggestions?

    Read the article

  • SQL SERVER – Server Side Paging in SQL Server 2011 – Part2

    - by pinaldave
    The best part of the having blog is that SQL Community helps to keep it running with new ideas. Earlier I wrote about SQL SERVER – Server Side Paging in SQL Server 2011 – A Better Alternative. A very popular article on that subject. I had used variables for “number of the rows” and “number of the pages”. Blog reader send me email asking in their organizations these values are stored in the table. Is there any the new syntax can read the data from the table. Absolutely YES! USE AdventureWorks2008R2 GO CREATE TABLE PagingSetting (RowsPerPage INT, PageNumber INT) INSERT INTO PagingSetting (RowsPerPage, PageNumber) VALUES(10,5) GO SELECT * FROM Sales.SalesOrderDetail ORDER BY SalesOrderDetailID OFFSET (SELECT RowsPerPage*PageNumber FROM PagingSetting) ROWS FETCH NEXT (SELECT RowsPerPage FROM PagingSetting) ROWS ONLY GO Here is the quick script: This is really an easy trick. I also wrote blog post on comparison of the performance over here: . SQL SERVER – Server Side Paging in SQL Server 2011 Performance Comparison Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology Tagged: SQL Paging

    Read the article

  • JQuery UI Autocomplete Syntax

    - by djs22
    Can someone help me understand the following code? I found it here. It takes advantage of the JQuery UI Autocomplete with a remote source. I've commented the code as best I can and a more precise question follows it. $( "#city" ).autocomplete({ source: function( request, response ) { //request is an objet which contains the user input so far // response is a callback expecting an argument with the values to autocomplete with $.ajax({ url: "http://ws.geonames.org/searchJSON", //where is script located dataType: "jsonp", //type of data we send the script data: { //what data do we send the script featureClass: "P", style: "full", maxRows: 12, name_startsWith: request.term }, success: function( data ) { //CONFUSED! response( $.map( data.geonames, function( item ) { return { label: item.name+(item.adminName1 ? ","+item.adminName1:"")+","+item.countryName, value: item.name } } ) ); } }); } }); As you can see, I don't understand the use of the success function and the response callback. I know the success function literal is an AJAX option which is called when the AJAX query returns. In this case, it seems to encapsulate a call to the response callback? Which is defined where? I thought by definition of a callback, it should be called on its own? Thanks!

    Read the article

  • Make Bluetooth on Android 2.1 discoverable indefinitely

    - by kanov-baekonfat
    Hello all. I'm working on a research project which involves Bluetooth and the Android OS. I need to make Bluetooth discoverable indefinitely in order for the project to continue. The Problem: Android limits discoverability to 300 seconds. I cannot ask the user every 300 seconds to turn discoverability back on as my application is designed to run in the background without disturbing the user. As far as I am aware, there is no way to increase the time though Android's GUI. Some sources have called this a safety feature, others have called this a bug. There may be a bit of truth in both... What I'm Trying / Have Tried: I'm trying to edit a stable release of cyanogenmod to turn the discoverability timer off (it's possible; there's a configuration file that needs to have a single number changed). This isn't working because I'm having verification problems with the resulting package. During the past week, I downloaded the cyanogenmod source code, changed a relevant class in the hope that it would make Bluetooth discoverable indefinitely, and tried to recompile. This did not work because (a) the repo is frequently changed, leading to an unstable code base which fails to compile (OR, it could be that I'm using it incorrectly; just because it looked like it was the code's fault in many instances doesn't mean I should blame it for all the problems I encountered!) and (b) the repo decides to periodically "ignore" me (but not always, as I have gotten the code base before!), replying to my synchronization/connection attempts with: fatal: The remote end hung up unexpectedly As you might imagine, the above two issues are problematic and very frustrating to deal with. More Info: I'm running Android 2.1 via cyanogenmod (v5 I believe). This means the phone is also rooted. I have a developer phone, which means that the bootloader is unlocked. My phone is an HTC Magic (32B). The Big Question: How can I make Bluetooth indefinitely discoverable on Android? Thanks for your time and input. I feel like I'm spinning my tires on this issue and I'd like to move past it.

    Read the article

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