I have a long int variable that I need to convert to a signed 32bit hexadecimal string (8 characters) (char array) without the "0x" at the start?
How would I go about doing this?
Thanks.
Hi,
I am going to create an xml element in javascript to exchange data with server side. I found I can do it with document.createElement.But I do not know how to convert it to string. Is there any API in browser to make it easier? Or is there any js lib incudling this API?
Thanks in advance.
According to CI's docs, CodeIgniter uses a segment-based approach, for example:
example.com/my/group
If I want to find a specific group (id=5), I can visit
example.com/my/group/5
And in the controller, define
function group($id='') {
...
}
Now I want to use the traditional approach, which CI calls "query string" URL. Example:
example.com/my/group?id=5
If I go to this URL directly, I get a 404 page not found. So how can I enable this?
I need something similar to List<String, Int32, Int32>. List only supports one type at a time, and Dictionary only two at a time. Is there a clean way to do something like the above (a multidimensional generic list/collection)?
I have some strings which contain the words LIMIT 3, 199 or LIMIT 0, 100.
Basically I want to replace the word LIMIT and everything after it in my string.
How do I do this in PHP? str_replace only replaces an item and the LIMIT text after is dynamic/
So it could be
WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT LIMIT, 121
// RETURN WOULD BE
WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT
WHEN JOHN TRIED LIMIT 343, 333 HE FOUND
// RETURN WOULD BE
WHEN JOHN TRIED
I want to define the block as a string, then create the lambda.
The following example does not work.
Is something like this possible?
code_string = "|x|x*2"
l = lambda {eval(code_string)}
l.call(3) => 6
I have the following input:
Hi! How are you? <script>//NOT EVIL!</script>
Wassup? :P
LOOOL!!! :D :D :D
Which is then run through emoticon library and it become this:
Hi! How are you? <script>//NOT EVIL!</script>
Wassup? <img class="smiley" alt="" title="tongue, :P" src="ui/emoticons/15.gif">
LOOOL!!! <img class="smiley" alt="" title="big grin, :D" src="ui/emoticons/5.gif"> <img class="smiley" alt="" title="big grin, :P" src="ui/emoticons/5.gif"> <img class="smiley" alt="" title="big grin, :P" src="ui/emoticons/5.gif">
I have a function that escapes HTML entites to prevent XSS. So running it on raw input for the first line would produce:
Hi! How are you? <script>//NOT EVIL!</script>
Now I need to escape all the input, but at the same time I need to preserve emoticons in their initial state. So when there is <:-P emoticon, it stays like that and does not become <:-P.
I was thinking of running a regex split on the emotified text. Then processing each part on its own and then concatenating the string together, but I am not sure how easily can Regex be bypassed? I know the format will always be this:
[<img class="smiley" alt="]
[empty string]
[" title="]
[one of the values from a big list]
[, ]
[another value from the list (may be matching original emoticon)]
[" src="ui/emoticons/]
[integer from Y to X]
[.gif">]
Using the list MAY be slow, since I need to run that regex on text that may have 20-30-40 emoticons. Plus there may be 5-10-15 text messages to process. What could be an elegant solution to this? I am ready to use third-party library or jQuery for this. PHP preprocessing is possible as well.
Hey guys,
How do I go about setting a string as a literal variable in PHP? Basically I have an array like
$data['setting'] = "thevalue";
and I want to convert that 'setting' to $setting so that $setting becomes "thevalue".
Thanks for any help!
Is there a way in objective-c/Cocoa to alloc an object when the class name isn't know until run-time. I seem to remember something about this a while ago, but can't find anything on it now.
Something like:
[[@"MyClass" alloc] init];
I seem to recall a function that would return some kind of class id based on a string that can then be used to alloc the object.
My emacs hangs (Ubuntu 9 + emacs 23 + pyflakes) when I type """ quotes for string blocks.
anybody experience the same problem? I think, it may not be the emacs problem but some python mode or pyflakes which I use it for error checking.
Anybody hot around the issue? It really frustrating experience.
I have the following line of code.
<%= Html.Encode(string.Join(", ", item.company1.companies.Select(x => x.company_name).ToArray())) %>
Would it be possible to somehow replace the comma with a line break?
I am using GWT Anchor, but when I pass a url encoded string to the setHref function, the browser displays the link in a decoded format. What's the reason for this? Is there a fix for it?
Anchor a = new Anchor();a.setHref(URL.encode(someString));
Hi Guys,
considering the following enum:
public enum LeadStatus
{
Cold = 1,
Warm = 2,
Hot = 3,
Quote = 5,
Convert = 6
}
How can I convert the integer value back to string when I pull the value from a database. I've tried:
DomainModel.LeadStatus status = (DomainModel.LeadStatus)Model.Status;
but all I seem to get is "status = 0"
I'm working with a database that has a bunch of serial numbers that are prefixed with leading 0's.
So a serial number can look like 00032432 or 56332432.
Problem is with PHP I don't understand how the conversion system with octals works.
A specific example is that I'm trying to convert and compare all of these integer based numbers with strings.
Is it possible to convert an octal, such as 00234 to a string like "00234" so that I can compare it?
I have to build a string like this
{ name: "john", url: "www.dkd.com", email: "[email protected]" }
where john, www.dkd.com and [email protected] are to be supplied by variables
I tried to do the following
s1 = "{'name:' {0},'url:' {1},'emailid:' {2}}"
s1.format("john","www.dkd.com","[email protected]")
I am getting the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: "'name"
Dont able to understand what I am doing wrong
Hi,
I am not so good with regex. I am struggling to find a solution for a small functionality.
I have a ajax response which returns a string like "Your ticket has been successfully logged. Please follow the link to view details 123432."
All I have to do is replace that number 123432 with <a href="blablabla.com?ticket=123432"> using javascript.
Assume:
Elf_Section_Header *sectionHeaderTable //points to the start of a ELF section header table
Elf_Section_Header *symtabHeader //points to the start of the symtab section header
Why doesn't the following point me to the associated string table section header?
Elf_Section_Header *strTabSectionHeader = (Elf_Section_Header *)((char *)sectionHeaderTable + (symtabHeader-strtab_index));
'strTabSectionHeader-type == SHT_STRTAB' is equal to false
How should I point ot the strTabSectionHeader?
I have a list that has some chapter numbers in string.
When I sort the keys using keys function, it gives me wrong results.
keys = ['1.1', '1.2', '2.1', '10.1']
keys.sort()
print keys
['1.1', '1.2', '10.1', '2.1']
How can I use the sort function to get
['1.1', '1.2', '2.1', '10.1']
What if the array has something like this?
['1.1.1', '1.2.1', '10.1', '2.1'] - ['1.1.1','1.2.1','2.1','10.1']
By using document.referrer we will get all the reference of url in javascript.ie,may be output like follows
http://localhost/testwordpress/wp-admin/admin.php?page=thesis-options&upgraded=true.From this output how can we differentiate the query string part only ( ie,?page=thesis-options&upgraded=true).Is there any method in javacript?Please help anybody knows........
Suppose I have a string that contains '¿'. How would I find all those unicode characters? Should I test for their code? How would I do that?
I want to detect it to avoid sax parser exception which I am getting it while parsing the xml
saved as a clob in oracle 10g database.
Exception
javax.servlet.ServletException: org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.
Is there a way to convert a date to a string in Sqlite? For example I am trying to get the min date in Sqlite:
SELECT MIN(StartDate) AS MinDate FROM TableName
I know in SQL Server I would use the SQL below to accomplish what I am trying to do:
SELECT CONVERT(VARCHAR(10), MIN(StartDate), 101) AS MinDate FROM TableName
Thanks!
hi
i want to know how to receive the string from file in java...
that file have different language letters...
i used UTF-8 format... this can receive some language letters correctly...
but Latin letters cant display correctly...
so how can i receive all language letters...
or any other format for receive all language letters...
thanks and advance
I have no clue how to validate this string. I am simply supplying an IV for an encryption, but can find no "is_hex()" or similar function, I can't wrap my head around it! I read on a comment in the php documentation (user contrib. notes) this:
if($iv == dechex(hexdec($iv))) {
//True
} else {
//False
}
But that doesn't seem to work at all.. It only says false.
If it helps my input of my IV would be this:
92bff433cc639a6d