Search Results

Search found 5807 results on 233 pages for 'generic'.

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

  • Generic factory of generic containers

    - by Feuermurmel
    I have a generic abstract class Factory<T> with a method createBoxedInstance() which returns instances of T created by implementations of createInstance() wrapped in the generic container Box<T>. abstract class Factory<T> { abstract T createInstance(); public final Box<T> createBoxedInstance() { return new Box<T>(createInstance()); } public final class Box<T> { public final T content; public Box(T content) { this.content = content; } } } At some points I need a container of type Box<S> where S is an ancestor of T. Is it possible to make createBoxedInstance() itself generic so that it will return instances of Box<S> where S is chosen by the caller? Sadly, defining the function as follows does not work as a type parameter cannot be declared using the super keyword, only used. public final <S super T> Box<S> createBoxedInstance() { return new Box<S>(createInstance()); } The only alternative I see, is to make all places that need an instance of Box<S> accept Box<? extends S> which makes the container's content member assignable to S. Is there some way around this without re-boxing the instances of T into containers of type Box<S>? (I know I could just cast the Box<T> to a Box<S> but I would feel very, very guilty.)

    Read the article

  • Update fails to Install

    - by FirmTech
    I get the below error when I try to install updates using Software Updater: Not enough free disk space The upgrade needs a total of 81.3 M free space on disk '/boot'. Please free at least an additional 15.9 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'. What should I do? firmtechnologies@FirmTechnologies:~$ (ls -l /boot) total 155801 -rw-r--r-- 1 root root 1158016 May 3 01:30 abi-3.13.0-24-generic -rw-r--r-- 1 root root 1161713 May 8 01:31 abi-3.13.0-26-generic -rw-r--r-- 1 root root 1161713 May 15 20:07 abi-3.13.0-27-generic -rw-r--r-- 1 root root 1161764 Jun 4 22:57 abi-3.13.0-29-generic -rw-r--r-- 1 root root 165510 May 3 01:30 config-3.13.0-24-generic -rw-r--r-- 1 root root 165538 May 8 01:31 config-3.13.0-26-generic -rw-r--r-- 1 root root 165521 May 15 20:07 config-3.13.0-27-generic -rw-r--r-- 1 root root 165544 Jun 4 22:57 config-3.13.0-29-generic drwxr-xr-x 5 root root 1024 Jun 6 14:31 grub -rw-r--r-- 1 root root 29091568 May 7 21:31 initrd.img-3.13.0-24-generic -rw-r--r-- 1 root root 29094684 May 12 12:24 initrd.img-3.13.0-26-generic -rw-r--r-- 1 root root 29095678 May 18 10:57 initrd.img-3.13.0-27-generic -rw-r--r-- 1 root root 29093700 Jun 6 14:32 initrd.img-3.13.0-29-generic drwx------ 2 root root 12288 Apr 30 17:11 lost+found -rw-r--r-- 1 root root 176500 Mar 12 13:31 memtest86+.bin -rw-r--r-- 1 root root 178176 Mar 12 13:31 memtest86+.elf -rw-r--r-- 1 root root 178680 Mar 12 13:31 memtest86+_multiboot.bin -rw------- 1 root root 3372643 May 3 01:30 System.map-3.13.0-24-generic -rw------- 1 root root 3377429 May 8 01:31 System.map-3.13.0-26-generic -rw------- 1 root root 3377429 May 15 20:07 System.map-3.13.0-27-generic -rw------- 1 root root 3378267 Jun 4 22:57 System.map-3.13.0-29-generic -rw------- 1 root root 5776416 May 3 01:30 vmlinuz-3.13.0-24-generic -rw------- 1 root root 5790912 May 8 01:30 vmlinuz-3.13.0-26-generic -rw------- 1 root root 5790912 May 15 20:07 vmlinuz-3.13.0-27-generic -rw------- 1 root root 5792544 Jun 4 22:57 vmlinuz-3.13.0-29-generic

    Read the article

  • Java multi Generic collection parameters complie error

    - by Geln Yang
    Hi, So strange!Please have a look the code first: public class A { } public class B extends A { } public class C extends A { } public class TestMain { public <T extends A> void test(T a, T b) { } public <T extends A> void test(List<T> a, List<T> b) { } public static void main(String[] args) { new TestMain().test(new B(), new C()); new TestMain().test(new ArrayList<B>(), new ArrayList<C>()); } } The statement "new TestMain().test(new ArrayList(), new ArrayList())" get a "Bound mismatch" compile error, while "new TestMain().test(new B(), new C())" is compiled ok. Bound mismatch: The generic method test(T, T) of type TestMain is not applicable for the arguments (ArrayList, ArrayList). The inferred type ArrayList is not a valid substitute for the bounded parameter It seems the type of the second generic List parameter is limited by the Type of the first.Is it a feature or a bug of the compile program? ps, jdk:1.6,IDE:Eclipse 3.5.1

    Read the article

  • Different behavior of reflected generic delegates with and without debugger

    - by Andrew_B
    Hello. We have encountered some strange things while calling reflected generic delegates. In some cases with attatched debuger we can make impossible call, while without debugger we cannot catch any exception and application fastfails. Here is the code: using System; using System.Windows.Forms; using System.Reflection; namespace GenericDelegate { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private delegate Class2 Delegate1(); private void button1_Click(object sender, EventArgs e) { MethodInfo mi = typeof (Class1<>).GetMethod("GetClass", BindingFlags.NonPublic | BindingFlags.Static); if (mi != null) { Delegate1 del = (Delegate1) Delegate.CreateDelegate(typeof (Delegate1), mi); MessageBox.Show("1"); try { del(); } catch (Exception) { MessageBox.Show("No, I can`t catch it"); } MessageBox.Show("2"); mi.Invoke(null, new object[] {});//It's Ok, we'll get exception here MessageBox.Show("3"); } } class Class2 { } class Class1<T> : Class2 { internal static Class2 GetClass() { Type type = typeof(T); MessageBox.Show("Type name " + type.FullName +" Type: " + type + " Assembly " + type.Assembly); return new Class1<T>(); } } } } There are two problems: Behavior differs with debugger and without You cannot catch this error without debugger by clr tricks. It's just not the clr exception. There are memory acces vialation, reading zero pointer inside of internal code. Use case: You develop something like plugins system for your app. You read external assembly, find suitable method in some type, and execute it. And we just forgot about that we need to check up is the type generic or not. Under VS (and .net from 2.0 to 4.0) everything works fine. Called function does not uses static context of generic type and type parameters. But without VS application fails with no sound. We even cannot identify call stack attaching debuger. Tested with .net 4.0 The question is why VS catches but runtime do not?

    Read the article

  • Using generic type from other generic parameter

    - by DEHAAS
    Hi, I have a question about .net generics. Consider the following code: public class Test<TKey> { TKey Key { get; set; } } public class Wrapper<TValue, TKey> where TValue : Test<TKey> { public TValue Value { get; set; } } Now, when using this code, I could do something like this: Wrapper<Test<int>, int> wrapper = new Wrapper<Test<int>, int>(); The int type parameter has to be provided twice. Is it possible to modify the Wrapper definition, to require TValue to be a generic type, and use this 'nested' generic type parameter insted of the TKey type parameter?

    Read the article

  • usb mouse/keyboard doesn't work with 3.11.0-12-generic kernel

    - by x-yuri
    I can't use my usb keyboard/mouse after upgrade from raring to saucy. The keyboard works in grub menu and if I boot with the previous kernel version (3.8.0-31-generic). My new kernel version is 3.11.0-12-generic. I've got Mad Catz R.A.T.7 wired USB mouse, Canyon CNL-MBMSO02 wired usb mouse and Logitech diNovo Edge wireless keyboard, connected to computer through Logitech Unifying Receiver. Using PS/2 keyboard I've managed to get some information. dmesg says: [ 0.166273] ACPI: bus type USB registered [ 0.166273] usbcore: registered new interface driver usbfs [ 0.166273] usbcore: registered new interface driver hub [ 0.166273] usbcore: registered new device driver usb ... [ 3.534226] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 3.534228] ehci-pci: EHCI PCI platform driver [ 3.534291] ehci-pci 0000:00:1a.7: setting latency timer to 64 [ 3.534299] ehci-pci 0000:00:1a.7: EHCI Host Controller [ 3.534304] ehci-pci 0000:00:1a.7: new USB bus registered, assigned bus number 1 [ 3.534315] ehci-pci 0000:00:1a.7: debug port 1 [ 3.538218] ehci-pci 0000:00:1a.7: cache line size of 64 is not supported [ 3.538231] ehci-pci 0000:00:1a.7: irq 18, io mem 0xd3325400 [ 3.548017] ehci-pci 0000:00:1a.7: USB 2.0 started, EHCI 1.00 [ 3.548042] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 3.548045] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.548048] usb usb1: Product: EHCI Host Controller [ 3.548050] usb usb1: Manufacturer: Linux 3.11.0-12-generic ehci_hcd [ 3.548053] usb usb1: SerialNumber: 0000:00:1a.7 [ 3.548155] hub 1-0:1.0: USB hub found [ 3.548159] hub 1-0:1.0: 6 ports detected [ 3.548311] ehci-pci 0000:00:1d.7: setting latency timer to 64 [ 3.548319] ehci-pci 0000:00:1d.7: EHCI Host Controller [ 3.548323] ehci-pci 0000:00:1d.7: new USB bus registered, assigned bus number 2 [ 3.548333] ehci-pci 0000:00:1d.7: debug port 1 [ 3.552228] ehci-pci 0000:00:1d.7: cache line size of 64 is not supported [ 3.552239] ehci-pci 0000:00:1d.7: irq 23, io mem 0xd3325000 [ 3.564014] ehci-pci 0000:00:1d.7: USB 2.0 started, EHCI 1.00 [ 3.564044] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002 [ 3.564047] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.564050] usb usb2: Product: EHCI Host Controller [ 3.564052] usb usb2: Manufacturer: Linux 3.11.0-12-generic ehci_hcd [ 3.564056] usb usb2: SerialNumber: 0000:00:1d.7 [ 3.564163] hub 2-0:1.0: USB hub found [ 3.564167] hub 2-0:1.0: 6 ports detected [ 3.564274] ehci-platform: EHCI generic platform driver [ 3.564280] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 3.564281] ohci-platform: OHCI generic platform driver [ 3.564287] uhci_hcd: USB Universal Host Controller Interface driver [ 3.564345] uhci_hcd 0000:00:1a.0: setting latency timer to 64 [ 3.564347] uhci_hcd 0000:00:1a.0: UHCI Host Controller [ 3.564352] uhci_hcd 0000:00:1a.0: new USB bus registered, assigned bus number 3 [ 3.564378] uhci_hcd 0000:00:1a.0: irq 16, io base 0x0000f0c0 [ 3.564402] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.564404] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.564406] usb usb3: Product: UHCI Host Controller [ 3.564408] usb usb3: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.564410] usb usb3: SerialNumber: 0000:00:1a.0 [ 3.564478] hub 3-0:1.0: USB hub found [ 3.564482] hub 3-0:1.0: 2 ports detected [ 3.564589] uhci_hcd 0000:00:1a.1: setting latency timer to 64 [ 3.564592] uhci_hcd 0000:00:1a.1: UHCI Host Controller [ 3.564597] uhci_hcd 0000:00:1a.1: new USB bus registered, assigned bus number 4 [ 3.564623] uhci_hcd 0000:00:1a.1: irq 21, io base 0x0000f0a0 [ 3.564647] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.564649] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.564651] usb usb4: Product: UHCI Host Controller [ 3.564653] usb usb4: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.564654] usb usb4: SerialNumber: 0000:00:1a.1 [ 3.564727] hub 4-0:1.0: USB hub found [ 3.564730] hub 4-0:1.0: 2 ports detected [ 3.564834] uhci_hcd 0000:00:1a.2: setting latency timer to 64 [ 3.564837] uhci_hcd 0000:00:1a.2: UHCI Host Controller [ 3.564843] uhci_hcd 0000:00:1a.2: new USB bus registered, assigned bus number 5 [ 3.564863] uhci_hcd 0000:00:1a.2: irq 18, io base 0x0000f080 [ 3.564885] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.564887] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.564889] usb usb5: Product: UHCI Host Controller [ 3.564891] usb usb5: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.564892] usb usb5: SerialNumber: 0000:00:1a.2 [ 3.564962] hub 5-0:1.0: USB hub found [ 3.564966] hub 5-0:1.0: 2 ports detected [ 3.565073] uhci_hcd 0000:00:1d.0: setting latency timer to 64 [ 3.565076] uhci_hcd 0000:00:1d.0: UHCI Host Controller [ 3.565081] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 6 [ 3.565101] uhci_hcd 0000:00:1d.0: irq 23, io base 0x0000f060 [ 3.565124] usb usb6: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.565127] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.565128] usb usb6: Product: UHCI Host Controller [ 3.565130] usb usb6: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.565132] usb usb6: SerialNumber: 0000:00:1d.0 [ 3.565195] hub 6-0:1.0: USB hub found [ 3.565198] hub 6-0:1.0: 2 ports detected [ 3.565303] uhci_hcd 0000:00:1d.1: setting latency timer to 64 [ 3.565306] uhci_hcd 0000:00:1d.1: UHCI Host Controller [ 3.565310] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 7 [ 3.565329] uhci_hcd 0000:00:1d.1: irq 19, io base 0x0000f040 [ 3.565352] usb usb7: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.565354] usb usb7: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.565356] usb usb7: Product: UHCI Host Controller [ 3.565358] usb usb7: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.565359] usb usb7: SerialNumber: 0000:00:1d.1 [ 3.565424] hub 7-0:1.0: USB hub found [ 3.565427] hub 7-0:1.0: 2 ports detected [ 3.565534] uhci_hcd 0000:00:1d.2: setting latency timer to 64 [ 3.565537] uhci_hcd 0000:00:1d.2: UHCI Host Controller [ 3.565541] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 8 [ 3.565560] uhci_hcd 0000:00:1d.2: irq 18, io base 0x0000f020 [ 3.565584] usb usb8: New USB device found, idVendor=1d6b, idProduct=0001 [ 3.565587] usb usb8: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 3.565588] usb usb8: Product: UHCI Host Controller [ 3.565590] usb usb8: Manufacturer: Linux 3.11.0-12-generic uhci_hcd [ 3.565592] usb usb8: SerialNumber: 0000:00:1d.2 [ 3.565658] hub 8-0:1.0: USB hub found [ 3.565661] hub 8-0:1.0: 2 ports detected ... [ 4.120014] usb 2-3: new high-speed USB device number 2 using ehci-pci ... [ 4.468908] usb 2-3: New USB device found, idVendor=046d, idProduct=0825 [ 4.468912] usb 2-3: New USB device strings: Mfr=0, Product=0, SerialNumber=2 [ 4.468914] usb 2-3: SerialNumber: AF582E10 ... [ 5.284019] usb 5-2: new full-speed USB device number 2 using uhci_hcd [ 5.465903] usb 5-2: New USB device found, idVendor=046d, idProduct=0b04 [ 5.465908] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 5.465911] usb 5-2: Product: Logitech BT Mini-Receiver [ 5.465914] usb 5-2: Manufacturer: Logitech [ 5.468948] hub 5-2:1.0: USB hub found [ 5.470898] hub 5-2:1.0: 3 ports detected [ 5.476096] Switched to clocksource tsc [ 5.712099] usb 7-2: new full-speed USB device number 2 using uhci_hcd [ 5.896366] usb 7-2: New USB device found, idVendor=046d, idProduct=c52b [ 5.896370] usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 5.896372] usb 7-2: Product: USB Receiver [ 5.896374] usb 7-2: Manufacturer: Logitech [ 6.140016] usb 8-1: new full-speed USB device number 2 using uhci_hcd [ 6.324597] usb 8-1: New USB device found, idVendor=0738, idProduct=1708 [ 6.324603] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 6.324605] usb 8-1: Product: Mad Catz R.A.T.7 Mouse [ 6.324608] usb 8-1: Manufacturer: Mad Catz [ 6.564012] usb 8-2: new low-speed USB device number 3 using uhci_hcd [ 6.746602] usb 8-2: New USB device found, idVendor=1d57, idProduct=0010 [ 6.746608] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 6.746610] usb 8-2: Product: usb mouse with wheel [ 6.746613] usb 8-2: Manufacturer: HID-Compliant Mouse [ 7.337898] usb 5-2.2: new full-speed USB device number 3 using uhci_hcd [ 7.490902] usb 5-2.2: New USB device found, idVendor=046d, idProduct=c713 [ 7.490907] usb 5-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 7.490910] usb 5-2.2: Product: Logitech BT Mini-Receiver [ 7.490913] usb 5-2.2: Manufacturer: Logitech [ 7.490915] usb 5-2.2: SerialNumber: 001F203BD6A7 [ 7.569898] usb 5-2.3: new full-speed USB device number 4 using uhci_hcd [ 7.722901] usb 5-2.3: New USB device found, idVendor=046d, idProduct=c714 [ 7.722906] usb 5-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 7.722909] usb 5-2.3: Product: Logitech BT Mini-Receiver [ 7.722911] usb 5-2.3: Manufacturer: Logitech [ 7.722913] usb 5-2.3: SerialNumber: 001F203BD6A7 lsusb (more output): Bus 002 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 008 Device 003: ID 1d57:0010 Xenta Bus 008 Device 002: ID 0738:1708 Mad Catz, Inc. Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 004: ID 046d:c714 Logitech, Inc. diNovo Edge Keyboard Bus 005 Device 003: ID 046d:c713 Logitech, Inc. Bus 005 Device 002: ID 046d:0b04 Logitech, Inc. Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub More background. Before that I had a problem with logging in to GNOME. During which I upgraded all the packages at one point (apt-get upgrade) and it stopped booting at all (it didn't get to login screen). Then I fixed PATH issue and now I've got this usb-not-working issue. I tried reinstalling kernel, to no effect. Is there anything else I can do to fix or diagnose the problem?

    Read the article

  • Problem resolving a generic Repository with Entity Framework and Castle Windsor Container

    - by user368776
    Hi, im working in a generic repository implementarion with EF v4, the repository must be resolved by Windsor Container. First the interface public interface IRepository<T> { void Add(T entity); void Delete(T entity); T Find(int key) } Then a concrete class implements the interface public class Repository<T> : IRepository<T> where T: class { private IObjectSet<T> _objectSet; } So i need _objectSet to do stuff like this in the previous class public void Add(T entity) { _objectSet.AddObject(entity); } And now the problem, as you can see im using a EF interface like IObjectSet to do the work, but this type requires a constraint for the T generic type "where T: class". That constrait is causing an exception when Windsor tries to resolve its concrete type. Windsor configuration look like this. <castle> <components> <component id="LVRepository" service="Repository.Infraestructure.IRepository`1, Repository" type="Repository.Infraestructure.Repository`1, Repository" lifestyle="transient"> </component> </components> The container resolve code IRepository<Product> productsRep =_container.Resolve<IRepository<Product>>(); Now the exception im gettin System.ArgumentException: GenericArguments[0], 'T', on 'Repository.Infraestructure.Repository`1[T]' violates the constraint of type 'T'. ---> System.TypeLoadException: GenericArguments[0], 'T', on 'Repository.Infraestructure.Repository`1[T]' violates the constraint of type parameter 'T'. If i remove the constraint in the concrete class and the depedency on IObjectSet (if i dont do it get a compile error) everything works FINE, so i dont think is a container issue, but IObjectSet is a MUST in the implementation. Some help with this, please.

    Read the article

  • C# ASP.NET Binding Controls via Generic Method

    - by OverTech
    I have a few web applications that I maintain and I find myself very often writing the same block of code over and over again to bind a GridView to a data source. I'm trying to create a Generic method to handle data binding but I'm having trouble getting it to work with Repeaters and DataLists. Here is the Generic method I have so far: public void BindControl<T>(T control, SqlCommand sql) where T : System.Web.UI.WebControls.BaseDataBoundControl { cmd = sql; cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { control.DataSource = dr; control.DataBind(); } dr.Close(); cn.Close(); } That way I can just define my CommandText then make a call to "BindControls(myGridView, cmd)" instead of retyping this same basic block of code every time I need to bind a grid. The problem is, this doesn't work with Repeaters or DataLists. Each of these controls inherit their respective "DataSource" and "DataBind" methods from different classes. Someone on another forum suggested that I implement an interface, but I'm not sure how to make that work either. The GridView, Datalist and Repeater get their respective "DataBind" methods from BaseDataBoundControl, BaseDataList, and Repeater classes. How would I go about creating a single interface to tie them all together? Or am I better off just using 3 overloads for this method? Dave

    Read the article

  • Django throws 404 at generic views

    - by x0rg
    I'm trying to get the generic views for a date-based archive working in django. I defined the urls as described in a tutorial, but django returns a 404 error whenever I want to access an url with a variable (such as month or year) in it. It don't even produces a TemplateDoesNotExist-execption. Normal urls without variables work fine. Here's my urlconf: from django.conf.urls.defaults import * from zurichlive.zhl.models import Event info_dict = { 'queryset': Event.objects.all(), 'date_field': 'date', 'allow_future': 'True', } urlpatterns += patterns('django.views.generic.date_based', (r'events/(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='archive/detail.html')), (r'^events/(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, template_name='archive/list.html')), (r'^events/(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/$','archive_day',dict(info_dict,template_name='archive/list.html')), (r'^events/(?P<year>d{4})/(?P<month>[a-z]{3})/$','archive_month', dict(info_dict, template_name='archive/list.html')), (r'^events/(?P<year>)/$','archive_year', dict(info_dict, template_name='archive/list.html')), (r'^events/$','archive_index', dict(info_dict, template_name='archive/list.html')), ) When I access /events/2010/may/12/this-is-a-slug I should get to the detail.html template, but instead I get a 404. What am I doing wrong?

    Read the article

  • Reusable non generic method for generic methods

    - by Jehof
    I have the following base interface public interface IHandler{ void Handle(IMessage message); } and an generic interface inheriting the base interface public interface IHandler<TMessage> : IHandler where TMessage : IMessage{ void Handle(TMessage message); } My classes can implement the interface IHandler<TMessage> mutiple times. IMessage is an base interface for messages and isn´t relevant here. Currently i´m implementing the interfaces as follows. public class ExampleHandler : IHandler<ExampleMessage>, IHandler<OtherExampleMessag>{ void IHandler.Handle(IMessage message){ ExampleMessage example = message as ExampleMessage; if (example != null) { Handle(example); } else { OtherExampleMessage otherExample = message as OtherExampleMessage; if (otherExample != null) { Handle(otherExample); } } public void Handle(ExampleMessage) { //handle message; } public void Handle(OtherExampleMessage) { //handle message; } } What bothers me is the way i have to implement the Handle(IMessage) method, cause in my opinion its many redundant code, and i have to extend the method each time when i implement a new IHandler<TMessage> interface on my class. What i´m looking for is a more generic way to implement the Handle(IMessage) method (maybe in a base class for Handlers), but i´m currently stuck how to do that.

    Read the article

  • Generic tree implementation in Java

    - by Ivan
    Is anyone aware of a generic tree (nodes may have multiple children) implementation for Java? It should come from a well trusted source and must be fully tested. It just doesn't seem right implementing it myself. Almost reminds me of my university years when we were supposed to write all our collections ourselves. EDIT: Found this project on java.net, might be worth looking into.

    Read the article

  • How can I use generic here.

    - by Shantanu Gupta
    I am trying to use generic for the first time and trying to typecast my result returned from database to programmer defined data type. How can I do this. dsb.ExecuteQuery( "DELETE FROM CurrencyMaster WHERE CurrencyMasterId=" + returnValueFromGrid<int>(getSelectedRowIndex(), "CurrencyMasterId"));` private T returnValueFromGrid<T>(int RowNo, string ColName) { return Convert.ChangeType(dgvCurrencyMaster.Rows[RowNo].Cells[ColName].Value,T); }

    Read the article

  • Generic TryParse

    - by Piers Myers
    I am trying to create a generic extension that uses 'TryParse' to check if a string is a given type: public static bool Is<T>(this string input) { T notUsed; return T.TryParse(input, out notUsed); } this won't compile as it cannot resolve symbol 'TryParse' As I understand, 'TryParse' is not part of any interface. Is this possible to do at all?

    Read the article

  • Create a ASP.NET Generic gridview

    - by harold-sota
    I wont to create a User Control based in gridview that have the edit add delete incorporate, the problem is these: In the admin part of my web site i have to repeat the same action for view add delete update the data for different datasource. I wont to create a generic gridview that have incorporate these action. The gridview can take a xml file for configure him self dependently of the request for desplay the data. Any ideas how i can do it?

    Read the article

  • Go - Generic function using an interface

    - by nevalu
    Since I've a similar function for 2 different data types: func GetStatus(value uint8) (string) {...} func GetStatus(name string) (string) {...} I would want to use a way more simple like: func GetStatus(value interface{}) (string) {...} Is possible to create a generic function using an interface? The data type could be checked using reflect.Typeof(value)

    Read the article

  • c# array vs generic list

    - by L G
    Hi, i basically want to know the differences or advantages in using a generic list instead of an array in the below mentioned scenario Class Employee { private _empName; Public EmpName { get{return _empName;} set{_empName = value;} } } 1. Employee[] emp 2. List<Employee> emp can anyone please tell me the advantages or disadvaatges and which one to prefer

    Read the article

  • Kernel Error during upgrade or update commands

    - by Ashesh
    I am getting these errors during sudo apt-get update and upgrade... I tried all possible options no success. I recently upgraded to 13.04 and had problems with Broadcom WiFi. Fixed tat issues using the clean script... but looks like it did not install the Kernel properly.. Here is the o/p of the few scripts I ran: ashesh@ashesh-HPdv4:~$ sudo dpkg -r bcmwl-kernel-source (Reading database ... 175338 files and directories currently installed.) Removing bcmwl-kernel-source ... Removing all DKMS Modules Done. update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools ... update-initramfs: Generating /boot/initrd.img-3.8.0-25-generic cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/mtd/mtd.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/mtd/mtd.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/sfc/sfc.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/sfc/sfc.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/broadcom/cnic.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/broadcom/cnic.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/qlogic/netxen/netxen_nic.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/qlogic/netxen/netxen_nic.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/brocade/bna/bna.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/net/ethernet/brocade/bna/bna.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/scsi/libfc/libfc.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/scsi/libfc/libfc.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/scsi/advansys.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/scsi/advansys.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/scsi/be2iscsi/be2iscsi.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/scsi/be2iscsi/be2iscsi.ko’: Input/output error cp: reading ‘/lib/modules/3.8.0-25-generic/kernel/drivers/scsi/bnx2i/bnx2i.ko’: Input/output error cp: failed to extend ‘/tmp/mkinitramfs_8gjKwQ//lib/modules/3.8.0-25-generic/kernel/drivers/scsi/bnx2i/bnx2i.ko’: Input/output error Bus error (core dumped) depmod: ../libkmod/libkmod-elf.c:207: elf_get_mem: Assertion `offset < elf->size' failed. Aborted (core dumped) I am not a techie but I need your support to resolve this without re-installation from scratch....

    Read the article

  • Nvidia drivers don't work with mainline kernel

    - by dutchie
    I want to try some of the new features in the btrfs filesystem, and to do that I need to use a newer kernel than is included in Ubuntu 12.04. To do that, I have installed linux-headers-3.4.0-030400_3.4.0-030400.201205210521_all.deb, linux-headers-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb, and linux-image-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb from the mainline kernel download here. However, on rebooting into the 3.4 kernel, my desktop is stuck at a very low resolution and I cannot increase it to the full. This did happen when I first installed, but a simple install of the nvidia-current package got everything working nicely with my GTX570 card. There were appear to be some DKMS errors when I installed the kernel, and they indicated I should look at /var/lib/dkms/nvidia-current/295.40/build/make.log: josh@sirius:~/Downloads$ sudo dpkg -i linux-*.deb Selecting previously unselected package linux-headers-3.4.0-030400. (Reading database ... 309400 files and directories currently installed.) Unpacking linux-headers-3.4.0-030400 (from linux-headers-3.4.0-030400_3.4.0-030400.201205210521_all.deb) ... Selecting previously unselected package linux-headers-3.4.0-030400-generic. Unpacking linux-headers-3.4.0-030400-generic (from linux-headers-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb) ... Selecting previously unselected package linux-image-3.4.0-030400-generic. Unpacking linux-image-3.4.0-030400-generic (from linux-image-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb) ... Done. Setting up linux-headers-3.4.0-030400 (3.4.0-030400.201205210521) ... Setting up linux-headers-3.4.0-030400-generic (3.4.0-030400.201205210521) ... Examining /etc/kernel/header_postinst.d. run-parts: executing /etc/kernel/header_postinst.d/dkms 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic ERROR (dkms apport): kernel package linux-headers-3.4.0-030400-generic is not supported Error! Bad return status for module build on kernel: 3.4.0-030400-generic (x86_64) Consult /var/lib/dkms/nvidia-current/295.40/build/make.log for more information. Setting up linux-image-3.4.0-030400-generic (3.4.0-030400.201205210521) ... Running depmod. update-initramfs: deferring update (hook will be called later) Examining /etc/kernel/postinst.d. run-parts: executing /etc/kernel/postinst.d/dkms 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic ERROR (dkms apport): kernel package linux-headers-3.4.0-030400-generic is not supported Error! Bad return status for module build on kernel: 3.4.0-030400-generic (x86_64) Consult /var/lib/dkms/nvidia-current/295.40/build/make.log for more information. run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic update-initramfs: Generating /boot/initrd.img-3.4.0-030400-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic run-parts: executing /etc/kernel/postinst.d/update-notifier 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.4.0-030400-generic /boot/vmlinuz-3.4.0-030400-generic Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.4.0-030400-generic Found initrd image: /boot/initrd.img-3.4.0-030400-generic Found linux image: /boot/vmlinuz-3.2.0-24-generic Found initrd image: /boot/initrd.img-3.2.0-24-generic Found memtest86+ image: /memtest86+.bin Found Ubuntu 12.04 LTS (12.04) on /dev/sda1 Found Windows 7 (loader) on /dev/sda2 Found Windows 7 (loader) on /dev/sda3 done /var/lib/dkms/nvidia-current/295.40/build/make.log: DKMS make.log for nvidia-current-295.40 for kernel 3.4.0-030400-generic (x86_64) Thu Jun 7 00:58:39 BST 2012 NVIDIA: calling KBUILD... test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo; \ echo " ERROR: Kernel configuration is invalid."; \ echo " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo; \ /bin/false) mkdir -p /var/lib/dkms/nvidia-current/295.40/build/.tmp_versions ; rm -f /var/lib/dkms/nvidia-current/295.40/build/.tmp_versions/* make -f scripts/Makefile.build obj=/var/lib/dkms/nvidia-current/295.40/build cc -Wp,-MD,/var/lib/dkms/nvidia-current/295.40/build/.nv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/include -I/usr/src/linux-headers-3.4.0-030400-generic/arch/x86/include -Iarch/x86/include/generated -Iinclude -include /usr/src/linux-headers-3.4.0-030400-generic/include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=1024 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/var/lib/dkms/nvidia-current/295.40/build -Wall -MD -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"295.40\" -Wno-unused-function -Wuninitialized -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(nv)" -D"KBUILD_MODNAME=KBUILD_STR(nvidia)" -c -o /var/lib/dkms/nvidia-current/295.40/build/.tmp_nv.o /var/lib/dkms/nvidia-current/295.40/build/nv.c In file included from include/linux/kernel.h:19:0, from include/linux/sched.h:55, from include/linux/utsname.h:35, from /var/lib/dkms/nvidia-current/295.40/build/nv-linux.h:38, from /var/lib/dkms/nvidia-current/295.40/build/nv.c:13: include/linux/bitops.h: In function ‘hweight_long’: include/linux/bitops.h:66:41: warning: signed and unsigned type in conditional expression [-Wsign-compare] In file included from /usr/src/linux-headers-3.4.0-030400-generic/arch/x86/include/asm/uaccess.h:577:0, from include/linux/poll.h:14, from /var/lib/dkms/nvidia-current/295.40/build/nv-linux.h:97, from /var/lib/dkms/nvidia-current/295.40/build/nv.c:13: /usr/src/linux-headers-3.4.0-030400-generic/arch/x86/include/asm/uaccess_64.h: In function ‘copy_from_user’: /usr/src/linux-headers-3.4.0-030400-generic/arch/x86/include/asm/uaccess_64.h:53:6: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] In file included from /var/lib/dkms/nvidia-current/295.40/build/nv.c:13:0: /var/lib/dkms/nvidia-current/295.40/build/nv-linux.h: At top level: /var/lib/dkms/nvidia-current/295.40/build/nv-linux.h:114:75: fatal error: asm/system.h: No such file or directory compilation terminated. make[3]: *** [/var/lib/dkms/nvidia-current/295.40/build/nv.o] Error 1 make[2]: *** [_module_/var/lib/dkms/nvidia-current/295.40/build] Error 2 NVIDIA: left KBUILD. nvidia.ko failed to build! make[1]: *** [module] Error 1 make: *** [module] Error 2

    Read the article

  • linq2sql : get generic type of table

    - by benpage
    i think this is a simple question but I've searched around and can't seem to find an answer easily. if you have var list = List<int>(); ... fill list ... and you want to get the generic type in list, i realise you could just type: var t = list.FirstOrDefault().GetType(); Is there another way to do this via just the list, rather than referring to the enumeration? Reason is, i have a System.Data.Linq.Table<TABLE1> and what i want to do is get the type of TABLE1 from it. so: var table = new DataContext().TABLE1s; // this is Table<TABLE1> var tableType = table.GetType().SomeMethod(); // i want tableType to equal TABLE1.GetType()

    Read the article

  • Return pointer to nested inner class from generic outer class

    - by helixed
    I'm new to C++, so bear with me. I have a generic class called A. A has a nested class called B. A contains a method called getB(), which is supposed to return a new instance of B. However, I can't get my code to compile. Here's what it looks like:#include A.h template <class E> class A { public: class B { public: int data; }; B * getB(); }; A.cpp #include "A.h" template <class E> A<E>::B * A::getB() { return new B(); } When I try to compile this, I get the following error: error: expected constructor, destructor, or type conversion before '*' token Does anybody know what I'm doing wrong? Thanks, helixed

    Read the article

  • Generic type in generic collection

    - by Brian Triplett
    I have generic type that looks like: public class GenericClass<T, U> where T : IComparable<T> { // Class definition here } I then have a collection of these instances. What is the cleanest way to pass through the type constraints? public class GenericCollection<V> where V : GenericClass<T, U> // This won't compile { private GenericClass<T, U>[] entries; public V this[index] { get{ return this.entries[index]; } } } Is there perhaps a better way to design this? I think that specifying GenericCollection<T, U, V> where V : GenericClass<T, U> seems awkward. Might be my only option though....

    Read the article

  • Constrain generic extension method to base types and string

    - by hitch
    I want to have an extension method for XElement/XAttribute that allows me to apply a "ValueOrDefault" logic - perhaps with various slightly different implementations: ValueOrNull, ValueOrDefault, NumericValueOrDefault (which validates if the value is numeric), but I want to constrain these methods so that they can only work with ValueTypes or String (i.e. it does not really make sense to use any other reference types. Is it possible to do this with one implementation of each method, or will I have to have one where the constraint is "Structure" and one where the constraint is "String" - if I combine Structure and String in the generic constraint, I get the error : 'Structure' constraint and a specific class type constraint cannot be combined. An example of the current method implementation is as follows: <Extension()> _ Public Function ValueOrDefault(Of T As {Structure})(ByVal xe As XElement, ByVal defaultValue As T) As T If xe Is Nothing or xe.Value = "" Then Return defaultValue End If Return CType(Convert.ChangeType(xe.Value, GetType(T)), T) End Function

    Read the article

  • How to declare a generic constraint that is a generic type

    - by HackedByChinese
    I have a two generic abstract types: Entity and Association. Let's say Entity looks like this: public class Entity<TId> { //... } and Association looks like this: public class Association<TEntity, TEntity2> { //... } How do I constrain Association so they can be of any Entity? I can accomplish it by the following: public class Association<TEntity, TId, TEntity2, TId2> where TEntity : Entity<TId> where TEntity2: Entity<TId2> { //... } This gets very tedious as more types derive from Association, because I have to keep passing down TId and TId2. Is there a simpler way to do this, besides just removing the constraint?

    Read the article

  • Extract Generic types from extended Generic

    - by Brigham
    I'm trying to refactor a class and set of subclasses where the M type does extend anything, even though we know it has to be a subclass of a certain type. That type is parametrized and I would like its parametrized types to be available to subclasses that already have values for M. Is there any way to define this class without having to include the redundant K and V generic types in the parameter list. I'd like to be able to have the compiler infer them from whatever M is mapped to by subclasses. public abstract class NewParametrized<K, V, M extends SomeParametrized<K, V>> { public void someMethodThatTakesKAndV(K k1, V v1) { } } In other words, I'd like the class declaration to look something like: public class NewParametrized<M extends SomeParametrized<K, V>> { And K and V's types would be inferred from the definition of M.

    Read the article

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