mardi 5 mai 2015

How would I make a program that meets these requirements? I need to

Your instructor is in a bind. His place of work has instituted a new technology project that will require remote access verification. In addition to his username and password, he will have a “challenge” to each sign-on. That challenge will require that he input a number or letter depending on what the security application asks him.

But your instructor is lazy. He wants an application that will tell him what those appropriate numbers are without him having to look them up each time. He understands that this will help foil remote hackers, but he does not want to be stuck carrying around a piece of paper all the time.

Write your instructor a program that gives him the three characters asked for. The matrix to use is:

A B C D E F G H I J 1 3 N 1 M 4 R X 5 F N 2 N V T 5 K Q F M 3 P 3 9 K 1 Y R 4 V T F 3 4 3 3 9 V 4 Y R T N N 5 3 1 1 3 2 9 X P N P

A challenge of A1:B2:C3 would yield 3 V 1.

A challenge of G4:D2:J3 would yield R 5 3.

Algorithm

Use a 5x10 matrix to load each the matrix above.

After you get the input, separate the two characters

First character is the column. Translate the letter to the appropriate array number (A = 0, B = 1, etc.)

Second character is the row. Subtract one from the number given to get the proper array number (arrays start counting at zero!).

You now have the row and column for each challenge.

Search the 5x10 array you have created using the row, column you just found

Display the proper number/character to the user (under the appropriate challenge).

This is what I have so far... In the Driver class:

public class Driver { public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    System.out.println("Please enter the challenge sepereated by colons:");
    String challenge = scan.nextLine();


    //static call to method that separates the challenge
    String challegeresult =  null;

    // sysprint to print out the contents of the array

    System.out.println("The three characters you need are " + challegeresult + "."); //add the challenge result
    System.out.println(challengevalue); //add the challenge result

}

In the util class:

public class Util {

// put in my matrix
                    //A    B    C    D    E    F    G    H    I     J
String[][] tom = {  {"3", "N", "1", "M", "4", "R", "X", "5", "F", "N"},
                    {"N", "V", "T", "5", "K", "Q", "F", "M", "3", "P"},
                    {"9", "K", "1", "Y", "R", "4", "V", "T", "F", "3"},
                    {"3","3", "9", "V", "4", "Y", "R", "T", "N", "N"},
                    {"3", "1", "1", "3", "2", "9", "X", "P","N", "P"} };

//method to separate the challenge

public static void seperate () {
}

//method to turn the letter into the number

public static void lettertonum(){

}

//method to subtract 1 from the number

public static void subonefromnum (){

}

//method to look up the answer

public static void answerlookup () {

}

Convert value from specific multidimensional array key into key in new array with original arrays as value

Basically I just would like to know if there is a built-in way of doing this, that might be faster, like maybe with an array_map callback or something:

function array_rekey($a, $column)
{
    $array = array();
    foreach($a as $keys) $array[$keys[$column]] = $keys;
    return $array;
}

Multidimensional Arrays in Ruby like C++

I had previously created a struct and an array of the same in C++ , now i want to implement the same in Ruby.

/ Number of Elements (Which can be increased) :D
#define ELM_NO 110

struct elem
{
  char name[18];
  char elm_symbol[5];

  double atm_weight;

  int elm_melting;
  int elm_boiling;
  int elm_yearofdis;
  int elm_group;

  double elm_ionis_e;
};

elem element[ELM_NO] = { {" Hydrogen"  ,"H"  ,1.0079 ,-259 ,-253 ,1776 ,1  ,13.5984 },
                      {" Hydrogen"  ,"H"  ,1.0079 ,-259 ,-253 ,1776 ,1  ,13.5984  } ,
                      {" Helium"  ,"He" ,4.0026 ,-272 ,-269 ,1895 ,18 ,24.5874  } ,
                      {" Lithium" ,"Li" ,6.941  ,180  ,1347 ,1817 ,1  ,5.3917 } ,
                      {" Beryllium" ,"Be" ,9.0122 ,1278 ,2970 ,1797 ,2  ,9.3227 } ,
                      {" Boron" ,"B"  ,10.811 ,2300 ,2550 ,1808 ,13 ,8.298  } ,
                      {" Carbon"  ,"C"  ,12.0107  ,3500 ,4827 ,0  ,14 ,11.2603  } ,
                      {" Nitrogen" ,"N"  ,14.0067  ,-210 ,-196 ,1772 ,15 ,14.5341  } ,
                      {" Oxygen" ,"O"  ,15.9994  ,-218 ,-183 ,1774 ,16 ,13.6181  } ,
                      {" Fluorine" ,"F"  ,18.9984  ,-220 ,188  ,1886 ,17 ,17.4228  } ,
                      {" Neon" ,"Ne" ,20.1797  ,-249 ,-246 ,1898 ,18 ,21.5645  } ,
                      {" Sodium" ,"Na" ,22.9897  ,98 ,883  ,1807 ,1  ,5.1391 } ,
                      {" Magnesium"  ,"Mg" ,24.305 ,639  ,1090 ,1755 ,2  ,7.6462 } ,
                      {" Aluminum" ,"Al" ,26.9815  ,660  ,2467 ,1825 ,13 ,5.9858 } };

Omitted some parts.

Now , I want to implement in Ruby . The problem is I don't know how to implement 2D arrays from which we can access an Individual Element from the Inner Array.

I have checked on previous Questions , and found that the answers were not either clear or were concerned with Narrays.

Can anybody show me how it's done ?

How to showing the date_part all

I have a data array's like this. and I want to make this data into grafik. and the problem is when i put the script

if (isset($b['admin'])) {
      echo $b['admin'];
      $series = $this->HighCharts->addChartSeries();
      $series->addName($user)->addData([(int)$b['admin']]);
      $mychart->addSeries($series);
}

in the foreach($datas as $a){. why the date_part 3 couldn't be show?

QUERY RESULT ARRAY

$array = array(
        (int) 0 => array( 
                        'B' => array(
                                    'company' => 'ABC' 
                        ), 
                        'User' => array( 
                                    'company' => 'abc' 
                        ), 
                        (int) 0 => array(
                                    'date_part' => '3',
                                    'jumlah' => null, 
                                    'jumbuy' => '50990', 
                                    'admin' => '50010' 
                        )
        ),
        (int) 1 => array(
                        'B' => array( 
                                    'company' => 'BCD'
                        ), 
                        'User' => array( 
                                    'company' => 'bcd' 
                        ), 
                        (int) 0 => array( 
                                    'date_part' => '3',
                                    'jumlah' => null, 
                                    'jumbuy' => '65000', 
                                    'admin' => '5000' )
        ),
        (int) 2 => array(
                        'B' => array(
                                    'company' => 'ABC' 
                        ), 
                        'User' => array( 
                                    'company' => 'abc' 
                        ), 
                        (int) 0 => array(
                                    'date_part' => '4',
                                    'jumlah' => null, 
                                    'jumbuy' => '98990', 
                                    'admin' => '2010' )
        ),
        (int) 3 => array(
                        'B' => array(
                                    'company' => 'CDE'
                        ), 'User' => array( 
                                    'company' => 'cde' 
                        ), 
                        (int) 0 => array(
                                    'date_part' => '4',
                                    'jumlah' => null, 
                                    'jumbuy' => '34566', 
                                    'admin' => '2010' )
        ),
        (int) 4 => array(
                        'B' => array( 
                                    'company' => 'BCD'
                        ), 
                        'User' => array( 
                                    'company' => 'bcd' 
                        ), 
                        (int) 0 => array( 
                                    'date_part' => '4',
                                    'jumlah' => null, 
                                    'jumbuy' => '9000', 
                                    'admin' => '5000' )
        ),
);

IN CONTROLLERS

$chartName = 'Line Chart with Data Labels';
$tooltipFormatFunction = <<<EOF
function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C';}
EOF;

    $mychart = $this->HighCharts->create($chartName, 'line');

    $data = array();
    foreach($report_posts as $values) {
        if (!isset($data[$values['User']['company']])) {
            $data[$values['User']['company']] = $values;
        } else {
            $last_element = array_pop($values);
            $data[$values['User']['company']][] = $last_element;
        }
    }
    $datas = array_values($data);

    foreach ($datas as $a) {
            $user = [$a['User']['company']];
            foreach ($a as $b) {
                if (isset($b['date_part'])) {
                    $this->HighCharts->setChartParams($chartName, array(
                            'renderTo' => 'linewrapper', // div to display chart inside
                            'chartWidth' => 1000,
                            'chartHeight' => 750,
                            'chartMarginTop' => 60,
                            'chartMarginLeft' => 90,
                            'chartMarginRight' => 30,
                            'chartMarginBottom' => 110,
                            'chartSpacingRight' => 10,
                            'chartSpacingBottom' => 15,
                            'chartSpacingLeft' => 0,
                            'chartAlignTicks' => FALSE,
                            'chartTheme' => 'dark-green',
                            'title' => 'Monthly Average Temperature',
                            'subtitle' => 'Source: WorldClimate.com',
                            'titleAlign' => 'center',
                            'titleFloating' => TRUE,
                            'titleStyleFont' => '18px Metrophobic, Arial, sans-serif',
                            'titleStyleColor' => '#0099ff',
                            'titleX' => 20,
                            'titleY' => 10,
                            'legendEnabled' => TRUE,
                            'legendLayout' => 'horizontal',
                            'legendAlign' => 'center',
                            'legendVerticalAlign ' => 'bottom',
                            'legendItemStyle' => array('color' => '#222'),
                            'legendBackgroundColorLinearGradient' => array(0, 0, 0, 25),
                            'legendBackgroundColorStops' => array(array(0, 'rgb(217, 217, 217)'), array(1, 'rgb(255, 255, 255)')),
                            'tooltipEnabled' => TRUE,
                            'tooltipFormatter' => $tooltipFormatFunction,
                            'xAxisLabelsEnabled' => TRUE,
                            'xAxisLabelsAlign' => 'right',
                            'xAxisLabelsStep' => 1,
                            'xAxislabelsX' => 5,
                            'xAxisLabelsY' => 20,
                            'xAxisCategories' => [$b['date_part']],
                            'yAxisTitleText' => 'Admin',
                            'plotOptionsLineDataLabelsEnabled' => TRUE,
                            'plotOptionsLineEnableMouseTracking' => TRUE,
                            'enableAutoStep' => FALSE
                        )
                    );
                }//end if

            }//end foreach

        if (isset($b['admin'])) {
            echo $b['admin'];
            $series = $this->HighCharts->addChartSeries();
            $series->addName($user)->addData([(int)$b['admin']]);
            $mychart->addSeries($series);
        }

    }

Array sent from Android to PHP via $_POST getting mucked up in transit

This problem is driving me crazy and I have no idea how to fix it. I have an Android program to gather all names and phone numbers into an array (basic key-value pairs) and then send that array over to a PHP script. The PHP script then parses the values received in a $_POST and inserts them into a MySQL table. Everything works fine except that the data doesn't always come as posted. For instance, some numbers get paired with names they don't belong to. Here's a snippet of my PHP:

$ar = 0;
foreach($_POST as $entry){
    echo $ar.". ".$_POST[$ar]."\n";
    $namenum = explode(',', $entry);
    $names[$ar] = $namenum[1];
    $numbers[$ar] = $namenum[0];
    echo $ar.". ".$numbers[$ar]."--->".$names[$ar]."\n"; 
    $ar += 1;
}
$namenum = NULL;
//$ar = NULL;

The above snippet is right at the beginning of the script and there's nothing to tamper with $_POST. The echo within the loop is to test this exact thing and that's how I discovered the problem. The weirdest part is that most of the time, the data received is exactly as sent. But then at times I suddenly notice a couple of numbers getting either mixed up with wrong names or disappearing altogether. I must also add that each time I have tested the program, I've done it on the same device, using the same contact list. Everything remains the same between test runs and yet results vary at random. The gremlins seem to be appearing in transit! Is this a known issue with $_POST or sending arrays in general? If so, what alternatives do I have? I can think of JSON or text files but would that ensure better data fidelity?

jQuery autocomplete - assigning one JSON PHP array to multiple HTML ID tags

I have successfully setup a jQuery autocomplete call from a PHP file using JSON encode. I am successfully sending a KVP (Key Value Pair) array back to my HTML.

The issue I have, is that I wish to send part of the array items to one id="sometag1" and the other array items to id="sometag2" and id="sometag3".

Here is my javascript jquery code:

jQuery(document).ready(function(data) {
    $('#edit-ad-location').autocomplete({
        source: '/postcodes-latlong.php',
        minLength: 2
    });
});

The file "postcodes-latlong.php" contains the following code:

$rs = mysql_query('select p.ID, p.post_title, m.* FROM wp_posts p, wp_postmeta m WHERE p.ID = m.post_id AND p.post_title like "' . mysql_real_escape_string($_REQUEST['term']) . '%" AND meta_value is NOT NULL AND meta_value !="" AND (meta_key = "_aphs_FYN_latitude" OR meta_key = "_aphs_FYN_longitude") order by post_title limit 0,25', $dblink);
$this_row = "";
// loop through each postcode returned and format the response for jQuery
$data = array();
if ($rs && mysql_num_rows($rs)) {
    while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
        $new_row = $row['post_title'];
        if ($new_row != $this_row) {
            $data[] = array(
                'id' => $row['meta_id'],
                'label' => $row['post_title'],
                'value' => $row['post_title']
            );
        }
        if ($row['meta_key'] == "_aphs_FYN_latitude") {
            $data[] = array_push($data, array(
                'id' => 'geo-search-lat',
                'value' => $row['meta_value']
            ));
        }
        if ($row['meta_key'] == "_aphs_FYN_longitude") {
            $data[] = array_push($data, array(
                'id' => 'geo-search-lng',
                'value' => $row['meta_value']
            ));
        }
        $this_row = $row['post_title'];
    }
}
// jQuery wants JSON data
echo json_encode($data);
flush();

And if the term 4503 is passed, we get the following returning array:

[{
    "id": "384047",
    "label": "4503, DAKABIN",
    "value": "4503, DAKABIN"
}, {
    "id": "geo-search-lat",
    "value": "-27.226474"
}, 2, {
    "id": "geo-search-lng",
    "value": "152.980732"
}, 4, {
    "id": "384062",
    "label": "4503, GRIFFIN",
    "value": "4503, GRIFFIN"
}, {
    "id": "geo-search-lat",
    "value": "-27.272654"
}, 7, {
    "id": "geo-search-lng",
    "value": "153.025911"
}, 9, {
    "id": "384077",
    "label": "4503, KALLANGUR",
    "value": "4503, KALLANGUR"
}, {
    "id": "geo-search-lat",
    "value": "-27.25075"
}, 12, {
    "id": "geo-search-lng",
    "value": "152.992606"
}, 14, {
    "id": "384092",
    "label": "4503, KURWONGBAH",
    "value": "4503, KURWONGBAH"
}, {
    "id": "geo-search-lat",
    "value": "-27.225828"
}, 17, {
    "id": "geo-search-lng",
    "value": "152.947552"
}, 19, {
    "id": "384107",
    "label": "4503, MURRUMBA DOWNS",
    "value": "4503, MURRUMBA DOWNS"
}, {
    "id": "geo-search-lat",
    "value": "-27.258672"
}, 22, {
    "id": "geo-search-lng",
    "value": "153.006916"
}, 24, {
    "id": "384122",
    "label": "4503, WHITESIDE",
    "value": "4503, WHITESIDE"
}, {
    "id": "geo-search-lat",
    "value": "-27.255364"
}, 27, {
    "id": "geo-search-lng",
    "value": "152.929729"
}, 29]

What I am trying to achieve, is send the ID, label and value (i.e. post_id, postcode, and suburb name) to the autocomplete field with id: "#edit-ad-location" and this works fine. But, I wish to send the latitude and longitude values to two other id tags #geo-search-lat and #geo-search-lng as shown below:

<div .... id="geo-search-lat" value=""> </div>

and

<div .... id="geo-search-lng" value=""> </div>

I have tried a number of approaches including converting the PHP JSON array to a Javascript array also trying to pass the JSON array as PHP array rather than JSON...

But I am struggling to glue all this together.

Is there a simple way to parse the array so that part of the KVP's go to one ID tag, and the rest goes to two other ID tags?

Something along the lines of:

jQuery(document).ready(function(data){
    $('#edit-ad-location', '#geo-search-lat', '#geo-search-lng').autocomplete({source:'/postcodes-latlong.php', minLength:2});
});

But if I try this approach returns an error.

You can try sending australian postcodes to the following URL and test it for yourslef:

http://ift.tt/1ckqpn9

Where XXXX is any integer from 0 to 9999.

Any help is appreciated.

Cheers, Henry

Need help accessing JSON array object

Objective: This code collects an array JSONAPIS and passes the APIS into a $.each() loop. Then JSON data field are evaluated in if statements and used to calculate precip. How do I access the JSONAPIS from the obj. Main issue: obj.daily.data.length is undefined on the daily array member. The obj should contain one of the API calls and the JSON dataset to use. Instead it contains keyword like abort, always, promise which I am not familiar how to use. What would access the result JSON object property?

var listAPIs = "";
    var darkForecastAPI = [];
    var result = [];
    var JSONAPIS = [];
$.each(numDaysAPITimes, function(a, time) {
    var darkForecastAPI = /*"http://ift.tt/1eU3pXU" + currentAPIKey + "/history_" + time + "/q/" + state + "/" + city +".json?callback=?"; */
        "http://ift.tt/1JmMFqC" + currentAPIKey + "/" + city + time + "?callback=?";
    //http://ift.tt/1iYC1hI
    JSONAPIS.push($.getJSON(darkForecastAPI, {
        tags: "WxAPI[" + i + "]", //Is this tag the name of each JSON page? I tried to index it incase this is how to refer to the JSON formatted code from the APIs.
        tagmode: "any",
        format: "json"
    }));
});
$.when(JSONAPIS).then(function(result) { /*no log simply an array */
    var eachPrecipSum = 0.0;
    var totalPrecipSinceDate = 0.0;
    alert(result);

    $.each(result, function(d, obj) {
        for (var c = 0; c <= obj.daily.data.length - 1; c++) {
            if (obj.daily.data[c].precipIntensity >= 0.0000 && obj.daily.data[c].precipType == "rain") /*Number(result.history.dailysummary.precipm, result.history.dailysummary.rain*/ {
                eachPrecipSum = result[d].daily.data[c].precipIntensity;
                totalPrecipSinceDate = eachPrecipSum + totalPrecipSinceDate; ///Write mean precip
                alert(Math.round(eachPrecipSum * 10000) / 10000);
                $("body").append("p").text("There has been as least a total of " + Math.round(totalPrecipSinceDate * 10000) / 10000 + " inches per hour of rain at the location in the last " + userDataDatePick + " days")

            } else if (obj.daily.data[c].precipIntensity >= 0.0000 && obj.daily.data[c].precipType != "rain") {
                alert("There is was no rain on ____" /*+ result.history.dailysummary.mon + "/" + result.history.dailysummary.mday + "/" + result.history.dailysummary.year*/ );
            }
        }
    });
});
numDaysAPITimes = 0;

}

Bank Account Java Program

I am creating a bank account program for my java class that is suppose to manage up to 5 different bank accounts. The program has to allow the creation of a new account, which I have done, allow deposit and withdraw, which is also done, the 2 parts I cannot get to work are 1: the bank can only have up to 5 accounts, so if a 6th is trying to be created, a message comes up saying that 5 are already created, and 2: one of the options has to print out all the account balances of current accounts in the bank.

This is my code as of now:

import java.util.Scanner;
public class Bankapp {

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    Bank myBank = new Bank();

    int user_choice = 2;


    do {
        //display menu to user
        //ask user for his choice and validate it (make sure it is between 1 and 6)
        System.out.println();
        System.out.println("1) Open a new bank account");
        System.out.println("2) Deposit to a bank account");
        System.out.println("3) Withdraw to bank account");
        System.out.println("4) Print account balance");
        System.out.println("5) Quit");
        System.out.println();
        System.out.print("Enter choice [1-5]: ");
        user_choice = s.nextInt();
        switch (user_choice) {
            case 1: 
                System.out.println("Enter a customer name");
                    String cn = s.next();
                    System.out.println("Enter a opening balance");
                    double d = s.nextDouble();
                    System.out.println("Account was created and it has the following number: " + myBank.openNewAccount(cn, d));
                    break;
            case 2: System.out.println("Enter a account number");
                    int an = s.nextInt();
                    System.out.println("Enter a deposit amount");
                    double da = s.nextDouble();
                    myBank.depositTo(an, da);
                    break;
            case 3: System.out.println("Enter a account number");
                    int acn = s.nextInt();
                    System.out.println("Enter a withdraw amount");
                    double wa = s.nextDouble();
                    myBank.withdrawFrom(acn, wa);
                    break;
            case 4: System.out.println("Enter a account number");
                    int anum = s.nextInt();
                    myBank.printAccountInfo(anum);
                    break;
            case 5:
                    System.out.println("Here are the balances " + "for each account:");
            case 6:
                System.exit(0);
        }
}
while (user_choice != '6');
}

static class Bank {
private BankAccount[] accounts;     // all the bank accounts at this bank
private int numOfAccounts = 5;      // the number of bank accounts at this bank

// Constructor: A new Bank object initially doesn’t contain any accounts.
public Bank() {
    accounts = new BankAccount[5];
    numOfAccounts = 0;
    }

// Creates a new bank account using the customer name and the opening balance given as parameters
// and returns the account number of this new account. It also adds this account into the account list
// of the Bank calling object.
public int openNewAccount(String customerName, double openingBalance) {

    BankAccount b = new BankAccount(customerName, openingBalance);
    accounts[numOfAccounts] = b;
    numOfAccounts++;
    return b.getAccountNum();
}

// Withdraws the given amount from the account whose account number is given. If the account is
// not available at the bank, it should print a message.
public void withdrawFrom(int accountNum, double amount) {
    for (int i =0; i<numOfAccounts; i++) {
        if (accountNum == accounts[i].getAccountNum()  ) {
            accounts[i].withdraw(amount);
            System.out.println("Amount withdrawn successfully");
            return;
        }
    }
    System.out.println("Account number not found.");
    }

// Deposits the given amount to the account whose account number is given. If the account is not
// available at the bank, it should print a message.
public void depositTo(int accountNum, double amount) {
    for (int i =0; i<numOfAccounts; i++) {
        if (accountNum == accounts[i].getAccountNum()  ) {
            accounts[i].deposit(amount);
            System.out.println("Amount deposited successfully");
            return;
        }
    }
    System.out.println("Account number not found.");
}

// Prints the account number, the customer name and the balance of the bank account whose
// account number is given. If the account is not available at the bank, it should print a message.
public void printAccountInfo(int accountNum) {
    for (int i =0; i<numOfAccounts; i++) {
                if (accountNum == accounts[i].getAccountNum()  ) {
                    System.out.println(accounts[i].getAccountInfo());
                    return;
                }
            }
    System.out.println("Account number not found.");
}


public void printAccountInfo(int accountNum, int n) {
    for (int i =0; i<numOfAccounts; i++) {
                        if (accountNum == accounts[i].getAccountNum()  ) {
                            System.out.println(accounts[i].getAccountInfo());
                            return;
                        }
                    }
    System.out.println("Account number not found.");
    }

}





  static class BankAccount{

       private int accountNum;
       private String customerName;
       private double balance;
       private  static int noOfAccounts=0;

       public String getAccountInfo(){
           return "Account number: " + accountNum + "\nCustomer Name: " + customerName + "\nBalance:" + balance +"\n";
       }


       public BankAccount(String abc, double xyz){
         customerName = abc;
         balance = xyz;
         noOfAccounts ++;
         accountNum = noOfAccounts;
       }

    public int getAccountNum(){
        return accountNum;
    }
    public void deposit(double amount){

        if (amount<=0) {
            System.out.println("Amount to be deposited should be positive");
        } else {
            balance = balance + amount;

        }
    }
    public void withdraw(double amount)
    {
        if (amount<=0){
             System.out.println("Amount to be withdrawn should be positive");
         }
        else
        {
            if (balance < amount) {
                System.out.println("Insufficient balance");
            } else {
                balance = balance - amount;

            }
        }
    }

}//end of class

The program runs fine, I just need to add these two options, and cannot get them to work properly, how would I go about doing this? Also, options 3 and 4 should not work if no accounts have been created yet. Thanks in advance.

Comparing 2-dimension arrays in VB Excel

I'm trying to compare two 2d arrays in VBA Excel.

Source:

1 2 3 4

4 5 6 2

3 3 4 4

Target:

4 5 3 2

1 2 3 4

3 7 7 5

Given the above two 2-d arrays which I will call source and target I want to compare each row from source with entire target and check if it exists in target. For Example row 1 from source (1 2 3 4) would be considered a match as it would found in target (at row 2). So I need to compare each row in target for a given row from source. If row in source does not exist in target then I will need to make note of this some how in order to mark as not existing in target.

Something on the lines of (not actual code just idea):

For i to ubound(srcArray)
    isFound = False
    For j To ubound(trgArray)
        If srcArray(i) = trgArray(j) Then
            isFound = True

    If Not isFound Then
        //make note of some sort

I know approach worked ok for single dim. array. But trying to do this for 2d arrays in some sort of loop in VB or other method. Not too familiar with VB in Excel. I would also like to look at each row as entire array if possible rather than comparing each element for each array individually.

How can I give a certain row of elements all the same value? Using a 2d array?

If I have

String[][] trenches = new String[10][10];

How can i make all elements in row 0 have the value of "X" ? or all elements in row 1 have the value of "0" ?

I have 2 errors compiling my java Lottery program using arrays

import java.util.Random;
import java.util.Scanner;

public class LotteryGame{

public static void main(String[] args) {

    int NUM_DIGITS = 6;

    int[] userDigits = new int[NUM_DIGITS];
    int[] lotteryNumbers = new int[NUM_DIGITS];
    int sameNum;

    generateNumbers(lotteryNumbers);
    getUserData(userDigits);
    sameNum = compareArrays(lotteryNumbers, userDigits);

    System.out.println("Winning numbers: " + lotteryNumbers[0] + " "
            + lotteryNumbers[1] + " " + lotteryNumbers[2] + " "
            + lotteryNumbers[3] + " " + lotteryNumbers[4] + " " + lotteryNumbers[5] + " ");

    System.out.println("Your numbers:  " + userDigits[0] + " "
            + userDigits[1] + " " + userDigits[2] + " " + userDigits[3]
            + " " + userDigits[4] + " " + userDigits[5] +" ");
    System.out.println("Number of matching digits: " + sameNum);

    if (sameNum == 6) {
        System.out.println("First prize!!!");
    }

    if (sameNum == 5) {
        System.out.println("Second prize!!!");
    }
    if (sameNum == 0) {
        System.out.println("No matching numbers, you lost.");
    }

}

public static void generateNumbers(int[] lotteryNumbers) {

    Random randNum = new Random();

    lotteryNumbers[0] = randNum.nextInt(59);
    lotteryNumbers[1] = randNum.nextInt(59);
    lotteryNumbers[2] = randNum.nextInt(59);
    lotteryNumbers[3] = randNum.nextInt(59);
    lotteryNumbers[4] = randNum.nextInt(59);
    lotteryNumbers[5] = randNum.nextInt(59);

    return lotteryNumbers[5];
}

public static void getUserData(int[] userDigits) {
    Scanner keyboard = new Scanner(System.in);

    System.out.print("Enter first digit: ");
    userDigits[0] = keyboard.nextInt();
    System.out.print("Enter second digit: ");
    userDigits[1] = keyboard.nextInt();
    System.out.print("Enter third digit: ");
    userDigits[2] = keyboard.nextInt();
    System.out.print("Enter fourth digit: ");
    userDigits[3] = keyboard.nextInt();
    System.out.print("Enter fifth digit: ");
    userDigits[4] = keyboard.nextInt();
    System.out.print("Enter sixth digit: ");
    userDigits[5] = keyboard.nextInt();



    return userDigits[5];
}

public static int compareArrays(int[] userDigits, int[] lotteryNumbers) {
    int sameNum = 0;

    for (int i = 0; i < 6; i++) {
        for (int x = 0; x < 5; x++) {
            if (lotteryNumbers[i] == userDigits[x]) {
                sameNum++;
            }
        }
    }
    return sameNum;
}

}

When I compile I get the following errors-

   LotteryGame.java:51: error: incompatible types: unexpected return value
       return lotteryNumbers[5];
                         ^
   LotteryGame.java:72: error: incompatible types: unexpected return value
    return userDigits[5];
                     ^
      2 errors

Can any of you help me with these compilation errors? I'm trying to get this to work. The user is supposed to input 6 numbers, and the program is supposed to pick randomly 6 numbers. Using these numbers, the program will compare the numbers with echoed input.

Sorting Array by biggest number

This is my unsorted array:

P  B    A 
5  125  400
2  102  145
3  56   200
6  65   200
7  30   200
4  148  300
1  135  0

This is what my current array has after I sorted it this is the output I get

P  B    A 
1  135  0  
4  148  0  
3  56  100  
2  102  100  
6  65  200  
5  125  200 

I want my array to sort B by the biggest number depending A like this example.

P  B    A 
4  148  0    
1  135  0  
2  102  100 
3  56  100  
5  125  200    
6  65  200

This is currently my code

 Arrays.sort(x, new Comparator<int[]>() {
                public int compare(int[] o1, int[] o2) {
                    int ret = Integer.compare(o1[2], o2[2]);
                    // if the entries are equal at index 2, compare index 1
                    if (0 == ret) {
                        ret = Integer.compare(o1[1], o2[1]);
                    }
                    return (ret);
                }
            });

How would i preform the tasks below in android studio?

1) Create a one dimensional array with 12 elements 2) set the first array values to be one 3) set every following array value to be the sum of the two before it 4) walk through the array and add up every element >= 10. 5) display the result as a toast message

I am having trouble doing this. I am very new to the android software and it would be great for some help.

Compute average of numpy array stack in Apache Spark

I'm working with large GeoTiff files and have loaded each GeoTiff as a numpy array, and then created an array-stack of the GeoTiffs:

GeoTiff_list = []
for i in range(1,n+1):
    GeoTiff_list.append(GeoTiff_i)
GeoTiff_array_stack = np.array(GeoTiff_list)  

Then I just want to compute the average by pixel across the stack of images. In numpy this can be done as follows:

average_GeoTiff = GeoTiff_array_stack.mean(axis=0)

I'd like to repeat this computation in spark. I know there are some projects in the pipeline, such as GeoTrellis, that will make this trivial...but I'm not sure how I can do it using whatever is currently available.

I presume I can parallelize the array as follow:

sc.parallelize(GeoTiff_array_stack)

But then I'm not sure how to compute the mean of this array. This is probably trivial in MLlib, but it seems like pyspark isn't up to speed with the the other spark APIs.

PHP: how to remove the last line break from the text file?

In a school work, I built a site for a fictional space museum in my city using PHP. It has a Data Inclusion and Data Consultation systems, but I have a problem with the consultation that I want to know how to solve: how to delete the last line break from the file?

Data Inclusion

In the restricted area of the site, I have a HTML5 form with 5 fields (name, addres, telephone number, sex and visited exhibitions) that sends the data by the method POST to a function in PHP that writes it on a given txt file by using the fwrite command:

fwrite ($pointer, "$name | $addres | $telephone | $sex | $exhibitions " .PHP_EOL);

As you can see, it writes in a txt file the data entered on the form, plus a line break. The pointer is the variable used by fopen to open the file that I need to work. Example of output:

Márcio Aguiar | Belmiro Braga Street | 1234-5678 | M | Planets of Solar System
Joana Tobias | Santos Dummont Avenue | 8765-4321 | F | Black Holes, Satellites

Data Consultation

Then there is a consultation system. It has a loop that runs until the file ends. Inside this loop there is a variable named $buffer that gets one line of the txt file each time. It is then exploded to create a array named $lines[$counter]. To print it nicely, I use a array_combine where I join the names of the fields on another array ($keys) to the values written in $lines[$counter], and attibutes that to $combined[$counter]. Then the loop ends and I use a print_r inside <pre></pre> to see the data written in $combined, while mantaining the spaces and breaks that HTML would otherwise ignore. Here is the code:

$keys = array ("Name", "Address", "Telephone", "Sex", "Visited exhibition");
for ($counter=0;!feof($reader);$counter++){
    $buffer = fgets($reader);
    $lines[$counter] = explode(" | ", $buffer);
    $combined[$counter] = array_combine($keys, $lines[counter]
}
echo "<pre>";
print_r($combined);
echo "</pre>";

Example of output:

    Array
    (
    [0] => Array
        (
            [Name] => Márcio Aguiar
            [Address] => Belmiro Braga Street
            [Telephone] => 1234-5678
            [Sex] => M
            [Visited exhibitions] => Planets of Solar System 

        )

    [1] => Array
        (
            [Name] => Joana Tobias
            [Address] => Santos Dummont Avenue
            [Telephone] => 8765-4321
            [Sex] => F
            [Visited exhibitions] => Black Holes, Satellites 

        )

    [2] => 
    )

Here you can see that a 2 Array was created blank. It's caused by the last line, that contains only a line break inserted by the form above. I need to remove this last line break, and only that one, but don't know how. I want to know! Not knowing causes the exhibition of an error when the execution arrive at the array_combine, because it's needed that the two arrays have the same number of elements, and 2 is blank. Here the error:

Warning: array_combine(): Both parameters should have an equal number of elements in E:\Aluno\Documents\Wamp\www\trab_1\area_restrita\consulta.php on line 60

Xcode 6.3.1 Swift - How to copy array by value

I am trying to copy an array and its values. Why are both arrays referencing the same variable? You can try this in Playground.

var view = UIView()
view.tag = 1

var a = [UIView]()
var b = [UIView]()

a.append(view)

b = a
view.tag = 2

a[0].tag // value is 2
b[0].tag // value is 2?

Array contents as a variable

Noob question here, I've got all this data in an array, but I can't figure out how to do anything with it. I need to use one element in a SQL update query, the other element is just for display purposes only. This works:

<cfset RecID=[]>
<cfset DistListNames=[]>    
<cfloop list="#form.ListName#" index="listcount">    
<cfset arrayAppend(RecID, listFirst(listcount,":"))>
<cfset arrayAppend(DistListNames, listLast(listcount, ":"))>    
</cfloop>    
<cfdump var=#RecID#>    
<cfdump var=#DistListNames#>

But other than displaying those little green boxes on the action page, I can't do anything with it. How do I set variables from the contents of RecID and DistListNames?

Thanks

Using String Array As Object Argument

So I have a class that has an argument of a string array. What I want to do is store multiple strings to this array that is part of this class. The code looks something like this:

//Class part of it. Class is called "Event"//

public class Event
{
   public string [] seats= new string [75];

   public Event(string[] seats)
   {
      this.seats=seats;
   }
}

// the main code that uses said Class

string[]seatnumber=new string[75];
Event show= new Event (seatnumber[]); //And that is where the error comes in. 

Any help would be greatly appreciated!

Converting C Program To CUDA (Max Reduction)

I am new to CUDA and trying to get a grasp for the basic so I apologize if something I ask or say sounds overly simple.

EDIT: Using the code provided by Robert Crovella below I am trying to convert the code to use multiple threads rather than one.

I have come up with the following code:

#include <stdio.h>
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <cuda.h>

#define num 100000

#define cudaCheckErrors(msg) \
    do { \
        cudaError_t __err = cudaGetLastError(); \
        if (__err != cudaSuccess) { \
            fprintf(stderr, "Fatal error: %s (%s at %s:%d)\n", \
                msg, cudaGetErrorString(__err), \
                __FILE__, __LINE__); \
            fprintf(stderr, "*** FAILED - ABORTING\n"); \
            exit(1); \
        } \
    } while (0)


int *arr,my_max = -1;

int getRand() {
    double r1=rand()/(double)RAND_MAX; // Generates value between 0 & 1
    return (r1 * num) + 1;
}
void generateRandom(int M) {
    int i;
    for(i=0;i<M;i++) {
        arr[i] = getRand();
    }
}
__global__ void getMax(int M, int *dArr, int *dMax) {
    int id = threadIdx.x;
    int numberThisThread = M / 32;
    int start = numberThisThread * id;
    int end = numberThisThread * (id + 1);
    for(int i=start;i<end;i++) {
        int a = dArr[i];
        if(a > *dMax)
            *dMax = a;
        }
}

int main(int argc, char *argv[] ){
    if (argc == 2) {
        int M;
        int *devArr, *devMax;
        /* initialize random seed: */
        srand (time(NULL));
        M = atoi(argv[1]);
        //int arr[M];
        arr = (int*)calloc(M,sizeof(int));
        cudaMalloc(&devArr,M*sizeof(int));
        cudaCheckErrors("cudaMalloc 1 fail");
        cudaMalloc(&devMax,sizeof(int));
        cudaCheckErrors("cudaMalloc 2 fail");
        cudaMemset(devMax, 0, sizeof(int));
        cudaCheckErrors("cudaMemset fail");
        //printf("M = %d MAX = %d\n", M, RAND_MAX);

        generateRandom(M);
        cudaMemcpy(devArr, arr, M*sizeof(int), cudaMemcpyHostToDevice);
        cudaCheckErrors("cudaMemcpy 1 fail");
        getMax<<<64,1>>>(M, devArr, devMax);
        cudaMemcpy(&my_max, devMax, sizeof(int), cudaMemcpyDeviceToHost);
        cudaCheckErrors("cudaMemcpy 2/kernel fail");
        printf("Max value: %d \n", my_max);

    }

    else
        printf("Invalid arguments.");

    return 0;
}

My idea in the implementation was to divide the amount of input by the amount of threads and have each thread compute its own section. This code just hangs though and does not produce any output.

C Programming structs runtime error

Line that has been commented out in createStructs() is giving me the error in question. I am trying to scan in a list of information from a textfile and it is giving me a program crash. It loads the file but then crashes for a reason I cannot figure out. Here is my code. When it crashes it loads out the output, but in a really, weird, manner.Can anyone lend a hand? ty! also how can i get it to format my output correctly? It like jumps everywhere.

#define MAX 71
#define SIZE 14

typedef struct {
char first[7]; 
char initial[1]; 
char last[9]; 
char street[16]; 
char city[11];
char state[2]; 
int zipcode[5]; 
int age; 
char sex[1]; 
int tenure; 
double salary;

} Employee;
insert main method just calling the functions
void strsub(char buf[], char sub[], int start, int end) {
int i, j = 0;


for (j = 0, i = start; i <= end; i++, j++) {
    sub[j] = buf[i];
}
sub[j] = '\0';

}

void createStructs(Employee inWorkers[]) {
int i = 0;
char buf[MAX];
char temp[SIZE];
if (!(fp = fopen("payfile.txt", "r"))) {
    printf("payfile.txt could not be opened for input.");
    exit(1);
}

while (!(feof(fp))) {
    fgets(buf, MAX, fp);
    strsub(buf, inWorkers[i].first, 0, 6);
    strsub(buf, inWorkers[i].initial, 8, 8);
    strsub(buf, inWorkers[i].last, 10, 18);
    strsub(buf, inWorkers[i].street, 20, 35);
    strsub(buf, inWorkers[i].city, 37, 47);
    strsub(buf, inWorkers[i].state, 49, 50);
    strsub(buf, temp, 52, 56);
    //inWorkers[i].zipcode = atoi(temp);
    strsub(buf, temp, 58, 59);
    inWorkers[i].age = atoi(temp);
    strsub(buf, inWorkers[i].sex, 61, 61);
    strsub(buf, temp, 63, 63);
    inWorkers[i].tenure = atoi(temp);
    strsub(buf, temp, 65, 70);
    inWorkers[i].salary = atof(temp);
    i++;
}

}

    void printNames(Employee workers[]) {
for (int i = 0; i < SIZE; i++) {
    printf("%s %s %s %s %s %s %d %d %s %d %.2lf", workers[i].first, workers[i].initial, workers[i].last,
        workers[i].street, workers[i].city, workers[i].state, workers[i].zipcode, workers[i].age,
        workers[i].sex, workers[i].tenure, workers[i].salary);
}

}

Issue with getting data when traversing through an array PHP with a variable

I asked a similar question earlier but I couldn't get a clear answer to my issue. I have a function "isParent" that gets 2 pieces of data. Each 1 of the 2 gets a string separating each value with a , or it just gets a plain int and then checks if the first value given is a parent of the second.

I pull the 2 bits of data in and explode them but when I go through my nested for loop and try to test $toss = $arr1[$i]; print_r($toss); It comes up blank. I have no idea what the issue is: Here is the full code of the function...

function isParent($parent, $child)
{

    $parentArr = explode(',', $parent);
    $childArr = explode(',',$child);

    //Explode by Comma here. If array length of EITHER parentArr or childArr > 1 Then throw to an Else
    if(count($parentArr) <= 1 && count($childArr) <= 1) //If explode of either is > 1 then ELSE
    {
$loop = get_highest_slot(15);

for($i = $loop; $i > 0; $i--)
{
        $temp = get_membership_from_slot($i,'id_parent','id_child');

    if($temp['id_parent'] == $parent && $temp['id_child'] == $child)
    {
        return 1;
    }

}
    }
    else //set up a for loop in here so that you traverse each parentArr value and for each iteration check all child values
    {
        $i = count($parentArr);

        $c = count($childArr);

        for(;$i >=0;$i--) //Loop through every parent
        {

            for(;$c >=0;$c--)
            {
                echo '<br>$i = ';
                print_r($i);
                echo '<br><br>Parent Arr at $i:';
                $toss = $parentArr[$i];
                echo $toss;
                echo '<br>';
                print_r($childArr);
                echo '<br><br>';



                if(isParent($parentArr[$i],$childArr[$c])) //THIS CAUSES AN INFINITE YES! Learn how to pull an array from slot
                {   
                    return 1;
                }

            }


        }


    }


return 0;




}

Laravel - can't get values from multidimensional array with blade

I am having trouble looping through a multidimensional array with blade in laravel. I am sending the data from the controller like so:

return View::make('store.categories')
            ->with('brands', $brands);

And if I die dump the data:

array (size=2)
  0 => 
    array (size=2)
      0 => string 'Fender' (length=6)
      1 => string '(2)' (length=3)
  1 => 
    array (size=2)
      0 => string 'Gibson' (length=6)
      1 => string '(1)' (length=3)

I've tried to use two @foreach loops but I couldn't get it to work:

@foreach($brands as $brand)
  @foreach($brand as $b)
  {{$b}}
  @endforeach
@endforeach

The above will output: Fender (2) Gibson (1).


I tried to get the 0 value for the $b to output Fender but it just prints the 0 position character for each of the items in the $b array:
@foreach($brands as $brand)
  @foreach($brand as $b)
  {{$b[0]}}
  @endforeach    
@endforeach

The above will output F ( G (.

I'm probably doing something terribly wrong. How can I get the output for the values 0 and 1 for the nested arrays individually? Any help is highly appreciated.

How to display event handler

ReservationsGUI.java

public class ReservationsGUI extends javax.swing.JFrame {
    private Object OutputPane;

/**
 * Creates new form ReservationsGUI
 */
public ReservationsGUI() {
    initComponents();
}


@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
private void initComponents() {

    nameTextField = new javax.swing.JTextField();
    nameLabel = new javax.swing.JLabel();
    phoneNumberLabel = new javax.swing.JLabel();
    phoneNumberTextField = new javax.swing.JTextField();
    numberInPartyLabel = new javax.swing.JLabel();
    timeLabel = new javax.swing.JLabel();
    reserveButton = new javax.swing.JToggleButton();
    reservationsLabel = new javax.swing.JLabel();
    reservationsTextField = new javax.swing.JTextField();
    displayAllButton = new javax.swing.JToggleButton();
    numberCombo = new javax.swing.JComboBox();
    timeCombo = new javax.swing.JComboBox();
    jMenuBar2 = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    clearMenuItem = new javax.swing.JMenuItem();
    exitMenuItem = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    nameTextField.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            nameTextFieldActionPerformed(evt);
        }
    });

    nameLabel.setText("Name:");

    phoneNumberLabel.setText("Phone Number:");

    phoneNumberTextField.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            phoneNumberTextFieldActionPerformed(evt);
        }
    });

    numberInPartyLabel.setText("Number in Party");

    timeLabel.setText("Time");

    reserveButton.setText("Reserve");
    reserveButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            reserveButtonActionPerformed(evt);
        }
    });

    reservationsLabel.setText("Tonight's Reservations");

    displayAllButton.setText("Display All");
    displayAllButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            displayAllButtonActionPerformed(evt);
        }
    });

    numberCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
    numberCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            numberComboActionPerformed(evt);
        }
    });

    timeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "5:30", "5:45", "6:00", "6:15", "6:30", "6:45", "7:00", "7:15", "7:30", "7:45", "8:00", "8:15", "8:30", " " }));
    timeCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            timeComboActionPerformed(evt);
        }
    });

    fileMenu.setText("File");

    clearMenuItem.setText("Clear");
    clearMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clearMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(clearMenuItem);

    exitMenuItem.setText("Exit");
    exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(exitMenuItem);

    jMenuBar2.add(fileMenu);

    setJMenuBar(jMenuBar2);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(nameLabel)
                                .addComponent(phoneNumberLabel))
                            .addGap(27, 27, 27)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(phoneNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(numberCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(timeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addComponent(numberInPartyLabel)
                        .addComponent(timeLabel)))
                .addGroup(layout.createSequentialGroup()
                    .addGap(45, 45, 45)
                    .addComponent(reserveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(reservationsLabel)
                    .addGap(40, 40, 40)
                    .addComponent(displayAllButton)
                    .addGap(144, 144, 144))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(reservationsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 370, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(39, 39, 39))))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(reservationsLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nameLabel)
                    .addComponent(nameTextField)
                    .addComponent(displayAllButton)))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(phoneNumberLabel)
                        .addComponent(phoneNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(numberInPartyLabel)
                        .addComponent(numberCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(timeLabel)
                        .addComponent(timeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(reserveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(reservationsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(67, 67, 67))
    );

    pack();
}// </editor-fold>                        

private void phoneNumberTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                                     
    // TODO add your handling code here:
}                                                    

private void nameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                              
    // TODO add your handling code here:
}                                             

private void clearMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                              
     if(JOptionPane.showConfirmDialog(null,"Are you sure ","Request",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION)
     {  
        reservationsTextField.setText("");
        nameTextField.setText("");
        phoneNumberTextField.setText("");
     }


}                                             

private void numberComboActionPerformed(java.awt.event.ActionEvent evt) {                                            


}                                           

private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
   if(JOptionPane.showConfirmDialog(null,"Are you sure ","Request",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION)
     {  
          System.exit(0);
     }

}                                            

private static String getFilename()
{
    String filename;

    Date today = new Date();
    SimpleDateFormat dateFormat = new SimpleDateFormat("MMddyyyy");
    filename = "C:\\Users\\User\\Documents\\Computer science\\reservations" + dateFormat.format(today) + ".txt";

    return filename;
}
private void reserveButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              

 try {
        String filename=getFilename();

        BufferedWriter outputWriter= new BufferedWriter(new FileWriter(filename));

        if (!nameTextField.getText().equals("") && !phoneNumberTextField.getText().equals(""))
        {
            outputWriter.write("Name: " + nameTextField.getText()); 
            outputWriter.newLine();
            outputWriter.write("Phone number: " + phoneNumberTextField.getText());
            outputWriter.newLine();
            outputWriter.write("Number in Party: " + numberCombo.getSelectedItem());
            outputWriter.newLine();
            outputWriter.write("Time: " + timeCombo.getSelectedItem());;;;;

            outputWriter.flush();
            outputWriter.close();
            JOptionPane.showMessageDialog(null, " Your reservation has been save. You can preview details at " + filename);
            nameTextField.setText("");
            phoneNumberTextField.setText("");
    }
        else 
        {
            JOptionPane.showMessageDialog(null, " Please make sure all your values are filled out");

        }

        }


catch(IOException e){
  e.printStackTrace();

}

}                                             



private void timeComboActionPerformed(java.awt.event.ActionEvent evt) {                                          

}                                         

private void displayAllButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                 

}                                                



 //delete this later
 public static void main(String[] args) {

    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new ReservationsGUI().setVisible(true);
        }

    });

}

// Variables declaration - do not modify                     
private javax.swing.JMenuItem clearMenuItem;
private javax.swing.JToggleButton displayAllButton;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JLabel nameLabel;
private javax.swing.JTextField nameTextField;
private javax.swing.JComboBox numberCombo;
private javax.swing.JLabel numberInPartyLabel;
private javax.swing.JLabel phoneNumberLabel;
private javax.swing.JTextField phoneNumberTextField;
private javax.swing.JLabel reservationsLabel;
private javax.swing.JTextField reservationsTextField;
private javax.swing.JToggleButton reserveButton;
private javax.swing.JComboBox timeCombo;
private javax.swing.JLabel timeLabel;
// End of variables declaration                   
}

Reservation.java

class Reservation {

public String name;
public String phone;
public int numInParty;
public String time;


public Reservation(String name, String phone, int numInParty, String time) {
    this.name = name;
    this.phone = phone;
    this.numInParty = numInParty;
    this.time = time;





    class ReservationsList {

    Reservation[]  reservationsArray;

    public ReservationsList(int arrayLength)
    {
        reservationsArray = new Reservation[arrayLength];
    }

    private void addArrayItem (int index, String name, String phone, int numberInParty, String time)
    {

        Reservation reservation = new Reservation(name, phone, numberInParty, time);
        reservationsArray[index] = reservation;
    }







        //swaps the elements of 2 indices
    public Reservation[] swapElement (Reservation[] a, int index1, int index2){

        Reservation swapVal = a[index1];
        Reservation swapVal2 = a[index2];

        a[index2] = swapVal;
        a[index1]=swapVal2;

        return a;
    }

    //sorts earliest to latest time and calls indexOfMaxInRange
    public Reservation[] sortArray(Reservation[] a){
        for (int i = a.length-1; i<-1; i--){
            int maxIndex = indexOfMaxInRange(a, 0, i);
            a = swapElement(a,i,maxIndex);
        }
        return a;
    }

    //finds the earliest time
    public int indexOfMaxInRange (Reservation[] a, int low, int high){
        int index = low;
        double check = convertTime(a[low].time);

        for(int i=low; i <= high; i++){
            double nextTime = convertTime(a[i].time);
            if (nextTime > check){
                index = i;
                check = nextTime;
            }
        }
        return index;
    }

    //converts time to a double
    public double convertTime (String timeString){
        String[] timeArray = timeString.split(":");

        double hour = Double.parseDouble(timeArray[0]);
        double minute = Double.parseDouble(timeArray[1]);
        double time = hour + minute/60;
        return time;

    }
}

  • Create the ReservationsList object based on the length of the file. When allocating the size of the reservation array, remember that there are four lines in the file for each reservation.
  • Load the ReservationsList array using a helper method as suggested below. Sorts the array based on time
  • Displays the results, formatted, in a text pane. You can use characters "\t" for tab and "\n" for a line feed.
  • private static int getFileLength(String filename)
  • This method needs to open the file, read every line in it using BufferedReader and count them, returning the total number of lines in the file.

    private static void loadArray (String filename, ReservationsList resList)

This method needs to open the file, read every line using BufferedReader and add Reservation objects to the reservations list array.

For these methods, you will need to catch the exceptions that can occur. You can simply print the message in the catch:

System.out.println(e.getMessage());

Okay, so I've basically been able to figure out everything else but I'm confused just putting this together. All I need to do to finish is to just finish the event handler for the the display. Yes it may be homework, but I've done most of I'm not asking for you guys to do it for me, just help with this tiny piece.

System.out.print unknown value

I am making a simple board for a game that I am making. It's printing out

[[Ljava.lang.String;@2a788b76

and i don't know where this is coming from. It might be something stupid that I am doing wrong.

public class AI {

public static String[][] board = new String[10][10];
    public static void addPiece(int x, int y, String r){

        board[x][y] = r;//no need for new String(), board is already made of Strings.
    }
    public static void showBoard(){
        //it's generally better practice to initialize loop counters in the loop themselves
        for (int row = 0; row < 9; row++)
        {
            System.out.println(" ");
            System.out.println("-------------------");    
            for(int col = 0; col < board[row].length; col++)
            {
                System.out.print("|"); //you're only printing spaces in the spots
                if(board[col][row] == null){
                  System.out.print(" ");
                }else{
                  System.out.print(board[col][row]);
                }
            }
        }
        System.out.println(" ");
        System.out.println("-------------------");
    }
    public static void main(String[] args) {
        System.out.println(board);
        addPiece(0,0," ");
        addPiece(0,1,"1");
        addPiece(0,2,"2");
        addPiece(0,3,"3");
        addPiece(0,4,"4");
        addPiece(0,5,"5");
        addPiece(0,6,"6");
        addPiece(0,7,"7");
        addPiece(0,8,"8");
        addPiece(1,0,"1");
        addPiece(2,0,"2");
        addPiece(3,0,"3");
        addPiece(4,0,"4");
        addPiece(5,0,"5");
        addPiece(6,0,"6");
        addPiece(7,0,"7");
        addPiece(8,0,"8");
        addPiece(1,1,"X");  
        addPiece(8,8,"O");
        showBoard();    
    }

}

Decode json and foreach Shows key but not value

I cant seem to get the value from the foreach below. I need to basically create a loop where i can then create html buttons based on selections.

I have also added a snippet example only below this text to show what im trying to achieve within the foreach. I just need to work out how to extract the values so i can do that.

I am basically wanting to create a foreach loop that checks how many buttons the user has added and then display each button within the loop with a link in href and a custom button name. I will also have to check of they chose 1,2,3,4 from the showBtn value to determine what type of html to output.

if showBtn==1 { <a herf="btnMenuLink">btnName</a> }

if showBtn==3 { <a herf="btnPhone">btnName</a> }

I have the following code of which i have provided the outputs of the database content and also a var_dump just so you can see how the information is being stored.

The following code does output the key for me but it wont output the values. And i suspect its because my values are an array as well. How on earth would i create a loop within a loop within a loop and still achieve what i explained above?

<?php

$jsonresult =  $column->links;
$array = json_decode($jsonresult,true);

// The databse TEXT field    
/*{
"showBtn":["3","3"],
"btnMenuLink":["101","101"],
"btnArticleLink":["2","2"],
"btnPhone":["036244789","0404256478"],
"btnURL":["",""],
"btnName":["Office","Mobile"]
}*/

// The Var dump $array    
/*  array(6) {
    ["showBtn"] => array(2) {
        [0] => string(1)
        "3" [1] => string(1)
        "3"
    }["btnMenuLink"] => array(2) {
        [0] => string(3)
        "101" [1] => string(3)
        "101"
    }["btnArticleLink"] => array(2) {
        [0] => string(1)
        "2" [1] => string(1)
        "2"
    }["btnPhone"] => array(2) {
        [0] => string(9)
        "036244789" [1] => string(10)
        "0404256478"
    }["btnURL"] => array(2) {
        [0] => string(0)
        "" [1] => string(0)
        ""
    }["btnName"] => array(2) {
        [0] => string(6)
        "Office" [1] => string(6)
        "Mobile"
    }
} */

foreach($array as $key => $value) { ?>    
<?php echo $key;?>:<?php echo $value;?><hr/>    
<?php } ?>

Recursing through a PHP array and producing the array tree as output

PHP 5.4

My code (based on the manual):

<?php
$myArray = array(
    'level_1' => array(
        1,
        'level_2' => array(
            2
        )
    )
);

$iterator = new RecursiveArrayIterator($myArray); 
iterator_apply($iterator, 'traverseStructure', array($iterator)); 

function traverseStructure($iterator) { 
    while ( $iterator -> valid() ) {
        if ( $iterator -> hasChildren() ) {        
            traverseStructure($iterator -> getChildren());            
        } 
        else { 
            echo $iterator -> key() . ' : ' . $iterator -> current() ."</br>";    
        } 
        $iterator -> next(); 
    } 
} 

Here's my output:

0 : 1
0 : 2

Here's what I would like to see:

level_1 : 0 : 1
level_1 : level_2 : 0 : 2

Any ideas?

how i can make my variable equal any element of my Array?

i have string array country={"USA","ks a","UK","France"}; i have variable String z i want to say if(z.equal(any element of my array (USA or ks or France) but randomly if(z.equal country[i]){

Doing action any code

} can any body help me?

I was wondering how I would put the arrays I have into a textView

so here is the code i have after doing some work. How do i put the three arrays into a textview that will display on my phone. I basically have to create random numbers in an array, add them up and thats the 3rd array

private int[] arrayOne = new int[5], arrayTwo = new int[5], arrayThree = new int[5];

public int randomNumbers(){
    Random rand = new Random();
    return rand.nextInt(20) -10;


}
public void generateArrays(){
    for(int i = 0; i < arrayOne.length; i++) {
        arrayOne[i] = randomNumbers();
        arrayTwo[i] = randomNumbers();

    }


}
public void arraySum(){
    for(int i = 0; i < arrayOne.length; i++){
        int temp = arrayOne[i] + arrayTwo[i];
        if (temp < 0) temp = 0;
        arrayThree[i] = temp;
    }


}

}

Removing objects from an array of Objects

public class SortedListOfImmutables {


 Assume that I already have constructors that create new objects,
 thus have its own items array.

private Listable[] items;

The method below removes an item from the list.If the list contains the same item that the parameter refers to, it will be removed from the list. If the item appears in the list more than once, just one instance will be removed. If the item does not appear on the list, then this method does nothing. @param itemToRemove refers to the item that is to be removed from the list

public void remove(Listable itemToRemove) {

    Listable[] newList = new Listable[items.length - 1];

    int count = 0;

    if(items.length == 0){
        newList[0] = itemToRemove;
    }else {
 /*Compares objects. If they they are equal, I replace the index of items
  * to null. I use int count to make sure that it only makes one object
  * null.
  */
        for(int i = 0; i < items.length; i++){
            while(count == 0){
                if(items[i].equals(itemToRemove)){
                    items[i] = null;
                    count++;
                }
            }
        }
    }

    int changeVar = 0;

 /* Copy all the objects into my newList array. Wherever items is null,
  * skip to the next index of items and put it into newList.
  */
    for(int i = 0; i < newList.length; i++){
        newList[i] = items[i + changeVar];
        if(items[i + changeVar] == null){
            changeVar += 1;
            newList[i] = items[i + changeVar];
        }
    }

    items = newList;

}

When I run this I get a timeout error. What did I do wrong and how can I fix it. Note: I am not allowed to use ArrayList, HashSet, or LinkedList,

Java compare method to sort array for Circular Look disk algorithm

I'm trying to make a custom comparator that will sort an array of integers in the order that a C-LOOK disk algorithm would perform.

I've implemented the Disk Queue as a PriorityQueue and the customer Comparator will be assigned to the Disk Queue list.

I am keeping track of the head position, and utilizing it in the compare method, but it's not quite right.

The first 5 operations added to the queue are [32, 188, 36, 61, 97]. The head position starts at 50. But the first 5 operations after being sorted come out to be [32, 36, 188, 97, 61].

What else should I be doing?

private Comparator<Integer> CLOOK() {

    return new Comparator<Integer>() {

        @Override
        public int compare(Integer o1, Integer o2) {

            if (o1 < o2) {

                if (o1 > currentHeadPosition) {
                    return 1;
                }
                return -1;
            }
            else if (o1 > o2) {

                if (o2 > currentHeadPosition) {
                    return -1;
                }
                return 1;
            }
            else {

                return 0;
            }
        }

    };
}
// End CLOOK Comparator

how to traverse an n-dimensional array with stride

I have an indexing issue that I am trying to solve. I have a n-dimensional array with known shape. I would like to traverse the array with a stride (possibly different in each dim).

With fixed dimensions, I would do this with nested for loops (small arrays) and increment by the stride:

std::vector<int> shape = {10, 10}; // h,w
int num_dim = shape.size();
std::vector<int> stride = {1,2};

for (int i = 0; i< shape[0]; i+=stride[0]} {
    for (int j = 0; j< shape[1]; j+=stride[1]} {
     //print flattened index (row major)
     printf("index: %d\n",i*shape[1]+j);
    }

}

But how would I do this with and n-dimensional array (flattened).

Julia un-initialize array at particular index

Im writing a Neural Network in Julia that tests random topologies. I've left all indices in an array of nodes that are not occupied by a node (but which may be under a future topology) undefined as it saves memory. When a node in an old topology is no longer connected to other nodes in a new topology, is there a way to un initialize the index to which the node belongs. Also, are there any reasons not to do it this way.

Convert array to json file to graph with flot

First I have no clue what I am doing. I am taking readings from 4 sensors. I get an array like this: I need to format and convert it into a json object I guess from reading through here. I then will use flot to draw a graph. That is the goal.

I want a line graph, showing each reading off of the four sensors. I will be using this in python eventually if that helps the direction I am going.

Any direction would be so much appreciated. Exhaustion has taken a hold on me :/

Thanking you in advance for any imput :)

 [{"value":0.162512,"number":0,"channel":0},{"value":0.027835,"number":1,"channel":1},{"value":0.08361,"number":2,"channel":2},{"value":0.295788,"number":3,"channel":3},{"value":0.137746,"number":4,"channel":0},{"value":0.009403,"number":5,"channel":1},{"value":0.089616,"number":6,"channel":2},{"value":0.310242,"number":7,"channel":3},{"value":0.109047,"number":8,"channel":0},{"value":0.005558,"number":9,"channel":1},{"value":0.094369,"number":10,"channel":2},{"value":0.325739,"number":11,"channel":3},{"value":0.087932,"number":12,"channel":0},{"value":0.000298,"number":13,"channel":1},{"value":0.09723,"number":14,"channel":2},{"value":0.336811,"number":15,"channel":3},{"value":0.080258,"number":16,"channel":0},{"value":-0.004426,"number":17,"channel":1},{"value":0.100464,"number":18,"channel":2},{"value":0.338927,"number":19,"channel":3},{"value":0.078663,"number":20,"channel":0},{"value":-0.006318,"number":21,"channel":1},{"value":0.101179,"number":22,"channel":2},{"value":

0.331864,"number":23,"channel":3},{"value":0.084192,"number":24,"channel":0},{"value":0.004098,"number":25,"channel":1},{"value":0.100911,"number":26,"channel":2},{"value":0.326067,"number":27,"channel":3},{"value":0.085652,"number":28,"channel":0},{"value":0.01359,"number":29,"channel":1},{"value":0.105441,"number":30,"channel":2},{"value":0.32407,"number":31,"channel":3}]

Learning to write to an array in Cython

The simplified code of what I am tyring to do is much slower when I write to the "a" array:

in the pyx file:

import cython
import numpy as np
cimport numpy as np

ctypedef np.float64_t DTYPE_t

@cython.boundscheck(False)
@cython.wraparound(False)
@cython.nonecheck(False)
def writearray(np.ndarray[DTYPE_t, ndim=1] a):

   cdef int i,j,k,l
   cdef DTYPE_t sum=0.0

   for i in range(100):
    for j in range(100):
        for k in range(100):
            for l in range(1000):
                sum+=1.0
            a[0]+=sum #this is the trouble line that makes the code slow.

I thought I have "a[0]" and "sum" to be the same type, but do I? Before this function is called, the "a" array is declared as

a=np.zeros(5, dtype=np.float64)

Thanks in advance.

Construct file from ArrayBuffer using Blob

I am experimenting some HTML5 APIs like FileReader, Blob and etc. I am trying to slice a file into chunks, read each chunk as array buffer, create a blob by adding all the chunked array buffers together, and then reconstruct the file. The issue i am having is after reconstruct the file, the file is corrupted for most file types except for text files which are fine. Any idea why? Below is the code i have so far.

JSFiddle Code Sample

<input type="file" id="files" name="files[]" multiple><button id="a">anaylze</button>



 document.getElementById('a').addEventListener('click', sliceFileToSend, false);
document.getElementById('files').addEventListener('change', handleFileSelect, false);
var files;
var blob = new Blob();
var filename='';

function handleFileSelect(evt) {
  files = evt.target.files; 
}

function sliceFileToSend() {
  console.log("enter sliceFileToSend function");

  if (typeof files !== 'undefined') {
    for (var j = 0, len = files.length; j < len; j++) {
      if (files[j].size > 25 * 1024 * 1024) {
        continue;
      }
      filename=files[j].name;
      alert(JSON.stringify({
        filename: files[j].name
      }));

      parseFile(files[j]);
    }
  }
}

function parseFile(file) {
  var fileSize = file.size;
  var chunkSize = 16 * 1024; // bytes
  var offset = 0;  
  var block = null;


  var foo = function(evt) {
    if (evt.target.error === null) {
      offset += evt.target.result.byteLength;
      blob = new Blob([evt.target.result,blob]); // callback for handling read chunk
    }
    else {
      console.log("Read error: " + evt.target.error);
      return;
    }
    if (offset >= fileSize) {
      console.log("Done reading file");
      alert({
        isEnded: true
      });
      saveFile(blob,filename);
      return;
    }

    block(offset, chunkSize, file);
  };

  block = function(_offset, length, _file) {
    var r = new FileReader();
    var blob = _file.slice(_offset, length + _offset);
    r.onload = foo;
    r.readAsArrayBuffer(blob);
  };

  block(offset, chunkSize, file);
}

function saveFile(blob, fileName) {
  var link = document.createElement('a');
  link.href = window.URL.createObjectURL(blob);
  link.download = fileName;
  link.click();
}

Include blank values in array from foreach statement

I am using two mySQL tables to create a javascript chart. Table A:

id |   date   | attended
1  |2015-01-14| 3
2  |2015-01-20| 4
3  |2015-01-31| 2

Table B:

id | name |   date
1  | dog  |2015-01-14
2  | cat  |2015-01-14
3  | fish |2015-01-30

Using this code:

<?php
    $sql = "SELECT TableB.*
    FROM TableB
    RIGHT JOIN TableA
    ON TableB.date=TableA.date
    ORDER BY TableA.date";
    $names = $con->query($sql);
?>
var namegroup=[<?php
$info = array();
while($row=$names->fetch_assoc())  {
    $date = $row['date'];
    $name = $row['name'];
    $info[$date][] = $name;
}
foreach ($info as $date => $values) {
    echo '"';
    foreach($values as $value) {
        echo $value . ',';
    }
    echo '",';
}
?>];

I am able to look at Table A and get the rows in Table B whose dates are the same and following this answer was able do a foreach that provides me with this array:

var namegroup=[",","dog,cat,","fish,"]

The problem is that any blank data (which I want) is grouped at the beginning of the array and I want it to remain in an order based on the date to get an array like so:

var namegroup=["dog,cat,",",","fish,"]

Any help would be much appreciated. Also I am sure that my code is not perfect as I am somewhat teaching myself mySQL and PHP so if there are any suggestions for cleaner/better code feel free to weigh in. Thanks.

Aligning elements from two arrays

I'm working on a project and need to display elements from a string array and an integer array in two horizontal rows, as follows...

name1 | name 2 | name3 |

111___ | 2222__ |3333__ |

I'm having trouble aligning the vertical separators. We are supposed to be learning foundational work so we are not supposed to use objects. Can anyone help?

Understanding Unsafe code and its uses

I am currently reading the ECMA-334 as suggested by a friend that does programming for a living. I am on the section dealing with Unsafe code. Although, I am a bit confused by what they are talking about.

The garbage collector underlying C# might work by moving objects around in memory, but this motion is invisible to most C# developers. For developers who are generally content with automatic memory management but sometimes need fine-grained control or that extra bit of performance, C# provides the ability to write “unsafe” code. Such code can deal directly with pointer types and object addresses; however, C# requires the programmer to fix objects to temporarily prevent the garbage collector from moving them. This “unsafe” code feature is in fact a “safe” feature from the perspective of both developers and users. Unsafe code shall be clearly marked in the code with the modifier unsafe, so developers can't possibly use unsafe language features accidentally, and the compiler and the execution engine work together to ensure 26 8 9BLanguage overview that unsafe code cannot masquerade as safe code. These restrictions limit the use of unsafe code to situations in which the code is trusted.

The example

using System;
class Test
{
    static void WriteLocations(byte[] arr)
    {
        unsafe
        {
            fixed (byte* pArray = arr)
            {
                byte* pElem = pArray;
                for (int i = 0; i < arr.Length; i++)
                {
                    byte value = *pElem;
                    Console.WriteLine("arr[{0}] at 0x{1:X} is {2}",
                    i, (uint)pElem, value);
                    pElem++;
                }
            }
        }
    }
    static void Main()
    {
        byte[] arr = new byte[] { 1, 2, 3, 4, 5 };
        WriteLocations(arr);
        Console.ReadLine();
    }
}

shows an unsafe block in a method named WriteLocations that fixes an array instance and uses pointer manipulation to iterate over the elements. The index, value, and location of each array element are written to the console. One possible example of output is:

arr[0] at 0x8E0360 is 1
arr[1] at 0x8E0361 is 2
arr[2] at 0x8E0362 is 3
arr[3] at 0x8E0363 is 4
arr[4] at 0x8E0364 is 5

but, of course, the exact memory locations can be different in different executions of the application.

Why is knowing the exact memory locations of for example, this array beneficial to us as developers? And could someone explain this ideal in a simplified context?

Deleting pointer to array

In one of my large projects I encountered problem with deleting arrays that were initialized with no specified size.
I wrote a simple program to check what is going wrong, here is the code

#include "stdafx.h"

class Checker
{
public:
    Checker()
    :myI(i++){}

virtual ~Checker(){
    printf("%i " , myI);
    fflush(stdout);
}
private:
    int myI;
    static int i;
};

int Checker::i = 0;


int _tmain(int argc, _TCHAR* argv[]){
    Checker* somePointer;
    Checker* anotherPointer;

    somePointer = new Checker[4]{
        Checker(), Checker(), Checker(), Checker()};

    anotherPointer = new Checker[]{
        Checker(), Checker(), Checker(), Checker()};

    delete[] somePointer;

    delete[] anotherPointer; //approach A
    delete anotherPointer; //approach B
    //in approach C anotherPointer is not deleted

    return 0;
}

As You can see anotherPointer is initialized without explicitly defined size.
Of course, only one of the lines marked as approach is active at once.
In approach A output looks like that (< crash> means that program ends unexpectedly)

 3 2 1 0 <crash> 

In approach B output is

 3 2 1 0 4 <crash> 

In approach C some time the output is 3 2 1 0 and other time application crashes without printing anything.

As far as I know initialization without specifying size of array ends with different memory allocation, but i don't know how to solve problem with application that crashes at the end and this is my question.

I'm using Visual Studio Pro 2013 Update 4 (MSVC++)

Java - putting comma separated integers from a text file into an array

had a quick question based on an assignment I'm working on.

I have a list of numbers like this in a text file:

5, 8, 14
7, 4, 2

And I need them inserted into an array as such

joe[5][8] = 14 
joe[7][4] = 2 

Having trouble getting this done, thanks to anyone who can give me a hand.

How to get the exact value from the array - php

Here is my array i.e.,

I used to print_r($Result);

So the output is given below,

Here how can i take only the FullName

I tried to take

echo $Result['FullName'];

But it is showing undefined index.

How can i get the fullname from this array ??

./1430714172resume.docxArray ( [ResumeId] => Array ( [@attributes] => Array ( [ResumeParserProductName] => RecruitPlus Resume Parser ) [ResumeParserOrgName] => ITCONS e-Solutions Private Limited ) [StructuredXMLResume] => Array ( [ContactInfo] => Array ( [PersonName] => Array ( [FullName] => DEBRA ALLEN [GivenName] => DEBRA [MiddleName] => Array ( ) [FamilyName] => ALLEN ) [ContactMethod] => Array ( [Telephone] => Array ( [PhoneBasic] => 617.405.4319 ) [Mobile] => Array ( [0] => Array ( ) ) [Fax] => Array ( [0] => Array ( ) ) [InternetEmailAddress] => Array ( [0] => allen.debra3@gmail.com [1] => SimpleXMLElement Object ( ) ) [PostalAddress] => Array ( [CountryName] => Array ( ) [Region] => Array ( ) [City] => Array ( ) [PostalCode] => Array ( ) [DeliveryAddress] => Array ( [AdressLine1] => Array ( ) [AdressLine2] => Array ( ) ) ) ) ) [ExecutiveSummary] => Array ( ) [Objective] => Array ( ) [Role] => Array ( ) [FunctionalArea] => Array ( ) [IndustryType] => Array ( ) [EmploymentHistory] => Array ( [TotalExperience] => 20Year(s) & 10Month(s) [TotalProjectExperience] => 19Year(s) & 10Month(s) [CurrentSalary] => Array ( ) [ExpectedSalary] => Array ( ) [EmployerOrg] => Array ( [0] => SimpleXMLElement Object ( [EmployerOrgName] => Vantage Travel [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => True [Title] => Traffic Manager [OrgName] => SimpleXMLElement Object ( [OrgName] => Vantage Travel ) [Description] => Vantage Travel (Travel Agency) - Boston, MA September 2014 - February 2015 Traffic Manager Create and manage the production schedule using Quad/Graphics Plan System to gather and interrupt requirements received from business owners Serve as the key liaison with teams: Brand Management, Creative, Production, Marketing and Circulation Ensure all projects are on time and accurate within agreed upon timeframe and communicate between departments Enforce creative deadlines and work-flow processes Communicate conflicts, delays or unusual situations to all parties; expedite and prioritize rush projects accordingly Work closely with the Creative Team to balance workloads, evaluate time-lines and make recommendations to Creative Management and Business Owners Run and manage all Traffic related reports Welcome new projects and consider companywide implications as well as departmental Identify opportunities for the Traffic department and manage guidelines and process documentation [StartDate] => SimpleXMLElement Object ( [AnyDate] => 9/1/2014 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 2/1/2015 ) ) ) [1] => SimpleXMLElement Object ( [EmployerOrgName] => J. Jill [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Executive Assistant to three Senior Vice [OrgName] => SimpleXMLElement Object ( [OrgName] => J. Jill ) [Description] => J. Jill (Clothes/Retail ) - Quincy, MA February 2014 - May 2014 Executive Assistant to three Senior Vice Presidents Heavy calendar management and Travel arrangements, executing expense reports on time Project work-updating Excel spreadsheets, printing weekly reports for high level meetings Working hand-and-hand with Human Resources onboarding new senior employees [StartDate] => SimpleXMLElement Object ( [AnyDate] => 2/1/2014 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 5/1/2014 ) ) ) [2] => SimpleXMLElement Object ( [EmployerOrgName] => StavisSeafoods, Inc [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Executive Assistant [OrgName] => SimpleXMLElement Object ( [OrgName] => StavisSeafoods, Inc ) [Description] => StavisSeafoods, Inc. (Third Generation Family Owned Fish Company) - Boston, MA July 2011-February 2014 Executive Assistant to President and Chief Executive Officer Excellent time management skills, meeting coordination and advance calendar management Domestic/international travel and executing expense reports on time Provide agendas and take meeting minutes-distribute to attendees to drive action items Create PowerPoint presentations and Excel worksheets, exceptional proofing skills Event planning which includes tradeshow experience, arrange company luncheons, manage employee milestone anniversaries Interact with board members, coordinate quarterly meetings Excellent telephone manner, verbal &written communication skills Oversee other administrative staff Public relations personality: ability to establish a strong rapport with top-level executives, co-workers and clients Practice ultimate privacy in regard to confidential information [StartDate] => SimpleXMLElement Object ( [AnyDate] => 7/1/2011 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 2/1/2014 ) ) ) [3] => SimpleXMLElement Object ( [EmployerOrgName] => Health Dialog [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Executive Assistant [OrgName] => SimpleXMLElement Object ( [OrgName] => Health Dialog ) [Description] => Health Dialog (Healthcare) - Boston, MA October 2010 - March 2011 Executive Assistant to the Vice President of Market Development Manage a complex calendar, including extensive travel arrangements-domestic/ international Follow company travel policy, cost saving initiatives, and manage expense reports Preparation for off-site executive meetings/special events and PowerPoint presentations [StartDate] => SimpleXMLElement Object ( [AnyDate] => 10/1/2010 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 3/1/2011 ) ) ) [4] => SimpleXMLElement Object ( [EmployerOrgName] => New Boston Fund, Inc [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Executive Assistant [OrgName] => SimpleXMLElement Object ( [OrgName] => New Boston Fund, Inc ) [Description] => New Boston Fund, Inc. (Real Estate) -  [StartDate] => SimpleXMLElement Object ( [AnyDate] => 6/1/2005 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 10/1/2010 ) ) ) [5] => SimpleXMLElement Object ( [EmployerOrgName] => Mellon, Private Wealth Management [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Investment Communications Manager [OrgName] => SimpleXMLElement Object ( [OrgName] => Mellon, Private Wealth Management ) [Description] => Mellon, Private Wealth Management (Finance) - Boston, MA June 2000 - June 2005 Investment Communications Manager Develop and implement a new intranet site for the Investment Communications Department (composite, mutual fund performance, AIMR, and economic news) posted to site Liaison between the fixed income, equity, international and marketing departments to disseminate internal information through different vehicles to better communicate to clients Design PowerPoint presentations on the economy, asset classes and PWM's strategy to better educate portfolio managers and present internal communication vehicles to new hired officers Manage the internal weekly investment management call - coordinated speakers [StartDate] => SimpleXMLElement Object ( [AnyDate] => 6/1/2000 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 6/1/2005 ) ) ) [6] => SimpleXMLElement Object ( [EmployerOrgName] => Shuster Laboratories, Inc [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Marketing Manager [OrgName] => SimpleXMLElement Object ( [OrgName] => Shuster Laboratories, Inc ) [Description] => Shuster Laboratories, Inc. (Full Service Laboratory) - Quincy, MA June 1999 - June 2000 Marketing Manager Develop and implement employee customer service reward system Manage marketing materials, one page information sheets and brochures Attend and manage all aspects for tradeshows [StartDate] => SimpleXMLElement Object ( [AnyDate] => 6/1/1999 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 6/1/2000 ) ) ) [7] => SimpleXMLElement Object ( [EmployerOrgName] => Dunkin Donuts, Corporate Office [PositionHistory] => SimpleXMLElement Object ( [CurrentEmplyor] => False [Title] => Retail Concept Integration/Marketing and Communications Associated Manager [OrgName] => SimpleXMLElement Object ( [OrgName] => Dunkin Donuts, Corporate Office ) [Description] => Dunkin Donuts, Corporate Office (Food/Retail) - Randolph, MA July 1994 - May1999 Retail Concept Integration/Marketing and Communications Associated Manager Implement steps to rollout Intranet site Serve as an editor and photographer for various company publications Design and implement the Retrofit Tracking System tool for new store remodels and installation of bagel ovens-trained employees how to operate Attend new store openings and worked with Marketing and Operations to rollout new store image; signage, messaging and rollout an improved operating system [StartDate] => SimpleXMLElement Object ( [AnyDate] => 7/1/1994 ) [EndDate] => SimpleXMLElement Object ( [Anydate] => 5/1/1999 ) ) ) ) ) [EducationHistory] => Array ( [SchoolOrInstitution] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [SchoolType] => College ) [School] => SimpleXMLElement Object ( [SchoolName] => Emmanuel College ) [SchoolLocation] => Boston [Degree] => SimpleXMLElement Object ( [@attributes] => Array ( [DegreeType] => Graduate/ Undergraduate ) [IsHighestDegee] => True [DegreeName] => Bachelor [DegreeDate] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) [DegreeMajor] => SimpleXMLElement Object ( [Name] => Science ) [EducationDetails] => Science [DegreeMeasure] => SimpleXMLElement Object ( [EducationMeasure] => SimpleXMLElement Object ( [MeasureSystem] => SimpleXMLElement Object ( ) [MeasureValue] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) ) ) [DateofAttendance] => SimpleXMLElement Object ( [StartDate] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) [EndDate] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) ) [EducationDescription] => BSBA, Bachelor of Sciences in Business Administration, Emmanuel College, Boston, MA ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [SchoolType] => College ) [School] => SimpleXMLElement Object ( [SchoolName] => Fisher College ) [SchoolLocation] => SimpleXMLElement Object ( ) [Degree] => SimpleXMLElement Object ( [@attributes] => Array ( [DegreeType] => Graduate/ Undergraduate ) [IsHighestDegee] => False [DegreeName] => SimpleXMLElement Object ( ) [DegreeDate] => SimpleXMLElement Object ( [AnyDate] => 1/1/2006 ) [DegreeMajor] => SimpleXMLElement Object ( [Name] => Science ) [EducationDetails] => Science [DegreeMeasure] => SimpleXMLElement Object ( [EducationMeasure] => SimpleXMLElement Object ( [MeasureSystem] => SimpleXMLElement Object ( ) [MeasureValue] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) ) ) [DateofAttendance] => SimpleXMLElement Object ( [StartDate] => SimpleXMLElement Object ( [0] => SimpleXMLElement Object ( ) ) [EndDate] => SimpleXMLElement Object ( [AnyDate] => 1/1/2006 ) ) [EducationDescription] => AA, Liberal Arts, Quincy College, Quincy, MA Fisher College, Paralegal Certificate Dale Carnegie, Presentation Training Emergency Medical Services, EMT - January 2006 ) ) ) ) [LicensesAndCertifications] => Array ( [LicenseOrCertification] => Array ( ) [Name] => EMT ) [Qualifications] => Array ( [Competency] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Brand Management ) [0] => SimpleXMLElement Object ( ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Marketing ) [LastUsedDate] => 2/1/2015 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Circulation ) [LastUsedDate] => 2/1/2015 ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Retail ) [LastUsedDate] => 5/1/2014 ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Healthcare ) [0] => SimpleXMLElement Object ( ) ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => PowerPoint ) [LastUsedDate] => 2/1/2014 ) [6] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Liaison ) [LastUsedDate] => 6/1/2005 ) [7] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Intranet ) [LastUsedDate] => 5/1/1999 ) [8] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Operations ) [LastUsedDate] => 5/1/1999 ) ) ) [languages] => Array ( ) ) [ResumeAdditionalItems] => Array ( [ResumeAdditionalItem] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => Personal ) [FatherName] => SimpleXMLElement Object ( ) [DateOfBirth] => SimpleXMLElement Object ( ) [Age] => SimpleXMLElement Object ( ) [Gender] => Unspecified [Nationality] => SimpleXMLElement Object ( ) [MaritalStatus] => Unspecified [PassportNo] => SimpleXMLElement Object ( ) [VisaStatus] => SimpleXMLElement Object ( ) [Currentlocation] => Boston ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => Resume Parsing Information ) [ResumeParsingStartDate] => 4/29/2015 12:00:00 AM [ResumeParsingExpiryDate] => 5/5/2015 12:00:00 AM [NumberOfParsedResume] => 72 [MaxLimitOfParsedResume] => 100 ) ) ) [ResumeContext] => The candidate is working as with a good working Experience of 20Year(s) & 10Month(s) and Skilled in Brand Management, Marketing, Circulation, Retail, Healthcare, PowerPoint, Liaison, Intranet, Operations. The Current Salary: and Expected Salary: . Candidate's Functional Area seems to be: and Industry is ; Currently located at . The candidate posses Bachelor with major as Science [ResumeTextFormat] => Array ( ) )

Formatted :

/1430714172resume.docxArray (
[ResumeId] => Array (
[@attributes] => Array (
[ResumeParserProductName] => RecruitPlus Resume Parser
)
[ResumeParserOrgName] => ITCONS e-Solutions Private Limited
)
[StructuredXMLResume] => Array (
[ContactInfo] => Array (
[PersonName] => Array (
[FullName] => DEBRA ALLEN
[GivenName] => DEBRA
[MiddleName] => Array (
)
[FamilyName] => ALLEN
)
[ContactMethod] => Array (
[Telephone] => Array (
[PhoneBasic] => 617.405.4319
)
[Mobile] => Array (
[0] => Array (
)
)
[Fax] => Array (
[0] => Array (
)
)
[InternetEmailAddress] => Array (
[0] => allen.debra3@gmail.com
[1] => SimpleXMLElement Object (
)
)
[PostalAddress] => Array (
[CountryName] => Array (
)
[Region] => Array (
)
[City] => Array (
)
[PostalCode] => Array (
)
[DeliveryAddress] => Array (
[AdressLine1] => Array (
)
[AdressLine2] => Array (
)
)
)
)
)
[ExecutiveSummary] => Array (
)
[Objective] => Array (
)
[Role] => Array (
)
[FunctionalArea] => Array (
)
[IndustryType] => Array (
)
[EmploymentHistory] => Array (
[TotalExperience] => 20Year(
s
) & 10Month(
s
)
[TotalProjectExperience] => 19Year(
s
) & 10Month(
s
)
[CurrentSalary] => Array (
)
[ExpectedSalary] => Array (
)
[EmployerOrg] => Array (
[0] => SimpleXMLElement Object (
[EmployerOrgName] => Vantage Travel
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => True
[Title] => Traffic Manager
[OrgName] => SimpleXMLElement Object (
[OrgName] => Vantage Travel
)
[Description] => Vantage Travel (
Travel Agency
) - Boston, MA September 2014 - February 2015 Traffic Manager Create and manage the production schedule using Quad/Graphics Plan System to gather and interrupt requirements received from business owners Serve as the key liaison with teams: Brand Management, Creative, Production, Marketing and Circulation Ensure all projects are on time and accurate within agreed upon timeframe and communicate between departments Enforce creative deadlines and work-flow processes Communicate conflicts, delays or unusual situations to all parties; expedite and prioritize rush projects accordingly Work closely with the Creative Team to balance workloads, evaluate time-lines and make recommendations to Creative Management and Business Owners Run and manage all Traffic related reports Welcome new projects and consider companywide implications as well as departmental Identify opportunities for the Traffic department and manage guidelines and process documentation
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 9/1/2014
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 2/1/2015
)
)
)
[1] => SimpleXMLElement Object (
[EmployerOrgName] => J. Jill
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Executive Assistant to three Senior Vice
[OrgName] => SimpleXMLElement Object (
[OrgName] => J. Jill
)
[Description] => J. Jill (
Clothes/Retail
) - Quincy, MA February 2014 - May 2014 Executive Assistant to three Senior Vice Presidents Heavy calendar management and Travel arrangements, executing expense reports on time Project work-updating Excel spreadsheets, printing weekly reports for high level meetings Working hand-and-hand with Human Resources onboarding new senior employees
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 2/1/2014
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 5/1/2014
)
)
)
[2] => SimpleXMLElement Object (
[EmployerOrgName] => StavisSeafoods, Inc
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Executive Assistant
[OrgName] => SimpleXMLElement Object (
[OrgName] => StavisSeafoods, Inc
)
[Description] => StavisSeafoods, Inc. (
Third Generation Family Owned Fish Company
) - Boston, MA July 2011-February 2014 Executive Assistant to President and Chief Executive Officer Excellent time management skills, meeting coordination and advance calendar management Domestic/international travel and executing expense reports on time Provide agendas and take meeting minutes-distribute to attendees to drive action items Create PowerPoint presentations and Excel worksheets, exceptional proofing skills Event planning which includes tradeshow experience, arrange company luncheons, manage employee milestone anniversaries Interact with board members, coordinate quarterly meetings Excellent telephone manner, verbal &written communication skills Oversee other administrative staff Public relations personality: ability to establish a strong rapport with top-level executives, co-workers and clients Practice ultimate privacy in regard to confidential information
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 7/1/2011
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 2/1/2014
)
)
)
[3] => SimpleXMLElement Object (
[EmployerOrgName] => Health Dialog
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Executive Assistant
[OrgName] => SimpleXMLElement Object (
[OrgName] => Health Dialog
)
[Description] => Health Dialog (
Healthcare
) - Boston, MA October 2010 - March 2011 Executive Assistant to the Vice President of Market Development Manage a complex calendar, including extensive travel arrangements-domestic/ international Follow company travel policy, cost saving initiatives, and manage expense reports Preparation for off-site executive meetings/special events and PowerPoint presentations
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 10/1/2010
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 3/1/2011
)
)
)
[4] => SimpleXMLElement Object (
[EmployerOrgName] => New Boston Fund, Inc
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Executive Assistant
[OrgName] => SimpleXMLElement Object (
[OrgName] => New Boston Fund, Inc
)
[Description] => New Boston Fund, Inc. (
Real Estate
) - Boston, MA June 2005 - October 2010 Executive Assistant to the Chief Investment Officer and Acquisitions Team Coordinate heavy travel arrangements for CIO and team,manage expense reports Heavy calendar management Preparation for annual investor meetings-advanced PowerPoint presentation Interface between all departments
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 6/1/2005
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 10/1/2010
)
)
)
[5] => SimpleXMLElement Object (
[EmployerOrgName] => Mellon, Private Wealth Management
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Investment Communications Manager
[OrgName] => SimpleXMLElement Object (
[OrgName] => Mellon, Private Wealth Management
)
[Description] => Mellon, Private Wealth Management (
Finance
) - Boston, MA June 2000 - June 2005 Investment Communications Manager Develop and implement a new intranet site for the Investment Communications Department (
composite, mutual fund performance, AIMR, and economic news
) posted to site Liaison between the fixed income, equity, international and marketing departments to disseminate internal information through different vehicles to better communicate to clients Design PowerPoint presentations on the economy, asset classes and PWM\'s strategy to better educate portfolio managers and present internal communication vehicles to new hired officers Manage the internal weekly investment management call - coordinated speakers
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 6/1/2000
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 6/1/2005
)
)
)
[6] => SimpleXMLElement Object (
[EmployerOrgName] => Shuster Laboratories, Inc
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Marketing Manager
[OrgName] => SimpleXMLElement Object (
[OrgName] => Shuster Laboratories, Inc
)
[Description] => Shuster Laboratories, Inc. (
Full Service Laboratory
) - Quincy, MA June 1999 - June 2000 Marketing Manager Develop and implement employee customer service reward system Manage marketing materials, one page information sheets and brochures Attend and manage all aspects for tradeshows
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 6/1/1999
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 6/1/2000
)
)
)
[7] => SimpleXMLElement Object (
[EmployerOrgName] => Dunkin Donuts, Corporate Office
[PositionHistory] => SimpleXMLElement Object (
[CurrentEmplyor] => False
[Title] => Retail Concept Integration/Marketing and Communications Associated Manager
[OrgName] => SimpleXMLElement Object (
[OrgName] => Dunkin Donuts, Corporate Office
)
[Description] => Dunkin Donuts, Corporate Office (
Food/Retail
) - Randolph, MA July 1994 - May1999 Retail Concept Integration/Marketing and Communications Associated Manager Implement steps to rollout Intranet site Serve as an editor and photographer for various company publications Design and implement the Retrofit Tracking System tool for new store remodels and installation of bagel ovens-trained employees how to operate Attend new store openings and worked with Marketing and Operations to rollout new store image; signage, messaging and rollout an improved operating system
[StartDate] => SimpleXMLElement Object (
[AnyDate] => 7/1/1994
)
[EndDate] => SimpleXMLElement Object (
[Anydate] => 5/1/1999
)
)
)
)
)
[EducationHistory] => Array (
[SchoolOrInstitution] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[SchoolType] => College
)
[School] => SimpleXMLElement Object (
[SchoolName] => Emmanuel College
)
[SchoolLocation] => Boston
[Degree] => SimpleXMLElement Object (
[@attributes] => Array (
[DegreeType] => Graduate/ Undergraduate
)
[IsHighestDegee] => True
[DegreeName] => Bachelor
[DegreeDate] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
[DegreeMajor] => SimpleXMLElement Object (
[Name] => Science
)
[EducationDetails] => Science
[DegreeMeasure] => SimpleXMLElement Object (
[EducationMeasure] => SimpleXMLElement Object (
[MeasureSystem] => SimpleXMLElement Object (
)
[MeasureValue] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
)
)
[DateofAttendance] => SimpleXMLElement Object (
[StartDate] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
[EndDate] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
)
[EducationDescription] => BSBA, Bachelor of Sciences in Business Administration, Emmanuel College, Boston, MA
)
)
[1] => SimpleXMLElement Object (
[@attributes] => Array (
[SchoolType] => College
)
[School] => SimpleXMLElement Object (
[SchoolName] => Fisher College
)
[SchoolLocation] => SimpleXMLElement Object (
)
[Degree] => SimpleXMLElement Object (
[@attributes] => Array (
[DegreeType] => Graduate/ Undergraduate
)
[IsHighestDegee] => False
[DegreeName] => SimpleXMLElement Object (
)
[DegreeDate] => SimpleXMLElement Object (
[AnyDate] => 1/1/2006
)
[DegreeMajor] => SimpleXMLElement Object (
[Name] => Science
)
[EducationDetails] => Science
[DegreeMeasure] => SimpleXMLElement Object (
[EducationMeasure] => SimpleXMLElement Object (
[MeasureSystem] => SimpleXMLElement Object (
)
[MeasureValue] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
)
)
[DateofAttendance] => SimpleXMLElement Object (
[StartDate] => SimpleXMLElement Object (
[0] => SimpleXMLElement Object (
)
)
[EndDate] => SimpleXMLElement Object (
[AnyDate] => 1/1/2006
)
)
[EducationDescription] => AA, Liberal Arts, Quincy College, Quincy, MA Fisher College, Paralegal Certificate Dale Carnegie, Presentation Training Emergency Medical Services, EMT - January 2006
)
)
)
)
[LicensesAndCertifications] => Array (
[LicenseOrCertification] => Array (
)
[Name] => EMT
)
[Qualifications] => Array (
[Competency] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Brand Management
)
[0] => SimpleXMLElement Object (
)
)
[1] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Marketing
)
[LastUsedDate] => 2/1/2015
)
[2] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Circulation
)
[LastUsedDate] => 2/1/2015
)
[3] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Retail
)
[LastUsedDate] => 5/1/2014
)
[4] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Healthcare
)
[0] => SimpleXMLElement Object (
)
)
[5] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => PowerPoint
)
[LastUsedDate] => 2/1/2014
)
[6] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Liaison
)
[LastUsedDate] => 6/1/2005
)
[7] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Intranet
)
[LastUsedDate] => 5/1/1999
)
[8] => SimpleXMLElement Object (
[@attributes] => Array (
[Name] => Operations
)
[LastUsedDate] => 5/1/1999
)
)
)
[languages] => Array (
)
)
[ResumeAdditionalItems] => Array (
[ResumeAdditionalItem] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[type] => Personal
)
[FatherName] => SimpleXMLElement Object (
)
[DateOfBirth] => SimpleXMLElement Object (
)
[Age] => SimpleXMLElement Object (
)
[Gender] => Unspecified
[Nationality] => SimpleXMLElement Object (
)
[MaritalStatus] => Unspecified
[PassportNo] => SimpleXMLElement Object (
)
[VisaStatus] => SimpleXMLElement Object (
)
[Currentlocation] => Boston
)
[1] => SimpleXMLElement Object (
[@attributes] => Array (
[type] => Resume Parsing Information
)
[ResumeParsingStartDate] => 4/29/2015 12:00:00 AM
[ResumeParsingExpiryDate] => 5/5/2015 12:00:00 AM
[NumberOfParsedResume] => 72
[MaxLimitOfParsedResume] => 100
)
)
)
[ResumeContext] => The candidate is working as with a good working Experience of 20Year(
s
) & 10Month(
s
) and Skilled in Brand Management, Marketing, Circulation, Retail, Healthcare, PowerPoint, Liaison, Intranet, Operations. The Current Salary: and Expected Salary: . Candidate\'s Functional Area seems to be: and Industry is ; Currently located at . The candidate posses Bachelor with major as Science
[ResumeTextFormat] => Array (
)