Search Results

Search found 2646 results on 106 pages for '300 baud'.

Page 10/106 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Floating point computer - Trouble with getting back correct results

    - by Francisco P.
    Having trouble with a challenge. Let's say I have a theoretical, base 10, floating point calculator with the following characteristics Only 3 digits for mantissa 1 digit for exponent Sign for mantissa and exponent How would this machine compute the following? 300 + \sum_{i=1}^{100} 0.2 The correct result is 320. The machine's result is 300. But why? Can't get where the 20 goes goes missing... Thanks for your time.

    Read the article

  • Does setting HttpCacheability.Public also cache the page on the server?

    - by Stewart Robinson
    I have these lines in my global.asax (basically because of http://stackoverflow.com/questions/2469348/can-i-add-my-caching-lines-to-global-asax) The thing I want to now understand is whether this code purely adds the HTTP headers to the page or does it also make .Net cache this page on the server for 300 seconds? Response.Cache.SetExpires(DateTime.Now.AddSeconds(300)); Response.Cache.SetCacheability(HttpCacheability.Public);

    Read the article

  • Scroll DIV Horizontally with Mouse Events

    - by williamtroup
    I have a layout as follows: <div style="width: 300"> <div style="width: 300">Some Content</div> </div I want to be able to mousedown in the content DIV and be able to move it left to right, or scroll it in other words :) What would be the best way of being this? I would prefer it in JavaScript mainly :)

    Read the article

  • jQuery animate Toggle

    - by danit
    Here is my code so far: $(document).ready(function(){ $("#slider").click(function() { $("#insight").animate({ top: "25px",}, 300, function() { $("#insight").animate({ top: "89px",}, 300); }); }); }); I want this to act like .toggle(), where by on click #div1 slides up to top:25px and then stops, but when clicked again slides down to top:89px. Can anyone expand the function above to achieve this?

    Read the article

  • jQuery animate opacity doesn't work properly on IE

    - by fidoboy
    I'm trying to use animate function to change the height and opacity for a DIV. The div has a image background in CSS, it works fine on Firefox and Safari, but when i test it on IE the background is being removed. This is my code: if (jQuery.support.opacity) { jQuery('#list_box').animate({opacity: '1',height: '300px',top: newTop},{duration: 300}); } else { jQuery('#list_box').animate({filter: 'alpha(opacity=100)',height: '300px',top: newTop},{duration: 300}); } How can i fix it?

    Read the article

  • Why won't this piece of my code write to file

    - by user2934783
    I am developing a c++ banking system. I am able to get the float, newbal, values correctly and when I try to write to file, there is no data in the file. else { file>>firstname>>lastname; cout<<endl<<firstname<<" "<<lastname<<endl; cout<<"-----------------------------------\n"; string line; while (getline(file, line)) { //stringstream the getline for line string in file istringstream iss(line); if (iss >> date >> amount) { cout<<date<<"\t\t$"<<showpoint<<fixed<<setprecision(2)<<amount<<endl; famount+=amount; } } cout<<"Your balance is $"<<famount<<endl; cout<<"How much would you like to deposit today: $"; cin>>amountinput; float newbal=0; newbal=(famount+=amountinput); cout<<"\nYour new balance is: $"<<newbal<<".\n"; file<<date<<"\t\t"<<newbal; //***This should be writing to file but it doesn't. file.close(); The text file looks like this: Tony Gaddis 05/24/12 100 05/30/12 300 07/01/12 -300 //Console Output looks like this Tony Gaddis 05/24/12 100 05/30/12 300 07/01/12 -300 Your balance is: #1 How much wuld you like to deposit: #2 Your new balance is: #1 + #2 write to file close file. //exits to main loop:::: How can I make it write to file and save it, and why is this happening. I tried doing it with ostringstream as well considering how I used istringstream for the input. But it didn't work either :\ float newbal=0; newbal=(famount+=amountinput); ostringstream oss(newbal); oss<<date<<"\t\t"<<newbal; I am trying to self teach c++ so any relevant information would be kindly appreciated.

    Read the article

  • I want to add ranges of rates for which I have a particular %

    - by happy
    My problem is I should add rates without overlapping and if a range of rates is missed while adding a new range I should display a message saying the range is missed. Example: 200 300 ----- 3% 300 400 ------5% and if I am adding new range, say 600 800 ------10% I should get a message saying the ranges 401 to 599 is missing.

    Read the article

  • How to diagnose failing 6Gbps SATA connection?

    - by whitequark
    I have a Samsung RC530 notebook and OCZ Vertex-3 6Gbps SATA SSD working in AHCI mode. # dmesg | grep DMI SAMSUNG ELECTRONICS CO., LTD. RC530/RC730/RC530/RC730, BIOS 03WD.M008.20110927.PSA 09/27/2011 # lspci -nn 00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller [8086:1c03] (rev 04) # sdparm -a /dev/sda /dev/sda: ATA OCZ-VERTEX3 2.15 At the boot, the following messages are present in dmesg (I am running Debian wheezy @ Linux 3.2.8): # dmesg | grep -iE '(ata|ahci)' [ 5.179783] ahci 0000:00:1f.2: version 3.0 [ 5.179802] ahci 0000:00:1f.2: PCI INT B -> GSI 19 (level, low) -> IRQ 19 [ 5.179864] ahci 0000:00:1f.2: irq 42 for MSI/MSI-X [ 5.195424] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 6 ports 6 Gbps 0x5 impl SATA mode [ 5.195429] ahci 0000:00:1f.2: flags: 64bit ncq sntf pm led clo pio slum part ems apst [ 5.195436] ahci 0000:00:1f.2: setting latency timer to 64 [ 5.204035] scsi0 : ahci [ 5.204301] scsi1 : ahci [ 5.204447] scsi2 : ahci [ 5.204592] scsi3 : ahci [ 5.204682] scsi4 : ahci [ 5.204799] scsi5 : ahci [ 5.204917] ata1: SATA max UDMA/133 abar m2048@0xf7c06000 port 0xf7c06100 irq 42 [ 5.204920] ata2: DUMMY [ 5.204923] ata3: SATA max UDMA/133 abar m2048@0xf7c06000 port 0xf7c06200 irq 42 [ 5.204924] ata4: DUMMY [ 5.204926] ata5: DUMMY [ 5.204927] ata6: DUMMY [ 5.523039] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [ 5.525911] ata3.00: ATAPI: TSSTcorp CDDVDW SN-208BB, SC00, max UDMA/100 [ 5.531006] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [ 5.533703] ata3.00: configured for UDMA/100 [ 5.542790] ata1.00: ATA-8: OCZ-VERTEX3, 2.15, max UDMA/133 [ 5.542800] ata1.00: 117231408 sectors, multi 16: LBA48 NCQ (depth 31/32), AA [ 5.552751] ata1.00: configured for UDMA/133 [ 5.553050] scsi 0:0:0:0: Direct-Access ATA OCZ-VERTEX3 2.15 PQ: 0 ANSI: 5 [ 5.559621] scsi 2:0:0:0: CD-ROM TSSTcorp CDDVDW SN-208BB SC00 PQ: 0 ANSI: 5 [ 5.564059] sd 0:0:0:0: [sda] 117231408 512-byte logical blocks: (60.0 GB/55.8 GiB) [ 5.564127] sd 0:0:0:0: [sda] Write Protect is off [ 5.564131] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 [ 5.564158] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 5.564582] sda: sda1 [ 5.564810] sd 0:0:0:0: [sda] Attached SCSI disk [ 5.572006] sr0: scsi3-mmc drive: 16x/24x writer dvd-ram cd/rw xa/form2 cdda tray [ 5.572010] cdrom: Uniform CD-ROM driver Revision: 3.20 [ 5.572189] sr 2:0:0:0: Attached scsi CD-ROM sr0 [ 6.717181] ata1.00: exception Emask 0x50 SAct 0x1 SErr 0x280900 action 0x6 frozen [ 6.717238] ata1.00: irq_stat 0x08000000, interface fatal error [ 6.717291] ata1: SError: { UnrecovData HostInt 10B8B BadCRC } [ 6.717342] ata1.00: failed command: READ FPDMA QUEUED [ 6.717395] ata1.00: cmd 60/50:00:20:39:58/00:00:00:00:00/40 tag 0 ncq 40960 in [ 6.717396] res 40/00:00:20:39:58/00:00:00:00:00/40 Emask 0x50 (ATA bus error) [ 6.717503] ata1.00: status: { DRDY } [ 6.717553] ata1: hard resetting link [ 7.033417] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [ 7.055234] ata1.00: configured for UDMA/133 [ 7.055262] ata1: EH complete [ 7.147280] ata1.00: exception Emask 0x10 SAct 0xf8 SErr 0x280100 action 0x6 frozen [ 7.147340] ata1.00: irq_stat 0x08000000, interface fatal error [ 7.147393] ata1: SError: { UnrecovData 10B8B BadCRC } [ 7.147460] ata1.00: failed command: READ FPDMA QUEUED [ 7.147529] ata1.00: cmd 60/08:18:88:17:41/00:00:02:00:00/40 tag 3 ncq 4096 in [ 7.147531] res 40/00:38:50:99:64/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.147691] ata1.00: status: { DRDY } [ 7.147754] ata1.00: failed command: READ FPDMA QUEUED [ 7.147821] ata1.00: cmd 60/00:20:f8:42:4c/01:00:02:00:00/40 tag 4 ncq 131072 in [ 7.147822] res 40/00:38:50:99:64/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.147977] ata1.00: status: { DRDY } [ 7.148036] ata1.00: failed command: READ FPDMA QUEUED [ 7.148100] ata1.00: cmd 60/50:28:f8:43:4c/00:00:02:00:00/40 tag 5 ncq 40960 in [ 7.148101] res 40/00:38:50:99:64/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.148255] ata1.00: status: { DRDY } [ 7.148315] ata1.00: failed command: READ FPDMA QUEUED [ 7.148379] ata1.00: cmd 60/00:30:50:98:64/01:00:02:00:00/40 tag 6 ncq 131072 in [ 7.148380] res 40/00:38:50:99:64/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.148534] ata1.00: status: { DRDY } [ 7.148593] ata1.00: failed command: READ FPDMA QUEUED [ 7.148657] ata1.00: cmd 60/00:38:50:99:64/01:00:02:00:00/40 tag 7 ncq 131072 in [ 7.148658] res 40/00:38:50:99:64/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.148813] ata1.00: status: { DRDY } [ 7.148875] ata1: hard resetting link [ 7.464842] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [ 7.486794] ata1.00: configured for UDMA/133 [ 7.486822] ata1: EH complete [ 7.546395] ata1.00: exception Emask 0x10 SAct 0x2f SErr 0x280100 action 0x6 frozen [ 7.546470] ata1.00: irq_stat 0x08000000, interface fatal error [ 7.546531] ata1: SError: { UnrecovData 10B8B BadCRC } [ 7.546588] ata1.00: failed command: READ FPDMA QUEUED [ 7.546648] ata1.00: cmd 60/00:00:e0:4b:61/01:00:02:00:00/40 tag 0 ncq 131072 in [ 7.546649] res 40/00:28:e0:4c:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.546794] ata1.00: status: { DRDY } [ 7.546847] ata1.00: failed command: READ FPDMA QUEUED [ 7.546906] ata1.00: cmd 60/00:08:90:2f:48/01:00:02:00:00/40 tag 1 ncq 131072 in [ 7.546907] res 40/00:28:e0:4c:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.547053] ata1.00: status: { DRDY } [ 7.547106] ata1.00: failed command: READ FPDMA QUEUED [ 7.547165] ata1.00: cmd 60/00:10:90:30:48/01:00:02:00:00/40 tag 2 ncq 131072 in [ 7.547166] res 40/00:28:e0:4c:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.547310] ata1.00: status: { DRDY } [ 7.547363] ata1.00: failed command: READ FPDMA QUEUED [ 7.547422] ata1.00: cmd 60/00:18:50:c7:64/01:00:02:00:00/40 tag 3 ncq 131072 in [ 7.547423] res 40/00:28:e0:4c:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.547568] ata1.00: status: { DRDY } [ 7.547621] ata1.00: failed command: READ FPDMA QUEUED [ 7.547681] ata1.00: cmd 60/00:28:e0:4c:61/01:00:02:00:00/40 tag 5 ncq 131072 in [ 7.547682] res 40/00:28:e0:4c:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.547825] ata1.00: status: { DRDY } [ 7.547882] ata1: hard resetting link [ 7.864408] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [ 7.886351] ata1.00: configured for UDMA/133 [ 7.886375] ata1: EH complete [ 7.890012] ata1: limiting SATA link speed to 3.0 Gbps [ 7.890016] ata1.00: exception Emask 0x10 SAct 0x7 SErr 0x280100 action 0x6 frozen [ 7.890093] ata1.00: irq_stat 0x08000000, interface fatal error [ 7.890152] ata1: SError: { UnrecovData 10B8B BadCRC } [ 7.890210] ata1.00: failed command: READ FPDMA QUEUED [ 7.890272] ata1.00: cmd 60/00:00:90:33:48/01:00:02:00:00/40 tag 0 ncq 131072 in [ 7.890273] res 40/00:10:e0:4f:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.890418] ata1.00: status: { DRDY } [ 7.890472] ata1.00: failed command: READ FPDMA QUEUED [ 7.890530] ata1.00: cmd 60/00:08:90:34:48/01:00:02:00:00/40 tag 1 ncq 131072 in [ 7.890531] res 40/00:10:e0:4f:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.890672] ata1.00: status: { DRDY } [ 7.890724] ata1.00: failed command: READ FPDMA QUEUED [ 7.890781] ata1.00: cmd 60/78:10:e0:4f:61/00:00:02:00:00/40 tag 2 ncq 61440 in [ 7.890782] res 40/00:10:e0:4f:61/00:00:02:00:00/40 Emask 0x10 (ATA bus error) [ 7.890925] ata1.00: status: { DRDY } [ 7.890981] ata1: hard resetting link [ 8.208021] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320) [ 8.230100] ata1.00: configured for UDMA/133 [ 8.230124] ata1: EH complete Looks like the SATA interface tries to use 6Gbps link, then fails miserably and Linux fallbacks to 3Gbps. This is somewhat fine for me, as the system boots successfully each time and works under high load (cd linux-3.2.8; make -j16). I've also ran memtest86+ and it did not find any errors. What concerns me more is that Grub sometimes takes a long time to load the images and/or fails to load itself completely. The error is consistent and is probablistic: that is, each time I boot I have a certain chance to fail. Actually, I have a slight suspiction on the cause of the failure. Look at the cabling: What kind of engineer does it this way? Nah. Even 1Gbps Ethernet hardly tolerates cables bent over a small angle, and there you have 6Gbps SATA. How cound I determine and fix the cause of errors and/or switch the link to 3Gbps mode permanently?

    Read the article

  • How can I make a table move in JavaScript?

    - by Michal Skrzypek
    My problem is that I was creating a simple website the other day and I needed the content to move according to the button pressed. I managed to do so in CSS3, but the solution did not work for IE whatsoever. Therefore I would like to ask if there is a simple solution for that in js? I don't know js at all but I heard what I need is much easier in js than in css. Details: http://i42.tinypic.com/6yl4ia.png I need the table in the picture to move according to the buttons (which are labels to be exact). The visible area is a div. Here's the relevant code (without animation as I was not satisfied with it): body { background-color: #fff; color: #fff; padding:0px; } #bodywrapperfixed { width: 1248px; margin: 0px auto; position: relative; overflow: hidden; height: 730px; } #bodywrapper { display:block; background-color: #fff; width: 1248px; color: #59595B; padding-top:50px; font-family: 'Roboto', sans-serif; position: absolute; top:0px; left:0px; z-index:1; font-size: 60px; height:730px; } #bodywrapper img { width:400px; padding:15px 0px 20px 0px; } #texten { font-family: 'Roboto', sans-serif; font-size: 35px; padding:5px; } #textpl { font-family: 'Roboto', sans-serif; font-size: 25px; padding:5px; } table#linki { width: 110px; border: none; margin-top:15px; } label { display: block; height: 54px; width: 54px; color:#fff; font-family: 'Roboto', sans-serif; font-weight: 300; font-size: 35px; background-color: #117D10; text-align: center; padding:23px; } label:hover { background-color: #004F00; cursor: pointer; } input#pl { position: absolute; top: -9999px; left: -9999px; } input#en { position: absolute; top: -9999px; left: -9999px; } and the relevant HTML: <div id="bodywrapperfixed"> <div id="bodywrapperfloat"> <table id="ramka"> <tr> <td>random text</td> <td><div id="bodywrapper"> <center> <div id="texten"><div style="font-weight:300; display:inline-block;">Introducing the all-in-one entertainment system.</div><div style="font-weight:500; display:inline-block;">&nbsp;For everyone.</div></div> <div id="textpl"><div style="font-weight:300; display:inline-block;">Przedstawiamy zintegrowany system rozrywki.</div><div style="font-weight:500; display:inline-block;">&nbsp;&nbsp;Dla wszystkich.</div></div> <img src="imgs/xboxone.png"> <div id="texten"><div style="font-weight:300; display:inline-block;">Choose your version of the story:</div></div> <div id="textpl"><div style="font-weight:300; display:inline-block;">Wybierz swoja wersja opowiesci:</div></div> <table id="linki"> <tr> <td><label for="en">en</label><input id="en" type="checkbox"></td> <td><label for="pl">pl</label><input id="pl" type="checkbox"></td> </tr></table> </center> </div></td> <td>random text</td> </tr> </table> </div> </div> Here's what it looks like: http://ingame.lh.pl/thinkone/ Please help me.

    Read the article

  • Two strange efficiency problems in Mathematica

    - by Jess Riedel
    FIRST PROBLEM I have timed how long it takes to compute the following statements (where V[x] is a time-intensive function call): Alice = Table[V[i],{i,1,300},{1000}]; Bob = Table[Table[V[i],{i,1,300}],{1000}]^tr; Chris_pre = Table[V[i],{i,1,300}]; Chris = Table[Chris_pre,{1000}]^tr; Alice, Bob, and Chris are identical matricies computed 3 slightly different ways. I find that Chris is computed 1000 times faster than Alice and Bob. It is not surprising that Alice is computed 1000 times slower because, naively, the function V must be called 1000 more times than when Chris is computed. But it is very surprising that Bob is so slow, since he is computed identically to Chris except that Chris stores the intermediate step Chris_pre. Why does Bob evaluate so slowly? SECOND PROBLEM Suppose I want to compile a function in Mathematica of the form f(x)=x+y where "y" is a constant fixed at compile time (but which I prefer not to directly replace in the code with its numerical because I want to be able to easily change it). If y's actual value is y=7.3, and I define f1=Compile[{x},x+y] f2=Compile[{x},x+7.3] then f1 runs 50% slower than f2. How do I make Mathematica replace "y" with "7.3" when f1 is compiled, so that f1 runs as fast as f2? Many thanks!

    Read the article

  • Cocoa Read NSInputStream from FTP connection

    - by Chuck
    Hi, I (apparently) manage to make a ftp connection, but fail to read anything from it, and with good cause: I don't reach the reading until the connection has timed out. Here's my code: NSHost *host = [NSHost hostWithAddress:@"127.0.0.1"]; [NSStream getStreamsToHost:host port:3333 inputStream:&iStream outputStream:&oStream]; NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:1]; [settings setObject:(NSString *)NSStreamSocketSecurityLevelTLSv1 forKey:(NSString *)kCFStreamSSLLevel]; [settings setObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCFStreamSSLAllowsAnyRoot]; [iStream retain]; [iStream setDelegate:self]; [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; CFReadStreamSetProperty((CFReadStreamRef)iStream, kCFStreamPropertySSLSettings, (CFTypeRef)settings);forKey:NSStreamSocketSecurityLevelKey]; [iStream open]; [oStream retain]; [oStream setDelegate:self]; [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; CFWriteStreamSetProperty((CFWriteStreamRef)oStream, kCFStreamPropertySSLSettings, (CFTypeRef)settings); forKey:NSStreamSocketSecurityLevelKey]; [oStream open]; NSMutableData *returnMessage = [NSMutableData dataWithLength: 300]; [iStream read: [returnMessage mutableBytes] maxLength: 300]; NSString *readData = [[NSString alloc] initWithBytes: [returnMessage bytes] length: 300 encoding: NSUTF8StringEncoding]; NSRunAlertPanel(@"response", readData, nil, nil, nil); I have not sent a request to the FTP to switch to ssl yet. Any help is greatly appreciated as I find Xcode quite horrible for debugging (no exception or error msg on failed steps what so ever). Chuck

    Read the article

  • stock management of assemblys and its sub parts

    - by The Disintegrator
    I have to track the stock of individual parts and kits (assembly) and can't find a satisfactory way of doing this. Sample bogus and hyper simplified database: Table prod: prodID 1 prodName Flux capacitor prodCost 900 prodPrice 1350 (900*1.5) prodStock 3 - prodID 2 prodName Mr Fusion prodCost 300 prodPrice 600 (300*2) prodStock 2 - prodID 3 prodName Time travel kit prodCost 1650 (1350+300) prodPrice 2145 (1650*1.3) prodStock 2 Table rels relID 1 relSrc 1 (Flux capacitor) relType 4 (is a subpart of) relDst 3 (Time travel kit) - relID 2 relSrc 2 (Mr Fusion) relType 4 (is a subpart of) relDst 3 (Time travel kit) prodPrice: it's calculated based on the cost but not in a linear way. In this example for costs of 500 or less, the markup is a 200%. For costs of 500-1000 the markup is 150%. For costs of 1000+ the markup is 130% That's why the time travel kit is much cheaper than the individual parts prodStock: here is my problem. I can sell kits or the individual parts, So the stock of the kits is virtual. The problem when I buy: Some providers sell me the Time Travel kit as a whole (with one barcode) and some sells me the individual parts (with a different barcode) So when I load the stock I don't know how to impute it. The problem when I sell: If I only sell kits, calculate the stock would be easy: "I have 3 Flux capacitors and 2 Mr Fusions, so I have 2 Time travel kits and a Flux Capacitor" But I can sell Kits or individual parts. I have to track the stock of the individual parts and the possible kits at the same time (and I have to compensate for the sell price) Probably this is really simple, but I can't see a simple solution. Resuming: I have to find a way of tracking the stock and the database/program is the one who has to do it (I cant ask the clerk to correct the stock) I'm using php+MySql. But this is more a logical problem than a programing one

    Read the article

  • Stock management of assemblies and its sub parts

    - by The Disintegrator
    I have to track the stock of individual parts and kits (assemblies) and can't find a satisfactory way of doing this. Sample bogus and hyper simplified database: Table prod: prodID 1 prodName Flux capacitor prodCost 900 prodPrice 1350 (900*1.5) prodStock 3 - prodID 2 prodName Mr Fusion prodCost 300 prodPrice 600 (300*2) prodStock 2 - prodID 3 prodName Time travel kit prodCost 1650 (1350+300) prodPrice 2145 (1650*1.3) prodStock 2 Table rels relID 1 relSrc 1 (Flux capacitor) relType 4 (is a subpart of) relDst 3 (Time travel kit) - relID 2 relSrc 2 (Mr Fusion) relType 4 (is a subpart of) relDst 3 (Time travel kit) prodPrice: it's calculated based on the cost but not in a linear way. In this example for costs of 500 or less, the markup is a 200%. For costs of 500-1000 the markup is 150%. For costs of 1000+ the markup is 130% That's why the time travel kit is much cheaper than the individual parts prodStock: here is my problem. I can sell kits or the individual parts, So the stock of the kits is virtual. The problem when I buy: Some providers sell me the Time Travel kit as a whole (with one barcode) and some sells me the individual parts (with a different barcode) So when I load the stock I don't know how to impute it. The problem when I sell: If I only sell kits, calculate the stock would be easy: "I have 3 Flux capacitors and 2 Mr Fusions, so I have 2 Time travel kits and a Flux Capacitor" But I can sell Kits or individual parts. So, I have to track the stock of the individual parts and the possible kits at the same time (and I have to compensate for the sell price) Probably this is really simple, but I can't see a simple solution. Resuming: I have to find a way of tracking the stock and the database/program is the one who has to do it (I cant ask the clerk to correct the stock) I'm using php+MySql. But this is more a logical problem than a programing one

    Read the article

  • Determine whether a canvas has been inserted into each page

    - by Hadi Teo
    Hi, Currently i have a code which will print OMR Mark on each pages. Basically i insert a canvas into each page and subsequently an OMR Mark Line Series are inserted into the canvas. Recently i found an issue that somehow one of the canvas is placed out of a page and it appears at the previous page instead of the current page. Below is the code snippet in how i inserted canvas as well as OMR Marks into each page: ' Start Code Snippet Sub GenerateOMR() Dim ShpCanvas As Shape Dim MaxPages As Integer Dim PNo As Integer ClearOMR MaxPages = Selection.Information(wdNumberOfPagesInDocument) For PNo = 1 To MaxPages Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=PNo, Name:="" Select Case PNo Case 1 Set ShpCanvas = ActiveDocument.Shapes.AddCanvas(0, 0.5, 600, 300) Case Else Set ShpCanvas = ActiveDocument.Shapes.AddCanvas(0, 0, 600, 300) End Select ' Add a canvas on each page With ShpCanvas .Name = "OMR_Canvas_" & CStr(PNo) .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .RelativeVerticalPosition = wdRelativeVerticalPositionPage End With ' Insert a white background rectange and remove the rectangle border line With ShpCanvas.CanvasItems.AddShape(msoShapeRectangle, 536, 0, 64, 300) .Name = "OMR_WhiteBackground_" & CStr(PNo) .Fill.ForeColor.RGB = RGB(255, 255, 255) .Line.ForeColor.RGB = RGB(255, 255, 255) End With PrintOMRPage ShpCanvas, PNo Next PNo End Sub ' End Code Snippet There is a custom method called PrintOMRPage method which is not relevant here. My question now, how do i know whether a canvas has been inserted into a page ? Basically i will loop in all the pages and check whether a canvas has been inserted into that page. Apparently i cannot find the correct way. I have tried to check using ActiveDocument.Shapes(1).Top and validate whether the Top position is a negative value. But apparently the Top position is always measured from the top of each page. Thanks for the help. hadi teo

    Read the article

  • Stock management of assemblies and its sub parts (relations)

    - by The Disintegrator
    I have to track the stock of individual parts and kits (assemblies) and can't find a satisfactory way of doing this. Sample bogus and hyper simplified database: Table prod: prodID 1 prodName Flux capacitor prodCost 900 prodPrice 1350 (900*1.5) prodStock 3 - prodID 2 prodName Mr Fusion prodCost 300 prodPrice 600 (300*2) prodStock 2 - prodID 3 prodName Time travel kit prodCost 1650 (1350+300) prodPrice 2145 (1650*1.3) prodStock 2 Table rels relID 1 relSrc 1 (Flux capacitor) relType 4 (is a subpart of) relDst 3 (Time travel kit) - relID 2 relSrc 2 (Mr Fusion) relType 4 (is a subpart of) relDst 3 (Time travel kit) prodPrice: it's calculated based on the cost but not in a linear way. In this example for costs of 500 or less, the markup is a 200%. For costs of 500-1000 the markup is 150%. For costs of 1000+ the markup is 130% That's why the time travel kit is much cheaper than the individual parts prodStock: here is my problem. I can sell kits or the individual parts, So the stock of the kits is virtual. The problem when I buy: Some providers sell me the Time Travel kit as a whole (with one barcode) and some sells me the individual parts (with a different barcode) So when I load the stock I don't know how to impute it. The problem when I sell: If I only sell kits, calculate the stock would be easy: "I have 3 Flux capacitors and 2 Mr Fusions, so I have 2 Time travel kits and a Flux Capacitor" But I can sell Kits or individual parts. So, I have to track the stock of the individual parts and the possible kits at the same time (and I have to compensate for the sell price) Probably this is really simple, but I can't see a simple solution. Resuming: I have to find a way of tracking the stock and the database/program is the one who has to do it (I cant ask the clerk to correct the stock) I'm using php+MySql. But this is more a logical problem than a programing one

    Read the article

  • How to implement custom JSF component for drawing chart?

    - by Roman
    I want to create a component which can be used like: <mc:chart data="#{bean.data}" width="200" height="300" /> where #{bean.data} returns a collection of some objects or chart model object or something else what can be represented as a chart (to put it simple, let's assume it returns a collection of integers). I want this component to generate html like this: <img src="someimg123.png" width="200" height="300"/> The problem is that I have some method which can receive data and return image, like: public RenderedImage getChartImage (Collection<Integer> data) { ... } and I also have a component for drawing dynamic image: <o:dynamicImage width="200" height="300" data="#{bean.readyChartImage}/> This component generates html just as I need but it's parameter is array of bytes or RenderedImage i.e. it needs method in bean like this: public RenderedImage getReadyChartImage () { ... } So, one approach is to use propertyChangedListener on submit to set data (Collection<Integer>) for drawing chart and then use <o:dynamicImage /> component. But I'd like to create my own component which receives data and draws chart. I'm using facelets but it's not so important indeed. Any ideas how to create the desired component? P.S. One solution I was thinking about is not to use <o:dynamicImage/> and use some servlet to stream image. But I don't know how to implement that correctly and how to tie jsf component with servlet and how to save already built chart images (generating new same image for each request can cause performance problems imho) and so on..

    Read the article

  • C# Vector maths questions

    - by Mark
    Im working in a screen coordinate space that is different to that of the classical X/Y coordinate space, where my Y direction goes down in the positive instead of up. Im also trying to figure out how to make a Circle on my screen always face away from the center point of the screen. If the center point of my screen is at x(200) y(300) and the point of my circle's center is at x(150) and y(380) then I would like to calculate the angle that the circle should be facing. At the moment I have this: Point centerPoint = new Point(200, 300); Point middleBottom = new Point(200, 400); Vector middleVector = new Vector(centerPoint.X - middleBottom.X, centerPoint.Y - middleBottom.Y); Vector vectorOfCircle = new Vector(centerPoint.X - 150, centerPoint.Y - 400); middleVector.Normalize(); vectorOfCircle.Normalize(); var angle = Math.Acos(Vector.CrossProduct(vectorOfCircle, middleVector)); Console.WriteLine("Angle: {0}", angle * (180/Math.PI)); Im not getting what I would expect. I would say that when I enter in x(150) and y(300) of my circle, I would expect to see the rotation of 90 deg, but Im not getting that... Im getting 180!! Any help here would be greatly appreciated. Cheers, Mark

    Read the article

  • Allow paste in worksheet without overwriting locked cells

    - by jjeaton
    I have a protected worksheet that users would like to copy and paste into. I have no control over the workbook they are copying from. The protected worksheet has some rows that are available for data entry, and other rows that are locked and greyed out to the user. The users would like to be able to paste over the top of the entire worksheet from another random workbook and have all the cells available for data entry filled in, while the locked cells are undisturbed. In the current state, the user gets an error when they try to paste, because it cannot paste over the locked cells. Example: Worksheet 1: Act1 100 100 100 Act2 100 100 100 Act3 100 100 100 Worksheet 2: (The second row is locked) Act1 300 300 300 Act2 200 200 200 Act3 100 100 100 After copying/pasting Worksheet 2 should look like this: Act1 100 100 100 Act2 200 200 200 Act3 100 100 100 The values from worksheet 1 are populated and the locked rows are undisturbed. I've been thinking along the lines of having a hook where on paste, the locked cells are unlocked so that the paste can happen, and then are reverted to their original values and relocked. Is there some way I can loop through the cells in the clipboard and only paste cells where the target isn't locked? It is preferable to not create a separate button for paste, so there is less impact on the users, but if that's the only way, I'm not opposed to it. Currently, I plan on grouping the locked rows together, so that the data entry cells are contiguous, but then the accounts will be out of order, which is not preferred.

    Read the article

  • Wrong colors when merging images with PHP

    - by OfficeJet
    Hi, I want to get images ID's and creat from files a merged image according to the given ID's. This code is called by ajax and return the image file name (which is the server time to prevent browser caching). code: if (isset($_REQUEST['items'])){ $req_items = $_REQUEST['items']; } else { $req_items = 'a'; } $items = explode(',',$req_items); $bg_img = imagecreatefrompng('bg.png'); for ($i=0; $i<count($items); $i++){ $main_img = $items[$i].'-large.png'; $image = imagecreatefrompng($main_img); $image_tc = imagecreatetruecolor(300, 200); imagecopy($image_tc,$image,0,0,0,0,300,200); $black = imagecolorallocate($image_tc, 0, 0, 0); imagecolortransparent($image_tc, $black); $opacity = 100; $bg_width = 300; $bg_height = 200; $dest_x = 0;//$image_size[0] - $bg_width - $padding; $dest_y = 0;//$image_size[1] - $bg_height - $padding; imagecopymerge($bg_img, $image_tc, $dest_x, $dest_y, 0, 0, $bg_width, $bg_height, $opacity) ; } $file = $_SERVER['REQUEST_TIME'].'.jpg'; imagejpeg($bg_img, $file, 100); echo $file; imagedestroy($bg_img); imagedestroy($image); die(); The images are shown exactly as I want but with wrong colors. I lately added the part with imagecreatetruecolor and imagecolortransparent, and still got wrong results. I also saved the PNG itself on a 24 bit format and also later as 8 bit - not helping. every ideas is very welcomed ! Thanks

    Read the article

  • C# How can I return my base class in a webservice

    - by HenriM
    I have a class Car and a derived SportsCar: Car Something like this: public class Car { public int TopSpeed{ get; set; } } public class SportsCar : Car { public string GirlFriend { get; set; } } I have a webservice with methods returning Cars i.e: [WebMethod] public Car GetCar() { return new Car() { TopSpeed = 100 }; } It returns: <Car> <TopSpeed>100</TopSpeed> </Car> I have another method that also returns cars like this: [WebMethod] public Car GetMyCar() { Car mycar = new SportsCar() { GirlFriend = "JLo", TopSpeed = 300 }; return mycar; } It compiles fine and everything, but when invoking it I get: System.InvalidOperationException: There was an error generating the XML document. --- System.InvalidOperationException: The type wsBaseDerived.SportsCar was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically. I find it strange that it can't serialize this as a straight car, as mycar is a car. Adding XmlInclude on the WebMethod of ourse removes the error: [WebMethod] [XmlInclude(typeof(SportsCar))] public Car GetMyCar() { Car mycar = new SportsCar() { GirlFriend = "JLo", TopSpeed = 300 }; return mycar; } and it now returns: <Car xsi:type="SportsCar"> <TopSpeed>300</TopSpeed> <GirlFriend>JLo</GirlFriend> </Car> But I really want the base class returned, without the extra properties etc from the derived class. Is that at all possible without creating mappers etc? Please say yes ;)

    Read the article

  • Django: Applying Calculations To A Query Set

    - by TheLizardKing
    I have a QuerySet that I wish to pass to a generic view for pagination: links = Link.objects.annotate(votes=Count('vote')).order_by('-created')[:300] This is my "hot" page which lists my 300 latest submissions (10 pages of 30 links each). I want to now sort this QuerySet by an algorithm that HackerNews uses: (p - 1) / (t + 2)^1.5 p = votes minus submitter's initial vote t = age of submission in hours Now because applying this algorithm over the entire database would be pretty costly I am content with just the last 300 submissions. My site is unlikely to be the next digg/reddit so while scalability is a plus it is required. My question is now how do I iterate over my QuerySet and sort it by the above algorithm? For more information, here are my applicable models: class Link(models.Model): category = models.ForeignKey(Category, blank=False, default=1) user = models.ForeignKey(User) created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) url = models.URLField(max_length=1024, unique=True, verify_exists=True) name = models.CharField(max_length=512) def __unicode__(self): return u'%s (%s)' % (self.name, self.url) class Vote(models.Model): link = models.ForeignKey(Link) user = models.ForeignKey(User) created = models.DateTimeField(auto_now_add=True) def __unicode__(self): return u'%s vote for %s' % (self.user, self.link) Notes: I don't have "downvotes" so just the presence of a Vote row is an indicator of a vote or a particular link by a particular user.

    Read the article

  • Changing where a resource is pulled during runtime?

    - by Brandon
    I have a website that goes out to multiple clients. Sometimes a client will insist on minor changes. For reasons beyond my control, I have to comply no matter how minor the request. Usually this isn't a problem, I would just create a client specific version of the user control or page and overwrite the default one during build time or make a configuration setting to handle it. Now that I am localizing the site, I'm curious about the best way to go about making minor wording changes. Lets say I have a resource file called Resources.resx that has 300 resources in it. It has a resource called Continue. English value is "Continue", the French value is "Continuez". Now one client, for whatever reason, wants it to say "Next" and "Après" and the others want to keep it the same. What is the best way to accomodate a request like this? (This is just a simple example). The only two ways I can think of is to Create another Resources.resx specific to the client, and replace the .dll during build time. Since I'd be completely replacing the dll, the new resource file would have to contain all 300 strings. The obvious problem being that I now have 2 resource files, each with 300 strings to maintain. Create a custom user control/page and change it to use a custom resource file. e.g. SignIn.ascx would be replaced during the build and it would pull its resources from ClientName.resx instead of Resources.resx. Are there any other things I could try? Is there any way to change it so that the application will always look in a ClientResources.resx file for the overridden values before actually look at the specified resource file?

    Read the article

  • Access Question

    - by kralco626
    I have a record set for inspections of many peices of equipment. The four cols of interest are equip_id,month,year,myData. My requirment is to have EXACTLY ONE Record per month for each peice of equipment. I have a quiery that makes the data unique over equip_id,month,year. So there is no more than one record for each month/year for a peice of equipment. But now I need to simulate data for the missing month. I want to simply go back in time to get the last peice of my data. So that may seem confusing, so i'll show by example. Given this: equip_id month year myData 1 1 2010 500 1 2 2010 600 1 5 2010 800 2 2 2010 300 2 4 2010 400 2 6 2010 500 I want this: equip_id month year myData 1 1 2010 500 1 2 2010 600 1 3 2010 600 1 4 2010 600 1 5 2010 800 2 2 2010 300 2 3 2010 300 2 4 2010 400 2 5 2010 400 2 6 2010 500 Notice that im filling in missing data with the data from the month ( or two months etc.) before. Also note that if the first record for equip 2 is in 2/2010 than I don't need a record for 1/2010 even though I have one for equip 1. I just need exactly one record for each month/year for each peice of equipment. So if the record does not exsist I just want to go back in time and grab the data for that record. Thanks!!!

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >