Is there a simple way to see if the xsd code generating C# code has a particular column? Or if you can reference a variable column? table.getColumn("column") instead of table.column?
Hi,
I built a class that allows me to do:
$db->query($query);
and it works perfectly, although if I want to do:
$db->query($query);
while($row = $db->fetch_assoc()){
$db->query($anotherquery);
echo $db->result();
}
it "breaks" the class. I don't want to constantly have to redeclare my class (eg: $seconddb = new database()), is there a way to get around this? I want to be able to reuse $db within $db, without overwriting the "outside" db. currently I'm create an array of data (from db-fetch_assoc() then doing a foreach and then doing the db call inside that:
$db->query('SELECT * FROM table');
while($row = $db->fetch_assoc()){
$arr[] = $row;
}
foreach($arr as $a){
$db->query(); // query and processing here
}
Is this the best method or am I missing the obvious? Should I consider passing a connection link ID with the database connection?
I'm building a web app that integrates with Google Drive, and am wondering if there was a way to list, search or delete files.
I see from https://developers.google.com/drive/v1/reference/files#resource that there are 4 operations. If there are no list and search capabilities then the onus is on the app to handle the management.
Is there another API I should be using? Are those features in the works?
This is what I'm trying to do and I can't:
#include <string>
using namespace std;
class A {
bool has() const { return get().length(); }
string& get() { return s; }
private:
string s;
};
The error I'm getting is:
passing ‘const A’ as ‘this’ argument of
‘std::string& A::get()’ discards qualifiers
I understand what the problem is, but how can I fix it? I really need has() to be const. Thanks.
I'm having trouble referencing the desired object when I've namespaced functions.
No problems here:
obj.test = function() {
// this == obj
}
But I'm getting tripped up when I namespace:
obj.namespace.test = function() {
// this == namespace
}
In the latter example, I know this references namespace, but I want to reference obj. How can I do it?
What is the best way to store the cards and suits in python so that I can hold a reference to these values in another variable?
For example, if I have a list called hand (cards in players hand), how could I hold values that could refer to the names of suits and values of specific cards, and how would these names and values of suits and cards be stored?
I have a program that runs correctly if I start it manually. However, if I try to add a registry key to start it automatically during startup, I get this error:
Debug assertion failed (str!=null) fprintf.c line:55
I tried to add Sleep(20000) before anything hapens, but same error.
here`s the code:
main()
{
FILE* filetowrite;
filetowrite = fopen("textfile.txt", "a+");
writefunction(filetowrite);
}
int writefunction(FILE* filetowrite) {
fprintf(filetowrite, "%s", "\n\n");
...
}
I also tried with passing filename as char* and opening it in wrtiefunction(), but same error.
I often have classes that are mostly just wrappers around some STL container, like this:
class Foo {
public:
typedef std::vector<whatever> Vec;
typedef Vec::size_type;
const Vec& GetVec() { return vec_; }
size_type size() { return vec_.size() }
private:
Vec vec_;
};
I am not so sure about returning size_type. Often, some function will call size() and pass that value on to another function and that one will use it and maybe pass it on. Now everyone has to include that Foo header, although I'm really just passing some size value around, which should just be unsigned int anyway ...? What is the right thing to do here? Is it best practice to really use size_type everywhere?
I am using a library that prints a bunch of superfluous information to the console when I reference it. Is there a way to silence the output of the library?
i am here to ask for help again, i created one database for all activities,
the problem i have is that the insertion in every activity comes in with new row, but that's
not what i want, what i am looking for is in the same row in each activity insert the columns
that contains. i already looked for solution here, they are speaking about static reference
but i don't know how to do it! so, is there any ideas ?
static DBAdapter db = new DBAdapter();
Hello
anyone has idea if and how is it possible to destroy / change php object which is referenced in many places? unset obviously destroys only one reference, and sometimes tracing all references manually is not an option. Any ideas? Maybe there is something i am missing in Reflection ?
I need a button that is visually completely customizable, but has custom logic to publish events and manage it's visual state based on events it has registered for.
When I say visually customizable, I mean I should be able to both create the button in xaml and set it's style by binding to the supplied style. Or I can create an instance of the button and set the style bypassing a parameter to an alternate constructor. Or by calling a method on the button class to set the style.
I do not plan on substituting the controls template, it should be a button. Can anyone point me to some code samples of this?
I keep getting the error "Method name expected" when trying add the a method to a delegate. I have a delegate which is invoked when ever my game ends. The function I'm trying to add to the delegate stops a countdown from flashing (the method is in a static class). I've searched about and I'm still unsure why its not working. Here is the line causing the error:
LivesManager.gameEnded += new LivesManager.EndGame(CountdownManager.DisableFlashTimer(this));
The this passes the current form to the method so it can disable the timer flash on the form.
I have added methods from static classes to the same delegate before and it works fine, the only difference is that I'm passing the form as a paramater and then it doesn't like it.
Is there any way to pass the form to the method without the error?
Thanks in advance :)
I have few lists like:
a = [1, 2, 3, 4, 5]
b = [4, 6, 5, 9, 2]
c = [4, 7, 9, 1, 2]
I want to trim all of them using a loop, instead of doing as below:
a[-2:]
b[-2:]
c[-2:]
I tried but got confused with pass by value or pass byreference fundamentals, looked into other questions as well but no help.
Thanks
I am using Sqlite database in my app.I Have 3 tables in database(group, category & categorygroup).I want to retrieve the contents from the category table with reference to the primary key of the group table.category group act as a junction table which as both the primary keys of group and category .How can i achieve that.Please help me out,Thanks
Background: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it. However, the build system uses the hash alone to check out the code and build it -- it simply stores the branch name, as given, in the build DB metadata.
I'm worried about developers accidentally providing the wrong branch name when they kick off a build, causing confusion when people are looking through the build history.
So how can I confirm, before passing along the hash and branch name to the build system, that the given hash does in fact come from the given branch?
I'm trying to use the lame_enc.dll file from LAME in a C# project, but adding the thing seems impossible.
I keep getting an error that says that a reference could not be added and to please check if the is accessible, a valid assembly or COM component.
I have no C++ experience, though I would like to use the functionality. Right now I'm using Process from the .NET framework to call lame.exe and do stuff, but I'd like to know if there's another way.
I'm wondering what's the difference between sample1 and sample2. Why sometimes I have to pass the struct as an argument and sometimes I can do it without passing it in the function? and how would it be if samplex function needs several structs to work with? would you pass several structs as an argument?
struct x
{
int a;
int b;
char *c;
};
void sample1(struct x **z;){
printf(" first member is %d \n", z[0]->a);
}
void sample2(){
struct x **z;
printf(" first member is %d \n", z[0]->a); // seg fault
}
int main(void)
{
struct x **z;
sample1(z);
sample2();
return 0;
}
according to http://www.cplusplus.com/reference/clibrary/cstring/memcpy/ c++'s memcpy takes three parameters: destination, source and size/bytes. it also returns a pointer. why is that so? aren't the parameters enough to input and copy data.
or am i misunderstanding something? the examples don't use the return value
I am dynamically creating forms dynamically according to a users actions. It is an entry-box and a two "buttons" for each instance. Each instance will be wrapped in a unique div tag.
What I tried to do without success is when I dynamically create the "button" I attach a function with the input variable containing the div of its instance. This a brief excerpt:
var newDivClass = document.getElementById("instance"+1);
button1.innerHTML = "<a href=\"#\" onclick=\"buttons("+newDivClass+");\" id=\"button1\"> Button1 </a>";
function buttons(selected) {
//I want this to select the first instance
//of button1 found within div newDivClass
selected.getElementById("button1");
//I also tried
//this.getElementById("button1");
//selected.getChildren[0];
}
The problem appears to be in passing newDivClass to the the actual function.
I'm doing a presentation about history of software engineering and stuck at this question due to the lack of available information. According to my quick research, TopLink is the first ORM framework ever created (in 1990s, certainly before 1996).
If anyone else has a different opinion, please let me know. (Please also provide a link to the reference sources)
Ref: http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software
http://en.wikipedia.org/wiki/TopLink
Let's start telling that I'm passing an x amount of variables via post from a form.
Let's name them menu_category_1, menu_category_2, ..., menu_category_x, plus, maybe, menu_category_new (I'm using an if empty to check this last one variable).
To make things easier I'm also sending the parameter $key (amount of variables starting from 0).
Now I need to set them into a new variable $menu_category (array), which is going to be imploded and then update my database.
How do I set up that new $menu_category variable to be an array containing all my variables named in the beginning?
I was thinking of using a for loop but I can't come up with something useful.
Thanks!!!
I have an app, say MyApp Free. I want to create MyApp Pro which I can charge for that has some additional functionality. The obvious way is to have a library that contains almost all my app code, then two Android app projects for the Free and Pro versions which reference that library.
Suggestions?
I am interested in creating a simple web application that will take in user input, convert it to an XML file and send the file to a database.
Coding wise I feel I am okay, it is just the general setup and what implementation to use I am a bit unsure of.
At the moment I have a JSP page containing a form, the user fills out the form and on submit a get method is sent to a servlet, in the servlet doGet() method the servlet is instantiating a java object and passing it the user inputted data. The java object then writes that data to an XML file and sends it to the database via REST.
All I would be interested to know is if this the standard/optimal way of creating such a web application.
Any and all feedback is appreciated.
Thanks