Hi all, I'm using this piece of code I found (http://impnerd.com/wordpress-hack-add-post-images-to-your-homepage) to display the first image uploaded to a post on the homepage next to the excerpts of posts. I'm doing this outside the main loop on the homepage, and have been having problems. When I do rewind_posts() to get the same loop r...
Consider such loop:
for(var it = 0; it < 2; it++)
{
setTimeout(function() {
alert(it);
}, 1);
}
The output is:
=> 2
=> 2
I would like it to be: 0, 1. I see two ways to fix it:
Solution # 1.
This one based on the fact that we can pass data to setTimeout.
for(var it = 0; it < 2; it++)
{
setTimeout(function(data...
Hi, My test uses Selenium to loop through a CSV list of URLs via an HTTP proxy (working script below). As I watch the script run I can see about 10% of the calls produce "Proxy error: 502" ("Bad_Gateway"); however, the errors are not captured by my catch-all "except Exception" clause -- ie: instead of writing 'error' in the appropriate r...
heres my code:
start /realtime /b /wait .\jampDed.exe
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%f
start .\Serv.bat
cmd
this batch is supposed to run the program in a window, and when it quits, is supposed to rename the file qconsole.log to the current time, and then relaunch the...
Hi,
I have opened a file with blast results and printed out the hits in fasta format to the screen.
the code looks like this:
result_handle = open("/Users/jonbra/Desktop/my_blast.xml")
from Bio.Blast import NCBIXML
blast_records = NCBIXML.parse(result_handle)
blast_record = blast_records.next()
for alignment in blast_record.alignmen...
We have all heard of how in a for loop, we should do this:
<?php
for ($i = 0, $count = count($array); $i < $c; ++$i)
{
// Do stuff while traversing array
}
?>
instead of this:
<?php
for ($i = 0; $i < count($array); ++$i)
{
// Do stuff while traversing array
}
?>
for performance reasons (i.e. initializing $count would've...
In most cases, validation methods I've overridden execute twice each time the parent field is changed. Everything still works, but the InfoLog displays double messages every time.
Is there any way to prevent this?
Thanks
public boolean validate()
{
boolean ret;
int exlowValue;
int lowValue;
int highValue;
int exhi...
This may be simple to some of you guys but im a novice coder. How do i make this foreach loop terminate after i loops. The number keeps resetting as it loops through another condition. There are multiple a's. About 100 so it i never gets up to 250.
$i = 0;
foreach ($a as $b) {
//do function
i++;
if (i == 250)
{
exit;...
I would like do something like that.
list_of_urls = ['http://www.google.fr/', 'http://www.google.fr/',
'http://www.google.cn/', 'http://www.google.com/',
'http://www.google.fr/', 'http://www.google.fr/',
'http://www.google.fr/', 'http://www.google.com/',
'http://www.goo...
I'm writing a little genetic algorithm in Java, as a school assignment. Up until now I've pretty much stuck to doing console applications. However I think a UI would be really helpful for this program, so I'd like to make one. I'm having trouble figuring out how to reconcile a GUI which is event-driven, and a console application which ha...
Hello,
I have a small program wrote in prolog. At the moment I can print the first result with
test(X, 1, 4, 5).
write(X).
But if there is more than one result for X, How do I print the next ones?
Thanks
~ KyleG
...
Hi,
I'm trying to read a list of items from a text file and format with square brackets and separators like this: ['item1','item2', .... 'last_item'] but I'm having trouble with the beginning and end item for which I always get: ...,'last_item','], so I do not want the last ,' to be there.
In python I've write:
out_list = "['"
for...
Part One
I want to .htaccess redirect all HTML files to the home page. I looked at this guy's question (http://bit.ly/3l9K86), and wrote this code:
RewriteCond %{HTTP_HOST} ^pandamonia.us$ [OR]
RewriteCond %{HTTP_HOST} ^www.pandamonia.us$
RewriteRule .*\.html$ "http\:\/\/pandamonia\.us\/" [L]
but the problem is that it also redir...
Hay all im using a simple look to get file names from a dir
if ($handle = opendir('news_items/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
}
}
}
the files are being outputted news last, oldest first.
How can i reverse this so the newest files are first?
...
HI
I'm trying to create an application in the Win32 environment containing more than one window.
How do i do that? all the Win32 Tutorials on web i found only showed how to manage one window.
How do i create the second window, and how do i handle messages for both of them together?
(i understood i'm supposed to have only one message loop...
As far as I know, the code below gets a shape from the active window, nudges it a bit, copies the slide and pastes it right after the current one, then turns the pasted slide into an active window, and nudges it again:
Sub Test()
' Get the active presentation
Dim oPresentation As Presentation
Set oPresentation = ActivePresentation
...
G'day all,
Trying to output the results of the task I'm running in a FOR loop with additional data. In this case, I'm using the FOR loop to read in server names from a text file to setup a scheduled job. I would like to capture the results on each loop and output to a log file but need to insert additional information such as server nam...
I'm able to parse through the directory and list all images with any of the functions below. I just need to insert a class="last" attribute into the img tag of the last element in the loop.
Also, which of these functions works best for what I'm trying to do?
Any help much appreciated!
function get_images1() {
$exts = 'jpg jpeg png gi...
Okay, basically... i am trying to store the dates and month name from my database in this format. I am aiming store the month and then count the entries in that month and then store the count. This is my loop, but I have trouble formatting the array properly.
while ( $row = mysql_fetch_assoc($res) ) {
if ($row['Date'] != $prev_date) {...
There are many functions within the code I am maintaining which have what could be described as boilerplate heavy. Here is the boilerplate pattern which is repeated ad nausea throughout the application when handling DB I/O with a cursor:
if( !RowValue( row, m_InferredTable->YearColumn(), m_InferredTable->YearName(), m_InferredTable->Ta...