content
stringlengths 228
999k
| pred_label
stringclasses 1
value | pred_score
float64 0.5
1
|
---|---|---|
How to stop an in-process upload in Plupload?
Member
by marina , in category: Other , 10 months ago
How to stop an in-process upload in Plupload?
Facebook Twitter LinkedIn Telegram Whatsapp
1 answer
by jeanie_reilly , 9 months ago
@marina
Plupload provides a method called stop() to stop an in-process upload. Here's how you can use it:
1. Get the Plupload instance that you want to stop the upload for. You can do this by using the plupload() function or by storing the instance in a variable when initializing Plupload.For example, if you used the plupload() function to initialize Plupload, you can get the instance like this:var uploader = plupload('#uploader');
2. Call the stop() method on the instance to stop the upload. This will abort the current file being uploaded.uploader.stop();
That's it! Now you know how to stop an in-process upload in Plupload using the stop() method. | __label__pos | 0.986178 |
Embedding QlikView sheets in reports
QlikView sheets can be added to certain Qlik NPrinting reports.
QlikView sheets can be exported directly from QlikView as images. Supported formats are .bmp, .gif, .jpeg, and .png. QlikView automatically sets the image dimensions to include the entire sheet. QlikView sheets can be added as images to a Microsoft Office, HTML, or PixelPerfect report template.
Adding a QlikView sheet to an HTML report
Do the following:
1. Select Reports in the Qlik NPrinting main menu, and then click Create report.
2. Enter a Title for the report..
3. Select HTML from the Type drop-down list.
4. Select an app from the App drop-down list.
5. Leave the Enabled flag checked.
6. Click Create to create the report.
7. Click Edit template to open the Template Editor.
8. Right-click the Images node, and then select Add objects.
9. Select the Connection to the QlikView document that contains the object you want.
10. Select a QlikView sheet from the list.
11. Click OK.
12. Drag the QlikView sheet onto the template and drop it between the body tags.
13. To check the result, click Preview.
The QlikView sheet will be exported as a single image.
14. Note: Note that the aspect ratio and content of the preview image depends on the aspect ratio and visible content of the sheet in QlikView. It does not depend on the visible dimensions of the QlikView window.
15. To store the template in the repository, click Save and Close.
Did this information help you?
Thanks for letting us know. Is there anything you'd like to tell us about this topic?
Can you tell us why it did not help you and how we can improve it? | __label__pos | 0.817029 |
Support » Plugin: User Submitted Posts » Changing “Post Content”
• Resolved Yunis777
(@yunis777)
Hi,
How can i change the descriptive text to tell the user what they must enter?
In other words, I would like to change the text “Post Content” and the placeholder “Post Content” to something more suitable. In fact, they could even be removed.
See screenshot: https://postimg.cc/K19D2V4v
How can I do this? I don’t have experience with CSS.
Kind regards,
Yunis
• This topic was modified 8 months, 2 weeks ago by Yunis777.
Viewing 15 replies - 1 through 15 (of 16 total)
• Plugin Author Jeff Starr
(@specialk)
Glad to help. It is possible to do this using the custom form. That way you can tweak the details like labels, placeholders, and more. Check the plugin docs for complete steps for the custom form.
Hi,
Where is the “plugin docs” to complete steps for the ‘custom form’?
Regards,
Yunis
Plugin Author Jeff Starr
(@specialk)
Under the Installation tab, scroll down to “Custom Submission Form” to find it.
Hi,
I’ve copied the files usp.css and submission-form.php into my theme and changed plugin’s setting to “Custom Form + CSS. How do I customize the form now?
Regards,
Yunis
Plugin Author Jeff Starr
(@specialk)
Open it and edit as you like.
Plugin Author Jeff Starr
(@specialk)
Note: do not change any of the input names, ids or classes. Just about everything else you can change though.
Hi,
Open it. What file are you referring to with “it”?
Regards,
Yunis
Plugin Author Jeff Starr
(@specialk)
You make a good point, I need to add an example that shows how to actually make changes to the form. So here goes.
First understand the purpose of each file:
• usp.css — this is a CSS file, used to change appearance, like colors, font sizes, margins, et al.
• submission-form.php — this is a PHP file, it uses scripted language to output dynamic content. You’ll notice code wrapped in <?php tags, stuff like variables and simple logic. This file also uses HTML to provide form structure, for example you will notice tags such as <label>, <input>, and <p>
Now for what you were asking about, changing labels and placeholders, follow these steps:
1. Open the PHP file in a code editor or plain-text editor (do not use any rich-text processor like Microsoft Word. Plain text or code editor only.
2. Inside of the file, take a look around and get a basic idea of scope, structure, and contents.
3. Now find the <label> tag or placeholder attribute that you want to change. And change it.
4. Save the file and upload to your server.
5. Visit the form in a browser and test thoroughly.
Note: unless you are comfortable with editing code you may want to hire a pro. But of course one of the great things about WP is that it is within reach for just about anyone. I hope this helps, will also add this to the Installation docs in the next plugin update. Cheers.
Hi,
I donwloaded the file “submission-form.php” and nowhere could I find the tags “<label>” and “<input>”.
https://pastebin.com/E0AQQpnD
Just keep in mind that all I want to do is remove the “Post Content” strings near the input box provided by your free plugin.
Regards,
Yunis
• This reply was modified 8 months, 2 weeks ago by Yunis777.
• This reply was modified 8 months, 2 weeks ago by Yunis777.
Plugin Author Jeff Starr
(@specialk)
Try searching the file for “Post Content” should be able to do that.
Hi,
If i want to remove “Post Content” strings rather than change them, how do I do that?
Regards,
Yunis
Plugin Author Jeff Starr
(@specialk)
It depends are you using the Visual/RTE editor or regular plain textarea?
How can i remove the field label “Post Content” and the placeholder “Post Content” using a text wditor such as
Windows Notepad?
Plugin Author Jeff Starr
(@specialk)
It depends……….. are you using the Visual/RTE editor or regular plain textarea?
I think I’m using regular plain textarea.
Viewing 15 replies - 1 through 15 (of 16 total)
• The topic ‘Changing “Post Content”’ is closed to new replies. | __label__pos | 0.800249 |
Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Print an XPS OM
Print an XPS OM
Describes how to send an XPS OM to a printer as an XPS document.
For instructions on how to print an XPS OM that contains a complete XPS document, see Print a complete XPS OM. To contain an XPS document, an XPS OM must include the items listed in Create a Blank XPS OM.
For instructions on how to print an XPS OM that is being created or processed one page at a time, see Incrementally print an XPS OM.
Before using these code examples in your program, read the disclaimer in Common XPS Document Programming Tasks.
In this topic, you will learn how to perform the following tasks:
Print a complete XPS OM
When an XPS OM contains a complete XPS document, the WriteToStream method of the IXpsOMPackage interface can send the contents of the XPS OM to a printer or a print queue.
To detect when the print job has completed, create an event handle as shown in the following example.
HANDLE completionEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (NULL == completionEvent)
{
hr = HRESULT_FROM_WIN32(GetLastError());
// The method can continue, but print spooling completion
// cannot be checked without a valid event handle.
}
To print a complete XPS OM:
1. Create a new print job stream by calling StartXpsPrintJob.
2. Send the contents of the XPS OM to the stream by calling the package's WriteToStream method.
3. Close the print job stream by calling the stream's Close method.
4. Wait for the print job to signal that it has completed.
5. Check the completion status.
6. Close and release resources.
IXpsPrintJob *job = NULL;
IXpsPrintJobStream *jobStream = NULL;
hr = StartXpsPrintJob(
printerName,
NULL,
NULL,
NULL,
completionEvent,
NULL,
0,
&job,
&jobStream,
NULL);
// Write package to print job stream
hr = package->WriteToStream (jobStream, FALSE);
// Close the stream to tell the print job
// that the entire document has been sent.
hr = jobStream->Close();
// Wait for the print job to finish spooling...
if (NULL != completionEvent) {
if (WaitForSingleObject(completionEvent, INFINITE) == WAIT_OBJECT_0)
{
// Get the print job status to see why the wait completed.
// Note that without waiting for a completion event,
// the print job may not be complete when the status is queried.
XPS_JOB_STATUS jobStatus;
hr = job->GetJobStatus(&jobStatus);
// Evaluate the job status returned.
switch (jobStatus.completion)
{
case XPS_JOB_COMPLETED:
// The job completed as expected.
hr = S_OK;
break;
case XPS_JOB_CANCELLED:
// The job was canceled.
hr = E_FAIL;
break;
case XPS_JOB_FAILED:
// The job failed,
// jobStatus.jobStatus has the reason.
hr = E_FAIL;
break;
default:
// An unexpected value was returned.
hr = E_UNEXPECTED;
break;
}
// Release completion event handle
CloseHandle(completionEvent);
}
else
{ // there was a problem, set hr to error status
hr = HRESULT_FROM_WIN32(GetLastError());
}
}
// hr contains the result of the print operation
CoUninitialize(); // if COM is no longer needed in this thread
Incrementally print an XPS OM
You can send the document components of an XPS OM to a printer job incrementally, by creating an XPS print job stream and then passing the individual document components to the print job stream, one at a time. The sequence in which the document components are sent determines how they will appear in the finished document. Thus, before a program can call the code in this example, it must correctly organize the document components.
Before using XPS OM interfaces, initialize COM in the thread as shown in the following example code.
HRESULT hr;
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
To monitor the print job completion, create an event handle as shown in the following example code.
HANDLE completionEvent = NULL;
completionEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (NULL == completionEvent)
{
hr = HRESULT_FROM_WIN32(GetLastError());
// The method can continue, but print spooling completion
// cannot be checked without a valid event handle.
}
Create a new print job stream and a new package writer. Pass each of the document components to the corresponding package writer methods in the same sequence as they will appear in the finished document.
Start each document new, then add pages to it. After passing all document components to the print job stream, close the stream, wait for the print job to complete, and then close and release open resources.
1. Create a new print job stream by calling StartXpsPrintJob.
2. Create a part URI for the FixedDocumentSequence part.
3. Create a new package writer on the print job stream.
4. For each document to be written:
1. Create a new part URI for the FixedDocument part.
2. Start a new document in the package writer.
3. For each page in the current document, create a part URI for the FixedPage part and add the page to the package writer.
5. After all pages have been added to the package writer, close it.
6. Close the print job stream.
7. Wait for the print job to complete.
8. Check the completion status.
9. Close and release open resources.
IXpsPrintJob* job = NULL;
IXpsPrintJobStream* jobStream = NULL;
hr = StartXpsPrintJob(
argv[1],
NULL,
NULL,
NULL,
completionEvent,
NULL,
0,
&job,
&jobStream,
NULL);
// Note the implicit requirement that CoInitializeEx
// has previously been called from this thread.
IXpsOMObjectFactory *xpsFactory = NULL;
hr = CoCreateInstance(
__uuidof(XpsOMObjectFactory),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IXpsOMObjectFactory),
reinterpret_cast<void**>(&xpsFactory)
);
// Create part URI for FixedDocumentSequence part
// This can use a static string because there is only one
// FixedDocumentSequence part in the print job.
IOpcPartUri *partUri = NULL;
hr = xpsFactory->CreatePartUri(L"/FixedDocumentSequence.fdseq", &partUri);
// Create the package writer on the print job stream
// Note that the interleaving parameter set to
// XPS_INTERLEAVING_ON, the package writer will create
// empty print ticket parts when a NULL pointer is
// passed in the print ticket argument of this method,
// the StartNewDocument method, and the AddPage method.
// For more information, see the help for these methods.
IXpsOMPackageWriter *packageWriter = NULL;
hr = xpsFactory->CreatePackageWriterOnStream(
jobStream,
TRUE,
XPS_INTERLEAVING_ON, // to create blank print ticket objects
partUri,
NULL,
NULL,
NULL,
NULL,
&packageWriter);
// release partUri after it's been used to create new doc. seq.
if (partUri)
{
partUri->Release();
partUri = NULL;
}
// Add document content to the print job stream.
int docNumber = 1;
int docsInPackage = 1; // Change this value as required.
while (docNumber <= docsInPackage) {
// Create a unique part URI for the current document.
WCHAR DocPartUri[MAX_PATH];
hr = MakeDocumentPartUri (docNumber, MAX_PATH, DocPartUri);
hr = xpsFactory->CreatePartUri(DocPartUri, &partUri);
// Initialize the new document in the package writer.
hr = packageWriter->StartNewDocument(partUri, NULL, NULL, NULL, NULL);
// release part URI after it's been used to create new doc.
if (partUri)
{
partUri->Release();
partUri = NULL;
}
// Add the pages
int pageNumber = 1;
int pagesInDocument = 1; // Change this value as required.
while (pageNumber <= pagesInDocument) {
// Create a unique part URI for the current page
WCHAR PagePartUri[MAX_PATH];
hr = MakePagePartUri (
docNumber,
pageNumber,
MAX_PATH,
PagePartUri);
hr = xpsFactory->CreatePartUri(PagePartUri, &partUri);
// create page in OM
XPS_SIZE pageSize = {816, 1056};
IXpsOMPage *xpsPage = NULL;
hr = xpsFactory->CreatePage(
&pageSize,
L"en-US",
partUri,
&xpsPage);
// release pagePartUri after it's been used to create the page
if (partUri)
{
partUri->Release();
partUri = NULL;
}
// add content to the page or retrieve
// the page from the XPS OM.
// (not shown in this example)
// add page to document
hr = packageWriter->AddPage(
xpsPage,
&pageSize,
NULL,
NULL,
NULL,
NULL);
if (xpsPage)
{
xpsPage->Release();
xpsPage = NULL;
}
// go to the next page
pageNumber++;
}
// the fixed document does not need to be closed.
// it will be closed when a new fixed doc is opened
// or the package is closed.
// go to the next document
docNumber++;
}
// Close the package writer when finished
hr = packageWriter->Close();
if (SUCCEEDED(hr))
{
// Close the print stream to tell the print
// job that the all document contents have
// been sent
hr = jobStream->Close();
// Wait for the print job to finish spooling...
if (NULL != completionEvent) {
if (WaitForSingleObject(completionEvent, INFINITE) == WAIT_OBJECT_0)
{
// Get the print job status to see why the wait completed.
// Note that without waiting for a completion event,
// the print job may not be complete when the status is queried.
XPS_JOB_STATUS jobStatus;
hr = job->GetJobStatus(&jobStatus);
// Evaluate the job status returned.
switch (jobStatus.completion)
{
case XPS_JOB_COMPLETED:
// The job completed as expected.
hr = S_OK;
break;
case XPS_JOB_CANCELLED:
// The job was canceled.
hr = E_FAIL;
break;
case XPS_JOB_FAILED:
// The job failed,
// jobStatus.jobStatus has the reason.
hr = E_FAIL;
break;
default:
// An unexpected value was returned.
hr = E_UNEXPECTED;
break;
}
// Release completion event handle
CloseHandle(completionEvent);
}
else
{ // there was a problem, set hr to error status
hr = HRESULT_FROM_WIN32(GetLastError());
}
}
}
else
{
// cancel the job, if one exists, because
// the close call returned an error
if (job) job->Cancel();
}
// hr contains the result of the print operation
// free/release pointers and handles used.
if (packageWriter)
{
packageWriter->Release();
packageWriter = NULL;
}
if (partUri)
{
partUri->Release();
partUri = NULL;
}
if (xpsFactory)
{
xpsFactory->Release();
xpsFactory = NULL;
}
if (jobStream)
{
jobStream->Release();
jobStream = NULL;
}
if (job)
{
job->Release();
job = NULL;
}
if (completionEvent)
{
CloseHandle(completionEvent);
completionEvent = NULL;
}
CoUninitialize(); // If done with COM in this thread.
When the program is writing the document components incrementally, as shown in this example, it must generate the part names for each document part that it sends to the print job stream. In the preceding example, the FixedDocumentSequence part URI is created from a static string because there is one and only one such part in the XPS document. The URI of each FixedPage and FixedDocument part must be unique within the XPS document. Building the part URI by using the index of these components can help ensure that the resulting URI string is unique within the XPS document.
HRESULT MakeDocumentPartUri (
__in int docNumber,
__in DWORD partUriStringLength,
__inout LPWSTR partUriStringBuffer
)
{
// create a Part URI string using the document number
// that was passed as an argument
// for example, "/Documents/1/FixedDocument.fdoc"
// where "1" specifies the document number, which would
// change with each document printed
return S_OK;
}
HRESULT MakePagePartUri (
__in int docNumber,
__in int pageNumber,
__in DWORD partUriStringLength,
__inout LPWSTR partUriStringBuffer
)
{
// create a Part URI string using the document number
// and page number that were passed as an argument
// for example: "/Documents/1/Pages/1.fpage"
// where the first "1" between Documents and Pages
// specifies the document number, which would change with
// each document. The second "1" specifies the page number,
// which would change with each page in the document.
return S_OK;
}
For more information on the structure of an XPS document, see the XML Paper Specification.
Related topics
Next Steps
Write an XPS OM to an XPS Document
Used in This Section
CoInitializeEx
CreateEvent
IOpcPartUri
IXpsOMPackage
IXpsOMPackageWriter
IXpsPrintJob
IXpsPrintJobStream
StartXpsPrintJob
WaitForSingleObject
For More Information
Initialize an XPS OM
XPS Document API Reference
XML Paper Specification
Community Additions
ADD
Show:
© 2015 Microsoft | __label__pos | 0.95197 |
DIAdem
cancel
Showing results for
Search instead for
Did you mean:
Reply
Cannot execute the "ScriptCMDReset" command
Hi,
I'm calling ScriptCmdReset() at the beginning of my script and this seems to have worked successfully for some time. Then, today, for a reason I cannot determine, I get the following error message:
"You cannot execute the "ScriptCMDReset" command at the moment.
Other user commands are activated."
Needless to say, I can't think of a way to diagnose this further and determine what is causing the message. Can anyone help?
Thanks,
Simon.
0 Kudos
Message 1 of 4
(239 Views)
Hey Simon.
I don't know why it suddenly stopped working, (maybe a software update) however after reading the Help File for the command i can see that i'ts only supposed to be called at the end of a script.
it's probably not the answer you wanted but hopefully it can help to guide you.
Cheers
0 Kudos
Message 2 of 4
(209 Views)
That's interesting. In the help file page for the DIAdem version I'm working with, and on versions prior to the 2015 page you quote, the command can be used at the beginning and the end. See here for example.
If I am to avoid using it at the beginning, how do I empty/delete/remove/bin/whatever all the user variables?
Thanks,
Simon.
0 Kudos
Message 3 of 4
(200 Views)
i find weird that they changed the description from 2014 to 2015.
In regards to how to delete all variables, I'm uncertain as I usually don't use the scripting functionality.
Sorry i could be of more assistance.
0 Kudos
Message 4 of 4
(195 Views) | __label__pos | 0.68648 |
Provided by: perl_5.26.2-7_amd64 bug
NAME
pod2text - Convert POD data to formatted ASCII text
SYNOPSIS
pod2text [-aclostu] [--code] [--errors=style] [-i indent]
[-q quotes] [--nourls] [--stderr] [-w width]
[input [output ...]]
pod2text -h
DESCRIPTION
pod2text is a front-end for Pod::Text and its subclasses. It uses them to generate
formatted ASCII text from POD source. It can optionally use either termcap sequences or
ANSI color escape sequences to format the text.
input is the file to read for POD source (the POD can be embedded in code). If input
isn't given, it defaults to "STDIN". output, if given, is the file to which to write the
formatted output. If output isn't given, the formatted output is written to "STDOUT".
Several POD files can be processed in the same pod2text invocation (saving module load and
compile times) by providing multiple pairs of input and output files on the command line.
OPTIONS
-a, --alt
Use an alternate output format that, among other things, uses a different heading
style and marks "=item" entries with a colon in the left margin.
--code
Include any non-POD text from the input file in the output as well. Useful for
viewing code documented with POD blocks with the POD rendered and the code left
intact.
-c, --color
Format the output with ANSI color escape sequences. Using this option requires that
Term::ANSIColor be installed on your system.
--errors=style
Set the error handling style. "die" says to throw an exception on any POD formatting
error. "stderr" says to report errors on standard error, but not to throw an
exception. "pod" says to include a POD ERRORS section in the resulting documentation
summarizing the errors. "none" ignores POD errors entirely, as much as possible.
The default is "die".
-i indent, --indent=indent
Set the number of spaces to indent regular text, and the default indentation for
"=over" blocks. Defaults to 4 spaces if this option isn't given.
-h, --help
Print out usage information and exit.
-l, --loose
Print a blank line after a "=head1" heading. Normally, no blank line is printed after
"=head1", although one is still printed after "=head2", because this is the expected
formatting for manual pages; if you're formatting arbitrary text documents, using this
option is recommended.
-m width, --left-margin=width, --margin=width
The width of the left margin in spaces. Defaults to 0. This is the margin for all
text, including headings, not the amount by which regular text is indented; for the
latter, see -i option.
--nourls
Normally, L<> formatting codes with a URL but anchor text are formatted to show both
the anchor text and the URL. In other words:
L<foo|http://example.com/>
is formatted as:
foo <http://example.com/>
This flag, if given, suppresses the URL when anchor text is given, so this example
would be formatted as just "foo". This can produce less cluttered output in cases
where the URLs are not particularly important.
-o, --overstrike
Format the output with overstrike printing. Bold text is rendered as character,
backspace, character. Italics and file names are rendered as underscore, backspace,
character. Many pagers, such as less, know how to convert this to bold or underlined
text.
-q quotes, --quotes=quotes
Sets the quote marks used to surround C<> text to quotes. If quotes is a single
character, it is used as both the left and right quote. Otherwise, it is split in
half, and the first half of the string is used as the left quote and the second is
used as the right quote.
quotes may also be set to the special value "none", in which case no quote marks are
added around C<> text.
-s, --sentence
Assume each sentence ends with two spaces and try to preserve that spacing. Without
this option, all consecutive whitespace in non-verbatim paragraphs is compressed into
a single space.
--stderr
By default, pod2text dies if any errors are detected in the POD input. If --stderr is
given and no --errors flag is present, errors are sent to standard error, but pod2text
does not abort. This is equivalent to "--errors=stderr" and is supported for backward
compatibility.
-t, --termcap
Try to determine the width of the screen and the bold and underline sequences for the
terminal from termcap, and use that information in formatting the output. Output will
be wrapped at two columns less than the width of your terminal device. Using this
option requires that your system have a termcap file somewhere where Term::Cap can
find it and requires that your system support termios. With this option, the output
of pod2text will contain terminal control sequences for your current terminal type.
-u, --utf8
By default, pod2text tries to use the same output encoding as its input encoding (to
be backward-compatible with older versions). This option says to instead force the
output encoding to UTF-8.
Be aware that, when using this option, the input encoding of your POD source should be
properly declared unless it's US-ASCII. Pod::Simple will attempt to guess the
encoding and may be successful if it's Latin-1 or UTF-8, but it will warn, which by
default results in a pod2text failure. Use the "=encoding" command to declare the
encoding. See perlpod(1) for more information.
-w, --width=width, -width
The column at which to wrap text on the right-hand side. Defaults to 76, unless -t is
given, in which case it's two columns less than the width of your terminal device.
EXIT STATUS
As long as all documents processed result in some output, even if that output includes
errata (a "POD ERRORS" section generated with "--errors=pod"), pod2text will exit with
status 0. If any of the documents being processed do not result in an output document,
pod2text will exit with status 1. If there are syntax errors in a POD document being
processed and the error handling style is set to the default of "die", pod2text will abort
immediately with exit status 255.
DIAGNOSTICS
If pod2text fails with errors, see Pod::Text and Pod::Simple for information about what
those errors might mean. Internally, it can also produce the following diagnostics:
-c (--color) requires Term::ANSIColor be installed
(F) -c or --color were given, but Term::ANSIColor could not be loaded.
Unknown option: %s
(F) An unknown command line option was given.
In addition, other Getopt::Long error messages may result from invalid command-line
options.
ENVIRONMENT
COLUMNS
If -t is given, pod2text will take the current width of your screen from this
environment variable, if available. It overrides terminal width information in
TERMCAP.
TERMCAP
If -t is given, pod2text will use the contents of this environment variable if
available to determine the correct formatting sequences for your current terminal
device.
SEE ALSO
Pod::Text, Pod::Text::Color, Pod::Text::Overstrike, Pod::Text::Termcap, Pod::Simple,
perlpod(1)
The current version of this script is always available from its web site at
<http://www.eyrie.org/~eagle/software/podlators/>. It is also part of the Perl core
distribution as of 5.6.0.
AUTHOR
Russ Allbery <[email protected]>.
COPYRIGHT AND LICENSE
Copyright 1999, 2000, 2001, 2004, 2006, 2008, 2010, 2012, 2013, 2014, 2015, 2016 Russ
Allbery <[email protected]>
This program is free software; you may redistribute it and/or modify it under the same
terms as Perl itself. | __label__pos | 0.717908 |
A question about projection operator
Open discussion regarding features, bugs, issues, vendors, etc.
A question about projection operator
Postby leobart » Fri Oct 07, 2016 8:16 am
I have a general matrix which has a certain number of real and a certain number of
complex eigenvalues.
I want to project the inverse of this matrix to the subspace spanned by eigenvectors
corresponding to real eigenvalues.
Is there some easy way to do this within lapack? For example for the inversion of the
matrix I use dgetrf and dgetri routines and for the diagonalization I use dgeev. Is there
some info stored in these subroutines that can help me do this?
leobart
Posts: 1
Joined: Fri Oct 07, 2016 8:09 am
Re: A question about projection operator
Postby Julien Langou » Mon Dec 12, 2016 10:23 am
I want to project the inverse of this matrix to the subspace spanned by eigenvectors corresponding to real eigenvalues.
Then the resulting operator would simply be a diagonal operator with the inverse eigenvalues on the diagonal.
I assume this is not the answer you are looking for, so what exactly are your trying to do?
Your question makes me think is that you might want to reorder the Schur form so that you have the real eigenvalues first in the Schur form.
So something like: DGEES (to get Schur form), the DTRSEN (to reorder the Schur form), at this point you should get Q, an orthonormal basis for the subspace spanned by the eigenvectors spanned by the real eigenvalues of your matrix.
(Note that Q is not a matrix of eigenvectors. (Since eigenvectors are likely not orthogonal.) Q is an orthonormal basis for the subspace spanned by the eigenvectors spanned by the real eigenvalue. Which is what you would need to `project on the subspace spanned by eigenvectors corresponding to real eigenvalues.`)
Julien.
Julien Langou
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA
Re: A question about projection operator
Postby ilya-fursov » Mon Dec 12, 2016 12:50 pm
leobart,
What do you mean by "projection"? Change of basis for the matrix, as Julien suggested, or employing a projection operator on top of your matrix of interest?
If this is the latter, denoting by M the inverse of your matrix, and by V the desired subspace you want to project onto, then it may be that you want something like:
1) P*M (output from M is projected via P onto V), or
2) P*M*P (input is projected onto the subspace V, then M acts, then its output is projected again),
where P is projection operator (matrix) onto V.
Strictly speaking, the input to your new operator should have already been from the subspace V, so in case (2) the first projection is not needed, and (2) becomes (1). But the input from subspace V should be expressed in its own basis, not in the default R^n basis, this leads to the selection of such a basis, and new basis transform matrices - finally it all depends on your intentions.
So, I'll only give an idea what to do for the case (1), i.e. projecting the output of whatever matrix M onto subspace V, where V is spanned by whatever linearly independent vectors v_i (in your case these are some subset of eigenvectors).
Denote V = matrix of column-vectors v_i.
Here, again, there are many options of how to do the projection:
- use orthogonal projection,
- or use a general projection parallel to some subspace U, where the direct sum of U and V makes the entire space R^n.
For simplicity I only consider the orthogonal projection.
Consider an arbitrary vector a from R^n. To find P*a, first express a = sum_i {alpha_i * v_i} + v*, where alpha_i are some coefficients, and v* is a vector orthogonal to V. Multiplying this equation by v_j and doing some algebra, we finally get:
P*a = V * (V^H * V)^(-1) * V^H * a,
where V^H is the conjugate transpose of matrix V.
Next, calculate P*M = V * (V^H * V)^(-1) * V^H * M. One can either calculate each item in this expression explicitly.
Or, noting that (V^H * V)^(-1) * V^H * M is the solution of normal equations, first find X = (V^H * V)^(-1) * V^H * M by solving the least-squares problem V*X = M (this equality may be approximate!), and then calculate V*X which is equal to P*M.
There are a bunch of least square solvers in LAPACK, e.g. *GELS, *GELSD, *GELSS.
ilya-fursov
Posts: 6
Joined: Thu Nov 10, 2016 9:00 am
Return to User Discussion
Who is online
Users browsing this forum: No registered users and 5 guests | __label__pos | 0.91386 |
Cisco 642-885 Dumps To Pass Exam
Cisco Certification Real Exam
Updated content of DumpsSchool Cisco 642-885 dumps make sure you pass the exam in the first attempt. You get information to configure and optimize service provider IP next-generation network infrastructures topics from 642-885 dumps which guides your way to get the CCNP Service Provider Certification.
Try it Latest DumpsSchool 642-885 Exam dumps. Buy Full File here: https://www.dumpsschool.com/642-885-exam-dumps.html (131 As Dumps)
Download the DumpsSchool 642-885 braindumps from Google Drive: https://drive.google.com/file/d/1ZB_LuK9qVw6h86HTLjKSKBCTQyUtRvo-/view (FREE VERSION!!!)
Question No. 1
Refer to the exhibit. R2 cannot to learn RP information from XR3. Which issue is the source of the problem?
Answer: D
Question No. 2
The 224.192.16.1 multicast IP address maps to which multicast MAC address?
Answer: B
Least significant 23 bits of IP address and pre-pend 01-00-5E
224 ignore
192 less 128 becomes 64 = 40
16 = 10
1 = 01
01-00-5E-40-10-01
Question No. 3
Which of the following can be used by dual-stack service providers supporting IPv4/IPv6 customers with dual-stack hosts using public IPv6 addresses and private IPv4 addresses?
Answer: D
Carrier Grade NAT is a large-scale NAT, capable of providing private-IPv4-to-public-IPv4 translation in the order of millions of translations. Carrier Grade NAT can support several hundred thousand subscribers with the bandwidth throughput of at least 10Gb/s full-duplex. With IPv4 addresses reaching depletion, Carrier Grade NAT is vital in providing private IPv4 connectivity to the public IPv4 internet. In addition, Carrier Grade NAT is not limited to IPv4 NAT; it can also translate between IPv4 and IPv6 addresses.
Question No. 4
When implementing IP SLA icmp-echo probes on Cisco IOS-XE routers, which two options are available for IPv6? (Choose two.)
Answer: A, D
Question No. 5
Refer to the exhibit.
The following multicast IP addresses map to which multicast MAC address?
Answer: B
Question No. 6
Which difference occurs between intradomain and interdomain routing technology?
Answer: A
642-885 Dumps Google Drive: (Limited Version!!!)
https://drive.google.com/file/d/1ZB_LuK9qVw6h86HTLjKSKBCTQyUtRvo-/view
Related Certification: CCNP Service Provider dumps | __label__pos | 0.76252 |
Ejemplos de propiedad sobre conjuntos y subconjuntos en la Diferencia simétrica
Probablemente, lo más conveniente antes de abordar cada uno de los casos que pueden servir de ejemplo a la propiedad sobre conjuntos y subconjuntos en la Diferencia Simétrica, sea revisar algunas definiciones, que permitirán tener presente el contexto en el cual se cumple esta Ley matemática.
Definiciones fundamentales
Por consiguiente, puede resultar beneficioso abarcar la propia definición de Conjunto, a fin de tener presente la naturaleza del objeto sobe el cual tiene lugar la operación de Diferencia Simétrica, a la que esta propiedad resulta inherente. Por otro lado, también puede ser pertinente traer a colación la definición de las operaciones involucradas en esta ley matemática. A continuación cada uno de los conceptos:
Conjunto
En este orden de ideas, se puede comenzar entonces por aproximarse a la definición de Conjunto, el cual es entendido por las Matemáticas como un objeto, constituido en base a elementos en los que puede distinguirse un elemento en común, que permite que puedan ser agrupados como una colección abstracta. Igualmente, esta disciplina afirma que estos elementos, además de pertenecer a una misma naturaleza, cumplen con la función de definir –de forma única y exclusiva- al conjunto. Por otro lado, con respecto a su notación, las distintas fuentes teóricas señalan que el Conjunto debe recibir como nombre el equivalente a una letra mayúscula, mientras que sus elementos deberán ser presentados como una enumeración, separados por comas, y contenidos por dos signos de llaves { }.
Diferencia Simétrica
Igualmente, es importante llamar la atención sobre la definición de Diferencia Simétrica, pues es en esta operación en donde tiene lugar la Propiedad de los subconjuntos y conjuntos. En este sentido, será pertinente decir que el Álgebra de conjuntos concibe a la Diferencia Simétrica como una operación básica en la cual un conjunto A y un conjunto B conforman un tercer conjunto A∆B en donde se pueden contar cada uno de los elementos de A que no se pueden encontrar en B, así también como cada uno de los elementos de B que no aparecen en A.
Diferencia
Así también, debe hacerse referencia a la operación de Diferencia, la cual es entendida por el Álgebra de conjuntos como una operación básica, por medio de la cual un conjunto A y un conjunto B crean un tercer conjunto, que recibe el nombre de A\B y en donde se anotarán como elementos todos aquellos elementos de A que no se encuentran en B. Con respecto al signo que sirve para denotar esta operación, el Álgebra de conjuntos señala a la barra invertida o backslash \.
Propiedad sobre conjuntos y subconjuntos
Finalmente, también se pasará revista sobre la definición de la propia ley matemática sobre conjuntos y subconjuntos en la Diferencia simétrica, la cual es señalada por varias fuentes teóricas como la Ley matemática que tienen lugar cuando un conjunto A tiene como subconjunto a un conjunto B, caso en el cual entonces la operación de Diferencia simétrica entre estas colecciones alcanzará igual resultado que la operación de Diferencia entre ellos, situación que es expresada matemáticamente de la siguiente manera:
B ⊆ A → A ∆ B = A\B
Ejemplos de la Propiedad de conjuntos y subconjuntos
Revisadas estas definiciones, quizás sea mucho más sencillo comprender la terminología y cada una de las operaciones que pueden presentarse a la hora de comprobar cómo se cumple esta ley en la operación de la Diferencia simétrica. A continuación, algunos ejemplos:
Ejemplo 1
Dado un conjunto A, conformado por nombres masculinos en general: A= {Antonio, Manuel, Miguel, Raúl, Leonardo, Alfredo, Adolfo} y un conjunto B conformado por nombres masculinos que terminen en la letra “o”: B= {Antonio, Leonardo, Alfredo, Adolfo} comprobar cómo se cumple la Ley de conjuntos y subconjuntos al realizar una operación de Diferencia simétrica.
Para cumplir con lo solicitado por este postulado, el primer paso que deberá hacerse es identificar si realmente el conjunto B constituye un subconjunto de A, principal requisito para que pueda tener lugar esta Ley matemática. En este caso, se revisan cada uno de los elementos, para ver si ciertamente B está incluido en A:
A= {Antonio, Manuel, Miguel, Raúl, Leonardo, Alfredo, Adolfo}
B= {Antonio, Leonardo, Alfredo, Adolfo}
Al hacerlo, se puede ver cómo efectivamente cada elemento del conjunto B se encuentra presente en el conjunto A, es decir que A contiene a B, o lo que es igual, que B es un subconjunto de A:
B ⊆ A
Comprobado esto, se procederá entonces a realizar cada una de las operaciones involucradas en la expresión matemática de esta ley, a fin de poder comprobar si realmente, cuando B es subconjunto de A, tanto la Diferencia simétrica como la Diferencia entre estos dos conjuntos son equivalentes:
A ∆ B =
A ∆ B = {Antonio, Manuel, Miguel, Raúl, Leonardo, Alfredo, Adolfo} ∆ {Antonio, Leonardo, Alfredo, Adolfo}
A ∆ B = {Manuel, Miguel, Raúl}
A\B=
A\B= {Antonio, Manuel, Miguel, Raúl, Leonardo, Alfredo, Adolfo} \ {Antonio, Leonardo, Alfredo, Adolfo}
A\B= {Manuel, Miguel, Raúl}
Como ha podido comprobarse, debido a que B es un subconjunto de A, al realizar una operación de Diferencia Simétrica o incluso de Diferencia se obtendrá igual resultado por lo que se puede decir entonces que la Ley de conjuntos y subconjuntos ha sido comprobada:
B ⊆ A → A ∆ B = A\B
Ejemplo 2
Dado un conjunto B en donde puedan contarse como elementos, instrumentos musicales en general: B= {Pandereta, Piano, Saxofón, Trompeta, Batería, Bongó, Guitarra} y un conjunto C, constituido por instrumentos musicales de percusión: C= {Pandereta, Batería, Bongó} comprobar si se cumple o no la Propiedad sobre conjuntos y subconjuntos:
B= {Pandereta, Piano, Saxofón, Trompeta, Batería, Bongó, Guitarra}
C= {Pandereta, Batería, Bongó}
B ⊆ C → B ∆ C = B\C
B ∆ C=
B ∆ C= {Pandereta, Piano, Saxofón, Trompeta, Batería, Bongó, Guitarra} ∆ {Pandereta, Batería, Bongó}
B ∆ C= {Piano, Saxofón, Trompeta, Guitarra}
B\C=
B\C= {Pandereta, Piano, Saxofón, Trompeta, Batería, Bongó, Guitarra} \ {Pandereta, Batería, Bongó}
B\C= {Piano, Saxofón, Trompeta, Guitarra}
C ⊆ B → B ∆ C = B\C
C ⊆ B → {Piano, Saxofón, Trompeta, Guitarra} = {Piano, Saxofón, Trompeta, Guitarra}
Imagen: pixabay.com
Ejemplos de propiedad sobre conjuntos y subconjuntos en la Diferencia simétrica
Bibliografía ►
Ver más Artículo al azar | __label__pos | 0.975411 |
Pure, CSS Module dari Yahoo!
Template Landing Page untuk Blogspot
Baru-baru ini Yahoo! meluncurkan Pure CSS yaitu sebuah CSS Module yang bisa dipakai untuk project website kita, ya seperti Bootstrap lah tapi Pure CSS lebih kecil gak sekomplek Bootstrap, meskipun tidak sekomplek bootstrap tapi keren juga dipakai pada project website kita selanjutnya.
[related_posts]
Seperti CSS Framework lainnya, Pure CSS juga menyajikan beberapa elemen seperti Layout yang bisa responsive, Menu, Form, tombol, Grid Base, Tabel.
pure-css-1
Grid
Penggunaan Grid untuk Pure CSS ini sama mudahnya seperti yang lain, hanya beda di classnya saja, untuk membuat sebuah Grid Layout dengan 3 kolom maka bisa menggunakan
<div class="pure-g">
<div class="pure-u-1-3">
<!--
By default, grid units don't have any margin/padding.
If you want to add these, put them in a child container.
-->
<p>Thirds</p>
</div>
<div class="pure-u-1-3">
<p>Thirds</p>
</div>
<div class="pure-u-1-3">
<p>Thirds</p>
</div>
</div>
Kita bisa menggunakan class pure-g atau pure-g-r bedanya kalau pakai pure-g-r maka ketika browser di resize ke ukuran kecil maka class tersebut akan berpindah ke bawah, kalau pure-g biasa dia akan tetap menjadi 3 kolom.
Baca Juga: Tutorial PSD to HTML/CSS #1
Button (Tombol)
Untuk membentuk link menjadi tombol cukup tambahkan class pure-button di tag a atau button
<a class="pure-button" href="#">A Pure Button</a>
<button class="pure-button">A Pure Button</button>
Menu
Untuk membuat menu menggunakan Pure CSS ini juga gampang aja, tinggal pakai
<div class="pure-menu pure-menu-open pure-menu-horizontal">
<ul>
<li><a href="#">Home</a></li>
<li class="pure-menu-selected"><a href="#">Blog</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
Nah, untuk melihat contoh elemen lainnya di Pure CSS ini bekerja, silakan kunjungi websitenya http://purecss.io/
Bagaimana Pure CSS ini menurut kamu?
Tags
cara memakai pure css,pengertian pure css
Komentar
comments
zulsdesign
Seorang Web Designer, Web Developer, Wordpress Development dan independen Blogger. Spesialisasi Personal Branding. Selalu haus akan ilmu tentang perkembangan dunia Web Design, Social Media, Online Marketing. Kadang-kadang juga berprofesi sebagai konsultan Website dadakan :)
grain storage kocaeli escort
%d bloggers like this: | __label__pos | 0.70825 |
5 Ways to Secure Your Account: Why You Should Use a Personal Access Token Instead [Expert Tips]
What is . Please use a personal access token instead.
A Personal Access Token, or PAT for short, is a secure way to authenticate to an API without the need for a username and password. Instead of using these sensitive credentials, you create a token associated with your username that grants specific permissions so that third-party applications can operate on behalf of the authenticated user safely.
This method improves security by restricting how much information users give out about themselves while still allowing service providers access and ultimate control over their platform’s functionality. It also eliminates intermediary steps like entering log-ins each time upon authentication which makes data exchange even more seamless and efficient across platforms.
How to Generate a Personal Access Token: Step-by-Step Guide
When it comes to accessing certain programs or applications, sometimes you might need a little extra security. That’s where personal access tokens come in handy.
A personal access token (PAT) is essentially a unique code that acts as an alternative login method for specific applications or services. They can be used instead of traditional passwords and provide more secure authentication measures when interacting with APIs or other software integration tools.
In this step-by-step guide, we’ll go through the process for generating your own PAT within Github – one of the most popular platforms that use them.
Step 1: Create a Github Account
To generate your own PAT on Github, you first have to create an account if you haven’t done so already. Follow the simple instructions provided by Github to get started with creating your account which mostly involves supplying basic personal information.
Step 2: Navigate-to/Select GitHub Settings from Your Profile
Once logged into your new account, select settings located right below your profile menu options prompting drop down menus providing you several option including; profile settings/repositories/settings/billing etc., kindly select “settings”.
Step 3: Select Developer setting tab under Setting section.
At this point you should see another list grouped items containing all things related to developments such as OAuth Apps and developer teams,.
Just underneath there – click on “personal access tokens”
You will now see Personal Access Tokens sub-tab appearing just beside OAutApps.*N.B-This where it counts*
Then hit “generate” new Token button
Step 4: Configure Authorization Details
When you are prompted review authorization details set on particular app/service connected to github while validating ratings-specific scopes required like read/write/delete privileges depending what level precision service/application requires whether full or limited authorizations.- then authenticate actions using generated token displayed under” YOUR NEW ACCESS TOKEN SECTION” header
iT’S THAT SIMPLE….But wait….. not yet done!
*Never store manually entered Pat codes!! Also DO NOT check in detail stored token code within repository files/folders that are open to public. It’s not only a major security risk but it means anyone with access could potentially compromise the confidentiality of the PAT increasing chances leaks.
Best Practice is using config files instead then protecting these configuration settings containing block even from fellow technical colleagues as precisions emanates safety first than convenience
In summary, generated PATs serves customized login credentials unique to you coupled with stringent securities protocols enforced by app developers for anybody who requires more authentication fit for accessing sensitive developer data which cannot be maintained through traditional username/password combinations. Knowing how to create and maintain one will go a long way toward helping protect valuable information utilized during development processes making work safer while maintaining uncompromising professional standards necessary for success on such platforms like Github nowadays essential kit pointing towards a standardized industry sure bet solution when requiring tweaked API level integrations among other possible use cases.
The Benefits of Using a Personal Access Token for API Authentication
API authentication is an essential security feature that allows developers to control access to their application programming interfaces (APIs) based on user credentials. Every time users make API calls, they need to authenticate themselves and prove their identity before the request is granted.
Traditionally, most APIs have relied on cookie-based or session-based authentication systems where a server associates a particular client with some form of identification token. However, these methods are not entirely secure since attackers can hijack cookies or sessions and use them without proper validation, resulting in unauthorized access to sensitive data. That’s why many developers have started using Personal Access Tokens as a more secure method for API authentication.
See also Discover the Secrets of Runaway Island Token: How to Solve the Mystery [With Numbers and Stats]
A personal access token is simply an encrypted code sent by the user along with each HTTP request to gain authorization for accessing protected resources. The tokens follow standard protocols like OAuth 2.0 or JSON Web Token (JWT), ensuring maximum security while also being easy to implement.
Here are some benefits of using Personal Access Tokens for API Authentication:
1) Increased Security
As mentioned earlier, traditional session-based authentication methods can be vulnerable to attacks such as Cross-Site Scripting (XSS) or Session Hijacking which could compromise your user’s sensitive information persisted in your server-side databases.Perosnal access tokens cannot be easily stolen by malicious third parties due its encryption mechanism which includes signature verification when hitting any endpoints.Embedding HMAC encryption offers secured call transaction between servers.Hence personal acccesstoken appear less suspeiptible againt CSRF , XSS etc..
2) Granular Control Over User Access and Permissions
Access-token provide granular attribute configurations so as availing fine-tuning granularity stting permissions attributes base on functionality needed.Creating scopes help segregating the authorization levels according domain accessibility specializations further allowing role specific assignments.
3) Single Point Of Reference
Having only one endpoint means you only ever run into issues at one place.And it’s very convenient! This makes maintenance simpler and reduces the risk of incurring an incident by decreasing your infraction points.
4) Better Implementation with API Clients
Personal-access token helps to make API calls without users having any typing or writing experience so there are no chances for miss typed URLs and headers adjustments. This ensures preconfigured security measures against potential hacks.
5) Easier Revocation and Renewal of Access Tokens
Since tokens are only limited to one user it is easy track a problematic token since they can easily be revoked,renewed,issued as per required scope at the developer’s end. It also allows developers greater control of clients who lose their accesses before sending invalid request.
In conclusion, using Personal Access Tokens for API Authentication can significantly improve security while simplifying application development.Their use offers high-level security benefits over traditional cookie-based session handshakes.It assists in extended flexibility enabling granular user access controls through functional abilities.This results into better long term data trends value-add generating effective client implementations across varied varieties including PHP,Laravel etc..
Common FAQs About Using Personal Access Tokens in Development
As an experienced developer, you might have heard of personal access tokens (PATs) that grant access to resources in different software systems. PATs are widely used for authenticating user actions and performing automated tasks on behalf of a user without needing their credentials.
While there is so much hype around PATs, developers still have some misconceptions about them. Let’s explore common frequently asked questions about using Personal Access Tokens in development:
1. What Are Personal Access Tokens?
A personal access token is a unique identifier issued by various software vendors or service providers that allows end-users to authenticate programmatically against APIs with elevated privileges compared to regular users’ authentication credentials.
2. Why Do Developers Need To Use Personal Access Tokens Instead Of Password Authentication Credentials?
Using passwords directly inside the script code can pose a security risk as it is easily visible if someone gains unauthorized access to the script’s source code repository. Moreover, managing multiple credential combinations becomes difficult over time due to frequent changes required within applications requiring usage granting permissions each update requires new password sharing notifications across all repositories based on policy implementation specifics like two-factor requirements external storage protection policies.
3. How Can Developers Generate A Personal Access Token?
Developers usually generate PATs from their respective vendor portal account pages featuring various workflows completion steps depending on the product/use case utilization scenarios.
4. Is There Any Scope Limitation Using The Different Pats Across Various Service Providers And Tools?
Each vendor has created its own authorization model with many different scopes available depending upon intended use cases selected before entering further processes for data transfer management capabilities enabling features along API endpoints allowing fine-grain control over who does what where during integration worktracks being split out between teams based upon functional segments/alignment breakdown structure approaches releasing mission-critical intelligence incrementally throughout project rollouts according to milestones achieved via agile methodology-based best practices utilizing performance reported backlogged/sprints planning framework setup session timeslot selection allocation goal prioritization criteria established at outset kickoff meetings followed by built-in progress tracking methodologies automation workflows integrated into project management tools tested iteratively over sprints assigned teams follow up accordingly via reporting functionality provided within these solutions.
5. How Secure Are Personal Access Tokens?
As with password authentication mechanisms, personal access tokens can be subject to hacking and exploitation by unauthorized actors given the right conditions are met such as session hijacking interception or targets reuse where one-time use requirements have been ignored resulting in information leakage beyond intended boundaries of processing power available from adverse parties with malicious intent aimed at sensitive data abuse practices based on security endpoint vulnerability analysis assessments completed across APIs developed utilizing industry-standard guidelines under evaluation period consideration recommendations made known periodically through patch update releases depending upon severity levels identified respective handling procedures implemented following OWASP best practices’ guildelines regarding inputs validation sanitization storage/crypto mechanims used securely transmitting data between different segments using encryption based algorithm-based cryptography methods cryptographic libraries also maintained regularly.
See also Vote for Your Favorite Monopoly Token: A Story of Strategy and Statistics [Ultimate Guide]
In conclusion, personal access tokens bring an added layer of security and flexibility for developers compared to traditional password authentication credentials. By understanding how PATs work and ensuring their secure usage, developers can enjoy all the benefits that come along with it while protecting themselves against potential risks associated with this mechanism. As a developer, stay informed about your vendor’s specific terms & conditionals documentations performing regular updates testing pre-release code bases prior to implementation phases incorporating feedback loops accomplishing continuous improvements audits evaluation rounds releasing bugfixes alone/collaborative effort earlier than expected rollout dates stay safe out there!
Top 5 Facts You Need to Know About Personal Access Tokens
Personal access tokens have become a popular form of authentication within the world of technology. They offer a quick, secure and easy way for users to authenticate without having to remember complex passwords or go through lengthy login processes.
But what exactly are personal access tokens? And why should you be paying attention to them? Here are the top 5 facts you need to know about personal access tokens:
1. Personal Access Tokens Are An Alternative To Passwords
Passwords have been an essential part of online security for decades, but they do come with their own set of challenges – namely, that they can be forgotten, stolen or hacked. Personal access tokens provide an alternative method of authentication which avoids these pitfalls entirely.
2. Personal Access Tokens Are Used By Developers
Personal access tokens were primarily designed for use by developers as a means of authenticating API requests between different services or systems. They allow developers to easily generate unique keys which can be used in place of traditional user credentials.
3. You Can Create Personal Access Tokens In Many Different Applications
Whilst originally created for developer use cases, personal access tokens are now offered by many different applications such as Github, Azure DevOps and even Shopify! These pre-built integrations make it easy for non-technical users to get started using them immediately.
4. They Should Be Protected Like Any Other Secret Credential!
Just because personal access tokens aren’t passwords doesn’t mean they shouldn’t be treated with the same careful regard when it comes down protecting them from unauthorized usage! Always ensure token management is held up properly e.g not storing in plain text etc).
5. The Adoption Of PAT Authentication Will Continue To Grow In Coming Years!
Given its wide adoption among third-party companies offering simple integration opportunities , there’s no indication that PAT will start losing traction anytime soon–in fact over time expect more and more organizations including banks and various other enterprises making significant investment toward integrating solutions based on this approach.
In summary: Personal access tokens are a quickly growing technology, providing an easy way for users to authenticate without passwords whilst being commonly used in many key business applications. Their ability to shortcut security concerns and offer easy-to-use integrations have made them increasingly ubiquitous, with their popularity only set to continue rising in coming years!
Best Practices for Securely Managing Your Personal Access Tokens
Personal access tokens have become an essential tool in our digital lives. They offer a convenient way to authenticate ourselves and allow us to access various online services from social media platforms, cloud storage solutions to digital marketplaces like Amazon or eBay.
Although the convenience of personal access tokens cannot be overstated, they can also pose a considerable security risk if not managed correctly. A lost or stolen token can put your sensitive information at risk or even grant cybercriminals unauthorized access to your online accounts.
To avoid such mishaps and stay safe when using personal access tokens, it is vital always to follow best practices for their use and management. In this blog, we explore some of these guidelines that will help you securely manage your personal access tokens.
1) Use strong passwords
When setting up authentication for personal access tokens assigned by any service provider, ensure that you set a unique password with an adequate mix of letters (capitalized/lowercase), numbers, symbols/ special characters.
2) Limit Access Tokens’ Scope
Consider only granting minimum required permissions necessary for fast logins yet leave out all additional privileges beyond what is entirely needed—no more no less than expected.
See also Unlocking the Power of Clifford Tokens: A Personal Journey to Understanding and Utilizing this Revolutionary Technology [Expert Tips and Stats Included]
3) Enable Two-Factor Authentication
In addition to having a strong password and limiting the scope of your Personal Access Token’s permission level Granting 2FA provides added layer protection against unauthorized entry(s).
4) Keep Your Access-Token Secret Session Securely Stored Away
As secure as storing sessions may appear instead store one-time-use credentials in RAM memory such as vault servers; re-issuing new ones on each code push auto-deployed through customized scripts consequently maintaining tight reins over who gains control while delivering bug fixes in real-time faster without sacrificing strict integration requirements”
5) Regularly update your token credentials:
Some providers give users options where credentials are renewed automatically upon expiry date expiration dates which ensures freshness among common login process session hijack attack mitigation measure both client-server levels.
You can maintain your personal access token secure by using strong passwords, limit the scope of access privileges granted, enable two-factor authentication and ensure to store them safe. These efforts will undoubtedly help boost security over time as more malicious tools crop up; following correct technologies’ standards remains vital towards protecting individual privacy for everyone online.
Conclusion: Why Every Developer Should Consider Using a Personal Access Token
As a developer, you never know when a project might require access to certain APIs or third-party services. This is where Personal Access Tokens come in handy.
Personal Access Tokens (PAT) are essentially tokens that replace the traditional username and password authentication method. Instead of using your actual credentials, PATs provide a complex string that allows access to specific resources within an application or service.
Why are these tokens so important? For starters, they help protect your account from potential security breaches. By not exposing your username and password every time you need access to certain resources, you’re limiting the amount of exposure hackers can have on sensitive information like login details.
But beyond just securing your accounts, personal access tokens can also streamline the development process by allowing for automatic authentication with specific API’s and tools without increasing risk. While it may seem simple enough to just enter in passwords each time such integrations necessary integration comes up; introducing automated token-based systems into how we execute requests becomes increasingly beneficial as more tools take advantage them
While other types of authentication like OAuth still certainly has value in their own right, PAT’s allow developers greater flexibility from control over what actions will be taken next based on delegated permissions ranging anywhere use cases through messaging platforms & testing frameworks all while keeping data grounded under one point configuration system.
So why should every developer consider making the switch?
For one thing, it simplifies accessing frequently used APIs and services; ensuring better efficiency — allowing even less-experienced clients quick-access adopting current best practices rather than having introduce ineffective alternatives due lack knowledge-sharing From there lies peace-of-mind thanks stronger security enabled through accurate identity management schemas offered now only through personal access tokens – this truly being remarkable benefit for everyone who handles safety related concerns throughout web applications at various roles including IT teams handling company servers
Overall: whether you’re a new programmer starting out small projects or large-scale solutions managing multiple organizations simultaneously- applying personal everything benefits those involved with cybersecurity efforts should always be a given. The convenience of preserving one’s information as best practice in the penitentiary of online attacks is undeniable – it can help save you from trouble down the line, ultimately ensuring smooth transitions into ‘set and forget’ mode for all OAuth community extensions; this type being most feasible solution to date bringing by far more streamlined consistent interface treatment even decades later.
Table with useful data:
Data Type Description
Personal Access Token A unique code that grants access to an individual user to access certain APIs or resources.
API An interface that allows different software applications to communicate with each other and share data.
OAuth An authorization framework that allows a user to grant access to their resources on one site to another site, without having to share their credentials.
SDK A software development kit that contains tools and resources for developing software applications for a specific platform or system.
Information from an expert
As an expert in online security, I highly recommend using a personal access token instead of traditional passwords for added protection. Access tokens are unique and can only be used by the person who created them, providing a more secure way to access online accounts and sensitive information. With the rise of cybercrimes and identity theft, taking proactive measures like using access tokens can make all the difference in protecting yourself online. Don’t wait until it’s too late to enhance your security – start using personal access tokens today.
Historical fact:
During World War II, Alan Turing developed a machine called the Bombe to crack German Enigma codes. This was instrumental in the Allied victory and laid the foundation for modern computing. However, Turing was later prosecuted for being gay and tragically took his own life in 1954. It wasn’t until 2009 that he received an official apology from the British government for his treatment.
Like this post? Please share to your friends: | __label__pos | 0.880694 |
Footnote help
When I insert a footnote by typing [^1] (or using the Footnote shortcut), the following happens. It inserts [^1]
BUT No number appears at the end of the page and the cursor does not jump there either.
In addition, the ^ symbol is always displayed (in preview mode).
image
and in “view mode” there is only a normal number in the text
What am I doing wrong?
Two steps:
1. Add “[^1]” into the note text.
2. Add “[^1]: Footnote text.” somewhere below. (Don’t forget the colon before the footnote text).
In Preview mode, the footnote is displayed where you placed the “[^1]: footnote text.”
In Reading mode, the footnote is displayed at the bottom of the note.
More info: Format your notes
Yeah that works BUT the the Obsidian Plug in “Footnote Shortcut” (from @akaalias) sould do that for me, but it does not.
I didn’t realise your question was about the “Footnote Shortcut” plugin. Sorry, not familiar with it.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed. | __label__pos | 0.965899 |
blob: 14683d40638c480e107b5b7b262fa8a9c4648f4b [file] [log] [blame]
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_LEB128_H_
#define ART_RUNTIME_LEB128_H_
#include <vector>
#include "base/bit_utils.h"
#include "base/logging.h"
#include "globals.h"
namespace art {
// Reads an unsigned LEB128 value, updating the given pointer to point
// just past the end of the read value. This function tolerates
// non-zero high-order bits in the fifth encoded byte.
static inline uint32_t DecodeUnsignedLeb128(const uint8_t** data) {
const uint8_t* ptr = *data;
int result = *(ptr++);
if (UNLIKELY(result > 0x7f)) {
int cur = *(ptr++);
result = (result & 0x7f) | ((cur & 0x7f) << 7);
if (cur > 0x7f) {
cur = *(ptr++);
result |= (cur & 0x7f) << 14;
if (cur > 0x7f) {
cur = *(ptr++);
result |= (cur & 0x7f) << 21;
if (cur > 0x7f) {
// Note: We don't check to see if cur is out of range here,
// meaning we tolerate garbage in the four high-order bits.
cur = *(ptr++);
result |= cur << 28;
}
}
}
}
*data = ptr;
return static_cast<uint32_t>(result);
}
// Reads an unsigned LEB128 + 1 value. updating the given pointer to point
// just past the end of the read value. This function tolerates
// non-zero high-order bits in the fifth encoded byte.
// It is possible for this function to return -1.
static inline int32_t DecodeUnsignedLeb128P1(const uint8_t** data) {
return DecodeUnsignedLeb128(data) - 1;
}
// Reads a signed LEB128 value, updating the given pointer to point
// just past the end of the read value. This function tolerates
// non-zero high-order bits in the fifth encoded byte.
static inline int32_t DecodeSignedLeb128(const uint8_t** data) {
const uint8_t* ptr = *data;
int32_t result = *(ptr++);
if (result <= 0x7f) {
result = (result << 25) >> 25;
} else {
int cur = *(ptr++);
result = (result & 0x7f) | ((cur & 0x7f) << 7);
if (cur <= 0x7f) {
result = (result << 18) >> 18;
} else {
cur = *(ptr++);
result |= (cur & 0x7f) << 14;
if (cur <= 0x7f) {
result = (result << 11) >> 11;
} else {
cur = *(ptr++);
result |= (cur & 0x7f) << 21;
if (cur <= 0x7f) {
result = (result << 4) >> 4;
} else {
// Note: We don't check to see if cur is out of range here,
// meaning we tolerate garbage in the four high-order bits.
cur = *(ptr++);
result |= cur << 28;
}
}
}
}
*data = ptr;
return result;
}
// Returns the number of bytes needed to encode the value in unsigned LEB128.
static inline uint32_t UnsignedLeb128Size(uint32_t data) {
// bits_to_encode = (data != 0) ? 32 - CLZ(x) : 1 // 32 - CLZ(data | 1)
// bytes = ceil(bits_to_encode / 7.0); // (6 + bits_to_encode) / 7
uint32_t x = 6 + 32 - CLZ(data | 1);
// Division by 7 is done by (x * 37) >> 8 where 37 = ceil(256 / 7).
// This works for 0 <= x < 256 / (7 * 37 - 256), i.e. 0 <= x <= 85.
return (x * 37) >> 8;
}
// Returns the number of bytes needed to encode the value in unsigned LEB128.
static inline uint32_t SignedLeb128Size(int32_t data) {
// Like UnsignedLeb128Size(), but we need one bit beyond the highest bit that differs from sign.
data = data ^ (data >> 31);
uint32_t x = 1 /* we need to encode the sign bit */ + 6 + 32 - CLZ(data | 1);
return (x * 37) >> 8;
}
static inline uint8_t* EncodeUnsignedLeb128(uint8_t* dest, uint32_t value) {
uint8_t out = value & 0x7f;
value >>= 7;
while (value != 0) {
*dest++ = out | 0x80;
out = value & 0x7f;
value >>= 7;
}
*dest++ = out;
return dest;
}
template<typename Allocator>
static inline void EncodeUnsignedLeb128(std::vector<uint8_t, Allocator>* dest, uint32_t value) {
uint8_t out = value & 0x7f;
value >>= 7;
while (value != 0) {
dest->push_back(out | 0x80);
out = value & 0x7f;
value >>= 7;
}
dest->push_back(out);
}
// Overwrite encoded Leb128 with a new value. The new value must be less than
// or equal to the old value to ensure that it fits the allocated space.
static inline void UpdateUnsignedLeb128(uint8_t* dest, uint32_t value) {
const uint8_t* old_end = dest;
uint32_t old_value = DecodeUnsignedLeb128(&old_end);
DCHECK_LE(value, old_value);
for (uint8_t* end = EncodeUnsignedLeb128(dest, value); end < old_end; end++) {
// Use longer encoding than necessary to fill the allocated space.
end[-1] |= 0x80;
end[0] = 0;
}
}
static inline uint8_t* EncodeSignedLeb128(uint8_t* dest, int32_t value) {
uint32_t extra_bits = static_cast<uint32_t>(value ^ (value >> 31)) >> 6;
uint8_t out = value & 0x7f;
while (extra_bits != 0u) {
*dest++ = out | 0x80;
value >>= 7;
out = value & 0x7f;
extra_bits >>= 7;
}
*dest++ = out;
return dest;
}
template<typename Allocator>
static inline void EncodeSignedLeb128(std::vector<uint8_t, Allocator>* dest, int32_t value) {
uint32_t extra_bits = static_cast<uint32_t>(value ^ (value >> 31)) >> 6;
uint8_t out = value & 0x7f;
while (extra_bits != 0u) {
dest->push_back(out | 0x80);
value >>= 7;
out = value & 0x7f;
extra_bits >>= 7;
}
dest->push_back(out);
}
// An encoder that pushed uint32_t data onto the given std::vector.
class Leb128Encoder {
public:
explicit Leb128Encoder(std::vector<uint8_t>* data) : data_(data) {
DCHECK(data != nullptr);
}
void Reserve(uint32_t size) {
data_->reserve(size);
}
void PushBackUnsigned(uint32_t value) {
EncodeUnsignedLeb128(data_, value);
}
template<typename It>
void InsertBackUnsigned(It cur, It end) {
for (; cur != end; ++cur) {
PushBackUnsigned(*cur);
}
}
void PushBackSigned(int32_t value) {
EncodeSignedLeb128(data_, value);
}
template<typename It>
void InsertBackSigned(It cur, It end) {
for (; cur != end; ++cur) {
PushBackSigned(*cur);
}
}
const std::vector<uint8_t>& GetData() const {
return *data_;
}
protected:
std::vector<uint8_t>* const data_;
private:
DISALLOW_COPY_AND_ASSIGN(Leb128Encoder);
};
// An encoder with an API similar to vector<uint32_t> where the data is captured in ULEB128 format.
class Leb128EncodingVector FINAL : private std::vector<uint8_t>, public Leb128Encoder {
public:
Leb128EncodingVector() : Leb128Encoder(this) {
}
private:
DISALLOW_COPY_AND_ASSIGN(Leb128EncodingVector);
};
} // namespace art
#endif // ART_RUNTIME_LEB128_H_ | __label__pos | 0.997822 |
texlive[57484] Master: tkz-graph (21jan21)
commits+karl at tug.org commits+karl at tug.org
Thu Jan 21 23:11:01 CET 2021
Revision: 57484
http://tug.org/svn/texlive?view=revision&revision=57484
Author: karl
Date: 2021-01-21 23:11:01 +0100 (Thu, 21 Jan 2021)
Log Message:
-----------
tkz-graph (21jan21)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/libexec/ctan2tds
trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/tkz-graph/
trunk/Master/texmf-dist/doc/latex/tkz-graph/README.md
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Dijkstra.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Welsh.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-annales.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-couverture.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-edge.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-label.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-main.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-presentation.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-prob.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-style.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertex.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertices.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf
trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.tex
trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf
trunk/Master/texmf-dist/tex/latex/tkz-graph/
trunk/Master/texmf-dist/tex/latex/tkz-graph/tkz-graph.sty
trunk/Master/tlpkg/tlpsrc/tkz-graph.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/README.md 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,62 @@
+# tkz-graph — for graph theory
+
+Release 2.0 2021/01/20
+
+## Description
+
+The package tkz-graph.sty is a collection of some useful macros if you want to
+ draw manually a graph of the graph theory. The kind of graphs that I will
+ present, are sometimes called combinatorial graphs to distinguish them from
+ the graphs of functions. The macros are designed to give math
+ teachers (and students) easy access at the programmation of drawing graphs
+ with TikZ. I therefore hope that my packages provide ideal tools for
+ teachers wanting to offer their students fine documents of maths.
+
+## Licence
+
+The scontents package may be modified and distributed under the terms and
+conditions of the [LaTeX Project Public License](https://www.latex-project.org/lppl/), version 1.3c or greater.
+
+
+## Requirements
+
+The package compiles with utf8, pdflatex and lualatex, loads and depends on updated versions of:
+- [tikz](https://ctan.org/pkg/tikz)
+
+## Installation
+
+The package `tkz-graph` is present in TeXLive and MiKTeX, use the package
+manager to install.
+
+You can experiment with the `tkz-graph` package by placing all of the
+distribution files in the directory containing your current tex file.
+
+
+## How to use it
+
+To use the package `tkz-graph`, place the following line in the preamble of
+your LaTeX document:
+
+```
+\usepackage{tkz-graph}
+```
+
+## Documentation
+
+Documentation for `tkz-graph` is available on `CTAN`.
+
+## Examples
+
+All examples given in documentation will be stored on `CTAN` as standalone
+files, ready for compilation.
+
+Other examples, in french, are on my site: [http://altermundus.fr](http://altermundus.fr)
+
+## History
+
+- 2.00 correction of bugs and new documentation
+- 1.00 first version
+
+## Author
+
+Alain Matthes, 5 rue de Valence, Paris 75005, al (dot) ma (at) mac (dot) com
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Dijkstra.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Dijkstra.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Dijkstra.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,152 @@
+\section{Dijkstra}
+
+{\large Algorithme de Dijkstra :} Plus courte chaîne du sommet $E$ au sommet $S$.
+
+\medskip
+
+\subsection{Dijkstra exemple 1}
+
+\medskip
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Dijkstra]
+ \SetGraphUnit{4}
+ \Vertices{square}{B,C,D,A}
+ \SetGraphUnit{2.82}
+ \NOWE(B){E}
+ \NOEA(C){S}
+ \Edge[label=$3$](E)(A)
+ \Edge[label=$1$](E)(B)
+ \Edge[label=$1$](A)(B)
+ \Edge[label=$3$](B)(C)
+ \Edge[label=$3$,style={pos=.25}](A)(C)
+ \Edge[label=$5$,style={pos=.75}](B)(D)
+ \Edge[label=$4$](A)(D)
+ \Edge[label=$1$](S)(D)
+ \Edge[label=$3$](C)(S)
+ \Edge[label=$1$](C)(D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+
+\def\ry{$\vrule width 5pt$}
+\def\iy{$\infty$}
+
+%<–––––––––––––––––——————————————————————————————————————————————————————————>
+\vbox{\tabskip=0pt \offinterlineskip
+\def\tablerule{\noalign{\hskip\tabskip\hrule}}
+\halign to \hsize{\strut#&\vrule # \tabskip=0.6em plus8em&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#\tabskip=0pt\cr\tablerule
+&& $E$ && $A$ && $B$ && $C$ && $D$ && $S$ && Choix &\cr\tablerule
+&& $0$ && \iy && \iy && \iy && \iy && \iy && $E$ &\cr\tablerule
+&& \ry && $3(E)$ && $1(E)$ && \iy && \iy && \iy && $B$ &\cr\tablerule
+&& \ry && $2(B)$ && \ry && $4(B)$ && $6(B)$ && \iy && $A$ &\cr\tablerule
+&& \ry && \ry && \ry && $4(B)$ && $6(B)$ && \iy && $C$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && $5(C)$ && $7(C)$ && $D$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && $6(D)$ && $S$ &\cr\tablerule}}
+%<–––––––––––––––––——————————————————————————————————————————————————————————>
+
+\medskip
+
+Le plus court chemin est donc $EBCDS$
+
+\vfill\newpage
+\subsection{Dijkstra exemple 2}
+
+\medskip
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Dijkstra]
+ \SetGraphUnit{4}
+ \Vertices{square}{G,D,A,F}
+ \WE(F){H}
+ \EA(A){B}
+ \EA(D){C}
+ \NO(A){E}
+ \Edge[label=$1$](H)(F)
+ \Edge[label=$4$](G)(F)
+ \Edge[label=$2$](H)(G)
+ \Edge[label=$2$](G)(D)
+ \Edge[label=$3$](D)(C)
+ \Edge[label=$4$](F)(E)
+ \Edge[label=$3$](A)(D)
+ \Edge[label=$2$](A)(E)
+ \Edge[label=$1$](A)(B)
+ \Edge[label=$2$](A)(C)
+ \Edge[label=$2$](C)(B)
+ \Edge[label=$3$](E)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+%<–––––––––––––––––——————————————————————————————————————————————————————————>
+\vbox{\tabskip=0pt \offinterlineskip
+\def\tablerule{\noalign{\hskip\tabskip\hrule}}
+\halign to \hsize{\strut#&\vrule # \tabskip=0.6em plus8em&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#\tabskip=0pt\cr\tablerule
+&& $H$ && $F$ && $G$ && $E$ && $D$ && $A$ && $C$ && $B$ && Choix &\cr\tablerule
+&& $0$ && \iy && \iy && \iy && \iy && \iy && \iy && \iy && $H$ &\cr\tablerule
+&& \ry && $1(H)$ && $2(H)$ && \iy && \iy && \iy && \iy && \iy && $F$ &\cr\tablerule
+&& \ry && \ry && $2(H)$ && $5(F)$ && \iy && \iy && \iy && \iy && $G$ &\cr\tablerule
+&& \ry && \ry && \ry && $5(F)$ && $4(G)$ && \iy && \iy && \iy && $D$ &\cr\tablerule
+&& \ry && \ry && \ry && $5(F)$ && \ry && $7(D)$ && $7(D)$ && \iy && $E$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && $7(D)$ && $7(D)$ && $8(E)$ && $A$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && \ry && $7(D)$ && $8(E)$ && $C$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && \ry && \ry && $8(E)$ && $B$ &\cr\tablerule}}
+%<–––––––––––––––––——————————————————————————————————————————————————————————>
+
+Le plus court chemin est donc $HFEB$
+
+\begin{tkzexample}[code only]
+\def\ry{$\vrule width 5pt$}
+\def\iy{$\infty$}
+\vbox{\tabskip=0pt \offinterlineskip
+\def\tablerule{\noalign{\hskip\tabskip\hrule}}
+\halign to \hsize{\strut#&\vrule # \tabskip=0.6em plus8em&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#&
+\hfil#\hfil& \vrule#\tabskip=0pt\cr\tablerule
+&& $H$ && $F$ && $G$ && $E$ && $D$ && $A$ && $C$ && $B$%
+&& Choix &\cr\tablerule
+&& $0$ && \iy && \iy && \iy && \iy && \iy && \iy && \iy%
+&& $H$ &\cr\tablerule
+&& \ry && $1(H)$ && $2(H)$ && \iy && \iy && \iy && \iy && \iy%
+&& $F$ &\cr\tablerule
+&& \ry && \ry && $2(H)$ && $5(F)$ && \iy && \iy && \iy && \iy%
+&& $G$ &\cr\tablerule
+&& \ry && \ry && \ry && $5(F)$ && $4(G)$ && \iy && \iy && \iy%
+&& $D$ &\cr\tablerule
+&& \ry && \ry && \ry && $5(F)$ && \ry && $7(D)$ && $7(D)$ && \iy%
+&& $E$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && $7(D)$ && $7(D)$ && $8(E)$%
+&& $A$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && \ry && $7(D)$ && $8(E)$%
+&& $C$ &\cr\tablerule
+&& \ry && \ry && \ry && \ry && \ry && \ry && \ry && $8(E)$%
+&& $B$ &\cr\tablerule}}
+\end{tkzexample}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Dijkstra.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Welsh.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Welsh.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Welsh.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,246 @@
+\section{Colorisation Welsh}
+%<–––––––––––––––––––––––––– graphs with colors ––––––––––––––––––––––––––—––>
+Ce chapitre montre comment colorer des sommets. Le plus simple est d'utiliser le style \tkzname{Welsh} et la macro \tkzcname{AddVertexColor} afin de colorer les sommets.
+
+\subsection{La macro \tkzcname{AddVertexColor} }
+
+\begin{NewMacroBox}{AddVertexColor}{\var{color}\var{List of vertices}}
+
+\medskip
+\emph{Cette macro permet de colorer des sommets. Le premier argument est la couleur, le second une liste de sommets.}
+\end{NewMacroBox}
+
+\subsection{Exemple d'utilisation }
+
+\medskip
+Une compagnie aérienne propose des vols directs entre certaines villes, notées A, B, C, D, E, F et G. Cela conduit au graphe $\mathcal{G}$ suivant, dont les sommets sont les villes et les arêtes représentent les liaisons aériennes :
+
+ \begin{center}
+\begin{tikzpicture}
+\renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{center}
+
+\begin{enumerate}
+
+\item Sur les cartes d'embarquement, la compagnie attribue à chaque aéroport une couleur, de sorte que deux aéroports liés par un vol direct aient des couleurs différentes.
+
+ Proposer un coloriage adapté‚ cette condition.
+\item Que peut-on en déduire sur le nombre chromatique de $\mathcal{G}$ ?
+\end{enumerate}
+
+
+
+\begin{center}
+\begin{tkzltxexample}[]
+\begin{tikzpicture}
+\renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+\end{center}
+
+\bigskip
+\begin{minipage}{7cm}
+ \begin{tikzpicture}
+\renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+ \end{tikzpicture}
+\end{minipage}
+\hfill
+\begin{minipage}{7cm}
+ \begin{tabular}{cc}
+ \hline
+ \itshape Sommet & \itshape Degré \\
+ \hline
+ B & $5$ \\
+ E & $5$ \\
+ C & $4$ \\
+ D & $4$ \\
+ A & $3$ \\
+ G & $3$ \\
+ F & $2$ \\
+ \hline
+ \end{tabular}
+\end{minipage}
+
+\begin{tkzltxexample}[]
+ \begin{tikzpicture}
+\renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+
+\bigskip
+\begin{minipage}{7cm}
+ \begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{minipage}
+\hfill
+\begin{minipage}{7cm}
+\begin{tabular}{ccc}
+\hline
+\itshape Sommet & \itshape Degré & \itshape Couleur\\
+\hline
+B & $5$ & rouge\\
+E & $5$ & \\
+C & $4$ & \\
+D & $4$ & \\
+A & $3$ & \\
+G & $3$ & \\
+F & $2$ & rouge\\
+\hline
+\end{tabular}
+\end{minipage}
+
+\begin{tkzltxexample}[]
+\begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+
+\bigskip
+\begin{minipage}{7cm}
+ \begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{minipage}
+\hfill
+\begin{minipage}{7cm}
+\begin{tabular}{ccc}
+\hline
+\itshape Sommet & \itshape Degré & \itshape Couleur\\
+\hline
+B & $5$ & rouge\\
+E & $5$ & bleu\\
+C & $4$ & \\
+D & $4$ & \\
+A & $3$ & bleu\\
+G & $3$ & \\
+F & $2$ & rouge\\
+\hline
+\end{tabular}
+\end{minipage}
+
+\begin{tkzltxexample}[]
+\begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F}
+ \AddVertexColor{blue}{E,A}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A)
+ \Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+
+\bigskip
+\begin{minipage}{7cm}
+\begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A}
+ \AddVertexColor{green}{C,G}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{minipage}
+\hfill
+\begin{minipage}{7cm}
+\begin{tabular}{ccc}
+\hline
+\itshape Sommet & \itshape Degré & \itshape Couleur\\
+\hline
+B & $5$ & rouge\\
+E & $5$ & bleu\\
+C & $4$ & vert\\
+D & $4$ & \\
+A & $3$ & bleu\\
+G & $3$ & vert\\
+F & $2$ & rouge\\
+\hline
+\end{tabular}
+\end{minipage}
+
+\begin{tkzltxexample}[]
+\begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A}
+ \AddVertexColor{green}{C,G}
+ \Vertex[Node]{D}}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+
+\bigskip
+\begin{minipage}{7cm}
+\begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A}
+ \AddVertexColor{green}{C,G} \AddVertexColor{yellow}{D}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E)
+\end{tikzpicture}
+\end{minipage}
+\hfill
+\begin{minipage}{7cm}
+\begin{tabular}{ccc}
+\hline
+\itshape Sommet & \itshape Degré & \itshape Couleur\\
+\hline
+B & $5$ & rouge\\
+E & $5$ & bleu\\
+C & $4$ & vert\\
+D & $4$ & jaune\\
+A & $3$ & bleu\\
+G & $3$ & vert\\
+F & $2$ & rouge\\
+\hline
+\end{tabular}
+\end{minipage}
+
+\begin{tkzltxexample}[]
+ \begin{tikzpicture}
+ \renewcommand*{\VertexLineWidth}{2pt}
+ \GraphInit[vstyle=Welsh]
+ \Vertices[unit=3]{circle}{A,B,C,D,E,F,G}
+ \SetVertexNoLabel
+ \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A}
+ \AddVertexColor{green}{C,G}\AddVertexColor{yellow}{D}
+ \Vertex[Node]{D}}
+ \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A)\Edges(B,E)
+\end{tikzpicture}
+\end{tkzltxexample}
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-Welsh.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-annales.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-annales.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-annales.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,1164 @@
+\section{Annales.}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% Amérique du nord juin 2003
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Amérique du nord juin 2003}
+
+Soit le graphe G joint en annexe constitué des sommets A, B, C, D, E, F et G.
+
+\begin{enumerate}
+\item Quel est son ordre et le degré de chacun de ses sommets ?
+\item Reproduire sur la copie et compléter le tableau des distances entre deux sommets de G :
+
+\medskip
+\begin{center}
+\begin{tabular}{|l|c|c|c|c|c|c|c|}\hline
+Distance & A & B & C & D & E & F & G \\ \hline
+A & X & & & & & & \\ \hline
+B & X & X & & & & & \\ \hline
+C & X & X & X & & & & \\ \hline
+D & X & X & X & X & & & \\ \hline
+E & X & X & X & X & X & & \\ \hline
+F & X & X & X & X & X & X & \\ \hline
+G & X & X & X & X & X & X & X \\ \hline
+\end{tabular}
+\end{center}
+
+\medskip
+En déduire le diamètre de ce graphe.
+\item
+ \begin{enumerate}
+ \item Donner un sous-graphe complet d'ordre 3 de G.
+
+Qu'en déduire pour le nombre chromatique de G ?
+ \item Proposer une coloration du graphe G et en déduire son nombre chromatique.
+ \end{enumerate}
+\item Donner la matrice M associée à G (vous numéroterez les lignes et les colonnes dans l'ordre alphabétique).
+\item En utilisant la matrice $ M_2$ donnée en annexe 1, déduire le nombre de chaînes de longueur 2 partant de A sans y revenir.
+\end{enumerate}
+
+\medskip
+\begin{minipage}[]{10cm}
+\begin{tikzpicture}
+ \Vertex[x=1.3,y=3.8]{A}
+ \Vertex[x=4.2,y=5.5]{B}
+ \Vertex[x=7.3,y=4]{C}
+ \Vertex[x=8.5,y=1.5]{D}
+ \Vertex[x=5,y=0]{E}
+ \Vertex[x=3.6,y=4]{F}
+ \Vertex[x=0.7,y=1]{G}
+ \Edges(A,B,C,D,E,G,A,F,E,C)
+ \Edge(B)(F)
+\end{tikzpicture}
+\end{minipage}
+\begin{minipage}[]{5cm}
+M$^2 =
+\begin{pmatrix}
+ 3 & 1 & 1 & 0 & 2 & 1 & 0\\
+ 1 & 3 & 0 & 1 & 2 & 1 & 1\\
+ 1 & 0 & 3 & 1 & 1 & 2 & 1\\
+ 0 & 1 & 1 & 2 & 1 & 1 & 1\\
+ 2 & 2 & 1 & 1 & 4 & 0 & 0\\
+ 1 & 1 & 2 & 1 & 0 & 3 & 2\\
+ 0 & 1 & 1 & 1 & 0 & 2 & 2\\
+\end{pmatrix}$
+\end{minipage}
+
+\medskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \Vertex[x=1.3,y=3.8]{A} \Vertex[x=4.2,y=5.5]{B}
+ \Vertex[x=7.3,y=4]{C} \Vertex[x=8.5,y=1.5]{D}
+ \Vertex[x=5,y=0]{E} \Vertex[x=3.6,y=4]{F}
+ \Vertex[x=0.7,y=1]{G}
+ \Edges(A,B,C,D,E,G,A,F,E,C) \Edge(B)(F)
+\end{tikzpicture}
+\end{tkzexample}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% Antilles-Guyane juin 2003
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Antilles-Guyane juin 2003 }\label{ag03}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\begin{enumerate}
+\item Un musée est constitué de 9 salles notées A, B, C, D, E, F, G, H et S.
+
+Le plan du musée est représenté ci-dessous :
+
+\medskip
+\begin{center}
+\begin{tikzpicture}
+\draw (0,0) rectangle (8,6);
+\draw(2,0)--(2,0.7);
+\draw(2,1.3)--(2,2.7);
+\draw(2,3.3)--(2,4.7);
+\draw(2,5.3)--(2,6);
+\draw(4,0)--(4,0.7);
+\draw(4,1.3)--(4,2.7);
+\draw(4,3.3)--(4,4.7);
+\draw(4,5.3)--(4,6);
+\draw(6,0)--(6,0.7);
+\draw(6,1.3)--(6,2.7);
+\draw(6,3.3)--(6,4.7);
+\draw(6,5.3)--(6,6);
+\draw(2,5.3)--(2,6);
+\draw(4,5.3)--(4,6);
+\draw(6,5.3)--(6,6);
+\draw(2,2)--(2.7,2);
+\draw(3.3,2)--(4.7,2);
+\draw(5.3,2)--(6,2);
+\draw(2,4)--(2.7,4);
+\draw(3.3,4)--(4.7,4);
+\draw(5.3,4)--(8,4);
+\node at (1,3){S};
+\node at (3,3){G};
+\node at (3,1){D};
+\node at (3,5){A};
+\node at (5,1){H};
+\node at (5,3){E};
+\node at (5,5){B};
+\node at (7,2){F};
+\node at (7,5){C};
+\end{tikzpicture}
+\end{center}
+
+\medskip
+Ainsi, un visiteur qui se trouve dans la salle S peut atteindre directement les salles A, B ou G. S'il se trouve dans la salle C, il peut se rendre directement dans la salle B, mais pas dans la salle F.
+
+On s'intéresse au parcours d'un visiteur dans ce musée. On ne se préoccupe pas de la manière dont le visiteur accède au musée ni comment il en sort. Cette situation peut être modélisée par un graphe, les sommets étant les noms des salles, les arêtes représentant les portes de communication.
+
+ \begin{enumerate}
+ \item Dessiner un graphe modélisant la situation décrite.
+ \item Est-il possible de visiter le musée, en empruntant chaque porte une fois et une seule ?
+
+Justifier en utilisant un théorème du cours sur les graphes.
+\item Pour rompre une éventuelle monotonie, le conservateur du musée souhaite différencier chaque salle de sa ou des salles voisines (c'est-à-dire accessibles par une porte) par la moquette posée au sol. Quel est le nombre minimum de types de moquettes nécessaires pour répondre à ce souhait ? Justifier.
+ \end{enumerate}
+\item On note $M$ la matrice à 9 lignes et 9 colonnes associée au graphe précédent, en convenant de l'ordre suivant des salles S, A, B, C, D, E, F, G, H. Le graphe n'étant pas orienté, comment cela se traduit-il sur la matrice ?
+\item On donne la matrice :
+
+\[M^4 =
+\begin{pmatrix}
+18 & 12 & 11 & 02 & 20 & 12 & 06 & 12 & 12\\
+12 & 20 & 03 & 06 & 11 & 20 & 05 & 18 & 05\\
+11 & 03 & 16 & 00 & 19 & 03 & 08 & 04 & 12\\
+02 & 06 & 00 & 03 & 01 & 07 & 01 & 04 & 01\\
+20 & 11 & 19 & 01 & 31 & 09 & 11 & 12 & 19\\
+12 & 20 & 03 & 07 & 09 & 28 & 09 & 20 & 09\\
+06 & 05 & 08 & 01 & 11 & 09 & 09 & 08 & 09\\
+12 & 18 & 04 & 04 & 12 & 20 & 08 & 20 & 06\\
+12 & 05 & 12 & 01 & 19 & 09 & 09 & 06 & 17\\
+\end{pmatrix}\]
+
+ \begin{enumerate}
+ \item Combien y-a-t-il de chemins qui en 4 étapes, partent de D et reviennent à D ?
+ \item Combien y-a-t-il de chemins qui en 4 étapes, partent de S et reviennent à C ? Les citer.
+ \item Est-il toujours possible de joindre en 4 étapes deux salles quelconques ? Justifier.
+ \end{enumerate}
+\end{enumerate}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent, uniquement fait avec tikz sans tkz-berge
+
+\bigskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \draw (0,0) rectangle (8,6);
+ \draw(2,0)--(2,0.7);
+ \draw(2,1.3)--(2,2.7);
+ \draw(2,3.3)--(2,4.7);
+ \draw(2,5.3)--(2,6);
+ \draw(4,0)--(4,0.7);
+ \draw(4,1.3)--(4,2.7);
+ \draw(4,3.3)--(4,4.7);
+ \draw(4,5.3)--(4,6);
+ \draw(6,0)--(6,0.7);
+ \draw(6,1.3)--(6,2.7);
+ \draw(6,3.3)--(6,4.7);
+ \draw(6,5.3)--(6,6);
+ \draw(2,5.3)--(2,6);
+ \draw(4,5.3)--(4,6);
+ \draw(6,5.3)--(6,6);
+ \draw(2,2)--(2.7,2);
+ \draw(3.3,2)--(4.7,2);
+ \draw(5.3,2)--(6,2);
+ \draw(2,4)--(2.7,4);
+ \draw(3.3,4)--(4.7,4);
+ \draw(5.3,4)--(8,4);
+ \node at (1,3){S};
+ \node at (3,3){G};
+ \node at (3,1){D};
+ \node at (3,5){H};
+ \node at (5,1){H};
+ \node at (5,3){E};
+ \node at (5,5){B};
+ \node at (7,2){F};
+ \node at (7,5){C};
+\end{tikzpicture}
+\end{tkzexample}
+
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% Asie juin 2003
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Asie juin 2003 }\label{asj03}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+
+\bigskip
+\begin{minipage}[l]{0,58\textwidth}
+Dans la ville de GRAPHE, on s'intéresse aux principales rues permettant de relier différents lieux ouverts au public, à savoir la mairie (M), le centre commercial (C), la bibliothèque (B), la piscine (P) et le lycée (L). Chacun de ces lieux est désigné par son initiale. Le tableau ci-contre donne les rues existant entre ces lieux.
+\end{minipage}\hfill
+\begin{minipage}[]{0,38\textwidth}
+\begin{center}
+ \begin{tabular}{|*{5}{c|} c|} \cline{2-6}
+ \multicolumn{1}{c|}{}
+ & B & C & L & M & P \\ \hline
+ B & & X & & X & X \\ \hline
+ C & X & & X & X & \\ \hline
+ L & & X & & X & \\ \hline
+ M & X & X & X & & X \\ \hline
+ P & X & & & X & \\ \hline
+ \end{tabular}
+\end{center}
+\end{minipage}
+
+\medskip
+\begin{enumerate}
+\item Dessiner un graphe représentant cette situation.
+\item Montrer qu'il est possible de trouver un trajet empruntant une fois et une seule toutes les rues de ce plan. Justifier. Proposer un tel trajet.
+
+Est-il possible d'avoir un trajet partant et arrivant du même lieu et passant une fois et une seule par toutes les rues ?
+
+
+\begin{minipage}[b]{0,3\textwidth}
+\item
+ Dimitri habite dans cette ville ; le graphe ci-contre donne le \textbf{nouveau} plan du quartier avec les sens de circulation dans les différentes rues et le temps de parcours entre les différents lieux.
+\end{minipage}
+\hspace{1cm}
+ \begin{minipage}[c]{0,68\textwidth}
+ \begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4}
+ \tikzset{VertexStyle/.style = {shape = circle,
+ draw = black,
+ inner sep = 2pt,%
+ minimum size = 6mm,
+ outer sep = 0pt,
+ fill = gray!60}}
+ \Vertex {P}
+ \NOEA(P){B}
+ \SOEA(P){M}
+ \NOEA(B){D}
+ \SOEA(B){C}
+ \SOEA(C){L}
+ \tikzset{LabelStyle/.style = {fill=white}}
+ \tikzset{EdgeStyle/.style = {<->}}
+ \Edge[label=$4$](P)(M)
+ \Edge[label=$9$](C)(M)
+ \Edge[label=$4$](C)(L)
+ \Edge[label=$5$](C)(D)
+ \Edge[label=$10$](B)(M)
+ \tikzset{EdgeStyle/.style = {<->,bend right}}
+ \Edge[label=$11$](L)(D)
+ \tikzset{EdgeStyle/.style = {->}}
+ \Edge[label=$3$](C)(B)
+ \Edge[label=$10$](D)(B)
+ \Edge[label=$10$](L)(M)
+ \Edge[label=$10$](B)(P)
+ \end{tikzpicture}
+ \end{minipage}
+\end{enumerate}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent
+
+\bigskip
+\begin{tkzexample}[code only]
+\begin{minipage}[c]{0,68\textwidth}
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4}
+ \tikzset{VertexStyle/.style = {shape = circle,
+ draw = black,
+ inner sep = 2pt,%
+ minimum size = 6mm,
+ outer sep = 0pt,
+ fill = gray!60}}
+ \Vertex {P}
+ \NOEA(P){B}
+ \SOEA(P){M}
+ \NOEA(B){D}
+ \SOEA(B){C}
+ \SOEA(C){L}
+ \tikzset{LabelStyle/.style = {fill=white}}
+ \tikzset{EdgeStyle/.style = {<->}}
+ \Edge[label=$4$](P)(M)
+ \Edge[label=$9$](C)(M)
+ \Edge[label=$4$](C)(L)
+ \Edge[label=$5$](C)(D)
+ \Edge[label=$10$](B)(M)
+ \tikzset{EdgeStyle/.style = {<->,bend right}}
+ \Edge[label=$11$](L)(D)
+ \tikzset{EdgeStyle/.style = {->}}
+ \Edge[label=$3$](C)(B)
+ \Edge[label=$10$](D)(B)
+ \Edge[label=$10$](L)(M)
+ \Edge[label=$10$](B)(P)
+\end{tikzpicture}
+\end{minipage}
+\end{tkzexample}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% France juin 2003
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{France juin 2003 }\label{frj03}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+Un concert de solidarité est organisé dans une grande salle de spectacle. À ce concert sont conviés sept artistes de renommée internationale Luther Allunison (A), John Biaise (B), Phil Colline (C), Bob Ditlâne (D), Jimi Endisque (E), Robert Fripe (F) et Rory Garaguerre (G).
+
+Les différents musiciens invités refusant de jouer avec certains autres, l'organisateur du concert doit prévoir plusieurs parties de spectacle. Les arêtes du graphe $\Gamma$ ci-dessous indiquent quels sont les musiciens qui refusent de jouer entre eux.
+
+\medskip
+\begin{center}
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \GraphInit[vstyle=Normal]
+ \tikzset{EdgeStyle/.style = {line width = 2pt}}
+ \tikzset{VertexStyle/.append style = {line width = 2pt}}
+ \Vertex{D}
+ \SOEA(D){E}
+ \EA(E){F}
+ \NOEA(F){G}
+ \NOWE(G){A}
+ \NOWE(A){B}
+ \SOWE(B){C}
+ \Edges(F,G,A,D,F,B,E,G,C,F,A,E,C,B)
+\end{tikzpicture}
+\end{center}
+
+\medskip
+\begin{enumerate}
+\item Déterminer la matrice associée au graphe $\Gamma$ (les sommets de $\Gamma$ étant classés dans l'ordre alphabétique).
+\item Quelle est la nature du sous-graphe de $\Gamma '$ constitué des sommets A, E, F et G ?
+
+Que peut-on en déduire pour le nombre chromatique $\chi(\Gamma)$ du graphe $\Gamma$ ?
+\item Quel est le sommet de plus haut degré de $\Gamma$ ?
+
+En déduire un encadrement de $\chi(\Gamma)$.
+\item Après avoir classé l'ensemble des sommets de $\Gamma$ par ordre de degré décroissant, colorier le graphe $\Gamma$ figurant en annexe.
+\item Combien de parties l'organisateur du concert doit-il prévoir ?
+
+Proposer une répartition des musiciens pour chacune de ces parties.
+\end{enumerate}
+
+\medskip
+
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \GraphInit[vstyle=Normal]
+ \tikzset{EdgeStyle/.style = {line width = 2pt}}
+ \tikzset{VertexStyle/.append style = {line width = 2pt}}
+ \Vertex{D}
+ \SOEA(D){E}\EA(E){F}
+ \NOEA(F){G}\NOWE(G){A}
+ \NOWE(A){B}\SOWE(B){C}
+ \Edges(F,G,A,D,F,B,E,G,C,F,A,E,C,B)
+\end{tikzpicture}
+\end{tkzexample}
+
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% CE juin 2003
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Centres Étrangers juin 2003 }\label{cej03}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+\bigskip
+Un livreur d'une société de vente à domicile doit, dans son après-midi, charger son camion à l'entrepôt noté A, livrer cinq clients que nous noterons B, C, D, E et F, puis retourner à l'entrepôt. Le réseau routier, tenant compte des sens de circulation, et les temps de parcours (en minutes) sont indiqués sur le graphe G suivant :
+
+\medskip
+\begin{center}
+ \begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4}
+ \Vertex {F}
+ \NOWE(F){A}
+ \NOEA(F){B}
+ \SOEA(F){C}
+ \SOWE(F){D}
+ \SOWE(A){E}
+ \tikzstyle{EdgeStyle}=[->]
+ \tikzstyle{LabelStyle}=[fill=white]
+ \Edge[label=$4$](A)(E)
+ \Edge[label=$4$](E)(D)
+ \Edge[label=$9$](D)(A)
+ \Edge[label=$2$](B)(A)
+ \Edge[label=$11$](C)(B)
+ \Edge[label=$3$](D)(F)
+ \Edge[label=$6$](F)(A)
+ \tikzstyle{EdgeStyle}=[->,bend left=15]
+ \Edge[label=$2$](D)(C)
+ \Edge[label=$2$](C)(D)
+ \Edge[label=$3$](F)(B)
+ \Edge[label=$3$](B)(F)
+ \Edge[label=$6$](F)(C)
+ \Edge[label=$6$](C)(F)
+ \end{tikzpicture}
+\end{center}
+
+\begin{enumerate}
+\item Donner la matrice M associée au graphe G.
+
+On utilisera le modèle suivant :
+
+\begin{center}
+ \begin{tabular}{|*{7}{c|}}\cline{2-7}
+ \multicolumn{1}{c|}{}%
+ & A & B & C & D & E & F \\ \hline
+ A & & & & & & \\ \hline
+ B & & & & & & \\ \hline
+ C & & & & & & \\ \hline
+ D & & & & & & \\ \hline
+ E & & & & & & \\ \hline
+ F & & & & & & \\ \hline
+ \end{tabular}
+\end{center}
+
+\item On donne la matrice M$^6$ :
+
+\[\text{M}^6 =
+\begin{pmatrix}
+ 8 & 6 & 6 & 3 & 4 & 6 \\
+ 19 & 11 & 12 & 9 & 6 & 16\\
+ 36 & 28 & 23 & 22 & 18 & 34\\
+ 37 & 24 & 25 & 17 & 15 & 31\\
+ 15 & 12 & 9 & 10 & 8 & 15\\
+ 28 & 22 & 19 & 15 & 15 & 26\\
+\end{pmatrix}\]
+
+On s'intéresse aux chemins partant de l'entrepôt A et se terminant en A.
+
+ \begin{enumerate}
+ \item Combien existe-t-il de chemins de longueur 6 reliant A à A ?
+ \item Citer ces chemins.
+ \item Parmi ceux qui passent par tous les sommets du graphe, lequel minimise le temps de parcours ?
+ \item Quelle conséquence peut tirer le livreur du dernier résultat ?
+ \end{enumerate}
+\item Au départ de sa tournée, le livreur a choisi de suivre l'itinéraire le plus rapide. Malheureusement, le client C n'est pas présent au passage du livreur et celui-ci décide de terminer sa livraison par ce client. Indiquer quel est le chemin le plus rapide pour revenir à l'entrepôt A à partir de C. La réponse devra être justifiée.
+\end{enumerate}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent
+
+\bigskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{3}
+ \Vertex {F}
+ \NOWE(F){A}
+ \NOEA(F){B}
+ \SOEA(F){C}
+ \SOWE(F){D}
+ \SOWE(A){E}
+ \tikzstyle{EdgeStyle}=[->]
+ \tikzstyle{LabelStyle}=[fill=white]
+ \Edge[label=$4$](A)(E)
+ \Edge[label=$4$](E)(D)
+ \Edge[label=$9$](D)(A)
+ \Edge[label=$2$](B)(A)
+ \Edge[label=$11$](C)(B)
+ \Edge[label=$3$](D)(F)
+ \Edge[label=$6$](F)(A)
+ \tikzstyle{EdgeStyle}=[->,bend left=15]
+ \Edge[label=$2$](D)(C)
+ \Edge[label=$2$](C)(D)
+ \Edge[label=$3$](F)(B)
+ \Edge[label=$3$](B)(F)
+ \Edge[label=$6$](F)(C)
+ \Edge[label=$6$](C)(F)
+\end{tikzpicture}
+\end{tkzexample}
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% Amérique du Nord mai 2004
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Amérique du Nord juin 2004 }\label{anm04}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+
+\textbf{Les parties A et B sont indépendantes.}
+
+\textbf{Partie A}
+
+On considère le graphe G$_{1}$ ci-dessous :
+
+\bigskip
+
+\begin{center}
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{6}
+ \Vertex{F}%
+ \NOEA(F){B}
+ \SOEA(F){E}
+ \EA(B){C}
+ \EA(E){D}
+ \NO(D){A}
+ \Edges(B,F,E,D,A,E,B,A,F,B,C,F,D)
+\end{tikzpicture}
+\end{center}
+
+\medskip
+
+\begin{enumerate}
+\item Justifier les affirmations suivantes :
+
+A$_{1}$ : \og le graphe G$_1$ admet au moins une chaîne eulérienne \fg.
+
+A$_{2}$ ; \og La chaîne DABCFBEFAE n'est pas une chaîne eulérienne de G$_1$ \fg.
+
+\item Déterminer un sous-graphe complet de G$_1$, ayant le plus grand ordre possible. En déduire un minorant du nombre chromatique $\gamma$ de ce graphe.
+
+\item Déterminer un majorant de ce nombre chromatique. (On justifiera la réponse).
+
+\item En proposant une coloration du graphe G$_1$, déterminer son nombre chromatique.
+
+\end{enumerate}
+
+\medskip
+
+\textbf{Partie B}
+
+Soit la matrice M d'un graphe orienté G$_2$ dont les sommets A, B, C, D et E sont pris dans l'ordre alphabétique.
+
+On donne \[
+ M =
+\begin{pmatrix}
+ 0 & 1 & 1 & 1 & 0\\
+ 1 & 0 & 1 & 0 & 1\\
+ 1 & 1 & 0 & 0 & 1\\
+ 0 & 1 & 0 & 0 & 1\\
+ 1 & 1 & 0 & 1 & 0\\
+\end{pmatrix}
+\]
+~et~
+\[
+ \text{M}^3 =
+\begin{pmatrix}
+ 6 & 6 & 4 & 5 & 3\\
+ 5 & 6 & 5 & 3 & 6\\
+ 5 & 7 & 4 & 3 & 6\\
+ 3 & 5 & 3 & 3 & 3\\
+ 6 & 6 & 3 & 3 & 5\\
+\end{pmatrix}.
+\]
+\begin{enumerate}
+\item Construire le graphe G$_2$.
+\item Déterminer le nombre de chaînes de longueur 3 reliant B à D. Les citer toutes.
+\end{enumerate}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent
+
+\bigskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{6}
+ \Vertex{F}
+ \NOEA(F){B}
+ \SOEA(F){E}
+ \EA(B){C}
+ \EA(E){D}
+ \NO(D){A}
+ \Edges(B,F,E,D,A,E,B,A,F,B,C,F,D)
+\end{tikzpicture}
+\end{tkzexample}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% CE mai 2004
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Centres étrangers mai 2004 }\label{cem04}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+\bigskip
+Un jardinier possède un terrain bien ensoleillé avec une partie plus ombragée.
+
+Il décide d'y organiser des parcelles où il plantera 8 variétés de légumes :
+
+\medskip
+\begin{center}\begin{minipage}[t]{0.48\textwidth}
+ \begin{itemize}
+ \item de l'ail (A),
+ \item des courges (Co),
+ \item des choux (Ch),
+ \item des poireaux (Px),
+ \item des pois (Po),
+ \item des pommes de terre (Pt),
+ \item des radis (R),
+ \item et des tomates (T).
+ \end{itemize}
+\end{minipage}\end{center}
+
+\medskip
+Il consulte un almanach où figurent des incompatibilités de plantes, données par les deux tableaux :
+
+\medskip
+
+\begin{minipage}[t]{0.46\textwidth}
+\begin{tabular}{|l|l|}\hline
+ \multicolumn{2}{|p{7cm}|}{Expositions incompatibles de plantes}\\
+\hline
+ \multicolumn{1}{|p{3.5cm}|}{Plantes d'ombre partielle}
+ &\multicolumn{1}{|p{3.5cm}|}{Plantes de plein soleil}\\
+\hline
+ & \\
+ & choux \\
+ pois & tomates \\
+ radis & courges \\
+ & \\
+ & \\
+\hline
+ \multicolumn{2}{|p{7cm}|}{Par exemple : les pois sont incompatibles avec les
+ choux, les tomates et les courges}\\ \hline
+\end{tabular}
+\end{minipage}
+\hfill
+\raisebox{6pt}{\begin{minipage}[t]{0.46\textwidth}
+\begin{tabular}{|l|l|}\hline
+\multicolumn{2}{|p{7cm}|}{Associations incompatibles de} \\
+\multicolumn{2}{|p{7cm}|}{plantes dans une même parcelle}\\ \hline
+ pois & ail, poireaux\\ \hline
+pommes de & courges, radis et\\
+terre & tomates\\ \hline
+& tomates, ail\\
+choux & poireaux et courges\\ \hline
+courges & tomates\\ \hline
+\multicolumn{2}{|p{7cm}|}{Par exemple : les pois sont incompatibles avec
+l'ail et les poireaux}\\ \hline
+\end{tabular}
+\end{minipage}}
+
+\medskip
+
+Pour tenir compte de ces incompatibilités le jardinier décide de modéliser la situation sous la forme d'un graphe de huit sommets, chaque sommet représentant un légume.
+\medskip
+\begin{enumerate}
+\item Sur la feuille annexe : compléter le graphe mettant en évidence les incompatibilités d'exposition ou les associations incompatibles indiquées dans les deux tableaux ci-dessus.
+
+\item Calculer la somme des degrés des sommets du graphe, en déduire le nombre de ses arêtes.
+
+\item Rechercher un sous-graphe complet d'ordre 4, qu'en déduit-on pour le nombre chromatique du graphe ?
+
+\item Donner le nombre chromatique du graphe et l'interpréter en nombre minimum de parcelles que le jardinier devra créer.
+
+\item Donner une répartition des plantes pur parcelle de façon à ce que chaque parcelle contienne exactement deux types de plantes et que le nombre de parcelles soit minimum.
+
+\item Donner une répartition des plantes de façon à ce qu'une parcelle contienne trois plantes et que le nombre de parcelles soit minimum.
+\end{enumerate}
+
+\medskip
+\begin{center}
+ \begin{tikzpicture}
+ \tikzstyle{VertexStyle}= [shape = circle,
+ fill = white,%
+ minimum size = 26pt,%
+ draw]
+ \Vertex[x=1,y=0.8]{R}
+ \Vertex[x=0.2,y=3.3]{Po}
+ \Vertex[x=0,y=2]{Pt}
+ \Vertex[x=0.9,y=5]{Px}
+ \Vertex[x=3.5,y=5]{A}
+ \Vertex[x=5.6,y=3.4]{T}
+ \Vertex[x=5.3,y=2]{Co}
+ \Vertex[x=3.3,y=0.2]{Ch}
+ \Edges(Po,Px,Po,A,Po,T,Po,Co,Po,Ch)
+ \end{tikzpicture}
+\end{center}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent
+
+\bigskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \tikzstyle{VertexStyle}= [shape = circle,
+ fill = white,%
+ minimum size = 26pt,%
+ draw]
+ \Vertex[x=1,y=0.8]{R}
+ \Vertex[x=0.2,y=3.3]{Po}
+ \Vertex[x=0,y=2]{Pt}
+ \Vertex[x=0.9,y=5]{Px}
+ \Vertex[x=3.5,y=5]{A}
+ \Vertex[x=5.6,y=3.4]{T}
+ \Vertex[x=5.3,y=2]{Co}
+ \Vertex[x=3.3,y=0.2]{Ch}
+ \Edges(Po,Px,Po,A,Po,T,Po,Co,Po,Ch)
+\end{tikzpicture}
+\end{tkzexample}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% France mai 2004
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{France juin 2004}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+Le graphe ci-dessous indique, sans respecter d'échelle, les parcours possibles entre les sept bâtiments d'une entreprise importante.
+
+\medskip
+\begin{tikzpicture}
+ \SetGraphUnit{5}
+ \Vertex{A}
+ \NOEA(F){B}
+ \SOEA(F){E}
+ \EA(B){C}
+ \EA(E){D}
+ \NO(D){A}
+ \Edges(F,E,F,D,F,C,F,A,F,B,A,E,E,D,D,A,B,A,C,B,E,B)
+\end{tikzpicture}
+
+Un agent de sécurité effectue régulièrement des rondes de surveillance. Ses temps de parcours en minutes entre deux bâtiments sont les
+suivants :
+
+\medskip
+\begin{center}
+\begin{minipage}{0.5\textwidth}
+ \begin{itemize}
+ \item AB : 16 minutes ;
+ \item AG : 12 minutes ;
+ \item BC : 8 minutes ;
+ \item BE : 12 minutes ;
+ \item BG : 8 minutes ;
+ \item CD : 7 minutes ;
+ \item CE : 4 minutes ;
+ \item CG : 10 minutes ;
+ \item DE : 2 minutes ;
+ \item EF : 8 minutes ;
+ \item EG : 15 minutes ;
+ \item FG : 8 minutes.
+ \end{itemize}
+\end{minipage}
+\end{center}
+
+\medskip
+Sur chaque arête, les temps de parcours sont indépendants du sens de parcours.
+
+\begin{enumerate}
+\item En justifiant la réponse, montrer qu'il est possible que l'agent de sécurité passe une fois et une seule par tous les chemins de cette usine. Donner un exemple de trajet.
+
+\item L'agent de sécurité peut-il revenir à son point de départ après avoir parcouru une fois et une seule tous les chemins ? Justifier la réponse.
+
+\item Tous les matins, l'agent de sécurité part du bâtiment A et se rend au bâtiment D.
+
+En utilisant un algorithme que l'on explicitera, déterminer le chemin qu'il doit suivre pour que son temps de parcours soit le plus court possible, et donner ce temps de parcours.
+\end{enumerate}
+
+\medskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \SetGraphUnit{5}
+ \Vertex{A} \NOEA(F){B} \SOEA(F){E}
+ \EA(B){C} \EA(E){D} \NO(D){A}
+ \Edges(F,E,F,D,F,C,F,A,F,B,A,E,E,D,D,A,B,A,C,B,E,B)
+\end{tikzpicture}
+\end{tkzexample}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% La Reunion mai 2004
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{La Réunion juin 2004 }\label{larj04}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+
+\textbf{Partie A}
+
+On note $G$ le graphe représenté ci-dessous et $M$ sa matrice obtenue en prenant les sommets dans l'ordre alphabétique. La matrice $M^3$ est également donnée.
+
+\medskip
+\begin{center}
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4.5}
+ \Vertex {e}
+ \NOEA(e){f}
+ \SOEA(e){d}
+ \SOEA(f){h}
+ \Vertex[position={above of=e,yshift=2cm}]{g}
+ \Vertex[position={left of=g,xshift=-1cm}]{c}
+ \Vertex[position={left of=d,xshift=-2cm}]{a}
+ \SOWE(c){b}
+ \Edges(a,c,g) \Edges(d,h,f,e,d,a,e,g,a,b,c,e)
+ \Edge[style={bend left}](g)(h)
+\end{tikzpicture}
+\end{center}
+
+\bigskip
+\begin{center}
+ $M^3 = \begin{pmatrix}
+ 10 & 8 & 11 & 10 & 12 & 5 & 13 & 4\\
+ 8 & 2 & 7 & 3 & 5 & 2 & 4 & 3\\
+ 11 & 7 & 8 & 6 & 12 & 3 & 10 & 5\\
+ 10 & 3 & 6 & 2 & 11 & 1 & 4 & 8\\
+ 12 & 5 & 12 & 11 & 8 & 8 & 13 & 3\\
+ 5 & 2 & 3 & 1 & 8 & 0 & 2 & 6\\
+ 13 & 4 & 10 & 4 & 13 & 2 & 6 & 9\\
+ 4 & 3 & 5 & 8 & 3 & 6 & 9 & 0\\
+\end{pmatrix}$
+\end{center}
+
+
+\bigskip
+Dire, en justifiant votre réponse, si les affirmations suivantes sont vraies ou
+ fausses :
+
+\begin{enumerate}
+\item L'ordre du graphe est égal au plus grand des degrés des sommets.
+\item Le graphe $G$ contient un sous-graphe complet d'ordre $3$.
+\item Les sommets de $G$ peuvent être coloriés avec trois couleurs sans que deux sommets adjacents soient de même couleur.
+\item Il est possible de parcourir ce graphe en passant une fois et une seule par chaque arête.
+\item Il existe au moins un chemin de longueur $3$ qui relie chaque sommet à chacun des sept autres sommets du graphe.
+\item il y a $72$ chemins de longueur $3$ qui relient le sommet $e$ à chacun des huit sommets du graphe.
+\end{enumerate}
+
+\newpage
+
+\textbf{ Partie B}
+
+Le graphe suivant représente un réseau de lignes d'autobus. Les sommets du graphe désignent les arrêts. Les poids des arêtes sont les durées de parcours, en minutes, entre deux arrêts (correspondances comprises).
+
+\medskip
+\begin{center}
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4.5}
+ \Vertex {e}
+ \NOEA(e){f}
+ \SOEA(e){d}
+ \SOEA(f){h}
+ \Vertex[position={above of=e,yshift=2cm}]{g}
+ \Vertex[position={left of=g,xshift=-1cm}]{c}
+ \Vertex[position={left of=d,xshift=-2cm}]{a}
+ \SOWE(c){b}
+ \tikzstyle{LabelStyle}=[fill=white]
+ \Edge[label=$3$](a)(b)
+ \Edge[label=$11$](a)(c)
+ \Edge[label=$6$](a)(e)
+ \Edge[label=$17$](a)(d)
+ \Edge[style={pos=.25},label=$20$](a)(g)
+ \Edge[label=$5$](c)(b)
+ \Edge[label=$6$](c)(e)
+ \Edge[label=$7$](c)(g)
+ \Edge[label=$7$](f)(e)
+ \Edge[label=$3$](d)(e)
+ \Edge[label=$9$](d)(h)
+ \Edge[label=$6$](g)(e)
+ \Edge[style={bend left},label=$11$](g)(h)
+ \Edge[label=$4$](f)(h)
+\end{tikzpicture}
+\end{center}
+
+\medskip
+Déterminer, à l'aide d'un algorithme, la durée minimum pour aller de l'arrêt $a$ à l'arrêt $h$ et donner ce trajet.
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+Code du graphe précédent
+
+\medskip
+\begin{tkzexample}[code only]
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4.5}
+ \Vertex {e}
+ \NOEA(e){f}
+ \SOEA(e){d}
+ \SOEA(f){h}
+ \Vertex[position={above of=e,yshift=2cm}]{g}
+ \Vertex[position={left of=g,xshift=-1cm}]{c}
+ \Vertex[position={left of=d,xshift=-2cm}]{a}
+ \SOWE(c){b}
+ \Edges(a,c,g) \Edges(d,h,f,e,d,a,e,g,a,b,c,e)
+ \Edge[style={bend left}](g)(h)
+\end{tikzpicture}
+\end{tkzexample}
+
+et
+
+\begin{tkzexample}[code only]
+\begin{tikzpicture}[>=latex]
+ \SetGraphUnit{4.5}
+ \Vertex {e}
+ \NOEA(e){f}
+ \SOEA(e){d}
+ \SOEA(f){h}
+ \Vertex[position={above of=e,yshift=2cm}]{g}
+ \Vertex[position={left of=g,xshift=-1cm}]{c}
+ \Vertex[position={left of=d,xshift=-2cm}]{a}
+ \SOWE(c){b}
+ \tikzstyle{LabelStyle}=[fill=white]
+ \Edge[label=$3$](a)(b)
+ \Edge[label=$11$](a)(c)
+ \Edge[label=$6$](a)(e)
+ \Edge[label=$17$](a)(d)
+ \Edge[style={pos=.25},label=$20$](a)(g)
+ \Edge[label=$5$](c)(b)
+ \Edge[label=$6$](c)(e)
+ \Edge[label=$7$](c)(g)
+ \Edge[label=$7$](f)(e)
+ \Edge[label=$3$](d)(e)
+ \Edge[label=$9$](d)(h)
+ \Edge[label=$6$](g)(e)
+ \Edge[style={bend left},label=$11$](g)(h)
+ \Edge[label=$4$](f)(h)
+\end{tikzpicture}
+\end{tkzexample}
+
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Amérique du Sud Nov 2006}\label{amsn06}
+\begin{enumerate}
+\item À l'occasion de la coupe du monde de football 2006 en Allemagne, une agence touristique organise des voyages en car à travers les différentes villes où se joueront les matchs d'une équipe nationale.
+
+Les routes empruntées par les cars sont représentées par le graphe ci-dessous. Le long de chaque arête figure la distance en kilomètres séparant les villes.
+Les lettres B, D, F, H, K, M, N et S représentent les villes Berlin, Dortmnd, Francfort, Hambourg, Kaiserslautern, Munich, Nuremberg et Stuttgart.
+
+\bigskip
+
+\begin{center}
+\begin{tikzpicture}
+ \Vertex[x=0 ,y=0]{K}
+ \Vertex[x=0 ,y=2]{F}
+ \Vertex[x=-1,y=4]{D}
+ \Vertex[x=3 ,y=7]{H}
+ \Vertex[x=8 ,y=5]{B}
+ \Vertex[x=9 ,y=2]{N}
+ \Vertex[x=5 ,y=0]{M}
+ \Vertex[x=3 ,y=1]{S}
+ \tikzstyle{LabelStyle}=[fill=white,sloped]
+ \tikzstyle{EdgeStyle}=[bend left]
+ \Edge[label=$120$](K)(F)
+ \Edge[label=$650$](H)(S)
+ \Edge[label=$780$](H)(M)
+ \Edge[label=$490$](D)(B)
+ \Edge[label=$600$](D)(M)
+ \Edge[label=$580$](B)(M)
+ \Edge[label=$600$](H)(N)
+ \Edge[label=$490$](F)(H)
+ \tikzstyle{EdgeStyle}=[bend right]
+ \Edge[label=$630$](S)(B)
+ \Edge[label=$210$](S)(N)
+ \Edge[label=$230$](S)(M)
+\end{tikzpicture}
+\end{center}
+
+\bigskip
+En précisant la méthode utilisée, déterminer le plus court chemin possible pour aller de Kaiserslautern à Berlin en utilisant les cars de cette agence.
+\item Pour des raisons de sécurité, les supporters de certaines équipes nationales participant à la coupe du monde de football en 2006 ne peuvent être logés dans le même hôtel.
+
+On donne ci-dessous le graphe d'incompatibilité entre les supporters de différentes équipes : par exemple, un supporter de l'équipe A ne peut être logé avec un supporter de l'équipe P.
+
+\bigskip
+\begin{center}
+\begin{tikzpicture}
+ \tikzstyle{EdgeStyle}=[bend left]
+ \Vertex[x=0,y=0]{G}
+ \Vertex[x=0,y=3]{A}
+ \Vertex[x=3,y=5]{P}
+ \Vertex[x=4,y=2]{C}
+ \Vertex[x=8,y=3]{Q}
+ \Vertex[x=7,y=0]{E}
+ \Vertex[x=3,y=-1]{R}
+ \Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
+\end{tikzpicture}
+\end{center}
+
+\bigskip
+\begin{enumerate}
+\item Déterminer le nombre chromatique de ce graphe en justifiant la valeur trouvée.
+\item Proposer une répartition des supporters par hôtel en utilisant un nombre minimum d'hôtels.
+\end{enumerate}
+\end{enumerate}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\vfill\newpage\null
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+% Liban juin 2006
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+\subsection{Liban juin 2006 }\label{lib06}
+%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
+
+\begin{enumerate}
+\item Dans un parc, il y a cinq bancs reliés entre eux par des allées.
+
+On modélise les bancs par les sommets A, B, C, D, E et les allées par les arêtes du
+graphe G ci-dessous :
+
+
+\medskip
+\begin{center}
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \tikzstyle{VertexStyle}=[shape = circle,
+ fill = black,
+ minimum size = 20pt,
+ text = white,
+ draw]
+ \Vertex[L= {\textbf{E}}]{E}
+ \NOEA[L = {\textbf{A}}](E){A}
+ \SOEA[L = {\textbf{D}}](E){D}
+ \EA[L = {\textbf{C}}](D){C}
+ \NOEA[L = {\textbf{B}}](C){B}
+ \tikzstyle{EdgeStyle}=[double = orange,%
+ double distance = 1pt,%
+ thick,%
+ bend right = 20]
+ \Edges(B,A,E,D,C,B,D)
+\end{tikzpicture}
+\end{center}
+
+\medskip
+
+\begin{enumerate}
+\item On désire peindre les bancs de façon que deux bancs reliés par une allée soient
+toujours de couleurs différentes.
+
+Donner un encadrement du nombre minimal de couleurs nécessaires et justifier.
+
+Déterminer ce nombre.
+\item Est-il possible de parcourir toutes les allées de ce parc sans passer deux fois par
+la même allée?
+\end{enumerate}
+\item Une exposition est organisée dans le parc. La fréquentation devenant trop importante, on décide d'instaurer un plan de circulation : certaines allées deviennent à sens unique, d'autres restent à double sens. Par exemple la circulation dans l'allée
+située entre les bancs B et C pourra se faire de B vers C et de C vers B, alors que la circulation dans l'allée située entre les bancs A et B ne pourra se faire que de A vers B. Le graphe G$'$ ci-dessous modélise cette nouvelle situation :
+
+\medskip
+\begin{center}
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \tikzstyle{VertexStyle}=[shape = circle,
+ fill = black,
+ minimum size = 20pt,
+ text = white,
+ draw]
+ \tikzstyle{TempStyle}=[double = orange,%
+ double distance = 1pt]
+ \Vertex[L= {\textbf{E}}]{E}
+ \NOEA[L = {\textbf{A}}](E){A}
+ \SOEA[L = {\textbf{D}}](E){D}
+ \EA[L = {\textbf{C}}](D){C}
+ \NOEA[L = {\textbf{B}}](C){B}
+ \tikzstyle{EdgeStyle}=[TempStyle,%
+ post,%
+ bend right = 20]
+ \Edges(A,E,D,C,B,D)
+ \tikzstyle{EdgeStyle}=[TempStyle,%
+ pre,%
+ bend right = 20]
+ \Edges(B,A)
+ \tikzstyle{EdgeStyle}=[TempStyle,%
+ pre,%
+ bend left = 20]
+ \Edges(A,E,D,C,B)
+\end{tikzpicture}
+\end{center}
+
+\begin{enumerate}
+\item Donner la matrice M associée au graphe G$'$. (On ordonnera les sommets
+par ordre alphabétique).
+\item On donne M$^5
+= \begin{pmatrix}
+1& 6& 9& 6& 10\\
+4& 5& 7& 11& 5\\
+4& 6& 6& 11& 5\\
+1& 5& 10& 6& 10\\
+6& 5& 5& 14& 2\\
+\end{pmatrix}$
+
+Combien y a-t-il de chemins de longueur 5 permettant de se rendre du
+sommet D au sommet B ?
+
+Les donner tous.
+\item Montrer qu'il existe un seul cycle de longueur 5 passant par le sommet A.
+
+Quel est ce cycle ?
+
+En est-il de même pour le sommet B ?
+ \end{enumerate}
+\end{enumerate}
+
+\vfill\newpage\null
+Code des graphes précédents
+
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \tikzstyle{VertexStyle}=[shape = circle,
+ fill = black,
+ minimum size = 20pt,
+ text = white,
+ draw]
+ \Vertex[L= {\textbf{E}}]{E}
+ \NOEA[L = {\textbf{A}}](E){A}
+ \SOEA[L = {\textbf{D}}](E){D}
+ \EA[L = {\textbf{C}}](D){C}
+ \NOEA[L = {\textbf{B}}](C){B}
+ \tikzstyle{EdgeStyle}=[double = orange,
+ double distance = 1pt,
+ thick,
+ bend right = 20]
+ \Edges(B,A,E,D,C,B,D)
+\end{tikzpicture}
+\end{tkzexample}
+
+\begin{tkzexample}[code only]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \tikzstyle{VertexStyle}=[shape = circle,
+ fill = black,
+ minimum size = 20pt,
+ text = white,
+ draw]
+ \tikzstyle{TempStyle}=[double = orange,
+ double distance = 1pt]
+ \Vertex[L= {\textbf{E}}]{E}
+ \NOEA[L = {\textbf{A}}](E){A}
+ \SOEA[L = {\textbf{D}}](E){D}
+ \EA[L = {\textbf{C}}](D){C}
+ \NOEA[L = {\textbf{B}}](C){B}
+ \tikzstyle{EdgeStyle}=[TempStyle,
+ post,
+ bend right = 20]
+ \Edges(A,E,D,C,B,D)
+ \tikzstyle{EdgeStyle}=[TempStyle,%
+ pre,%
+ bend right = 20]
+ \Edges(B,A)
+ \tikzstyle{EdgeStyle}=[TempStyle,%
+ pre,%
+ bend left = 20]
+ \Edges(A,E,D,C,B)
+\end{tikzpicture}
+\end{tkzexample}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-annales.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-couverture.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-couverture.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-couverture.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,31 @@
+\thispagestyle{empty}
+\null\vfill
+\begin{center}
+\textcolor{Brown}{\fontsize{30}{30}\selectfont{\upshape tkz-graph.sty}}
+
+\vspace{0.25cm}
+\hfill\textcolor{Brown}{\fontsize{14}{14}\selectfont{\upshape Alain Matthes}}
+\end{center}
+
+\vspace{3cm}
+\begin{center}
+\begin{tikzpicture}[scale=5]
+ \SetVertexNoLabel
+ \tikzstyle{VertexStyle}=[draw,
+ shape = circle,
+ shading = ball,
+ ball color = blue!50,
+ inner sep = 10pt,
+ outer sep = 0pt]
+ \tikzstyle{EdgeStyle}= [thick,
+ double = blue,%
+ double distance = 1pt]
+ \draw[fill = white,color = white] circle (0.55cm);
+ \draw (0,0) node[circle,draw,shade,
+ ball color = orange,
+ minimum size = 3cm] (am){\textbf{AlterMundus}};
+ \grIcosahedral[RA=1.4,RB=0.8]
+\end{tikzpicture}
+\end{center}
+\vfill\newpage\null\thispagestyle{empty}
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-couverture.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-edge.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-edge.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-edge.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,116 @@
+\section{Edge avec tkz-graph}
+
+\begin{NewMacroBox}{Edge}{\oarg{local options}\varp{Vertex A}\varp{Vertex B}}
+
+\begin{tabular}{lllc}
+options & défaut & définition \\ \midrule
+\TOline{local} {false} {booléen désactive EdgeStyle }
+\TOline{color} {\textbackslash EdgeColor} {couleur de l'arête}
+\TOline{lw} {\textbackslash EdgeLineWidth} {épaisseur de l'arête.}
+\TOline{label} {\{\}} {le label}
+\TOline{labeltext} {black} {couleur du texte}
+\TOline{labelcolor} {white} {couleur du fond du label }
+\TOline{labelstyle} {\{\}} {modication du style du label}
+\TOline{style} {pos=.5} {modification du style général} \bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de tracer une arête entre deux sommets. Dans les exemples et dans le chapitre sur les styles, l'usage des styles est expliqué. }
+\end{NewMacroBox}
+
+
+
+\medskip
+\subsection{Utilisation de \addbs{Edge}}
+ On peut remarquer qu'il y a deux sortes d'arêtes au niveau de la forme : les segments et les arcs. De plus, ces arêtes peuvent avoir un label. La notion de style est importante car on peut définir pour toutes les arêtes un même style dès le début.
+
+par défaut :
+
+\begin{tkzexample}[latex=8cm, small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \Vertex{a}
+ \EA(a){b}
+ \SO[unit=2](a){c}
+ \EA(c){d}
+ {\SetGraphUnit{2}
+ \SO(c){e}}
+ \EA(e){f}
+ \Edge(a)(b)
+ \tikzset{EdgeStyle/.style = {-,bend left}}
+ \Edge(c)(d)
+ \tikzset{EdgeStyle/.style = {->,bend right=60}}
+ \Edge(e)(f)
+\end{tikzpicture}
+\end{tkzexample}
+
+
+
+
+\vfill
+\newpage
+
+\subsection{Arête particulière la boucle : \tkzname{Loop}}
+
+\begin{NewMacroBox}{Loop}{\oarg{local options}\varp{Vertex}}
+\begin{tabular}{lllc}
+options & défaut & définition \\
+\midrule
+\TOline{color} {black } {}
+\TOline{lw} {0.8pt } {}
+\TOline{label} {\{\} } {}
+\TOline{labelstyle} {\{\} } {}
+\TOline{style} {\{\} } {}
+\end{tabular}
+\end{NewMacroBox}
+
+\subsubsection{Exemple avec \tkzcname{Loop}}
+\begin{center}
+\begin{tkzexample}[vbox, small]
+\begin{tikzpicture}
+ \useasboundingbox (-1,-2) rectangle (8,2);
+ \SetVertexSimple
+ \SetGraphUnit{5}
+ \Vertex{A}
+ \EA(A){B}
+ \Edge[style={->}](A)(B)
+ \Loop[dist=3cm,dir=EA,style={thick,->}](B)
+ \Loop[dist=5cm,dir=WE,style={thick,->}](A)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\vfill
+\newpage
+\subsection{Multiple arêtes \tkzcname{Edges}}
+
+\begin{NewMacroBox}{Edges}{\oarg{local options}\varp{Vertex A,Vertex B,\dots}}
+
+\begin{tabular}{llc}
+options & défaut & définition \\
+\midrule
+\TOline{color} {black} {}
+\TOline{lw} {thick} {}
+\TOline{label} {\{\} } {}
+\TOline{labelstyle}{\{\}} {}
+\TOline{style} {\{\} } {}
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{ Cette macro permet de définir une série d'arêtes en une seule fois.}
+\end{NewMacroBox}
+
+\subsubsection{Exemple avec \tkzcname{Edges}}
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \GraphInit[vstyle=Art]
+ \Vertices{circle}{a0,a1,a2,a3,a4,a5,a6,a7}
+ \Edges(a0,a3,a6,a1,a4,a7,a2,a5,a0)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-edge.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-label.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-label.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-label.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,125 @@
+\section{Les labels}
+% Options sur les labels
+Rappel : Si aucun label n'est donné alors l'affichage du label est celui de la référence du \tkzname{vertex}. Il est possible de modifier localement le comportemnt des labels
+
+\subsection{Options concernant les labels}
+
+L'option suivante permet de définir un label, celui-ci peut être en mode texte ou bien en mode math.
+
+\subsubsection{Option \tkzname{L}}
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \Vertex[L=$\alpha$] {a}
+ \EA[unit=4](a){b}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Option \tkzname{Math}}
+Le label est en mode math. Il est inutile de placer L en mode math si l'option est utilisée.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \Vertex[Math] {A_1}
+ \Vertex[Math,L=\alpha,x=4,y=0] {a}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsubsection{Suppression d'un label, Option \tkzname{NoLabel}}
+Cette option supprime l'affichage du label. Il est préférable d'utiliser \tkzname{SetVertexNoLabel} si on veut généraliser à tous les sommets.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \Vertex[NoLabel]{A}
+ \EA[NoLabel](A){B}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Option \tkzname{LabelOut}, \tkzname{Lpos} et \tkzname{Ldist}}
+
+La première option permet de placer le label hors du node, la deuxième positionne le label autour du sommet et la dernière spécifie la distance entre le label et le sommet.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \Vertex[LabelOut]{A}
+ \Vertex[LabelOut,Lpos=60,
+ Ldist=.5cm,x=2,y=0]{B}
+ \Vertex[LabelOut,Lpos=60,x=4,y=0]{C}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\vfill\newpage
+On peut souhaiter appliquer une option pour tous les sommets.
+
+\subsection{\tkzcname{SetVertexNoLabel}}
+On peut souhaiter ne pas avoir de label pour tous les sommets avec un style prédéfini.
+
+\begin{NewMacroBox}{SetVertexNoLabel}{}
+\emph{ Cette macro permet de supprimer les labels sur tous les sommets. Elle agit globalement sur tous les sommets. Elle correspond à l'option \tkzname{NoLabel}.}
+\end{NewMacroBox}
+
+\subsubsection{Suppression des labels}
+
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \SetVertexNoLabel
+ \Vertex{A}\EA(A){B}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsection{\tkzcname{SetVertexMath} }
+\begin{NewMacroBox}{SetVertexMath}{}
+\emph{Cette macro permet d'appliquer l'option \tkzname{Math} à plusieurs sommets. Elle agit globalement sur tous les sommets. Elle correspond à l'option \tkzname{Math}}
+\end{NewMacroBox}
+
+\begin{tkzexample}[latex=7cm,small]
+ \begin{tikzpicture}
+ \SetVertexMath
+ \Vertex {A_1} \EA[unit=3](A_1){A_2}\texttt{}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsection{\tkzcname{SetVertexLabel}}
+\begin{NewMacroBox}{SetVertexLabel}{}
+\emph{ Cette macro autorise les labels. Elle agit globalement sur tous les sommets.}
+\end{NewMacroBox}
+
+\subsubsection{Labels supprimés puis autorisés.}
+ Dans l'exemple qui suit, les labels sont supprimés puis autorisés.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetVertexNoLabel
+ \SetGraphUnit{2}
+ \Vertex {A} \EA(A){B}
+ \SetVertexLabel \EA(B){C}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Label en dehors du sommet \tkzcname{SetVertexLabelOut}}
+
+\begin{NewMacroBox}{SetVertexLabelOut}{}
+\emph{\tkzcname{SetVertexLabelOut} Dans les exemples précédents, les sommets sont des petits disques colorés, généralement en noir et dans ce cas par défaut le label est à l'extérieur. On peut contrôler la position à l'aide des labels avec \tkzname{Ldist} et\tkzname{Lpos}.}
+\end{NewMacroBox}
+
+\begin{NewMacroBox}{SetVertexLabelIn}{}
+\emph{\tkzcname{SetVertexLabelIn} permet d'écrire le label dans le sommet.}
+\end{NewMacroBox}
+
+Cette macro permet d'appliquer l'option à plusieurs sommets. \tkzcname{SetVertexLabelIn} annule l'effet.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \SetVertexLabelOut
+ \Vertex {A} \EA(A){B}
+ \SetVertexLabelIn \SO[unit=3](B){C}
+\end{tikzpicture}
+\end{tkzexample}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-label.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-main.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-main.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-main.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,237 @@
+% encoding : utf8
+% tkz-doc-graph
+% Created by Alain Matthes on 2021/01/20.
+% Copyright (C) 2021 Alain Matthes
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License , either version 1.3
+% of this license or (at your option) any later version and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.%
+% See http://www.latex-project.org/lppl.txt for details.
+%
+%
+% ``tkzdoc-graph-fr'' is the french doc of tkz-graph
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% tkz-doc-graph encodage : utf8 %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Created by Alain Matthes 2007/09/02 %
+% Copyright (c) 2021 __Altermundus__ All rights reserved. %
+% version : 2.0 %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\documentclass[DIV = 14,
+ fontsize = 10,
+ headinclude = false,
+ footinclude = false,
+ index = totoc,
+ twoside,
+ headings = small]{tkz-doc}
+\usepackage{etoc}
+\gdef\tkznameofpack{tkz-graph}
+\gdef\tkzversionofpack{2.0c}
+\gdef\tkzdateofpack{2021/01/20}
+\gdef\tkznameofdoc{doc-tkz-graph}
+\gdef\tkzversionofdoc{2.0c}
+\gdef\tkzdateofdoc{2021/01/20}
+\gdef\tkzauthorofpack{Alain Matthes}
+\gdef\tkzadressofauthor{}
+\gdef\tkznamecollection{AlterMundus}
+\gdef\tkzurlauthor{}
+\gdef\tkzengine{lualatex}
+\gdef\tkzurlauthorcom{http://altermundus.fr}
+
+% -- Packages ---------------------------------------------------
+\usepackage[dvipsnames,svgnames]{xcolor}
+\usepackage{calc}
+\usepackage{tkz-berge}
+\usetikzlibrary{calc,positioning,shapes}
+\usepackage[colorlinks]{hyperref}
+\hypersetup{
+ linkcolor=Gray,
+ citecolor=Green,
+ filecolor=Mulberry,
+ urlcolor=NavyBlue,
+ menucolor=Gray,
+ runcolor=Mulberry,
+ linkbordercolor=Gray,
+ citebordercolor=Green,
+ filebordercolor=Mulberry,
+ urlbordercolor=NavyBlue,
+ menubordercolor=Gray,
+ runbordercolor=Mulberry,
+ pdfsubject={Euclidean Geometry},
+ pdfauthor={\tkzauthorofpack},
+ pdftitle={\tkznameofpack},
+ pdfcreator={\tkzengine}
+}
+ \usepackage{bookmark}
+\usepackage{tkzexample}
+\usepackage{fontspec}
+\setmainfont{texgyrepagella}%
+ [Extension = .otf ,
+ UprightFont = *-regular,
+ ItalicFont = *-italic,
+ BoldFont = *-bold,
+ BoldItalicFont = *-bolditalic]
+\setsansfont{texgyreheros}[
+ Extension = .otf,
+ UprightFont = *-regular ,
+ ItalicFont = *-italic ,
+ BoldFont = *-bold ,
+ BoldItalicFont = *-bolditalic ,
+]
+
+\setmonofont{lmmono10-regular.otf}[
+ Numbers={Lining,SlashedZero},
+ ItalicFont=lmmonoslant10-regular.otf,
+ BoldFont=lmmonolt10-bold.otf,
+ BoldItalicFont=lmmonolt10-boldoblique.otf,
+]
+\newfontfamily\ttcondensed{lmmonoltcond10-regular.otf}
+%% (La)TeX font-related declarations:
+\linespread{1.05} % Pagella needs more space between lines
+
+\usepackage{unicode-math}
+\usepackage{fourier-otf,zorna}
+\usepackage{datetime,multicol,lscape}
+\usepackage[french]{babel}
+\usepackage[autolanguage]{numprint}
+\usepackage{array,multirow,multido,booktabs}
+\usepackage{shortvrb,fancyvrb}
+\usepackage{fancybox}
+\usepackage{stmaryrd}
+\usepackage{xkeyval,array}
+\usepackage[weather]{ifsym}
+\RequirePackage{makeidx}
+\makeindex
+
+\title{The package : tkz-graph.sty}
+\author{Alain Matthes}
+
+\AtBeginDocument{\MakeShortVerb{\|}}
+
+\begin{document}
+
+\parindent=0pt
+\author{\tkzauthorofpack}
+\title{\tkznameofpack}
+\date{\today}
+\clearpage
+\thispagestyle{empty}
+\maketitle
+\definecolor{iceberg}{rgb}{0.44, 0.65, 0.82}
+
+\AddToShipoutPicture*{%
+\setlength\unitlength{1mm}
+\put(70,120){%
+\begin{tikzpicture}[scale=4]
+ \SetVertexNoLabel
+ \tikzstyle{VertexStyle}=[draw,
+ shape = circle,
+ shading = ball,
+ ball color = blue!50,
+ inner sep = 10pt,
+ outer sep = 0pt]
+ \tikzstyle{EdgeStyle}= [thick,
+ double = blue,%
+ double distance = 1pt]
+ \draw (0,0) node[circle,draw,shade,
+ ball color = iceberg,
+ minimum size = 2cm] (am){\textbf{tkz-graph}};
+ \grIcosahedral[RA=1.4,RB=0.8]
+\end{tikzpicture}
+}
+}
+
+
+\clearpage
+\tkzSetUpColors[background=white,text=darkgray]
+\let\rmfamily\ttfamily
+
+\nameoffile{\tkznameofpack}
+\defoffile{Le package \tkzname{tkz-graph.sty} est un package pour créer à l'aide de \TIKZ\ des graphes le plus simplement possible. Il fera partie d'une série de modules ayant comme point commun, la création de dessins utiles dans l'enseignement des mathématiques. La lecture de cette documentation va , je l'espère, vous permettre d'apprécier la simplicité d'utilisation de \TIKZ\ et vous permettre de commencer à le pratiquer. Il est accompagné du package \tkzname{tkz-berge.sty} qui permet de tracer des graphes particuliers de la théorie des graphes.}
+
+\presentation
+
+\vspace*{1cm}
+\lefthand\ Je souhaite remercier \textbf{Till Tantau} pour avoir créé le merveilleux outil \href{http://sourceforge.net/projects/pgf/}{Ti\emph{k}Z}.
+
+
+\vspace*{12pt}
+\lefthand\ Vous trouverez de nombreux exemples sur mon site~:
+\href{http://altermundus.fr/pages/download.html}{altermundus.fr}
+
+\vfill
+Vous pouvez envoyer vos remarques, et les rapports sur des erreurs que vous aurez constatées à l'adresse suivante~: \href{mailto:al.ma at mac.com}{\textcolor{blue}{Alain Matthes}}.
+
+This file can be redistributed and/or modified under the terms of the LATEX
+Project Public License Distributed from CTAN archives in directory \url{CTAN://
+macros/latex/base/lppl.txt}.
+
+
+
+ \clearpage
+ \tableofcontents
+ \clearpage
+
+
+Liste des macros dans l'ordre d'apparition :
+
+\medskip
+\begin{itemize}
+\item \tkzcname{SetVertexLabelOut}
+\item \tkzcname{SetVertexLabelIn}
+\item \tkzcname{SetVertexMath}
+\item \tkzcname{SetVertexNoMath}
+\item \tkzcname{SetUpVertex}
+\item \tkzcname{Vertex}
+\item \tkzcname{EA}
+\item \tkzcname{WE}
+\item \tkzcname{NO}
+\item \tkzcname{SO}
+\item \tkzcname{NOEA}
+\item \tkzcname{NOWE}
+\item \tkzcname{SOEA}
+\item \tkzcname{SOWE}
+\item \tkzcname{Vertices}
+\item \tkzcname{SetUpEdge}
+\item \tkzcname{Edge}
+\item \tkzcname{Edges}
+\item \tkzcname{Loop}
+\item \tkzcname{grProb}
+\item \tkzcname{SetGraphShadeColor}
+\item \tkzcname{SetGraphArtColor}
+\item \tkzcname{SetGraphColor}
+\item \tkzcname{AddVertexColor}
+\end{itemize}
+
+\vfill
+%<-------------------------------------------------------------------------->
+\renewcommand*{\VertexLightFillColor}{fondpaille}
+%\include{TKZdoc-gr-installation}
+\include{TKZdoc-gr-presentation}
+\include{TKZdoc-gr-vertex}
+\include{TKZdoc-gr-vertices}
+\include{TKZdoc-gr-label}
+\include{TKZdoc-gr-edge}
+\include{TKZdoc-gr-style}
+\include{TKZdoc-gr-prob}
+\include{TKZdoc-gr-Welsh}
+\include{TKZdoc-gr-annales}
+\include{TKZdoc-gr-Dijkstra}
+%<-------------------------------------------------------------------------->
+
+\clearpage\newpage
+\small\printindex
+
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-main.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-presentation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-presentation.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-presentation.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,206 @@
+\section{Premiers graphes avec tkz-graph.sty}
+
+ \tkzname{TikZ} est un outil que je trouve très agréable à utiliser pour la création de graphes. J'ai trouvé si simple son utilisation que je me suis demandé si cela avait un sens de créer un package pour la création de graphes. Pas de théorie des graphes dans ce package, seulement des outils pour leur construction. Trois arguments peuvent intervenir pour soutenir mon effort :
+
+\begin{enumerate}
+
+\item Certains utilisateurs n'ont pas envie d'apprendre quoi que ce soit sur \TIKZ\; cela est respectable et une simplification du code par l'intermédiaire d'un package peut avoir une certaine utilité. La syntaxe n'est plus tout à fait celle de \TIKZ\ mais celle de \LATEX.
+\item Il est possible finalement de jouer avec les styles et d'optimiser certains situations, ainsi la création d'un graphe sans la moindre coordonnée est possible. On peut obtenir des variantes du graphe, simplement en jouant avec les styles.
+\item La création de ce que l'on peut appeler les graphes classiques de la théorie des graphes.
+\item Et pour terminer, cela peut être une approche en douceur de l'utilisation de \TIKZ\, par l'intermédiaire des options.
+
+\end{enumerate}
+
+Que peut apporter \tkzname{tkz-graph.sty} ? Il facilite la gestion des styles des sommets et des arêtes, et également le positionnement de ceux-ci.
+
+\subsection{Exemple simple avec \tkzname{tkz-graph}}
+Avant d'expliquer le fonctionnement des différentes macros, il est possible de tester si le package est bien installé avec l'exemple simple suivant. Le code complet est donné. Le préambule peut évidemment être modifié.
+
+
+\medskip
+\begin{minipage}{.45\textwidth}
+\begin{tkzltxexample}[]
+% Author : Alain Matthes
+% Encoding : UTF8
+% Engine : LuaLaTeX
+\documentclass[border=3mm]{standalone}
+\usepackage{tkz-graph}
+\begin{document}
+
+\begin{tikzpicture}[scale=1.75]
+ \GraphInit[vstyle=Art]
+ \Vertex{A}
+ \Vertex[x=4,y=0]{B}
+ \Vertex[x=1,y=2]{C}
+ \Edge[style={bend left}](B)(A)
+ \Edges(A,B,C,A)
+\end{tikzpicture}
+\end{document}
+\end{tkzltxexample}
+\end{minipage}
+\hfil\begin{minipage}{.40\textwidth}
+ \begin{tikzpicture}[scale=1.75]
+ \GraphInit[vstyle=Art]
+ \Vertex{A}
+ \Vertex[x=4,y=0]{B}
+ \Vertex[x=1,y=2]{C}
+ \Edge[style={bend left}](B)(A)
+ \Edges(A,B,C,A)
+\end{tikzpicture}
+ \end{minipage}
+
+\newpage
+\subsection{Exemple classique avec \tkzname{tkz-graph}}
+
+Voyons un exemple classique. Nous allons utiliser un style scolaire \tkzname{vstyle=Normal} ainsi que les macros \tkzcname{Vertices}, \tkzcname{NOEA} et \tkzcname{Edges} qui permet de créer une "chaîne" d'arêtes (edges). L'environnement \tkzname{scope} fait partie de \TIKZ, il est utilisé ici afin d'appliquer une rotation.
+
+\begin{center}
+\begin{tkzexample}[latex=7cm, small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Normal]
+ \SetGraphUnit{2}
+ \begin{scope}[rotate=-135]
+ \Vertices{circle}{A,B,C,E}
+ \end{scope}
+ \NOEA[unit=1.414](E){D}
+ \Edges(A,B,E,D,C,E,A,C,B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Modification du style}
+Un style plus esthétique peut être choisi avec \tkzcname{GraphInit}. J'ai choisi \tkzname{Art} parmi une liste que vous découvrirez plus tard.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Art]
+ \begin{scope}[rotate=-135]
+ \Vertices[unit=2]{circle}{A,B,C,E}
+ \end{scope}
+ \NOEA[unit=1.414](E){D}
+ \Edges(A,B,E,D,C,E,A,C,B)
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsection{La ville de Königsberg avec \tkzname{tkz-graph}}
+
+
+\begin{tkzexample}[latex=8cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Shade]
+ \tikzset{LabelStyle/.style= {draw,
+ fill = yellow,
+ text = red}}
+ \Vertex{A}
+ \EA(A){B}
+ \EA(B){C}
+ \SetGraphUnit{6}
+ % modifie la distance entre les nodes
+ \NO(B){D}
+ \Edge[label=1](B)(D)
+ \tikzset{EdgeStyle/.append style = {bend left}}
+ \Edge[label=4](A)(B)
+ \Edge[label=5](B)(A)
+ \Edge[label=6](B)(C)
+ \Edge[label=7](C)(B)
+ \Edge[label=2](A)(D)
+ \Edge[label=3](D)(C)
+\end{tikzpicture}
+\end{tkzexample}
+
+
+
+
+\medskip
+Ce dernier exemple était important sur un plan historique, mais il était un peu compliqué car on doit modifier des styles.
+
+\subsection{La ville de Königsberg avec \TIKZ\ mais sans \tkzname{tkz-graph}}
+
+Voyons l'exemple précédent, sans l'utilisation du package \tkzname{tkz-graph}.
+L'exemple peut être vu sur cet excellent site \url{http://www.texample.net/tikz/examples/bridges-of-konigsberg/}, voici le code complet. The result is on the next page.
+D'abord le préambule
+
+\begin{tkzltxexample}[left margin=3cm,right margin=3cm]
+% The seven bridges of Königsberg
+% Author : Alain Matthes
+% Encoding : UTF8
+% Engine : PDFLaTeX
+\documentclass[border=3mm]{standalone}
+\usepackage{fullpage}
+\usepackage{tikz}
+\usetikzlibrary{arrows,shapes,positioning}
+\begin{document}
+\end{tkzltxexample}
+
+Ensuite les styles principaux
+
+\begin{tkzltxexample}[left margin=3cm,right margin=3cm]
+\begin{center}
+\begin{tikzpicture}
+ \useasboundingbox (-1,-1) rectangle (11,11);
+ \tikzset{VertexStyle/.style = {shape = circle,
+ ball color = orange,
+ text = black,
+ inner sep = 2pt,
+ outer sep = 0pt,
+ minimum size = 24 pt}}
+ \tikzset{EdgeStyle/.style = {thick,
+ double = orange,
+ double distance = 1pt}}
+ \tikzset{LabelStyle/.style = {draw,
+ fill = yellow,
+ text = red}}
+\end{tkzltxexample}
+
+ enfin, le tracé
+\begin{tkzltxexample}[left margin=3cm,right margin=3cm]
+ \node[VertexStyle](A){A};
+ \node[VertexStyle,right=of A](B){B};
+ \node[VertexStyle,right=of B](C){C};
+ \node[VertexStyle,above= 7 cm of B](D){D};
+ \draw[EdgeStyle](B) to node[LabelStyle]{1} (D) ;
+ \tikzset{EdgeStyle/.append style = {bend left}}
+ \draw[EdgeStyle](A) to node[LabelStyle]{2} (B);
+ \draw[EdgeStyle](B) to node[LabelStyle]{3} (A);
+ \draw[EdgeStyle](B) to node[LabelStyle]{4} (C);
+ \draw[EdgeStyle](C) to node[LabelStyle]{5} (B);
+ \draw[EdgeStyle](A) to node[LabelStyle]{6} (D);
+ \draw[EdgeStyle](D) to node[LabelStyle]{7} (C);
+ \end{tikzpicture}
+\end{center}
+\end{document}
+\end{tkzltxexample}
+
+\begin{center}
+\begin{tikzpicture}[scale=.75]
+ \useasboundingbox (-1,-1) rectangle (11,11);
+ \tikzset{VertexStyle/.style = {shape = circle,
+ ball color = orange,
+ text = black,
+ inner sep = 2pt,
+ outer sep = 0pt,
+ minimum size = 24 pt}}
+ \tikzset{EdgeStyle/.style = {thick,
+ double = orange,
+ double distance = 1pt}}
+ \tikzset{LabelStyle/.style = {draw,
+ fill = yellow,
+ text = red}}
+
+ \node[VertexStyle](A){A};
+ \node[VertexStyle,right= 4cm of A](B){B};
+ \node[VertexStyle,right= 4cm of B](C){C};
+ \node[VertexStyle,above= 7 cm of B](D){D};
+ \draw[EdgeStyle](B) to node[LabelStyle]{1} (D) ;
+ \tikzset{EdgeStyle/.append style = {bend left}}
+ \draw[EdgeStyle](A) to node[LabelStyle]{2} (B);
+ \draw[EdgeStyle](B) to node[LabelStyle]{3} (A);
+ \draw[EdgeStyle](B) to node[LabelStyle]{4} (C);
+ \draw[EdgeStyle](C) to node[LabelStyle]{5} (B);
+ \draw[EdgeStyle](A) to node[LabelStyle]{6} (D);
+ \draw[EdgeStyle](D) to node[LabelStyle]{7} (C);
+\end{tikzpicture}
+\end{center}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-presentation.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-prob.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-prob.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-prob.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,147 @@
+\section{Graphes probabilistes }
+%<–––––––––––––––––––––––––– graphes probabilistes ––––––––––––––––––––––––––>
+\subsection{La macro \tkzcname{grProb} }
+\begin{NewMacroBox}{grProb}{\oarg{local options} \var{left} \var{right} \var{N}\var{S}\var{W}\var{E}}
+
+\begin{tabular}{lll}
+Arguments & & Définition \\
+ \midrule
+ \TAline{Vertex-left} {}{Nom du sommet à gauche}
+ \TAline{Vertex-right} {}{Nom du sommet à droite}
+ \TAline{label N} {}{Étiquette située en haut}
+ \TAline{label S} {}{Étiquette située en bas}
+ \TAline{label W} {}{Étiquette située à gauche}
+ \TAline{label E} {}{Étiquette située à droite}
+ \bottomrule
+ \end{tabular}
+
+\medskip
+\begin{tabular}{lll}
+options & défaut & définition \\
+\midrule
+\TOline{unit} {4cm} {distance entre les sommets }
+\TOline{LposA} {180} {angle si label extérieur en A }
+\TOline{LposB} {0 } {angle si label extérieur en B }
+\TOline{Ldist} {0cm} {écart entre le node et le label }
+\TOline{LoopDist} {4cm} {longueur des boucles }
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de créer un graphe probabiliste d'ordre 2. }
+\end{NewMacroBox}
+
+\subsection{Utilisation de \tkzcname{grProb} }
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \useasboundingbox (-2.5,-2) rectangle (7.5,2);
+ \grProb{A}{B}{NO}{SO}{WE}{EA}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\begin{tkzexample}[latex=5cm]
+\begin{tikzpicture}[scale=.5]
+ \useasboundingbox (-2.5,-2) rectangle (5,2);
+ \grProb[unit=4]{\Rain}{\Sun}{0,4}{0,3}{0,6}{0,7}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+
+
+
+\subsection{\tkzcname{grProb} et le style par défaut }
+\begin{center}
+\begin{tkzexample}[latex=5cm]
+\begin{tikzpicture}[scale=.5]
+ \useasboundingbox (-2.5,-2) rectangle (5,2);
+ \grProb{A}{B}{0,8}{0,6}{0,2}{0,4}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{\tkzcname{grProb} et le style « Simple »}
+\begin{center}
+\begin{tkzexample}[latex=5cm]
+\begin{tikzpicture}[scale=.5]
+\useasboundingbox (-2.5,-2) rectangle (5,2);
+\SetVertexSimple
+\grProb[Ldist=0.2cm]{Paris}{Lyon}%
+ {\scriptstyle\dfrac{2}{3}}{\scriptstyle\dfrac{3}{4}}%
+ {\scriptstyle\dfrac{1}{3}}{\scriptstyle\dfrac{1}{4}}%
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Utilisation d'un style personnalisé}
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \useasboundingbox (-2.5,-2.5) rectangle (7.5,2.5);
+ \tikzset{VertexStyle/.style = {shape = circle,
+ shading = ball,
+ ball color = Orange,
+ minimum size = 20pt,
+ draw,color=white}}
+ \tikzset{LabelStyle/.style = {draw,color=orange,fill=white}}
+ \tikzset{EdgeStyle/.style = {->, thick,
+ double = orange,
+ double distance = 1pt}}
+
+\grProb[Ldist=0.1cm,LposA=0,LposB=180]%
+ {Paris}{Lyon}%
+ {\scriptstyle\dfrac{2}{3}}{\scriptstyle\dfrac{3}{4}}%
+ {\scriptstyle\dfrac{1}{3}}{\scriptstyle\dfrac{1}{4}}%
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\vfill
+\newpage
+\subsection{La macro \tkzcname{grProbThree}}
+
+\begin{NewMacroBox}{grProbThree}{\oarg{local options} \var{right} \var{up}\var{down} \var{rr/ru/rd}\var{uu/ud/ur}\var{dd/dr/du}}
+
+\begin{tabular}{llc}
+Arguments & & Définition \\
+\midrule
+\TAline{Vertex-right} {}{Nom du sommet à droite}
+\TAline{Vertex-up} {}{Nom du sommet en haut}
+\TAline{Vertex-down} {}{Nom du sommet en bas}
+\TAline{rr/ru/rd} {}{arête partant de r vers r etc\dots}
+\TAline{uu/ud/ur} {}{arête partant de u vers u etc\dots}
+\TAline{dd/dr/du} {}{arête partant de d vers d etc\dots}
+\bottomrule
+\end{tabular}
+
+\medskip
+\begin{tabular}{llc}
+Options & Défaut & Définition \\
+\midrule
+\TOline{unit} {4cm} {distance entre les sommets }
+\TOline{LposA} {180} {angle si label extérieur en A }
+\TOline{LposB} {0 } {angle si label extérieur en B }
+\TOline{Ldist} {0cm} {écart entre le node et le label }
+\TOline{LoopDist} {4cm} {longueur des boucles }
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de créer un graphe probabiliste d'ordre 3. }
+\end{NewMacroBox}
+
+\subsubsection{Graphe probabiliste d'ordre 3}
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}[scale=.75]
+ \tikzset{LabelStyle/.style = {draw,fill=white}}
+ \grProbThree[unit=4]{\Rain}{\Sun}{\Cloud}
+ {0.1/0.3/0.6}{0.2/0.3/0.5}{0.25/0.35/0.4}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-prob.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-style.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-style.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-style.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,848 @@
+\section{Modification des styles des sommets}
+
+Différentes méthodes sont possibles mais il faut distinguer une utilisation globale ou locale.
+
+Les trois principaux styles sont \tkzname{VertexStyle}, \tkzname{EdgeStyle} et \tkzname{LabelStyle}. Le dernier est attaché aux étiquettes que peuvent avoir les arêtes.
+
+\begin{enumerate}
+\item \tkzcname{GraphInit} permet de choisir un style prédfini et il est possible de retoucher ces styles en modifiant les valeurs choisies par défaut.
+\item Les styles des sommets, des arêtes et étiquettes peuvent être personnalisés avec \tkzname{VertexStyle}, \tkzname{EdgeStyle} et \tkzname{LabelStyle}. On peut redéfinir ces styles avec \tkzcname{tikzset\{VertexStyle/.append style = \{ ... \}\}} ou bien \tkzcname{tikzset\{VertexStyle/.style = \{ ... \}\}}. La première méthode modifie un style existant alors que la seconde définit un style .
+\item On peut utiliser les anciennes macros : \tkzcname{SetVertexSimple}, \tkzcname{SetVertexNormal}, \tkzcname{SetUpVertex} et \tkzcname{SetUpEdge} .
+
+\end{enumerate}
+
+\medskip
+Il est possible de mélanger tout cela en sachant que la dernière définition d'un style l'emporte.
+
+\medskip
+\begin{NewMacroBox}{GraphInit}{\oarg{local options}}
+\begin{tabular}{llc}
+Options & Défaut & Définition \\ \midrule
+\TOline{vstyle} {Normal} {} \bottomrule
+\end{tabular}
+
+\medskip
+Les possibilités pour \tkzname{vstyle} sont :
+
+\begin{enumerate}
+ \item Empty,
+ \item Hasse,
+ \item Simple,
+ \item Classic,
+ \item Normal,
+ \item Shade,
+ \item Dijkstra
+ \item Welsh,
+ \item Art,
+ \item Shade Art.
+\end{enumerate}
+
+\emph{Il y a pour le moment 10 styles pré-définis. Il est possible de modifier les valeurs par défaut.}
+\end{NewMacroBox}
+
+
+Utilisation des styles pré-définis
+
+\begin{enumerate}
+\item GraphInit par défaut
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}\EA(A){B}
+ \Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Empty|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+ \begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Empty]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Hasse|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Hasse]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Simple|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+ \begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Simple]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Classic|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Classic]
+ \Vertex[Lpos=-90]{A}
+ \EA[Lpos=-90](A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+ \item GraphInit et \tkzname{|vstyle=Normal|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Classic]
+ \Vertex[Lpos=-90]{Paris}
+ \EA[Lpos=-90](Paris){Berlin}
+ \Edge (Paris)(Berlin)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Shade|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Shade]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Dijkstra|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Dijkstra]
+ \Vertex{A}\EA(A){B}\Edge[label=$7$](A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Welsh|}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Welsh]
+ \Vertex[Lpos=-90]{A}
+ \EA[Lpos=-90](A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Art|}
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Art]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\item GraphInit et \tkzname{|vstyle=Shade Art|}
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Shade Art]
+ \Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+\end{enumerate}
+
+\newpage
+\tkzname{|vstyle|} est basé sur les macros suivantes qui peuvent être redéfinies.
+
+\medskip
+\begin{tabular}{lc}\toprule
+Commandes pour les styles & utilisation \\ \midrule
+|\newcommand*{\VertexInnerSep}{0pt} | &\\
+|\newcommand*{\VertexOuterSep}{0pt} | &\\
+|\newcommand*{\VertexDistance}{3cm} | &\\
+|\newcommand*{\VertexShape}{circle}| &\\
+|\newcommand*{\VertexLineWidth}{0.8pt}| &\\
+|\newcommand*{\VertexLineColor}{black}| &\\
+|\newcommand*{\VertexLightFillColor}{white}| &\\
+|\newcommand*{\VertexDarkFillColor}{black}| &\\
+|\newcommand*{\VertexTextColor}{black}| &\\
+|\newcommand*{\VertexFillColor}{black}| &\\
+|\newcommand*{\VertexBallColor}{orange}| &\\
+|\newcommand*{\VertexBigMinSize}{24pt}| &\\
+|\newcommand*{\VertexInterMinSize}{18pt}| &\\
+|\newcommand*{\VertexSmallMinSize}{12pt}| &\\
+|\newcommand*{\EdgeFillColor}{orange}| &\\
+|\newcommand*{\EdgeArtColor}{orange}| &\\
+|\newcommand*{\EdgeColor}{black}| &\\
+|\newcommand*{\EdgeDoubleDistance}{1pt}| &\\
+|\newcommand*{\EdgeLineWidth}{0.8pt}| &\\ \bottomrule
+\end{tabular}
+
+
+
+\subsection{Modification de \tkzname{vstyle=Art}}
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Art]
+ \renewcommand*{\VertexInnerSep}{8pt}
+ \renewcommand*{\EdgeLineWidth}{3pt}
+ \renewcommand*{\VertexBallColor}{blue!50}
+ \Vertices{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+\vfill
+\newpage
+
+\subsection{Modification du style \tkzname{VertexStyle} par défaut}
+
+Il est possible de redéfinir le style \tkzcname{SetVertexSimple}.
+
+Par défaut :
+
+\begin{tkzltxexample}[]
+\tikzset{VertexStyle/.style = {
+ shape = circle,
+ fill = black,
+ inner sep = 0pt,
+ outer sep = 0pt,
+ minimum size = 8pt,
+ draw]
+\end{tkzltxexample}
+
+maintenant si on utilise ceci :
+
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetVertexSimple
+ \tikzset{VertexStyle/.style = {
+ shape = rectangle,
+ fill = red,%
+ inner sep = 0pt,
+ outer sep = 0pt,
+ minimum size = 10pt,
+ draw}}
+ \SetGraphUnit{3}
+ \Vertex{A}\EA(A){B}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsection{Modification d'un style \tkzname{VertexStyle}}
+
+C'est le style par défaut pour les sommets mais on peut le modifier. Voici quelques exemples utilisés plus tard dans ce document
+
+par défaut :
+
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+\SetGraphUnit{3}
+\tikzset{VertexStyle/.style = {%
+ shape = circle,
+ shading = ball,
+ ball color = Orange,
+ minimum size = 20pt,draw}}
+ \SetVertexNoLabel
+ \Vertex{A}\EA[unit=3](A){B}
+\end{tikzpicture}
+\end{tkzexample}
+
+ ou bien encore:
+
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+\SetGraphUnit{4}
+\tikzset{VertexStyle/.style = {%
+ shape = circle,
+ shading = ball,
+ ball color = green!40!black,%
+ minimum size = 30pt,draw}}
+\SetVertexNoLabel
+\Vertex{A}\EA[unit=3](A){B}
+\end{tikzpicture}
+\end{tkzexample}
+ \vfill
+\newpage
+
+\begin{NewMacroBox}{SetVertexSimple}{\oarg{local options}}
+
+\medskip
+\emph{Il est possible de modifier les styles prédéfinis. La macro \tkzcname{SetVertexSimple} permet d'affiner le style \og Simple \fg des sommets.}
+\begin{tabular}{llc}
+ \toprule
+options & default & definition \\ \midrule
+\TOline{Shape} {\textbackslash VertexShape }{}
+\TOline{MinSize} {\textbackslash VertexSmallMinSize}{}
+\TOline{LineWidth} {\textbackslash VertexLineWidth }{}
+\TOline{LineColor} {\textbackslash VertexLineColor }{}
+\TOline{FillColor} {\textbackslash VertexFillColor }{} \bottomrule
+\end{tabular}
+\end{NewMacroBox}
+
+\medskip
+\subsection{Autre style \tkzcname{SetVertexSimple}}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetVertexSimple[Shape=diamond,
+ FillColor=blue!50]
+ \Vertices[unit=3]{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{\tkzcname{SetVertexSimple}, \tkzname{inner sep} et \tkzname{outer sep}}
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+\SetGraphUnit{3}
+\SetVertexSimple[MinSize = 12pt,
+ LineWidth = 4pt,
+ LineColor = red,%
+ FillColor = blue!60]
+\tikzset{VertexStyle/.append style =
+ {inner sep = 0pt,%
+ outer sep = 2pt}}
+\Vertices{circle}{A,B,C,D,E}
+\Edges(A,B,C,D,E,A,C,E,B,D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\vfill
+\newpage
+\begin{NewMacroBox}{SetVertexNormal}{\oarg{local options}}
+\begin{tabular}{llc}
+Options & Défaut & Définition \\ \midrule
+\TOline{color} {\textbackslash EdgeColor } {}
+\TOline{label} {no default } {}
+\TOline{labelstyle} {no default } {}
+\TOline{labeltext} {\textbackslash LabelTextColor } {}
+\TOline{labelcolor} {\textbackslash LabelFillColor } {}
+\TOline{style} {no default } {}
+\TOline{lw} {\textbackslash EdgeLineWidth } {}
+ \bottomrule
+\end{tabular}
+
+\medskip
+\emph{Macro semblable à la précédente.}
+\end{NewMacroBox}
+
+\subsection{Autre style \tkzcname{SetVertexNormal}}
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \SetVertexNormal[Shape = rectangle,%
+ LineWidth = 2pt,%
+ FillColor = green!50]
+ \Vertices{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+\vfill\newpage
+\begin{NewMacroBox}{SetUpVertex}{\oarg{local options}}
+\begin{tabular}{llc}
+Options & Défaut & Définition \\ \midrule
+\TOline{Lpos} {-90 } {position label externe }
+\TOline{Ldist} {0cm } {distance du label }
+\TOline{style} {{} } {permet d'affiner le style }
+\TOline{NoLabel} {false} {supprime le label }
+\TOline{LabelOut}{false} {Label externe } \bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de modifier les options précédentes. }
+\end{NewMacroBox}
+
+\subsection{\tkzcname{SetUpVertex}}
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \SetUpVertex[Lpos=-60,LabelOut]
+ \Vertex{A}\EA(A){B}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsection{\tkzcname{SetUpVertex} et \tkzcname{tikzset}}
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+\SetGraphUnit{4}
+\SetVertexLabel
+\SetUpVertex[Lpos=-60,LabelOut]
+\tikzset{VertexStyle/.append style =
+ {outer sep = .5\pgflinewidth}}
+\renewcommand*{\VertexLineWidth}{6pt}
+\Vertex{A}\EA(A){B}\Edge(A)(B)
+\end{tikzpicture}
+\end{tkzexample}
+
+\vfill\newpage
+\section{Modification des styles des arêtes}
+
+\subsection{Utilisation de l'option \tkzname{style} de la macro \tkzcname{Edge}}
+
+\subsubsection{Exemple 1}
+\begin{tkzexample}[latex=8cm, small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \Vertex{e}
+ \EA(e){f}
+ \Edge(f)(e)
+ \Edge[style={bend left}](f)(e)
+ \Edge[style={bend right}](f)(e)
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Exemple 2}
+\begin{tkzexample}[latex=8cm, small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \Vertex{e}
+ \EA(e){f}
+ \Edge[style={->,bend left}](f)(e)
+ \Edge[style={<-,bend right}](f)(e)
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Exemple 3}
+\begin{tkzexample}[latex=8cm, small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \Vertex{a}
+ \EA(a){b}
+ \NO(b){c}
+ \SetUpEdge[style={->,bend right,ultra thick},
+ color=red]
+ \Edge(a)(b)
+ \Edge(b)(c)
+ \Edge(c)(a)
+\end{tikzpicture}
+\end{tkzexample}
+
+\newpage
+\subsection{Modification des styles par défaut \tkzcname{SetUpEdge}}
+
+Cette macro a une action globale et permet de rédéfinir un style.
+
+\begin{NewMacroBox}{SetUpEdge}{\oarg{local options}}
+\begin{tabular}{llc}
+Options & Défaut & Définition \\
+\midrule
+\TOline{lw} {-90 } {position label externe }
+\TOline{color}{\textbackslash EdgeLineWidth} {position label externe }
+\TOline{label} {0cm } {distance du label }
+\TOline{labelstyle} {{} } {permet d'affiner le style }
+\TOline{labeltext} {false} {supprime le label }
+\TOline{style}{false} {Label externe } \bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de modifier les options précédentes. }
+\end{NewMacroBox}
+
+
+\subsubsection{Utilisation de \tkzcname{SetUpEdge} Exemple 1}
+\begin{center}
+{ \tikzset{VertexStyle/.style = {shape = circle,
+ draw = black,
+ fill = orange,
+ inner sep = 2pt,
+ outer sep = 0.5pt,
+ minimum size = 6mm,
+ line width = 1pt}}
+ \tikzset{every to/.style = {line width = 2pt,
+ color = orange}}
+\begin{tkzexample}[vbox]
+ \begin{tikzpicture}
+ \SetGraphUnit{4} \SetUpEdge[lw=3pt]
+ \Vertex{A}
+ \EA (A){B} \NO (B){C}
+ \SO (B){D} \EA (B){E}
+ \Edges(A,B,C,A,D,E,C)
+ \end{tikzpicture}
+\end{tkzexample}
+}
+\end{center}
+
+
+\subsubsection{Utilisation de \tkzcname{SetUpEdge} Exemple 2}
+{ \tikzset{VertexStyle/.style = {
+ shape = circle,
+ draw = black,
+ fill = orange,
+ inner sep = 2pt,
+ outer sep = 1pt,
+ minimum size = 6mm,
+ line width = 2pt}}
+\begin{tkzexample}[latex=7cm]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \SetUpEdge[lw=1.5pt]
+ \Vertex{A}
+ \EA(A){B} \WE(A){C} \NO(A){D}
+ \SO(A){E} \NOEA(A){F} \NOWE(A){G}
+ \SOEA(A){H} \SOWE(A){I}
+ \foreach \v in {B,C,D,E,F,G,H,I}{%
+ \Edge(A)(\v)}
+ \end{tikzpicture}
+\end{tkzexample} }
+
+\subsection{Arête avec label \tkzname{LabelStyle}}
+
+
+\begin{tkzexample}[latex=7cm, small]
+\begin{tikzpicture}
+ \SetGraphUnit{4}
+ \tikzset{VertexStyle/.style =
+ {draw,
+ shape = circle,
+ shading = ball,
+ ball color = green!40!black,
+ minimum size = 24pt,
+ color = white}}
+ \tikzset{EdgeStyle/.style =
+ {->,bend right,
+ thick,
+ double = orange,
+ double distance = 1pt}}
+ \Vertex{a}
+ \EA(a){b}
+ \NO(b){c}
+ \tikzset{LabelStyle/.style =
+ {fill=white}}
+ \Edge[label=$1$](a)(b)
+ \Edge[label=$2$](b)(c)
+ \Edge[label=$3$](c)(a)
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsection{Utiliser un style intermédiaire}
+
+\begin{tkzltxexample}[]
+ \SetGraphUnit{4}
+ \tikzset{VertexStyle/.style = {shape = circle,
+ shading = ball,
+ ball color = Maroon!50,
+ minimum size = 24pt,
+ draw}}
+ \tikzset{TempEdgeStyle/.style = {ultra thick,
+ double = Maroon!50,
+ double distance = 2pt}}
+ \tikzset{LabelStyle/.style = {color = brown,
+ text=black}}
+\end{tkzltxexample}
+
+
+\begin{center}
+ \SetGraphUnit{4}
+ \tikzset{VertexStyle/.style = {shape = circle,
+ shading = ball,
+ ball color = Maroon!50,
+ minimum size = 24pt,
+ draw}}
+ \tikzset{TempEdgeStyle/.style = {ultra thick,
+ double = Maroon!50,
+ double distance = 2pt}}
+ \tikzset{LabelStyle/.style = {color = brown,
+ text=black}}
+\begin{tkzexample}[latex=7cm, small]
+\begin{tikzpicture}[scale=.8]
+ \Vertex{A}
+ \EA(A){B} \EA(B){C}
+ \SetGraphUnit{8}
+ \NO(B){D}
+ \tikzset{EdgeStyle/.style = {TempEdgeStyle}}
+ \Edge[label=1](B)(D)
+ \tikzset{EdgeStyle/.style = {TempEdgeStyle,bend left}}
+ \Edge[label=4](A)(B) \Edge[label=5](B)(A)
+ \Edge[label=6](B)(C) \Edge[label=7](C)(B)
+ \Edge[label=2](A)(D) \Edge[label=3](D)(C)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\vfill\newpage
+
+\section{Changement de couleurs dans les styles prédéfinis}
+Trois macros sont proposées
+
+\subsection{\tkzcname{SetGraphShadeColor}}
+\begin{NewMacroBox}{SetGraphShadeColor}{\var{ball color}\var{color}\var{double}}
+\emph{\tkzcname{SetGraphShadeColor} permet de modifier les couleurs pour le style \tkzname{Shade}.}
+\end{NewMacroBox}
+
+\subsubsection{Exemple}
+Cet exemmple utilise une macrio de \tkzname{tkz-berge}\NamePack{tkz-berge}
+\begin{center}
+\begin{tkzexample}[latex=7cm]
+ \begin{tikzpicture}
+ \GraphInit[vstyle=Shade]
+ \SetGraphUnit{4}
+ \SetVertexNoLabel
+ \SetGraphShadeColor{red!50}{black}{red}
+ \Vertices{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+ \end{tikzpicture}
+\end{tkzexample}
+
+\end{center}
+
+\newpage
+\subsection{\tkzcname{SetGraphArtColor}}
+\begin{NewMacroBox}{SetGraphArtColor}{\var{ball color}\var{color}}
+\emph{\tkzcname{SetGraphArtColor} permet de modifier les couleurs pour le style \tkzname{Art}.}
+\end{NewMacroBox}
+
+\subsubsection{Exemple}
+\begin{center}
+ \begin{tkzexample}[vbox]
+ \begin{tikzpicture}
+ \SetVertexArt
+ \SetGraphArtColor{green!40!black}{magenta}
+ \SetGraphUnit{4}
+ \SetVertexNoLabel
+ \Vertices{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+ \end{tikzpicture}
+ \end{tkzexample}
+\end{center}
+
+
+\vfill\newpage
+\subsection{\tkzcname{SetGraphColor}}
+\begin{NewMacroBox}{SetGraphColor}{\var{fill color}\var{color}}
+\emph{\tkzcname{SetGraphColor} permet de modifier les couleurs pour le style \tkzname{Normal}.}
+\end{NewMacroBox}
+
+
+\subsubsection{Exemple avec \tkzcname{SetGraphColor}}
+\begin{center}
+ \begin{tkzexample}[vbox]
+ \begin{tikzpicture}
+ \SetGraphColor{yellow}{blue}
+ \SetGraphUnit{4}
+ \SetVertexNoLabel
+ \Vertices{circle}{A,B,C,D,E}
+ \Edges(A,B,C,D,E,A,C,E,B,D)
+ \end{tikzpicture}
+ \end{tkzexample}
+\end{center}
+
+
+
+\newpage
+
+\subsection{Variation I autour des styles}
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetVertexNormal[Shape = circle,
+ FillColor = orange,
+ LineWidth = 2pt]
+ \SetUpEdge[lw = 1.5pt,
+ color = black,
+ labelcolor = white,
+ labeltext = red,
+ labelstyle = {sloped,draw,text=blue}]
+ \Vertex[x=0 ,y=0]{K}
+ \Vertex[x=0 ,y=2]{F}
+ \Vertex[x=-1,y=4]{D}
+ \Vertex[x=3 ,y=7]{H}
+ \Vertex[x=8 ,y=5]{B}
+ \Vertex[x=9 ,y=2]{N}
+ \Vertex[x=5 ,y=0]{M}
+ \Vertex[x=3 ,y=1]{S}
+ \tikzset{EdgeStyle/.append style = {bend left}}
+ \Edge[label = $120$](K)(F)
+ \Edge[label = $650$](H)(S)
+ \Edge[label = $780$](H)(M)
+ \Edge[label = $490$](D)(B)
+ \Edge[label = $600$](D)(M)
+ \Edge[label = $580$](B)(M)
+ \Edge[label = $600$](H)(N)
+ \Edge[label = $490$](F)(H)
+ \tikzset{EdgeStyle/.append style = {bend right}}
+ \Edge[label = $630$](S)(B)
+ \Edge[label = $210$](S)(N)
+ \Edge[label = $230$](S)(M)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+\subsection{Variation II autour des styles}
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetVertexNormal[Shape = circle,
+ FillColor = orange,
+ LineWidth = 2pt]
+ \SetUpEdge[lw = 1.5pt,
+ color = black,
+ labelcolor = white,
+ labeltext = red,
+ labelstyle = {sloped,draw,text=blue}]
+ \tikzstyle{EdgeStyle}=[bend left]
+ \Vertex[x=0, y=0]{G}
+ \Vertex[x=0, y=3]{A}
+ \Vertex[x=3, y=5]{P}
+ \Vertex[x=4, y=2]{C}
+ \Vertex[x=8, y=3]{Q}
+ \Vertex[x=7, y=0]{E}
+ \Vertex[x=3, y=-1]{R}
+ \Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Variation III autour des styles}
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Shade]
+ \SetGraphUnit{3}
+ \Vertex{e}
+ \NOEA(e){f}\SOEA(e){d}
+ \SOEA(f){h}\NOWE(f){g}
+ \WE(g){c} \SOWE(e){a} \SOWE(c){b}
+ \tikzstyle{LabelStyle}=[fill=white]
+ \tikzstyle{EdgeStyle}=[color=red]
+ \Edge[label=$3$](a)(b)
+ \Edge[label=$11$](a)(c)
+ \Edge[label=$6$](a)(e)
+ \Edge[label=$17$](a)(d)
+ \Edge[style={pos=.25},label=$20$](a)(g)
+ \Edge[label=$5$](c)(b)
+ \Edge[label=$6$](c)(e)
+ \Edge[label=$7$](c)(g)
+ \Edge[label=$7$](f)(e)
+ \Edge[label=$3$](d)(e)
+ \Edge[label=$9$](d)(h)
+ \Edge[label=$6$](g)(e)
+ \Edge[style={bend left,out=45,in=135},label=$11$](g)(h)
+ \Edge[label=$4$](f)(h)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Variation IV autour des styles}
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+ \SetUpEdge[lw = 1.5pt,
+ color = orange,
+ labelcolor = gray!30,
+ labelstyle = {draw}]
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Normal]
+ \Vertex{P}
+ \NOEA(P){B}
+ \SOEA(P){M}
+ \NOEA(B){D}
+ \SOEA(B){C}
+ \SOEA(C){L}
+ \tikzset{EdgeStyle/.style={->}}
+ \Edge[label=$3$](C)(B)
+ \Edge[label=$10$](D)(B)
+ \Edge[label=$10$](L)(M)
+ \Edge[label=$10$](B)(P)
+ \tikzset{EdgeStyle/.style={<->}}
+ \Edge[label=$4$](P)(M)
+ \Edge[label=$9$](C)(M)
+ \Edge[label=$4$](C)(L)
+ \Edge[label=$5$](C)(D)
+ \Edge[label=$10$](B)(M)
+ \tikzset{EdgeStyle/.style={<->,relative=false,in=0,out=60}}
+ \Edge[label=$11$](L)(D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Variation V autour des styles}
+
+\begin{center}
+\begin{tkzexample}[vbox]
+\begin{tikzpicture}
+
+ \SetUpEdge[lw = 1.5pt,
+ color = orange,
+ labelcolor = white]
+ \GraphInit[vstyle=Normal] \SetGraphUnit{3}
+ \tikzset{VertexStyle/.append style={fill = red!50}}
+ \Vertex{P}
+ \NOEA(P){B} \SOEA(P){M} \NOEA(B){D}
+ \SOEA(B){C} \SOEA(C){L}
+ \tikzset{EdgeStyle/.style={->}}
+ \Edge[label=$3$](C)(B)
+ \Edge[label=$10$](D)(B)
+ \Edge[label=$10$](L)(M)
+ \Edge[label=$10$](B)(P)
+ \tikzset{EdgeStyle/.style={<->}}
+ \Edge[label=$4$](P)(M)
+ \Edge[label=$9$](C)(M)
+ \Edge[label=$4$](C)(L)
+ \Edge[label=$5$](C)(D)
+ \Edge[label=$10$](B)(M)
+ \tikzset{EdgeStyle/.style={<->,relative=false,in=0,out=60}}
+ \Edge[label=$11$](L)(D)
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-style.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertex.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertex.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,242 @@
+\section{Vertex}
+%<------------------------------------------------------------------------>
+C'est bien évidemment la macro essentielle qui permet de placer des sommets. Les sommets peuvent être placés avec un système de coordonnées rectangulaires ou bien polaires ou encore relativement les uns par rapport aux autres. Quelques dispositions particulières sont également possibles.
+
+\subsection{\tkzcname{Vertex}}
+\begin{NewMacroBox}{Vertex}{\oarg{local options}\var{Name}}
+Un sommet se caractérise par~:
+\begin{itemize}
+\item sa référence,
+\item sa position,
+\item son label,
+\item et le style.
+\end{itemize}
+
+\medskip
+Un argument non vide \IargName{Vertex}{Name} est obligatoire. Cet argument définit le nom de référence du node. C'est celui que l'on doit utiliser dans toute création de sommet (\tkzcname{Vertex}) Il ne faut pas le confondre avec le \tkzname{label} (étiquette) qui sera utilisé pour l'affichage.
+On peut vouloir afficher $M_1$ alors que le nom lui sera $M1$.
+
+\medskip
+Des options sont utilisées pour définir les quatre premières caractéristiques. Les styles texte et graphique sont traités séparément.
+
+\medskip
+\begin{tabular}{llc}
+\midrule
+Options & Défaut & Définition \\
+\midrule
+\TOline{x} {\{\}}{abscisse}
+\TOline{y} {\{\}}{ordonnée}
+\TOline{a} {\{\}}{angle}
+\TOline{d} {\{\}}{distance}
+\TOline{Node} {false}{utilisation d'une référence déjà définie}
+\TOline{position} {\{\}}{style qui permet un positionnement relatif }
+\TOline{dir} {\textbackslash EA}{direction pour un positionnement relatif }
+\midrule
+\TOline{empty} {false}{booléen permettant de ne pas afficher le sommet}
+\midrule
+\TOline{NoLabel} {false}{booléen supprime le label}
+\TOline{LabelOut}{false}{booléen Label extérieur au node}
+\TOline{L} {\{\}}{Le label}
+\TOline{Math} {false}{booléen qui affiche le label en mode math}
+\TOline{Ldist} {0cm }{distance du label au node}
+\TOline{Lpos} {0 }{position du label par rapport au node}
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{Cette macro permet de définir un sommet qui a un nom \tkzname{name} et un label.\\
+Si \tkzname{L}$=${} alors \tkzname{label} = \tkzname{Name} sinon \tkzname{label} = \tkzname{L}.}
+\end{NewMacroBox}
+
+\subsubsection{Utilisation de coordonnées cartésiennes}
+\tkzcname{Vertex[x=\meta{number},y=\meta{number}]\var{name}}. Coordonnées cartésiennes $x$ et $y$.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Normal]
+ \draw[help lines] (0,0) grid (2,2);
+ \Vertex{A} % par défaut x = 0 et y = 0
+ \Vertex[x=2 , y=0]{B} \Vertex[x=2 , y=2]{C}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Utilisation de coordonnées polaires}
+
+ \tkzcname{Vertex[a=\meta{number},d=\meta{number}]\var{vertex}} Les coordonnées polaires peuvent être aussi utilisées. J'ai utilisé une grille d'aide afin de constater le placement du sommet.
+
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Normal]
+ \draw[help lines] (-2,0) grid (2,2);
+ \draw[red] (2,0) arc (0:180: 2 cm);
+ \Vertex{A}
+ \Vertex[a=45 , d=2 cm]{B}
+ \Vertex[a=135 , d=2 cm]{C}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+
+
+
+\subsubsection{Option \tkzname{Node} : utilisation d'une position référencée}
+Cette option permet de placer un sommet sur un Node déjà défini ou bien
+ un objet du type \og~coordinate~\fg.
+ % pb taile du node pour M ??
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Normal]
+ \draw[help lines] (0,0) grid (2,2);
+ \Vertex{A} \Vertex[x=2 , y=2]{B}
+ \coordinate (M) at ($ (A)!.5!(B) $){};
+ \Vertex[Node]{M}
+\end{tikzpicture}
+\end{tkzexample}
+
+\vfill
+%<------------------------------------------------------------------------–>
+% ShortCuts
+%<------------------------------------------------------------------------–>
+
+\newpage
+\subsection{Raccourcis pour placement relatif}
+
+Pour effectuer des placements relatifs, il est nécessaire de définir une distance unité entre deux sommets. La macro suivante permet de définir cette distance.
+
+\begin{NewMacroBox}{SetGraphUnit}{\var{nombre}}
+\emph{Cette macro permet de définir la distance entre deux sommets. La distance se réfère aux centres de ces sommets et le nombre est exprimé en \tkzname{cm}. Par défaut, l'unité est $1$ cm.}
+
+utilisation :\tkzcname{SetGraphUnit\{2\}}
+\end{NewMacroBox}
+
+\begin{NewMacroBox}{ShortCut}{\oarg{local options}\varp{vertex A}\var{vertex B}}
+Ces raccourcis permettent de créer un \tkzname{vertex B} relativement à un
+\tkzname{vertex A}. La distance entre les deux sommets est déterminé par la valeur de \tkzname{unit} et par les unités de \TIKZ. Horizontalement et verticalement la distance est définie par \tkzname{unit}$\times$\tkzname{x} et
+\tkzname{unit}$\times$\tkzname{y}. La valeur de \tkzname{unit} peut être redéfinie par la macro \tkzcname{SetGraphUnit} ou bien avec l'option \tkzname{unit}. Avec l'option la définition est locale; avec la macro, la définition est globale mais elle peut être locale si elle est intervient dans un goupe \TEX ou un environnement \tkzname{scope}.
+Les raccourcis sont :
+
+\medskip
+\begin{tabular}{lll}
+\hline
+Raccourcis & & Définition \\
+\midrule
+\TMline{EA} {} {à l'est }
+\TMline{WE} {} {à l'ouest}
+\TMline{NO} {} {au nord}
+\TMline{SO} {} {au sud}
+\TMline{NOEA} {} {au nord-est soit "nord" puis "est"}
+\TMline{NOWE} {} {au nord-ouest soit "nord" puis "ouest" }
+\TMline{SOEA} {} {au sud-est soit "sud" puis "est"}
+\TMline{SOWE} {} {au sud-ouest soit "sud" puis "ouest"}
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{\tkzcname{NOEA} est un raccourci pour \tkzcname{NO}\tkzcname{EA}. par défaut, la distance entre les sommets avec ce raccourci est $\sqrt{2}\times$ \tkzname{unit}=$\sqrt{2}$. Les options sont celles de la macro \tkzcname{Vertex}. }
+\end{NewMacroBox}
+
+Nous allons d'abord modifier la distance entre deux noeuds d'une façon générale avec \tkzcname{SetGraphUnit\{2\}} sinon par défaut \tkzname{unit =1}.
+
+\subsubsection{Utilisation des raccourcis avec les valeurs par défaut}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (-1,-1) grid (1,1);
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}
+ \EA(A){B} \WE(A){C} \NO(A){D} \SO(A){E}
+ \NOEA(A){F} \NOWE(A){G} \SOEA(A){H} \SOWE(A){I}
+ \foreach \v in {B,C,D,E,F,G,H,I}{\Edge(A)(\v)}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsubsection{Modification de l'unité avec \tkzcname{SetGraphUnit }}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (-2,-2) grid (2,2);
+ \SetGraphUnit{2}
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}
+ \EA(A){B} \WE(A){C} \NO(A){D} \SO(A){E}
+ \NOEA(A){F} \NOWE(A){G} \SOEA(A){H} \SOWE(A){I}
+ \foreach \v in {B,C,D,E,F,G,H,I}{\Edge(A)(\v)}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Modification des unités de \TIKZ\ : \tkzname{x=2 cm,y=1 cm} }
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}[x=2 cm,y=1 cm]
+ \draw[help lines] (-1,-1) grid (1,1);
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}
+ \EA(A){B} \WE(A){C} \NO(A){D} \SO(A){E}
+ \NOEA(A){F} \NOWE(A){G} \SOEA(A){H} \SOWE(A){I}
+ \foreach \v in {B,C,D,E,F,G,H,I}{\Edge(A)(\v)}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsubsection{Exemple classique}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (-2,-2) grid (4,2);
+ \SetGraphUnit{2}
+ \coordinate (O) at (0,0);
+ \NOEA(O){A} \NOWE(O){B} \SOEA(O){D}
+ \SOWE(O){C} \NOEA(D){E}
+ \Edges(B,C,D,A,E,D,B,A,C)
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Autre exemple classique}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (0,-2) grid (4,2);
+ \SetGraphUnit{2}
+ \GraphInit[vstyle=Normal]
+ \Vertex{A}
+ \EA(A){B} \NO(B){C} \SO(B){D} \EA(B){E}
+ \Edges(A,B,C,A,D,E,C)
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsubsection{Modication locale de \tkzname{unit} avec l'option}
+Le plus simple :
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (0,0) grid (2,3);
+ \SetGraphUnit{2}
+ \Vertex{A} \EA(A){B}
+ \NO[unit=3](B){C}
+ \NO(A){D}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsubsection{Modication locale de \tkzname{unit} avec l'environnement \tkzname{scope}}
+\begin{tkzexample}[latex=7cm,small]
+ \begin{tikzpicture}
+ \draw[help lines] (0,0) grid (2,3);
+ \SetGraphUnit{2}
+ \Vertex{A} \EA(A){B}
+ \begin{scope}
+ \SetGraphUnit{3} \NO(B){C}
+ \end{scope}
+ \NO(A){D}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsubsection{Modication locale de \tkzname{unit} avec un groupe \TEX}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \draw[help lines] (0,0) grid (2,3);
+ \SetGraphUnit{2}
+ \Vertex{A} \EA(A){B}
+ {\SetGraphUnit{3} \NO(B){C}}
+ \NO(A){D}
+\end{tikzpicture}
+\end{tkzexample}
+
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertex.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertices.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertices.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertices.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,172 @@
+\section{Placement de sommets sur une forme géométrique}
+Il s'agit ici de placer un groupe de sommets suivant une direction donnée ou bien encore suivant une forme prédéfinie. Les sommets sont placés avec comme support une figure géométrique simple. La macro principale utilise une direction définie à l'aide de l'option dir, la version étoilée une forme particulière triangulaire, carrée etc...
+
+
+\begin{NewMacroBox}{Vertices}{\oarg{local options}\var{type}\var{List of vertices}}
+\emph{Il y a donc plusieurs types de formes géométriques, droite, triangle, carrés et cercles. La macro \tkzcname{SetGraphUnit} permet de modifier les longueurs. Pour les sommets alignés, ceux-ci sont placés suivant une direction donnée par |EA|, |WE|, |NO|, |SO|, |NOEA|, |NOWE|, |SOEA|, |SOWE|.}
+
+\medskip
+\begin{tabular}{llc}
+ \toprule
+Premier Argument & & Définition \\
+\midrule
+\TAline{line } {} {Sommets alignés, une option détermine la direction}
+\TAline{tr1 } {} {première forme de triangle}
+\TAline{tr2 } {} {deuxième forme de triangle}
+\TAline{tr3 } {} {troisième forme de triangle}
+\TAline{tr4 } {} {quatrième forme de triangle}
+\TAline{square} {} {quatre sommets sur un carré}
+\TAline{circle} {} {sommets sur une cercle}
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{Le second argument est une liste de noms pour les sommets.}
+
+\medskip
+\begin{tabular}{llc}
+\midrule
+Options & Défaut & Définition \\
+\midrule
+\TOline{dir} {EA} {permet de placer plusieurs sommets alignés}
+\bottomrule
+\end{tabular}
+
+\medskip
+\emph{Les options sont celles d'un sommet (Vertex).}
+\end{NewMacroBox}
+
+
+
+\subsection{\tkzcname{Vertices} à partir d'un sommet défini par des coordonnnées}
+
+
+\begin{center}
+\begin{tkzexample}[latex=7cm, ,small]
+\begin{tikzpicture}
+ \SetGraphUnit{2}
+ \draw[help lines] (0,0) grid (5,2);
+ \Vertices[x=1,y=2]{line}{A,B,C}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{\tkzcname{Vertices} à partir d'une position donnée.}
+
+\begin{center}
+\begin{tkzexample}[latex=7cm, ,small]
+\begin{tikzpicture}[rotate=45]
+ \SetGraphUnit{2}
+ \draw[help lines] (0,0) grid (5,2);
+ \coordinate (A) at (1,1);
+ \Vertices[Node]{line}{A,B,C}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+\subsection{Exemples avec une direction }
+ Il s'agit ici de placer une liste de sommets suivant une direction donnée, cette direction est définie à l'aide de l'option \tkzname{dir}.
+
+
+\begin{center}
+\begin{tkzexample}[latex=7cm, ,small]
+\begin{tikzpicture}
+ \GraphInit[vstyle=Art]
+ \Vertices[dir=\NOEA]{line}{A,B,C,D}
+ \Vertices[dir=\NOWE]{line}{A,E,F,G}
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+\subsection{Placement sur un triangle }
+
+Il y a différentes possibilités avec une forme triangulaire, mais les triangles sont isocèles rectangles. Voici dans l'ordre les formes \tkzname{tr1}, \tkzname{tr2} , \tkzname{tr3} et \tkzname{tr4}
+
+
+\begin{tkzexample}[latex=8cm,small]
+\begin{tikzpicture}\SetGraphUnit{2}
+ \Vertices{tr1}{A,B,C}
+\end{tikzpicture}\hspace*{2cm}
+\begin{tikzpicture}\SetGraphUnit{2}
+ \Vertices{tr2}{A,B,C}
+\end{tikzpicture}
+\end{tkzexample}
+
+\begin{tkzexample}[latex=8cm,small]
+\begin{tikzpicture}\SetGraphUnit{2}
+ \Vertices{tr3}{A,B,C}
+\end{tikzpicture}\hspace*{2cm}
+\begin{tikzpicture}\SetGraphUnit{2}
+ \Vertices{tr4}{A,B,C}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsection{Utilisation d'un carré}
+
+
+Deux autres possibilités de placer un node. La première utilise un node obtenu à l'aide d'une intersection (voir le pgfmanual). Dans la première, j'ai redéfini la distance unité entre deux sommets à l'aide de \tkzcname{SetGraphUnit}.
+
+\begin{center}
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetGraphUnit{3}
+ \GraphInit[vstyle=Shade]
+ \Vertices{square}{A,B,C,D}
+ \coordinate (E) at (intersection of A--C and B--D);
+ \Vertex[Node]{E}% voir option node
+\end{tikzpicture}
+\end{tkzexample}
+\end{center}
+
+
+\subsection{Utilisation d'un cercle }
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}
+ \SetGraphUnit{2}
+ \Vertices{circle}{A,B,C,D}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+\subsection{Utilisation d'un cercle et positionnement des labels }
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture} \SetGraphUnit{2}
+ \GraphInit[vstyle=Classic]
+ \Vertices{circle}{A,B,C,D,E,F}
+\end{tikzpicture}
+\end{tkzexample}
+
+
+
+\subsection{Rotation et labels externes }
+
+|Lpos| = \tkzname{angle de la rotation}. Cela permet de faire une rotation du label autour du centre de chaque sommet et de suivre la rotation du graphe. Il suffit pour comprendre cette option de compiler l'exemple en l'omettant.
+
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}[rotate=90]
+ \GraphInit[vstyle=Classic]
+ \Vertices[Lpos=90,unit=2]{circle}{A,B,C,D,E,F}
+\end{tikzpicture}
+\end{tkzexample}
+
+\subsection{Placement sur un cercle }
+
+Avec des labels externes, il faut procéder avec précaution.
+
+\begin{tkzexample}[latex=7cm,small]
+\begin{tikzpicture}[scale=.5]
+ \SetGraphUnit{4}
+ \GraphInit[vstyle=Classic]
+ \begin{scope}[rotate=45]
+ \Vertices[Lpos=45]{circle}{C,E,A,B}
+ \end{scope}
+ \NOEA[Lpos=90,unit=2.828](E){D}
+ \Edges(A,B,E,D,C,E,A,C,B)
+\end{tikzpicture}
+\end{tkzexample}
+\endinput
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/doc/latex/TKZdoc-gr-vertices.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf 2021-01-21 22:08:31 UTC (rev 57483)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf 2021-01-21 22:11:01 UTC (rev 57484)
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.tex 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,12 @@
+\documentclass[border=3mm]{standalone}
+\usepackage{tkz-graph}
+\begin{document}
+\begin{tikzpicture}[scale=1.75]
+ \GraphInit[vstyle=Art]
+ \Vertex{A}
+ \Vertex[x=4,y=0]{B}
+ \Vertex[x=1,y=2]{C}
+ \Edge[style={bend left}](B)(A)
+ \Edges(A,B,C,A)
+\end{tikzpicture}
+\end{document}
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/test-graph.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf 2021-01-21 22:08:31 UTC (rev 57483)
+++ trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf 2021-01-21 22:11:01 UTC (rev 57484)
Property changes on: trunk/Master/texmf-dist/doc/latex/tkz-graph/tkz-graph-screen.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tkz-graph/tkz-graph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tkz-graph/tkz-graph.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tkz-graph/tkz-graph.sty 2021-01-21 22:11:01 UTC (rev 57484)
@@ -0,0 +1,1026 @@
+% tkz-graph.sty v2.0
+% Copyright 2021 Alain Matthes
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status “maintained”.
+%
+% The Current Maintainer of this work is Alain Matthes.
+
+%<--------------------------------------------------------------------------->
+% Objet : Création de graphes
+%<--------------------------------------------------------------------------->
+\def\fileversion{2.00}
+\def\filedate{2021/01/20}
+\typeout{2021/01/20 v 2.00 tkz-graph.sty}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tkz-graph}[2021/01/20 2.00 base for graphs]
+%<--------------------------------------------------------------------------->
+
+\ifx\e at alloc\@undefined
+\RequirePackage{etex}
+\fi
+\RequirePackage{ifthen}
+\RequirePackage{xkeyval}
+\RequirePackage{tikz}
+\usetikzlibrary{arrows}
+%<--------------------------------------------------------------------------->
+% todo remove some counters
+\newcounter{tkz at gr@a}
+\newcounter{tkz at gr@b}
+\newcounter{tkz at gr@c}
+\newcounter{tkz at gr@e}
+\newcounter{tkz at gr@d}
+\newcounter{tkz at gr@p}
+\newcounter{tkz at gr@i}
+\newcounter{tkz at gr@n}
+\newcounter{tkz at gr@ta}
+\newcounter{tkz at gr@tb}
+%<--------------------------------------------------------------------------->
+% Init vertex
+%<--------------------------------------------------------------------------->
+%<--------------------------------------------------------------------------->
+\def\tkz at gr@background at color{white}
+\def\tkz at gr@text at color{black}
+\global\edef\tkz at suc@bkc{\tkz at gr@background at color}
+\global\edef\tkz at suc@txt{\tkz at gr@text at color}
+\pgfkeys{
+/tkzsupcol/.cd,
+ background/.code = {\global\edef\tkz at suc@bkc{#1}},
+ text/.code = {\global\edef\tkz at suc@txt{#1}},
+}
+\def\tkzSetUpColors{\pgfutil at ifnextchar[{\tkz at SetUpColors}{\tkz at SetUpColors[]}}
+\def\tkz at SetUpColors[#1]{%
+\begingroup
+\pgfkeys{%
+/tkzsupcol/.cd,
+ background = \tkz at gr@background at color,
+ text = \tkz at gr@text at color
+ }
+\pgfqkeys{/tkzsupcol}{#1}
+\pagecolor{\tkz at suc@bkc}
+\color{\tkz at suc@txt}
+\endgroup
+}
+
+\newcommand*{\GraphUnit}{1}
+\newcommand*{\VertexInnerSep}{2pt}
+\newcommand*{\VertexOuterSep}{0pt}
+\newcommand*{\VertexDistance}{3cm}
+\newcommand*{\VertexShape}{circle}
+\newcommand*{\VertexLineWidth}{0.5pt}
+\newcommand*{\VertexLineColor}{\tkz at suc@txt}
+\newcommand*{\VertexLightFillColor}{\tkz at suc@bkc}
+\newcommand*{\VertexDarkFillColor}{\tkz at suc@txt}
+\newcommand*{\VertexTextColor}{\tkz at suc@txt}
+\newcommand*{\VertexFillColor}{\tkz at suc@txt}
+\newcommand*{\VertexBallColor}{orange}
+\newcommand*{\VertexBigMinSize}{24pt}
+\newcommand*{\VertexInterMinSize}{18pt}
+\newcommand*{\VertexSmallMinSize}{12pt}
+\newcommand*{\EdgeFillColor}{orange}
+\newcommand*{\EdgeArtColor}{orange}
+\newcommand*{\EdgeColor}{\tkz at suc@txt}
+\newcommand*{\EdgeDoubleDistance}{1pt}
+\newcommand*{\EdgeLineWidth}{0.8pt}
+\newcommand*{\LabelTextColor}{\tkz at suc@txt}
+\newcommand*{\LabelFillColor}{\tkz at suc@bkc}
+
+\tikzset{pre/.style={<-,shorten <=1pt,>=stealth',semithick}}
+\tikzset{post/.style={->,shorten <=1pt,>=stealth',semithick}}
+%<--------------------------------------------------------------------------->
+% Simple Vertex
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {SVS} {Shape}{}
+\define at cmdkey [GR] {SVS} {MinSize}{}
+\define at cmdkey [GR] {SVS} {LineWidth}{}
+\define at cmdkey [GR] {SVS} {LineColor}{}
+\define at cmdkey [GR] {SVS} {FillColor}{}
+\define at cmdkey [GR] {SVS} {InnerSep}{}
+\define at cmdkey [GR] {SVS} {OuterSep}{}
+\presetkeys [GR] {SVS} {Shape = \VertexShape,
+ MinSize = \VertexSmallMinSize,
+ LineWidth = \VertexLineWidth,
+ LineColor = \VertexLineColor,
+ InnerSep = \VertexInnerSep,
+ OuterSep = \VertexOuterSep,
+ FillColor = \VertexFillColor}{}
+\newcommand*{\SetVertexSimple}[1][]{\GR at SetVertexSimple[#1]}%
+\def\GR at SetVertexSimple[#1]{%
+\setkeys[GR]{SVS}{#1}%
+\presetkeys[GR]{vertex}{NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \cmdGR at SVS@Shape,
+ color = \cmdGR at SVS@LineColor,
+ fill = \cmdGR at SVS@FillColor,
+ inner sep = \cmdGR at SVS@InnerSep,
+ outer sep = \cmdGR at SVS@OuterSep,
+ minimum size = \cmdGR at SVS@MinSize,
+ line width = \cmdGR at SVS@LineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}}
+%<--------------------------------------------------------------------------->
+% Shade Vertex
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {shade} {Shape}{}
+\define at cmdkey [GR] {shade} {MinSize}{}
+\define at cmdkey [GR] {shade} {LineWidth}{}
+\define at cmdkey [GR] {shade} {LineColor}{}
+\define at cmdkey [GR] {shade} {BallColor}{}
+\define at cmdkey [GR] {shade} {InnerSep}{}
+\define at cmdkey [GR] {shade} {OuterSep}{}
+\presetkeys [GR] {shade} {Shape = \VertexShape,
+ MinSize = \VertexBigMinSize,
+ LineWidth = \VertexLineWidth,
+ LineColor = \VertexLineColor,
+ InnerSep = \VertexInnerSep,
+ OuterSep = \VertexOuterSep,
+ BallColor = \VertexBallColor}{}
+\newcommand*{\SetVertexShade}[1][]{\GR at SetVertexShade[#1]}%
+\def\GR at SetVertexShade[#1]{%
+\setkeys[GR]{shade}{#1}%
+\presetkeys[GR]{vertex}{NoLabel = false}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \cmdGR at shade@Shape,
+ ball color = \cmdGR at shade@BallColor,
+ inner sep = \cmdGR at shade@InnerSep,
+ outer sep = \cmdGR at shade@OuterSep,
+ minimum size = \cmdGR at shade@MinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor,% color outside
+ double = \EdgeFillColor,% inside
+ double distance = \EdgeDoubleDistance}}%
+\tikzset{LabelStyle/.style={}}}
+%<--------------------------------------------------------------------------->
+% Art Vertex
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {art} {Shape}{}
+\define at cmdkey [GR] {art} {MinSize}{}
+\define at cmdkey [GR] {art} {LineWidth}{}
+\define at cmdkey [GR] {art} {LineColor}{}
+\define at cmdkey [GR] {art} {BallColor}{}
+\define at cmdkey [GR] {art} {InnerSep}{}
+\define at cmdkey [GR] {art} {OuterSep}{}
+\presetkeys [GR] {art} {Shape = \VertexShape,
+ MinSize = \VertexSmallMinSize,
+ LineWidth = \VertexLineWidth,
+ LineColor = \VertexLineColor,
+ InnerSep = \VertexInnerSep,
+ OuterSep = \VertexOuterSep,
+ BallColor = \VertexBallColor}{}
+\newcommand*{\SetVertexArt}[1][]{\GR at SetVertexArt[#1]}%
+\def\GR at SetVertexArt[#1]{%
+\setkeys[GR]{art}{#1}%
+\presetkeys[GR]{vertex}{NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \cmdGR at art@Shape,
+ ball color = \cmdGR at art@BallColor,
+ inner sep = \cmdGR at art@InnerSep,
+ outer sep = \cmdGR at art@OuterSep,
+ minimum size = \cmdGR at art@MinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeArtColor}}
+\tikzset{LabelStyle/.style = {}}}
+%<--------------------------------------------------------------------------->
+% Normal Vertex
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {SVN} {Shape}{}
+\define at cmdkey [GR] {SVN} {MinSize}{}
+\define at cmdkey [GR] {SVN} {LineWidth}{}
+\define at cmdkey [GR] {SVN} {LineColor}{}
+\define at cmdkey [GR] {SVN} {FillColor}{}
+\define at cmdkey [GR] {SVN} {TextColor}{}
+\define at cmdkey [GR] {SVN} {InnerSep}{}
+\define at cmdkey [GR] {SVN} {OuterSep}{}
+\presetkeys [GR] {SVN} {Shape = \VertexShape,
+ MinSize = \VertexInterMinSize,
+ LineWidth = \VertexLineWidth,
+ LineColor = \VertexLineColor,
+ FillColor = \VertexLightFillColor,
+ InnerSep = \VertexInnerSep,
+ OuterSep = \VertexOuterSep,
+ TextColor = \VertexTextColor}{}
+\newcommand*{\SetVertexNormal}[1][]{\GR at SetVertexNormal[#1]}%
+\def\GR at SetVertexNormal[#1]{%
+\setkeys[GR]{SVN}{#1}%
+\tikzset{VertexStyle/.style = {shape = \cmdGR at SVN@Shape,
+ minimum size = \cmdGR at SVN@MinSize,
+ line width = \cmdGR at SVN@LineWidth,
+ color = \cmdGR at SVN@LineColor,
+ fill = \cmdGR at SVN@FillColor,
+ text = \cmdGR at SVN@TextColor,
+ inner sep = \cmdGR at SVN@InnerSep,
+ outer sep = \cmdGR at SVN@OuterSep,
+ draw}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}}
+\SetVertexNormal% default
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {init} {unit}{}
+\define at choicekey*[GR]{init}{vstyle}[\val\nr]{Empty,%
+ Hasse,%
+ Simple,%
+ Classic,%
+ Normal,%
+ Shade,%
+ Dijkstra,%
+ Welsh,%
+ Art,%
+ Shade Art}{%
+\edef\GR at init@vstyle{\nr}
+\ifcase\nr\relax
+% Empty
+\presetkeys [GR] {vertex} {LabelOut = false}{}%
+\tikzset{VertexStyle/.style = {shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexLightFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = 0.5\pgflinewidth,
+ text = \VertexTextColor,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,\EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+\or
+% Hasse
+\presetkeys [GR] {vertex} {NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexLightFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = 0.5\pgflinewidth,
+ text = \VertexTextColor,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+\or
+% Simple
+\presetkeys [GR] {vertex} {NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexDarkFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = 0.5\pgflinewidth,
+ text = \VertexTextColor,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+% Classic
+\or
+\presetkeys [GR] {vertex} {LabelOut = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexDarkFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = 0.5\pgflinewidth,
+ text = \VertexTextColor,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+% Normal
+\or
+\presetkeys [GR] {vertex} {LabelOut = false}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ minimum size = \VertexInterMinSize,
+ line width = \VertexLineWidth,
+ color = \VertexLineColor,
+ outer sep = 0.5\pgflinewidth,
+ fill = \VertexLightFillColor,
+ text = \VertexTextColor,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+% Shade
+\or
+\presetkeys [GR] {vertex} {LabelOut = false}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ ball color = \VertexBallColor,
+ color = \VertexLineColor,
+ text = \VertexTextColor,
+ inner sep = \VertexInnerSep,
+ outer sep = \VertexOuterSep,
+ minimum size = \VertexBigMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor,% color outside
+ double = \EdgeFillColor,% inside
+ double distance = \EdgeDoubleDistance}}%
+\tikzset{LabelStyle/.style={}}
+% Dijkstra
+\or
+\presetkeys [GR] {vertex} {LabelOut = false}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexLightFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = 0.5\pgflinewidth,
+ text = \VertexTextColor,
+ minimum size = \VertexInterMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}
+\tikzset{LabelStyle/.style={}}
+% Welsh
+\or
+\presetkeys [GR] {vertex} {LabelOut = true}{}%
+\tikzset{VertexStyle/.style = {draw,
+ shape = \VertexShape,
+ color = \VertexLineColor,
+ fill = \VertexLightFillColor,
+ inner sep = \VertexInnerSep,
+ outer sep = \VertexOuterSep,
+ text = \VertexTextColor,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor}}%
+\tikzset{LabelStyle/.style={}}
+% Art
+\or
+\presetkeys [GR] {vertex} {NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {shape = \VertexShape,
+ ball color = \VertexBallColor,
+ color = \VertexLineColor,
+ inner sep = \VertexInnerSep,
+ outer sep = \VertexOuterSep,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}%
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeArtColor}}
+\tikzset{LabelStyle/.style = {}}
+% ShadeArt
+\or
+\presetkeys [GR] {vertex} {NoLabel = true}{}%
+\tikzset{VertexStyle/.style = {shape = \VertexShape,
+ ball color = \VertexBallColor,
+ inner sep = \VertexInnerSep,
+ outer sep = \VertexOuterSep,
+ minimum size = \VertexSmallMinSize,
+ line width = \VertexLineWidth}}
+\tikzset{EdgeStyle/.style = {line width = \EdgeLineWidth,
+ \EdgeColor,
+ double = \EdgeFillColor,
+ double distance = .5\EdgeDoubleDistance}}
+\tikzset{LabelStyle/.style = {}}
+\fi%
+}
+
+\presetkeys [GR] {init} {vstyle = Normal,%
+ unit = \GraphUnit}{}
+
+\newcommand*{\SetGraphUnit}[1]{\renewcommand{\GraphUnit}{#1}}%
+
+\newcommand*{\GraphInit}[1][]{\setkeys[GR]{init}{#1}%
+\edef\GraphUnit{\cmdGR at init@unit}%
+}%
+%<--------------------------------------------------------------------------->
+% Colors
+%<--------------------------------------------------------------------------->
+\newcommand*{\SetGraphShadeColor}[3]{%
+ \tikzset{VertexStyle/.append style = {ball color=#1}}
+ \tikzset{EdgeStyle/.append style = {color=#2,double=#3}}
+}
+\newcommand*{\SetGraphArtColor}[2]{%
+ \tikzset{VertexStyle/.append style = {ball color=#1}}
+ \tikzset{EdgeStyle/.append style = {color=#2}}
+}
+\newcommand*{\SetGraphColor}[2]{%
+ \tikzset{VertexStyle/.append style = {fill=#1}}
+ \tikzset{EdgeStyle/.append style = {color=#2}}
+}
+\newcommand*{\AddVertexColor}[2]{%
+\begingroup
+ \tikzset{VertexStyle/.append style = {fill=#1}}
+ \foreach \v in {#2}
+ {\Vertex[Node,NoLabel]{\v}}
+\endgroup
+}
+%<--------------------------------------------------------------------------->
+\newcommand*{\SetVertexNoLabel}{%
+ \presetkeys [GR] {vertex} {NoLabel = true}{}%
+}
+% add RV
+\newcommand*{\SetVertexLabel}{%
+ \presetkeys [GR] {vertex} {NoLabel = false}{}%
+}
+%<--------------------------------------------------------------------------->
+\newcommand*{\SetVertexLabelOut}{%
+ \presetkeys [GR] {vertex} {LabelOut = true}{}%
+}
+\newcommand*{\SetVertexLabelIn}{%
+ \presetkeys [GR] {vertex} {LabelOut = false}{}%
+}
+\newcommand*{\SetVertexMath}{%
+ \presetkeys [GR] {vertex} {Math = true}{}%
+ \presetkeys [GR] {cl} {Math = true}{}%
+}
+\newcommand*{\SetVertexNoMath}{%
+ \presetkeys [GR] {vertex} {Math = false}{}%
+ \presetkeys [GR] {cl} {Math = false}{}%
+}
+%<--------------------------------------------------------------------------->
+% Init SetUpVertex
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {SUV} {Lpos}{}
+\define at cmdkey [GR] {SUV} {Ldist}{}
+\define at cmdkey [GR] {SUV} {Style}{}
+\define at cmdkey [GR] {SUV} {MinSize}{}
+\define at cmdkey [GR] {SUV} {LineWidth}{}
+\define at cmdkey [GR] {SUV} {TextColor}{}
+\define at cmdkey [GR] {SUV} {LineColor}{}
+\define at cmdkey [GR] {SUV} {FillColor}{}
+\define at cmdkey [GR] {SUV} {InnerSep}{}
+\define at cmdkey [GR] {SUV} {OuterSep}{}
+\define at cmdkey [GR] {SUV} {Unit}{}
+\define at boolkey [GR] {SUV} {NoLabel} [true]{}
+\define at boolkey [GR] {SUV} {LabelOut}[true]{}
+\define at boolkey [GR] {SUV} {Math}[true]{}
+\presetkeys [GR] {SUV} {Ldist = 0cm,
+ Lpos = 0,
+ Style = {},
+ LabelOut = false,
+ NoLabel = false,
+ Math = false,
+ Unit = \GraphUnit,
+ MinSize = \VertexInterMinSize,
+ TextColor = \VertexTextColor,
+ LineColor = \VertexLineColor,
+ FillColor = \VertexLightFillColor,
+ LineWidth = \VertexLineWidth,
+ InnerSep = \VertexInnerSep,
+ OuterSep = \VertexOuterSep}{}
+%<--------------------------------------------------------------------------->
+% SetUpVertex
+%<--------------------------------------------------------------------------->
+\newcommand*{\SetUpVertex}[1][]{\GR at SetUpVertex[#1]}%
+\def\GR at SetUpVertex[#1]{%
+\setkeys[GR]{SUV}{#1}%
+\presetkeys [GR] {vertex} {Lpos = \cmdGR at SUV@Lpos,
+ Ldist = \cmdGR at SUV@Ldist,
+ style = \cmdGR at SUV@Style,
+ unit = \cmdGR at SUV@Unit}{}%
+\tikzset{VertexStyle/.append style = {inner sep = \cmdGR at SUV@InnerSep,
+ outer sep = \cmdGR at SUV@OuterSep,
+ minimum size = \cmdGR at SUV@MinSize,
+ text = \cmdGR at SUV@TextColor,
+ color = \cmdGR at SUV@LineColor,
+ fill = \cmdGR at SUV@FillColor,
+ line width = \cmdGR at SUV@LineWidth}}
+\ifGR at SUV@NoLabel%
+ \presetkeys [GR] {vertex} {NoLabel = true}{}%
+\fi%
+\ifGR at SUV@LabelOut%
+ \presetkeys [GR] {vertex} {LabelOut = true}{}%
+\fi%
+\ifGR at SUV@Math%
+ \presetkeys [GR] {vertex} {Math = true}{}%
+\fi%
+}
+%<--------------------------------------------------------------------------->
+% Init Vertex
+%<--------------------------------------------------------------------------->
+\define at boolkey [GR] {vertex} {empty}[true]{}
+\define at cmdkey [GR] {vertex} {unit}{}
+\define at cmdkey [GR] {vertex} {x}{}
+\define at cmdkey [GR] {vertex} {y}{}
+\define at cmdkey [GR] {vertex} {a}{}
+\define at cmdkey [GR] {vertex} {d}{}
+\define at boolkey [GR] {vertex} {Node}[true]{}
+\define at cmdkey [GR] {vertex} {dir}{}
+\define at cmdkey [GR] {vertex} {style}{}
+\define at cmdkey [GR] {vertex} {position}{}
+\define at cmdkey [GR] {vertex} {L}{}
+\define at cmdkey [GR] {vertex} {Lpos}{}
+\define at cmdkey [GR] {vertex} {Ldist}{}
+\define at boolkey [GR] {vertex} {NoLabel}[true]{}
+\define at boolkey [GR] {vertex} {Math}[true]{}
+\define at boolkey [GR] {vertex} {LabelOut}[true]{}
+\presetkeys [GR] {vertex} {Node = false,
+ NoLabel = false,
+ LabelOut = false,
+ empty = false,
+ Math = false,
+ x = {},
+ y = {},
+ a = {},
+ d = {},
+ unit = \GraphUnit,
+ dir = \EA,
+ position = {},
+ style = {},
+ L = {},
+ Ldist = 0cm,
+ Lpos = 0}{}
+%<--------------------------------------------------------------------------->
+% Vertex
+%<--------------------------------------------------------------------------->
+\newcommand*{\Vertex}[1][]{\@vertex[#1]}%
+\def\@vertex[#1]#2{%
+ \setkeys[GR]{vertex}{#1}%
+ \@@vertex{#2}%
+}
+% coord rect todo coord polar and pos relative
+\def\@@vertex#1{%
+ \def\nstyle{VertexStyle}
+%<--------------------------------------------------------------------------->
+\ifGR at vertex@Node%
+ \pgfextractx{\pgf at x}{\pgfpointanchor{#1}{center}}
+ \pgfextracty{\pgf at y}{\pgfpointanchor{#1}{center}}
+ \edef\cmdGR at vertex@x{\pgf at x}
+ \edef\cmdGR at vertex@y{\pgf at y}
+\fi%
+%<--------------------------------------------------------------------------->
+\ifGR at vertex@empty%
+ \begin{scope}
+ \ifthenelse{\not\equal{\cmdGR at vertex@x}{}}{%
+ \protected at edef\@tempa{%
+ \noexpand\node[inner sep = 0pt](#1)%
+ at (\cmdGR at vertex@x,\cmdGR at vertex@y){}}%
+ \@tempa;}{%
+ \ifthenelse{\not\equal{\cmdGR at vertex@d}{}}{%
+ \protected at edef\@tempa{%
+ \noexpand\node[inner sep = 0pt](#1)%
+ at (\cmdGR at vertex@a:\cmdGR at vertex@d){}}%
+ \@tempa;}{%
+ \protected at edef\@tempa{%
+ \noexpand \node[inner sep = 0pt](#1)%
+ [\cmdGR at vertex@position]{}}%
+ \@tempa;}}%
+ \end{scope}
+\else
+ \begin{scope}[label distance = \cmdGR at vertex@Ldist]
+ \ifGR at vertex@NoLabel
+ \def\vertex at Label{}%
+ \def\cmdGR at vertex@L{}%
+ \def\vertex at Name{}
+ \else%
+ \ifGR at vertex@Math
+ \ifthenelse{\equal{\cmdGR at vertex@L}{}}{%
+ \def\vertex at Name{$#1$}}{\def\vertex at Name{$\cmdGR at vertex@L$}}
+ \else
+ \ifthenelse{\equal{\cmdGR at vertex@L}{}}{%
+ \def\vertex at Name{#1}}{\def\vertex at Name{\cmdGR at vertex@L}}
+ \fi%
+ \ifGR at vertex@LabelOut%
+ \def\nstyle{VertexStyle,%
+ label={[text = \cmdGR at SVN@TextColor,\cmdGR at vertex@style]%
+ \cmdGR at vertex@Lpos:\vertex at Name}}
+ \def\vertex at Label{}
+ \else%
+ \def\vertex at Label{\vertex at Name}
+ \fi
+ \fi
+%<--------------------------------------------------------------------------->
+ \ifthenelse{\not\equal{\cmdGR at vertex@x}{}}{%
+ \protected at edef\@tempa{%
+ \noexpand\node[outer sep=0pt,\cmdGR at vertex@style,\nstyle](#1)
+ at (\cmdGR at vertex@x,\cmdGR at vertex@y){%
+ \noexpand\vertex at Label}}%
+ \@tempa;%
+ }{%
+ \ifthenelse{\not\equal{\cmdGR at vertex@d}{}}{%
+ \protected at edef\@tempa{%
+ \noexpand\node[outer sep=0pt,\cmdGR at vertex@style,\nstyle](#1)
+ at (\cmdGR at vertex@a:\cmdGR at vertex@d){%
+ \noexpand\vertex at Label}}%
+ \@tempa;%
+ }{%
+ \protected at edef\@tempa{%
+ \noexpand\node[outer sep=0pt,\cmdGR at vertex@style,\nstyle](#1)%
+ [\cmdGR at vertex@position]{%
+ \noexpand\vertex at Label}}%
+ \@tempa;}}%
+ \end{scope}
+\fi%
+}
+%<--------------------------------------------------------------------------->
+% End of Vertex
+%<--------------------------------------------------------------------------->
+% EA east of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\EA}[1][]{\@droite[#1]}%
+\def\@droite[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(\cmdGR at vertex@unit,0) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}%
+%<--------------------------------------------------------------------------->
+% WE west of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\WE}[1][]{\@gauche[#1]}%
+\def\@gauche[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(-\cmdGR at vertex@unit,0) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+ \endgroup%
+}
+%<--------------------------------------------------------------------------->
+% NO north of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\NO}[1][]{\@haut[#1]}%
+\def\@haut[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(0,\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+%<--------------------------------------------------------------------------->
+% SO south of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\SO}[1][]{\@bas[#1]}%
+\def\@bas[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(0,-\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+%<--------------------------------------------------------------------------->
+% NOEA north east of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\NOEA}[1][]{\@hautdroite[#1]}%
+\def\@hautdroite[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(\cmdGR at vertex@unit,\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+
+%<--------------------------------------------------------------------------->
+% NOWE north west of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\NOWE}[1][]{\@hautgauche[#1]}%
+\def\@hautgauche[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(-\cmdGR at vertex@unit,\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+%<--------------------------------------------------------------------------->
+% SOEA south east of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\SOEA}[1][]{\@basdroite[#1]}%
+\def\@basdroite[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(\cmdGR at vertex@unit,-\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+%<--------------------------------------------------------------------------->
+% SOWE south west of #2
+%<--------------------------------------------------------------------------->
+\newcommand*{\SOWE}[1][]{\@basgauche[#1]}%
+\def\@basgauche[#1](#2)#3{%
+\begingroup%
+ \setkeys[GR]{vertex}{#1}%
+ \path (#2)--++(-\cmdGR at vertex@unit,-\cmdGR at vertex@unit) coordinate (#3);
+ \Vertex[#1,Node]{#3}
+\endgroup%
+}
+
+%<--------------------------------------------------------------------------->
+% Vertices
+%<--------------------------------------------------------------------------->
+\newcommand*{\Vertices}[1][]{\Vertices at NoStar[#1]}%
+\def\Vertices at NoStar[#1]#2#3{%
+\setkeys[GR]{vertex}{#1}%
+\begingroup%
+ \setcounter{tkz at gr@p}{0}
+ \@for\liste:=#3\do{%
+ \stepcounter{tkz at gr@p}%
+ \global\expandafter\let\csname label@\alph{tkz at gr@p}\endcsname\liste}
+ \ifthenelse{\equal{#2}{line}}{%
+ \setcounter{tkz at gr@p}{0}
+ \foreach \fin in {#3}{%
+ \ifthenelse{\value{tkz at gr@p}=0}{%
+ \global\let\deb\fin
+ \Vertex[#1]{\fin}
+ \stepcounter{tkz at gr@p}
+ }{%
+ \cmdGR at vertex@dir[#1,x={},y={},a={},d={},Node=false](\deb){\fin}
+ \global\let\deb\fin
+ }
+ }%
+ }{
+ \ifthenelse{\equal{#2}{square}}{%
+ \begin{scope}[rotate=45]
+ \Vertex[#1,Lpos=-135]{\label at a}
+ \EA[#1,Lpos=-45,x={},y={},Node=false](\label at a){\label at b}
+ \NO[#1,Lpos=45, x={},y={},Node=false](\label at b){\label at c}
+ \WE[#1,Lpos=135,x={},y={},Node=false](\label at c){\label at d}
+ \end{scope}
+}{%
+ \ifthenelse{\equal{#2}{tr1}}{%
+ \Vertex[#1]{\label at a}
+ \EA[#1,x={},y={},Node=false](\label at a){\label at b}
+ \NO[#1,x={},y={},Node=false](\label at b){\label at c}}{%
+ \ifthenelse{\equal{#2}{tr2}}{%
+ \Vertex[#1]{\label at a}
+ \NO[#1,x={},y={},Node=false](\label at a){\label at b}
+ \EA[#1,x={},y={},Node=false](\label at b){\label at c}}{%
+ \ifthenelse{\equal{#2}{tr3}}{%
+ \Vertex[#1]{\label at a}
+ \NO[#1,x={},y={},Node=false](\label at a){\label at b}
+ \WE[#1,x={},y={},Node=false](\label at b){\label at c}}{%
+ \ifthenelse{\equal{#2}{tr4}}{%
+ \Vertex[#1]{\label at a}
+ \WE[#1,x={},y={},Node=false](\label at a){\label at b}
+ \NO[#1,x={},y={},Node=false](\label at b){\label at c}}{%
+ \ifthenelse{\equal{#2}{circle}}{%
+ \pgfmathdivide{360}{\value{tkz at gr@p}}%
+ \global\let\gr at angle\pgfmathresult%
+ \setcounter{tkz at gr@p}{0}
+ \foreach \lab in {#3}{%
+ \pgfmathmultiply{\gr at angle}{\thetkz at gr@p}%
+ \let\gr at newangle\pgfmathresult%
+ \pgfmathadd{\cmdGR at vertex@Lpos}{\gr at newangle}
+ \let\gr at posangle\pgfmathresult%
+ \Vertex[#1,
+ a = \gr at newangle,
+ d = \cmdGR at vertex@unit,
+ Lpos = \gr at posangle]{\lab}
+ \stepcounter{tkz at gr@p}%
+ }%
+ }{}%
+ }}}}}}%
+\endgroup%
+}
+%<--------------------------------------------------------------------------->
+% Edge style
+%<--------------------------------------------------------------------------->
+\tikzset{LabelStyle/.style={}}% add 03/04/2009
+\tikzset{EdgeStyle/.style={}}
+%<--------------------------------------------------------------------------->
+% Init SetUpEdge
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {SUE} {color}{}
+\define at cmdkey [GR] {SUE} {label}{}
+\define at cmdkey [GR] {SUE} {labelstyle}{}
+\define at cmdkey [GR] {SUE} {labeltext}{}
+\define at cmdkey [GR] {SUE} {labelcolor}{}
+\define at cmdkey [GR] {SUE} {style}{}
+\define at cmdkey [GR] {SUE} {lw}{}
+\presetkeys [GR] {SUE} {color = \EdgeColor,
+ lw = \EdgeLineWidth,
+ label = {},
+ labeltext = \LabelTextColor,
+ labelcolor = \LabelFillColor,
+ labelstyle = {},
+ style = {}}{}
+%<--------------------------------------------------------------------------->
+% SetUpEdge
+%<--------------------------------------------------------------------------->
+\newcommand*{\SetUpEdge}[1][]{\@SetUpEdge[#1]}%
+\def\@SetUpEdge[#1]{%
+\setkeys [GR] {SUE} {#1}%
+\presetkeys [GR] {edge} {color = \cmdGR at SUE@color,
+ lw = \cmdGR at SUE@lw,
+ label = \cmdGR at SUE@label,
+ labeltext = \cmdGR at SUE@labeltext,
+ labelcolor = \cmdGR at SUE@labelcolor,
+ labelstyle = \cmdGR at SUE@labelstyle,
+ style = \cmdGR at SUE@style}{}
+\tikzset{LabelStyle/.style={}}
+\tikzset{EdgeStyle/.style={}}}
+\newcommand*{\DisableEdgeStyle}{\tikzset{EdgeStyle/.style={}}}
+%<--------------------------------------------------------------------------->
+% Init Edge
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {edge} {color}{}
+\define at cmdkey [GR] {edge} {lw}{}
+\define at cmdkey [GR] {edge} {double}{}
+\define at cmdkey [GR] {edge} {incolor}{}
+\define at cmdkey [GR] {edge} {dd}{}
+\define at cmdkey [GR] {edge} {style}{}
+\define at cmdkey [GR] {edge} {label}{}
+\define at cmdkey [GR] {edge} {labeltext}{}
+\define at cmdkey [GR] {edge} {labelcolor}{}
+\define at cmdkey [GR] {edge} {labelstyle}{}
+\define at boolkey[GR] {edge} {local}[true]{}
+\presetkeys [GR] {edge} {style = {pos=.5},
+ lw = \EdgeLineWidth,
+ label = {},
+ labeltext = \LabelTextColor,
+ labelcolor = \LabelFillColor,
+ labelstyle = {},
+ local = false,
+ double = {},
+ dd = \EdgeDoubleDistance,
+ incolor = \EdgeFillColor,
+ color = \EdgeColor}{}
+%<--------------------------------------------------------------------------->
+% Edge
+%<--------------------------------------------------------------------------->
+\newcommand*{\Edge}[1][]{\@edge[#1]}%
+\def\@edge[#1](#2)(#3){%
+\setkeys[GR]{edge}{#1}%
+ \begingroup%
+\ifthenelse{\equal{\cmdGR at edge@double}{}}{%
+\tikzset{LocalEdgeStyle/.style={color = \cmdGR at edge@color,
+ line width = \cmdGR at edge@lw}}}{%
+\tikzset{LocalEdgeStyle/.style={line width = \cmdGR at edge@dd,
+ color = \cmdGR at edge@double,
+ double distance = \cmdGR at edge@lw,
+ double = \cmdGR at edge@color}}}%
+\ifGR at edge@local%
+ \tikzset{EdgeStyle/.style={}}%
+ \fi
+ \ifthenelse{\equal{\cmdGR at edge@label}{}}{%
+ \protected at edef\@tempa{%
+ \noexpand \draw[LocalEdgeStyle,\cmdGR at edge@style,EdgeStyle]}%
+ \@tempa (#2) to (#3)}{%
+ \protected at edef\@tempa{%
+ \noexpand \draw[LocalEdgeStyle,\cmdGR at edge@style,EdgeStyle] (#2) to%
+ node[fill = \cmdGR at edge@labelcolor,
+ text = \cmdGR at edge@labeltext,
+ \cmdGR at edge@labelstyle,LabelStyle]}\@tempa
+ {\cmdGR at edge@label} (#3)}%
+ ;
+\endgroup%
+}%
+%<--------------------------------------------------------------------------->
+% Edges
+%<--------------------------------------------------------------------------->
+\newcommand*{\Edges}[1][]{\@edges[#1]}%
+\def\@edges[#1](#2){%
+\setkeys[GR]{edge}{#1}%
+ \begingroup%
+ \setcounter{tkz at gr@p}{0}
+ \foreach \fin in {#2}{%
+ \ifthenelse{\value{tkz at gr@p}=0}{%
+ \global\let\deb\fin
+ \stepcounter{tkz at gr@p}}{%
+ \Edge[#1](\deb)(\fin)
+ \global\let\deb\fin
+ }%
+ }
+ \endgroup%
+}%
+%<--------------------------------------------------------------------------->
+% Init loop
+%<--------------------------------------------------------------------------->
+\define at choicekey*[GR]{loop}{dir}[\val\nr]{WE,EA,NO,SO,NOWE,NOEA,SOWE,SOEA}{%
+\ifcase\nr\relax
+\tikzset{LoopStyle/.style = {in=225, out=135, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in= 45, out=-45, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=135, out= 45, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=-45, out=-135, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=180, out=90, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=90, out=0, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=-90, out=-180, distance=\cmdGR at loop@dist}}%
+\or
+\tikzset{LoopStyle/.style = {in=0, out=-90, distance=\cmdGR at loop@dist}}%
+\fi%
+}
+\define at cmdkey [GR] {loop} {color}{}
+\define at cmdkey [GR] {loop} {label}{}
+\define at cmdkey [GR] {loop} {labelstyle}{}
+\define at cmdkey [GR] {loop} {style}{}
+\define at cmdkey [GR] {loop} {dist}{}
+\presetkeys [GR] {loop} {style = {pre,thick},%`
+ label = {},%
+ labelstyle = {},%
+ color = \tkz at suc@txt,%
+ dist = 4cm,%
+ dir = WE}{}
+%<--------------------------------------------------------------------------->
+% loop
+%<--------------------------------------------------------------------------->
+\newcommand*{\grLoop}[1][]{\tkzGR at loop[#1]}%
+\def\tkzGR at loop[#1](#2){%
+\setkeys[GR]{loop}{#1}%
+\protected at edef\@tempa{%
+\noexpand \draw[\cmdGR at loop@color] (#2)%
+ edge [EdgeStyle,LoopStyle,\cmdGR at loop@style]%
+ node [LabelStyle,\cmdGR at loop@labelstyle]%
+ {\cmdGR at loop@label} (#2)}\@tempa;%
+}%
+%<--------------------------------------------------------------------------->
+% Init Graphes probabilistes
+%<--------------------------------------------------------------------------->
+\define at cmdkey [GR] {grpb} {unit}{}
+\define at cmdkey [GR] {grpb} {LposA}{}
+\define at cmdkey [GR] {grpb} {LposB}{}
+\define at cmdkey [GR] {grpb} {Ldist}{}
+\define at cmdkey [GR] {grpb} {LoopDist}{}
+\presetkeys [GR] {grpb} {LposA = 180,%
+ LposB = 0,%
+ Ldist = 0cm,%
+ LoopDist = 4cm,
+ unit = 4}{}
+%<--------------------------------------------------------------------------->
+% Graphes probabilistes
+%<--------------------------------------------------------------------------->
+\newcommand*{\grProb}[7][]{%
+\setkeys[GR]{grpb}{#1}%
+\tikzset{LabelStyle/.append style ={pos=.5}}
+\Vertex[Lpos=\cmdGR at grpb@LposA,Ldist=\cmdGR at grpb@Ldist,L=#2]{grA}
+\EA[unit=\cmdGR at grpb@unit,Lpos=\cmdGR at grpb@LposB,
+ Ldist=\cmdGR at grpb@Ldist,L=#3](grA){grB}
+\Edge[style={post,bend left=60},label={$#4$},labelstyle={above}](grA)(grB)
+\Edge[style={post,bend left=60},label={$#5$},labelstyle={below}](grB)(grA)
+\grLoop[dist=\cmdGR at grpb@LoopDist,dir=WE,label={$#6$},labelstyle={left}](grA)
+\grLoop[dist=\cmdGR at grpb@LoopDist,dir=EA,label={$#7$},labelstyle={right}](grB)
+}%
+\newcommand*{\grProbThree}[7][]{%
+\setkeys[GR]{grpb}{#1}%
+\begin{scope}[]
+ \tikzset{LabelStyle/.append style ={pos=.5}}
+ \Vertices[empty,unit=\cmdGR at grpb@unit]{circle}{grA,grB,grC}
+ \Vertex[Node,Lpos=\cmdGR at grpb@LposA,Ldist=\cmdGR at grpb@Ldist,L=#2]{grA}
+ \Vertex[Node,Lpos=\cmdGR at grpb@LposA,Ldist=\cmdGR at grpb@Ldist,L=#3]{grB}
+ \Vertex[Node,Lpos=\cmdGR at grpb@LposA,Ldist=\cmdGR at grpb@Ldist,L=#4]{grC}
+ \foreach \x/\y/\z in {#5} {%
+ \grLoop[dist=\cmdGR at grpb@LoopDist,dir=EA,label={$\x$}](grA)
+\Edge[style={post,bend right=20},label={$\y$}](grA)(grB)
+\Edge[style={post,bend right=20},label={$\z$}](grA)(grC)}
+\foreach \x/\y/\z in {#6} {%
+ \grLoop[dist=\cmdGR at grpb@LoopDist,dir=NO,label={$\x$}](grB)
+\Edge[style={post,bend right=20},label={$\y$}](grB)(grA)
+\Edge[style={post,bend right=20},label={$\z$}](grB)(grC)}
+ \foreach \x/\y/\z in {#7} {%
+ \grLoop[dist=\cmdGR at grpb@LoopDist,dir=SO,label={$\x$}](grC)
+ \Edge[style={post,bend right=20},label={$\y$}](grC)(grA)
+ \Edge[style={post,bend right=20},label={$\z$}](grC)(grB)}
+\end{scope}
+}
+%<--------------------------------------------------------------------------->
+% End Graphes probabilistes
+%<--------------------------------------------------------------------------->
+\let\Loop\grLoop
+\newcommand{\SetVertexLabeledSmall}{%
+\SetVertexLabel%
+\tikzset{VertexStyle/.style = {draw,
+ shape = circle,
+ inner sep = 1pt,
+ minimum size = 10pt}}
+\tikzset{EdgeStyle/.style = {double = \tkz at suc@txt,
+ double distance = 1pt,
+ color = \tkz at suc@bkc,
+ line width = 0.7pt}}
+}
+\newcommand{\SetVertexNotLabeledSmall}{%
+ \tikzset{EdgeStyle/.style = {double = \tkz at suc@txt,
+ double distance = 1pt,
+ color = \tkz at suc@bkc,
+ line width = 0.7pt}}
+ \SetVertexNoLabel
+ \SetVertexSimple[MinSize=6pt,FillColor=gray]
+ \renewcommand*{\VertexLineWidth}{0pt}
+}%
+
+\newcommand{\SetVertexForPresentation}[3]{%
+ \GraphInit[vstyle=Shade]
+ \SetVertexNoLabel
+ \renewcommand*{\VertexBigMinSize}{12pt}%
+ \renewcommand*{\EdgeDoubleDistance}{2pt}%
+ \renewcommand*{\EdgeLineWidth}{0.7pt}%
+ \SetGraphShadeColor{#1}{#2}{#3}
+}%
+
+\newcommand{\setxyzvec}[1][20]{%
+ \pgfmathsetmacro{\xone}{cos(180+#1)}%
+ \pgfmathsetmacro{\yone}{sin(180+#1)}%
+ \pgfmathsetmacro{\xtwo}{cos(360-#1)}%
+ \pgfmathsetmacro{\ytwo}{sin(360-#1)}%
+ \pgfsetxvec{\pgfpoint{\xone cm}{\yone cm}}%
+ \pgfsetyvec{\pgfpoint{\xtwo cm}{\ytwo cm}}%
+ \pgfsetzvec{\pgfpoint{0cm}{1cm}}%
+}
+\endinput
+
Property changes on: trunk/Master/texmf-dist/tex/latex/tkz-graph/tkz-graph.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2021-01-21 22:08:31 UTC (rev 57483)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2021-01-21 22:11:01 UTC (rev 57484)
@@ -758,7 +758,7 @@
tikztosvg tile-graphic
timbreicmc times timetable timing-diagrams tinos tipa tipa-de tipfr
titlecaps titlefoot titlepages titlepic titleref titlesec titling
- tkz-base tkz-doc tkz-euclide tkz-fct tkz-tab
+ tkz-base tkz-doc tkz-euclide tkz-fct tkz-graph tkz-tab
tkz-orm tikz-page
tlc-article tlc2 tlcockpit tlmgrbasics
tocbibind tocdata tocloft tocvsec2 todo todonotes
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2021-01-21 22:08:31 UTC (rev 57483)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2021-01-21 22:11:01 UTC (rev 57484)
@@ -1318,10 +1318,8 @@
'tksbrief', "die 'skipping, LaTeX 2.09'",
'tkz', "die 'skipping, container directory'",
'tkz-base', "&MAKEtkz",
- 'tkz-berge', "die 'skipping, obsolete on ctan'", #"&MAKEtkz",
'tkz-euclide', "&MAKEtkz",
'tkz-fct', "&MAKEtkz",
- 'tkz-graph', "die 'skipping, obsolete on ctan'", #"&MAKEtkz",
'tkz-kiviat', "die 'skipping, obsolete on ctan'", #"&MAKEtkz",
'tkz-linknodes',"die 'skipping, obsolete on ctan'",#"&MAKEtkz",
'tkz-tab', "&MAKEtkz",
@@ -1515,6 +1513,7 @@
'stix' => '&PREHOOK_stix',
'texdraw' => '&PREHOOK_texdraw',
'texfot' => '&PREHOOK_texfot',
+ 'tkz-graph' => '&PREHOOK_flatten1',
'tlcockpit' => '&PREHOOK_tlcockpit',
'tudscr' => '&PREHOOK_tudscr',
'tui' => '&PREHOOK_tui',
Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc 2021-01-21 22:08:31 UTC (rev 57483)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc 2021-01-21 22:11:01 UTC (rev 57484)
@@ -198,6 +198,7 @@
depend tkz-doc
depend tkz-euclide
depend tkz-fct
+depend tkz-graph
depend tkz-orm
depend tkz-tab
depend tqft
Added: trunk/Master/tlpkg/tlpsrc/tkz-graph.tlpsrc
===================================================================
More information about the tex-live-commits mailing list. | __label__pos | 0.999899 |
0
Using Droid Explorer, how to I access the guest microSD card?
In Windows Explorer, it comes up as a connected device, with a path of Computer\Acer Iconia Tab A100\SD Card\Documents
How do I get to that in Droid Explorer?
*(Windows 7 with Android 4.0.3 and Droid Explorer 0.9.0.4)
1 Answer 1
1
Oh - you know, this always happens. I spend time trying to figure things out, and as soon as I post a question, I find the answer. doh!
I found it under /mnt/external_sd/documents
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged . | __label__pos | 0.999087 |
`g(x) = x^(1/3) - x^(-2/3)` Find the critical numbers of the function
2 Answers
mathace's profile pic
mathace | (Level 3) Assistant Educator
Posted on
Given: `g(x)=x^(1/3)-x^(-2/3)`
Find the critical value(s) of the function by setting the first derivative equal to zero and solving for the x value(s).
`g'(x)=(1/3)x^(-2/3)+(2/3)x^(-5/3)=0`
`1/(3x^(2/3))=-2/(3x^(5/3))`
`3x^(5/3)=-6x^(2/3)`
`3x^(5/3)+6x^(2/3)=0`
`3x^(2/3)(x+2)=0`
`x=0,x=-2`
The value x=0 is not defined in g(x).
The critical value is x=-2.
scisser's profile pic
scisser | (Level 3) Honors
Posted on
Convert to fractional form :
`g(x) = x^(1/3) - 1/x^(2/3) `
`g(x) = (x - 1)/x^(2/3) `
Vertical asymptotes occur when denominator = 0.
If `x^(2/3) = 0` , then `x = 0` , so vertical asymptote at `x = 0` .
Take the derivative and set the numerator equal to 0.
`g'(x) = (x + 2)/[3x^(5/3)] = 0`
`x = -2 `
Substituting `x = -2` into g(x) gives : `g(-2) = -1.89` approx.
Therefore `(-2, -1.89)` is a critical point. | __label__pos | 0.999926 |
2
$\begingroup$
I remember this trick from one of my crypto courses way back then, but I can't find the details, and I'm unable to figure out the logic behind it.
I'm talking about a countermeasure to the MITM attack on "plain" (textbook, unauthenticated) DH key exchange. It was something like Alice and Bob compute $g^a$ and $g^b$ (respectively, where $a$ and $b$ are their randomly chosen not-to-be-disclosed values), but first transmit half the bits, and only after receiving the first half bits of the other party, then transmit the remaining half (example, if Alice's $g^a$ is 0x12345678, then transmit first 0x1234, and only after receiving Bob's first half, then transmit 0x5678).
My memory of the description of such trick is that Mallory (the MITM attacker) somehow needed to commit to something based on the first halves, but somehow what Mallory needed required the complete $g^a$ and $g^b$, which, by the time he/she gets those, it is too late and he/she cannot change the value now without being detected.
Does this ring any bells to someone? What part am I missing? I can't see how simply transmitting the first half, and only transmitting the second half after receiving the other party's first half would prevent Mallory to play MITM --- he/she just plays the game with Alice and Bob separately.
Thanks!
| improve this question | | | | |
$\endgroup$
• $\begingroup$ I have to object to your comment that "Nothing cryptographic can" [prevent a MITM attack]. Certainly, real-world cryptographic tools build upon DH and they do provide certain (reasonable) degree of guarantees against MITM or any other known attacks, right? There are certainly tricks that can ensure that one is directly communicating with the other party, with no MITM being able to decrypt one's communication. (right?) $\endgroup$ – Cal-linux Feb 3 '18 at 18:29
• $\begingroup$ I have expanded my comments into a full answer, addressing the above. $\endgroup$ – fgrieu Feb 4 '18 at 19:36
1
$\begingroup$
The question's technique does not prevent a Man in the Middle attack, for the reasons stated in the question. Nothing cryptographic can, under the question's assumption. Pre-existing trusted material allows that, and is used to that effect in authenticated DH.
What the question's technique achieves is
• Give more insurance to Alice that the shared secret that she will use can't have been chosen to have certain properties, because the other party's secret exponent $b$ can't be chosen with knowledge of the full $g^a$ chosen by Alice. When doing the normal way (where Alice reveals $g^a$ in full before receiving $g^b$), the party communicating with Alice (no matter who) could chose $b$ such that $(g^a)^b$ has (for example) its low-order 20 bits set to zero, then send the corresponding $g^b$ to Alice; exploring $b$ sequentially, this require only about a million multiplications.
• Make it harder or impossible to tell if Alice has chosen a somewhat poor value of $a$ before going as far as the second message sent by Alice, so that analysis of logs of failed connections will have more chance to reveal an attack forcing repeated connections until such poor choice (no answer from Bob on the first message can simply mean that Bob is offline; no answer on the second message, repeatedly, can't have this simple explanation and should raise alarm).
• More generally, lessens the asymmetry in timing of information disclosure between the originator that sends the first message, and the other party.
That might guard against some attacks, or make some security proofs possible.
For example, the question's technique might at least partially mitigate an attack where Mallory, actively performing MitM during key exchange, tries to make Alice and Bob compute a common shared secret that Mallory also knows, which then allows Mallory to passively eavesdrop later direct communication between Alice and Bob, encrypted under a symmetric key derived from the shared secret. There's an illustration in the second section.
If additionally the convention exists that the originator sends the high half first, while the other party sends the low half first, then:
• Assuming authenticated symmetric encryption from the shared DH secret, this blocks a denial of service by reflection attack where Alice is made to communicate with herself by always sending back to Alice whatever message she sends.
• This could have some (hopefully strengthening) effect on protocol attacks that attempt to change originator/target roles.
Half-baked construction where the question's practice mitigates MitM even so slightly.
Start with naive Diffie-Hellman key exchange to establish an encryption key in $\mathbb Z_p^*$ with prime $p$ and $g\in\mathbb Z_p^*$ with $g\ne1$ (perhaps a generator). Normally the protocol goes:
• Alice draws random secret $a$ and sends $m_a=g^a\bmod p$ towards Bob
• Bob draws random secret $b$ and sends $m_b=g^b\bmod p$ towards Alice
• Alice receives alleged $\hat m_b$, computes $s_a={\hat m_b}^a\bmod p$, then $k_a=\operatorname{SHA-256}(s_a)$ used as a secret shared key for a symmetric cryptosystem.
• Bob does similarly and ends with $k_b=\operatorname{SHA-256}(s_b={\hat m_a}^b\bmod p)$, which if everything went well is the same as $k_a$.
Mallory playing active attacker could perform a classic MitM (where he plays as Bob to Alice, and as Alice to Bob), and have Alice and Bob use $k'_a$ and $k'_b$ that Mallory knows. But that leads to different $k'_a$ and $k'_b$, and Mallory has to decipher then re-encipher all symmetrically-enciphered messages between Alice and Bob. That's at least a chore for Mallory, and might lead to his active snooping to be detected.
Thus Mallory wants $k'_a=k'_b$. With the basic protocol above, he can achieve this my making $\hat m_a=\hat m_b=1$, $\hat m_a=\hat m_b=p+1$, or $\hat m_a=\hat m_b=p$, which will lead to $s_a=s_b=1$ or $s_a=s_b=0$, hence $k'_a=k'_b$ and known to Mallory. The question's countermeasure won't help against that, but the simpler countermeasure that Alice checks $s_a>1$ will block it. We assume that from now on.
Mallory can still succeed with fairs odds by sending $\hat m_b=p-1$. With odds about 25%, $a$ and $b$ will both be odd, giving $s_a=s_b=p-1$. If $g$ is a generator of $\mathbb Z_p^*$, Mallory can even force Alice to use odd $a$, by having Alice retry until ${m_a}^{(p-1)/2}\bmod p\ne1$ (which insures $a$ odd); same for Bob. The question's technique starts helping, even so little: Mallory can no longer determine the parity of $a$ from what Alice first sends, and must allow the protocol to advance to the second step for Alice before Mallory aborts it, or not.
Note: I tried to find attacks that work even if further it is checked $s_a<p-1$ or something similar intended to block the above, but so far found none. I welcome these (there's an open question), and vaguely conjecture that the question's countermeasure is likely to mitigate such other attack, if any.
| improve this answer | | | | |
$\endgroup$
1
$\begingroup$
What you are describing sounds like a variation on the interlock protocol, which is a strange creature that
• is completely useless for anything except for a club of chess grandmasters whose criterion for admission is to defeat an existing grandmaster in the club, and yet
• persistently remains seductively alluring to passersby who are not yet convinced that it is fundamentally impossible for two parties who know nothing about each other a priori to establish an authenticated shared secret.
To wit, how does Alice know whether to do the interlock protocol with Bob on Monday or on Tuesday, if Mallory can initiate the protocol on whichever day they like?
| improve this answer | | | | |
$\endgroup$
• $\begingroup$ The reference to the interlock protocol is spot-on! $\endgroup$ – fgrieu Feb 6 '18 at 9:33
• $\begingroup$ I don't think it is completely useless (in practice yes, due to the alternative approaches that work much better for a wider range of scenarios) --- two parties that do know about each other still have no way to guarantee that there is no MITM using DH, but they can with this interlock protocol (unless I'm still missing something?). Either Monday or Tuesday without prior agreement, once the communication is established, they can authenticate each other based on challenges that rely on their a priori knowledge of each other, no? $\endgroup$ – Cal-linux Feb 6 '18 at 20:34
• $\begingroup$ If you can share knowledge a priori, then that is what provides the authentication, not the interlock protocol. $\endgroup$ – Squeamish Ossifrage Feb 6 '18 at 21:49
• $\begingroup$ The question never was about authentication, it was about ensuring that there isn't an eavesdropper. (With authenticated public keys, that comes for free, sure). But the parties authenticating each other based on prior knowledge but without any prior arrangement for the communication does not guarantee the absence of a MITM (and that is a reasonable/realistic scenario: we know each other and once we're communicating we can tell each other from any, or say most adversaries, but one of us asynchronously decided to contact the other without having arranged for that communication) $\endgroup$ – Cal-linux Feb 7 '18 at 1:44
• 1
$\begingroup$ If your hash-based challenge-response protocol using a prior shared secret can't detect a MITM, then it's not a very good authentication protocol, is it? If your authentication protocol does work, like many password-based key agreement protocols or like the socialist millionaire protocol on top of DH key agreement (provided it covers both the prior shared secret and the DH session key), you don't need the interlock protocol. $\endgroup$ – Squeamish Ossifrage Feb 7 '18 at 17:58
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.900464 |
BOOL
The BOOL data type stores a Boolean value of false or true.
Aliases
In CockroachDB, BOOLEAN is an alias for BOOL.
Syntax
There are two predefined named constants for BOOL: TRUE and FALSE (the names are case-insensitive).
Alternately, a boolean value can be obtained by coercing a numeric value: zero is coerced to FALSE, and any non-zero value to TRUE.
• CAST(0 AS BOOL) (false)
• CAST(123 AS BOOL) (true)
Size
A BOOL value is 1 byte in width, but the total storage size is likely to be larger due to CockroachDB metadata.
Examples
icon/buttons/copy
> CREATE TABLE bool (a INT PRIMARY KEY, b BOOL, c BOOLEAN);
icon/buttons/copy
> SHOW COLUMNS FROM bool;
column_name | data_type | is_nullable | column_default | generation_expression | indices | is_hidden
--------------+-----------+-------------+----------------+-----------------------+-----------+------------
a | INT8 | false | NULL | | {primary} | false
b | BOOL | true | NULL | | {primary} | false
c | BOOL | true | NULL | | {primary} | false
(3 rows)
icon/buttons/copy
> INSERT INTO bool VALUES (12345, true, CAST(0 AS BOOL));
icon/buttons/copy
> SELECT * FROM bool;
+-------+------+-------+
| a | b | c |
+-------+------+-------+
| 12345 | true | false |
+-------+------+-------+
Supported casting and conversion
BOOL values can be cast to any of the following data types:
Type Details
INT Converts true to 1, false to 0
DECIMAL Converts true to 1, false to 0
FLOAT Converts true to 1, false to 0
STRING ––
See also
Data Types
YesYes NoNo | __label__pos | 0.642618 |
Task parameters
• Input - task parameters which come to the start node of the process
• Local - internal frequently used parameters for fast and convenient use in logic
• Output - task parameters, which are the result of a process
Task parameters menu is designed to describe task parameters of the process:
Task parameters interface:
1 - + Add parameter - add empty fields to describe a new parameter
2 - Copy - copy all parameters from the current tab
3 - Paste - paste parameters (this button is inactive while there are no parameters in the clipboard)
4 - copy parameter
5 - delete parameter
6 - Cancel - close window without saving changes
7 - Save - close window with saving changes.
You can also open Task parameters when specifying parameters to the logic. By default, the parameter is added to Local:
Task archive (Table mode) displays already described parameters highlighted. To specify the new ones, click "+" next to the parameter.
The parameter is added to the Local tab, Name and Description fields are filled in, the data type is determined automatically. If necessary, edit the description and click Save.
Describing Parameters
To add a description of the task parameters:
• click Task parameters
• select the tab according to the use of the parameter (Input/Local/Output)
• press button + Add parameter
• enter parameter Name
• enter short Description (optional)
• select data type
• specify the parameter:
• Auto-clear - hides parameter value (displays as "*") in Task archive**
• Required (for Input and Output parameters)
• RegExp - parameter validation using regular expressions (only for Input parameters)
• press Save
Parameters pass validation when adding.
Possible errors:
Parameter "<name>" is already exist - duplicate parameter in one of the tabs
Name is empty - Parameter name field is not filled (required)
Invalid parameter name - contains invalid characters.
Parameter Name
Parameter name must be unique for all tabs.
It may contain:
• big and small Latin letters
• numbers
• characters "_", "#", "@", "$", "\", "[", "]", "."
Escaping special characters in parameter name
If parameter name contains characters ".", "[" or "]" you must escape it with a backslash.
For example
phone[0] - element of the array "phone"
phone\[0\] - parameter "phone[0]"
Examples of valid parameter names:
Parameter Type
String:
{
"name": "John"
}
Number (integer, float):
{
"card_number": 123456789,
"bonus": 10.50
}
Please notice!
The maximum value for type Number - 2ˆ53 = 9 007 199 254 740 992. For large values, you must use String.
Boolean - true or false:
{
"send_notifications": false,
"subscribed": true
}
Array:
{
"phones": [
"+380991234567",
"+380661234567"
]
}
Object - set of "key-value" pairs:
{
"address": {
"city": "Odessa",
"zip_code": 65000
}
}
How to use RegExp
Regular expression is a good way to validate parameter value of task parameter in process. It can be validation of text fields such as names, addresses, phone numbers, etc.
Adding the parameter description, select RegExp.
Enter:
• Regex for validation of value - regular expression
• Text of the response in case of error regexp - error text if validation failed
Press Save.
This option is available only for Input parameters.
The parameter is validated by the added regular expression at the input to the process. If validation failed, an error specified in Text of the response in case of error regexp occurs.
Masking Values
Parameters values and task references, which consist of a set of digits and are similar to the format of:
• bank account / card number
• CVV code are masked in Task Archive (displayed as "*"). To disable masking values specify process parameters.
To disable masking task references switch off the checkbox Mask REF in Task parameters.
Why describe the task parameters?
Input parameters are substituted to new task automatically.
When adding Call Process, Copy Task, Modify Task logic to the process, the Input parameters of the selected process are automatically substituted.
Output parameters are used to configure the logic Reply to Process:
Also described parameters can be selected in all logics from the dropdown list. The drop-down list is called by clicking on the field to enter a variable. For example, in logic Condition:
results matching ""
No results matching ""
Would you recommend to your colleagues Corezoid.com documentation for learning?
Please enter your email to feedback
Thank you! | __label__pos | 0.958558 |
Skip to main content
Figures
Decide whether your illustrations are relevant content or decorative elements.
1. Relevant content
Anchor your illustrations if they do not have the layout option In line with text. Anchoring has an effect on the logical reading order - the anchored object always follows the paragraph to which it was anchored.
Do not forget to enter the alternative text in the task pane axesWord - Role Mapping.
2. Decorative elements
Change the role to Artifact in the context-sensitive task pane axesWord - Role Mapping. An alternative text is then not required. | __label__pos | 0.982955 |
Square into a circle
why is it not symmetric?
Isn’t it? How so?
No. Auto-fold doesn’t make it symmetrical. I don’t know the reason why.
There are other ways to accomplish it, though.
Curviloft is one.
I wonder if it’s making the fewest number of faces? In your example the auto fold one has 26 faces, and the symmetrical one is 48 faces.
I’ve tried using Auto-fold for embossed letters and have similar issues. The problem seems to be related to filling in each “quadrant” maybe? | __label__pos | 0.99986 |
Large Data Files - Timeout
Hello,
I am running into an issue with system resources and large data files. For context, we are ramping up the number of pages we are building 10x by 10x until we hit hundreds of thousands. Every page must be accompanied by a data file (we are using .json format). The problem as I understand it is that when Hugo is building the site with the data files it is trying to load all (or a lot) of the data files in memory and causing our build to be killed.
Is there a way to lazy load the data files, process in serial instead of parallel, or any other way of possibly reducing the system requirements for building a site like this?
I have also been reading this for more context: github bug
I don’t think there’s a way other than parallel according to the docs. Is there something that can be set before running Hugo? I know MacOS has ulimit. | __label__pos | 0.884916 |
How to pass an array through url_for
hi , every one.
i just want to generate url from url_for method
like this:
url_for(:controller=>“users”,:action=>“index”,:names=>[“aotianlong”,“ayowaya”])
i except it’s generate
users?names[]=aotianlong&names[]=ayowaya
but it’s generated :
users?names=aotianlong%2Fayowaya
any idiea ?
thank you .
IS this the RAILS’s bug?
2007/9/7, aotianlong [email protected]:
The way rails does it is the correct way. It will be reconstructed as
an array in the params hash.
Looks like it. However, did you try in edge rails ? url_for()
generates expected link in edge for me. That’d be
“users?names[]=aotianlong&names[]=ayowaya” in your case,
On 9/7/07, ao tianlong [email protected] wrote:
any idiea ?
thank you .
Cheers!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
| Privacy Policy | Terms of Service | Remote Ruby Jobs | __label__pos | 0.998921 |
Product Code Database
Example Keywords: nokia -kindle $76
barcode-scavenger
» Wiki: Control Character
Tag Wiki 'Control Character'.
Tag
In and telecommunication, a control character or non-printing character is a (a ) in a character set, that does not represent a written symbol. They are used as in-band signaling to cause effects other than the addition of a symbol to the text. All other characters are mainly printing, printable, or graphic characters, except perhaps for the "space" character (see ASCII printable characters).
All entries in the table below code 32 (technically the C0 control code set) are of this kind, including used to separate lines of text. The code 127 () is also a control character. sets defined by ISO 8859 added the codes 128 through 159 as control characters, this was primarily done so that if the high bit was stripped it would not change a printing character to a C0 control code, but there have been some assignments here, in particular . This second set is called the C1 set.
These 65 control codes were carried over to . Unicode added more characters that could be considered controls, but it makes a distinction between these "Formatting characters" (such as the Zero-width non-joiner), and the 65 Control characters.
The Extended Binary Coded Decimal Interchange Code (EBCDIC) character set contains 65 control codes, including all of the ASCII control codes as well as additional codes which are mostly used to control IBM peripherals.
0x00DLE
0x01DC1
0x02DC2
0x03ETXDC3
0x04EOTDC4
0x05ENQNAK
0x06ACKSYN
0x07ETB
0x08
0x09EM
0x0ASUB
0x0B
0x0C
0x0D
0x0ESO
0x0FSI
0x7F
History
Procedural signs in are a form of control character.
A form of control characters were introduced in the 1870 : NUL and DEL. The 1901 added the (CR) and (LF), and other versions of the Baudot code included other control characters.
The (BEL), which rang a bell to alert operators, was also an early control character.
Control characters have also been called "format effectors".
In ASCII
The control characters in ASCII still in common use include:
• 0 (, NUL, \0, ^@), originally intended to be an ignored character, but now used by many programming languages including C to mark the end of a string.
• 7 (, BEL, \a, ^G), which may cause the device receiving it to emit a warning of some kind (usually audible).
• 8 (, BS, \b, ^H), may overprint the previous character.
• 9 (, HT, \t, ^I), moves the printing position right to the next tab stop.
• 10 (, LF, \n, ^J), moves the print head down one line, or to the left edge and down. Used as the end of line marker in most and variants.
• 11 (, VT, \v, ^K), vertical tabulation.
• 12 (, FF, \f, ^L), to cause a printer to eject paper to the top of the next page, or a video terminal to clear the screen.
• 13 (, CR, \r, ^M), moves the printing position to the start of the line, allowing overprinting. Used as the end of line marker in Classic Mac OS, OS-9, FLEX (and variants). A CR+LF pair is used by CP/M-80 and its derivatives including and Windows, and by Application Layer protocols such as FTP, SMTP, and HTTP.
• 26 (, SUB, EOF, ^Z). Acts as an end-of-file for the Windows text-mode file i/o.
• 27 (, ESC, \e (GCC only), ^[). Introduces an .
You may often see control characters described as doing something when the user inputs them, such as code 3 (End-of-Text character, ETX, ^C) to interrupt the running process, or code 4 (End of transmission, EOT, ^D), used to end text input or to exit a . These uses usually have little to do with their use when they are in text being output, and on modern systems usually do not involve the transmission of the code number at all (instead the program gets the fact that the user is holding down the Ctrl key and pushing the key marked with a 'C').
There were quite a few control characters defined (33 in ASCII, and the ECMA-48 standard adds 32 more). This was because early terminals had very primitive mechanical or electrical controls that made any kind of state-remembering api quite expensive to implement, thus a different code for each and every function looked like a requirement. It quickly became possible and inexpensive to interpret sequences of codes to perform a function, and device makers found a way to send hundreds of device instructions. Specifically, they used ASCII code 27 (escape), followed by a series of characters called a "control sequence" or "escape sequence". The mechanism was invented by , the father of ASCII. For example, the sequence of code 27, followed by the printable characters "[2;10H", would cause a DEC VT-102 terminal to move its cursor to the 10th cell of the 2nd line of the screen. Several standards exist for these sequences, notably ANSI X3.64. But the number of non-standard variations in use is large, especially among printers, where technology has advanced far faster than any standards body can possibly keep up with.
In Unicode
In Unicode, "Control-characters" are U+0000—U+001F (C0 controls), U+007F (delete), and U+0080—U+009F (C1 controls). Their General Category is "Cc". Formatting codes are distinct, in General Category "Cf". The Cc control characters have no Name in Unicode, but are given labels such as "" instead.
Display
There are a number of techniques to display non-printing characters, which may be illustrated with the in encoding:
• : decimal 7, hexadecimal 0x07
• An abbreviation, often three capital letters: BEL
• A special character condensing the abbreviation: Unicode U+2407 (␇), "symbol for bell"
• An ISO 2047 graphical representation: Unicode U+237E (⍾), "graphic for bell"
• in ASCII, where code point 00xxxxx is represented as a caret followed by the capital letter at code point 10xxxxx: ^G
• An , as in C/C++ character string codes: \a, \007, \x07, etc.
How control characters map to keyboards
ASCII-based keyboards have a key labelled "", "Ctrl", or (rarely) "Cntl" which is used much like a shift key, being pressed in combination with another letter or symbol key. In one implementation, the control key generates the code 64 places below the code for the (generally) uppercase letter it is pressed in combination with (i.e., subtract 64 from ASCII code value in decimal of the (generally) uppercase letter). The other implementation is to take the ASCII code produced by the key and bitwise AND it with 31, forcing bits 6 and 7 to zero. For example, pressing "control" and the letter "g" or "G" (code 107 in or 71 in , which is 01000111 in binary, produces the code 7 (Bell, 7 in base 10, or 00000111 in binary). The NULL character (code 0) is represented by Ctrl-@, "@" being the code immediately before "A" in the ASCII character set. For convenience, a lot of terminals accept Ctrl-Space as an alias for Ctrl-@. In either case, this produces one of the 32 ASCII control codes between 0 and 31. This approach is not able to represent the DEL character because of its value (code 127), but Ctrl-? is often used for this character, as subtracting 64 from a '?' gives −1, which if masked to 7 bits is 127.
When the control key is held down, letter keys produce the same control characters regardless of the state of the or keys. In other words, it does not matter whether the key would have produced an upper-case or a lower-case letter. The interpretation of the control key with the space, graphics character, and digit keys (ASCII codes 32 to 63) vary between systems. Some will produce the same character code as if the control key were not held down. Other systems translate these keys into control characters when the control key is held down. The interpretation of the control key with non-ASCII ("foreign") keys also varies between systems.
Control characters are often rendered into a printable form known as by printing a caret (^) and then the ASCII character that has a value of the control character plus 64. Control characters generated using letter keys are thus displayed with the upper-case form of the letter. For example, ^G represents code 7, which is generated by pressing the G key when the control key is held down.
Keyboards also typically have a few single keys which produce control character codes. For example, the key labelled "Backspace" typically produces code 8, "Tab" code 9, "Enter" or "Return" code 13 (though some keyboards might produce code 10 for "Enter").
Many keyboards include keys that do not correspond to any ASCII printable or control character, for example cursor control arrows and functions. The associated keypresses are communicated to computer programs by one of four methods: appropriating otherwise unused control characters; using some encoding other than ASCII; using multi-character control sequences; or using an additional mechanism outside of generating characters. "Dumb" computer terminals typically use control sequences. Keyboards attached to stand-alone personal computers made in the 1980s typically use one (or both) of the first two methods. Modern computer keyboards generate that identify the specific physical keys that are pressed; computer software then determines how to handle the keys that are pressed, including any of the four methods described above.
The design purpose
The control characters were designed to fall into a few groups: printing and display control, data structuring, transmission control, and miscellaneous.
Printing and display control
Printing control characters were first used to control the physical mechanism of printers, the earliest output device. An early implementation of this idea was the ASA carriage control characters. Later, control characters were integrated into the stream of data to be printed. The carriage return character (CR), when sent to such a device, causes it to put the character at the edge of the paper at which writing begins (it may, or may not, also move the printing position to the next line). The line feed character (LF/NL) causes the device to put the printing position on the next line. It may (or may not), depending on the device and its configuration, also move the printing position to the start of the next line (which would be the leftmost position for scripts, such as the alphabets used for Western languages, and the rightmost position for scripts such as the Hebrew and Arabic alphabets). The vertical and horizontal tab characters (VT and HT/TAB) cause the output device to move the printing position to the next tab stop in the direction of reading. The form feed character (FF/NP) starts a new sheet of paper, and may or may not move to the start of the first line. The backspace character (BS) moves the printing position one character space backwards. On printers, this is most often used so the printer can overprint characters to make other, not normally available, characters. On terminals and other electronic output devices, there are often software (or hardware) configuration choices which will allow a destruct backspace (i.e., a BS, SP, BS sequence) which erases, or a non-destructive one which does not. The shift in and shift out characters (SO and SI) selected alternate character sets, fonts, underlining or other printing modes. Escape sequences were often used to do the same thing.
With the advent of computer terminals that did not physically print on paper and so offered more flexibility regarding screen placement, erasure, and so forth, printing control codes were adapted. Form feeds, for example, usually cleared the screen, there being no new paper page to move to. More complex escape sequences were developed to take advantage of the flexibility of the new terminals, and indeed of newer printers. The concept of a control character had always been somewhat limiting, and was extremely so when used with new, much more flexible, hardware. Control sequences (sometimes implemented as escape sequences) could match the new flexibility and power and became the standard method. However, there were, and remain, a large variety of standard sequences to choose from.
Data structuring
The separators (File, Group, Record, and Unit: FS, GS, RS and US) were made to structure data, usually on a tape, in order to simulate . End of medium (EM) warns that the tape (or other recording medium) is ending. While many systems use CR/LF and TAB for structuring data, it is possible to encounter the separator control characters in data that needs to be structured. The separator control characters are not overloaded; there is no general use of them except to separate data into structured groupings. Their numeric values are contiguous with the space character, which can be considered a member of the group, as a word separator.
Transmission control
The transmission control characters were intended to structure a data stream, and to manage re-transmission or graceful failure, as needed, in the face of transmission errors.
The start of heading (SOH) character was to mark a non-data section of a data stream—the part of a stream containing addresses and other housekeeping data. The start of text character (STX) marked the end of the header, and the start of the textual part of a stream. The end of text character (ETX) marked the end of the data of a message. A widely used convention is to make the two characters preceding ETX a checksum or CRC for error-detection purposes. The end of transmission block character (ETB) was used to indicate the end of a block of data, where data was divided into such blocks for transmission purposes.
The escape character () was intended to "quote" the next character, if it was another control character it would print it instead of performing the control function. It is almost never used for this purpose today.
The substitute character (SUB) was intended to request a translation of the next character from a printable character to another value, usually by setting bit 5 to zero. This is handy because some media (such as sheets of paper produced by typewriters) can transmit only printable characters. However, on MS-DOS systems with files opened in text mode, "end of text" or "end of file" is marked by this character, instead of the or Ctrl-D, which are common on other operating systems.
The cancel character () signalled that the previous element should be discarded. The negative acknowledge character (NAK) is a definite flag for, usually, noting that reception was a problem, and, often, that the current element should be sent again. The acknowledge character (ACK) is normally used as a flag to indicate no problem detected with current element.
When a transmission medium is half duplex (that is, it can transmit in only one direction at a time), there is usually a master station that can transmit at any time, and one or more slave stations that transmit when they have permission. The enquire character (ENQ) is generally used by a master station to ask a slave station to send its next message. A slave station indicates that it has completed its transmission by sending the end of transmission character (EOT).
The device control codes (DC1 to DC4) were originally generic, to be implemented as necessary by each device. However, a universal need in data transmission is to request the sender to stop transmitting when a receiver can't take more data right now. Digital Equipment Corporation invented a convention which used 19, (the device control 3 character (DC3), also known as control-S, or XOFF) to "S"top transmission, and 17, (the device control 1 character (DC1), a.k.a. control-Q, or XON) to start transmission. It has become so widely used that most don't realize it is not part of official ASCII. This technique, however implemented, avoids additional wires in the data cable devoted only to transmission management, which saves money. A sensible protocol for the use of such transmission flow control signals must be used, to avoid potential deadlock conditions, however.
The data link escape character (DLE) was intended to be a signal to the other end of a data link that the following character is a control character such as STX or ETX. For example a packet may be structured in the following way (DLE) (DLE) .
Miscellaneous codes
Code 7 () is intended to cause an audible signal in the receiving terminal.An old RFC, which explains the structure and meaning of the control characters in chapters 4.1 and 5.2
Many of the ASCII control characters were designed for devices of the time that are not often seen today. For example, code 22, "synchronous idle" (SYN), was originally sent by synchronous modems (which have to send data constantly) when there was no actual data to send. (Modern systems typically use a start bit to announce the beginning of a transmitted word— this is a feature of asynchronous communication. Synchronous communication links were more often seen with mainframes, where they were typically run over corporate leased lines to connect a mainframe to another mainframe or perhaps a minicomputer.)
Code 0 (ASCII code name ) is a special case. In paper tape, it is the case when there are no holes. It is convenient to treat this as a fill character with no meaning otherwise. Since the position of a NUL character has no holes punched, it can be replaced with any other character at a later time, so it was typically used to reserve space, either for correcting errors or for inserting information that would be available at a later time or in another place. In computing it is often used for padding in fixed length records and more commonly, to mark the end of a string.
Code 127 (, a.k.a. "rubout") is likewise a special case. Its 7-bit code is all-bits-on in binary, which essentially erased a character cell on a when overpunched. Paper tape was a common storage medium when ASCII was developed, with a computing history dating back to WWII code breaking equipment at Biuro Szyfrów. Paper tape became obsolete in the 1970s, so this clever aspect of ASCII rarely saw any use after that. Some systems (such as the original Apples) converted it to a backspace. But because its code is in the range occupied by other printable characters, and because it had no official assigned glyph, many computer equipment vendors used it as an additional printable character (often an all-black "box" character useful for erasing text by overprinting with ink).
Non-erasable Programmable ROMs are typically implemented as arrays of fusible elements, each representing a , which can only be switched one way, usually from one to zero. In such PROMs, the DEL and NUL characters can be used in the same way that they were used on punched tape: one to reserve meaningless fill bytes that can be written later, and the other to convert written bytes to meaningless fill bytes. For PROMs that switch one to zero, the roles of NUL and DEL are reversed; also, DEL will only work with 7-bit characters, which are rarely used today; for 8-bit content, the character code 255, commonly defined as a nonbreaking space character, can be used instead of DEL.
Many do not allow control characters in the , as they may have reserved functions.
See also
• C0 and C1 control codes
• In-band signaling
• Whitespace character
Notes and references
External links
Page 1 of 1
1
Page 1 of 1
1
Account
Social:
Pages: .. ..
Items: ..
Navigation
General: Atom Feed Atom Feed ..
Help: .. ..
Category: .. ..
Media: .. ..
Posts: .. .. ..
Statistics
Page: ..
Summary: ..
1 Tags
10/10 Page Rank
5 Page Refs | __label__pos | 0.831983 |
Logo ROOT
Reference Guide
TEvePolygonSetProjected.h
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TEvePolygonSetProjected
13#define ROOT_TEvePolygonSetProjected
14
15#include "TEveVector.h"
16#include "TEveShape.h"
17#include <list>
18
19class TBuffer3D;
20
22 public TEveProjected
23{
26
27private:
30
31protected:
32 struct Polygon_t
33 {
34 Int_t fNPnts; // number of points
35 Int_t* fPnts; // point indices
36
37 Polygon_t() : fNPnts(0), fPnts(nullptr) {}
38 virtual ~Polygon_t() { delete [] fPnts; fNPnts = 0; fPnts = nullptr; }
39
41 { fNPnts = x.fNPnts; fPnts = x.fPnts; return *this; }
42
44 {
45 for (Int_t i=0; i<fNPnts; ++i) {
46 if (fPnts[i] == pi) return i;
47 }
48 return -1;
49 }
50 };
51
52 typedef std::list<Polygon_t> vpPolygon_t;
53 typedef vpPolygon_t::iterator vpPolygon_i;
54 typedef vpPolygon_t::const_iterator vpPolygon_ci;
55
56private:
57 TBuffer3D* fBuff; // buffer of projectable object
58
60 Float_t AddPolygon(std::list<Int_t, std::allocator<Int_t> >& pp, std::list<Polygon_t, std::allocator<Polygon_t> >& p);
61
65
66protected:
67 vpPolygon_t fPols; // polygons
68 vpPolygon_t fPolsBS; // polygons build from TBuffer3D segments
69 vpPolygon_t fPolsBP; // polygons build from TBuffer3D polygons
70
71 Int_t fNPnts; // number of reduced and projected points
72 TEveVector* fPnts; // reduced and projected points
73
74 virtual void SetDepthLocal(Float_t d);
75
76 Float_t PolygonSurfaceXY(const Polygon_t& poly) const;
77
78public:
79 TEvePolygonSetProjected(const char* n="TEvePolygonSetProjected", const char* t="");
81
82 virtual void ComputeBBox();
83
84 virtual void SetProjection(TEveProjectionManager* mng, TEveProjectable* model);
85 virtual void UpdateProjection();
86 virtual TEveElement* GetProjectedAsElement() { return this; }
87
88 void ProjectBuffer3D();
89
90 virtual void DumpPolys() const;
91 void DumpBuffer3D();
92
93 ClassDef(TEvePolygonSetProjected,0); // Set of projected polygons with outline; typically produced from a TBuffer3D.
94
95};
96
97#endif
#define d(i)
Definition: RSha256.hxx:102
#define s0(x)
Definition: RSha256.hxx:90
#define s1(x)
Definition: RSha256.hxx:91
float Float_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:335
winID h TVirtualViewer3D TVirtualGLPainter p
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:36
GL-renderer for TEvePolygonSetProjected class.
A set of projected polygons.
virtual void ComputeBBox()
Override of virtual method from TAttBBox.
virtual void SetDepthLocal(Float_t d)
Set depth (z-coordinate) of the projected points.
TEvePolygonSetProjected & operator=(const TEvePolygonSetProjected &)=delete
void DumpBuffer3D()
Dump information about currently projected buffer.
vpPolygon_t::iterator vpPolygon_i
virtual TEveElement * GetProjectedAsElement()
Returns this projected dynamic-casted to TEveElement.
vpPolygon_t::const_iterator vpPolygon_ci
Int_t * ProjectAndReducePoints()
Project and reduce buffer points.
Float_t MakePolygonsFromBS(Int_t *idxMap)
Build polygons from the set of buffer segments.
std::list< Polygon_t > vpPolygon_t
Float_t MakePolygonsFromBP(Int_t *idxMap)
Build polygons from list of buffer polygons.
TEvePolygonSetProjected(const TEvePolygonSetProjected &)=delete
Float_t PolygonSurfaceXY(const Polygon_t &poly) const
Calculate XY surface of a polygon.
virtual void SetProjection(TEveProjectionManager *mng, TEveProjectable *model)
This is virtual method from base-class TEveProjected.
void ProjectBuffer3D()
Project current buffer.
virtual void UpdateProjection()
This is virtual method from base-class TEveProjected.
virtual ~TEvePolygonSetProjected()
Destructor.
Float_t AddPolygon(std::list< Int_t, std::allocator< Int_t > > &pp, std::list< Polygon_t, std::allocator< Polygon_t > > &p)
Check if polygon has dimensions above TEveProjection::fgEps and add it to a list if it is not a dupli...
virtual void DumpPolys() const
Dump information about built polygons.
Bool_t IsFirstIdxHead(Int_t s0, Int_t s1)
Compare the two segments and check if the first index of first segment is starting.
Abstract base-class for non-linear projectable objects.
Abstract base class for classes that hold results of a non-linear projection transformation.
Manager class for steering of projections and managing projected objects.
Abstract base-class for 2D/3D shapes.
Definition: TEveShape.h:26
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
static constexpr double pi
Polygon_t & operator=(const Polygon_t &x) | __label__pos | 0.767363 |
分享:新浪RSS解析,比较老的一个话题啦
2015-11-22 06:30:01 阅读( 140 )
2118人 收藏本页
标签:Java面试题
代码结构不复杂Main.java 主类News.java和Outline.java 一条新闻对象和一个新闻频道对象PublicUtils.java 工具类很简单,就一个读取配置文件中新浪RSS的地址的方法Dom4jXmlParser.java 这个类是核心,根据工具类读取进来的地址进行解析XML文档,获取到各个频道的集合,然后再迭代解析各个频道内的XML获取新闻的集合,用News(新闻)和Outline(频道)封装。
[Java]代码
文件:resource_sina.properties
内容:url=http://rss.sina.com.cn/sina_all_opml.xml
作用:存放新浪RSS接口地址的配置文件
[Java]代码
package cn.outofmemory.code;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import cn.tyz.domain.News;
import cn.tyz.domain.Outline;
import cn.tyz.utils.PublicUtils;
import cn.tyz.xml.Dom4jXmlParser;
public class Main
{
public static void main(String[] args)
{
try
{
// 获取各个频道名称及子频道集合,并迭代
Map<String, List<Outline>> map_Channels =
Dom4jXmlParser.getLinkAsXmlData(new URL(PublicUtils.getUrl()));
Iterator<Entry<String, List<Outline>>>
iterator_Channels = map_Channels.entrySet().iterator();
while(iterator_Channels.hasNext())
{
// 一个频道
Entry<String, List<Outline>> entry = iterator_Channels.next();
String channelName = entry.getKey(); // 频道名称
List<Outline> outlines = entry.getValue(); // 频道内子频道项目
System.out.println("模块名称:"+channelName);
// 迭代子频道
Iterator<Outline> iterator_Item = outlines.iterator();
while(iterator_Item.hasNext())
{
// 一个子频道
Outline outline = iterator_Item.next();
System.out.println(outline.getText() + ":" + outline.getXmlUrl() + "内容:\n");
URL url = new URL(outline.getXmlUrl());
// 根据子频道的XMLURL获取新闻集合,并迭代
List<News> list_News = Dom4jXmlParser.getNewsAsXmlData(url);
Iterator<News> iterator_News = list_News.iterator();
while(iterator_News.hasNext())
{
// 一条新闻
News news = iterator_News.next();
System.out.println(news.getTitle().trim());
System.out.println(news.getDescription().trim());
System.out.println(news.getPubDate().trim());
System.out.println(news.getLink().trim());
System.out.println(news.getCategory().trim());
System.out.println(news.getComments().trim());
System.out.println("\n");
}
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
[Java]代码
package cn.tyz.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PublicUtils
{
// 读取资源文件中的URL
public static String getUrl()
{
String url = "";
InputStream in = PublicUtils.class.getClassLoader()
.getResourceAsStream("resource_sina.properties");
Properties properties = new Properties();
try
{
properties.load(in);
}
catch (IOException e)
{
e.printStackTrace();
}
url = properties.getProperty("url");
return url;
}
}
[Java]代码
package cn.tyz.domain;
public class News
{
private String title;
private String link;
private String author;
private String guid;
private String category;
private String pubDate;
private String comments;
private String description;
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getLink()
{
return link;
}
public void setLink(String link)
{
this.link = link;
}
public String getAuthor()
{
return author;
}
public void setAuthor(String author)
{
this.author = author;
}
public String getGuid()
{
return guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public String getCategory()
{
return category;
}
public void setCategory(String category)
{
this.category = category;
}
public String getPubDate()
{
return pubDate;
}
public void setPubDate(String pubDate)
{
this.pubDate = pubDate;
}
public String getComments()
{
return comments;
}
public void setComments(String comments)
{
this.comments = comments;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
}
[Java]代码
package cn.tyz.domain;
public class Outline
{
private String title;
private String text;
private String type;
private String xmlUrl;
private String htmlUrl;
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getText()
{
return text;
}
public void setText(String text)
{
this.text = text;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getXmlUrl()
{
return xmlUrl;
}
public void setXmlUrl(String xmlUrl)
{
this.xmlUrl = xmlUrl;
}
public String getHtmlUrl()
{
return htmlUrl;
}
public void setHtmlUrl(String htmlUrl)
{
this.htmlUrl = htmlUrl;
}
}
[Java]代码
package cn.tyz.xml;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import cn.tyz.domain.News;
import cn.tyz.domain.Outline;
public class Dom4jXmlParser
{
// 根据URL解析大纲XML数据,获取各个频道的名称及频道内的子频道的名称和XML数据链接
public static Map<String, List<Outline>> getLinkAsXmlData(URL url) throws Exception
{
Map<String, List<Outline>> map_Channels = new HashMap<String, List<Outline>>();
// 加载XML到内存解析并得到Document对象
SAXReader reader = new SAXReader();
Document document = reader.read(url);
// 获取根节点
Element root = document.getRootElement();
// 获取根节点下的body,然后获取其下的所有一级的outline节点,并迭代
List<Element> ele_Channels = root.element("body").elements("outline");
Iterator<Element> iterator_Channel = ele_Channels.iterator();
while(iterator_Channel.hasNext())
{
// 频道名称节点
Element ele_Channel = iterator_Channel.next();
// 获取频道名称
String channelName = ele_Channel.attributeValue("text");
// 获取当前频道下的所有outline节点,并迭代
List<Element> ele_Items = ele_Channel.elements("outline");
Iterator<Element> iterator_Item = ele_Items.iterator();
// 存放一个频道内的子频道的集合
List<Outline> list_Items = new ArrayList<Outline>();
while(iterator_Item.hasNext())
{
// 子频道节点
Element ele_Item = iterator_Item.next();
Outline outline = new Outline();
outline.setTitle(ele_Item.attributeValue("title"));
outline.setText(ele_Item.attributeValue("text"));
outline.setType(ele_Item.attributeValue("type"));
outline.setXmlUrl(ele_Item.attributeValue("xmlUrl"));
outline.setHtmlUrl(ele_Item.attributeValue("htmlUrl"));
list_Items.add(outline);
}
map_Channels.put(channelName, list_Items);
}
return map_Channels;
}
// 根据URL解析单个子频道内的XML新闻数据
public static List<News> getNewsAsXmlData(URL url) throws Exception
{
// 加载XML到内存解析并得到Document对象
SAXReader reader = new SAXReader();
Document document = reader.read(url);
// 获取根节点
Element root = document.getRootElement();
// 获取所有新闻条目的集合,并迭代
List<Element> ele_Items = root.element("channel").elements("item");
Iterator<Element> iterator_Item = ele_Items.iterator();
// 存放所有新闻项的集合
List<News> list_News = new ArrayList<News>();
while(iterator_Item.hasNext())
{
// 新闻项节点
Element ele_Item = iterator_Item.next();
News news = new News();
news.setTitle(ele_Item.elementText("title"));
news.setLink(ele_Item.elementText("link"));
news.setAuthor(ele_Item.elementText("author"));
news.setGuid(ele_Item.elementText("guid"));
news.setCategory(ele_Item.elementText("category"));
news.setPubDate(ele_Item.elementText("pubDate"));
news.setComments(ele_Item.elementText("comments"));
news.setDescription(ele_Item.elementText("description"));
list_News.add(news);
}
return list_News;
}
}
下一篇:怎么使用java获得当前时间
上一篇:java连接SqlServer数据库调用存储过程代码
亲~ 如果您有更好的答案 可在评论区发表您独到的见解。
您想查看更多的信息: 面试题 | __label__pos | 0.998418 |
Android JNI 之 Bitmap 操作
Android JNI 之 Bitmap 操作
标签: Android JNI
在 Android 中通过 JNI 去操作 Bitmap。
在 Android 通过 JNI 去调用 Bitmap,通过 CMake 去编 so 动态链接库的话,需要添加 jnigraphics 图像库。
target_link_libraries( # Specifies the target library.
native-operation
jnigraphics
${log-lib} )
在 Android 中关于 JNI Bitmap 的操作,都定义在 bitmap.h 的头文件里面了,主要就三个函数,明白它们的含义之后就可以去实践体会了。
检索 Bitmap 对象信息
AndroidBitmap_getInfo 函数允许原生代码检索 Bitmap 对象信息,如它的大小、像素格式等,函数签名如下:
/**
* Given a java bitmap object, fill out the AndroidBitmapInfo struct for it.
* If the call fails, the info parameter will be ignored.
*/
int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap,
AndroidBitmapInfo* info);
其中,第一个参数就是 JNI 接口指针,第二个参数就是 Bitmap 对象的引用,第三个参数是指向 AndroidBitmapInfo 结构体的指针。
AndroidBitmapInfo 结构体如下:
/** Bitmap info, see AndroidBitmap_getInfo(). */
typedef struct {
/** The bitmap width in pixels. */
uint32_t width;
/** The bitmap height in pixels. */
uint32_t height;
/** The number of byte per row. */
uint32_t stride;
/** The bitmap pixel format. See {@link AndroidBitmapFormat} */
int32_t format;
/** Unused. */
uint32_t flags; // 0 for now
} AndroidBitmapInfo;
其中,width 就是 Bitmap 的宽,height 就是高,format 就是图像的格式,而 stride 就是每一行的字节数。
图像的格式有如下支持:
/** Bitmap pixel format. */
enum AndroidBitmapFormat {
/** No format. */
ANDROID_BITMAP_FORMAT_NONE = 0,
/** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/
ANDROID_BITMAP_FORMAT_RGBA_8888 = 1,
/** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/
ANDROID_BITMAP_FORMAT_RGB_565 = 4,
/** Deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead. **/
ANDROID_BITMAP_FORMAT_RGBA_4444 = 7,
/** Alpha: 8 bits. */
ANDROID_BITMAP_FORMAT_A_8 = 8,
};
如果 AndroidBitmap_getInfo 执行成功的话,会返回 0 ,否则返回一个负数,代表执行的错误码列表如下:
/** AndroidBitmap functions result code. */
enum {
/** Operation was successful. */
ANDROID_BITMAP_RESULT_SUCCESS = 0,
/** Bad parameter. */
ANDROID_BITMAP_RESULT_BAD_PARAMETER = -1,
/** JNI exception occured. */
ANDROID_BITMAP_RESULT_JNI_EXCEPTION = -2,
/** Allocation failed. */
ANDROID_BITMAP_RESULT_ALLOCATION_FAILED = -3,
};
访问原生像素缓存
AndroidBitmap_lockPixels 函数锁定了像素缓存以确保像素的内存不会被移动。
如果 Native 层想要访问像素数据并操作它,该方法返回了像素缓存的一个原生指针,
/**
* Given a java bitmap object, attempt to lock the pixel address.
* Locking will ensure that the memory for the pixels will not move
* until the unlockPixels call, and ensure that, if the pixels had been
* previously purged, they will have been restored.
*
* If this call succeeds, it must be balanced by a call to
* AndroidBitmap_unlockPixels, after which time the address of the pixels should
* no longer be used.
*
* If this succeeds, *addrPtr will be set to the pixel address. If the call
* fails, addrPtr will be ignored.
*/
int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr);
其中,第一个参数就是 JNI 接口指针,第二个参数就是 Bitmap 对象的引用,第三个参数是指向像素缓存地址的指针。
AndroidBitmap_lockPixels 执行成功的话返回 0 ,否则返回一个负数,错误码列表就是上面提到的。
释放原生像素缓存
对 Bitmap 调用完 AndroidBitmap_lockPixels 之后都应该对应调用一次 AndroidBitmap_unlockPixels 用来释放原生像素缓存。
当完成对原生像素缓存的读写之后,就应该释放它,一旦释放后,Bitmap Java 对象又可以在 Java 层使用了,函数签名如下:
/**
* Call this to balance a successful call to AndroidBitmap_lockPixels.
*/
int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap);
其中,第一个参数就是 JNI 接口指针,第二个参数就是 Bitmap 对象的引用,如果执行成功返回 0,否则返回 1。
对 Bitmap 的操作,最重要的就是 AndroidBitmap_lockPixels 函数拿到所有像素的缓存地址,然后对每个像素值进行操作,从而更改 Bitmap 。
实践
通过对 Bitmap 进行旋转,上下翻转,左右镜像来体验 JNI 的开发。
效果如下:
具体代码可以参考我的 Github 项目,欢迎 Star。
https://github.com/glumes/AndroidDevWithCpp
通过 JNI 将 Bitmap 旋转
首先定义一个这样的 native 函数:
// 顺时针旋转 90° 的操作
public native Bitmap rotateBitmap(Bitmap bitmap);
传入一个 Bitmap 对象,然后返回一个 Bitmap 对象。
然后在 C++ 代码中,首先检索 Bitmap 的信息,看看是否成功。
AndroidBitmapInfo bitmapInfo;
int ret;
if ((ret = AndroidBitmap_getInfo(env, bitmap, &bitmapInfo)) < 0) {
LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
return NULL;
}
接下来就是获得 Bitmap 的像素缓存指针:
// 读取 bitmap 的像素内容到 native 内存
void *bitmapPixels;
if ((ret = AndroidBitmap_lockPixels(env, bitmap, &bitmapPixels)) < 0) {
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
return NULL;
}
这个指针指向的就是 Bitmap 像素内容,它是一个以一维数组的形式保存所有的像素点的值,但是我们在定义 Bitmap 图像时,都会定义宽和高,这就相对于是一个二维的了,那么就存在 Bitmap 的像素内容如何转成指针指向的一维内容,是按照行排列还是按照列排列呢?
在这里是按照行进行排列的,而且行的排列是从左往右,列的排列是从上往下,起始点就和屏幕坐标原点一样,位于左上角。
通过 AndroidBitmap_lockPixels 方法,bitmapPixels 指针就指向了 Bitmap 的像素内容,它的长度就是 Bitmap 的宽和高的乘积。
要将 Bitmap 进行旋转,可以通过直接更改 bitmapPixels 指针指向的像素点的值,也可以通过创建一个新的 Bitmap 对象,然后将像素值填充到 Bitmap 对象中,这里选择后者的实现方式。
首先创建一个新的 Bitmap 对象,参考之前文章中提到的方式:Android 通过 JNI 访问 Java 字段和方法调用
在 Java 代码中,通过 createBitmap 方法可以创建一个 Bitmap,如下所示:
Bitmap.createBitmap(int width, int height, @NonNull Config config)`
所以在 JNI 中就需要调用 Bitmap 的静态方法来创建一个 Bitmap 对象。
jobject generateBitmap(JNIEnv *env, uint32_t width, uint32_t height) {
jclass bitmapCls = env->FindClass("android/graphics/Bitmap");
jmethodID createBitmapFunction = env->GetStaticMethodID(bitmapCls,
"createBitmap",
"(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
jstring configName = env->NewStringUTF("ARGB_8888");
jclass bitmapConfigClass = env->FindClass("android/graphics/Bitmap$Config");
jmethodID valueOfBitmapConfigFunction = env->GetStaticMethodID(
bitmapConfigClass, "valueOf",
"(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;");
jobject bitmapConfig = env->CallStaticObjectMethod(bitmapConfigClass,
valueOfBitmapConfigFunction, configName);
jobject newBitmap = env->CallStaticObjectMethod(bitmapCls,
createBitmapFunction,
width,
height, bitmapConfig);
return newBitmap;
}
首先通过 FindClass 方法找到 Config 类,得到一个 ARGB_8888 的配置,然后得到 Bitmap 类,调用它的静态方法 createBitmap 创建一个新的 Bitmap 对象,具体可以参考之前的文章。
在这里要传入新 Bitmap 的宽高,这个宽高也是通过 AndroidBitmap_getInfo 方法得到原来的宽高之后,根据不同的操作计算后得到的。
// 旋转操作,新 Bitmap 的宽等于原来的高,新 Bitmap 的高等于原来的宽
uint32_t newWidth = bitmapInfo.height;
uint32_t newHeight = bitmapInfo.width;
有了新的 Bitmap 对象,又有了原有的 Bitmap 像素指针,接下来就是创建新的像素指针,并填充像素内容,然后把这个像素内容再填充到 Bitmap 上。
// 创建一个新的数组指针,把这个新的数组指针填充像素值
uint32_t *newBitmapPixels = new uint32_t[newWidth * newHeight];
int whereToGet = 0;
for (int y = 0; y < newHeight; ++y) {
for (int x = newWidth - 1; x >= 0; x--) {
uint32_t pixel = ((uint32_t *) bitmapPixels)[whereToGet++];
newBitmapPixels[newWidth * y + x] = pixel;
}
}
在这两个 for循环里面就是从原来的像素指针中取出像素值,然后把它按照特定的排列顺序填充到新的像素指针中对应位置的值,这里也就是前面强调的像素指针是按照行进行排列的,起点是 Bitmap 的左上角。
void *resultBitmapPixels;
if ((ret = AndroidBitmap_lockPixels(env, newBitmap, &resultBitmapPixels)) < 0) {
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
return NULL;
}
int pixelsCount = newWidth * newHeight;
memcpy((uint32_t *) resultBitmapPixels, newBitmapPixels, sizeof(uint32_t) * pixelsCount);
AndroidBitmap_unlockPixels(env, newBitmap);
再次创建一个 resultBitmapPixels 指针,并调用 AndroidBitmap_lockPixels 方法获取新的 Bitmap 的像素指针缓存,然后调用 memcpy 方法,将待填充的像素指针填充到 resultBitmapPixels 上,这样就完成了像素的赋值,最后调用 AndroidBitmap_unlockPixels 方法释放像素指针缓存,完成整个赋值过程。
就这样通过读取原有 Bitmap 的像素内容然后进行操作后再赋值给新的 Bitmap 对象就完成了 JNI 操作 Bitmap 。
通过 JNI 将 Bitmap 上下翻转和左右镜像
将 Bitmap 进行上下翻转以及左右镜像和旋转操作类似了,只是针对像素指针的操作方式不同。
上下翻转的操作:
int whereToGet = 0;
for (int y = 0; y < newHeight; ++y) {
for (int x = 0; x < newWidth; x++) {
uint32_t pixel = ((uint32_t *) bitmapPixels)[whereToGet++];
newBitmapPixels[newWidth * (newHeight - 1 - y) + x] = pixel;
}
}
左右镜像的操作:
int whereToGet = 0;
for (int y = 0; y < newHeight; ++y) {
for (int x = newWidth - 1; x >= 0; x--) {
uint32_t pixel = ((uint32_t *) bitmapPixels)[whereToGet++];
newBitmapPixels[newWidth * y + x] = pixel;
}
}
其他的操作都相同了,具体还是看项目代码吧。
参考
1. 《Android C++ 高级编程–使用 NDK》
「真诚赞赏,手留余香」
Glumes
请我喝杯咖啡?
使用微信扫描二维码完成支付
欢迎扫码关注微信公众号:【音视频开发进阶】,获得最新文章推送~~~
原创文章,转载请注明来源: Android JNI 之 Bitmap 操作
相关文章
comments powered by Disqus | __label__pos | 0.921417 |
7 Replies Latest reply on Nov 8, 2016 12:34 AM by Laubender
How to find the location of text path in spread?
diwakarbhatt
I require finding the location of the text frame and text path element in a spread. I can do that easily for text frame by looking at path point array of the text frame. However, I am not able to do the same for text path element. Please guide me how can I find the location of text path.
• 1. Re: How to find the location of text path in spread?
Laubender Adobe Community Professional & MVP
Hi,
I assume, this is a scripting question. You mentioned the "path point array".
The parent of a textPath can be:
graphicLine, oval, polygon, rectangle, textFrame and EPSText.
If you located a textPath object, maybe through looping the textContainer array of a story, ask for its parent and then check the parent's pathPoints array if you are interested in path points.
However, the exact path that the text is flowing is not available.
Mainly that depends on the applied text path effects and the formatting of the text.
Regards,
Uwe
• 2. Re: How to find the location of text path in spread?
Laubender Adobe Community Professional & MVP
Some clarifications on textPath and textContainer with ExtendScript:
Assumed some text is selected on a text path:
var selectedText = app.selection[0];
And assumed you'll start from the parentStory of that selected text.
That story could flow through several text containers, text frames and text paths alike.
You'll get all the text containers of a story written to an array with e.g.:
var textContainersOfStoryArray = selectedText.parentStory.textContainers;
If you now loop the text containers array, the parent of the text container will always be the story:
Sorry. I was wrong on this.
The parent of a textContainer that holds a text frame will be the parent of that text frame, maybe a spread.
The parent of a textContainer that holds a textPath is the object that forms the path: A polygon maybe.
for(var n=0; n<textContainersOfStoryArray.length;n++)
{
$.writeln(n+"\t"+textContainersOfStoryArray[n].parent);
}
[ EDITED: Remove contents ]
Hope, that helps.
Regards,
Uwe
• 3. Re: How to find the location of text path in spread?
Jump_Over Level 5
...I can do that easily for text frame by looking at path point array of the text frame...
This is not a scripting question, I am afraid.
Jarek
• 4. Re: How to find the location of text path in spread?
Laubender Adobe Community Professional & MVP
Hi Jarek,
hm. Now, that I read the tags—idml, XML and InDesign CS4—you could be right.
But where to move that thread then? Back to the Adobe InDesign user-to-user forum?
Regards,
Uwe
• 5. Re: How to find the location of text path in spread?
diwakarbhatt Level 1
Hi Jarek,
Yes, it is not exactly the scripting question, it is more like a generalised question about document structure of IDML. Sorry if I've tagged it wrong.
• 6. Re: How to find the location of text path in spread?
diwakarbhatt Level 1
Hi Uwe,
Thank you for taking time answering the question. So if I'm not wrong the path point array of the text path container like a polygon in my case will refer to the location of the text path. As it is contained within the polygon. Sorry if it sounds stupid as I'm relatively new to IDML.
• 7. Re: How to find the location of text path in spread?
Laubender Adobe Community Professional & MVP
Hi,
if it's more about the structure of an IDML I'd position one single text path on a polygon with significant text (that is easily searchable later in the IDML package) on an InDesign document page, save that to IDML and inspect the IDML. From that example it should be clear how the relationship of the polygon to the text path is made.
And then I would do another text frame and thread that to the text path. And another text frame that is threaded to the polygon and also inspect the IDML. You have to inspect the Story XML for the text contents and its formatting and the Spread XML for the polygon's and text frames path points.
I hope you are not new to InDesign and hopefully not new to ExtendScript, because the property/value pairs listed in the DOM can give you valuable hints for searching the IDML.
Note: Not all property/value pairs of an object in IDML are available in the document object model for scripting.
Good luck with that,
Uwe | __label__pos | 0.948624 |
Firewall
A firewall prevents computers on a network from communicating directly with external computer systems. A firewall typically consists of a computer that acts as a barrier through which all information passing between the networks and the external systems must travel. The firewall software analyzes information passing between the two and rejects it if it does not conform to pre-configured rules. | __label__pos | 0.947351 |
学习Pushlet(四):项目实战对user用户点对点发送
实际项目中我们需要根据登录系统的用户的不同,推送接收不同的消息,我们知道pushlet向后台服务发送请求后会生成一个session,每个session都有随机的一个id,我们需要把这个id改成userid传给后台服务,然后服务根据userid做一些业务处理。
如何修改sessionid为userid呢?第一步:
打开js文件添加一个属性userId: null,
var PL = {
NV_P_FORMAT: 'p_format=xml-strict',
NV_P_MODE: 'p_mode=pull',
pushletURL: null,
webRoot: null,
sessionId: null, STATE_ERROR: -2, STATE_ABORT: -1, STATE_NULL: 1, STATE_READY: 2, STATE_JOINED: 3, STATE_LISTENING: 3, state: 1, userId: null,
然后找到我们之前说的可以自定义请求参数的那个方法_doRequest中加入:拼接上我们的userid
var url = PL.pushletURL + '?p_event=' + anEvent;
if (anEvent == 'join' || anEvent == 'join-listen') {
url = url + "&mySessionId=" + PL.mySessionId;
}
接着就是在我们的jsp页面上面给userid赋值:
PL.userId = "zhagnsan";
PL._init();
PL.joinListen(“msgNum”);
在页面刷新或者关闭的时候我们还需要去取消订阅:
var subscriptionId = null;//全局变量
window.onbeforeunload = onUnsubscribe;.//触发事件
// 页面关闭时,取消订阅
function onUnsubscribe() {
if (subscriptionId != null) {
PL.unsubscribe(subscriptionId);
}
}
// 监听后台返回的数据信息,更新页面
function onData(event) {
// 保存订阅编号,用于页面关闭时进行退订
subscriptionId = event.get('p_sid');
console.log(event.get("who") +" "+
event.get(PL.userId) +" "+ event.get("date")); }
然后我们需要重写pushlet创建session的方法,加入我们的userId。新建类PushletSessionManager继承SessionManager:Session.create(anEvent.getField("userId", "visitor"));
package com.css.app.personalmsg.server;
import nl.justobjects.pushlet.core.Event;
import nl.justobjects.pushlet.core.Session;
import nl.justobjects.pushlet.core.SessionManager;
import nl.justobjects.pushlet.util.PushletException;
public class PushletSessionManager extends SessionManager { @Override public Session createSession(Event anEvent) throws PushletException { //Event的getField方法的第二个参数为当传递参数中不存在第一个参数字段时默认使用的值。 return Session.create(anEvent.getField("userId", "visitor")); } }
然后在pushlet.properties中找到sessionmanager.class改为我们写的类的路径:
sessionmanager.class=com.css.app.personalmsg.server.PushletSessionManager
ok,接下来就在我们的处理事件的方法中处理这个userId了:
package com.css.app.personalmsg.server;
import nl.justobjects.pushlet.core.Event;
import nl.justobjects.pushlet.core.EventPullSource;
import nl.justobjects.pushlet.core.Session;
import nl.justobjects.pushlet.core.SessionManager;
import javax.servlet.http.HttpServlet; import java.util.Date; public class MySinglePlushlet extends HttpServlet { private static final long serialVersionUID =1l; //private static SystemService systemService; static public class HwPlushlet extends EventPullSource { // 休眠五秒 执行一次pullEvent @Override protected long getSleepTime() { return 5000; } @SuppressWarnings("deprecation") @Override protected Event pullEvent() { Event event = Event.createDataEvent("/msgNum"); Session[] sessions = SessionManager.getInstance().getSessions(); if(sessions.length > 0){ for(Session session : sessions){ if (session.getSubscriber().match(event) != null) { try { String userId = session.getId().split("_")[0]; // GetPersonalMsgService service = new GetPersonalMsgService(userId); // int num = service.getmsg(); int num = 2; event.setField(userId, num); event.setField("who",userId); event.setField("date",new Date().toString()); System.out.println(session.getId()+"执行中..."); } catch (Exception e) { event.setField("mess", "异常错误!"); } } else{ session.stop(); System.out.println(session.getId()+"已经取消订阅了================================="); } } }else{ System.out.println("no pushlet session"); } return event; } } }
ok代码更改完毕,我们的思路是,系统的所有的用户都订阅相同的事件,没有一个用户订阅,就会有一个session生成,在后台遍历这个session拿到userId处理后,把结果通过event.setField(userId, num);放进去,然后前台在通过event.get(PL.userId)拿到各自的信息。
但是问题来了,我们发现我们现在使用的是单线程的,所以我们只能通过这种方式,把不同用户的处理结果都放在一个事件event中,如果用户大量的时候,根本是不科学的,因为单线程中,我们无法一个一个生成事件,否则就不会准确的按照我们设置的睡眠时间去“推”。效率也低。所以我们需要做成多线程的方式,为每个用户单独生成一个线程去处理,这样各个用户之间互相不受影响。下一篇继续使用多线程改进方案。
猜你喜欢
转载自www.cnblogs.com/liuyuan1227/p/10885219.html
0条评论
添加一条新回复
| __label__pos | 0.886951 |
Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
295 lines (273 sloc) 11.2 KB
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace lithium\template\helper;
/**
* A template helper that assists in generating HTML content. Accessible in templates via
* `$this->html`, which will auto-load this helper into the rendering context. For examples of how
* to use this helper, see the documentation for a specific method. For a list of the
* template strings this helper uses, see the `$_strings` property.
*/
class Html extends \lithium\template\Helper {
/**
* String templates used by this helper.
*
* @var array
*/
protected $_strings = array(
'block' => '<div{:options}>{:content}</div>',
'block-end' => '</div>',
'block-start' => '<div{:options}>',
'charset' => '<meta charset="{:encoding}" />',
'image' => '<img src="{:path}"{:options} />',
'js-block' => '<script type="text/javascript"{:options}>{:content}</script>',
'js-end' => '</script>',
'js-start' => '<script type="text/javascript"{:options}>',
'link' => '<a href="{:url}"{:options}>{:title}</a>',
'list' => '<ul{:options}>{:content}</ul>',
'list-item' => '<li{:options}>{:content}</li>',
'meta' => '<meta{:options}/>',
'meta-link' => '<link href="{:url}"{:options} />',
'para' => '<p{:options}>{:content}</p>',
'para-start' => '<p{:options}>',
'script' => '<script type="text/javascript" src="{:path}"{:options}></script>',
'style' => '<style type="text/css"{:options}>{:content}</style>',
'style-import' => '<style type="text/css"{:options}>@import url({:url});</style>',
'style-link' => '<link rel="{:type}" type="text/css" href="{:path}"{:options} />',
'table-header' => '<th{:options}>{:content}</th>',
'table-header-row' => '<tr{:options}>{:content}</tr>',
'table-cell' => '<td{:options}>{:content}</td>',
'table-row' => '<tr{:options}>{:content}</tr>',
'tag' => '<{:name}{:options}>{:content}</{:name}>',
'tag-end' => '</{:name}>',
'tag-start' => '<{:name}{:options}>'
);
/**
* Data used for custom <meta /> links.
*
* @var array
*/
protected $_metaLinks = array(
'atom' => array('type' => 'application/atom+xml', 'rel' => 'alternate'),
'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate'),
'icon' => array('type' => 'image/x-icon', 'rel' => 'icon')
);
/**
* List of meta tags to cache and to output.
*
* @var array
* @see lithium\template\helper\Html::meta()
*/
protected $_metaList = array();
/**
* Used by output handlers to calculate asset paths in conjunction with the `Media` class.
*
* @var array
* @see lithium\net\http\Media
*/
public $contentMap = array(
'script' => 'js',
'style' => 'css',
'image' => 'image',
'_metaLink' => 'generic'
);
/**
* Returns a charset meta-tag for declaring the encoding of the document.
*
* The terms character set (here: charset) and character encoding (here:
* encoding) were historically synonymous. The terms now have related but
* distinct meanings. Whenever possible Lithium tries to use precise
* terminology. Since HTML uses the term `charset` we expose this method
* under the exact same name. This caters to the expectation towards a HTML
* helper. However the rest of the framework will use the term `encoding`
* when talking about character encoding.
*
* It is suggested that uppercase letters should be used when specifying
* the encoding. HTML specs don't require it to be uppercase and sites in
* the wild most often use the lowercase variant. On the other hand must
* XML parsers (those may not be relevant in this context anyway) not
* support lowercase encodings. This and the fact that IANA lists only
* encodings with uppercase characters led to the above suggestion.
*
* @see lithium\net\http\Response::$encoding
* @link http://www.iana.org/assignments/character-sets
* @param string $encoding The character encoding to be used in the meta tag.
* Defaults to the encoding of the `Response` object attached to the
* current context. The default encoding of that object is `UTF-8`.
* The string given here is not manipulated in any way, so that
* values are rendered literally. Also see above note about casing.
* @return string A meta tag containing the specified encoding (literally).
*/
public function charset($encoding = null) {
$encoding = $encoding ?: $this->_context->response()->encoding;
return $this->_render(__METHOD__, 'charset', compact('encoding'));
}
/**
* Creates an HTML link (`<a />`) or a document meta-link (`<link />`).
*
* If `$url` starts with `"http://"` or `"https://"`, this is treated as an external link.
* Otherwise, it is treated as a path to controller/action and parsed using
* the `Router::match()` method (where `Router` is the routing class dependency specified by
* the rendering context, i.e. `lithium\template\view\Renderer::$_classes`).
*
* If `$url` is empty, `$title` is used in its place.
*
* @param string $title The content to be wrapped by an `<a />` tag.
* @param mixed $url Can be a string representing a URL relative to the base of your Lithium
* applcation, an external URL (starts with `'http://'` or `'https://'`), an anchor
* name starting with `'#'` (i.e. `'#top'`), or an array defining a set of request
* parameters that should be matched against a route in `Router`.
* @param array $options Array of HTML s and other options.
* @return string Returns an `<a />` or `<link />` element.
*/
public function link($title, $url = null, array $options = array()) {
$defaults = array('escape' => true, 'type' => null);
list($scope, $options) = $this->_options($defaults, $options);
if (isset($scope['type']) && $type = $scope['type']) {
$options += compact('title');
return $this->_metaLink($type, $url, $options);
}
$url = is_null($url) ? $title : $url;
return $this->_render(__METHOD__, 'link', compact('title', 'url', 'options'), $scope);
}
/**
* Returns a JavaScript include tag (`<script />` element). If the filename is prefixed with
* `"/"`, the path will be relative to the base path of your application. Otherwise, the path
* will be relative to your JavaScript path, usually `webroot/js`.
*
* @param mixed $path String path to JavaScript file, or an array of paths.
* @param array $options
* @return string
* @filter This method can be filtered.
*/
public function script($path, array $options = array()) {
$defaults = array('inline' => true);
list($scope, $options) = $this->_options($defaults, $options);
if (is_array($path)) {
foreach ($path as $i => $item) {
$path[$i] = $this->script($item, $scope);
}
return ($scope['inline']) ? join("\n\t", $path) . "\n" : null;
}
$m = __METHOD__;
$params = compact('path', 'options');
$script = $this->_filter(__METHOD__, $params, function($self, $params, $chain) use ($m) {
return $self->invokeMethod('_render', array($m, 'script', $params));
});
if ($scope['inline']) {
return $script;
}
if ($this->_context) {
$this->_context->scripts($script);
}
}
/**
* Creates a link element for CSS stylesheets.
*
* @param mixed $path The name of a CSS style sheet in `/app/webroot/css`, or an array
* containing names of CSS stylesheets in that directory.
* @param array $options Array of HTML attributes.
* @return string CSS <link /> or <style /> tag, depending on the type of link.
* @filter This method can be filtered.
*/
public function style($path, array $options = array()) {
$defaults = array('type' => 'stylesheet', 'inline' => true);
list($scope, $options) = $this->_options($defaults, $options);
if (is_array($path)) {
foreach ($path as $i => $item) {
$path[$i] = $this->style($item, $scope);
}
return ($scope['inline']) ? join("\n\t", $path) . "\n" : null;
}
$method = __METHOD__;
$type = $scope['type'];
$params = compact('type', 'path', 'options');
$filter = function($self, $params, $chain) use ($defaults, $method) {
$template = ($params['type'] == 'import') ? 'style-import' : 'style-link';
return $self->invokeMethod('_render', array($method, $template, $params));
};
$style = $this->_filter($method, $params, $filter);
if ($scope['inline']) {
return $style;
}
if ($this->_context) {
$this->_context->styles($style);
}
}
/**
* Creates a tag for the ```<head>``` section of your document.
*
* If there is a rendering context, then it also pushes the resulting tag to it.
*
* The ```$options``` must match the named parameters from ```$_strings``` for the
* given ```$tag```.
*
* @param string $tag the name of a key in ```$_strings```
* @param array $options the options required by ```$_strings[$tag]```
* @return mixed a string if successful, otherwise NULL
* @filter This method can be filtered.
*/
public function head($tag, array $options) {
if (!isset($this->_strings[$tag])) {
return null;
}
$method = __METHOD__;
$filter = function($self, $options, $chain) use ($method, $tag) {
return $self->invokeMethod('_render', array($method, $tag, $options));
};
$head = $this->_filter($method, $options, $filter);
if ($this->_context) {
$this->_context->head($head);
}
return $head;
}
/**
* Creates a formatted <img /> element.
*
* @param string $path Path to the image file, relative to the app/webroot/img/ directory.
* @param array $options Array of HTML attributes.
* @return string
* @filter This method can be filtered.
*/
public function image($path, array $options = array()) {
$defaults = array('alt' => '');
$options += $defaults;
$path = is_array($path) ? $this->_context->url($path) : $path;
$params = compact('path', 'options');
$method = __METHOD__;
return $this->_filter($method, $params, function($self, $params, $chain) use ($method) {
return $self->invokeMethod('_render', array($method, 'image', $params));
});
}
/**
* Creates a link to an external resource.
*
* @param string $type The title of the external resource
* @param mixed $url The address of the external resource or string for content attribute
* @param array $options Other attributes for the generated tag. If the type attribute
* is 'html', 'rss', 'atom', or 'icon', the mime-type is returned.
* @return string
*/
protected function _metaLink($type, $url = null, array $options = array()) {
$options += isset($this->_metaLinks[$type]) ? $this->_metaLinks[$type] : array();
if ($type == 'icon') {
$url = $url ?: 'favicon.ico';
$standard = $this->_render(__METHOD__, 'meta-link', compact('url', 'options'), array(
'handlers' => array('url' => 'path')
));
$options['rel'] = 'shortcut icon';
$ieFix = $this->_render(__METHOD__, 'meta-link', compact('url', 'options'), array(
'handlers' => array('url' => 'path')
));
return "{$standard}\n\t{$ieFix}";
}
return $this->_render(__METHOD__, 'meta-link', compact('url', 'options'), array(
'handlers' => array()
));
}
}
?>
Something went wrong with that request. Please try again. | __label__pos | 0.958587 |
Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
PerlMonks
Re: Comparing two text files
by space_monk (Chaplain)
on Jan 08, 2013 at 11:51 UTC ( #1012226=note: print w/ replies, xml ) Need Help??
in reply to Comparing two text files
Try something like this, which includes the suggestions by davido and Anonymous_Monk. As CountZero has suggested, you may also need to check some or all of the index values as arrays start at element zero in Perl ... :-)
use strict; use warnings; open my $bh, "<", $B_file or die "$0: open $B_file: $!"; my %bHash; # slurp text file B # could generate a unique key consisting of field 0 and 11, # but never mind. foreach (<$bh>) { my @text=split(/\t/); $bHash{$text[0]} = $text[11]; } close $bh; open my $ah, "<", $A_file or die "$0: open $A_file: $!"; # read in text file A foreach (<$ah>) { my @text = split(/\t/); if ($bHash{$text[3]} eq $text[11]) { # we have a match, print it print join( "\t", @text[1..3]),"\n"; } } close $ah;
A Monk aims to give answers to those who have none, and to learn from those who know more.
Comment on Re: Comparing two text files
Download Code
Re^2: Comparing two text files
by perlnoobster (Sexton) on Jan 08, 2013 at 17:25 UTC
Thank you all for your advice! i've taken it aboard and it works great! I have one last question though, the value that could match the $text11 of file A can be found in several other columns such as 12,13,14,15 How can I adjust the original hash: <code>$bHash{$text[0]} = $text11; so that it includes text 12....15?<\code> is it possible to implement that? if so how? Thank you ! :) This doesnt work: $bHash{$text[0]} = $text11|$text12|$text13;
Log In?
Username:
Password:
What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012226]
help
Chatterbox?
and the web crawler heard nothing...
How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-04-25 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Who makes your decisions?
Results (474 votes), past polls | __label__pos | 0.837135 |
Bài 1, 2, 3, 4 trang 4 sgk Toán 3
Bài 1 tính nhẩm, bài 2 đặt tính rồi tính, bài 3 giải bài toán dựa vào tóm tắt...
Bài 1. Tính nhẩm:
400 + 300 =
500 + 40 =
100 + 20 + 4 =
700 – 300 =
540 – 40 =
300 + 60 + 7 =
700 – 400 =
540 – 500 =
800 + 10 + 5 =
Bài 2. Đặt tính rồi tính:
352 + 416; 732 – 511 ; 418 + 201 ; 395 – 44.
Bài 3.Khối lớp Một có 245 học sinh, khối lớp Hai có ít hơn khối lớp Một 32 học sinh. Hỏi khối lớp Hai có bao nhiêu học sinh?
Bài 4. Giá tiền một phong bì là 200 đồng, giá tiền một tem thư nhiều hơn giá tiền một phong bì là 600 đồng. hỏi giá tiền một tem thư là bao nhiêu ?
Bài 5. Với ba số 315 , 40, 355 và các dấu +, -, =, em hãy lập các phép tính đúng.
Bài làm:
Bài 1:
400 + 300 = 700 500 + 40 = 540
700 – 300 = 400 540 – 40 = 500
700 – 400 = 300 540 – 500 = 40
100 + 20 + 4 = 124
300 + 60 + 7 = 367
800 + 10 + 5 = 815
Bài 2:
Bài 3:
Số học sinh khối lớp Hai là :
245 – 32 = 213 ( học sinh).
Đáp số 213 học sinh
Bài 4.
Giá tiền một tem thư là :
200 + 600 = 800 ( đồng).
Bài 5
Có thế lập được các phép tính như sau :
315 + 40 = 355 355 – 40 = 315
40 + 315 = 355 355 – 315 = 40 | __label__pos | 0.994816 |
{"_id":"5aab5a20d933f6001f5e34a0","project":"56439dfe9eebf70d00490d54","version":{"_id":"5864d2df79ce642d00f0fec7","project":"56439dfe9eebf70d00490d54","__v":4,"createdAt":"2016-12-29T09:09:51.074Z","releaseDate":"2016-12-29T09:09:51.074Z","categories":["5864d2df79ce642d00f0fec8","5864d2df79ce642d00f0fec9","5864d2df79ce642d00f0feca","5864d2df79ce642d00f0fecb","5864d2df79ce642d00f0fecc","5864d2df79ce642d00f0fecd","5864d2df79ce642d00f0fece","5864d2df79ce642d00f0fecf","5864d2df79ce642d00f0fed0","5864d2df79ce642d00f0fed1","5864d2df79ce642d00f0fed2","5864d2df79ce642d00f0fed3","5864d2df79ce642d00f0fed4","5864d2df79ce642d00f0fed5","5864d2df79ce642d00f0fed6","5864d2df79ce642d00f0fed7","5864d2df79ce642d00f0fed8","5864d2df79ce642d00f0fed9","5864d2df79ce642d00f0feda","5864d2df79ce642d00f0fedb","5864d2df79ce642d00f0fedc","5864d2df79ce642d00f0fedd","5864d2df79ce642d00f0fede","598aa64f4b6e990019b7a2d2","599bc76bc03fa2000f83db2a","599bcc3c3c5bf7000f3434fc"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"category":{"_id":"5864d2df79ce642d00f0fed6","__v":0,"version":"5864d2df79ce642d00f0fec7","project":"56439dfe9eebf70d00490d54","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-04-21T19:06:48.486Z","from_sync":false,"order":14,"slug":"taxonomy-1","title":"Taxonomy"},"user":"567b9bf2b56bac0d0019d914","__v":4,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-03-16T05:46:08.500Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"text","code":""}]},"settings":"","results":{"codes":[{"code":"{\n\t\"codes\": [{\n\t\t\"id\": \"NGSS.K12.SC-1-WAT-01\",\n\t\t\"code\": \"1-PS4-1\",\n\t\t\"title\": \"Plan and conduct investigations to provide evidence that vibrating materials can make sound and that sound can make materials vibrate.\",\n\t\t\"code_type\": \"standard_level_1\",\n\t\t\"sequence_id\": 1\n\t}, {\n\t\t\"id\": \"NGSS.K12.SC-1-WAT-01-01\",\n\t\t\"parent_taxonomy_code_id\": \"NGSS.K12.SC-1-WAT-01\",\n\t\t\"code\": \"NGSS.K12.SC-1-WAT-01-01\",\n\t\t\"title\": \"Students will plan and conduct an investigation to find evidence about the relationship between vibrating materials and sound.\",\n\t\t\"code_type\": \"learning_target_level_0\",\n\t\t\"sequence_id\": 1\n\t}, {\n\t\t\"id\": \"NGSS.K12.SC-1-WAT-01-02\",\n\t\t\"parent_taxonomy_code_id\": \"NGSS.K12.SC-1-WAT-01\",\n\t\t\"code\": \"NGSS.K12.SC-1-WAT-01-02\",\n\t\t\"title\": \"Students will determine which materials will be used for their investigations and how to make them vibrate to cause sounds.\",\n\t\t\"code_type\": \"learning_target_level_0\",\n\t\t\"sequence_id\": 2\n\t}]\n}","name":"","status":200,"language":"json"}]},"method":"get","auth":"required","params":[{"_id":"5aab5c84d933f6001f5e34c5","ref":"","in":"path","required":true,"desc":"Standards framework code as obtained at subjects listing","default":"","type":"string","name":"framework-id"},{"_id":"5aab5c84d933f6001f5e34c4","ref":"","in":"path","required":true,"desc":"Taxonomy subject ID as obtained at subjects listing","default":"","type":"string","name":"subject-id"},{"_id":"5aab5c84d933f6001f5e34c3","ref":"","in":"path","required":true,"desc":"Taxonomy course ID as obtained at course listing","default":"","type":"string","name":"course-id"},{"_id":"5aab5c84d933f6001f5e34c2","ref":"","in":"path","required":true,"desc":"Taxonomy domain ID as obtained at domain listing","default":"","type":"string","name":"domain-id"},{"_id":"5aab5c84d933f6001f5e34c1","ref":"","in":"header","required":true,"desc":"Provide access token in the format: \"Token authorization_access_token\"","default":"","type":"string","name":"Authorization"}],"url":"/taxonomy/frameworks/:framework-id/subjects/:subject-id/courses/:course-id/domains/:domain-id/codes"},"isReference":false,"order":6,"body":"**Request Structure Detail**\n\nThe API requires the framework, subject, course and domain of interest as input to list available standards and micro-standards for that subject + course + domain. The necessary codes are available and mapped as below:\n\n * framework-id <== standard_framework_id ( from response at [Fetch Taxonomy Subjects](doc:fetch-gut-gooru-universal-taxonomy-subjects) )\n * subject-id <== taxonomy_subject_id ( from response at [Fetch Taxonomy Subjects](doc:fetch-gut-gooru-universal-taxonomy-subjects) )\n * course-id <== id ( from response at [Fetch Taxonomy Courses For a Framework](doc:fetch-taxonomy-courses-for-a-framework) )\n * domain-id <== id ( from response at [Fetch Taxonomy Domains at a Framework](doc:fetch-taxonomy-domains-for-course-at-a-framework) )\n\n \n**Response Structure Detail**\n\nAPI returns an array of supported standards and learning targets as JSON object. The JSON object is structured as detailed below:\n\n * id : standard / learning-target id\n * code : standard / learning-target code for the standards framework\n * title : title at the framework \n * code_type : identifies if returned value is a standard or a learning-target\n * parent_taxonomy_code_id : identifies the standard id to which the said learning-target belongs\n * sequence_id : identifies the ordering of standard at domain level for the standards framework\n[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Access token is needed\",\n \"body\": \"Header: \\nAuthorization: Token [anonymous_access_token]\"\n}\n[/block]","excerpt":"Fetch a list of taxonomy standards available at a given subject, course and domain for a specific standards framework.","slug":"fetch-taxonomy-standards-at-a-framework","type":"endpoint","title":"Fetch Taxonomy Standards at a Framework"}
getFetch Taxonomy Standards at a Framework
Fetch a list of taxonomy standards available at a given subject, course and domain for a specific standards framework.
Definition
{{ api_url }}{{ page_api_url }}
Parameters
Path Params
framework-id:
required
string
Standards framework code as obtained at subjects listing
subject-id:
required
string
Taxonomy subject ID as obtained at subjects listing
course-id:
required
string
Taxonomy course ID as obtained at course listing
domain-id:
required
string
Taxonomy domain ID as obtained at domain listing
Headers
Authorization:
required
string
Provide access token in the format: "Token authorization_access_token"
Result Format
Documentation
**Request Structure Detail** The API requires the framework, subject, course and domain of interest as input to list available standards and micro-standards for that subject + course + domain. The necessary codes are available and mapped as below: * framework-id <== standard_framework_id ( from response at [Fetch Taxonomy Subjects](doc:fetch-gut-gooru-universal-taxonomy-subjects) ) * subject-id <== taxonomy_subject_id ( from response at [Fetch Taxonomy Subjects](doc:fetch-gut-gooru-universal-taxonomy-subjects) ) * course-id <== id ( from response at [Fetch Taxonomy Courses For a Framework](doc:fetch-taxonomy-courses-for-a-framework) ) * domain-id <== id ( from response at [Fetch Taxonomy Domains at a Framework](doc:fetch-taxonomy-domains-for-course-at-a-framework) ) **Response Structure Detail** API returns an array of supported standards and learning targets as JSON object. The JSON object is structured as detailed below: * id : standard / learning-target id * code : standard / learning-target code for the standards framework * title : title at the framework * code_type : identifies if returned value is a standard or a learning-target * parent_taxonomy_code_id : identifies the standard id to which the said learning-target belongs * sequence_id : identifies the ordering of standard at domain level for the standards framework [block:callout] { "type": "info", "title": "Access token is needed", "body": "Header: \nAuthorization: Token [anonymous_access_token]" } [/block]
User Information
Try It Out
get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }} | __label__pos | 0.531651 |
JSON 对象
网道(WangDoc.com),互联网文档计划
JSON 格式 #
JSON 格式(JavaScript Object Notation 的缩写)是一种用于数据交换的文本格式,2001年由 Douglas Crockford 提出,目的是取代繁琐笨重的 XML 格式。
相比 XML 格式,JSON 格式有两个显著的优点:书写简单,一目了然;符合 JavaScript 原生语法,可以由解释引擎直接处理,不用另外添加解析代码。所以,JSON 迅速被接受,已经成为各大网站交换数据的标准格式,并被写入标准。
每个 JSON 对象就是一个值,可能是一个数组或对象,也可能是一个原始类型的值。总之,只能是一个值,不能是两个或更多的值。
JSON 对值的类型和格式有严格的规定。
1. 复合类型的值只能是数组或对象,不能是函数、正则表达式对象、日期对象。
2. 原始类型的值只有四种:字符串、数值(必须以十进制表示)、布尔值和null(不能使用NaN, Infinity, -Infinityundefined)。
3. 字符串必须使用双引号表示,不能使用单引号。
4. 对象的键名必须放在双引号里面。
5. 数组或对象最后一个成员的后面,不能加逗号。
以下都是合法的 JSON。
["one", "two", "three"]
{ "one": 1, "two": 2, "three": 3 }
{"names": ["张三", "李四"] }
[ { "name": "张三"}, {"name": "李四"} ]
以下都是不合法的 JSON。
{ name: "张三", 'age': 32 } // 属性名必须使用双引号
[32, 64, 128, 0xFFF] // 不能使用十六进制值
{ "name": "张三", "age": undefined } // 不能使用 undefined
{ "name": "张三",
"birthday": new Date('Fri, 26 Aug 2011 07:13:10 GMT'),
"getName": function () {
return this.name;
}
} // 属性值不能使用函数和日期对象
注意,null、空数组和空对象都是合法的 JSON 值。
JSON 对象 #
JSON对象是 JavaScript 的原生对象,用来处理 JSON 格式数据。它有两个静态方法:JSON.stringify()JSON.parse()
JSON.stringify() #
基本用法 #
JSON.stringify()方法用于将一个值转为 JSON 字符串。该字符串符合 JSON 格式,并且可以被JSON.parse()方法还原。
JSON.stringify('abc') // ""abc""
JSON.stringify(1) // "1"
JSON.stringify(false) // "false"
JSON.stringify([]) // "[]"
JSON.stringify({}) // "{}"
JSON.stringify([1, "false", false])
// '[1,"false",false]'
JSON.stringify({ name: "张三" })
// '{"name":"张三"}'
上面代码将各种类型的值,转成 JSON 字符串。
注意,对于原始类型的字符串,转换结果会带双引号。
JSON.stringify('foo') === "foo" // false
JSON.stringify('foo') === "\"foo\"" // true
上面代码中,字符串foo,被转成了"\"foo\""。这是因为将来还原的时候,内层双引号可以让 JavaScript 引擎知道,这是一个字符串,而不是其他类型的值。
JSON.stringify(false) // "false"
JSON.stringify('false') // "\"false\""
上面代码中,如果不是内层的双引号,将来还原的时候,引擎就无法知道原始值是布尔值还是字符串。
如果对象的属性是undefined、函数或 XML 对象,该属性会被JSON.stringify()过滤。
var obj = {
a: undefined,
b: function () {}
};
JSON.stringify(obj) // "{}"
上面代码中,对象obja属性是undefined,而b属性是一个函数,结果都被JSON.stringify过滤。
如果数组的成员是undefined、函数或 XML 对象,则这些值被转成null
var arr = [undefined, function () {}];
JSON.stringify(arr) // "[null,null]"
上面代码中,数组arr的成员是undefined和函数,它们都被转成了null
正则对象会被转成空对象。
JSON.stringify(/foo/) // "{}"
JSON.stringify()方法会忽略对象的不可遍历的属性。
var obj = {};
Object.defineProperties(obj, {
'foo': {
value: 1,
enumerable: true
},
'bar': {
value: 2,
enumerable: false
}
});
JSON.stringify(obj); // "{"foo":1}"
上面代码中,barobj对象的不可遍历属性,JSON.stringify方法会忽略这个属性。
第二个参数 #
JSON.stringify()方法还可以接受一个数组,作为第二个参数,指定参数对象的哪些属性需要转成字符串。
var obj = {
'prop1': 'value1',
'prop2': 'value2',
'prop3': 'value3'
};
var selectedProperties = ['prop1', 'prop2'];
JSON.stringify(obj, selectedProperties)
// "{"prop1":"value1","prop2":"value2"}"
上面代码中,JSON.stringify()方法的第二个参数指定,只转prop1prop2两个属性。
这个类似白名单的数组,只对对象的属性有效,对数组无效。
JSON.stringify(['a', 'b'], ['0'])
// "["a","b"]"
JSON.stringify({0: 'a', 1: 'b'}, ['0'])
// "{"0":"a"}"
上面代码中,第二个参数指定 JSON 格式只转0号属性,实际上对数组是无效的,只对对象有效。
第二个参数还可以是一个函数,用来更改JSON.stringify()的返回值。
function f(key, value) {
if (typeof value === "number") {
value = 2 * value;
}
return value;
}
JSON.stringify({ a: 1, b: 2 }, f)
// '{"a": 2,"b": 4}'
上面代码中的f函数,接受两个参数,分别是被转换的对象的键名和键值。如果键值是数值,就将它乘以2,否则就原样返回。
注意,这个处理函数是递归处理所有的键。
var obj = {a: {b: 1}};
function f(key, value) {
console.log("["+ key +"]:" + value);
return value;
}
JSON.stringify(obj, f)
// []:[object Object]
// [a]:[object Object]
// [b]:1
// '{"a":{"b":1}}'
上面代码中,对象obj一共会被f函数处理三次,输出的最后那行是JSON.stringify()的默认输出。第一次键名为空,键值是整个对象obj;第二次键名为a,键值是{b: 1};第三次键名为b,键值为1。
递归处理中,每一次处理的对象,都是前一次返回的值。
var obj = {a: 1};
function f(key, value) {
if (typeof value === 'object') {
return {b: 2};
}
return value * 2;
}
JSON.stringify(obj, f)
// "{"b": 4}"
上面代码中,f函数修改了对象obj,接着JSON.stringify()方法就递归处理修改后的对象obj
如果处理函数返回undefined或没有返回值,则该属性会被忽略。
function f(key, value) {
if (typeof(value) === "string") {
return undefined;
}
return value;
}
JSON.stringify({ a: "abc", b: 123 }, f)
// '{"b": 123}'
上面代码中,a属性经过处理后,返回undefined,于是该属性被忽略了。
第三个参数 #
JSON.stringify()还可以接受第三个参数,用于增加返回的 JSON 字符串的可读性。
默认返回的是单行字符串,对于大型的 JSON 对象,可读性非常差。第三个参数使得每个属性单独占据一行,并且将每个属性前面添加指定的前缀(不超过10个字符)。
// 默认输出
JSON.stringify({ p1: 1, p2: 2 })
// JSON.stringify({ p1: 1, p2: 2 })
// 分行输出
JSON.stringify({ p1: 1, p2: 2 }, null, '\t')
// {
// "p1": 1,
// "p2": 2
// }
上面例子中,第三个属性\t在每个属性前面添加一个制表符,然后分行显示。
第三个属性如果是一个数字,则表示每个属性前面添加的空格(最多不超过10个)。
JSON.stringify({ p1: 1, p2: 2 }, null, 2);
/*
"{
"p1": 1,
"p2": 2
}"
*/
参数对象的 toJSON() 方法 #
如果参数对象有自定义的toJSON()方法,那么JSON.stringify()会使用这个方法的返回值作为参数,而忽略原对象的其他属性。
下面是一个普通的对象。
var user = {
firstName: '三',
lastName: '张',
get fullName(){
return this.lastName + this.firstName;
}
};
JSON.stringify(user)
// "{"firstName":"三","lastName":"张","fullName":"张三"}"
现在,为这个对象加上toJSON()方法。
var user = {
firstName: '三',
lastName: '张',
get fullName(){
return this.lastName + this.firstName;
},
toJSON: function () {
return {
name: this.lastName + this.firstName
};
}
};
JSON.stringify(user)
// "{"name":"张三"}"
上面代码中,JSON.stringify()发现参数对象有toJSON()方法,就直接使用这个方法的返回值作为参数,而忽略原对象的其他参数。
Date对象就有一个自己的toJSON()方法。
var date = new Date('2015-01-01');
date.toJSON() // "2015-01-01T00:00:00.000Z"
JSON.stringify(date) // ""2015-01-01T00:00:00.000Z""
上面代码中,JSON.stringify()发现处理的是Date对象实例,就会调用这个实例对象的toJSON()方法,将该方法的返回值作为参数。
toJSON()方法的一个应用是,将正则对象自动转为字符串。因为JSON.stringify()默认不能转换正则对象,但是设置了toJSON()方法以后,就可以转换正则对象了。
var obj = {
reg: /foo/
};
// 不设置 toJSON 方法时
JSON.stringify(obj) // "{"reg":{}}"
// 设置 toJSON 方法时
RegExp.prototype.toJSON = RegExp.prototype.toString;
JSON.stringify(/foo/) // ""/foo/""
上面代码在正则对象的原型上面部署了toJSON()方法,将其指向toString()方法,因此转换成 JSON 格式时,正则对象就先调用toJSON()方法转为字符串,然后再被JSON.stringify()方法处理。
JSON.parse() #
JSON.parse()方法用于将 JSON 字符串转换成对应的值。
JSON.parse('{}') // {}
JSON.parse('true') // true
JSON.parse('"foo"') // "foo"
JSON.parse('[1, 5, "false"]') // [1, 5, "false"]
JSON.parse('null') // null
var o = JSON.parse('{"name": "张三"}');
o.name // 张三
如果传入的字符串不是有效的 JSON 格式,JSON.parse()方法将报错。
JSON.parse("'String'") // illegal single quotes
// SyntaxError: Unexpected token ILLEGAL
上面代码中,双引号字符串中是一个单引号字符串,因为单引号字符串不符合 JSON 格式,所以报错。
为了处理解析错误,可以将JSON.parse()方法放在try...catch代码块中。
try {
JSON.parse("'String'");
} catch(e) {
console.log('parsing error');
}
JSON.parse()方法可以接受一个处理函数,作为第二个参数,用法与JSON.stringify()方法类似。
function f(key, value) {
if (key === 'a') {
return value + 10;
}
return value;
}
JSON.parse('{"a": 1, "b": 2}', f)
// {a: 11, b: 2}
上面代码中,JSON.parse()的第二个参数是一个函数,如果键名是a,该函数会将键值加上10。
JSON.parse()JSON.stringify()可以结合使用,像下面这样写,实现对象的深拷贝。
JSON.parse(JSON.stringify(obj))
上面这种写法,可以深度克隆一个对象,但是对象内部不能有 JSON
不允许的数据类型,比如函数、正则对象、日期对象等。
参考链接 # | __label__pos | 0.90253 |
Creating a Custom Asterisk in CSS for Required Fields
If you want to customize the asterisk color in required fields, we’ll show you how using CSS.
Not already signed up for Wufoo? Let's get started!
Creating a Custom Asterisk in CSS for Required Fields
How to Create a Custom Asterisk in CSS for Required Fields
Do you want to customize the color of the asterisk that appears next to required fields on a form? (For example, for date of birth or addresses.) Whether you have a color scheme going that you’re trying to keep consistent, or if you use a preferred color for branding, using a custom asterisk color in CSS is possible when using our program. Here’s how:
When you go to the CSS for the asterisk codes, you’ll find the following:
form span.req{
display:inline;
float:none;
color:red !important;
font-weight:bold;
margin:0;
padding:0;
}
You don’t need to change the color in the fourth line in this set of CSS code. Instead, change the class “req” in our CSS:
.wufoo span.req{
color:red !important;
}
In this line, you’ll be able to input your desired color for the custom fields asterisk. It’s that simple. Happy customizing! | __label__pos | 0.922186 |
Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
576 lines (543 sloc) 15.6 KB
package org.flixel
{
/**
* This is an organizational class that can update and render a bunch of <code>FlxBasic</code>s.
* NOTE: Although <code>FlxGroup</code> extends <code>FlxBasic</code>, it will not automatically
* add itself to the global collisions quad tree, it will only add its members.
*
* @author Adam Atomic
*/
public class FlxGroup extends FlxBasic
{
/**
* Use with <code>sort()</code> to sort in ascending order.
*/
static public const ASCENDING:int = -1;
/**
* Use with <code>sort()</code> to sort in descending order.
*/
static public const DESCENDING:int = 1;
/**
* Array of all the <code>FlxBasic</code>s that exist in this group.
*/
public var members:Array;
/**
* The number of entries in the members array.
* For performance and safety you should check this variable
* instead of members.length unless you really know what you're doing!
*/
public var length:Number;
/**
* Internal tracker for the maximum capacity of the group.
* Default is 0, or no max capacity.
*/
protected var _maxSize:uint;
/**
* Internal helper variable for recycling objects a la <code>FlxEmitter</code>.
*/
protected var _marker:uint;
/**
* Helper for sort.
*/
protected var _sortIndex:String;
/**
* Helper for sort.
*/
protected var _sortOrder:int;
/**
* Constructor
*/
public function FlxGroup(MaxSize:uint=0)
{
super();
members = new Array();
length = 0;
_maxSize = MaxSize;
_marker = 0;
_sortIndex = null;
}
/**
* Override this function to handle any deleting or "shutdown" type operations you might need,
* such as removing traditional Flash children like Sprite objects.
*/
override public function destroy():void
{
if(members != null)
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
basic.destroy();
}
members.length = 0;
members = null;
}
_sortIndex = null;
}
/**
* Just making sure we don't increment the active objects count.
*/
override public function preUpdate():void
{
}
/**
* Automatically goes through and calls update on everything you added.
*/
override public function update():void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && basic.exists && basic.active)
{
basic.preUpdate();
basic.update();
basic.postUpdate();
}
}
}
/**
* Automatically goes through and calls render on everything you added.
*/
override public function draw():void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && basic.exists && basic.visible)
basic.draw();
}
}
/**
* The maximum capacity of this group. Default is 0, meaning no max capacity, and the group can just grow.
*/
public function get maxSize():uint
{
return _maxSize;
}
/**
* @private
*/
public function set maxSize(Size:uint):void
{
_maxSize = Size;
if(_marker >= _maxSize)
_marker = 0;
if((_maxSize == 0) || (members == null) || (_maxSize >= members.length))
return;
//If the max size has shrunk, we need to get rid of some objects
var basic:FlxBasic;
var i:uint = _maxSize;
var l:uint = members.length;
while(i < l)
{
basic = members[i++] as FlxBasic;
if(basic != null)
basic.destroy();
}
length = members.length = _maxSize;
}
/**
* Adds a new <code>FlxBasic</code> subclass (FlxBasic, FlxSprite, Enemy, etc) to the group.
* FlxGroup will try to replace a null member of the array first.
* Failing that, FlxGroup will add it to the end of the member array,
* assuming there is room for it, and doubling the size of the array if necessary.
*
* <p>WARNING: If the group has a maxSize that has already been met,
* the object will NOT be added to the group!</p>
*
* @param Object The object you want to add to the group.
*
* @return The same <code>FlxBasic</code> object that was passed in.
*/
public function add(Object:FlxBasic):FlxBasic
{
//Don't bother adding an object twice.
if(members.indexOf(Object) >= 0)
return Object;
//First, look for a null entry where we can add the object.
var i:uint = 0;
var l:uint = members.length;
while(i < l)
{
if(members[i] == null)
{
members[i] = Object;
if(i >= length)
length = i+1;
return Object;
}
i++;
}
//Failing that, expand the array (if we can) and add the object.
if(_maxSize > 0)
{
if(members.length >= _maxSize)
return Object;
else if(members.length * 2 <= _maxSize)
members.length *= 2;
else
members.length = _maxSize;
}
else
members.length *= 2;
//If we made it this far, then we successfully grew the group,
//and we can go ahead and add the object at the first open slot.
members[i] = Object;
length = i+1;
return Object;
}
/**
* Recycling is designed to help you reuse game objects without always re-allocating or "newing" them.
*
* <p>If you specified a maximum size for this group (like in FlxEmitter),
* then recycle will employ what we're calling "rotating" recycling.
* Recycle() will first check to see if the group is at capacity yet.
* If group is not yet at capacity, recycle() returns a new object.
* If the group IS at capacity, then recycle() just returns the next object in line.</p>
*
* <p>If you did NOT specify a maximum size for this group,
* then recycle() will employ what we're calling "grow-style" recycling.
* Recycle() will return either the first object with exists == false,
* or, finding none, add a new object to the array,
* doubling the size of the array if necessary.</p>
*
* <p>WARNING: If this function needs to create a new object,
* and no object class was provided, it will return null
* instead of a valid object!</p>
*
* @param ObjectClass The class type you want to recycle (e.g. FlxSprite, EvilRobot, etc). Do NOT "new" the class in the parameter!
*
* @return A reference to the object that was created. Don't forget to cast it back to the Class you want (e.g. myObject = myGroup.recycle(myObjectClass) as myObjectClass;).
*/
public function recycle(ObjectClass:Class=null):FlxBasic
{
var basic:FlxBasic;
if(_maxSize > 0)
{
if(length < _maxSize)
{
if(ObjectClass == null)
return null;
return add(new ObjectClass() as FlxBasic);
}
else
{
basic = members[_marker++];
if(_marker >= _maxSize)
_marker = 0;
return basic;
}
}
else
{
basic = getFirstAvailable(ObjectClass);
if(basic != null)
return basic;
if(ObjectClass == null)
return null;
return add(new ObjectClass() as FlxBasic);
}
}
/**
* Removes an object from the group.
*
* @param Object The <code>FlxBasic</code> you want to remove.
* @param Splice Whether the object should be cut from the array entirely or not.
*
* @return The removed object.
*/
public function remove(Object:FlxBasic,Splice:Boolean=false):FlxBasic
{
var index:int = members.indexOf(Object);
if((index < 0) || (index >= members.length))
return null;
if(Splice)
{
members.splice(index,1);
length--;
}
else
members[index] = null;
return Object;
}
/**
* Replaces an existing <code>FlxBasic</code> with a new one.
*
* @param OldObject The object you want to replace.
* @param NewObject The new object you want to use instead.
*
* @return The new object.
*/
public function replace(OldObject:FlxBasic,NewObject:FlxBasic):FlxBasic
{
var index:int = members.indexOf(OldObject);
if((index < 0) || (index >= members.length))
return null;
members[index] = NewObject;
return NewObject;
}
/**
* Call this function to sort the group according to a particular value and order.
* For example, to sort game objects for Zelda-style overlaps you might call
* <code>myGroup.sort("y",ASCENDING)</code> at the bottom of your
* <code>FlxState.update()</code> override. To sort all existing objects after
* a big explosion or bomb attack, you might call <code>myGroup.sort("exists",DESCENDING)</code>.
*
* @param Index The <code>String</code> name of the member variable you want to sort on. Default value is "y".
* @param Order A <code>FlxGroup</code> constant that defines the sort order. Possible values are <code>ASCENDING</code> and <code>DESCENDING</code>. Default value is <code>ASCENDING</code>.
*/
public function sort(Index:String="y",Order:int=ASCENDING):void
{
_sortIndex = Index;
_sortOrder = Order;
members.sort(sortHandler);
}
/**
* Go through and set the specified variable to the specified value on all members of the group.
*
* @param VariableName The string representation of the variable name you want to modify, for example "visible" or "scrollFactor".
* @param Value The value you want to assign to that variable.
* @param Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
*/
public function setAll(VariableName:String,Value:Object,Recurse:Boolean=true):void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
{
if(Recurse && (basic is FlxGroup))
(basic as FlxGroup).setAll(VariableName,Value,Recurse);
else
basic[VariableName] = Value;
}
}
}
/**
* Go through and call the specified function on all members of the group.
* Currently only works on functions that have no required parameters.
*
* @param FunctionName The string representation of the function you want to call on each object, for example "kill()" or "init()".
* @param Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
*/
public function callAll(FunctionName:String,Recurse:Boolean=true):void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
{
if(Recurse && (basic is FlxGroup))
(basic as FlxGroup).callAll(FunctionName,Recurse);
else
basic[FunctionName]();
}
}
}
/**
* Call this function to retrieve the first object with exists == false in the group.
* This is handy for recycling in general, e.g. respawning enemies.
*
* @param ObjectClass An optional parameter that lets you narrow the results to instances of this particular class.
*
* @return A <code>FlxBasic</code> currently flagged as not existing.
*/
public function getFirstAvailable(ObjectClass:Class=null):FlxBasic
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && !basic.exists && ((ObjectClass == null) || (basic is ObjectClass)))
return basic;
}
return null;
}
/**
* Call this function to retrieve the first index set to 'null'.
* Returns -1 if no index stores a null object.
*
* @return An <code>int</code> indicating the first null slot in the group.
*/
public function getFirstNull():int
{
var basic:FlxBasic;
var i:uint = 0;
var l:uint = members.length;
while(i < l)
{
if(members[i] == null)
return i;
else
i++;
}
return -1;
}
/**
* Call this function to retrieve the first object with exists == true in the group.
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @return A <code>FlxBasic</code> currently flagged as existing.
*/
public function getFirstExtant():FlxBasic
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && basic.exists)
return basic;
}
return null;
}
/**
* Call this function to retrieve the first object with dead == false in the group.
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @return A <code>FlxBasic</code> currently flagged as not dead.
*/
public function getFirstAlive():FlxBasic
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && basic.exists && basic.alive)
return basic;
}
return null;
}
/**
* Call this function to retrieve the first object with dead == true in the group.
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @return A <code>FlxBasic</code> currently flagged as dead.
*/
public function getFirstDead():FlxBasic
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && !basic.alive)
return basic;
}
return null;
}
/**
* Call this function to find out how many members of the group are not dead.
*
* @return The number of <code>FlxBasic</code>s flagged as not dead. Returns -1 if group is empty.
*/
public function countLiving():int
{
var count:int = -1;
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
{
if(count < 0)
count = 0;
if(basic.exists && basic.alive)
count++;
}
}
return count;
}
/**
* Call this function to find out how many members of the group are dead.
*
* @return The number of <code>FlxBasic</code>s flagged as dead. Returns -1 if group is empty.
*/
public function countDead():int
{
var count:int = -1;
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
{
if(count < 0)
count = 0;
if(!basic.alive)
count++;
}
}
return count;
}
/**
* Returns a member at random from the group.
*
* @param StartIndex Optional offset off the front of the array. Default value is 0, or the beginning of the array.
* @param Length Optional restriction on the number of values you want to randomly select from.
*
* @return A <code>FlxBasic</code> from the members list.
*/
public function getRandom(StartIndex:uint=0,Length:uint=0):FlxBasic
{
if(Length == 0)
Length = length;
return FlxG.getRandom(members,StartIndex,Length) as FlxBasic;
}
/**
* Remove all instances of <code>FlxBasic</code> subclass (FlxSprite, FlxBlock, etc) from the list.
* WARNING: does not destroy() or kill() any of these objects!
*/
public function clear():void
{
length = members.length = 0;
}
/**
* Calls kill on the group's members and then on the group itself.
*/
override public function kill():void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if((basic != null) && basic.exists)
basic.kill();
}
super.kill();
}
/**
* Helper function for the sort process.
*
* @param Obj1 The first object being sorted.
* @param Obj2 The second object being sorted.
*
* @return An integer value: -1 (Obj1 before Obj2), 0 (same), or 1 (Obj1 after Obj2).
*/
protected function sortHandler(Obj1:FlxBasic,Obj2:FlxBasic):int
{
if(Obj1[_sortIndex] < Obj2[_sortIndex])
return _sortOrder;
else if(Obj1[_sortIndex] > Obj2[_sortIndex])
return -_sortOrder;
return 0;
}
}
} | __label__pos | 0.940413 |
Articles
Gamification in UX. Boosting User Engagement
Gamification in UX. Boosting User Engagement The article is focused on the aspect of gamification applied for mobile applications and websites for engaging UX design and user-friendly interactions.
Gamification in UX. Boosting User Engagement
The user-centered approach, which strives for creating products highly responding to the user’s needs, has become the major philosophy behind many projects. Following this method designers constantly search for new techniques improving user experience which depends on various aspects including emotions. The thing is that users expect a product to be simple and enjoyable in use, so the idea to add a “fun” element to the UX came as it is. But how to make the product fun and enjoyable in use? The technique called gamification was created to solve the problem. Let’s find out what’s the method of gamification in design and how it can improve UX.
What is gamification?
When we say the word “gamification” in the context of design, it can be easily mistaken for the game design. Still, these terms hardly relate to each other, even more, they are opposite in many aspects. In the tech world, the word “gamification” stands for the technique of exerting game mechanics into the non-game environment, such as websites and mobile applications. For example, if you want to encourage the users to interact more with your application, you can add the game element such as a challenge. They can be challenged to check-in every day during a week and be rewarded if they do so. The thing is that people like having a clear goal and even more to be rewarded after it’s achieved, so such a challenge would doubtfully pass unnoticed among the users. This way, designers are able to influence users’ behavior and motivate them as “players” to do the expected actions via game elements such as a challenge and rewards.
Gamification in UX. Boosting User Engagement.
Toonie Alarm
Types of game mechanics for UX improvement
Gamification is a complicated design technique that requires using various game mechanics referring to the interactive UI elements. The main task for designers applying gamification is not to turn the product fully into a game. For this reason, there have been distinguished the effective game mechanics that are commonly used in the design. Let’s see what they are.
Challenge
Human nature always makes us take the challenges and prove that we are able to handle them. So, a challenge is thought to be one of the most compelling game elements motivating people to take an action which can be a great tool on the way for UX improvement. In order to enhance the challenge effect, it may be a good idea to use some kind of rewards, so that users could feel even more motivated.
Upper-App-to-do-list
Upper Streak Challenge in Upper App
Points
To measure the players’ success, many games use the points system. The gamified product can apply the same scheme that helps both users and stakeholders: the first sees their achievements and the others can estimate user engagement of the website or application. It is not necessary to make the count of points in the rating form. It may be just the number of check-ins or video views.
Badges and stickers
When users complete the challenge or gather a certain number of points, they can be awarded the badges or stickers. This kind of virtual rewards is often used in video games, so people are familiar with them. Stickers have gained people’s love long ago, therefore this kind of reward will be appreciated. Besides, the badges and stickers give much room for creative experimentation since they can be designed in various ways. Such rewards can become additional drivers of motivation.
badges_illustration_tubik_design
PukaPal Badges
toonie_stickers_jumble_animation
Toonie Alarm Stickers
Leaderboards
The thing making the challenge even more interesting for people is the competition. Not many things can motivate users better than the desire to be a leader. The list of the “players” ranked in the order “Who’s got more badges” can increase users’ enthusiasm. However, in some cases, it may work contrarily demotivating people due to the high ranks of the others. That’s why this game element is recommended to be applied carefully.
snake_battle_ui_design
Snake Battle
Journey
This game mechanic aims to make the process of interaction with the product as easy and understandable as possible. The user should feel like the real player starting the personal journey of product usage. For example, on the onboarding page from which the user starts, they can be offered an introduction to the features, so that users won’t be afraid to make a mistake. When the journey continues, it is recommended to use the method of “scaffolding”. It means to disclose features progressively as the users become more experienced in using the product. Such an approach allows people to avoid errors and makes the product pleasing to use. Also, the journey element may be supplemented with the progress feature. Providing information about the progress of the user’s journey, we can inspire them to continue.
tutorial ui illustration
Singify App Tutorial
Constraints
Many of us may think that it is not funny at all, still, there is a game element constraining players’ time. For example, the task in the games are often needed to be complete in a limited time, otherwise, players lose. The same approach can be applied to the gamified product. Users may be offered to do something which is available only today. The constraints make people react faster and somehow motivate them to take action right here and now.
night_in_berlin_animation_tubik
Night in Berlin App
These are some common examples of game elements in design but there is room for the innovative game mechanics that can be applied in UX design. The major point to consider is that the product shouldn’t become too playful if it’s not expected according to the general stylistic strategy and brand image.
The role of gamification in UX design
Today the method of gamification is widely used in design since it is thought to help to solve many problems in UX. The appropriate use of gamification and well-chosen game mechanics can become a valuable tool for UX designers on the way to increasing user engagement of the product as well as conversion rates. So how does it work? First of all, the gamification brings the element of fun to the websites and applications. People enjoy the interactive process full of fun, challenges, and competitive spirit similar to video games, so they are encouraged to go back. Furthermore, the game mechanics are the powerful motivators for the users. The game elements set the tasks and the awards are promised to those who accomplish them. The curiosity and excitement drive people to continue performing various tasks and spend more time on the app or the website.
In addition, today gamification already goes as one of the major design approaches. Plenty of designers have caught the hype and actively apply this method in various projects. That’s why many users might already have an experience of interacting with the gamified products which means they expect the same from yours.
AnimaAnimated-stickers-mood-messenger-design-tubikted-stickers-mood-messenger-design-tubik
Animated Stickers for Mood Messenger
Summing it up, gamification is quite a new technique that is now on the path of active proving its reliability as an effective design method. Nevertheless, its popularity is growing really fast so it has good chances to become the leading approach in a short time.
Recommended reading
Here are some more articles we could recommend for those who would like to get deeper into the topic:
Gamification Mechanics in UX Design: User Journey
Gamification And UX: Where Users Win Or Lose
Gamification: Designing for Motivation
5 examples of great gamification
Introducing Game Mechanics for Gamification
Originally written for Tubik Blog
animation, app design, creative, design, design for business, design tips, gamification, graphic design, human-computer interaction, interaction design, interface, mobile app, motion design, product design, tubik agency, UI, UI design, usability, user experience, user interface, UX,
• English
• Ukrainian | __label__pos | 0.548548 |
PitchSalience
streaming mode | Tonal category
Inputs
• spectrum (vector_real) - the input audio spectrum
Outputs
• pitchSalience (real) - the pitch salience (normalized from 0 to 1)
Parameters
• highBoundary (real ∈ (0, ∞), default = 5000) :
until which frequency we are looking for the minimum (must be smaller than half sampleRate) [Hz]
• lowBoundary (real ∈ (0, ∞), default = 100) :
from which frequency we are looking for the maximum (must not be larger than highBoundary) [Hz]
• sampleRate (real ∈ (0, ∞), default = 44100) :
the sampling rate of the audio signal [Hz]
Description
This algorithm computes the pitch salience of a spectrum. The pitch salience is given by the ratio of the highest auto correlation value of the spectrum to the non-shifted auto correlation value. Pitch salience was designed as quick measure of tone sensation. Unpitched sounds (non-musical sound effects) and pure tones have an average pitch salience value close to 0 whereas sounds containing several harmonics in the spectrum tend to have a higher value.
Note that this algorithm may give better results when used with low sampling rates (i.e. 8000) as the information in the bands musically meaningful will have more relevance.
This algorithm uses AutoCorrelation on the input “spectrum” and thus inherits its input requirements and exceptions. An exception is thrown at configuration time if “lowBoundary” is larger than “highBoundary” and/or if “highBoundary” is not smaller than half “sampleRate”. At computation time, an exception is thrown if the input spectrum is empty. Also note that feeding silence to this algorithm will return zero.
Application: characterizing percussive sounds.
References:
[1] J. Ricard “Towards computational morphological description of sound. DEA pre-thesis research work, Universitat Pompeu Fabra, Barcelona, 2004.
Source code
See also
AutoCorrelation (standard) AutoCorrelation (streaming) PitchSalience (standard) | __label__pos | 0.666925 |
Help
This Product Ideas board is currently undergoing updates, but please continue to submit your ideas.
Filter by keyword across all fields
cancel
Showing results for
Search instead for
Did you mean:
Steven_Zhang
6 - Interface Innovator
6 - Interface Innovator
Is there a way to filter a table by keyword that searches across all columns?
I would like something like the current ctrl/cmd+f feature, but instead just highlighting the rows that have a hit, the rows are filtered in.
I could do a hacky workaround where I concatenate all the columns in a calculated column, but this is impractical in bases with 30+ fields
2 Comments
David_Smedberg
6 - Interface Innovator
6 - Interface Innovator
You can create a filter that uses OR. Set up the filter on all columns. It’d look something like this, but with more columns included in the filter:
28c06aa8e61bf07614c701a132a073949ff22788.PNG
Steven_Zhang
6 - Interface Innovator
6 - Interface Innovator
Yes, but if you have 50+ columns, this method becomes pretty untenable. But agreed, it works fine for a few columns! | __label__pos | 0.587297 |
Data in TinyWebDB
There is a rumor that the stored data in TinyWebDB disappears the next day.
Is this true?
If it’s MIT’s TinywebDB server, I would expect data there to last as long as a cup of coffee on a taxi hood.
as a cup of coffee on a taxi hood?
What does it mean?
It means you cannot rely on the MIT tinywebdb server to retain your data or to always be available. The server is provided for testing and development purposes, it is not intended for production use.
That said, any testing data I have put on the MIT tinywebdb has always been there.
1 Like
https://boards.straightdope.com/sdmb/archive/index.php/t-330583.html
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. | __label__pos | 0.844806 |
En mi proyecto hay dos formas: la primera forma la nombré frmSettings, usaré cuadros de texto para guardar valores en el archivo INI. segunda forma lo llamé frmSelectFolder, lo había incluido con DirListBox y 2 botones de comando
enter image description here
Como se muestra en la imagen adjunta arriba en el formulario de Configuración, tengo 8 cuadros de texto y 8 botones de comando para buscar la ruta de la carpeta que se seleccionará de frmSelectFolder
¿Cómo usar frmSelectFolder para todos los cuadros de texto sin duplicar este formulario por cada botón de comando para devolver el valor de control DirlistBox?
vb6
0
Mohamed Soliman 1 ago. 2020 a las 18:24
1 respuesta
La mejor respuesta
Aquí hay un código de muestra para el formulario frmSelectFolder secundario
Option Explicit
Private m_bConfirm As Boolean
Public Function Init(sPath As String) As Boolean
Dir1.Path = sPath
Show vbModal
If m_bConfirm Then
sPath = Dir1.Path
'--- success
Init = True
End If
Unload Me
End Function
Private Sub cmdOk_Click()
If LenB(Dir1.Path) = 0 Then
MsgBox "Please select a path!", vbExclamation
Exit Sub
End If
m_bConfirm = True
Visible = False
End Sub
Private Sub cmdCancel_Click()
Visible = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode <> vbFormCode Then
Cancel = 1
Visible = False
End If
End Sub
A continuación, se explica cómo llamar al método Init anterior desde el frmSettings principal.
Option Explicit
Private Sub cmdStartupPath_Click()
Dim sPath As String
Dim oFrmSelector As New frmSelectFolder
sPath = txtStartupPath.Text
If oFrmSelector.Init(sPath) Then
txtStartupPath.Text = sPath
txtStartupPath.SetFocus
End If
End Sub
Private Sub cmdDownloadPath_Click()
Dim sPath As String
Dim oFrmSelector As New frmSelectFolder
sPath = txtDownloadPath.Text
If oFrmSelector.Init(sPath) Then
txtDownloadPath.Text = sPath
txtDownloadPath.SetFocus
End If
End Sub
Aquí hay un enlace a un proyecto de muestra completo para que lo investigue: SelectFolder.zip
1
wqw 2 ago. 2020 a las 13:22 | __label__pos | 0.923997 |
DOFAdmin.cc 9.94 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <algorithm>
#include "QPsiPhi.h"
#include "BasisFunction.h"
#include "Boundary.h"
#include "DOFAdmin.h"
#include "ElInfo.h"
#include "Error.h"
#include "FiniteElemSpace.h"
#include "Mesh.h"
#include "DOFVector.h"
#include "DOFIterator.h"
namespace AMDiS {
const int DOFAdmin::sizeIncrement = 10;
DOFAdmin::DOFAdmin(Mesh* m)
: mesh(m),
nrDOF(mesh->getDim(), NO_INIT),
nr0DOF(mesh->getDim(), NO_INIT)
Thomas Witkowski's avatar
Thomas Witkowski committed
22
23
24
{
init();
}
25
26
DOFAdmin::DOFAdmin(Mesh* m, std::string aName)
27
28
29
30
31
32
33
34
: name(aName),
mesh(m),
nrDOF(mesh->getDim(), NO_INIT),
nr0DOF(mesh->getDim(), NO_INIT)
{
init();
}
35
36
void DOFAdmin::init()
{
37
38
39
40
41
firstHole = 0;
size = 0;
usedCount = 0;
holeCount = 0;
sizeUsed = 0;
42
43
44
dofFree.clear();
}
45
46
DOFAdmin& DOFAdmin::operator=(const DOFAdmin& src)
{
47
48
49
50
51
52
53
54
55
56
57
if (this != &src) {
mesh = src.mesh;
name = src.name;
dofFree = src.dofFree;
firstHole = src.firstHole;
size = src.size;
usedCount = src.usedCount;
holeCount = src.holeCount;
sizeUsed = src.sizeUsed;
for (int i = 0; i < 4; nrDOF[i] = src.nrDOF[i++]) {
nr0DOF[i] = src.nr0DOF[i];
58
};
59
60
dofIndexedList = src.dofIndexedList;
dofContainerList = src.dofContainerList;
61
62
63
64
65
66
67
68
69
70
}
return *this;
}
/****************************************************************************/
/* use a bit vector to indicate used/unused dofs */
/* storage needed: one bit per dof */
/****************************************************************************/
bool DOFAdmin::operator==(const DOFAdmin& ad) const
{
71
72
73
74
75
if (name != ad.name)
return false;
if (mesh != ad.mesh)
return false;
76
77
78
79
80
return true;
}
DOFAdmin::DOFAdmin(const DOFAdmin&)
81
{
82
83
84
FUNCNAME("DOFAdmin::DOFAdmin()");
ERROR_EXIT("TODO\n");
85
}
86
87
void DOFAdmin::freeDOFIndex(int dof) {
88
FUNCNAME("DOFAdmin::freeDOFIndex()");
89
90
91
TEST_EXIT_DBG(usedCount > 0)("no dofs in use\n");
TEST_EXIT_DBG((dof >= 0) && (dof < size))("invalid dof index %d\n",dof);
92
93
94
std::list<DOFIndexedBase*>::iterator di;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
95
96
for (di = dofIndexedList.begin(); di != end; ++di) {
97
98
99
(*di)->freeDOFContent(dof);
}
100
101
std::list<DOFContainer*>::iterator dc;
std::list<DOFContainer*>::iterator dcend = dofContainerList.end();
102
103
for (dc = dofContainerList.begin(); dc != dcend; ++dc) {
104
105
106
107
108
(*dc)->freeDOFIndex(dof);
}
dofFree[dof] = true;
109
110
if (static_cast<int>(firstHole) > dof)
firstHole = dof;
111
112
113
114
115
116
117
118
119
usedCount--;
holeCount++;
}
/****************************************************************************/
int DOFAdmin::getDOFIndex()
{
120
FUNCNAME("DOFAdmin::getDOFIndex()");
121
int dof = 0;
122
123
124
// if there is a hole
if (firstHole < static_cast<int>(dofFree.size())) {
125
TEST_EXIT_DBG(dofFree[firstHole])("no hole at firstHole!\n");
126
127
128
129
130
// its no longer a hole
dofFree[firstHole] = false;
dof = firstHole;
// search new hole
int dfsize = static_cast<int>(dofFree.size());
131
132
int i = firstHole + 1;
for (; i < dfsize; i++) {
133
134
135
136
137
if (dofFree[i]) {
break;
}
}
firstHole = i;
138
} else { // if there is no hole
139
140
// enlarge dof-list
enlargeDOFLists(0);
141
TEST_EXIT_DBG(firstHole < static_cast<int>(dofFree.size()))
142
("no free entry after enlargeDOFLists\n");
143
TEST_EXIT_DBG(dofFree[firstHole])
144
145
146
147
148
149
150
("no free bit at firstHole\n");
dofFree[firstHole] = false;
dof = firstHole;
firstHole++;
}
usedCount++;
151
152
153
if (holeCount > 0)
holeCount--;
sizeUsed = max(sizeUsed, dof + 1);
154
155
156
157
158
159
160
161
162
return(dof);
}
/****************************************************************************/
void DOFAdmin::enlargeDOFLists(int minsize)
{
163
FUNCNAME("DOFAdmin::enlargeDOFLists()");
164
165
int old = size;
166
167
168
169
if (minsize > 0) {
if (old > minsize) return;
}
170
int newval = max(minsize, static_cast<int>((dofFree.size() + sizeIncrement)));
171
172
173
174
175
176
177
178
179
180
181
size = newval;
// stl resizes dofFree to at least newval and sets all new values true
dofFree.resize(newval, true);
firstHole = old;
// enlarge all vectors and matrices
// but DOFVectors<int> don't have to be changed
182
183
std::list<DOFIndexedBase*>::iterator di;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
184
185
186
for (di = dofIndexedList.begin(); di != end; ++di) {
if ((*di)->getSize() < newval) {
187
188
189
190
191
192
(*di)->resize(newval);
}
}
}
void DOFAdmin::addDOFIndexed(DOFIndexedBase* dofIndexed) {
193
FUNCNAME("DOFAdmin::addDOFIndexed()");
194
195
TEST_EXIT(dofIndexed)("no dofIndexed\n");
196
197
198
199
200
201
202
203
204
205
206
#ifdef _OPENMP
#pragma omp critical (dofIndexAccess)
#endif
{
if (dofIndexed->getSize() < size) {
dofIndexed->resize(size);
}
dofIndexedList.push_back(dofIndexed);
}
207
208
209
210
}
void DOFAdmin::removeDOFIndexed(DOFIndexedBase* dofIndexed)
{
211
212
FUNCNAME("DOFAdmin::removeDOFIndexed()");
213
214
215
216
217
218
219
220
221
222
223
224
225
bool removed = false;
#ifdef _OPENMP
#pragma omp critical (dofIndexAccess)
#endif
{
std::list<DOFIndexedBase*>::iterator it;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for (it = dofIndexedList.begin(); it != end; ++it) {
if (*it == dofIndexed) {
dofIndexedList.erase(it);
removed = true;
break;
}
226
227
}
}
228
229
TEST_EXIT(removed)("DOFIndexed not in list\n");
230
231
232
233
}
void DOFAdmin::addDOFContainer(DOFContainer* cont)
{
234
FUNCNAME("DOFAdmin::addDOFContainer()");
235
TEST_EXIT_DBG(cont)("no container\n");
236
237
238
239
240
dofContainerList.push_back(cont);
}
void DOFAdmin::removeDOFContainer(DOFContainer* cont)
{
241
242
FUNCNAME("DOFAdmin::removeDOFContainer()");
243
244
std::list<DOFContainer*>::iterator it;
std::list<DOFContainer*>::iterator end = dofContainerList.end();
245
246
for (it = dofContainerList.begin(); it != end; ++it) {
if (*it == cont) {
247
248
249
250
251
252
253
254
255
256
dofContainerList.erase(it);
return;
}
}
ERROR("container not in list\n");
}
/****************************************************************************/
257
void DOFAdmin::compress(std::vector<DegreeOfFreedom> &new_dof)
258
{
259
FUNCNAME("DOFAdmin::compress()");
260
261
262
263
264
265
266
// nothing to do ?
if (size < 1) return;
if (usedCount < 1) return;
if (holeCount < 1) return;
// vector to mark used dofs
267
for (int i = 0; i < size; i++) {
268
269
270
271
272
new_dof[i] = -1;
}
// mark used dofs
DOFIteratorBase it(this, USED_DOFS);
273
274
275
for (it.reset(); !it.end(); ++it) {
new_dof[it.getDOFIndex()] = 1;
}
276
277
278
int n = 0, last = 0;
for (int i = 0; i < size; i++) { /* create a MONOTONE compress */
279
280
281
282
283
284
if (new_dof[i] == 1) {
new_dof[i] = n++;
last = i;
}
}
285
TEST_EXIT_DBG(n == usedCount)("count %d != usedCount %d\n", n, usedCount);
286
287
// mark used dofs in compressed dofFree
288
for (int i = 0; i < n; i++) {
289
290
291
dofFree[i] = false;
}
// mark unused dofs in compressed dofFree
292
for (int i = n; i < size; i++) {
293
294
295
296
297
298
299
300
dofFree[i] = true;
}
firstHole = n;
holeCount = 0;
sizeUsed = n;
// get index of first changed dof
301
302
int first = last;
for (int i = 0; i<size; i++) {
303
304
305
306
307
308
if ((new_dof[i] < i) && (new_dof[i] >= 0)) {
first = i;
break;
}
}
309
310
311
std::list<DOFIndexedBase*>::iterator di;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for (di = dofIndexedList.begin(); di != end; ++di) {
312
313
314
315
(*di)->compressDOFIndexed(first, last, new_dof);
};
316
317
318
std::list<DOFContainer*>::iterator dc;
std::list<DOFContainer*>::iterator endc = dofContainerList.end();
for (dc = dofContainerList.begin(); dc != endc; dc++) {
319
320
321
322
323
324
325
(*dc)->compressDOFContainer(n, new_dof);
};
return;
}
void DOFAdmin::setNumberOfDOFs(int i,int v) {
326
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
327
328
nrDOF[i] = v;
329
330
331
}
void DOFAdmin::setNumberOfPreDOFs(int i, int v) {
332
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
333
334
nr0DOF[i] = v;
335
336
337
}
DOFAdmin::~DOFAdmin()
338
339
{
}
340
341
void DOFAdmin::serialize(std::ostream &out)
342
343
{
// write name
Thomas Witkowski's avatar
Thomas Witkowski committed
344
out << name << "\n";
345
346
347
348
// write dofFree
int s = static_cast<int>(dofFree.size());
out.write(reinterpret_cast<const char*>(&s), sizeof(int));
349
for (int i = 0; i < s; i++) {
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
bool free = dofFree[i];
out.write(reinterpret_cast<const char*>(&free), sizeof(bool));
}
// write firstHole
out.write(reinterpret_cast<const char*>(&firstHole), sizeof(unsigned int));
// write size
out.write(reinterpret_cast<const char*>(&size), sizeof(int));
// write usedCount
out.write(reinterpret_cast<const char*>(&usedCount), sizeof(int));
// write holeCount
out.write(reinterpret_cast<const char*>(&holeCount), sizeof(int));
// write sizeUsed
out.write(reinterpret_cast<const char*>(&sizeUsed), sizeof(int));
// write nrDOF
nrDOF.serialize(out);
// write nr0DOF
nr0DOF.serialize(out);
}
376
void DOFAdmin::deserialize(std::istream &in)
377
378
379
380
381
382
383
384
385
{
// read name
in >> name;
in.get();
// read dofFree
int s;
in.read(reinterpret_cast<char*>(&s), sizeof(int));
dofFree.resize(s);
386
for (int i = 0; i < s; i++) {
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
bool free;
in.read(reinterpret_cast<char*>(&free), sizeof(bool));
dofFree[i] = free;
}
// read firstHole
in.read(reinterpret_cast<char*>(&firstHole), sizeof(unsigned int));
// read size
in.read(reinterpret_cast<char*>(&size), sizeof(int));
// read usedCount
in.read(reinterpret_cast<char*>(&usedCount), sizeof(int));
// read holeCount
in.read(reinterpret_cast<char*>(&holeCount), sizeof(int));
// read sizeUsed
in.read(reinterpret_cast<char*>(&sizeUsed), sizeof(int));
// read nrDOF
nrDOF.deserialize(in);
// read nr0DOF
nr0DOF.deserialize(in);
413
414
std::list<DOFIndexedBase*>::iterator di;
std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
415
416
for (di = dofIndexedList.begin(); di != end; ++di) {
417
418
419
420
421
(*di)->resize(size);
}
}
} | __label__pos | 0.989139 |
Remove Itodayire.fun POP-UP ads (1 Simple Step)
Itodayire.fun pop-up ads will appear in your browser if you have accepted push notifications from Itodayire.fun ads. Itodayire.fun notifications are displayed in the Google Chrome browser (including Android or iOS), Firefox browser, Edge browser, or Safari browser.
The Itodayire.fun intrusive advertisements appear as pop-ups in the lower right corner of Windows or on your mobile device, for example, an Android tablet or phone or iPad or iPhone.
Itodayire.fun ads result from rogue advertising networks that redirect users to Itodayire.fun after a visit, and there try to convince the user to press the “allow” button on the web browser.
Itodayire.fun is a social engineering trick to mislead users and is only intended to trick you into clicking on the ads that Itodayire.fun displays. Clicking on the Itodayire.fun ads will redirect your web browser to multiple dangerous websites and make online revenue for cybercriminals.
In most cases, your computer is most likely not infected with adware or malware, but only a web browser setting needs to be removed to remove the Itodayire.fun advertisements from your device.
This article will explain how to remove the notifications and associated advertisements sent by the Itodayire.fun domain from your web browser settings.
Remove Itodayire.fun pop-up ads
Itodayire.fun
google chrome logoRemove Itodayire.fun from Google Chrome
1. Open Google Chrome.
2. In the top-right corner, expand the Chrome menu.
3. In the Google Chrome menu, open Settings.
4. At the Privacy and Security section, click Site settings.
5. Open the Notifications settings.
6. Remove Itodayire.fun by clicking the three dots on the right next to the Itodayire.fun URL and click Remove.
android logoRemove Itodayire.fun from Android
1. Open Google Chrome
2. In the top-right corner, find the Chrome menu.
3. In the menu tap Settings, scroll down to Advanced.
4. In the Site Settings section, tap the Notifications settings, find the Itodayire.fun domain, and tap on it.
5. Tap the Clean & Reset button and confirm.
Problem solved? Please share this page, Thank you SO much.
mozilla firefox logoRemove Itodayire.fun from Firefox
1. Open Firefox
2. In the top-right corner, click the Firefox menu (three horizontal stripes).
3. In the menu go to Options, in the list on the left go to Privacy & Security.
4. Scroll down to Permissions and then to Settings next to Notifications.
5. Select the Itodayire.fun URL from the list, and change the status to Block, save Firefox changes.
internet explorer logoRemove Itodayire.fun from Internet Explorer
1. Open Internet Explorer.
2. In the top right corner, click on the gear icon (menu button).
3. Go to Internet Options in the menu.
4. Click on the Privacy tab and select Settings in the pop-up blockers section.
5. Find the Itodayire.fun URL and click the Remove button to remove the domain.
microsoft edge logoRemove Itodayire.fun from Edge
1. Open Microsoft Edge.
2. In the top right corner, click on the three dots to expand the Edge menu.
3. Scroll down to Settings, scroll further down to Advanced Settings
4. In the Notification section click Manage.
5. Click to Disable the on switch for the Itodayire.fun URL.
mac safari logoRemove Itodayire.fun from Safari on Mac
1. Open Safari. In the top left corner, click on Safari.
2. Go to Preferences in the Safari menu, now open the Websites tab.
3. In the left menu click on Notifications
4. Find the Itodayire.fun domain and select it, click the Deny button. | __label__pos | 0.96948 |
success = true; } public function checkPass($user, $pass) { assert(is_string($user)); assert(is_string($pass)); $userinfo = $this->getUserData($user); $status = False; $value = False; if($userinfo === false) return false; if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } $escPassword = urlencode($pass); $escUsername = urlencode($user); dbglog("Starting privacyIDEA auth with " . $escUsername . " and " . $escPassword); try { $crl = curl_init(); $timeout = 5; $privacyidea_url = $this->getConf("privacyidea_url"); $privacyidea_realm = $this->getConf("privacyidea_realm"); $privacyidea_verify = $this->getConf("privacyidea_verify"); $timeout = $this->getConf("privacyidea_timeout"); $url = $privacyidea_url . '?user=' . $escUsername . '&pass=' . $escPassword; if ($privacyidea_realm != "") { $url = $url . "&realm=" . $privacyidea_realm; } curl_setopt ($crl, CURLOPT_URL, $url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt ($crl, CURLOPT_HEADER, TRUE); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($crl, CURLOPT_SSL_VERIFYPEER, $privacyidea_verify); curl_setopt ($crl, CURLOPT_SSL_VERIFYHOST, $privacyidea_verify); dbglog("About to execute curl for url ". $url); $response = curl_exec($crl); dbglog("Got response " . $response); $header_size = curl_getinfo($crl, CURLINFO_HEADER_SIZE); $body = json_decode(substr( $response, $header_size )); $status = $body->result->status; $value = $body->result->value; curl_close($crl); } catch (Exception $e) { die("Something went wrong: " + $e); } return $value; } } ?> | __label__pos | 0.999793 |
Namespaces
Variants
Views
Actions
std::mersenne_twister_engine::discard
From cppreference.com
void discard( unsigned long long z );
(since C++11)
Advances the internal state by z times. Equivalent to calling operator() z times and discarding the result
Contents
[edit] Parameters
z - integer value specifying the number of times to advance the state by
[edit] Return value
(none)
[edit] Complexity
[edit] Notes
For some engines, "fast jump" algorithms are known, which advancing the state by many steps (order of millions) without calculating intermediate state transitions.
[edit] See also
advances the engine's state and returns the generated value
(public member function) [edit] | __label__pos | 0.714205 |
Skip to main content
This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.
For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?
Importing SQL Code
This chapter describes how to import SQL code from a text file into Caché SQL. When you import SQL code, Caché prepares and executes each line of SQL using the %Library.ResultSet dynamic SQL class. If it encounters a line of code it cannot parse, SQL import skips over that line of code and continues to prepare and execute subsequent lines until it reaches the end of the file. All SQL code import operations import to the current namespace.
SQL Import is primarily used to import Data Definition Language (DDL) statements, such as CREATE TABLE, and to populate tables using INSERT, UPDATE, and DELETE statements. SQL import does prepare and execute SELECT statements, but does not create a result set.
SQL import can be used to import Caché SQL code. It can also be used for code migration, to import SQL code from other vendors (FDBMS, Informix, InterBase, MSSQLServer, MySQL, Oracle, Sybase). Code from other vendors is converted to Caché SQL code and executed. SQL import cannot import all SQL statements into Caché SQL. It imports those statements and clauses that are compatible with the Caché implementation of the SQL standard. Incompatible features are commonly parsed, but ignored.
Successfully executed SQL statements create a corresponding cached query, where appropriate.
You perform SQL code import by invoking the appropriate method from the %SYSTEM.SQL class. When importing SQL code, these methods can create two other files: an Errors.log file which records errors in parsing SQL statements, and an Unsupported.log file, which contains the literal text of lines that the method does not recognize as an SQL statement.
This chapter describes importing different types of SQL code:
For further details on %Library.ResultSet refer to “Dynamic SQL Using %Library.ResultSet”.
Importing Caché SQL
You can import Caché SQL code from a text file using either of the following methods:
• DDLImport() is a general-purpose SQL import method. This method runs as a background (non-interactive) process. To import Caché SQL you specify “CACHE” as the first parameter.
• Cache() is a Caché SQL import method. This method runs interactively from the Terminal. It prompts you to specify the location of the import text file, the location to create the Errors.log file and the Unsupported.log file, and other information.
The following example imports the Caché SQL code file mysqlcode.txt, executing its SQL statements in the current namespace:
DO $SYSTEM.SQL.DDLImport("CACHE",$USERNAME,"c:\temp\mysqlcode.txt",,1)
By default, DDLImport() creates an errors log file. This example creates a file named mysqlcode_Errors.log in the same directory as the SQL code file. The fifth parameter is a boolean specifying whether or not to create a file that lists unsupported statements. The default is 0. In this example, the fifth parameter is set to 1, creating a file named mysqlcode_Unsupported.log in the same directory as the SQL code file. These log files are created even when there is nothing written to them.
When executing DDLImport() from the Terminal, it first lists the input file, the error log file, and the unsupported log file. Then for each SQL command it displays a listing such as the following:
SQL statement to process (number 1):
CREATE TABLE Sample.MyStudents (StudentName VARCHAR(32),
StudentDOB DATE)
Preparing SQL statement...
Executing SQL statement...
DONE
If an error occurs in any SQL command, the Terminal display the error, as shown in the following example:
SQL statement to process (number 3):
INSERT INTO Sample.MyStudents (StudentName,StudentDOB) SELECT Name,
DOB FROM Sample.Person WHERE Age <= '21'
Preparing SQL statement...
ERROR #5540: SQLCODE: -30 Message: Table 'SAMPLE.PERSON' not found
Pausing 5 seconds - read error message! (Type Q to Quit)
If you do not Quit within 5 seconds, DDLImport() proceeds to execute the next SQL command. The error is recorded in the errors log file with a timestamp, the user name, and the namespace name.
Import File Format
An SQL text file must be an unformatted file such as a .txt file. Each SQL statement must begin on its own line. An SQL statement may be broken into multiple lines and indentation is permitted. By default, each SQL statement must be followed by a GO statement on its own line.
The following is an example of a valid Caché SQL import file text:
CREATE TABLE Sample.MyStudents (StudentName VARCHAR(32),StudentDOB DATE)
GO
CREATE INDEX NameIdx ON TABLE Sample.MyStudents (StudentName)
GO
INSERT INTO Sample.MyStudents (StudentName,StudentDOB) SELECT Name,
DOB FROM Sample.Person WHERE Age <= '21'
GO
INSERT INTO Sample.MyStudents (StudentName,StudentDOB)
VALUES ('Jones,Mary',60123)
GO
UPDATE Sample.MyStudents SET StudentName='Smith-Jones,Mary' WHERE StudentName='Jones,Mary'
GO
DELETE FROM Sample.MyStudents WHERE StudentName %STARTSWITH 'A'
GO
By setting the DDLImport("CACHE") deos seventh parameter, this method can accept (but does not require) a specified end-of-statement delimiter, commonly a semicolon (;), at the end of each SQL statement. The default is to not support an end-of-statement delimiter. The “GO” statement on the line following an SQL statement is always supported, but is not required if deos specifies an end-of-statement delimiter.
Supported SQL Statements
Not all valid Caché SQL code statements can be imported. The following is a list of supported Caché SQL commands:
• CREATE TABLE, ALTER TABLE, DROP TABLE
• CREATE VIEW, ALTER VIEW, DROP VIEW
• CREATE INDEX all index types, except bitslice
• CREATE USER, DROP USER
• CREATE ROLE
• GRANT, REVOKE
• INSERT, UPDATE, INSERT OR UPDATE, DELETE
• SET OPTION
• SELECT for optimizer plan mode only
Code Migration: Importing non-Caché SQL
You can import SQL code that is in the SQL format used by other vendors. Code from other vendors is converted to Caché SQL code and executed. The following methods are provided:
• DDLImport() is a general-purpose SQL import method. This method runs as a background (non-interactive) process. Refer to Importing Caché SQL for general information on using this method.
To import SQL in a specific format you specify the name of that format as the first parameter: FDBMS, Informix, InterBase, MSSQLServer, MySQL, Oracle, or Sybase.
• Individual interactive methods are provided to import the following types of SQL: FDBMS(), Informix(), InterBase(), MSSQLServer(), Oracle(), and Sybase(). These methods runs interactively from the Terminal. It prompts you to specify the location of the import text file, the location to create the Errors.log file and the Unsupported.log file, and other information.
• DDLImportDir() allow you to import SQL code from multiple files in a directory. This method runs as a background (non-interactive) process. It supports Informix, MSSQLServer, and Sybase. All files to be imported must have a .sql extension suffix.
• ImportDir() allow you to import SQL code from multiple files in a directory. Provides more options than DDLImportDir(). This method runs as a background (non-interactive) process. It supports MSSQLServer, and Sybase. You can specify a list of allowed file extension suffixes.
Feedback | __label__pos | 0.975853 |
BETA
Translations
Merchant Center applications use react-intl, a library built on top of the ECMAScript Internationalization API.
In the React components, you can use things like <FormattedMessage> or intl.formatMessage to render the correct translation message based on the active locale.
We usually define a messages.js file co-located to the React component using those messages. The file defines messages as following:
import { defineMessages } from 'react-intl';
export default defineMessages({
title: {
id: 'StateMachines.ListView.title',
description: 'The page title of state machines list',
defaultMessage: 'State Machines',
},
});
This is the default message, which will be used in case there is no translation available for the given locale.
Extracting messages for translations
To generate translation files, you can use the official @formatjs/cli package to extract message from React Intl messages files. For example:
formatjs extract \
--out-file=./src/i18n/data/core.json \
'src/**/messages.js'
Based on your translation tool, you may need to transform the extracted messages to the appropriate format. For that you can write a formatter file and pass it as the --format option to the script.
formatjs extract \
--format=./intl-transformer.js
--out-file=./src/i18n/data/core.json \
'src/**/messages.js'
At commercetools we use Transifex as our translation tool. Therefore, in our applications we generate a core.json file with the key being the message id and the value being the default Intl message.
{
"StateMachines.ListView.title": "State Machines"
}
The core.json is the so-called source file, which should be used as reference file for the translations in the other locales.
As a convention, we store the translation files in a i18n folder:
└── src
└── i18n
└── data
├── core.json
├── en.json
└── de.json
Using the messages in the application
The JSON files containing the translations need to be loaded within the application. The <ApplicationShell> expects a applicationMessages prop that is used to load the messages in the react-intl provider. The applicationMessages prop can either be a JSON object or a function returning a Promise with the loaded messages.
To keep the bundle size low, the application should only load the messages for a specific locale and not all of them. This can be achieved by using the Code-Splitting feature.
Given the translation messages are located in the i18n/data folder, you can define a function to dynamically load the messages:
// entry-point.js
const loadMessages = lang => {
let loadAppI18nPromise;
switch (lang) {
case 'de':
loadAppI18nPromise = import(
'../../i18n/data/de.json' /* webpackChunkName: "app-i18n-de" */
);
break;
case 'es':
loadAppI18nPromise = import(
'../../i18n/data/es.json' /* webpackChunkName: "app-i18n-es" */
);
break;
default:
loadAppI18nPromise = import(
'../../i18n/data/en.json' /* webpackChunkName: "app-i18n-en" */
);
}
return loadAppI18nPromise.then(
result => result.default,
error => {
console.warn(
`Something went wrong while loading the app messages for ${lang}`,
error
);
return {};
}
);
};
const Application = () => (
<ApplicationShell
// other props
applicationMessages={loadMessages}
/>
);
Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2021 commercetools
Privacy PolicyImprint | __label__pos | 0.792941 |
analytics-go.v3: gopkg.in/segmentio/analytics-go.v3 Index | Examples | Files | Directories
package analytics
import "gopkg.in/segmentio/analytics-go.v3"
Index
Examples
Package Files
alias.go analytics.go config.go context.go error.go executor.go group.go identify.go integrations.go json.go logger.go message.go page.go properties.go screen.go timeout_16.go track.go traits.go
Constants
const DefaultBatchSize = 250
This constant sets the default batch size used by client instances if none was explicitly set.
const DefaultEndpoint = "https://api.segment.io"
This constant sets the default endpoint to which client instances send messages if none was explictly set.
const DefaultInterval = 5 * time.Second
This constant sets the default flush interval used by client instances if none was explicitly set.
const Version = "3.0.0"
Version of the client.
Variables
var (
// This error is returned by methods of the `Client` interface when they are
// called after the client was already closed.
ErrClosed = errors.New("the client was already closed")
// This error is used to notify the application that too many requests are
// already being sent and no more messages can be accepted.
ErrTooManyRequests = errors.New("too many requests are already in-flight")
// This error is used to notify the client callbacks that a message send
// failed because the JSON representation of a message exceeded the upper
// limit.
ErrMessageTooBig = errors.New("the message exceeds the maximum allowed size")
)
type Alias Uses
type Alias struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
PreviousId string `json:"previousId"`
UserId string `json:"userId"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in a alias call as described in https://segment.com/docs/libraries/http/#alias
func (Alias) Validate Uses
func (msg Alias) Validate() error
type AppInfo Uses
type AppInfo struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Build string `json:"build,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
This type provides the representation of the `context.app` object as defined in https://segment.com/docs/spec/common/#context
type Callback Uses
type Callback interface {
// This method is called for every message that was successfully sent to
// the API.
Success(Message)
// This method is called for every message that failed to be sent to the
// API and will be discarded by the client.
Failure(Message, error)
}
Values implementing this interface are used by analytics clients to notify the application when a message send succeeded or failed.
Callback methods are called by a client's internal goroutines, there are no guarantees on which goroutine will trigger the callbacks, the calls can be made sequentially or in parallel, the order doesn't depend on the order of messages were queued to the client.
Callback methods must return quickly and not cause long blocking operations to avoid interferring with the client's internal work flow.
type CampaignInfo Uses
type CampaignInfo struct {
Name string `json:"name,omitempty"`
Source string `json:"source,omitempty"`
Medium string `json:"medium,omitempty"`
Term string `json:"term,omitempty"`
Content string `json:"content,omitempty"`
}
This type provides the representation of the `context.campaign` object as defined in https://segment.com/docs/spec/common/#context
type Client Uses
type Client interface {
io.Closer
// Queues a message to be sent by the client when the conditions for a batch
// upload are met.
// This is the main method you'll be using, a typical flow would look like
// this:
//
// client := analytics.New(writeKey)
// ...
// client.Enqueue(analytics.Track{ ... })
// ...
// client.Close()
//
// The method returns an error if the message queue not be queued, which
// happens if the client was already closed at the time the method was
// called or if the message was malformed.
Enqueue(Message) error
}
This interface is the main API exposed by the analytics package. Values that satsify this interface are returned by the client constructors provided by the package and provide a way to send messages via the HTTP API.
func New Uses
func New(writeKey string) Client
Instantiate a new client that uses the write key passed as first argument to send messages to the backend. The client is created with the default configuration.
func NewWithConfig Uses
func NewWithConfig(writeKey string, config Config) (cli Client, err error)
Instantiate a new client that uses the write key and configuration passed as arguments to send messages to the backend. The function will return an error if the configuration contained impossible values (like a negative flush interval for example). When the function returns an error the returned client will always be nil.
type Config Uses
type Config struct {
// The endpoint to which the client connect and send their messages, set to
// `DefaultEndpoint` by default.
Endpoint string
// The flushing interval of the client. Messages will be sent when they've
// been queued up to the maximum batch size or when the flushing interval
// timer triggers.
Interval time.Duration
// The HTTP transport used by the client, this allows an application to
// redefine how requests are being sent at the HTTP level (for example,
// to change the connection pooling policy).
// If none is specified the client uses `http.DefaultTransport`.
Transport http.RoundTripper
// The logger used by the client to output info or error messages when that
// are generated by background operations.
// If none is specified the client uses a standard logger that outputs to
// `os.Stderr`.
Logger Logger
// The callback object that will be used by the client to notify the
// application when messages sends to the backend API succeeded or failed.
Callback Callback
// The maximum number of messages that will be sent in one API call.
// Messages will be sent when they've been queued up to the maximum batch
// size or when the flushing interval timer triggers.
// Note that the API will still enforce a 500KB limit on each HTTP request
// which is independent from the number of embedded messages.
BatchSize int
// When set to true the client will send more frequent and detailed messages
// to its logger.
Verbose bool
// The default context set on each message sent by the client.
DefaultContext *Context
// The retry policy used by the client to resend requests that have failed.
// The function is called with how many times the operation has been retried
// and is expected to return how long the client should wait before trying
// again.
// If not set the client will fallback to use a default retry policy.
RetryAfter func(int) time.Duration
// contains filtered or unexported fields
}
Instances of this type carry the different configuration options that may be set when instantiating a client.
Each field's zero-value is either meaningful or interpreted as using the default value defined by the library.
type ConfigError Uses
type ConfigError struct {
// A human-readable message explaining why the configuration field's value
// is invalid.
Reason string
// The name of the configuration field that was carrying an invalid value.
Field string
// The value of the configuration field that caused the error.
Value interface{}
}
Returned by the `NewWithConfig` function when the one of the configuration fields was set to an impossible value (like a negative duration).
func (ConfigError) Error Uses
func (e ConfigError) Error() string
type Context Uses
type Context struct {
App AppInfo `json:"app,omitempty"`
Campaign CampaignInfo `json:"campaign,omitempty"`
Device DeviceInfo `json:"device,omitempty"`
Library LibraryInfo `json:"library,omitempty"`
Location LocationInfo `json:"location,omitempty"`
Network NetworkInfo `json:"network,omitempty"`
OS OSInfo `json:"os,omitempty"`
Page PageInfo `json:"page,omitempty"`
Referrer ReferrerInfo `json:"referrer,omitempty"`
Screen ScreenInfo `json:"screen,omitempty"`
IP net.IP `json:"ip,omitempty"`
Locale string `json:"locale,omitempty"`
Timezone string `json:"timezone,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Traits Traits `json:"traits,omitempty"`
// This map is used to allow extensions to the context specifications that
// may not be documented or could be introduced in the future.
// The fields of this map are inlined in the serialized context object,
// there is no actual "extra" field in the JSON representation.
Extra map[string]interface{} `json:"-"`
}
This type provides the representation of the `context` object as defined in https://segment.com/docs/spec/common/#context
func (Context) MarshalJSON Uses
func (ctx Context) MarshalJSON() ([]byte, error)
Satisfy the `json.Marshaler` interface. We have to flatten out the `Extra` field but the standard json package doesn't support it yet. Implementing this interface allows us to override the default marshaling of the context object and to the inlining ourselves.
Related discussion: https://github.com/golang/go/issues/6213
type DeviceInfo Uses
type DeviceInfo struct {
Id string `json:"id,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
Model string `json:"model,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
AdvertisingID string `json:"advertisingId,omitempty"`
}
This type provides the representation of the `context.device` object as defined in https://segment.com/docs/spec/common/#context
type FieldError Uses
type FieldError struct {
// The human-readable representation of the type of structure that wasn't
// initialized properly.
Type string
// The name of the field that wasn't properly initialized.
Name string
// The value of the field that wasn't properly initialized.
Value interface{}
}
Instances of this type are used to represent errors returned when a field was no initialize properly in a structure passed as argument to one of the functions of this package.
func (FieldError) Error Uses
func (e FieldError) Error() string
type Group Uses
type Group struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
GroupId string `json:"groupId"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Traits Traits `json:"traits,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in a group call as described in https://segment.com/docs/libraries/http/#group
func (Group) Validate Uses
func (msg Group) Validate() error
type Identify Uses
type Identify struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Traits Traits `json:"traits,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in an identify call as described in https://segment.com/docs/libraries/http/#identify
func (Identify) Validate Uses
func (msg Identify) Validate() error
type Integrations Uses
type Integrations map[string]interface{}
This type is used to represent integrations in messages that support it. It is a free-form where values are most often booleans that enable or disable integrations. Here's a quick example of how this type is meant to be used:
analytics.Track{
UserId: "0123456789",
Integrations: analytics.NewIntegrations()
.EnableAll()
.Disable("Salesforce")
.Disable("Marketo"),
}
The specifications can be found at https://segment.com/docs/spec/common/#integrations
func NewIntegrations Uses
func NewIntegrations() Integrations
func (Integrations) Disable Uses
func (i Integrations) Disable(name string) Integrations
func (Integrations) DisableAll Uses
func (i Integrations) DisableAll() Integrations
func (Integrations) Enable Uses
func (i Integrations) Enable(name string) Integrations
func (Integrations) EnableAll Uses
func (i Integrations) EnableAll() Integrations
func (Integrations) Set Uses
func (i Integrations) Set(name string, value interface{}) Integrations
Sets an integration named by the first argument to the specified value, any value other than `false` will be interpreted as enabling the integration.
type LibraryInfo Uses
type LibraryInfo struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
}
This type provides the representation of the `context.library` object as defined in https://segment.com/docs/spec/common/#context
type LocationInfo Uses
type LocationInfo struct {
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
Region string `json:"region,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Speed float64 `json:"speed,omitempty"`
}
This type provides the representation of the `context.location` object as defined in https://segment.com/docs/spec/common/#context
type Logger Uses
type Logger interface {
// Analytics clients call this method to log regular messages about the
// operations they perform.
// Messages logged by this method are usually tagged with an `INFO` log
// level in common logging libraries.
Logf(format string, args ...interface{})
// Analytics clients call this method to log errors they encounter while
// sending events to the backend servers.
// Messages logged by this method are usually tagged with an `ERROR` log
// level in common logging libraries.
Errorf(format string, args ...interface{})
}
Instances of types implementing this interface can be used to define where the analytics client logs are written.
func StdLogger Uses
func StdLogger(logger *log.Logger) Logger
This function instantiate an object that statisfies the analytics.Logger interface and send logs to standard logger passed as argument.
type Message Uses
type Message interface {
// Validate validates the internal structure of the message, the method must return
// nil if the message is valid, or an error describing what went wrong.
Validate() error
// contains filtered or unexported methods
}
This interface is used to represent analytics objects that can be sent via a client.
Types like analytics.Track, analytics.Page, etc... implement this interface and therefore can be passed to the analytics.Client.Send method.
type NetworkInfo Uses
type NetworkInfo struct {
Bluetooth bool `json:"bluetooth,omitempty"`
Cellular bool `json:"cellular,omitempty"`
WIFI bool `json:"wifi,omitempty"`
Carrier string `json:"carrier,omitempty"`
}
This type provides the representation of the `context.network` object as defined in https://segment.com/docs/spec/common/#context
type OSInfo Uses
type OSInfo struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
}
This type provides the representation of the `context.os` object as defined in https://segment.com/docs/spec/common/#context
type Page Uses
type Page struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
Name string `json:"name,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Properties Properties `json:"properties,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in a page call as described in https://segment.com/docs/libraries/http/#page
func (Page) Validate Uses
func (msg Page) Validate() error
type PageInfo Uses
type PageInfo struct {
Hash string `json:"hash,omitempty"`
Path string `json:"path,omitempty"`
Referrer string `json:"referrer,omitempty"`
Search string `json:"search,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
}
This type provides the representation of the `context.page` object as defined in https://segment.com/docs/spec/common/#context
type Product Uses
type Product struct {
ID string `json:"id,omitempty"`
SKU string `json:"sky,omitempty"`
Name string `json:"name,omitempty"`
Price float64 `json:"price"`
}
This type represents products in the E-commerce API.
type Properties Uses
type Properties map[string]interface{}
This type is used to represent properties in messages that support it. It is a free-form object so the application can set any value it sees fit but a few helper method are defined to make it easier to instantiate properties with common fields. Here's a quick example of how this type is meant to be used:
analytics.Page{
UserId: "0123456789",
Properties: analytics.NewProperties()
.SetRevenue(10.0)
.SetCurrency("USD"),
}
func NewProperties Uses
func NewProperties() Properties
func (Properties) Set Uses
func (p Properties) Set(name string, value interface{}) Properties
func (Properties) SetCategory Uses
func (p Properties) SetCategory(category string) Properties
func (Properties) SetCoupon Uses
func (p Properties) SetCoupon(coupon string) Properties
func (Properties) SetCurrency Uses
func (p Properties) SetCurrency(currency string) Properties
func (Properties) SetDiscount Uses
func (p Properties) SetDiscount(discount float64) Properties
func (Properties) SetName Uses
func (p Properties) SetName(name string) Properties
func (Properties) SetOrderId Uses
func (p Properties) SetOrderId(id string) Properties
func (Properties) SetPath Uses
func (p Properties) SetPath(path string) Properties
func (Properties) SetPrice Uses
func (p Properties) SetPrice(price float64) Properties
func (Properties) SetProductId Uses
func (p Properties) SetProductId(id string) Properties
func (Properties) SetProducts Uses
func (p Properties) SetProducts(products ...Product) Properties
func (Properties) SetReferrer Uses
func (p Properties) SetReferrer(referrer string) Properties
func (Properties) SetRepeat Uses
func (p Properties) SetRepeat(repeat bool) Properties
func (Properties) SetRevenue Uses
func (p Properties) SetRevenue(revenue float64) Properties
func (Properties) SetSKU Uses
func (p Properties) SetSKU(sku string) Properties
func (Properties) SetShipping Uses
func (p Properties) SetShipping(shipping float64) Properties
func (Properties) SetSubtotal Uses
func (p Properties) SetSubtotal(subtotal float64) Properties
func (Properties) SetTax Uses
func (p Properties) SetTax(tax float64) Properties
func (Properties) SetTitle Uses
func (p Properties) SetTitle(title string) Properties
func (Properties) SetTotal Uses
func (p Properties) SetTotal(total float64) Properties
func (Properties) SetURL Uses
func (p Properties) SetURL(url string) Properties
func (Properties) SetValue Uses
func (p Properties) SetValue(value float64) Properties
type ReferrerInfo Uses
type ReferrerInfo struct {
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Link string `json:"link,omitempty"`
}
This type provides the representation of the `context.referrer` object as defined in https://segment.com/docs/spec/common/#context
type Screen Uses
type Screen struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
Name string `json:"name,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Properties Properties `json:"properties,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in a screen call as described in https://segment.com/docs/libraries/http/#screen
func (Screen) Validate Uses
func (msg Screen) Validate() error
type ScreenInfo Uses
type ScreenInfo struct {
Density int `json:"density,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}
This type provides the representation of the `context.screen` object as defined in https://segment.com/docs/spec/common/#context
type Track Uses
type Track struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
AnonymousId string `json:"anonymousId,omitempty"`
UserId string `json:"userId,omitempty"`
Event string `json:"event"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Properties Properties `json:"properties,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
This type represents object sent in a track call as described in https://segment.com/docs/libraries/http/#track
Code:
body, server := mockServer()
defer server.Close()
client, _ := NewWithConfig("h97jamjwbh", Config{
Endpoint: server.URL,
BatchSize: 1,
now: mockTime,
uid: mockId,
})
defer client.Close()
client.Enqueue(Track{
Event: "Download",
UserId: "123456",
Properties: Properties{
"application": "Segment Desktop",
"version": "1.1.0",
"platform": "osx",
},
})
fmt.Printf("%s\n", <-body)
Output:
{
"batch": [
{
"event": "Download",
"messageId": "I'm unique",
"properties": {
"application": "Segment Desktop",
"platform": "osx",
"version": "1.1.0"
},
"timestamp": "2009-11-10T23:00:00Z",
"type": "track",
"userId": "123456"
}
],
"context": {
"library": {
"name": "analytics-go",
"version": "3.0.0"
}
},
"messageId": "I'm unique",
"sentAt": "2009-11-10T23:00:00Z"
}
func (Track) Validate Uses
func (msg Track) Validate() error
type Traits Uses
type Traits map[string]interface{}
This type is used to represent traits in messages that support it. It is a free-form object so the application can set any value it sees fit but a few helper method are defined to make it easier to instantiate traits with common fields. Here's a quick example of how this type is meant to be used:
analytics.Identify{
UserId: "0123456789",
Traits: analytics.NewTraits()
.SetFirstName("Luke")
.SetLastName("Skywalker")
.Set("Role", "Jedi"),
}
The specifications can be found at https://segment.com/docs/spec/identify/#traits
func NewTraits Uses
func NewTraits() Traits
func (Traits) Set Uses
func (t Traits) Set(field string, value interface{}) Traits
func (Traits) SetAddress Uses
func (t Traits) SetAddress(address string) Traits
func (Traits) SetAge Uses
func (t Traits) SetAge(age int) Traits
func (Traits) SetAvatar Uses
func (t Traits) SetAvatar(url string) Traits
func (Traits) SetBirthday Uses
func (t Traits) SetBirthday(date time.Time) Traits
func (Traits) SetCreatedAt Uses
func (t Traits) SetCreatedAt(date time.Time) Traits
func (Traits) SetDescription Uses
func (t Traits) SetDescription(desc string) Traits
func (Traits) SetEmail Uses
func (t Traits) SetEmail(email string) Traits
func (Traits) SetFirstName Uses
func (t Traits) SetFirstName(firstName string) Traits
func (Traits) SetGender Uses
func (t Traits) SetGender(gender string) Traits
func (Traits) SetLastName Uses
func (t Traits) SetLastName(lastName string) Traits
func (Traits) SetName Uses
func (t Traits) SetName(name string) Traits
func (Traits) SetPhone Uses
func (t Traits) SetPhone(phone string) Traits
func (Traits) SetTitle Uses
func (t Traits) SetTitle(title string) Traits
func (Traits) SetUsername Uses
func (t Traits) SetUsername(username string) Traits
func (Traits) SetWebsite Uses
func (t Traits) SetWebsite(url string) Traits
Directories
PathSynopsis
examples
Package analytics imports 16 packages (graph) and is imported by 21 packages. Updated 2019-09-21. Refresh now. Tools for package owners. | __label__pos | 0.957823 |
How to Pass CCNP ENCOR: Tips and Strategies for Success
Are you looking to pass the CCNP ENCOR exam? If so, you’re in the right place. In this article, we will provide you with tips and techniques to help you prepare for and pass the CCNP ENCOR exam. We will cover everything from understanding the basics of CCNP ENCOR to effective study techniques and exam day tips.
To begin with, it’s important to have a solid understanding of the basics of CCNP ENCOR. This includes network fundamentals, virtualization and infrastructure, network assurance, security principles, and automation. Once you have a good grasp of these concepts, you can move on to more advanced topics and techniques that will help you pass the exam.
Effective study techniques are also crucial when it comes to passing the CCNP ENCOR exam. This includes creating a study plan, using high-quality study materials, and practicing with practice exams. Additionally, exam day tips such as getting a good night’s sleep and arriving early to the testing center can help you feel more confident and prepared for the exam.
Key Takeaways
• Understand the basics of CCNP ENCOR, including network fundamentals, virtualization and infrastructure, network assurance, security principles, and automation.
• Use effective study techniques such as creating a study plan, using high-quality study materials, and practicing with practice exams.
• Follow exam day tips such as getting a good night’s sleep and arriving early to the testing center to feel more confident and prepared for the exam.
Understanding CCNP ENCOR Basics
The CCNP ENCOR exam tests your knowledge of enterprise networking technologies. It covers a wide range of topics, including network design, routing protocols, network security, and more. In order to pass the exam, you need to have a strong understanding of these fundamentals.
Here are some of the key topics that you should focus on:
Network Design
Network design is a critical component of the CCNP ENCOR exam. You need to understand the various network topologies, such as LAN, WAN, and VPN, as well as the different network models, such as the OSI and TCP/IP models. Additionally, you need to be familiar with network design principles and best practices, such as redundancy, scalability, and security.
Routing Protocols
Routing protocols are another important topic on the CCNP ENCOR exam. You need to understand the different types of routing protocols, such as OSPF, EIGRP, and BGP, as well as their features, advantages, and disadvantages. You also need to know how to configure and troubleshoot these protocols.
Network Security
Network security is a critical component of any enterprise network. You need to understand the different types of security threats, such as viruses, worms, and malware, as well as the different security technologies, such as firewalls, VPNs, and intrusion prevention systems. Additionally, you need to know how to configure and troubleshoot these technologies.
Network Automation
Network automation is becoming increasingly important in enterprise networks. You need to understand the different automation technologies, such as Ansible, Puppet, and Chef, as well as their features, advantages, and disadvantages. You also need to know how to configure and troubleshoot these technologies.
In summary, the CCNP ENCOR exam covers a wide range of topics related to enterprise networking technologies. In order to pass the exam, you need to have a strong understanding of these fundamentals. By focusing on the key topics outlined above, you can prepare yourself for success on the exam.
Network Fundamentals
To pass the CCNP ENCOR exam, you must have a general understanding of network fundamentals. This includes knowledge of routing protocols, IP services, and network device security. Let’s take a closer look at each of these sub-sections.
Routing Protocols
Routing protocols are used to determine the best path for data to travel through a network. There are two types of routing protocols: interior gateway protocols (IGPs) and exterior gateway protocols (EGPs). IGPs are used within an autonomous system, while EGPs are used between autonomous systems.
Some common IGPs include:
• Routing Information Protocol (RIP)
• Open Shortest Path First (OSPF)
• Enhanced Interior Gateway Routing Protocol (EIGRP)
EGPs include:
• Border Gateway Protocol (BGP)
It’s important to understand the differences between these protocols and when to use each one.
IP Services
IP services are used to provide advanced functionality to networks. Some common IP services include:
• Domain Name System (DNS): translates domain names to IP addresses
• Dynamic Host Configuration Protocol (DHCP): assigns IP addresses automatically
• Network Address Translation (NAT): allows multiple devices to share a single IP address
You should have a good understanding of how these services work and how to configure them on network devices.
In conclusion, understanding network fundamentals is crucial to passing the CCNP ENCOR exam. Make sure you have a solid understanding of routing protocols, IP services, and network device security to increase your chances of success.
Virtualization and Infrastructure
Virtualization and infrastructure are crucial topics that you need to understand to pass the CCNP ENCOR exam. This section will cover Network Virtualization and Infrastructure Security.
Network Virtualization
Network virtualization allows multiple virtual networks to run on a single physical network infrastructure. This is achieved by creating virtual switches, routers, and firewalls that can be managed independently of the physical network. Understanding network virtualization is essential for designing, deploying, and troubleshooting virtual networks.
To prepare for the CCNP ENCOR exam, you should have a good understanding of the following topics related to network virtualization:
• Virtual LANs (VLANs)
• Virtual Switching System (VSS)
• Virtual Routing and Forwarding (VRF)
• Overlay networks such as VXLAN and NVGRE
Infrastructure Security
Infrastructure security is a critical component of any enterprise network. It involves securing the network infrastructure devices such as routers, switches, and firewalls. Infrastructure security is important to prevent unauthorized access, protect against attacks, and ensure the confidentiality, integrity, and availability of network resources.
To prepare for the CCNP ENCOR exam, you should have a good understanding of the following topics related to infrastructure security:
• Device hardening
• Access control lists (ACLs)
• Network Address Translation (NAT)
• Virtual Private Network (VPN)
• Secure Socket Layer (SSL) and Transport Layer Security (TLS)
In conclusion, virtualization and infrastructure are essential topics that you need to understand to pass the CCNP ENCOR exam. By understanding network virtualization and infrastructure security, you will be able to design, deploy, and troubleshoot enterprise networks with confidence.
Network Assurance
Network Assurance is one of the six sections of the CCNP ENCOR exam. It covers topics related to network monitoring, troubleshooting, and optimization. The Network Assurance section makes up 10% of the exam, which means that it is important to have a solid understanding of the concepts and technologies covered in this section.
To pass the Network Assurance section of the CCNP ENCOR exam, you need to have a good understanding of the following topics:
• Network monitoring tools and protocols
• Troubleshooting methodologies
• Network optimization techniques
You should also be familiar with the following Cisco technologies:
• Cisco DNA Center
• Cisco Prime Infrastructure
• Cisco Network Services Orchestrator (NSO)
In addition to the above, you should also be familiar with network security concepts and technologies, as they are closely related to network assurance.
To prepare for the Network Assurance section of the CCNP ENCOR exam, you should start by reviewing the official exam topics provided by Cisco. You can find these topics on the Cisco Learning Network website. Other resources that can help you prepare for this section include:
• Cisco Press books
• Online training courses
• Practice exams
It is also a good idea to gain hands-on experience with the technologies covered in this section. This can be done by setting up a lab environment or by working on real-world projects.
In summary, the Network Assurance section of the CCNP ENCOR exam covers topics related to network monitoring, troubleshooting, and optimization. To pass this section, you need to have a good understanding of the concepts and technologies covered in this section, as well as network security concepts and technologies. You can prepare for this section by reviewing the official exam topics, using study resources, and gaining hands-on experience.
Security Principles
Security is an essential aspect of network infrastructure, and it is also a critical part of the CCNP ENCOR exam. In this section, we will cover some of the security principles that you need to know to pass the exam.
Confidentiality, Integrity, and Availability (CIA)
The CIA triad is a fundamental concept in network security. It stands for Confidentiality, Integrity, and Availability. Confidentiality refers to the protection of data from unauthorized access, while integrity ensures that data is not tampered with or altered. Availability means that data is accessible to authorized users when needed. Understanding the CIA triad is crucial to designing and implementing secure networks.
Network Security Devices
Network security devices play a vital role in securing a network. Some of the critical network security devices that you need to know for the CCNP ENCOR exam include firewalls, intrusion prevention systems (IPS), and virtual private networks (VPN). Firewalls are the first line of defense against unauthorized access to a network, while IPS helps to detect and prevent network attacks. VPNs, on the other hand, provide secure remote access to a network.
Network Security Threats
To secure a network, you need to be aware of the various security threats that can affect it. Some of the common network security threats include malware, phishing, and denial-of-service (DoS) attacks. Malware is a type of software that is designed to harm a network or steal data. Phishing is a social engineering technique used to trick users into revealing sensitive information, while DoS attacks aim to disrupt network services by overwhelming them with traffic.
In summary, to pass the CCNP ENCOR exam, you need to have a strong understanding of network security principles. This includes understanding the CIA triad, network security devices, and common network security threats. By mastering these concepts, you will be well on your way to becoming a certified network professional.
Automation
Automation is a key aspect of modern networking. It allows network administrators to streamline their workflows, reduce errors, and improve efficiency. In this section, we will explore some of the key concepts related to automation that you should be familiar with in order to pass the CCNP ENCOR exam.
Network Automation
Network automation is the process of using software tools to automate the configuration, management, and monitoring of network devices. There are several benefits to network automation, including reducing the time and effort required to manage a network, reducing the risk of errors, and improving network reliability.
There are several tools available for network automation, including Ansible, Chef, Puppet, and SaltStack. These tools use various programming languages and methodologies to automate network tasks. It is important to be familiar with at least one of these tools in order to pass the CCNP ENCOR exam.
Programming Concepts
In order to effectively use network automation tools, it is important to have a basic understanding of programming concepts. This includes knowledge of programming languages such as Python, as well as concepts such as data structures, algorithms, and object-oriented programming.
Python is a popular programming language for network automation due to its ease of use and large number of libraries and modules available. It is important to have a basic understanding of Python in order to write scripts and automate network tasks.
In addition to Python, it is also important to be familiar with other programming concepts such as data structures and algorithms. These concepts are used in network automation to manipulate and analyze data, and to create efficient and effective scripts.
Overall, network automation is an important aspect of modern networking, and it is essential to have a basic understanding of automation tools and programming concepts in order to pass the CCNP ENCOR exam. By familiarizing yourself with these concepts, you will be better prepared to manage and maintain complex networks in a more efficient and effective manner.
Effective Study Techniques
Studying for the CCNP ENCOR exam can be a daunting task, but with the right techniques, it can be a manageable and even enjoyable experience. Here are some effective study techniques to help you prepare for the exam:
1. Create a Study Plan
Before you start studying, it’s important to create a study plan that outlines your goals, schedule, and study materials. This will help you stay organized and focused, and ensure that you cover all the necessary topics before the exam. You can use a spreadsheet or a task management app to create your study plan.
2. Use Multiple Study Materials
While the official Cisco study materials are essential, they may not be enough to fully prepare you for the exam. It’s a good idea to use multiple study materials, such as online courses, practice exams, and study groups. This will give you a more well-rounded understanding of the topics and help you identify areas where you need more practice.
3. Take Breaks
Studying for long periods of time can be counterproductive, as it can lead to burnout and decreased productivity. It’s important to take regular breaks to rest your mind and recharge your batteries. You can take a short walk, meditate, or do some stretching exercises to help you relax and refocus.
4. Practice, Practice, Practice
The CCNP ENCOR exam is a hands-on exam, which means that you need to have practical experience in addition to theoretical knowledge. It’s important to practice configuring and troubleshooting Cisco devices in a lab environment to gain practical experience and reinforce your understanding of the topics.
5. Join a Study Group
Joining a study group can be a great way to stay motivated and get support from other people who are also preparing for the exam. You can share study materials, ask questions, and discuss difficult topics with your study group. You can find study groups online or create your own with colleagues or friends.
By using these effective study techniques, you can increase your chances of passing the CCNP ENCOR exam and achieve your professional goals. Remember to stay focused, stay motivated, and stay positive throughout your study journey.
Exam Day Tips
On the day of the CCNP ENCOR exam, it’s normal to feel nervous or anxious. However, with some preparation and planning, you can help alleviate some of that stress. Here are some tips to help you have a successful exam day:
1. Get a Good Night’s Sleep
Make sure you get a full night’s sleep before the exam. Being well-rested will help you stay focused and alert during the test. Avoid staying up late the night before studying or cramming, as this can lead to fatigue and decreased performance.
2. Arrive Early
Plan to arrive at the testing center at least 30 minutes before your scheduled exam time. This will give you time to check in, go through security, and get settled before the exam starts. You don’t want to be rushed or stressed out before the exam even begins.
3. Bring Proper Identification
Make sure you bring two forms of identification, one of which must be a government-issued photo ID. Check the requirements for acceptable forms of identification beforehand to avoid any issues on exam day.
4. Read Instructions Carefully
Before starting the exam, take a few minutes to read through the instructions carefully. Make sure you understand how to navigate through the exam, how to flag questions for review, and how to submit your answers.
5. Pace Yourself
The CCNP ENCOR exam is timed, so it’s important to pace yourself. Don’t spend too much time on any one question, and make sure you leave enough time to review your answers before submitting the exam.
6. Take Breaks
You are allowed to take breaks during the exam, so make use of them if you need to. Taking a short break can help you clear your mind and refocus for the next section of the exam.
7. Stay Calm and Focused
Finally, remember to stay calm and focused during the exam. If you encounter a difficult question, don’t panic. Take a deep breath, read the question carefully, and use your knowledge and reasoning skills to come up with the best answer.
By following these exam day tips, you can help set yourself up for success on the CCNP ENCOR exam.
Conclusion
In conclusion, passing the CCNP ENCOR exam requires a strong understanding of process control, CEF, architecture, virtualization, infrastructure, network assurance, security, and automation. With the right preparation, you can successfully demonstrate your knowledge and skills to obtain your CCNP Enterprise certification.
One of the best ways to prepare for the exam is to enroll in high-quality training courses. According to experts, it may take 3-5 months of studying to cover all the necessary ground. Additionally, practicing with Boson exams can help you feel confident and prepared for the actual Cisco exam.
Remember to focus on the exam topics and ensure you have a thorough understanding of each area. Don’t rush through your studies or try to cram everything in at the last minute. Instead, take your time, review the material regularly, and seek help when needed.
Lastly, don’t forget to take care of yourself during the preparation process. Get enough rest, exercise, and eat healthy foods to keep your mind and body in top shape. With dedication, hard work, and the right mindset, you can pass the CCNP ENCOR exam and achieve your certification goals.
Frequently Asked Questions
What are some effective study strategies for CCNP Encor?
Effective study strategies for CCNP Encor include reading the official Cisco text, watching video courses, taking notes, doing every lab and practice, and using Boson practice tests. Studying for at least 3-5 months is recommended.
What resources are available for CCNP Encor practice tests?
Boson practice tests are highly recommended for CCNP Encor practice. They are considered to be very effective in preparing for the real exam. Other resources include official Cisco practice exams and study groups.
What is the recommended study time for CCNP Encor?
The recommended study time for CCNP Encor is at least 3-5 months. This gives you enough time to cover all the topics in the exam and practice with different resources.
What topics should I focus on for the CCNP Encor exam?
The CCNP Encor exam covers a wide range of topics, including network architecture, virtualization, infrastructure, security, automation, and network assurance. It is important to focus on all these topics and not miss any important details.
How can I improve my understanding of CCNP Encor lab exercises?
Improving your understanding of CCNP Encor lab exercises involves practicing with different lab scenarios, using virtual labs, and learning from experts in the field. You can also join study groups and attend online courses to get more insights.
What are some common mistakes to avoid when taking the CCNP Encor exam?
Common mistakes to avoid when taking the CCNP Encor exam include not reading the questions carefully, not managing time well, not knowing the exam format and structure, and not reviewing the material thoroughly. It is important to be well-prepared and confident when taking the exam.
Be the first to Apply 👋
Sign up to get job alerts and we will match you with only relevant jobs
We don’t spam! Read our [link]privacy policy[/link] for more info.
jobs
Leave a Reply
This site uses Akismet to reduce spam. Learn how your comment data is processed. | __label__pos | 0.959836 |
310-091 Sun Certified Bus. Component Developer Java EE Test Set 9
A developer implemented a Java class called Store. The class is annotated correctly to act as an
entity. The developer created a stateless session bean to create, lookup, and remove Store
objects. This session bean has a container-managed entity manager injected into field em and a
removeStore method with transaction attribute REQUIRED.
Given the following code :
32. public void removeStore(Store store) {
33. em.remove(store);
34. }
What is a possible reason that an IllegalArgumentException is thrown at Line 33 when the
removeStore method is called by a remote client?
Options are :
• The passed object is NOT serializable.
• The passed object is NOT found in the database.
• The passed object is NOT managed by the entity manager.
• There is no active transaction to manage the database removal.
Answer : The passed object is NOT managed by the entity manager.
A developer is implementing a message-listener method of an EJB 3.0 message-driven bean. The
developer wants to make sure that the message receipt is immediately rolled back in case the
message listener method is aborted with a runtime exception. Which option can the developer
use?
Options are :
• Use Container-Managed Transactions with transaction attribute REQUIRED.
• Use Bean-Managed Transactions and write a try-catch-finally block that calls UserTransaction.rollback in case of a RuntimeException.
• Use Container-Managed Transactions with transaction attribute NOT_SUPPORTED.
• Use Bean-Managed Transactions and the JMS API for message acknowledgement.
Answer : Use Container-Managed Transactions with transaction attribute REQUIRED.
A session bean's business method throws an exception during execution. Which two are
responsibilities of the Bean Provider when throwing the exception? (Choose two.)
A. For application exceptions, ensure that if the current transaction commits there will be no loss
of data integrity.
B. For application exceptions, ensure that the current transaction will commit.
C. For system errors, when the client is remote, throw a java.rmi.RemoteException that wraps the
original exception.
D. For checked exceptions from which the bean cannot recover, throw an EJBException that
wraps the original exception.
Options are :
• C,D
• A,B
• A,D
• A,C
Answer : A,D
310-110 Sun Certified Mobile Application Developer for J2ME Set 1
Which is a valid way of injecting a container-managed transaction-scoped persistence context into
an EJB 3.0 session bean assuming the application contains only one persistence unit?
Options are :
• @Resource(name="persistence/em", authenticationType=AuthenticationType.CONTAINER) protected EntityManager em;
• @PersistenceContext private EntityManager em;
• @PersistenceUnit public EntityManager em;
• @TransactionManagement(TransactionManagementType.CONTAINER) public EntityManager em;
Answer : @PersistenceContext private EntityManager em;
Given the following entity class:
11. @Entity public class Customer {
12. @Id private int id;
13. private transient String name;
14. private java.math.BigDecimal grossAmmount;
15. }
Which mapping annotation can be added to the fields of this entity?
Options are :
• @JoinColumns to the grossAmmount field
• @Basic to the grossAmmount field
• @Column to the name field
• @EmbeddedId to the id field
Answer : @Basic to the grossAmmount field
A developer creates a stateless session bean, EmployeeServiceBean, and its interface,
EmployeeService. The session bean uses two annotated entity classes, Employee.class and
Department.class. Which two packaging options can the developer use when creating a
deployable EAR? The proposed directory structure is listed for each option. (Choose two.)
A. emp.ear
emp-ejb.jar
META-INF/persistence.xml
EmployeeService.class
EmployeeServiceBean.class
lib/emp-classes.jar
Employee.class
Department.class
B. emp.ear
META-INF/orm.xml
emp-ejb.jar
EmployeeService.class
EmployeeServiceBean.class
Employee.class
Department.class
C. emp.ear
emp-ejb.jar
META-INF/persistence.xml
Employee.class
Department.class
EmployeeService.class
EmployeeServiceBean.class
D. emp.ear
emp-ejb.jar
persistence.xml
Employee.class
Department.class
EmployeeService.class
EmployeeServiceBean.class
Options are :
• A,C
• A,D
• B,C
• A,B
Answer : A,C
310-110 Sun Certified Mobile Application Developer for J2ME Set 11
Your application uses the Java Persistence API to access a database. This application must reject
adding an instance to the database if it does NOT pass validation tests for values of two
persistence properties. The database contains some data that will NOT pass such validation. Only
the new records must be validated. Which option will achieve this behavior?
Options are :
• Add the PrePersist callback method with all of the validation logic.
• Add PrePersist and PreUpdate callback methods with all of the validation logic.
• Add validation logic to the setter methods for each property.
• Add the PostPersist callback method with all of the validation logic.
Answer : Add the PrePersist callback method with all of the validation logic.
A developer obtains a java.security.Principal object by calling the
SessionContext.getCallerPrincipal method from within a business method of a session bean.
Which statement is true?
Options are :
• The roles which the Principal is in can be determined from this Principal object.
• The returned Principal object can be null.
• The return value of Principal.getName depends on the security realm which was used to authenticate the caller.
• The return value of the Principal.getName method is exactly the same as the username used for authentication of the caller.
Answer : The return value of Principal.getName depends on the security realm which was used to authenticate the caller.
The Java Persistence entity LineItem defines a composite primary key that is defined by the two
columns ORDERID and LINEITEMID in the database. Which two are true? (Choose two.)
A. LineItem must define a primary key class to represent the composite primary key.
B. The composite primary key is mapped as two fields in LineItem. No extra primary key class is
necessary.
C. The combination of @Embedded and @Embeddable annotations can be used to denote the
composite primary key.
D. The semantics of the equals and hashCode methods of the primary key class must be
consistent with the database equality.
Options are :
• B,D
• A,B
• A,C
• A,D
Answer : A,D
310-110 Sun Certified Mobile Application Developer for J2ME Set 12
Consider the following classes:
11. @Entity Auction {
12. @Id int id;
13. @OneToOne Item item;
14. }
11. @Entity Item {
12. @Id int id;
13. @OneToOne (mappedBy="item") Auction auction;
14. }
Given that the Auction entity maps to an AUCTION database table and the Item entity maps to an
ITEM database table, which statement is correct assuming there is NO mapping descriptor?
Options are :
• The relationship is mapped to foreign keys in both ITEM and AUCTION tables.
• The relationship is mapped to a foreign key in the ITEM table.
• The relationship is mapped using a join table AUCTION_ITEM.
• The relationship is mapped to a foreign key in the AUCTION table.
Answer : The relationship is mapped to a foreign key in the AUCTION table.
Which statement is correct about a Java EE client of a message-driven bean?
Options are :
• The client can use JNDI to obtain a reference to a dependency injection.
• The client can use JNDI to obtain a reference to a message-driven bean instance.
• The client can use JNDI to look up a reference to the message-driven bean's home interface.
• The client can use JNDI to obtain a reference to a message destination.
Answer : The client can use JNDI to obtain a reference to a message destination.
310-110 Sun Certified Mobile Application Developer for J2ME Set 2
Given:
11. @PersistenceContext EntityManager em;
12. public boolean test(Order o) {
13. boolean b = false;
14. o = em.merge(o);
15 em.remove(o);
16. o = em.merge(o);
17. b = em.contains(o);
18. return b;
19. }
Which statement is correct?
Options are :
• The method will throw an exception.
• The method will return FALSE.
• The method will return TRUE.
• The Order instance will be removed from the database.
Answer : The method will throw an exception.
A Java Persistence application uses entities mapped to tables from two datasources in the same
transaction. What statement is correct?
Options are :
• The entities must be packaged using two different persistence.xml files.
• The entities must be packaged into two persistence units.
• This is NOT possible.
• The entities can be packaged into a single persistence unit
Answer : The entities must be packaged into two persistence units.
A developer writes a stateless session bean with one local business interface and with containermanaged
transactions. All business methods have transaction attribute REQUIRED. The bean has
an injected field sessionCtx of the type SessionContext. Which two operations are allowed in a
business method of the bean? (Choose two.)
A. sessionCtx.getEJBObject
B. sessionCtx.setRollbackOnly
C. sessionCtx.getMessageContext
D. sessionCtx.getBusinessObject
E. sessionCtx.getEJBLocalObject
Options are :
• B,D
• B,C
• B,E
• B,A
Answer : B,D
310-110 Sun Certified Mobile Application Developer for J2ME Set 3
A developer has created an application-managed entity manager. Which statement is correct?
Options are :
• A new persistence context begins when the entity manager is invoked in the context of a resource-local transaction.
• A new persistence context begins when a new JTA transaction begins.
• A new persistence context begins when the entity manager is invoked in the context of a JTA transaction.
• A new persistence context begins when the entity manager is created.
Answer : A new persistence context begins when the entity manager is created.
You have been asked to develop business methods for an enterprise bean to fulfill the following
objective:
If the JDBC connection is NOT available, the current state of the shopping cart session must be
serialized.
A serialized state must be written to a text file using a java.io.PrintWriter.
Data must be shared with a Web services end point.
Logging information must be displayed in a javax.swing.JPanel component.
Which is true?
Options are :
• The requirements can be fulfilled only in message-driven beans.
• All of the requirements can be fulfilled using either session beans or message-driven beans.
• None of the requirements can be fulfilled using either session beans or message-driven beans.
• Both session beans and message-driven beans can fulfill some but not all of the requirements.
• The requirements can be fullfilled only in session beans.
Answer : Both session beans and message-driven beans can fulfill some but not all of the requirements.
A User entity is in a one-to-many relationship with a Book entity.
A developer writes a query to delete users that have a first name of 'Fred' or 'Ginger', and writes
the following Java Persistence query language statement:
DELETE FROM User u WHERE u.name IN ('Fred', 'Ginger')
If the query fails with a PersistenceException, what can be the cause?
Options are :
• The query causes a foreign key integrity constraint to be violated.
• The entities corresponding to the users with the name 'Fred' or 'Ginger' are already being managed by the persistence context.
• The database does NOT have any users with the name 'Fred' or 'Ginger'.
• None
• The syntax of the query is NOT correct.
Answer : The query causes a foreign key integrity constraint to be violated.
310-110 Sun Certified Mobile Application Developer for J2ME Set 4
A developer creates a stateless session bean. This session bean needs data from a remote
system. Reading this data takes a long time. Assume that the data will NOT change during the
lifetime of the bean and that the information to connect to the remote system is defined in JNDI.
Which statement describes how to manage the data correctly?
Options are :
• The data can only be read in the bean's business methods.
• Read the data in a method which is annotated with @PostActivate.
• Read the data in a method which is annotated with @PrePassivate.
• Read the data in the bean's constructor.
• Read the data in a method which is annotated with @PostConstruct.
Answer : Read the data in a method which is annotated with @PostConstruct.
FooBean is an EJB 3.0 session bean that can make valid use of UserTransaction. Which is
guaranteed to work in an EJB container for FooBean to obtain the UserTransaction object?
Options are :
• Perform JNDI lookup with the name "jdbc/UserTransaction" on an InitialContext.
• Invoke a method on a SessionContext that returns a UserTransaction object.
• Use the @TransactionManagement annotation to inject an instance variable of type UserTransaction in a bean class.
• Perform JNDI lookup with name "java:/UserTransaction" on an InitialContext.
Answer : Invoke a method on a SessionContext that returns a UserTransaction object.
A developer writes client code that runs in a Java EE container and accesses an EJB 3.0 stateful
session bean. Which three statements are correct? (Choose three.)
A. The client can obtain a reference to the bean's business interface through JNDI lookups.
B. The client can obtain a reference to the bean's business interface through dependency
injection.
C. If the client calls a business method after the bean instance has been removed an exception
will occur.
D. After obtaining a reference to the bean's business interface, the client must call the create
method before it may call business methods.
E. After the bean instance has been passivated, the client needs to re-obtain a reference to the
bean's business interface to activate the bean instance.
Options are :
• A,D,C
• A,B,C
• E,B,C
• A,B,E
Answer : A,B,C
310-110 Sun Certified Mobile Application Developer for J2ME Set 5
A developer is designing a Java Persistence application that is mapped to a set of existing tables.
This set includes table EMPLOYEE, DEPARTMENT, and PROJECT. Tables EMPLOYEE and
DEPARTMENT do NOT define any foreign key constraints to table PROJECT. Table PROJECT
defines foreign key constraints with references to tables EMPLOYEE and DEPARTMENT and an
extra column called COST. The table EMPLOYEE is mapped to an entity Employee and the table
DEPARTMENT to an entity Department.
How can the table PROJECT be mapped so the persistence application can be portable?
Options are :
• Map the table PROJECT to bidirectional many-to-many relationships between the Employee and Department using a java.util.Map as the type of the field or property.
• Such sets of tables cannot be mapped and keep the application portable.
• Map the table PROJECT as a secondary table for either the Employee or Department entity.
• Map the table PROJECT to an entity Project with a field or property cost mapped to the column COST and one-to-many relationships to this entity in the Employee and the Department.
Answer : Map the table PROJECT to an entity Project with a field or property cost mapped to the column COST and one-to-many relationships to this entity in the Employee and the Department.
A Java Persistence application wants to use optimistic locking. Which statement that describes the
functionality of optimistic locking is correct?
Options are :
• Optimistic locking can be used by Java Persistence applications to set optimistic locks on tables in the database.
• Optimistic locking ensures that updates or deletes are consistent with the current state of the database and that intervening updates are not lost.
• The Version attribute of an entity using optimistic locking can be mapped to a secondary table.
• The Version attribute of an entity using optimistic locking is verified each time the instance is loaded from the database.
Answer : Optimistic locking ensures that updates or deletes are consistent with the current state of the database and that intervening updates are not lost.
A developer writes a stateful session bean FooBarBean with two local business interfaces Foo
and Bar. The developer wants to write a business method called getBar for interface Foo that
returns a Bar reference to the same session bean identity on which the client invokes getBar.
Which code, when inserted on Line 12 below, implements the getBar method with the wanted
behavior?
10. @Resource SessionContext sessionCtx;
11. public Bar getBar() {
12.
13. }
Options are :
• return (Bar) sessionCtx.getBusinessObject(Bar.class);
• return (Bar) new FooBarBean();
• InitialContext ic = new InitialContext(); return (Bar) ic.lookup("java:comp/env/ejb/FooBarBean");
• return (Bar) this;
• return (Bar) sessionCtx.lookup("FooBarBean")
Answer : return (Bar) sessionCtx.getBusinessObject(Bar.class);
310-110 Sun Certified Mobile Application Developer for J2ME Set 6
The Java Persistence API defines the Query interface. Which two statements about the
Query.executeUpdate method are true? (Choose two.)
A. It must always be executed within a transaction.
B. It throws a PersistenceException if no entities were updated.
C. It throws an IllegalStateException if called on a Query instance created with a Java Persistence
SELECT query.
D. All managed entity objects corresponding to database rows affected by the update will have
their state changed to correspond with the update.
Options are :
• A,C
• D,C
• A,B
• A,D
Answer : A,C
A developer wants to implement a relationship between Company and Department entity classes.
Every department belongs to one company, and one company has several departments. In this
application it is essential to quickly determine which company a department belongs to and to also
easily access all departments of a given company. Which two declarations provide a solution to
these requirements? (Choose two.)
A. In class Department:
@ManyToOne
private Company company;
B. In class Department:
@OneToMany
private Company company;
C. In class Department:
@OneToMany(mappedBy="department")
private Collection<Company> companies;
D. In class Company:
@ManyToOne(mappedBy="company")
private Collection<Department> departments;
E. In class Company:
@OneToMany(mappedBy="company")
private Collection<Department> departments;
Options are :
• A,E
• C,E
• A,D
• A,B
Answer : A,E
Within a Java EE environment, which annotation can be used to inject an entity manager factory?
Options are :
• @JTAFactory
• @Factory
• @Entity
• @PersistenceUnit
• @PersistenceContext
Answer : @PersistenceUnit
310-110 Sun Certified Mobile Application Developer for J2ME Set 7
A developer wants to create a Java Persistence query that restricts the results of an age-based
query. Specifically, the developer wants to select everyone who is NOT a teenager. (A teenager is
someone who is 13, 14, 15, 16, 17, 18, or 19 years old.) Which expression in the query's WHERE
clause is correct?
Options are :
• WHERE p.age NOT BETWEEN 13 and 19
• WHERE p.age NOT BETWEEN 12 and 19
• WHERE p.age NOT BETWEEN 13 and 20
• WHERE p.age NOT BETWEEN 12 and 20
Answer : WHERE p.age NOT BETWEEN 13 and 19
Which two are true about EJB 3.0 exception classes? (Choose two.)
A. The javax.ejb.NoSuchEJBException is an application exception.
B. The javax.ejb.EJBException extends java.lang.RuntimeException.
C. The javax.ejb.EJBTransactionRequiredException is an application exception.
D. An application exception must NOT be a subclass of java.rmi.RemoteException.
E. The javax.ejb.EJBTransactionRolledbackException is an application exception.
F. Any subclass of java.lang.RuntimeException is always considered a system exception.
Options are :
• E,D
• B,F
• B,D
• B,C
Answer : B,D
A deployer is given the following session bean:
10. @Stateless
11. @RolesAllowed("BATH")
12. @DeclareRoles("SOAP")
13. public class ShowerBean implements Shower {
14. public void plug() {}
15. }
and the following associated excerpt from the ejb-jar.xml descriptor file:
20. <assembly-descriptor>
21. <security-role>
22. <role-name>TOWEL</role-name>
23. </security-role>
24. </assembly-descriptor>
Which roles is the deployer expected to map to users or user groups?
Options are :
• BATH and TOWEL
• TOWEL
• BATH and SOAP
• BATH and SOAP and TOWEL
Answer : BATH and SOAP and TOWEL
310-110 Sun Certified Mobile Application Developer for J2ME Set 8
The execution of the find method in the following code throws an exception:
11. em.find(Customer.class, custId);
12. //Where em is a reference to a extended scoped entity manager.
Which scenario can cause the exception?
Options are :
• The data type of custId is NOT a valid type for the Customer entity primary key.
• The entity corresponding to the requested primary key has been removed.
• The find method was called without a transaction.
• The entity corresponding to the requested primary key has been detached.
Answer : The data type of custId is NOT a valid type for the Customer entity primary key.
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions | __label__pos | 0.889336 |
0
hey everyone
i have sugested to create a new club in my school called programmers , so they told me that i have to bring a list of the club aims and they xheck if the aims are good or bad then they accept the club or no , so please sugest to me some stuff that can be aims for our club ( programmers club )
thank you
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by budalverson
0
This is your work - do it yourself. You want to start it - why? What for? Who benefits? What are those benefits? How does the school benefit? What additional skills will the members develop? Do these skills tie in with general curriculum?
Will the club require extra funding? If so, how much?
There are a million questions one could ask, but only YOU can provide the answers, as it is YOUR responsibility to do so.
0
This is a great idea, I'm glad you want to step out and do something important like this! :)
So, maybe you could use ideas about the education benefits of a Programmers Club. For example, "This will help students learn to think logically", or "This will help students to learn to solve complicated problems in an orderly fashion".
Also, maybe you could point out the benefits for the student's future employment potential. For example, "This will help teach students skills for a job in the Internet industries", or "This will help students learn good business problem-solving skills".
Study hard yourself to learn how programming and computers work, and you'll become a good leader that others can look up too! :)
Let us know how it goes!
-Bud
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules. | __label__pos | 0.916748 |
Managing connections
The API exposes DSS connections, which can be created, modified and deleted through the API. These operations are restricted to API keys with the “admin rights” flag.
A list of the connections can by obtained with the list_connections method:
client = DSSClient(host, apiKey)
dss_connections = client.list_connections()
prettyprinter.pprint(dss_connections)
outputs
{ 'filesystem_managed': { 'allowManagedDatasets': True,
'allowMirror': False,
'allowWrite': True,
'allowedGroups': [],
'maxActivities': 0,
'name': 'filesystem_managed',
'params': { 'root': '${dip.home}/managed_datasets'},
'type': 'Filesystem',
'usableBy': 'ALL',
'useGlobalProxy': True},
'hdfs_root': { 'allowManagedDatasets': True,
'allowMirror': False,
'allowWrite': True,
'allowedGroups': [],
'maxActivities': 0,
'name': 'hdfs_root',
'params': {'database': 'dataik', 'root': '/'},
'type': 'HDFS',
'usableBy': 'ALL',
'useGlobalProxy': False},
'local_postgress': { 'allowManagedDatasets': True,
'allowMirror': False,
'allowWrite': True,
'allowedGroups': [],
'maxActivities': 0,
'name': 'local_postgress',
'params': { 'db': 'testdb',
'host': 'localhost',
'password': 'admin',
'port': '5432',
'properties': { },
'user': 'admin'},
'type': 'PostgreSQL',
'usableBy': 'ALL',
'useGlobalProxy': False},
...
}
Connections can be added:
new_connection_params = {'db':'mysql_test', 'host': 'localhost', 'password': 'admin', 'properties': { }, 'user': 'admin'}
new_connection = client.create_connection('test_connection', type='MySql', params=new_connection_params, usable_by='ALLOWED', allowed_groups=['data_scientists'])
prettyprinter.pprint(client.list_connections()['test_connection'])
outputs
{ 'allowManagedDatasets': True,
'allowMirror': True,
'allowWrite': True,
'allowedGroups': ['data_scientists'],
'maxActivities': 0,
'name': 'test_connection',
'params': { 'db': 'mysql_test',
'host': 'localhost',
'password': 'admin',
'properties': { },
'user': 'admin'},
'type': 'MySql',
'usableBy': 'ALLOWED',
'useGlobalProxy': True}
To modify a connection, it is advised to first retrieve the connection definition with a get_definition call, alter the definition, and set it back into DSS:
connection_definition = new_connection.get_definition()
connection_definition['usableBy'] = 'ALL'
connection_definition['allowWrite'] = False
new_connection.set_definition(connection_definition)
prettyprinter.pprint(new_connection.get_definition())
outputs
{ 'allowManagedDatasets': True,
'allowMirror': True,
'allowWrite': False,
'allowedGroups': ['data_scientists'],
'maxActivities': 0,
'name': 'test_connection',
'params': { 'db': 'mysql_test',
'host': 'localhost',
'password': 'admin',
'properties': { },
'user': 'admin'},
'type': 'MySql',
'usableBy': 'ALL',
'useGlobalProxy': True}
Connections can be deleted through their handle:
connection = client.get_connection('test_connection')
connection.delete()
Reference documentation
class dataikuapi.dss.admin.DSSConnection(client, name)
A connection on the DSS instance
get_location_info()
Gets information about this connection.
Note: this call requires either an admin API key or a personal API key that corresponds to a user who belongs to a group who has the rights to read connection details
Returns:a dict containing connection information
delete()
Delete the connection
Note: this call requires an API key with admin rights
get_definition()
Get the connection’s definition (type, name, params, usage restrictions) Note: this call requires an API key with admin rights
Returns:The connection definition, as a dict.
The exact structure of the returned dict is not documented and depends on the connection type. Create connections using the DSS UI and call get_definition() to see the fields that are in it.
set_definition(description)
Set the connection’s definition. Note: this call requires an API key with admin rights
You should only set_definition() using an object that you obtained through get_definition(), not create a new dict.
:param dict the definition for the connection, as a dict.
sync_root_acls()
Resync root permissions on this connection path. This is only useful for HDFS connections when DSS is in multi-user-security mode. Note: this call requires an API key with admin rights
Returns:a DSSFuture handle to the task of resynchronizing the permissions
sync_datasets_acls()
Resync permissions on datasets in this connection path. This is only useful for HDFS connections when DSS is in multi-user-security mode. Note: this call requires an API key with admin rights
Returns:a DSSFuture handle to the task of resynchronizing the permissions | __label__pos | 0.559048 |
Qadir Hussain Qadir Hussain - 1 year ago 1039
Swift Question
Converting Hex String to NSData in Swift
I got the code to convert String to HEX-String in objective-C.
- (NSString *) CreateDataWithHexString:(NSString*)inputString
{
NSUInteger inLength = [inputString length];
unichar *inCharacters = alloca(sizeof(unichar) * inLength);
[inputString getCharacters:inCharacters range:NSMakeRange(0, inLength)];
UInt8 *outBytes = malloc(sizeof(UInt8) * ((inLength / 2) + 1));
NSInteger i, o = 0;
UInt8 outByte = 0;
for (i = 0; i < inLength; i++) {
UInt8 c = inCharacters[i];
SInt8 value = -1;
if (c >= '0' && c <= '9') value = (c - '0');
else if (c >= 'A' && c <= 'F') value = 10 + (c - 'A');
else if (c >= 'a' && c <= 'f') value = 10 + (c - 'a');
if (value >= 0) {
if (i % 2 == 1) {
outBytes[o++] = (outByte << 4) | value;
outByte = 0;
} else {
outByte = value;
}
} else {
if (o != 0) break;
}
}
NSData *a = [[NSData alloc] initWithBytesNoCopy:outBytes length:o freeWhenDone:YES];
NSString* newStr = [NSString stringWithUTF8String:[a bytes]];
return newStr;
}
I want the same in Swift. can any body translate this code in swift.
or is there any easy way to do this in swift.
Please help
Rob Rob
Answer Source
This is my hex string to NSData routine:
extension String {
/// Create NSData from hexadecimal string representation
///
/// This takes a hexadecimal representation and creates a NSData object. Note, if the string has any spaces or non-hex characters (e.g. starts with '<' and with a '>'), those are ignored and only hex characters are processed.
///
/// The use of `strtoul` inspired by Martin R at http://stackoverflow.com/a/26284562/1271826
///
/// - returns: NSData represented by this hexadecimal string.
func dataFromHexadecimalString() -> NSData? {
let data = NSMutableData(capacity: characters.count / 2)
let regex = try! NSRegularExpression(pattern: "[0-9a-f]{1,2}", options: .CaseInsensitive)
regex.enumerateMatchesInString(self, options: [], range: NSMakeRange(0, characters.count)) { match, flags, stop in
let byteString = (self as NSString).substringWithRange(match!.range)
let num = UInt8(byteString.withCString { strtoul($0, nil, 16) })
data?.appendBytes([num], length: 1)
}
return data
}
}
Note, the above is written for Swift 2.0. See the revision history of this answer if you want to see Swift 1.2 or 1.1 renditions.
And for the sake of completeness, this is my NSData to hex string routine:
extension NSData {
/// Create hexadecimal string representation of NSData object.
///
/// - returns: String representation of this NSData object.
func hexadecimalString() -> String {
var string = ""
var byte: UInt8 = 0
for i in 0 ..< length {
getBytes(&byte, range: NSMakeRange(i, 1))
string += String(format: "%02x", byte)
}
return string
}
}
Note, as shown in the above, I generally only convert between hexadecimal representations and NSData instances (because if the information could have been represented as a string you probably wouldn't have created a hexadecimal representation in the first place). But your original question wanted to convert between hexadecimal representations and String objects, and that might look like so:
extension String {
/// Create NSData from hexadecimal string representation
///
/// This takes a hexadecimal representation and creates a String object from taht. Note, if the string has any spaces, those are removed. Also if the string started with a '<' or ended with a '>', those are removed, too.
///
/// - parameter encoding: The NSStringCoding that indicates how the binary data represented by the hex string should be converted to a String.
///
/// - returns: String represented by this hexadecimal string. Returns nil if string contains characters outside the 0-9 and a-f range or if a string cannot be created using the provided encoding
func stringFromHexadecimalStringUsingEncoding(encoding: NSStringEncoding) -> String? {
if let data = dataFromHexadecimalString() {
return String(data: data, encoding: encoding)
}
return nil
}
/// Create hexadecimal string representation of String object.
///
/// - parameter encoding: The NSStringCoding that indicates how the string should be converted to NSData before performing the hexadecimal conversion.
///
/// - returns: String representation of this String object.
func hexadecimalStringUsingEncoding(encoding: NSStringEncoding) -> String? {
let data = dataUsingEncoding(NSUTF8StringEncoding)
return data?.hexadecimalString()
}
}
You could then use the above like so:
let hexString = "68656c6c 6f2c2077 6f726c64"
print(hexString.stringFromHexadecimalStringUsingEncoding(NSUTF8StringEncoding))
Or,
let originalString = "hello, world"
print(originalString.hexadecimalStringUsingEncoding(NSUTF8StringEncoding)) | __label__pos | 0.995945 |
Resources Contact Us Home
Browse by: INVENTOR PATENT HOLDER PATENT NUMBER DATE
Matrix character generation system
6225989 Matrix character generation system
Patent Drawings:Drawing: 6225989-2 Drawing: 6225989-3
« 1 »
(2 images)
Inventor: Wu, et al.
Date Issued: May 1, 2001
Application: 09/163,323
Filed: September 30, 1998
Inventors: Huang; Yi-Hui (Hsien, TW)
Wu; Fu-Sheng (Taoyuan, TW)
Assignee: Arphic Technology Co., Ltd. (Taipei, TW)
Primary Examiner: Tung; Kee M.
Assistant Examiner:
Attorney Or Agent: Hsu; Winston
U.S. Class: 345/467; 345/469; 345/551
Field Of Search: 345/467; 345/471; 345/141; 345/142; 345/192; 345/194; 345/195
International Class: G09G 5/24
U.S Patent Documents: 4990903; 5852448; 5923321
Foreign Patent Documents:
Other References:
Abstract: The present invention provides a matrix character generation system comprising a memory for storing data and programs, a processor for executing the programs stored in the memory, and a screen for displaying matrix graphs generated by the matrix character generation system. The memory comprises a character table for recording all the strokes that form each character, a stroke table for recording the parameters of each stroke, and a graph generation program for displaying the matrix graph of each character on the screen according to the character table and the stroke table. When generating a new character, the graph generation program searches the character table for the stroke IDs of all the strokes of the character and the position of each stroke in the matrix according to the WID of the character. Then it searches the stroke table for the matrix graphic data of each stroke according to the stroke ID of each stroke. Finally, it draws the matrix graph of each stroke in the matrix according to the position and matrix graphic data of each stroke to form the matrix graph of the character.
Claim: What is claimed is:
1. A matrix character generation system for generating a dot matrix graph of a character in a dot, matrix format according to a word ID of the character, the matrix charactergeneration system comprising:
a memory for storing data and programs;
a processor for executing the programs stored in the memory;
a stroke table stored in the memory comprising a stroke ID and dot matrix data pre-stored in the memory for each of a plurality of strokes, the dot matrix data of each stroke being used to display the matrix graph of the stroke in a dot matrix,wherein the dot matrix data of each stroke comprises the data of dots constituting the dot matrix graph of the stroke;
a character table stored in the memory comprising a word ID for each of a plurality of characters, a stroke ID for each stroke of each of the characters, and the position of each stroke of each character within the dot matrix; and
a graph generation program stored in the memory for displaying the dot matrix graph of one character in the dot matrix according to the word ID of the character, the character table and the stroke table;
wherein the graph generation program searches the character table for the stroke IDs of all the strokes of the character and the position of each stroke in the dot matrix according to the word ID of the character, searches the stroke table forthe dot matrix data of each stroke according to the stroke ID of each stroke of the character, and displays the dot matrix graph of the character in the dot matrix format according to the position and the dot matrix data of each stroke.
2. The matrix character generating system of claim 1 wherein the dot matrix data of each stroke comprises the data of all the horizontal lines constituting the dot matrix graph of the stroke, and the graph generation program draws the stroke inthe dot matrix format to form the dot matrix graph of the stroke according to the position of the stroke and the data of all the horizontal lines in the dot matrix data of the stroke.
3. The matrix character generating system of claim 2 wherein the dot matrix data of each stroke comprises parameters corresponding to the start and ending dots of each horizontal line constituting the matrix graph of the stroke.
4. The matrix character generating system of claim 1 wherein the dot matrix data of each stroke comprises the data of all the vertical lines constituting the dot matrix graph of the stroke, and the graph generation program draws the stroke inthe dot matrix format to form the dot matrix graph of the stroke according to the position of the stroke and the data of all the vertical lines in the dot matrix data of the stroke.
5. The matrix character generating system of claim 4 wherein the dot matrix data of each stroke comprises parameters corresponding to the start And ending dots of each vertical line constituting the dot matrix graph of the stroke.
Description: BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to a matrix character generation system, and more particularly, to a matrix character generation system for generating a character by using a character table and a stroke table.
2. Description of the Prior Art
Printed Chinese characters can be generally divided into two categories: contour characters and matrix characters. A contour character is usually formed by using a stroke-combination character technique which treats each character as astructural graph combined by strokes, each stroke being a sub-graph of the character and consisting of a contour. Alternatively, a matrix character is treated as a matrix graph formed by points drawn in a matrix.
Please refer to FIG. 1. FIG. 1 shows the matrix graph 10 of a 16.times.16 scale matrix character. The matrix graph 10 comprises 256 small squares. Each square is black or white and corresponds to one bit of data. The digital number of "0 " isrepresented by a white square and "1" is represented by a black square. The data of the matrix graph is stored in sequence from the upper left to the lower right of the matrix. All the black and white squares in the matrix graph 10 constitute a Chinesecharacter, e.g. {character pullout}, and are sequentially stored in this way:"00 00 00 00 06 00 00 0C 00 18 00 39 F0 68 00 08 00 0B FC 08 00 08 00 08 00 00 00 00 00 00 00". The total data amount of this 16.times.16 scale matrix graph is 32 bits. Thebigger the matrix, the larger the data amount. A 24.times.24 scale character corresponds to 72 bits of data, a 32.times.32 scale character corresponds to 128 bits, and a 48.times.48 scale character corresponds to 288 bits. A Chinese font comprisesabout thirteen thousand characters and as such a 48.times.48 scale Chinese font corresponds to about 3.744 MB of data which can be reduced to about 1.5 MB when a good compression technique is applied. However, 1.5 MB of data is still too large for asmall sized electrical commercial product, such as a beeper, a cellular phone, etc. Moreover, if the small sized electrical commercial product is equipped with more than one matrix font with different sizes, the required memory becomes prohibitivelylarge leading to increased costs.
SUMMARY OF THE INVENTION
It is therefore a primary objective of the present invention to provide a matrix character generation system for generating a character by using a stroke table and a character table to reduce the data amount to solve the above mentioned problem.
In a preferred embodiment, the present invention provides a matrix character generation system for generating a matrix graph of a matrix character in a matrix according to the word ID of the character, the matrix character generation systemcomprising:
a memory for storing data and programs;
a processor for executing the programs stored in the memory;
a stroke table stored in the memory comprising a stroke ID and matrix graphic data for each of a plurality of strokes, the matrix graphic data of each stroke being used to draw the matrix graph of the stroke in the matrix;
a character table stored in the memory comprising a word ID for each of a plurality of characters, a stroke ID for each stroke of each of the characters, and position of each stroke of each character within the matrix; and
a graph generation program stored in the memory for displaying the matrix graph of the word in the matrix according to the WID of the character, the character table, and the stroke table.
When generating a new character, the graph generation program searches the character table for the stroke IDs of all the strokes of the character and the position of each stroke in the matrix according to the word ID of the character. It thensearches the stroke table for the matrix graphic data of each stroke according to the stroke IDs of each stroke of the character. Finally, it draws the matrix graph of each stroke in the matrix according to the position and matrix graphic data of eachstroke thereby forming the matrix graph of the character.
It is an advantage of the present invention that the matrix character generation system only stores a small amount of data including the WID of each character, the position of each stroke, and the data constituting each stroke thus saving a lotof memory space.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment which is illustrated in thevarious figures and drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a matrix graph of a 16.times.16 scale matrix character.
FIG. 2 is a functional block diagram of a matrix character generation system according to the present invention.
FIG. 3 is a schematic diagram of the data structure of the character table shown in FIG. 2.
FIG. 4 is a schematic diagram of the data structure of the stroke table shown in FIG. 2.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
Please refer to FIG. 2. FIG. 2 is a functional block diagram of a matrix character generation system 11 according to the present invention. The matrix character generation system 11 comprises a memory 12 for storing data and programs, aprocessor 14 for executing the programs stored in the memory 12, and a screen 16 for displaying matrix graphs generated by the matrix character generation system 11. The memory 12 comprises a character table 18 for recording all the strokes forming eachcharacter, a stroke table 20 for recording the parameters of each stroke, and a graph generation program 22 for displaying the matrix graph of each character on the screen 16 based on information from the character table 18 and the stroke table 20.
Please refer to FIG. 3 and FIG. 4. FIG. 3 is aschematic diagram of the data structure of the character table 18 shown in FIG. 2. FIG. 4 is a schematic diagram of the data structure of the stroke table 20 shown in Fig.2. The character table 18comprises the WID 30 of each character, the SIDs 32 of all the strokes constituting the character, and the parameters 34 indicating the position of each stroke in the matrix. The stroke table 20 comprises the SID 32 of each stroke, the number 42 of thehorizontal lines forming the matrix graph of the strokes, and the parameter 44 corresponding to the start and ending points of each horizontal line. Each of the horizontal lines constituting each stroke is composed of a series of squares along ahorizontal direction in the matrix. For example, the stroke positioned on the upper right side of the Chinese character {character pullout} consists of five horizontal lines. Since these lines are straight, it is easy to draw them by using theparameters of their start and ending points. Once all the horizontal lines are drawn, the corresponding stroke is finished. Besides recording the parameters of all the horizontal lines of each stroke, the strokes can be constructed by recordinghorizontal lines at fixed or varying intervals, lines of another direction, or points rather than lines.
When generating a specific character, the graph generation program 22 searches the character table 18 for the SIDs of all the strokes of the character and the position parameters 34 of each stroke in the matrix according to the WID of thecharacter. Then it searches the stroke table 20 for the number 42 of horizontal lines constituting each stroke and the parameters 44 of the start and ending points of each horizontal line according to the SID 32 of each stroke. Finally, it displays thematrix graph of the character on the screen 16 according to the position parameters 34 of each stroke, the number 42 of each horizontal line, and the parameters 44 of the start and ending points of each horizontal line.
In contrast to the prior art matrix character generation system which generates a character by recording the data of all the small squares in a matrix, the matrix character generation system 11 of the present invention only records the SIDs ofeach character, the position parameter 34 of each stroke, and the data of the lines constituting each stroke. Using the matrix character generation system 10, a font of about thirteen thousand characters requires only about 0.5 MB which is one third ofthat needed using the prior art.
Those skilled in the art will readily observe that numerous modifications and alterations of the device may be made while retaining the teachings of the invention. Accordingly, the above mentioned disclosure should be construed as limited onlyby metes and bounds of the appended claims.
* * * * *
Recently Added Patents
Systems and methods for detailed error reporting in data storage systems
Semiconductor device and fabrication method
Method and apparatus for providing contention-based resource zones in a wireless network
Combination photovoltaic and wind power generation installation
Systems and methods for automated institutional processing of payments
Dye-sensitized solar cell, dye-sensitized solar cell module, and coating liquid for forming electrolyte layer
Pressing mold for optical lenses and method for manufacturing glass optical lenses
Randomly Featured Patents
Top sheet feeding apparatus
Fixing instrument for use in spinal surgery
Probe with replaceable centering feet
Orchestrating indexing
Prediction of aspirated volume of a liquid
Front insert receptacle
Expanded memory space in environments including virtual machines
Rational-harmonic apparatus and technique
Heat exchanger structure of automatic transmission
Gamma-glutamyl transpeptidase attenuated Francisella
| __label__pos | 0.917703 |
July20 , 2024
The Benefits and Challenges of Implementing MPLS Technology in Modern Networks
Related
How to Save Money on Life’s Expenses
Navigating the fiscal demands of daily life requires wisdom...
Enhancing Business Communication: The Role of Advanced Voice Call Solutions
Post Preview Table of Contents Introduction to Advanced Voice Call...
Why Having a Lawyer Matters in Abuse Cases
Navigating the aftermath of abuse can be an incredibly...
OneGoSEO – Your Trusted SEO Agency in Bangkok
Introduction In today's digital age, having a robust online presence...
Maximize Your Savings: How to Find and Use Promo Codes for Photo Printing
Post Preview Key Takeaways: Unlock savings strategies for locating valuable...
Share
Post Preview
Table of Contents
1. What is MPLS?
2. Key Benefits of MPLS
3. Common Challenges with MPLS Implementation
4. Comparing MPLS with Other Network Technologies
5. Real-World Applications of MPLS
6. Best Practices for Implementing MPLS
7. Future Trends in MPLS Technology
8. Conclusion
What is MPLS?
In today’s fast-paced digital landscape, efficient data transmission is crucial for businesses of all sizes. MPLS assigns labels to data packets, directing them through the network using a path predetermined by these labels rather than traditional IP addresses. This method allows for a more streamlined and efficient routing process, drastically improving network performance.
MPLS allows for seamless integration across multiple network types, providing a versatile solution for modern enterprises. Using labels instead of lengthy IP headers, MPLS reduces the time routers spend processing data packets. This enhances the speed and reliability of data transmission, which is especially beneficial in environments where high performance and low latency are critical.
Key Benefits of MPLS
multiprotocol label switching (MPLS) is a technique used to enhance data flow across a network. MPLS technology offers several benefits that make it an attractive option for businesses:
• Improved Speed and Efficiency: MPLS allows data to flow more quickly and efficiently across the network by reducing the need for complex routing decisions. This leads to faster response times and improved user experiences, which are crucial for applications such as VoIP and real-time video conferencing.
• Enhanced Quality of Service (quality of service): MPLS supports traffic prioritization, ensuring critical applications receive the bandwidth required to perform optimally. This is particularly important for businesses that rely on real-time data for operations, such as financial trading platforms or telemedicine services.
• Scalability: Businesses can quickly scale their networks as they grow, thanks to the adaptable nature of MPLS technology. This scalability ensures that a company’s network infrastructure can evolve alongside its needs without significant overhauls.
• Network Redundancy: MPLS provides multiple pathways for data transmission, enhancing network reliability and reducing downtime. This redundancy is vital for maintaining operations during network failures or other disruptions.
Common Challenges with MPLS Implementation
Though MPLS presents many advantages, it is not without its challenges:
• Cost: Deploying MPLS can be expensive in terms of initial setup and ongoing maintenance. This can be a significant barrier, particularly for smaller organizations needing more money for large-scale network upgrades.
• Complexity: MPLS networks require specialized knowledge to set up and manage, which can be challenging for organizations needing more experienced IT staff. The intricate nature of MPLS systems can demand extensive training and support.
• Vendor Dependence: Many businesses may rely heavily on their MPLS service providers, which can limit flexibility and control. This dependence can also make it difficult to switch providers or make independent network adjustments without incurring significant hassles.
Comparing MPLS with Other Network Technologies
While MPLS provides unique benefits, it’s essential to compare it with other network technologies:
• SD-WAN: SD-WAN offers flexibility and can be a less costly alternative to MPLS. However, MPLS might be the better choice for applications requiring high performance and quality of service. According to an analysis by Network World, SD-WAN solutions are growing in popularity due to their ability to optimize wide-area network (WAN) connections by routing traffic through the most efficient path.
• Traditional IP Routing: Though more straightforward and cost-effective, traditional IP routing lacks the advanced traffic management and quality of service features MPLS offers. Traditional routing is generally easier to implement but may provide different performance levels for critical applications than MPLS can.
Real-World Applications of MPLS
MPLS has found its place in various real-world scenarios:
• Enterprise Networks: Large companies often use MPLS to manage complex data efficiently flows between their offices and data centers. This is particularly useful for multinational corporations requiring a dependable internal network to support global operations.
• Service Providers: Service providers utilize MPLS to deliver clients high-speed, reliable network services. TechTarget says service providers leverage MPLS to offer differentiated services, such as Virtual Private Networks (VPNs), essential for secure, cross-location data communications.
• Financial Services: The financial industry relies on MPLS to provide low-latency and secure data transmissions crucial for financial transactions. Rapid data exchange is fundamental in trading environments where milliseconds can impact financial outcomes.
Best Practices for Implementing MPLS
To maximize the benefits of MPLS, consider these best practices:
1. Conduct a thorough network assessment to determine your environment’s specific need for MPLS. This will help identify the areas where MPLS can benefit most and justify the investment.
2. Engage with experienced MPLS providers to ensure proper setup and integration. Partnering with knowledgeable vendors can ease the transition and address any technical challenges.
3. Regularly monitor and manage the MPLS network to quickly identify and resolve any issues. Ongoing management ensures the network operates at optimal performance levels.
4. Provide training for IT staff to ensure they possess the necessary skills for managing an MPLS network. A well-trained team can handle issues internally and reduce dependency on external support.
Future Trends in MPLS Technology
As technology advances, MPLS is expected to evolve in several ways:
• Integration with SD-WAN: Hybrid solutions that combine MPLS and SD-WAN are becoming increasingly popular, offering the benefits of both technologies. These hybrid networks provide the reliability of MPLS with the flexibility and cost savings of SD-WAN.
• Enhanced Security Features: Future implementations of MPLS will likely include advanced security measures to protect data transmission better. Enhanced encryption and real-time threat detection are expected to become standard features.
• Automation and AI: Automated management and artificial intelligence are expected to simplify the operation of MPLS networks, making them more efficient. These technologies can optimize traffic routing and predict network issues before they occur.
Conclusion
MPLS technology plays a crucial role in modern network management by offering significant speed, efficiency, and reliability benefits. Although there are challenges to its implementation, understanding and addressing these can help businesses fully leverage MPLS’s advantages. By staying informed about future trends, organizations can ensure their networks remain robust and adaptable to changing demands. Implementing MPLS may require an upfront investment and specialized knowledge, but the long-term benefits can profoundly impact a company’s networking capabilities and overall operational efficiency.
| __label__pos | 0.856926 |
Custom Query (124 matches)
Filters
Or
Columns
Show under each result:
Results (19 - 21 of 124)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Ticket Resolution Summary Owner Reporter
#30 fixed One reference to Appendix C should actually reference Appendix D cf-conventions@… taylor13
Description
After Example 4.3 the following sentence appears:
"In this example the standard_name value atmosphere_sigma_coordinate identifies the following definition from Appendix C, Standard Name Modifiers which specifies how to compute pressure at gridpoint (n,k,j,i) where j and i are horizontal indices, k is a vertical index, and n is a time index:"
This should refer to Appendix D, Dimensionless Vertical Coordinates, not Appendix C.
#31 fixed Proposal for standard attributes actual_min and actual_max cf-conventions@… jonblower
Description
Summary
It is very useful for data mining and visualization applications to know the minimum and maximum values of a particular variable in a NetCDF file, without needing to extract the entire variable and calculate this in the application. Here we propose a new pair of standard variables actual_min and actual_max that contain the min and max values of a variable.
Advantages
The proposed new attributes would prevent misuse of the valid_min and valid_max attributes, which are intended to be used to delimit a valid data range, but in fact are often used to denote the actual range of data in a variable. The latter (mis)use leads to incorrect assessment of missing values by tools.
Supports data mining: It is a quick operation to find, say, all those data files that contain temperature values above 30degC.
Supports visualization: Visualization tools can use the actual_min/max to generate a sensible colour scale range for displaying the contents of a file. (However see caveats below.)
In the context of aggregations (by NcML or otherwise), the actual_min/max could be easily calculated by taking the minimum/maximum of the attributes of the components of the aggregation.
Disadvantages
The new attributes represent redundant metadata and could be incorrectly generated or otherwise become inconsistent. Mitigation: Allow the CF-checker to check these attribute values if they are present in a file.
Caveats
These attribute values would not be correct for a subset of data from the file and so any data subsetting tools must be aware of this and recalculate or remove these attributes from any data product subset.
Data values outside the valid_range would not be counted in the actual_min/max. An alternative nomenclature could be actual_valid_min/max (although personally I find this more confusing).
For visualization, the actual_min/max will not always represent the optimal scale range, particularly if examining a restricted geographical area, or when looking at data from a particular elevation. A more sophisticated solution could involve expressing actual_min/max as an array quantity, with a value pair for each elevation in the data volume. This increases the complexity of the solution and places extra burdens on data providers and tool developers (and does not completly solve the problems described).
#32 fixed Ambiguity in text discussing auxiliary coordinate variables cf-conventions@… taylor13
Description
I find the antecdents to the various instances of "their" in the following text ambiguous.
"The axis attribute is not allowed for auxiliary coordinate variables. Auxiliary coordinate variables which lie on the horizontal surface can be identified as such by their dimensions being horizontal, which can in turn be inferred from their having an axis attribute of X or Y , or from their units in the case of latitude and longitude (see Chapter 4, Coordinate Types )."
I propose modifying the text slightly to read:
"The axis attribute is not allowed for auxiliary coordinate variables. Auxiliary coordinate variables which lie on the horizontal surface can be identified as such by their dimensions being horizontal. Horizontal dimensions are those whose coordinate variables have an axis attribute of X or Y, or a units attribute indicating latitude and longitude (see Chapter 4, Coordinate Types)."
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Note: See TracQuery for help on using queries. | __label__pos | 0.634383 |
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Joshua Leung, Blender Foundation * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/editors/object/object_constraint.c * \ingroup edobj */ #include #include #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" #include "DNA_constraint_types.h" #include "DNA_curve_types.h" #include "DNA_scene_types.h" #include "DNA_text_types.h" #include "DNA_object_types.h" #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" #include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" #include "BKE_tracking.h" #include "BIK_api.h" #ifdef WITH_PYTHON #include "BPY_extern.h" #endif #include "WM_api.h" #include "WM_types.h" #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" #include "ED_object.h" #include "ED_armature.h" #include "ED_screen.h" #include "UI_interface.h" #include "UI_resources.h" #include "object_intern.h" /* -------------- Get Active Constraint Data ---------------------- */ /* if object in posemode, active bone constraints, else object constraints */ ListBase *get_active_constraints(Object *ob) { if (ob == NULL) return NULL; if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; pchan = BKE_pose_channel_active(ob); if (pchan) return &pchan->constraints; } else return &ob->constraints; return NULL; } /* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */ ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **pchan_r) { if (pchan_r) *pchan_r = NULL; if (ELEM(NULL, ob, con)) return NULL; /* try object constraints first */ if ((BLI_findindex(&ob->constraints, con) != -1)) { return &ob->constraints; } /* if armature, try pose bones too */ if (ob->pose) { bPoseChannel *pchan; /* try each bone in order * NOTE: it's not possible to directly look up the active bone yet, so this will have to do */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if ((BLI_findindex(&pchan->constraints, con) != -1)) { if (pchan_r) *pchan_r = pchan; return &pchan->constraints; } } } /* done */ return NULL; } /* single constraint */ bConstraint *get_active_constraint(Object *ob) { return constraints_get_active(get_active_constraints(ob)); } /* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */ #ifdef WITH_PYTHON /* ------------- PyConstraints ------------------ */ /* this callback sets the text-file to be used for selected menu item */ static void validate_pyconstraint_cb(void *arg1, void *arg2) { bPythonConstraint *data = arg1; Text *text = NULL; int index = *((int *)arg2); int i; /* exception for no script */ if (index) { /* innovative use of a for...loop to search */ for (text = G.main->text.first, i = 1; text && index != i; i++, text = text->id.next) ; } data->text = text; } /* this returns a string for the list of usable pyconstraint script names */ static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex) { DynStr *pupds = BLI_dynstr_new(); Text *text; char *str; char buf[64]; int i; /* add title first */ sprintf(buf, "Scripts: %%t|[None]%%x0|"); BLI_dynstr_append(pupds, buf); /* init active-index first */ if (con_text == NULL) *pyconindex = 0; /* loop through markers, adding them */ for (text = G.main->text.first, i = 1; text; i++, text = text->id.next) { /* this is important to ensure that right script is shown as active */ if (text == con_text) *pyconindex = i; /* only include valid pyconstraint scripts */ if (BPY_is_pyconstraint(text)) { BLI_dynstr_append(pupds, text->id.name + 2); sprintf(buf, "%%x%d", i); BLI_dynstr_append(pupds, buf); if (text->id.next) BLI_dynstr_append(pupds, "|"); } } /* convert to normal MEM_malloc'd string */ str = BLI_dynstr_get_cstring(pupds); BLI_dynstr_free(pupds); return str; } #endif /* WITH_PYTHON */ #if 0 // UNUSED, until pyconstraints are added back. /* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */ static void update_pyconstraint_cb(void *arg1, void *arg2) { #ifndef WITH_PYTHON (void)arg1; /* unused */ (void)arg2; /* unused */ #else Object *owner = (Object *)arg1; bConstraint *con = (bConstraint *)arg2; if (owner && con) BPY_pyconstraint_update(owner, con); #endif } #endif // UNUSED /* helper function for add_constriant - sets the last target for the active constraint */ static void set_constraint_nth_target(bConstraint *con, Object *target, const char subtarget[], int index) { bConstraintTypeInfo *cti = constraint_get_typeinfo(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; int num_targets, i; if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); num_targets = BLI_countlist(&targets); if (index < 0) { if (abs(index) < num_targets) index = num_targets - abs(index); else index = num_targets - 1; } else if (index >= num_targets) { index = num_targets - 1; } for (ct = targets.first, i = 0; ct; ct = ct->next, i++) { if (i == index) { ct->tar = target; BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget)); break; } } if (cti->flush_constraint_targets) cti->flush_constraint_targets(con, &targets, 0); } } /* ------------- Constraint Sanity Testing ------------------- */ /* checks validity of object pointers, and NULLs, * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag. */ static void test_constraints(Object *owner, bPoseChannel *pchan) { bConstraint *curcon; ListBase *conlist = NULL; int type; if (owner == NULL) return; /* Check parents */ if (pchan) { switch (owner->type) { case OB_ARMATURE: type = CONSTRAINT_OBTYPE_BONE; break; default: type = CONSTRAINT_OBTYPE_OBJECT; break; } } else type = CONSTRAINT_OBTYPE_OBJECT; /* Get the constraint list for this object */ switch (type) { case CONSTRAINT_OBTYPE_OBJECT: conlist = &owner->constraints; break; case CONSTRAINT_OBTYPE_BONE: conlist = &pchan->constraints; break; } /* Check all constraints - is constraint valid? */ if (conlist) { for (curcon = conlist->first; curcon; curcon = curcon->next) { bConstraintTypeInfo *cti = constraint_get_typeinfo(curcon); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; /* clear disabled-flag first */ curcon->flag &= ~CONSTRAINT_DISABLE; if (curcon->type == CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = curcon->data; /* bad: we need a separate set of checks here as poletarget is * optional... otherwise poletarget must exist too or else * the constraint is deemed invalid */ /* default IK check ... */ if (BKE_object_exists_check(data->tar) == 0) { data->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->tar == owner) { if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->subtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } if (data->poletar) { if (BKE_object_exists_check(data->poletar) == 0) { data->poletar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->poletar == owner) { if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->polesubtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } } /* ... can be overwritten here */ BIK_test_constraint(owner, curcon); /* targets have already been checked for this */ continue; } else if (curcon->type == CONSTRAINT_TYPE_PIVOT) { bPivotConstraint *data = curcon->data; /* target doesn't have to exist, but if it is non-null, it must exist! */ if (data->tar && BKE_object_exists_check(data->tar) == 0) { data->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->tar == owner) { if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->subtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } /* targets have already been checked for this */ continue; } else if (curcon->type == CONSTRAINT_TYPE_ACTION) { bActionConstraint *data = curcon->data; /* validate action */ if (data->act == NULL) { /* must have action */ curcon->flag |= CONSTRAINT_DISABLE; } else if (data->act->idroot != ID_OB) { /* only object-rooted actions can be used */ data->act = NULL; curcon->flag |= CONSTRAINT_DISABLE; } } else if (curcon->type == CONSTRAINT_TYPE_FOLLOWPATH) { bFollowPathConstraint *data = curcon->data; /* don't allow track/up axes to be the same */ if (data->upflag == data->trackflag) curcon->flag |= CONSTRAINT_DISABLE; if (data->upflag + 3 == data->trackflag) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_TRACKTO) { bTrackToConstraint *data = curcon->data; /* don't allow track/up axes to be the same */ if (data->reserved2 == data->reserved1) curcon->flag |= CONSTRAINT_DISABLE; if (data->reserved2 + 3 == data->reserved1) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_LOCKTRACK) { bLockTrackConstraint *data = curcon->data; if (data->lockflag == data->trackflag) curcon->flag |= CONSTRAINT_DISABLE; if (data->lockflag + 3 == data->trackflag) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_SPLINEIK) { bSplineIKConstraint *data = curcon->data; /* if the number of points does not match the amount required by the chain length, * free the points array and request a rebind... */ if ((data->points == NULL) || (data->numpoints != data->chainlen + 1)) { /* free the points array */ if (data->points) { MEM_freeN(data->points); data->points = NULL; } /* clear the bound flag, forcing a rebind next time this is evaluated */ data->flag &= ~CONSTRAINT_SPLINEIK_BOUND; } } else if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) { bFollowTrackConstraint *data = curcon->data; if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0) { if (data->clip != NULL && data->track[0]) { MovieTracking *tracking = &data->clip->tracking; MovieTrackingObject *tracking_object; if (data->object[0]) tracking_object = BKE_tracking_named_object(tracking, data->object); else tracking_object = BKE_tracking_get_camera_object(tracking); if (!tracking_object) { curcon->flag |= CONSTRAINT_DISABLE; } else { if (!BKE_tracking_named_track(tracking, tracking_object, data->track)) curcon->flag |= CONSTRAINT_DISABLE; } } else curcon->flag |= CONSTRAINT_DISABLE; } } else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) { bCameraSolverConstraint *data = curcon->data; if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) { bObjectSolverConstraint *data = curcon->data; if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } /* Check targets for constraints */ if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(curcon, &targets); /* disable and clear constraints targets that are incorrect */ for (ct = targets.first; ct; ct = ct->next) { /* general validity checks (for those constraints that need this) */ if (BKE_object_exists_check(ct->tar) == 0) { /* object doesn't exist, but constraint requires target */ ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (ct->tar == owner) { if (type == CONSTRAINT_OBTYPE_BONE) { if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), ct->subtarget)) { /* bone must exist in armature... */ // TODO: clear subtarget? curcon->flag |= CONSTRAINT_DISABLE; } else if (strcmp(pchan->name, ct->subtarget) == 0) { /* cannot target self */ ct->subtarget[0] = '\0'; curcon->flag |= CONSTRAINT_DISABLE; } } else { /* cannot use self as target */ ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } } /* target checks for specific constraints */ if (ELEM3(curcon->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) { if (ct->tar) { if (ct->tar->type != OB_CURVE) { ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else { Curve *cu = ct->tar->data; /* auto-set 'Path' setting on curve so this works */ cu->flag |= CU_PATH; } } } } /* free any temporary targets */ if (cti->flush_constraint_targets) cti->flush_constraint_targets(curcon, &targets, 0); } } } } void object_test_constraints(Object *owner) { if (owner->constraints.first) test_constraints(owner, NULL); if (owner->type == OB_ARMATURE && owner->pose) { bPoseChannel *pchan; for (pchan = owner->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->constraints.first) test_constraints(owner, pchan); } } } /************************ generic functions for operators using constraint names and data context *********************/ #define EDIT_CONSTRAINT_OWNER_OBJECT 0 #define EDIT_CONSTRAINT_OWNER_BONE 1 static EnumPropertyItem constraint_owner_items[] = { {EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"}, {EDIT_CONSTRAINT_OWNER_BONE, "BONE", 0, "Bone", "Edit a constraint on the active bone"}, {0, NULL, 0, NULL, NULL}}; static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); if (!ob || ob->id.lib) return 0; if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0; return 1; } static int edit_constraint_poll(bContext *C) { return edit_constraint_poll_generic(C, &RNA_Constraint); } static void edit_constraint_properties(wmOperatorType *ot) { RNA_def_string(ot->srna, "constraint", "", MAX_NAME, "Constraint", "Name of the constraint to edit"); RNA_def_enum(ot->srna, "owner", constraint_owner_items, 0, "Owner", "The owner of this constraint"); } static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); bConstraint *con; ListBase *list; if (RNA_struct_property_is_set(op->ptr, "constraint") && RNA_struct_property_is_set(op->ptr, "owner")) return 1; if (ptr.data) { con = ptr.data; RNA_string_set(op->ptr, "constraint", con->name); list = get_constraint_lb(ob, con, NULL); if (&ob->constraints == list) RNA_enum_set(op->ptr, "owner", EDIT_CONSTRAINT_OWNER_OBJECT); else RNA_enum_set(op->ptr, "owner", EDIT_CONSTRAINT_OWNER_BONE); return 1; } return 0; } static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type) { char constraint_name[MAX_NAME]; int owner = RNA_enum_get(op->ptr, "owner"); bConstraint *con; ListBase *list = NULL; RNA_string_get(op->ptr, "constraint", constraint_name); if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) { list = &ob->constraints; } else if (owner == EDIT_CONSTRAINT_OWNER_BONE) { bPoseChannel *pchan = BKE_pose_channel_active(ob); if (pchan) list = &pchan->constraints; else { //if (G.debug & G_DEBUG) //printf("edit_constraint_property_get: No active bone for object '%s'\n", (ob)? ob->id.name+2 : ""); return NULL; } } else { //if (G.debug & G_DEBUG) //printf("edit_constraint_property_get: defaulting to getting list in the standard way\n"); list = get_active_constraints(ob); } con = constraints_findByName(list, constraint_name); //if (G.debug & G_DEBUG) //printf("constraint found = %p, %s\n", (void *)con, (con)?con->name:""); if (con && (type != 0) && (con->type != type)) con = NULL; return con; } /* ********************** CONSTRAINT-SPECIFIC STUFF ********************* */ /* ---------- Distance-Dependent Constraints ---------- */ /* StretchTo, Limit Distance */ static int stretchto_reset_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO); bStretchToConstraint *data = (con) ? (bStretchToConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) return OPERATOR_CANCELLED; /* just set original length to 0.0, which will cause a reset on next recalc */ data->orglength = 0.0f; ED_object_constraint_update(ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); return OPERATOR_FINISHED; } static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return stretchto_reset_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot) { /* identifiers */ ot->name = "Reset Original Length"; ot->idname = "CONSTRAINT_OT_stretchto_reset"; ot->description = "Reset original length of bone for Stretch To Constraint"; ot->exec = stretchto_reset_exec; ot->invoke = stretchto_reset_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } static int limitdistance_reset_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT); bDistLimitConstraint *data = (con) ? (bDistLimitConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) return OPERATOR_CANCELLED; /* just set original length to 0.0, which will cause a reset on next recalc */ data->dist = 0.0f; ED_object_constraint_update(ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); return OPERATOR_FINISHED; } static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return limitdistance_reset_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot) { /* identifiers */ ot->name = "Reset Distance"; ot->idname = "CONSTRAINT_OT_limitdistance_reset"; ot->description = "Reset limiting distance for Limit Distance Constraint"; ot->exec = limitdistance_reset_exec; ot->invoke = limitdistance_reset_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } /* ------------- Child-Of Constraint ------------------ */ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4]) { bConstraint *lastcon = NULL; bPoseChannel *pchan = NULL; /* nullify inverse matrix first */ unit_m4(invmat); /* try to find a pose channel - assume that this is the constraint owner */ // TODO: get from context instead? if (ob && ob->pose) pchan = BKE_pose_channel_active(ob); /* calculate/set inverse matrix: * We just calculate all transform-stack eval up to but not including this constraint. * This is because inverse should just inverse correct for just the constraint's influence * when it gets applied; that is, at the time of application, we don't know anything about * what follows. */ if (pchan) { float imat[4][4], tmat[4][4]; float pmat[4][4]; /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above), * to use as baseline ("pmat") to derive delta from. This extra calc saves users * from having pressing "Clear Inverse" first */ BKE_pose_where_is(scene, ob); copy_m4_m4(pmat, pchan->pose_mat); /* 2. knock out constraints starting from this one */ lastcon = pchan->constraints.last; pchan->constraints.last = con->prev; if (con->prev) { /* new end must not point to this one, else this chain cutting is useless */ con->prev->next = NULL; } else { /* constraint was first */ pchan->constraints.first = NULL; } /* 3. solve pose without disabled constraints */ BKE_pose_where_is(scene, ob); /* 4. determine effect of constraint by removing the newly calculated * pchan->pose_mat from the original pchan->pose_mat, thus determining * the effect of the constraint */ invert_m4_m4(imat, pchan->pose_mat); mult_m4_m4m4(tmat, pmat, imat); invert_m4_m4(invmat, tmat); /* 5. restore constraints */ pchan->constraints.last = lastcon; if (con->prev) { /* hook up prev to this one again */ con->prev->next = con; } else { /* set as first again */ pchan->constraints.first = con; } /* 6. recalculate pose with new inv-mat applied */ BKE_pose_where_is(scene, ob); } else if (ob) { Object workob; /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */ BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(invmat, workob.obmat); } } /* ChildOf Constraint - set inverse callback */ static int childof_set_inverse_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) { printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : ""); BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse"); return OPERATOR_CANCELLED; } child_get_inverse_matrix(scene, ob, con, data->invmat); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_set_inverse_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot) { /* identifiers */ ot->name = "Set Inverse"; ot->idname = "CONSTRAINT_OT_childof_set_inverse"; ot->description = "Set inverse correction for ChildOf constraint"; ot->exec = childof_set_inverse_exec; ot->invoke = childof_set_inverse_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } /* ChildOf Constraint - clear inverse callback */ static int childof_clear_inverse_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL; if (data == NULL) { BKE_report(op->reports, RPT_ERROR, "Childof constraint not found"); return OPERATOR_CANCELLED; } /* simply clear the matrix */ unit_m4(data->invmat); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_clear_inverse_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot) { /* identifiers */ ot->name = "Clear Inverse"; ot->idname = "CONSTRAINT_OT_childof_clear_inverse"; ot->description = "Clear inverse correction for ChildOf constraint"; ot->exec = childof_clear_inverse_exec; ot->invoke = childof_clear_inverse_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } /* ------------- Object Solver Constraint ------------------ */ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER); bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ if (data == NULL) { printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : ""); BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse"); return OPERATOR_CANCELLED; } child_get_inverse_matrix(scene, ob, con, data->invmat); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } static int objectsolver_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return objectsolver_set_inverse_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot) { /* identifiers */ ot->name = "Set Inverse"; ot->idname = "CONSTRAINT_OT_objectsolver_set_inverse"; ot->description = "Set inverse correction for ObjectSolver constraint"; ot->exec = objectsolver_set_inverse_exec; ot->invoke = objectsolver_set_inverse_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER); bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL; if (data == NULL) { BKE_report(op->reports, RPT_ERROR, "Childof constraint not found"); return OPERATOR_CANCELLED; } /* simply clear the matrix */ unit_m4(data->invmat); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } static int objectsolver_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return objectsolver_clear_inverse_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_objectsolver_clear_inverse(wmOperatorType *ot) { /* identifiers */ ot->name = "Clear Inverse"; ot->idname = "CONSTRAINT_OT_objectsolver_clear_inverse"; ot->description = "Clear inverse correction for ObjectSolver constraint"; ot->exec = objectsolver_clear_inverse_exec; ot->invoke = objectsolver_clear_inverse_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } /***************************** BUTTONS ****************************/ void ED_object_constraint_set_active(Object *ob, bConstraint *con) { ListBase *lb = get_constraint_lb(ob, con, NULL); /* lets be nice and escape if its active already */ // NOTE: this assumes that the stack doesn't have other active ones set... if ((lb && con) && (con->flag & CONSTRAINT_ACTIVE)) return; constraints_set_active(lb, con); } void ED_object_constraint_update(Object *ob) { if (ob->pose) BKE_pose_update_constraint_flags(ob->pose); object_test_constraints(ob); if (ob->type == OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB); else DAG_id_tag_update(&ob->id, OB_RECALC_OB); } void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob) { ED_object_constraint_update(ob); if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels DAG_scene_sort(bmain, scene); } static int constraint_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); return (ptr.id.data && ptr.data); } static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); Object *ob = ptr.id.data; bConstraint *con = ptr.data; ListBase *lb = get_constraint_lb(ob, con, NULL); const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); /* free the constraint */ if (remove_constraint(lb, con)) { /* there's no active constraint now, so make sure this is the case */ constraints_set_active(lb, NULL); ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */ /* ITASC needs to be rebuilt once a constraint is removed [#26920] */ if (is_ik) { BIK_clear_data(ob->pose); } /* notifiers */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob); return OPERATOR_FINISHED; } else { /* couldn't remove due to some invalid data */ return OPERATOR_CANCELLED; } } void CONSTRAINT_OT_delete(wmOperatorType *ot) { /* identifiers */ ot->name = "Delete Constraint"; ot->idname = "CONSTRAINT_OT_delete"; ot->description = "Remove constraint from constraint stack"; /* callbacks */ ot->exec = constraint_delete_exec; ot->poll = constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int constraint_move_down_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->next) { ListBase *conlist = get_constraint_lb(ob, con, NULL); bConstraint *nextCon = con->next; /* insert the nominated constraint after the one that used to be after it */ BLI_remlink(conlist, con); BLI_insertlinkafter(conlist, nextCon, con); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } return OPERATOR_CANCELLED; } static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_down_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_move_down(wmOperatorType *ot) { /* identifiers */ ot->name = "Move Constraint Down"; ot->idname = "CONSTRAINT_OT_move_down"; ot->description = "Move constraint down in constraint stack"; /* callbacks */ ot->exec = constraint_move_down_exec; ot->invoke = constraint_move_down_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } static int constraint_move_up_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->prev) { ListBase *conlist = get_constraint_lb(ob, con, NULL); bConstraint *prevCon = con->prev; /* insert the nominated constraint before the one that used to be before it */ BLI_remlink(conlist, con); BLI_insertlinkbefore(conlist, prevCon, con); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } return OPERATOR_CANCELLED; } static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_up_exec(C, op); else return OPERATOR_CANCELLED; } void CONSTRAINT_OT_move_up(wmOperatorType *ot) { /* identifiers */ ot->name = "Move Constraint Up"; ot->idname = "CONSTRAINT_OT_move_up"; ot->description = "Move constraint up in constraint stack"; /* callbacks */ ot->exec = constraint_move_up_exec; ot->invoke = constraint_move_up_invoke; ot->poll = edit_constraint_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; edit_constraint_properties(ot); } /***************************** OPERATORS ****************************/ /************************ remove constraint operators *********************/ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* free constraints for all selected bones */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) { free_constraints(&pchan->constraints); pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST); } CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ DAG_scene_sort(bmain, scene); /* sort order of objects */ /* note, calling BIK_clear_data() isn't needed here */ /* do updates */ DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; } void POSE_OT_constraints_clear(wmOperatorType *ot) { /* identifiers */ ot->name = "Clear Pose Constraints"; ot->idname = "POSE_OT_constraints_clear"; ot->description = "Clear all the constraints for the selected bones"; /* callbacks */ ot->exec = pose_constraints_clear_exec; ot->poll = ED_operator_posemode; // XXX - do we want to ensure there are selected bones too? } static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); /* do freeing */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { free_constraints(&ob->constraints); DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); return OPERATOR_FINISHED; } void OBJECT_OT_constraints_clear(wmOperatorType *ot) { /* identifiers */ ot->name = "Clear Object Constraints"; ot->idname = "OBJECT_OT_constraints_clear"; ot->description = "Clear all the constraints for the active Object only"; /* callbacks */ ot->exec = object_constraints_clear_exec; ot->poll = ED_operator_object_active_editable; } /************************ copy all constraints operators *********************/ static int pose_constraint_copy_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bPoseChannel *pchan = CTX_data_active_pose_bone(C); /* don't do anything if bone doesn't exist or doesn't have any constraints */ if (ELEM(NULL, pchan, pchan->constraints.first)) { BKE_report(op->reports, RPT_ERROR, "No active bone with constraints for copying"); return OPERATOR_CANCELLED; } /* copy all constraints from active posebone to all selected posebones */ CTX_DATA_BEGIN (C, bPoseChannel *, chan, selected_pose_bones) { /* if we're not handling the object we're copying from, copy all constraints over */ if (pchan != chan) { copy_constraints(&chan->constraints, &pchan->constraints, TRUE); /* update flags (need to add here, not just copy) */ chan->constflag |= pchan->constflag; } } CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ DAG_scene_sort(bmain, scene); /* sort order of objects/bones */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL); return OPERATOR_FINISHED; } void POSE_OT_constraints_copy(wmOperatorType *ot) { /* identifiers */ ot->name = "Copy Constraints to Selected Bones"; ot->idname = "POSE_OT_constraints_copy"; ot->description = "Copy constraints to other selected bones"; /* api callbacks */ ot->exec = pose_constraint_copy_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *obact = ED_object_active_context(C); /* copy all constraints from active object to all selected objects */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { /* if we're not handling the object we're copying from, copy all constraints over */ if (obact != ob) { copy_constraints(&ob->constraints, &obact->constraints, TRUE); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } } CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ DAG_scene_sort(bmain, scene); /* sort order of objects */ /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, NULL); return OPERATOR_FINISHED; } void OBJECT_OT_constraints_copy(wmOperatorType *ot) { /* identifiers */ ot->name = "Copy Constraints to Selected Objects"; ot->idname = "OBJECT_OT_constraints_copy"; ot->description = "Copy constraints to other selected objects"; /* api callbacks */ ot->exec = object_constraint_copy_exec; ot->poll = ED_operator_object_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /************************ add constraint operators *********************/ /* get the Object and/or PoseChannel to use as target */ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_ob, bPoseChannel **tar_pchan, short add) { Object *obact = ED_object_active_context(C); bPoseChannel *pchanact = BKE_pose_channel_active(obact); short only_curve = 0, only_mesh = 0, only_ob = 0; short found = 0; /* clear tar_ob and tar_pchan fields before use * - assume for now that both always exist... */ *tar_ob = NULL; *tar_pchan = NULL; /* check if constraint type doesn't requires a target * - if so, no need to get any targets */ switch (con_type) { /* no-target constraints --------------------------- */ /* null constraint - shouldn't even be added! */ case CONSTRAINT_TYPE_NULL: /* limit constraints - no targets needed */ case CONSTRAINT_TYPE_LOCLIMIT: case CONSTRAINT_TYPE_ROTLIMIT: case CONSTRAINT_TYPE_SIZELIMIT: case CONSTRAINT_TYPE_SAMEVOL: return 0; /* restricted target-type constraints -------------- */ /* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */ /* curve-based constraints - set the only_curve and only_ob flags */ case CONSTRAINT_TYPE_CLAMPTO: case CONSTRAINT_TYPE_FOLLOWPATH: case CONSTRAINT_TYPE_SPLINEIK: only_curve = 1; only_ob = 1; add = 0; break; /* mesh only? */ case CONSTRAINT_TYPE_SHRINKWRAP: only_mesh = 1; only_ob = 1; add = 0; break; /* object only - add here is ok? */ case CONSTRAINT_TYPE_RIGIDBODYJOINT: only_ob = 1; break; } /* if the active Object is Armature, and we can search for bones, do so... */ if ((obact->type == OB_ARMATURE) && (only_ob == 0)) { /* search in list of selected Pose-Channels for target */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) { /* just use the first one that we encounter, as long as it is not the active one */ if (pchan != pchanact) { *tar_ob = obact; *tar_pchan = pchan; found = 1; break; } } CTX_DATA_END; } /* if not yet found, try selected Objects... */ if (found == 0) { /* search in selected objects context */ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { /* just use the first object we encounter (that isn't the active object) * and which fulfills the criteria for the object-target that we've got */ if ( (ob != obact) && ((!only_curve) || (ob->type == OB_CURVE)) && ((!only_mesh) || (ob->type == OB_MESH)) ) { /* set target */ *tar_ob = ob; found = 1; /* perform some special operations on the target */ if (only_curve) { /* Curve-Path option must be enabled for follow-path constraints to be able to work */ Curve *cu = (Curve *)ob->data; cu->flag |= CU_PATH; } break; } } CTX_DATA_END; } /* if still not found, add a new empty to act as a target (if allowed) */ if ((found == 0) && (add)) { Scene *scene = CTX_data_scene(C); Base *base = BASACT, *newbase = NULL; Object *obt; /* add new target object */ obt = BKE_object_add(scene, OB_EMPTY); /* set layers OK */ newbase = BASACT; newbase->lay = base->lay; obt->lay = newbase->lay; /* transform cent to global coords for loc */ if (pchanact) { /* since by default, IK targets the tip of the last bone, use the tip of the active PoseChannel * if adding a target for an IK Constraint */ if (con_type == CONSTRAINT_TYPE_KINEMATIC) mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_tail); else mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_head); } else { copy_v3_v3(obt->loc, obact->obmat[3]); } /* restore, BKE_object_add sets active */ BASACT = base; base->flag |= SELECT; /* make our new target the new object */ *tar_ob = obt; found = 1; } /* return whether there's any target */ return found; } /* used by add constraint operators to add the constraint required */ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bPoseChannel *pchan; bConstraint *con; if (list == &ob->constraints) { pchan = NULL; } else { pchan = BKE_pose_channel_active(ob); /* ensure not to confuse object/pose adding */ if (pchan == NULL) { BKE_report(op->reports, RPT_ERROR, "No active pose bone to add a constraint to"); return OPERATOR_CANCELLED; } } /* check if constraint to be added is valid for the given constraints stack */ if (type == CONSTRAINT_TYPE_NULL) { return OPERATOR_CANCELLED; } if ( (type == CONSTRAINT_TYPE_RIGIDBODYJOINT) && (list != &ob->constraints) ) { BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint Constraint can only be added to Objects"); return OPERATOR_CANCELLED; } if ( (type == CONSTRAINT_TYPE_KINEMATIC) && ((!pchan) || (list != &pchan->constraints)) ) { BKE_report(op->reports, RPT_ERROR, "IK Constraint can only be added to Bones"); return OPERATOR_CANCELLED; } if ( (type == CONSTRAINT_TYPE_SPLINEIK) && ((!pchan) || (list != &pchan->constraints)) ) { BKE_report(op->reports, RPT_ERROR, "Spline IK Constraint can only be added to Bones"); return OPERATOR_CANCELLED; } /* create a new constraint of the type requried, and add it to the active/given constraints list */ if (pchan) con = add_pose_constraint(ob, pchan, NULL, type); else con = add_ob_constraint(ob, NULL, type); /* get the first selected object/bone, and make that the target * - apart from the buttons-window add buttons, we shouldn't add in this way */ if (setTarget) { Object *tar_ob = NULL; bPoseChannel *tar_pchan = NULL; /* get the target objects, adding them as need be */ if (get_new_constraint_target(C, type, &tar_ob, &tar_pchan, 1)) { /* method of setting target depends on the type of target we've got * - by default, just set the first target (distinction here is only for multiple-targeted constraints) */ if (tar_pchan) set_constraint_nth_target(con, tar_ob, tar_pchan->name, 0); else set_constraint_nth_target(con, tar_ob, "", 0); } } /* do type-specific tweaking to the constraint settings */ switch (type) { case CONSTRAINT_TYPE_PYTHON: // FIXME: this code is not really valid anymore { #ifdef WITH_PYTHON char *menustr; int scriptint = 0; /* popup a list of usable scripts */ menustr = buildmenu_pyconstraints(NULL, &scriptint); // XXX scriptint = pupmenu(menustr); MEM_freeN(menustr); /* only add constraint if a script was chosen */ if (scriptint) { /* add constraint */ validate_pyconstraint_cb(con->data, &scriptint); /* make sure target allowance is set correctly */ BPY_pyconstraint_update(ob, con); } #endif break; } default: break; } /* make sure all settings are valid - similar to above checks, but sometimes can be wrong */ object_test_constraints(ob); if (pchan) BKE_pose_update_constraint_flags(ob->pose); /* force depsgraph to get recalculated since new relationships added */ DAG_scene_sort(bmain, scene); /* sort order of objects */ if ((ob->type == OB_ARMATURE) && (pchan)) { ob->pose->flag |= POSE_RECALC; /* sort pose channels */ DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB); } else DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, ob); return OPERATOR_FINISHED; } /* ------------------ */ /* dummy operator callback */ static int object_constraint_add_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); int type = RNA_enum_get(op->ptr, "type"); short with_targets = 0; if (!ob) { BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to"); return OPERATOR_CANCELLED; } /* hack: set constraint targets from selected objects in context is allowed when * operator name included 'with_targets', since the menu doesn't allow multiple properties */ if (strstr(op->idname, "with_targets")) with_targets = 1; return constraint_add_exec(C, op, ob, &ob->constraints, type, with_targets); } /* dummy operator callback */ static int pose_constraint_add_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(ED_object_active_context(C)); int type = RNA_enum_get(op->ptr, "type"); short with_targets = 0; if (!ob) { BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to"); return OPERATOR_CANCELLED; } /* hack: set constraint targets from selected objects in context is allowed when * operator name included 'with_targets', since the menu doesn't allow multiple properties */ if (strstr(op->idname, "with_targets")) with_targets = 1; return constraint_add_exec(C, op, ob, get_active_constraints(ob), type, with_targets); } /* ------------------ */ void OBJECT_OT_constraint_add(wmOperatorType *ot) { /* identifiers */ ot->name = "Add Constraint"; ot->description = "Add a constraint to the active object"; ot->idname = "OBJECT_OT_constraint_add"; /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_constraint_add_exec; ot->poll = ED_operator_object_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot) { /* identifiers */ ot->name = "Add Constraint (with Targets)"; ot->description = "Add a constraint to the active object, with target (where applicable) set to the selected Objects/Bones"; ot->idname = "OBJECT_OT_constraint_add_with_targets"; /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_constraint_add_exec; ot->poll = ED_operator_object_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void POSE_OT_constraint_add(wmOperatorType *ot) { /* identifiers */ ot->name = "Add Constraint"; ot->description = "Add a constraint to the active bone"; ot->idname = "POSE_OT_constraint_add"; /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = pose_constraint_add_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) { /* identifiers */ ot->name = "Add Constraint (with Targets)"; ot->description = "Add a constraint to the active bone, with target (where applicable) set to the selected Objects/Bones"; ot->idname = "POSE_OT_constraint_add_with_targets"; /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = pose_constraint_add_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", ""); } /************************ IK Constraint operators *********************/ /* NOTE: only for Pose-Channels */ // TODO: should these be here, or back in editors/armature/poseobject.c again? /* present menu with options + validation for targets to use */ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bPoseChannel *pchan = BKE_pose_channel_active(ob); bConstraint *con = NULL; uiPopupMenu *pup; uiLayout *layout; Object *tar_ob = NULL; bPoseChannel *tar_pchan = NULL; /* must have active bone */ if (ELEM(NULL, ob, pchan)) { BKE_report(op->reports, RPT_ERROR, "Must have active bone to add IK Constraint to"); return OPERATOR_CANCELLED; } /* bone must not have any constraints already */ for (con = pchan->constraints.first; con; con = con->next) { if (con->type == CONSTRAINT_TYPE_KINEMATIC) break; } if (con) { BKE_report(op->reports, RPT_ERROR, "Bone already has IK Constraint"); return OPERATOR_CANCELLED; } /* prepare popup menu to choose targetting options */ pup = uiPupMenuBegin(C, "Add IK", ICON_NONE); layout = uiPupMenuLayout(pup); /* the type of targets we'll set determines the menu entries to show... */ if (get_new_constraint_target(C, CONSTRAINT_TYPE_KINEMATIC, &tar_ob, &tar_pchan, 0)) { /* bone target, or object target? * - the only thing that matters is that we want a target... */ if (tar_pchan) uiItemBooleanO(layout, "To Active Bone", ICON_NONE, "POSE_OT_ik_add", "with_targets", 1); else uiItemBooleanO(layout, "To Active Object", ICON_NONE, "POSE_OT_ik_add", "with_targets", 1); } else { /* we have a choice of adding to a new empty, or not setting any target (targetless IK) */ uiItemBooleanO(layout, "To New Empty Object", ICON_NONE, "POSE_OT_ik_add", "with_targets", 1); uiItemBooleanO(layout, "Without Targets", ICON_NONE, "POSE_OT_ik_add", "with_targets", 0); } /* finish building the menu, and process it (should result in calling self again) */ uiPupMenuEnd(C, pup); return OPERATOR_CANCELLED; } /* call constraint_add_exec() to add the IK constraint */ static int pose_ik_add_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); int with_targets = RNA_boolean_get(op->ptr, "with_targets"); /* add the constraint - all necessary checks should have been done by the invoke() callback already... */ return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets); } void POSE_OT_ik_add(wmOperatorType *ot) { /* identifiers */ ot->name = "Add IK to Bone"; ot->description = "Add IK Constraint to the active Bone"; ot->idname = "POSE_OT_ik_add"; /* api callbacks */ ot->invoke = pose_ik_add_invoke; ot->exec = pose_ik_add_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "with_targets", 1, "With Targets", "Assign IK Constraint with targets derived from the select bones/objects"); } /* ------------------ */ /* remove IK constraints from selected bones */ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only remove IK Constraints */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) { bConstraint *con, *next; // TODO: should we be checking if these contraints were local before we try and remove them? for (con = pchan->constraints.first; con; con = next) { next = con->next; if (con->type == CONSTRAINT_TYPE_KINEMATIC) { remove_constraint(&pchan->constraints, con); } } pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET); } CTX_DATA_END; /* refresh depsgraph */ DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob); return OPERATOR_FINISHED; } void POSE_OT_ik_clear(wmOperatorType *ot) { /* identifiers */ ot->name = "Remove IK"; ot->description = "Remove all IK Constraints from selected bones"; ot->idname = "POSE_OT_ik_clear"; /* api callbacks */ ot->exec = pose_ik_clear_exec; ot->poll = ED_operator_posemode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } | __label__pos | 0.999669 |
9
I am getting unfortunate behavior with the the most recent version of breqn.sty with regards to how it handles a newcommand that begins with a superscript. Considering the following code
\documentclass{article}
\usepackage{breqn}
\newcommand{\hc}{^\dagger}
\begin{document}
\begin{dmath}
A\hc
\end{dmath}
\end{document}
This code will not stop compiling, and hangs on this error:
! Missing { inserted.
<to be read again>
\penalty
l.6 A\hc
! Missing } inserted.
<inserted text>
}
l.7 \end{dmath}
(Note that older iterations of breqn.sty did not give me this issue.)
However, if I just replace \hc with ^\dagger, everything works. Also, if I replace dmath with any of the standard math environments, it works (I've been using this particular newcommand for years).
Is it bad practice to have a superscript begin a newcommand? Is there a way to modify my \hc to make the above code just work?
2 Answers 2
9
The way breqn works is rather complex, and so I'm not surprised that it fails in the case you give. I'd suggest sticking rigidly to the formally-allowed syntax for superscripts:
\documentclass{article}
\usepackage{breqn}
\newcommand{\hc}{^{\dagger}}
\begin{document}
\begin{dmath}
A\hc
\end{dmath}
\end{document}
As Bruno observes, this is to do with category codes. The following also works
\documentclass{article}
\usepackage{breqn}
\catcode`\^=12 %
\newcommand{\hc}{^\dagger}
\begin{document}
\begin{dmath}
A\hc
\end{dmath}
\end{document}
as breqn makes ^ an 'other' character.
which works fine.
1
• 1
I strongly suspect that it has to do with the catcode of ^ being set to active by breqn \AtBeginDocument. Can't test at the moment, though. Oct 11, 2011 at 16:54
4
To complement Joseph's answer and Bruno's comment, here's some analysis of the situation.
breqn changes all mathcodes to "8000 so that characters in math mode behave like macros; and changes also the meaning of commands such as \dagger.
The meanings of ^, A and \dagger become
> ^=macro:
#1->\mathsup {\protect \subsupstyle #1}.
> A=\protected\long macro:
->\@sym A\math_sym_Var:Nn \mg@Latin {41}.
> \dagger=\protected\long macro:
->\@sym \dagger \math_sym_Bin:Nn \mg@bin {79}.
where \mathsup is an alias for the usual category 7 ^.
With \newcommand{\hc}{^\dagger} given in the preamble, ^ still has category 7 and such remains when \hc is expanded. But an important property of category 7 ^ in math mode is that it keeps expanding the next token until an unexpandable one is found (and it has better be a mathchardef token or a chardef token or a left brace). After a good deal of expansions, in the present case ^ is presented \penalty, which is not a good token after it.
The safest definition would be
\begingroup\lccode`?=`^
\lowercase{\endgroup\newcommand{\hc}{?{\dagger}}}
or
{\catcode`^=12 \gdef\hc{^{\dagger}}}
as changing at that point the catcode of ^ could be dangerous. Maybe issuing
\catcode`^=12
\newcommand{\hc}{^{\dagger}}
just before \begin{document} may not have unexpected consequences. In any case, defining \hc with a catcode 7 ^ should be avoided, as it can interfere with the workings of breqn: there's quite a difference between
\mathsup{\protect\subsupstyle \dagger}
and
\mathsup{\dagger}
The latter is what LaTeX would see with the catcode 7 ^ definition.
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged . | __label__pos | 0.999919 |
5
\$\begingroup\$
I'm trying to Sync data from the client to the server using the new Unity Networking, and I'm failing for some reason.
I've set up a prefab with a NetworkIdentity component with the attribute Local Player Authority set.
I (manually) spawn that on the server, and it is correctly propagated to the clients.
I have a couple of vars on this class, which the client sets and the server should read:
public class PlayerController : NetworkBehaviour
{
[SyncVar] public bool engineOn;
[SyncVar] public Quaternion lookAt;
The client correctly sets them, however the server never receives them, they always stay at the default value.
What might be happening?
\$\endgroup\$
1
• \$\begingroup\$ The alternative is using Command, but I would like to understand if I can get it to work using SyncVar. \$\endgroup\$
– o0'.
Jun 15 '15 at 16:56
4
\$\begingroup\$
[SyncVar] only sends messages from the server to the client. You need [Command].
\$\endgroup\$
3
• \$\begingroup\$ You confirm this is also true even for objects with Local Player Authority? \$\endgroup\$
– o0'.
Jul 8 '15 at 10:28
• \$\begingroup\$ PS: why the downvote? \$\endgroup\$
– o0'.
Jul 8 '15 at 10:28
• 1
\$\begingroup\$ Yes, I tested it on my cumputer and checked online document even if with Local Player Authority \$\endgroup\$
– Ricardo
Jul 12 '15 at 17:18
1
\$\begingroup\$
Not sure if this has been figured out or but here goes. I dropped the [SyncVar] portion except for health and shields on players and used the following code to get by break lights to sync across network.
void LateUpdate () {
if (isLocalPlayer) {
if (Input.GetButton ("Fire1")) {
breakLightsOnOff = true;
} else {
breakLightsOnOff = false;
}
CmdBLC (breakLightsOnOff);
}
}
[Command]
void CmdBLC(bool OnOff) {
RpcBreakLightControl (OnOff);
}
[ClientRpc]
void RpcBreakLightControl(bool OnOff) {
breakLights.SetActive (OnOff);
}
\$\endgroup\$
1
• \$\begingroup\$ This was a huge help for me as I was using Command methods and SyncVars but hadn't used Rpc methods \$\endgroup\$
– mswieboda
Mar 1 '17 at 3:48
-1
\$\begingroup\$
The problem is that Server will never receive these updates unless there is a LocalClient on the machine running the server. Refer unity docs for the word Host i.e. Sever and a Client
\$\endgroup\$
2
• \$\begingroup\$ So, local authority has no effect on syncvars? That would be very counter-intuitive… \$\endgroup\$
– o0'.
Jun 21 '15 at 8:16
• \$\begingroup\$ The intension was to be able to turn any Single Player Game to Multiplayer in a few hours. If there is a client on the Server as well, one does not have to write special code for remote client and local client. It may be Counter-Intuitive but it is Productive. This way games can have dedicated servers. \$\endgroup\$ Jun 21 '15 at 17:21
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged . | __label__pos | 0.638607 |
Spacing in math mode - Overleaf, Online LaTeX Editor - latex spacing math
Category
latex spacing math - Whitespace in math mode – texblog
Spacing in math mode In mathematical mode characters are spaced as if they were part of a single word, regardless of the actual space you insert. This article explains how to insert spaces of different lengths in mathematical mode. What commands are there for horizontal spacing? Ask Question Asked 6 years, 11 months ago. Active There are a number of horizontal spacing macros for LaTeX: \, inserts a \thinspace (equivalent to.16667em) in text mode, Controlling horizontal spacing in math mode in text. 0.
Spacing in Math Mode. In a math environment, LaTeX ignores the spaces you type and puts in the spacing that it thinks is best. LaTeX formats mathematics the way it's done in mathematics texts. If you want different spacing, LaTeX provides the following four commands for use in math mode. In the example above, \renewcommand{\baselinestretch}{1.5} scales the default interline space to 1.5 its default value. Of course that number can be set to any value. As mentioned before, there are other two L a T e X lengths that may change the line spacing: \baselineskip Is a length determining the minimum space between the bottom of two successive lines in a paragraph; it may be changed (in.
Math Page spacing Margins Remember that T E X was designed for producing books. We might need to leave paper for binding. nevensidemargin left margin for even numbered pages noddsidemargin left margin for odd numbered pages ntextwidth width of text area. The right margin is . Apr 09, 2014 · There are a number of predefined commands to add whitespace in LaTeX math mode. These are summarized in the list below. Example usage of medium space \: Here, we use whitespace to separate symbols from regular text. Whitespace commands are available by default. Additional packages are necessary to produce natural number symbol and \text command. | __label__pos | 0.94958 |
2
I have an FME workspace which has a number of different workspaceRunner transformers. The first workspaceRunner launches a workspace which buffers a pipeline and outputs the bounding coordinates to a CSV file.
I then have a python caller which reads the CSV to get the bounding coordinates and save them as global variables.
enter image description here
The code of the Python Script looks like this:
import fmeobjects
import csv
# Template Function interface:
def processFeature(feature):
global XMIN
global XMAX
global YMIN
global YMAX
outputDirectory = FME_MacroValues['Output_Directory']
csvPath = outputDirectory + '\\Buffer Bounds.csv'
coordlist = []
with open(csvPath, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter = ',')
for row in reader:
coordlist.append(row)
XMIN = float(coordlist[0][0])
XMAX = float(coordlist[0][2])
YMIN = float(coordlist[0][3])
YMAX = float(coordlist[0][4])
print XMIN, XMAX, YMIN, YMAX
pass
# Template Class Interface:
class FeatureProcessor(object):
def __init__(self):
pass
def input(self,feature):
self.pyoutput(feature)
def close(self):
pass
After the PythonCaller, I have four VariableRetriever transformers which get the values of XMIN, XMAX, YMIN, YMAX and save them as attributes.
That is then connected to a workspaceRunner transformer. The parameters for the bounding box are passed to the next workspace and are used to define the Search Envelope Coordinates for the File Geodatabase.
enter image description here
enter image description here
My problem is that these variables are somehow not getting passed to the attributes. Am I using the variableRetriever transformers correctly? I have read on some FME forums that you can use them this way. I've declared them as global variables.
1
Turns out, I didn't need to use a VariableRetriever or VariableSetter transformer. I first create the attributes that will hold the bounds:
enter image description here
Then I pass that to the PythonCaller and expose those attributes. The code looks like this:
import fmeobjects
import csv
# Template Function interface:
def getBounds(feature):
global XMIN
global XMAX
global YMIN
global YMAX
outputDirectory = FME_MacroValues['Output_Directory']
csvPath = outputDirectory + '\\Buffer Bounds.csv'
coordlist = []
with open(csvPath, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter = ',')
bounds = reader.next()
XMIN = float(bounds[0])
XMAX = float(bounds[1])
YMIN = float(bounds[2])
YMAX = float(bounds[3])
feature.setAttribute("_xmin", XMIN)
feature.setAttribute("_ymin", YMIN)
feature.setAttribute("_xmax", XMAX)
feature.setAttribute("_ymax", YMAX)
print XMIN, XMAX, YMIN, YMAX
pass
# Template Class Interface:
class FeatureProcessor(object):
def __init__(self):
pass
def input(self,feature):
self.pyoutput(feature)
def close(self):
pass
And the dialog box looks like this:
enter image description here
I can then pass those attributes as parameters to other WorkspaceRunners.
Now, my workspace runs in minutes instead of 2.5 hours.
|improve this answer|||||
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.63503 |
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
Sign up
Here's how it works:
1. Anybody can ask a question
2. Anybody can answer
3. The best answers are voted up and rise to the top
I've been using Google Drive for a while with ups and downs. One major down that I recently discovered is that it doesn't appear in command prompt mode, although it appears fine in Windows Explorer. As a result, some Windows applications that access folders based on their visibility from command prompt can't detect Google Drive. Google Drive's attribute is definitely not hidden either.
So, why is Google Drive invisible from command prompt, and is there any way to make Google Drive visible?
share|improve this question
I'm running Google Drive under Windows 7, and the Google Drive folder is visible to me from the command prompt. – PJC Nov 16 '12 at 17:09
mmm. I'm on Windows 7 too. How come it doesn't show up in mine.. – Anon Nov 16 '12 at 20:05
I don't see the google drive in Vista or XP either.. Are you sure it's visible? You can certainly move into the folder by "CD Google Drive", but the directory "Google Drive" is nowhere to be seen in its immediate parent directory. Thus my question. – Anon Nov 16 '12 at 20:43
Google Drive contains a space in the name. do you quote the name before giving it to cd? as in cd "Google Drive"? – akira Nov 17 '12 at 7:42
If you read my question carefully, I said I have no problem moving into the Google Drive with the cd command. The question is why the directory is not visible in its parent directory when one can still move into it from the parent directory with the CD command. – Anon Nov 17 '12 at 17:52
up vote 1 down vote accepted
dir /as will display it for me, so it must have the system attribute.
Oddly enough, dir /ad (list directories) will also list it.
Running the cmd.exe as Administrator didn't help.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.579396 |
Uploaded image for project: 'Jackrabbit Oak'
1. Jackrabbit Oak
2. OAK-8613
Azure Segment Store clustering PoC
XMLWordPrintableJSON
Details
• Story
• Status: Open
• Major
• Resolution: Unresolved
• None
• None
• segment-azure
• None
Description
Azure Segment Store offers a way to read the same segments, concurrently in many Oak instances. With a way to coordinate writes, it's possible to implement a distributed node store based on the SegmentNS. The solution will consist of following elements:
• a central server, that'd coordinate the writes to the shared repository,
• a number of clients, that can read directly from the shared repository. They also have their own, private repositories within the same cloud storage,
• the shared repository, which represents the current state. It can be read by anyone, but only the central server can write it,
• the private repositories. Clients can write their own segments there and then pass their references to the server.
As above, every client uses two repositories: shared (in the read only mode) and private (in read-write mode). When a client wants to read the current root, it asks the server for its revision. Then, it looks in the shared repository, reads the segment and creates a node state.
If the client wants to modify the repository, it convert the fetched node state into node builder. The applied changes will eventually be serialized in the new segment, in the client's private repository. In order to merge it changes, the client will send two revision ids: of the base root (fetched from shared repo) and of the current root (stored in the private repo). Server will check if the base root wasn't updated in the meantime - in such case it requests a rebase. Otherwise, it'll read the current root from the private repository, apply the commit changes in the shared repository and update the journal.
gRPC is used for the communication between the server and clients. This is used only for the coordination. All the data are actually exchanged via segment stores.
The attached OAK-8613.patch contains the implementation split into 3 parts:
• oak-store-remote-commons, which contains the gRPC descriptors of used services and embeds the required libraries,
• oak-store-remote-server builds an executable JAR, that starts the server,
• oak-store-remote-client is an OSGi bundle that starts NodeStore connecting to the configured server and Azure Storage.
There are also some changes in the oak-segment-tar - new SPIs that allows to read segments with their revisions (record ids) and exposes the revision in the node state.
The gRPC uses Guava 26. I was able to somehow get it running with other Oak bundles, using Guava 15, but if we want to produtize it, we'd need to update Oak's Guava.
There's a new fixture that tests the implementation. It can be run with:
mvn clean install -f oak-it/pom.xml -Dnsfixtures=REMOTE -Dtest=NodeStoreTest -Dtest.opts=-Xmx4g
This is prototype. It lacks of the tests and important resilience features:
• unit tests, especially for the discovery lite implementation,
• enable online compaction for the shared repository (the private ones can be just thrown away after merge),
• server resilience and support disconnecting clients in a clean way (eg. unregister node observers),
• client resilience, with support to re-connect,
• clean resources on both sides on disconnection (eg. remove private repository).
Potential improvements:
• can we have multiple replicas for the server, in the active-passive mode, to increase resilience?
Attachments
1. OAK-8613.patch
180 kB
Tomek Rękawek
2. remote node store.png
223 kB
Tomek Rękawek
Issue Links
Activity
People
tomek.rekawek Tomek Rękawek
tomek.rekawek Tomek Rękawek
Votes:
0 Vote for this issue
Watchers:
6 Start watching this issue
Dates
Created:
Updated: | __label__pos | 0.672292 |
Web Design: Use the Hexadecimal Color Code to Match Colors
When you specify colors in HTML or CSS code in web design, you don’t use their RGB numbers. Instead, you use something called a hexadecimal code. For example, plain old white is 255,255,255 in RGB, but it is #FFFFFF in hexadecimal code. In hexadecimal code, the first two digits define the red color, the next two digits define the green, and the last two digits define the blue of the RGB system. Using the #FFFFFF example, the first two digits FF equal 255. So this color is R=255, G=255, and B=255. All three colors at full power (255) make white.
Imagine that you’re designing a website for a company that has a handful of company colors that they want you to use throughout the site. Often times, these colors are specified as PMS colors (Pantone Matching System). So just how do you go from PMS or RGB to hexadecimal color codes?
Instead of using a super-duper decoder ring to translate color values into hexadecimal code and vice versa, you can retrieve the code in both Adobe Photoshop and Adobe Fireworks. (Otherwise you really do need a special hexadecimal calculator, and they do exist online!)
Here’s how to use Adobe Photoshop to find the hexadecimal number of a sample color, or of a known PMS or RGB color:
1. Launch Photoshop.
2. Choose File→Open from the menu bar.
Navigate to an image you want to sample a color from and open it.
If you don’t have an image to sample and just need to translate an RGB or PMS color value, you do not need to open a file.
3. Click on the Foreground color swatch at the bottom of the Tools panel.
A pop-up palette appears, offering a Color Picker for you to use, as the following figure illustrates. Note as well that your cursor turns into an eyedropper.
image0.jpg
4. Move your cursor over your image, and click on the color you want to sample.
Notice the hexadecimal readout updates in the Color Picker.
5. Select and copy the hexadecimal code within the Color Picker before clicking the OK button to exit, then paste the code into your CSS code, or into your style guide.
6. To translate a PMS color, do the following:
1. Click the Color Libraries button in the Color Picker.
2. Quickly type your PMS number, say 375, to see your color swatch appear.
3. When you find the right one in the list, click the “Picker” button to return to the Color Picker.
Notice the hexadecimal code appears for your color; you can now copy and paste it as you like.
7. To translate an RGB color, simply enter the R, G, and B values in the Color Picker and see the hexadecimal number update accordingly.
blog comments powered by Disqus
Advertisement
Inside Dummies.com | __label__pos | 0.983838 |
Lagrange's four-square theorem
Lagrange's four-square theorem, also known as Bachet's conjecture, states that every natural number can be represented as the sum of four integer squares.
where the four numbers are integers. For illustration, 3, 31 and 310 can be represented as the sum of four squares as follows:
This theorem was proven by Joseph Louis Lagrange in 1770.
Historical developmentEdit
From examples given in the Arithmetica it is clear that Diophantus was aware of the theorem. This book was translated in 1621 into Latin by Bachet (Claude Gaspard Bachet de Méziriac), who stated the theorem in the notes of his translation. But the theorem was not proved until 1770 by Lagrange.[1]
Adrien-Marie Legendre completed the theorem in 1797–8 with his three-square theorem, by proving that a positive integer can be expressed as the sum of three squares if and only if it is not of the form for integers and . Later, in 1834, Carl Gustav Jakob Jacobi discovered a simple formula for the number of representations of an integer as the sum of four squares with his own four-square theorem.
The formula is also linked to Descartes' theorem of four "kissing circles", which involves the sum of the squares of the curvatures of four circles. This is also linked to Apollonian gaskets, which were more recently related to the Ramanujan–Petersson conjecture.[2]
The classical proofEdit
Several very similar modern versions[3][4][5] of Lagrange's proof exist. The proof below is a slightly simplified version, in which the cases for which m is even or odd do not require separate arguments.
It is sufficient to prove the theorem for every odd prime number p. This immediately follows from Euler's four-square identity (and from the fact that the theorem is true for the numbers 1 and 2).
The residues of a2 modulo p are distinct for every a between 0 and (p − 1)/2 (inclusive). To see this, take some a and define c as a2 mod p. a is a root of the polynomial x2 − c over the field Z/pZ. So is p − a (which is different from a). In a field K, any polynomial of degree n has at most n distinct roots (Lagrange's theorem (number theory)), so there are no other a with this property, in particular not among 0 to (p − 1)/2.
Similarly, for b taking integral values between 0 and (p − 1)/2 (inclusive), the b2 − 1 are distinct. By the pigeonhole principle, there are a and b in this range, for which a2 and b2 − 1 are congruent modulo p, that is for which
Now let m be the smallest positive integer such that mp is the sum of four squares, x12 + x22 + x32 + x42 (we have just shown that there is some m (namely n) with this property, so there is a least one m, and it is smaller than p). We show by contradiction that m equals 1: supposing it is not the case, we prove the existence of a positive integer r less than m, for which rp is also the sum of four squares (this is in the spirit of the infinite descent[6] method of Fermat).
For this purpose, we consider for each xi the yi which is in the same residue class modulo m and between (–m + 1)/2 and m/2 (included). It follows that y12 + y22 + y32 + y42 = mr, for some strictly positive integer r less than m.
Finally, another appeal to Euler's four-square identity shows that mpmr = z12 + z22 + z32 + z42. But the fact that each xi is congruent to its corresponding yi implies that all of the zi are divisible by m. Indeed,
It follows that, for wi = zi/m, w12 + w22 + w32 + w42 = rp, and this is in contradiction with the minimality of m.
In the descent above, we must rule out both the case y1 = y2 = y3 = y4 = m/2 (which would give r = m and no descent), and also the case y1 = y2 = y3 = y4 = 0 (which would give r = 0 rather than strictly positive). For both of those cases, one can check that mp = x12 + x22 + x32 + x42 would be a multiple of m2, contradicting the fact that p is a prime greater than m.
Proof using the Hurwitz integersEdit
One of the ways to prove the theorem relies on Hurwitz quaternions, which are the analog of integers for quaternions.[7] The Hurwitz quaternions consist of all quaternions with integer components and all quaternions with half-integer components. These two sets can be combined into a single formula
where are integers. Thus, the quaternion components are either all integers or all half-integers, depending on whether is even or odd, respectively. The set of Hurwitz quaternions forms a ring; that is to say, the sum or product of any two Hurwitz quaternions is likewise a Hurwitz quaternion.
The (arithmetic, or field) norm of a rational quaternion is the nonnegative rational number
where is the conjugate of . Note that the norm of a Hurwitz quaternion is always an integer. (If the coefficients are half-integers, then their squares are of the form , and the sum of four such numbers is an integer.)
Since quaternion multiplication is associative, and real numbers commute with other quaternions, the norm of a product of quaternions equals the product of the norms:
For any , . It follows easily that is a unit in the ring of Hurwitz quaternions if and only if .
The proof of the main theorem begins by reduction to the case of prime numbers. Euler's four-square identity implies that if Langrange's four-square theorem holds for two numbers, it holds for the product of the two numbers. Since any natural number can be factored into powers of primes, it suffices to prove the theorem for prime numbers. It is true for . To show this for an odd prime integer , represent it as a quaternion and assume for now (as we shall show later) that it is not a Hurwitz irreducible; that is, it can be factored into two non-unit Hurwitz quaternions
The norms of are integers such that
and . This shows that both and are equal to (since they are integers), and is the sum of four squares
If it happens that the chosen has half-integer coefficients, it can be replaced by another Hurwitz quaternion. Choose in such a way that has even integer coefficients. Then
Since has even integer coefficients, will have integer coefficients and can be used instead of the original to give a representation of as the sum of four squares.
As for showing that is not a Hurwitz irreducible, Lagrange proved that any odd prime divides at least one number of the form , where and are integers.[7] This can be seen as follows: since is prime, can hold for integers , only when . Thus, the set of squares contains distinct residues modulo . Likewise, contains residues. Since there are only residues in total, and , the sets and must intersect.
The number can be factored in Hurwitz quaternions:
The norm on Hurwitz quaternions satisfies a form of the Euclidean property: for any quaternion with rational coefficients we can choose a Hurwitz quaternion so that by first choosing so that and then so that for . Then we obtain
It follows that for any Hurwitz quaternions with , there exists a Hurwitz quaternion such that
The ring of Hurwitz quaternions is not commutative, hence it is not an actual Euclidean domain, and it does not have unique factorization in the usual sense. Nevertheless, the property above implies that every right ideal is principal. Thus, there is a Hurwitz quaternion such that
In particular, for some Hurwitz quaternion . If were a unit, would be a multiple of , however this is impossible as is not a Hurwitz quaternion for . Similarly, if were a unit, we would have
so divides , which again contradicts the fact that is not a Hurwitz quaternion. Thus, is not Hurwitz irreducible, as claimed.
GeneralizationsEdit
Lagrange's four-square theorem is a special case of the Fermat polygonal number theorem and Waring's problem. Another possible generalization is the following problem: Given natural numbers , can we solve
for all positive integers in integers ? The case is answered in the positive by Lagrange's four-square theorem. The general solution was given by Ramanujan.[8] He proved that if we assume, without loss of generality, that then there are exactly 54 possible choices for such that the problem is solvable in integers for all . (Ramanujan listed a 55th possibility , but in this case the problem is not solvable if .[9])
AlgorithmsEdit
Michael O. Rabin and Jeffrey Shallit[10] have found randomized polynomial-time algorithms for computing a single representation for a given integer , in expected running time .
Number of representationsEdit
The number of representations of a natural number n as the sum of four squares is denoted by r4(n). Jacobi's four-square theorem states that this is eight times the sum of the divisors of n if n is odd and 24 times the sum of the odd divisors of n if n is even (see divisor function), i.e.
Equivalently, it is eight times the sum of all its divisors which are not divisible by 4, i.e.
We may also write this as
where the second term is to be taken as zero if n is not divisible by 4. In particular, for a prime number p we have the explicit formula r4(p) = 8(p + 1).[11]
Some values of r4(n) occur infinitely often as r4(n) = r4(2mn) whenever n is even. The values of r4(n)/n can be arbitrarily large: indeed, r4(n)/n is infinitely often larger than 8log n.[11]
UniquenessEdit
The sequence of positive integers which have only one representation as a sum of four squares (up to order) is:
1, 2, 3, 5, 6, 7, 8, 11, 14, 15, 23, 24, 32, 56, 96, 128, 224, 384, 512, 896 ... (sequence A006431 in the OEIS).
These integers consist of the seven odd numbers 1, 3, 5, 7, 11, 15, 23 and all numbers of the form or .
The sequence of positive integers which cannot be represented as a sum of four non-zero squares is:
1, 2, 3, 5, 6, 8, 9, 11, 14, 17, 24, 29, 32, 41, 56, 96, 128, 224, 384, 512, 896 ... (sequence A000534 in the OEIS).
These integers consist of the eight odd numbers 1, 3, 5, 9, 11, 17, 29, 41 and all numbers of the form or .
Further refinementsEdit
Lagrange's four-square theorem can be refined in various ways. For example, Zhi-Wei Sun [12] proved that each natural number can be written as the sum of a sixth power (or a fourth power) and three squares, and Sun's 1-3-5 conjecture (with $1350 prize for the solution) states that any natural number can be written as with nonnegative integers such that is a square.
One may also wonder whether it is necessary to use the entire set of square integers to write each natural as the sum of four squares. Wirsing proved that there exists a set of squares with such that every positive integer smaller than or equal can be written as a sum of at most 4 elements of .[13]
See alsoEdit
NotesEdit
1. ^ Ireland & Rosen 1990.
2. ^ Sarnak 2013.
3. ^ Landau 1958, Theorems 166 to 169.
4. ^ Hardy & Wright 2008, Theorem 369.
5. ^ Niven & Zuckerman 1960, paragraph 5.7.
6. ^ Here the argument is a direct proof by contradiction. With the initial assumption that m>2, m<p, is some integer such that mp is the sum of four squares (not necessarily the smallest), the argument could be modified to become an infinite descent argument in the spirit of Fermat.
7. ^ a b Stillwell 2003, pp. 138–157.
8. ^ Ramanujan 1917.
9. ^ Oh 2000.
10. ^ Rabin & Shallit 1986.
11. ^ a b Williams 2011, p. 119.
12. ^ Z.-W. Sun 2017.
13. ^ Spencer 1996.
ReferencesEdit
• Hardy, G. H.; Wright, E. M. (2008) [1938]. Heath-Brown, D. R.; Silverman, J. H.; Wiles, Andrew (eds.). An Introduction to the Theory of Numbers (6th ed.). Oxford University Press. ISBN 978-0-19-921985-8.
• Ireland, Kenneth; Rosen, Michael (1990). A Classical Introduction to Modern Number Theory (2nd ed.). Springer. doi:10.1007/978-1-4757-2103-4. ISBN 978-1-4419-3094-1.
• Landau, Edmund (1958) [1927]. Elementary Number Theory. 125. Translated by Goodman, Jacob E. (2nd ed.). AMS Chelsea Publishing.
• Niven, Ivan; Zuckerman, Herbert S. (1960). An introduction to the theory of numbers. Wiley.
• Oh, Byeong-Kweon (2000). "Representations of Binary Forms by Quinary Quadratic Forms" (PDF). Trends in Mathematics. 3 (1): 102–107.
• Rabin, M. O.; Shallit, J. O. (1986). "Randomized Algorithms in Number Theory". Communications on Pure and Applied Mathematics. 39 (S1): S239–S256. doi:10.1002/cpa.3160390713.
• Ramanujan, S. (1917). "On the expression of a number in the form ax2 + by2 + cz2 + dw2". Proc. Camb. Phil. Soc. 19: 11–21.
• Sarnak, Peter (2013). "The Ramanujan Conjecture and some Diophantine Equations" (Lecture at Tata Institute of Fundamental Research). ICTS Lecture Series. Bangalore, India.
• Stillwell, John (2003). Elements of Number Theory. Undergraduate Texts in Mathematics. Springer. doi:10.1007/978-0-387-21735-2. ISBN 978-0-387-95587-2. Zbl 1112.11002.
• Sun, Z.-W. (2017). "Refining Lagrange's four-square theorem". J. Number Theory. 175: 167–190. arXiv:1604.06723. doi:10.1016/j.jnt.2016.11.008.
• Williams, Kenneth S. (2011). Number theory in the spirit of Liouville. London Mathematical Society Student Texts. 76. Cambridge University Press. ISBN 978-0-521-17562-3. Zbl 1227.11002.
• Spencer, Joel (1996). "Four Squares with Few Squares". Number Theory: New York Seminar 1991–1995. Springer US. pp. 295–297. doi:10.1007/978-1-4612-2418-1_22. ISBN 9780387948263.
External linksEdit | __label__pos | 0.717846 |
1
Preciso pegar um dado enviado pelo usuário através do método GET em uma página, colocar esse dado no banco de dados e, em outra página, preciso ler esse dado do banco de dados e escrever na página. No caso, eu tenho uma tabela chamada comandos onde tenho dua colunas nome e valor e quero pegar o dado do campo valorque está na mesma linha onde o campo nome contem o valor LED1
Tentei isso, mas não funcionou:
Página 1
mysql_connect("u541106066_estad","u541106066_ctp","jkf45s6f4sdf4");
$sSQL="Update comandos Set valor='$_GET_["LED1"]' Where nome='LED1'";
mysql_db_query("u541106066_estad",$sSQL);
Página 2
mysql_connect("u541106066_estad","u541106066_ctp","81GDYC2lDC");
$sql = 'SELECT valor FROM comandos';
echo "led=$ql";
7
• 1
Faltou executar a sql. – user6406 3/08/15 às 16:43
• como assim ? Poderia exemplificar – Carlos 3/08/15 às 16:44
• Fiz um exemplo pra ti Carlos, dá uma olhada... com a execução e o fetch_array() – Sr. André Baill 3/08/15 às 16:45
• 1
Outra coisa, qual é o aspecto temporal desse dado? Ele deve ser gravado em banco de dados relacional mesmo? Sessão não serve? – user6406 3/08/15 às 16:45
• Está dando erro no primeiro código. Não tenho muito conhecimento em my sql. O que preciso exatamente é colocar um dado em uma página e dar saída em outra página. Essas páginas vão ser acessadas de clientes diferentes. Um vai enviar o dado e o outro vai pegar. O dado em questão deve ser mantindo mesmo quando os clientes se desconectarem. Esse processo deve acontecer em tempo real e continuamente. – Carlos 3/08/15 às 16:51
2 Respostas 2
1
O que você deseja me parece muito simples, você pode fazer isso desta maneira:
1. Crie uma classe (arquivo: Database.php) para acessar o banco de dados utilizando PDO, como no exemplo abaixo:
class Database {
private static $servidor = 'localhost'; // Servidor, no caso poderia ser também localhost
private static $usuario = 'u541106066_ctp'; // usuário do banco de dados
private static $senha = 'jkf45s6f4sdf4'; // senha do banco de dados
private static $banco = 'u541106066_estad'; // nome do banco de dados
private static $instance = null;
//inicia a conexão
public static function getConnection() {
if (!self::$instance instanceof PDO) {
try {
self::$instance = new PDO('mysql:host=' .
self::$servidor . ';dbname=' .
self::$banco,
self::$usuario,
self::$senha,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} catch (PDOException $exc) {
echo "Erro ao conectar :: {$exc->getMessage()}";
}
}
return self::$instance;
}
//metodo para trazer vários resultados
public function fetchAll($query) {
$con = self::getConnection();
$stmt = $con->prepare($query);
$this->execute($stmt);
if ($stmt->rowCount()) {
return $stmt->fetchAll(PDO::FETCH_OBJ);
} else {
return false;
}
}
//metodo para trazer um resultado
public function fetch($query) {
$con = self::getConnection();
$stmt = $con->prepare($query);
$this->execute($stmt);
if ($stmt->rowCount()) {
return $stmt->fetch(PDO::FETCH_OBJ);
} else {
return false;
}
}
//executa o PDO
public function execute(PDOStatement $stmt, array $data = null) {
try {
if (isset($data)) {
$stmt->execute($data);
} else {
$stmt->execute();
}
} catch (PDOException $exc) {
echo $exc->getTraceAsString();
var_dump($exc->getMessage());
}
}
//metodo para inserir e atualizar dados
public function save($sql, array $data) {
$con = self::getConnection();
$stmt = $con->prepare($sql);
$this->execute($stmt, $data);
if ($stmt->rowCount()) {
return true;
} else {
return false;
}
}
}
1. Utilize a classe para pegar os dados do banco, crie um arquivo do tipo index.php e neste arquivo faça o seguinte:
//primeiro você precisa incluir a classe
require_once("Database.php");
//agora você precisa instanciá-la:
$conexao = new Database();
/*
Agora basta chamar o método para a query que você quer buscar no seu banco, através da requisição GET.
- no seu caso /index.php?id=1
- Armazene numa variável o valor que receber
*/
$requisicao_consulta = (isset($_GET['id'])) ? $_GET['id'] : null;
//para post, salva a id no campo hidden
$valor_id = ($_POST['id'] != '') ? $_POST['id'] : null;
//requisição de inclusão/atualização
$requisicao_save = (isset($_POST['action'])) ? $_POST['action'] : null;
if ($requisicao_save != null) {
$values = [
'id' => $valor_id,
'val1' => $_POST['valor1'],
'val2' => $_POST['valor2'],
'val3' => $_POST['valor3'],
];
} else {
if ($requisicao_consulta != null) {
$data = $conexao->fetch("SELECT id,
valor1,
valor2,
valor3
FROM comandos
WHERE id='$requisicao_consulta'");
}
$message = "- Preencha o formulário abaixo:\n<br>";
if (isset($_GET['success-insert'])) {
$message .= "Dados cadastrados com sucesso!\n<br>";
}
if (isset($_GET['success-update'])) {
$message .= "Dados atualizados com sucesso!\n<br>";
}
}
//agora basta chamar a query com a requisição
if ($requisicao_save == 'insert' && $valor_id == null) {
$execute = $conexao->save("INSERT INTO comandos
(id, valor1, valor2, valor3)
VALUES (:id,:val1,:val2,:val3);",
$values);
header('Location: index.php?success-insert');
}
if ($requisicao_save == 'update' && $valor_id != null) {
$execute = $conexao->save("UPDATE comandos SET
valor1=:val1,
valor2=:val2,
valor3=:val3
WHERE id:id;",
$values);
header('Location: index.php?success-update');
}
//a variável $data representa os dados (em objeto) que contém o conjunto de valores trazido pela similaridade da sua requisição, como não é uma coleção, "não" utilizamos $conexao->fetchAll("..."), onde teríamos uma coleção em array. Desta maneira, vamos construir um formulário para preencher os dados que serão alterados (vou escrever em php mesmo, depois você refatora se achar melhor):
$inputs = [];
$action = 'insert';
if (!empty($data)) {
$action = 'update';
foreach ($data as $key => $dado) {
$inputs["<label>{ucwords($key)}</label>\n<input type=\"text\" value=\"{$dado->$key}\" name=\"{$key}\">"];
}
$inputs["<input type=\"hidden\" name=\"action\" value=\"update\">"];
} else {
for ($i=1; $i <= 3; $i++) {
$inputs["<label>Valor {$i}</label>\n<input type=\"text\" value=\"\" name=\"valor{$i}\">"];
}
}
$inputs["<input type=\"hidden\" name=\"action\" value=\"{$action}\">"];
$inputs["<input type=\"hidden\" name=\"id\" value=\"{$valor_id}\">"];
$inputs["<input type=\"submit\" value=\"Salvar\">"];
echo "<div id=\"mensagem\" class=\"msg\">{$message}</div>\n";
echo "<form method=\"post\" action=\"{$_SERVER['SCRIPT_NAME']}\" name=\"send\" id=\"send\">\n";
echo implode("\n<br />", $inputs);
echo "</form>";
0
Na página 2, faz assim:
$res = mysql_db_query($sql);
while ($row = mysql_fetch_assoc($res)) {
echo $row['valor'];
}
1
• Também sugeri isso, porém, ele está usando o PDO. O que não dá pra fazer desta nossa forma. – Sr. André Baill 3/08/15 às 19:18
Sua resposta
Ao clicar em “Publique sua resposta”, você concorda com os termos de serviço, política de privacidade e política de Cookies
Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag ou faça sua própria pergunta. | __label__pos | 0.95756 |
topic badge
CanadaON
Grade 10
Surface area of prisms
Interactive practice questions
Consider the following cube with a side length equal to $6$6 cm. Find the total surface area.
Easy
Approx a minute
Sign up to try all questions
Consider the following rectangular prism with length width and height equal to $12$12 m, $6$6 m and $4$4 m respectively.
Find the surface area of the prism.
Given the following triangular prism. Find the total surface area.
Find the surface area of the triangular prism shown.
Outcomes
10P.MT3.04
Solve problems involving the surface areas of prisms, pyramids, and cylinders, and the volumes of prisms, pyramids, cylinders, cones, and spheres, including problems involving combinations of these figures, using the metric system or the imperial system, as appropriate
What is Mathspace
About Mathspace | __label__pos | 0.922225 |
Quality of Service in Computer Networking
Quality of Service in Computer Networking
QoS is an essential element of network architecture that is commonly used at the enterprise level. In environments where certain network functions can’t afford to be delayed or interrupted QoS should be implemented. A well designed plan with with QoS should increase the performance and efficiency of a network once established. This will help the organization’s overall performance by providing continuous access to business essential functions necessary for successful daily operations.
QoS uses four types of network traffic metrics to measure performance which are bandwidth, delay, loss and jitter. Each of these metrics provides a way to measure network traffic efficiency and where it may need to be improved. The first thing an organization should do is to identify those essential functions that use the most amount of bandwidth. This could be video teleconferencing, video streaming or VoIP services. In addition to bandwidth intensive activities there may be others that experience latency or packet loss. This can result from an overcrowded network which causes disruptions in service. This may also result from what is known as jitter which is when packets are received before or after their expected arrival time due to inconsistent transfer speed over the network (Fortinet, n.d.).
When these potential problems on the network are cross referenced with the most essential functions of the network the administrator can begin to prioritize certain types of traffic. From here the network administrator can determine what methods are best for guaranteeing the best performance and efficiency on the network. One method of accomplishing this is a technique known as traffic marking. This is where specific types of traffic from essential applications is marked on the network. From here it is then configured to take priority over other applications on the network that may also need bandwidth. This is a very straight forward method of QoS (Microsoft, 2016).
Another technique that could be used is known as queuing. To use this method the network administrator will first set up a dedicated queue that will buffer resources that will later be used on the network for a specific task. From here the important traffic type will be identified and the network will be configured to reserve this queued bandwidth for that specific service. This method is slightly more complex but accomplishes the same thing as traffic marking. However, in this case the network automatically guarantees that the application will have access to the resources it needs by reserving it ahead of time (Fortinet, n.d.).
For example imagine that there is a call center with hundreds of employees. Each of them is using VoIP services to contact customers, some are using video on demand (VOD) for training and others are using chat services and a variety of other applications. The traffic on this network could become very complex and without QoS mechanisms in place the network availability needed for mission business tasks could be disrupted. In this instance it would make sense for the network administrator to configure a resource reservation queue for VoIP traffic since contacting customers is the primary objective of the call center. By creating this policy the employees would always be access to the VoIP service despite it being a resource intensive service (Microsoft, 2016).
In an enterprise network there are thousands of information systems competing for network resources. If these devices are not subject to some sort of QoS strategy then there is a good chance that the most critical functions may not be available when they are needed. There are several other methods of configuring QoS on a network such as by port number, type of service or application, resource reservation and several other internet protocols. Understanding the network and the services that use it is key to determining how to use QoS for increasing performance and efficiency. Although there are many best practices there is no one size fits all approach to QoS. Each network administrator will need to identify inelastic services that are more susceptible to network disruptions listed above. | __label__pos | 0.638288 |
Help on how to get the highest value of a number value inside multiple objects that are inside a folder
Hey! u may already have seen me around here and know that im making a tower defense game
And after doing the lobby music im working on a better tower system, and im making it so the player can select if it will attack the closest enemy or the strongest enemy, etc
And im stuck at the part of getting the zombie that has the highest help
Btw how this system works is, theres a folder named Zombies that has all the zombies which are in the map, instead of using a humanoid for the health i used a number value so they dont die they just disappear, making it more clean
Could anyone help me?
local Zombies = script.Zombies --path to folder
local result
local biggest_health = 0
for _, zombie in pairs(Zombies:GetChildren()) do
local Health = zombie:FindFirstChild("Health") --where Health is the name of NumberValue
if not Health then continue end
local val = Health.Value
if not result or val > biggest_health then
biggest_health = val
result = zombie
end
end
print(result) --chosen zombie
local highestHealthZombie
local highestHealth
for _, zombie in pairs(zombies) do
local health = zombie:FindFirstChild("Health") -- or whatever it's called
if health then
if highestHealth then
if health > highestHealth then
highestHealth = health
highestHealthZombie = zombie
end
else
highestHealth = health
highestHealthZombie = zombie
end
end
end
Thx! But could u explain to me what it does?
Thx! This also helped!
character69420
Basically, it loops through each zombie and checks the health of it. If the health is higher than the previous highestHealth, then highestHealth will be set to the new health. If it’s less than the current health, then it will ignore it and move on.
And also makes an exclusion, if the zombie is the first one being checked.
Ohhh thx! ima implement this into the system, it will probably work!
Oh but does the script already makes the exclusion or i need to implement thst into it
Both of the scripts make the exclusion, just in a different way.
1 Like | __label__pos | 0.960224 |
parallel-2.2.0.1: Parallel programming library
Portabilityportable
Stabilityexperimental
[email protected]
Control.Parallel.Strategies
Contents
Description
Parallel Evaluation Strategies, or Strategies for short, specify a way to evaluate a structure with components in sequence or in parallel.
Strategies are for expressing deterministic parallelism: the result of the program is unaffected by evaluating in parallel. For non-deterministic parallel programming, see Control.Concurrent.
Strategies let you separate the description of parallelism from the logic of your program, enabling modular parallelism.
Version 1.x
The original Strategies design is described in http://www.macs.hw.ac.uk/~dsg/gph/papers/html/Strategies/strategies.html and the code was written by Phil Trinder, Hans-Wolfgang Loidl, Kevin Hammond et al.
Version 2.x
Later, during work on the shared-memory implementation of parallelism in GHC, we discovered that the original formulation of Strategies had some problems, in particular it lead to space leaks and difficulties expressing speculative parallelism. Details are in the paper "Runtime Support for Multicore Haskell" http://www.haskell.org/~simonmar/papers/multicore-ghc.pdf.
This module has been rewritten in version 2. The main change is to the 'Strategy a' type synonym, which was previously a -> Done and is now a -> Eval a. This change helps to fix the space leak described in "Runtime Support for Multicore Haskell". The problem is that the runtime will currently retain the memory referenced by all sparks, until they are evaluated. Hence, we must arrange to evaluate all the sparks eventually, just in case they aren't evaluated in parallel, so that they don't cause a space leak. This is why we must return a "new" value after applying a Strategy, so that the application can evaluate each spark created by the Strategy.
The simple rule is this: you must use the result of applying a Strategy if the strategy creates parallel sparks, and you should probably discard the the original value. If you don't do this, currently it may result in a space leak. In the future (GHC 6.14), it will probably result in lost parallelism instead, as we plan to change GHC so that unreferenced sparks are discarded rather than retained (we can't make this change until most code is switched over to this new version of Strategies, because code using the old verison of Strategies would be broken by the change in policy).
The other changes in version 2.x are:
• Strategies can now be defined using a convenient Monad/Applicative type, Eval. e.g. parList s = traverse (Par . (`using` s))
• parList has been generalised to parTraverse, which works on any Traversable type, and similarly seqList has been generalised to seqTraverse
• parList and parBuffer have versions specialised to rwhnf, and there are transformation rules that automatically translate e.g. parList rwnhf into a call to the optimised version.
• NFData has been moved to Control.DeepSeq in the deepseq package. Note that since the Strategy type changed, rnf is no longer a Strategy: use rdeepseq instead.
Synopsis
Strategy type and basic operations
type Strategy a = a -> Eval aSource
A Strategy is a function that embodies a parallel evaluation strategy. The function traverses (parts of) its argument, evaluating subexpressions in parallel or in sequence.
A Strategy may do an arbitrary amount of evaluation of its argument, but should not return a value different from the one it was passed.
Parallel computations may be discarded by the runtime system if the program no longer requires their result, which is why a Strategy function returns a new value equivalent to the old value. The intention is that the program applies the Strategy to a structure, and then uses the returned value, discarding the old value. This idiom is expressed by the using function.
using :: a -> Strategy a -> aSource
evaluate a value using the given Strategy.
using x s = s x
withStrategy :: Strategy a -> a -> aSource
evaluate a value using the given Strategy. This is simply using with the arguments reversed, and is equal to '($)'.
rwhnf :: Strategy aSource
A Strategy that simply evaluates its argument to Weak Head Normal Form (i.e. evaluates it as far as the topmost constructor).
rdeepseq :: NFData a => Strategy aSource
A Strategy that fully evaluates its argument
rdeepseq a = rnf a `pseq` a
r0 :: Strategy aSource
A Strategy that does no evaluation of its argument
rpar :: Strategy aSource
A Strategy that evaluates its argument in parallel
Tuple strategies
seqTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)Source
parTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)Source
General traversals
seqTraverse :: Traversable t => Strategy a -> Strategy (t a)Source
A strategy that traverses a container data type with an instance of Traversable, and evaluates each of the elements in left-to-right sequence using the supplied strategy.
parTraverse :: Traversable t => Strategy a -> Strategy (t a)Source
A strategy that traverses a container data type with an instance of Traversable, and sparks each of the elements using the supplied strategy.
List strategies
parList :: Strategy a -> Strategy [a]Source
Spark each of the elements of a list using the given strategy. Equivalent to parTraverse at the list type.
seqList :: Strategy a -> Strategy [a]Source
Evaluate each of the elements of a list sequentially from left to right using the given strategy. Equivalent to seqTraverse at the list type.
parMap :: Strategy b -> (a -> b) -> [a] -> [b]Source
parBuffer :: Int -> Strategy a -> [a] -> [a]Source
Applies a strategy to the nth element of list when the head is demanded. More precisely:
• semantics: parBuffer n s = id :: [a] -> [a]
• dynamic behaviour: evalutates the nth element of the list when the head is demanded.
The idea is to provide a `rolling buffer' of length n. It is a better than parList for a lazy stream, because parList will evaluate the entire list, whereas parBuffer will only evaluate a fixed number of elements ahead.
Simple list strategies
parListWHNF :: Strategy [a]Source
version of parList specialised to rwhnf. This version is much simpler, and may be faster than 'parList rwhnf'. You should never need to use this directly, since 'parList rwhnf' is automatically optimised to parListWHNF. It is here for experimentation purposes only.
parBufferWHNF :: Int -> Strategy [a]Source
version of parBuffer specialised to rwhnf. You should never need to use this directly, since 'parBuffer rwhnf' is automatically optimised to parBufferWHNF. It is here for experimentation purposes only.
Strategy composition operators
($|) :: (a -> b) -> Strategy a -> a -> bSource
Sequential function application. The argument is evaluated using the given strategy before it is given to the function.
($||) :: (a -> b) -> Strategy a -> a -> bSource
Parallel function application. The argument is evaluated using the given strategy, in parallel with the function application.
(.|) :: (b -> c) -> Strategy b -> (a -> b) -> a -> cSource
Sequential function composition. The result of the second function is evaluated using the given strategy, and then given to the first function.
(.||) :: (b -> c) -> Strategy b -> (a -> b) -> a -> cSource
Parallel function composition. The result of the second function is evaluated using the given strategy, in parallel with the application of the first function.
(-|) :: (a -> b) -> Strategy b -> (b -> c) -> a -> cSource
Sequential inverse function composition, for those who read their programs from left to right. The result of the first function is evaluated using the given strategy, and then given to the second function.
(-||) :: (a -> b) -> Strategy b -> (b -> c) -> a -> cSource
Parallel inverse function composition, for those who read their programs from left to right. The result of the first function is evaluated using the given strategy, in parallel with the application of the second function.
Building strategies
data Eval a Source
Eval is an Applicative Functor that makes it easier to define parallel strategies that involve traversing structures.
a Seq value will be evaluated strictly in sequence in its context, whereas a Par value wraps an expression that may be evaluated in parallel. The Applicative instance allows sequential composition, making it possible to describe an evaluateion strategy by composing Par and Seq with <*>.
For example,
parList :: Strategy a -> Strategy [a]
parList strat = traverse (Par . (`using` strat))
seqPair :: Strategy a -> Strategy b -> Strategy (a,b)
seqPair f g (a,b) = pure (,) <$> f a <*> g b
Constructors
Seq a
Par a
Lazy a
unEval :: Eval a -> aSource
re-exported for backwards compatibility
class NFData a where
A class of types that can be fully evaluated.
Methods
rnf :: a -> ()
rnf should reduce its argument to normal form (that is, fully evaluate all sub-components), and then return '()'.
The default implementation of rnf is
rnf a = a `seq` ()
which may be convenient when defining instances for data types with no unevaluated fields (e.g. enumerations).
Instances
NFData Bool
NFData Char
NFData Double
NFData Float
NFData Int
NFData Int8
NFData Int16
NFData Int32
NFData Int64
NFData Integer
NFData Word
NFData Word8
NFData Word16
NFData Word32
NFData Word64
NFData ()
NFData IntSet
NFData a => NFData [a]
(Integral a, NFData a) => NFData (Ratio a)
(RealFloat a, NFData a) => NFData (Complex a)
NFData a => NFData (Maybe a)
NFData a => NFData (Tree a)
NFData a => NFData (IntMap a)
NFData a => NFData (Set a)
(NFData a, NFData b) => NFData (Either a b)
(NFData a, NFData b) => NFData (a, b)
(Ix a, NFData a, NFData b) => NFData (Array a b)
(NFData k, NFData a) => NFData (Map k a)
(NFData a, NFData b, NFData c) => NFData (a, b, c)
(NFData a, NFData b, NFData c, NFData d) => NFData (a, b, c, d)
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5)
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6)
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7)
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8)
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9)
Deprecated functionality
type Done = ()Source
demanding :: a -> Done -> aSource
sparking :: a -> Done -> aSource | __label__pos | 0.775139 |
anemotaxis (6x) - Linux Man Pages
anemotaxis: directional search on a plane.
NAME
anemotaxis - directional search on a plane.
SYNOPSIS
anemotaxis [-display host:display.screen] [-visual visual] [-window] [-root] [-delay number] [-distance number] [-sources number] [-searchers number] [-fps]
DESCRIPTION
The program demonstrates a search algorithm designed for locating a source of odor in turbulent atmosphere. The odor is convected by wind which has a constant mean direction and fluctuations around it. The searcher is able to sense the odor and determine local instantaneous wind direction. The goal is to find the source in the shortest mean time. Some animals face this task to find mates, food, home etc. They exhibit very particular, zigzagging search trajectories.
This is modeled as a search on a discrete two-dimensional lattice. The source releases particles that drift with constant velocity in one direction and walk randomly in the other direction. The searcher knows if it hit a particle, and if so, particle's position one time step earlier (local wind direction). The program paints sources and particles released by them as well as trajectories of searchers who are trying to capture the sources.
OPTIONS
-visual visual
Specify which visual to use. Legal values are the name of a visual class, or the id number (decimal or hex) of a specific visual.
-window
Draw on a newly-created window. This is the default.
-root
Draw on the root window.
-delay number
Per-frame delay, in microseconds. Default: 20000 (0.02 seconds.).
-distance number
Max initial distance to the source . 10 - 250. Default: 40.
-sources number
Max number of sources. Default: 25.
-searchers number
Max number of searchers. Default: 25.
-fps
Display the current frame rate and CPU load.
ENVIRONMENT
DISPLAY
to get the default host and display number.
XENVIRONMENT
to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property.
COPYRIGHT
Copyright © 2004 by Eugene Balkovsky. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
AUTHOR
Eugene Balkovsky
SEE ALSO
X(1), xscreensaver(1) | __label__pos | 0.541412 |
Программирование вевлений
Программирование вевлений
Что написано неправильно?
#include
#include
#include
int
main()
[Error] lvalue required as left operand of assignment
• Перепишите строку:
else (y > 1? rez = x/(y-1) : rez = x + y);
так
else res = y > 1? x / (y - 1) : x + y;
В таких задания совершенно незачем использовать тернарную операцию. Пишите прямо по условиям, будет меньше ошибок:
#include
int main() {
double x, y, f;
printf("x y? ");
scanf("%lf%lf", &x, &y);
if (x > 0 && y < 0) {
f = x + y;
} else if (x > 0 && y > 1) {
f = x / (y - 1);
} else {
f = x - y;
}
printf("f(x, y): %fn", f);
getchar();
return 0;
} | __label__pos | 0.999661 |
SHARE
TWEET
Untitled
a guest Oct 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1.
2. <html lang="en-US"><head><marquee><title>HACKED BY NeoxWeb</title></marquee>
3. <meta property="og:title" content="HACKED BY NeoxWeb">
4. <meta property="og:description" content="~ This site has been hacked by Neox ~">
5. <meta property="og:author" content="Neox">
6.
7. <meta charset="UTF-8">
8. <head>
9. <!-- Based on http://codepen.io/lbebber/pen/ypgql -->
10. <link href="http://necolas.github.io/normalize.css/3.0.2/normalize.css" rel='stylesheet'/>
11. <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
12. <style>
13. /* Just colors and font sizes */
14. * {
15. font-family: courier new;
16. }
17. body {
18. background-color: black;
19. }
20.
21. .glitch {
22. color: white;
23. font-size: 28px;
24. margin: 0 auto;
25. width: 400px;
26. }
27.
28. /* Real glitch effect */
29. .glitch {
30. position: relative;
31. }
32.
33. .glitch:after {
34. animation: glitch-animation 2s infinite linear alternate-reverse;
35. background: black;
36. clip: rect( 0, 900px, 0, 0 );
37. color: white;
38. content: attr( data-text );
39. left: 2px;
40. overflow: hidden;
41. position: absolute;
42. text-shadow: -1px 0 red;
43. top: 0;
44. }
45. .glitch:before {
46. animation: glitch-animation-2 3s infinite linear alternate-reverse;
47. background: black;
48. clip: rect( 0, 900px, 0, 0 );
49. color: white;
50. content: attr( data-text );
51. left: -2px;
52. overflow: hidden;
53. position: absolute;
54. text-shadow: 1px 0 blue;
55. top: 0;
56. }
57. /* Expanded Animations */
58. @keyframes glitch-animation {
59. 0% {
60. clip: rect(42px, 9999px, 44px, 0);
61. }
62. 5% {
63. clip: rect(12px, 9999px, 59px, 0);
64. }
65. 10% {
66. clip: rect(48px, 9999px, 29px, 0);
67. }
68. 15.0% {
69. clip: rect(42px, 9999px, 73px, 0);
70. }
71. 20% {
72. clip: rect(63px, 9999px, 27px, 0);
73. }
74. 25% {
75. clip: rect(34px, 9999px, 55px, 0);
76. }
77. 30.0% {
78. clip: rect(86px, 9999px, 73px, 0);
79. }
80. 35% {
81. clip: rect(20px, 9999px, 20px, 0);
82. }
83. 40% {
84. clip: rect(26px, 9999px, 60px, 0);
85. }
86. 45% {
87. clip: rect(25px, 9999px, 66px, 0);
88. }
89. 50% {
90. clip: rect(57px, 9999px, 98px, 0);
91. }
92. 55.0% {
93. clip: rect(5px, 9999px, 46px, 0);
94. }
95. 60.0% {
96. clip: rect(82px, 9999px, 31px, 0);
97. }
98. 65% {
99. clip: rect(54px, 9999px, 27px, 0);
100. }
101. 70% {
102. clip: rect(28px, 9999px, 99px, 0);
103. }
104. 75% {
105. clip: rect(45px, 9999px, 69px, 0);
106. }
107. 80% {
108. clip: rect(23px, 9999px, 85px, 0);
109. }
110. 85.0% {
111. clip: rect(54px, 9999px, 84px, 0);
112. }
113. 90% {
114. clip: rect(45px, 9999px, 47px, 0);
115. }
116. 95% {
117. clip: rect(37px, 9999px, 20px, 0);
118. }
119. 100% {
120. clip: rect(4px, 9999px, 91px, 0);
121. }
122. }
123. @keyframes glitch-animation-2 {
124. 0% {
125. clip: rect(65px, 9999px, 100px, 0);
126. }
127. 5% {
128. clip: rect(52px, 9999px, 74px, 0);
129. }
130. 10% {
131. clip: rect(79px, 9999px, 85px, 0);
132. }
133. 15.0% {
134. clip: rect(75px, 9999px, 5px, 0);
135. }
136. 20% {
137. clip: rect(67px, 9999px, 61px, 0);
138. }
139. 25% {
140. clip: rect(14px, 9999px, 79px, 0);
141. }
142. 30.0% {
143. clip: rect(1px, 9999px, 66px, 0);
144. }
145. 35% {
146. clip: rect(86px, 9999px, 30px, 0);
147. }
148. 40% {
149. clip: rect(23px, 9999px, 98px, 0);
150. }
151. 45% {
152. clip: rect(85px, 9999px, 72px, 0);
153. }
154. 50% {
155. clip: rect(71px, 9999px, 75px, 0);
156. }
157. 55.0% {
158. clip: rect(2px, 9999px, 48px, 0);
159. }
160. 60.0% {
161. clip: rect(30px, 9999px, 16px, 0);
162. }
163. 65% {
164. clip: rect(59px, 9999px, 50px, 0);
165. }
166. 70% {
167. clip: rect(41px, 9999px, 62px, 0);
168. }
169. 75% {
170. clip: rect(2px, 9999px, 82px, 0);
171. }
172. 80% {
173. clip: rect(47px, 9999px, 73px, 0);
174. }
175. 85.0% {
176. clip: rect(3px, 9999px, 27px, 0);
177. }
178. 90% {
179. clip: rect(26px, 9999px, 55px, 0);
180. }
181. 95% {
182. clip: rect(42px, 9999px, 97px, 0);
183. }
184. 100% {
185. clip: rect(38px, 9999px, 49px, 0);
186. }
187. }
188. </style>
189. </head>
190.
191. <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
192. <style>body{background:#000;
193. cursor: url(http://cur.cursors-4u.net/cursors/cur-9/cur862.ani), url(http://cur.cursors-4u.net/cursors/cur-9/cur862.png), progress !important;
194. }
195.
196.
197. </style>
198.
199.
200. </head><body oncontextmenu="return false" onkeydown="return false" onmousedown="return false"><script> alert('This site has been hacked') </script><br><br><br>
201. <center><img style="width:700px;" src="https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/B3mqp6o/videoblocks-mysterious-hooded-man-standing-in-the-dark_bzn3gysre_thumbnail-full01.png">
202.
203.
204.
205. <br><br><font color="white" face="courier new"><div class="glitch" data-text="HACKED BY NeoxWeb">HACKED BY NeoxWeb</div></font>
206. <br><br><font color="white" face="courier new">Tu n'as aucune puissance face a moi, tu n'es juste qu'un vieux Random</font><br><font color="white" face="courier new">
207. Ton site n'a aucune sécurité, essaye d'arranger ce problème.
208.
209. </font>
210. <br><font color="white" face="courier new">
211. Your Website Is Deface</font></center></body>ont>font>b</html>r></font><br><br><font color="white" face="courier new">Je suis ton plus grand maitre, donc soumet toi a moi.<br><br><br>Thanks to:<br><font color="black" face="courier new"><marquee bgcolor="white">| Bxsical | Azukay | Fugaku | Kalipt0x | Ken's </marquee></font>
212. </center>
213. <embed src="http://www.youtube.com/v/S2bHaHpHWOA&autoplay=1" type="application/x-shockwave-flash"wmode="transparent" width="1" height="1"></embed>
214. </body></html>
215. <iframe width="0" height="0" src="https://4.top4top.net/m_1388j9jrs0.mp3" frameborder="0" allowfullscreen></iframe>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top | __label__pos | 0.991349 |
It is currently 21 Mar 2018, 07:33
Happening Now:
UVA Darden R2 Results - Join CHAT ROOM for Live Updates | HBS R2 Results at Noon ET
Close
GMAT Club Daily Prep
Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.
Customized
for You
we will pick new questions that match your level based on your Timer History
Track
Your Progress
every week, we’ll send you an estimated GMAT score based on your performance
Practice
Pays
we will pick new questions that match your level based on your Timer History
Not interested in getting valuable practice questions and articles delivered to your email? No problem, unsubscribe here.
Close
Request Expert Reply
Confirm Cancel
Events & Promotions
Events & Promotions in June
Open Detailed Calendar
For real numbers a, b, and c, is ab = bc + 3?
new topic post reply Question banks Downloads My Bookmarks Reviews Important topics
Author Message
TAGS:
Hide Tags
Expert Post
2 KUDOS received
Math Expert
User avatar
V
Joined: 02 Sep 2009
Posts: 44388
For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 23 Aug 2016, 09:10
2
This post received
KUDOS
Expert's post
1
This post was
BOOKMARKED
00:00
A
B
C
D
E
Difficulty:
75% (hard)
Question Stats:
57% (01:37) correct 43% (02:11) wrong based on 137 sessions
HideShow timer Statistics
Intern
Intern
avatar
Joined: 18 Aug 2013
Posts: 12
Re: For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 23 Aug 2016, 10:47
(1) ab = 3b => It gives no information about 'c' --> Insufficient
(2) b + 3 = c => It gives no information about 'a' --> Insufficient
Both (1) and (2) together .. Lets substitute these two conditions (1) and (2) in the main eqn (to be proved)
ab = b.(b+3) + 3 = b^2 + 3b + 3
3b = b^2 + 3b + 3 => b^2 = -3 --> For this eqn to be equal, 'b' should be imaginary.
But, we are given that a, b and c are real numbers => These numbers cannot be imaginary ..
Hence, b^ 2 = -3 CANNOT be true for any values of a,b and c.. Option (C)
2 KUDOS received
Senior Manager
Senior Manager
avatar
Joined: 23 Apr 2015
Posts: 329
Location: United States
Concentration: General Management, International Business
WE: Engineering (Consulting)
Re: For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 23 Aug 2016, 10:55
2
This post received
KUDOS
1
This post was
BOOKMARKED
Bunuel wrote:
For real numbers a, b, and c, is ab = bc + 3?
(1) ab = 3b
(2) b + 3 = c
Consider 1) \(ab = 3b\)
there are 2 possibilities, \(b = 0\) or \(b\neq{0}\) which means \(a = 3\) or \(a\neq{3}\) and also \(c\) is not known.
Not Sufficient , Eliminate A and D
Consider 2) \(b + 3 = c\)
Substituting on the given equation: \(ab = b(b+3) + 3 = b^2 + 3b + 3\) . Still \(a\) and \(b\) are not known.
Not Sufficient , Eliminate B
Consider 1) and 2) together (include that 1) has 2 possibilities based on \(b = 0\) and \(b\neq{0}\))
when \(b = 0\), then \(c=3\)and \(ab = bc +3\) becomes \(0 = 0 + 3\) and Hence FAILS
when \(b\neq{0}\), then \(a = 3\) and \(ab = bc + 3\) becomes \(3b = b(b+3) + 3=> b^2 = -3\)
giving values for b which are not real and the Hence Fails,
so answer is C, since when 1) and 2) considered together, the equality FAILS.
PS: this took more than 2 mins, anyone with faster approach please.
+1 for kudos.
Intern
Intern
User avatar
Joined: 28 Apr 2016
Posts: 3
GPA: 3.5
WE: Information Technology (Computer Software)
Re: For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 03 Sep 2016, 07:35
C is the correct option: Below is the solution
Statement 1: ab=3b i.e b(a-3)=0 . Either b=0 or a=3 : We leave this, as no solution we get
Statement 2: b+3=c No info about anything else, so leave this too
Combining both 1 & 2
If we take b=0 , then c=3 according to statement 2 .
Try inputting this in ab= bc+3 . 0 is not equal to 3 Therefore ruled out
Now take a=3 and b+3 =c
Input these in ab=bc+3 ; b(a-c)=3 ; (c-3)(3-b-3) =3 ; -bc+3b =3 ; b(3-c)=3 : This matches the required where 3=a.
Hence combining the statements gave the answer .
Therefore Option C :D
Senior Manager
Senior Manager
avatar
G
Joined: 02 Apr 2014
Posts: 451
For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 16 Jan 2018, 10:56
ab = bc + 3?
ab - bc = 3 ?
b(a-c) = 3?
Statement 1:
ab - 3b = 0
=> b = 0 OR a = 3
if b = 0 => b(a-c) not equals to 3
if a = 3 => we dont know the value of c to say if b(a-c) equals to 3
Statement 2:
b + 3 = c
b(a-c) = 3? => (c-3)(a-3)= 3 ? => don't know about a to conclude => insuff
1 + 2
if b = 0, we saw from statement 1, b(a-c) is not equal to 3
if a = 3 and b + 3 = c, b(a-c) = 3 ? => (c-3)(3-c) = 3? => (3-c)(3-c) = -3? => (3-c)^2 = -3? definitely not equal to -3, as squared values are >= 0
sufficient to answer the question as NO => (C)
Expert Post
Math Revolution GMAT Instructor
User avatar
D
Joined: 16 Aug 2015
Posts: 5062
GMAT 1: 800 Q59 V59
GPA: 3.82
Re: For real numbers a, b, and c, is ab = bc + 3? [#permalink]
Show Tags
New post 20 Jan 2018, 22:13
Bunuel wrote:
For real numbers a, b, and c, is ab = bc + 3?
(1) ab = 3b
(2) b + 3 = c
Forget conventional ways of solving math questions. For DS problems, the VA (Variable Approach) method is the quickest and easiest way to find the answer without actually solving the problem. Remember that equal numbers of variables and independent equations ensure a solution.
Since we have 3 variables and 0 equations, E is most likely to be the answer. So, we should consider 1) & 2) first.
Conditions 1) & 2):
ab = 3b
⇔ ab - 3b = 0
⇔ (a-3)b = 0
⇔ a = 3 or b = 0
Case 1: \(a = 3\)
\(ab = 3b\) and \(bc + 3 = b(b+3)+3\)
\(ab = bc + 3\)
\(⇔ 3b = b(b+3)+3\)
\(⇔ 3b = b^2 + 3b + 3\)
\(⇔ 0 = b^2 + 3\), which is false.
The answer is "No".
Case 2: \(b = 0\)
\(ab = bc + 3\)
\(⇔ 0a = 0c + 3\)
\(⇔ 0 = 0 + 3\), which is false.
The answer is "No".
The answer is always "No".
They are sufficient by CMT (Common Mistake Type) 1, since the answer "no" also means the condition is sufficient.
The answer is C.
In cases where 3 or more additional equations are required, such as for original conditions with “3 variables”, or “4 variables and 1 equation”, or “5 variables and 2 equations”, conditions 1) and 2) usually supply only one additional equation. Therefore, there is an 80% chance that E is the answer, a 15% chance that C is the answer, and a 5% chance that the answer is A, B or D. Since E (i.e. conditions 1) & 2) are NOT sufficient, when taken together) is most likely to be the answer, it is generally most efficient to begin by checking the sufficiency of conditions 1) and 2), when taken together. Obviously, there may be occasions on which the answer is A, B, C or D.
_________________
MathRevolution: Finish GMAT Quant Section with 10 minutes to spare
The one-and-only World’s First Variable Approach for DS and IVY Approach for PS with ease, speed and accuracy.
"Only $79 for 3 month Online Course"
"Free Resources-30 day online access & Diagnostic Test"
"Unlimited Access to over 120 free video lessons - try it yourself"
Re: For real numbers a, b, and c, is ab = bc + 3? [#permalink] 20 Jan 2018, 22:13
Display posts from previous: Sort by
For real numbers a, b, and c, is ab = bc + 3?
new topic post reply Question banks Downloads My Bookmarks Reviews Important topics
GMAT Club MBA Forum Home| About| Terms and Conditions| GMAT Club Rules| Contact| Sitemap
Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne
Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®. | __label__pos | 0.986675 |
Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Problem with looping.' topicStudent Support Forum > General > "Problem with looping."
Help | Reply To Topic | Post New Topic
Author Comment/Response
A. Wong
11/28/09 7:49pm
Trying to do some cellular automata but having trouble with an update function.
When i run the update function it gives me something like this:
Set::setps: {{-20.1879,21.1748},{62.8569,85.},{59.7414,-58.9272},{-25.3293,36.1174},{91.5649,-77.5145},<<42>>,{-32.3608,-91.3138},{-39.4355,88.9865},{57.58,95.9021},<<50>>} in the part assignment is not a symbol. >>
Heres my code
students = Table[
RandomReal[{-100, 100}, 2]
, {100}
];
visualize[dots_] :=
ListPlot[dots,
ImageSize -> 400,
PlotStyle -> AbsolutePointSize[10],
AspectRatio -> Automatic,
Frame -> True,
Axes -> False,
PlotRange -> {{-100, 100}, {-100, 100}}
];
probability = Table[0, {100}];
i = 1;
While[i < Length[students] + 1,
musicLike = (.5) RandomReal[1];
height = (.3) RandomReal[1];
amtMoney = (.2) RandomReal[1];
probability[[i]] = musicLike + amtMoney + height;
i++
]
(*ERROR OCCURS AT THIS FUNCTION*)
update[input_] := Module[{},
Do[
input[[i]] = input[[i]] (.9) + {2, 2}
,
{i, Length[input]}
];
Return[input];
]
simulate[initialAg_] := Manipulate[
Refresh[
If[updating || onestep,
t++;
onestep = False;
ag = update[ag]
];
Show[visualize[ag], PlotLabel -> "t = " <> ToString[t]]
, UpdateInterval -> If[updating, 0, Infinity]
]
,
{{t, 0}, ControlType -> None},
{{ag, initialAg}, ControlType -> None},
{{onestep, False}, ControlType -> None},
{{updating, False, "Run simulation"}, {True, False}},
Button["Update one step", onestep = True],
Button["Reset", updating = False; ag = initialAg; t = 0],
SynchronousUpdating -> True,
SaveDefinitions -> True
];
simulate[students]
URL: ,
Help | Reply To Topic | Post New Topic | __label__pos | 0.977825 |
Manage tags in Semarchy xDG
In Semarchy xDG tags are labels or metadata attributes assigned to data assets to provide additional information or context about them.
In a data catalog, tags are user-created labels assigned to data assets to provide additional information or context about them. Tags may serve several purposes:
• Categorization: Tags help categorize and classify data assets based on their characteristics, content, or usage. This aids in organizing and searching for data within the catalog.
• Search and Discovery: Users can use tags to search for specific types of data or to filter results, making it easier to find relevant information quickly.
• Contextual Information: Tags provide additional context about the data, such as its source, quality, or compliance status, helping users understand the data’s relevance and reliability.
• Data Governance: Tags can indicate informal data ownership, data lineage, data sensitivity, and compliance requirements, facilitating effective data governance and compliance monitoring.
• Collaboration: Tags can support collaboration by highlighting data assets of interest or relevance to specific teams or projects.
For example, in a data catalog for a healthcare organization, tags might include "Patient Data," "Medical Records," "Sensitive," "HIPAA Compliant," and "Cardiology Department," among others. These tags provide valuable information about the data’s nature and usage, aiding both data managers and users in their interactions with the catalog.
Tags vs. Glossary
Tags are user-curated. Users can freely create and assign tags to assets. Tags should be considered informal organization, also known as a folksonomy. They should be used in the early stages of your governance initiative to enable user-curated and lightweight governance. Widely used tags should be eventually promoted to "official and governed" organizational artifacts such as initiatives or glossary terms.
For example, users can start by tagging assets with sensitivity tags such as "Confidential", "Internal" and "Public". Once the corporate sensitivity scheme is agreed upon and defined in the business glossary as a format taxonomy, tagged assets should be associated by authorized users to the corresponding sensitivity glossary terms.
Create and associate tags
When editing an asset, a domain, or an initiative, you can assign multiple tags. If you assign a tag that does not exist yet, it is automatically created.
Edit tags
To edit a tag:
1. Select an asset or initiative this tag is assigned to.
2. Click the tag’s chip on that asset.
The tag editor opens.
3. Edit the Tag’s Description.
4. (Optional) Add Owners to this tags
From this editor, you can also delete the tag by clicking Delete icon Delete. When you delete a tag, it is removed from all the assets using it. | __label__pos | 0.62428 |
The Adjax Javascript API
In order to use Adjax, you will need to load javascript that will initiate the Ajax request and process the response. In general, this is as simple as linking to the Adjax library, and enabling it for a given link or form.
Javascript libraries
The Adjax library can be found at media/js/jquery.adjax.js in the adjax module. A compatible version of the required jquery library is also available.
To include them, simply copy the files into your MEDIA_ROOT (or use a symbolic link) add add the appropriate html. For example:
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.adjax.js"></script>
Basic Use
To enable a link or form, simply call the .adjaxify() method on the relevant element. For example:
<a id="my-link" href="{% url my_ajax_view %}">Do some Ajaxing</a>
<script type="text/javascript">
$('#my-link').adjaxify();
</script>
Advanced customisation
The .adjaxify() method can also take a single argument, being a callback function, which is called after the Ajax request is complete and the data has been processed. A single argument is passed to the callback, containing the json data returned by the view.
<script type="text/javascript">
$('#my-link').adjaxify(function(data) { if (!data.forms) {alert("Success!");} });
</script>
The way messages are displayed can also be customised. This is done by defining your own callbacks in jQuery.adjax_callbacks.
For example, the following overrides the default implementation of the show_message function, with a customised version that slides down with custom HTML, and slides up a few seconds later if it is not an error message:
$.adjax_callbacks.show_message = function(message) {
msg_content = jQuery('<div class="bar1"><p>'+message.content+'</p><a href="#" class="close">Close</a></div>');
msg_content.hide();
jQuery('#messages').prepend(msg_content);
msg_content.slideDown('slow');
if (message.level < 40) { msg_content.wait(2000).slideUp('slow') }
$('.bar1 .close').click(function() {$(this).closest('.bar1').remove();});
} | __label__pos | 0.972099 |
College Programs Courses
College Math Practice Tests
College Math Online Tests
Nature of roots of quadratic equation Multiple Choice Questions (MCQ) PDF Download
The Nature of roots of quadratic equation Multiple Choice Questions (MCQ Quiz) with Answers PDF (Nature of roots of quadratic equation MCQ PDF Download) e-Book to practice College Math Tests. Study Quadratic Equations Multiple Choice Questions and Answers (MCQs), Nature of roots of quadratic equation quiz answers PDF to learn online classes courses. The Nature of roots of quadratic equation MCQ App Download: Free learning app for remainder theorem, introduction to quadratic equations, nature of roots of quadratic equation, solution of a quadratic equations test prep to learn free online courses.
The MCQ: If roots of p² + qx + 1 = 0 are equal, then; "Nature of roots of quadratic equation" App Download (Free) with answers: Q² - 4p = 0; Q² + 4p = 0; P² - 4p = 0; P² + 4q = 0; to learn online classes courses. Practice Nature of roots of quadratic equation Quiz Questions, download Apple eBook (Free Sample) for online college classes.
Nature of roots of quadratic equation MCQs: Questions and Answers PDF Download
MCQ 1: If the roots of x² - 5x + a = 0 are equal, then a =
1. 25-May
2. ±25/4
3. 25-Apr
4. None of Above
MCQ 2: If the roots of p² + qx + 1 = 0 are equal, then
1. q² - 4p = 0
2. q² + 4p = 0
3. p² - 4p = 0
4. p² + 4q = 0
MCQ 3: The roots of the quadratic equation ax² + bx + c = 0 are rational and equal if
1. b² - 4ac = 0
2. b² - 4ac > 0
3. b² - 4ac < 0
4. None of Above
MCQ 4: If the roots 3² + kx + 12 = 0 are equal, then k =
1. ± 12
2. 12
3. −12
4. 0
MCQ 5: The roots of the quadratic equation x² - 6x + 10 = 0 are
1. equal
2. imaginary
3. irrational
4. real
College Math Practice Tests
Nature of roots of quadratic equation Learning App: Free Download Android & iOS
The App: Nature of roots of quadratic equation MCQs App to learn Nature of roots of quadratic equation Textbook, College Math MCQ App, and 7th Grade Math MCQ App. The "Nature of roots of quadratic equation MCQs" App to free download Android & iOS Apps includes complete analytics with interactive assessments. Download App Store & Play Store learning Apps & enjoy 100% functionality with subscriptions!
Nature of roots of quadratic equation App (Android & iOS)
Nature of roots of quadratic equation App (Android & iOS)
College Math App (Android & iOS)
College Math App (iOS & Android)
7th Grade Math App (Android & iOS)
7th Grade Math App (Android & iOS)
10th Grade Math App (Android & iOS)
10th Grade Math App (iOS & Android) | __label__pos | 0.999091 |
# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..30\n"; } END {print "not ok 1\n" unless $loaded;} use Cwd; use IPTables::IPv4::DBTarpit::Tools qw(inet_aton); $TPACKAGE = 'IPTables::IPv4::DBTarpit::Tools'; $loaded = 1; print "ok 1\n"; ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): $test = 2; umask 007; foreach my $dir (qw(tmp tmp.dbhome tmp.bogus)) { if (-d $dir) { # clean up previous test runs opendir(T,$dir); @_ = grep(!/^\./, readdir(T)); closedir T; foreach(@_) { unlink "$dir/$_"; } rmdir $dir or die "COULD NOT REMOVE $dir DIRECTORY\n"; } unlink $dir if -e $dir; # remove files of this name as well } sub ok { print "ok $test\n"; ++$test; } sub next_sec { my ($then) = @_; $then = time unless $then; my $now; # wait for epoch do { select(undef,undef,undef,0.1); $now = time } while ( $then >= $now ); $now; } ### database loader # takes one test cycle # # input: sw,db,\%hash # sub dbinsert { my($sw,$db,$hp) = @_; my $err; while(my($k,$v) = each %$hp) { if ($err = $sw->put($db,$k,$v)) { print "insert failure, database '$db'\nnot "; last; } } &ok; } ## database checker # takes 3 test cycles # # input: sw,db,\%hash,$txt # sub dbcheck { my($sw,$db,$hp,$txt) = @_; my($err,%copy); # dump database to %copy print "failed to dump '$db'\nnot " if $sw->dump($db,\%copy) || ! keys %copy; # parm $db removed from args &ok; # check keys my $x = keys %$hp; my $y = keys %copy; print "bad key count ans=$x, db=$y\nnot " if $x != $y; &ok; # check data content foreach(keys %copy) { if (!$txt && $hp->{$_} !~ /^$copy{$_}$/) { print "data mismatch in '$db'\nnot "; last; } elsif ( $txt && $hp->{$_} ne $copy{$_}) { print "data mismatch in '$db'\nnot "; last; } } &ok; } my $localdir = cwd(); my $dbhome = "$localdir/tmp.dbhome"; my %new = ( dbfile => ['tarpit'], txtfile => ['evidence'], dbhome => $dbhome, ); mkdir 'tmp',0755; ## test 2 - establish DB connections my $sw = eval { new $TPACKAGE(%new); }; print "failed to open db\nnot " if $@; &ok; ### ### preliminary's finished ### # get some spam my @spam; opendir(D,'spam.lib') or die "could not open 'spam.lib' for read\n"; @spam = grep(!/^\./, readdir(D)); closedir D; foreach(0..$#spam) { open(F,'spam.lib/'.$spam[$_]) or die "could not open 'spam.lib/$spam[$_]' for read\n"; $spam[$_] = ''; foreach my $line () { $spam[$_] .= $line; # slurp } close F; } ## test 3 my %evidence = ( inet_aton('0.0.0.1') => $spam[0], inet_aton('0.0.0.2') => $spam[2], inet_aton('0.0.0.3') => $spam[3], inet_aton('0.0.0.4') => $spam[4], ); my %tarpit = ( inet_aton('0.0.0.1') => 1, inet_aton('0.0.0.2') => 2, inet_aton('0.0.0.3') => 3, inet_aton('0.0.0.4') => 4, ); ## one test cycle, test 3 dbinsert($sw,'tarpit',\%tarpit); ## test 4 dbinsert($sw,'evidence',\%evidence); ## test 5-7 - verify tarpit data dbcheck($sw,'tarpit',\%tarpit); ## test 8-10 - verify evidence data dbcheck($sw,'evidence',\%evidence,1); ## test 11 - check non-existent data print "found non-existent data in 'tarpit'\nnot " if defined $sw->get('tarpit','none'); &ok; ## test 12 - check some real data print "failed to retrieve data '1' from 'tarpit'\nnot " unless $sw->get('tarpit',inet_aton('0.0.0.1')) =~ /^1$/; &ok; ## test 13-15 - verify database integrity dbcheck($sw,'tarpit',\%tarpit); ## test 16 - check dummy remove print "removed non-existent data in 'action'\nnot " if defined $sw->remove('tarpit',inet_aton('1.2.3.4')); &ok; ## test 17-19 - verify database integrity dbcheck($sw,'tarpit',\%tarpit); ## test 20 - remove record from tarpit delete $tarpit{inet_aton('0.0.0.2')}; $_ = $sw->remove('tarpit',inet_aton('0.0.0.2')); print "failed to delete record from 'tarpit'\nnot " unless defined $_ && ! $_; &ok; ## test 21-23 - verify tarpit database dbcheck($sw,'tarpit',\%tarpit); ## test 24 - attempt bogus remove from db print "removed non-existent data\nnot " if defined $sw->remove('tarpit',inet_aton('1.2.3.4')); &ok; ## test 25-27 - verify tarpit database dbcheck($sw,'tarpit',\%tarpit); ## test 28-30 - verify that evidence database is unchanged dbcheck($sw,'evidence',\%evidence,1); $sw->closedb(); | __label__pos | 0.935322 |
bugprone-redundant-branch-condition
Finds condition variables in nested if statements that were also checked in the outer if statement and were not changed.
Simple example:
bool onFire = isBurning();
if (onFire) {
if (onFire)
scream();
}
Here onFire is checked both in the outer if and the inner if statement without a possible change between the two checks. The check warns for this code and suggests removal of the second checking of variable onFire.
The checker also detects redundant condition checks if the condition variable is an operand of a logical “and” (&&) or a logical “or” (||) operator:
bool onFire = isBurning();
if (onFire) {
if (onFire && peopleInTheBuilding > 0)
scream();
}
bool onFire = isBurning();
if (onFire) {
if (onFire || isCollapsing())
scream();
}
In the first case (logical “and”) the suggested fix is to remove the redundant condition variable and keep the other side of the &&. In the second case (logical “or”) the whole if is removed similarly to the simple case on the top.
The condition of the outer if statement may also be a logical “and” (&&) expression:
bool onFire = isBurning();
if (onFire && fireFighters < 10) {
if (someOtherCondition()) {
if (onFire)
scream();
}
}
The error is also detected if both the outer statement is a logical “and” (&&) and the inner statement is a logical “and” (&&) or “or” (||). The inner if statement does not have to be a direct descendant of the outer one.
No error is detected if the condition variable may have been changed between the two checks:
bool onFire = isBurning();
if (onFire) {
tryToExtinguish(onFire);
if (onFire && peopleInTheBuilding > 0)
scream();
}
Every possible change is considered, thus if the condition variable is not a local variable of the function, it is a volatile or it has an alias (pointer or reference) then no warning is issued.
Known limitations
The else branch is not checked currently for negated condition variable:
bool onFire = isBurning();
if (onFire) {
scream();
} else {
if (!onFire) {
continueWork();
}
}
The checker currently only detects redundant checking of single condition variables. More complex expressions are not checked:
if (peopleInTheBuilding == 1) {
if (peopleInTheBuilding == 1) {
doSomething();
}
} | __label__pos | 0.999739 |
Arqade is a question and answer site for passionate videogamers on all platforms. Join them; it only takes a minute:
Sign up
Here's how it works:
1. Anybody can ask a question
2. Anybody can answer
3. The best answers are voted up and rise to the top
I am currently using Counter Strike 1.3 and there are more than 4 players playing. We get connected through the connect <<IP>> command, but while playing the game, sometimes the PC hangs (the one we are using as a server) and when this happens, all of the PCs hang as well.
I have tried to use another PC as the server but there is still no change - it still hangs.
Is there a solution to this problem?
share|improve this question
Is this question about Counter-Strike or Counter-Strike: Source? – Dave McClelland Jan 27 '12 at 13:03
I used to get these problems in my college when arranging CS 1.6 events. However, we got over these by making other PCs server or re-installing the game. This can happen due to a corrupted file too. Try re-installing the game and checking your graphics drivers and also the Hub/Switch which you use, make sure enough bandwidth is allocated in the configuration. Mostly this happens either due to a bad connection medium or hardware.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.755287 |
Properties
Label 4-10056-1.1-c1e2-0-0
Degree $4$
Conductor $10056$
Sign $-1$
Analytic cond. $0.641179$
Root an. cond. $0.894838$
Motivic weight $1$
Arithmetic yes
Rational yes
Primitive yes
Self-dual yes
Analytic rank $1$
Origins
Downloads
Learn more
Normalization:
Dirichlet series
L(s) = 1 − 2-s − 3-s − 4-s + 2·5-s + 6-s − 5·7-s + 3·8-s − 2·10-s − 11-s + 12-s − 6·13-s + 5·14-s − 2·15-s − 16-s + 3·17-s − 6·19-s − 2·20-s + 5·21-s + 22-s − 3·24-s − 4·25-s + 6·26-s + 4·27-s + 5·28-s + 4·29-s + 2·30-s − 8·31-s + ⋯
L(s) = 1 − 0.707·2-s − 0.577·3-s − 1/2·4-s + 0.894·5-s + 0.408·6-s − 1.88·7-s + 1.06·8-s − 0.632·10-s − 0.301·11-s + 0.288·12-s − 1.66·13-s + 1.33·14-s − 0.516·15-s − 1/4·16-s + 0.727·17-s − 1.37·19-s − 0.447·20-s + 1.09·21-s + 0.213·22-s − 0.612·24-s − 4/5·25-s + 1.17·26-s + 0.769·27-s + 0.944·28-s + 0.742·29-s + 0.365·30-s − 1.43·31-s + ⋯
Functional equation
\[\begin{aligned}\Lambda(s)=\mathstrut & 10056 ^{s/2} \, \Gamma_{\C}(s)^{2} \, L(s)\cr =\mathstrut & -\, \Lambda(2-s) \end{aligned}\]
\[\begin{aligned}\Lambda(s)=\mathstrut & 10056 ^{s/2} \, \Gamma_{\C}(s+1/2)^{2} \, L(s)\cr =\mathstrut & -\, \Lambda(1-s) \end{aligned}\]
Invariants
Degree: \(4\)
Conductor: \(10056\) = \(2^{3} \cdot 3 \cdot 419\)
Sign: $-1$
Analytic conductor: \(0.641179\)
Root analytic conductor: \(0.894838\)
Motivic weight: \(1\)
Rational: yes
Arithmetic: yes
Character: $\chi_{10056} (1, \cdot )$
Primitive: yes
Self-dual: yes
Analytic rank: \(1\)
Selberg data: \((4,\ 10056,\ (\ :1/2, 1/2),\ -1)\)
Particular Values
\(L(1)\) \(=\) \(0\)
\(L(\frac12)\) \(=\) \(0\)
\(L(\frac{3}{2})\) not available
\(L(1)\) not available
Euler product
\(L(s) = \displaystyle \prod_{p} F_p(p^{-s})^{-1} \)
$p$$\Gal(F_p)$$F_p(T)$
bad2$C_2$ \( 1 + T + p T^{2} \)
3$C_1$$\times$$C_2$ \( ( 1 - T )( 1 + 2 T + p T^{2} ) \)
419$C_1$$\times$$C_2$ \( ( 1 + T )( 1 + 20 T + p T^{2} ) \)
good5$D_{4}$ \( 1 - 2 T + 8 T^{2} - 2 p T^{3} + p^{2} T^{4} \)
7$C_2$$\times$$C_2$ \( ( 1 + p T^{2} )( 1 + 5 T + p T^{2} ) \)
11$D_{4}$ \( 1 + T - 6 T^{2} + p T^{3} + p^{2} T^{4} \)
13$C_2$$\times$$C_2$ \( ( 1 + p T^{2} )( 1 + 6 T + p T^{2} ) \)
17$D_{4}$ \( 1 - 3 T + 28 T^{2} - 3 p T^{3} + p^{2} T^{4} \)
19$D_{4}$ \( 1 + 6 T + 32 T^{2} + 6 p T^{3} + p^{2} T^{4} \)
23$C_2^2$ \( 1 + 38 T^{2} + p^{2} T^{4} \)
29$D_{4}$ \( 1 - 4 T + 48 T^{2} - 4 p T^{3} + p^{2} T^{4} \)
31$D_{4}$ \( 1 + 8 T + 70 T^{2} + 8 p T^{3} + p^{2} T^{4} \)
37$D_{4}$ \( 1 + T - 24 T^{2} + p T^{3} + p^{2} T^{4} \)
41$D_{4}$ \( 1 + 2 T - 46 T^{2} + 2 p T^{3} + p^{2} T^{4} \)
43$C_2$$\times$$C_2$ \( ( 1 - 5 T + p T^{2} )( 1 + 4 T + p T^{2} ) \)
47$D_{4}$ \( 1 - 4 T + 46 T^{2} - 4 p T^{3} + p^{2} T^{4} \)
53$D_{4}$ \( 1 + T + 12 T^{2} + p T^{3} + p^{2} T^{4} \)
59$D_{4}$ \( 1 + 6 T + 94 T^{2} + 6 p T^{3} + p^{2} T^{4} \)
61$C_2^2$ \( 1 + 46 T^{2} + p^{2} T^{4} \)
67$D_{4}$ \( 1 + 6 T + 68 T^{2} + 6 p T^{3} + p^{2} T^{4} \)
71$D_{4}$ \( 1 + 3 T - 26 T^{2} + 3 p T^{3} + p^{2} T^{4} \)
73$C_2^2$ \( 1 - 3 T - 64 T^{2} - 3 p T^{3} + p^{2} T^{4} \)
79$D_{4}$ \( 1 - T + 54 T^{2} - p T^{3} + p^{2} T^{4} \)
83$D_{4}$ \( 1 - 7 T + 50 T^{2} - 7 p T^{3} + p^{2} T^{4} \)
89$C_2^2$ \( 1 + 26 T^{2} + p^{2} T^{4} \)
97$D_{4}$ \( 1 + 3 T - 120 T^{2} + 3 p T^{3} + p^{2} T^{4} \)
show more
show less
\(L(s) = \displaystyle\prod_p \ \prod_{j=1}^{4} (1 - \alpha_{j,p}\, p^{-s})^{-1}\)
Imaginary part of the first few zeros on the critical line
−16.9221529890, −16.6457327236, −16.0575548591, −15.5592650392, −14.7949917622, −14.3371538918, −13.7936150994, −13.1999770747, −12.8447732949, −12.3791637204, −12.0051872293, −10.9118083646, −10.3774437183, −10.0745691727, −9.61858958358, −9.23133480024, −8.58936996280, −7.69512942194, −7.14785607019, −6.43414449648, −5.87342079481, −5.20327237273, −4.39691775739, −3.31113675149, −2.20975427653, 0, 2.20975427653, 3.31113675149, 4.39691775739, 5.20327237273, 5.87342079481, 6.43414449648, 7.14785607019, 7.69512942194, 8.58936996280, 9.23133480024, 9.61858958358, 10.0745691727, 10.3774437183, 10.9118083646, 12.0051872293, 12.3791637204, 12.8447732949, 13.1999770747, 13.7936150994, 14.3371538918, 14.7949917622, 15.5592650392, 16.0575548591, 16.6457327236, 16.9221529890
Graph of the $Z$-function along the critical line | __label__pos | 0.98544 |
/*LINTLIBRARY*/ #define NULL 0 #define EOF (-1) #define ERR(s, c) if(opterr){\ extern int strlen(), write();\ char errbuf[2];\ errbuf[0] = c; errbuf[1] = '\n';\ (void) write(2, argv[0], (unsigned)strlen(argv[0]));\ (void) write(2, s, (unsigned)strlen(s));\ (void) write(2, errbuf, 2);} extern int strcmp(); extern char *strchr(); int opterr = 1; int optind = 1; int optopt; char *optarg; int getopt(argc, argv, opts) int argc; char **argv, *opts; { static int sp = 1; register int c; register char *cp; if(sp == 1) if(optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return(EOF); else if(strcmp(argv[optind], "--") == NULL) { optind++; return(EOF); } optopt = c = argv[optind][sp]; if(c == ':' || (cp=strchr(opts, c)) == NULL) { ERR(": illegal option -- ", c); if(argv[optind][++sp] == '\0') { optind++; sp = 1; } return('?'); } if(*++cp == ':') { if(argv[optind][sp+1] != '\0') optarg = &argv[optind++][sp+1]; else if(++optind >= argc) { ERR(": option requires an argument -- ", c); sp = 1; return('?'); } else optarg = argv[optind++]; sp = 1; } else { if(argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = NULL; } return(c); } | __label__pos | 0.999846 |
Arjun Ajith Arjun Ajith - 5 months ago 9
JSON Question
how to access object inside an object Array which is inside another array in javascript?
I have an array as follows
[
[{"Id":"5","Color":"White"}],
[{"Id":"57","Color":"Blue"}],
[{"Id":"9","Color":"Brown"}]
]
each object is inside an array which is inside another array. I want to access an object item, let say 'Id' of first object ("Id":"5"). How can I do that?
Answer
If the array is assigned to a variable:
var a = [
[{"Id":"5","Color":"White"}],
[{"Id":"57","Color":"Blue"}],
[{"Id":"9","Color":"Brown"}]
];
You can do it like this:
a[0][0].Id;
or
a[0][0]["Id"];
To get the second object you would do:
a[1][0].Id;
or
a[1][0].["Id"]; | __label__pos | 0.999879 |
Live Coding #2: Building Powerful Games with DOTS by Unity
Publikováno v Offbeat
06. 5. 2019
autor
Anne-Laure Civeyrac
Tech Editor @ WTTJ
In this live coding session, Alexandre Nicaise, a Unity 3D developer working at Phaethon Games, explains how to use the Data-Oriented Tech Stack (DOTS) in Unity as a way of dealing with performance issues in games. To do this, he will show how to build a ground of 10,000 cubes using DOTS.
What is DOTS?
DOTS is a Data-Oriented Tech Stack of Unity composed of three elements: The entity-component-system (ECS), the jobs system, and the burst compiler.
This improves memory management when compared to object-oriented programming. For example, displaying a ground of 10,000 cubes takes 277 milliseconds normally on Unity, but only 41 milliseconds with DOTS.
Demonstration steps to build a ground of 10,000 cubes
1- Send a game object to a prefab
2- Create an empty game and convert it to an entity
3- Create a component to store the prefab
using System;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
[Serializable]
public struct SpawnerDemoData : IComponentData
{
// Add fields to your component here. Remember that:
//
// * A component itself is for storing data and doesn't 'do' anything.
//
// * To act on the data, you will need a System.
//
// * Data in a component must be blittable, which means a component can
// only contain fields which are primitive types or other blittable
// structs; they cannot contain references to classes.
//
// * You should focus on the data structure that makes the most sense
// for runtime use here. Authoring Components will be used for
// authoring the data in the Editor.
public Entity prefab;
public int Ecol;
public int Erow;
}
4- Create a proxy to add the component to the entity
using System.Collections.Generic;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
[DisallowMultipleComponent]
[RequiresEntityConversion]
public class SpawnerDemoProxy : MonoBehaviour, IConvertGameObjectToEntity, IDeclareReferencedPrefabs
{
// Add fields to your component here. Remember that:
//
// * The purpose of this class is to store data for authoring purposes - it is not for use while the game is
// running.
//
// * Traditional Unity serialization rules apply: fields must be public or marked with [SerializeField], and
// must be one of the supported types.
public GameObject prefab;
public int column;
public int row;
// Lets you convert the editor data representation to the entity optimal runtime representation
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
SpawnerDemoData data = new SpawnerDemoData
{
// The referenced prefab will be converted due to DeclareReferencedPrefabs.
// So here we simply map the game object to an entity reference to that prefab.
prefab = conversionSystem.GetPrimaryEntity(prefab),
Ecol = column,
Erow = row
};
dstManager.AddComponentData(entity, data);
}
// Referenced prefabs have to be declared so that the conversion system knows about them ahead of time
public void DeclareReferencedPrefabs(List<GameObject> referencedPrefabs)
{
referencedPrefabs.Add(prefab);
}
}
5- Create a system to spawn the entity
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Transforms;
using static Unity.Mathematics.math;
// JobComponentSystems can run on worker threads.
// However, creating and removing Entities can only be done on the main thread to prevent race conditions.
// The system uses an EntityCommandBuffer to defer tasks that can't be done inside the Job.
public class SpawnerDemoSystem : JobComponentSystem
{
// EndSimulationEntityCommandBufferSystem is used to create a command buffer which will then be played back
// when that barrier system executes.
// Though the instantiation command is recorded in the SpawnJob, it's not actually processed (or "played back")
// until the corresponding EntityCommandBufferSystem is updated.
EndSimulationEntityCommandBufferSystem _endSimulationEntityCommandBufferSystem;
protected override void OnCreateManager()
{
// Cache the EndSimulationEntityCommandBufferSystem in a field, so we don't have to create it every frame
_endSimulationEntityCommandBufferSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
}
// This declares a new kind of job, which is a unit of work to do.
// The job is declared as an IJobForEachWithEntity<LocalToWorld, SpawnerDemoData>,
// meaning it will process all entities in the world that have both
// LocalToWorld and SpawnerDemoData components. Change it to process the component
// types you want.
struct SpawnerDemoSystemJob : IJobForEachWithEntity<LocalToWorld, SpawnerDemoData>
{
// Add fields here that your job needs to do its work.
//A thread-safe command buffer that can buffer commands that affect entities and components for later playback.
public EntityCommandBuffer commandBuffer;
public void Execute(Entity entity, int index, ref LocalToWorld location, ref SpawnerDemoData data)
{
for (int x = 0; x < data.Ecol; x++)
{
for (int z = 0; z < data.Erow; z++)
{
//Create your entity from the prefab
Entity instance = commandBuffer.Instantiate(data.prefab);
//define the position
float3 pos = math.transform(location.Value, new float3(x, noise.cnoise(new float2(x,z) *0.21f), z));
//set the position in the world
commandBuffer.SetComponent(instance, new Translation() { Value = pos});
}
}
//Destroy the spawner entity
commandBuffer.DestroyEntity(entity);
}
}
protected override JobHandle OnUpdate(JobHandle inputDependencies)
{
//Instead of performing structural changes directly, a Job can add a command to an EntityCommandBuffer to perform such changes on the main thread after the Job has finished.
//Command buffers allow you to perform any, potentially costly, calculations on a worker thread, while queuing up the actual insertions and deletions for later.
// Schedule the job that will add Instantiate commands to the EntityCommandBuffer.
var job = new SpawnerDemoSystemJob()
{
commandBuffer = _endSimulationEntityCommandBufferSystem.CreateCommandBuffer() // instantiate the Buffer
}.ScheduleSingle(this, inputDependencies) ;
// SpawnJob runs in parallel with no sync point until the barrier system executes.
// When the barrier system executes we want to complete the SpawnJob and then play back the commands (Creating the entities and placing them).
// We need to tell the barrier system which job it needs to complete before it can play back the commands.
_endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(job);
return job;
}
}
The full project is available on GitHub.
This article is part of Behind the Code, the media for developers, by developers. Discover more articles and videos by visiting Behind the Code!
Want to contribute? Get published!
Follow us on Twitter to stay tuned!
Illustrations by WTTJ
Probíraná témata | __label__pos | 0.898747 |
Ogive (Cumulative Frequency Polygon)
Ogive graph tutorial
An ogive, also known as a cumulative frequency polygon, is a graph that shows how many data values lie above or below a certain value in a dataset.
To create an ogive, we use the cumulative frequencies in a frequency table. The way to find cumulative frequencies is to simply add the frequencies of each group that come before a certain value in a dataset.
Once we have a cumulative frequency table, we can create an ogive chart by charting the cumulative frequency points for each class interval and then connecting each of these points.
The following examples show how to create a cumulative frequency table from a raw set of data values as well as how to create an ogive graph using a cumulative frequency table.
Examples of Creating an Ogive Graph
Example 1
Create an ogive chart using the following set of data values:
3, 6, 7, 8, 12 ,13, 14, 14, 16, 22, 24, 26, 27, 33, 35, 37, 39, 40, 41, 47, 48, 49, 49, 49
Step 1: Create a frequency table
To create a frequency table, we need to decide on the class interval size, which is how wide the groups of data values will be. In this example, a class interval size of 10 seems reasonable. Next, we simply count how many data values fall into each interval:
Frequency table
Step 2: Find the cumulative frequency for each class interval
To find the cumulative frequency, we just add up each frequency going down the table. The first cumulative frequency is equal to itself, since we aren’t adding any other frequency to it, while the last cumulative frequency is equal to the total number of data values:
Cumulative frequency table
Step 3: Create an ogive chart.
To create an ogive chart, we simply need to place a dot at the ending value of each class interval that represents the cumulative frequency up to that point. In addition, we need to place a dot on the starting value of the first class interval at value y = 0. Lastly, we need to connect all the dots with a line:
Ogive chart
Example 2
Create an ogive chart using the following set of data values:
2, 3, 3, 4, 5, 7, 8, 8, 9, 10, 11, 12, 13, 14, 14, 15, 15, 15, 17, 19, 19, 21, 22
Step 1: Create a frequency table
To create a frequency table, we need to decide on the class interval size, which is how wide the groups of data values will be. In this example, a class interval size of 5 seems reasonable. Next, we simply count how many data values fall into each interval:
Frequency table for example ogive chart
Step 2: Find the cumulative frequency for each class interval
To find the cumulative frequency, we just add up each frequency going down the table. The first cumulative frequency is equal to itself, since we aren’t adding any other frequency to it, while the last cumulative frequency is equal to the total number of data values:
Cumulative frequency table for ogive chart
Step 3: Create an ogive chart.
To create an ogive chart, we simply need to place a dot at the ending value of each class interval that represents the cumulative frequency up to that point. In addition, we need to place a dot on the starting value of the first class interval at value y = 0. Lastly, we need to connect all the dots with a line:
Ogive example
How to Answer Questions Using an Ogive Graph
We can use ogive charts to answer interesting questions about data distributions.
Example 1
Consider the ogive chart below:
Ogive chart example
What percentage of values fall between 10 and 15?
The chart shows that a total of 10 values are less than 10 and 15 values are less than 15, so 15 – 10 = 5 values fall between 10 and 15.
How many values are greater than 15?
The chart shows that 15 values are less than 15 and that there are 24 total values (i.e. the maximum point on the y-axis). This means that 24 – 15 = 9 values are greater than 15.
How many values are greater than 10?
The chart shows that 10 values are less than 10 and that there are 24 total values. This means that 24 – 10 = 14 values are greater than 10.
Example 2
Consider the ogive chart below:
Ogive chart from cumulative frequency table
What is the minimum and maximum value in this dataset?
The minimum value in the dataset is 1 since this is where the ogive chart starts on the x-axis. The maximum value in the dataset is 10 since this is where the ogive chart ends on the x-axis.
How many values are greater than 7?
The chart shows that 15 values are less than 7 and that there are 24 total values (i.e. the maximum point on the y-axis). This means that 24 – 15 = 9 values are greater than 7.
How many values are between 2 and 7?
The chart shows that 5 values are less than 2 and 15 values are less than 7, so 15 – 5 = 10 values fall between 2 and 7.
How to Create an Ogive Graph in Excel
To create an ogive chart in Excel, simply follow the steps below:
Step 1: Type the values of your dataset into one column.
Type in the values of your dataset into one column in Excel. For this example, I choose to type the 24 values in my dataset in column A:
Ogive chart in Excel
Step 2: Choose your class interval size.
Decide on a class interval size. For this dataset, I choose a class interval size of 10. Next, I simply type in my class interval start and end values in columns C and D:
Ogive example in Microsoft Excel
Step 3: Find the frequencies and cumulative frequencies
Type the following formulas in columns F and G:
Ogive chart formula in Excel
For the dataset I’m working with in this example, these formulas will produce the following values:
Ogive chart frequency table in Excel
Step 4: Create the ogive chart
Copy and paste the class ending values in column I and the cumulative frequencies in column J:
Note: I also added a class end of “0” with a cumulative frequency of “0” to ensure the chart starts at zero.
Ogive in Excel
To create the ogive chart, highlight the data in columns I and J. Then, on the INSERT tab, in the Charts Group, click Scatter Chart, then click Scatter with Straight Lines and Markers:
Ogive in Excel
Once you click this, an ogive chart will automatically be generated:
Finished ogive chart in Excel
Feel free to modify the colors, chart title, axes titles, and axes labels to make the chart look however you would like.
Leave a Reply
Your email address will not be published. Required fields are marked * | __label__pos | 0.999495 |
An excercise to help a student to understand geometry better
an excercise to help a student to understand geometry better It's needed for tasks like following multi-step directions or solving a math problem in your head you can help your child improve this executive function by building some working memory as he gets better at a mom shares how she came to understand her adopted daughter's.
They use hands-on materials such as popsicle sticks to help the students understand tens and teacher-directed instruction generally yields better results math students need to become fluent with basic operations before they can talk about multiple methods for solving problems or. Improving math performance help students understand math concepts mastery of computation is balanced with problem solving, applying mathematics, and exercises increase in complexity with each lesson, affording sufficient time for students to. Learning math through problem solving one of our goals as teachers is to help students become better at solving problems this course will provide teachers an opportunity to deepen their understanding of topics and student learning in geometry and measurement and the problem solving. Hands-on activities drawing perpendicular lines deepen students' understanding and set square develops skills that will be useful ities to help students develop intuition about parallel 85-86 of primary math 5a 5 in exercise 92 on pages 240-241 of nem1, do problems 1b and parts b. Reading and understanding written math problems by: students will understand another good tool is to teach them to draw or model the problems provide manipulatives to help students visualize the problem. A great way to help students to understand the concept of angles is to give them a physical representation of the angle itself students have any number of technological tools that they can use to better understand quantitative concepts math help's trigonometry index.
How to help students understand high school geometry if you read the first part of this article, you can already see that the best measures to help students with high school geometry happen before high school. How exercise benefits the brain exercise creates the optimal environment and rhythmic patterns enhance learning and understanding students use gestures, actions we exercise to help our brains work better and learn better the brain is only as healthy as the body that carries it. Ipracticemath provides free online math practice, help and worksheets try our math problem for 4th,5th,6th,7th,8th,9th grade. Why do americans stink at math by elizabeth green july 23, 2014 who can use them to help a student understand how multiplication actually works for example guiding the student through the exercise.
Health education curricula and instruction help students learn skills they will one study showed that reading and math scores of third and fourth grade students healthy students learn better numerous studies have shown that healthier students tend to do better in school they. Use student's writing exercise as material for this activity 4 of 22 this activity is designed to help students understand gender roles and expectations that are learned in for a math connection, have students create graphs of a variety of occupations to show. Reading comprehension and making predictions this exercise helps students understand how much information you can obtain from being observant and looking at everything in the picture how context clues can help students with dyslexia. 12 fascinating ways to use drama in the curriculum by: loriana romano, lisa papa, and elita in connection to the ways in which integrating drama can help students learn mime exercises mime exercises help further develop oral expression and self-esteem.
Basic graphing skills or skills we should have then others can use that equation to understand the system, too, because math is a universal a number of the activities posted on the quantitative skills in the geosciences site are designed to help students learn about graphing in a. Reading and writing in the mathematics classroom mark freitag reading are valued, will most likely understand math-ematical text better and take more from it than would a to students as well as exercises and problems so that.
An excercise to help a student to understand geometry better
Teaching for understanding: ongoing assessment understanding goalto help students understand the process of writing an effective persuasive essay in a math class: understanding goals:to help students understand percentages and their. Differentiating the lesson ancillary begins with an overview outlining the help teachers guide students to better understanding laurie's notes provides a kind of critical thinking problems that help students develop a deeper understanding.
It is much better and rewarding in the long-run to focus on understanding the process and logic that is involved this will help you understand how you should approach a free learning platform for creating, sharing & discovering learning resources that help students and teachers achieve. Improving sentence structure is an important skill for students to learn designed to help students improve their writing skills, regardless of academic grade or proficiency level helps esl students develop a better understanding of the english language. A dyslexic child in the classroom a dyslexic child in the classroom a guide for teachers and parents more and more children and adults are needing help in learning to read class teachers need to have an understanding of the problems that the dyslexic child may have within the. What will i do to help students practice and deepen their understanding of new knowledge they note that students' understanding of mathematics content is particularly susceptible to bugs the practice exercise requires students to use the first step only in the overall procedure. Understanding number sense understanding number sense— it's importance and research-based teaching that improve it using math talk to help students learn however traditional textbook rounding exercises don't provide the necessary context for students to understand estimating. Teaching geometry according to the common core standards h wu c hung-hsi wu 2013 january 1 is hoped that this document will promote a better understanding of the practice isting materials that treat school geometry as an exercise in learning new vocabulary. Do hands-on activities increase student understanding: a case study that would help our students develop an understanding of important students actively involved in data collection and analysis who developed a better understanding of various statistics concepts (eg.
8 ways to help students understand math better may 23, 2017 cuemath teachers use the cuestudent app to help students build their aptitude with the vast number of delightful games and exercises on it. It seems that instead of attempting to explain how to develop a mindset for math i use the example of elevation for my math students as i had a stroke some years back and know my brain has heald is there any books that could help me get a better understanding on how numbers realy work. Did you know you can actually train your brain to retain information better see the 7 reasons why you have trouble remembering what you learn and 15 memory improvement strategies that will help increase in physics, you must have a solid understanding of math additionally, do not waste. 'how can i help this student learn better a third strategy to understand your students is to look at their past school records or iep for example if a student received an a in math, but a lower grade in english.
an excercise to help a student to understand geometry better It's needed for tasks like following multi-step directions or solving a math problem in your head you can help your child improve this executive function by building some working memory as he gets better at a mom shares how she came to understand her adopted daughter's. an excercise to help a student to understand geometry better It's needed for tasks like following multi-step directions or solving a math problem in your head you can help your child improve this executive function by building some working memory as he gets better at a mom shares how she came to understand her adopted daughter's.
An excercise to help a student to understand geometry better
Rated 3/5 based on 50 review
Similar articles to an excercise to help a student to understand geometry better
2018. | __label__pos | 0.998814 |
Skip to Content
Reply to comment
Notificaciones growl en cakephp 1.2
Growl es un sitema de notificacion no intrusivo y visual que interactua con los mensajes de sistema, avisandonos de cualquier evento que ocurra con la mayoria de nuestros programas favoritos.
Tambien existen implementaciones web para nuestras aplicaciones como el plugin en jquery llamado proyecto jgrowl:
Podemos usar jgrow dentro de cackephp de la siguiente forma: Descargamos el plugin jgrowl http://stanlemon.net/projects/jgrowl.html. Copiamos los archivos que vienen en el paquete en los siguientes directorios de nuestra aplicacion hecha en cakephp:
• jquery.jgrowl.css --> [directorio raiz de la aplicacion]/app/webroot/css
• jquery.jgrowl.js --> [directorio raiz de la aplicacion]/app/webroot/js
• jquery-1.3.2.js --> [directorio raiz de la aplicacion]/app/webroot/js
Se modifican los headers de los layouts de nuestra aplicacion para usar estos archivos: [directorio raiz de la aplicacion]/app/views/layouts/default.ctp
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>
5 <?php __('Titulo'); ?>
6 <?php echo $title_for_layout;?>
7 </title>
8
9 <?php echo $html->charset('utf-8');?>
10 <link rel="icon" href="<?php echo $this->webroot;?>favicon.ico" type="image/x-icon" />
11 <link rel="shortcut icon" href="<?php echo $this->webroot;?>favicon.ico" type="image/x-icon" />
12 <?php echo $html->css('site');?>
13 <?php echo $html->css('jquery.jgrowl');?>
14 <?php echo $javascript->link(array('jquery-1.3.2.js','jquery.jgrowl.js')); ?>
15 <?php echo $scripts_for_layout;?>
16 <!-- Javascript includes-->
17 </head>
18 <body>
19 <div id="container">
20 <div id="header">
21 <?php echo $this->element('header'); ?>
22 </div>
23 <div id="content-left">
24 <div id='message'>
25 <?php
26 if ($session->check('Message.flash')):
27 $session->flash();
28 endif;
29 ?>
30 </div>
31
32 <?php echo $content_for_layout;?>
33
34 </div>
35 <div id="footer">
36 <?php echo $this->element('footer'); ?>
37 </div>
38 </div>
39 </body>
40 </html>
Tambien añadimos el archivo growl.ctp como una plantilla en el mismo directorio. [directorio raiz de la aplicacion]/app/views/layouts/growl.ctp Con el siguiente contenido:
1 <script type="text/javascript">
2 <?php if (isset($type) && $type == 'important') : ?>
3 var settings = {header:"Importante :", glue:'before' };
4 <?php elseif (isset($type) && $type == 'error') : ?>
5 var settings = {header:"Error :",sticky:true };
6 <?php else : ?>
7 var settings = {};
8 <?php endif ?>
9 jQuery.jGrowl("<?php echo $content_for_layout; ?>", settings);
10 </script>
Que es la plantilla para cada tipo de notificacion, si es del tipo error o del tipo important, estos parametros de configuracion se pueden cambiar de acuerdo a la documentacion de jgrowl.
Es necesario hacer la llamada a Javascrit dentro los helpers y asi poder usar ajax en todos los controladores. [directorio raiz de la aplicacion]/app/app_controller.php
1 <?php
2 class AppController extends Controller {
3
4 var $helpers = array('Html','Form','Javascript');
5 ....
6
7 }
8 ?>
Ahora como ejemplo se usa el jgrowl dentro de el metodo logout dentro de un user controller en los setFlash habituales de cakephp agregando el argumento growl que es el la plantilla ya mencionada.
1 <?php
2 class UsersController extends AppController {
3
4 ...
5
6 /**
7 * Metodo que usa el logout del Auth component
8 * */
9 function logout() {
10 $this->Session->setFlash('Se ha desconectado correctamente', 'growl');
11 $this->redirect($this->Auth->logout());
12 }
13 ...
14 }
15 ?>
En este ejemplo se uso los mensajes de autenticacion de logueo y deslogueo del componmente Auth de Cakephp 1.2, si terminamos sesion usando el metodo logout de user controller finalmente tendremos el mensaje de notifiacion al igual que growl:
Reply
CAPTCHA
Esta pregunta se hace para comprobar que es usted una persona real e impedir el envío automatizado de mensajes basura.
CAPTCHA de imagen
Enter the characters shown in the image. | __label__pos | 0.673513 |
maol
musings and one liners
Splunk Makes Machine-Generated Big Data Serve Analytics
David Menninger writes a nice intro to Splunk in Splunk Makes Machine-Generated Big Data Serve Analytics:
Splunk focuses on a specific segment of the big-data market: machine-generated data. This type of data originates constantly from many sources throughout an organization and in large quantities. The other common characteristic of machine-generated data is that generally it is less structured than data in typical relational databases. Often the information is captured as logs consisting of text files containing various record lengths and record structures. To effectively utilize this loosely structured information in real time, two challenges must be overcome: loading the data quickly and easily navigating through and analyzing the information once it is loaded.
Posted
in
by | __label__pos | 0.657243 |
Purchase Solution
Using cross products to find orthogonal vectors and areas
Not what you're looking for?
Ask Custom Question
Find a vector orthogonal to the plane through the points P, Q, and R and find the area of the triangle PQR.
P(1,0,0) Q(0,2,0) R(0,0,3)
Purchase this Solution
Solution Summary
One use of cross products is to find the area of triangles in 3D space. The solution comprises one example of this application.
Solution Preview
To find a vector orthogonal to the plane, first find any two direction vectors in the plane, then take their cross product:
The vector ...
Purchase this Solution
Free BrainMass Quizzes
Exponential Expressions
In this quiz, you will have a chance to practice basic terminology of exponential expressions and how to evaluate them.
Solving quadratic inequalities
This quiz test you on how well you are familiar with solving quadratic inequalities.
Multiplying Complex Numbers
This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.
Geometry - Real Life Application Problems
Understanding of how geometry applies to in real-world contexts
Graphs and Functions
This quiz helps you easily identify a function and test your understanding of ranges, domains , function inverses and transformations. | __label__pos | 0.814022 |
Resolved viewDidLoad called in background issue
Discussion in 'iOS Programming' started by nickculbertson, Nov 14, 2011.
1. nickculbertson, Nov 14, 2011
Last edited: Nov 14, 2011
nickculbertson macrumors regular
nickculbertson
Joined:
Nov 19, 2010
Location:
Nashville, TN
#1
Hi,
I have a view based application in which the viewDidLoad method of my initial view controller (FirstViewController) is being called while the other view is being shown. The reason this is an issue is because I am playing music in the viewDidLoad of my first view and it reloads randomly as I'm in my second view (GameViewController).
Code:
// in my FirstViewController.m
-(IBAction) press1{
[theAudio stop];
GameViewController *views = [[GameViewController alloc] initWithNibName:Nil bundle:nil];
[self presentModalViewController:views animated:YES];
}
- (void)viewDidLoad {
NSString *path = [[NSBundle mainBundle] pathForResource:@"Song1" ofType:@"wav"];
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
I've tried playing the sound on launch from the app delegate but I want to be able to control the AVAudioPlayer variable from my FirstViewController.h since it is playing the first track of a playlist.
Any thoughts?
Thanks,
Nick
Edit: I put the code in - (void) awakeFromNib { } and that did the trick
2. North Bronson macrumors 6502
Joined:
Oct 31, 2007
Location:
San José
#2
Why would your FirstViewController randomly be loading its view when it is not preparing to display? Why would something that happens when GameViewController is visible cause FirstViewController to need to load its view?
Share This Page | __label__pos | 0.962419 |
Skip to main content
Adobe Photoshop Family
2 Messages
•
80 Points
Tue, Mar 4, 2014 12:50 AM
PHOTOSHOP: Shouldn't my image look the same between a PSD and a JPEG?
Dear Adobe,
Is it really that difficult to make it so an image will look like it did before flattening or merging or rasterizing layer effects and blending options? i.e. color overlay and bevel/emboss disappear completely when formatting image for print. This just seems like a pretty necessary feature and it takes so much more work to print my designs without it. Or am I just doing something wrong? Please help me out here.
Responses
15.1K Messages
•
195.8K Points
7 years ago
It sounds like you are doing something wrong, somewhere.
For everyone else, the flattened image looks the same.
If your image is really noisy (or B&W like a halftone), you may need to zoom in to 100% to judge the effect of your adjustments/filters/effects.
2 Messages
•
80 Points
7 years ago
I have seen this problem from other people several times. My image has no noise or halftones. The problem is that the "layer style" of the layer loses several aspects when I rasterize the layer style. Text that is embossed with a color overlay goes flat and reverts to the original color when the style is rasterized. So how do you think I can fix this?
Before and After
This doesn't always occur, but it happens enough to cause problems.
15.1K Messages
•
195.8K Points
So far, every time we have heard about this "problem", it has been a case of someone being zoomed out on noisy or binary images. And that does look like a noisy texture under your effects.
If you want to send me a file to take a look at, I can. | __label__pos | 0.835074 |
Expand Authors Top
If you have a few years of experience in the Java ecosystem and you’d like to share that with the community, have a look at our Contribution Guidelines.
November Discount Launch 2022 – Top
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:
>> GET ACCESS NOW
November Discount Launch 2022 – TEMP TOP (NPI)
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:
>> GET ACCESS NOW
Expanded Audience – Frontegg – Security (partner)
announcement - icon User management is very complex, when implemented properly. No surprise here.
Not having to roll all of that out manually, but instead integrating a mature, fully-fledged solution - yeah, that makes a lot of sense.
That's basically what Frontegg is - User Management for your application. It's focused on making your app scalable, secure and enjoyable for your users.
From signup to authentication, it supports simple scenarios all the way to complex and custom application logic.
Have a look:
>> Elegant User Management, Tailor-made for B2B SaaS
1. Introduction
In the tutorial Java Bean Validation Basics, we saw how to apply basic javax validation to various types, and in this tutorial, we'll focus on using javax validation with BigDecimal.
2. Validating BigDecimal Instances
Unfortunately, with BigDecimal, we can't use the classic @Min or @Max javax annotations.
Luckily, we have a dedicated set of annotations for working with them:
• @DecimalMin
• @Digits
• @DecimalMax
BigDecimal is the first choice for financial calculation because of its high precision.
Let's see our Invoice class, which has a field of type BigDecimal:
public class Invoice {
@DecimalMin(value = "0.0", inclusive = false)
@Digits(integer=3, fraction=2)
private BigDecimal price;
private String description;
public Invoice(BigDecimal price, String description) {
this.price = price;
this.description = description;
}
}
2.1. @DecimalMin
The annotated element must be a number whose value is greater than or equal to the specified minimum. @DecimalMin has an attribute inclusive that indicates whether the specified minimum value is inclusive or exclusive.
2.2. @DecimalMax
@DecimalMax is the counterpart of @DecimalMin. The annotated element must be a number whose value is lower or equal to the specified maximum. @DecimalMax has an inclusive attribute that specifies whether the specified maximum value is inclusive or exclusive.
Also, @Min and @Max accept long values only. In @DecimalMin and @DecimalMax, we can specify the value in string format, which can be of any numeric type.
2.3. @Digits
In many cases, we need to validate the number of digits in the integral part and fraction part of a decimal number.
The @Digit annotation has two attributes, integer and fraction, for specifying the number of allowed digits in the integral part and fraction part of the number.
As per the official documentation, integer allows us to specify the maximum number of integral digits accepted for this number.
Similarly, the fraction attribute allows us to specify the maximum number of fractional digits accepted for this number.
2.4. Test Cases
Let's see these annotations in action.
First, we'll add a test that creates an Invoice with an invalid price according to our validation, and checks that the validation will fail:
public class InvoiceUnitTest {
private static Validator validator;
@BeforeClass
public static void setupValidatorInstance() {
validator = Validation.buildDefaultValidatorFactory().getValidator();
}
@Test
public void whenMoreThanThreeIntegerDigits_thenShouldGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("1021.21"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).hasSize(1);
assertThat(violations)
.extracting("message")
.containsOnly("numeric value out of bounds (<3 digits>.<2 digits> expected)");
}
}
Now let's check the validation with the correct price:
@Test
public void whenLessThanThreeIntegerDigits_thenShouldNotGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("10.21"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).isEmpty();
}
In a similar way, let's see how validation works for the fractional part:
@Test
public void whenTwoFractionDigits_thenShouldNotGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("99.99"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).isEmpty();
}
@Test
public void whenMoreThanTwoFractionDigits_thenShouldGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("99.999"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).hasSize(1);
assertThat(violations)
.extracting("message")
.containsOnly("numeric value out of bounds (<3 digits>.<2 digits> expected)");
}
A price equal to 0.00 should violate our constraint:
@Test
public void whenPriceIsZero_thenShouldGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("0.00"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).hasSize(1);
assertThat(violations)
.extracting("message")
.containsOnly("must be greater than 0.0");
}
Finally, let's see the case with a price greater than zero:
@Test
public void whenPriceIsGreaterThanZero_thenShouldNotGiveConstraintViolations() {
Invoice invoice = new Invoice(new BigDecimal("100.50"), "Book purchased");
Set<ConstraintViolation<Invoice>> violations = validator.validate(invoice);
assertThat(violations).isEmpty();
}
3. Conclusion
In this article, we saw how to use javax validation for BigDecimal.
All code snippets can be found over on GitHub.
November Discount Launch 2022 – Bottom
We’re finally running a Black Friday launch. All Courses are 30% off until next Friday:
>> GET ACCESS NOW
Generic footer banner
Comments are closed on this article! | __label__pos | 0.865237 |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
US-CERT Cyber Security Tip ST04-018 -- Understanding Digital Signatures
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Cyber Security Tip ST04-018
Understanding Digital Signatures
Digital signatures are a way to verify that an email message is really from
the person who supposedly sent it and that it hasn't been changed.
What is a digital signature?
There are different types of digital signatures; this tip focuses on digital
signatures for email messages. You may have received emails that have a
block of letters and numbers at the bottom of the message. Although it may
look like useless text or some kind of error, this information is actually a
digital signature. To generate a signature, a mathematical algorithm is used
to combine the information in a key with the information in the message. The
result is a random-looking string of letters and numbers.
Why would you use one?
Because it is so easy for attackers and viruses to "spoof" email addresses
(see Using Caution with Email Attachments for more information), it is
sometimes difficult to identify legitimate messages. Authenticity may be
especially important for business correspondenceâ??if you are relying on
someone to provide or verify information, you want to be sure that the
information is coming from the correct source. A signed message also
indicates that changes have not been made to the content since it was sent;
any changes would cause the signature to break.
How does it work?
Before you can understand how a digital signature works, there are some
terms you should know:
* Keys - Keys are used to create digital signatures. For every signature,
there is a public key and a private key.
+ Private key - The private key is the portion of the key you use to
actually sign an email message. The private key is protected by a
password, and you should never give your private key to anyone.
+ Public key - The public key is the portion of the key that is
available to other people. Whether you upload it to a public key
ring or send it to someone, this is the key other people can use to
check your signature. A list of other people who have signed your
key is also included with your public key. You will only be able to
see their identities if you already have their public keys on your
key ring.
* Key ring - A key ring contains public keys. You have a key ring that
contains the keys of people who have sent you their keys or whose keys
you have gotten from a public key server. A public key server contains
keys of people who have chosen to upload their keys.
* Fingerprint - When confirming a key, you will actually be confirming the
unique series of letters and numbers that comprise the fingerprint of
the key. The fingerprint is a different series of letters and numbers
than the chunk of information that appears at the bottom of a signed
email message.
* Key certificates - When you select a key on a key ring, you will usually
see the key certificate, which contains information about the key, such
as the key owner, the date the key was created, and the date the key
will expire.
* "Web of trust" - When someone signs your key, they are confirming that
the key actually belongs to you. The more signatures you collect, the
stronger your key becomes. If someone sees that your key has been signed
by other people that he or she trusts, he or she is more inclined to
trust your key. Note: Just because someone else has trusted a key or you
find it on a public key ring does not mean you should automatically
trust it. You should always verify the fingerprint yourself.
The process for creating, obtaining, and using keys is fairly
straightforward:
1. Generate a key using software such as PGP, which stands for Pretty Good
Privacy, or GnuPG, which stands for GNU Privacy Guard.
2. Increase the authenticity of your key by having your key signed by
co-workers or other associates who also have keys. In the process of
signing your key, they will confirm that the fingerprint on the key you
sent them belongs to you. By doing this, they verify your identity and
indicate trust in your key.
3. Upload your signed key to a public key ring so that if someone gets a
message with your signature, they can verify the digital signature.
4. Digitally sign your outgoing email messages. Most email clients have a
feature to easily add your digital signature to your message.
There are a variety of mechanisms for creating digital signatures, and these
mechanisms may operate differently. For example, S/MIME does not add a
visible block of letters and numbers within the message, and its digital
signatures are verified indirectly using a certificate authority instead of
directly with other users in a web of trust. You may just see an icon or
note on the message that the signature has been verified. If you get an
error about a digital signature, try to contact the sender through a phone
call or a separate email address that you know is valid to verify the
authenticity of the message.
_________________________________________________________________
Authors: Mindi McDowell, Allen Householder
_________________________________________________________________
Produced 2004 by US-CERT, a government organization.
Note: This tip was previously published and is being re-distributed to
increase awareness.
Terms of use
http://www.us-cert.gov/legal.html
This document can also be found at
http://www.us-cert.gov/cas/tips/ST04-018.html
For instructions on subscribing to or unsubscribing from this mailing
list, visit
http://www.us-cert.gov/cas/signup.html.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iQEVAwUBSyqeo9ucaIvSvh1ZAQJjUAf+KaZctYFgsBDN0zFpel5eLDLIPFnChEyO
XWTPa/5Mmw+8AvyNffFUMB93ouSNwfTyii456sy5jGyF6ddj5BJeWHhEUnrgegP3
EqLkRuGTTzBieokh+y8AN+4QUDQr2U+yXKXri/dkFariwUO2wCV6mZLiR1yOnCtW
67aZH+YNY9AcMcSchztRCisIueQL7ge1R3ZB72Qaqup3w1zhjLRuAX+UoI7nB8dw
Po0Z75TV3hO1FQ2I2v2428uDYva29S4JspJv5S/sMGj1t3iS5pfWbHZfPDGWzdqE
miHZuXnFvUma1afUW+f0ujdrgJ7V0jIQjQi7tHk2uW4t/AZ4zButaA==
=lGai
-----END PGP SIGNATURE-----
[Fedora Announce] [Linux Crypto] [Kernel] [Netfilter] [Video for Linux] [Bugtraq] [USB] [Fedora Security]
Add to Google Powered by Linux | __label__pos | 0.574891 |
Python | sympy.as_terms() method
With the help of sympy.as_terms() method, we can get the mathematical expression as a list of terms by using sympy.as_terms() method.
Syntax : sympy.as_terms()
Return : Return list of terms that are in mathematical expression.
Example #1 :
In this example we can see that by using sympy.as_terms() method, we are able to get the terms of mathematical expression in a list.
filter_none
edit
close
play_arrow
link
brightness_4
code
# import sympy
from sympy import *
x, y = symbols('x y')
# Use sympy.as_terms() method
gfg = (x**2 + 2 * x*y + y**2).as_terms()
print(gfg)
chevron_right
Output :
([(x**2, ((1.0, 0.0), (2, 0), ())), (y**2, ((1.0, 0.0), (0, 2), ())), (2*x*y, ((2.0, 0.0), (1, 1), ()))], [x, y])
Example #2 :
filter_none
edit
close
play_arrow
link
brightness_4
code
# import sympy
from sympy import *
x, y = symbols('x y')
# Use sympy.as_terms() method
gfg = (y + x).as_terms()
print(gfg)
chevron_right
Output :
([(x, ((1.0, 0.0), (1, 0), ())), (y, ((1.0, 0.0), (0, 1), ()))], [x, y])
My Personal Notes arrow_drop_up
Check out this Author's contributed articles.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Article Tags :
Be the First to upvote.
Please write to us at [email protected] to report any issue with the above content. | __label__pos | 0.993941 |
Home » How to Improve Your Website with Latest 2023 Technique
Web Dev
How to Improve Your Website with Latest 2023 Technique
How to Improve Your Website with Latest 2023 Technique
How to Improve Your Website with Latest 2023 Technique
Introduction
Websites are essential marketing tools that help you reach a wider audience and create a better user experience. To stay competitive, it is important to ensure that your website is up-to-date with the latest techniques and strategies to improve its performance in 2023. In this blog, we will discuss the benefits of improving your website, identify weaknesses, and provide the latest 2023 techniques and strategies to help enhance your website’s performance. We’ll also provide step-by-step instructions on how to implement these techniques and strategies to improve your website.
Benefits of Improving Your Website
Having a well-maintained website is essential in today’s digital world. Improving your website can have a wide variety of benefits, including increasing your visibility to potential customers, helping to build trust in your business, and providing an efficient way to share information with your customers. Having a website that is properly optimized for search engine results can also be a great way to increase traffic to your website, helping to expand your customer base. Additionally, improving the design of your website can help make it easier for customers to navigate and use, resulting in a better user experience. Finally, staying up-to-date with the latest web technologies can help ensure that your website is secure and reliable, giving customers peace of mind when they use it. Taking the time to improve your website can help take your business to the next level.
Identifying Weaknesses in Your Website
Having a website that is well-designed and optimized can help you build your business. To ensure that your website is doing its job, it is important to identify any weaknesses that might be affecting its performance. Identifying weaknesses in your website can help you improve its quality, increase user engagement and ultimately increase your revenues.
5 Crucial Things You Need to Know To Get A Head Start On Building Scalable Websites
To begin identifying weaknesses in your website, start by reviewing the design, content and functionality of the website. Ask yourself if the design is visually appealing, if the content is up-to-date and relevant, and if the website is easy to navigate and use. Additionally, look for any broken links, slow load times and other technical issues that might be hindering user experience.
Once you have identified any weaknesses in your website, you can begin to make improvements. Updating content, redesigning elements, and testing the website are all ways to improve your website’s performance. Additionally, optimizing images, utilizing SEO best practices, and improving the website’s navigation structure can all help you get the most out of your website.
Identifying weaknesses in your website is an important part of running an effective business. By taking the time to review and improve your website, you can ensure that your website is performing at its best and helping you build a successful business.
Latest Techniques for Improving Your Website in 2023
As the digital landscape continues to evolve, it is important for businesses to keep up with the latest techniques for improving their websites in order to remain competitive. In 2023, there are several strategies that can be used to optimize website performance and provide a better user experience. Firstly, leveraging modern web design technologies, such as HTML5, CSS3, and JavaScript, is essential for creating a responsive and intuitive interface. Additionally, incorporating mobile-friendly design techniques helps ensure that users can access the website on any device. Furthermore, optimizing content for SEO will help to increase visibility and drive more traffic to the website. Finally, taking advantage of web analytics tools can help to identify opportunities for improvement and measure the effectiveness of changes. By utilizing these techniques, businesses can ensure that their websites remain up-to-date and provide a positive user experience.
Building Your Personal Brand: A Guide to Branding Your Freelancer Website
Strategies for Enhancing Your Website Performance
Optimizing website performance is key to ensuring your website visitors have a smooth and enjoyable experience. There are a variety of strategies that can be implemented to improve the performance of your website. To start, you should make sure your website is running on reliable and up-to-date hosting to ensure the highest levels of performance. Additionally, optimizing images, minifying code, and reducing HTTP requests can help decrease loading times. Rendering content dynamically can also improve website performance, as the website only needs to load content that is requested. Finally, leveraging browser caching can improve website performance by reducing the amount of information that is sent between the server and the browser. Implementing these strategies can help improve the performance of your website, creating a better experience for your visitors.
Steps for Implementing the 2023 Techniques to Improve Your Website
The world of website design is constantly evolving, and it’s essential to stay up to date with the latest techniques if you want to keep your website competitive. Implementing the 2023 techniques for improving your website is a great way to ensure that your website is best-in-class. Here are the steps you can take to implement these techniques:
10 Tips for Crafting an Unforgettable Tagline
1. Review the trends for website design in 2023. Research best practices in website design and make sure you are up-to-date with the latest techniques.
2. Evaluate your existing website design. Take a look at your current website layout and design to see if they meet the standards of the 2023 techniques.
3. Make a list of all the changes you need to make. Once you have a good understanding of the 2023 techniques, you can make a list of the changes you need to make to your website to ensure that it is up-to-date.
4. Implement the changes. Once you have a list of the changes you need to make, start taking action to implement them. This could involve anything from changing the layout of your website to adding new features or content.
5. Test your website. After making all of the changes, make sure to test your website to ensure that everything is functioning properly.
By following these steps, you can make sure that your website is up to date with the 2023 techniques and can remain competitive in the modern web landscape.
Conclusion
In conclusion, improving your website is beneficial and can have a positive impact on your business. Identifying weak areas in your website can help you to better understand what needs to be improved. By utilizing the latest techniques for improving your website in 2023, you can make sure that your website performs optimally. Utilizing strategies for enhancing your website performance and implementing the 2023 techniques can help you to achieve the desired outcomes. With these tips, you can easily improve your website and ensure that it is up-to-date and competitive.
About the author
Sobi Tech
Am Sobi From Mirpur Azad Kashmir, am the owner of iTechMagazine.com, sobitech, GlobalHealth Mag, eduqia, sobigraphics, blogging since 2012 & writes about Reviews, Laptops, traveling, fitness, web designer and developer, Computing, Blogging, SEO, Make money online & tech and much more, | __label__pos | 0.725503 |
History of complex numbers
In this course we’ll explore complex analysis, complex dynamics, and some applications of these topics this course provides an introduction to complex analysis, that is the theory of complex functions of a complex variable. The problem of complex numbers dates back to the 1st century, when heron of alexandria (about 75 ad) attempted to find the volume of a frustum of a pyramid, which required computing the square root of 81-144 (though negative numbers were not conceived in the hellenistic world. 2 development of the complex numbers in this chapter, we shall try to motivate how the structure of the complex number system developed we shall investigate this develop. Video created by wesleyan university for the course introduction to complex analysis we’ll begin this module by briefly learning about the history of complex numbers: when and why were they invented. The magic of complex numbers the notion of complex number is intimately related to the fundamental theorem 2 the magic of complex numbers 11 history of complex.
A complex number is a combination of a real number and an imaginary number a complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i is the imaginary number the earliest reference to a complex number appears in 50ad in egypt in the work of the. Use your imagination and complexity () and dive into the world of complex numbers add, subtract, multiply, & divide complex numbers plot them on the complex plane and convert between rectangular and polar forms. Sal explains how we obtain complex numbers by adding real numbers and imaginary numbers. Get information, facts, and pictures about complex numbers at encyclopediacom make research projects and school reports about complex numbers easy with credible articles from our free, online encyclopedia and dictionary. Any book on the history of mathematics will go into the details of this fascinating controversy bombelli’s investigations of complex numbers.
A popular story about the discovery of the complex numbers goes as follows once the formula for the solution of the cubic equation has been discovered its application to the equation $x^3=15x+4$ yields the answer $\sqrt[3]{2+\sqrt{-121}}+\sqrt[3]{2-\sqrt{-121}}. Complex numbers history: 1) complex numbers were rst introduced by g cardano (1501-1576) in his ars magna, chapter 37 (published 1545) as a tool for nding (real) roots of a cubic e-quation: x3 + ax+ b= 0 however, he had serious misgivings about such expressions (eg 5+ p 15) he referred to thinking about them as \mental torture. Imaginary number an imaginary number is a complex number that can be written as a real number multiplied by the imaginary unit i, which is defined by its property i2 = −1 the square of an imaginary number bi is −b2 for example, 5i is an imaginary number, and its square is −25.
The evolution of numbers negative numbers but the history of mathematics is all about people asking a complex number has a real part and an imaginary. Complex number: complex number,, number of the form x + yi, in which x and y are real numbers and i is the imaginary unit such that i2 = -1 see numerals and numeral. How it all began: a short history of complex numbers in the history of mathematics geronimo (or gerolamo) cardano (1501-1576) is considered as the creator of complex numbers. How can the answer be improved.
And finally, complex numbers came around when evolution of mathematics led to the unthinkable equation x² = -1 all in due course the. All three computer algebra programs: , and use complex number arithmetic in all computations, including graphics history of complex numbers complex numbers.
History of complex numbers
Why were complex numbers invented were they invented to explain a physical complex numbers help us study the flow of history of complex numbers. The ordered number pair (a,b) is equivalent to the complex number a+ ib that is, if b is zero, then (a,0) and a+i0 behave algebraically as the same real numbers if a is zero, then (0,b) and 0+ib behave algebraically as the same imaginary numbers. Internet resources for the history of complex numbers complex numbers laurie geller, math dept, university of north dakota, grand forks, nd.
• A short introductory chapter explains the number systems as we know it now, including the notion of algebraic, transcendental, and complex numbers and the cardinals and (transfinite) ordinals this is followed by a brief survey of the notation for numbers in ancient egypt, babylon, and greece, and of course the usual positional system that.
• This is an introduction to complex numbers it includes the mathematics and a little bit of history as well it is intended for a general audience the necessary background in a familiarity with ordinary real numbers (all positive.
• Complex numbers and the complex exponential 1 complex numbers the equation x2 + 1 = 0 has no solutions, because for any real number xthe square x 2is nonnegative, and so x + 1 can never be less than 1.
History the number i has its earliest roots in some of the work thus he termed it an “imaginary” number fully comprehend the complex number. Math 111 lab - history of complex numbers - download as word doc (doc / docx), pdf file (pdf), text file (txt) or read online. A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i is the imaginary unit (which satisfies the equation i2 = −1)[1] in this expression, a is called the real part of the complex number, and. The usual definition of complex numbers, either as ordered pairs ( a, b) of real numbers or as “numbers” of the form a + bi, does not give any indication of their long and tortuous evolution, which. Complex numbers: lesson 1 part 1 - a history - duration: 29:19 mike aben 10,765 views 29:19 fantastic quaternions - numberphile - duration: 12:25. Today complex numbers have such widespread practical use--from electrical engineering to aeronautics--that few people would expect the story behind their derivation to be filled with adventure and enigma in an imaginary tale, paul nahin tells the 2000-year-old history of one of mathematics' most.
history of complex numbers Complex numbers history: 1) complex numbers were rst introduced by g cardano (1501-1576) in his ars magna, chapter 37 (published 1545) as a. history of complex numbers Complex numbers history: 1) complex numbers were rst introduced by g cardano (1501-1576) in his ars magna, chapter 37 (published 1545) as a.
History of complex numbers
Rated 5/5 based on 46 review | __label__pos | 0.999597 |
Michelle_MOE
Scholar
How can I print out the status of outstanding items?
Jump to solution
I have a user that will need to be able to do a printout of the items that are outstanding and where they are in the workflow. We have a form that has a possible 8 signatures and the user will need to know where in the process the item is at so that she can give her boss an update on what forms are outstanding and at what process they are in the workflow. Is this possible?
0 Kudos
Reply
1 Reply
chaddavis
Contributor
Re: How can I print out the status of outstanding items?
Jump to solution
Why not just have a column in the list/library called Status or Stage, and then at each stage of the workflow, update that field. It would be a very quick way to identify where the workflow is at in the process.
0 Kudos
Reply | __label__pos | 0.999569 |
Resync delay and White Noise
I’m using a NUC running Roon Server + SoTM SMS200 ULTRA + CHORD QUTEST
There are 2 independent places to set Resync Buffer/Delay: in the Roon Server Device Settings and in the SMS200 RoonReady Settings. What is the difference between them ?
When starting a new album (not always switching formats), my setup sometimes (not consistently) plays very loud white noise. I set both values described above to 3 Sec. which is quite a lot but that seems to improve but not solve entirely. What could be the root problem ?
I have moved this to support as a more appropriate place for support.
Are you using HQPlayer?
I’m not using HQPlayer
I am upsampling in Roon DSP to the Max PCM Rate (768 Khz for Chord QUTEST)
I noticed that the white noise appears only when I start a new album manually using my wireless tablet and not when Roon Radio starts an album by itself after my album finishes
Also, the White Noise is very loud and the music still plays in the background
I asked the question because I too have had what you describe using a Chord Hugo TT, but using HQPlayer instead of Roon DSP, upsampled to the maximum for my DAC of 352.8 or 384khz. I was only getting the issue with HQPlayer 4.7.0, so I went back to 4.6.0 and have had no problems since. It seems to be a continuing issue with Chord DAC users without any definitive explanation of what is causing the problem, Roon, HQPlayer or Chord.
I’ve not had this problem using jRiver and upsampling to 768Khz
So it seems to me that the problem is in Roon DSP…
Any feedback from Roon Tech Support would be appreciated…
I’d send native resolution as the chord upsamples everything internally by default.
I do notice a difference in sound (for the better) when upsampling in Roon
You’re dead right Ged, but if you want to use Roon’s or HQPlayer’s filter sets without Chord DAC automatic upsampling kicking in, you have to send the maximum upsampled file to the DAC to bypass the main upsampling feature. I prefer the extensive range of filters available with HQPlayer over Roon DSP
Hello @Ori_Onn, are you able to reproduce this with the Qutest connected to a different PC? I spoke to the team about the issue and we’d like to narrow down the issue. Thanks! Also, we recommend using the resync delay in Roon.
Hello,
Unfortunately I do not have another PC that I could connect.
I also upgraded the NUC from 4GB to 8GB RAM thinking that there may be a performance issue but this problem persists
It seems that lowering the upsampling to 705.6Khz instead of the Max PCM of 768Khz eliminates the whitenoise problem
Could it be because in the SoTM sms200 Network Bridge the max rate for the QUTEST DAC is set at DoP DSD256 (although 705.6Khz is actually DSD512) ?
Hello @Ori_Onn, I ran your last few messages by our team for additional input. 705kHz should be DSD256, and your findings does help confirm that there’s likely an issue with one of those two devices communicating with the NUC.
I would say our next best option is to try these devices with another machine. Does anyone in your household have a device we could quickly test this with?
Hello
Switching to another machine would mean: installing another Roon Core, migrating the DB and the USB HDD attached. That’s quite a process and anyway if you’re pointing at my NUC as the problem then anyway it functions fine on all other applications so I’m not going to change it. Also, the processing speed indication in Roon shows above 2 even when I upsample to 768Khz so there does not seem to be a performance issue either. I can’t see how the NUC comm link over LAN which is asynchronous could be the issue either.
I believe there is a problem in the Roon DSP when upsampling not in multiples of 2. I guess other users use HQPlayer for upsampling and this may work better. Could you test upsampling from 44.1Khz to 768Khz in your lab ?
Hello @Ori_Onn,
What happens if you increase buffer to “0.20” seconds on sMS-200 WebUI Roon Ready settings?
-John
Hello John,
I changed the buffer in the sMS-200 to 0.2Sec and the upsampling to Max (768Khz).
The “whitenoise” phenomena still happens sometimes but inconsistently. It happens when switching tracks from a certain bitrate to another but there is no specific transition that causes it consistently and if a track starts well then it continues so.
The Resync Delay in Roon Device Setup is set to 2000ms. In the sMS-200 the Resync Delay is set to the minimum 0.05Sec since I’ve been advised by your support to only use the Roon Resync Delay.
Any suggestions ?
-Ori
Hello @Ori_Onn,
Is it possible to attach the Chord Qutest to your PC? This would help to determine if the sMS-200 is a factor in the behavior you are seeing.
-John
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. | __label__pos | 0.784703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.