What is the VB Equivalent of the following C# boolean expression?
data.GetType() == typeof(System.Data.DataView)
Note: The variable data is declared as IEnumerable.
This probably an easy thing to do but for some reason I can't get a handle on it.
I have a simple form that allows people to select one if three items for sale. When they chose their item I need to pass that variable into an iFrame with a third party checkout page to safely process their cc transaction.
How would I do this?
Cheers-
Please tell me what is difference
== if i write query directly in storedprocedure
== and write query in string variable and than run it in exec in stored procedure.
i am using ms sql server 2005
One of my friends sent this code to me, saying it doesn't work as expected:
#include<stdio.h>
void main()
{
int a [10] ={23, 100, 20, 30, 25, 45, 40, 55, 43, 42};
int sizeOfInput = sizeof(a)/sizeof(int);
int b, outer, inner, c;
printf("Size is : %d \n", sizeOfInput);
printf("Values before bubble sort are : \n");
for ( b = 0; b < sizeOfInput; b++)
printf("%d\n", a[b]);
printf("End of values before bubble sort... \n");
for ( outer = sizeOfInput; outer > 0; outer-- )
{
for ( inner = 0 ; inner < outer ; inner++)
{
printf ( "Comparing positions: %d and %d\n",inner,inner+1);
if ( a[inner] > a[inner + 1] )
{
int tmp = a[inner];
a[inner] = a [inner+1];
a[inner+1] = tmp;
}
}
printf ( "Bubble sort total array size after inner loop is %d :\n",sizeOfInput);
printf ( "Bubble sort sizeOfInput after inner loop is %d :\n",sizeOfInput);
}
printf ( "Bubble sort total array size at the end is %d :\n",sizeOfInput);
for ( c = 0 ; c < sizeOfInput; c++)
printf("Element: %d\n", a[c]);
}
I am using Micosoft Visual Studio Command Line Tool for compiling this on a Windows XP machine.
cl /EHsc bubblesort01.c
My friend gets the correct output on a dinosaur machine (code is compiled using TCC there).
My output is unexpected. The array mysteriously grows in size, in between.
If you change the code so that the variable sizeOfInput is changed to sizeOfInputt, it gives the expected results!
A search done at Microsoft Visual C++ Developer Center doesn't give any results for "sizeOfInput".
I am not a C/C++ expert, and am curious to find out why this happens - any C/C++ experts who can "shed some light" on this?
Unrelated note: I seriously thought of rewriting the whole code to use quicksort or merge sort before posting it here. But, after all, it is not Stooge sort...
Edit: I know the code is not correct (it reads beyond the last element), but I am curious why the variable name makes a difference.
how can i detect white image surrounded by black image
000 000 000 000 000
255 255 255 000 000
255 255 255 000 000
255 255 255 000 000
000 000 000 000 000
and
how can calculate length and widht of the square
I have a form page in PHP that reads a DBF, and conditionally converts it into a MySQL - extracting the data from an old, but still production accounting app. The conversion should be able to be actioned without user intervention, ie scripted from the web-host's command line on a cron job.
How can I get PHP to submit the form automatically when receiving variables at command line, like for instance a specific post variable? Every auto-submit I've found so far relied upon javascript, which would be useless at PHP command line.
I'm trying to check if a window has a certain style using GetWindowLong(hWnd, GWL_STYLE) but that gives me a LONG type of variable. how would you check for a specific style from that?
Hi everybody,
I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, want have FTP access to the site.
Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own translations of the interface. There is however still no mysql adapater for Zend_Translate.
So, does anybody now of an adapter script for Zend_Translate so it can work with a mysql table? Or any arguments against using mysql and possible other solutions for this problem?
Hi, I want to process raw data from a picture taken in java me with
byte[] snap = videoControl.getSnapshot(encoding);
My question is, whether I should try working already with snap or should I first create the image from this array
Image im = Image.createImage(snap, 0, snap.length);
and then work with that? Or is there some better documentation of both methods, i.e. getSnapshot and createImage than the Java API reference?
Hi,
I want to send the following JSON text {"Email":"[email protected]","Password":"123456"} to a web service and read the response. I know to how to read JSON. The problem is that the above jason object must be sent in a variable name jason. How can i do this from android? Like creating a request object setting content headers etc.
If given subnet address e.g. 192.168.10.0/24
How to determine mask length ? (/24)
How to determine mask address ? (255.255.255.0)
How to determine network address ? (192.168.10.0)
i have created a file argument.pl
which takes several arguments first of which should be in form of a year
example of argument : 2010 23 type
here 2010 is a year
my code does something like:
use strict;
use warning
use Date::Calc qw(:all);
my ($startyear, $startmonth, $startday) = Today();
my $weekofyear = (Week_of_Year ($startyear,$startmonth,$startday))[0];
my $Year = $startyear;
...
...
if ($ARGV[0])
{
$Year = $ARGV[0];
}
here this code fill $Year with "current year" if if $ARGV[0] is null or doesn't exists
now here instead of if ($ARGV[0])
is it possible to check that the value in $ARGV[0] is a valid year (like 2010, 1976,1999 etc.)
Why the following code runs so.... slow....... ?
<html><body><script type="text/javascript">
var i = 0;
f();
function f() {
if (i == 5000) {
document.write("Done");
} else {
i++;
tail();
}
}
function tail() {
var fn = tail.caller;
var args = arguments;
setTimeout(function() {fn.apply(this, args)}, 0);
};
</script></body></html>
Hi I was working with apache fop and when the number of pages exceeds about 130 pages ,it could not generate the pdf ....
Is there any limit to page number or the length of xml file...
I wonder if syntax as follows would be helpful in your opinion as a code readability improvent and self-commenting of code:
std::map<std::string name, std::vector<int> scores> myMap;
In this example it clearly says and no other comment is needed, what for we are using myMap variable.
Looking forward to your opinions.
How do you run SQL that contains one or more bind variables in the Oracle Developer Tools for Visual Studio Query Window?
For example, the following works fine in SQL*Plus:
variable x NUMBER;
BEGIN
:x := 0;
END;
/
SELECT 1 FROM DUAL WHERE :x <> 1;
When executed in the ODT Query Window, the following exception is raised in the Query output pane:
ERROR
ORA-01008: not all variables bound
Hi,
When i include fb_connect_async_js javascript helper it is throwing an
error , Facebooker 2 don't have action view template. Could you please tell
me how handle this situation .
undefined local variable or method `fb_connect_async_js' for
ActionView::Base
Thanks,
Srini
Lets say I have a integer result and an array of integers, lets say [a,b,c] (not a fixed length). I need to detect if result=a*i +b*j + c*k, with i,j,k=0.
I prefer a solution in C/C# if it is possible.
PS The problem is from a reservation system, a trip can be sold if its durations is a combination of given durations.
Thanks!
How can we convert the following 64 bit binary into the long equivalent;
01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000
equals 7D A3 4F FF FF FF FF C0 HEX
equals 9053167636875050944 << this is the value we want in a C# variable
Hi all:
I've been trying to obtain the Driver class for JDBC connection to MySQL.
The workstation is running on Linux, Fedora 10.
I have manually set up the classpath variable for Java by CLI like this:
bash-3.2$ echo $CLASSPATH
/home/cmao/public_html/jsp/mysql-connector-java-5.1.12-bin.jar
This shows that I've added the lastest mysql connection jar archive to my CLASSPATH variable.
I've created a test JSP page which can be found here
And source code for this page is:
<%@page language="java"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<html>
<head>
<title>UTS JDBC MySQL connection test page</title>
</head>
<body>
<%
Connection con = null;
out.print("Java version is : " + System.getProperty("java.version") + "<br />");
out.print("Tomcat version is : " + application.getServerInfo() + "<br />");
out.print("Servlet version is: " + application.getMajorVersion() + "<br />");
out.print("JSP version is : " + JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() +"<br />");
//out.print("Java classpath is : " + System.getProperty("java.class.path")+ "<br />");
//out.print("JSP classpath is : " + appliaction.getAttribute("org.apache.catalina.jsp_classpath") + "<br />");
//out.print("Tomcat classpath is : " + System.getProperty("org.apache.tomcat.common.classpath") + "<br />");
try
{
Class c = Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e)
{
out.println("Error! Failed to obtain JDBC driver for MySQL... Missing class \"com.mysql.jdbc.Driver\"<br />");
}
%>
</body>
</html>
None of those commented out line would work, various Jsper Expetions would be thrown.
You can check those Error pages from the following links:
classpath Error page
catalina Error page
tomcat Error page
It seems, from my limited knowledge of JSP and Servlet, the Tomcat environment "ignores" my Java CLASSPATH? In which case I cannot configure the MySQL JDBC package to let my Servlets(a JSP is but a Servlet anyway) work.
I am not sure how to fix this issue. would it be better if I use an IDE like Eclipse or NetBeans and create a real Java "web app" so that everything can be "self-configured" by the usage of a web.config XML configuration file? So that I can certainly bypass this Tomcat environment restriction?
Many thanks for the suggestions in advance.
Hello,
I want to display all images that are stored outside my web root folder. Please help me. I am only able to display one image repeatedly. For example, if I have 5 images in my folder, only one image is displayed on my browser 5 times. Please help me on this. I've been working on this problem for over a month now. I'm a newbie. Help. Thank you. Here is the code I'm using.
images.php
<?php
// Get our database connector
require("includes/copta.php");
// Grab the data from our people table
$sql = "select * from people";
$result = mysql_query($sql) or die ("Could not access DB: " . mysql_error());
$imgLocation = " /uploadfile/";
while ($row = mysql_fetch_array($result))
{
$imgName = $row["filename"];
$imgPath = $imgLocation . $imgName;
echo "<img src=\"call_images.php?imgPath=" . $imgName . "\" alt=\"\"><br/>";
echo $row['id'] . " " . $imgName. "<br />";
}
?>
call_images.php
<?php
// Get our database connector
require("includes/copta.php");
$imgLocation = '/ uploadz/';
$sql = "select * from people";
$result = mysql_query($sql) or
die ("Could not access DB: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$imgName = $row["filename"];
$imgPath = $imgLocation . $imgName;
// Make sure the file exists
if(!file_exists($imgPath) || !is_file($imgPath)) {
header('HTTP/1.0 404 Not Found');
die('The file does not exist');
}
// Make sure the file is an image
$imgData = getimagesize($imgPath);
if(!$imgData) {
header('HTTP/1.0 403 Forbidden');
die('The file you requested is not an image.');
}
// Set the appropriate content-type
// and provide the content-length.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: image/jpg");
header("Content-length: " . filesize($imgPath));
// Print the image data
readfile($imgPath);
exit();
}
?>
Hey all. Newbie JavaScript question here. I have an array: {r=1, g=4, b=6} How do i go about getting the value of each (r,g,b) into a separate variable?
HOWEVER! would setting the $link to my database be one thing that I prolly should use a GLOBAL scope for? In my setting of (lots of functions)...it seems as though having only one variable that is on the global scope would be wise.
I am currently using the functions to transfer it back and forth so that way I do not have it on global...but it is a bit of a hinder to my script.
Please Advise,
Thank you.
Matt
I have an object variable Object test = Spinner.getSelectedItem();
-It gets the selected item from the Spinner (called spinner) and names the item 'test'
I want to do an if statement related to that object e.g:
'if (test = "hello") {
//do something
}'
But it appears not to work....
Can someone give me some help?
-Do I have to use a different if? or convert the object to string etc.?
Thanks alot...
James