I will have a different type of string(string will not have fixed format,they will be different every time) from them I want to remove some specific substring.Like the string can be
FUTIDX 26FEB2009 NIFTY 0
FUTSTK ONGC 27 Mar 2008
FUTIDX MINIFTY 30 Jul 2009
FUTIDX NIFTY 27 Aug 2009
NIFTY FUT XP: 29/05/2008
Actuall I want the string from every string defined above like
NIFTY-FEB09
ONGC-MAR08
MINIFTY-JUL09
NIFTY-AUG09
NIFTY-MAY08
How can I do that ?
I am not working with XSLT not too long. I read that variable of XSLT can't be updated on the fly, so how can i do the following task.
I want to sum up Purchase & Sales and put them into a variable, and make some decision according to these values. (For example, if Purchase is greater then sales then do something if not, do something else)
<rows>
<row>
<col attr2="Purchase" >100.00</col>
<col attr2="Sales" >100.00</col>
</row>
<row >
<col attr2="Purchase" >19.16</col>
<col attr2="Sales" >12.94</col>
</row>
<row >
<col attr2="Purchase" >0.67</col>
<col attr2="Sales" >2.74</col>
</row>
<row >
<col attr2="Purchase" >71.95</col>
<col attr2="Sales" >61.54</col>
</row>
<row >
<col attr2="Purchase" >3.62</col>
<col attr2="Sales" >14.72</col>
</row>
<row >
<col attr2="Purchase">8.80</col>
<col attr2="Sales">1.22</col>
</row>
<row >
<col attr2="Purchase" >-4.28</col>
<col attr2="Sales" >6.53</col>
</row>
</rows>
if anyone knows, please help me.
I have different php output in jQuery-based tabs. This output is formed from database and it consists of several <div>'s. Every time I click any tab it sends AJAX request to the php script which performs "SELECT" request and gives result back as response to AJAX request from the tab.
$(document).ready(function() {
$('ul.tabs li').css('cursor', 'pointer');
$('ul.tabs.tabs1 li').click(function(){
var thisClass = this.className.slice(0,2);
$('div.t1').hide();
$('div.t2').hide();
$('div.t3').hide();
$('div.t4').hide();
$('div.' + thisClass).show('fast');
$('ul.tabs.tabs1 li').removeClass('tab-current');
$(this).addClass('tab-current');
var data = thisClass;
$.ajax({
type:"GET",
url:"handler.php?name="+data,
data:data,
success:function(html) {
$('div.' + thisClass).html(html);
}
});
return false;
});
});
//Server-side PHP script:
<?php
$name = $_GET[name];
switch ($name) {
case "t1":
query_and_output_1();
case "t2":
query_and_output_2();
// etc...
}
?>
The problem is that the first tab contains output that must be in second and third ones as well, the second also contains the third tab output.
Sorry for such a rubbishy question, I used to work with server side and unfortunately I'm not familiar with DOM and jQuery yet.
Thanks.
Hi,
This is my array
Array
(
[0] => Array
(
[sample_id] => 3
[time] => 2010-05-30 21:11:47
)
[1] => Array
(
[sample_id] => 2
[time] => 2010-05-30 21:11:47
)
[2] => Array
(
[sample_id] => 1
[time] => 2010-05-30 21:11:47
)
)
And I want to get all the sample_ids in one array. can someone please help ?
Can this be done without for loops (because arrays are very large).
Hi all,
Am I better to move a node I sent down form the server or to insert it?
I'm using jQuery (1.4) but would like to know for both jQuery and JS in general. In this case the node is small with only one child. But what if it were a large list?
I have a directory /tmp/dir with two types of file names
/tmp/dir/abc-something-server.log
/tmp/dir/xyz-something-server.log
..
..
and
/tmp/dir/something-client.log
I need append a few lines (these lines are constant) to files end with "client.log"
line 1
line 2
line 3
line 4
append these four lines to files end with "client.log"
and For files end with "server.log"
I needed to append after a keyword say "After-this".
"server.log " file has multiple entries of "After-this" I need to find the first entry of "After-this" and append above said four lines keep the remaining file as it is.
Any help will be great appreciated :) Thanks in advance.
Has anyone an idea, how I can make TValue using a reference to the original data? In my serialization project, I use (as suggested in XML-Serialization) a generic serializer which stores TValues in an internal tree-structure (similar to the MemberMap in the example).
This member-tree should also be used to create a dynamic setup form and manipulate the data.
My idea was to define a property for the Data:
TDataModel <T> = class
{...}
private
FData : TValue;
function GetData : T;
procedure SetData (Value : T);
public
property Data : T read GetData write SetData;
end;
The implementation of the GetData, SetData Methods:
procedure TDataModel <T>.SetData (Value : T);
begin
FData := TValue.From <T> (Value);
end;
procedure TDataModel <T>.GetData : T;
begin
Result := FData.AsType <T>;
end;
Unfortunately, the TValue.From method always makes a copy of the original data. So whenever the application makes changes to the data, the DataModel is not updated and vice versa if I change my DataModel in a dynamic form, the original data is not affected.
Sure I could always use the Data property before and after changing anything, but as I use lot of Rtti inside my DataModel, I do not realy want to do this anytime.
Perhaps someone has a better suggestion?
Hi,
Through the housekeeping stuff my android application has to do is to read and write some files and sometimes to delete others and create new ones. The files in cause have all "sdcard/" as root. Is it safe if I perform all this task using Java style functions ?
To me it is very handy to do it this way but I've read that not always the java functions can be applied when it comes to files in Android.
Hi
I have a list of dates for an event in the following format
13/04/2010 10:30:00
13/04/2010 13:30:00
14/04/2010 10:30:00
14/04/2010 13:30:00
15/04/2010 10:30:00
15/04/2010 13:30:00
16/04/2010 10:30:00
17/04/2010 11:00:00
17/04/2010 13:30:00
17/04/2010 15:30:00
How can i have the list be output, so that the date is only displayed once followed by the times for that date, so the above list would look like something like this:
13/04/2010
10:30:00
13:30:00
14/04/2010
10:30:00
13:30:00
15/04/2010
10:30:00
13:30:00
16/04/2010
10:30:00
17/04/2010
11:00:00
13:30:00
15:30:00
I'm an experienced programmer, but relatively new to SQL. We're using Oracle 10 and 11. I have a system in place using SQL that combines actual rows with virtual rows (e.g. "SELECT 1 from DUAL") doing unions and intersects as needed, which all seems to work.
My problem is that I need to combine this system which is expecting rows of data, with new data that will have the data in (let's say for simplification) comma delimited strings.
So I think what I need is a way to convert a string like: "5,6,7,8" into 4 rows with one column each, with "5" in the first row, "6" in the second, etc. In other languages, I'd do a "Split" with comma as the delimiter. Of course, the data won't always have 4 entries.
There's a second question, but I'll ask it separately. But I suspect it will simplify things, if possible, if the solution to the above could be used as a table in another SQL statement (i.e., to work with my existing system). Thanks for any help.
When I search on the Internet about JQuery and I got the jquery cheat sheet. At there, I am very confused about how to use the following under which condition. Pls help me.
[attribute|=val]
[attribute*=val]
[attribute~=val]
[attribute$=val]
[attribute=val]
[attribute!=val]
[attribute^=val]
[attribute]
[attribute1=val1] [attribute2=val2]
What are the functions of these special character *, ~, $, !, ^? Thanks very much.
I have a control field where I dynamically add certain text. That works well so far. The problem is that in one text I have an input field where the user can type in text.
I need to hardcode the form text input field into the VBA code. How is this achieved? Or can someone point me in the right direction?
In the following code snippet I need to replace the [InputField] by a VBA input field.
ActiveDocument.SelectContentControlsByTitle("Bottom").Item(1).Range.Text = _
"Some Text" & vbNewLine & _
"Some Text" & vbNewLine & _
"Some Text" & vbNewLine & _
"Text [InputField] Text"
Hi,
I'm a beginner in java. I want the logic of the small program.
I have two arrays
array = {a1,a2,a3,a4,a5,,,,,,,,,an}
and
array2 = {b1,b2,b3,b4,,,,,,,,,,,bn}
I want string as:
a1b1,a2a3b2b3,a4a5a6b4b5b6,..........an
Please tell me what will be the logic.
I've searched through related questions but can't find what I need.
I have a richtextbox control. I need to trigger an event when the vertical scrollbar reaches a certain position (say 90% down to the bottom). I've been playing around with the events for the rich textbox but have yet to find anything.
Any help would be greatly appreciated.
I need to parse some large text file and extract Display name and area code only if it matches the following pattern:
Line starts with display name (any number of words)
Followed by 6 digits (can contain spaces)
Followed by #text tag
e.g.
John doe 123 456 #text some text
Display name: John doe
Area code: 123 456
Test 123456 #text
Display name: Test
Area code: 123456
Test 123 #test
Invalid, area code contains only 3 digits
Test 123456 #test1
Invalid, contains invalid tag
Test 123g45 #test
Invalid, area code contains letters
etc.
I know how to open the text file and read it line by line, but having trouble with writing the regular expression.
Any help would be greatly appreciated!
edit:
I have tried this:
private static void Main(string[] args)
{
string text = "John Doe 123 45 #text Lorem ipsum dolor :)";
string pattern = @"(\w+)*([0-9]{2,5}).([0-9]{2,5}).#text";
Match match = Regex.Match(text, pattern, RegexOptions.IgnoreCase);
if (match.Success)
{
string key = match.Groups[0].Value;
Console.WriteLine(key);
}
}
Hey guys,
I have been working on this code but I can't find out what is wrong.
This program does compile and run but it ends up having a fatal error.
I have a file called myFile.txt, with the following content :
James------ 07.50 Anthony--- 17.00
And here is the code :
int main()
{
int n =2, valueTest=0,count=0;
FILE* file = NULL;
float temp= 00.00f, average= 00.00f, flTen = 10.00f;
float *totalNote = (float*)malloc(n*sizeof(float));
int position = 0;
char selectionNote[5+1], nameBuffer[10+1], noteBuffer[5+1];
file = fopen("c:\\myFile.txt","r");
fseek(file,10,SEEK_SET);
while(valueTest<2)
{
fscanf(file,"%5s",&selectionNote);
temp = atof(selectionNote);
totalNote[position]= temp;
position++;
valeurTest++;
}
for(int counter=0;counter<2;counter++)
{
average += totalNote[counter];
}
printf("The total is : %f \n",average);
rewind(file);
printf("here is the one with less than 10.00 :\n");
while(count<2)
{
fscanf(file,"%10s",&nameBuffer);
fseek(file,10,SEEK_SET);
fscanf(file,"%5s",¬eBuffer);
temp = atof(noteBuffer);
if(temp<flTen)
{
printf("%s who has %f\n",nameBuffer,temp);
}
fseek(file,1,SEEK_SET);
count++;
}
fclose(file);
}
I am pretty new to c and find it more difficult than c# or java. And I woud like to get some suggestions to help me to get better. I think this code could be simplier. Do you think the same ?
Hi,
I am trying to create a css menu. I would like to remove border and padding for every last
li > a element on the child ul tag. (sorry for confusing)
Here is the code for the menu
<ul id="nav">
<li><a id="cat1" href="#">Menu 1</a></li>
<li><a id="cat2" href="#">Menu 2</a></li>
<li><a id="cat3" href="#">Menu 3</a>
<ul>
<li><a href="#">Sub Item 1 - M3</a></li>
</ul>
</li>
<li><a id="cat4" href="#">Menu 4</a>
<ul>
<li><a href="#">Sub Item 2 - M3</a></li>
<li><a href="#">Sub Item 3 - M3</a></li>
<li><a href="#">Sub Item 4 - M3</a></li>
</ul>
</li>
</ul>
The code must remove border and padding for last elements that is
<li><a href="#">Sub Item 1 - M3</a></li>
<li><a href="#">Sub Item 4 - M3</a></li>
Tried this but it takes off border for only sub item 4
$("#nav li ul").each(function(index) {
$("#nav li ul > :last a").css('border','0 none');
$("#nav li ul > :last a").css('padding','0');
});
Hi,
I have myself a handle to a bitmap, in C++, on Windows:
HBITMAP hBitmap;
On this image I want to do some Image Recognition, pattern analysis, that sort of thing. In my studies at University, I have done this in Matlab, it is quite easy to get at the individual pixels based on their position, but I have no idea how to do this in C++ under Windows - I haven't really been able to understand what I have read so far. I have seen some references to a nice looking Bitmap class that lets you setPixel() and getPixel() and that sort of thing, but I think this is with .net .
How should I go about turning my HBITMAP into something I can play with easily? I need to be able to get at the RGBA information. Are there libraries that allow me to work with the data without having to learn about DCs and BitBlt and that sort of thing?
Hello everyone,
Im trying to use the DOM in PHP to do a pretty specific job and Ive got no luck so far, the objective is to take a string of HTML from a Wordpress blog post (from the DB, this is a wordpress plugin). And then out of that HTML replace <div id="do_not_edit">old content</div>" with <div id="do_not_edit">new content</div>" in its place. Saving anything above and below that div in its structure.
Then save the HTML back into the DB, should be simple really, I have read that a regex wouldnt be the right way to go here so Ive turned to the DOM instead.
The problem is I just cant get it to work, cant extract the div or anything.
Help me!!
UPDATE
The HTML coming out of the wordpress table looks like:
Congratulations on finding us here on the world wide web, we are on a mission to create a website that will show off your culinary skills better than any other website does.
<div id="do_not_edit">blah blah</div>
We want this website to be fun and easy to use, we strive for simple elegance and incredible functionality.We aim to provide a 'complete package'. By this we want to create a website where people can meet, share ideas and help each other out.
After several different (incorrect) workings all Ive got below is:
$content = ($wpdb->get_var( "SELECT `post_content` FROM $wpdb->posts WHERE ID = {$article[post_id]}" ));
$doc = new DOMDocument();
$doc->validateOnParse = true;
$doc->loadHTMLFile($content);
$element = $doc->getElementById('do_not_edit');
echo $element;
I am trying upload images and than create an thumbnail of it and than store both in S3. After the file has been uploaded i am first uploading it to S3 and than trying to create thumbnail but it doesn't work as than PIL is not able to recognise the image. And secondly if I create the thumbnail first than while uploading original image I get EOF.
I think Django allows just once for the uploaded files to be used only once....Please kindly tell me a way to do so....Thanks in advance
For a project, I have to convert a binary string into (an array of) bytes and write it out to a file in binary.
Say that I have a sentence converted into a code string using a huffman encoding. For example, if the sentence was: "hello" h = 00 e = 01, l = 10, o = 11
Then the string representation would be 0001101011.
How would I convert that into a byte? <-- If that question doesn't make sense it's because I know little about bits/byte bitwise shifting and all that has to do with manipulating 1's and 0's.
I'm currently trying to move some VB6 macros into a C# app and I'm having trouble setting the active cell using C#.
In VB6 its simply:
ActiveSheet.Range("L1").Select
Does anyone know what the C# equivalent is?
Cheers in advance.
I'm trying to insert records in mysql database using java,
What do I place in this code so that I could insert records:
String id;
String name;
String school;
String gender;
String lang;
Scanner inputs = new Scanner(System.in);
System.out.println("Input id:");
id=inputs.next();
System.out.println("Input name:");
name=inputs.next();
System.out.println("Input school:");
school= inputs.next();
System.out.println("Input gender:");
gender= inputs.next();
System.out.println("Input lang:");
lang=inputs.next();
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "MyPassword");
PreparedStatement statement = con.prepareStatement("insert into employee values('id', 'name', 'school', 'gender', 'lang');");
statement.executeUpdate();