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
I am creating a doc file and writing a text containing ^m in it and facing issue. Does this ^m is a special character for doc file ? If I replace ^m with some other characters (like ^m with m or any other) then It works fine. I faced this issue with other characters too like ^a and few other. What could be the solution ?
I want to split the /n from my string in Java. For example, I have one String field which has 2 lines space ( /n). I have to find out lines ( wherever mopre than one lines is coming) and should replace with one line spaces.
"This is Test Message
thanks
Zubair
"
From the above example, there are more spaces between "This is Test Message" and "thanks". So i want to reduce as only one line instead of 2 lines.How to do that?
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
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
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 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
hi, this below mentioned code works perfect in internet explorer but not in firefox... i get an error in line in firefox: document.getElementById("supplier_no").value= values_array[0]; that getElementById returns null. how to solve the problem?
var winName; //variable for the popup window
var g_return_destination = null ; //variable to track where the data gets sent back to.
// Set the value in the original pages text box.
function f_set_home_value( as_Value )
{
if (document.getElementById(g_return_destination[0]).name == "netbank_supplier_name_info" )
{
//clear the old values
for (selnum = 1; selnum <= 5; selnum++)
{
document.getElementById("expense_account"+selnum).value = "";
document.getElementById("expense_account_name"+selnum).value = "";
document.getElementById("expense_vat_flag"+selnum).value = "off";
document.getElementById("expense_vat_flag"+selnum).checked = "";
document.getElementById("expense_vat_amount"+selnum).value = "";
document.getElementById("expense_vat_code"+selnum).value = "";
document.getElementById("expense_period"+selnum).value = "";
document.getElementById("expense_date"+selnum).value = "";
if (selnum!=1) {//these are sometimes defaulted in, and in any case you will always have line1
document.getElementById("expense_more_dept"+selnum).value = "";
document.getElementById("expense_more_prj"+selnum).value = "";
document.getElementById("expense_more_subj"+selnum).value = "";
}
document.getElementById("expense_amount"+selnum).value = "";
}
var values_array = as_Value[0].split("!");
document.getElementById("supplier_no").value= values_array[0];
document.getElementById("supplier_bankAccount_no").value= values_array[1];
str = values_array[2] ;
str = str.split(";sp;").join(" ");
document.getElementById("default_expense_account").value= str;
document.getElementById("expense_account1").value= str;
document.getElementById("expense_more_sok1").disabled= false;
str = values_array[3] ;
str = str.split(";sp;").join(" ");
document.getElementById("payment_term").value= str;
strPeriod = calcPeriod(str,document.getElementById("due_date").value);
document.getElementById("expense_period1").value = (strPeriod);
strExpenseDate = calcExpenseDate(str,document.getElementById("due_date").value);
document.getElementById("expense_date1").value = (strExpenseDate);
str = values_array[4] ;
str = str.split(";sp;").join(" ");
document.getElementById("expense_account_name1").value= str;
str = values_array[5] ;
str = str.split(";sp;").join(" ");
document.getElementById("expense_vat_code1").value= str;
if (str == 0) {
document.getElementById("expense_vat_flag1").checked= '';
document.getElementById("expense_vat_flag1").disabled= true;
}else{
document.getElementById("expense_vat_flag1").checked= 'yes';
document.getElementById("expense_vat_flag1").value= 'on';
document.getElementById("expense_vat_flag1").disabled= false;
}
str = values_array[6] ;
str = str.split(";sp;").join(" ");
document.getElementById("supplier_name").value= str;
var str = values_array[7];
str = str.split(";sp;").join(" ");
str = str.split("&cr;").join("\r");
document.getElementById("netbank_supplier_name_info").value= str;
strx = justNumberNF(document.getElementById("amount").value);
document.all["expense_vat_amount1"].value = NetbankToDollarsAndCents(strx * (24/124)) ;
document.getElementById("amount").value=NetbankToDollarsAndCents(strx);
document.getElementById("expense_amount1").value = document.getElementById("amount").value;
document.getElementById("expense_amount2").value = '';
document.getElementById("expense_account2").value= '';
//document.getElementById("expense_vat_flag2").value= '';
document.getElementById("expense_vat_amount2").value= '';
document.getElementById("expense_amount3").value = '';
document.getElementById("expense_account3").value= '';
//.getElementById("expense_vat_flag3").value= '';
document.getElementById("expense_vat_amount3").value= '';
document.getElementById("expense_amount4").value = '';
document.getElementById("expense_account4").value= '';
//document.getElementById("expense_vat_flag4").value= '';
document.getElementById("expense_vat_amount4").value= '';
document.getElementById("expense_amount5").value = '';
document.getElementById("expense_account5").value= '';
//document.getElementById("expense_vat_flag5").value= '';
document.getElementById("expense_vat_amount5").value= '';
str = values_array[8] ;
str = str.split(";sp;").join(" ");
if (str=="2"){
document.frmName.ButtonSelPeriodisering1.disabled=false;
document.frmName.ButtonSelPeriodisering1.click();
}
winName.close();
}
}
//Pass Data Back to original window
function f_popup_return(as_Value)
{
var l_return = new Array(1);
l_return[0] = as_Value;
f_set_home_value(l_return);
}
function justNumberNF(val){
val = (val==null) ? 0 : val;
// check if a number, otherwise try taking out non-number characters.
if (isNaN(val)) {
var newVal = parseFloat(val.replace(/[^\d\.\-]/g, '.'));
// check if still not a number. Might be undefined, '', etc., so just replace with 0.
return (isNaN(newVal) ? 0 : newVal);
}
// return 0 in place of infinite numbers.
else if (!isFinite(val)) { return 0; }
return val;
};
function NetbankToDollarsAndCents(n) {
var s = "" + Math.round(n * 100) / 100 ;
var i = s.indexOf('.') ;
if (i < 0) {return s + ",00" } ;
var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3) ;
if (i + 2 == s.length) {t += "0"} ;
return t.replace('.',',') ;
}
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 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."
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'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.
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)?
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?
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.
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?
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?
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.
It seems that we have managed to insert into our database 2 unicode characters for each of the unicode characters we want,
For example, for the unicde char 0x3CBC, we've inserted the unicode equivalents for each of it's components (0xC383 AND 0xC2BC)
Can anyone think of a simple solution for fixing this?
I've come up with something like
SELECT replace(name, CONCAT(0xC3,0x83,0xc2,0xbc), CONCAT(0xc3,0xbc)) FROM lang
For the above, but don't want to have to do this for every unicode character!
Hi friends!
In my application I tried to search diff map location using diff lat and long. First time the application show the map but wen i change the lat long and try to invalidate the mapview using diff lat long, map is not refreshed.
Below is my code please have a look and suggest accordingly:
//Source code
protected void onCreate(Bundle icicle) {
// TODO Auto-generated method stub
super.onCreate(icicle);
setContentView(R.layout.main);
infoTextView = (TextView) findViewById(R.id.infoTextView);
// Finding Current Location
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
1l, 1l, this);
Location location = locationManager.getLastKnownLocation("gps");
// mock location by hard-code if DDMS has not sent a fake loc to the emulator.
if (location == null) {
lat = 13.6972 * 1E6;
lng = 100.5150 * 1E6;
} else { // get real location if can retrieve the location sent by DDMS or GPS
lat = location.getLatitude() * 1E6;
lng = location.getLongitude() * 1E6;
}
setGPSLocation(lat, lng);
}
//This is the function which I am calling with different lat and long
public void setGPSLocation(Double lati, Double longi)
{
lat = lati;
lng = longi;
System.out.println("Latitude :"+ lat +" Longitude :"+lng);
// Prepare text being shown
String tmpLoc = LOC_INFO_TEMPLATE;
tmpLoc = tmpLoc.replace("lg", String.valueOf(lng));
tmpLoc = tmpLoc.replace("lt", String.valueOf(lat));
infoTextView.setText(tmpLoc);
// Setup Zoom/Hide Buttons
linearLayout = (LinearLayout) findViewById(R.id.zoomview);
mapView = (MapView) findViewById(R.id.mapview);
mapView.invalidate();
mapView.setBuiltInZoomControls(true); //new by me
mapView.setSatellite(true); // Set satellite view
mZoom = (ZoomControls) mapView.getZoomControls();
linearLayout.addView(mZoom);
// Setup Marker
mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.marker);
itemizedOverlay = new MyItemizedOverlay(drawable);
GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue());
OverlayItem overlayitem = new OverlayItem(point, "", "");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
// Centralize Current Location
myMapController = mapView.getController();
myMapController.setZoom(DEFAULT_ZOOM_NUM);
centerlizeCurrentLocation(point);
}
Any suggest is truly appreciable.
i've only used phpmyadmin but then i stumbled upon mysql workbench that looks promising.
i wonder if someone has tried it out and could give your thoughts about it compared to phpmyadmin.
could it replace phpmyadmin completely?
thanks in advance
Is there an easy way to translate a path with system path variables to an absolute path?
So %ProgramFiles%\Internet Explorer\hmmapi.dll becomes C:\Program Files\Internet Explorer\hmmapi.dll
I like to know if there is an API call that can do this, or do I have to do this the hard way and detect %..% sequences and replace them with the appropriate environment variable?
I have created a turing-complete programming language (already proven) so it must be possible to write a quine for it, right?
But all quines I know store their source code in a string and then replace a special character in it using something like chr and ord.
My language only has the following
Basic arithmetics
Int and string types
Variables
== operator
Conditional gotos
I have no idea how I could write a quine as I have no real string manipulation available, I can only output constant strings. Yet, it is 100% turing-complete.
Hi,
Please explain.
a) is "subquery factoring" used to replace a non-correlated subquery? What about correlated subquery?
b) if it is true, are "subquery" and "subquery factoring" executed exactly once?
c) "subquery" vs "subquery factoring" which one is better
Thank you.