Download the AI & Machine Learning For Dummies PRO App: iOS - Android Our AI and Machine Learning For Dummies PRO App can help you Ace the following AI and Machine Learning certifications:
Install and run your first noSQL MongoDB on Mac OSX
Classified as a NoSQL database, MongoDB is an open source, document-oriented database designed with both scalability and developer agility in mind. Instead of storing your data in tables and rows as you would with a relational database, in MongoDB you store JSON-like documents with dynamic schemas; This makes the integration of data in certain types of application easier and faster. Why? MongoDB can help you make a difference to the business. Tens of thousands of organizations, from startups to the largest companies and government agencies, choose MongoDB because it lets them build applications that weren’t possible before. With MongoDB, these organizations move faster than they could with relational databases at one tenth of the cost. With MongoDB, you can do things you could never do before.
Install Homebrew $ /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Homebrew installs the stuff you need that Apple didn’t. $ brew install wget
Install MongoDB $ brew install mongodb
Run MongoDB Create the data directory: $ mkdir -p /data/db Set permissions for the data directory:$ chown -R you:yourgroup /data/db then chmod -R 775 /data/db Run MongoDB (as non root): $ mongod
Begin using MongoDB.(MongoDB will be running as soon as you ran mongod above)Open another terminal and run: mongo
Download the AI & Machine Learning For Dummies PRO App: iOS - Android Our AI and Machine Learning For Dummies PRO App can help you Ace the following AI and Machine Learning certifications:
How to declare and write a script with hash tables on windows and linux
A hash table, also known as a hash map, is a data structure that is used to store key-value pairs. It is an efficient way to store data that can be quickly retrieved using a unique key.
Here is an example of how to declare and write a script with a hash table in Python:
# Declare an empty hash table hash_table = {}
# Add some key-value pairs to the hash table hash_table[‘key1’] = ‘value1’ hash_table[‘key2’] = ‘value2’ hash_table[‘key3’] = ‘value3’
# Access a value using its key print(hash_table[‘key2’]) # Output: “value2”
# Modify a value using its key hash_table[‘key2’] = ‘new value’ print(hash_table[‘key2’]) # Output: “new value”
# Delete a key-value pair using the `del` statement del hash_table[‘key1’]
# Check if a key is in the hash table using the `in` operator print(‘key1’ in hash_table) # Output: False
# Output: False
In this example, we declare an empty hash table using the {} syntax. We then add some key-value pairs to the hash table using the [] syntax. We access a value using its key, modify a value using its key, delete a key-value pair using the del statement, and check if a key is in the hash table using the in operator.
I hope this helps! Let me know if you have any questions.
Add new key-value in hashtable: $states.Add(“Manitoba”,”Winnipeg”)
Remove key-value in hashtable: $states.Remove(“Manitoba”,”Winnipeg”) Change value in hashtable: $states.Set_Item(“Ontario”,”Ottawa”) Retrieve value in hashtable: $states.Get_Item(“Alberta”) Find key in hashtable: $states.ContainsKey(“Alberta”) Find Value in hashtable: $states.ContainsValue(“Calgary”) Count items in hashtable: $states.Count Sort items by Name in hashtable: $states.GetEnumerator() | Sort-Object Name -descending Sort items by Value in hashtable: $states.GetEnumerator() | Sort-Object Value -descending
Hash tables with perl on linux or windows
Declaration: my %hash = (); #Initialize a hash my $hash_ref = {}; # Initialize a hash reference. ref will return HASH Clear (or empty) a hash for (keys %hash) { delete $hash{$_}; } Clear (or empty) a hash reference for (keys %$href) { delete $href->{$_}; } Add a key/value pair to a hash $hash{ ‘key’ } = ‘value’; # hash $hash{ $key } = $value; # hash, using variables Using Hash Reference $href->{ ‘key’ } = ‘value’; # hash ref $href->{ $key } = $value; # hash ref, using variables Add several key/value pairs to a hash %hash = ( ‘key1’, ‘value1’, ‘key2’, ‘value2’, ‘key3’, ‘value3’ ); %hash = ( key1 => ‘value1’, key2 => ‘value2’, key3 => ‘value3’, );
Copy a hash my %hash_copy = %hash; # copy a hash my $href_copy = $href; # copy a hash ref Delete a single key/value pair delete $hash{$key}; delete $hash_ref->{$key};
Download the AI & Machine Learning For Dummies PRO App: iOS - Android Our AI and Machine Learning For Dummies PRO App can help you Ace the following AI and Machine Learning certifications:
Using the rev command: The rev command is a utility that reverses the lines of a file or the characters in a string. To reverse a string, you can use the echo command to pass the string to rev:
echo"string" | rev
Using the sed command: The sed command is a powerful utility that can perform various text transformations. To reverse a string, you can use the sed command with the -r option and the 's/.*(.)/\1/g' expression:
echo"string" | sed -r 's/.*(.)/\1/g'
Using the awk command: The awk command is a programming language that is used for text processing. To reverse a string, you can use the awk command with the {print} action:
echo"string" | awk '{print $1}'
On Windows:
Using the powershell command: The powershell command is a shell that provides a command-line interface for Windows. To reverse a string, you can use the powershell command with the -C option and the '[System.Text.Encoding]::Unicode.GetString([System.Text.Encoding]::Unicode.GetBytes("string"))' expression:
Using the cmd command: The cmd command is the command-line interpreter for Windows. To reverse a string, you can use the cmd command with the for loop:
cmd /c "for /L %i in (1,1,%len%) do @echo !string:~%len%-%i,1!"
These are some ways to reverse a string on Linux and Windows. There are other ways to achieve this, using different utilities or programming languages.
Via shell script on Linux
sh-3.2# vi reverse.sh #### Start Script ##### #!/bin/bash input_string=”$1″ reverse_string=””
input_string_length=${#input_string} for (( i=$input_string_length-1; i>=0; i– )) do reverse_string=”$reverse_string${input_string:$i:1}” done
::—————- :: Calc Var Length ::—————- :: %*=Str to Check :: Returns %Len% :: ————— :StrLen %* set Data=%* for /L %%a in (0,1,80) do ( set Char=!Data:~%%a,1! if not “!Char!”==”” ( set /a Len=%%a+1 ) else (exit /b) ) exit /b
::————— :: Reverse String ::————— :: %* Str to Reverse :: Returns %Reverse% ::—————— :ReverseStr %* set Data=%* call :StrLen %Data% for /L %%a in (!Len!,-1,0) do ( set Char=!Data:~%%a,1! set Reverse=!Reverse!!Char! ) exit /b
Download the AI & Machine Learning For Dummies PRO App: iOS - Android Our AI and Machine Learning For Dummies PRO App can help you Ace the following AI and Machine Learning certifications:
Let’s find how to prompt and read input variables from keyboard while executing a script using shell, perl, python, batch and powershell (windows and Linux)
On Linux via shell
read -p “Enter your name: ” name echo “Hi, $name. Let’s be friend!”
On Windows via powershell
$name=read-host “Enter your name:” write-host “Hi $name, Let’s be friend!”
On Windows via batch
Set /p Name=”Enter your name:” echo “Hi %name%, Let’s be friend!”
On Windows or Linux via perl
print “Enter your name “; my $name = ; chomp $name; # Get rid of newline character at the end print “Hello $name, let’s be friend”;
On Windows or Linux via python
name=input(“Enter your name: “) print (“Hello ” + name + ” let’s be friend”)
Today I Learned (TIL) You learn something new every day; what did you learn today? Submit interesting and specific facts about something that you just found out here.
Reddit Science This community is a place to share and discuss new scientific research. Read about the latest advances in astronomy, biology, medicine, physics, social science, and more. Find and submit new publications and popular science coverage of current research.
What do you think of the list? What would you add? LeBron James scores 40,000 career points Mondo Duplantis smashes Olympic pole vault records Spain’s historic Euro 2024 victory, featuring - - Lamine Yamal’s stunning debut Rafael Nadal bids farewell to tennis with an emotional retirement Novak Djokovic finally captures Olympic gold in Paris Caitlin Clark and Angel Reese redefine women’s basketball and its impact Record-breaking Super Bowl LVIII captivates millions The AFC Asian Cup and AFCON showcase football’s global influence Simone Biles makes a triumphant Olympic comeback with record-breaking performances Steph Curry delivers an unforgettable Olympic final performance submitted by /u/bakenzo [link] [comments]