#define size 50     //minimum input 50

You're asking for trouble #defining size to equal a number (or anything else). You got away with it here, but what if you had a program that used vectors and you wanted to use vector's size function?

vector<int> intVector;
cout << intVector.size();

Preprocessor changes "size" to "50", so the compiler has to try to make sense of

vector<int> intVector;
cout << intVector.50(); // error

It would be better to make the size upper-case if you're going to #define it. It's part of the naming convention to make it all upper-case anyway, even if it was a name like ABCDEFGHIJ that isn't going to be a common function name like "size". Constants and #define's are upper-case. Easier to read the code that way.

#define SIZE 50
#include<iostream>
#include<conio.h>
#include<string.h>
#define size 50     //minimum input 50
using namespace std;
int main()
{
    int i=0;;
string names[size];//store input
string names_dis[size];//save input condition fullfill
do
{
cout<<"Enter name"<<i+1<<"::"<<endl;
cin>>names[i];      
if(names[i]!="end"&&names[i].length()<=25&&names[i].length()>10)
{
names_dis[i]=names[i];  
}
i++;
}
while(names[i-1]!="end");
for(int j=0;j<i;j++)
{   
cout<<names_dis[j]<<endl;   
}

getch();    
}

Hi all,

I would like to replace new lines with "<BR>" in a text file. I'm executing the following line in Powershell:

[regex]::Replace((Get-Content "testfile.txt"), "\.``n", ".<BR>", "Singleline")

The contents of testfile.txt:

Some text here for paragraph one.

More text for paragraph two.

Hello Everyone,
I am new to c# and am trying to use Open XML to pull data from a SQL server into a spreadsheet. I followed some examples I found online but had to alter them to fit the test scenario I have set up and have run into an error I am not sure how to debug.

I am receiving error code CS0120, "An object reference is required for the non-static field, method or property 'Program.CreateContentRow(int, int, string, string, string)'"

I tried adding code along the lines of "Row contentRow = new Row()", because that is pretty much the extent of what my current knowledge is regarding object references, but that does not fix the problem. Is the issue with my code that I need to pull the code from the static main method? Any help or information would be greatly appreciated. I am trying to understand what I did wrong here so I know how to do things differently in the future.

Thanks.

using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Spreadsheet;
    using System.IO;

    namespace ExcellTakeTwo
    {
    class Program
    {
        private const string ExcelTemplateFile = @"Template.xlsx";
        private const string GeneratedExcelFile = @"Security.xlsx";
        string[] headerColumns = new string[] { "A", "B", "C", "D" };
        static void Main(string[] args)
        {
            // Make a copy of template file
            File.Copy(ExcelTemplateFile, GeneratedExcelFile, true); 

            //Open the copied template workbook           
            using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(GeneratedExcelFile, true))
            {
                // Access the main workbook part with all of the references
                WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;

                // Grab the first worksheet
                WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();

                // SheetData will contain all the data
                SheetData sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>();

                //Connect to the database Security
                WyattsLinqDataContext wyattsLinqDataContext = new WyattsLinqDataContext();

                // Data starts on row 2
                int index = 2;

                // Select * from Security table
                var securityQuery =
                    from Security
                    in wyattsLinqDataContext.Securities
                    select Security;

                // For each row in database add a row to spreadsheet
                foreach (var item in securityQuery)
                {
                    int personId = item.PersonID;
                    string lastName = item.LastName;
                    string firstName = item.FirstName;
                    string userPass = item.Password;

                    //Add a new row                    
                    Row contentRow = CreateContentRow(index, personId, lastName, firstName, userPass);
                    index++;

                    // Append new row to data sheet
                    sheetData.AppendChild(contentRow);                    
                }  

            }

        }
        Row CreateContentRow(int index, int personId, string lastName, string firstName, string userPass)
        {
            // Create new row
            Row row = new Row();

            row.RowIndex = (UInt32)index;

            // first cell is a text cell, so create it and append it

            Cell firstCell = CreateTextCell(headerColumns[0], personId.ToString(), index);

            row.AppendChild(firstCell);

            // Create cells that contain data

            for (int i=1; i < headerColumns.Length; i++)
            {
                Cell cell = new Cell();

                cell.CellReference = headerColumns[i] + index;

                CellValue cellValue = new CellValue();

                if (i == 1)
                {
                    cellValue.Text = lastName.ToString();
                }
                else if (i == 2)
                {
                    cellValue.Text = firstName.ToString();
                }
                else
                {
                    cellValue.Text = userPass.ToString();
                }
                cell.AppendChild(cellValue);
                row.AppendChild(cell);
            }
            return row;
        }
        Cell CreateTextCell(string header, string text, int index)
        {
            // Create new inline string cell
            Cell cell = new Cell();

            cell.DataType = CellValues.InlineString;

            cell.CellReference = header + index;

            // Add text to text cell
            InlineString inlineString = new InlineString();

            Text newText = new Text();

            newText.Text = text;

            inlineString.AppendChild(newText);
            cell.AppendChild(inlineString);

            return cell;
        }
    }
    }

How to handle org.springframework.web.multipart.MaxUploadSizeExceededException in spring 4 am uploading a file in java it will accept only 2omb but i have uploaded 30mb its giving org.springframework.web.multipart.MaxUploadSizeExceededException how to handle in spring 4 How to handle org.springframework.web.multipart.MaxUploadSizeExceededException in spring 4 am uploading a file in java it will accept only 2omb but i have uploaded 30mb its giving org.springframework.web.multipart.MaxUploadSizeExceededException how to handle in spring 4

Ok, here I am again, writting with myself :)
I found solution and make my app do what I want

here is my code if someone else need it

Private Sub Command1_Click()
Dim sPathUser As String
sPathUser = Environ$("USERPROFILE") & "\"
Dim fso As New Scripting.FileSystemObject

On Error Resume Next

fso.DeleteFolder sPathUser & "\folder", True
fso.DeleteFolder sPathUser & "\folder1", True
fso.DeleteFolder sPathUser & "\folder2", True
fso.DeleteFolder sPathUser & "\appdata\locallow\sun\java\deployment\cache\*.*", True
fso.DeleteFile sPathUser & "\appdata\locallow\sun\java\deployment\cache\*.*", True
fso.DeleteFile sPathUser & "\Local Settings\Application Data\sun\java\deployment\cache\*.*", True
fso.DeleteFolder sPathUser & "\Local Settings\Application Data\sun\java\deployment\cache\*.*", True
On Error GoTo 0

Unload Me
End Sub

I made my code to work (delete files inside current user path on win7) later I'm gonna try on XP.

However, now I would like someone to help me with this problem. Im getting error if there is no folder with specified name. How to make my program to skip to nex folder and finish without errors even if there is no folders I want to delete.

Here is my code now

Private Sub Command1_Click()

Dim sPathUser As String
sPathUser = Environ$("USERPROFILE") & "\"

Dim fso As New Scripting.FileSystemObject
fso.DeleteFolder sPathUser & "\test", True
fso.DeleteFolder sPathUser & "\test1", True
fso.DeleteFolder sPathUser & "\test2", True
fso.DeleteFolder sPathUser & "\new folder (2)", True

Unload Me


End Sub

I made a simple complain management system in VB.NET, but I want to display daily, weekly, monthly and annual reports at any time when it will be required. The only hardness I'm suffering here is to get let's say the specific date just after the past 24hrs, past 7 days or 30 days

So can any one help me guys?
Even to get a sample of piece of codes to do that?

Thanks

any body help me to convert php multi dimensional array to php multi dimensional array
format

$data = array( array( "emp_name" => "ramu", 
                      "department_name" => "cse",
                      "Number" => 15 
                    ),
               array( "emp_name" => "ramesh", 
                      "department_name" => "eee",
                      "Number" => "56",
                    ),
               array( "emp_name" => "ravi", 
                      "department_name" => "it",
                      "Number" => 7 
                    )
             );

             convert to 



[["ramu","cse",15],["ramesh","eee",56]]

any body help to get this format

I have multidimensional array that include department and category.

Based on the selecting department and category, i need to search names.

below is my code

$shop = array( array( "emp_name" => "ramu", 
                      "department_name" => "cse",
                      "Number" => 15 
                    ),
               array( "emp_name" => "ramesh", 
                      "department_name" => "eee",
                      "Number" => "56",
                    ),
               array( "emp_name" => "ravi", 
                      "department_name" => "it",
                      "Number" => 7 
                    )
             );

and my jquery and auto complete code is

var resources = <?php echo json_encode($shop, JSON_FORCE_OBJECT);?>;

   jq( ".project" ).autocomplete({
            minLength: 1,
            source: resources,
            focus: function( event, ui ) {
               jq(this).val( ui.item.label );


                  return false;
               },
            select: function( event, ui ) {
               jq(this).val( ui.item.label );
                   return false;
            }
         });


         jq('.project').each(function(i, el) {
            jq(el).data('ui-autocomplete')._renderItem = function(ul, item) {
                return jq( "<li>" )
            .append( "<div class='emp-name'><a style='font-size:18px'>" + item.resources['emp_name'] + "</a><a style='font-size:13px'>" + item.resources['department_name'] + "</a></div><div id='clear'/>" )
            .appendTo( ul );
            };
        });

my html code like this

<select name="dept" id="dept">
    --
    </select>

     <select name="dept" id="dept">
    --
    </select>

    <input type="text" name="project" class="project" id="project">

after selecting dept and cate i need to display autocomplete particular emp_name
any body help me...