Search the Community
Showing results for tags 'array'.
-
Hi. Im a hobbyist photographer and I have been shooting for over 20 years. I have a lot of files and currently I have everything stored on a windows storage spaces volume across 8 drives in a raid 1 configuration set at 8tb. I wouldn't dare use parity as I have read that it’s awful on storage spaces. the drives are varied capacities. I do have an old synology nas but it only has a max capacity of 8tb (1x8 or 2x4). The nas would need to be able to support two 8tb drives for me to use it the way I want but it does not support that. The software I use to manage my photos does not store previews like some programs do but instead renders thumbnails and previews on the fly as needed. The speed of this is very dependant on drive speed. Mine is currently struggling with this with the storage space hitting 100% whilst rendering these files but I tested it using files on an m.2 Nvme ssd and it was way better. I know storage spaces does have some speed problems but I read that from article done years ago. Not sure if they’ve improved it. So moving forward I’d like to try to speed things up but also simplify things. Should I get rid of the storage space and all the drives in it (which will leave me with a lot of perfectly good surplus drives) and replace with a new two bay nas thats capable of two 8tb or greater drives in it (I do have offsite backup). Or should I continue using storage spaces but maybe use SSDs instead of spinning drives? I could just not pool anything and have single drives that back up to my offsite drive but I find that messy. My software would keep track of the files and locations across the drives but I don’t think this is the best answer. Or do I just leave things the way they are now and just be patient. After all the files do load after a few seconds of waiting. I did a quick video.
- 6 replies
-
- storage spaces
- nas
-
(and 4 more)
Tagged with:
-
Hi all, Need to buy a good quality array controller for a server running Windows 2019 Server Essentials. The idea is to have two RAID 1's being one with two 512GB SSD's/NVME's for the Operating System and another RAID 1 with two 1 TBSSD's/NVME's for the data. I need to be as much as possible fault tolerant. Software being run is not heavy at all but it must be available 24x7 with no interruptions (or, at least that they happen very, very occasionally) The idea is that if a OS drive or a data Drive the other drive assumes it with automatically, no downtime and relay a warning message to replace the faulty drive (hot swap) and the re-sync of the failed drive should be as much as possible automatic. Is there such a controller to buy? As I said it does not need to be the fastest one available as the requests are not that heavy and to keep price in check. I have two options pending price and availability: one controller capable of supporting 2 Raid 1's (each with 2 drives) or 2 controllers, each with 1 Raid 1 with 2 drivers. In any case the computer must be able to boot from the array. Any comments will be greatly appreciated. Thank you all
-
Ok, so i finally managed to persuade my junkyard IBM HS-1235E Server to work and i made a raid 0 array from two 250GB Hdd drives, then i discovered that using computer management in windows i can combine that raid 0 array with another drive i put in the server(80gb Seagate) so i made 580gb virtual drive by using "New spanned volume" option, and everything seems to work but i got an idea because you can also use "New striped volume" option which basically is making raid 0. So if you connect different size drives in raid 0 all of them count as if they would have capacity of the smallest one, but could i possibly make let's say Raid 0 using 2x500gb and then another Raid 0 using 4x250gb and then use both of this virtual drives in windows to make Striped volume which is basically Raid 0? In that way i would connect different capacity drives in Raid 0 without sacrificing any drive capacity, it would be possible because 2x500gb volume will have same capacity as 4x250gb so from windows perspective i would be connecting two equal volumes. What you guys think?
-
Hellloooo, Apologies if this isn't the forum. We currently use a Dell PowerVault MD3620i as a disk array for our Proxmox environment and we've recently purchased some more disks to expand the storage capacity. The Disk array is setup to use a virtual disk and is using Raid 6 As part of some weekend maintenance work we was planning on shutting everything off in our server room including the PowerVault Disk array. Powered all of the other servers off and we got to the disk array, myself and my manager were under the impression we could disconnect the network cable and just power off the Disk array but after disconnecting the network cable we noticed that the "Activity" & "Status" lights on the drives themselves continued flashing green. The status light we expected to continue flashing but we was a little bit worried as to why the "Activity" light was still flashing as nothing else is communicating to the disk array, we left the disk array for 45 minutes and went back to it and the light was still flashing. 1 - Does anyone know why the Activity light would still be flashing? 2 - Are we okay to shutdown the disk array once the network card has been disconnected? We've contacted our Dell account manager and his reply was "We're unable to tell you that because you don't have support on the machine" Does anyone know the answer to the two questions above? If you need anything else please let me know.
-
import React, { useState, useEffect} from 'react' import {Card, ListGroup, ListGroupItem} from "react-bootstrap"; import axios from "axios"; import moment from "moment"; import "moment/locale/fr-ca"; import { Button } from "react-bootstrap"; require("es6-promise").polyfill(); require("isomorphic-fetch"); export default function Recherche(props){ moment.locale("fr-ca"); const [data, setData] = useState([]) const [q, setQ] = useState("") const [d, setD] = useState("") const [c, setC] = useState(false) const [cat, setCat] = useState("") const [searchColumns, setSearchColumns] = useState(["emplacement_depart", "emplacement_destination", "ville"]) //const [reservations, setReservations] = useState([]) let reservations = [] useEffect(() => { fetch('http://localhost:3001/deplacements') .then((response) => response.json()) .then((json) => setData(json)); }, []); function search(rows) { return rows.filter((row) => searchColumns.some( (column) => row[column].toString().toLowerCase().indexOf(q.toLowerCase()) > -1 ) ); } const [columns] = useState(["emplacement_depart", "emplacement_destination", "ville"]); function searchDate(rows){ return rows.filter(row => moment(row.date_heure).format('L').toString().split("T")[0].indexOf(d.toLowerCase()) > -1 ); } function searchCategorie(rows){ return rows.filter(row => row.categorie_id.toString().toLowerCase().indexOf(cat.toLowerCase()) > -1 ); } let account = "'"+props.user.account.accountIdentifier+"'" //Get le tokenId de l'utilisateur let user_id = null //Trouve le id de l'utilisateur avec son tokenId axios.get("http://localhost:3001/users/"+account).then(function (response) { user_id = response.data.id }); axios.get('http://localhost:3001/reservations', { params: { user_id: user_id } }).then(function (response) { if (typeof response.data !== 'undefined' && response.data.length > 0) { response.data.forEach(e => reservations.push(e.deplacement_id)) //console.log(reservations) } }); const renderCard = (card, index) => { let tokenId; let cout; let estReserver; let now = Date.now(); now = moment(now).subtract(5, 'hour').toISOString(); axios.get('http://localhost:3001/users', { params: { userId: card.chauffeur_id } }).then(function (response) { console.log(response.data[0].tokenid) tokenId = response.data[0].tokenid; }); /* Affichage date */ let date = moment(card.date_heure); //console.log(date.toISOString(), " ",now); //console.log(card.ville,card.date_heure," ", card.date_heure.split("T")[0].toString().toLowerCase(), " " , date); console.log(now, " NOW ") /* Affichage coût */ if (card.cout == 0 || card.cout == null){ cout = 'Gratuit'; } else { cout = card.cout + "$"; } //Regarde si le déplacement est déja réserver par l'utilisateur //Fonction quand l'utilisateur clique sur réserver function reserver(){ //Crée la réservation dans la base de données axios.post('http://localhost:3001/reservations', { deplacement_id: card.id, user_id: user_id }) .then(res => { console.log(res); console.log(res.data); }, (error) => { console.log(error.message); }); //Modifie le nombre de places disponnibles du déplacement réserver axios.put('http://localhost:3001/deplacements/'+card.id, { categorie_id: card.categorie_id, ville: card.ville, emplacement_depart: card.emplacement_depart, emplacement_destination: card.emplacement_destination, date_heure: moment(card.date_heure).format('L') + ' ' + moment(card.date_heure).format('LTS'), recurrent: card.recurrent, cout: card.cout, nb_places: card.nb_places - 1, chauffeur_id: card.chauffeur_id }) .then(res => { console.log(res); console.log(res.data); }, (error) => { console.log(error.message); }); } if (reservations.indexOf(card.id) !== -1){ estReserver = true; } else{ estReserver = false; } console.log(reservations, reservations.indexOf(card.id), card.id) if (card.date_heure > now) { if (c && cout != 'Gratuit' || estReserver){return } else if (estReserver){return console.log(card.id + ' est reserver.')} else { return ( <Card style={{width: '18rem'}} key={index} className="box" border="dark"> <Card.Header>Conducteur : { card.chauffeur_id }</Card.Header> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Ville : </strong> {card.ville}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Départ : </strong>{card.emplacement_depart}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Destination : </strong>{card.emplacement_destination}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Date : </strong>{date.format("dddd")} le {date.format("LL")}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Heure : </strong>{date.format('LT')}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Coût : </strong>{cout}</p> </ListGroup> <ListGroup variant="flush" className="infoDeplacement"> <p><strong>Places disponnibles : </strong>{card.nb_places}</p> </ListGroup> <Button type={"button"} variant="default" className="btn-reserver" onClick={reserver}>Réserver</Button> </Card> ) } } } return ( <div> <div> <div className='row'> <label className="rechercheCheckbox"> Recherche : <input type="text" value={q} onChange={(e) => setQ(e.target.value)}/> </label> { columns && columns.map(column => <label className="rechercheCheckbox"> <input type="checkbox" checked={searchColumns.includes(column)} onChange={(e) => { const checked = searchColumns.includes(column); setSearchColumns((prev) => checked ? prev.filter((sc) => sc !== column) : [...prev, column] ) }} /> {(() => { switch (column) { case "emplacement_depart": return "Départ"; case "emplacement_destination": return "Destination"; case "ville": return "Ville"; } })()} </label>) } <label className="rechercheCheckbox"> <input type="checkbox" onChange={(e) => setC(!c)}/> Gratuit </label> </div> <div className='row'> <label className='rechercheCheckbox'>Type de déplacement :</label> <select value={cat} name="categorie_id" onChange={(e) => setCat(e.target.value)}> <option value=''>Choisir...</option> <option value='1'>Vers un pavillon</option> <option value='2'>À partir de Victoriaville</option> <option value='3'>Inter-pavillons</option> </select> <label className="rechercheCheckbox"> Date : <input type="date" value={d} onChange={(e) => setD(e.target.value)}/> </label> </div> </div> <div className="grid"> {searchCategorie(searchDate(search(data))).map(renderCard)} </div> </div> ); } reservations.indexOf(card.id) always returns -1 or reservation.includes(card.id) always returns false I have no idea why, please help!
-
Ok long story short swapped cases, numbered my drives and sata cables. Boop everything works fine, except a missing drive on my array. Apparently that’s “critical” for raid10 on 8 drives…? x570 whatever. So I did the routine, check sata, power and all. Nope, drives gone. Whatever a few days later now I got trouble, my Z drive is gone. Pull up bios immediately and of course 3 of 8 are showing. Fudge at this point I’m using hiren to DD each drive individually to my server, via a usb3 adapter. They’re all 2.5 so power isn’t a concern any suggested next steps or, do this instead? It’s 300g on the first drive and still 3 hours to go if not more - but it is using the network gig connection, 50ish/mbps
-
Hi guys! Last time, when i had a problem with programming I got quick and good answers here, so i thought I would share one of my other problems here. So, I have a task, which for the upper level IT High School exam. I have to read data from a txt file, into arrays. program eutazas; uses crt; var i,j,n:integer; megall:array[1..2000] of integer; datum:array[1..2000] of longint; kotojel:char; ido:array[1..2000] of string[4]; azon:array[1..2000] of longint; tipus:array[1..2000] of string[3]; lejarat:array[1..2000] of longint; szkoz:char;{szokozok beolvasasa} f:text; procedure beolvasas; var i:integer; begin assign(f,'utasadat.txt'); reset(f); for i:=1 to 2000 do readln(f,megall[i],szkoz,datum[i],kotojel,ido[i],szkoz,azon[i],szkoz,tipus[i],szkoz,lejarat[i]); close(f); {szamlalas} j:=1; repeat if azon[j]<>0 then inc(n); inc(j); until azon[j]=0; end;{beolvasas} This is(a part of) my code. 0 20190326-0700 4170861 NYB 20190404 And this is one line from the database txt file. I try to read every part of the line into different arrays. For the date and time(20190326-0700) first i used a string[13] array, but in a later task i had to use only the date part of it, so i had to make it a longint of array, with seperating the date and time. I used longint for the date part of it, a char for the '-' mark, and a string[4] for the time. But after that, it compiles, but when I try to run it I get Runtime Error 106(non-numeric value is read from a text file, and a numeric value was expected). Maybe the way i try to read it parts is messed up already. If thats the case, can anyone recommend me another way, to make it posibble. I have to use arrays, and it would be too much hassle to make new types, because the time for the exam is kinda short. Thank for any help in advance! Ps.: Oh, and sorry for the strange array names. They make sense in my language.
-
So i made a post yesterday got a little feedback but it didnt solve my problem. im trying to write a sketch for an arduino in witch i have an array of analog inputs witch i want to read all at once and write them to a array of arrays witch i should be able to do in one line to conserve space on the micro heres my code witch i believe works but id like to know how to do it more efficiently const int SliderPin[3] = {14,15,16}; int CurrentProfile = 0; int Profile[4][3]={ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }; if (CurrentProfile > 3) { CurrentProfile = 0; }; Profile[CurrentProfile][0] = analogRead(SliderPin[0]); Profile[CurrentProfile][1] = analogRead(SliderPin[1]); Profile[CurrentProfile][2] = analogRead(SliderPin[2]);
-
Hey everyone, I've made some code to generate an array full of random numbers (between 2 points), to create a "Set" of data to be analyzed. This works fine - I've got my random set, but for it to be counted as a valid set, it has to have no duplicate numbers. Sure, I can make the RNG to a really high number and hope I don't get a duplicate, but that is beside the point. (In fact, I tried that and still got 3 repeated numbers...) How would I make my RNG generate a random set of numbers without duplicates? Here's the code for my RNG if this is of any help: int length = 9; Random r = new Random(); int yes; int[] setS = new int[9]; for (int i = 0; i < length; i++) { setS[i] = r.Next(1, 19); Console.WriteLine(setS[i]); } I've had a look at multiple sites, such as StackOverflow and I don't fully understand the methods people are showing on how to solve this problem. Thanks for any help given.
- 20 replies
-
Hey guys im trying to deduplicate a external json file the json file looks like this [{"id":1,"firstName":"Krisha","lastName":"Shenfisch", "city":"Zwolle"}, {"id":2,"firstName":"Ad","lastName":"Buesden", "city":"Hengelo"}, {"id":3,"firstName":"Wilma","lastName":"Dyerson", "city":"Enschede"}, {"id":4,"firstName":"Drew","lastName":"Chattelaine", "city":"Amsterdam"}, {"id":5,"firstName":"Esteban","lastName":"Beniesh", "city":"Amsterdam"}] now i want to make it so the it would not show the same city twice, i have no clue on how to do this im using js
-
So, I have an array being given to me by a MySQL query. Here is the array, as it is printed by print_r function: Array ( [policydatakey] => 1 [policydatapolicykey] => 1 [policydatastatus] => Active [policydatapolicyname] => Policy 1111 [policydataprocessorname] => My Processor [policydatabranchcode] => Branch1 [policydatafiletaxid] => Taxid1 [policydatafilestate] => XX [policydatafilelicense] => Lic111 [policydatainsuredname] => Trim [policydatarisklocation] => 4 [policydataunderwritingcompany] => Stuff n Thangs [policydatapolicystate] => XX [policydatapolicynumber] => 1111 [policydatapolicytype] => 8 [policydatamultistate] => 9 [policydatalineofbusiness] => 0 [policydataeffectivedate] => 1 [policydataendorsementeffectivedate] => 2 [policydataenddate] => 3 [policydatapremium] => 4 [policydatainsuredamount] => 5 [policydatapolicyfee] => 6 [policydatainspectionfee] => 7 [policydatacatfee] => 8 [policydatasltaxes] => 9 [policydatafiremarshaltax] => 0 [policydatasurcharge] => 5-surcharge [policydataadditionalassessment] => 2 [policydatastampingfee] => 3 [policydatainvoicenumber] => XXXX [policydatainvoicedate] => 2016-02-02 [policydataac1] => 6 [policydataac1date] => 2016-01-01 [policydataac1comments] => 8 [policydataac2] => 9 [policydataac2date] => 0 [policydataac2comments] => 1 [policydataac3] => yes (ac3) [policydataac3date] => 3 [policydataac3comments] => Ac3 Comments go here [policydatacomments] => My Comments ) When I run is_array on the variable that holds that array, it returns boolean TRUE. i.e. if (is_array($data)==TRUE){ printf("It is an array."); }else{ printf("It is not an array."); } Comes back as "It is an array." When I try to have that array printed to a .CSV using fputcsv(), I get the following: Catchable fatal error: Argument 2 passed to fputcsv() must be an array, null given... When I try to have that array printed to a spreadsheet XLSX file, using xlsxwriter.class.php (see here), it complains of the same thing. Neither have a problem using a simple test array, as follows: $array = array( array('year','month','day'), array('2004','8','20'), array('2008','12','13'), ); The way I'm getting the array I'm trying to use is with the following: $data = $conn->query($sql); // $conn is the connection credentials to the MySQL Database, and $sql is the sql query. $data_array = array(); $data_array = $data->fetch_assoc(); fetch_assoc() is supposed to return an associative array, which it seems to, rather than an object. I have no idea what the issue is.
-
I have a problem with a project for Uni. I know this has been done many times before and there is probably a more optimal way but I want to get there largely by myself.The problem currently is that if I set the scope(the program searches for prime numbers between 2- ... <-- this i called 'obergrenze'). if that upper boundry is set to roughly 1 million - haven't tried to many different values but 100k works - it crashes but idk why. Might this be a memory limitation? I have 4GB of VRAM but the program only uses about 30-35MB. The task is to progrma something that finds all prime numnbers from 2- 100 000 000 and then trim for speed which i have not been able to do yet. Some notes: Sry for all the german variable names. the 'int integer' is just a test and 100% irrelevant. I first fill the array in which the position simbolizes the number - NOT its value - with -1 and then edit these to 1 for a prime number or 0 for non prime. In the end every number should be either 1 or 0. I separately count up how many primes i got and how many non for some controllability. Should work until there but it is for some reason not scalable. #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main() { //Sieb des Erathostines int obergrenze = 200000; int zahlen[obergrenze - 2 + 1]; int i, j; int posAnzahl = 0, negAnzahl = 0, summe = 0; int integer = 2000000000; //array befüllen for(i = 0; i < obergrenze; i++) { zahlen[i] = -1; } //Schleife vom niedrigsten bis zum höchsten sinnvollen Wert for(i = 2; i <= obergrenze; i++) { if(zahlen[i - 2] == -1 || zahlen[i - 2] != 0) { for(j = i; j <= obergrenze; j = j + i) { //printf("\n Kontrolle j=%d",j); if(j == i) { zahlen[j - 2] = 1; posAnzahl++; // eine Möglichkeit separat zu zählen }else{ //if(zahlen[i]%j == 0) if(zahlen[j - 2] == -1) { zahlen[j - 2] = 0; negAnzahl++; // gehört zur Möglichkeit separat zu zählen und dient Kontrolle } } } j = 0; }else{ //if(zahlen[i] == -1 || zahlen[i] != 0) } } printf("\n Anzahl der Primzahlen:%d\n Anzahl der NICHT-Primzahlen:%d\n Gesamtmenge der Zahlen %d gleich obergrenze: %d?", posAnzahl, negAnzahl + 1, posAnzahl + negAnzahl + 1, obergrenze); for( i = 0; i < obergrenze - 2 + 1; i++) { if(zahlen[i] == -1) { printf("\n Es wurden nicht alle Zahlen bearbeitet! zahlen[%d]", i + 2); }else{ //if(zahlen[i] == -1) summe = zahlen[i] + summe; } } return(8); } EDIT: To be clear please don't suggest me just copying something else. I would very much prefere to find out and solve what the problem is I have right here. The maximum value the program works with is obergrenze=518132;
- 27 replies
-
- c
- prime number
-
(and 1 more)
Tagged with:
-
Hi, I'm new to the community so I'm hoping someone is able to help... I have an aging computer which was running on an MSI 890gxm g65 (AMD) motherboard. I set up a RAID 1 (mirror) across (2x) 3TB (WesternDigital) HDDs using the onboard RAID software and Windows 7. The motherboard failed and now I am unable to access the drives. So far, I've tried the following: Tried reading one of the drives directly from an external enclosure - no dice. Didn't show up in the explorer, but I could see the drive connected on the manage hardware menu. Used ReclaiMe to actually view the drive and partitions. Recovered data to external drive. This retained all the folder structure and files have accurate file sizes, but I can't read a bulk of the important files (image files, documents etc). Videos inexplicably work. I've called around to data recover places and I'd really like to not have to spend all my savings to recover this if I can do it for a fraction of the cost on my own. Let me know if you have any questions and I look forward to any solutions you can provide. Thanks.
-
I have been failing on making an array with Images. I changed the code back to it's working state before I starting the edits for the image array. If any one can give me some tips or help on how to start the array. I will post the code and the functions that are giving me issues. Thanks in advanced for the help. var $ = function(id) {return document.getElementById(id); }//end $ window.onload = function () { //Provide answer for Question 1 here ////////////////////// spooks(); }; function spooks() { var reindeerCounter=[];//the array for the counter reindeerCounter[noname]=0;//the count for anything else that is not a reindeer reindeerCounter["blitzen"]=0;//the count for blitzen reindeerCounter["comet"]=0;//the count for comet reindeerCounter["cupid"]=0;//the count for cupid reindeerCounter["dancer"]=0;//the count for dancer reindeerCounter["dasher"]=0;//the count for dasher reindeerCounter["donner"]=0;//the count for donner reindeerCounter["prancer"]=0;//the count for prancer reindeerCounter["rudolph"]=0;//the counter for rudolph reindeerCounter["vixen"]=0;//the counter for vixen reindeerCounter["bumble"]=0;//the counter bumble var noname;//the counter for the noname reindeers var user;//what the user enters var reindeer ={names:["blitzen","comet","cupid","dancer","dasher","donner","prancer","rudolph","vixen","bumble"]};//the array for the reindeer names for (var n=0; n<1; n++) { do { user=prompt("Enter:blitzen, comet, cupid, dancer, dasher, donner, \nprancer, rudolph, vixen,and type exit to see score").toLowerCase(); if(user===reindeer["names"][0]) { reindeerCounter[user]++; } else if(user===reindeer["names"][1]) { reindeerCounter[user]++; } else if(user===reindeer["names"][2]) { reindeerCounter[user]++; } else if (user===reindeer["names"][3]) { reindeerCounter[user]++; } else if (user===reindeer["names"][4]) { reindeerCounter[user]++; } else if (user===reindeer["names"][5]) { reindeerCounter[user]++; } else if (user===reindeer["names"][6]) { reindeerCounter[user]++; } else if (user===reindeer["names"][7]) { reindeerCounter[user]++; } else if (user===reindeer["names"][8]) { reindeerCounter[user]++; } else if(user!==reindeer["names"]) { reindeerCounter[noname]++; } } while (user!=="exit"); displayThemSpooks(reindeerCounter[user]); } function displayThemSpooks(blitzen,bumble,comet,cupid,dancer,dasher,donner,noname,prancer,rudolph,vixen) { if(reindeerCounter["blitzen"] >1) { document.writeln("<p> blitzen was entered"+" "+reindeerCounter["blitzen"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["blitzen"],"blitzen"); } else if(reindeerCounter["blitzen"]===0) { document.writeln("<p>blitzen was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["blitzen"]+ " blitzens</p>"); displayThemSpookspic(reindeerCounter["blitzen"],"blitzen"); } if(reindeerCounter["comet"] >1) { document.writeln("<p> comet was entered"+" "+reindeerCounter["comet"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["comet"],"comet"); } else if(reindeerCounter["comet"]===0) { document.writeln("<p> comet was not spotted</p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["comet"]+" comets</p>"); displayThemSpookspic(reindeerCounter["comet"],"comet"); } if(reindeerCounter["cupid"] >1) { document.writeln("<p> cupid was entered"+" "+reindeerCounter["cupid"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["cupid"],"cupid"); } else if(reindeerCounter["cupid"]===0) { document.writeln("<p> cupid was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["cupid"]+" cupids</p>"); displayThemSpookspic(reindeerCounter["cupid"],"cupid"); } if(reindeerCounter["dancer"] >1) { document.writeln("<p> dancer was entered"+" "+reindeerCounter["dancer"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["dancer"],"dancer"); } else if(reindeerCounter["dancer"]===0) { document.writeln("<p> dancer was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["dancer"]+" dancers</p>"); displayThemSpookspic(reindeerCounter["dancer"],"dancer"); } if(reindeerCounter["dasher"] >1) { document.writeln("<p> dasher was entered"+" "+reindeerCounter["dasher"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["dasher"],"dasher"); } else if(reindeerCounter["dasher"]===0) { document.writeln("<p> dasher was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["dasher"]+" dashers</p>"); displayThemSpookspic(reindeerCounter["dasher"],"dasher"); } if(reindeerCounter["donner"] >1) { document.writeln("<p> donner was entered"+" "+reindeerCounter["donner"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["donner"],"donner"); } else if(reindeerCounter["donner"]===0) { document.writeln("<p> donner was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["donner"]+" donners</p>"); displayThemSpookspic(reindeerCounter["donner"],"donner"); } if(reindeerCounter["prancer"] >1) { document.writeln("<p> prancer was entered"+" "+reindeerCounter["prancer"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["prancer"],"prancer"); } else if(reindeerCounter["prancer"]===0) { document.writeln("<p> prancer was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["prancer"]+" prancers</p>"); displayThemSpookspic(reindeerCounter["prancer"],"prancer"); } if(reindeerCounter["rudolph"] >1) { document.writeln("<p> rudolph was entered"+" "+reindeerCounter["rudolph"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["rudolph"],"rudolph"); } else if(reindeerCounter["rudolph"]===0) { document.writeln("<p> rudolph was not spotted</p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["rudolph"]+" rudolphs</p>"); displayThemSpookspic(reindeerCounter["rudolph"],"rudolph"); } if(reindeerCounter["vixen"] >1) { document.writeln("<p> vixen was entered"+" "+reindeerCounter["vixen"]+ " \n </p>"); displayThemSpookspic(reindeerCounter["vixen"],"vixen"); } else if(reindeerCounter["vixen"]===0) { document.writeln("<p> vixen was not spotted </p>"); } else { document.writeln("<p> You entered"+" "+reindeerCounter["vixen"]+" vixens</p>"); displayThemSpookspic(reindeerCounter["vixen"],"vixen"); } if(reindeerCounter[noname] >1) { document.writeln("<p> other was entered"+" "+reindeerCounter[noname]+ " \n </p>"); displayThemSpookspic(reindeerCounter[noname],"bumble"); } else if(reindeerCounter[noname]===0) { document.writeln("<p> other was not spotted</p>"); } else { document.writeln("<p> You entered"+" "+" "+reindeerCounter[noname]+" noname</p>"); displayThemSpookspic(reindeerCounter[noname],"bumble"); } } function displayThemSpookspic(counters,spookPic )//have to change this and the way it gets photo to an array. { var imagesreindeer=[]; imagesreindeer[0]="Images/blitzen.png"; imagesreindeer[1]="Images/bumble.png"; imagesreindeer[2]="Images/comet.png"; imagesreindeer[3]="Images/cupid.png"; imagesreindeer[4]="Images/dancer.png"; imagesreindeer[5]="Images/dasher.png"; imagesreindeer[6]="Images/donner.png"; imagesreindeer[7]="Images/prancer.png"; imagesreindeer[8]="Images/rudolph.png"; imagesreindeer[9]="Images/vixen.png"; for(var num=1;num<=counters;num++ ) { var tag="<img src='Images/"+spookPic + ".png' alt='reindeer pictures' height='40' width='40'>"; document.write(tag); } } }
- 3 replies
-
- javascript
- html
-
(and 1 more)
Tagged with:
-
Hello world, I'm creating a simple maze game i VBScript, I have the walls in a 37x40 grit with each box in the grit being the same size as the character your moving. I've already created all of the walls and the character is moving but I was wondering how I can create a loop to check for all X and Y values for the walls. Atm the character that you are stearing can faze through the walls like they don't exicts. This is a simpler version of what I have: ```VBScript 'assume that the block you're stearing already exicts Dim wall(37,40) as Picturebox Dim wallX(37, 40) wallY(37,40) as Integer 'so this is how I created all walls For wallX = 0 to 37 For wallY = 0 to 40 wall(wallX, wallY) = new picturebox wall(wallX, wallY).backcolor = new color.black wall(wallX, wallY).location = new point(xVAR, yVAR) wall(wallX, wallY).size = new size(75, 75) wall(wallX, wallY).visible = false Form1.controls.add(wall(wallX, wallY)) Next Next 'and then to place all walls, for example wall(4, 31).visible = true wall(3, 5).visible = true 'and so on 'I tried adding this 'block is the block you're moving (as integer) If block.bounds.IntersectsWith(wall(wallX, wallY).bounds) And wall(wallX, wallY).visible = true then //no movement else //movement End If Any suggestions, I would greatly apprichiate them. Thank you!
-
Hey guys, I am not sure how to get this code done. The goal is to type in 10 numbers and get a random number out of those as an output. import javax.swing.*; import java.util.*; public class Aufgabe51 { public static void main(String[] args) { int[] arrayNumber; int number, randomNumber; Scanner input; Random random; arrayNumber = new int[number]; input = new Scanner(System.in); random = new Random(); System.out.println ("Type in 10 numbers."); for(int i = 0; i < 10; i++) { System.out.println ("Type in one number."); arrayNumber[i] = input.nextInt(); } randomNumber = random.nextInt(arrayNumber.length); arrayNumber[randomNumber]; System.out.println ("The random number is: " + (arrayNumber[randomNumber])); System.exit(0); } }
-
I recently built my first computer and decided to use 2x 8tb HDD in Raid1 as secondary storage on it. I am running the raid array using the motherboard BIOS and AMD Raidxpert2. The problem I am finding though is when I wake my computer from sleep the Raid array disconnects and the only way to bring it back up it to restart the computer. So I have to just leave it running at all times or do a full shut down when I'm not using it. I have been trying to find a solution/workaround for this but can't seem to find anything, so any advice would be very welcomed. Build Specs: Ryzen 3700X Asus X570 Tuf ATX MOBO NVIDIA GTX 1070ti 1tb Samsung 970 Evo M.2 SSD 2x 8tb Seagate Ironwolf Nas HDD 64GB Ripraw RAM
-
I see a lot of drives (specifically nas rated ones) that say something like "Compatible with 1 to 8-bay network attached storage (NAS) servers.....". Is this legit to any degree? I would assume its just a "this drive is only so durable and probably wont like the vibrations of a 9+ bay array" or something like that?
-
I am working on testing out some through put issues on my Dell R740xd with 2 Xeon Gold 6254 CPUs. I am using 8 Intel DC4510 8TB SSDs in a mdadm raid 0 array with xfs on top. Running parallel (8 to 12) dd commands (bs=32K count=8M) I am getting about 24GB/s reads and 6GB/s writes. The writes seem to be kind of slow and I can't figure out where the bottleneck is. Does anyone have any experience troubleshooting something like this? I know LTT posted a video about this, but my problem is a bit different and is on an Intel platform so the same techniques may not apply.
-
I'm working with an API that has a weird way of doing arrays which I just can't understand how to convert to a C# array/list. Note: I'm using Newtonsoft.Json The JSON "array" looks something like this: Values : { "0": { "some data" }, "1": { "more data" }, "2": { "even more data" } } The thing is that the array itself isn't actually an array, its an object containing objects which have their name as array index and value their data... I don't get why the API was made this way, how you would handle this even in JavaScript For smaller arrays like this I did something like this, using JsonProperty in a way that I know: class Data { public string Value { get; set; } } [JsonProperty("0")] public Data Zero { get; set; } [JsonProperty("1")] public Data One { get; set; } [JsonProperty("2")] public Data Two { get; set; } public Data[] All { get { return new Data[] { Zero, One, Two } } } It works... kind of a hacky way of doing it, but some arrays are up to couple of thousand elements big and I have no clue if they are fixed or can expand in the future so this way of doing it is not practical at all. I have no control over the API, I can just fetch that data I have tried searching around if maybe there is a wildcard for the JsonPropertyAttribute name so that it can handle this kind of stuff but haven't found anything helpful or anyone else working with JSON of this type. Has anyone worked with something like this before and/or has an idea of how to handle this? Thank you in advance!
-
hi, I'm trying to write a code that will store the price of an item and the tax in an array based on user input. User will enter both price than taxes. I am trying to get a 3rd array to use the values in the other two and add the values to produce a total to include price+tax. here is the code, but it obviously doesn't work. I could combine price*tax and get the same result, but I'm trying to figure out how to avoid doing that by using the already assigned values in those two arrays than have a 3rd array use them to add them up. public static void main(String[] args){ Scanner input= new Scanner(System.in); final int NUM = 2; int[] tax = new int[NUM]; int[] price = new int[NUM]; int[] total = new int[NUM]; for (int index = 0; index < tax.length; index++){ System.out.println("Enter tax " + (index+1) + ": "); tax[index] = input.nextInt(); System.out.println("Enter price " + (index+1) + ": "); price[index] = input.nextInt(); } System.out.println(); System.out.println("total\t\tprice\t\ttax"); System.out.println("-----\t\t-----\t\t------"); for ( int i = 0; i < total.length; i++){ System.out.print("" + total); // would like to do something like total = price + tax than just use total in the for loop. Anyone know how to do something like this? System.out.print("\t\t" + price); System.out.print("\t\t\t" + tax); System.out.println(); }
-
Hi guys, I need someone with javascript experience to tell me how I can fill a <ol> or <ul> element with listitems which contain values from an object array. I would appreciate if this can be done with as little code as possible and little jquery. Thanks for anyone who wants to help. this is my array : (dutch translation: naam=name, prijs=price, personeel=employees) var behandeling={ knippen:{ naam:"knippen", prijs:15, personeel:["mark","kerim","niels","jan"] }, verven:{ naam:"kleuren", prijs: 20, personeel:["mark"] }, wassen:{ naam:"wassen", prijs: 5, personeel:["mark","kerim","niels","jan"] }, brushen:{ naam:"brushen", prijs: 10, personeel:["kerim","niels"] }, permanent:{ naam:"permanent", prijs: 15, personeel:["niels","jan"] } };
-
I have this code which uses the caesar cipher encryption method based on a users input, so the user enters the text then they enter the amount of times they want to shift the text. However I was wondering how I could make it so only the lower case letters would be shifted as specified. I was thinking of adding something like this: if (input[i] >= 97 && input[i] <= 122) But i'm not sure where to add it in my program which is this: #include<stdio.h> #include<string.h> int main() { int rotate, i; char input[80]; printf(" Enter the text you wish to be encrypted: \n"); gets(input); printf(" Enter the amount of times you want to rotate: \n"); scanf("%d",&rotate); if (rotate > 26) rotate = rotate % 26; //0 <= rotate < 26. for(i = 0; i < strlen(input); i++) { if(input[i] == ' ') { continue; } else { if(input[i] >= 'x') { input[i] = input[i] -26; } input[i] = input[i] + rotate; } } printf("Your encrypted text is: %s\n", input); } Could anyone advise me on this? I need only lower case letters to be caeser ciphered.
- 10 replies
-
- c programming
- caesar cipher
- (and 4 more)
-
So my synology DS215+ had a JBOD array failure. I would be fine, if i was able to backup my data in time. Lets start from the beginning: I ordered a Synology DS215+ and 2X Crucial 240GB SSDs. I put them in a jbod array and had it running for a few weeks with some vms from a proxmox server. I finally decided it was time to transfer my windows user files to the nas. All went well and I was up and running. A few minutes later, I heard beeping coming from the nas. The second drive of the array failed. What I'm wondering is - Since I only had about 170GB on the nas, are all my files on the primary, still running drive? Or did I lose half of my files because it put half of them on one drive and half on the other. The NAS failed before I could do any backups. Thanks, Kyle
-
Right so I have this program that nearly works, the only thing that isn't working is printing out stars. What the program is supposed to do is match the amount of stars printed with each value in the array. Currently I have this code: #include <stdio.h>int main(){ char star = '*'; int i; //int s; int lottery[49] = { 23,16,18,19,26,13,22, /* 1 .. 7 */ 20,14,22,18,21,15,17, /* 8 .. 14 */ 24,15,18,20,13,14,20, /* 15 .. 21 */ 18,22,20,16,19,11,20, /* 22 .. 28 */ 16,28,22,20,15,17,17, /* 29 .. 35 */ 21,21,19,20,14,22,25, /* 36 .. 42 */ 19,17,26,18,20,23,12 }; /* 43 .. 49 */ for (i = 0; i < 49; i++) { printf(" %2d (%d) | %c\n", i+1, lottery[i], star); } return 0;} The program is supposed to do this in the (picture 1 below) But the output is currently this (picture 2 below)
- 11 replies
-
- c programming
- representing array values
- (and 3 more)