Hi,
I have installed eclipse with CDT. I have GNU compiler tool chain installed on my PC. But I need to replace the GNU compiler tool chain with our own Tool chain, how can I do this
Hi There I need some help
I am looking for a regex that would match the last space character in a string.
I am using Javascript and Classic ASP
If there is someone that could maybe point me in the right direction
I have a long string of text which I trim to 100 characters.
I would like to remove the last character to avoid a spelling mistake if the trim cuts a word due to the 100 characters limit
regex.replace(/[ ]$.*?/ig, '');
Anybody with ideas?
Thanks
Hello all,
I am not a regex specialist, so I need some help with this.
I have a text file, and I need to remove some trailing delimiters.
The text file looks like this:
MSH|^~\&|OAZIS||||20101029135359||ADT^A31|00000015|P|2.3.1||||||ASCII
EVN|A31|20101029135359^^^^||||19900101
So I think the best way is to do a Regex replace?
Can anyone help me with this regex?
I want to remove all ^ that come before a |
So test^A^^| has to become test^A|
Thanks
Hi Guys,
I code in C# (ASP.NET) and am using Forms authentication.
I would like to know which is the best method to change a user password without using the asp:ChangePassword control.
I dont want to use the reset password method.
I just want to grab the password i have inside my textbox and replace it with my older password.
Please note that the PasswordFormat I use is passwordFormat="Hashed"
Some code snippets would be helpful
Regards,
Naveen Jose
There are lots of apps where the searchbar moves upwards if active and moves down when it is inactive. There is a sample code from apple available which works with IB, but how can I achieve this behavior programmatically? Mostly it is combined with a navigationbar which moves out of the screen in replace with the searchbar
I am hesitant just to look at some env.vars and try to replace things with regexes. So is there a ready method to print relative pathnames system-independently?
$ echo ~
/u/user
$ pwd
/u/user/OH/one/src
$ echo "Like relative pathnames ~/OH/one/src, not /u/user/OH/one/src."
Hi all,
A fellow developer on a project I am on believes that doctests are as good as unit-tests, and that if a piece of code is doctested, it does not need to be unit-tested. I do not believe this to be the case. Can anyone provide some solid, ideally cited, examples either for or against the argument that doctests do not replace the need for unit-tests?
Thank you
-Daniel
Is there a way to get the list of currently running threads in objective-C?
I'm mostly interested in getting the NSThreads objects, cause i want to replace the assertion handler for each running thread?
If such thing is not possible, maybe i could set my own selector to be invoked after any thread is spawn(so that i could do the assertion handler replacement over there)?
Why doesn't this assign prepClass to the string selectorClass with underscores instead of non alpha chars? What do I need to change it to?
var regex = new RegExp("/W/", "g");
var prepClass = selectorClass.replace(regex, "_");
I got the code
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "C:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine,"ex3")> 0 Then
strLine = Replace(strLine,"ex3","ex5")
End If
WScript.Echo strLine
Loop
The strLine replacing part i can fix myself to use with my own purposes, but how do i do something like this so that it doesn't require the file's name, it just edits all text files within the document?
Is there anyway to serve a file from a web server through the web, that is not within the web application.
I am using Tomcat and a Java servlets based application.
I don't want to put the files within the webapp because they are several 100GB and I will have to replace them every time I update the WAR if I put them inside it.
I have a timeseries of samples in R:
> str(d)
'data.frame': 5 obs. of 3 variables:
$ date: POSIXct, format: "2010-03-04 20:47:00" "2010-03-04 21:47:00" ...
$ x : num 0 10 11 15.2 20
$ y : num 0 5 7.5 8.4 12.5
> d
date x y
1 2010-03-04 20:47:00 0.0 0.0
2 2010-03-04 21:47:00 10.0 5.0
3 2010-03-04 22:47:00 11.0 7.5
4 2010-03-04 23:47:00 15.2 8.4
5 2010-03-05 00:47:00 20.0 12.5
In this example samples for x and y are taken every hour (but the time delta is not fix).
The x and y values are always growing (like a milage counter in a car). I need the deltas,
how much was the growth in between, something like this:
1 2010-03-04 20:47:00 0.0 0.0
2 2010-03-04 21:47:00 10.0 5.0
3 2010-03-04 22:47:00 1.0 2.5
4 2010-03-04 23:47:00 4.2 0.9
5 2010-03-05 00:47:00 4.8 4.1
And I also need the detlas per time (x and y delta, divided by the time - delta per hour)
How would I do this in R?
Hello,
1) How to read the data from read stream in Objective-C,
Below code would give me how many bytes are read from stream, but how to know what data is read from stream?
CFIndex cf = CFReadStreameRead(Stream, buffer, length);
2) How to extract only the 1st 2bytes of NSString in Objective-C in iPhone programming.
For Ex: If this is the string
NSString *str = 017MacApp;
1st byte has 0 in it, and 2nd byte has 17 in it.
how do i extract o and 17 into byte array?
I know that the below code would give me back the byte array to int value.
((b[0] & 0xFF) << 8)+ (b[1] & 0xFF);
but how to put 0 into b[0] and 17 into b[1]?
plz help me to solve this.
I am looking at some JS code from the 20th century, and they are using document.layers in code that is trying to get the current key code. What browser are they sniffing for?
i am about to replace the code with something like this:
var fn = function(event){
event = event || window.event;
var code = event.charCode || event.keyCode;
}
but i am afraid of breaking something arcane and releasing the evil
I'm wondering if using a CASE statement in SQLite (or other SQL engines) to replace data is not advised. For example lets say I have a query.
SELECT Users,
CASE WHEN Active = 0 THEN 'Inactive'
WHEN Active = 1 THEN 'Active'
WHEN Active = 2 THEN 'Processing'
ELSE 'ERROR' AS Active
FROM UsersTable;
When is it better to create a reference table and perform a JOIN. In this case I would create a Table 'ActiveStatesTable' with ActiveID, ActiveDescription and perform the JOIN.
I have a HTML string in ISO-8859-1 encoding. I need to pass this string to HTML:Entities::decode_entities() for converting some of the HTML ASCII codes to respective chars. To so i am using a module HTML::Parser::Entities 3.65 but after decode_entities() operation my whole string changes to utf-8 string. This behavior seems fine as the documentation of the HTML::Parse. As i need this string back in ISO-8859-1 format for further processing so i have used Encode::encode("iso-8859-1",$str) to change the string back to ISO-8859-1 encoding.
My results are fine excepts for some chars, a question mark is coming instead. One example is single quote ' ASCII code (’)
Can anybody help me if there any limitation of Encode module? Any other pointer will also be helpful to solve the problem.
Thanks
How would i write a program, using the replace method, that rotates the vowels in a word? meaning the letter 'a' would be 'e', 'e' would be 'i', 'i' would be 'o', 'o' would be 'u', and finally 'u' would be 'a'.
For example, the word "instructor" would be "onstractur".
I hope someone can answer my problem.
Is there a way to show HTML code-snippets on a webpage without needing to replace each < with < and with >?
In other words, is there some tag which simply says "Don't render html until you hit the closing tag?"
I am looking to replace a nasty shell script that uses awk to trim down some html, problem is I cannot find anything in perl that does the aforementioned function
awk '/<TABLE\ WIDTH\=\"100\%\" BORDER\=1\ CELLSPACING\=0><TR\ class\=\"tabhead\"><TH>State<\/TH>/,/END/'
How can I do this in perl?
memset to initilize data member- What is the benefit of initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general?
class A {
public:
A();
private:
int a;
float f;
char str[35];
long *lp;
};
A::A()
{
memset(this, 0, sizeof(*this));
}
Hi,
Can anybody help me writting a regular expression to replace these characters with a empty string. Character list is given below.
public static char[] delimiters = { ' ', '\r', '\n', '?', '!', ';', '.', ',', '`', ':', '(', ')', '{', '}', '[', ']', '|', '\'', '\\', '~', '=', '@', '>', '<', '&', '%', '-', '/', '#' };
Thanks.
Subrat.
Hello everyone, Im really really new to Javascript but Ive got this script that loads the contents of a url and everything works fine. I call the plannerSpin function with an onClick method on a button but how would I go about displaying an animated gif whilst all this is going on?
var xmlHttp
function plannerSpin(str) {
xmlHttp = GetXmlHttpObject()
if (xmlHttp == null) {
alert("Browser does not support HTTP Request")
return
}
var url = "/recipes/planner/data"
xmlHttp.onreadystatechange = stateChanged
xmlHttp.open("GET", url, true)
xmlHttp.send(null)
}
function stateChanged() {
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
document.getElementById("recipe_planner_container").innerHTML = xmlHttp.responseText
}
}
function GetXmlHttpObject() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I have a question about how MS SQL evaluates functions inside CTEs. A couple of searches didn't turn up any results related to this issue, but I apologize if this is common knowledge and I'm just behind the curve. It wouldn't be the first time :-)
This query is a simplified (and obviously less dynamic) version of what I'm actually doing, but it does exhibit the problem I'm experiencing. It looks like this:
CREATE TABLE #EmployeePool(EmployeeID int, EmployeeRank int);
INSERT INTO #EmployeePool(EmployeeID, EmployeeRank)
SELECT 42, 1
UNION ALL
SELECT 43, 2;
DECLARE @NumEmployees int;
SELECT @NumEmployees = COUNT(*) FROM #EmployeePool;
WITH RandomizedCustomers AS (
SELECT CAST(c.Criteria AS int) AS CustomerID,
dbo.fnUtil_Random(@NumEmployees) AS RandomRank
FROM dbo.fnUtil_ParseCriteria(@CustomerIDs, 'int') c)
SELECT rc.CustomerID,
ep.EmployeeID
FROM RandomizedCustomers rc
JOIN #EmployeePool ep ON ep.EmployeeRank = rc.RandomRank;
DROP TABLE #EmployeePool;
The following can be assumed about all executions of the above:
The result of dbo.fnUtil_Random() is always an int value greater than zero and less than or equal to the argument passed in. Since it's being called above with @NumEmployees which has the value 2, this function always evaluates to 1 or 2.
The result of dbo.fnUtil_ParseCriteria(@CustomerIDs, 'int') produces a one-column, one-row table that contains a sql_variant with a base type of 'int' that has the value 219935.
Given the above assumptions, it makes sense (to me, anyway) that the result of the expression above should always produce a two-column table containing one record - CustomerID and an EmployeeID. The CustomerID should always be the int value 219935, and the EmployeeID should be either 42 or 43.
However, this is not always the case. Sometimes I get the expected single record. Other times I get two records (one for each EmployeeID), and still others I get no records. However, if I replace the RandomizedCustomers CTE with a true temp table, the problem vanishes completely.
Every time I think I have an explanation for this behavior, it turns out to not make sense or be impossible, so I literally cannot explain why this would happen. Since the problem does not happen when I replace the CTE with a temp table, I can only assume it has something to do with the functions inside CTEs are evaluated during joins to that CTE. Do any of you have any theories?
I want to read a YML document, filter it by modifying some nodes in memory, and then spit it back out with an emitter. The problem is that YAML::Node appears to be designed to be read-only. Is there a way to replace a node's value (with a scalar in this case) that I'm missing?
Hello StackOverflow community,
Using Google App Engine, I wrote a keyToSha256() method within a model class (extending db.Model) :
class Car(db.Model):
def keyToSha256(self):
keyhash = hashlib.sha256(str(self.key())).digest()
return keyhash
When displaying the output (ultimately within a Django template), I get garbled text, for example :
?????_??!`?I?!?;?QeqN??Al?'2
I was expecting something more in line with this :
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
Am I missing something important ? Despite reading several guides on ASCII, Unicode, utf-8 and the like, I think I'm still far from mastering the secrets of string encoding/decoding. After browsing StackOverflow and searching for insights via Google, I figured out I should ask the question here. Any idea ? Thanks !