Hello, I want to Remove the Sessions from this php code, actually if someone searches i get this url search.php?searchquery=test but if I reload the page, the results are cleaned. how can I remove the Sessions to get the Results still, if someone reloads the page? this are the codes:
search.php
<?php
session_start();
?>
<form method="get" action="querygoogle.php">
<label for="searchquery"><span class="caption">Search this site</span> <input type="text" size="20" maxlength="255" title="Enter your keywords and click the search button" name="searchquery" /></label> <input type="submit" value="Search" />
</form>
<?php
if(!empty($_SESSION['googleresults']))
{
echo $_SESSION['googleresults'];
unset($_SESSION['googleresults']);
}
?>
querygoogle.php
<?php
session_start();
$url = 'http://www.example.com';
$handle = fopen($url, 'rb');
$body = '';
while (!feof($handle)) {
$body .= fread($handle, 8192);
}
fclose($handle);
$json = json_decode($body);
foreach($json->responseData->results as $searchresult)
{
if($searchresult->GsearchResultClass == 'GwebSearch')
{
$formattedresults .= '
<div class="searchresult">
<h3><a href="' . $searchresult->unescapedUrl . '">' . $searchresult->titleNoFormatting . '</a></h3>
<p class="resultdesc">' . $searchresult->content . '</p>
<p class="resulturl">' . $searchresult->visibleUrl . '</p>
</div>';
}
}
$_SESSION['googleresults'] = $formattedresults;
header("Location: search.php?searchquery=" . $_GET['searchquery']);
exit;
?>
thank you for your help!!
Hey you Objective-C bods.
Does anyone know how I would go about changing (transforming) an image based on the input from the Microphone on the iPhone?
i.e. When a user speaks into the Mic, the image will pulse or skew.
Thanking you!!
I have a C program, and I'd like to have it filter all its input with tr. So, I'd like to start up tr as a child process, redirect my stdin to it, then capture tr's stdout and read from that.
This is my first time building a tool like this, so please bare with me. I'm doing this to learn more about jQuery and AJAX.
Basically, I have a search input and a hidden div. When you start typing in the search input, the hidden div becomes visible and results are brought in. In this case, I'm searching for client names.
It all works fine, however I think my code could be better but I'm not sure exactly where to begin. Each keyup requests a PHP script which accesses a table in a database to find a like string. But in my PHP script, I'm echo'ing some JS/jQuery which I'm not sure is good practice. Below is my code. Am I going about this the right way or am I totally off base? Any suggestions for improvement?
Javascript
$("#search").keyup(function() {
$("#search_results").show("fast");
$.ajax
({
type: "POST",
url: "http://localhost:8888/index.php/welcome/search/" + $("#search").val(),
success: function(html)
{
$("#search_results").html(html);
}
});
});
PHP
function search($search_string = false)
{
if ($search_string)
{
$this->db->like('name', $search_string);
$query = $this->db->get('clients');
if ($query->num_rows() == 0)
{
echo "No client exists.";
}
else
{
foreach ($query->result() as $row)
{
echo '<script>';
echo '
$("#client_results_'.$row->id.'").hide();
$("#'.$row->id.'").toggle(function()
{
$.ajax
({
type: "POST",
url: "http://localhost:8888/index.php/welcome/search_client_ads/" + '.$row->id.',
success: function(html)
{
$("#client_results_'.$row->id.'").html(html).show("fast");
}
});
}, function()
{
$("#client_results_'.$row->id.'").hide("fast").html("");
});';
echo '</script>';
echo '<p><span id="'.$row->id.'">'.$row->name.'</span></p>';
echo '<div id="client_results_'.$row->id.'"></div>';
}
}
}
else
{
echo '';
}
}
function search_client_ads($client_id)
{
$query = $this->db->get_where('online_ads', array('client' => $client_id));
if ($query->num_rows() == 0)
{
echo "No ads exist.";
}
else
{
foreach ($query->result() as $row)
{
echo $row->id;
}
}
}
I'm still very new to codeigniter. The issue i'm having is that the file uploads fine and it writes to the database without issue but it just doesn't return me to the upload form. Instead it stays in the do_upload and doesn't display anything. Even more bizarrely there is some source code behind the scenes. Can someone tell my what it is i'm doing wrong because I want to be returning to my upload form after submission. Thanks in advance. Below is my code:
Controller:
function do_upload()
{
if($this->Upload_model->do_upload())
{
$this->load->view('home/upload_form');
}else{
$this->load->view('home/upload_success', $error);
}
}
Model:
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2000';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
return $error;
}
else
{
$data = $this->upload->data();
$full_path = 'uploads/' . $data['file_name'];
$spam = array(
'image_url' => $full_path,
'url' => $this->input->post('url')
);
$id = $this->input->post('id');
$this->db->where('id', $id);
$this->db->update('NavItemData', $spam);
return true;
}
}
View (called upload_form):
<html>
<head>
<title>Upload Form</title>
</head>
<body>
<?php if(isset($buttons)) : foreach($buttons as $row) : ?>
<h2><?php echo $row->image_url; ?></h2>
<p><?php echo $row->url; ?></p>
<p><?php echo $row->name; ?></p>
<p><?php echo anchor("upload/update_nav/$row->id", 'edit'); ?></p>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>
How do I convert this:
[True, True, False, True, True, False, True]
Into this:
'AB DE G'
Note: C and F are missing in the output because the corresponding items in the input list are False.
I wanted the user to input values in "dd MMM yyyy" format Only, I'm using dataGridView1.Columns["Rel_Date"].DefaultCellStyle.Format = "dd MMM yyyy"; in Form_Load.........
But somehow it's not working.
Here is the question:
Many companies normally charge a shipping and handling fee for purchases. Create a Web page that allows a user to enter a purchase price into a text box - include a JavaScript function that calculates shipping and handling. Add functionality to the script that adds a minimum shipping and handling fee of $1.50 for any purchase that is less than or equal to $25.00. For any orders over $25.00, add 10% to the total purchase price for shipping and handling, but do not include the $1.50 minimum shipping and handling fee. After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box.
I am beginner at JavaScript and struggling to get my code to work. It does display an alert box with the value entered by the user but doesn't add anything. Although, I don't know why the formula doesn't work. Please help.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calculating Shipping & Handling</title>
<script type="text/javascript">
/* <![CDATA[ */
var price=[];
var shipping=[];
var total=price+shipping;
function calculateShipping(){
if (price <= 25){
shipping = (price + 1.5);
}
else {
shipping = (price * 10 / 100);
}
window.alert("The purchase price with shipping is "
+ document.calculate.ent.value);
}
/* ]]> */
</script>
</head>
<body>
<form name ="calculate" action="" >
<p>Enter Purchase Price</p>
<input type="text" name="ent" >
<input type="button" name="button" value="Submit" onClick="calculateShipping()" />
</form>
</body>
</html>
Ok, here is the question.
Imagine I have a ModelForm which have only two fields. like this one:
class ColorForm(forms.Form):
color_by_name = forms.CharField()
color = forms.IntegerField(widget = forms.Select(choices=COLOR_CHOICES))
So a user can either input a color name, a choose it from a list. Color is required, but that doesn't mean, that user should enter it manually. There do I put validation, so that my code checks if user selected color in dropdownlist and if not then he should write it manually?
I am looking for a way to capture the user interactions with a text input control in Flash over a period of time (not a screen cast)?
For example: If the user enter some text, then delete, then enter something, I would be able to store that interaction as it happens and replay that later. Any help would be extremely useful
Thanks
I have a gwt application that uses the map api for a mapWidget. I added the integrated search for the map with setGoogleBarEnabled(true). It works fine, but the input field is 6px height.
How can I resize it?
Thanks
Balint
I'm writing an app in which I'm trying to change the pitch of the audio when I'm recording a movie (.m4v). Or by modifying the audio pitch of the movie afterwards. I want the end result to be a movie (.m4v) that has the original length (i.e. same visual as original) but with modified sound pitch, e.g. a "chipmunk voice". A realtime conversion is to prefer if possible.
I've read alot about changing audio pitch in iOS but most examples focus on playback, i.e. playing the sound with a different pitch.
In my app I'm recording a movie (.m4v / AVFileTypeQuickTimeMovie) and saving it using standard AVAssetWriter. When saving the movie I have access to the following elements where I've tried to manipulate the audio (e.g. modify the pitch):
audio buffer (CMSampleBufferRef)
audio input writer (AVAssetWriterAudioInput)
audio input writer options (e.g. AVNumberOfChannelsKey, AVSampleRateKey, AVChannelLayoutKey)
asset writer (AVAssetWriter)
I've tried to hook into the above objects to modify the audio pitch, but without success.
I've also tried with Dirac as described here: Real Time Pitch Change In iPhone Using Dirac
And OpenAL with AL_PITCH as described here: Piping output from OpenAL into a buffer
And the "BASS" library from un4seen: Change Pitch/Tempo In Realtime
I haven't found success with any of the above libs, most likely because I don't really know how to use them, and where to hook them into the audio saving code.
There seems to be alot of librarys that have similar effects but focuses on playback or custom recording code. I want to manipulate the audio stream I've already got (AVAssetWriterAudioInput) or modify the saved movie clip (.m4v). I want the video to be unmodifed visually, i.e. played at the same speed. But I want the audio to go faster (like a chipmunk) or slower (like a ... monster? :)).
Do you have any suggestions how I can modify the pitch in either real time (when recording the movie) or afterwards by converting the entire movie (.m4v file)? Should I look further into Dirac, OpenAL, SoundTouch, BASS or some other library?
I want to be able to share the movie to others with modified audio, that's the reason I can't rely on modifying the pitch for playback only.
Any help is appreciated, thanks!
Hi all,
I want list of software installed on VM's & condition is those VM's are in Offline mode not in running mode and this list should display on main OS
is it possible in KVM virtualization ?
any input really appriataite !!!!
I have a input that the user types a search parameter into, at the moment i have it on keyup to do a POST ajax request to a PHP script that returns search results. however its firing off 50 billion (not literally) post requests in about 10 seconds (as the user types) which slows the whole experience down. Can i use jQuery to detect a "wordup" rather than "keyup" by detecting the use of the space bar?
Does this make sense?
I have this code working on Safari and Chrome , but not in Firefox . Is firefox having a problem with StopPropagation() ?
$(function() {
// Setup drop down menu
$('.dropdown-toggle').dropdown();
// Fix input element click problem
$('.login-menu form').click(function(e) {
alert( e.isPropagationStopped() );
e.stopPropagation();
alert( e.isPropagationStopped() );
});
});
Trying to merge some data that I have. The input would look like so:
foo bar
foo baz boo
abc def
abc ghi
And I would like the output to look like:
foo bar baz boo
abc def ghi
I have some ideas using some arrays in a shell script, but I was looking for a more elegant or quicker solution.
Hello,
Say I have a test like:
void TestSomething(int someParam)
{
// Test code
}
I would like to execute this test with a set of "someParam" values. I could write explicit [Test] fixtures calling TestSomething() with the parameters, which means having N methods for every TestSomething() method. I could write another [Test] method looping on "someParam" values and calling TestSomething(), it means 2 methods for every test, and the test report is not as good as with individual TestSomethingWithXValue() methods.
So, is there any way to programmatically generate fixtures for every test methods and input values?
Hi
I have a tooltip for each datagrid row. Which is fine. I also can style it with with mx:Style which is great.
However, I desire to have multiple styles ie a header and the rest of the text in the tooltip. Is this possible? Or to have htmlText for input?
I'm writing a bunch of scripts that present images serially (e.g. 1 per second) and require the user to make either a keyboard or mouse response.
I'm using closures to handle the timing of image presentation and user input. This causes garbage collection to happen pretty frequently and I'm wondering if that will affect the performance (viz. timing of image presentation).
Is it possible to replace the following with a list comprehension?
res = []
for a, _, c in myList:
for i in c:
res.append((a, i))
For example:
# Input
myList = [("Foo", None, [1, 2, 3]), ("Bar", None, ["i", "j"])]
# Output
res = [("Foo", 1), ("Foo", 2), ("Foo", 3), ("Bar", "i"), ("Bar", "j")]
I am implementing a distributed chat system, in this system we have the following options :
Make the client and server running at each node run as separate threads. The server acting as the receiver will be running as the daemon thread and the client taking the user input as a normal thread.
Fork two processes one for the client and one for the server.
I am not able to reason out with which one to proceed. Any insight would be great !
Hi, if I have a input with new lines in it like:
[INFO]
xyz
[INFO]
How can I pull out the xyz part. I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me:
Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6.
I've been trying things to get interpolation to stop like using qr// but alas, no love.