I have next to no programming experience, and absolutely none with Java, so I'm looking for some good online tutorials/primers. Please point me to good ones for beginners like me.
Thanks.
Given any number of the random real numbers from the interval [0,1] is there exist any method to construct a floating point number with zero decimal part?
Your algorithm can use only random() function calls and no variables or constants. No constants and variables are allowed, no type casting is allowed. You can use for/while, if/else or any other programming language operands.
[Queston asked in ML Interview]
Design an server/application which handle multiple incoming stock information ( stock symbol and values ) Server need to store the information in some cache ( need to design the data structure ), There are multiple client connected to server using tcp/ip socket. They will subscribe to particular request say stock symbol XYZ , and may be for more then one. As and when there is change the stock symbol server should broadcast the information to subscribed client. If tcp/ip write failed, server should handle the unregistration of the client.
What various data structures will be used and how threading model will be ?
Problem
I send the message "12345" from the socket server to the client:
myPrintWriter.println("12345");
After that I read this message on client:
int c;
while ((c = inputStream.read( )) != -1)
{
byte[] buffer2 = new byte[1];
buffer2[0] = (byte) c;
String symbol = new String(buffer2 , "UTF-8");
String symbolCode = Integer.toString((int)buffer2[0]);
Log.v(symbol, symbolCode);
}
Log.v("c == -1", "Disconnected");
What I see in log:
With
out.println("abcrefg");
Why? I think it's line termination symbol. I need to get string "12345" or any other and next strings correctly. Help me please.
This has got to be a FAQ, so can someone please just direct me to a "network programming for dummies" URL?
The server wants to push information to a client or broadcast to all, when an event happens - as opposed to the clients constantly polling the server "just in case". The client then updates a browser page display.
How do I do that? (toldya it was a n00b question)
Should I have a thread which receives info on a socket and then writes it to a database which the browser display (PHP) can process with an HTML refresh tag, or what?
Sorry to sound so dumb.
Hi there ,
i always asked myself. Why are there so many DB management systems?
I am not an DB expert and i never thought about using another DB than mysql.
Programming languages offer different paradigms, so there it makes sense to choose a specific language for your purpose.
What are factors to choose a specific DB management system ?
Hi,
a colleague and I are trying pair programming for the first time. We both remote into a development machine; I'm using RemoteDesktop and my colleague is using UltraVNC. This works great except that he can't see the Intellisense dropdown in Visual Studio 2008. According to online posts, this may be something to do with DirectDraw, but I don't see much by way of a workaround.
Has anyone else experienced this?
Thanks,
Andrew
New to programming, I am trying to graph the following Gaussian function in Matlab (should graph in 3 dimensions) but am making some mistakes somewhere. What is wrong?
sigma = 1
for i = 1:20
for j = 1:20
z(i,j) = (1/(2*pi*sigma^2))*exp(-(i^2+j^2)/(2*sigma^2));
end
end
surf(z)
I'm not sure if this is the right place to post this, but the problem actually belongs to a programming assignment.
Solve the recursion:
T(0) = 2;
T(n) = T(n-1) + 2;
Solution:
T(n) = 2(n+1)
Could someone please show me how they got to that solution?
I have read lots of programmers saying and writing when programming in C/C++ there are lots of issue related to memory. I am planning to learn to program in C/C++. I have beginner knowledge of C/C++ and I want to see some short sample why C/C++ can have issues with memory management. Please Provide some samples.
So private IP addresses are
192.168.00 ~ 192.168.255.255 or 10.0.0.0 or 172.16.0.0 ~ 172.31.255.255
If I accepted a client to my serversocket, I can get the client's remoteIp address by using socket.getremotesocketaddress(); But I suspect the IP address that I'm getting from this method is only the public IP address and it must have more than one client using same public IP as this one (one like you see when you go on to the website www.whatismyip.com). So if I want to make sure that my packet is delivered to the right person using some IP address or otherthing that uniquely identifies a person, what should I have to do?
Hi. I have a TCP Server application that serves each client in a new thread using POSIX Threads and C++.
The server calls "listen" on its socket and when a client connects, it makes a new object of class Client. The new object runs in its own thread and processes the client's requests.
When a client disconnects, i want some way to tell my main() thread that this thread is done, and main() can delete this object and log something like "Client disconnected".
My question is, how do i tell to the main thread, that a thread is done ?
What is the meaning of "parallel software" and what are the differences between "parallel software" and "regular software"?
What are its advantages and disadvantages?
Does writing "parallel software" require a specific hardware or programming language ?
I have two XIb files and I need to switch between them with the swipe of a finger, like the native iphone weather app. does anyone know how to do this. please give some sample code if possible. thank you. P.S I am programming in Objective-C.
There are two connected sockets. How can I interconnect them?
Data appeared on the one socket should be written to the other.
EOF/FIN should propogate well. If one is half-closed, the other should also be half-closed.
int client = get_connected_client_socket();
int proxy = get_connected_proxy_socket();
negotiate_with_proxy(proxy);
iterconnect(client, proxy);
// Now forgot about both client and proxy.
// System should handle IO/shutdown/close.
// Ideally even without any support of the user-space process.
Can Linux do it? Can it be done by tricking connection tracking to change tracking status of existing connection?
@related http://stackoverflow.com/questions/2673975/determine-how-much-can-i-write-into-a-filehandle-copying-data-from-one-fh-to-the
Please share and vote for the best!
Please do not close this. This is a subjective question, but is programming related and can be beneficial to people.
Hi all
I have followed the instructions on the Android website on how to download the latest android source code files but it gives errors when i run this command:
repo init -u git://android2.git.kernel.org/platform/manifest.git
It gives the following error:
Getting repo ...
from git://android.git.kernel.org/tools/repo.git
android.git.kernel.org[0: 199.6.1.176]: errno=Connection refused
android.git.kernel.org[0: 130.239.17.12]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
On checking forums for its resolution, i was told that port 9418 was being blocked.
I use Ubuntu 10.04 and ensured that the firewall wasnt blocking the port and also enabled the port and the above IP addresses.
I also spoke to the networking peeps who ensured that no traffic from the internet is being blocked.
I would be glad if i could get directions on how to proceed next.
Many thanks as you respond.
Saheed.
I am developing a gaming server using the Winsock2 API from Windows, just for now until porting it to Linux.
The main problem I have found is that I don't know how to differentiate gaming clients that come from the same router/network. Let´s imagine 2 gamers that are in the same network going to the Internet through the same router IP and port with, for example IP 220.100.100.100 and port 5000, how can my C/C++ server differentiate both TCP connections and know that they are two different gamers?
Can I find any difference in the sockaddr_in struct that returns the socket when accept(...) returns ??
Hello,
I want a framework (or anything) that helps me make rich client guis. I know my server-side, but I don't like programming in ajax, javascript, css etc.
Something that wraps the ajax code in some objects/methods with clean syntax, would do the trick. I want to write code in java instead of defining css and html tags.
Does Java Spring, JSF, Django support this ?
Languages: Java, Python
Thank you
How to explain CSS Float in general language (not Programming) ? Is there any real life example to take a example to explain CSS Float?
Is there any Slideshow in very simple way to explain float?
Hi,
since moving to Windows 7 (IIS 7.5), the debug assertions do not prompt a pop up dialog anymore.
I have tested this in a separate project, and noticed that they do work when using the integrated Visual Studio Developer server (Cassini) but they do not work when using IIS Web Server.
This is a big issue for us since we are counting on debug assertions to identify potential programming errors, so any help would be appreciated.
Thanks. Eyal.
A naive question - i am a novice on mac programming.
How to change text color on Macintosh? My code uses TESetText and TEUpdate for drawing.
PS - Mac is really really badly documented.
Why are there so many Database management systems? I am not an DB expert and I've never thought about using another Database other than mySQL.
Programming languages offer different paradigms, so it makes sense to choose a specific language for your purpose.
Question
What are the factors in choosing a specific Database management system ?