I thought this would be a nice thing to have up, so if you have any questions regarding the following:
HTML, CSS, PHP, VB, C#, ObjC, Java, or Ruby, and some C++ and C
Leave a comment below with your question, and when I have time, I will help you all to the best of my ability.
Rules:
No, I will not help you if you ask me how to make something black hat (eg: My RAT's File Stealer function isn't working)
Please be descriptive with your question including what you've tried, what you're doing, and post some source code along with it!
Nov 22, 2014 02:05 PM
(This post was last modified: Nov 22, 2014 02:06 PM by Trisomy 21.)
This is in Java.
Basically I want to take a mathematical expression that is represented by a String and move it into a Vector
i.e take the string "34.5+16/2*(4^2)" and store it in the vector<?> {34.5, '+', 16, '/', 2, '*', '(', 4, '^', 2, ')'} where the numbers are doubles and everything else are characters
My code works fine, but i think it's clunky do you see a much better and/or efficient way of doing this?
PHP Code
<?php private Vector stringExpressionToVectorExpression(String strExp) { Vector vecExp = new Vector(); String temp = new String(); for (int i = 0; i < strExp.length(); i++) { if (Character.isDigit(strExp.charAt(i)) || strExp.charAt(i) == '.') temp += strExp.charAt(i); else { if (!temp.isEmpty()) { vecExp.addElement(Double.parseDouble(temp)); temp = ""; } vecExp.addElement(strExp.charAt(i)); } } if (!temp.isEmpty()) vecExp.addElement(Double.parseDouble(temp)); return vecExp; }
(Nov 22, 2014 02:05 PM)Trisomy 21 Wrote: This is in Java.
Basically I want to take a mathematical expression that is represented by a String and move it into a Vector
i.e take the string "34.5+16/2*(4^2)" and store it in the vector<?> {34.5, '+', 16, '/', 2, '*', '(', 4, '^', 2, ')'} where the numbers are doubles and everything else are characters
My code works fine, but i think it's clunky do you see a much better and/or efficient way of doing this?
PHP Code
<?php private Vector stringExpressionToVectorExpression(String strExp) { Vector vecExp = new Vector(); String temp = new String(); for (int i = 0; i < strExp.length(); i++) { if (Character.isDigit(strExp.charAt(i)) || strExp.charAt(i) == '.') temp += strExp.charAt(i); else { if (!temp.isEmpty()) { vecExp.addElement(Double.parseDouble(temp)); temp = ""; } vecExp.addElement(strExp.charAt(i)); } } if (!temp.isEmpty()) vecExp.addElement(Double.parseDouble(temp)); return vecExp; }
Other than extremely long variable names and personal preferences, I think it's OK as long as it actually does compile.
For example 'stringExpressionToVectorExpression', I would just do something like 'stringToVector' or 'StV'. As long as you, and other people reading your code know what it means, it's fine.
Adding 'Expression' with the variable just makes it longer and I guess harder to read.
I've also formatted it with my personal preferences.
PHP Code
<?php private Vector stringToVector(String strExp) { Vector vecExp = new Vector(); String temp = new String();
for (int i = 0; i < strExp.length(); i++) { if (Character.isDigit(strExp.charAt(i)) || strExp.charAt(i) == '.') { temp += strExp.charAt(i); } else { if (!temp.isEmpty()) { vecExp.addElement(Double.parseDouble(temp)); temp = ""; } vecExp.addElement(strExp.charAt(i)); } }
if (!temp.isEmpty()) { vecExp.addElement(Double.parseDouble(temp)); }
return vecExp; }
I want to create a program that automatically changes and apply's a hex code to my keyboard. I have a strike 3 and it is possible to change the colors of the leds and I want a program that can do that without me manually having the change the color my self. I have no idea where to begin. Thanks in advanced
(Nov 22, 2014 02:35 PM)Epic Legendz Wrote: I want to create a program that automatically changes and apply's a hex code to my keyboard. I have a strike 3 and it is possible to change the colors of the leds and I want a program that can do that without me manually having the change the color my self. I have no idea where to begin. Thanks in advanced
You mean change the color of the LED light coming out of your keyboard? To be honest, I have no idea what computer you're using, and how to even access that to test anything (not to mention I've never done anything like that) without me owning a laptop / keyboard that can do that.
(Nov 22, 2014 02:41 PM)Programming Wrote: You mean change the color of the LED light coming out of your keyboard? To be honest, I have no idea what computer you're using, and how to even access that to test anything (not to mention I've never done anything like that) without me owning a laptop / keyboard that can do that. Sorry maybe I explained it wrong. There is a program released by madcatz that does almost exactly that so its not impossible my keyboard has RGB leds. But the madcatz program doesn't switch between colors automatically and I would like to create something that does
I am learning some basic programming in school right now on windows. But I run on Macs on home. What is a good program to begin coding on mac and what language should I work on first?
DO NOT DEAL WITH THIS MEMBER
(Nov 22, 2014 02:12 PM)Programming Wrote: -snip-
When a language has a set of standardized rules that you're supposed to follow, and you just blatantly ignore them, you must be mentally challenged.
Also, you kind of contradicted yourself here:
(Nov 22, 2014 02:12 PM)Programming Wrote: For example 'stringExpressionToVectorExpression', I would just do something like 'stringToVector' or 'StV'. As long as you, and other people reading your code know what it means, it's fine.
Nobody (including yourself if you come back to the code later on) is going to know what in the hell "stringToVector", or "StV" means (StV is just wrong, if I ever see that in someone's code, I'll kill you).
/rant
(Nov 22, 2014 02:45 PM)Jake Johnson Wrote: I am learning some basic programming in school right now on windows. But I run on Macs on home. What is a good program to begin coding on mac and what language should I work on first?
Are you wanting to code for Windows on your Mac or do you want to code for Macs?
For macs: Download XCode and learn Objective-C
If you want to develop on Windows on your Mac, download a Virtual Machine.
DO NOT DEAL WITH THIS MEMBER
I have a richtextbox where i'm trying to write text and save the file as txt, but the problem is everytime I write text on the richtextbox with some new lines and save it as txt and open it there's only one line.
Code:
PHP Code
<?php private void saveFileAsToolStripMenuItem_Click(object sender, EventArgs e) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "TEXT|*.txt"; if (sfd.ShowDialog() == DialogResult.OK) { StreamWriter sw = new StreamWriter(sfd.FileName); sw.Write(richTextBox1.Text); sw.Close(); } } }
Thanks in advance 🤝
DO NOT DEAL WITH THIS MEMBER
Nov 22, 2014 03:19 PM
(This post was last modified: Nov 22, 2014 03:24 PM by Mr. Dr. Prof. Patrick.)
(Nov 22, 2014 02:45 PM)Jake Johnson Wrote: I am learning some basic programming in school right now on windows. But I run on Macs on home. What is a good program to begin coding on mac and what language should I work on first?
well you can learn java, obj-c, swift, C or C++ they all have supported compilers on mac as for first program? traditional helloworld... then make a basic calculator then add float(decimal) support
(Nov 22, 2014 03:04 PM)CrypticX Wrote: I have a richtextbox where i'm trying to write text and save the file as txt, but the problem is everytime I write text on the richtextbox with some new lines and save it as txt and open it there's only one line.
Code:
PHP Code
<?php private void saveFileAsToolStripMenuItem_Click(object sender, EventArgs e) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "TEXT|*.txt"; if (sfd.ShowDialog() == DialogResult.OK) { StreamWriter sw = new StreamWriter(sfd.FileName); sw.Write(richTextBox1.Text); sw.Close(); } } }
Thanks in advance 🤝
PHP Code
<?php using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "TEXT|*.txt"; if (sfd.ShowDialog() == DialogResult.OK) { string[] lines = richTextBox1.Lines; File.WriteAllLines(sfd.FileName, lines); } }
DO NOT DEAL WITH THIS MEMBER
(Nov 22, 2014 03:32 PM)Programming Wrote: PHP Code
<?php using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "TEXT|*.txt"; if (sfd.ShowDialog() == DialogResult.OK) { string[] lines = richTextBox1.Lines; File.WriteAllLines(sfd.FileName, lines); } }
Wow I would have never found myself :p thanks a lot 🤝
(Nov 22, 2014 03:34 PM)CrypticX Wrote: Wow I would have never found myself :p thanks a lot 🤝
No problem! :)
Enjoy whatever you're making!
I am very new to coding, and was curious where do you recommend I start learning, I want to learn Java, HTML, CSS, PHP for now.
|