Hello,
I how do I find the last but one character in a string in VB.net.
for e.g. I have a string Dim strTicket as string="56789-091F0"
I want the value "F"
Thanks for your help in advance.
Hi,
I am very new to using this wmd editor. In simple way, i am using this editor in my page using asp textbox with "wmd-input" class. It is perfectly behaving like a wmd editor.
But when enter some data and do some formatting like bold, italic etc and read editor's content from server side, i can see that the data in plain text.
Is there any way i can read the data in html formatted data?
Thanks for your help.
I am wanting to verify and then parse this string (in quotes):
string = "start: c12354, c3456, 34526;"
//Note that some codes begin with 'c'
I would like to verify that the string starts with 'start:' and ends with ';'
Afterward, I would like to have a regex parse out the strings. I tried the following python re code:
regx = r"V1 OIDs: (c?[0-9]+,?)+;"
reg = re.compile(regx)
matched = reg.search(string)
print ' matched.groups()', matched.groups()
I have tried different variations but I can either get the first or the last code but not a list of all three.
Or should I abandon using a regex?
Hi,
I currently have an array, created from a database, an example of which looks like the following:
Array(
[0] => Array (
objectid => 2,
name => title,
value => apple
),
[1] => Array (
objectid => 2,
name => colour,
value => red
),
[2] => Array (
objectid => 3,
name => title,
value => pear
),
[3] => Array (
objectid => 3,
name => colour,
value => green
)
)
What I would like to do is group all the items in the array by their objectid, and convert the 'name' values into keys and 'value' values into values of an associative array....like below:
Array (
[0] => Array (
objectid => 2,
title => apple,
colour => red
),
[1] => Array (
objectid => 3,
title => pear,
colour => green
)
)
I've tried a few things but haven't really got anywhere.. Any ideas?
Thanks in advance
Can anybody tell me how to persist long text using JPA (I use PostgreSQL)?
Here's the way I defined a very long string in my class:
@Lob
private String body;
However, this produces a field of type charactervarying(255) in the database.
Furthermore, I've tried to use @Column annotation:
@Column(columnDefinition="TEXT")
private String body;
But everything in vain.
I would be gratefull for a helpfull comment on this problem.
I am maintaining a legacy application which prints product labels on packaging. The format of the label is stored in a INI file. I wanted to know if anyone has any hints about the meaning of this format. I have pasted a snippet here.
{D1531,1000,1501|}
{C|}
{U2;0130|}
{D1531,1000,1501|}
{AX;+000,+000,+00|}
{AY;+05,0|}
{PC000;0922,0555,15,15,H,11,B|}
{RC00;<FE/>LABELTITLE</FE>|}
{PC001;0865,0555,15,15,H,11,B|}
{RC01;<FE/>CURRENT</FE>|}
{PC002;0796,0040,10,10,H,11,B|}
I would like to pass a vector of strings from C++ to matlab. I have tried using the functions available such as mxCreateCharMatrixFromStrings but it doesn't give me the correct behavior.
So, I have something like this:
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
vector<string> stringVector;
stringVector.push_back("string 1");
stringVector.push_back("string 2");
//etc...
The problem is how do I get this vector to the matlab environment?
plhs[0] = ???
My goal is to be able to run:
>> [strings] = MyFunc(...)
>> strings(1) = 'string 1'
I have a string which looks like this:
"[segment1][segment2][segment2]"
What I'd like is to be able to split the string into an array, so I'd end up with:
Array[0] = "segment1", Array[1] = "segment2", Array[2] = "segment3"
I've tried using the string split function, but it doesn't seem to do exactly what I want. I was wondering if anyone has some regex which might help me out?
Thanks in advance
Given a string of JSON data, how can you safely turn that string into a JavaScript object?
Obviously you can do this unsafely with something like...
var obj = eval("(" + json + ')');
...but that leaves us vulnerable to the json string containing other code, which it seems very dangerous to simply eval.
I have an app using a SQLite db, and I need the ability for the user to move the data file and point the app to where it moved to. I used the Entity Framework to create the model, and by default it puts the connection string in the App.Config file. From what I've read if I make changes to the connection string there then they won't take effect until the app is restarted. That seems a bit clunky for my use. I see how I can init my model and pass in a custom string but I'm unsure what the best practice is in where to store basic user prefrences such as this? Ini, Registry, somewhere else? I don't want the user to have to "Open" the file each time, just when it relocates and then the app will try to auto open from then on.
Is there any tool (editor, script, whatever...) available that can automatically reformat R code? It does not need to be customizable but it must be able to recognize statements separated by either semicolons or newlines since this code has both. If it can put all statements on a separate line, consistently indent code blocks and consistently place braces I will be very happy.
The following does not work and gives me a SIGABRT when I run in the debugger:
std::ifstream inFile;
inFile.open("/Users/fernandonewyork/inputText.txt");
cout << inFile << endl;
vector<string> inText;
if (inFile) {
string s4;
while (inFile>>s4) {
inText.push_back(s4);
}
}
inFile.close();
The following does:
std::ifstream inFile;
inFile.open("/Users/fernandonewyork/inputText.txt");
cout << inFile << endl;
vector<string> inText;
if (inFile) {
string s4("This is no lnger an empty string");
while (inFile>>s4) {
inText.push_back(s4);
}
}
inFile.close();
I was under the impression I was able to simply use s4 without having to worry about any space considerations, or is something else happening here? This is the full error I get from the top code:
malloc: * error for object 0x100010a20: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Program received signal: “SIGABRT”.
I want to find some words after i get the whole file to char*. I know how to do it using the string class functions but i don't want to copy the data again to a string variable. is there any similar functions available to use for char* strings or should i still use string class?
Hello fellow stackoverflowers, quick question. I'm using C# 3.5 and I have a date that comes in as string in the following format:
Tue Jan 20 20:47:43 GMT 2009
First question, what is the name of that format? Second question, what's the easiest and clearest way to convert this string into a datetime? I would love to be able to use a .net API/Helper method if possible.
Thanks a bunch...
My problem is the page shows a vertical line of options. I want to put them into a 4 column table to display instead of just down lhs of page. The code I want to change is as follows:
</tr>
<tr>
<td>{LOOP: JOBTYPE}
IF("{JOBTYPE.parent_id}"!="0"){  {:IF}
IF("{JOBTYPE.catcount}"=="0"){<input type="checkbox" name="jobtype[{JOBTYPE.id}]" value="{JOBTYPE.id}" {JOBTYPE.selected}>{JOBTYPE.title}<br>{:IF}
IF("{JOBTYPE.catcount}"!="0"){<strong>{JOBTYPE.title}</strong><br>{:IF}
{/LOOP: JOBTYPE}</td>
</tr>
<tr>
<td> </td>
</tr>
As you can see I have another column there and can split cell further but i would like the job list to be displayed accross the page not vertically. Thank you in advance, Peter
Hi all
Just beginning my journey in ASP.Net MVC and I have a query about something before I dig myself in too deep.
I have a table, which is paged, and I have 2 controls above the table:
Dropdown that defines order of the results and apply button next to it
Textbox that defines a filter and apply button next to it
What I need to achieve is that if the user changes the order or adds a filter I fire of an AJAX call to my action like such: /Membership/Users?sort=value&filter=value&page=pagenumber. So my controller action is:
// GET Membership/Users?sort=&filter=&page=
public ActionResult Users(string sort, string filter, string page)
So I have 3 questions:
Is this the correct approach?
What would be the best way to ensure that the query string is maintained, bearing in mind that the action will nearly always be called by Jquery/Ajax functions?
If I wanted to link directly to this action passing the arguments would I need to hard-code the querystring?
Thanks
Hi,
I have generated class diagram by gight clicking and selecting generate class diagram usign VS 2005. There are nearly 300 class in my project . The class diagram that i have created is not in expanded view. I have to manually expand the class diagrams to view the members. Is there any way to expand the classdiagrams that are created .
Regards,
Jebli.
In ColdFusion, I can parse a string of XML formatted data into an XML Object
using xmlParse(). How can I convert it back into a string?
When I tried using toString() it throws an error that "it can't convert complex object to simple objects....", which is ironic because that's what it's supposed to do.
I need to use XMLTransform() which requires the first argument to be an xml string. But I also need to use xmlSearch() to get a node to pass into my transform, and xmlSearch returns an xmlObject. So now I need to put that object back into xml stringformat to pass into xmlTransform.
I'm working on an SSIS package which uses a for each loop to iterate through excel files in a directory and a data flow task to import them.
The issue I'm having is that the project manager I'm working with doesn't think the users will always follow the structure. So if a file is in the folder and the package tries to import it but the spreadsheet is missing columns or has extra columns it generates and error of course. Even though I have the task set to not fail the package; the package does indeed fail and then the other files aren't imported.
So, I'm wondering what is the easiest way to either determine the spreadsheet is incorrectly formatted, or stop the error from failing the package execution? After taking said step I would just use a file copy task to move the file to a "Failure" folder. Then continue on processing the spreadsheets.