Forum Replies Created

SapnaVishwas Member

You could use awk on a Linux machine, or install one of the free versions available for Windows, and then run a script like this:

BEGIN {
   print "INSERT INTO [mydb].[mytable]"
   print "   ([fieldname1], [fieldname2], [fieldname3])"
   print "   VALUES"
}
{
   print "      (" $0 "),"
}

using the command

awk -f myfile.awk myfile.csv

Of course this assumes that the CSV fields map one-to-one with your columns. If they don’t, you can use multiple awk scripts to extract the individual fields and generate multiple SQL scripts.

SapnaVishwas Member

There is no method named empty() for a String object.

Here is the code that prints all the received words also ignoring nulls now.

import java.util.Scanner;
public class lab13zad3{
    public static void main(String[] args) {
       Scanner sc= new Scanner(System.in);
       
       String word;
       String words[]=new String[100];
       int i=0;
       
       String k="end";
       System.out.println("Write some words: ");
       word=sc.next();
       
       //Add words to the array
       while(word.compareToIgnoreCase(k)!=0)
       {
         words[i] = word;
         i=i+1;
         word=sc.next();
       }
       
       //Add "end" after receiving all the words
      words[i] = k;
      System.out.println("The received words are:");
      for(int j=0;j 0)
           System.out.println(words[j]);
      }
    }
}           

For the second part of the question, are you trying to print all the words without any spaces or printing all words in the same line with a space between each?

SapnaVishwas Member

It stuck again.

if(type.equals("A")){
       int lenght=words.length;
       lenght=i+1;
       i=0;
       while(i

Code is working, but not that way i want.

It's shows properly words:

Cat
Cats
blabla
null (i guess it's that word "end" right, ) Any tips how to replace that with "end" ?
Or somehow i need to assign that "end" to end of array ?

And the second question.

How should code look if i want to have words like that:

c a t s d o g s etc. Smile (Here i have only one thought, that i need somehow add space between words ;x)

Null is because of that "string k = "end" ;d maybe...

in reply to: SQL login check help
SapnaVishwas Member

check for UID is I noticed if I had it just look if the username and passwords matched, it accepted any username and password from the userlist, so a user I had made for another page could also login here, I wanted to prevent different usernames to login to the “secret” pages. When it checks the UID, then I make sure only the specific user can log in.

Probably there would also be another way, this is just what worked for me first.

SapnaVishwas Member

To program things in C++ is a lot of work on your own. The learning curve is very steep and you might get put off if you try and dive in too deep. I’d honestly recommend some form of Visual Studio work (.NET, VB, anything) to at least get your feet wet.

in reply to: RealBasic programming
SapnaVishwas Member

Ahh, realbasic, I use that sometimes, and all I need is the Language Reference in the help menu.
It contains examples on almost everything in there.

Just use it to read up on any function you are trying to use, and it should explain every way on using it, it also contains stuff on all the controls and such

Also, noticed you use mac(userbar or what ever they are called) so are you using realbasic on your mac?

SapnaVishwas Member

Wow that actually exists, any general solution that works multi platform bro ? linux, windows, etc, and multi language too , python, java, etc.. ? thanks ; )

SapnaVishwas Member

strtok() will modify the original string by replacing a deliminator with ‘\0’.

...
char * dateString = "1/1/1";
Date dateClass(dateString);
...
------------------------------------
...
Date dateClass("1/1/1");
...

The code above will give you an access violation because your compiler will make dateString immutable and “1/1/1” will be treated as a constant which will also be immutable.

...
char dateString[] = "1/1/1";
Date dateClass(dateString);
...

The code above will work because dateString can be modified as long as it’s within its boundaries. You can also make a copy of the original string and use the copy with strtok().

SapnaVishwas Member
1>------ Rebuild All started: Project: webclient4, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  AssemblyInfo.cpp
1>  main.cpp
1>main.cpp(37): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(197) : see declaration of 'strtok'
1>main.cpp(40): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(197) : see declaration of 'strtok'
1>  Generating Code...
1>  .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1>  webclient4.vcxproj -> D:\webclient4\Debug\webclient4.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Dear friend,
i tried your code in visual studio 2010 express.It passses the build test but gives this warning.The warning is self explanatory.

The said code is deprecated and can produce dangerous results;which in your case seems to be crashing.

Hence follow the solution given with the warning itself.

SapnaVishwas Member

thanks but I can’t modify the code I wrote above. I need to know what else should I put in there to work.

also, I need to submit the data to a text file not to email it.
but thanks for your help, I appreciate it.

SapnaVishwas Member

What are the two other data sources? Flat files, db tables, …

Write a pl/sql procedure that takes care of the import of new data and schedule that procedure with dbms_scheduler.

SapnaVishwas Member

Use jQuery (JavaScript library) as it has an awesome ajax handler which you might like:

$.ajax("url", {"options"}, function(data) {
//do something with data.
});
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/

Search that site for ajax – it’s a really decent site to learn from! Razz

Also, bare in mind that article may be old and things might have changed, but the core principles will be the same.

in reply to: PHP Display array data
SapnaVishwas Member

You need the implode function. More info here:

http://php.net/manual/en/function.implode.php

Use it like this:

echo implode(",", $names);

SapnaVishwas Member

I suggest you read/have a look at books like:

Effective C++
Effective STL
Exceptional C++
Exceptional C++ Style
Modern C++ Design

SapnaVishwas Member

I read C++ Primer last semester for my programming course and it was actually my first book I’ve read on C++ prior to having any knowledge of it whatsoever, I wasn’t following the book so well being that I hated the professor and the professor made me just not want to program at all…

But anyways now I’m reading C++ How to Program 7th Ed by deitel which you could find a pdf of online if you’re interested. But so far I’m enjoying the read, I will agree it’s very detailed and sometimes boring but it’s a nice refresher to refine what you know or what you think you know about C++ in general.

Viewing 15 posts - 16 through 30 (of 156 total)
en_USEnglish