Hi, As we know constructor doesn't have any return value so it is not good idea to perform exceptional handling inside constructor.SO i would like to know if i am opening a file inside constructor and due to some reason (file not exist) failure happened inside constructor then how to tackle this issue. so below are some questionin my mind (1) should we perform exceptional handling inside constructor. (2) if failure (file opening falure) happens inside constructor, does it going to affect the object state. I mean to say object is going to be currupted. if yes then what are …

Member Avatar
Member Avatar
+0 forum 17

the problem I have here is: when I input an integer it works fine, but when i input any other thing, it doesn't give me a chance to input again when the loop iterates, it just keeps printing "error type the right thing" to the screen even though "cin var" is inside the loop. #include<iostream> #include<iomanip> using namespace std; int main(){ int var; while(true){ cout<<"please enter any integer"<<endl; cin>>var; if(cin.good()){ cin.ignore(10, '\n'); break; } cin.clear(); cout<<"error, enter the right thing"<<endl; } return 0;}

Member Avatar
Member Avatar
+0 forum 3

Hi, I'm trying to create folder name (serialno) from user input (GUI) in textbox and DataMonitoring and DataControlling output files will be save in the created folder. public bool DataMonitoring(ref string returnmsg) { string folderName = String.Format(@"C:\DataOutput\{0}", serialno); String DateAndTime = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss"); FilePath = DateAndTime + "_DataMonitoring"; } public bool DataControlling(ref string returnmsg) { string folderName = String.Format(@"C:\DataOutput\{0}", serialno); String DateAndTime = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss"); FilePath = DateAndTime + "_DataControlling"; }

Member Avatar
Member Avatar
-1 forum 2

import java.io.*; class ConsoleInput{ public static void main(String ss[]) throws IOException{ InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); char c=' '; System.out.println("Enter Characters And q to Quiet"); do{ c=(char)br.read(); System.out.println(c); }while(c != 'q'); } } in upper code this line `c=(char)br.read();` get string from user at this point user enter some string like `abcdefq` and at first iteration jvm checks the a then b then c and so on until jvm finds q (Am I write) now my question is that there is not increment operator that first check a then increment and check b and so on is `BufferedReader` like …

Member Avatar
Member Avatar
+0 forum 5

I have this code. Its not the entire code because its a Blender addon with many lines that are unrelated to sockets so I give here only the part that deals with the sockets which I kept isolated from the rest of the program. def create_thread(): global threadSocket,listening threadSocket = threading.Thread(name='threadSocket', target= socket_listen) listening = True create_socket_connection() threadSocket.start() def socket_listen(): global receivedSocket,listening, receivedData,socketServer, socketMessages, pherror socketServer.listen(5) while listening: (receivedSocket , adreess) = socketServer.accept() receivedData = (receivedSocket.recv(1024)).decode("utf-8")[:-2] socketMessages.append(receivedData) receivedSocket.sendall('Hello from Blender!\n') receivedSocket.close() def create_socket_connection(): global socketServer socketServer = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socketServer.bind(('127.0.0.1',4000)) If you want to see the entire code, it can …

Member Avatar
Member Avatar
+0 forum 1

Hi! I'm trying to count the number of occurrences of each word in a text file. But program put in the file the first symbol of inputed word only (line 34) and don't enter in the for-statement (line 51). What should I serach for in my code in order to find the problem? Thanks in advance. #include <fstream.h> #include <iostream.h> #include <map.h> #include <string> #include <iterator> #include <cstdlib> #include <iomanip> #include <conio.h> typedef std::map<std::string, int> StrIntMap; // map for counting void countWords(std::istream& in, StrIntMap& words) // func that count words { std::string s; while (in >> s) { ++words[s]; } …

Member Avatar
Member Avatar
+0 forum 10

Hi All, I have come across Read and write method from InputStream and outputstream but im finding it hard to understand the logic behind it. Below is a simple example which reads a jar file from input stream and writes it to output stream. Please explain the logic on how this reading and writing happens . ** Please assume other parameters in below code are defined/intialised properly ** InputStream is = ctx.getResourceAsStream("/bookcode.jar"); int read = 0; byte[] bytes = new byte[1024]; OutputStream os = response.getOutputStream(); while((read = is.read(bytes) != -1) { os.write(bytes,0,read); } os.flush(); os.close(); } ** what will happen …

Member Avatar
Member Avatar
+0 forum 3

Oh boy They ust be tired of me now. My trouble: I have two ArrayLists of custom classes. ``ArrayList<Subject>` **a**` ``ArrayList<Student>` **b**` Within those custom classes are other custom classes which themselves have primitive data types as well as an ArrayList of other custom classes. It's a big circus going on. How do I XMLEncode those two ArrayLists, **a** and **b**, so that all the information within them branching all the way down, is saved? (Also, is it possible to save both of these to the same file please?)

Member Avatar
Member Avatar
+0 forum 4

Hello, I am Marcus and i`m new on this forum. thought it would be nice to say hello and start using this forum. My website is Onchannel Movies Portal.

Member Avatar
Member Avatar
+0 forum 6

Hai i am connect in live some problems are detected they are webcam ip address.......... my code is.... <param name="SRC" value="rtmps://59.96.238.215"> any example plz.....

Member Avatar
Member Avatar
+0 forum 1

Have this code when the button is clicked the stream starts but when the stop button is clicked nothing happens? I want to be able to stop the stream and get the recorded Media and display it? How would i do this? Any Help Will be Great. <html> <input type="button" value="Record" onclick="record(this)"> <input type="button" value="Stop" onclick="stop(this)"> <video autoplay></video> <script language="javascript" type="text/javascript"> var record = function(button) { navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia; window.URL = window.URL || window.webkitURL; navigator.getUserMedia({audio: true, video: true}, function(stream) { var video = document.querySelector('video'); video.src = window.URL.createObjectURL(stream); stream.record(); //setTimeout(stop, 10); }, function(e) { console.log(e); //setTimeout(10); }); }; var …

Member Avatar
Member Avatar
+0 forum 1

I am using the following code to write to the file out1.txt: try{ FileWriter fostream = new FileWriter("out1.txt"); BufferedWriter out = new BufferedWriter(fostream); out.write("jlsdfjdlsfhsdkjf"); out.close(); }catch (Exception e){ System.err.println("Error: " + e.getMessage()); } Now i want to write to multiple files in the same code (let us say 2 files). Do i need to define a new object other than fostream to write to another file out2.txt or i could use the same object to write to out2.txt after i close it once? I will try to explain it through a code perhaps: try{ FileWriter fostream = new FileWriter("out1.txt"); BufferedWriter …

Member Avatar
Member Avatar
+0 forum 8

Need help writing a program for class. Here were the posted instructions: Step 1: The program should have a FUNCTION that displays a screen that shows which seats are available and which are taken. Seats that are taken should be represented by a # symbol and seats that are available should be represented by a * symbol. The first thing your program should do is initialize all of the seats to available (*) and display the seating chart. (HINT: The seating chart should be a two dimensional array.) Step 2: Each row in the auditorium has a different ticket price. …

Member Avatar
Member Avatar
+0 forum 1

I'm working on a music streaming website for iPads and iPhones the website is programmed mostly with php and html. The website uses the website layout iwebkit (http://snippetspace.com/portfolio/iwebkit/). My question is how do I make box appear at the bottom of the screen that is always on the screen even when a visitor goes to another page on my website. the box would display the music player (probably just the default html5 audio player for now) on every page so that the music doesnt stop when a visitor clicks on a link on my website. Any information on how to …

Member Avatar
Member Avatar
+0 forum 4

I have been told it is good to overload the stream extraction operator to load data from a file. Would I simple use this in my class: friend ifstream &operator>>( ifstream &input, Class &C ) { input >> C.variable1 >> C.variable2 >> C.variable3; return input; } What are the advantages of overloading the stream extraction operator to read data from a file? Also I am confused what to do in main. At the moment to read in the data I have for example: ifstream fin; fin.open("filename.txt"); if(fin.good()) { object1 = new Class[10]; for (int i=0; i<10; i++) { fin >> …

Member Avatar
Member Avatar
+0 forum 7

Hello everyone am facing an error exception SQLServerException: The TDS protocol stream is not valid Jan 19, 2013 4:21:02 PM com.microsoft.sqlserver.jdbc.TDSReader throwInvalidTDS SEVERE: ConnectionID:18 got unexpected value in TDS response at offset:1508 Jan 19, 2013 4:21:02 PM com.microsoft.sqlserver.jdbc.TDSReader throwInvalidTDS SEVERE: ConnectionID:18 got unexpected value in TDS response at offset:1451 com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid. at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368) at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1355) at com.microsoft.sqlserver.jdbc.SQLServerConnection.throwInvalidTDS(SQLServerConnection.java:1344) at com.microsoft.sqlserver.jdbc.TDSReader.throwInvalidTDS(IOBuffer.java:3190) at com.microsoft.sqlserver.jdbc.ServerDTVImpl.getValuePrep(dtv.java:1922) at com.microsoft.sqlserver.jdbc.ServerDTVImpl.skipValue(dtv.java:1831) at com.microsoft.sqlserver.jdbc.DTV.skipValue(dtv.java:103) at com.microsoft.sqlserver.jdbc.Column.skipValue(Column.java:86) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.skipColumns(SQLServerResultSet.java:135) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.loadColumn(SQLServerResultSet.java:670) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getterGetColumn(SQLServerResultSet.java:1962) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:1982) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:1967) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getString(SQLServerResultSet.java:2301) at org.apache.jsp.jsp.fas_005fconpaybillcheque_005fentry_jsp._jspService(fas_005fconpaybillcheque_005fentry_jsp.java:832) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at …

Member Avatar
Member Avatar
+0 forum 1

Hello, In trying to port some Java code to C++ I'm disliking the std::stream's lack of copy constructors. I know exactly what the problem is, but I don't know what I can do about it. I have a dangling reference to a stream as a member variable of a class. My full code is very large but hopefully this will work to explain my dilema: (comments in caps indicate the problem areas, lowercase is extra information) class PushbackReader{//class allows unread operations and limits read/unread to single char protected: istream & myreader;//SHOULD THIS BE A POINTER? //other stuff for pushback buffer …

Member Avatar
Member Avatar
+0 forum 15

I want to know if it could be posible to implement a web video chat conference, without any server between?. I'm building a web portal that implements web text chat... but I want to it to have video also. Thanks

Member Avatar
Member Avatar
+0 forum 1

I am doing a project and I need to monitor a program I run through ssh2, I need to get info while it is running but i dont know how to do that really. First this is my code (part of it): $stream = ssh2_exec($con, "make run"); $data = stream_get_contents($stream); while($buffer = fread($stream, 4096)) { $data .= $buffer; $mem = getMemory($con); echo "<br/> Total: ".$mem; } Does anyone know how I can get the memory a few times while the program I ran with make run is running?

Member Avatar
Member Avatar
+0 forum 1

std::string s = "65//3"; std::istringstream indexBlock(s); for (int i = 0; i < 2; i++) { int index = 0; indexBlock >> index; std::cout << index << std::endl; } I would expect the output of the cout to be: output: 65 3 as I thought the stream iterates through the ints when passing it through '>>'. However the actual output is: output: 65 0 Can someone please explain what is happening and how I might go about changing it to get the desired result. Thank you.

Member Avatar
Member Avatar
+0 forum 1

Hi :) I was wondering if anyone knows of (or has created) some type of software that could synchronise video between two remote computers (not on LAN). My internet speed is too slow to stream the actual video file, so is there some way of simply streaming the position of the movie to the other computer. I hope I'm being clear enough :P Thanks :D

Member Avatar
Member Avatar
+0 forum 4

Hello everyone, I have question about how AudioTrack instance should be used for streaming applications. Below my code example and some brief explation about code ... /* some work before */ InputStream in = client.getInputStream(); AudioTrack output_stream = new AudioTrack(AudioManager.STREAM_MUSIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT, 8192, AudioTrack.MODE_STREAM); byte[] buffer = new byte[8192]; int count; while ((count = in.read(buffer)) != -1) output_stream.write(buffer, 0, count); output_stream.flush(); Now I am in my receiver class where receives sound data from sender class I want to use this sound to play as streaming mode, and in Android API we can use AudioTrack.MODE_STREAM I hear some sound in …

Member Avatar
Member Avatar
+0 forum 1

it show me this when i click the previw button to show the page how i can fix this? Warning: include(funck.inc.php): failed to open stream: No such file or directory in C:\xampp\htdocs\search\index.php on line 1 Warning: include(): Failed opening 'funck.inc.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\search\index.php on line 1

Member Avatar
Member Avatar
+0 forum 6

Hi, I am recieving these two errors when attempting to upload an image file to my server: Warning: move_uploaded_file(images/) [function.move-uploaded-file]: failed to open stream: Is a directory in }[I removed the path, this is not part of the error] on line 13 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php2bBihw' to 'images/' in [i removed the path again for security reasons] on line 13 I'm using 000webhost as a free user, and I checked the permissions on the forder, and they are at the correct settings. So I'm not exactly sure what's wrong. If you need my php script that I …

Member Avatar
Member Avatar
+0 forum 2

I am connecting to a data stream that pushes data continuously and when I tried to set up a network stream I just could not connect and kept getting the 'not found' error. I used the httpwebrequest with webrequest.keepalive = true and started to consume the data by reading into a buffer and then appending to a stringbuilder. Once the stringbuilder reaches max size I flush it to a text file. The problem is that I get disconnected from the data stream because I am not reading the data fast enough. I need to keep the connection open and read …

Member Avatar
Member Avatar
+0 forum 1

In below code using i try to upload multiple files to remote URL. but only 1 file data only i am receiving. please help any one to resolve issue. Remotepage.php i am not getting sign,cheque file details [CODE]<?php function do_post_request($url, $postdata, $files = null) { $data = ""; $boundary = "---------------------".substr(md5(rand(0,32000)), 0, 10); //Collect Postdata foreach($postdata as $key => $val) { $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$key."\"\n\n".$val."\n"; } $data .= "--$boundary\n"; //Collect Filedata foreach($files as $key => $file) { $fileContents = file_get_contents($file['tmp_name']); $data .= "Content-Disposition: form-data; name=\"{$key}\"; filename=\"{$file['name']}\"\n"; $data .= "Content-Type: image/jpeg\n"; $data .= "Content-Transfer-Encoding: binary\n\n"; $data .= …

Member Avatar
Member Avatar
+0 forum 2

Hi All I do not read file content except .txt file .Can you give universal solution in vb dotnet to read content all type of file. Thanks in advance Dim filetoread As String = "c:\CodeNotes_NET.pdf" Dim filestream As StreamReader filestream = File.OpenText(filetoread) Dim readcontents As String readcontents = filestream.ReadToEnd()

Member Avatar
Member Avatar
+0 forum 1

Ive got a bunch of VOB (mp2) files from DVDs - far too many to transcode to, say, H.264 format), plus i dont want to lose any quality. I want to be able to stream these from my (linux) server. What software do I need?

Member Avatar
+0 forum 0

Well... im making some kind of graphic engine for console in [B]c++[/B], ASCII based, just for exercise... anyways, i was wandering, can i print text [B]faster[/B]? Right now i'm printing the whole map of characters (pix[160][120]) in a [B]single line[/B], so it is fast, however i need it faster cause the screen is [B]flickering[/B] and it is realy annoying.. help please? im kind of newbie to console input output streaming..

Member Avatar
Member Avatar
+0 forum 7

Here are two examples of opening read streams to files on an FTP server. One example uses the FtpWebRequest method. One example uses the WebClient method. Here is a method of testing those functions: [CODE] using System; using System.Diagnostics; using System.IO; using System.Net; namespace UseFtpStreamExample { using FtpReadStreams; class Program { static void Main(string[] args) { string strError = ""; string strFtpUri = #if !DEBUG "ftp://ftp.myServer.com/SomeFile.txt"; #else "ftp://download.textpad.com/welcome.msg"; #endif // Be sure to open an debug output window to see file contents if (!CFtpReadStream.DoWebRequestExample(strFtpUri, ref strError)) { Trace.WriteLine("Could not read WR: " + strError); return; } // Be sure to …

Member Avatar
+0 forum 0

The End.