I have a tab on my page, when i click on this tab, i need to show a pdf file on page(browser).
For this i am writing function on control like this
public ActionResult PricedPdf(string projID,string fileName)
{
byte[] bArr = new byte[] { };
bArr =getdata();
return File(bArr, System.Net.Mime.MediaTypeNames.Application.Pdf, fileName+".pdf");
}
Now my problem is when i render this, page only show some unreadable data not pdf.
Ok: I edited my question: I heared somewhere, that php language is written by C.
So i have question: what happens for example when you run a function in php such as date("Ymd"); or file_get_contents("file.txt");?
Does it translate that code to C and request to server, or does php do it? sorry i haven't a clue
And if it does translate it and request, that means besically it is C?
sorry for english
Thank you,
Anon Verma
Hello guys, i have start working with CodeIgniter, but i can't understand one think. How do i load one class into another?
$this->load->library("hello_world");
This is not working?
my class - load - hello_world class
class myclass {
function test() {
$this->load->library("hello_world");
$this->hello_world->hello();
}
}
Message: Undefined property: myclass::$load
So I am in Excel trying to read the last saved metadata from an Access database, but I cannot figure out how on earth to do this.
If I use environ$("username") it will give my the last saved information for the excel document where I am coding, not the access db that I want it to grab from. Excel has a built in function for grabbing username data, but I cannot find one for access.
How can I do this?!
Any help is greatly appreciated!
hello.. is there any way to replace titles faster then str_replace function? I've got a file that 2000 lines of array changes. that hurts my webpage thanks.
ZWOpenFile and NtOpenFile are both the functions of nt dll..ZwOpenFile is implemented as same as NtopenFile..but I dont understand why ZWopenFile is included in nt dll function.Can anyone please explain me the difference?
Some programming environments like C++ builder have timer components with a callback function which executes in the same execution contexts as where the timer object is created.
I was wondering how to do something similar in plain c++ with threading.
Or are there any other ways to have a callback which is periodically called to perform some task and runs in the same execution context as the calling thread?
hi
i am working on the simulation and noise cleaning for ECG ,my problem is that how to write a function for adding baseline artifact noise ,and high frequency noise to the simulated ECG signal.
So im just playing around with PHP and the MD5 functionality, sorry if this sounds really silly, but I cant seem to understand, how is it possible to represent an unlimited number of characters of input into a 32 bit character output? Is my logic sound here? Or is there a limit to the input that a MD5 function can take?
Thanks...
I have created a TransactionScope and within the scope various items are created and updated in the database. During this process I make a lot of calls to the database. Originally I opened a SqlConnection in the beginning of the TransactionScope and passed it around to any function that made a DB call then I closed the connection after all the calls are made and before the transaction commits. Is it better to do this or to open and close a connection for each call?
I am trying to call an object method from an object (the same object) property definition to no avail.
var objectName = {
method : function() {
return "boop";
},
property : this.method()
};
In this example I want to assign the return value of objectName.method ("boop") to objectName.property.
I have tried objectName.method(), method(), window.objectName.method(), along with the bracket notation variants of all those as well, ex. this["method"], with no luck.
The difference between Chr and Char when used in converting types is that one is a function and the other is cast
So: Char(66) = Chr(66)
I don't think there is any performance difference (at least I've never noticed any, one probably calls the other).... I'm fairly sure someone will correct me on this!
Which do you use in your code and why?
Here is my implementation file:
using namespace std;
#include <iostream>
#include <iomanip>
#include <string>
#include <stack> //line 5
#include "proj05.canvas.h"
//----------------Constructor----------------//
Canvas::Canvas() //line 10
{
Title = "";
Nrow = 0;
Ncol = 0;
image[][100]; // line 15
position.r = 0;
position.c = 0;
}
//-------------------Paint------------------// line 20
void Canvas::Paint(int R, int C, char Color)
{
cout << "Paint to be implemented" << endl;
}
The errors I'm getting are these:
proj05.canvas.cpp: In function 'std::istream& operator>>(std::istream&,
Canvas&)':
proj05.canvas.cpp:11: error: expected `;' before '{' token
proj05.canvas.cpp:22: error: a function-definition is not
allowed here before '{' token
proj05.canvas.cpp:24: error: expected `}' at end of input
proj05.canvas.cpp:24: error: expected `}' at end of input
These seem like simple syntax errors, but I am not sure what's wrong. Could someone decode these for me? I'd really appreciate it, thanks for your time!
EDIT
Here is the definition of Canvas in my .h file:
#ifndef CANVAS_H
#define CANVAS_H
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
class Canvas
{
public:
Canvas(); void Paint(int R, int C, char Color);
const int Nrow;
const int Ncol;
string Title;
int image[][100];
stack<int> path;
struct PixelCoordinates
{
unsigned int r;
unsigned int c;
} position;
};
#endif
Hello.
I working now on firm that using ref in every function.
The reason, is to catch errors.
There example :
//return true if the read is success
//otherwise writing to the error ,the problem
bool ReadFile(ref string error)
Question:
How do you catching errors?
Using ref,exceptions or other way?
I am trying to capture the event when a child element link is clicked and add class called "highlightchild" to it. Also I want to check if there are any child element link exist or not, if no child element exits ie "third level" highlight with "highlightparent" the parent. How can I do that using jquery?
$(document).ready(function() {
$('.menu ul').hide();
$('.menu .arrowUp').click(function() {
$('.menu ul').hide();
$(this).find(".third-level").toggle();
});
});
html
<ul class="menu">
<li class="arrowUp"><a href="#">link1</a>
<ul class="third-level" >
<!-- third level non-active -->
<li class="arrowUp"><a href="/somelink/">Some Link</a></li>
</ul>
</li>
<li class="arrowUp"><a href="#">link2</a>
<ul class="third-level" >
<!-- third level non-active -->
<li class="arrowUp"><a href="/links2/">some Links 2</a></li>
</ul>
</li>
<li class="arrowUp"><a href="#">link3</a>
<ul class="third-level" >
<!-- third level non-active -->
<li class="arrowUp"><a href="/Agri/">Agricultural</a></li>
<!-- third level non-active -->
<li class="arrowUp"><a href="/sugar/">Sugar</a></li>
<!-- third level non-active -->
<li class="arrowUp"><a href="/bbc/">Coffee</a></li>
<!-- third level non-active -->
<li class="arrowUp"><a href="/cnn/">Energy</a></li>
<!-- third level non-active -->
<li class="arrowUp"><a href="funstuff">Fun stuff</a></li>
</ul>
</li>
<li class="arrowUp"><a href="#">link4</a></li>
<li class="arrowUp"><a href="#">link5</a></li>
<li class="arrowUp"><a href="#">link6</a></li>
</ul>
How to convert a string format into an array format?
I have a string, $string = 'abcde'
I want to convert it to a 1 element array
$string[0] = 'abcde'
Is there a built in function for this task? Or the shortest way is to
$string = 'abcde';
$array[0] = $string;
$string = $array;
TIA
hi,
I wanted to have function which will accept as
foo(...)
{
}
usage of this would be
foo(1,2,3);
foo(1)
foo(1,2,3,4,5,5,6);
va_list can be used but again for that I have to pass foo(int count, ...), as this at run time i dont know how many argument i have.
any pointer would be appreciated
Thanks
Hi,
I want to execute a slot in different class. Is it possible
UI_CDSK Obj;
connect(Obj.penDrive,SIGNAL(clicked()),this,SLOT( Obj.caller()));
This code is in different class and from this class i want to execute slot of different class(UI_CDSK )
Here penDrive and caller belongs to function UI_CDSK class and the mentioned code is in other class
Hi
I want a linq query to return a calculated timespan,
i have used the timespan function before, but im not sure how to incorporate it into linq.
Basically the linq is returning a datetime field which i want to subtract from the current datetime to get days and hours.
Any help appreciated!
Thanks
I want to use file_get_contents to implement a proxy so I can do ajax cross domain requests. Querystring will be used to supply the URL to file_get_contents. Now the problem is people can muck around with the qurystring in order to read local files on the server. I dont wnat this. Can someone get me a function to sinitize the querystring in order only to accept urls and not local files: ie:
?url=http://google.com.au - OK
?url=./passwords.txt - Not OK
I use the following snippet to filter the list of selected users, where isSelected is a boolean variable. Is there a simpler way (helper function) to populate the selectedUsers collection instead of writing the following lines of code.
List<User> selectedUsers = new ArrayList<User>(0);
for (User user : this.getUsers()) {
if (user.isSelected()) {
selectedUsers.add(user.getId());
}
}
What is the fastest way to create a hash function which will be used to check if two files are equal?
Security is not very important.
Edit: I am sending a file over a network connection, and will be sure that the file on both sides are equal
I have a set of folders, and I want to be able to run a function that will find the most recently edited file and tell me the name of the file and the folder it is in.
Folder layout:
root
Folder A
File A
File B
Folder B
File C
File D
etc...
Any tips to get me started as i've hit a bit of a wall.