Showing posts with label Computer Technique. Show all posts
Showing posts with label Computer Technique. Show all posts

Wednesday, June 02, 2010

chrome problem: "could not create directory for unzipping"

when install extension in google chrome, may show a problem named "could not create directory for unzipping"

may work in some systems by running chrome using
chrome.exe --enable-logging --log-level=0 --single-process

Wednesday, April 21, 2010

Matlab black picture problem

Warning: Problems in UIW_SetUpGLPrinting
In C:\Program Files\MATLAB\R2009b\toolbox\matlab\graphics\hardcopy.p>hardcopy at 21
In graphics\private\render at 143
In print at 277
In hgexport at 818
In filemenufcn>localSaveExportHelper at 206
In filemenufcn>localSaveExport at 316
In filemenufcn at 56

Try changing the Renderer property of your figure from OpenGL to ZBuffer.
To do this, use:

set(gcf, 'Renderer', 'ZBuffer')

Friday, October 23, 2009

resolve MPI deadlocking

Deadlock is a problem with blocked communication.

Example 1: always deadlocking

if (rank == 0) then
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif


Example 2: sometimes deadlocking: MPI is using internal buffers (the “message envelope”) to cache messages. A blocked comm pattern may work for some values of count, and then fail as count is increased.

if (rank == 0) then
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
elseif (rank == 1) then
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
endif


A couple of ways to fix this problem.
Method 1: reverse the order of one of the send/receive pairs

if (rank == 0) then
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif


Method 2: using unblocked communication

if (rank == 0) then
call MPI_Isend(..., 1, tag, MPI_COMM_WORLD, req, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Wait(req, status)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif

Sunday, June 07, 2009

latex multi-plots using minipage and picture env



\begin{figure}[h!]
\begin{minipage}{0.5\textwidth} 
\includegraphics[width=\textwidth]{uz_low.eps}
\end{minipage}
\begin{minipage}{0.5\textwidth} 
\includegraphics[width=\textwidth]{uz_high.eps}
\end{minipage}
\setlength{\unitlength}{1in}
\begin{picture}(0,0)(0,0)
\put(0.2,0.1){\makebox(0,0){\textbf{(a)}}}
\put(3.22,0.1){\makebox(0,0){\textbf{(b)}}}
\end{picture} \vspace{-0.17cm}
\caption{Nondimensional mean streamwise velocity profile in a semi-logarithmic
scale: (a) results from lower resolutions; (b) results from higher resolutions and the right corner plot is a zoomed view of the far-wall region ($z/z_0 \apprge 1000$). The dashed line corresponds to the classical log-law with $\kappa=0.4$.}
\label{fig:uz_all}
\end{figure} 


Thursday, April 30, 2009

endian test using C

Code can be used to test a machine, and also includes big-endian/little-endian converters (for float and double), which can be modified and included into C++.

Just copy the code into a file, for example “endiantest.c,” then compile it using “gcc endiantest.c,” and execute “a.out.”

Good luck!

Hao


#include <stdio.h>

float floatSWAP(float f)
{
union
{
float f;
unsigned char b[4];
} dat1, dat2;

dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];
dat2.b[2] = dat1.b[1];
dat2.b[3] = dat1.b[0];
return dat2.f;
}

double doubleSWAP(double df)
{
union
{
double df;
unsigned char b[8];
} dat1, dat2;

dat1.df = df;
dat2.b[0] = dat1.b[7];
dat2.b[1] = dat1.b[6];
dat2.b[2] = dat1.b[5];
dat2.b[3] = dat1.b[4];
dat2.b[4] = dat1.b[3];
dat2.b[5] = dat1.b[2];
dat2.b[6] = dat1.b[1];
dat2.b[7] = dat1.b[0];
return dat2.df;
}

int IsBigEndian()
{
short int word = 0x0001;
char *byte = (char *) &word;
return (byte[0] ? 0:1);
}

float BEfloat(float f)
{
if (IsBigEndian())
return f;
else
return floatSWAP(f);
}

float LEfloat(float f)
{
if (IsBigEndian())
return floatSWAP(f);
else
return f;
}

double BEdouble(double df)
{
if (IsBigEndian())
return df;
else
return doubleSWAP(df);
}

double LEdouble(double df)
{
if (IsBigEndian())
return doubleSWAP(df);
else
return df;
}

int main(void)
{
float f, sf;
double df, sdf;
unsigned char * ch;

f = 32.45;
sf = floatSWAP(f);
printf("%f:%f\n%f\n",f,sf,BEfloat(f));
ch = (unsigned char *) &f;
printf("%1x%1x%1x%1x:",*ch,*(ch+1),*(ch+2),*(ch+3));
ch = (unsigned char *) &sf;
printf("%1x%1x%1x%1x\n\n",*ch,*(ch+1),*(ch+2),*(ch+3));

df = 10.23456789;
sdf = doubleSWAP(df);
printf("%13.10g:%13.10g\n%13.10g\n",df,sdf,BEdouble(df));
ch = (unsigned char *) &df;
printf("%1x%1x%1x%1x%1x%1x%1x%1x:",*ch,*(ch+1),*(ch+2),*(ch+3),*(ch+4),*(ch+5),*(ch+6),*(ch+7));
ch = (unsigned char *) &sdf;
printf("%1x%1x%1x%1x%1x%1x%1x%1x\n\n",*ch,*(ch+1),*(ch+2),*(ch+3),*(ch+4),*(ch+5),*(ch+6),*(ch+7));

if (IsBigEndian())
printf("This is Big-Endian machine.\n");
else
printf("This is Little-Endian machine.\n");
}

latex multi-plots using minipage



\begin{figure}[h!]
\begin{minipage}{0.5\textwidth}
\begin{tabular}{c}
\includegraphics[width=\textwidth]{SPU64.eps} \\
(a)
\end{tabular}
\end{minipage}
%\hfill
\begin{minipage}{0.5\textwidth}
\begin{tabular}{c}
\includegraphics[width=\textwidth]{SPW64.eps} \\
(b)
\end{tabular}
\end{minipage}
\caption{Normalized streamwise velocity spectra (a) and vertical velocity spectra (b) at different heights obtained from $64^3$ LES. Numbers in plots denote normalized heights ($z/H$).}
\label{fig:SP64}
\end{figure}

Wednesday, April 08, 2009

some names of online information system

  1. Blog
  2. Wiki
  3. Internet Forum or Message Board
  4. CMS (Content management system)
  5. Moodle
  6. Ning

Friday, January 04, 2008

segmentation fault

"segmentation fault" can happen when datasize/stacksize limitation is too small. following steps may solve this problem,

>limit
cputime unlimited
filesize unlimited
datasize 6144 kbytes
stacksize 8192 kbytes
coredumpsize 0 kbytes
memoryuse unlimited
descriptors 256
memorylocked unlimited
maxproc 266

>unlimit datasize
>unlimit stacksize

Monday, June 11, 2007

A free source code editor under Windows


PSPad is a freeware programmer's editor for Microsoft Windows operating systems.

It has many features
  • work with projects
  • work with several documents at the same time (MDI)
  • save desktop sessions to later reopen all session files
  • FTP client - edit files directly from the web (using Tunnelier or Putty, it can access SFTP
  • macro recorder to record, save and load macros
  • search and replace in files
  • text difference with color-coded differences highlighted
  • templates (HTML tags, scripts, code templates...)
  • installation contains templates for HTML, PHP, Pascal, JScript, VBScript, MySQL, MS-Dos, Perl,...
  • syntax highlighting according to file type
  • user-defined highlighters for exotic environments
  • auto correction
  • intelligent internal HTML preview using IE and Mozilla
  • full HEX editor
  • call different external programs for different environments
  • external compiler with output catcher, log window and log parser for an "IDE" effect in every environment
  • color syntax highlight printing and print preview
  • integrated TiDy library for formatting and checking HTML code, conversion to CSS, XML, XHTML
  • integrated free version of the top CSS editor TopStyle Lite
  • export with highlight to RTF, HTML, TeX format to file or clipboard
  • column block select, bookmarks, line numbers, ...
  • reformat and compress HTML code, tag character case change
  • line sorting with ability to sort on defined columns and drop duplicates
  • ASCII chart with HTML entities
  • Code explorer for Pascal, C/C++, INI, HTML, XML, PHP and more in development
  • spell checker
  • internal web browser with APACHE support
  • matching bracket highlighting
  • function list
  • ...(many more features, too numerous to list)

Friday, June 08, 2007

LED, A free LaTeX Editor under Windows

LaTeX Editor, called later LEd, is a free environment for rapid TeX and LaTeX document development.

LaTeX Editor is designed to work on Windows® 95/98/Me/NT4/2000/XP/2003 operating systems. LEd's capabilities vary according to the operating system used, e.g., Visual Styles from Windows® XP. It, however, works with almost all functionality also on Windows® 95.

Lots of features are included.

Saturday, January 27, 2007

A free X Server for Windows

Xming is the Free unlimited X Window server for Microsoft Windows (XP/2003/Vista). It works great with Putty (a free SSH client).

Want to replace commercial ones, such as Exceed (Hummingbird Ltd.), XWin32 (StarNet Communications). Try Xming!

Recommend NOTEPAD++

Notepad++ is a free source code editor (and Notepad replacement), which supports several programming languages, running under the MS Windows environment.

I like some features very much, such as:

(1) Syntax Highlighting and Syntax Folding
Supported languages : C, C++, Java , C#, XML, HTML, PHP, Javascript, RC resource file, makefile, ASCII art file, Fortran, doxygen, ini file, batch file, ASP, VB/VBS source files, SQL, Objective-C, CSS, Pascal, Perl, Python, Lua, TeX, TCL, Assembler, Ruby, Lisp, Scheme, Properties, Diff, Smalltalk, Postscript, VHDL, Ada, Caml, AutoIt, KiXtart, Matlab and Verilog.

(2) Function Listing

Recommend versions>=4.0. It can be executed under Unix/Linux using Wine (the latest release).