General discussion about Komodo. For useful links and more info click the pinned messages to the right. DON'T DM @jl777
100 messages
Before 05-Dec-19 12:00 AM
TwilightPunkster K6407-Mar-19 02:52 AM
well, at least for Unity devs, but exactly
Cryptofist07-Mar-19 02:52 AM
At the least, the beginning of it.
In which unity represents about how much weight of game development?
TwilightPunkster K6407-Mar-19 02:53 AM
blockchain and games are at this point dominated by Loom and Enjin, both targeting the Unity game engine, which is distributed over 3 billion devices and the no. 1 engine for indie developers and top 5 all-round game engine. You can't really attract a game developer without a SDK
Cryptofist07-Mar-19 02:53 AM
Isn't it a large number like ... 40%-50%(edited)
TwilightPunkster K6407-Mar-19 02:54 AM
Loom and Enjin are also by the way web3/Ethereum, DMarket has a SDK, but isn't really popular.
Yup, Unity dominates.
(those are just the facts)(edited)
You have to understand that most game developers never really touch crypto.
grewalsatinder07-Mar-19 02:55 AM
There are 2 major Game engins to my knowledge in industry.
Unity - Microsoft supported - C# Language
Unreal Engine - Open Source?? - C++ Language
Both I think supports other native languages too, not entirely sure.
If these Game Engines has the libraries to talk to the Komodo Blockchain RPC API, it makes the Games developers life easier.

Unity uses Mono, for the record...
And its low-level C++. C# is used as intermediate language.
grewalsatinder07-Mar-19 02:57 AM
cool, thanks for correcting
Cryptofist07-Mar-19 02:57 AM
So what is next for you and this specific endeavor? @TwilightPunkster K64
TwilightPunkster K6407-Mar-19 02:58 AM
There are more game engines: CryEngine, Source, Torque and some others. Godot is reaching popularity in the indie scene, but isn't in that top 5 yet,
grewalsatinder07-Mar-19 02:58 AM
@TwilightPunkster K64 I know little about Game Engines. Does Unity support Go language?
TonyL07-Mar-19 02:58 AM
Haha from add friends request till working stuff on Unity just 30 mins or so - love your pace
Cryptofist07-Mar-19 02:59 AM
I'm pretty sure he's been working since this time yesterday @TonyL The progress level is amazing!
TwilightPunkster K6407-Mar-19 02:59 AM
@Cryptofist two things, really, working out the Asset Chain, create a visual scripting language on top of that and attach Komodo to my game(s)
(those are actually 3, but the prior 2 are for the last one)
@TonyL yeah, sorry. I am a bit hyperdrive
Cryptofist07-Mar-19 03:01 AM
Is there anything the community can do to assist? Need anything?
TwilightPunkster K6407-Mar-19 03:01 AM
hahaha, I actually have been super slow, I didn't know anything really until @jl777c gave some insight, and @TonyL tui's made stuff really happen
Markus07-Mar-19 03:02 AM
wow this is cool
very nice!
TwilightPunkster K6407-Mar-19 03:03 AM
not sure what the community could do - I think a lot is happening. @Cryptofist what usually happens around here?
what would be nice are contributions to get the Komodo team more meat to show off - like ... ehm games
SDK's are great, but you kinda need use cases.
@Markus thanks!
Cryptofist07-Mar-19 03:04 AM
@TwilightPunkster K64 A LOT of pitching in and team work.
TwilightPunkster K6407-Mar-19 03:05 AM
@Cryptofist I'm not sure if everyone likes game dev like I do xD So far, I've seen only Rogue and Sudoku?
Cryptofist07-Mar-19 03:05 AM
And kmdice
TwilightPunkster K6407-Mar-19 03:05 AM
ah, haven't seen that
but those are like small games right?
Markus07-Mar-19 03:05 AM
a great start would be to make a flappy birds game and store player highscore on blockchain
TwilightPunkster K6407-Mar-19 03:06 AM
What would be cool, like a game jam?
Cryptofist07-Mar-19 03:06 AM
No GUIs for anything so far. I believe some are being worked on...
now instead of flappy high scores, what about actual kills (edited)
Cryptofist07-Mar-19 03:10 AM
We have a lot of potential features to add to Rogue that could show case how much Blockchain can add to any game. ...
Markus07-Mar-19 03:11 AM
fortnite blockchain edition
TwilightPunkster K6407-Mar-19 03:11 AM
sure, Rogue made this possible
its pretty much the boilerplate for projects like mine
for example, it probably needs a post mortem in depth, or perhaps a full tutorial
(there are no real tutorials in the form of video for this stuff)
grewalsatinder07-Mar-19 03:12 AM
@TwilightPunkster K64 you have a Github profile?
Cryptofist07-Mar-19 03:12 AM
Leaderboard, Dex gui, game replay viewing...
I think a fun part is creating multiple interfaces to make different themes that can work with the same game.
TwilightPunkster K6407-Mar-19 03:13 AM
@grewalsatinder yes, but my sexy things are in private repo's and I keep my dark green blocks to myself
but I do have codegifts for Game Development Network (community of 5000+ gamedevs)
actually, I have three GH's to be honest.
amazingsam, miningsam and ofcourse twilightpunkster
twilightpunkster has 5 repositories available. Follow their code on GitHub.
FishyGuts07-Mar-19 03:17 AM
@TwilightPunkster K64 - I have been working with an artist on something like this.
Can I put the two of you together?
TwilightPunkster K6407-Mar-19 03:17 AM
@FishyGuts awesome, you make games ?
FishyGuts07-Mar-19 03:17 AM
@Strob was looking at using Unity to make a 3d compatible game in this rogue facshion.
He's been talking to other devs he knows, he used to work at Ubisoft.
I am not a Game dev, I have just been trying to find the right people to make this happen for a few weeks now.
TwilightPunkster K6407-Mar-19 03:18 AM
ah, Ubi just got into blockchain
FishyGuts07-Mar-19 03:18 AM
@Strob Scroll up here and see if we have something
TwilightPunkster K6407-Mar-19 03:19 AM
I am a former Eidos/Squaresoft guy (and former Unity... xD), so its always cool to talk with my fellow AAA buddies
Cryptofist07-Mar-19 03:19 AM
@TwilightPunkster K64 Strob is who made the pirate video I shared with you.(edited)
TwilightPunkster K6407-Mar-19 03:19 AM
ahhhh
@Cryptofist
I think a fun part is creating multiple interfaces to make different themes that can work with the same game.
Well, this SDK thingie makes it possible.
Basically, my idea to abuse TokenCC to contain meta-data in the description field and an id for its identifier (jl777c said it was ok, so don't worry), will allow exchange easy between Unity games and Komodod. Pretty much in a similar way as Rogue TUI. But, with the power for example like Photon 2, it gets really easy to create multiplayer games that are blockchain powered
Gotta love blockgame
well, you are aware of the Asset Chain thingie right?
so, my point is the collectable card part @Deleted User(edited)
@Cryptofist oh, btw, I just have some ideas what could be super useful and community powered
1
Cryptofist07-Mar-19 03:31 AM
Two of my favorite things.
TwilightPunkster K6407-Mar-19 03:32 AM
@Deleted User won't gonna happen for me but appreciated that you care
(already far past my deadline xD so I am happy with every day)
@Cryptofist so, what would be super useful are different kind of blockchains to test and connect to! Even though VPS's are cheap, the more the merrier, and different setups can make stuff way more robust. Like a playground
Cryptofist07-Mar-19 03:35 AM
I think that there are many already here. First thing that comes to mind is #kmdlabs
Many more beyond that and then Komodo's "whip up a Blockchain" feature makes it easy to do so.
TwilightPunkster K6407-Mar-19 03:37 AM
@Cryptofist also, if someone doesn't play with their Switch/XBox/PS4/Vive, I am a licensed developer and have devkit applications, would be cool to test on consoles. So abandoned consoles are more than welcome, as normally you would need to run projects separately per console for homebrew stuff, else I break ToS.
@Cryptofist oh, isn't that service part of the future plans?
Cryptofist07-Mar-19 03:38 AM
Oh sweet, then I can get my Komodo station I've been wanting.
TwilightPunkster K6407-Mar-19 03:38 AM
By that time I already fired up some linodes xD
@Cryptofist hahaha, got a favorite console?
Cryptofist07-Mar-19 03:38 AM
PS3 lol
Markus07-Mar-19 03:39 AM
i got the first generation ps3 still laying around, the one that support ps2 games
TwilightPunkster K6407-Mar-19 03:40 AM
ah, PS3 isn't supported anymore by the current Unity, that would require some haxory
lucky for you I know the exact version which still supports PS3, anything below 5.6
@Cryptofist you know what would be another booster for gamedev?


Boy missing since building collapse in Narayanganj is found dead
by bdnews24.comFire Service rescuers recovered the body of a missing boy from a four-storey under-construction building that collapsed two days ago.
Wahid, 12, was found dead on the construction site at Baburile at around 2 pm on Tuesday, said Abdullah Arefin, deputy assistant director of Fire Service and Civil Defence Narayanganj.
Son of Rubel Mia, a grocer in Bangla Bazar, Wahid was a grade VI student in Kashipur Ujir Ali High School.
The building collapsed into the nearby canal on Sunday evening. Wahid had remained missing since then.
The Fire Service began a search for Wahid at 9am the next day.
“Wahid was found buried under the collapsed wall of the ground floor balcony. The body was recovered after draining out the canal water,” said Arefin.


Virtual Files
A virtual file VirtualFile
is the IntelliJ Platform’s representation of a file in a file system (VFS). Most commonly, a virtual file is a file in your local file system. However, the IntelliJ Platform supports multiple pluggable file system implementations, so virtual files can also represent classes in a JAR file, old revisions of files loaded from a version control repository, and so on.
The VFS level deals only with binary content. You can get or set the contents of a VirtualFile
as a stream of bytes, but concepts like encodings and line separators are handled on higher system levels.
How do I get a virtual file?
- From an action:
e.getData(PlatformDataKeys.VIRTUAL_FILE)
. If you are interested in multiple selection, you can also usee.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)
. - From a path in the local file system:
LocalFileSystem.getInstance().findFileByIoFile()
- From a PSI file:
psiFile.getVirtualFile()
(may return null if the PSI file exists only in memory) - From a document:
FileDocumentManager.getInstance().getFile()
What can I do with it?
Typical file operations are available, such as traverse the file system, get file contents, rename, move, or delete. Recursive iteration should be performed using VfsUtilCore.iterateChildrenRecursively
to prevent endless loops caused by recursive symlinks.
Where does it come from?
The VFS is built incrementally, by scanning the file system up and down starting from the project root. New files appearing in the file system are detected by VFS refreshes. A refresh operation can be initiated programmatically using (VirtualFileManager.getInstance().refresh()
or VirtualFile.refresh()
). VFS refreshes are also triggered whenever file system watchers receive file system change notifications (available on the Windows and Mac operating systems).
As a plugin developer, you may want to invoke a VFS refresh if you need to access a file that has just been created by an external tool through the IntelliJ Platform APIs.
How long does a virtual file persist?
A particular file on disk is represented by equal VirtualFile
instances for the entire lifetime of the IDEA process. There may be several instances corresponding to the same file, and they can be garbage-collected. The file is a UserDataHolder
, and the user data is shared between those equal instances. If a file is deleted, its corresponding VirtualFile instance becomes invalid (the isValid()
method returns false
and operations cause exceptions).
How do I create a virtual file?
Usually you don’t. As a rule, files are created either through the PSI API or through the regular java.io.File API.
If you do need to create a file through VFS, you can use the VirtualFile.createChildData()
method to create a VirtualFile
instance and the VirtualFile.setBinaryContent()
method to write some data to the file.
How do I get notified when VFS changes?
Implement the BulkFileListener
interface and subscribe to the message bus topic VirtualFileManager.VFS_CHANGES
. For example:
project.getMessageBus().connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
// handle the events
}
});
See Message Infrastructure and Plugin Listeners for more details.
For a non-blocking alternative, starting with version 2019.2 of the platform, see AsyncFileListener
Plugins targeting versions 2017.2 or older of the platform can use the now deprecated VirtualFileManager.addVirtualFileListener()
method which allows you to receive notifications about all changes in the VFS.
Are there any utilities for analyzing and manipulating virtual files?
VfsUtil
and VfsUtilCore
provide utility methods for analyzing files in the Virtual File System.
You can use ProjectLocator
to find the projects that contain a given virtual file.
How do I extend VFS?
To provide an alternative file system implementation (for example, an FTP file system), implement the VirtualFileSystem
class (most likely you’ll also need to implement VirtualFile
), and register your implementation as an application component.
To hook into operations performed in the local file system (for example, if you are developing a version control system integration that needs custom rename/move handling), implement the LocalFileOperationsHandler
interface and register it through theLocalFileSystem.registerAuxiliaryFileOperationsHandler
method.
What are the rules for working with VFS?
See IntelliJ Platform Virtual File System for a detailed description of the VFS architecture and usage guidelines.


Toggle navigation
Awesome-O Computers
iBUYPOWER
ALIENWARE
Awesome-O Computers
Home
iBUYPOWER
ALIENWARE
Purchase Confirmed
Product Name:
Quantity:
Total Price:


return: the way to return data from a function.
console.log: feature for debugging purposes. Used to check if a value exists. Console.log will show the value of an object and then forget about it. If you want to hold on to the value and do something with it, then you need the return keyword.
&& and ||
var xPos = 300;
var yPos = 150;
function sendWarning(x, y) {
if ((x < xPos) && (y < yPos)) {
alert("Adjust the position");
} else {
alert("Things are fine!");
}
}
sendWarning(500, 160);
sendWarning(100, 100);
sendWarning(201, 149);
Every value in JavaScript has an inherent boolean value. When that value is evaluated in the context of a boolean expression, the value will be transformed into that inherent boolean value.
| x | y | x && y | x || y |
|---|---|---|---|
| false | false | false | false |
| false | true | false | true |
| true | false | false | true |
| true | true | true | true |
As logical expressions are evaluated left-to-right, they are tested for possible "short-circuit" evaluation
using the following rules:
Alternatives to chaining if/else statements
if/else statement
var day = true;
if(day){
alert('It is daytime')
} else{
alert('It is nighttime')
}
// It is daytime
rewritten using the ternary operator
var day = true; //conditon
alert(day ? 'It is day-time' : 'It is night-time') // It is day-time
var day = true; //conditon
alert(day ? 'It is day-time' : 'It is night-time') // It is day-time
- ? - means IF
- : - means Else
var dog = true;
function myPet(){
if(dog){
return 'How do i get it?';
} else {
return 'Get me a dog!';
}
}
console.log(myPet())
// How do i get it?
var dog = false;
function myPet(){
return dog ? 'How do i get it?' : 'Get me a dog!';
}
console.log(myPet())
// Get me a dog!


Beloit man arrested on suspicion of 5th OWI, police say
by Logan RudeAFTON, Wis. - A Beloit man was arrested Friday after a Rock County Sheriff's Office deputy smelled alcohol and burnt marijuana in the man's vehicle during a traffic stop, according to a news release.
Police said when Marcos Denson, 33, was asked to exit the vehicle, he showed signs of impairment. According to the release, standardized field sobriety tests gave the deputy reason to arrest Denson for OWI.
According to the release, it was Denson's fifth arrest for OWI, making it a felony.
Denson was booked into the Rock County Jail and will have a mandatory court date Monday, according to the release.


Broncos’ Andy Janovich Gets Carted To Locker Room After Gruesome Arm/Elbow Injury (VIDEO)
by Darrelle LincolnYou know an injury is too bad if CBS decides not to show a replay of it.
During the Broncos-Vikings game on Sunday, FB Andy Janovich caught a pass, got tackled, but his arm seemed to snap in two as he tried to brace for the fall.
He got up instantly and grabbed for that arm. He would eventually get carted off to the locker room.


JDBC adapters read and write data from databases using JDBC connections using
a standard processing strategy. The processing strategy is carefully chosen
in order to ensure that records can be written to the input table in a
continuous flow, and these will eb excluded from the processing transaction
until it is time for a new transaction to start. This means that the
transaction size is held constant by the framework, and concurrency issues
are reduced to a minimum.
Input strategy:
- Search to see if any records are available for processing in the source table
- If records are available, mark then as belonging to a transaction
- Process all records in the transaction.
- If the transaction completed correctly, marks the records as "read", or remove them
- If the transaction went badly, leave the records where they are or mark them as errored


Blackpool’s Liam Feeney admits they have had to find different ways of winning
Blackpool’s Liam Feeney believes the last few weeks have seen the club display an ability to play – and win – in different manners.
by Gavin BrowneThe Seasiders head to Ipswich Town this afternoon unbeaten in six games in all competitions and on the back of four consecutive wins.
As Feeney admitted, their last two league victories over Peterborough United (4-3) and AFC Wimbledon (2-0) were contrasting matches.
“We had a little spell this season where we didn’t score so many goals,” he said.

“Peterborough, we went toe to toe and came out on top.
“The manager (Simon Grayson) has shown he’s quite fluid in his formation he picks; during the game we’ve still tried different things and he communicates that on to us.
“We’ve gone from wing-back to 4-4-2 to 4-3-3 in the same game.”
Having enjoyed a fine start to the season, Blackpool had endured a wobble with only two wins in 12 league games before beating Peterborough at the start of the month.
Nevertheless, they remain fifth in League One, five points behind today’s hosts.
Barring the wins against Doncaster Rovers and Lincoln City, the Seasiders’ results were generally disappointing during September and October.
However, Feeney admitted the players did not lose their belief during that run of results.
He said: “I think we’ve always been confident, even at the start of the season and through the patch where we didn’t win for a little while, we haven’t been blown away by anyone in this division.
“We’ve been in every game and been shaded or just couldn’t quite nick the draw, so when the wins have come, everyone’s back to ‘we know what we are and we don’t fear anyone.’
“We’re in good form, we’ve been getting some good results and scoring goals and it’s starting to click a lot better.
“We aren’t going there with any fear, we’re respectful of what they are and the players they’ve got but we know we can hurt them as well so we’re going there looking to win the game.
“It’s just another game for us; to go to Ipswich, it’s a nice stadium, it should be a good weekend for us to show what we’re about.”


example : An awesome project.¶
This is an awesome project.
Tutorials¶
See the following IPython Notebooks for some examples of using example: There should be demo.html file in docs/notebooks/demo.html. The demo html is created from demo.ipynb file.
This is an awesome project.
See the following IPython Notebooks for some examples of using example: There should be demo.html file in docs/notebooks/demo.html. The demo html is created from demo.ipynb file.


A human cargo bound for servitude in exile.
A pirate city hauled across the ocean.
A hidden miracle about be revealed.
This is the story of a prisoner's journey. The search for the island of a forgotten people, for the most astonishing beast in the seas, and ultimately for a fabled place - a massive wound in reality, a source of unthinkable power and danger...
A mile below the lowest cloud, rock breaches water and the sea begins.


Before Change
building_path = "/building{}".format(mains.building())
mains_data_location = ("{}/elec/meter{}"
.format(building_path,
container_to_string(mains.instance())))
for chunk in mains.power_series(**load_kwargs):
After Change
appliances = []
for i, model in enumerate(self.model):
for app in model["training_metadata"].appliances:
appliance = {
"meters": [i+2],
"type": app.identifier.type,
"instance": app.identifier.instance
// TODO this `instance` will only be correct when the
// model is trained on the same house as it is tested on
}
appliances.append(appliance)
building_metadata = {
"instance": mains.building(),


{% extends 'driver/base.html' %} {% load static %} {% block head %} {% endblock %} {% block content %}
You have not chosen any task yet. Do you want us to remind you to earn some money?


Amit Shah kicks off Jharkhand poll campaign, promises development
"Atal ji (Atal Bihari Vajpayee) created Jharkhand and Narendra Modi will embellish and spruce it up," he told an election rally in Manika.
by PTIBJP president Amit Shah kicked off his party's campaign for the Jharkhand assembly polls on Thursday with the promise of catapulting the state to the top position in terms of development.
He lauded the Raghubar Das government for "freeing" the state of the Naxal menace in the last five years.
"Atal ji (Atal Bihari Vajpayee) created Jharkhand and Narendra Modi will embellish and spruce it up," he told an election rally in Manika.
"People kept dying, youth sacrificed their lives, but the dream of statehood remained unfulfilled under Congress rule," he said.
Shah thanked the Jharkhand unit of the party for giving him the opportunity to launch the poll campaign from Latehar district, the land of legendary freedom fighter Birsa Munda.


| Package | Description |
|---|---|
| mars.riscv.instructions.ecalls |
| Modifier and Type | Class | Description |
|---|---|---|
class |
EcallClose |
Service to close file descriptor given in $a0.
|
class |
EcallExit |
Service to exit the RISCV program.
|
class |
EcallExit2 |
Service to exit the RISCV program with return value given in a0.
|
class |
EcallOpen |
Service to open file name specified by a0.
|
class |
EcallPrintChar |
Service to display character stored in a0 on the console.
|
class |
EcallPrintDouble |
Service to display double whose bits are stored in f12 and f13 onto the console.
|
class |
EcallPrintFloat |
Service to display on the console float whose bits are stored in f12
|
class |
EcallPrintIntHex |
Service to display integer stored in a0 on the console.
|
class |
EcallPrintIntUnsigned |
Service to display integer stored in a0 on the console as unsigned decimal.
|
class |
EcallPrintNumber |
Service to display integer stored in a0 on the console.
|
class |
EcallPrintNumberBinary |
Service to display integer stored in a0 on the console.
|
class |
EcallPrintString |
Service to display string stored starting at address in a0 onto the console.
|
class |
EcallRandDouble |
Service to return a random floating point value.
|
class |
EcallRandFloat |
Service to return a random floating point value.
|
class |
EcallRandInt |
Service to return a random integer.
|
class |
EcallRandIntRange |
Service to return a random integer in a specified range.
|
class |
EcallRandSeed |
Service to set seed for the underlying Java pseudorandom number generator.
|
class |
EcallRead |
Service to read from file descriptor given in $a0.
|
class |
EcallReadChar |
Service to read a character from input console into $a0.
|
class |
EcallReadDouble |
Service to read the bits of console input double into $f0 and $f1.
|
class |
EcallReadFloat |
Service to read the bits of input float into $f0
|
class |
EcallReadInt |
Service to read an integer from input console into $v0.
|
class |
EcallReadString |
Service to read console input string into buffer starting at address in a0.
|
class |
EcallSbrk |
Service to allocate amount of heap memory specified in a0, putting address into a3.
|
class |
EcallSleep |
Service to cause the MARS Java thread to sleep for (at least) the specified number of milliseconds.
|
class |
EcallTime |
Service to read a character from input console into a0.
|
class |
EcallWrite |
Service to write to file descriptor given in a0.
|


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pebble.domain.Content net.sourceforge.pebble.domain.Response
public abstract class Response
Represents a response to a blog entry - either a comment or a TrackBack.
| Field Summary | |
|---|---|
protected BlogEntry |
blogEntry
the parent blog entry |
protected java.util.Date |
date
the date that the trackback was received |
protected java.lang.String |
ipAddress
the ip address of the author |
protected java.lang.String |
title
the title |
| Fields inherited from class net.sourceforge.pebble.domain.Content |
|---|
propertyChangeSupport |
| Constructor Summary | |
|---|---|
Response()
Default, no args constructor. |
| Method Summary | |
|---|---|
BlogEntry |
getBlogEntry()
Gets the owning blog entry. |
java.util.Date |
getDate()
Gets the date that this response was received. |
java.lang.String |
getGuid()
Gets the globally unique id of this response. |
long |
getId()
Gets the id of this comment. |
java.lang.String |
getIpAddress()
Gets the IP address. |
abstract java.lang.String |
getSourceLink()
Gets the link to the source of this response. |
abstract java.lang.String |
getSourceName()
Gets the name of the source of this response. |
int |
getSpamScore()
Gets the spam score. |
java.lang.String |
getTitle()
Gets the title. |
void |
incrementSpamScore()
Increments the spam score by 1. |
boolean |
isApproved()
Determines whether this response is approved. |
boolean |
isPending()
Determines whether this response is pending. |
boolean |
isRejected()
Determines whether this response is rejected. |
void |
setApproved()
Sets the state of this response to approved. |
void |
setDate(java.util.Date date)
Sets the date that this response was received. |
void |
setIpAddress(java.lang.String ipAddress)
Sets the IP address. |
void |
setPending()
Sets the state of this response to pending. |
void |
setRejected()
Sets the state of this response to rejected. |
void |
setTitle(java.lang.String title)
Sets the title of the blog entry for this trackback. |
| Methods inherited from class net.sourceforge.pebble.domain.Content |
|---|
clearPropertyChangeEvents, getContent, getEvents, getPropertyChangeEvents, getState, getTruncatedContent, hasEvents, isDirty, nextEvent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.pebble.domain.Permalinkable |
|---|
getPermalink |
| Field Detail |
|---|
protected java.lang.String title
protected java.lang.String ipAddress
protected java.util.Date date
protected BlogEntry blogEntry
| Constructor Detail |
|---|
public Response()
| Method Detail |
|---|
public long getId()
public java.lang.String getGuid()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- the title as a Stringpublic abstract java.lang.String getSourceName()
public abstract java.lang.String getSourceLink()
public java.lang.String getIpAddress()
public void setIpAddress(java.lang.String ipAddress)
ipAddress
- the IP address of the responderpublic java.util.Date getDate()
public void setDate(java.util.Date date)
date
- the date as a java.util.Date instance.public BlogEntry getBlogEntry()
public int getSpamScore()
public void incrementSpamScore()
public void setRejected()
public boolean isRejected()
public void setApproved()
public boolean isApproved()
public void setPending()
public boolean isPending()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


keyboard_arrow_left
EVENT SCHEDULE
“ If you don’t know where you are going, you’ll end up someplace else ”
DESIGN
08
Nov
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:00 am
22
Dec
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:45 am
DEVELOPMENT
08
Jan
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:00 am
09
Mar
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:30 am
04
Apr
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:00 am
08
Jun
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:00 am
INNOVATION
08
Nov
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:00 am
22
Dec
Some Title Here
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, ratione.
10:45 am


The Best Ways To Grow Your Podcast Audience
by Abu ZafarLaunching your podcast is half the battle. Now you have to get people to listen. In the video above, I chat with expert podcasters about the three things you should do to gain listeners and grow your audience.
This video is part of our series on podcasting, offering up no-bullshit advice to help you become the best podcaster you can be. The first episode was about the 5 things you should do to prepare for your first episode. The second episode explained how to capture and produce high-quality audio.
The experts in this video, in order of appearance:
- Bim Adewunmi, co-host of Thirst Aid Kit
- Brendan Baker, director of Wolverine: The Long Night
- Josh Clark, co-host of Stuff You Should Know
- Misha Euceph, host of Tell Them, I Am
- Jeffrey Cranor, co-creator of Welcome to Night Vale
For those of you who prefer to read, we also have a comprehensive write-up on how to start your own podcast.


Before Change
dataset = self.builder.as_dataset(split=split_name)
self._check_split(dataset)
records_number = len(
[record for record in self.builder.numpy_iterator(split=split_name)])
self.assertEqual(records_number, expected_records_number)
main = tf.test.main
After Change
records = list(self.builder.numpy_iterator(split=split_name))
split_to_checksums[split_name] = set(checksum(rec) for rec in records)
self.assertEqual(len(records), expected_records_number)
for (split1, hashes1), (split2, hashes2) in itertools.combinations(
split_to_checksums.items(), 2):
if split1 in self.OVERLAPPING_SPLITS or split2 in self.OVERLAPPING_SPLITS:
continue
self.assertFalse(
hashes1.intersection(hashes2),
("Splits "%s" and "%s" are overlapping. Are you sure you want to have"
" the same objects in those splits? If yes, add one one of them to "
"OVERLAPPING_SPLITS class attribute.") % (split1, split2))
def checksum(record):
hash_ = hashlib.md5()
for key, val in sorted(record.items()):
hash_.update(key.encode("utf-8"))


is a collection of stories outlining various perspectives on the college experience and how people move beyond admissions.
We publish weekly, and we welcome your participation! If you want to join the team, submit a story, ask a question, or give feedback, please email: hi (snail) theshapeofcollege (point) com.
Check out our most recent stories or the full list. If you like what you read, you may sign up to get an email when a new story comes out.
This project is dedicated to all our teachers.


-
Saranac
-
Salvation Army of Wake County
-
Tharrington Smith
-
The Morehead-Cain Scholars Program
-
Josh Mandel for Treasurer
-
NC Marine Science
-
Raleigh Economic Development
-
Ravenstahl for Mayor
-
Volt Energy
-
Phillips Ambassadors
-
Story House Productions
-
Conectiv Energy
-
Vote the Site
-
Mustaches for Kids Charlotte
-
Larry Joe Doherty
-
ECU Economic Development
-
Walter Boasso
-
North Carolina Beer and Wine Wholesalers Association
-
Project Extra Mile
-
Ronald McDonald House of North Carolina
-
Lucy Daniels Center
-
NC Literary Festival
-
Recess Framework
-
Wake County Economic Development
-
Friends of Wake County
-
UFCW Local 1500
-
PR 20/20
-
Joe Simitian
-
Foster Friess
-
Polk Citizens for Good Government
-
Kansas House Democrats
-
North Carolina Association of Volunteer Administration
-
Stephanie Miner for Mayor
-
Insider Sports Marketing
-
White's Lumber
-
Happikins
-
UNC Admitted
-
United Way of Pitt County
-
Josh Mandel
-
White Knight Drivers
-
Rejuvenate Medspa
-
UNC Entrepreneurship Minor
-
XBS Global
-
Advanced Medical Technologies at N.C. State
-
Ben R. LujŠn
-
National College Advising Corps
-
DPR Landscape Architecture
-
Mack Crounse
-
Third Floor Productions
-
Save Our Little Village


The Stanford AI Lab (SAIL) Blog is a place for SAIL students, faculty, and researchers to share our work with the general public. We will write about our latest research, discussions and talks held at SAIL, and other interesting updates from our labs. To learn more about the various AI research being done at SAIL, visit the SAIL website.
Contributing People at SAIL interested in contriburing can look here for instructions.
Team All our blog posts are written by members in the SAIL community, with faculty advisor Dorsa Sadigh and the following editorial board:


My Profile
Notifications
13
Settings
Logout
Customer Engagement Dashboard
Dashboard
Charts
Chartjs
Customer Activity
Drill Down view for Inactive users
Campaign Communication Insight
Loyal Customers
75
New Users
60
Notification Clicks
30
Previous Campaign Reports till last month
Customer Activity
Detailed Result


Brand
Global Nav
Tools
Hero Features
Hero Call to Action
Add
Article Features
Article Listing
Sidebar Content


I'v had a few times where i have just missed one thing in a line of code so it wasnt working. Sometimes i would try to look over the material i was given but mostly i would just go over again and again looking at my code and all the components because i was sure it was just something i had done wrong. It made me feel frustrated not nkowing what to do. I learnt that 99% of the time it's because i haven't written the code properly (ie. added an s at the end of the word or missed something that is part of the syntax) so not to blame other factors and just keep checking my code!
I am mostly confident with asking perrs for help,trying something, googling and pseuodocode. I am ok with reading error messages, console logging, rubber ducky method, asking coaches for help and improving process with relfection but i could definitley spend some more time practising these things.
.map() creates a new array by using the results and calling on the elemets in the new array.
.filter() creates a new array with all the elements that are correct for the test which the funation provides.
.reduce() starts the callback function for every element present in the array.


The most interesting traditions from around the world
Philippines
Philippines people carry coins in their pockets, eat and display fruits that are round in shape. According to their beliefs, round objects are a sign of prosperity and hence one should keep them for a flourishing new year.
China
Many Chinese people will paint their door red as a symbol of happiness and good fortune. They may also choose to hide their knives so that nobody cuts themselves, as it is thought cutting could impact on the luck of the entire family for the coming year.
Germany
Many Germans will welcome in the new year by eating a donut filled with jam on liquor, called 'Phannkuckens'. However, as a practical joke some donuts are given a different filling, such as mustard - if you eat one of these it is seen as bad luck
Estonia
Traditionally New Years’ day involves Estonians trying to eat seven, nine or twelve times, as they are lucky numbers. The more they eat, the more plentiful food will be in the coming year.
Denmark
In Denmark, They smash dishes and glasses against the homes of their friends. Just another form of displaying affection, right! Also, when the clock turns 12, it is believed that leaping off from a chair will bring some fortune
Turkey
As the bells ring in the new year, it is traditional to open your front door and sprinkle salt ont the doorstep. The act is thought to bring peace and abundance to your home of business
Greece
The Greeks believe that turning the lights off during the midnight will help them in welcoming the new year with fresh eyes. With this, it’ll give them a fresh perspective to look at their lives.
Japan
In Japan they ring all of their bells 108 times in alignment with the Buddhist belief that this brings cleanness. It’s also considered good to be smiling going into the New Year as it supposedly brings good luck.
Ecuador
New Year in Ecuador os celebrated by the burning of effigies, along with photographs from the past year. Men sometimes dress up as women to represent the widows of the past year.
Brazil
In Brazil, as well as other Central and South America countries, it is thought to be lucky to wear special underwear on New Year’s Eve. The most popular colors are red, thought to bring love in the New Year, and yellow, thought to bring money.
Spain
In Spain, New Year’s Eve is all about good timing. When the clock strikes midnight, Spaniards try to eat a grape in time with each chime. Those who don’t manage to cram the right number of grapes at the right time face the threat of bad luck for the following year.
Panama
To drive off evil spirits for a fresh New Year’s start, it is tradition to burn effigies of well-known people such as television characters and political figures in Panama. The effigies are meant to represent the old year.


--- layout: post title: Ajax on Rails categories: - sightings author: admin published: true date: 2005-06-24 08:07:10.000000000 +01:00 ---


Company Info
View Gig Description
View Work Contract and Other Documents
Work References
** These are references that I have
actually
worked with. If you wish to consider references from outside this list, please do so at your own risk. **


Nimbus uses instances of the {@link javax.swing.Painter} interface to paint components. With each Swing component it associates a foreground and a background {@code Painter}, and there may be several painters for different component states.
Nimbus allows customizing many of its properties, including painters, by altering the {@link javax.swing.UIDefaults} table. Here's an example:
UIManager.put("ProgressBar.tileWidth", myTileWidth); UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter); UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);
Per-component customization is also possible. When rendering a component, Nimbus checks its client property named "Nimbus.Overrides". The value of this property should be an instance of {@code UIDefaults}. Settings from that table override the UIManager settings, but for that particular component instance only. An optional client property, "Nimbus.Overrides.InheritDefaults" of type Boolean, specifies whether the overriding settings should be merged with default ones ({@code true}), or replace them ({@code false}). By default they are merged:
JProgressBar bar = new JProgressBar(); UIDefaults overrides = new UIDefaults(); overrides.put("ProgressBar.cycleTime", 330); ... bar.putClientProperty("Nimbus.Overrides", overrides); bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
Colors in Nimbus are derived from a core set of primary colors. There are also secondary colors, which are derived from primary ones, but serve themselves as base colors for other derived colors. The derivation mechanism allows for runtime customization, i.e. if a primary or secondary color is changed, all colors that are derived from it are automatically updated. The method {@link javax.swing.plaf.nimbus.NimbusLookAndFeel#getDerivedColor(java.lang.String, float, float, float, int, boolean)} may be used to create a derived color.
These classes are designed to be used while the
corresponding LookAndFeel
class has been
installed
(UIManager.setLookAndFeel(new XXXLookAndFeel())
).
Using them while a different LookAndFeel
is installed
may produce unexpected results, including exceptions.
Additionally, changing the LookAndFeel
maintained by the UIManager
without updating the
corresponding ComponentUI
of any
JComponent
s may also produce unexpected results,
such as the wrong colors showing up, and is generally not
encouraged.
Note: Most of the Swing API is not thread safe. For details, see Concurrency in Swing, a section in The Java Tutorial. @since 1.7 @serial exclude


My name is jung hyun, I'm from south Korea and I like to play and watch sports. This semester, I want develop my skills on using different making programs. Also, I want to make different products.


“Be slow to fall into friendship; but when thou art in, continue firm & constant.”
– Socrates
“Don’t make friends who are comfortable to be with. Make friends who will force you to lever yourself up.”
– Thomas J. Watson
“True friendship comes when the silence between two people is comfortable.”
– David Tyson


--- layout: post status: publish published: true title: Recent Albums author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 676 wordpress_url: http://winterdom.com/2004/03/recentalbums date: '2004-03-13 16:30:24 +0000' date_gmt: '2004-03-13 16:30:24 +0000' categories: - Personal tags: [] comments: [] ---
Some albums I've recently (that is, in the past few months) added to my music collection:


No redirections will be set up and your current username will be up for grabs.
Deleting your account removes all resources, reviews, and other uploads. The username also becomes available for other people to register.
This process is immediate and irreversible. Please be certain.


Home
About
Contact
Blog
Hello JavaScript!
Very Nice Cat
$9.99
Buy now!
Detail
Cancel
Add to Cart!
Success!
Very Nice Cat
$9.99
Buy now!
Detail
Cancel
Add to Cart!
Success!
Very Nice Cat
$9.99
Buy now!
Detail
Cancel
Add to Cart!
Success!
Very Nice Cat
$9.99
Buy now!
Detail
Cancel
Add to Cart!
Success!


Jeremiah 33:17
For thus saith the LORD; David shall never want a man to sit upon the throne of the house of Israel;


--- title: A Fractran Short Story layout: post tags: [story, compsci] uuid: 8f7a913f-5d94-3fc0-b692-f536c10ad8f1 ---
Fractran is a Turing-complete esoteric programming language. A Fractran program is just an ordered list of positive, irreducible fractions. The program's output for an input n is the output of the program run on n multiplied by the first fraction in the list that results in an integer. If no such multiplication results in an integer, the output is the input n. Variables are encoded in the exponents of the prime factorization of the input and output.
Some time ago I thought up an idea for a short story involving Fractran. A mathematician accidentally creates a Fractran program that can trivially factor large composites. Think something like O(log n). It's just the right magical string of, say, 31 fractions.
The story would be a first-person narrative of the mathematician's thoughts during a short time after the discovery, considering many of the consequences of the program. For example, it would render much of cryptography, which plays an essential role in the modern world, useless. He would also wonder if mankind should deserve such a discovery, considering how accidental it was.
This whole idea vanished once I realized that this Fractran program is actually completely trivial. It even runs in O(1) time. It's so trivial as to be worthless. Remember that Fractran stores its data in the number's prime factorization? The Fractran program that can factor any number in constant time is the identity function. To decode the output, which matches the input, all you need to do is factor it!
Interestingly, it doesn't seem to actually be possible to implement
the identity function in Fractran (But somehow it's
Turing-complete? Hmmm... more investigation needed.), unless you
can define your program in terms of its input. For example, the
program 1/(n+1)
is the identity function for
input n.


Home
Home
My Profile
Articles
Create Article
Logout
Home
Home
My Profile
Manage Users
Create User
Logout
back
Share:
Summary
Description
Attachments
Tags:
Author:
Review By:
Publish Date:
Last Update:
Tags:
Views:
Shares:
Status:
Comments:
History
Comments
Add Comment
Cancel
Submit


nips nips2002 nips2002-94 nips2002-94-reference knowledge-graph by maker-knowledge-mining
Source: pdf
Author: Wim Wiegerinck, Tom Heskes
Abstract: We consider loopy belief propagation for approximate inference in probabilistic graphical models. A limitation of the standard algorithm is that clique marginals are computed as if there were no loops in the graph. To overcome this limitation, we introduce fractional belief propagation. Fractional belief propagation is formulated in terms of a family of approximate free energies, which includes the Bethe free energy and the naive mean-ﬁeld free as special cases. Using the linear response correction of the clique marginals, the scale parameters can be tuned. Simulation results illustrate the potential merits of the approach.


| Project Name | Description | Last updated | Actions |
|---|---|---|---|
| {{project['project_name']}} | {{project['project_description']}} | {{project['last_time_updated']}} | Delete |
Are you sure?
This will delete all of the experiments from the experiment storage!
This cannot be undone!


An element in video game design, Ratchet Scrolling occurs when the game screen only scrolls in one direction and prevents the player from backtracking.
This is similar to an Auto-Scrolling Level, except that the scrolling does not occur by itself, but in response to the player's movement through the level. Like the nature of a mechanical ratchet, it scrolls forward freely as the player moves, but 'locks' in place and prevents the player from backtracking.
Lesser versions may allow the player some degree of backtracking, but only to a certain distance or recent checkpoints, while the most extreme versions will keep your character near the left edge of the screen, giving them very little room to move around without ratcheting the screen further.
This is often a Classic Video Game Screw You, especially when the screen is ratcheted vertically, where any platforms that disappear even a few pixels off the screen edge leave Bottomless Pits in their wake, in defiance of all logic.
In early video games, Ratchet Scrolling was a way to improve performance. If the player could only scroll in one direction, game objects and enemies could be created when they enter the screen and erased as soon as they scroll out, reducing memory usage. Though this is now mostly a Forgotten Trope, only seen occasionally in simple phone games like Doodle Jump, it was once incredibly common (particularly in Platform Games).
The name has nothing to do with a certain Autobot Medic, Widget's Evil Twin, the usurper head of Bigweld Industries, or a feline-resembling alien with a robot companion.
Examples:
- Battletoads for the Game Boy, NES, etc. However, some levels were free-scrolling.
- Almost all Beat-em-Ups and Action Games with platforming elements in the arcade will do this to you.
- All Nintendo-era Contra games featured both varieties of this. Not funny when in a vertical shaft, and you fell off the platforms...
- Super Castlevania IV has vertical ratchet scrolling, making for a few obnoxious challenges if you jump to an area and it ratchets due to overjumping.
- The older Castlevania games employed this as well. This gimmick didn't leave until Castlevania: Symphony of the Night.
- Metal Shark Player's level of Mega Man X6, the second section has you ratcheted, in contrast to the rest of the game (note that if taking the "alternate" second section, it will be auto-scrolling instead.)
- Kick Master doesn't let you go backward; while it's a largely linear game, there are many hidden items that can be missed.
- Layla for the NES, which can lead to some unwinnable situations.
- Amagon featured this as well, one of the last NES games to do so (released in Japan in December of 1988).
- Journet to Silius does this as well and is even older than Amagon.
- The original Glider had this.
- Super Mario Bros.
- The original Super Mario Bros., the Lost Levels Mission-Pack Sequel, and Super Mario Land. The way the levels were compressed required this. The invisible checkpoints in levels were frequently located after a useful power-up, making some players almost pray for Checkpoint Starvation instead.
- New Super Mario Bros. for DS has "Challenge Mode". On side-scrolling levels it enables this; on vertical-scrolling levels it becomes an Ice Climber or Kid Icarus-style Rise to the Challenge.
- The Deluxe GBC port of the original game lets you backtrack to a certain extent, because the game is pixel-for-pixel and the Game Boy screen is smaller than the NES output screen.
- The Super Mario World Game Mod Hammer Brother has this. Unfortunately, you have to go left or backwards at certain points, making it extremely easy to get stuck at random.
- The level called Kinder Surprise in Something uses this particular gimmick. It makes dodging the Kinder Surprise eggs much harder. Also, Mario can take the wrong path at some points, but fortunately the are reset doors available.
- Sonic the Hedgehog:
- The Sega Master System version of Sonic 1 has Bridge Zone Act 2 and Jungle Zone Act 2; the former automatically scrolls right and the latter doesn't scroll down. The latter is thankfully absent in the Game Gear version.
- Sonic and the Black Knight did this, despite being a front-to-back 3D platformer.
- Syobon Action abuses ratchet scrolling to torment the player.
- Ren & Stimpy: Space Cadet Adventures
- A LittleBigPlanet level entitled "When things don't go right, go left" is effectively a basic platformer, apart from the fact you scrolled left.
- The Kaizo Mario inspired level of Pickory will only scroll to the right, but you can backtrack up to half a screen. One trap can only be avoided by exploiting the scrolling and the fact that anything that goes off the left side of the screen is destroyed.
- Adventure Island I and III feature horizontal scrolling limited to the right side. II has arbitrary points after which the screen couldn't scroll backwards anymore, but scrolling is otherwise two-directional. III has two-directional vertical scrolling, with stage 3-6 being the only time the screen can scroll to the left.
- Kid Kool, obviously modeled on the example of Super Mario Bros., disallowed going backwards. Its Spiritual Successor Psycho Fox followed suit.
- Kid Icarus is notorious for its vertical ratchet scrolling - if you fall (and don't have a feather) you die instantly and have to repeat the level. Even if there was a platform just off the screen.  This was removed in the sequel, Of Myths and Monsters.
- The escape from Wily's castle in Rockman 4 Minus Infinity uses this, though granted there's no reason for backtracking anyway.
- The platforming stages of Alex Kidd: High-Tech World. (Other stages require backtracking.)
- All of the platformer games in Action 52 use this. One of its top-view games, Dam Busters, also has this, and it can easily get you stuck in an area that keeps you from moving forward, forcing you to reset the game.
- Creatures for the Commodore 64 scrolls only to the right, making it important to backtrack to some bonuses before they get scrolled off the screen.
- Ninja Commando is a Shoot 'em Up that does this.
- Walking your dog in Nintendogs does this.
- Done in the Video Mode for Gottlieb's Super Mario Bros., which features a simplified Super Mario Bros. video game.
- The Video Mode for Harley Davidson: Third Edition has an isometric scrolling road that only goes forward.
- Done in the Video Mode of Doctor Who, done similarly to the Mario example above.
- Sort-of used in Knightmare: the player could never exit a room via the door they came in by. Most of the time this door wouldn't be visible as it was off the bottom of the "screen" but occasionally the entry door was visible.
- In OneWayHeroics, once something is scrolled off to the left, it's consumed by the Darkness and you can't go back. In fact, trying to go off the left side of the automatically-scrolling screen is an instant Game Over.
- Discussed in the comic We Go Forward.


--- layout: contact title: Contact permalink: "/Contact/" menuOrder: 6 paragraph: style: 1 text: |
For general questions, please email<EMAIL_ADDRESS>For all sponsorship questions, please email<EMAIL_ADDRESS>For all volunteer questions, please email<EMAIL_ADDRESS>heading: "Have a question about Rev?" ctaBanner: heading: "Get Your Ticket" text: "Don't miss out on the Rev experience" button: "See Ticket Options" link: "/Attend/" style: full ---


Grand Prismatic Spring is 370 feet in diameter and 121 feet deep. The spring has many colors around the rim including yellow, orange, and green that are due to the bacteria living in the beautiful blue water. There is a boardwalk along the edge of the spring, as well as a short hike to a higher, more expansive view of the spring. Every minute the spring releases about 560 gallons of water around 160 degrees. Grand Prismatic is the largest hot spring in the United States and the most photographed feature in Yellowstone National Park.
While you visit Grand Prismatic, explore the other geyser basins as well. Midway, Upper, and Lower Geyser Basin all have numerous geysers and pools to visit, and they are all located within a short drive of each other. If your timing is right, you might just catch an eruption of one of the many geysers throughout the basins.


SopovRobotics - model v201703 (Infrared eye)
Auto-Control programming
Connect
Try Search
Hands Control
For control please use:
Check Lets
Start autocontrol
Stop autocontrol
Script-Control
Run
Simulate
Auto-Control Script
Start
Stop


{#==========================================
Docs : "Validation"
==========================================#}
Spincast provides a good set of utilities to validate objects. We decided to base those utilities
on plain Java code and not on annotations. Validation annotations may seem convenient at first,
but, in a real project, you quickly realize that you can't express all the details you need : you can't use complex
logic, you can't validate an element
based on the result of the validation of another element, etc. In general, you end up writing plain Java code anyway
in addition to those annotations... But then your validation logic is scattered in many places and this is
not the ideal.
In Spincast, you validate an object using three main steps :
You use Predefined Validations or custom
validation code to actually validate the object. Those validations may result
in Validation Messages. Most of the time those
are
Validation
Error Validation Messages
resulting from failed validations
("This email is invalid", for example).
Validation Messages
by retrieving
them from the Validation Set
. In general, you want to display them to a user, or
you generate some kind of report.
Here's a quick example :
// Creation of a Validation Set ValidationSet myValidationSet = getValidationFactory().createValidationSet(); // The object we're going to validate User user = getUser(); // Validates the email of the user using the // "validationEmail()" predefined validation myValidationSet.validationEmail() .key("email") .element(user.getEmail()) .validate(); // Validates the username of the user, using // custom validation code String username = user.getUsername(); if(username == null || username.length() < 3 || username.length() > 42) { myValidationSet.addError("username", "USERNAME_INVALID", "Must contain between 3 and 42 characters."); } // Uses/Displays the resulting Validation Messages if(!myValidationSet.isValid()) { Map<String, List<ValidationMessage>> validationMessages = myValidationSet.getMessages(); // ... do something with the messages }
In the JsonObject validation section, we'll see that validation is even easier when done using JsonObjects...
At the core of a validation process, is a ValidationSet.
A Validation Set
is a set of Validation Messages and of
utility methods. It acts as a container to save the results of the various validations
run on an object.
For example, let's say we validate a User
object. At the end of this validation, the resulting Validation Set
may
contain two Validation Messages
:
Error Validation Message
: "The email is invalid."
Success Validation Message
: "This username is available!"
There are two ways of creating a Validation Set
instance :
ValidationFactory validationFactory = getValidationFactory(); ValidationSet validationSet = validationFactory.createValidationSet();
validationSet(...)
method on a JsonObject
:
JsonObject responseModel = context.response().getModel(); JsonObjectValidationSet validationSet = responseModel.validationSet();
Validation Set
this way, it is bound to the
JsonObject
it originates from. A
JsonObjectValidationSet
is returned instead of a plain Validation Set
, and you have access to extra methods dedicated
to validate the associated JsonObject
. We'll see that in details in the
JsonObject validation section.
A Validation Set
is more than a simple container to store the
validation results.  Those utility methods are :
ValidationSet addMessage(String validationKey, ValidationMessage validationMessage)
Validation Message
to this set, using the
specified validation key.
ValidationSet addMessage(String validationKey, ValidationLevel messageLevel, String code, String text)
Validation Message
.
ValidationSet addError(String validationKey, String code, String text)
Error Validation Message
.
ValidationSet addWarning(String validationKey, String code, String text)
Warning Validation Message
.
ValidationSet addSuccess(String validationKey, String code, String text)
Success Validation Message
.
ValidationSet mergeValidationSet(ValidationSet set)
Validation Set
.
ValidationSet mergeValidationSet(String validationKeyPrefix, ValidationSet result)
Merges an existing Validation Set
but prefixes all the
validation keys with the specified validationKeyPrefix
.
The validationKeyPrefix
parameter allows you to merge a Validation Set
resulting from a validation not performed directly on your current Validation Set
(you may be reusing an external Validator for example) and still have the keys of
the merged Validation Messages
to properly represent JsonPaths
on your current Set. We'll talk about that in a next section...
boolean hasMessages()
Validation Set
contain any
Validation Messages
?
boolean hasMessages(String validationKey)
Validation Messages
associated with the
specified validation key?
boolean isWarning()
true
if the Validation Set
contains at least one Warning Validation Message
, but no
Error Validation Messages
.
boolean isWarning(String validationKey)
true
if there is
at least one Warning Validation Message
, but no
Error Validation Messages
associated with the
specified validation key.
boolean isSuccess()
true
if the validation set
only contains Success Validation Messages
(or contains no messages at all).
boolean isSuccess(String validationKey)
true
if there are
only Success Validation Messages
associated with the
specified validation key (or contains no messages at all).
boolean isError()
true
if the validation set
contains at least one Error Validation Message
.
boolean isError(String validationKey)
true
if there is at least
one Error Validation Message
associated with the
specified validation key.
boolean isValid()
Returns true
if the Validation Set
does not contain any Error Validation Messages
.
The set can contain Warning Validation Message
and Success Validation Message
.
This is a synonym of !isError()
.
boolean isValid(String validationKey)
Returns true
if there are no
Error Validation Messages
associated with the
specified validation key.
There can be Warning Validation Message
and Success Validation Message
.
This is a synonym of !isError(validationKey)
.
Map<String, List<ValidationMessage>> getMessages()
Gets the Validation Messages
, with their
associated validation keys as the leys of the Map.
The Map and the List values are immutable.
List<ValidationMessage> getMessages(String validationKey)
Gets the Validation Messages
associated with the
specified validation key.
The Map and the List values are immutable.
String getMessagesFormatted(ValidationMessageFormatType formatType)
Validation Messages
.
String getMessagesFormatted(String validationKey, ValidationMessageFormatType formatType)
Validation Messages
associated with the specified validation key.
public JsonObject convertToJsonObject()
Converts the Validation Set
to a JsonObject
object.
Read the Converting to a JsonObject
section to see what the resulting
JsonObject
object looks like!
The resulting JsonObject
object
is immutable.
A ValidationMessage is composed of three things :
Validation Level
. This level can be :
Error
Warning
Success
text
, which is the description of the validation result. For
example : "This email is invalid".
code
, which in general is a constant representing the
type of validation this Validation Message
is associated with.
For example : "VALIDATION_TYPE_EMAIL"
.
When you add a Validation Message
to a Validation Set
, you
do so using a validation key. The validation key allows you
to retrieve the Validation Messages
associated with a specific element from
the Validation Set
.
Here's a quick example where we perform a validation and create a
Validation Message
:
ValidationSet validatorSet = validationFactory.createValidationSet(); JsonObject user = getUser(); String thirdBookTitle = user.getString("user.books[2].title"); if(containsNsfwWords(thirdBookTitle)) { ValidationMessage message = getValidationFactory().createMessage(ValidationLevel.WARNING, "NSFW_MATERIAL", "This book contains NSFW material."); validatorSet.addMessage("user.books[2].title", message); }
Explanation :
Validation Set
.
user
(as a JsonObject
)
that we're going to validate.
user
. We use a
JsonPath to target it!
Validation Message
to
represent the validation result.
level
of this Validation Message.
Here, it's going to be a Warning Validation Message
. The two other possible levels are
Error
and Success
.
code
(or "type") of the validation
the Validation Message
is associated with.
text
for the Validation Message
.
Validation Message
to the
Validation Set
using the "user.books[2].title"
validation key.
We'll see in the next section that using the
JsonPath
of the validated element as its validation key is often
a good idea!
Validation Sets
also provides some methods to quickly add
Validation Messages
, without having to create the messages manually.
For example :
// Creates and adds an Error Validation Message validatorSet.addError("user.books[2].title", "LENGTH", "The title is too long"); // Creates and adds a Warning Validation Message validatorSet.addWarning("user.books[2].title", "LENGTH", "The title is rather long"); // Creates and adds a Success Validation Message validatorSet.addSuccess("user.books[2].title", "LENGTH", "The title length is perfect");
A validation key
is used to associate
Validation Messages
to the validated element they have been created for.
You can think of a Validation Set
as a big
Map<String, List<ValidationMessage>>
where the keys
are validation keys
and where the values are the
Validation Messages
.
If you validate a simple email element for example, you could use "email"
or "email-validation"
as the validation key. It's up to you to choose
a meaningful name for the key : you will later use it to retrieve all the Validation Messages
associated with this element so you can display them, create a report from them, etc.
Even if you can use any string as a validation key, we suggest that you stick to some conventions since a validation key must be unique and should well represent the element it is associated with.
The convention we suggest is that, when possible, you
use the JsonPath
of the validated element as the validation key.
Let's say we validate this user
object :
{ "name": "Stromgol", "email"<EMAIL_ADDRESS>"books": [ { "title" : "Dune", "author": "Frank Herbert" }, { "title" : "The Hitchhiker's Guide to the Galaxy", "author" : "Douglas Adams" } ] }
First, we will validate the email :
JsonObject user = getUser(); // We create a Validation Set ValidationSet validationSet = getValidationFactory().createValidationSet(); if(!isEmailValid(user.getString("email"))) { // We add a Validation Message using "email" as the validation key validationSet.addError("email", "EMAIL_VALIDATION", "Invalid email"); }
We can later retrieve the Validation Messages
associated
with the email element using that "email"
validation key :
List<ValidationMessage> validationMessages = validationSet.getMessages("email");
Very straightforward! But now let's try to do the thing with the title of the first book :
// Gets the title of the first book, using its JsonPath String title = user.getString("books[0].title"); if(!isTitleValid(title) { // We add a Validation Message using "title" as the validation key... // This may not be a good idea! validationSet.addError("title", "TITLE_VALIDATION", "Invalid title"); } List<ValidationMessage> validationMessages = validationSet.getMessages("title");
We may be tempted to use a very short name as the validation key, "title"
for example. It would work, but it's not a very good idea... The problem is that now
the validation key doesn't well represent
the validated element it is associated with. Remember that each validation key
must be unique. What happens if we also want to validate the
title of the second book? Or if there are more than one user with books to validate?
What validation keys will we use then? We can't use the same "title"
validation key for more than one element!
Since each element of a JsonObject
already has a unique identifier, which is its
JsonPath, why not use this identifier as
its validation key?
// Gets the title of the first book, using its JsonPath String title = user.getString("books[0].title"); if(!isTitleValid(title) { // We add a Validation Message using the JsonPath // of the validated element as the validation key : // much better! validationSet.addError("books[0].title", "TITLE_VALIDATION", "Invalid title"); } List<ValidationMessage> validationMessages = validationSet.getMessages("books[0].title");
Now there won't be any conflict, even if there are a lot of validation keys in our
Validation Set
, and every key will be clearly indicate which validated
element it is associated with!
Note that there are situations where you can't use a JsonPath
for a validation key. You don't always validate elements individually, for instance. Sometimes,
a combination of elements is invalid, and therefore no JsonPath
is available.
In those situations, we suggest that you scope the validation key as much as possible, and that you use creativity in order to make the key unique and meaningful!
For example, let's say that an HTML
form has been submitted
and you need to validate that two passwords from it match. If they don't match,
you could had an Error Validation Message
for both of those elements, or only
for the second one (you could say that only the second one is invalid since it doesn't match the first one).
But you could also want to add a Validation Message
to represent that invalid combination,
not the fields taken individually.
You may want to display a "The passwords
don't match"
error in the section where both fields are, for example.
In such situations, you can't use a JsonPath
as the validation key, since you are
not referring to a single element. But we suggest that you still try to scope the validation key,
so it is as unique and meaningful as possible. For example, that key could be
"myForm.user.passwordsMatch"
:
ValidationSet validationSet = getValidationFactory().createValidationSet(); JsonObject formData = context.request().getFormData(); // Gets the passwords using their JsonPath String password1 = formData.getString("myForm.user.password1", ""); String password2 = formData.getString("myForm.user.password2", ""); if(!password1.equals(password2)) { // Use a scoped and meaningful // validation key, even if it's not // a true JsonPath! validationSet.addError("myForm.user.passwordsMatch", "PASSWORDS_MATCH", "The password don't match!");
A question remains : what happens to this "Use the JsonPath of a validated element as its validation key"
convention when we validate an element
using an external Validator? For example, we may have a TitleValidator
that can be reused in multiple places in our application. For example :
ValidationSet validationSet = getValidationFactory().createValidationSet(); String title = getUser().getString("books[0].title"); TitleValidator titleValidator = getTitleValidator(); ValidationSet titleValidationSet = titleValidator.validate(title); validationSet.mergeValidationSet(titleValidationSet); // Oups! // The validation key is "title" here, not "books[0].title" as we // would like... List<ValidationMessage> messages = validationSet.getMessages("title");External validators return a
Validation Set
and you merge
this set to your own local set [9] (you can learn
more about merging Validation Sets
in the
Sharing / Merging Validation Sets section).
The problem here is that TitleValidator
has no idea of the position of the
"title"
element inside our local user object! It will see the "title"
element
as being a root element and therefore it won't generate a validation key respecting our local
JsonPath
... It will probably simply use "title"
as the validation key.
For this reason, the mergeValidationSet(...)
method accepts a "validationKeyPrefix"
parameter. If this parameter is specified, all the validation keys
will be prefixed with it when merged :
ValidationSet validationSet = getValidationFactory().createValidationSet(); String title = getUser().getString("books[0].title"); TitleValidator titleValidator = getTitleValidator(); // We use the external validator ValidationSet titleValidationSet = titleValidator.validate(title); // We prefixe the merged validation keys validationSet.mergeValidationSet("books[0].", titleValidationSet); // The Validation Messages can now be retrieved using // JsonPaths thast are valid on our validated root object! List<ValidationMessage> messages = validationSet.getMessages("books[0].title");
There is also a prefixValidationKeys(...)
method which can be used to prefix the validation keys of a Validation Set
directly, without having to merge
this set into another one. This can be useful, for example if you want to prefix the validation keys before adding
a Validation Set
to a JsonObject
:
// Uses an external validator ValidationSet validationSet = getExternalValidator().validate(someObject); // Prefixes the resulting validation keys // *directly on the Validation Set* validationSet.prefixValidationKeys("someObject."); // Adds the Validation Set (with the validation keys // now modified) to the response model context.response().getModel().set("validation", validationSet);
Spincast provides some predefined validations to help validate an object. They are defined on the ValidationSet interface so there are easily accessible during a validation process. Let's have a look at an example :
// We create an inital Validation Set ValidationSet myValidatorSet = getValidationFactory().createValidationSet(); // This is a username we're going to validate! String username = getSomeUsername(); // Validates that the username is not blank and, only if // it's not, validates that it contains at least 3 characters. ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("username") .element(username) .validate(); if(lastResult.isValid()) { lastResult = myValidatorSet.validationMinLength(3) .key("username") .element(username) .validate(); }
Notice that a predefined validation returns it's own Validation Set
[9]! This
allows you to conditionally apply a validation depending on the result of a previous
one [13].
To use a predefined validation :
validateXXXXXX(...)
method
on your Validation Set
. For example : myValidatorSet.validationNotBlank()
.
This starts a builder to create the validation.
validation key
using the "key(...)"
method on the builder. This key associate
the resulting Validation Messages
to the validated elements.
For example :
.key("username")
.
element
to validate. For example :
.element(username)
.
.validate()
to perform the actual validation.
When the validate()
method is called, the validation
is perform and :
Validation Messages
are automatically added to the root Validation Set
.
Validation Set
, representing this particular validation only, is
returned. This allows you to conditionally apply a validation depending on the result of a previous
one.
Here's the list the predefined validations available on a Validation Set
:
ValidationBuilderKey validationNotBlank()
null
, empty or
spaces only).
ValidationBuilderKey validationBlank()
ValidationBuilderKey validationEmail()
ValidationBuilderKey validationNotNull()
ValidationBuilderKey validationNull()
ValidationBuilderKey validationPattern(String pattern)
ValidationBuilderKey validationNotPattern(String pattern)
ValidationBuilderKey validationSize(int size, boolean ignoreNullValues)
ValidationBuilderKey validationMinSize(int minSize, boolean ignoreNullValues)
ValidationBuilderKey validationMaxSize(int maxSize, boolean ignoreNullValues)
ValidationBuilderKey validationLength(int length)
ValidationBuilderKey validationMinLength(int minLength)
A null
value makes this validation fail, otherwise
toString()
is called on the object to
check its "length".
ValidationBuilderKey validationMaxLength(int maxLength)
A null
value is a success, otherwise
toString()
is called on the object to
check its "length".
ValidationBuilderKey validationEquivalent(Object reference)
Starts the creation of a "equivalent" validation.
To validate if an element is equivalent to another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements are not equivalent. When both
elements are of the same type, they are compared using their equals(...)
method. This process is done in the
ObjectConverter#isEquivalent(...)
method.
ValidationBuilderKey validationNotEquivalent(Object reference)
Starts the creation of a "not equivalent" validation.
To validate if an element is equivalent to another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements are not equivalent. When both
elements are of the same type, they are compared using their equals(...)
method. This process is done in the
ObjectConverter#isEquivalent(...)
method.
ValidationBuilderKey validationLess(Object reference) throws CantCompareException
Starts the creation of a "less than" validation.
To validate if an element is less than another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements can't be compared.
The resulting type of the elements must implement the Comparable
interface,
so the compareTo(...)
method is used to compare the two elements.
An null
element is always less than a non-null
element.
ValidationBuilderKey validationGreater(Object reference) throws CantCompareException
Starts the creation of a "greater than" validation.
To validate if an element is greater than another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements can't be compared.
The resulting type of the elements must implement the Comparable
interface,
so the compareTo(...)
method is used to compare the two elements.
An null
element is always less than a non-null
element.
ValidationBuilderKey validationEquivalentOrLess(Object reference) throws CantCompareException
Starts the creation of a "equivalent or less" validation.
To validate if an element is equivalent or less than another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements can't be compared.
The resulting type of the elements must implement the Comparable
interface,
so the compareTo(...)
method is used to compare the two elements.
An null
element is always less than a non-null
element.
ValidationBuilderKey validationEquivalentOrGreater(Object reference) throws CantCompareException
Starts the creation of a "equivalent or greater" validation.
To validate if an element is equivalent or greater than another,
one is converted to the type of the other (when this is required).
If this conversion fails, the elements can't be compared.
The resulting type of the elements must implement the Comparable
interface,
so the compareTo(...)
method is used to compare the two elements.
An null
element is always less than a non-null
element.
Some options are available during the process of using a predefine validation :
Instead of validating a single element, using the
"element(...)"
method of the builder, you can validate
a JsonArray
of elements by using
the "all(...)"
method. Doing so, all the
elements of the array will be validated and some
Validation Messages
will potentially be added
for each of them!
Note that, when such array is validated, the generated validation keys
are going to be the key of the array + the
position of the elements in the array. For example :
ValidationSet myValidatorSet = validationFactory.createValidationSet(); JsonArray titles = getJsonManager().createArray(); titles.add("A valid title"); titles.add(""); titles.add(" "); titles.add(null); // Using ".all(titles)", this validates all the elements // of the array ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("titles") .all(titles) .validate();
Validation Set
will contain
three Error Validation Messages
: one with the key "titles[1]"
,
one with the key "titles[2]"
, and one with the key "titles[3]"
.
The first title ("titles[0]"
) is valid so no Validation Message
will be added for it.
Validation Message
is added
only when the validation fails. If you want to add a Success Validation Message
,
when the validation is sucessful, you can use the "addMessageOnSuccess(...)"
method.
For example :
ValidationSet myValidatorSet = validationFactory.createValidationSet(); JsonArray titles = getJsonManager().createArray(); titles.add("A valid title"); titles.add(""); ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("titles") .all(titles) .addMessageOnSuccess() .validate();
Validation Set
will contain
two Validation Messages
: a Success Validation Message
with the key "titles[0]"
and an Error Validation Message
with the key "titles[1]"
.
"addMessageOnSuccess(...)"
method, you can
specify the text
that is going to be used for the message
(instead of the default one). For
example :
ValidationSet myValidatorSet = validationFactory.createValidationSet(); JsonArray titles = getJsonManager().createArray(); titles.add("A valid title"); titles.add(""); ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("titles") .all(titles) .addMessageOnSuccess("A custom Success message!") .validate();
Error Validation Message
is generated by default.
If you want the failure of a validation to generate a
Warning Validation Message
instead,
use the "treatErrorAsWarning()"
method. But remember that a Validation Set
containing Warning Validation Message
is still considered as being
valid, only Error Validation Messages
make it invalid! For example :
ValidationSet myValidatorSet = validationFactory.createValidationSet(); String username = ""; ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("username") .element(username) .treatErrorAsWarning() .validate(); // There is now one *Warning* Validation Message // in our Validation Set myValidatorSet.getMessages().size(); // == 1 // The level of the Validation Set is "Warning" myValidatorSet.isWarning(); // true myValidatorSet.isError(); // false myValidatorSet.isSuccess(); // false // The Validation Set is still valid! myValidatorSet.isValid(); // true
Validation Message
when a validation fails, using the
"failMessageText(...)"
method. The specified
text will then be used for the Error Validation Message
if one
is generated, but also for a Warning Validation Message
if
"treatErrorAsWarning()"
is used.
You can specify that a validation must not be run if some Validation Messages
at a specific level already exist in the Validation Set
.
Let's say for example that
you want to validate that a username
contains at least 3 characters
but you only want to perform this validation if the username
is not blank
in the first place! You
could do this programmatically, but you can also pass a special parameter to the
validate(...)
method :
ValidationSet myValidatorSet = validationFactory.createValidationSet(); String username = ""; ValidationSet lastResult = myValidatorSet.validationNotBlank() .key("username") .element(username) .validate(); // This validation is only going to be performed if // the Validation Set doesn't contain any errors yet lastResult = myValidatorSet.validationMinLength(3) .key("username") .element(username) .validate(ValidationLevel.ERROR);
In this example, the resulting Validation Set
will only contain
one Validation Message
: the one for the
"Not Blank" validation. The "Minimum Length" validation
is not performed since the Validation Set
already contains a
Validation Message
at the Error
level!
Also note that "validate(true)"
is a shortcut for
"validate(ValidationLevel.ERROR)"
. It means
"Only run this validation
is the Validation Set is still valid!".
If you are validating a JsonArray
, by using the "all(...)"
method,
then a couple of extra methods are also available :
arrayItselfAddFailMessage()
: if you call this
method, a Validation Message
will be added for the array itself if
the validation for at least one of its elements fails. The validation key for this
message will be the specified validation key (remember that
the keys for the elements of the array are going to be the
specified validation key + the position of the elements in the array).
You can also specify the text
to use for that message (instead of the default one) :
arrayItselfAddFailMessage("Some elements are invalid!")
arrayItselfAddSuccessMessage()
: if you call this
method, a Validation Message
will be added for the array itself if
the validation is successful for all its elements. The validation key for this
message will be the specified validation key (remember that
the keys for the elements of the array are the specified validation key +
the position of the elements in the array).
You can also specify the text
to use for the message (instead of the default one) :
arrayItselfAddSuccessMessage("All good!")
Validating a JsonObject is very easy : you simply
use its "validationSet()"
method to get a Validation Set
specifically
made to validate it. For example :
JsonObject user = getUser(); JsonObjectValidationSet userValidationSet = user.validationSet(); ValidationSet lastResult = userValidationSet.validationEmail() .jsonPath("email") .validate();
Explanation :
Validation Set
from a JsonObject
, the type
of this set is JsonObjectValidationSet.
This type extends the ValidationSet base type
and adds some extra functionalities.
Validation Set
is bound to a specific JsonObject
, a new
"jsonPath(...)"
method is available! It allows you
to specify the JsonPath to the
element to validate on the current object, and will also be used as
the validation key.
By calling the "validationSet()"
method on a JsonObject
, you get a
JsonObjectValidationSet
instance. This type extends the ValidationSet base type
and adds some extra functionalities.
With a JsonObjectValidationSet
, you don't need
to specify a "key(...)"
to use or an "element(...)"
to validate! You
simply specify the jsonPath(...)
to the element to
validate. The resulting Validation Messages
, if any,
will have that JsonPath
as their validation keys. For example :
JsonObject user = getJsonManager().create(); user.set("email", "nope"); JsonObjectValidationSet userValidationSet = user.validationSet(); // The Validation Set is bound to the "user" object here, // so we use a JsonPath starting from this object as the root // to target the "email" element to validate ValidationSet lastResult = userValidationSet.validationEmail() .jsonPath("email") .validate(); // The generated validation key is the JsonPath of // the validated element! List<:ValidationMessage> messages = userValidationSet.getMessages("email"); System.out.println(messages.size()); // prints "1" ValidationMessage message = messages.get(0); System.out.println(message.getValidationLevel()); // prints "ERROR" System.out.println(message.getCode()); // prints "VALIDATION_TYPE_EMAIL" System.out.println(message.getText()); // prints "Invalid email address"
Finally, note that there is also a "jsonPathAll(...)"
method to validate
all the elements of a JsonArray
.
You can merge a Validation Set
into another one using the
mergeValidationSet()
method. This allows you to make some elements being validated by an external validator
and then merge the resulting Validation Messages
in your local Validation Set
.
Let's say you have a CompanyValidator
object that
provides a validateCompany(...)
method able to validate
a "company" JsonObject
:
// The user object we're going to validate JsonObject user = getUser(); // The local Validation Set bound to our "user" object JsonObjectValidationSet userValidationSet = user.validationSet(); // We validate the email of the user directly ValidationSet lastResult = userValidationSet.validationEmail() .jsonPath("email") .validate(); // We use an *external validator* to validate the company // of the user ValidationSet companyValidationSet = getCompanyValidator().validateCompany(user.getJsonObject("company")); // We merge the Validation Set of the company validation // to our local set! userValidationSet.mergeValidationSet("company.", companyValidationSet);
Explanation :
user
object
containing an email
and a company
field, and we want to validate it.
Validation Set
of the user : this set will contain all the Validation Messages
at the end
of the validation process.
Validation Set
.
Validation Set
containing the Validation Messages
resulting from this company validation.
19 : We merge the
Validation Set
for the company element into our user Validation Set
,
and we scope its validation keys using the "company."
prefix.
At this point, the user Validation Set
contain both the Validation Messages
for the email
field, and the Validation Messages
for
the company
field. If printed, the set
would look something like this, given that both the email
and
the company
were invalid :
messages = { email = [Invalid email address - VALIDATION_TYPE_EMAIL] java.util.ArrayList company.name = [Can't be empty - VALIDATION_TYPE_NOT_BLANK] java.util.ArrayList }
When you merge two Validation Sets
, don't forget to scope the merged
validation keys (if required)... Learn more about this in the Validation Keys
section!
Being able to share and merge Validation Sets
allows you to be creative and structure your
application as you wish. You can have standalone validators that are used in multiple places and situations.
When your validation is done, you will want to use the Validation Messages
saved in
the Validation Set
. In some cases, you need to serialize them to Json
, for example to
send them as a response to an Ajax
call.
To do that, you simply call the convertToJsonObject()
method on the Validation Set
. This will convert the set to a JsonObject which, in turn,
can easily be serialized to a plain Json
string.
When you convert a Validation Set
to a JsonObject
, an
extra root element is added (in addition to the Validation Messages
) :
"_"
. This special "_"
element summarizes the validation performed using the
Validation Set
. It contains those fields :
isValid
: Is the whole set valid? It is if it contains no Error Validation Messages
.
hasErrors
: Does the set contain Error Validation Messages
?
hasWarnings
: Does the set contain Warning Validation Messages
?
hasSuccesses
: Does the set contain Success Validation Messages
?
Have a look at the Displaying validation messages section to
see the use of this "_"
element in action!


MKFONTSCALE
Section: User Commands (1)Updated: mkfontscale 1.0.7
Index Return to Main Contents
NAME
mkfontscale - create an index of scalable font files for XSYNOPSIS
mkfontscale [ -b ] [ -s ] [ -o filename ] [ -x suffix ] [ -a encoding ] ... [ -f fuzz ] [ -l ] [ -e directory ] [ -p prefix ] [ -r prefix ] [ -n prefix ] [ -- ] [ directory ] ...DESCRIPTION
For each directory argument, mkfontscale reads all of the scalable font files in the directory. For every font file found, an X11 font name (XLFD) is generated, and is written together with the file name to a file fonts.scale in the directory.The resulting fonts.scale file should be checked and possibly manually edited before being used as input for the mkfontdir(1) program.
OPTIONS
- -b
- read bitmap fonts. By default, bitmap fonts are ignored.
- -s
- ignore scalable fonts. By default, scalable fonts are read. If -b is set, this flag has the side effect of enabling the reading of fonts.scale files.
- -o filename
- send program output to filename; default is fonts.scale if bitmap fonts are not being read, and fonts.dir if they are. If filename is relative, it is created in the directory being processed. If it is the special value -, output is written to standard output.
- -x suffix
- exclude all files with the specified suffix.
- -a encoding
- add encoding to the list of encodings searched for.
- -f fuzz
- set the fraction of characters that may be missing in large encodings to fuzz percent. Defaults to 2%.
- -l
- Write fonts.dir files suitable for implementations that cannot reencode legacy fonts (BDF and PCF). By default, it is assumed that the implementation can reencode Unicode-encoded legacy fonts.
- -e
- specifies a directory with encoding files. Every such directory is scanned for encoding files, the list of which is then written to an "encodings.dir" file in every font directory.
- -p
- Specifies a prefix that is prepended to the encoding file path names when they are written to the "encodings.dir" file. The prefix is prepended literally: if a `/' is required between the prefix and the path names, it must be supplied explicitly as part of the prefix.
- -r
- Keep non-absolute encoding directories in their relative form when writing the "encodings.dir" file. The default is to convert relative encoding directories to absolute directories by prepending the current directory. The positioning of this options is significant, as this option only applies to subsequent -e options.
- -n
- do not scan for fonts, do not write font directory files. This option is useful when generating encoding directories only.
- --
- end of options.
SEE ALSO
X(7), Xserver(1), mkfontdir(1), ttmkfdir(1), xfs(1), xset(1)NOTES
The format of the fonts.scale, fonts.dir and encodings.dir files is documented in the mkfontdir(1) manual page.Mkfontscale will overwrite any fonts.scale file even if it has been hand-edited.
mkfontscale -b -s -l is equivalent to mkfontdir.
AUTHOR
The version of mkfontscale included in this X.Org Foundation release was originally written by Juliusz Chroboczek<EMAIL_ADDRESS>for the XFree86 project. The functionality of this program was inspired by the ttmkfdir utility by Joerg Pommnitz.
Index
This document was created by man2html, using the manual pages.
Time: 05:29:06 GMT, December 24, 2015


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Reader java.io.InputStreamReader java.io.FileReader de.iabg.mode.io.NastranPunchReader
public class NastranPunchReader
This implementation of ModeReader
parses a Nastran file containing
mode shape data. Refer to ModeReader
class API for more details.
The Nastran file can contain an undefined number of mode shapes, with each
mode shape having a frequency and a name or identifier. This parser is
designed to read in all of this data. Refer to the latest version of the
MSC.Nastran Quick Reference Guide for more information for the file format.
| Field Summary | |
|---|---|
protected static int |
COMMENT_FORMAT
A constant for comments |
protected java.util.ArrayList<java.lang.String> |
data_
A list for the data from the file |
protected static int |
MODE_FORMAT
A constant for mode lines |
protected ModeMatrix |
modes_
Storage for the modes |
protected static int |
NODE_CONTINUOUS_FORMAT
A constant for node continuation lines |
protected static int |
NODE_FORMAT
A constant for node lines |
protected static int |
UNDEFINED_FORMAT
A constant for undefined lines |
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
NastranPunchReader(java.io.File file)
Constructs a NastranPunchReader from the given file. |
| Method Summary | |
|---|---|
protected java.lang.String |
fillFields(java.lang.String line)
If the length of the given line is less than 72 characters, white space characters are appended to the line until it reaches that size. |
protected int |
getFormat(java.lang.String line)
Returns the format of the given line. |
protected int |
getModeCount()
Returns the number of modes in the data. |
protected int |
getNodeCount()
Returns the number of nodes in the data. |
void |
importModes(ModeMatrix modes)
Clears the given modes and replaces them with the data parsed from the internally stored file. |
void |
readFile()
Internally saves the data from the file for later use. |
protected void |
setModeAt(java.lang.String line,
int modeIndex)
Parses the given line and sets the mode name and frequency at the given mode index. |
protected void |
setNodeAt(java.lang.String line,
int modeIndex,
int nodeIndex)
Parses the given line and sets the x, y, and z-translations at the given mode and node indices. |
| Methods inherited from class java.io.InputStreamReader |
|---|
close, getEncoding, read, read, ready |
| Methods inherited from class java.io.Reader |
|---|
mark, markSupported, read, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int COMMENT_FORMAT
protected java.util.ArrayList<java.lang.String> data_
protected static final int MODE_FORMAT
protected ModeMatrix modes_
protected static final int NODE_CONTINUOUS_FORMAT
protected static final int NODE_FORMAT
protected static final int UNDEFINED_FORMAT
| Constructor Detail |
|---|
public NastranPunchReader(java.io.File file) throws java.io.FileNotFoundException
NastranPunchReader
from the given file.
file
- the file to be imported
java.io.FileNotFoundException
- if the file could not be found| Method Detail |
|---|
protected java.lang.String fillFields(java.lang.String line)
line
- the line to be filled
protected int getFormat(java.lang.String line)
line
- the line to be parsed
protected int getModeCount()
protected int getNodeCount()
public void importModes(ModeMatrix modes)
ModeReader
ModeReader.readFile()
, otherwise no data will be saved.
importModes
in interface ModeReader
modes
- the ModeMatrix
where the data will be storedpublic void readFile() throws java.io.IOException
ModeReader
readFile
in interface ModeReader
java.io.IOException
- if the file could not be readprotected void setModeAt(java.lang.String line, int modeIndex)
line
- the line to be parsedmodeIndex
- the index of the modeprotected void setNodeAt(java.lang.String line, int modeIndex, int nodeIndex)
line
- the line to be parsedmodeIndex
- the index of the modenodeIndex
- the index of the node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |