Search the Community
Showing results for tags 'variable'.
-
In traditional RAID setups, the data is spread out across all drives in the RAID array. If you were running RAID 5 with six drives, for example you would have five drives worth of storage space, with the missing space being for parity data. If you lose one drive, you haven't yet lost all your data. Throw in a new drive, and rebuild your RAID array (and pray you don't run into an unrecoverable read error or silent corruption, because then you can kiss your data good-bye). This has obvious advantages: It is space efficient for the amount of redundancy it provides, and can increase read/write performance with good hardware, since there are multiple drives to run I/O on. However, a single drive going down will kill all of your data. What if you wanted to be able to choose how much overhead you wanted to use for parity calculations? Or what if you wanted a drive loss to not completely kill all of your data? Here's an approach. Here, we have a single giant parity RAID setup. Each color represents pieces of data belonging to a single data chunk (e.g. all the red blocks represent a chunk, spread out over all the drives). This is how traditional RAID works. The proposed "betterRAID" method is to have a fixed parity ratio in a RAID array. For instance, if I want a RAID volume with N parity drive worth of space for every M drives worth of space, then I will have N/(N+M) for my overhead (for N = 1 and M = 4, I have a RAID 5 with five drives, pretty common). However, let me use any number of drives with this setup, and write a given chunk of data to 5 of those drives, then the next chunk to the next 5 drives, and so on, like this: Here, the red data is written across five drives (twice as much data is written to an individual drive) instead of across all ten drives. The orange data gets written to the next five drives, then the green, etc. Notice that if I kill any two drives, I am guaranteed to have 50% of my data survive in the worst case, and 100% of my data survive in the best case. To gain this advantage over traditional RAID 5, I sacrificed one additional drive worth of space (one drive for every five, meaning two drives of the ten are reserved for parity). Obviously, for very large files that span tons of data chunks, they will become corrupted. For smaller files (which can fit inside of a single data chunk), they would survive if the chunk survived, and therefore would be recoverable. Here is a slightly more complicated example. Black lines indicate dead drives. In this case, we write chunks of data across five drives (with 20% of that space used for single-parity), and have 18 drives total in our array. In this case, we can kill two drives, and in the worst case we have lost only 25% of our data. To clarify: A "chunk" is not a complete file. A chunk is just a chunk of data (say, 512KB). If I was writing a 10KB file, it would fit within that chunk, and the next file I wrote might also fit within that chunk. When the chunk is completely full of data, the next one would start to be filled with new incoming data. Writing a multi-gigabyte file would span thousands of chunks. There are obvious upsides to this, most notably the fact that losing more drives than there are parity will not destroy all data, though much of it would likely be corrupted if it spanned many chunks. This also makes disaster recovery a little bit better, ensuring that a failure will not necessarily kill absolutely everything. In addition, if we used dual-parity we could make it even harder to kill data. The downside is that now it is harder to manage the data for an individual file, since you have to find which drives the data lives on. This doesn't provide the same level of protection that dual-parity or triple-parity RAID does. It provides a measure of disaster recovery in case a RAID fails completely. I think it'd be really cool for a software RAID solution like ZFS to implement something like this for RAID Z1, Z2 and Z3.
-
I've got two methods, a method which takes a link and processes it, and then another which does the main methods. Within the main, I want to grab the name of one of the variables within the first function, how do I go about this? This is my code: import requests import nltk from bs4 import BeautifulSoup import string from nltk.corpus import stopwords from collections import Counter def linkInput(): # input which will allow the end user to input a link or file location linkInput = input ("Enter the website address: ") # processes the link using the requests module (linkText variable) and then processes linkText using the .text method (savedLinkText) linkText = requests.get(linkInput) print ("The output of the HTML document looks like this: ") savedLinkText = linkText.text print(" ") def mainProcesing(): linkInput() #prints the text of the link through the savedLinkText variable. #grabs the savedLinkText variable from the linkInput() method. print(savedLinkText) #text in savedLinkText is then parsed through the BeautifulSoup html parser saved as the variable linkParsed. linkParsed = BeautifulSoup(savedLinkText, 'html.parser') #the parsed link then gets scraped for its text, without the tags in the variable parsedText parsedText = linkParsed.get_text() #extra spaces are then removed, joining the parsedText variable contents with split. strippedText = " ".join(parsedText.split()) print(strippedText) #the strippedText contents are then tokenised using the natural toolkit language module, via its tokenize method. tokenList = nltk.word_tokenize(strippedText) print(" ") print(" ") print(tokenList) #tokenised list (tokenList) is then stripped of any punctuation values such as ' , . ? or ! which may be seperate from any text values (tokenListNoPunctuation). This list is then normalised (tokenListNormalised) tokenListNoPunctuation = [''.join(c for c in s if c not in string.punctuation) for s in tokenList] tokenListNormalised = [s for s in tokenListNoPunctuation if s] print(" ") print(len(tokenListNormalised)) #stop words are then removed which are part of the english words list in stopwords.words from the nltk module in a variable named stopwordsRemoved. stopwordsRemoved = [word for word in tokenListNormalised if word not in stopwords.words('english')] print(" ") print(" ") #now the stop words are removed, the text in variable stopwordsRemoved is then tagged using the pos_tag method through the nltk module, in a variable named taggedText taggedText = nltk.pos_tag(stopwordsRemoved) print(len(taggedText)) #the following four variables (removedSingularNouns,removedProperNouns,removedProperSingularNouns,removedAllNouns) are then used to remove nouns (singular noun, proper noun, proper singular noun and proper plural nouns) #this is done in four stages, with the final list being the 'removedAllNouns'variable removedSingularNouns = [s for s in taggedText if s[1] != 'NN'] removedProperNouns = [s for s in removedSingularNouns if s[1] != 'NNP'] removedProperSingularNouns = [s for s in removedProperNouns if s[1] != 'NNS'] removedAllNouns = [s for s in removedProperSingularNouns if s[1] != 'NNPS'] print(len(removedSingularNouns)) print(len(removedProperNouns)) print(len(removedProperSingularNouns)) print(len(removedAllNouns)) #counter named wordCounter is then used using the collections module which associates a counter for each of the tagged values, and lists them from most used to least used. wordCounter = Counter(removedAllNouns) print(len(wordCounter)) print(wordCounter)
-
Hi everyone, we use owncloud in our company and I installed Keypass and shared the .exe file with everyone so all our workes use the same .exe. The problem is that in the same folder where the .exe file is located you will find the configuration files that manage accessibility and user rights for the password database. I don't want that certain users have access to this files so they cannot play around or copy our database. So what I wanted to do is the following: Create folder1 where the programme + configuration files + password database is stored and restrict viewing rights for certain users. Create a new folder (folder2) around folder1 where a shortcut to the exe is stored and have every user access this folder. Since some users have different PCs the owncloud folder will not be in the same directory on every PC which is a problem because then the shortcut won't work anymore. Is there a way to create a shortcut that is relative and ignores the everything that comes before /folder2 an just have it linked to folder1 (which is located in folder2)? It should look something like this: .../users/..../owncloud/folder2 shortcut for keypass.exe (ignores everything before /folder2) folder1 (visibility restricted for some of my coworkers) keypass.exe config-files database ... Thank you in advance!
-
To start I will say that this is a school assignment. We hardly covered variables. The web page should be able to take the entered values and print out the amount of paint is required. It should also look like the "Outcome" image. I cannot get the table and image to line up like it is supposed to. I also cannot get the button to print out the amount of paint required... The instructions specifically said to make the table, center aligned. It also said that this would cause the image to fall into place, except it didn't and I had to left align the image. I have 3 files w/ 3 different ways I've tried. You will need the last picture and rename it measure.gif for it to show up. I am using Brackets Thank you for your help! Paint Calculator 1.html Paint Calculator 2.html Paint Calculator 3.html
-
Hi all, I'm building an eGPU enclosure, and due to it's very tight dimensions I've decided to put a slim fan in one end to prevent heatsoak. Now I'm using an power brick with none of your usual power connectors, but the PCB itself has USB-A output. So I'm looking for something like the image below, if anyone has any suggestions...because that one is butt ugly. But then, if it's not asking too much it'd be great to have it adjustable, because I'll set the fan curve on the GPU down when not gaming. How hard would it be to add a rotary controller in-line, so I could dial back the power and slow it down? As I've got fans with this feature in my old PC case, but those are unsuitable. I'm a bit of an electronics n00b.
-
Hey, I'm currently trying to write a script to launch Internet Explorer as a different user, using variables from an inputbox as username and password. When running the script the GUI runs just fine, you can input your credentials. And they are successfully saved to the variables, however the RunAs command doesn't work at all. I'm not receiving any error messages at all, internet explorer just doesn't start. Anyone with some experience that can help out? See script below: #SingleInstance force Gui, New Gui, Add, Text,, Username Gui, Add, Edit, vUsername Gui, Add, Text,, Password Gui, Add, Edit, Password vPassword Gui, Add, Button, Default gOK, OK Gui, Show return OK: Gui, Submit ;MsgBox %Username% and %Password% return RunAs,%Username%,%Password% RunWait, iexplore.exe return
-
- autohotkey
- runas
-
(and 1 more)
Tagged with:
-
I am having an issue with setting php session variables. Here is what I'm trying to do: I'm creating a website that pulls data from a database. In the database, there are movie theater schedules of three different cities. (not that relevant, but might be useful to see the reason why I need this) So I want to use Session variables and a way to select one of those movie theaters. My index page is as follows: [code] <?php session_start(); if (!isset($_SESSION['varToSet'])){ include('template/selectVarVal.php'); // Var Setting } else { include('template/header.php'); // Page Header include('views/'.$view['name'].'.php'); // View Type include('template/footer.php'); // Page Footer } ?> [/code] So if the session variable varToSet is not set, you will get a page displaying the three options. These are three html buttons: [code] <button id="btnVarToSetVal1" class="btnstyle center-block">Val1</button> [/code] The buttons use javascript to send an ajax request to set the session variable: [code] $('#btnVarToSetVal1').on('click', function(e){ var name = 1; $.ajax({ type: 'POST', url: 'config/SetVar.php', data: { VarToSet: name } }); location.reload() }); [/code] with the php in SetVar.php: [code] <?php session_start(); if($_POST['VarToSet'] != 0){ $VarToSet = $_POST['VarToSet']; session_registrer($VarToSet); $_SESSION['VarToSet'] = $_POST['VarToSet']; //header("Location: index.php"); } else{ unset($_SESSION['VarToSet']); //header("Location: index.php"); } ?> [/code] Thus, the javascript should start the php to set the session variable and reload the index page, which then has the VarToSet-variable set and should display the correct page instead of the SelectValVar-page. This works on my localhost (xampp apache server), but only on chrome and not on firefox and edge. It doesn't work on the Host I am deploying the website to at all, not even on chrome. When I click one of the buttons, the page reloads, but keeps displaying the SelectValVar-page. As far as I can tell the session-id stays the same, but the session variable doesn't get set, or doesn't stick. Yesterday I managed to get the page to load the correct page, but when switching pages (using the navigation) it lost the session-variables again and it displayed the SelectValVar-page anew. The Host is using an older version of php (5.3.29) which also causes some other issues but to my knowledge that shouldn't affect the setting of session variables. Am I doing something wrong? What can I do to get the damned thing to work??
-
So, I recently discovered that you can generate new variables in PHP by doing something like ${"randomString"} = true; //or something like this: $counter = 0; while($counter < 10) { ${"var_" . $counter} = "This is a variable with a by PHP generated name"; $counter = $counter + 1; } This allows me to generate new variables with custom names. Is there something similar in Javascript?
- 5 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
Is there any "anything that the user wrote in that part" variable in Batch? Here's the code: @[member='Echo'] offREM Please do not use the Member='Echo' example. It takes a lot more bytes and it can be shortened, and it is very inpopular.REM It makes the wrong thing and wrong member, so please do not use it.clsset code=(!x!)if "%1"=="/%color% "%code%" I want the code part to be anything that could possibly exist. For example: The code variable could be 123, and it was valid. Or 321, and it was still valid. Or auhedhfwsdiwbdxwmed wxwec wcs cscxhadiwueqwikx asxghasduwm xa diwqduyhwqoskwb dweu8fbefijewrf, and it was still valid. And !LñKäaÈZâE○☻♥♦♣♠ and it was STILL valid. (I'm not sure if here is where i can ask questions about programming, but whatever)
-
I am trying to create a program where the user can create Alarms. When i try to set a variable to the current time in the constructor, everything is fine, but when i try to do it in a method, I get the compiler message: error: non-static variable hour cannot be referenced from a static context hour = now.get(Calendar.HOUR_OF_DAY);. Why is this? How can I compare the time the user inputs to the current time? Here is my class: import java.util.*; public class Alarm { int timeHour; int timeMinute; int date; Calendar now; int hour; int minute; public Alarm(int x, int y) { Calendar now = Calendar.getInstance(); System.out.println("Alarm Initialized"); timeHour = x; timeMinute = y; int hour = now.get(Calendar.HOUR_OF_DAY); System.out.println(hour); } public static boolean goOff() { hour = now.get(Calendar.HOUR_OF_DAY); // if (now.get(Calendar.HOUR_OF_DAY) == timeHour && now.get(Calendar.MINUTE)== timeMinute) // return true; // else // return false; } } Thanks!
-
FreeSync NCIX: http://bit.ly/1HAMTHN Amazon: http://geni.us/3qcT G-Sync NCIX: http://bit.ly/1Rtb1qV Amazon: http://geni.us/2KaJ Is there a final answer in the FreeSync vs G-Sync debate? We set out to find it...
-
Hey guys/girls, I'm a student at Grand valley going for computer science, and I'm taking a java course this semester Right now we're covering methods, parameters, constructors, how to instance variables, and call up methods. I find it all very confusing at this point. Does anyone know of a resource that I can use to help me understand these things for my upcoming project My prof isn't giving us much hands on programming example which is how I personally learn. Any suggestions on websites that I can practice on? IDK if Lynda.com would follow my course at this time, and I'm in college working a part time job that doesn't make much. Appreciate any help you can offer Thanks! Here's a notepad doc of what we went covered in class today. java help.txt
- 7 replies
-
- java
- constructor
- (and 4 more)
-
Simple theme/layout: G-sync related question here Quote previous question and G-sync related answer here Correct me If I'm wrong, G-Sync is limited by the refresh rate of the panel itself, right? Meaning if I have a 120 Hz panel, and get 210 FPS, it can't possibly refresh at 210Hz, correct?
-
I'm doing a water cooling build in the furniture were tubing goes across my walls from the computer to radiators. So I was wondering how can a D5 variable pump go and where should I put another pump? Taking in that I will be going through radiators and waterblocks. Thanks
-
First of all, sorry if it is in the wrong category. I thought it does not fit well into Software and it is a problem that i have. As you can see in the attached picture, i want to calculate a formula in Excel10. How can i define the variables as a cell and how do i get a solution? I hope you understood what I´m trying to do. Greetings Helge
-
Hi guys, I have this java project where I am creating a bank and when i call another class, the variable in the first class resets. I don't really know why. The first screen prompt the user to enter their AdmNo and PIN which is transferred into the Database with no problems. Then, the second screen will have a prompt to enter in a pattern as a secondary password. When this happens, the variable storing the identity of the person(array) is being reset. Database is extends to the pattern. This is the class for the Database. //Method checkAdmNo checks the admno of the user and matches it to //the AdmNo in the array to find which row it belongs to public void checkAdmNo(int admno, int method) { for(int i = 0; i < admNo.length; i++){ if ((admNo[i] != admno)) { correct = false; } else { array = i; correct = true; break; } } if (correct==false) System.out.println("Incorrect AdmNo or PIN"); } //Using the row found above check the pin number of it to see if it matches public void checkPIN(int PIN) { if (correct) { if ((pin[array] == PIN)) { System.out.println("Welcome " + names[array] + " to DIT 22 Bank!\nEnter your pattern here."); super.callPattern(); correct = false; } else { System.out.println("Incorrect AdmNo or PIN"); correct = false; //reinvoke the bank screen to reenter AdmNo and PIN Bank.main(names); } } } //Using the row found above check the pattern of it to see if it matches //Currently does not work as the array variable is being reset public void checkPattern(int pat) { if (pattern[array] == pat) { System.out.println("Welcome " + names[array] + " to DIT 22 Bank"); } else { System.out.println("Incorrect Pattern"); //reinvoke the pattern screen to reenter pattern super.callPattern(); } } This is the Pattern class public void mouseReleased(MouseEvent e) { //Set mouse holding down to false holding = false; //Re-enable Buttons for (int i = 0; i < button1.length; i++) { button1[i].setEnabled(true); } //call method in database to checkPattern DataBase d = new DataBase(); d.checkPattern((Integer.parseInt(enteredPattern))); dispose(); } Sorry if its abit long so i included only the necessary parts. Thanks for help in advance.
-
Panel Self Refresh http://www.hardwaresecrets.com/article/Introducing-the-Panel-Self-Refresh-Technology/1384 Intel Seamless Display Refresh Rate Switching http://liliputing.com/2012/04/intel-future-could-use-less-power-panel-self-refresh-tech.html LG wanted to introduce this (G-Sync Module) tech back in 2011 http://www.youtube.com/watch?v=rdfomYGi1dk It only took Nvidia's marketing to bring the attention of enthusiasts to this. Unfortunately Nvidia tried to make it seem like it re-invented the wheel.
-
Hi guys, So we are testing out domain logins for our users. Well, their domain name == their local user name. So when they log into the computer & domain, the folder under C:\Users is this: jdoe.DOMAIN because there's already a jdoe for the local account. My question is: Does the environment variable %USERNAME% include that Domain? So say I said to create a folder in the C:\Users\%USERNAME%\Documents directory, would that end up being C:\Users\jdoe\Documents or C:\Users\jdoe.DOMAIN\Documents? I'm assuming the former which explains why folder creation isn't working. Would %USERPROFILE% bypass this, such as %USERPROFILE%\Documents? Any help is appreciated, thanks.
-
I'm trying to make a program for school and i was wondering if it is possible in a while loop or some kind of loop if u can create a unique variable for the each integer value intputted?