riahc3 50 Â Team Colleague

Hello

Havent been here in a while but might as well give it a shot.

I have several Apache Tomcat instances running on a Windows Server on different ports. They are all HTTP. The idea would be to (on the same server) install a IIS and use it a content switcher and also as a SSL terminator.

This was depending on the URL, the IIS would redirect to one spot or another.

All of this is to replace a Netscaler

Ive tried to setup this with ARR, URL rewrite and IIS but for now Im only getting a "Bad Gateway" error.

Anyone done this before?

riahc3 50 Â Team Colleague
riahc3 50 Â Team Colleague

Here is a quickie:

//declare another integer called x
while i <= Length(sEmail) do

  begin

    while x <= Length(ALLOWED) do
     begin

       if sEmail[i] = ALLOWED[x] then
         begin
               bResult := true;
               break;
         end;
       else
       begin
             bResult := false;
     // break;
         end;
           Inc(x) ;
     end;  
     Inc(i)

  end; 

Code is as-is and untested. Also very dirty and there are 1000000s of better ways to do this.

BTW, pritaeas is right: With this you are just validating if it is a email, not a proper email.

riahc3 50 Â Team Colleague

Id take a hack at it (putting it on my PC and testing it) but is this Pascal or Delphi? Looks like Delphi...

Mya:) commented: Yes it is delphi. +0
riahc3 50 Â Team Colleague

He was obviously being sarcastic....

Due to the fact it is not possible (in web apllications) to open a words file using Java, it is required to directly put the words string separated by a | into the string variable. Modify the string in the initGame() function in the script (line 59).

Since when? JS can do it perfectly AFAIK. Obviously we wont get into Java....

riahc3 50 Â Team Colleague

Dani hates me :P so here you go. Updated:

private void button1_Click(object sender, EventArgs e)
        {
            string newString = "";
            var client = new RestClient("http://www.daniweb.com/api"); /*I prepare the API*/

            /*I remove whitespaces except actual spaces*/
            for (int i = 0; i < textBox1.Text.Length; i++)
            {
                if ((char.IsWhiteSpace(textBox1.Text[i])) && (!textBox1.Text[i].Equals(' ')))
                {
                    textBox1.Text = textBox1.Text.Remove(i, 1); 
                }

            }


            /*I make sure that the user name isnt empty */
            if (textBox1.TextLength==0)
            {
                MessageBox.Show("Please insert a valid member");
            }
            else
            {

            /*I call the members method of the API and pass parameters by GET. POST did not work (Why?)*/
            var request = new RestRequest("members", Method.GET);
            request.AddParameter("username", textBox1.Text);

            /*Send it and wait for reply*/
            var response = client.Execute(request);

            /*Finding where it says the post number in the response...*/
            int next = 0;
            int first = response.Content.IndexOf("\"posts_count\":\"");
                if (first==-1) /*-1 means it could not find it therefore no member exists*/
                {
                    MessageBox.Show("Member not found!"); 
                }
                else
                {
                    /*I find the next quote that actually begins the post number*/
            do
            {
                next = response.Content.IndexOf("\"", first);
                /*Not neccesary but in case Dani changes the array to something else....*/
                if (next==-1)
                {
                    break;
                }
            } while ((next==0));



            /*VERY Ugly hack to get posts numbers. Tried with largest post numbers I could find (Dani's AFAIK)*/
            string str2 = response.Content.Substring(first, (next + 21) - first);
            newString = Regex.Replace(str2, "[^.0-9]", "");

            }

             if (textBox1.TextLength == 0)
             {
                 MessageBox.Show("Please insert a valid member");
             }
             else if (first!=-1)
             {
                 MessageBox.Show(newString, "The total amount of posts this user has is:");
             } …
riahc3 50 Â Team Colleague

Because Dani hates me, the above is outdated so:

package DaniWebClient;


import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.ws.rs.core.MultivaluedMap;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.core.util.MultivaluedMapImpl;

public class DaniWebClient 
{


    public static void main(String[] args) 
    {
        /*I prepare the API*/
        Client client = Client.create();
        WebResource webResource = client.resource("http://www.daniweb.com/api/members");

        /*User introduces name*/
        System.out.println("Enter the member who's post you want to see: ");
        String user;     
        Scanner scanIn = new Scanner(System.in);
        user = scanIn.nextLine();
        StringBuilder username=new StringBuilder(user);

            /*I remove whitespaces except actual spaces*/
            for (int i=0;i<username.length();i++)
            {
                if ((Character.isWhitespace(username.charAt(i))) && (username.charAt(i)!=' '))
                        {
                            username.deleteCharAt(i);
                        }
            }
            user = username.toString();
            /*For some stupid reason, Java is stupid (no surprise there) and doesnt consider ALT+0160 a whitespace. I have to remove it manually*/
            user = user.replace("\u00A0","");

            /*I make sure that the user name isnt empty */
            if (user.length()==0)
            {
                System.out.println("Please insert a valid member");
            }
            else
            {

                /*I call the members method of the API and pass parameters by GET. POST not tested in Java*/
                MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
                queryParams.add("username", user);

                /*Send it and wait for reply*/
                String output = webResource.queryParams(queryParams).get(String.class);
                System.out.println(output);

                int first=0;
                int next=0;

                /*Finding where it says the post number in the response...*/
                //first=output.indexOf("\"posts\":\"");
                first=output.indexOf("\"posts_count\":\"");

                if (first==-1) /*-1 means it could not find it therefore no member exists*/
                {
                    System.out.println("Member not found!");
                }
                else
                {
                    do
                    {
                        /*I find the next quote that actually begins the post number*/
                        next = output.indexOf("\"",Integer.valueOf(first));

                        /*Not neccesary but in case Dani changes the array to something else....*/
                        if (next==-1)
                        {
                            break;
                        } …
riahc3 50 Â Team Colleague

The question is SO broad......

I want to state that HTML is NOT a programming language. Having said that, I have no idea what OP ment by "computer language".

Ketsuekiame commented: +1 for the HTML distinction :) I would also like to add that CSS is also not a programming language ;) +0
<M/> commented: i know that the question is broad so i jokefully said HTML +0
riahc3 50 Â Team Colleague

You guys found a loophole in my post....

OK: No Javascript libraries or jQuery libraries.

riahc3 50 Â Team Colleague

i never said i used the etc etc i know what that means and i aint stupid to write that in the program...
i never said write the damn program for me!!
NO THANKS FOR UR HELP!!

First you need to calm the fuck down. Thats first off.
Second, posting in the wrong section and being told that Java 7 has this feature and answering you are using Netbeans means that Java is pretty new for you (Id say even programming in general is new for you but oh well...)

I see you have 2 initialise functions with different types of parameters. You should really name them differenly to know exactly what is going on in your program.

We need some more explainations on what exactly you want to acomplish.

riahc3 50 Â Team Colleague

I go to "edit profile", clicked on the "update member profile" button and log out. After that, the only way (for me) to login is to reset my password,

The only thing that can remotely have to do with it (I doubt it is thing) is that if you click edit profile, you can edit your password. If you dont do anything and click update member profile, technically (I imagine there are checks against this but...) your password is set to "". Daniweb's DB might not allow that and cause problems.

Its the only thing I can up with...

Nick Evan commented: Yup! +0
riahc3 50 Â Team Colleague

Again, this is a demo app........In a serious app, yes, Id use a while loop until the user actually inserts something valid.

Java is the shittiest language known to man. I hate it to death and I work on it at my workplace daily. If I had time (and knowledge) I would port every known software written in Java to a better language (for example C#).

And Im not even talking about the security issues (which dont really exist if you control your browser settings correctly); Im talking about the language itself.

riahc3 50 Â Team Colleague

Hello

This is a demo showing Java interacting with Daniweb's new API ( http://www.daniweb.com/api/documentation ) You introduce a member's name and it should show you the total number of posts he has made. Demo is a proof of concept: No bug checking, error checking, etc is in this code.

In order to make this work you need the Jersey library. Download here:

http://jersey.java.net/nonav/documentation/latest/chapter_deps.html#core_client

Any comments, bugs, glitches, etc, please say and Ill look into it.

riahc3 50 Â Team Colleague

So you saying this site is the best if you tend to ask stupid questionsa and don't know how to spell the word stupid?

Isn't life ironic?

otengkwaku commented: true how ironic? +0
riahc3 50 Â Team Colleague

RestSharp library needed

Mike Askew commented: Thanks for sharing, +rep +6
riahc3 50 Â Team Colleague

OK, there is something intresting....

I clicked the Files button and it shows the two dialog boxes. I post this post (this one you are reading right now) and I click Files again and it does not show the two dialog boxes.

Yup, confirmed. Steps to reproduce:

1: Click Files. The two files dialog boxes will appear.
2: Write a post and post it
3: Again click the Files button and it will not appear.

This is the confirmed way to reproduce it.

riahc3 50 Â Team Colleague

A lot of reading functionability but no writing; Will there function to make our own client for posting threads/posts to Daniweb?

Nice though :)

This is something not seen on most forums.

riahc3 50 Â Team Colleague

Thank Dani :) You seemed to have fixed it and now it shows.

riahc3 50 Â Team Colleague

Certainly was one of my problems! Thankyou very much for your assistance - I have half of my script working now - the values are being passed.

Now I just need to make the <option></option> appear in my second menu now that the array is responding with ["1","2","3"].

I was advised not to put html in my ajax.php file for some reason. So now to figure out how to spit it out :)

Step by step.....Thats good that now it replies.

I imagine that now that you know how Firebug/AJAX works you will have more knowledge on how to debug this. You could also download FirePHP to debug even further.

riahc3 50 Â Team Colleague

I just noticed something when I was posting your code on here to reply to you:

$t2=$_GET["t2choice"];

Should be

$t2=$_POST["t2choice"];

Sorry about that.

The reason it works when you directly call http://yoursitee.com/ajax.php?hi=hello is because there you are passing it as a GET value and not as a POST value while in this AJAX call you are passing it as a POST value and your ajax.php expects a GET value. Try this out.

So you can do that or change in the ajax call to "type:GET" or put (not recomended)

$t2=$_REQUEST["t2choice"];

My personal recommendation is to change in the ajax.php to a $_POST

JayJ commented: Superb spot! Thankyou very much! +2
riahc3 50 Â Team Colleague

OK, just looked at it....

Good news: Your parameters are being POSTed corrected, the page can be reached and it replies. Bad news: Its repling "".

Just in case do this test on your ajax.php page:

<?php 
$t2=$_GET["t2choice"];
echo $t2;
?>

This should just send back what you POSTed as a reply....

riahc3 50 Â Team Colleague

But........really it has no point :S

More than login page, it shows how a if works.

riahc3 50 Â Team Colleague

By your post, then yes, you should do change on t2. Whenever you change on t2, you modify t3.

riahc3 50 Â Team Colleague

Trust me, AJAX is a bitch so its normal the first time around this doesnt work :P

You can see AJAX events (with POST and GET) using Firebug. In the network tab, whenever a change is made (in your case as thats the event being fired) it should show the call. It should show you the reply, HTML reply, POST/GET etc.....

As a matter of fact, if you want, PM the address as I can see the page you call yourself and I can see what you pass and the reply. I cant see the PHP code (dontworry) just the reply and what is passed.

riahc3 50 Â Team Colleague

Apologies - thats my lack of simplifying my code. brigade should read t3choice

I have adjusted both var to .val as you suggest that both should be the same. This is where I have been going wrong as I have been lifting snippets of code from various sources and piecing them together.

Firebug pointed out a missing "}" - and then a missing ")" - not sure where these are from, but having placed those no further errors are showing.

Upon changing the value of the first drop-down, the second menu is not displaying.

Thankyou very much for your assistance so far

No problem, we all copy/paste....

Anyways, thats one important step: No errors such as missing ")" or "}".

But, you said it should be "t3choice". Personally that makes no sense; When you change t2choice, it should populate t3choice, not the other way around.

I apoligize if I am not understanding something correctly.

riahc3 50 Â Team Colleague

Also, I personally dont know what "brigade" is. Does Firebug's console do anything when the event change is fired on brigade?

riahc3 50 Â Team Colleague

Why

var t2choice = $('#t2choice').attr('value');
var t3choice = $('#t3choice').val();

?

They SHOULD both be the same but...

riahc3 50 Â Team Colleague

You said you need a website with "chat,downloads,messages ect.". I think before even creating your site, you need to know what is your website going to transmit and who is your target audience.

Another thing: There are web programmers and web designers. VERY RARELY, one person is good at both. Web designers usually make a mockup in Photoshop and then web programmers reproduce it in code. This is one of the most complicated steps in making a pro website.

riahc3 50 Â Team Colleague

Today I got a warning for "profanity".........Come on.

riahc3 50 Â Team Colleague
<!DOCTYPE html>
<html>
  <head>
    <title>Google Maps JavaScript API v3 Example: Map Simple</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map_canvas {
        margin: 0;
        padding: 0;
        height: 100%;
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?key=PUTYOURKEYHERE&sensor=false"></script>
    <script>
      var map;
      function initialize() {
        var mapOptions = {
          zoom: 8,
          center: new google.maps.LatLng(-34.397, 150.644),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map_canvas'),
            mapOptions);
      }

      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
    <div id="map_canvas"></div>
  </body>
</html>

If you truely have a API v3 key, then just copy and paste this code in a HTML page and where it says "PUTYOURKEYHERE", replace it with your API v3 key and it should work perfectly.

riahc3 50 Â Team Colleague

https://google-developers.appspot.com/maps/documentation/javascript/examples/map-simple

There is a map example. View the code. It is VERY easy....

BTW, noone knows "simple Dreamweaver" as it is a program, not a programming language. What you may/may not know is PHP/JS/HTML/etc....

riahc3 50 Â Team Colleague

The question is why?

The website seems to be recreational (nothing towards coorp users) which would be at MIN running Windows 2000 (Windows 2000 can run up to IE6 only). XP (your true MIN "core audicence") runs up to IE8. You should test against IE8 if anything.

Even if that, if this is a new website, its for your future audicence: Most of your future audicence will be running at least IE9.

Web developers have to STOP testing against old versions of Internet Explorer. This is 2013 people. If it doesnt work, the public should upgrade to a newer version of their browser, not the other way around. IE6 is older than XP. IE8 can run on ALL OSs (except Windows 2000) than run IE6.

If you really want to help your users, detect if they are running IE6 and Windows 2000 (or below), and resend them to a page that explains in a easy format that they should use another browser such as Firefox or Chrome. If they are using IE6 and something newer than Windows 2000, directly redirect them to the internet explorer homepage.

DO NOT HOLD WEB DEVELOPMENT BACK AND MAKE IT EASIER FOR THE REST OF US DEVS.

riahc3 50 Â Team Colleague

Actually, there is no such thing in reality as a "perfect" random number generator. There are good ones, and there are ok ones. See this tutorial for more information: http://www.phy.ornl.gov/csep/CSEP/RN/RN.html

I like this from the extended summary (the posting is from one of the foremost research labs in the US, Oak Ridge National Laboratory):

And as an aside, I have done research into random number generators, and find that I personally like the lagged fibonnaci generators. I used such techniques in the 1980s when developing index fund balancing algorithms for the Mellon Bank / Mellon Capital Management. They worked very well.

I know that 100% random numbers are impossible but I want to get as close to 100% as possible.

Its out of curiousity nothing else...

riahc3 50 Â Team Colleague

I understand that repping/solved by yourself it is not implemented because it can be abused....

riahc3 50 Â Team Colleague

Riahc3, it was mentioned earlier you can quote using the '>' character at the start of the quoted sentence. No need for writing out lots of quote tags :)

I tried this. But lets say I quote you using '>', line break, and then I start typing; It still sees WHAT I AM TYPING as a quote. I dont know if this is a IE9/W7 bug....

The only way I can split quotes is a lot of line breaks then highlighting and quote.

Then you should take the two minutes it takes to learn how to do it. Since the last changes (which were made following suggestions from the users) I no longer have a problem quoting either manually or with the Quote button

The only way to do it and have the correct output is copy, hit the quote button, erase the double quote it automatically does for some unknown reason and continue....

From what I understand (I don't have to work with the code), trying to "pretty up" the frontend of VBulletin was like putting lipstick on a pig. IMO you start with a solid foundation then build on that. You don't spend your time playing whack-a-mole with a crappy code base.

Here is the thing: Users love the lipstick. They dont care if there is a pig behind it. Thats the developers problem.
What we have currently here is a great body (backend) with a malformed face (frontend). Users are …

riahc3 50 Â Team Colleague

BTW, I am not trolling. Im not pointing these things out to waste my time or the rest of the members' time. If you feel this way, please leave the thread.

riahc3 50 Â Team Colleague

My apologies for taking so long to post ...

Thank you for your time Dani. As you can see, quoting you is near imposible and since you use Javascript to do it, this post Im writing appers with a lag that is horrible. Nonetheless, you took the time and Ill try to take the time to reply to your post...

Ive read this on several occasions: The backend of vBulletin was a mess and the frontend was good, but now this new system, the backend is nice but the frontend??? Ultimitly your site is directed towards users who use the site. I mean yeah its nice that its easier for you but you made it harder for the users. The users should come first and then the backend.

I know that you have limited resources as most programmers working on this site work for free and do it in their free time, but it has been months now and I dont see any improvement over the system. I cant say it gets worst either (except bugs/glitches but those are expected in some way) but most importantly it doesnt get better. I come to this site, I read a reply and think "man this is going to be painful to quote and copy code" I am never expirenced that with ANY site.

Ive posted on Github and Stack Overflow and I have never felt the way I feel about your site as I described above. I mind it alot …

riahc3 50 Â Team Colleague

Ctrl+A, Right-Click + Select All, work as intended.

Once again, no. They do not work.

Blaim Microsoft, not DaniWeb.

Blaim Microsoft? Is this a new company? Blaim sounds like such a powerful word!

Dont BLAME anyone/anything on the site's errors and incorrect programming. The fault is the programmers working on DaniWeb.

riahc3 50 Â Team Colleague

Let's try this again. What OS and browser are you using and what versions? You've said you're having problems with Chrome, Firefox, and IE, but there's definitely something else going on because nobody can seem to reproduce the issues to the severity that you suggest. Surely you don't think that we'd release something as bad as the above and claim that it's not broken. :rolleyes:

Noone can seem to reproduce the issueS? Excuse me? pritaeas mentioned in this thread that one of the bugs happens to him as well. Read everything, not only the things you want to....

This happens on Windows 7 Ultimate SP1. My main browser is IE9 but Ive tried to see if my experience on this site is better with Chrome and Firefox (a good site is good on ALL browsers but....) yet these same bugs appear.

riahc3 50 Â Team Colleague

ets get this straight... every forum has its own pros and cons.......

No doubt. Its just that most forums have more pro than cons. This one is the few that you notice more quirks than amazing features (I perfer not to call them pro and cons :) )

riahc3 50 Â Team Colleague

Windows 8 maybe that will happen, but for now it's impossible to have the same experience on both PC and mobile platform simply because mobile doesn't have the real-estate necessary to view DaniWeb like you do on PC. I tried it on a tablet -- very very difficult to do. Some web sites have a mobile version of the PC web site and the user experience are definitely different on the two. Maybe with Windows 8 and beyond that will change so that the experience will be identical on both. But for now, that isn't possible.

I was referring to a simple forum. Forums dont use anything flashy or resource intensive to have a different expierence. You hit with your finger the textbox where you want to type, type, and click on Post. Same expirece: Finger (click), type (type), and finger (click).

I repeat that I have the same expirence on most forum sites except daniweb. Hell, I actually load the desktop version on most forum sites because the mobile version is too stripped.

That was funny. Was it supposed to be?

No, if you think it was funny, you need professional help :)

riahc3 50 Â Team Colleague

I take it you're going to air your dirty laundry every few months just to remind us that you're unhappy with the new system?

I could have sworn I made this thread before. I looked around and could not find it. I apoligize.

But Im not sure if it was you or another user that said you get use to it if you learn how to use it. I tried and I tried and I just cant because other forums are not like that.

You can use spaces too, or the Code button on the editor. Or you could not use an old DOS box because extreme examples are often stupid. And let's be honest here, if you're posting from a phone or a tablet, you shouldn't really expect the same experience as you would from a computer. We may even provide a mobile version of Daniweb in the future. Having used forums from a tablet before, I recognize that there are usability issues. But it's not unique to Daniweb. I think the problem is that you've become used to vBulletin based forums and simply don't like being forced to learn new workarounds.

Thanks for the space tip but "tabbing" with the space bar is like using Windows 95 in 2012; Yes you can do it but you shouldnt. Ill give it you that the DOS box was a extreme example but a mobile platform? Im sorry but no; A forum should have the same expirence …

riahc3 50 Â Team Colleague

No "hi" or anything as you have to act now and quickly.

Microsoft for whatever lame excuse they present, are cutting out previous 25GB storage down to 7GB. So you can compare: Google Music allows 20,000 songs with a 250 MB limit per song which means in theory you can store up to 5TB. Dropbox uses a horrible of 2GB....

So go to https://skydrive.live.com/ManageStorage NOW (Do not even keep reading this post) and claim your free 25GB even if you dont use it for anything because simply you never know.

riahc3 50 Â Team Colleague

Hey

I wanted to make a thread for not only myself but for others to give a "thank you" to anyone who has helped them.

In my case, without some suggestions here, I would have been stuck for days on a single thing and not be able to advance further.

I got a month left at my job so more Java things will problably pop up :P but meanwhile Im trying to get a C# social network going so might pop up over there more frequently. But who knows....

Anyways thanks to all :)

riahc3 50 Â Team Colleague

I'm using Java 6 but I solved it: had to set the file type to binary instead of the default of ASCII. My fault.

dantinkakkar commented: In every thread of yours, you find the solution at the very end yourself!. :P +4
riahc3 50 Â Team Colleague

In my main, when trying to delete it, it simply says unable to delete. Nothing else.

riahc3 50 Â Team Colleague

binary

As a binary file? Is there some easier way and much more simple?

riahc3 50 Â Team Colleague

Yeah .. look at the rsync source for ideas :)

I rather not "rip" code from another utility.

Id just like to make this using a shell script. Please no more comments suggesting rsync. Thank you :)

sknake commented: fair enough, i wont badger you anymore :P +9
riahc3 50 Â Team Colleague

Kinda important so bumping up...

riahc3 50 Â Team Colleague

There you go, a program to print a balanced checkbook

Well I learnt something from this thread

printf(
        "CHECKBOOK\n"
        "=========\n"
        "    ^\n"
        );

Had no idea you could do that in C.

Salem commented: :) at least someone got something out of it +32