for writing images on a html page i want to write only " after closing are anyone tell me about this then how i can write this
means to say that
<img src = " <% code is here %> " />
Say I have my class
@interface Person : NSObject { NSString *name; }
I need to get the name of NSString's within my class
Person *person = [[Person alloc] init];
NSLog(@"Name of variable %s\n", NameofVariable(person.name));
Using the pysnmp framework i get some values doing a snmp walk. Unfortunately for the oid
1.3.6.1.21.69.1.5.8.1.2 (DOCS-CABLE-DEVICE-MIB)
i get a weird result which i cant correctly print here since it contains ascii chars like BEL ACK
When doing a repr i get:
OctetString('\x07\xd8\t\x17\x03\x184\x00')
But the output should look like:
2008-9-23,3:24:52.0
the format is called "DateAndTime". How can i translate the OctetString output to a "human readable" date/time ?
I'm freaking out here and can't figure out what's wrong. I'm pretty new to PDO, but everything works in my code except for booleans which are sent as strings.
My code (simplified):
$sql = 'SELECT * FROM pages WHERE clean_url_slo = :clean_url_slo AND published = :published LIMIT 1';
$clean_url_slo = 'home';
$published = true;
Then I prepare stuff and execute it like this (simplified):
$stmt = $db->prepare($sql);
$stmt->bindValue(':clean_url_slo',$clean_url_slo,PDO::PARAM_STR);
$stmt->bindValue(':published',$published,PDO::PARAM_BOOL);
$stmt->execute();
And then here is what comes to mysql (from the mysql log - the query mysql received):
91 Query SELECT * FROM pages WHERE 1=1 AND clean_url_slo='domov' AND published='1' ORDER BY id desc LIMIT 1
As you can see, published is an integer - so always true, which is not OK. Why is that if I'm declaring it as a boolean?
using:
WAMP SERVER
PHP version: 5.3.9
Mysql: 5.5.20
Many thanks for your help..
Theres a problem. I can't set value of BorderBrush fros C#-code (not in XAML):
((Border)((Image)sender).Parent).BorderBrush = "#FFBCC7D8";
How to solve this problem?
DECLARE @STR_IDS VARCHAR(15)
SET @STR_IDS='7,15,18'
UPDATE TBL_USERS WHERE ID IN @STR_IDS
I know the update statement would not work as the ID is of type INT and i am replacing a varachar value there .How can i change the query so that it will be executed like this in effect ?
UPDATE TBL_USERS WHERE ID IN (7,15,18)
Thanks in advace
I'm loading several external JSON files and want to check if they have been successfully cached before the the next screen is displayed. My strategy is to check the name of the array to see if it an object. My code works perfectly when I check only a single array and hard code the array name into my function. My question is: how can i make this dynamic?
not dynamic: (this works)
$("document").ready(){
checkJSON("nav_items");
}
function checkJSON(){
if(typeof nav_items == "object"){
// success...
}
}
dynamic: (this doesn't work)
$("document").ready(){
checkJSON("nav_items");
checkJSON("foo_items");
checkJSON("bar_items");
}
function checkJSON(item){
if(typeof item == "object"){
// success...
}
}
here is the a larger context of my code:
var loadAttempts = 0;
var reloadTimer = false;
$("document").ready(){
checkJSON("nav_items");
}
function checkJSON(item){
loadAttempts++;
//if nav_items exists
if(typeof nav_items == "object"){
//if a timer is running, kill it
if(reloadTimer != false){
clearInterval(reloadTimer);
reloadTimer = false;
}
console.log("found!!");
console.log(nav_items[1]);
loadAttempts = 0; //reset
// load next screen....
}
//if nav_items does not yet exist, try 5 times, then give up!
else {
//set a timer
if(reloadTimer == false){
reloadTimer = setInterval(function(){checkJSON(nav_items)},300);
console.log(item + " not found. Attempts: " + loadAttempts );
}
else {
if(loadAttempts <= 5){
console.log(item + " not found. Attempts: " + loadAttempts );
} else {
clearInterval(reloadTimer);
reloadTimer = false;
console.log("Giving up on " + item + "!!");
}
}
}
}
Is there a quick way in Python to replace strings by starting from the end? For example:
>>> def rreplace(old, new, occurence)
>>> ... # Code to replace the last occurences of old by new
>>> '<div><div>Hello</div></div>'.rreplace('</div>','</bad>',1)
>>> '<div><div>Hello</div></bad>'
I'm building dynamic forms based on a partial view. My view inherits a model with a single property: CatalogName { get; set; }.
I have tried this:
@Html.Label(Model.CatalogName + "-ProductNumber", "Product Number")
@Html.TextBox(Model.CatalogName + "-ProductNumber")
The HTML renders like this though:
<label for>Product Number</label>
<input name="CatatalogName-ProductNumber" type="text" />
If I write my code like this:
@Html.Label("ProductNumber-" + Model.CatalogName", "Product Number")
It will render the way I expect
<label for="ProductNumber-CatalogName">Product Number</label>
Is this a bug with MVC? Are there any answers to why my concatenation won't work the way I want it in the label, but works fine with the TextBox?
Hi, I am stumped...
I am trying to get the following output until a certain condition is met.
test_1.jpg
test_2.jpg
..
test_50.jpg
The solution (if you could remotely call it that) that I have is
fileCount = 0
while (os.path.exists(dstPath)):
fileCount += 1
parts = os.path.splitext(dstPath)
dstPath = "%s_%d%s" % (parts[0], fileCount, parts[1])
however...this produces the following output.
test_1.jpg
test_1_2.jpg
test_1_2_3.jpg
.....etc
The Question: How do I get change the number in its current place (without appending numbers to the end)?
Ps. I'm using this for a file renaming tool.
I have very little programming knowledge; only a fair bit in Visual Basic.
How do I take a value from a text field, then do some simple math such as divide the value by two, then display it back to the user in the same field?
In Visual Basic you could just do txtBoxOne.text = txtBoxOne.text / 2
I understand this question is more than one question and is very basic stuff, but I need to get my head out of Visual Basic and into where I should be :)
I found some partial help but cannot seem to fully accomplish what I need. I need to be able to do the following:
I need an regular expression to replace any 1 to 3 character words between two words that are longer than 3 characters with a match any expression:
For example: walk to the beach == walk(.*)beach
If the 1 to 3 character word is not preceded by a word that's longer than 3 characters then I want to translate that 1 to 3 letter word to ' ?'
For example: on the beach == on ?the ?beach
The simpler the rule the better (of course, if there's an alternative more complicated version that's more performant then I'll take that as well as I eventually anticipate heavy usage eventually).
This will be used in a PHP context most likely with preg_replace. Thus, if you can put it in that context then even better!
Sorry for such a simple question but I can't seem to find the solution.
I am trying to fade in and out some divs.
Divs have an ID of "div1", "div2", "div3".
My code is:
var Divs = new Array("div1", "div2", "div3");
I want to fade out one div and then fade in the next on top of it.
I have a setinterval that runs every 5 seconds and checked it works.
Inside it is this code:
$(Divs[1]).fadeOut(1000);
$(Divs[2]).fadeIn(1000);
However nothing happens when the timer method is ran. Any ideas?
i have question from programming pearls
problem is following
show how to use lomuto's partitioning scheme to sort varying length bit strings in time proportional to the sum oof their length
and algorithm is following
each record in x[0..n-1] has an integer length and pointer to the array bit[0..length-1]
code
void bsort(l,u,depth){
if (l>=u)
return;
for (int i=l;i<u;i++)
if (x[i].length<depth)
swap(i,l++);
m=l;
if (x[i].bit[depth] ==0)
swap(i,m++);
bsort(l,m-1,depth+1);
bsort(m,u,depth+1);
please help me
i need following things
1. how this algorith works
2.how implement in java?
I'm trying to extract some results from a download manager, the format is:
[#8760e4 4.3MiB/40MiB(10%) CN:2 DL:4.9MiB ETA:7s]
what I'd like to extract from the above example, would be an array that looks like this:
['4.3','MiB','40','MiB','10%','4.9','MiB','7','s']
I've tried to split this in various combinations, but nothing seems to be right. Would anyone happen to know how to do this or be able to offer suggestions?
Thank you!
What is the basic setup on the subject?
Let say I have a QByteArray, and I need to encrypt it with simple password.
And then decrypt it in another piece of code
Just a very simple setup
#include "stdio.h"
#include "conio.h"
#include <iostream>
using namespace std;
int main (void)
{
char my_char[] = "happy birthday";
int i;
bool j=false;
char my_char_temp[1];
do
{
for (i=0;i<sizeof(my_char)-2;i++)
{
j=false;
if (my_char[i+1] < my_char[i])
{
my_char_temp[0]=my_char[i+1];
my_char[i+1] = my_char[i];
my_char[i] = my_char_temp[0];
j=true;
}
}
}while (j);
cout << my_char;
}
what am i doing wrong?
im just trying to sort the letters within the char
the output i get is completely wrong
I stored some html contents in a local resource file.
So it has html tags in it such as p, br, div, etc.
I used GetLocalResourceObject("myContent")
to display the content on the page,
but the page doesnt render it as HTML.
E.g.
Declare @str varchar2(20)
Set @str = 'A Student'
Select Reverse(@str)
Output:
tnedutS A
Expected being:
Student A
The output(using Reverse) is as expected. But my requirement is the one described.
Help needed with SET BASED.
I am using SQL SERVER 2005
E.g.
Declare @str varchar2(20)
Set @str = 'A Student'
Select Reverse(@str)
Output:
tnedutS A
Expected being:
Student A
The output(using Reverse) is as expected. But my requirement is the one described.
Help needed with SET BASED.
I am using SQL Server 2005
I just need to validate 2 strings in javascript.
One of them must contain only 0 or more open parenthesis ( .
The other must contain only 0 or more close parenthesis ) .
This means only those characters are allowed in each value.
After spending a lot of time trying to understand the regex, I can't find a way to achieve this. With the escape characters I make a mess of the regex function.
This is what I thought:
/\(*/
Could anyone help me?
Hi,
having a FileStream that I read with a StreamReader (it is a very large file), how can I set the Seek position of the FileStream to the first occurrence of a certain substring so that I can start reading this large file from a given point?
Thanks