Im using DataServices and OData protocol, i need to generate Get, Post, Delete, and Update from a c++ aplication. how i can do this? the easiest way ??
I'm trying to insert records in mysql database using java,
What do I place in this code so that I could insert records:
String id;
String name;
String school;
String gender;
String lang;
Scanner inputs = new Scanner(System.in);
System.out.println("Input id:");
id=inputs.next();
System.out.println("Input name:");
name=inputs.next();
System.out.println("Input school:");
school= inputs.next();
System.out.println("Input gender:");
gender= inputs.next();
System.out.println("Input lang:");
lang=inputs.next();
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "MyPassword");
PreparedStatement statement = con.prepareStatement("insert into employee values('id', 'name', 'school', 'gender', 'lang');");
statement.executeUpdate();
hi all,
I am looking some help in php+MySQL+jquery
I have 2 tables
table1
table 1 have 4 colume
(id, title, desc, thumb_img)
tabel2
table 2 have 3 colume(id, table1id, img)
I just want to compare 2 table with the value of $_get['QS'];
and show the records from both (title, desc, img)
Looking forward for the help.:)
I'm not sure if this is the best place to ask this, but you guys have been helpful with plenty of my CS homework in the past so I figure I'll give it a shot.
I'm looking for an algorithm to blindly combine several dependent variables into an index that produces the best linear fit with an external variable. Basically, it would combine the dependent variables using different mathematical operators, include or not include each one, etc. until an index is developed that best correlates with my external variable.
Has anyone seen/heard of something like this before? Even if you could point me in the right direction or to the right place to ask, I would appreciate it. Thanks.
I am trying to round up cases when it makes sense to use a map (set of key-value entries). So far I have two categories (see below). Assuming more exist, what are they?
Please limit each answer to one unique category and put up an example.
Property values (like a bean)
age -> 30
sex -> male
loc -> calgary
Presence, with O(1) performance
peter -> 1
john -> 1
paul -> 1
I can't for the life of me figure out why this function is causing multiple entries into my database table...
When I run the function I end up with two records stacked on top of each one second apart
here is the function:
function generate_signup_token(){
$connection = new DB_Connect(); // <--- my database connection class
$ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
$sign_up_token = uniqid(mt_rand(), true);
$_SESSION['signup_token'] = $sign_up_token;
$sign_up_token = mysql_real_escape_string($sign_up_token);
$query = "INSERT INTO `token_manager` (`ip_address`, `signup_token`) VALUES ('$ip', '$sign_up_token')";
mysql_query($query);
}
generate_signup_token();
Hello - my main question is given a feature centroid, how can I draw it in MATLAB?
In more detail, I have an NxNx3 image (an rgb image) of which I take 4x4 blocks and compute a 6-dimensional feature vector for each block. I store these feature vectors in an Mx6 matrix on which I run kmeans function and obtain the centroids in a kx6 matrix, where k is the number of clusters and 6 is the number of features for each block. How can I draw these center clusters in my image in order to visualize if the algorithm is performing the way I wish it to perform? Or if anyone has any other way/suggestions on how I can visualize the centroids on my image, I'd greatly appreciate it.
Thank you.
I have an R script file that executes a second R script via:
source("../scripts/second_file.R")
That second file has the following lines:
myfiles <- list.files(".",pattern = "*.csv")
...
rm(myfiles)
When I run the master R file I get:
> source("../scripts/second_file.R")
Error in file.remove(myfiles) : object 'myfiles' not found
and the program aborts.
I think this has something to do with the environment. I looked at ?rm() pages but less than illuminating. I figure I have to give it a position argument, but not sure which.
{"names": [
{"patientName": "Ratna"},
{"patientName": "raju" },
{"patientName": "krishna"},
{"patientName": "kishore"},
{"patientName": "Kishore1"},
{"patientName": "mahesh"}
]}
this is the JSON object i'm getting from Ajax call
so now i want to add all patientName values to select box through jquery
can any one tell me how to accomplish this ??
here i'm using $.ajax() function for ajax call
thanks in advance
My web application deals with strings that need to be converted to numbers alot - users often put commas, currency symbols etc. in these fields so what I want to do is create a string extension method that cleans the field up and converts it to a decimal.
For example:
decimal myNumber = "$1,250.85".ToDecimal();
Can anyone help with this? Thanks!
I want to display a table from database in phpMyAdmin by putting the following conditions that in every different options in drop down menu it displays different table from database by pressing the button of search. But it is not doing so.
<p class="h2">Quick Search</p>
<div class="sb2_opts">
<p></p>
<form method="post" action="" >
<p>Enter your source and destination.</p>
<p>From:</p>
<select name="from">
<option value="Islamabad">Islamabad</option>
<option value="Lahore">Lahore</option>
<option value="murree">Murree</option>
<option value="Muzaffarabad">Muzaffarabad</option>
</select>
<p>To:</p>
<select name="To">
<option value="Islamabad">Islamabad</option>
<option value="Lahore">Lahore</option>
<option value="murree">Murree</option>
<option value="Muzaffarabad">Muzaffarabad</option>
</select>
<input type="submit" value="search" />
</form>
</form>
</table>
<?php
$con=mysqli_connect("localhost","root","","test");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['from']) and isset($_POST['To'])) {
$from = $_POST['from'] ;
$to = $_POST['To'] ;
$table = array($from, $to);
switch ($table) {
case array ("Islamabad", "Lahore") :
$result = mysqli_query($con,"SELECT * FROM flights");
echo "</flights>"; //table name is flights
break;
case array ("Islamabad", "Murree") :
$result = mysqli_query($con,"SELECT * FROM isb to murree");
echo "</isb to murree>"; //table name isb to murree
;
break;
case array ("Islamabad", "Muzaffarabad") :
$result = mysqli_query($con,"SELECT * FROM isb to muzz");
echo "</isb to muzz>";
break;
//.....
//......
default:
echo "Your choice is nor valid !!";
}
}
mysqli_close($con);
?>
Hi all,
I have this code:
I need to replace 800px and 300px from database value;
I tried both of the below. But still i am not getting the answer.
Method 1:
<div id="container" style="width:'<% Response.Write(width);%>'px; height:'<% Response.Write(height);%>'px; margin: 0 auto;overflow:hidden;"></div>
Method 2:
<div id="container" style="width:'<%# Eval("width");%>'px; height: <%# Eval("height");%>'px; margin: 0 auto;overflow:hidden;"></div>
The value of height and width variables are defined in page_load() function
int height=300;
int width= 800;
This is not affecting the resulting web page.
Can anyone help me on this.
I have a text file which contains words separated by space. I want to take each word from the file and store it. So i have opened the file but am unsure how to assign the word to a char.
FILE *fp;
fp = fopen("file.txt", "r");
//then i want
char one = the first word in the file
char two = the second word in the file
I created a Windows Forms Application to which I added a DataGridView and LINQ to SQL Classes from one of my databases. I can successfully bind one of my database's tables to my DataGridView:
var dataSource = from c in _db.NetworkedEquipments
select c;
dataGridView1.DataSource = dataSource;
However, the foreign keys get duplicated, that is, the columns appear twice. How can I prevent this?
I'm trying to save the address of a dynamic array index.
struct sstor *dlist;
struct node *q;
q->item = &(dlist->item[(dlist->sz)-1]); // Problem?
This is my node
struct node {
char **item;
struct node *next;
struct node *prev;
};
This is my array
struct sstor {
int sz;
int maxsz;
char item[][1024];
};
I'm still new to pointers. The line below gives the error: assignment from incompatible pointer type
q->item = &(dlist->item[(dlist->sz)-1]);
I have a model that looks like this:
class Client(models.Model):
name = models.CharField(max_length=100, primary_key=True)
user = models.ForeignKey(User)
class Contract(models.Model):
title = models.CharField(max_length=100, primary_key=True)
start_date = models.DateField()
end_date = models.DateField()
description = models.TextField()
client = models.ForeignKey(Client)
user = models.ForeignKey(User)
How can i configure a django form so that only clients associated with that user show in the field in the form?
My initial thought was this in my forms.py:
client = forms.ModelChoiceField(queryset=Client.objects.filter(user__username = User.username))
But it didn't work. So how else would I go about it?
I have a table with 1.4 billion records. The table structure is as follows:
CREATE TABLE text_page (
text VARCHAR(255),
page_id INT UNSIGNED
) ENGINE=MYISAM DEFAULT CHARSET=ascii
The requirement is to create an index over the column text.
The table size is about 34G.
I have tried to create the index by the following statement:
ALTER TABLE text_page ADD KEY ix_text (text)
After 10 hours' waiting I finally give up this approach.
Is there any workable solution on this problem?
UPDATE: the table is unlikely to be updated or inserted or deleted. The reason why to create index on the column text is because this kind of sql query would be frequently executed:
SELECT page_id FROM text_page WHERE text = ?
Hello,
I have some stored procedure
DECLARE cursor FOR SELECT [FooData] From [FooTable];
OPEN cursor ;
FETCH NEXT FROM cursor INTO @CurrFooData;
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @CurrFooData AS FooData;
INSERT INTO Bar (BarData) VALUES(@CurrFooData);
FETCH NEXT FROM cursor INTO @CurrFooData;
END;
CLOSE OldestFeeds
DEALLOCATE OldestFeeds
But in result I have a lot of tables, not one. How can I return one table with 'FooData' column and all '@CurrFooData' rows?
i have this querystring that shall open up my page.
http://www.a1-one.com/[email protected]&stuid=123456
Now when this page loads, on page_load, I want to pick up email and stuid in two different variables. So I can use them to insert into my database (sql server)
how can this be done in vb.net
Every Customer has a physical address and an optional mailing address. What is your preferred way to model this?
Option 1. Customer has foreign key to Address
Customer (id, phys_address_id, mail_address_id)
Address (id, street, city, etc.)
Option 2. Customer has one-to-many relationship to Address, which contains a field
to describe the address type
Customer (id)
Address (id, customer_id, address_type, street, city, etc.)
Option 3. Address information is de-normalized and stored in Customer
Customer (id, phys_street, phys_city, etc. mail_street, mail_city, etc.)
One of my overriding goals is to simplify the object-relational mappings, so I'm leaning towards the first approach. What are your thoughts?
I have a test django app.
In one page the test show the same question to all users.
I'd like that when a user answers correctly, send a signal to other active user's browser to refresh to the next question.
I have been learning about signals in django I learning work with them but I don't now how send the "refresh signal" to client browser.
I think that it can do with a javascript code that check if a certain value (actual question) change and if change reload the page but I don't know this language and the information that I find was confused.
Can anybody help me?
Many Thanks.
Hi all , Im trying to read in image file from a server , with the code below . It keeps going into the exception. I know the correct number of bytes are being sent as I print them out when received. Im sending the image file from python like so
#open the image file and read it into an object
imgfile = open (marked_image, 'rb')
obj = imgfile.read()
#get the no of bytes in the image and convert it to a string
bytes = str(len(obj))
#send the number of bytes
self.conn.send( bytes + '\n')
if self.conn.sendall(obj) == None:
imgfile.flush()
imgfile.close()
print 'Image Sent'
else:
print 'Error'
Here is the android part , this is where I'm having the problem. Any suggestions on the best way to go about receiving the image and writing it to a file ?
//read the number of bytes in the image
String noOfBytes = in.readLine();
Toast.makeText(this, noOfBytes, 5).show();
byte bytes [] = new byte [Integer.parseInt(noOfBytes)];
//create a file to store the retrieved image
File photo = new File(Environment.getExternalStorageDirectory(), "PostKey.jpg");
DataInputStream dis = new DataInputStream(link.getInputStream());
try{
os =new FileOutputStream(photo);
byte buf[]=new byte[1024];
int len;
while((len=dis.read(buf))>0)
os.write(buf,0,len);
Toast.makeText(this, "File recieved", 5).show();
os.close();
dis.close();
}catch(IOException e){
Toast.makeText(this, "An IO Error Occured", 5).show();
}
EDIT: I still cant seem to get it working. I have been at it since and the result of all my efforts have either resulted in a file that is not the full size or else the app crashing. I know the file is not corrupt before sending server side. As far as I can tell its definitely sending too as the send all method in python sends all or throws an exception in the event of an error and so far it has never thrown an exception. So the client side is messed up . I have to send the file from the server so I cant use the suggestion suggested by Brian .
I have a testdata like this:
DROP TABLE SELECT_PASS;
CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT VARCHAR(20));
INSERT INTO SELECT_PASS VALUES(1,"TC1","PASS");
INSERT INTO SELECT_PASS VALUES(2,"TC2","PASS");
INSERT INTO SELECT_PASS VALUES(3,"TC3","INCONC");
INSERT INTO SELECT_PASS VALUES(4,"TC1","FAIL");
INSERT INTO SELECT_PASS VALUES(5,"TC21","FAIL");
INSERT INTO SELECT_PASS VALUES(6,"TC4","PASS");
INSERT INTO SELECT_PASS VALUES(7,"TC3","PASS");
INSERT INTO SELECT_PASS VALUES(8,"TC2","PASS");
INSERT INTO SELECT_PASS VALUES(9,"TC1","TIMEOUT");
SELECT TESTCASE, MAX(RESULT) FROM SELECT_PASS GROUP BY TESTCASE;
The resultset I get is :
TC1 TIMEOUT
TC2 PASS
TC21 FAIL
TC3 PASS
TC4 PASS
Basically I want to see those testcases which never passed.
Any way to do it?
Thanks.
I ned to write a code sniplet that enables to disable connection to some parts of a site. Admin and the mainpage will be displayable, but user section (which uses ajax) will be displayed, but can not be used (vith a transparent div set over the page). Also there is a few pages which will be disabled.
my logic is that, i write a middleware,
def process_request(self, request):
if ayar.tonline_kapali:
url_parcalari = request.path.split('/')
if url_parcalari[0] not in settings.BAGIMSIZ_URLLER:
if not request.is_ajax():
return render_to_response('bakim_modu.html')
else:
return None
that code let me to display a "site closed" message for the urls not in BAGIMSIZ_URLLER (which contains urls that will be accessible)
But i do not figure out how can i solve the problem about ajax pages... i need to set a header or something to the response and need to check it in the template.