var str = 'single words "fixed string of words"';
var astr = str.split(" "); // need fix
i want the array to be like: single, words, fixed string of words.
Hey everybody. Given an array of n integers, i need to find the product of each of the (n-1) subsets i.e:
ith subset = the product of all the elements except the ith element itself. e.g:
S = {1,0,3,2};
subset_product(1) = 0*3*2=0;
subset_product(2) = 1*3*2=6; etc.
So Any help?
I'm accessing an array by reference inside a foreach loop, but the unset() function doesn't seem to be working:
foreach ( $this->result['list'] as &$row ) {
if ($this_row_is_boring) {
unset($row);
}
}
print_r($this->result['list']); // Includes rows I thought I unset
Ideas? Thanks!
I have created an array of threads and started all of them. How to know whether all threads have completed work. I don't want to use thread.wait or thread.join.
I am trying to sort an array of strings, but it's not sorting anything.... what am I doing wrong?
string namesS[MAX_NAMES];
int compare (const void * a, const void * b){
return ( *(char*)a - *(char*)b );
}
void sortNames(){
qsort(namesS, MAX_NAMES, sizeof(string), compare);
}
Hi,
I want to execute a query like
select ID from "xyz_DB"."test" where user in ('a','b')
so the corresponding code is like
String s="(";
for(String user:selUsers){
s+= " ' " + user + " ', ";
}
s+=")";
Select ID from test where userId in s;
The following code is forming the value of s as ('a','b',)
i want to remove the comma after the end of array how to do this ?
Say the original list is
1 2 3 4 5 6 7 8 9 10
and u shift it so that it becomes
5 6 7 8 9 10 1 2 3 4
so say i want to check if 7 is in the array. how would i do this efficiently.
I have a lot of classes and want to create some kind of 'directory'.
So that I can create menus automatically.
Clicking a menu-item would then create an instance of the class and shows the window.
What I want for this is an array of System.Type where I can stuff in all the classes without instantiating them.
Though from my test and (unsuccessful) googling, this doesn't seem possible.
Any ideas?
I want to implement a code that loops inside an array that its size is set by the user that means that the size isn't constant.
for example:
A=[1,2,3,4,5]
then I want the output to be like this:
[1],[2],[3],[4],[5]
[1,2],[1,3],[1,4],[1,5]
[2,3],[2,4],[2,5]
[3,4],[3,5]
[4,5]
[1,2,3],[1,2,4],[1,2,5]
[1,3,4],[1,3,5]
and so on
[1,2,3,4],[1,2,3,5]
[2,3,4,5]
[1,2,3,4,5]
Can you help me implement this code?
hi, first of all this is not homework!!
my question is from book: Algorithms in C++ third edition by robert sedgewick
question is: there is given array of size n by 2^n(two dimensional) and we should fill it by binary numbers with bits size exactly n or
for example n=5 so result will be
00001
00010
00011
00100
00101
00110
00111
and so on we should put this sequence of bits into arrays please help me
I'm trying to include the elements of an array in the NSString that's returned by the -description method in my class. No clue how to do this in Objective-C...in Java there's string concatenation or StringBuilder, what's the equivalent in Obj-C?
TIA..
Hello,
I would like to know how a variable length array is managed (what extra variables or data structures are kept on the stack in order to have variable length arrays).
Thanks a lot.
So I have a .dat file that just holds a list of names, each name is on a new line. I am having a day of complete mental blanks but how would I go about getting those names out of the file and puting them into a array.
Thanks for any help
in an array first we have to find whether a desired number exists in that or not?
if, not then how will i find nearer number to the given desired number in java.
Hello,
I have these a file in a c program which consist of a string and 4 doubles and 2 integer in one line and there is a total of 28 lines, i want to read this file and load the data into an array. can someone help me solve this.
Can I do this in C++ (if yes, what is the syntax?):
void func(string* strs) {
// do something
}
func({"abc", "cde"});
I want to pass an array to function, without instantiating it as a variable. Thanks for suggestions.
I have a 3-disk RAID array running in my Ubuntu server. This has been running flawlessly for over a year but I was recently forced to strip, move and rebuild the machine.
When I had it all back together and ran up Ubuntu, I had some problems with disks not being detected. A couple of reboots later and I'd solved that issue. The problem now is that the 3-disk array is showing up as degraded every time I boot up. For some reason it seems that Ubuntu has made a new array and added the missing disk to it.
I've tried stopping the new 1-disk array and adding the missing disk, but I'm struggling. On startup I get this:
root@uberserver:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md_d1 : inactive sdf1[2](S)
1953511936 blocks
md0 : active raid5 sdg1[2] sdc1[3] sdb1[1] sdh1[0]
2930279808 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]
I have two RAID arrays and the one that normally pops up as md1 isn't appearing.
I read somewhere that calling mdadm --assemble --scan would re-assemble the missing array so I've tried first stopping the existing array that ubuntu started:
root@uberserver:~# mdadm --stop /dev/md_d1
mdadm: stopped /dev/md_d1
...and then tried to tell ubuntu to pick the disks up again:
root@uberserver:~# mdadm --assemble --scan
mdadm: /dev/md/1 has been started with 2 drives (out of 3).
So that's started md1 again but it's not picking up the disk from md_d1:
root@uberserver:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid5 sde1[1] sdf1[2]
3907023872 blocks level 5, 64k chunk, algorithm 2 [3/2] [_UU]
md_d1 : inactive sdd1[0](S)
1953511936 blocks
md0 : active raid5 sdg1[2] sdc1[3] sdb1[1] sdh1[0]
2930279808 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]
What's going wrong here? Why is Ubuntu trying to pick up sdd into a different array?
How do I get that missing disk back home again?
[Edit] - After adding the md1 to mdadm.conf it now tries to mount the array on startup but it's still missing the disk. If I tell it to try and assemble automatically I get the impression it know it needs sdd but can't use it:
root@uberserver:~# mdadm --assemble --scan
/dev/md1: File exists
mdadm: /dev/md/1 already active, cannot restart it!
mdadm: /dev/md/1 needed for /dev/sdd1...
What am I missing?