Latest Posts in Software Development

Re: in VB.NET

You know.. I re-read your post and Im a bit confused... so I want to clarify and maybe direct you in a different direction.

If you are using an application on a machine that will interact with a remote database, then you need some sort of authentication layer to protect your data. Otherwise, all anyone would need is an install of your app, a valid "password" that is in its encrypted state in their registry, and voila! They get access. This is a very weak protection.

Odds are, you are going to want to know who logged in, who made what changes, and who broke whatever they broke.

I would encourage you to instead make your app part of the authentication layer, which identifies itself to a web host, which in turn will have the password and everything else you need for your mysql database. This abstraction will make sure no one ever has their hands on your password (encrypted or not), and all they will ever have access to is a login prompt. Even if they reverse engineer your application, all they will learn is what method you use for authentication (be it an oAuth or domain, etc..).

Your app would hold a valid public key to access data on your web server, and with that no one could ever really harm your data or system without a valid user id and password (unless you get brute force hacked, or you give someone that password).

You may want to reconsider your direction if security is really that big of an issue. In truth, encryption alone may not be enough.

in C#

/// This is my code and my file already open in window i want to close it first and then delete pls help

var directory = new DirectoryInfo(path);

                    if (!IsFileLocked(file1, file) & file1.Name == file + ".xlsx")
                        File.Delete(path + file + ".xlsx"); // DELETE THE FILE BEFORE CREATING A NEW ONE.

  public static Boolean IsFileLocked(FileInfo file, string fileName)
        FileStream stream = null;
            if (file.Name == fileName + ".xlsx")
                using (stream = File.Open(file.FullName, FileMode.Open, FileAccess.Write, FileShare.Read))
        catch (Exception ex)
            return true;
            if (stream != null)
        return false;
Re: in VB.NET

Thre very first reply to this post was me telling the poster to add a reference.

No need to keep repeating that, it has already been answered correctly!

Re: in C++

Could you give me the email of your teacher/proffessor, so I can email him/her the solution? In that way, you can continue with whatever you where doing and don't have to bother any further.

l0l :D:D
in C++

.1 Develop a complete C/C++ program which will sort the input array of integer having a maximum of 10 elements in "Descending Order". (15 Marks)

Your program should give a menu to the user after reading the input. The menu must be following:

Press 1 to sort using merge sort
Press 2 to sort using quick sort
Press 3 to sort using insertion sort
Press 3 to sort using shell sort
Press 0 to quit.

Your program should use recursive functions where required.

Your program should contain adequate necessary program documentation and proper program formatting. The program should give necessary messages to the user for input as well as output.

The program must not contain any syntax, runtime or logical errors.

Suggested Marking Scheme

No. Required Information Marks
1 Necessary declarations and program structure and array input 3
2 Merge Sort function 3
3 Quick sort function 3
4 Insertion sort function 3
5 Shell sort function 3

Re: in VB.NET

We've nailed it now! I had forgotten that VBStudio creates a Sub New automatically "in the background" with no parameters when adding a new form to a project and therefore one has to create one on their form's .vb file to 'override' the Studio created one. Thank you so much for your help as it's now working like a charm!

Re: in Java

We still would need to know what the syntax error is, not just where it is occurring.

As for the second part, you are setting array_size to zero here:

int array_size =0;

Then you are comparing i < array_size. If i is set to zero, it isn't less than zero, is it?

You want to set array_size to the total size of the array. So, if the array is meant to have five elements, you would set

int array_size = 5;

That's the size of the array, not the index of it. The whle idea is that you are counting up to 4 (which is the highest integer below 5, naturally), so array_size indicates the endpoint of the loop iteration. Mind you, you want to declare array_size as final (that is to say, constant), and use it when you construct the array:

final int array_size = 5;

int[] rand_array = new int[array_size];

This gives you a fixed, named value for the array size, so that if you ever need to change it, you only need to change it in one place.

Re: in VB.NET

interesting project sir. :) thanks for everything :D

Re: in Java

I am getting a syntax error here and

why is the compile not reading this condition
for some reason the compiler is not reading this code at all

int array_size =0;
            for( i = 0; i<array_size; i++)
                rand_array[i] = randomizer.nextInt(max_range); 

         System.out.println("user1 can you enter the second smallest number");
                        System.out.println("enter the next subsequent number");
                        int num2 = keyin.nextInt(); if(num2 == ans)

                      if(num2 == ans)
                        System.out.println("answer correct, excellent!!!");
                        int numtries = 1;
                        scores = 10;
                        System.out.println("incorrect, \n try again");
                        scores -= 5;
Re: in Python

Use this function to make sure that an integer value is entered ...

an input function for integer values

    # allows the use of input() for Python2 and Python3
    input = raw_input
except NameError:

def get_int(prompt="Enter an integer: "):
    this function will loop until a valid integer value is entered
    returns an integer number
    while True:
            # successful return breaks out of the endless while loop
            return int(input("Enter an integer: "))
        except ValueError:
            print("Try again, value entered was not an integer value.")

# test
n = get_int()
Re: in C++

hey can you please help me out! do you still have this file completed anywhere? please let me know. i would love to see it. i have the same problem and i cannot get numbers to loop after they hit saturday they just go on forever. Please help me. thanks

Re: in Python

There are at least four switch recipes on activestate alone. There is also this Click Here that I find interesting, YMMV.

Re: in Python

Shows how to use a class for a record like structure ...

create a list of instances of class Persons
from a space separated data file

class Persons:
    # similar to a record
    def __init__(self, ni_number, name, age):
        # prefix dunder __ makes variable private
        self.__ni_number = ni_number
        self.__name = name
        self.__age = age

    def show(self):
        '''for a quick test'''
        # formating string
        sf = " ni_number = {}\n name = {}\n age = {}\n"
        return sf.format(self.__ni_number, self.__name, self.__age)

# format: ni_number firstname lastname age
data_str = '''\
55512 Bart Simpson 45
45622 John Smith 58
45813 Sven Soetebier 41
46231 Alicia Sands 27

fname = "data123.txt"

# write test data file
with open(fname, "w") as fout:

# read the data file back in and process
with open(fname, "r") as fin:
    person_list = []
    for line in fin:
        mylist = line.split()
        print(mylist)  # test
        # unpack the list
        ni_number, first, last, age = mylist
        name = first + ' ' + last
        # create a list of instances of class Persons
        person_list.append(Persons(ni_number, name, age))

# test one of the instances
inst1 = person_list[0]

''' result ...
['55512', 'Bart', 'Simpson', '45']
['45622', 'John', 'Smith', '58']
['45813', 'Sven', 'Soetebier', '41']
['46231', 'Alicia', 'Sands', '27']
 ni_number = 55512
 name = Bart Simpson
 age = 45

Software Development Tag Cloud