#include <vector>
using namespace std;
int main()
{
vector<int> *list = new vector<int>[33];
delete[] list;
return 0;
}
Any reason why the delete SIGSEGVs?
Im trying to sort any array with array_multisort and everything is working great. However, based on conditions in my script, I need to change the options. So What I have so far is this:
array_multisort(
$sort1,SORT_ASC,
$sort2,SORT_ASC,
$sort3,SORT_ASC,
$arraytosort
);
and what I would like to have is something like this:
$dynamicSort = "$sort1,SORT_ASC,$sort2,SORT_ASC,$sort3,SORT_ASC,";
array_multisort(
$dynamicSort,
$arraytosort
);
Any suggestions?
I have a set of different interfaces and I need to give them access via web services.
I have implemented this task in .NET as follows: dynamically generated interface implementation on the IL, marked methods with WebMethod annotation, and in *.asmx handler called generated stub.
More needs to be able to change the method signatures (eg change the type of certain argument or add new arguments), ie not always explicitly implement an interface, and use it as a decorator pattern.
Example:
interface ISomeService {
void simpleMetod (String arg1);
void customMetod (CusomType arg1, Integer arg2);
}
// Need to dynamically generate such class
@WebService
class SomeWebService {
private ISomeService someService = new SomeServiceImpl ();
@WebMethod
public void simpleMethod (String arg1) {
someService.simpleMethod (arg1);
}
@WebMethod
public void customMethod (String arg1, Integer arg2) {
someService.customMethod (CusomType.fromString (arg1), arg2);
}
}
Interfaces such as ISomeService quite a lot. And manually write code like this I don't want.
I work with Java recently, what technology/libraries should be used to solve such task.
Thanks.
How do I get the values of a check box that is in a repeating region with its values dynamically generated from a recordset from the database.I want to retrieve the value when it is checked and after I click on a link.The problem is that it is retrieving only the first value of the recordset which is 1.This is the code:
//jQuery
$(document).ready(function(){
$("#clickbtn").click(function(){
$("input[type=checkbox][checked]").each(function(){
var value=$("#checkid").attr('value');
$("#textfield").attr('value',value);
});
return false;
});
});
//html
<td width="22"><form id="form1" name="form1" method="post" action="">
<input type="checkbox" name="checkid" id="checkid" value="<?php echo $row_people['NameID']; ?>" />
</form></td>
I would appreciate the help.
Hi all,
in C++, when you define a function which takes one argument, you have to define the data type of that variable:
void makeProccess(int request)
However, I want to implement a function which takes different data types rather taking statically defined integer type.
void makeProccess(anyType request)
How can I design a proccess like this, any idea?
Thanks.
Hi
I am trying to add a filter to a controller that is based on a certain role (using role_requirement) and then on the company_id that each user has.
So basically I need something like this:
require_role "company" ** This is working fine
before_filter :company_required
def company_required
unless current_user.company_id == Company.find(params[:id])
end
end
The error I am receiving
undefined method `company_id' for nil:NilClass
I would appreciate any guidance. Thanks
I want to dynamically set the content of an iframe to that of an html document I have. It is in the form of a string in memory in javascript.
Then i want to print that iframe.
Ideas?
I have some old indexed pages like:
index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=1
index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=yes
and I want to redirect them to new urls:
index.php?action=listingview&listingID=XXXXX
XXXXX is a number.
What should I put in my htaccess file?
Thank you in advance.
I'm using asp.net and want to filter a search result everytime the user enter letters in a textbox. For exmaple this website do exactly what I want: http://www.prisjakt.nu/ (try searching in the right top corner). I have tried just putting my textbox and the gridview with the search result in an updatepanel, it's working but it's really slow, can I make it faster and how? Is there any articles or something about this?
I have a general question. I would like to have a window containing some buttons, radio buttons, text fields and so on. So, user can do something (write text, select options and press buttons). As the result of the user activity window should change it structure/appearance some element should disappear and some appear.
How do I program such "updates"? Should I close an old window and open a new one or I can modify content of window without closing it?
I am little new to C++, I have one doubt in variable argument passing. As I mentioned in a sample code below ( This code won't work at all, just for others understanding of my question I framed it like this), I have two functions func with 1 parameter and 2 parameters(parameter overloading). I am calling the func from main, before that I am checking whether I needs to call 2 parameter or 1 parameter. Here is the problem, as I know I can call two fuctions in respective if elseif statements, but I am curious to know whether I can manage with only one function. (In below code I am passing string not int, as I mentioned before this is just for others understanding purpose.
#include<iostream.h>
#include <string>
void func(int, int);
void func(int);
void main()
{
int a, b,in;
cout << "Enter the 2 for 2 arg, 1 for 1 arg\n";
cin << in;
if ( in == 2)
{
string pass = "a,b";
}
elseif ( in == 1)
{
string pass = "a";
}
else
{
return 0;
}
func(pass);
cout<<"In main\n"<<endl;
}
void func(int iNum1)
{
cout<<"In func1 "<<iNum1<<endl;
}
void func(int iNum1, int iNum2)
{
cout<<"In func2 "<<iNum1<<" "<<iNum2<<endl;
}
I am parsing data through the web service. I want the flipping horizontally rather than vertically. Here is a tutorial where ViewFlipper is used but it is for static data.
I'm writing a program and I have the following problem:
char *tmp;
sprintf (tmp,"%ld",(long)time_stamp_for_file_name);
Could someone explain how much memory allocate for the string tmp.
How many chars are a long variable?
Thank you,
I would appreciate also a link to an exahustive resource on this kind of information.
Thank you
What I wanted to do was create a listbox from a delimited text file.
The listbox would populate X # of rows based on the rows of the text file. And the listbox would have 3 columns, each being populated from a specific delimiter. Is this possible in C#? Any starting point would be great!
I have a label and I got some text from database.
text format like: Windows Server 2008 ...etc
But sometimes there are different fonts or something like style. How can I remove all of them quickly?
I know I can make it with replace command. But is there any quick way for it?
Hi, why did it fail to load the library at link at compilation time? i don't care about freeing the library yet it just won't work.
#include <windows.h>
int main()
{
LoadLibrary("winmm.lib");
timeGetTime();
}
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?
Hello,
Let's say I have a class named Klass, and a class called Klass2. Depending on the user's input, I'd like to decide whether I'll call "hello_world" on Klass, or Klass2:
class Klass
def self.hello_world
"Hello World from Klass1!"
end
end
class Klass2
def self.hello_world
"Hello World from Klass2!"
end
end
input = gets.strip
class_to_use = input
puts class_to_use.send :hello_world
The user inputs "Klass2" and the script should say:
Hello World from Klass2!
Obviously this code doesn't work, since I'm calling #hello_world on String, but I'd like to call #hello_world on Klass2.
How do I "convert" the string into a referrence to Klass2 (or whatever the user might input), or how could I else would I achieve this behavior?
I have this class, with the atribute 'word'
class Node {
char *word;
Inside the Node constructor, I do this asignation:
word = new char[strlen(someword)];
In the destructor of the Node class, I try to delete the contents pointed by word:
delete []word;
I obtain the next message after executing the programs:
"Heap block at 003E4F48 modified at 003E4F51 past requested size of 1"
What am I not doing well?
i wanna write a program that creates (allocating memory)
and manipulates (adding elements and increasing memory etc.) integer arrays dynamically according to given input sequences.
input sequence which starts with the maximum
number of arrays, includes integers to be put into arrays and some one letter
characters which are commands to carry out some tasks (activating next array,
deleting an array etc).
also, i wanna create *c_arrays which is the address of the array whose elements are
the actual capacities (How many integer slots are already allocated for an array?) of arrays
how should i organize(set up) the algorithm?
Hi,
My web page will get a set of results from the database and display it to the user. However I am not sure about "number" of results.
Each result will have a panel which contains several controls in itself, an image, several labels, etc.
What is the best way to do this dynamically, eg. create these controls dynamically?
Is it better to use an AJAX control? Should I use Gridview?
Thanks for the help,
Behrouz
In SQL Server, I have two tables TableA and TableB, based on these I need to generate a report which is kind of very complex and after doing some research I come to a conclusion that I have to go with SQL Pivot table but I dont have any idea about the SQL Pivot feature so, can anyone please help me on this. Please see the details below:
Create table TableA
(
ProjectID INT NOT NULL,
ControlID INT NOT NULL,
ControlCode Varchar(2) NOT NULL,
ControlPoint Decimal NULL,
ControlScore Decimal NULL,
ControlValue Varchar(50)
)
Sample Data
-------------
ProjectID | ControlID | ControlCode | ControlPoint | ControlScore | ControlValue
P001 1 A 30.44 65 Invalid
P001 2 C 45.30 85 Valid
Create table TableB
(
ControlID INT NOT NULL,
ControlChildID INT NOT NULL,
ControlChildValue Varchar(200) NULL
)
Sample Data
------------
ControlID | ControlChildID | ControlChildValue
1 100 Yes
1 101 No
1 102 NA
1 103 Others
2 104 Yes
2 105 SomeValue
Output should be in a single row for a given ProjectID with all its Control values first & followed by child control values (based on the ControlCode (i.e.) ControlCode_Child (1, 2, 3...) and it should look like this
I just wanted to know if something like this is possible.
Jquery should fire some action on certian custom event.
Like Whenever a new row is added to dom dynamically to table then i have certain action like change the background color to example red.
That should work across the whole site.
Somethings like Event listeners in Doctrine2 or Signals in Django
EDIT:
Basically i want some thing like where i can create custom event
$.AddnewEvent(newRowAdded);
Then i can customise that event with my own functions like
$.newRowAdded(function(){ blah blah });
I've got an app with two themes (dark and light) that can be selected at runtime. This works. I also have a ListView with rows that can have one of three different layouts, each of which has a style (say, different colors). This also works. But I can't get these two features to work together. I really need six different styles, three for one theme (dark) and three for the other (light), but I can't figure out how to choose a style for a list item based on the current theme, or get that effect any other way by using XML files. My three layouts each point to a custom theme that sets the color, but that overrides whatever theme I've got set. Themes can only contain items that are "styleable", so I can't put my own custom items in there. There may be a way to do this programmatically, but I was hoping to do it declaratively. Any ideas?