Hi there!
I am attempting to tackle college worksheet on C programming (no marking for it, just to improve our learning). What we're meant to do is get a few details about shipping docks. I decided to use structures for this.
My code is below, what I need help with is to print out the information (to see if its working) of whats at the...
Example dump from the list of a directory:
hello:3.1 GB
world:1.2 MB
foo:956.2 KB
The above list is in the format of FILE:VALUE UNIT. How would one go about ordering each line above according to file size?
I thought perhaps to parse each line for the unit via the pattern ":VALUE UNIT" (or somehow use the delimiter) then run it throug...
#include <cstdlib>
#include <iostream>
using namespace std;
const unsigned long MAX_SIZE = 20;
typedef int ItemType;
class Heap {
private:
ItemType array[MAX_SIZE];
int elements; //how many elements are in the heap
public:
Heap( )
~Heap( )
bool IsEmpty( ) const
bool IsFull( ) const
Itemt...
I am expecting that both following vectors have the same representation in RAM:
char a_var[] = "XXX\x00";
char *p_var = "XXX";
But strange, a call to a library function of type f(char argument[]) crushs the running application if I call it using f(p_var). But using f(a_var) is Ok!
Why?
...
Hi All,
I have to parse an xml file with PHP to an object. At the moment I don't have a clue how to do this, help is appreciated.
The xml is quite big. I have to parse a part of it which looks like this:
<someNamespace:xmlDocument>
<someNamespace:categories>
<category name="Patrick" anAttribute="numericValue" anotherAttribute="numeri...
I'm working on a little project and this is my first time using regex
I've tried using .match or .matches but i don't see any option that will alow me to return the results of a regex query to an array.
thanks
...
I want to create a multidimensional array that includes an integer element and a datetime element. I want to be able to sort on the datetime element and grab the integer elements according to the sorted datetime elements. Is there a way to do this with arrays in c#, or should I be using something more like a datatable?
...
How could I implement this? I think my solution is very dirty, and I would like to do it better. I think there is an easy way to do this in Ruby, but I can't remember. I want to use it with Rails, so if Rails provides something similar that's ok, too. usage should be like this:
fruits = ['banana', 'strawberry', 'kiwi', 'orange', 'grapef...
Ok I've been asking alot of JS questions lately, and realized I just need to go learn it.
Been following tutorials at http://www.tizag.com/javascriptT very simple and straightforward.
I just want to make sure I understand this correctly. It took me a while to get it:
<script type="text/javascript">
var myString = "zero one two three f...
Here is an example array:
$foo = array(
'employer' => array(
'name' => 'Foobar Inc',
'phone' => '555-555-5555'
),
'employee' => array(
'name' => 'John Doe',
'phone' => '555-555-5556',
'address' ...
Hi all, I have a problem I am trying to tackle that involves a 7 point computational stencil. For those who may not know, this would be a 3D grid, and the 7 points are the n'th point, and the neighbors one point away in the x, y and z directions, both positive and negative (or neighbors to the east/west/north/south and up/down).
So thes...
Hi
I need to remove array item with given value:
if (in_array($id, $items)) {
$items = array_flip($items);
unset($items[ $id ]);
$items = array_flip($items);
}
Could it be done in shorter (more efficient) way?
...
I'm doing very frequent iterations over arrays of objects and have been using jQuery.each(). However, I'm having speed and memory issues and one of the most called methods according to my profiler is jQuery.each(). What's the word on the street about its performance? Should I switch to a simple for loop? Of course I'm fixing the many iss...
I'm doing very frequent searches in arrays of objects and have been using jQuery.inArray(). However, I'm having speed and memory issues and one of the most called methods according to my profiler is jQuery.inArray(). What's the word on the street about its performance? Should I switch to a simple for loop?
My specific function is:
func...
Not sure how to do this with jquery, but I'm trying to return a count of the number of divs that have specific classes...
<div id="main">
<div class="contact">Data</div>
<div class="margin">Margin</div>
<div class="contact">Data</div>
<div class="break">Break</div>
<div class="break">Breaker</div>
<div class="nap">Nap</div>
</div>
A...
Hi there.
I need a hint on handling data structures send via DBus. The running service returns an Array of 2-Tuples containing two ints. In Python a(ii).
Calling the method from the Qt app returns me:
QDBusMessage answer = dbus_iface.call("hello", 'blaaa', 3, 4);
QList data = answer.arguments();
qDebug() << answer:
QDBusMessage(type=...
i have 2 string arrays:
string[] all = new string[]{"a", "b", "c", "d"}
string[] taken = new string[]{"a", "b"}
i want to generate a new string array with "c" and "d" which is all - taken.
any quick way in dotnet 3.5 to do this without a manual loop and creating new lists?
...
I'm trying to add the values of two arrays in javascript eg. [1,2,1] + [3,2,3,4]
The answer should be 4,4,4,4 but I'm either getting 4,4,4 or 4,4,4,NaN if I change the 1st array length to 4.
I know a 4th number needs to be in the 1st array, but i can't figure out how to tell javascript to make it 0 rather then undefined if there i...
I'm a designer who dabbles in scripting using JQuery and PHP. I have a pretty good understanding of functionality in both but using sessions is new to me.
I have an app with a search feature. The search results may stretch over several pages and each result has a checkbox. The idea is the user goes through the results and checks off ite...
I've recently learned that it's possible to inject arrays into PHP GET variables to perform code execution?
.php?a[]=asd&a[]=asdasd&b[]=$a
That was the example I was given. I have no idea how it works and was wondering if this is even possible?
...