~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since a 2D char array is nothing but an array of char arrays, you can convert the char array to a String using String.valueOf() and write it out to a file using PrintWriter . When reading in data, just read in lines of data and recreate your 2d char array using String.toCharArray() .

Another interesting thing you can try out is to write out Java arrays as JSON which will render it usable by any application without having a proprietary format for your text file.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Come to think of it, all the articles of IBM Developerworks and JavaWorld are worth the read for every Java programmer out there.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Btw this is my first post here in the lounge so "hi all there"

Welcome; funny how music can bring C++ er... people together. ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you will notice, the viewer has the option to view the site in English. Notice the flag at the top right corner of the screen.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> What is it supposed to mean by " sort, by hand, the folllowing
> array... using a)merge sort b)quicksort

http://www.iti.fh-flensburg.de/lang/algorithmen/sortieren/

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Vector and hence Stack are legacy/by default thread safe classes. Consider using ArrayList and LinkedList in lieu of the above mentioned classes.

And as for your problem, replace:

Vector<String> temp= new Vector<String>();
temp  =vVariables;
variables.push(temp);

with

variables.push(new Vector<String>(vVariables));

In your code, you create a new Vector instance referenced by `temp' but discard it by assigning `vVariables' to `temp' which effectively means, `vVariables' and `temp' now point to the same thing. In the code I posted, the list pushed onto the `variables' stack is effectively different from the list `vVariables'. It is also worth noticing that both the lists effectively point to the same data so modifying it will make the changes visible in both the lists [which isn't a problem here since Strings are immutable].

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*Not working* is not a very helpful description of the problem. You should try debugging your script and inspecting variables to see if they are causing a problem. Use the Microsoft Script Debugger if using IE and Firebug if using Firefox.

Also, onclick works:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Title</title>
    <META http-equiv="Content-Type" content="text/html; charset=utf8">
    <script type="text/javascript">
      function doDisable(elem, id) {
        var e = document.getElementById(id);
        if(!e || !elem)  return;
        e.disabled = elem.checked;
      }
    </script>
  </head>
  <body id="bdy">
    <form name="frm" id="frm" action="#">
      <div id="container">
        <input type="checkbox" id="chk1" name="chk1">
        <br><br>
        <input type="checkbox" id="chk2" name="chk2" onclick="doDisable(this, 'chk1');">
      </div>
    </form>
  </body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

No l33t speak and use of code tags on the very first post; this has given me happiness indeed.

Anyways, the problem with your approach is that you attempt to read in `int' from the file but don't test for it i.e. instead of fileRead.hasNext() test for fileRead.hasNextInt() . Also, your code will fail if any of the lines have less than four tab separated integer strings. Consider having a test for int before reading one.

IMO, reading in a single line from the file and parsing it manually gives you much more control and flexibility in your implementation than using fileRead.nextInt() . To prove this point, try replacing one of your integer strings with a alphanumeric character. Also, intermixing the file reading logic along with the parsing logic / file format logic is bad in itself; consider having a separate class process each line of file separately so that if you need to change the format, the impact is minimalistic.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

>
> //yourCodeHere
>

Use the [noparse][/noparse] tag for writing out tags without interpreting them. E.g.:
[noparse][code=java]code-here [/code][/noparse]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

One risk that this procedure runs is that you are basically shipping all your class files which can be potentially decompiled and your source code be exposed to other parties. So if you have the concern of keeping your source code closed you can use the second method mentioned here.
The other method is to use some kind of Java-to-EXE converter software which would take all the class files and optionally the manifest file as input and produce an EXE file as an output. Some of them take theexecutable JAR as input. Shipping an exe file essentially keeps your source code protected.

I agree with you when you say that class files shipped as part of your application can be very *easily* decompiled without any kind of special; all you need is a class file decompiler which are pretty easy to get by. On the other hand, decompiling/reverse engineering platform dependent executables and libraries [static and dynamic] is no easy feat and definitely can't be achieved by a casual script kiddie or a curious programmer; it requires much more expertise.

To avoid the ease of decompiling class files, you can use free softwares like ProGuard which shrinks, optimizes and obfuscates the class files.

Come to think of it logically, it is very much an assumed scenario that developing commercial application in Java and distributing them always has the possibility of the application being decompiled. Such applications rely on restrictive licenses stating that any part of …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though it seems like an obvious thing to ask, but are you closing your resources in `finally'?

try {
  Port p = null;
  InputStream in = null;
  OutputStream out = null;
  try {
    // acquire streams and do something
  } finally {
    if(in != null) in.close();
    if(out != null) out.close();
    if(port != null) port.close();
  }
} catch(Exception e) {
  e.printStackTrace();
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Much better than Thread.getThread().sleep(3000) which doesn't compile. :-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Thread.getThread().sleep(3000); //Pause for 3 s Thread.currentThread().sleep(3000);

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes there are better ways of editing data at a random position; look into RandomAccessFile, though things can get complicated pretty soon.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Pretty simple:
- Create a minimalistic HTML document
- Attach a handler to the onclick event listener which performs all the work
- Make a asynchronous call [using XHR or XMLHttpRequest object] to the server
- Retrieve the data in case the request is successful and show it to the user

For making async calls it would be simpler if you used some sort of library to abstract away the boilerplate code. A sample untested snippet:

<!--
Show a tooltip
Copyright (C) 2008  sos aka Sanjay

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript" src="AjaxRequest.js"></script>
    <script type="text/javascript">
      function showTooltip(evt) {
        evt = evt || window.event;
        var elem = evt.srcElement || evt.target;
        setTitle(elem);
      }

      function setTitle(elem) {
      // For making Ajax calls, I'll be using the Ajaxtoolbox
      // library which …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Use a Firefox addon, Firebug, to debug your Javascript applications. Move the semicolon separated statements in the onclick handler of the INPUT element to a separate function for easier debugging.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I was wondering if someone could explain to me how to merge two arrays so that one is not simply appended to the other, but they need to be merged into one sorted array. I could simply append the two arrays and then sort the result, but that would be too easy. Instead I need to have my javascript look over each element of both arrays to see which number is smaller to merge into one sorted array. I need to be able to understand how and why it works if possible.

For example:

arr1 = [1,2,7,10];
arr2 = [3,4,9,19];
//needs to merge into one array appearing as [1,2,3,4,7,9,10,19];

Any quick explanation on how to do this would be greatly appreciated. Have a wonderful holiday weekend everyone and I look forward to talking with someone soon.

There are better ways to understand sorting than doing things the hard way. Anyways, what you can do is:

- Sort both the arrays
- Inspect the first element of both the arrays
- The array which has the smallest element as its first element is the one into which the other array will be merged. Let A1 be the array into which array A2 will be merged.
- Run a loop over the array A2 and for each element; let that element be E.
- Run a loop over A1 and find an appropriate place in A1 to insert E
- Rinse and repeat

Of course the above would require …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good idea; edited.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It's not about being thankful; as long as someone benefits/learns something from the answers posted, it's always an effort worth spent. I have very little time and lot of boards to manage so most of my replies are curt and short; maybe that made you think I am dismissing your problem as trivial.

My level of expectation was high because at universities they don't given these kinds of problems to complete beginners hence the knowledge of `break' was at least expected from you.

> I'm just trying to think of where i acted like a "spoiled brat"

By calling someone who tries to help you out a `crank'?

stultuske commented: I guess trying is the first step to success, but some will never learn +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> but i do get the feeling that i am being a bother, if you don't
> wanna help me, fine

If you would have bothered to read the all replies given to your post, you would have noticed that it contains all that you need to complete this assignment of yours. If you don't understand things, you need to search them up and then post if you still have doubts; acting like a spoiled brat is no excuse.

> I'm in first year computer science and this is the first language
> i've learned

So? All I did was to ask you search up something; was it that difficult/troublesome?

> excuse me for not knowing some stuff, and asking for help,
> in a help forum.

People are definitely excused here for not knowing stuff but behavior like yours is certainly not. Replies like yours make us feel that our valuable time was wasted on something which has no returns to the Software Development community in general.

P.S.: Though this is a help forum, people here are not under any obligation to reply to threads; all the replies you received were from people who spend their valuable time trying to help others out. You should be thankful.

Ezzaral commented: Well, you've certainly tried to help him here. +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hi i created one jsp form with 2 fields..now in the first servlet i want check whether those 2 fields values are presented in the Database or not..if not then i want move those values to another servlet .. how can i do this?how to get the values (parameter values of jsp in second servlet.. .ie; in first servlet those values will be comapred with database and bcoz of send redirect in else the values will be stored if they not present in DB here is my code plz check it once..

The very reason that you require to pass user submitted data from one servlet to another reeks of bad design. Seldom would you require two servlets in a single application. Just create a single controller servlet which is responsible for routing requests to proper request handlers.

IMO, what you require are multiple request handlers instead of multiple servlets. Also, you entire business logic is placed in the servlet which is pretty bad. Create two classes called LoginController and SearchController which would be instantiated by the servlet or the request handler.

You are actually spitting out HTML in your servlet which was pretty cool a few years back, but now isn't. Use JSP along with JSTL for presentation purposes. The J2EE 5 guide is a free download. Read and be enlightened.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Honestly I do not see anything of JSP in your page, just Javascript.
And following is what you can use to encode your field

var encoded_data = escape("<string_data_to_encode>");

The escape / unescape functions have been deprecated since they don't work well with non-ASCII characters. Use encodeURI / encodeURIComponent .

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I have tried reading: Struts 2 In Action, but I wasn't very thrilled
> about it

Reading anyways isn't as thrilling as getting your hands dirty with the real stuff. Try some sample projects you can think of when learning Struts and practice as you read. The online documentation plus the book should be good enough.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

what does these mean?

for(; ;)

and

break;

The first one is an infinite loop. Use your favorite search engine to know more about break in Java; it's pretty basic stuff you should know before trying to program in Java or as a matter of fact any language.

BTW, the code snippet I presented in my previous post was untested and was meant to be used as a reference and not directly copy pasted. And the reason you are getting an ArrayIndexOutOfBounds exception is because of a typo in my previous post; replace the i < 5 in the second loop with j < 5 .

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> the method I need is:public static Person binarySearch(Person[]
> people, String target)

Is this a school assignment for implementing binary search? If not, then use the binarySearch method of the Arrays class.

And you don't need another method; what you need is just an instanceof check along with an appropriate cast.

Comparable c = binarySearch(persons, person);
Person p = null;
if(c instanceof Person) {
  p = (Person)c;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Like it has been already suggested, keep pushing the items in a Set until the size of the set is 25 [since you are attempting to fill a 5 x 5 array]. Since a Set rejects duplicate elements, the only time the size of a Set will be 25 is when it contains 25 unique elements. Loop over the Set using an Iterator and push the elements in the given array.

Or maintain a frequency table [using array] of the size as the range of your random number generation [in your case 74]. As soon as you generate a random number, increment the frequency and keep generating as long as the frequency for a given generated number is greater than 0.

int[] freq = new int[75]; // 0 to 74
int[][] arr = new int[5][5];
for(int i = 0; i < 5; ++i) {
  for(int j = 0; i < 5; ++j) {
    for(; ;) {
      int r = /* generated random number between 1 and 74 */
      if(freq[r] != 0)
        continue; // generate the next random
      ++freq[r];
      arr[i][j] = r;
      break;
    }    
  }
}

You can even use a HashMap to maintain the frequencies. Just modify the above idea/code to fit your needs.

In your case, it would be easier to tackle one row/column at a time rather than looping over the entire two dimensional array. Also consider creating a Bingo class which encapsulates the arrangement of numbers rather than exposing the entire functionality as a two dimensional integer array.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Look into Character.isSpaceChar(char ch)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though you did post the code, I am still unclear as to how this all fits in your current application flow. Without the flow, it would be kind of difficult to point out the fault. How about a test snippet which showcases your problem?

Anyways, try this snippet and let us know if you are still facing the same issue:

Port port = null;
for(int i = 0; i < 3; ++i) {
  port = (SerialPort)portId.open("comm", 2000);
  InputStream in = port.getInputStream();
  OutputStream out = port.getOutputStream();
  // write and read some junk data
  Thread.sleep(2000);

  in.close();
  out.close();
  Thread.sleep(2000);
}

If the above code works, you can be pretty sure it has got something to do with your application logic. If even your test code fails, post the stack trace with the sample code as it is.

Your very statement "If I restart the application the port is opened without problems." points to a possibility of a resource being held by the application.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Has the link for http://www.daniweb.com/forums/search.php disappeared, or am I just not looking hard enough?

Maybe the 'site search' image at the top right corner of the screen is what you are looking for?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I don't think so -- see the link I posted

It's definitely a bass guitar since it's used for producing `bass'. [of the treble and bass fame]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> "Device busy"

Most probably this means that the device is still in use i.e. all the communication channels opened to the device have not been properly closed. In case you are playing around with streams obtained obtained from the port, you should try closing them. But then again, this is just a speculation since I haven't done any serial port programming. Feel free to post the relevant piece of code, I'll try and see what can be done.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
String s1="a";
String s2="a"; //2 Different objects.

(s1==s2) //false
(s1.equals(s2)) //true

Think again; hint: String pool.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

One tiny question do you think exchanging %20 with dashes help with SEO?
Have a fantastic day.

Most of the search engines out there treat dashes as spaces when indexing sites/urls. Hence a search for "order of phoenix" might just show you http://somesite.com/order-of-phoenix but not http://someothersite.com/order_of_phoenix

That being said, I ain't no expert on SEO, it's just something I heard a while back which I thought I should share. More information here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

That code is a big mess; just to confirm whether this is a problem with your code or responseText on IE strip all the fluff and create a bare minimum snippet which just sends a single parameter and receives some random response in responseText. If it still doesn't work, post the minimized code [without your application logic] along with which version of IE/Chrome you are having problems with.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

http://www.mredkj.com/tutorials/tableaddrow.html

Please consider using a search engine before posting such obvious queries.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There is no reliable/standard way of detecting a browser close event. Though there are non-supported workarounds, a browser close event is not something you should rely on.

Anyways, here is a snippet which seems to be working fine on IE. If you are new to Ajax, I recommend using the AjaxToolbox library to do away with writing most of the boilerplate code.

<!--
    Make async request when a browser window is closed.

    Copyright (C) 2008  sos aka Sanjay

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript" src="AjaxRequest.js"></script>
    <script type="text/javascript">
    // Error checking omitted for brevity
    function doIt() {
      var o = {
        "url": "http://your.domain.net/logout",
        "onSuccess": function(req) {
          alert("status: " + req.status + "\nStatus text: " + req.statusText);
        },
        "onError": function(req) {
          alert('Error!\nStatusText='+req.statusText+'\nContents=' +
              req.responseText);
        }
      };
      AjaxRequest.get(o);
      alert("Request sent; …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I just couldn't wait to share this masterpiece with you; The IT Contract from Hell

Hope it makes you all go LOL! ;-)

John A commented: Heh. +17
Narue commented: Good story. +31
Nick Evan commented: Great! +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

[B]I just joined this site and I notice that most of the questions asked by members are either viewed alot and left unanswered or answered by one or two persons. So I'm just wondering are these questions a little bit too complicated for some people to answer of are everyone looking just for answers as well.. [/B] :icon_question:

.............................
I just don't wanna exist, I wanna live to change the world

Some reasons I can come up with are:
- Lack of time
- Lack of expertise
- Personal preferences

If everyone here whose question gets answered took some time to give back to the community what they received, we wouldn't have this situation cropping up. Instead people post their questions, get an answer and take a leave never to show up again unless they are confronted with yet another question.

It's also interesting to notice that the questions posted by regulars have less probability of getting by unanswered as compared to those posted by newcomers.

PS: Consider snipping your fake signature, you can add a signature to your profile which shows up with each post from the Control Panel.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> so you don't get the wrong impression

Too late. :-)

> They watch that thing (at least until about 6 months ago) all the time.

The things these cute little devils watch sometimes just make me go crazy, but hey, they are kids! ;-)

> Aaaarrgghhh, just shoot me now and get it over with!

Hey, it's the pirates we are talking about.
/me stabs Masijade

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good thing you found a solution to your problem but I still believe locale specific content needs to be moved to separate message bundles instead of being embedded in JSP's; but then again it might be a limitation imposed by your design.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Beside all the obvious whining some members can restrain them
> self s.

Oh come on, whining is the worst word you could have come up with. After all this is the Community Feedback Section, let everyone express their thoughts on how they feel about the new layout.

> Well, I wont be happy until the post alignment is back to the
> middle. But I guess I will have to live with that

You could work wonders with the layout if you know Javascript/CSS and are capable of messing around with Greasemonkey; on Firefox at least.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to set the JBOSS_CLASSPATH system property. Read the JBoss manual along with the contents of run.bat for more instructions.

Also, if these classes are required by your application, consider putting them in the applications' classpath instead. Read the JBoss application deployment guide for more details.

In case of any further queries related to JBoss, it would be better if you post in the JBoss user forums to get quicker help.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Nah, Pirates of the Caribbean ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

develop a simple application that when run welcomes the users and tells them the name of the last person to run the application, this information should be retrieved from a file. Use the Class Loader and Properties classes to load the file

Aye aye Captain!

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> But I don't want to place all the content into the JSP page.
> This should load the targeting content stored in another JSP file (not simple XML)

The above two lines are contradictory; you still end up placing the content if your JSP file.

> I also know about the MessageResources concept, but I doesn't think this fits my need

Why? You can use Message bundles inside your JSP's with the fmt (format) JSTL tag library.

As far as your needs are concerned, you just need to create a JSP file which pulls the data from a message bundle (depending on a locale of course) and include it in your main JSP file. Pass in the required language(locale) to the included JSP as a parameter.

[include.jsp]

<fmt:setLocale value="${param.lang}" scope="request" />
<fmt:bundle baseName="Bundle">
<table>
  <tr>
    <td>Name</td>
    <td><fmt:message key="name" /></td>
  </tr>
  <tr>
    <td>Hello</td>
    <td><fmt:message key="hello" /></td>
  </tr>
  <!-- and so on -->
</table>
</fmt:bundle>
[Bundle_en.properties]

name=YourName
hello=Hello-in-English
[main.jsp]

<jsp:include page="include.jsp">
  <jsp:param name="lang" value="some-locale-like-en" />
</jsp:include>

Google for these terms for more explanation and read the J2EE 5 tutorial. for more on tags.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

All the pretty girls / women who work for Santa...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> JSON freeware? hard to use? hard to learn?

It's a data interchange format, not a software. :-)

Pretty easy to learn and use if you know Javascript object literals.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Congratulations on using:
- Code tags for your first post.
- int main(void) instead of the usual void main() for your first post.
You have a bright future ahead! :-)

Anyways, your problem is a rogue semi-colon sitting at the end of your while construct. Remove it and surround your increment statement with braces, it should turn out to be fine. Or if you want to do it all in a single while, just add a && ++no_nodes at the end.

while((line_ptr = fgets(line, sizeof(line), input_stream)) != NULL && 
      ((no_values = sscanf (line, "%d %lf %lf",
                            &node_array[no_nodes].id,
                            &node_array[no_nodes].x,
                            &node_array[no_nodes].y)) ==3) && ++no_nodes);

The code could have been written in a better/efficient way but I'll leave it to the regulars to the C forum to sort that out for you.