[StructLayout(LayoutKind.Explicit)]
public struct Ip4Address
{
[FieldOffset(0)] public byte Octet1;
[FieldOffset(1)] public byte Octet2;
[FieldOffset(3)] public byte Octet3;
[FieldOffset(4)] public byte Octet4;
[FieldOffset(0)] public UInt32 Address;
Setting Address = UInt32.MaxValue results in 255.255.255.0
I write a simple php login class that only operate on php sessions to login user in the system.
My Question is that this class is secure enough to be used on production environment ?
NOTE : Die Statements are used only for testing of scripts
class.login.inc.php
class Login
{
//setSessionFun...
today I tried to code all the dictionary operations such as Search, Successor, Predecessor, Minimum, Maximum, Insert, Delete etc. for a Binary Search Tree data structure using the Java programming language. I would be grateful to you guys if you can review my code and suggest me some cool tricks ...
First the Image is not going on and it says the applet hasnt started at the bottom of this applet. Please help me its fursrtating me a lot. And i tried to do this based of this youtube viedo if it will help you. THANKS!!!
This is my Main Class:
import java.applet.*;
import java.awt.*;
public cl...
I was inspired by
Processing a list to build an IP in String Format to reinvent the wheel a little bit and play around with explicit struct layouts.
You see, an IP address is really made up of four, 1-byte numbers. Each Octet of an IP address is one byte. So, this means that an IP address can ...
I adapted this piece of code from a math book for game developers and the result is correct albeit with slight floating point errors.
void rotate(matrix44_t &m, const float32_t x, const float32_t y, const float32_t z) {
float32_t sin_x = math::sin(x), cos_x = math::cos(x);
...
This should not be posted as an answer as it appears to be a question. If your code works as expected and your question is more of a "clean up my code" request, post to codereview.stackexchange.com. If the code isn't working the way you want, describe what is your expected vs. actual output in a new question post or edit your original question. — E. Moffat57 secs ago
Basically, Alex has already made some good suggestions (especially the bit about using \b). However, your function will fail in certain cases like this one:
//looking for chars like *, +, ? and such
filterExactPhrase("some *markdown* string", "*markdown*");
The string could contain special reg...
This is volunteer homework so I don't have to do it and I won't get any grades for doing it anyway, but I don't get my parser to work correctly and it's driving me insane.
Basically I just want to read an infix formula and convert it to postfix and it is working with smaller formulas like 1 + 5 /...
@Phrancis split the string on each period and return an IEnumerable<string>, then convert each string into a Byte and return IEnumerable<byte>, then cast the IEnumerable<byte> to an array.
It is my first time here in Code Review so i will welcome all comments in order to improve my post.
So I am looking to see if my code can be improved by all ways.
What my code does is: Find the best match between a Private Company and a listed company based on 3 ratios in order to report the ra...
My name is Michael, 13 years, and I began to do C++ programming recently.
I have a book with following exercise:
Create a class myArray that solves the overflow problem when
handling arrays. In addition, this new class will allow a user to
provide any integer (positive or negative) as t...
Reminds me of my favourite joke. Guy's being interviewed, and is asked what his biggest weakness is. "I'd have to say honesty". The interviewer replies "Honesty? What's wrong with that? I don't think honesty is a weakness?!" Interviewee says "I don't give a **** what you think". — Alexyesterday
I wrote this code but it seams it doesn't create a histogram how I want it.
#include<iostream>
#include<string>
using namespace std;
int main(){
int Range1 = 0; // 0 to 29
int Range2 = 0; // 30 to 39
int Range3 = 0; // 40 to 69
int Range4 = 0; // 70 to 100
int Grade; // Gr...
In Usenet slang, Eternal September (or the September that never ended) began in September 1993, the month that Internet service provider America Online began offering Usenet access to its tens of thousands, and later millions, of users. Before then, Usenet was largely restricted to colleges and universities. Every year in September, a large number of incoming freshmen would acquire access to Usenet for the first time, and would take some time to become accustomed to Usenet's standards of conduct and "netiquette". But, after a month or so, these new users would either learn to comply with the networks...
> An IT contractor goes to the gates of Heaven. Very indignantly, he says to St Peter, "Look here, I was only 45 so why did I have to die? It's not fair." St Peter stares back with a puzzled frown, and leafs through the golden book. "Hey, that's odd. According to the hours you've claimed for, you're 120.
> I called the janitor the other day to see what he could do about my dingy linoleum floor. He said he would have been happy to loan me a polisher, but that he hadn't the slightest idea what he had done with it. I told him not to worry about it - that as a programmer it wasn't the first time I had experienced a buffer allocation failure due to a memory error.
Damn, this is scarier than actual Russian roulette. At least with the real thing you don't have to deal with the consequences. — Manos DilaverakisNov 11 '09 at 16:22
I don't know why my code is't working, this code suppose to take the name of the text file then read the information of the graph from it.(this is't the full code)
void graph(node* G[], FILE *fp){
int index;
int n;
fscanf(fp, "%d", &n);
for (int i = 0; i < n; i++){
G[i] = new node; // creat ...