#Boolean data
Explore tagged Tumblr posts
Text
refs for a code creature named Boolean (it/its)! It is based on glitch slimes and digitarr from Slime Rancher :]
Boolean's whole thing is that normally it is a silly goober but, if stressed or agitated enough, it'll turn into its digitarr form (which is the second image). It's quite mean in that form lol
#raintailed's art#rain world#rw#rain world oc#my ocs#boolean (oc)#reference#tw eyestrain#boolean is named that for a reason!#a boolean is a data type that has two possible values: true (1) or false (0)#boolean's normal form is: isFriend = true#its digitarr form is: isFriend = false
85 notes
·
View notes
Text
The tech bro inside me that makes fun of people who don't know how Ai works and the 2000s teen movie popular girl in me who passive aggressively makes fun of everyone balance out perfectly into someone who cannot watch most movies
#its terrible honestly#my life is very hard and here's why:#most costume departments are absolutely terrible#like all they doll is put some guy in either a tshirt or a suit#and like NO?!#dont do that!#fashion tells you about that person#what do they like? whats their lifestyle? what is their personality? whats their heritage? where are they from? how old are they?#how confident are they? whats their job? are they happy?#tell a fucking story with their outfit!!#put the girl whose under constant pressure from her parents to be perfect in a 50s housewife inspired outfit!#give the shy kid long sleeves and layers because they are closed off but then give them a fake designer bag to show that they want to fit in#TECHNOLOGY#heres a fun game:#whenever you see a smartphone try to guess if based on IOS or Android#you usually cant tell because the prop department doesnt know shit about technology#“i hacked the power grid all electricity is off in the city”#NO YOU DIDN'T?!#the power grid isnt a boolean that you can just set to false#also generators are a fucking thing#also also if the electricity is out#food will spoil!#also also also for plot shit no electricity means no wifi means you better hope your charcters have an unlimited data plan#like omg#foxys magical tech adventures#unmedicated foxy thoughts
4 notes
·
View notes
Text
I don't know how to code but I also don't know how to stop.
#had another dream set inside a ruby script#ARGV was full of cat toys and my hair ties#i was trying to teach someone primitive data types but i didn't know which cat toys were 'integer's#embarrassing#(the hair ties were like TrueClass/boolean)
9 notes
·
View notes
Text
A structured way to learn JavaScript.
I came across a post on Twitter that I thought would be helpful to share with those who are struggling to find a structured way to learn Javascript on their own. Personally, I wish I had access to this information when I first started learning in January. However, I am grateful for my learning journey so far, as I have covered most topics, albeit in a less structured manner.
N/B: Not everyone learns in the same way; it's important to find what works for you. This is a guide, not a rulebook.
EASY
What is JavaScript and its role in web development?
Brief history and evolution of JavaScript.
Basic syntax and structure of JavaScript code.
Understanding variables, constants, and their declaration.
Data types: numbers, strings, boolean, and null/undefined.
Arithmetic, assignment, comparison, and logical operators.
Combining operators to create expressions.
Conditional statements (if, else if, else) for decision making.
Loops (for, while) for repetitive tasks. - Switch statements for multiple conditional cases.
MEDIUM
Defining functions, including parameters and return values.
Function scope, closures, and their practical applications.
Creating and manipulating arrays.
Working with objects, properties, and methods.
Iterating through arrays and objects.Understanding the Document Object Model (DOM).
Selecting and modifying HTML elements with JavaScript.Handling events (click, submit, etc.) with event listeners.
Using try-catch blocks to handle exceptions.
Common error types and debugging techniques.
HARD
Callback functions and their limitations.
Dealing with asynchronous operations, such as AJAX requests.
Promises for handling asynchronous operations.
Async/await for cleaner asynchronous code.
Arrow functions for concise function syntax.
Template literals for flexible string interpolation.
Destructuring for unpacking values from arrays and objects.
Spread/rest operators.
Design Patterns.
Writing unit tests with testing frameworks.
Code optimization techniques.
That's it I guess!
867 notes
·
View notes
Text
Why the Number Zero Changed Everything
Zero: a concept so foundational to modern mathematics, science, and technology that we often forget it wasn’t always there. Its presence in our world today seems obvious, but its journey from controversial abstraction to indispensable tool has shaped entire civilizations.
1. The Birth of Zero: A Revolutionary Idea
The concept of zero didn't exist in many ancient cultures. For example, the Greeks, despite their advancements in geometry and number theory, rejected the idea of a placeholder for nothingness. The Babylonians had a placeholder symbol (a space or two slashes) for zero, but they didn't treat it as a number. It wasn't until Indian mathematicians in the 5th century, like Brahmagupta, that zero was truly conceptualized and treated as a number with its own properties.
Zero was initially used as a place-holder in the decimal system, but soon evolved into a full-fledged number with mathematical properties, marking a huge leap in human cognition.
2. The Birth of Algebra
Imagine trying to solve equations like x + 5 = 0 without zero. With zero, algebra becomes solvable, opening up entire fields of study. Before zero’s arrival, solving equations involving unknowns was rudimentary, relying on geometric methods. The Indian mathematician Brahmagupta (again) was one of the first to establish rules for zero in algebraic operations, such as:
x + 0 = x (additive identity)
x × 0 = 0 (multiplicative property)
These properties allowed algebra to evolve into a system of abstract thought rather than just arithmetic, transforming the ways we understand equations, functions, and polynomials.
3. Calculus and Zero: A Relationship Built on Limits
Without zero, the foundation of calculus—limits, derivatives, and integrals—wouldn’t exist. The limit concept is intrinsically tied to approaching zero as a boundary. In differentiation, the derivative of a function f(x) is defined as:
f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
This limit process hinges on the ability to manipulate and conceptualize zero in infinitesimal quantities. Similarly, integrals, which form the backbone of area under curves and summation of continuous data, rely on summing infinitely small quantities—essentially working with zero.
Without the concept of zero, we wouldn’t have the means to rigorously define rates of change or accumulation, effectively stalling physics, engineering, and economics.
4. Zero and the Concept of Nothingness: The Philosophical Impact
Zero is more than just a number; it’s an idea that forces us to confront nothingness. Its acceptance was met with philosophical resistance in ancient times. How could "nothing" be real? How could nothing be useful in equations? But once mathematicians recognized zero as a number in its own right, it transformed entire philosophical discussions. It even challenged ideas in theology (e.g., the nature of creation and void).
In set theory, zero is the size of the empty set—the set that contains no elements. But without zero, there would be no way to express or manipulate sets of nothing. Thus, zero's philosophical acceptance paved the way for advanced theories in logic and mathematical foundations.
5. The Computing Revolution: Zero as a Binary Foundation
Fast forward to today. Every piece of digital technology—from computers to smartphones—relies on binary systems: sequences of 1s and 0s. These two digits are the fundamental building blocks of computer operations. The idea of Boolean algebra, where values are either true (1) or false (0), is deeply rooted in zero’s ability to represent "nothing" or "off."
The computational world relies on logical gates, where zero is interpreted as false, allowing us to build anything from a basic calculator to the complex AI systems that drive modern technology. Zero, in this context, is as important as one—and it's been essential in shaping the digital age.
6. Zero and Its Role in Modern Fields
In modern fields like physics and economics, zero plays a crucial role in explaining natural phenomena and building theories. For instance:
In physics, zero-point energy (the lowest possible energy state) describes phenomena in quantum mechanics and cosmology.
In economics, zero is the reference point for economic equilibrium, and the concept of "breaking even" relies on zero profit/loss.
Zero allows us to make sense of the world, whether we’re measuring the empty vacuum of space or examining the marginal cost of producing one more unit in economics.
7. The Mathematical Utility of Zero
Zero is essential in defining negative numbers. Without zero as the boundary between positive and negative values, our number system would collapse. The number line itself relies on zero as the anchor point, dividing positive and negative values. Vector spaces, a fundamental structure in linear algebra, depend on the concept of a zero vector as the additive identity.
The coordinate system and graphs we use to model data in statistics, geometry, and trigonometry would not function as we know them today. Without zero, there could be no Cartesian plane, and concepts like distance, midpoint, and slope would be incoherent.
#mathematics#math#mathematician#mathblr#mathposting#calculus#geometry#algebra#numbertheory#mathart#STEM#science#academia#Academic Life#math academia#math academics#math is beautiful#math graphs#math chaos#math elegance#education#technology#statistics#data analytics#math quotes#math is fun#math student#STEM student#math education#math community
66 notes
·
View notes
Note
So Solar Beta and Lunar Beta are the same AI but different personalities? The solar form seems more daring, I guess he would hug Y/N in the teddy bear suit without hesitation, right? Lol
Also happy Valentine's Day!
He's a single AI with a dual personality, yeah! It's as if you tell the AI to act differently under certain conditions (in coding, the most basic way to do this is to use some conditional/boolean structure). But they're not THAT different from each other, and they may appear to be two different AIs because they don't share memory, so Beta Solar would have different memories about you, if he ever met you
The Solar form is just a prototype, very poorly made, by the way. The idea of those who programmed him was that during this state, the Solar form wouldn't have access to the main memory but would store all the collected data (for future reports) in a separate, removable, and easily accessible storage to avoid mixing information. This way, everything would be more "organized," and the Solar form wouldn't be influenced by the Lunar form and vice versa. But this guy is a walking machine of bugs and errors; he overheats too much as if trying to emulate another OS with a low-performance CPU. Sometimes, he also has little control over his body and drops things, trips, or simply shuts down (if he doesn’t catch fire)
Edit: the idea was that the solar form could access the most recent memories of the Lunar to have some notion and context, but everyone forgot about this part hsushhshs
I like to play with the fact that, even though Beta refers to the type of radiation with that name, he's also a test project and has not yet reached his final form
Yes, Beta Solar would probably be less hesitant to hug teddy YN! ann maybe squeeze and kiss them a little, everything the Lunar form would have wanted but kept only in his thoughts lmao
Happy Valentine's Day to you and everyone reading this! <3
33 notes
·
View notes
Text
Date: march 7th, 2025
Alert
I believe I have made a mistake.
I was attempting to find out more information about AdvUript when one of my alerts went off. After the To Long Night, I decided to make an alert attached to the attention variable, that went off whenever someone observed the cube that wasn’t me. I figured it would make a good alert, and I could get a file id of my fellow coder.
I quickly ran the DataFile command on the id, and found its GPV. It was a few meters away, sitting in a cage, looking adorable.
Remington was being registered by the cube.
I looked through his data, finding much of it similar to my own. He had barely any Type 3 variables (variables that cause type 3 errors), and instead had what looked like huge Boolean lists. A Quick Look at the help files showed something that looked like a basic neural network.
The thing I was not expecting to find was an external reference to something labeled “AdvUript DrePLoSU 328AC3”. The help document requires credentials, but I was able to navigate to the actual file structure via the reference. When I tried to make a DataFile for that, I think I started Lagging?
What I mean by that is I could see my body moving, but I wasn’t. Like, I would lift my arm, and I could see it lift, but I was still feeling the keyboard? I fell unconscious for a bit, and when I woke up, the reference was gone. I still had access to Remingtons DataFile, but a bunch of values had been wiped. My notes were intact, fortunately.
The only other change I found was a new reference on my DataFile to “AdvUript SLoTEStp 93D3”.
I’m concerned.
Pleasantly Yours,
Tester
3 notes
·
View notes
Text
🌟 Understanding Arrays: A Beginner’s Deep Dive! 🌟
Hey Tumblr friends 👋
Today I want to break down something super important if you're getting into coding: Arrays. (Yes, those weird-looking brackets you've probably seen in code snippets? Let’s talk about them.)
So... What Exactly Is an Array? 🤔
Imagine you have a bunch of favorite songs you want to save. Instead of creating a new playlist for each song (chaotic!), you put them all into one single playlist.
That playlist? That’s what an Array is in programming! 🎶✨
An array is basically a container where you can store multiple values together under a single name.
Instead of doing this:
You can just do:
Why Are Arrays Useful? 🌈
✅ You can group related data together. ✅ You can loop through them easily. ✅ You can dynamically access or update data. ✅ You keep your code clean and organized. (No messy variables 👀)
How Do You Create an Array? ✨
Here's a simple array:
Or create an empty array first (you must specify size in C++):
Note: C++ arrays have a fixed size once declared!
How Do You Access Items in an Array? 🔎
Arrays are zero-indexed. That means the first element is at position 0.
Example:
Changing Stuff in an Array 🛠️
You can update an item like this:
Looping Through an Array 🔄
Instead of writing:
Use a loop:
Or a range-based for loop (cleaner!):
Some Cool Things You Can Do With Arrays 🚀
In C++ you don't have built-in methods like push, pop, etc. for raw arrays, but you can use vectors (dynamic arrays)! Example with vector:
Quick Tip: Arrays Can Store Anything 🤯
You can store numbers, booleans, objects (structures/classes), and even arrays inside arrays (multidimensional arrays).
Example:
Real-World Example 🌍
A To-Do list:
Output:
👏 See how clean and readable that is compared to hardcoding every single task?
🌟 Final Thoughts
Arrays are the foundation of so much you'll do in coding — from simple projects to complex apps. Master them early, and you'll thank yourself later!
🌱 Start practicing:
Make a list of your favorite movies
Your favorite foods
Songs you love
...all in an array!
If you liked this C++ explainer, let’s connect! 💬✨ Happy coding, coder fam! 💻🌈
2 notes
·
View notes
Text
stream of consciousness about the new animation vs. coding episode, as a python programmer
holy shit, my increasingly exciting reaction as i realized that yellow was writing in PYTHON. i write in python. it's the programming language that i used in school and current use in work.
i was kinda expecting a print("hello world") but that's fine
i think using python to demonstrate coding was a practical choice. it's one of the most commonly used programming languages and it's very human readable.
the episode wasn't able to cram every possible concept in programming, of course, but they got a lot of them!
fun stuff like print() not outputting anything and typecasting between string values and integer values!!
string manipulation
booleans
little things like for-loops and while-loops for iterating over a string or list. and indexing! yay :D
* iterable input :D (the *bomb that got thrown at yellow)
and then they started importing libraries! i've never seen the turtle library but it seems like it draws vectors based on the angle you input into a function
the gun list ran out of "bullets" because it kept removing them from the list gun.pop()
AND THEN THE DATA VISUALIZATION. matplotlib!! numpy!!!! my beloved!!!!!!!! i work in data so this!!!! this!!!!! somehow really validating to me to see my favorite animated web series play with data. i think it's also a nice touch that the blue on the bars appear to be the matplotlib default blue. the plot formatting is accurate too!!!
haven't really used pygame either but making shapes and making them move based on arrow key input makes sense
i recall that yellow isn't the physically strongest, but it's cool to see them move around in space and i'm focusing on how they move and figure out the world.
nuke?!
and back to syntax error and then commenting it out # made it go away
cool nuke text motion graphics too :D (i don't think i make that motion in python, personally)
and then yellow cranks it to 100,000 to make a neural network in pytorch. this gets into nlp (tokenizers and other modeling)
a CLASS? we touch on some object oriented programming here but we just see the __init__ function so not the full concept is demonstrated here.
OH! the "hello world" got broken down into tokens. that's why we see the "hello world" string turn into numbers and then... bits (the 0s and 1s)? the strings are tokenized/turned into values that the model can interpret. it's trying to understand written human language
and then an LSTM?! (long short-term memory)
something something feed-forward neural network
model training (hence the epochs and increasing accuracy)
honestly, the scrolling through the code goes so fast, i had to do a second look through (i'm also not very deeply versed in implementing neural networks but i have learned about them in school)
and all of this to send "hello world" to an AI(?) recreation of the exploded laptop
not too bad for a macbook user lol
i'm just kidding, a major of people used macs in my classes
things i wanna do next since im so hyped
i haven't drawn for the fandom in a long time, but i feel a little motivated to draw my design of yellow again. i don't recall the episode using object oriented programming, but i kinda want to make a very simple example where the code is an initialization of a stick figure object and the instances are each of the color gang.
it wouldn't be full blown AI, but it's just me writing in everyone's personality traits and colors into a function, essentially since each stick figure is an individual program.
#animator vs animation#ava#yellow ava#ava yellow#long post#thank you if you took the time to read lol
5 notes
·
View notes
Text
((OOC: switching to plain text for readability and since providing a plain text translation of the entire thing would have been.... way too long.))
ITS ME DATA BOY AND I AM MAKING AN ASK GAME
THE THEME OF THIS ASK GAME IS: BRANCHES OF MATHEMATICS
DISCLAIMER: THIS DOES NOT INCLUDE ALL BRANCHES OF MATHEMATICS
NUMBER THEORY: WHAT IS YOUR FAVORITE SUBSET OF POKEMON. THIS CAN BE A TYPE (EXAMPLE: WATER POKEMON) OR SOME OTHER CATEGORY (EXAMPLES: LEGENDARY POKEMON, DOGGIE POKEMON)
DIFFERENTIAL GEOMETRY: WHAT KIND OF ART DO YOU LIKE TO MAKE
RIEMANNIAN GEOMETRY: HOW FAR AWAY ARE YOU PHYSICALLY FROM YOUR FRIENDS AND FAMILY. DO YOU LIVE NEARBY AND ALSO WHY OR WHY NOT
TOPOLOGY: WHAT ABOUT YOU HAS NEVER CHANGED EVEN AS YOU GOT OLDER AND WISER
COMPLEX GEOMETRY: HAVE YOU EVER SEEN SOMETHING THAT YOU COULD NOT EXPLAIN
GROUP THEORY: WHAT KIND OF PEOPLE DO YOU LIKE TO HANG OUT WITH
LIE ALGEBRA: DO YOU LIKE TO KEEP YOUR SPACE ORGANIZED OR DO YOU LIKE TO KEEP IT A COMPLETE MESS
BOOLEAN ALGEBRA: WHAT DO YOU BELIEVE TO ALWAYS BE TRUE
MULTIVARIATE CALCULUS: WHO IS YOUR CLOSEST FRIEND AND SAY SOMETHING VERY NICE ABOUT THEM
ORDINARY DIFFERENTIAL EQUATIONS: WHAT THINGS DO YOU LIKE TO DO WHEN YOU ARE ALONE
PARTIAL DIFFERENTIAL EQUATIONS: WHAT THINGS DO YOU LIKE TO DO WITH YOUR FRIENDS
INTEGATION: WHAT IS THE GREATEST REALIZATION THAT YOU HAVE EVER HAD
GRAPH THEORY: DO YOU LIKE TO USE THE INTERNET TO TALK OR DO YOU LIKE TO STARE AT PEOPLE WHEN YOU TALK
GAME THEORY: DO YOU TAKE RISKS AND WHAT IS THE (BAD WORD INCOMING) STUPIDEST RISK YOU HAVE EVER TAKEN
PROBABILITY THEORY: DO YOU BELIEVE IN FREE WILL
REMEMBER TO BE NICE AND ALSO SEND AN ASK TO THE PERSON YOU REBLOGGED THIS FROM AND ALSO REMEMBER TO SAY THANK YOU TO DATA BOY (ME) FOR MAKING THIS
30 notes
·
View notes
Text
JavaScript
Introduction to JavaScript Basics
JavaScript (JS) is one of the core technologies of the web, alongside HTML and CSS. It is a powerful, lightweight, and versatile scripting language that allows developers to create interactive and dynamic content on web pages. Whether you're a beginner or someone brushing up on their knowledge, understanding the basics of JavaScript is essential for modern web development.
What is JavaScript?
JavaScript is a client-side scripting language, meaning it is primarily executed in the user's web browser without needing a server. It's also used as a server-side language through platforms like Node.js. JavaScript enables developers to implement complex features such as real-time updates, interactive forms, and animations.
Key Features of JavaScript
Interactivity: JavaScript adds life to web pages by enabling interactivity, such as buttons, forms, and animations.
Versatility: It works on almost every platform and is compatible with most modern browsers.
Asynchronous Programming: JavaScript handles tasks like fetching data from servers without reloading a web page.
Extensive Libraries and Frameworks: Frameworks like React, Angular, and Vue make it even more powerful.
JavaScript Basics You Should Know
1. Variables
Variables store data that can be used and manipulated later. In JavaScript, there are three ways to declare variables:
var (old way, avoid using in modern JS)
let (block-scoped variable)
const (constant variable that cannot be reassigned)
Example:
javascript
Copy code
let name = "John"; // can be reassigned const age = 25; // cannot be reassigned
2. Data Types
JavaScript supports several data types:
String: Text data (e.g., "Hello, World!")
Number: Numeric values (e.g., 123, 3.14)
Boolean: True or false values (true, false)
Object: Complex data (e.g., { key: "value" })
Array: List of items (e.g., [1, 2, 3])
Undefined: A variable declared but not assigned a value
Null: Intentional absence of value
Example:
javascript
Copy code
let isLoggedIn = true; // Boolean let items = ["Apple", "Banana", "Cherry"]; // Array
3. Functions
Functions are reusable blocks of code that perform a task.
Example:
javascript
Copy code
function greet(name) { return `Hello, ${name}!`; } console.log(greet("Alice")); // Output: Hello, Alice!
4. Control Structures
JavaScript supports conditions and loops to control program flow:
If-Else Statements:
javascript
Copy code
if (age > 18) { console.log("You are an adult."); } else { console.log("You are a minor."); }
Loops:
javascript
Copy code
for (let i = 0; i < 5; i++) { console.log(i); }
5. DOM Manipulation
JavaScript can interact with and modify the Document Object Model (DOM), which represents the structure of a web page.
Example:
javascript
Copy code
document.getElementById("btn").addEventListener("click", () => { alert("Button clicked!"); });
Visit 1
mysite
Conclusion
JavaScript is an essential skill for web developers. By mastering its basics, you can create dynamic and interactive websites that provide an excellent user experience. As you progress, you can explore advanced concepts like asynchronous programming, object-oriented design, and popular JavaScript frameworks. Keep practicing, and you'll unlock the true power of JavaScript!
2 notes
·
View notes
Text
Day 5 - 100 days of code with C++
One of the main or fundamental characteristics of any programming language is Functions, but why? Because functions help us maintain order, organization, and also greatly assist in inevitable future maintenance of our code. All the dynamics of programs are carried out through functions.
What are functions ?
But what are functions? Functions are generally small pieces or parts of code that exist outside the main scope of the program, meaning they are code snippets that are called by the function's identifier (name) and also by its return type for that functionality. Therefore, they are responsible for performing a specific task in our program, such as processing a piece of data or a certain number of data that other parts of the program do not handle.
Imagine a program that requests 3 grades to calculate the student's average. Although the program is simple, you can break it down or divide it into parts for future modifications.
All functions must be specified by a type, meaning the type of data they will return. Return types in C++ basically come down to: integer, float, boolean, and void, with the latter not returning any value.
What Not to Do - Typical Errors
Do not give functions names that are not clear about their functionality. This makes the code harder to read and, consequently, more time-consuming when it comes to maintenance or corrections.
In C++, there is an order that functions must follow to avoid errors during compilation.
Notice that now the program's organization has changed. 1) Incredibly, this will result in a compilation error. Why? Because the C++ compiler does not find the function mediaFunction() - now you might be thinking, "But why, since mediaFunction() is there in main()?" For the C++ compiler, there is an order.
But how do you solve this problem in C++? There are 2 options: a) You declare the function at the beginning of the code, or b) you place the function before main. However, there is a problem with this last detail. What if another function A calls function B, and function B calls function A?
We would have the same problem again. Therefore, what must be done is to declare a prototype of the function at the beginning.
Conclusion:
From the little shown here about functions, it is clear that this is a fundamental skill for anyone aspiring to be a good programmer. I tried not to go into too many details because the intention is not to be a course on how to create, but at least to make it a little clear about the fundamental aspect of functions within any code.
18 notes
·
View notes
Note

Download a program called undertale mod tools, then, using it open the data file in uty.
Undertale mod tools can be used to mod any game, not just undertale/deltarune.
Hope this helps ^.^
I tried to but an error screen appears saying something about an invalid boolean value?? hold on lemme copypaste it
..i cannot copypaste it. i'll type it by hand
Invalid boolean value: 4281479935 at 01126E50 while reading object UndertaleModLib.Models.UndertaleParticleSystemEmitter while reading item 1 of 3 in a list of UndertaleModLib.Models.UndertaleParticleSystemEmitter in chunk PSEM
#ask#freemongo#help what does this mean#did u encounter this error too or am i the unluckiest person alive
7 notes
·
View notes
Text
LDAP testing & defense
LDAP Injection is an attack used to exploit web based applications that construct LDAP statements based on user input. When an application fails to properly sanitize user input, it's possible to modify LDAP statements through techniques similar to SQL Injection.
LDAP injection attacks are common due to two factors:
The lack of safer, parameterized LDAP query interfaces
The widespread use of LDAP to authenticate users to systems.
How to test for the issue
During code review
Please check for any queries to the LDAP escape special characters, see here.
Automated Exploitation
Scanner module of tool like OWASP ZAP have module to detect LDAP injection issue.
Remediation
Escape all variables using the right LDAP encoding function
The main way LDAP stores names is based on DN (distinguished name). You can think of this like a unique identifier. These are sometimes used to access resources, like a username.
A DN might look like this
cn=Richard Feynman, ou=Physics Department, dc=Caltech, dc=edu
or
uid=inewton, ou=Mathematics Department, dc=Cambridge, dc=com
There are certain characters that are considered special characters in a DN. The exhaustive list is the following: \ # + < > , ; " = and leading or trailing spaces
Each DN points to exactly 1 entry, which can be thought of sort of like a row in a RDBMS. For each entry, there will be 1 or more attributes which are analogous to RDBMS columns. If you are interested in searching through LDAP for users will certain attributes, you may do so with search filters. In a search filter, you can use standard boolean logic to get a list of users matching an arbitrary constraint. Search filters are written in Polish notation AKA prefix notation.
Example:
(&(ou=Physics)(| (manager=cn=Freeman Dyson,ou=Physics,dc=Caltech,dc=edu) (manager=cn=Albert Einstein,ou=Physics,dc=Princeton,dc=edu) ))
When building LDAP queries in application code, you MUST escape any untrusted data that is added to any LDAP query. There are two forms of LDAP escaping. Encoding for LDAP Search and Encoding for LDAP DN (distinguished name). The proper escaping depends on whether you are sanitising input for a search filter, or you are using a DN as a username-like credential for accessing some resource.
Safe Java for LDAP escaping Example:
public String escapeDN (String name) {
//From RFC 2253 and the / character for JNDI
final char[] META_CHARS = {'+', '"', '<', '>', ';', '/'};
String escapedStr = new String(name);
//Backslash is both a Java and an LDAP escape character,
//so escape it first escapedStr = escapedStr.replaceAll("\\\\\\\\","\\\\\\\\");
//Positional characters - see RFC 2253
escapedStr = escapedStr.replaceAll("\^#","\\\\\\\\#");
escapedStr = escapedStr.replaceAll("\^ | $","\\\\\\\\ ");
for (int i=0 ; i < META_CHARS.length ; i++) {
escapedStr = escapedStr.replaceAll("\\\\" + META_CHARS[i],"\\\\\\\\" + META_CHARS[i]);
}
return escapedStr;
}
3 notes
·
View notes
Text
Understanding Java Data Types: A Comprehensive Guide
Java, one of the most widely used programming languages, is known for its portability, security, and rich set of features. At the core of Java programming are data types, which define the nature of data that can be stored and manipulated within a program. Understanding data types is crucial for effective programming, as they determine how data is stored, how much memory it occupies, and the operations that can be performed on that data.
What are Data Types?
In programming, data types specify the type of data that a variable can hold. They provide a way to classify data into different categories based on their characteristics and operations. Java categorizes data types into two main groups:
1. Primitive Data Types
2. Reference Data Types
Why Use Data Types?
1. Memory Management: Different data types require different amounts of memory. By choosing the appropriate data type, you can optimize memory usage, which is particularly important in resource-constrained environments.
2. Type Safety: Using data types helps catch errors at compile time, reducing runtime errors. Java is a statically typed language, meaning that type checks are performed during compilation.
3. Code Clarity: Specifying data types makes the code more readable and understandable. It allows other developers (or your future self) to quickly grasp the intended use of variables.
4. Performance Optimization: Certain data types can enhance performance, especially when dealing with large datasets or intensive calculations. For example, using int instead of long can speed up operations when the range of int is sufficient.
5. Defining Operations: Different data types support different operations. For example, you cannot perform mathematical operations on a String data type without converting it to a numeric type.
When and Where to Use Data Types?
1. Choosing Primitive Data Types:
Use int when you need a whole number without a decimal, such as counting items.
Use double for fractional numbers where precision is essential, like financial calculations.
Use char when you need to store a single character, such as a letter or symbol.
Use boolean when you need to represent true/false conditions, like in conditional statements.
2. Choosing Reference Data Types:
Use String for any textual data, such as names, messages, or file paths.
Use Arrays when you need to store multiple values of the same type, such as a list of scores or names.
Use Custom Classes to represent complex data structures that include multiple properties and behaviors. For example, a Car class can encapsulate attributes like model, year, and methods for actions like starting or stopping the car.
1. Primitive Data Types
Primitive data types are the most basic data types built into the Java language. They serve as the building blocks for data manipulation in Java. There are eight primitive data types:
Examples of Primitive Data Types
1. Byte Example
byte age = 25; System.out.println(“Age: ” + age);
2. Short Example
short temperature = -5; System.out.println(“Temperature: ” + temperature);
3. Int Example
int population = 1000000; System.out.println(“Population: ” + population);
4. Long Example
long distanceToMoon = 384400000L; // in meters System.out.println(“Distance to Moon: ” + distanceToMoon);
5. Float Example
float pi = 3.14f; System.out.println(“Value of Pi: ” + pi);
6. Double Example
double gravitationalConstant = 9.81; // m/s^2 System.out.println(“Gravitational Constant: ” + gravitationalConstant);
7. Char Example
char initial = ‘J’; System.out.println(“Initial: ” + initial);
8. Boolean Example
boolean isJavaFun = true; System.out.println(“Is Java Fun? ” + isJavaFun);
2. Reference Data Types
Reference data types, unlike primitive data types, refer to objects and are created using classes. Reference data types are not defined by a fixed size; they can store complex data structures such as arrays, strings, and user-defined classes. The most common reference data types include:
Strings: A sequence of characters.
Arrays: A collection of similar data types.
Classes: User-defined data types.
Examples of Reference Data Types
1. String Example
String greeting = “Hello, World!”; System.out.println(greeting);
2. Array Example
int[] numbers = {1, 2, 3, 4, 5}; System.out.println(“First Number: ” + numbers[0]);
3. Class Example
class Car { String model; int year;
Car(String m, int y) { model = m; year = y; } }
public class Main { public static void main(String[] args) { Car car1 = new Car(“Toyota”, 2020); System.out.println(“Car Model: ” + car1.model + “, Year: ” + car1.year); } }
Type Conversion
In Java, type conversion refers to converting a variable from one data type to another. This can happen in two ways:
1. Widening Conversion: Automatically converting a smaller data type to a larger data type (e.g., int to long). This is done implicitly by the Java compiler.
int num = 100; long longNum = num; // Widening conversion
2. Narrowing Conversion: Manually converting a larger data type to a smaller data type (e.g., double to int). This requires explicit casting.
double decimalNum = 9.99; int intNum = (int) decimalNum; // Narrowing conversion
Conclusion
Understanding data types in Java is fundamental for effective programming. It not only helps in managing memory but also enables programmers to manipulate data efficiently. Java’s robust type system, consisting of both primitive and reference data types, provides flexibility and efficiency in application development. By carefully selecting data types, developers can optimize performance, ensure type safety, and maintain code clarity.
By mastering data types, you’ll greatly enhance your ability to write efficient, reliable, and maintainable Java programs, setting a strong foundation for your journey as a Java developer.
3 notes
·
View notes
Text
@ptilopsiis
E: While I am here, though:
Greetings to you, Operator Ptilopsis. It is a pleasure to make the acquaintance of another from Consul Gladiia's universe.
I am Exploratory Unit Model E, Designation: Echo, acting captain of the Starship Pyxis. My crew and I are androids that were intended to represent humanity and explore the stars on its behalf. We are currently...serving an impromptu tour on Earth, however.
Prior to which I was an engineer actually. Not quite a data specialist, but I did work- and still work- quite closely with our Information Technologist, Quebec. Doubtless, they will be happy to meet you too when they have the chance.
I am sorry to hear your earliest experiences with this website have been...a bit rocky. Needless to say I also find the search function to be rather obtuse. They don't even appear to have Boolean operators for stars' sake...
#E#L: Greetings. I am Lima. I will not interrupt other than to say I like your profile picture.#L: White faced owls are very cute.#L#ptilopsiis
4 notes
·
View notes