Search Results

Search found 21663 results on 867 pages for 'result sets'.

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

  • Unable to transfer data to or from mounted hard drive

    - by user210335
    So usually i'm good at sorting out issues. But this one has me at a loss! This issues has occured since upgrading my ubuntu so this was workingg prior. I use mounted hard drives to manage my downloads which are then copied over accordingly by a python based app. I found it was having issues with permissions to create anything on these mounted hard drives. I'm able to play and access he content of these drives so they're not faulty. My mount script looks like the following rw,user,exec,auto I really am stuck. Could anyone shed any light on how to fix this and allow me to access it. I've checked the properties and all groups should have read and write access so i'm very confused! thanks, edit here's the output of my mount options /dev/sda2 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) none on /sys/firmware/efi/efivars type efivarfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755) none on /sys/fs/pstore type pstore (rw) /dev/sda1 on /boot/efi type vfat (rw) /dev/sdc1 on /mnt/tv type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096) /dev/sdb1 on /mnt/B88A30E88A30A4B2 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd) gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=simon) /dev/sdd1 on /media/simon/New Volume3 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096) the main mount in question is /dev/sdc1 on /mnt/tv type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096) heres my dmesg output. I tried cchanging permissions in a terminal and I got an io error. [52803.343417] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.343420] sd 2:0:0:0: [sdc] CDB: [52803.343422] Read(10): 28 00 00 60 9e 3f 00 00 08 00 [52803.343805] sd 2:0:0:0: [sdc] Unhandled error code [52803.343808] sd 2:0:0:0: [sdc] [52803.343810] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.343812] sd 2:0:0:0: [sdc] CDB: [52803.343813] Read(10): 28 00 00 67 64 67 00 00 08 00 [52803.344389] sd 2:0:0:0: [sdc] Unhandled error code [52803.344392] sd 2:0:0:0: [sdc] [52803.344394] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.344396] sd 2:0:0:0: [sdc] CDB: [52803.344397] Read(10): 28 00 09 bd e7 6f 00 00 08 00 [52803.344584] sd 2:0:0:0: [sdc] Unhandled error code [52803.344587] sd 2:0:0:0: [sdc] [52803.344589] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.344591] sd 2:0:0:0: [sdc] CDB: [52803.344592] Read(10): 28 00 07 3a cf b7 00 00 08 00 [52803.344776] sd 2:0:0:0: [sdc] Unhandled error code [52803.344779] sd 2:0:0:0: [sdc] [52803.344781] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.344783] sd 2:0:0:0: [sdc] CDB: [52803.344784] Read(10): 28 00 09 bd e7 97 00 00 08 00 [52803.344973] sd 2:0:0:0: [sdc] Unhandled error code [52803.344976] sd 2:0:0:0: [sdc] [52803.344978] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.344980] sd 2:0:0:0: [sdc] CDB: [52803.344981] Read(10): 28 00 08 dd 57 ef 00 00 08 00 [52803.346745] sd 2:0:0:0: [sdc] Unhandled error code [52803.346748] sd 2:0:0:0: [sdc] [52803.346750] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.346752] sd 2:0:0:0: [sdc] CDB: [52803.346754] Read(10): 28 00 07 1a c1 0f 00 00 08 00 [52803.349939] sd 2:0:0:0: [sdc] Unhandled error code [52803.349942] sd 2:0:0:0: [sdc] [52803.349944] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.349946] sd 2:0:0:0: [sdc] CDB: [52803.349948] Read(10): 28 00 00 67 64 9f 00 00 08 00 [52803.350147] sd 2:0:0:0: [sdc] Unhandled error code [52803.350150] sd 2:0:0:0: [sdc] [52803.350152] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.350154] sd 2:0:0:0: [sdc] CDB: [52803.350155] Read(10): 28 00 00 67 64 97 00 00 08 00 [52803.351302] sd 2:0:0:0: [sdc] Unhandled error code [52803.351305] sd 2:0:0:0: [sdc] [52803.351307] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.351309] sd 2:0:0:0: [sdc] CDB: [52803.351311] Read(10): 28 00 00 a4 1d cf 00 00 08 00 [52803.351894] sd 2:0:0:0: [sdc] Unhandled error code [52803.351897] sd 2:0:0:0: [sdc] [52803.351899] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.351901] sd 2:0:0:0: [sdc] CDB: [52803.351902] Read(10): 28 00 00 67 67 3f 00 00 08 00 [52803.353163] sd 2:0:0:0: [sdc] Unhandled error code [52803.353166] sd 2:0:0:0: [sdc] [52803.353168] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.353170] sd 2:0:0:0: [sdc] CDB: [52803.353172] Read(10): 28 00 00 67 64 ef 00 00 08 00 [52803.353917] sd 2:0:0:0: [sdc] Unhandled error code [52803.353920] sd 2:0:0:0: [sdc] [52803.353922] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.353924] sd 2:0:0:0: [sdc] CDB: [52803.353925] Read(10): 28 00 00 67 65 17 00 00 08 00 [52803.354484] sd 2:0:0:0: [sdc] Unhandled error code [52803.354487] sd 2:0:0:0: [sdc] [52803.354489] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.354491] sd 2:0:0:0: [sdc] CDB: [52803.354492] Read(10): 28 00 07 1a d8 9f 00 00 08 00 [52803.355005] sd 2:0:0:0: [sdc] Unhandled error code [52803.355010] sd 2:0:0:0: [sdc] [52803.355013] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.355017] sd 2:0:0:0: [sdc] CDB: [52803.355019] Read(10): 28 00 00 67 65 3f 00 00 08 00 [52803.355293] sd 2:0:0:0: [sdc] Unhandled error code [52803.355298] sd 2:0:0:0: [sdc] [52803.355301] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.355305] sd 2:0:0:0: [sdc] CDB: [52803.355308] Read(10): 28 00 00 a4 20 27 00 00 08 00 [52803.355575] sd 2:0:0:0: [sdc] Unhandled error code [52803.355580] sd 2:0:0:0: [sdc] [52803.355583] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.355587] sd 2:0:0:0: [sdc] CDB: [52803.355589] Read(10): 28 00 00 5d dc 67 00 00 08 00 [52803.356647] sd 2:0:0:0: [sdc] Unhandled error code [52803.356650] sd 2:0:0:0: [sdc] [52803.356652] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.356654] sd 2:0:0:0: [sdc] CDB: [52803.356655] Read(10): 28 00 07 1a dd 3f 00 00 08 00 [52803.357108] sd 2:0:0:0: [sdc] Unhandled error code [52803.357111] sd 2:0:0:0: [sdc] [52803.357113] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.357115] sd 2:0:0:0: [sdc] CDB: [52803.357116] Read(10): 28 00 00 67 65 97 00 00 08 00 [52803.357298] sd 2:0:0:0: [sdc] Unhandled error code [52803.357300] sd 2:0:0:0: [sdc] [52803.357302] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.357304] sd 2:0:0:0: [sdc] CDB: [52803.357306] Read(10): 28 00 07 1a 04 d7 00 00 08 00 [52803.360374] sd 2:0:0:0: [sdc] Unhandled error code [52803.360377] sd 2:0:0:0: [sdc] [52803.360379] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.360382] sd 2:0:0:0: [sdc] CDB: [52803.360383] Read(10): 28 00 00 67 65 b7 00 00 08 00 [52803.360581] sd 2:0:0:0: [sdc] Unhandled error code [52803.360584] sd 2:0:0:0: [sdc] [52803.360586] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.360588] sd 2:0:0:0: [sdc] CDB: [52803.360589] Read(10): 28 00 00 67 65 c7 00 00 08 00 [52803.361352] sd 2:0:0:0: [sdc] Unhandled error code [52803.361355] sd 2:0:0:0: [sdc] [52803.361357] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.361359] sd 2:0:0:0: [sdc] CDB: [52803.361360] Read(10): 28 00 09 bd e1 af 00 00 08 00 [52803.362096] sd 2:0:0:0: [sdc] Unhandled error code [52803.362099] sd 2:0:0:0: [sdc] [52803.362101] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.362103] sd 2:0:0:0: [sdc] CDB: [52803.362104] Read(10): 28 00 07 0a 64 e7 00 00 08 00 [52803.362555] sd 2:0:0:0: [sdc] Unhandled error code [52803.362558] sd 2:0:0:0: [sdc] [52803.362560] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.362562] sd 2:0:0:0: [sdc] CDB: [52803.362563] Read(10): 28 00 00 67 65 d7 00 00 08 00 [52803.362747] sd 2:0:0:0: [sdc] Unhandled error code [52803.362750] sd 2:0:0:0: [sdc] [52803.362752] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.362754] sd 2:0:0:0: [sdc] CDB: [52803.362755] Read(10): 28 00 01 4c 12 6f 00 00 08 00 [52803.362977] sd 2:0:0:0: [sdc] Unhandled error code [52803.362980] sd 2:0:0:0: [sdc] [52803.362982] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.362984] sd 2:0:0:0: [sdc] CDB: [52803.362985] Read(10): 28 00 03 85 43 7f 00 00 08 00 [52803.365197] sd 2:0:0:0: [sdc] Unhandled error code [52803.365200] sd 2:0:0:0: [sdc] [52803.365202] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.365204] sd 2:0:0:0: [sdc] CDB: [52803.365206] Read(10): 28 00 07 15 46 4f 00 00 08 00 [52803.365524] sd 2:0:0:0: [sdc] Unhandled error code [52803.365527] sd 2:0:0:0: [sdc] [52803.365528] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.365531] sd 2:0:0:0: [sdc] CDB: [52803.365532] Read(10): 28 00 07 11 78 8f 00 00 08 00 [52803.369355] sd 2:0:0:0: [sdc] Unhandled error code [52803.369360] sd 2:0:0:0: [sdc] [52803.369362] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.369365] sd 2:0:0:0: [sdc] CDB: [52803.369366] Read(10): 28 00 09 bd e2 8f 00 00 08 00 [52803.370806] sd 2:0:0:0: [sdc] Unhandled error code [52803.370809] sd 2:0:0:0: [sdc] [52803.370811] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.370814] sd 2:0:0:0: [sdc] CDB: [52803.370815] Read(10): 28 00 07 1a c6 37 00 00 08 00 [52803.371630] sd 2:0:0:0: [sdc] Unhandled error code [52803.371634] sd 2:0:0:0: [sdc] [52803.371636] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.371639] sd 2:0:0:0: [sdc] CDB: [52803.371640] Read(10): 28 00 00 67 66 57 00 00 08 00 [52803.371863] sd 2:0:0:0: [sdc] Unhandled error code [52803.371867] sd 2:0:0:0: [sdc] [52803.371868] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.371871] sd 2:0:0:0: [sdc] CDB: [52803.371872] Read(10): 28 00 00 64 0b df 00 00 08 00 [52803.373467] sd 2:0:0:0: [sdc] Unhandled error code [52803.373470] sd 2:0:0:0: [sdc] [52803.373472] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.373474] sd 2:0:0:0: [sdc] CDB: [52803.373476] Read(10): 28 00 00 60 83 7f 00 00 08 00 [52803.373655] sd 2:0:0:0: [sdc] Unhandled error code [52803.373658] sd 2:0:0:0: [sdc] [52803.373660] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.373662] sd 2:0:0:0: [sdc] CDB: [52803.373663] Read(10): 28 00 00 60 83 7f 00 00 08 00 [52803.374063] sd 2:0:0:0: [sdc] Unhandled error code [52803.374066] sd 2:0:0:0: [sdc] [52803.374068] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.374070] sd 2:0:0:0: [sdc] CDB: [52803.374071] Read(10): 28 00 08 db d5 5f 00 00 08 00 [52803.374602] sd 2:0:0:0: [sdc] Unhandled error code [52803.374605] sd 2:0:0:0: [sdc] [52803.374607] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.374609] sd 2:0:0:0: [sdc] CDB: [52803.374611] Read(10): 28 00 07 1a bf a7 00 00 08 00 [52803.375259] sd 2:0:0:0: [sdc] Unhandled error code [52803.375264] sd 2:0:0:0: [sdc] [52803.375267] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.375270] sd 2:0:0:0: [sdc] CDB: [52803.375272] Read(10): 28 00 00 67 66 87 00 00 08 00 [52803.375515] sd 2:0:0:0: [sdc] Unhandled error code [52803.375520] sd 2:0:0:0: [sdc] [52803.375522] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.375526] sd 2:0:0:0: [sdc] CDB: [52803.375527] Read(10): 28 00 00 62 54 8f 00 00 08 00 [52803.378506] sd 2:0:0:0: [sdc] Unhandled error code [52803.378513] sd 2:0:0:0: [sdc] [52803.378516] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.378520] sd 2:0:0:0: [sdc] CDB: [52803.378522] Read(10): 28 00 00 67 66 bf 00 00 08 00 [52803.381048] sd 2:0:0:0: [sdc] Unhandled error code [52803.381054] sd 2:0:0:0: [sdc] [52803.381057] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.381061] sd 2:0:0:0: [sdc] CDB: [52803.381063] Read(10): 28 00 00 60 ae 77 00 00 08 00 [52803.381238] sd 2:0:0:0: [sdc] Unhandled error code [52803.381242] sd 2:0:0:0: [sdc] [52803.381245] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.381248] sd 2:0:0:0: [sdc] CDB: [52803.381250] Read(10): 28 00 00 60 ae 77 00 00 08 00 [52803.381382] sd 2:0:0:0: [sdc] Unhandled error code [52803.381386] sd 2:0:0:0: [sdc] [52803.381388] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.381392] sd 2:0:0:0: [sdc] CDB: [52803.381394] Read(10): 28 00 00 60 ae 77 00 00 08 00 [52803.381569] sd 2:0:0:0: [sdc] Unhandled error code [52803.381573] sd 2:0:0:0: [sdc] [52803.381575] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.381579] sd 2:0:0:0: [sdc] CDB: [52803.381581] Read(10): 28 00 00 60 ae 77 00 00 08 00 [52803.382295] sd 2:0:0:0: [sdc] Unhandled error code [52803.382300] sd 2:0:0:0: [sdc] [52803.382302] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.382306] sd 2:0:0:0: [sdc] CDB: [52803.382307] Read(10): 28 00 00 67 6a 87 00 00 08 00 [52803.382552] sd 2:0:0:0: [sdc] Unhandled error code [52803.382556] sd 2:0:0:0: [sdc] [52803.382558] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.382562] sd 2:0:0:0: [sdc] CDB: [52803.382564] Read(10): 28 00 00 67 6a af 00 00 08 00 [52803.382794] sd 2:0:0:0: [sdc] Unhandled error code [52803.382798] sd 2:0:0:0: [sdc] [52803.382801] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.382804] sd 2:0:0:0: [sdc] CDB: [52803.382806] Read(10): 28 00 00 67 6a c7 00 00 08 00 [52803.383269] sd 2:0:0:0: [sdc] Unhandled error code [52803.383274] sd 2:0:0:0: [sdc] [52803.383277] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.383280] sd 2:0:0:0: [sdc] CDB: [52803.383282] Read(10): 28 00 00 67 6a f7 00 00 08 00 [52803.383556] sd 2:0:0:0: [sdc] Unhandled error code [52803.383560] sd 2:0:0:0: [sdc] [52803.383563] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.383566] sd 2:0:0:0: [sdc] CDB: [52803.383568] Read(10): 28 00 00 67 6b 2f 00 00 08 00 [52803.386185] sd 2:0:0:0: [sdc] Unhandled error code [52803.386191] sd 2:0:0:0: [sdc] [52803.386194] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.386198] sd 2:0:0:0: [sdc] CDB: [52803.386200] Read(10): 28 00 01 4c 1b bf 00 00 08 00 [52803.386454] sd 2:0:0:0: [sdc] Unhandled error code [52803.386458] sd 2:0:0:0: [sdc] [52803.386461] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.386465] sd 2:0:0:0: [sdc] CDB: [52803.386467] Read(10): 28 00 07 1a b4 1f 00 00 08 00 [52803.388320] sd 2:0:0:0: [sdc] Unhandled error code [52803.388324] sd 2:0:0:0: [sdc] [52803.388326] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.388328] sd 2:0:0:0: [sdc] CDB: [52803.388329] Read(10): 28 00 09 bd de 17 00 00 08 00 [52803.388836] sd 2:0:0:0: [sdc] Unhandled error code [52803.388838] sd 2:0:0:0: [sdc] [52803.388839] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.388841] sd 2:0:0:0: [sdc] CDB: [52803.388842] Read(10): 28 00 07 57 9f ff 00 00 08 00 [52803.389124] sd 2:0:0:0: [sdc] Unhandled error code [52803.389126] sd 2:0:0:0: [sdc] [52803.389127] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.389129] sd 2:0:0:0: [sdc] CDB: [52803.389130] Read(10): 28 00 00 67 6b 8f 00 00 08 00 [52803.389244] sd 2:0:0:0: [sdc] Unhandled error code [52803.389246] sd 2:0:0:0: [sdc] [52803.389248] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.389249] sd 2:0:0:0: [sdc] CDB: [52803.389250] Read(10): 28 00 07 e9 ee ff 00 00 08 00 [52803.390386] sd 2:0:0:0: [sdc] Unhandled error code [52803.390389] sd 2:0:0:0: [sdc] [52803.390390] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.390392] sd 2:0:0:0: [sdc] CDB: [52803.390393] Read(10): 28 00 07 1a be 0f 00 00 08 00 [52803.390682] sd 2:0:0:0: [sdc] Unhandled error code [52803.390685] sd 2:0:0:0: [sdc] [52803.390686] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.390688] sd 2:0:0:0: [sdc] CDB: [52803.390689] Read(10): 28 00 00 67 6b e7 00 00 08 00 [52803.390804] sd 2:0:0:0: [sdc] Unhandled error code [52803.390806] sd 2:0:0:0: [sdc] [52803.390808] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.390809] sd 2:0:0:0: [sdc] CDB: [52803.390810] Read(10): 28 00 07 ed 17 bf 00 00 08 00 [52803.391449] sd 2:0:0:0: [sdc] Unhandled error code [52803.391451] sd 2:0:0:0: [sdc] [52803.391452] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.391454] sd 2:0:0:0: [sdc] CDB: [52803.391455] Read(10): 28 00 09 bd e5 9f 00 00 08 00 [52803.391956] sd 2:0:0:0: [sdc] Unhandled error code [52803.391958] sd 2:0:0:0: [sdc] [52803.391960] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.391961] sd 2:0:0:0: [sdc] CDB: [52803.391962] Read(10): 28 00 00 b5 86 a7 00 00 08 00 [52803.392293] sd 2:0:0:0: [sdc] Unhandled error code [52803.392295] sd 2:0:0:0: [sdc] [52803.392296] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.392298] sd 2:0:0:0: [sdc] CDB: [52803.392299] Read(10): 28 00 07 18 bf bf 00 00 08 00 [52803.392843] sd 2:0:0:0: [sdc] Unhandled error code [52803.392845] sd 2:0:0:0: [sdc] [52803.392846] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.392848] sd 2:0:0:0: [sdc] CDB: [52803.392849] Read(10): 28 00 00 60 b3 1f 00 00 08 00 [52803.392929] sd 2:0:0:0: [sdc] Unhandled error code [52803.392931] sd 2:0:0:0: [sdc] [52803.392932] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.392934] sd 2:0:0:0: [sdc] CDB: [52803.392935] Read(10): 28 00 00 60 b3 1f 00 00 08 00 [52803.393057] sd 2:0:0:0: [sdc] Unhandled error code [52803.393059] sd 2:0:0:0: [sdc] [52803.393060] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393062] sd 2:0:0:0: [sdc] CDB: [52803.393063] Read(10): 28 00 00 60 83 9f 00 00 08 00 [52803.393286] sd 2:0:0:0: [sdc] Unhandled error code [52803.393288] sd 2:0:0:0: [sdc] [52803.393289] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393291] sd 2:0:0:0: [sdc] CDB: [52803.393292] Read(10): 28 00 00 67 6b bf 00 00 08 00 [52803.393720] sd 2:0:0:0: [sdc] Unhandled error code [52803.393722] sd 2:0:0:0: [sdc] [52803.393723] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393725] sd 2:0:0:0: [sdc] CDB: [52803.393725] Read(10): 28 00 00 60 b2 17 00 00 08 00 [52803.393806] sd 2:0:0:0: [sdc] Unhandled error code [52803.393808] sd 2:0:0:0: [sdc] [52803.393809] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393810] sd 2:0:0:0: [sdc] CDB: [52803.393811] Read(10): 28 00 00 60 b2 17 00 00 08 00 [52803.393892] sd 2:0:0:0: [sdc] Unhandled error code [52803.393894] sd 2:0:0:0: [sdc] [52803.393895] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393896] sd 2:0:0:0: [sdc] CDB: [52803.393897] Read(10): 28 00 00 60 b2 17 00 00 08 00 [52803.393974] sd 2:0:0:0: [sdc] Unhandled error code [52803.393976] sd 2:0:0:0: [sdc] [52803.393977] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.393978] sd 2:0:0:0: [sdc] CDB: [52803.393979] Read(10): 28 00 00 60 b2 17 00 00 08 00 [52803.394298] sd 2:0:0:0: [sdc] Unhandled error code [52803.394300] sd 2:0:0:0: [sdc] [52803.394302] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.394303] sd 2:0:0:0: [sdc] CDB: [52803.394304] Read(10): 28 00 00 5d a6 a7 00 00 08 00 [52803.395577] sd 2:0:0:0: [sdc] Unhandled error code [52803.395580] sd 2:0:0:0: [sdc] [52803.395582] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.395584] sd 2:0:0:0: [sdc] CDB: [52803.395585] Read(10): 28 00 00 00 01 9f 00 00 08 00 [52803.395721] sd 2:0:0:0: [sdc] Unhandled error code [52803.395724] sd 2:0:0:0: [sdc] [52803.395725] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.395726] sd 2:0:0:0: [sdc] CDB: [52803.395727] Read(10): 28 00 00 00 01 67 00 00 08 00 [52803.395843] sd 2:0:0:0: [sdc] Unhandled error code [52803.395845] sd 2:0:0:0: [sdc] [52803.395846] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.395847] sd 2:0:0:0: [sdc] CDB: [52803.395848] Read(10): 28 00 02 a8 33 77 00 00 08 00 [52803.395960] sd 2:0:0:0: [sdc] Unhandled error code [52803.395962] sd 2:0:0:0: [sdc] [52803.395963] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.395965] sd 2:0:0:0: [sdc] CDB: [52803.395965] Read(10): 28 00 00 b5 ae 7f 00 00 08 00 [52803.396077] sd 2:0:0:0: [sdc] Unhandled error code [52803.396079] sd 2:0:0:0: [sdc] [52803.396080] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396082] sd 2:0:0:0: [sdc] CDB: [52803.396083] Read(10): 28 00 00 63 64 bf 00 00 08 00 [52803.396193] sd 2:0:0:0: [sdc] Unhandled error code [52803.396195] sd 2:0:0:0: [sdc] [52803.396196] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396198] sd 2:0:0:0: [sdc] CDB: [52803.396199] Read(10): 28 00 07 1a e2 e7 00 00 08 00 [52803.396313] sd 2:0:0:0: [sdc] Unhandled error code [52803.396315] sd 2:0:0:0: [sdc] [52803.396316] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396318] sd 2:0:0:0: [sdc] CDB: [52803.396319] Read(10): 28 00 07 1a b9 87 00 00 08 00 [52803.396435] sd 2:0:0:0: [sdc] Unhandled error code [52803.396437] sd 2:0:0:0: [sdc] [52803.396438] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396439] sd 2:0:0:0: [sdc] CDB: [52803.396441] Read(10): 28 00 02 ce 8e df 00 00 08 00 [52803.396555] sd 2:0:0:0: [sdc] Unhandled error code [52803.396557] sd 2:0:0:0: [sdc] [52803.396558] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396560] sd 2:0:0:0: [sdc] CDB: [52803.396561] Read(10): 28 00 0e 66 6d f7 00 00 08 00 [52803.396769] sd 2:0:0:0: [sdc] Unhandled error code [52803.396770] sd 2:0:0:0: [sdc] [52803.396772] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396773] sd 2:0:0:0: [sdc] CDB: [52803.396774] Read(10): 28 00 07 1a e4 2f 00 00 08 00 [52803.396886] sd 2:0:0:0: [sdc] Unhandled error code [52803.396888] sd 2:0:0:0: [sdc] [52803.396889] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.396890] sd 2:0:0:0: [sdc] CDB: [52803.396891] Read(10): 28 00 00 63 d4 3f 00 00 08 00 [52803.397002] sd 2:0:0:0: [sdc] Unhandled error code [52803.397004] sd 2:0:0:0: [sdc] [52803.397005] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.397007] sd 2:0:0:0: [sdc] CDB: [52803.397007] Read(10): 28 00 07 1a e4 1f 00 00 08 00 [52803.400074] sd 2:0:0:0: [sdc] Unhandled error code [52803.400078] sd 2:0:0:0: [sdc] [52803.400079] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.400081] sd 2:0:0:0: [sdc] CDB: [52803.400082] Read(10): 28 00 07 16 c7 5f 00 00 08 00 [52803.400318] sd 2:0:0:0: [sdc] Unhandled error code [52803.400320] sd 2:0:0:0: [sdc] [52803.400322] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.400323] sd 2:0:0:0: [sdc] CDB: [52803.400324] Read(10): 28 00 00 60 01 87 00 00 08 00 [52803.400408] sd 2:0:0:0: [sdc] Unhandled error code [52803.400410] sd 2:0:0:0: [sdc] [52803.400412] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.400413] sd 2:0:0:0: [sdc] CDB: [52803.400414] Read(10): 28 00 00 60 01 0f 00 00 08 00 [52803.400564] sd 2:0:0:0: [sdc] Unhandled error code [52803.400566] sd 2:0:0:0: [sdc] [52803.400568] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.400569] sd 2:0:0:0: [sdc] CDB: [52803.400570] Read(10): 28 00 00 5d d1 d7 00 00 08 00 [52803.400841] sd 2:0:0:0: [sdc] Unhandled error code [52803.400843] sd 2:0:0:0: [sdc] [52803.400844] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.400846] sd 2:0:0:0: [sdc] CDB: [52803.400847] Read(10): 28 00 07 1a e3 47 00 00 08 00 [52803.401151] sd 2:0:0:0: [sdc] Unhandled error code [52803.401153] sd 2:0:0:0: [sdc] [52803.401155] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.401156] sd 2:0:0:0: [sdc] CDB: [52803.401157] Read(10): 28 00 07 1a b9 1f 00 00 08 00 [52803.401310] sd 2:0:0:0: [sdc] Unhandled error code [52803.401312] sd 2:0:0:0: [sdc] [52803.401313] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.401315] sd 2:0:0:0: [sdc] CDB: [52803.401316] Read(10): 28 00 00 a4 1b 57 00 00 08 00 [52803.401877] sd 2:0:0:0: [sdc] Unhandled error code [52803.401879] sd 2:0:0:0: [sdc] [52803.401880] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.401881] sd 2:0:0:0: [sdc] CDB: [52803.401882] Read(10): 28 00 0e 66 35 47 00 00 08 00 [52803.402032] sd 2:0:0:0: [sdc] Unhandled error code [52803.402033] sd 2:0:0:0: [sdc] [52803.402034] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402036] sd 2:0:0:0: [sdc] CDB: [52803.402037] Read(10): 28 00 06 30 69 ff 00 00 08 00 [52803.402148] sd 2:0:0:0: [sdc] Unhandled error code [52803.402150] sd 2:0:0:0: [sdc] [52803.402151] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402153] sd 2:0:0:0: [sdc] CDB: [52803.402154] Read(10): 28 00 09 bd d8 77 00 00 08 00 [52803.402263] sd 2:0:0:0: [sdc] Unhandled error code [52803.402265] sd 2:0:0:0: [sdc] [52803.402266] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402267] sd 2:0:0:0: [sdc] CDB: [52803.402268] Read(10): 28 00 00 5d ff 77 00 00 08 00 [52803.402376] sd 2:0:0:0: [sdc] Unhandled error code [52803.402378] sd 2:0:0:0: [sdc] [52803.402379] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402381] sd 2:0:0:0: [sdc] CDB: [52803.402382] Read(10): 28 00 00 5d ff 7f 00 00 08 00 [52803.402490] sd 2:0:0:0: [sdc] Unhandled error code [52803.402492] sd 2:0:0:0: [sdc] [52803.402493] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402495] sd 2:0:0:0: [sdc] CDB: [52803.402496] Read(10): 28 00 00 00 01 2f 00 00 08 00 [52803.402602] sd 2:0:0:0: [sdc] Unhandled error code [52803.402604] sd 2:0:0:0: [sdc] [52803.402605] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402607] sd 2:0:0:0: [sdc] CDB: [52803.402608] Read(10): 28 00 00 b5 ac 8f 00 00 08 00 [52803.402715] sd 2:0:0:0: [sdc] Unhandled error code [52803.402717] sd 2:0:0:0: [sdc] [52803.402719] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402720] sd 2:0:0:0: [sdc] CDB: [52803.402721] Read(10): 28 00 00 e1 18 ff 00 00 08 00 [52803.402829] sd 2:0:0:0: [sdc] Unhandled error code [52803.402831] sd 2:0:0:0: [sdc] [52803.402833] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.402834] sd 2:0:0:0: [sdc] CDB: [52803.402835] Read(10): 28 00 09 bd ea cf 00 00 08 00 [52803.403999] sd 2:0:0:0: [sdc] Unhandled error code [52803.404001] sd 2:0:0:0: [sdc] [52803.404003] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52803.404005] sd 2:0:0:0: [sdc] CDB: [52803.404006] Read(10): 28 00 07 1a b8 f7 00 00 08 00 [52832.950225] sd 2:0:0:0: [sdc] Unhandled error code [52832.950230] sd 2:0:0:0: [sdc] [52832.950233] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52832.950235] sd 2:0:0:0: [sdc] CDB: [52832.950237] Write(10): 2a 00 00 60 bf 7f 00 00 08 00 [52832.950247] blk_update_request: 1077 callbacks suppressed [52832.950250] end_request: I/O error, dev sdc, sector 6340479 [52832.950253] quiet_error: 1077 callbacks suppressed [52832.950256] Buffer I/O error on device sdc1, logical block 792552 [52832.950258] lost page write due to I/O error on sdc1 [52832.950269] sd 2:0:0:0: [sdc] Unhandled error code [52832.950272] sd 2:0:0:0: [sdc] [52832.950273] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [52832.950276] sd 2:0:0:0: [sdc] CDB: [52832.950277] Write(10): 2a 00 01 a5 f1 4f 00 00 08 00 [52832.950285] end_request: I/O error, dev sdc, sector 27652431 [52832.950287] Buffer I/O error on device sdc1, logical block 3456546 [52832.950289] lost page write due to I/O error on sdc1

    Read the article

  • Webservice Return Generic Result Type or Purposed Result Type

    - by hanzolo
    I'm building a webservice which returns JSON / XML / SOAP at the moment.. and I'm not entirely sure which approach for returning results is best. Which would be a better return value? A generic "transfer" type structure, which carries Generic properties or a purposed type with distinct properties: class GenericTransferObject{ public string returnVal; public string returnType; } VS class PurposedTransferObject_1{ public string Property1; } //and then building additional "types" for additional values class PurposedTransferObject_2 { public string PropertyA; public string PropertyB; } Now, this would be the serialized and returned from a web service call via some client technology, JQuery in this example. SO if I called: /GetDaysInWeek/ I would either get back: {"returnType": "DaysInWeek", "returnVal": "365" } OR {"DaysInWeek": "365"} And then it would go from there. On the one hand there's flexibilty with the 1st example. I can add "returnTypes" without needing to adjust the client other than referencing an additional "index".. but if I had to add a property, now i'm changing a structure definition.. Is there an obvious choice in this situation?

    Read the article

  • intersection of three sets in python?

    - by Phil Brown
    Currently I am stuck trying to find the intersection of three sets. Now these sets are really lists that I am converting into sets, and then trying to find the intersection of. Here's what I have so far: for list1 in masterlist: list1=thingList1 for list2 in masterlist: list2=thingList2 for list3 in masterlist: list3=thingList3 d3=[set(thingList1), set(thingList2), set(thingList3)] setmatches c= set.intersection(*map(set,d3)) print setmatches and I'm getting set([]) Script terminated. I know there's a much simpler and better way to do this, but I can't find one...

    Read the article

  • Fastest way to perform subset test operation on a large collection of sets with same domain

    - by niktech
    Assume we have trillions of sets stored somewhere. The domain for each of these sets is the same. It is also finite and discrete. So each set may be stored as a bit field (eg: 0000100111...) of a relatively short length (eg: 1024). That is, bit X in the bitfield indicates whether item X (of 1024 possible items) is included in the given set or not. Now, I want to devise a storage structure and an algorithm to efficiently answer the query: what sets in the data store have set Y as a subset. Set Y itself is not present in the data store and is specified at run time. Now the simplest way to solve this would be to AND the bitfield for set Y with bit fields of every set in the data store one by one, picking the ones whose AND result matches Y's bitfield. How can I speed this up? Is there a tree structure (index) or some smart algorithm that would allow me to perform this query without having to AND every stored set's bitfield? Are there databases that already support such operations on large collections of sets?

    Read the article

  • C#/.NET Little Wonders: The Useful But Overlooked Sets

    - by James Michael Hare
    Once again we consider some of the lesser known classes and keywords of C#.  Today we will be looking at two set implementations in the System.Collections.Generic namespace: HashSet<T> and SortedSet<T>.  Even though most people think of sets as mathematical constructs, they are actually very useful classes that can be used to help make your application more performant if used appropriately. A Background From Math In mathematical terms, a set is an unordered collection of unique items.  In other words, the set {2,3,5} is identical to the set {3,5,2}.  In addition, the set {2, 2, 4, 1} would be invalid because it would have a duplicate item (2).  In addition, you can perform set arithmetic on sets such as: Intersections: The intersection of two sets is the collection of elements common to both.  Example: The intersection of {1,2,5} and {2,4,9} is the set {2}. Unions: The union of two sets is the collection of unique items present in either or both set.  Example: The union of {1,2,5} and {2,4,9} is {1,2,4,5,9}. Differences: The difference of two sets is the removal of all items from the first set that are common between the sets.  Example: The difference of {1,2,5} and {2,4,9} is {1,5}. Supersets: One set is a superset of a second set if it contains all elements that are in the second set. Example: The set {1,2,5} is a superset of {1,5}. Subsets: One set is a subset of a second set if all the elements of that set are contained in the first set. Example: The set {1,5} is a subset of {1,2,5}. If We’re Not Doing Math, Why Do We Care? Now, you may be thinking: why bother with the set classes in C# if you have no need for mathematical set manipulation?  The answer is simple: they are extremely efficient ways to determine ownership in a collection. For example, let’s say you are designing an order system that tracks the price of a particular equity, and once it reaches a certain point will trigger an order.  Now, since there’s tens of thousands of equities on the markets, you don’t want to track market data for every ticker as that would be a waste of time and processing power for symbols you don’t have orders for.  Thus, we just want to subscribe to the stock symbol for an equity order only if it is a symbol we are not already subscribed to. Every time a new order comes in, we will check the list of subscriptions to see if the new order’s stock symbol is in that list.  If it is, great, we already have that market data feed!  If not, then and only then should we subscribe to the feed for that symbol. So far so good, we have a collection of symbols and we want to see if a symbol is present in that collection and if not, add it.  This really is the essence of set processing, but for the sake of comparison, let’s say you do a list instead: 1: // class that handles are order processing service 2: public sealed class OrderProcessor 3: { 4: // contains list of all symbols we are currently subscribed to 5: private readonly List<string> _subscriptions = new List<string>(); 6:  7: ... 8: } Now whenever you are adding a new order, it would look something like: 1: public PlaceOrderResponse PlaceOrder(Order newOrder) 2: { 3: // do some validation, of course... 4:  5: // check to see if already subscribed, if not add a subscription 6: if (!_subscriptions.Contains(newOrder.Symbol)) 7: { 8: // add the symbol to the list 9: _subscriptions.Add(newOrder.Symbol); 10: 11: // do whatever magic is needed to start a subscription for the symbol 12: } 13:  14: // place the order logic! 15: } What’s wrong with this?  In short: performance!  Finding an item inside a List<T> is a linear - O(n) – operation, which is not a very performant way to find if an item exists in a collection. (I used to teach algorithms and data structures in my spare time at a local university, and when you began talking about big-O notation you could immediately begin to see eyes glossing over as if it was pure, useless theory that would not apply in the real world, but I did and still do believe it is something worth understanding well to make the best choices in computer science). Let’s think about this: a linear operation means that as the number of items increases, the time that it takes to perform the operation tends to increase in a linear fashion.  Put crudely, this means if you double the collection size, you might expect the operation to take something like the order of twice as long.  Linear operations tend to be bad for performance because they mean that to perform some operation on a collection, you must potentially “visit” every item in the collection.  Consider finding an item in a List<T>: if you want to see if the list has an item, you must potentially check every item in the list before you find it or determine it’s not found. Now, we could of course sort our list and then perform a binary search on it, but sorting is typically a linear-logarithmic complexity – O(n * log n) - and could involve temporary storage.  So performing a sort after each add would probably add more time.  As an alternative, we could use a SortedList<TKey, TValue> which sorts the list on every Add(), but this has a similar level of complexity to move the items and also requires a key and value, and in our case the key is the value. This is why sets tend to be the best choice for this type of processing: they don’t rely on separate keys and values for ordering – so they save space – and they typically don’t care about ordering – so they tend to be extremely performant.  The .NET BCL (Base Class Library) has had the HashSet<T> since .NET 3.5, but at that time it did not implement the ISet<T> interface.  As of .NET 4.0, HashSet<T> implements ISet<T> and a new set, the SortedSet<T> was added that gives you a set with ordering. HashSet<T> – For Unordered Storage of Sets When used right, HashSet<T> is a beautiful collection, you can think of it as a simplified Dictionary<T,T>.  That is, a Dictionary where the TKey and TValue refer to the same object.  This is really an oversimplification, but logically it makes sense.  I’ve actually seen people code a Dictionary<T,T> where they store the same thing in the key and the value, and that’s just inefficient because of the extra storage to hold both the key and the value. As it’s name implies, the HashSet<T> uses a hashing algorithm to find the items in the set, which means it does take up some additional space, but it has lightning fast lookups!  Compare the times below between HashSet<T> and List<T>: Operation HashSet<T> List<T> Add() O(1) O(1) at end O(n) in middle Remove() O(1) O(n) Contains() O(1) O(n)   Now, these times are amortized and represent the typical case.  In the very worst case, the operations could be linear if they involve a resizing of the collection – but this is true for both the List and HashSet so that’s a less of an issue when comparing the two. The key thing to note is that in the general case, HashSet is constant time for adds, removes, and contains!  This means that no matter how large the collection is, it takes roughly the exact same amount of time to find an item or determine if it’s not in the collection.  Compare this to the List where almost any add or remove must rearrange potentially all the elements!  And to find an item in the list (if unsorted) you must search every item in the List. So as you can see, if you want to create an unordered collection and have very fast lookup and manipulation, the HashSet is a great collection. And since HashSet<T> implements ICollection<T> and IEnumerable<T>, it supports nearly all the same basic operations as the List<T> and can use the System.Linq extension methods as well. All we have to do to switch from a List<T> to a HashSet<T>  is change our declaration.  Since List and HashSet support many of the same members, chances are we won’t need to change much else. 1: public sealed class OrderProcessor 2: { 3: private readonly HashSet<string> _subscriptions = new HashSet<string>(); 4:  5: // ... 6:  7: public PlaceOrderResponse PlaceOrder(Order newOrder) 8: { 9: // do some validation, of course... 10: 11: // check to see if already subscribed, if not add a subscription 12: if (!_subscriptions.Contains(newOrder.Symbol)) 13: { 14: // add the symbol to the list 15: _subscriptions.Add(newOrder.Symbol); 16: 17: // do whatever magic is needed to start a subscription for the symbol 18: } 19: 20: // place the order logic! 21: } 22:  23: // ... 24: } 25: Notice, we didn’t change any code other than the declaration for _subscriptions to be a HashSet<T>.  Thus, we can pick up the performance improvements in this case with minimal code changes. SortedSet<T> – Ordered Storage of Sets Just like HashSet<T> is logically similar to Dictionary<T,T>, the SortedSet<T> is logically similar to the SortedDictionary<T,T>. The SortedSet can be used when you want to do set operations on a collection, but you want to maintain that collection in sorted order.  Now, this is not necessarily mathematically relevant, but if your collection needs do include order, this is the set to use. So the SortedSet seems to be implemented as a binary tree (possibly a red-black tree) internally.  Since binary trees are dynamic structures and non-contiguous (unlike List and SortedList) this means that inserts and deletes do not involve rearranging elements, or changing the linking of the nodes.  There is some overhead in keeping the nodes in order, but it is much smaller than a contiguous storage collection like a List<T>.  Let’s compare the three: Operation HashSet<T> SortedSet<T> List<T> Add() O(1) O(log n) O(1) at end O(n) in middle Remove() O(1) O(log n) O(n) Contains() O(1) O(log n) O(n)   The MSDN documentation seems to indicate that operations on SortedSet are O(1), but this seems to be inconsistent with its implementation and seems to be a documentation error.  There’s actually a separate MSDN document (here) on SortedSet that indicates that it is, in fact, logarithmic in complexity.  Let’s put it in layman’s terms: logarithmic means you can double the collection size and typically you only add a single extra “visit” to an item in the collection.  Take that in contrast to List<T>’s linear operation where if you double the size of the collection you double the “visits” to items in the collection.  This is very good performance!  It’s still not as performant as HashSet<T> where it always just visits one item (amortized), but for the addition of sorting this is a good thing. Consider the following table, now this is just illustrative data of the relative complexities, but it’s enough to get the point: Collection Size O(1) Visits O(log n) Visits O(n) Visits 1 1 1 1 10 1 4 10 100 1 7 100 1000 1 10 1000   Notice that the logarithmic – O(log n) – visit count goes up very slowly compare to the linear – O(n) – visit count.  This is because since the list is sorted, it can do one check in the middle of the list, determine which half of the collection the data is in, and discard the other half (binary search).  So, if you need your set to be sorted, you can use the SortedSet<T> just like the HashSet<T> and gain sorting for a small performance hit, but it’s still faster than a List<T>. Unique Set Operations Now, if you do want to perform more set-like operations, both implementations of ISet<T> support the following, which play back towards the mathematical set operations described before: IntersectWith() – Performs the set intersection of two sets.  Modifies the current set so that it only contains elements also in the second set. UnionWith() – Performs a set union of two sets.  Modifies the current set so it contains all elements present both in the current set and the second set. ExceptWith() – Performs a set difference of two sets.  Modifies the current set so that it removes all elements present in the second set. IsSupersetOf() – Checks if the current set is a superset of the second set. IsSubsetOf() – Checks if the current set is a subset of the second set. For more information on the set operations themselves, see the MSDN description of ISet<T> (here). What Sets Don’t Do Don’t get me wrong, sets are not silver bullets.  You don’t really want to use a set when you want separate key to value lookups, that’s what the IDictionary implementations are best for. Also sets don’t store temporal add-order.  That is, if you are adding items to the end of a list all the time, your list is ordered in terms of when items were added to it.  This is something the sets don’t do naturally (though you could use a SortedSet with an IComparer with a DateTime but that’s overkill) but List<T> can. Also, List<T> allows indexing which is a blazingly fast way to iterate through items in the collection.  Iterating over all the items in a List<T> is generally much, much faster than iterating over a set. Summary Sets are an excellent tool for maintaining a lookup table where the item is both the key and the value.  In addition, if you have need for the mathematical set operations, the C# sets support those as well.  The HashSet<T> is the set of choice if you want the fastest possible lookups but don’t care about order.  In contrast the SortedSet<T> will give you a sorted collection at a slight reduction in performance.   Technorati Tags: C#,.Net,Little Wonders,BlackRabbitCoder,ISet,HashSet,SortedSet

    Read the article

  • Calculate a set of concatenated sets of n sets

    - by Andras Zoltan
    Okay - I'm not even sure that the term is right - and I'm sure there is bound to be a term for this - but I'll do my best to explain. This is not quite a cross product here, and the order of the results are absolutely crucial. Given: IEnumerable<IEnumerable<string>> sets = new[] { /* a */ new[] { "a", "b", "c" }, /* b */ new[] { "1", "2", "3" }, /* c */ new[] { "x", "y", "z" } }; Where each inner enumerable represents an instruction to produce a set of concatenations as follows (the order here is important): set a* = new string[] { "abc", "ab", "a" }; set b* = new string[] { "123", "12", "1" }; set c* = new string[] { "xyz", "xy", "x" }; I want to produce set ordered concatenations as follows: set final = new string { a*[0] + b*[0] + c*[0], /* abc123xyz */ a*[0] + b*[0] + c*[1], /* abc123xy */ a*[0] + b*[0] + c*[2], /* abc123x */ a*[0] + b*[0], /* abc123 */ a*[0] + b*[1] + c*[0], /* abc12xyz */ a*[0] + b*[1] + c*[1], /* abc12xy */ a*[0] + b*[1] + c*[2], /* abc12x */ a*[0] + b*[1], /* abc12 */ a*[0] + b*[2] + c*[0], /* abc1xyz */ a*[0] + b*[2] + c*[1], /* abc1xy */ a*[0] + b*[2] + c*[2], /* abc1x */ a*[0] + b*[2], /* abc1 */ a*[0], /* abc */ a*[1] + b*[0] + c*[0], /* ab123xyz */ /* and so on for a*[1] */ /* ... */ a*[2] + b*[0] + c*[0], /* a123xyz */ /* and so on for a*[2] */ /* ... */ /* now lop off a[*] and start with b + c */ b*[0] + c*[0], /* 123xyz */ /* rest of the combinations of b + c with b on its own as well */ /* then finally */ c[0], c[1], c[2]}; So clearly, there are going to be a lot of combinations! I can see similarities with Numeric bases (since the order is important as well), and I'm sure there are permutations/combinations lurking in here too. The question is - how to write an algorithm like this that'll cope with any number of sets of strings? Linq, non-Linq; I'm not fussed. Why am I doing this? Indeed, why!? In Asp.Net MVC - I want to have partial views that can be redefined for a given combination of back-end/front-end culture and language. The most basic of these would be, for a given base view View, we could have View-en-GB, View-en, View-GB, and View, in that order of precedence (recognising of course that the language/culture codes could be the same, so some combinations might be the same - a Distinct() will solve that). But I also have other views that, in themselves, have other possible combinations before culture is even taken into account (too long to go into - but the fact is, this algo will enable a whole bunch of really cool that I want to offer my developers!). I want to produce a search list of all the acceptable view names, iterate through the whole lot until the most specific match is found (governed by the order that this algo will produce these concatenations in) then serve up the resolved Partial View. The result of the search can later be cached to avoid the expense of running the algorithm all the time. I already have a really basic version of this working that just has one enumerable of strings. But this is a whole different kettle of seafood! Any help greatly appreciated.

    Read the article

  • joining two sets in LINQ

    - by user343209
    var setsA = new List<SetA> { new SetA { SsnA = "3450734507", name = "setA"}, new SetA { SsnA = "6833467788", name = "setA"}, new SetA { SsnA = "5452347787", name = "setA"}, new SetA { SsnA = "9345345345", name = "setA"}, }; var setsB = new List<SetB> { new SetB { SsnB = "5452347787" ,name = "setB"}, new SetB { SsnB = "9345345345", name = "setB"}, }; when i use this linq: var Set = from seta in setsA join setb in setsB on seta.SsnA equals setb.SsnB select new { SSN = seta.SsnA, NAME = setb.name }; i get this value: { SSN = "5452347787", NAME = "setB" } { SSN = "9345345345", NAME = "setB" } but i would want to have SET which combines these two and the result would be: { SSN = "3450734507", NAME = "setA" } { SSN = "6833467788", NAME = "setA" } { SSN = "5452347787", NAME = "setB" } { SSN = "9345345345", NAME = "setB" } This would be a result set that would tell me with the name NAME property which set it was taken from, if SSN was found in SetA and SetB it would have property NAME = "setB" could someone help me with this?

    Read the article

  • determine if intersection of a set with conjunction of two other sets is empty

    - by koen
    For any three given sets A, B and C: is there a way to determine (programmatically) whether there is an element of A that is part of the conjunction of B and C? example: A: all numbers greater than 3 B: all numbers lesser than 7 C: all numbers that equal 5 In this case there is an element in set A, being the number 5, that fits. I'm implementing this as specifications, so this numerical range is just an example. A, B, C could be anything.

    Read the article

  • Determine the relative compliment of two IEnumerable<T> sets in .net

    - by SFun28
    Hi! Is there an easy way to get the relative compliment of two sets? Perhaps using LINQ? http://en.wikipedia.org/wiki/Complement_(set_theory) I have to find the relative compliment of a set A relative to B. Both A and B are of type HashSet but I think the algorithm could be made more generation (IEnumerable or even ISet)? I could use a solution in either vb.net or C#.

    Read the article

  • SQL - Counting sets of Field-B values for each Field-A value

    - by potrnd
    Hello, First of all sorry that I could not think of a more descriptive title. What I want to do is the following using only SQL: I have some lists of strings, list1, list2 and list3. I have a dataset that contains two interesting columns, A and B. Column A contains a TransactionID and column B contains an ItemID. Naturally, there can be multiple rows that share the same TransactionIDs. I need to catch those transactions that have at least one ItemID in each and every list (list1 AND list2 AND list3). I also need to count how many times does that happen for each transaction. [EDIT] That is, count how many full sets of ItemIDs there are for each TransactionID", "Full Set" being any element of the list1 with any element of the list2 with any element of the list3 I hope that makes enough sense, perhaps I will be able to explain it better with a clear head. Thanks in advance

    Read the article

  • Algorithm to match items be value into sets base on total

    - by Ben
    Given n sets of items. Each item has a value. The items in a set have similar values but vary by a small amount. The goal is to create new sets containing three items selected from the original sets such that the total of the values is within a given range. Only one item a source set can be selected. For example: If we have the following starting sets: Set A - { 4.0, 3.8, 4.2 } Set B - { 7.0, 6.8, 7.2 } Set C - { 1.0, 0.9, 1.1 } Set D - { 6.5, 6.4, 6.6 } Set E - { 2.5, 2.4, 2.6 } Goal is to create sets containing three elements such that the total is between 11.9 and 12.1. For example { 3.8, 7.2, 1.0 } There can be unused elements. Can someone suggest an algorithm for this problem?

    Read the article

  • python / sets / dictionary / initialization

    - by Mario D
    Can someone explain help me understand how the this bit of code works? Particularly how the myHeap assignment works. I know the freq variable is assigned as a dictionary. But what about my myHeap? is it a Set? exe_Data = { 'e' : 0.124167, 't' : 0.0969225, 'a' : 0.0820011, 'i' : 0.0768052, } freq = exe_Data) myHeap = [[pct, [symbol, ""]] for symbol, pct in freq.items()]

    Read the article

  • Securing Flexfield Value Sets in EBS 12.2

    - by Sara Woodhull
    Release 12.2 includes a new feature: flexfield value set security. This new feature gives you additional options for ensuring that different administrators have non-overlapping responsibilities, which in turn provides checks and balances for sensitive activities.  Separation of Duties (SoD) is one of the key concepts of internal controls and is a requirement for many regulations including: Sarbanes-Oxley (SOX) Act Health Insurance Portability and Accountability Act (HIPAA) European Union Data Protection Directive. Its primary intent is to put barriers in place to prevent fraud or theft by an individual acting alone. Implementing Separation of Duties requires minimizing the possibility that users could modify data across application functions where the users should not normally have access. For flexfields and report parameters in Oracle E-Business Suite, values in value sets can affect functionality such as the rollup of accounting data, job grades used at a company, and so on. Controlling access to the creation or modification of value set values can be an important piece of implementing Separation of Duties in an organization. New Flexfield Value Set Security feature Flexfield value set security allows system administrators to restrict users from viewing, adding or updating values in specific value sets. Value set security enables role-based separation of duties for key flexfields, descriptive flexfields, and report parameters. For example, you can set up value set security such that certain users can view or insert values for any value set used by the Accounting Flexfield but no other value sets, while other users can view and update values for value sets used for any flexfields in Oracle HRMS. You can also segregate access by Operating Unit as well as by role or responsibility.Value set security uses a combination of data security and role-based access control in Oracle User Management. Flexfield value set security provides a level of security that is different from the previously-existing and similarly-named features in Oracle E-Business Suite: Function security controls whether a user has access to a specific page or form, as well as what operations the user can do in that screen. Flexfield value security controls what values a user can enter into a flexfield segment or report parameter (by responsibility) during routine data entry in many transaction screens across Oracle E-Business Suite. Flexfield value set security (this feature, new in Release 12.2) controls who can view, insert, or update values for a particular value set (by flexfield, report, or value set) in the Segment Values form (FNDFFMSV). The effect of flexfield value set security is that a user of the Segment Values form will only be able to view those value sets for which the user has been granted access. Further, the user will be able to insert or update/disable values in that value set if the user has been granted privileges to do so.  Flexfield value set security affects independent, dependent, and certain table-validated value sets for flexfields and report parameters. Initial State of the Feature upon Upgrade Because this is a new security feature, it is turned on by default.  When you initially install or upgrade to Release 12.2.2, no users are allowed to view, insert or update any value set values (users may even think that their values are missing or invalid because they cannot see the values).  You must explicitly set up access for specific users by enabling appropriate grants and roles for those users.We recommend using flexfield value set security as part of a comprehensive Separation of Duties strategy. However, if you choose not to implement flexfield value set security upon upgrading to or installing Release 12.2, you can enable backwards compatibility--users can access any value sets if they have access to the Values form--after you upgrade. The feature does not affect day-to-day transactions that use flexfields.  However, you must either set up specific grants and roles or enable backwards compatibility before users can create new values or update or disable existing values. For more information, see: Release 12.2 Flexfield Value Set Security Documentation Update for Patch 17305947:R12.FND.C (Document 1589204.1) R12.2 TOI: Implement and Use Application Object Library (AOL) - Flexfields Security and Separation of Duties for Value Sets (recorded training)

    Read the article

  • asp.net mvc json result format

    - by ile
    public class JsonCategoriesDisplay { public JsonCategoriesDisplay() { } public int CategoryID { set; get; } public string CategoryTitle { set; get; } } public class ArticleCategoryRepository { private DB db = new DB(); public IQueryable<JsonCategoriesDisplay> JsonFindAllCategories() { var result = from c in db.ArticleCategories select new JsonCategoriesDisplay { CategoryID = c.CategoryID, CategoryTitle = c.Title }; return result; } .... } public class ArticleController : Controller { ArticleRepository articleRepository = new ArticleRepository(); ArticleCategoryRepository articleCategoryRepository = new ArticleCategoryRepository(); public string Categories() { var jsonCats = articleCategoryRepository.JsonFindAllCategories().ToList(); //return Json(jsonCats, JsonRequestBehavior.AllowGet); return new JavaScriptSerializer().Serialize(new { jsonCats}); } } This results with following: {"jsonCats":[{"CategoryID":2,"CategoryTitle":"Politika"},{"CategoryID":3,"CategoryTitle":"Informatika"},{"CategoryID":4,"CategoryTitle":"Nova kategorija"},{"CategoryID":5,"CategoryTitle":"Testna kategorija"}]} If I use line that is commented and place JsonResult instead of returning string, I get following result: [{"CategoryID":2,"CategoryTitle":"Politika"},{"CategoryID":3,"CategoryTitle":"Informatika"},{"CategoryID":4,"CategoryTitle":"Nova kategorija"},{"CategoryID":5,"CategoryTitle":"Testna kategorija"}] But, I need result to be formatted like this: {'2':'Politika','3':'Informatika','4':'Nova kateorija','5':'Testna kategorija'} Is there a simple way to accomplish this or I will need to hardcode result? Thanks in advance!

    Read the article

  • A Nondeterministic Engine written in VB.NET 2010

    - by neil chen
    When I'm reading SICP (Structure and Interpretation of Computer Programs) recently, I'm very interested in the concept of an "Nondeterministic Algorithm". According to wikipedia:  In computer science, a nondeterministic algorithm is an algorithm with one or more choice points where multiple different continuations are possible, without any specification of which one will be taken. For example, here is an puzzle came from the SICP: Baker, Cooper, Fletcher, Miller, and Smith live on different floors of an apartment housethat contains only five floors. Baker does not live on the top floor. Cooper does not live onthe bottom floor. Fletcher does not live on either the top or the bottom floor. Miller lives ona higher floor than does Cooper. Smith does not live on a floor adjacent to Fletcher's.Fletcher does not live on a floor adjacent to Cooper's. Where does everyone live? After reading this I decided to build a simple nondeterministic calculation engine with .NET. The rough idea is that we can use an iterator to track each set of possible values of the parameters, and then we implement some logic inside the engine to automate the statemachine, so that we can try one combination of the values, then test it, and then move to the next. We also used a backtracking algorithm to go back when we are running out of choices at some point. Following is the core code of the engine itself: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Public Class NonDeterministicEngine Private _paramDict As New List(Of Tuple(Of String, IEnumerator)) 'Private _predicateDict As New List(Of Tuple(Of Func(Of Object, Boolean), IEnumerable(Of String))) Private _predicateDict As New List(Of Tuple(Of Object, IList(Of String))) Public Sub AddParam(ByVal name As String, ByVal values As IEnumerable) _paramDict.Add(New Tuple(Of String, IEnumerator)(name, values.GetEnumerator())) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(1, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(2, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(3, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(4, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(5, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(6, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(7, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(8, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Sub CheckParamCount(ByVal count As Integer, ByVal paramNames As IList(Of String)) If paramNames.Count <> count Then Throw New Exception("Parameter count does not match.") End If End Sub Public Property IterationOver As Boolean Private _firstTime As Boolean = True Public ReadOnly Property Current As Dictionary(Of String, Object) Get If IterationOver Then Return Nothing Else Dim _nextResult = New Dictionary(Of String, Object) For Each item In _paramDict Dim iter = item.Item2 _nextResult.Add(item.Item1, iter.Current) Next Return _nextResult End If End Get End Property Function MoveNext() As Boolean If IterationOver Then Return False End If If _firstTime Then For Each item In _paramDict Dim iter = item.Item2 iter.MoveNext() Next _firstTime = False Return True Else Dim canMoveNext = False Dim iterIndex = _paramDict.Count - 1 canMoveNext = _paramDict(iterIndex).Item2.MoveNext If canMoveNext Then Return True End If Do While Not canMoveNext iterIndex = iterIndex - 1 If iterIndex = -1 Then Return False IterationOver = True End If canMoveNext = _paramDict(iterIndex).Item2.MoveNext If canMoveNext Then For i = iterIndex + 1 To _paramDict.Count - 1 Dim iter = _paramDict(i).Item2 iter.Reset() iter.MoveNext() Next Return True End If Loop End If End Function Function GetNextResult() As Dictionary(Of String, Object) While MoveNext() Dim result = Current If Satisfy(result) Then Return result End If End While Return Nothing End Function Function Satisfy(ByVal result As Dictionary(Of String, Object)) As Boolean For Each item In _predicateDict Dim pred = item.Item1 Select Case item.Item2.Count Case 1 Dim p1 = DirectCast(pred, Func(Of Object, Boolean)) Dim v1 = result(item.Item2(0)) If Not p1(v1) Then Return False End If Case 2 Dim p2 = DirectCast(pred, Func(Of Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) If Not p2(v1, v2) Then Return False End If Case 3 Dim p3 = DirectCast(pred, Func(Of Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) If Not p3(v1, v2, v3) Then Return False End If Case 4 Dim p4 = DirectCast(pred, Func(Of Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) If Not p4(v1, v2, v3, v4) Then Return False End If Case 5 Dim p5 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) If Not p5(v1, v2, v3, v4, v5) Then Return False End If Case 6 Dim p6 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) If Not p6(v1, v2, v3, v4, v5, v6) Then Return False End If Case 7 Dim p7 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) Dim v7 = result(item.Item2(6)) If Not p7(v1, v2, v3, v4, v5, v6, v7) Then Return False End If Case 8 Dim p8 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) Dim v7 = result(item.Item2(6)) Dim v8 = result(item.Item2(7)) If Not p8(v1, v2, v3, v4, v5, v6, v7, v8) Then Return False End If Case Else Throw New NotSupportedException End Select Next Return True End FunctionEnd Class    And now we can use the engine to solve the problem we mentioned above:   Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Sub Test2() Dim engine = New NonDeterministicEngine() engine.AddParam("baker", {1, 2, 3, 4, 5}) engine.AddParam("cooper", {1, 2, 3, 4, 5}) engine.AddParam("fletcher", {1, 2, 3, 4, 5}) engine.AddParam("miller", {1, 2, 3, 4, 5}) engine.AddParam("smith", {1, 2, 3, 4, 5}) engine.AddRequire(Function(baker) As Boolean Return baker <> 5 End Function, {"baker"}) engine.AddRequire(Function(cooper) As Boolean Return cooper <> 1 End Function, {"cooper"}) engine.AddRequire(Function(fletcher) As Boolean Return fletcher <> 1 And fletcher <> 5 End Function, {"fletcher"}) engine.AddRequire(Function(miller, cooper) As Boolean 'Return miller = cooper + 1 Return miller > cooper End Function, {"miller", "cooper"}) engine.AddRequire(Function(smith, fletcher) As Boolean Return smith <> fletcher + 1 And smith <> fletcher - 1 End Function, {"smith", "fletcher"}) engine.AddRequire(Function(fletcher, cooper) As Boolean Return fletcher <> cooper + 1 And fletcher <> cooper - 1 End Function, {"fletcher", "cooper"}) engine.AddRequire(Function(a, b, c, d, e) As Boolean Return a <> b And a <> c And a <> d And a <> e And b <> c And b <> d And b <> e And c <> d And c <> e And d <> e End Function, {"baker", "cooper", "fletcher", "miller", "smith"}) Dim result = engine.GetNextResult() While Not result Is Nothing Console.WriteLine(String.Format("baker: {0}, cooper: {1}, fletcher: {2}, miller: {3}, smith: {4}", result("baker"), result("cooper"), result("fletcher"), result("miller"), result("smith"))) result = engine.GetNextResult() End While Console.WriteLine("Calculation ended.")End Sub   Also, this engine can solve the classic 8 queens puzzle and find out all 92 results for me.   Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Sub Test3() ' The 8-Queens problem. Dim engine = New NonDeterministicEngine() ' Let's assume that a - h represents the queens in row 1 to 8, then we just need to find out the column number for each of them. engine.AddParam("a", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("b", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("c", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("d", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("e", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("f", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("g", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("h", {1, 2, 3, 4, 5, 6, 7, 8}) Dim NotInTheSameDiagonalLine = Function(cols As IList) As Boolean For i = 0 To cols.Count - 2 For j = i + 1 To cols.Count - 1 If j - i = Math.Abs(cols(j) - cols(i)) Then Return False End If Next Next Return True End Function engine.AddRequire(Function(a, b, c, d, e, f, g, h) As Boolean Return a <> b AndAlso a <> c AndAlso a <> d AndAlso a <> e AndAlso a <> f AndAlso a <> g AndAlso a <> h AndAlso b <> c AndAlso b <> d AndAlso b <> e AndAlso b <> f AndAlso b <> g AndAlso b <> h AndAlso c <> d AndAlso c <> e AndAlso c <> f AndAlso c <> g AndAlso c <> h AndAlso d <> e AndAlso d <> f AndAlso d <> g AndAlso d <> h AndAlso e <> f AndAlso e <> g AndAlso e <> h AndAlso f <> g AndAlso f <> h AndAlso g <> h AndAlso NotInTheSameDiagonalLine({a, b, c, d, e, f, g, h}) End Function, {"a", "b", "c", "d", "e", "f", "g", "h"}) Dim result = engine.GetNextResult() While Not result Is Nothing Console.WriteLine("(1,{0}), (2,{1}), (3,{2}), (4,{3}), (5,{4}), (6,{5}), (7,{6}), (8,{7})", result("a"), result("b"), result("c"), result("d"), result("e"), result("f"), result("g"), result("h")) result = engine.GetNextResult() End While Console.WriteLine("Calculation ended.")End Sub (Chinese version of the post: http://www.cnblogs.com/RChen/archive/2010/05/17/1737587.html) Cheers,  

    Read the article

  • Patterns for Handling Changing Property Sets in C++

    - by Bhargav Bhat
    I have a bunch "Property Sets" (which are simple structs containing POD members). I'd like to modify these property sets (eg: add a new member) at run time so that the definition of the property sets can be externalized and the code itself can be re-used with multiple versions/types of property sets with minimal/no changes. For example, a property set could look like this: struct PropSetA { bool activeFlag; int processingCount; /* snip few other such fields*/ }; But instead of setting its definition in stone at compile time, I'd like to create it dynamically at run time. Something like: class PropSet propSetA; propSetA("activeFlag",true); //overloading the function call operator propSetA("processingCount",0); And the code dependent on the property sets (possibly in some other library) will use the data like so: bool actvFlag = propSet["activeFlag"]; if(actvFlag == true) { //Do Stuff } The current implementation behind all of this is as follows: class PropValue { public: // Variant like class for holding multiple data-types // overloaded Conversion operator. Eg: operator bool() { return (baseType == BOOLEAN) ? this->ToBoolean() : false; } // And a method to create PropValues various base datatypes static FromBool(bool baseValue); }; class PropSet { public: // overloaded[] operator for adding properties void operator()(std::string propName, bool propVal) { propMap.insert(std::make_pair(propName, PropVal::FromBool(propVal))); } protected: // the property map std::map<std::string, PropValue> propMap; }; This problem at hand is similar to this question on SO and the current approach (described above) is based on this answer. But as noted over at SO this is more of a hack than a proper solution. The fundamental issues that I have with this approach are as follows: Extending this for supporting new types will require significant code change. At the bare minimum overloaded operators need to be extended to support the new type. Supporting complex properties (eg: struct containing struct) is tricky. Supporting a reference mechanism (needed for an optimization of not duplicating identical property sets) is tricky. This also applies to supporting pointers and multi-dimensional arrays in general. Are there any known patterns for dealing with this scenario? Essentially, I'm looking for the equivalent of the visitor pattern, but for extending class properties rather than methods. Edit: Modified problem statement for clarity and added some more code from current implementation.

    Read the article

  • Required Skill Sets Of A Software Architect

    The question has been asked as to what is the required skill sets of a software architect. The answer to this is that it truly depends. When I state that it depend, it depends on the organization, industry, and skill sets available on the open market and internally within a company. With open ended skill sets even Napoleon Dynamite could be an architect. Napoleon Dynamite’s Skills Pedro: Have you asked anybody yet? Napoleon Dynamite: No, but who would? I don't even have any good skills. Pedro: What do you mean? Napoleon Dynamite: You know, like nunchuck skills, bow hunting skills, computer hacking skills... Girls only want boyfriends who have great skills. Pedro: Aren't you pretty good at drawing, like animals and warriors and stuff? This example might be a little off base but it does illustrate a point. What are the real required skills of a software architect? In my opinion, an architect needs to demonstrate the knowledge of the following three main skill set categories so that they are successful. General Skill Sets of an Architect Basic Engineering Skills Organizational  Skills Interpersonal Skills Basic Engineering Skills are a very large part of what a software architect deal with on a daily bases when designing or updating systems. Think about it, how good would a lead mechanic be if they did not know how to fix or repair cars? They would not be, and that is my point that architects need to have at least some basic skills regarding engineering. The skills listed below are generic in nature because they change from job to job, so in this discussion I am trying to focus more on generalities so that anyone can apply this information to their individual situation. Common Basic Engineering Skills Data Modeling Code Creation Configuration Testing Deployment/Publishing System and Environment Knowledge Organizational Skills If an Architect works for or with an origination then they will need strong organization skills to survive. An architect is no use to a project if the project is missed managed. Additionally, budgets and timelines can really affect a company and their products when established deadlines are repeated not meet. By not meeting these timelines a company is forced to cancel the project and waste all the money and time spent or spend more money until it is completed, if it is ever completed. Common Organizational Skills Project Management Estimation (Cost and Time) Creation and Maintenance of Accepted Standards Interpersonal Skills For me personally Interpersonal skill ranks above the other types of skill sets because an architect can quickly pick up the other two skill sets by communicating with other team/project members so that they are quickly up to speed on a project. Additionally, in order for an architect to manage a project or even derive rough estimates they will more than likely have to consult with others actually working on the code (Programmers/Software Engineers) to get there estimates since they will be the ones actually working on the changes to be implemented. Common Interpersonal Skills Good Communicator Focus on projects success over personal Honors roles within a team Reference: Taylor, R. N., Medvidovic, N., & Dashofy, E. M. (2009). Software architecture: Foundations, theory, and practice Hoboken, NJ: John Wiley & Sons

    Read the article

  • Code Analysis Rule Sets in Visual Studio 2010

    - by Anthony Trudeau
    Microsoft Visual Studio 2010 introduces the concept of rule sets when configuring code analysis.  This is a valuable change from Visual Studio 2008 that I didn't even realize I wanted.  Visual Studio 2008 by default selected all rules and then you had to remove rules on an item by item basis. The rule sets fall into logical groups including "Microsoft All Rules", "Microsoft Basic Correctness Rules", "Microsoft Security Rules", et al.  And within the project properties you can select one rule set, multiple rule sets, or you can define your own rule set based upon another. Selecting a single rule set is obviously the easiest option.  The default rule set when you create a new project is the "Microsoft Minimum Recommended Rules".  However, in my opinion the recommended rules are just too permissive.  For that reason you might want to change your rule set to "Microsoft All Rules" until you get around to creating your own rule set; or alternately you can select multiple rule sets which is an option from the rule set combo box.  The Visual Studio documentation has comprehensive help on what is contained within the rule sets. Creating your own rule set is easy if not obvious.  You need to start a rule set from an existing rule set.  To get started select a rule set in the combo box within the Code Analysis tab of the project properties.  I selected the "Microsoft All Rules" for my rule set, but you may find it easier to start with the "Microsoft Minimum Recommended Rules" if your rules are on the more permissive side. Once your rule set is selected click the Open button.  This will display a dialog that is similar in composition to the rules selection from Visual Studio 2008.  Browsing through the tree view you can select or deselect individual rules within their categories; and you can indicate that the rules are flagged as errors instead of the default which is a warning.  A nice touch to the form is that you get a help pane when you select an individual rule.  That helped me considerably when I first configured my rule set. Once you have finished selecting your rules click the Save tool button, specify a location and name, and click the Save button on the Save As dialog.  Once you're back on the Code Analysis tab you'll choose the Browse option within the combo box and open the file you just created.

    Read the article

  • Positive result, negative result and current balance. How do you make starting balance show current result?

    - by Tine
    I have 3 columns. Column A shows positive result and if the result is negative then it is in a column B. Column B shows negative result and if the result is positive then it is in a column A. (meaning that either columns can have 0.00 in the cell (empty zero cells)). Column C has starting assets and it also shows the current balance that while result A or B are adding up and current balance is showing the current result. What is the proper formula for this I hope I was clear with my problem. Please help. Thanks in advance!

    Read the article

  • Special Value Sets in Oracle Applications

    - by Manoj Madhusoodanan
    Here I am going to explain Special Value Sets in Oracle Applications.I have a requirement in which I want to execute a BIP report with some parameters. The first parameter Current Month should allow only MON-YYYY format.Schedule Start Date and Schedule End Date should be with in first parameter month. Approach 1If the report is through PL/SQL Stored Procedure executable the we can do all the validation in backend. Approach 2Second approach is through Special Value Sets.This value set has events like Edit,Load and Validate.We can attach PL/SQL code snippet to each event.Here I am going to attach validation routine to Validate event to validate the user input.Validate event fires when the focus leaves from the item. Here I am going to create two special value sets ( one for first parameter and another for the second and third parameter). Value Set 1Name : XXCUST_CURRENT_MONTHList Type : List of ValuesFormat Type : CharMaximum Size : 8Validation Type : SpecialEvent : ValidateFunction : XXCUST_CURRENT_MONTH_VALIDATE_ROUTINEValue Set 2Name : XXCUST_DATESList Type : List of ValuesFormat Type : Standard DateValidation Type : SpecialEvent : ValidateFunction : XXCUST_DATES_VALIDATE_ROUTINE Note: Inside the validate routine I am using FND messages.Generate message file also using "FNDMDGEN apps/password 0 Y US XXCUST DB_TO_RUNTIME". Attach XXCUST_CURRENT_MONTH to first parameter.Also XXCUST_DATES to second and third parameter. Note: Since the program is using Special Value Sets it can be submit only through Oracle Forms.Submission through OA Framework and PL/SQL APIs are not recommended. OutputGive Current Date as 01-2012 Give Schedule Start Date out of current month.

    Read the article

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