Daily Archives

Articles indexed Tuesday June 8 2010

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

  • Xpath that evaluates -all- attributes?

    - by Tres
    I maybe be trying to do something invalid here, but maybe someone smarter than me knows the correct syntax to solve my problem. Given: <group code="vehicle"> <line code="car"> <cell> <box code="price">1000.00</box> </cell> </line> <line code="car"> <cell code="sports"> <box code="price">500.00</box> </cell> </line> </group> If I use //*[@code="vehicle"]//*[@code="car"]//*[@code="price"], I will get both boxes returned (1000.00 and 500.00)--as expected but not what I want. Is there an xpath syntax that will evaluate against all nodes that have an attribute of @code rather than skipping it if it doesn't match with the end result being that I only get back the first box (price of 1000.00)? Like asking, choose the first node with @code and that @code must equal "vehicle", then choose the next node with @code and that @code must equal "car", then choose the next node with @code and @code must equal "price".

    Read the article

  • Making the domain-model of tic tac toe

    - by devoured elysium
    I am trying to make the domain model of a Tic Tac Toe game. I'll try then to go on through the various steps of the Unified Process and later implement it in some language (C# or Java). I'd like to have some feedback if I'm going on the right path: I've defined the game with two actors, Player O and Player X. I'm not sure about defining both a Tile and a Tile State. Maybe I should only define a Tile and have the 3 possible states specialize from it? I'm not sure what is best: to have both Player O and Player X be associations with Tic Tac Toe or have them inherit from Player that is associated with Tic Tac Toe. Following the design shown on the pic, in theory we could have a Tic Tac Toe concept with 2 Player O's, which wouldn't be correct. What is your opinion on this? Also, am I missing something in the diagram? Although I can't see any other actors for Tic Tac Toe, should I have any other? Thanks

    Read the article

  • array retain question

    - by Cosizzle
    Hello, im fairly new to objective-c, most of it is clear however when it comes to memory managment I fall a little short. Currently what my application does is during a NSURLConnection when the method -(void)connectionDidFinishLoading:(NSURLConnection *)connection is called upon I enter a method to parse some data, put it into an array, and return that array. However I'm not sure if this is the best way to do so since I don't release the array from memory within the custom method (method1, see the attached code) Below is a small script to better show what im doing .h file #import <UIKit/UIKit.h> @interface memoryRetainTestViewController : UIViewController { NSArray *mainArray; } @property (nonatomic, retain) NSArray *mainArray; @end .m file #import "memoryRetainTestViewController.h" @implementation memoryRetainTestViewController @synthesize mainArray; // this would be the parsing method -(NSArray*)method1 { // ???: by not release this, is that bad. Or does it get released with mainArray NSArray *newArray = [[NSArray alloc] init]; newArray = [NSArray arrayWithObjects:@"apple",@"orange", @"grapes", "peach", nil]; return newArray; } // this method is actually // -(void)connectionDidFinishLoading:(NSURLConnection *)connection -(void)method2 { mainArray = [self method1]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { mainArray = nil; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [mainArray release]; [super dealloc]; } @end

    Read the article

  • jquery find image based on "align"

    - by SoulieBaby
    Hi all, I'm trying to find all the images on a page based on their alignment (no class or id attached to these images), although I'm not sure how to do it. Basically I want to add CSS to images which are aligned to the right, yet leave the other images as they are. If anyone could help out, that'd be great :)

    Read the article

  • Cookieless Django - Django with no cookies

    - by phoebebright
    As I'm writing a django site from government bodies I'm not going to be able to use cookies. I found this snippet http://djangosnippets.org/snippets/1540/ but it's currently not allowing users to login. Before I start debugging I wondered if anyone else has solved this problem with this snippet or in any other way?

    Read the article

  • Dolphin Smalltalk - adding method

    - by bialpio
    Hi, I am trying to create a custom class in Dolphin Smalltalk. When I open the Workspace, type in and evaluate the code: Object subclass: #Sudoku instanceVariableNames: 'board' classVariableNames: '' poolDictionaries: '' category: 'JiPP SudokuSolver'. everything works fine and the class is created and visible from Class Browser. The problem is, I want to add custom member method to this class, but without using Class Browser. Is it possible from the Workspace? I want to have one file with all the source code, so I don't have to worry about saving entire image.

    Read the article

  • C# getting mouse coordinates from a tab page when selected

    - by Tom
    I wish to show the mouse coordinates only when i am viewing tabpage7. So far i have: this.tabPage7.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); protected void OnMouseMove(object sender, MouseEventArgs mouseEv) { Console.WriteLine("happening"); Console.WriteLine(mouseEv.X.ToString()); Console.WriteLine(mouseEv.Y.ToString()); } but this doesn't appear to be doing anything, could someone help show me what im doing wrong please?

    Read the article

  • Excel vba -get ActiveX Control checkbox when event handler is triggered

    - by danoran
    I have an excel spreadsheet that is separated into different sections with named ranges. I want to hide a named range when a checkbox is clicked. I can do this for one checkbox, but I would like to have a single function that can hide the appropriate section based on the calling checkbox. I was planning on calling that function from the event_handlers for when the checkboxes are clicked, and to pass the checkbox as an argument. Is there a way to access the checkbox object that calls the event handler? This works: Sub chkDogsInContest_Click() ActiveSheet.Names("DogsInContest").RefersToRange.EntireRow.Hidden = Not chkMemberData.Value End Sub But this is what I would like to do: Sub chkDogsInContest_Click() Module1.Show_Hide_Section (<calling checkbox>) End Sub These functions are defined in a different module: 'The format for the the names of the checkbox controls is 'CHECKBOX_NAME_PREFIX + <name> 'where "name" is also the name of the associated Named Range Public Const CHECKBOX_NAME_PREFIX As String = "chk" 'The format for the the names of the checkbox controls is 'CHECKBOX_NAME_PREFIX + <name> 'where "name" is also the name of the associated Named Range Public Function CheckName_To_SectionName(ByRef strCheckName As String) CheckName_To_SectionName = Mid(strCheckName, CHECKBOX_NAME_PREFIX.Length() + 1) End Function Public Sub Show_Hide_Section(ByRef chkBox As CheckBox) ActiveSheet.Names(CheckName_To_SectionName(chkBox.Name())).RefersTo.EntireRow.Hidden = True End Sub

    Read the article

  • Getting Started with UDK

    - by Sean Edwards
    I've been trying for a couple of days now to learn UDK, but I seem to be stuck at making that leap to understanding how everything works together. I understand the syntax, that's all well and good, and I pretty much get how classes and .ini files interact. As for the API, I have the entire reference as pretty decent Doxygen-style HTML output. What I'm looking for is a sort of intermediate tutorial on game creation from scratch (as opposed to modding UT3 itself), more advanced than just learning language syntax, but not yet to the level of going through the API step by step. I'm looking for some guide to the structure of the internals - how GameInfo and PlayerController interact, where Pawn comes in, etc. - a way to visualize the big picture. Does anyone have a particular favorite intermediate-level tutorials (or set of tutorials) that they used when first learning UDK?

    Read the article

  • TTActionSheetController adding a UIPicker

    - by Ward
    I know how to add a uipicker to a uiactionsheet, how can one be added to the ttactionsheetcontroller? I see a reference to actionSheet within the controller, but setting the bounds to accommodate the uipicker doesn't seem to have any affect. And ideas? Best, Ward

    Read the article

  • Packaging for Ubuntu - Web Application

    - by Sam
    A web application has no make file unlike C++ or anything like that. However, it needs to be placed into specific directories...e.g /var/www. I'm new to linux packaging, so my question is, how do I package my app into a .deb such that when its being installed, it gets put into something like /etc/myprogram/bundles/myprogram-3.4? Mine in particular is a java app running on apache tomcat. I've managed to create a .deb file by reading painstakingly every word in http://www.debian.org/doc/manuals/maint-guide. However when I follow the instructions I end up getting 1) a .deb file that is 1.7kb instead of the ~240mb that it should be, because apparently it is lacking all my source code. 2) confused because I don't know whether I was supposed to write some sort of makefile. I am not even sure where to go about learning the answer to that question, and then I'd have to deal with how to write a makefile. I've posted a similar question to ubuntuforums, but I feel like I'm more likely to get a response here.

    Read the article

  • Azure News at TechEd 2010

    - by guybarrette
    The Azure team did a few announcements today at TechED US 2010: June 2010 Azure Tools SDK with support for VS 2010 RTM and the .NET Framework 4 Production launch of the Azure CDN OS Auto-upgrade Feature Read all about it here var addthis_pub="guybarrette";

    Read the article

  • Find the source of malware?

    - by Jud Stephenson
    I have a server that was running an older version of lighttpd (1.4.19 on a freebsd 6.2-RELEASE (yea, old) machine) and google alerted me that it had found malware embedded on one of my server's pages. It just so happened to be our index page. I promptly removed the malware and started looking at server logs for how it got there. With no trace in any of the logs of the files being edited, I noticed that the index page's owner had been changed to www, which is the lighttpd user. I then concluded that some sort of veunerability must have existed for that software version and promptly upgraded to 1.4.26. Now the malware is back. I have started some pretty verbose server logging with ftp, lighttpd, and all login attempts to try and see how this script is getting in. Are their any suggestions as to other approaches to take?

    Read the article

  • internet access options in remote area? (read: no comcast,qwest, etc)

    - by freedrull
    Currently I am living in a fairly "remote" area, in the countryside, and cable internet access through the typical companies like comcast and qwest is just not available here. I've been trying to research other options for fast internet access. There are some small cable companies but they currently do not offer broadband access here. I thought about maybe buying a 3g phone with a data plan and doing some sort of tethering, or perhaps getting an android phone and using it as a wireless AP. This would of course depend on 3g being available here. The only other thing I can think of is some sort of satellite internet service, or doing something crazy like adapting wifi over am radio. Anyone have any ideas, at all, short of moving somewhere else?

    Read the article

  • Problem Registering a Generic Repository with Windsor IoC

    - by Robin
    I’m fairly new to IoC and perhaps my understanding of generics and inheritance is not strong enough for what I’m trying to do. You might find this to be a mess. I have a generic Repository base class: public class Repository<TEntity> where TEntity : class, IEntity { private Table<TEntity> EntityTable; private string _connectionString; private string _userName; public string UserName { get { return _userName; } set { _userName = value; } } public Repository() {} public Repository(string connectionString) { _connectionString = connectionString; EntityTable = (new DataContext(connectionString)).GetTable<TEntity>(); } public Repository(string connectionString, string userName) { _connectionString = connectionString; _userName = userName; EntityTable = (new DataContext(connectionString)).GetTable<TEntity>(); } // Data access methods ... ... } and a SqlClientRepository that inherits Repository: public class SqlClientRepository : Repository<Client> { private Table<Client> ClientTable; private string _connectionString; private string _userName; public SqlClientRepository() {} public SqlClientRepository(string connectionString) : base(connectionString) { _connectionString = connectionString; ClientTable = (new DataContext(connectionString)).GetTable<Client>(); } public SqlClientRepository(string connectionString, string userName) : base(connectionString, userName) { _connectionString = connectionString; _userName = userName; ClientTable = (new DataContext(connectionString)).GetTable<Client>(); } // data access methods unique to Client repository ... } The Repository class provides some generics methods like Save, Delete, etc, that I want all my repository derived classes to share. The TEntity parameter is constrained to the IEntity interface: public interface IEntity { int Id { get; set; } NameValueCollection GetSaveRuleViolations(); NameValueCollection GetDeleteRuleViolations(); } This allows the Repository class to reference these methods within its Save and Delete methods. Unit tests work fine on mock SqlClientRepository instances as well as live unit tests on the real database. However, in the MVC context: public class ClientController : Controller { private SqlClientRepository _clientRepository; public ClientController(SqlClientRepository clientRepository) { this._clientRepository = clientRepository; } public ClientController() { } // ViewResult methods ... ... } ... _clientRepository is always null. I’m using Windor Castle as an IoC container. Here is the configuration: <component id="ClientRepository" service="DomainModel.Concrete.Repository`1[[DomainModel.Entities.Client, DomainModel]], DomainModel" type="DomainModel.Concrete.SqlClientRepository, DomainModel" lifestyle="PerWebRequest"> <parameters> <connectionString>#{myConnStr}</connectionString> </parameters> </component> I’ve tried many variations in the Windsor configuration file. I suspect it’s more of a design flaw in the above code. As I'm looking over my code, it occurs to me that when registering components with an IoC container, perhaps service must always be an interface. Could this be it? Does anybody have a suggestion? Thanks in advance.

    Read the article

  • Getting float values out of PostgreSQL

    - by skymander
    I am having trouble retrieving float/real values out of PostgreSQL. For example, I would like to store: 123456789123456, the retrieve that exact same number with a select statement. table tbl (num real) insert into tbl(num) values('123456789123456'); As it is now, if I "select num from tbl" the result is "1.23457e+14" If I run "select CAST(num AS numeric) as num from tbl" the result is 123457000000000 If I run "select CAST(num AS float) as num from tbl" the result is 123456788103168 (where did this number come from) How on earth can I select the value and get "123456789123456" as the result? Thanks so much in advance

    Read the article

  • StackOverflow for President

    - by Earthworm
    I was inspired to create this account today because stackoverflow has been an amazing resource and I have decided that it's time to create an account, and I hope what I can be as helpful to others as they have been to me in my endeavors. ?peace?

    Read the article

  • Xammp and Zend Library Conflicts

    - by Kieran
    Im trying to use the Zend Frameworks ACL library in my code (in codeigniter) and after including the library in my controller I get this error: Fatal error: Cannot redeclare class Zend_Acl in C:\xampp\php\PEAR\Zend\Acl.php on line 48 If I remove the include to the Zend library I get this error instead Fatal error: Class 'Zend_Acl' not found in C:\xampp\htdocs\ISU-Cart\system\application\libraries\acl.php on line 3 Any help on this?

    Read the article

  • MySQL create stored procedure fails but all internal queries succeed alone?

    - by Mark
    Hi all, I just created a simple database in MySQL, and I am learning how to write stored proc's. I'm familiar with M$SQL and as far as I can see the following should work: use mydb; -- -------------------------------------------------------------------------------- -- Routine DDL -- -------------------------------------------------------------------------------- DELIMITER // CREATE PROCEDURE mydb.doStats () BEGIN CREATE TABLE IF NOT EXISTS resultprobability ( ballNumber INT NOT NULL , probability FLOAT NULL, PRIMARY KEY (ballNumber) ); CREATE TABLE IF NOT EXISTS drawProbability ( drawDate DATE NOT NULL , ball1 INT NULL , ball2 INT NULL , ball3 INT NULL , ball4 INT NULL , ball5 INT NULL , ball6 INT NULL , ball7 INT NULL , score FLOAT NULL , PRIMARY KEY (drawDate) ); TRUNCATE TABLE resultprobability; TRUNCATE TABLE drawprobability; INSERT INTO resultprobability (ballNumber, probability) (select resultset.ballNumber ballNumber,(count(0)/(select count(0) from resultset)) probability from resultset group by resultset.ballNumber); INSERT INTO drawProbability (drawDate, ball1, ball2, ball3, ball4, ball5, ball6, ball7, score) (select distinct r.drawDate, a.ballnumber ball1, b.ballnumber ball2, c.ballnumber ball3, d.ballnumber ball4, e.ballnumber ball5, f.ballnumber ball6,g.ballnumber ball7, ((a.probability + b.probability + c.probability + d.probability + e.probability + f.probability + g.probability)/7) score from resultset r inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 1) a on a.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 2) b on b.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 3) c on c.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 4) d on d.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 5) e on e.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 6) f on f.drawdate = r.drawDate inner join (select r.drawDate, r.ballNumber, p.probability from resultset r inner join resultprobability p on p.ballNumber = r.ballNumber where r.appearence = 7) g on g.drawdate = r.drawDate order by score desc); END // DELIMITER ; instead i get the following Executed successfully in 0.002 s, 0 rows affected. Line 1, column 1 Error code 1064, SQL state 42000: 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 '' at line 26 Line 6, column 1 Error code 1064, SQL state 42000: 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 ')) probability from resultset group by resultset.ballNumber); INSERT INTO d' at line 1 Line 31, column 51 Error code 1064, SQL state 42000: 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 ') score from resultset r inner join (select r.drawDate, r.ballNumber, p.probabi' at line 1 Line 39, column 114 Execution finished after 0.002 s, 3 error(s) occurred. What am I doing wrong? I seem to have exhausted my limited mental abilities!

    Read the article

  • I keep getting a "System InvalidOperationException occurred in System Windows Forms dll" error in VB

    - by Heartrent
    I've just started learning VB.NET with VS 9.0; a small application I'm working on keeps returning an "A first chance exception of type System InvalidOperationException occurred in System Windows Forms dll" error from the Immediate Window. The application has almost zero functionality so far, it consists of a menu strip with: File About |Open |Save |Save As |Quit The only code I have written opens an Open File dialog, a Save As dialog, an About window with background sound and an OK button, and the Quit button which exits. Since there is almost no code for me to search through, I can't understand why there would be an error. The program runs just fine when I'm debugging it too.

    Read the article

  • Symfony dynamic subdomains

    - by Jamie
    Hi all, I'm trying to match subdomains to a customer id in symfony. i.e. i have customer1.example.com and customer2.example.com Domains are stored in a table. When a user goes to customer1.example.com, I would like to get the subdomain, look up the domain name in the database, once matched, it will then deploy the app config for that customer and then store the customer_Id in a global attribute so i know exactly which customer I'm dealing with througout the whole application. The virtual host will have the relevant wildcard servername. Have you managed to achieve this, and if so, how? If not, any ideas would be a great help! I'm thinking about using a filter to do it. :-)

    Read the article

  • Netbeans render unrecognized files as html

    - by nick
    Hey Everyone, I am using Netbeans and very happy with it. Unfortunately I am having a little problem with it that I cant seem to figure out. I am using Silverstripe CMS and it uses a templating system that syntactically is basically just a mix of php and html. These files however end in .ss and therefore netbeans doesnt format and highlight them at all. How do I make netbeans format and highlight all .ss files just as if they where normal html files? Kind Regards Nick

    Read the article

  • NETCF - Optimized Repaint (onPaint)

    - by Nullstr1ng
    Hi Guys, I want to ask for suggestions on how to optimize a repaint in Compact Framework? GetHashCode() didn't help because it always return a different hash code. Anyway, I have a program which you can drag and resize an object in run time. This object is a transparent object and it has a PNG image which also dynamically resize relative to object client size. Though I noticed, (e.g. I have 4 transparent object and I'm dragging or resizing one) all 4 of them triggers OnPaintBackground even if the 3 are not moving. Another one when am just tapping on the one object .. it sill triggers onPaintBacground(). Anyway, I don't have a problem when this events get triggered. What I like to do is optimization and that means I only have to repaint the object when it's necessary. Can you guys please give a suggestions? here's my pseudo C# code Bitmap _backBuff; onResize() { if(_backBuff != null) _backBuff.Dispose(); _backBuff = new Bitmap(ClientSize.Width, ClientSize.Height); Invalidate(); } onPaintBackground(e) /*have to use onPaintBackground because MSDN said it's faster*/ { using(Graphics g = Graphics.FromImage(_backBuff)) { g.Clear(Color.Black); // draw background ....some interface calling here ....and paint the background // draw alpha PNG .. get hDc .. paint PNG .. release hDc } e.Graphics.DrawImage(_backBuff,0,0); } Thanks in advance.

    Read the article

  • Java: micro-optimizing array manipulation

    - by Martin Wiboe
    Hello all, I am trying to make a Java port of a simple feed-forward neural network. This obviously involves lots of numeric calculations, so I am trying to optimize my central loop as much as possible. The results should be correct within the limits of the float data type. My current code looks as follows (error handling & initialization removed): /** * Simple implementation of a feedforward neural network. The network supports * including a bias neuron with a constant output of 1.0 and weighted synapses * to hidden and output layers. * * @author Martin Wiboe */ public class FeedForwardNetwork { private final int outputNeurons; // No of neurons in output layer private final int inputNeurons; // No of neurons in input layer private int largestLayerNeurons; // No of neurons in largest layer private final int numberLayers; // No of layers private final int[] neuronCounts; // Neuron count in each layer, 0 is input // layer. private final float[][][] fWeights; // Weights between neurons. // fWeight[fromLayer][fromNeuron][toNeuron] // is the weight from fromNeuron in // fromLayer to toNeuron in layer // fromLayer+1. private float[][] neuronOutput; // Temporary storage of output from previous layer public float[] compute(float[] input) { // Copy input values to input layer output for (int i = 0; i < inputNeurons; i++) { neuronOutput[0][i] = input[i]; } // Loop through layers for (int layer = 1; layer < numberLayers; layer++) { // Loop over neurons in the layer and determine weighted input sum for (int neuron = 0; neuron < neuronCounts[layer]; neuron++) { // Bias neuron is the last neuron in the previous layer int biasNeuron = neuronCounts[layer - 1]; // Get weighted input from bias neuron - output is always 1.0 float activation = 1.0F * fWeights[layer - 1][biasNeuron][neuron]; // Get weighted inputs from rest of neurons in previous layer for (int inputNeuron = 0; inputNeuron < biasNeuron; inputNeuron++) { activation += neuronOutput[layer-1][inputNeuron] * fWeights[layer - 1][inputNeuron][neuron]; } // Store neuron output for next round of computation neuronOutput[layer][neuron] = sigmoid(activation); } } // Return output from network = output from last layer float[] result = new float[outputNeurons]; for (int i = 0; i < outputNeurons; i++) result[i] = neuronOutput[numberLayers - 1][i]; return result; } private final static float sigmoid(final float input) { return (float) (1.0F / (1.0F + Math.exp(-1.0F * input))); } } I am running the JVM with the -server option, and as of now my code is between 25% and 50% slower than similar C code. What can I do to improve this situation? Thank you, Martin Wiboe

    Read the article

  • How do I use waf to build a shared library?

    - by James Morris
    I want to build a shared library using waf as it looks much easier and less cluttered than GNU autotools. I actually have several questions so far related to the wscript I've started to write: VERSION='0.0.1' APPNAME='libmylib' srcdir = '.' blddir = 'build' def set_options(opt): opt.tool_options('compiler_cc') pass def configure(conf): conf.check_tool('compiler_cc') conf.env.append_value('CCFLAGS', '-std=gnu99 -Wall -pedantic -ggdb') def build(bld): bld.new_task_gen( features = 'cc cshlib', source = '*.c', target='libmylib') The line containing source = '*.c' does not work. Must I specify each and every .c file instead of using a wildcard? How can I enable a debug build for example (currently the wscript is using the debug builds CFLAGS, but I want to make this optional for the end user). It is planned for the library sources to be within a sub directory, and programs that use the lib each in their own sub directories.

    Read the article

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