use nmake from command prompt console window
*********************************************
If you open the command prompt console window from within the IDE by
using the menu item:
Tools->Visual Studio 2008 Command Prompt
============================================================================
The compiler has to know the path(s) to the header files (such as stdio.h).
There are a number of ways this can be specified. Normally it is specified
via an environment variable - INCLUDE=
The linker also has to know the path(s) to the lib files to be linked.
Again, there are a number of ways this can be specified.
Normally it is specified via an environment variable - LIB=
If you open the command prompt console window from within the IDE by
using the menu item:
Tools->Visual Studio 2008 Command Prompt
these environment variables will be set up for you automatically.
The file vcvars32.bat is where these are configured for 32-bit builds.
It's in the VC++ bin directory.
You can also specify the include file directory via the /I switch when
invoking cl.exe - type cl /? to see all of the options available. Note
the linker options as well.
As a self-professed "absolute beginner" you would be well-advised to
use the IDE for doing your programming. It will configure many things
for you - especially if you use the supplied project templates. There
are many things you have to consider when building using the command
line tools, which most beginners won't be able to cope with initially.
- Wayne
Thursday, March 18, 2010
Friday, February 19, 2010
[Work] how to make windows 7 search file contents
How to Make Windows 7 Search File Contents
http://www.wikihow.com/Make-Windows-7-Search-File-Contents
1. Click the Start button and in the search box at the very bottom type "search" then choose the result "Change How Windows Searches"
2.
2
Choose the "Advanced" button just below the list of indexed locations.
3.
3
Activate the "File Types" tab in the Advanced Options window.
4.
4
After windows populates the file type list, locate the extension that you want it to look into in the future.
* If the extension is not listed, enter your desired file extension, such as ".php" into the input box at the bottom and click Add.
5.
5
Once your extension is highlighted, change the indexing property to "Index Properties and File Contents" and click OK, close the Indexing options.
6.
6
Try your search again and your expected results will appear.
http://www.wikihow.com/Make-Windows-7-Search-File-Contents
1. Click the Start button and in the search box at the very bottom type "search" then choose the result "Change How Windows Searches"
2.
2
Choose the "Advanced" button just below the list of indexed locations.
3.
3
Activate the "File Types" tab in the Advanced Options window.
4.
4
After windows populates the file type list, locate the extension that you want it to look into in the future.
* If the extension is not listed, enter your desired file extension, such as ".php" into the input box at the bottom and click Add.
5.
5
Once your extension is highlighted, change the indexing property to "Index Properties and File Contents" and click OK, close the Indexing options.
6.
6
Try your search again and your expected results will appear.
Monday, January 18, 2010
[work] miktex repository
make a local repository directory
for example, localtex
put two files in the folder
miktex-zzdb1-2.6.tar.bz2
miktex-zzdb2-2.6.tar.bz2
download the necessary packages for local installation
http://tug.ctan.org/tex-archive/systems/win32/miktex/tm/packages/
for example, localtex
put two files in the folder
miktex-zzdb1-2.6.tar.bz2
miktex-zzdb2-2.6.tar.bz2
download the necessary packages for local installation
http://tug.ctan.org/tex-archive/systems/win32/miktex/tm/packages/
Saturday, January 16, 2010
[work] ruby search convert files
require 'find'
require "FileUtils"
require "ftools"
def pfm2exr(dirname)
sum=0
Find.find(dirname) do |f|
if(f[f.length()-4..f.length()]==".pfm")
puts f
fnew=f[0..f.length()-4]+"exr"
cmdline="D:/proj/pfm2exr/Release/pfm2exr.exe -in \""+f+"\" -out \""+fnew+ "\" -precision 1"
puts cmdline
system("#{cmdline}")
puts "delete"+f
File.delete(f)
end
end
sum
end
if ARGV.length != 1
puts "ruby pfm2exr.rb\n"
Process.exit
end
dir=ARGV[0]
pfm2exr(dir)
[work] ruby time
oldtime=Time.now
for i in 0..18000
a=Math::cos(0.2)
#puts "hahahhee"
end
puts Time.now-oldtime
Monday, January 4, 2010
Monday, December 21, 2009
[Work] Ruby, check directory folder existence
if File.exists? path_out
puts path_out+" exists"
else
# puts path_out+" doesn't exist"
Dir.mkdir(path_out)
end
Wednesday, December 16, 2009
[work] gnuplot
C:\gnuplot\bin\wgnuplot.exe plot_gather.pl
file: plot_gather.pl
==============
set output "stoke_C_gather7.png"
#set terminal postscript eps color 22
set terminal png size 1200, 900
set xlabel "Roughness"
set ylabel "C"
plot [][] \
'curve.txt' using 1:2 with lines title "Roughtness-C"
file: plot_gather.pl
==============
set output "stoke_C_gather7.png"
#set terminal postscript eps color 22
set terminal png size 1200, 900
set xlabel "Roughness"
set ylabel "C"
plot [][] \
'curve.txt' using 1:2 with lines title "Roughtness-C"
[Work] Ruby, organize text file
files=["stokesCR025.txt",\
"stokesCR05.txt",\
"stokesCR10.txt",\
"stokesCR15.txt",\
"stokesCR20.txt",\
"stokesCR25.txt",\
"stokesCR30.txt",\
"stokesCR35.txt",\
"stokesCR40.txt",\
"stokesCR45.txt",\
"stokesCR50.txt"]
rough=[0.025, 0.050, 0.100, 0.150, 0.200, 0.250, 0.300,0.350,0.400,0.450,0.500]
num=files.size
fout=File.new("curve.txt", "w")
for j in 0..num-1
fname=files[j]
puts "fname "+fname
roughness=rough[j]
file = File.new(fname, "r")
i=0
while i<2 do
line = file.gets
i=i+1
end
value1=line.match(/^[0-9]* /)
puts value1.to_s
value2=line.match(/ [-,.,0-9]*$/)
puts value2.to_s
file.close
fout.puts roughness.to_s+" "+value2.to_s
end
fout.close
Wednesday, December 2, 2009
[Ruby] make thumbnails
require "FileUtils"
require "ftools"
filetype = ".jpg"
path_in = Dir.pwd
path_out=path_in+"/thumbnail"
if !FileTest::directory?(path_out)
Dir::mkdir(path_out)
end
dir=Dir.open(path_in)
a=Array.new(dir.collect.length)
num=0
dir.each do |file|
if(file.length>filetype.length)
if (file[file.length-4..file.length]==filetype)
a[num]=file
num=num+1
end
end
end
puts num
for i in 0..num-1
fold = path_in + "/" + a[i]
fnew_ppm = path_out + "/" + a[i][0..a[i].length-5]+".ppm"
fnew_jpg = path_out + "/" + a[i][0..a[i].length-5]+".jpg"
cmdline="convert -resize 200x -quality 100 "+fold+" "+fnew_ppm
puts cmdline
system("#{cmdline}")
cmdline="convert -quality 100 "+fnew_ppm+" "+fnew_jpg
puts cmdline
system("#{cmdline}")
puts "---------------------"
File.delete(fnew_ppm)
end
[Ruby] resize image (portrait or landscape)
require "FileUtils"
require "ftools"
filetype = ".jpg"
path_in = Dir.pwd
path_out=path_in+"/size2900"
if !FileTest::directory?(path_out)
Dir::mkdir(path_out)
end
dir=Dir.open(path_in)
a=Array.new(dir.collect.length)
num=0
dir.each do |file|
if(file.length>filetype.length)
if (file[file.length-4..file.length]==filetype)
a[num]=file
num=num+1
end
end
end
puts num
for i in 0..num-1
fold = path_in + "/" + a[i]
fnew_ppm = path_out + "/" + a[i][0..a[i].length-5]+".ppm"
fnew_jpg = path_out + "/" + a[i][0..a[i].length-5]+".jpg"
#check the image size, portrait or landscape
cmdline="identify "+fold+" >t.txt"
system("#{cmdline}")
file = File.new("t.txt", "r")
line = file.gets
m=line.match(/[0-9]*x[0-9]*/)
width=m.to_s.match(/^[0-9]*/)
height=m.to_s.match(/[0-9]*$/)
#resize to ppm
if(width.to_s.to_i>height.to_s.to_i)
puts "landscape"
cmdline="convert -resize 2900x -quality 100 "+fold+" "+fnew_ppm
puts cmdline
system("#{cmdline}")
else
puts "portrait"
cmdline="convert -resize x2900 -quality 100 "+fold+" "+fnew_ppm
puts cmdline
system("#{cmdline}")
end
file.close
#convert ppm to jpg
cmdline="convert -quality 100 "+fnew_ppm+" "+fnew_jpg
puts cmdline
system("#{cmdline}")
puts "---------------------"
#delete ppm
File.delete(fnew_ppm)
end
File.delete("t.txt")
[Ruby] file rename
filetype = ".jpg"
path = "."
prefix="slide_"
dir=Dir.open(path)
a=Array.new(dir.collect.length)
num=0
dir.each do |file|
if(file.length>filetype.length)
if (file[file.length-4..file.length]==filetype)
a[num]=file
num=num+1
end
end
end
puts num
count=0
for i in 0..num-1
fnew=prefix+"%05d"%count+a[i][a[i].length-4..a[i].length]
count=count+1
old_file = path + "/" + a[i]
new_file = path + "/" + fnew
puts "old "+old_file
puts "new "+new_file
puts "--------------"
File.rename(old_file, new_file)
end
[Ruby] is a number
def is_a_number(s)
s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end
Thursday, October 8, 2009
[Work] Gears
http://www.premier-gear.com/worm_gears.htm
http://www.pslofamerica.com/worm-drives.htm
NEXEN ANNOUNCES ROLLER PINION GEAR SYSTEM
http://www.nexengroup.com/nexen/index.jsp
ring gear
http://www.plasticmachiningcompany.com/index.php?vid=20091009135215-39p
Align Trex 500 Main Drive Gear 162T (2 pcs) H50018-1
Main Drive Gear/164T HN7019-1
0412-259
Sceadu G Second Gear 80T (DTDS)
$29.99
0412-113
SD Main Gear 87T
$8.09
Tail Shaft With Pulley
http://www.pslofamerica.com/worm-drives.htm
NEXEN ANNOUNCES ROLLER PINION GEAR SYSTEM
http://www.nexengroup.com/nexen/index.jsp
ring gear
http://www.plasticmachiningcompany.com/index.php?vid=20091009135215-39p
Align Trex 500 Main Drive Gear 162T (2 pcs) H50018-1
Main Drive Gear/164T HN7019-1
0412-259
Sceadu G Second Gear 80T (DTDS)
$29.99
0412-113
SD Main Gear 87T
$8.09
Tail Shaft With Pulley
Monday, October 5, 2009
[Work] Visual Studio Linker tools errors
Linker Tools Warning LNK4098
defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Important The run-time libraries now contain directives to prevent mixing different types. You’ll receive this warning if you try to use different types or debug and non-debug versions of the run-time library in the same program. For example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you’ll get this warning. You should compile all source files to use the same run-time library. See the Use Run-Time Library (MD, /ML, /MT, /LD) compiler options for more information.
You can use the linker’s /VERBOSE:LIB switch to determine which libraries the linker is searching. If you receive LNK4098 and want to create an executable file that uses, for example, the single-threaded, non-debug run-time libraries, use the /VERBOSE:LIB option to find out which libraries the linker is searching. The linker should print LIBC.LIB and not LIBCMT.LIB, MSVCRT.LIB, LIBCD.LIB, LIBCMTD.LIB, or MSVCRTD.LIB as the libraries searched. You can tell the linker to ignore the the incorrect run-time libraries by typing the incorrect libraries in the Ignore Libraries text box on the Link tab of the Settings dialog box in Developer’s Studio or by using the /NODEFAULTLIB:library option with LINK for each library you want to ignore. See the Ignore Libraries (/NODEFAULTLIB) linker option for more information.
The table below shows which libraries should be ignored depending on which run-time library you want to use.
To use this run-time library Ignore these libraries
Single-threaded (libc.lib) libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded (libcmt.lib) libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded using DLL (msvcrt.lib) libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Debug Single-threaded (libcd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib
Debug Multithreaded (libcmtd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
Debug Multithreaded using DLL (msvcrtd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib
For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Important The run-time libraries now contain directives to prevent mixing different types. You’ll receive this warning if you try to use different types or debug and non-debug versions of the run-time library in the same program. For example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you’ll get this warning. You should compile all source files to use the same run-time library. See the Use Run-Time Library (MD, /ML, /MT, /LD) compiler options for more information.
You can use the linker’s /VERBOSE:LIB switch to determine which libraries the linker is searching. If you receive LNK4098 and want to create an executable file that uses, for example, the single-threaded, non-debug run-time libraries, use the /VERBOSE:LIB option to find out which libraries the linker is searching. The linker should print LIBC.LIB and not LIBCMT.LIB, MSVCRT.LIB, LIBCD.LIB, LIBCMTD.LIB, or MSVCRTD.LIB as the libraries searched. You can tell the linker to ignore the the incorrect run-time libraries by typing the incorrect libraries in the Ignore Libraries text box on the Link tab of the Settings dialog box in Developer’s Studio or by using the /NODEFAULTLIB:library option with LINK for each library you want to ignore. See the Ignore Libraries (/NODEFAULTLIB) linker option for more information.
The table below shows which libraries should be ignored depending on which run-time library you want to use.
To use this run-time library Ignore these libraries
Single-threaded (libc.lib) libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded (libcmt.lib) libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded using DLL (msvcrt.lib) libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Debug Single-threaded (libcd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib
Debug Multithreaded (libcmtd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
Debug Multithreaded using DLL (msvcrtd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib
For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
Friday, October 2, 2009
[Work] compiling LuxRender
error:
bison: W4: permission denied
To fix:
use Cygwin bison and flex
install and include all libraries
boost:
use installer
required components:
serialization
thread
date time
regex
filesystem
system
error C3861: 'isatty': identifier not found
add: #include
#ifdef WIN32
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
bison: W4: permission denied
To fix:
use Cygwin bison and flex
install and include all libraries
boost:
use installer
required components:
serialization
thread
date time
regex
filesystem
system
error C3861: 'isatty': identifier not found
add: #include
#ifdef WIN32
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
Thursday, October 1, 2009
[Work] How to set the path in Windows 2000 / Windows XP
Reference number: CH000549
How to set the path in Windows 2000 / Windows XP.
Question:
How to set the path in Windows 2000 / Windows XP.
Additional information:
Modifying the path statement will enable an MS-DOS window opened in Microsoft Windows as well as older programs to locate files that may be required to run the program.
Users familiar with MS-DOS will remember the PATH= statement that was in the autoexec.bat file. Additional information about the MS-DOS path command that is still usable in Windows 2000 and Windows XP can be found on our path command page, additional information about the MS-DOS command can be found on our set command page.
See our dictionary path definition for additional information about this term and related definitions.
Answer:
The path is now managed by Windows 2000 / Windows XP and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.
1. From the desktop, right-click My Computer and click properties.
2. In the System Properties window, click on the Advanced tab.
3. In the Advanced section, click the Environment Variables button.
4. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32
How to set the path in Windows 2000 / Windows XP.
Question:
How to set the path in Windows 2000 / Windows XP.
Additional information:
Modifying the path statement will enable an MS-DOS window opened in Microsoft Windows as well as older programs to locate files that may be required to run the program.
Users familiar with MS-DOS will remember the PATH= statement that was in the autoexec.bat file. Additional information about the MS-DOS path command that is still usable in Windows 2000 and Windows XP can be found on our path command page, additional information about the MS-DOS command can be found on our set command page.
See our dictionary path definition for additional information about this term and related definitions.
Answer:
The path is now managed by Windows 2000 / Windows XP and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.
1. From the desktop, right-click My Computer and click properties.
2. In the System Properties window, click on the Advanced tab.
3. In the Advanced section, click the Environment Variables button.
4. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32
Thursday, May 14, 2009
[Work] ruby script for listing the folder sizes in a folder in reversed order
#ruby script for listing the folder sizes in a folder in reversed order
require 'find'
def sizer(dirname)
sum=0
Find.find(dirname) do |f|
sum=sum+File.size(f)
# puts f
# puts sum
end
sum
end
dir=ARGV[0]
sa=Array.new #size array
pa=Array.new
Dir.foreach(dir) do |path|
folder=dir+"/"+path
if FileTest.directory?(folder)
if(path!="." && path!=".." )
pa.insert(-1, path);
s=sizer(folder)
sa.insert(-1, s)
end
end
end
#sorting
len=sa.size
for i in 0..len-2
flag=0
for j in 1..(len-1)
if(sa[j]>sa[j-1])
flag=1
t=sa[j]
sa[j]=sa[j-1]
sa[j-1]=t
t1=pa[j]
pa[j]=pa[j-1]
pa[j-1]=t1
end
end
if(flag==0)
break
end
end
for i in 0..sa.size-1
s=sa[i]
g=(s/(1024*1024*1024)).to_i
m=(s-g*1024*1024*1024)/(1024*1024).to_i
k=((s-g*1024*1024*1024-m*1024*1024)/1024).to_i
b=s-g*1024*1024*1024-m*1024*1024-k*1024
#st="%03d"%g+"G "+"%03d"%m+"M "+"%03d"%k+"K "+"%03d"%b+"B "
st=""
if(g!=0)
st=st+"%03d"%g+"G "
else
st=st+" "
end
if(m!=0)
st=st+"%03d"%m+"M "
else
st=st+" "
end
if(k!=0)
st=st+"%03d"%k+"K "
else
st=st+" "
end
print(st)
print(" "+pa[i]+"\n")
end
Subscribe to:
Posts (Atom)