Daily Archives

Articles indexed Friday December 31 2010

Page 18/30 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Java : Inner class of an interface (from google guice)

    - by bsreekanth
    Hello, I was going through the source of google guice, and found an unfamiliar piece of code. It would be great learning if someone can clarify it. I have very basic understanding of inner classes, as they keep the implementation details close to the public interface. Otherwise the inner class may pollute the namespace. Now, I see the below lines at public static final Scope SINGLETON = new Scope() { public <T> Provider<T> scope(final Key<T> key, final Provider<T> creator) { return new Provider<T>() { ......... } It assign an inner class instance to the static variable, but Scope is an interface defined as (at) public interface Scope Is it possible to instantiate the interface?? or is it a succinct syntax for an anonymous implementation of an interface?? If anyone can explain what the author is intended by multiple nested classes above (Scope and Provider), and why it make sense to implement this way, it would help me to understand. thanks.

    Read the article

  • Linux Device Driver: Symbol "memcpy" not found

    - by Hinton
    Hello, I'm trying to write a Linux device driver. I've got it to work really well, until I tried to use "memcpy". I don't even get a compiler error, when I "make" it just warns me: WARNING: "memcpy" [/root/homedir/sv/main.ko] undefined! OK and when I try to load via insmod, I get on the console: insmod: error inserting './main.ko': -1 Unknown symbol in module and on dmesg: main: Unknown symbol memcpy (err 0) I include the following: #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/kernel.h> /* printk() */ #include <linux/slab.h> /* kmalloc() */ #include <linux/fs.h> /* everything... */ #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/fcntl.h> /* O_ACCMODE */ #include <linux/cdev.h> #include <asm/system.h> /* cli(), *_flags */ #include <asm/uaccess.h> /* copy_*_user */ The function using memcpy: static int dc_copy_to_user(char __user *buf, size_t count, loff_t *f_pos, struct sv_data_dev *dev) { char data[MAX_KEYLEN]; size_t i = 0; /* Copy the bulk as long as there are 10 more bytes to copy */ while (i < (count + MAX_KEYLEN)) { memcpy(data, &dev->data[*f_pos + i], MAX_KEYLEN); ec_block(dev->key, data, MAX_KEYLEN); if (copy_to_user(&buf[i], data, MAX_KEYLEN)) { return -EFAULT; } i += MAX_KEYLEN; } return 0; } Could someone help me? I thought the thing was in linux/string.h, but I get the error just the same. I'm using kernel 2.6.37-rc1 (I'm doing in in user-mode-linux, which works only since 2.6.37-rc1). Any help is greatly appreciated. # Context dependent makefile that can be called directly and will invoke itself # through the kernel module building system. KERNELDIR=/usr/src/linux ifneq ($(KERNELRELEASE),) EXTRA_CFLAGS+=-I $(PWD) -ARCH=um obj-m := main.o else KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD = $(shell pwd) all: $(MAKE) V=1 ARCH=um -C $(KERNELDIR) M=$(PWD) modules clean: rm -rf Module.symvers .*.cmd *.ko .*.o *.o *.mod.c .tmp_versions *.order endif

    Read the article

  • Constant Expected "{" before ")" token

    - by Thijs
    I've got a little problem. I am applying some changes to an iOS program i wrote, but I've struck a problem. I constantly get a "Expected '{' before ')' token" warning, but my coding skills aren't good enough to find the problem. A little help would greatly be appreciated. #import "Search.h" #import "RootViewController.h" //button - (IBAction)buttonPressed)sender{ RootViewController *newview = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFl ipFromRight forView:self.view cache:YES]; [self.view addSubview:newview.view]; [UIView commitAnimations]; @implementation Search @end

    Read the article

  • Create an event to recognise when text on a page changes?

    - by DaveDev
    There's a page that I'm trying to trigger a jQuery event for when a certain span's value changes to 1. There's a countdown timer on the page. When the timer reaches 1, I'd like to trigger a click event. The difficulty I'm having is getting a script that i'm running via Jash to know when the timer changes to 1. The value of the timer can read with: $('#tCounter_474754 .bid_time_highlight').text(); But how can I get jQuery to trigger the click when this timer reaches 1?

    Read the article

  • How to define a default tooltip style for all Controls

    - by skjagini
    I would like to define a style with a template when there are validation errors and would display the first error message as a tooltip. It works fine when targeting specific control like DatePicker in the following xaml. <Style TargetType="{x:Type ToolKit:DatePicker}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style> I cannot get it to work for Control though, i.e. the following doesn't give any tooltip <Style TargetType="{x:Type ToolKit:Control}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style> Any idea?

    Read the article

  • CaptureCameraDialog returns OK but does not save (Motorola ES400)

    - by Dominic
    Ok it seems like everyone in the world has issues with CaptureCameraDialog. In my case the result is OK, but when taking the photo there is a MessageBox that says "Error" that appears and disappears in the blink of an eye, then returns to my app (so I don't have time to actually read the error). It has not saved the file. It does not throw an error to my application. There is also another issue which is exactly the same as the issue talked about here (yet none of the fixes work for me). http://www.pcreview.co.uk/forums/thread-4025602.php Does anyone know how to get the "error message" that the dialogue box displays for an instant?

    Read the article

  • How, with javascript, can i read Childnode content on an XML file that contains html tags

    - by Joe
    to read a child node content i use : MYDATA = xhr.responseXML.getElementsByTagName("MenuItem") [INDEX].getElementsByTagName("PageContent")[0].childNodes[0].nodeValue; sometimes when the childnode data contains an HTML tag (eg b or br tags, because they have the <), i have problems since they are counted like xml tags (like childnodes). my question is how to get the entire data from a child node even if it contains other html tags exp : MenuItem MenuText menu b text b MenuText MenuItem would return "menu" !!! but i want it to return :"menu text" thank you guys, and happy new year

    Read the article

  • Anything wrong with my cURL code (http status of 0)?

    - by Ilya
    Consistently getting a status of 0 even though if I copy and paste the url sent into my browser, I get a json object right back <?php $mainUrl = "https://api.xxxx.com/?"; $co = "xxxxx"; $pa = "xxxx"; $par = "xxxx"; $part= "xxxx"; $partn = "xxxx"; $us= "xxx"; $fields_string; $fields = array( 'co'=>urlencode($co), 'pa'=>urlencode($pa), 'par'=>urlencode($par), 'part'=>urlencode($part), 'partn'=>urlencode($partn), 'us'=>urlencode($us) ); foreach($fields as $key=>$value) { $fields_string .= $key . '=' . $value . '&' ;} $fields_string = rtrim($fields_string, "&"); $fields_string = "?" . $fields_string; $url = "https://api.xxxxx.com/" . $fields_string; $request = $url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT,'3'); $content = trim(curl_exec($ch)); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); print $url; print $http_status; print $content; ?>

    Read the article

  • Is possible to remove an event listener in actionscript 3 (flash) ??

    - by DomingoSL
    In the frame 1 of my movie, part of my code is: stage.addEventListener(Event.RESIZE, resizeHandler); It works all fine, but when i go to the frame 2 the listener is still there but the function resizeHandler is not anymore (and i dont want it). So the console output this: TypeError: Error #1009: Cannot access a property or method of a null object reference. at index_fla::MainTimeline/resizeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.display::Stage/dispatchEvent() at index_fla::MainTimeline/frame2() Is possible to remove the event listener on the frame 2? Thanks!!!

    Read the article

  • Conflicting problem with css

    - by Luke
    I was told last night that the following isn't allowed in CSS. <a href="index.php"><div class="button">Home</div></a> .submenu div.button{width:72px; height:20px; float:left; margin:0 20px; font-size:0.9em; font-family:Arial; padding:2px; color:black;} How can i create the look I want for the button and then allow the user to click on it in any other way? What is the best way to do this? It works as it is, but I am being told it's not complient.

    Read the article

  • Create table class as a singleton

    - by Mark
    I got a class that I use as a table. This class got an array of 16 row classes. These row classes all have 6 double variables. The values of these rows are set once and never change. Would it be a good practice to make this table a singleton? The advantage is that it cost less memory, but the table will be called from multiple threads so I have to synchronize my code which way cause a bit slower application. However lookups in this table are probably a very small portion of the total code that is executed. EDIT: This is my code, are there better ways to do this or is this a good practice? Removed synchronized keyword according to recommendations in this question. final class HalfTimeTable { private HalfTimeRow[] table = new HalfTimeRow[16]; private static final HalfTimeTable instance = new HalfTimeTable(); private HalfTimeTable() { if (instance != null) { throw new IllegalStateException("Already instantiated"); } table[0] = new HalfTimeRow(4.0, 1.2599, 0.5050, 1.5, 1.7435, 0.1911); table[1] = new HalfTimeRow(8.0, 1.0000, 0.6514, 3.0, 1.3838, 0.4295); //etc } @Override @Deprecated public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public static HalfTimeTable getInstance() { return instance; } public HalfTimeRow getRow(int rownumber) { return table[rownumber]; } }

    Read the article

  • is there a multiple payment providers (paypal, ogone, ...) php module for use in a web app?

    - by Jorre
    We are building an ecommerce app where we want our users to pick out a (any provider we can make compatible with our app) payment provider. Up to today, we only support paypal and we have implemented this rather manually. We are looking for some sort of a module (free or commercial) to easily plugin in more payment providers to let customers accept payments through them. Our customers would use this to accept payments for sales in their web shops. Any ideas on such "modules"? I know of the Zend_Payment module but that's not updated anymore or isn't out yet at all. We run PHP in the Zend Framework if that matters.

    Read the article

  • Serialport List Read problem and NullReferenceException?

    - by Plumbum7
    Hello everybody, Using Microsoft VC# 2008 Express (little fact about me : non experience in c#, programskills further very beginnerlevel. This peace op program is to communicate with Zigbee switching walloutlets (switching, status info). and is downloaded from http://plugwiselib.codeplex.com/SourceControl/list/changesets The problem: NullRefferenceException was UnHandled private void port_DataReceived(object sender, SerialDataReceivedEventArgs e) {// Event for receiving data string txt = port.ReadExisting(); Console.WriteLine(txt); List<PlugwiseMessage> msg = reader.Read (Regex.Split (txt, "\r\n" )); //Console.WriteLine( msg ); DataReceived(sender, new System.EventArgs(), msg); VC# Marks the last line and says msg is empty. so i looked further. Msg come's from txt text is filled with "000002D200C133E1\r\nPutFifoUnicast 40 : Handle 722 :"< so it goes wrong in or reader.Read or in the List so i looked further: public List<PlugwiseMessage> Read(string[] serialData) { Console.WriteLine(serialData); List<PlugwiseMessage> output = new List<PlugwiseMessage>(); Console.WriteLine(output); Both (serialData) as (output); are empty. So can i assume that the problem is in: Read(string[] serialData) But now the questions, Is Read(string[] serialData) something which is a Windows.Refence or is is from a Method ? and IF this is so is this then reader.READ (how can i find this)? (answered my own question proberly)(method reader)(private PlugwiseReader reader) So why isn't is working trough the serialData ? or is it the List<PlugwiseMessage> part, but i have no idea how it is filled can sombody help me ?

    Read the article

  • MVC MapPageRoute and ActionLink

    - by Dismissile
    I have created a page route so I can integrate my MVC application with a few WebForms pages that exist in my project: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); // register the report routes routes.MapPageRoute("ReportTest", "reports/test", "~/WebForms/Test.aspx" ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } This has created a problem whenever I use Html.ActionLink in my Views: <%: Html.ActionLink("Home", "Index", "Home") %> When I load the page in the browser the link appears like: http://localhost:12345/reports/test?action=Index&controller=Home Has anyone run into this before? How can I fix this?

    Read the article

  • Is it possible to raise an error if a variable assignment in a select returns multiple values?

    - by Brann
    I just found a bug on one of my softwares where I had forgotten a where clause. The code was something like that : declare @foo bigint declare @bar bigint select @foo = foo, @bar=bar from tbFooBar where (....a long list of condition goes there) (... and an extra condition should have went there but I forgot it) Unfortunately, the where clause I forgot was useful in very specific corner cases and the code went through testing successfully. Eventually, the query returned two values instead of one, and the resulting bug was a nightmare to track down (as it was very difficult to reproduce, and it wasn't obvious at all that this specific stored procedure was causing the issue we spotted) Debugging would have been a lot easier if the @foo=foo had raised an exception instead of silently assigning the first value out of multiple rows. Why is that this way? I can't think of a situation where one would actually want to do that without raising an error (bearing in mind the clauses 'distinct' and 'top' are there for a reason) And is there a way to make sql server 2008 raise an error if this situation occurs ?

    Read the article

  • Does the <script> tag position in HTML affects performance of the webpage?

    - by Rahul Joshi
    If the script tag is above or below the body in a HTML page, does it matter for the performance of a website? And what if used in between like this: <body> ..blah..blah.. <script language="JavaScript" src="JS_File_100_KiloBytes"> function f1() { .. some logic reqd. for manipulating contents in a webpage } </script> ... some text here too ... </body> Or is this better?: <script language="JavaScript" src="JS_File_100_KiloBytes"> function f1() { .. some logic reqd. for manipulating contents in a webpage } </script> <body> ..blah..blah.. ..call above functions on some events like onclick,onfocus,etc.. </body> Or this one?: <body> ..blah..blah.. ..call above functions on some events like onclick,onfocus,etc.. <script language="JavaScript" src="JS_File_100_KiloBytes"> function f1() { .. some logic reqd. for manipulating contents in a webpage } </script> </body> Need not tell everything is again in the <html> tag!! How does it affect performance of webpage while loading? Does it really? Which one is the best, either out of these 3 or some other which you know? And one more thing, I googled a bit on this, from which I went here: Best Practices for Speeding Up Your Web Site and it suggests put scripts at the bottom, but traditionally many people put it in <head> tag which is above the <body> tag. I know it's NOT a rule but many prefer it that way. If you don't believe it, just view source of this page! And tell me what's the better style for best performance.

    Read the article

  • JSF 2.0 Dynamic Views

    - by Robe Eleckers
    Hello, I'm working on a web project which uses JSF 2.0, PrimeFaces and PrettyFaces as main frameworks / libraries. The pages have the following (common) structure: Header, Content, Footer. Header: The Header always contains the same menu. This menu is a custom component, which generates a recursive html <ul><li> list containing <a href="url"> html links, this is all rendered with a custom renderer. The link looks like 'domain.com/website/datatable.xhtml?ref=2'. Where the ref=2 used to load the correct content from the database. I use prettyfaces to store this request value in a backingbean. Question 1: Is it ok to render the <a href> links myself, or should I better add an HTMLCommandLink from my UIComponent and render that in the encodeBegin/End? Question 2: I think passing variables like this is not really the JSF 2.0 style, how to do this in a better way? Content: The content contains dynamic data. It can be a (primefaces) datatable, build with dynamic data from the database. It can also be a text page, also loaded from the database. Or a series of graphs. You got the point, it's dynamic. The content is based on the link pressed in the header menu. If the content is of type datatable, then I put the ref=2 variable to a DataTableBean (via prettyfaces), which then loads the correct datatable from the database. If the content is of type chart, I'll put it on the ChartBean. Question 3: Is this a normal setup? Ideally I would like to update my content via Ajax. I hope it's clear :)

    Read the article

  • Complex class using PHP soapserver mapclass

    - by user559343
    Hi all, I need to create a server for processing SOAP requests. I have the wsdl and xml specifications, but I have a doubt: the xml elements are pretty complex, they are not simple type, but they have parent/child relationships (e.g. I have a Book class with an author subclass). How can I map this to PHP classes? In this example, should I create an author class i.e.: class Author { public $name; public $surname; } and then class Book { public $author; } will $author be a class of type Author? Or a typed array? Any help will be appreciated Thanks and happy new year!

    Read the article

  • Are Windows Domain Service Accounts Really Necessary?

    - by Zach Bonham
    One of the biggest problems we have in automating application deployments is the idea that running IIS AppPools and Windows Services under domain service accounts is a 'best practice'. Unfortunately, this best practice sometimes causes deployment headaches in that either we need to provision a new domain level service account quickly, or once we have the account, we now need to manage the account credentials. I had a great conversation about not making domain level service accounts a requirement and effectively taking one of two approaches: Secure at the node level using machine account(domain\machine$) and add the node to appropriate ActiveDirectory/Sql groups/roles Create local app specific accounts on each machine (machine\myapp) and add that account to appropriate ActiveDirectory/Sql groups/roles (the password here can change per deployment, it doesn't need to be stored) In both cases, it seems that its easier to manage either adding an account to appropriate group/role, or even stand up new, local account, than it is to have to provision a new domain level account and manage those credentials. This would hopefully ease the management burden on ActiveDirectory, Sql Server and Operations teams as there would be no more password management. We've not actually been able to implement this in practice yet. I am coming from a development background, so I'm curious as to how many ways this approach could go wrong? Can we really get rid of domain level service accounts with this direction? I'd appreciate any thoughts from anyone who has taken this path! Thanks! Zach

    Read the article

  • spontaneous hard disk password

    - by sc
    I had an HP proliant server go down recently. All of the sudden the sas controller (e200i) would not see any of the physical disks. New disks were detected just fine. I thought it was odd that all 6 disks would go down at one time so sent them to a data recovery firm to find out what happened. I'm being told that, somehow, all of the disks were spontaneously password protected. These are Hitachi 2.5" drives and I guess this is something of a known issue. The company has worked for a while to try and recover them, with no luck. Has anyone had experience with this? Any recommendations for how to recover the drives or a company that might have the expertise to do so?

    Read the article

  • Sql 2008 r2 DEV install failed

    - by obulay
    I am trying to install Sql 2008 r2 DEVeloper on Windows 2008 STD. It previously had Sql 2008 Enterprise installed. I first uninstalled SQL 2008. I think uninstall still leaves some crap in registery, and in Program files. Installation fails in the last step of the process - installation, about couple of minutes into it. Can't insert picture for you because serverfault does not allow me to do so. But it basically it: Error message: "Installation failed" I re-installed SQL 2008 Enterprise on this box and we are not going to go to R2 on older servers that previously had SQL 2005 or SQL 2008 on it. Looking at Windows log: Activation context generation failed for "C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\SQLServer2008R2\x64\Microsoft.SqlServer.Configuration.SqlServer_ConfigExtension.dll". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4027" could not be found. Please use sxstrace.exe for detailed diagnosis.

    Read the article

  • Old scheduled task still being started, but can't find it.

    - by JvO
    System: Windows XP Home Summary: Some scheduled task is still being started by Windows, but I can't find it, nor determine where its configuration has been stored. This is turning into a mystery for me... I set up a Windows XP Home machine to run a task at 7:00 AM, using the Task manager. This was a clean install, no users defined, so you got straight to the desktop after starting the machine. The filesystem uses NTFS. Later on, I needed to introduce users, so I created one (named Sam) with administrator privileges. After this I noticed that the scheduled task failed, most likely due to privilege errors (i.e. can't write to a network drive). So I want to delete the old task, and add it again with the correct user credentials. However.... I can't find the old task!! I know it is still being executed at 7:00 AM, but there's no mention anywhere on the system of this task. I've looked in c:\windows\tasks for .job files, but there's only the "MP Scheduled Scan.job" from Security Essentials. I've searched the whole disk for mention of the batch file that is being run, but can't find it. So why is this old task still running, and more importantly, why can't I find it? Would it have something to do with introducing users on XP?

    Read the article

  • How can I automate my Linux computer to power off (and on preferably) under certain circumstances?

    - by Ashimema
    OK, So a little background; I've been using Windows Home Server as a Backup Appliance, Media Server and Share Server at home for some time. I decided it was costing me allot of juice so very early on added the "Lights Out" add-on to ensure it was only running as and when needed. I'm now looking to switch to a Linux based server and I'm looking for a similar tool/set of tools for advanced power management. Now the question; Anyone got any all-in-one suggestions (i.e with client parts for both Windows and Linux and a server part for the Linux server), or can anyone simply verify that I'll need to set-up all the individual bits for this myself separately? (A tool similar to "[SmartPower][2]" but for linux would be a great start)

    Read the article

  • Problems to export java home and to find or create .bashrc in Mac OS X 10.6

    - by casiopea
    Hello, I need to install a program for my studies and, this program, need java to run. When I try to perform the installation say that cannot find the JDK; since the JDK is already installed by default in mac, the problem is export the java home. I´ve try a lot and I cant do it! I know that I have to add a line in a .bashrc file (or .profile, or .bash_profile) I´ve created all those files, at different times but nothing... I´m a new mac user, but I use Linux too and I dont know what happened, I just need to export java home to perform my work... and is really necessary for me to add environment variables too. Thanks for your help

    Read the article

  • Can you reference an entire column in OpenOffice Calc (like A:A in Excel)?

    - by Andy
    I'd like to refer to an entire column, like you can in Excel by using A:A. I found a discussion on the openoffice.org forums which is a few years old, and suggests there is/was no neat way to do it. The options presented are Use A1:A65536. Use OFFSET($A$1;0;0;65536;1) as the previous range may get altered if you insert or remove rows. Use Data - Define Range... to name the column range (but which for me still just equates to $A$1:$A$1048576). These approaches seem over-complicated and still don't achieve my goal perfectly. Does anyone know of a way? Thanks, Andy

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >