Search This Blog

Thursday, March 19, 2009

Read && Write To/From file c++ MFC

two simple function to read & write to/from file in c++ MFC.

void WriteToFile(CString data)
{
CStdioFile file("C:\\TEMP\\chinese.txt",CFile::modeCreate | CFile::modeWrite);
file.WriteString(data);
file.Close();

}
CString ReadFromFile()
{
CStdioFile file("C:\\TEMP\\chinese.txt",CFile::modeRead);
CString data;
file.ReadString(data);
file.Close();
return data;

}


Yaniv

Tuesday, March 17, 2009

See all network computers

if you want to see all network computer , you can run the next command on your windows console
net view

Sunday, March 15, 2009

Windows command line

In the next link you can find all windows command line from A-Z
Command-line reference A-Z

Thursday, March 12, 2009

Read && Write To/From file UTF-8 characters in java

Here is the write method :


private void writeToFile(String data)
{
try {
File file = new File("C:\\TEMP\\chinese1.txt.html");
BufferedWriter bw = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(file),"UTF8"));

bw.write(data);
bw.close();

} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}



Here is the read method


private String readFromFile()
{
String retStr="";
try {
File file = new File("C:\\TEMP\\chinese.txt.html");
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(file),"UTF8"));

String s;
while((s = br.readLine()) != null) {
retStr += s;//new String(s.getBytes(),"UTF-8");
}
br.close();

} catch (IOException e1) {
e1.printStackTrace();
}
writeToFile(retStr);
return retStr;
}


Yaniv

Sunday, March 8, 2009

Axis Web services with XML Schemas

if you would like to develop AXIS web services with validation schema, you can find here a very good tutorial / article , with project sample .

Developing Axis Web services with XML Schemas

enjoy
Yaniv

Monday, February 23, 2009

Setting SSL for Tomcat

Setting up SSL on Tomcat is easy and you don’t have to do much for converting your web application to work with the Https protocol.
in the next article i found you will find the three simple steps you need to follow.
i can confirm that its working well !

setting-up-ssl-on-tomcat-in-3-easy-steps

enjoy
Yaniv

Monday, February 2, 2009

Open url in Full screen mode

Here is a sample that simulate opening a url in a new browser in a full screen or as a popup, with several variation , you can even put your page name for test.
create two html files e.g a.html & b.html.

copy the next code into a.html file - and navigate to a.html file .

<html>
<script language=javascript>
function getUrl()
{
var myTextField = document.getElementById('myText');
if(myTextField.value != "")
return myTextField.value;
else
return "b.html";


}
function openMaxWithSize(url)
{
var strParam="titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,top=0,left=0";
strParam += ",height=" + (screen.availHeight-40);
strParam += ",width=" + (screen.availWidth-10);
window.open(url,'',strParam); //remove comment to open full screen
}

function OpenUrl(url)
{
var childWin;
childWin = window.open(url,'window','height=300,width=550,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
childWin.focus();
}
function OpenUrl_yaniv(url)
{
var childWin;
childWin = window.open(url,'window','fullscreen=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no');
childWin.focus();
}
function Maxfullwin(url){


window.open(url,'MainUI', ',type=fullWindow,fullscreen,scrollbars=yes,channelmode=0')
}

</script>
<body>
<br/>
page to Open <input type=TextBox id="myText" value="b.html"/>
<br/>
<br/>

<input type=button value="open Max With Size" onclick="openMaxWithSize(getUrl());"/>
<input type=button value="Open Url" onclick="OpenUrl(getUrl());"/>
<input type=button value="Open Url yaniv" onclick="OpenUrl_yaniv(getUrl());"/>
<input type=button value="Maxfullwin" onclick="Maxfullwin(getUrl());"/>
<br/>
</body>
</html>

enjoy
Yaniv