Programming :: Implement (linear Data Structure) Queue In Shell Script?

Jun 21, 2010

I am in deeply need of queue (linear data structure) in shell script. How can I implement this ??

View 2 Replies


ADVERTISEMENT

Programming :: Data Structure To Manage Memory?

Oct 1, 2010

I have a mxn matric (which is my simplified way of saying it is RAM with bytes on it) Some of the locations on this metric is filled with some data and some places are empty. The mxn are very big numbers in size. I am trying to make a program so that if a system call wants to write some thing on empty locations on this mxn metric it should be able to do so without any problem. The thing which I want to understand or logic of a data structure is what data structure do you people feel should I be maintaining so that I can allocate the requested space immediately from the above mxn matric when some system call requests for some (k) number of locations from above metrics.

The logic initially I thought was to maintain a hashtable

1bytes requested----------> location 1,location 2,location 3.........location n
2bytes requested----------> location 1,location 2,location 3.........location n
3bytes requested----------> location 1,location 2,location 3.........location n

[code]....

but the problem with above logic is size of the pointers where I will be writing this problem is unsigned 64 byte.So to know location of one free byte if I am maintaining one pointer of type u64 this is not a feasible solution.

View 6 Replies View Related

Programming :: Data Structure For Implementing A Text Editor?

Nov 15, 2010

Options:A double linked list with fixed size character arrays. New nodes will be added when previous ones get filled. Dynamic arrays using realloc(). Linked list has the disadvantage of not having an O(1) search like an array but I think using realloc() will be more dangerous since it moves the whole block to a new location and if the new location is not big enough to hold the whole block, realloc fails !! this case will not occur with the linked list since its nodes are scattered.

View 14 Replies View Related

Programming :: C++ - Store A Text File In A Data Structure?

May 25, 2009

I am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?

Quote:

Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?

Code:

#include <iostream>
#include <fstream>
#include <strstream>

[code]....

View 3 Replies View Related

Programming :: C Language Data Structure/ Algorithm Info Requested

Apr 2, 2010

Does anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.

View 4 Replies View Related

Networking :: NETFILTER And Extraction Of Data From Non Linear Area Of Skbuff

Feb 25, 2011

i am writing a netfilter module for linux 2.6.34.6-47 / 2.6.35. while i could capture the packets on the incoming hook since the same came as a single packet in probably the allocated skbuff area by the stack, i found that packets going out of the machine are getting splitted into linear and non-linear area. skb->data gives the total length of packet as correct, but when i extract skb-> data to print it, it prints only ip and tcp header. Now to treat the data i need to extract it and then push it back on the route.

To clarify if my data is 3 bytes . the total length by passing pointers show as 55 bytes = ( 52 byte of header + 3 byte of data), but i can't access these 3 bytes by using skb->tail - skb->data. how to extract outgoing data for any further action and then put it back on route for further encapsulation by the L2 stack or whatever. will skb_linearize() or skb_linearize_cow() be of any use , if yes how and why?

View 1 Replies View Related

Programming :: Get Length Of Run Queue And Swap Queue?

Nov 3, 2010

is it possible to get the length or even the items of both queues, the run queue and the swap queue? I've googled a lot but had no luck. Maybe I havn't used the correct search words...

Is there any header and/or code example to use structures or any API to get these information from the kernel or the scheduler?

View 1 Replies View Related

Programming :: Shell Scripts For Cutting And Pasting Part Of Data?

Mar 17, 2011

I have a tab-delimited txt file as below. It is part of the original file.Quote:

##Hello
##Welcome
#C1 C2 C3

[code]....

View 13 Replies View Related

Programming :: Checking Shell Script Variable Contain Numeric Data

Mar 28, 2009

I need to check whether a shell script variable contains non-zero numeric data to proceed. The variable should contain numeric values, but may in fact contain zeroes, blank space or nothing. So far, I have tried various combinations of:

Code:
if test $variable
then
if test $variable -gt 0
then
echo "good data exists"
else "no good data exists"
fi
fi
It partially works, but I get either "too many arguments" or "integer expression expected".

View 2 Replies View Related

General :: Creating A Shell Using C Which Could Implement LS Command

Sep 4, 2010

I would like to create the shell which would support the LS command in C++. And the way the command prompt can be changed.

View 7 Replies View Related

Programming :: Shell Script Network Data Collection Anomaly- Workarounds/changes?

Jun 5, 2010

I have a script that I am using to try to measure network throughput over the ethernet ports. This is at work in order to test the performance of our onboard ethernet ports (planar) versus our pci-e (and daughter) ethernet pluggable cards.The script is very long (and calls other scripts), so I will try to only show the parts that seem to be producing this weird little bug:

Code:
#Robert de Bock's "A shell script to measure network
#throughput on Linux machines" served as the basis for
#this part of the script. Thank you for your help Robert!

[code]...

View 4 Replies View Related

Programming :: Writing Shell Snip To Import CSV Data Into Bash Array

Jan 5, 2011

I have been trying to write a simple snip of bash shell code to import from 1 to 100 records into a Bash array.

I have a CSV file that is structured like:
record1,item1,item2,item3,item4
record2,item1,item2,item3,item4
record3,item1,item2,item3,item4
record4,item1,item2,item3,item4

And would like to get this data into corresponding arrays as such:
$record1[item1-4]
$record2[item1-4]
$record3[item1-4]
$record4[item1-4]

View 9 Replies View Related

Debian :: How To Rewrite Partition Structure Without Deleting Any Data?

Aug 20, 2009

I'm pretty new to linux, and I'm facing a problem with an ext3 partition on an external hdd. I'm not sure whether the hdd is about to crash or not, however I've had a few problems accessing it in the past.

I have a second external hdd, the exact same drive, that has the exact same partition configuration, but holds different data. So, my question is; is it possible to backup the partition structure of the second working drive, and using this information to rewrite the partition structure of the failing hdd without damaging the data stored on that drive?

View 2 Replies View Related

General :: Compare Directory Structure Without Matching Data In Files

Jul 22, 2010

What is the best and simplest way to compare two directory structures without actually comparing the data in files. This works fine:
diff -qr dir1 dir2
But it's really slow because it's comparing files too. Is there a switch for diff or another simple cli tool to do this?

View 4 Replies View Related

Ubuntu :: Samba Shared Data With Fixed Folder Structure

Dec 4, 2010

We want to fix our data folders structre in Samba, for example our folders would be like as Data/Group A/2010 /A.We want all our users can work only in folder A and no one can create any files in data, GroupA, 2010 folders. Similarly no one can delete these basic folders. However users can create further folders in A as required.

View 1 Replies View Related

Programming :: Use Socket Programming In Order To Implement Chatting Feature?

Aug 25, 2010

how to use socket programming in order to implement chatting feature

View 5 Replies View Related

Ubuntu Servers :: LAMP - Identify The Right Network Structure For A Data Intensive Website

May 18, 2010

identify the right network structure for a data intensive website, built on LAMP. I'm thinking of a load balanced website, and that it should have a mysql master/slave setup server. I'm no expert in this area, so any online resources are welcome. You can check out the website [URL] - but it will have 10 million items once the hardware can support it.

View 1 Replies View Related

Programming :: Implement The OOP In Interpreter?

Mar 7, 2011

I have a partially completed interpreter that has first-calss functions and can store scopes in variables. That way it is possible to implement a simple class like this:

Code:

MyClass = func () {
value = 0;
setValue = func (x) value = x;;

[code]....

But what about inheritance, and what if I want to know the type of the object?

View 6 Replies View Related

Programming :: Implement Two Periodical Processes In C++?

Jul 28, 2010

I am doing real time programming in C++, under Linux. I have two processes, let me say A and B. A process is being started periodically, every 5ms. B process is being started every 10ms. The process A is doing data processing. The process B is reading that data and displays it. I am confused about how to run periodically processes. The problem is that the period of process A should be as much as it is possible accurate (5ms). For the process B it isn't so important. I have created independent processes, each in one .cpp file, and I am starting them from bash file. Is that OK? I don't have to make child processes in order to have parallel processes?

View 1 Replies View Related

Programming :: How To Implement Whole New Writing System

Aug 11, 2010

So basically, there is a really cool writing system I have been working on. It could be viewed (for simplification purposes) like an encryption method for the Latin script.

Facts about the writing system:
It has a little over 300 symbols.
It is syllable-driven.
It is highly compositional (eg. "c", "ca", "cae", "ca " and "ci." all map to different symbols - and NOT by overlaying elements)
Symbols have medium graphical complexity (comparable to Korean Hangul, or Japanese Hiragana)
Has a rather complex set of diacritics (~10, some of which can go on any symbol)
Has no ligatures

How transliteration occurs:
Sequences of Latin symbols map to certain symbols. Example below:[G][rou][p ][hu][g.]Characters sequences between "[" and "]" map to a single symbol (so it would take only 5 symbols to write "Group hug.").

How I want it to work:
I would like to have a daemon that: Intercepts all text displayed on the screen.
Converts it to my writing system (changes letter sequences with individual Unicode codes)
Leaves unsupported symbols unchanged.
Displays all the text on the screen using my font and characters intertwined with the fonts and characters left unchanged.

For example, if you take the following line of C++ code:for (i = 1; i <= n; i++)
I would like it displayed like this:[fo][r ]([i ]= [1]; [i ]<= [n]; [i]++)
Bold-symbols should be in my Unicode font with special symbols defined for this writing system, and the rest should be in its original font and encoding. Also, I would like this encoding to hold for display-purposes only. The data in the memory should remain unaffected. This also means real-time adjustments: if I open a text editor (say, from the OpenOffice Suite) and I start typing, I would like to see what I type encoded with my writing system, even though the document actually contains Latin letters. This also means that the symbol immediately before the cursor may change as you type.

View 3 Replies View Related

Programming :: How To Implement Count Word

Nov 9, 2010

I have these but not working.

size_t count_words(const std::string& s)
{
std::istringstream is(s);
return distance( std::istream_iterator<std::string>(is),
std::istream_iterator<std::string>());
}
and
std::string s; // word count
unsigned int wordno = 0;
while(getline(myfile, s))
{ ++wordno;
if(s.empty())++ wordno;
else wordno += count_words(s);
std::cout << s << '
';
}

myoutput1<< "Number of words : " << wordno << '
';
myoutput1 << "
Word" <<" " <<" Occurrence" <<endl;
myoutput2<< "Number of words : " << wordno << '
';
myoutput2 << "
Word" <<" " <<" Occurrence" <<endl;

View 6 Replies View Related

Programming :: Implement Own Protocol With AgenjJ?

Feb 9, 2011

I developed a protocol "it's a modification of OLSR" for wireless networks, it was with JAVA and I try to simulate it on NS2, I used AgentJ, so in the TCL I did any thing like usual;

set val(chan) Channel/WirelessChannel ;# channel type
set val(prop)Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type

[code]....

and I didn't specified the protocol because I attached my nodes to the JAVA class responsible for the protocol, but when I run it generates errors, it claims the protocol to use, so I don't know how proceeding.

View 2 Replies View Related

Programming :: Implement Persistent SSL Connection ?

May 14, 2011

I implemented a SSL client using openssl on Linux and it's working fine i am getting response from server...

But my problem is I have a separate thread for each request comes form front end and i have to do SSL communication in each thread, for this i have to create a separate SSL Context for each thread and this is taking too much time hence my transaction is getting delayed

My question is can we implement Persistent SSL connection where i will do SSL Handshake only at the time of application startup and use that connection in all the threads....

View 2 Replies View Related

Programming :: Implement A Set Class (like In Stl) Using A Vector?

Sep 3, 2010

i need to implement a Set class(like in stl) using a vector.Here is my code that doesnt work corectly:

Code:
#include <iostream>
#include <vector>
template<class T>
class Set
{

[Code]....

View 2 Replies View Related

Programming :: Submit Job To Queue?

May 15, 2011

Is there a more convenient way or function call to submit a job to a queue than the following in Linux?

Code:
#include <stdlib.h>
...
system( "at -f /var/myproj/task_starter.sh now" );
...

View 2 Replies View Related

Programming :: Implement C_str() For A String Class?

Oct 19, 2010

How can I implement c_str() for a string class?

View 2 Replies View Related

Programming :: Implement Variable Substitution In Strings?

May 6, 2011

I have an interpteter that supports string literals, and the way it works is that the lexer returns the entire string as a single token, with the quotes removed and escape sequences replaced with the literal characters they represent.

I already implemented single-quote strings, they don't interpret any characters specially except for the single quote. I partially implemented double-quoted strings, they already support all the same backslash escape sequences that C does. But I would also want to add variable substitution.

The way it would work is that "${expression}" would interpret the expression (which could just be a variable name) and replace itself with the result. But I have no idea how to do this.

In case it matters, I'm using a hand-written lexer and recursive-descent parser.

View 14 Replies View Related

Programming :: Implement SAML 1.1 SSO Process In Php / Java Or C#?

Oct 11, 2010

I need to implement SAML 1.1 SSO process in Php(Preferred), Java, or C# I am having a very difficult time finding information related to this task. If I could use SAML 2.0 I would be home free with "Simple Saml Php" but I am not that lucky. Would the process be as simple as building the SAML in XML then submitting it with a SoapClient? According to the Docs I've read that would appear to work.

View 1 Replies View Related

Programming :: Implement Inheritance An Polymorphism In Plain C?

Mar 20, 2009

how to implement inheritance an polymorphism in plain C. Most of them do this through function pointers.However I'd like to support multiple inheritance.

View 14 Replies View Related

Programming :: Implement A Dynamic Menu Which Will Allow To Specify An IP Address

Jul 2, 2010

I'd like to implement a dynamic menu which will allow me to specify an IP address and read it into memory. This is what I've got so far (it's fairly basic...)

Code:
IPS=`ifconfig -a | grep 'inet addr:' | awk '{print $2}' | tr -d "addr:"`
PS3='Select an option and press Enter: '
select i in $IPS
do
case $i in
$i) echo $IPS;;
esac
done
echo $IPS

At the moment it just says "Which IP would you like to use" and then freezes, most success I've had is it showing all the IP's listed in ifconfig and then showing the same menu.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved