text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
Introduction: Simple Phone Stand and Charging Dock Welcome to this instructable. Today i am going to show you the design process of a simple phone stand and charging dock. This is a simple light weight phone dock and charging station Supplies 1. A 3D Printer 2. Some 3D Printer Filament (Any Color) 3. Some Adhesive (Optional but recommended) Step 1: Mesure the Size of Your Phone Using any tool of your choice, Measure the length and thickness of your smartphone. You also need to locate the charging port and get the dimensions of the port. Step 2: Import a Solid Shape (Cube) Using the measurements acquired in the previous step, resize the shape's length to the length of your Smart Phone. This shape will be the base shape of your dock *Shape in photo is not to scale Step 3: Import a Hole Import a cube as a hole. using the dimensions acquired in step 1 once again make the hole the same length as the base shape and make the thickness the same to the thickness of your phone but add 1 millimetre (to allow a slanted angle for you phone) Step 4: Move the Hole Lift the hole made in step 3 to about 1-2 centimetres and then move the hole to a similar position as shown in the picture. *Shape in picture not to scale Step 5: Import a Backplate (Cube) Import a back plate for your dock. This will be where the back of your phone rests on. when importing a cube resize the length to be the same as the main shape and change its thickness to 3mm. (This is shown as the blue shape) Step 6: Moving Your Back Plate Move the back plate we imported in Step 5 to a similar position as showed in the picture. after which you should group the shape. Step 7: Importing Your Charging Output Slot (Cube) Import another hole. after which you should measure the dimensions of the output connection of the wire you are planning to use. Make the hole slightly bigger than the port. Make sure to lift the hole a few millimetres. Step 8: Importing Your Charging Input Slot import another hole. But instead of making it tall make it long. measure the size of the usb port connecting to the charger. use the dimensions but add a millimetre or two. make sure to lift this shape as much as you lifted the hole in step 7. Also check if your hole is poking out the other side. if it is shorten it (But it should still be connected to the other hole) Step 9: Congratulations! You Have Completed This Build! Hopefully this print turned out as expected. If you want to print a small test model to check the design. one is available linked to this step. Hope you enjoyed making this build. Be the First to Share Recommendations
https://www.instructables.com/Simple-Phone-Stand-and-Charging-Dock/
CC-MAIN-2021-43
refinedweb
488
81.43
Wow, this is my first entry. I feel enlightened already :) Well, it is yet another weekend for me without my car. It has been in the shop now for two weeks. Being trapped in my house forces me to concentrate on code even harder. Today I began working on some skeleton code for a simple filesystem for BSD. Right now it doesn't do much, but there are greater plans afoot! It is not a file storing file system, but rather a proc style file system concept. A month or so ago I wrote a quick and dirty language that had a pretty impressive symbol table system. my hopes and dreams are to integrate that language with this filesystem. essentially what this would give you is a programming environment which could be debugged and or interacted with from an outside process via a simple file system interface. Imagine this senario: The Following lines of code could be executed by the mangle interpreter (The little language I mentioned earlier). def string mystring;Now, at the same time, a seperate process inspects the programs symbol table via the file system: mystring="Hello World!"; # cd /mangle/$MANGLE_PID/symboltable/Now, returning back to the mangle interpreter, the session continues without a burp: # ls mystring # cat mystring Hello World! # echo "Smello World" > mystring # cat mystring Smello World # print mystring; #the program prints out "Smello World"Now back to the file system, we see the new changes: undef mystring; def number foo; def ref bar; foo = 5; bar -> foo; # ls -l /mangle/$MANGLE_PID/symboltable/ rw-r---- root wheel foo rw-r---- root wheel bar # cat foo 5 # cat bar ->foo # This is how pathetic I am, I really have nothing better to do with my time. I actually love this stuff. Needless to say, I am still single.
http://www.advogato.org/person/harbourn/diary.html?start=0
CC-MAIN-2015-11
refinedweb
302
69.92
Introduction to Unity Scripting – Part 1 Scripting is an essential part of making even the simplest of games. These small collections of code work together to do all sorts of things. Version - C# 7.3, Unity 2019.2, Unity Scripting is an essential part of making even the simplest of games. These small collections of code work together to do all sorts of things: From moving a character around the screen to keeping track of your inventory. Game developers write scripts in Unity in C#, a powerful object-oriented programming language developed by Microsoft around the year 2000. It has since grown to be one of the most popular programming languages out there. The Unity team chose C# as Unity’s main programming language because it’s well documented, easy to learn and flexible. Unity has a well-documented API at its core that scripts can communicate with. In this tutorial, you’ll be creating a simple game — starting with a few models, while learning how to use the most important parts of the Unity API. You’ll learn how to create C# scripts that: - Create variables that can be changed in the editor. - Detect player input and react to it. - Use physics to create interactions. - Change values over time in several different ways. Before starting off, make sure you meet the following requirements: - The latest stable version of Unity is installed on your machine. - A scripting IDE that supports C# is installed on your machine. I recommend Visual Studio Community on Windows and Visual Studio Code on macOS and linux. - You know the basics of C#. If you’re new to programming, follow along with Brian’s Beginning Programming with C# video course first. If you want to dive deep into C# straight away, pick up a copy (or download the free PDF version) of the C# Programming Yellow Book, that’s how I learned how to use C#. With that out the way, you’re ready to discover the Unity API by making a simple game! Getting Started Download the materials for the project using the Download Materials button at the top or bottom of this tutorial, unzip it somewhere and open the starter project inside Unity. To start off, direct your attention to the Project window and unfold the RW folder. This project comes with a bunch of pre-made assets that you’ll be using to blow life into the game with scripting: To focus on the scripting, here’s the included asset folders and their content: - Materials: A single material that’s shared between all models for optimal performance. - Models: Some models that range from a small smoke puff to the big ground model . - Music: The background music for the game. The song is Flying Kerfuffle by Kevin MacLeod. - Prefabs: A bunch of pre-made prefabs to make it easier to make changes to GameObjects already present in the scenes. - Scenes: A Game and a Title scene. - Scripts: Empty! Here’s where you’ll place the scripts you’ll be creating. - Sounds: A few 8-bit sound effects created using bfxr. - Sprites: There’s a single sprite sheet in here for some small UI elements. - Textures: A single texture that’s used by the shared material. Now, open up the Game scene under RW/Scenes if it isn’t opened yet and take a look around in the Scene view. There are some floating islands with windmills, bridges and a small rail line with a blue hay machine sitting on top. Now, take a glance at the Hierarchy: Here’s a quick overview of the GameObjects: - Music: An audio source playing a happy tune on loop. - Main Camera: The camera that points down at the scene to give a good overview. - Directional Light: A single light source that emulates a sun. - Scenery: This GameObjects hold the ground and the windmills. - Hay Machine: This is the blue machine sitting on the rails. It’s made out of a few GameObjects to make it easy to customize later on. Next, click the play button at the top of the editor and take a look at the Game view to see what happens. The only signs of life at the moment are the smoke particles flying up from the hay machine. It won’t win any game of the year awards any time soon, but it’s a good foundation to build on. :] Click the play button again to stop testing the “game”. Now that you’re familiar with the project, it’s time to get scripting! Your First Script Creating new scripts in Unity is quite easy. Right-click the RW/Scripts folder, select Create ► C# Script and name the script Rotate. Unity now creates and immediately compiles a bare bones MonoBehaviour script. While the script won’t do anything yet, you can already use it as a component by attaching it to a GameObject. In this case, the Rotate script will turn the wheels of all windmills around. Components are instances of scripts, meaning that you can add as many of the same component to any GameObject as you like. Any changes made to the script will reflect in all its components. Unfold Scenery in the Hierarchy to reveal its children. Open Windmill in the prefab editor by clicking the arrow next to its name. Select Wheel, it’s the grandchild of Windmill. Now, click the Add Component button at the bottom of the Inspector, start typing “rotate” until the Rotate component appears in the list and select it. This will add the Rotate component to the wheels of all windmills. To edit the script, you’ll need to open it in a code editor like Visual Studio. There are a few ways of opening a script, but the easiest ways are by either finding the source file in the Project window and double-clicking it. Double-clicking the Script field of any component also works: Use any of the methods above to open the Rotate script in your default code editor. Here’s what that looks like in Visual Studio: The script itself is a single class that derives from MonoBehaviour, Unity’s base class that all scripts should derive from if they need to be used as components. MonoBehaviour is part of the UnityEngine namespace and implements a few public methods but — more importantly — a huge list of event functions. Unity adds the Start and Update methods by default to all new scripts. These are actually event functions, they get called when a specific action triggers them. Here’s a handful of the most common event functions and when they get called: - Start: First time the component is initialized. - Update: Every frame. - OnEnable: When the component is (re)enabled. - OnDestroy: When the component is destroyed. You’ll be using a lot more of them over the course of this tutorial as they’re an essential part of scripting. You can check out the full list of event functions in Unity’s documentation. Add the following line inside of Update: transform.Rotate(0, 50 * Time.deltaTime , 0); This single line that does a constant rotation on the Y-axis over time already shows some of the abilities of the Unity API: transformis an inherited property of MonoBehaviour. It returns the Transform of the GameObject the component gets attached to. The Transformclass allows you to read and change a GameObject’s position, rotation and scale. Rotateis one of the public methods of the Transformclass, one of its signatures is used here to pass on a rotation in degrees to the X, Y and Z axes respectively. - The value passed for the Y-axis is 50 * Time.deltaTime. Time.deltaTimeis part of the UnityEnginenamespace and returns the time in seconds between the last and the current frame. This value can change values over time independent of framerate. In essence, this prevents stuff from going slow motion on slow machines and into hyper mode on faster ones. Multiplying the value from Time.deltaTimewith 50 means that you want the value to increase by 50 per second. In this case that’s a rotation of 50 degrees on the Y-axis over the time span of a second. As this line has been added to Update, it gets executed every frame while the component is enabled. This results in a smooth, constant rotation. Save this script and return to the editor. You’ll the notice the editor will be unresponsive for a very short time while it’s compiling. You can check when this compilation is happening by looking at the bottom right corner of the editor, there will be a small animated icon: If you haven’t exited the Prefab editing mode, do so now by clicking the left pointing arrow next to the Windmill prefab in the Hierarchy. You’ll be prompted to Save or Discard your changes. Click Save. Now, play the scene. You’ll notice the windmill wheels are now slowly turning around, so relaxing. Now, let’s say you want to tweak how fast the wheels are turning, or you want to add the Rotate component to another GameObject that needs to turn on a different axis. Wouldn’t it be nice if you could change those values in the editor? That’s where variables come in! Variables Variables are containers of data that store information. These can range from the player’s lives and money to a reference to a prefab to spawn into the scene. Once you add these to a script, you can edit their values in the editor. Open the Rotate script in your favorite code editor and add the following line right above the Start method: public Vector3 rotationSpeed; This variable will change how fast and on what axis the rotation happens. The public access modifier in the context of Unity means that this variable will be exposed to the editor and other classes. A Vector3 is a struct that stores an X, Y and Z value, a Vector3 can be used to pass on the position, rotation or scale of a GameObject. Now replace this line: transform.Rotate(0, 50 * Time.deltaTime , 0); With the following: transform.Rotate(rotationSpeed * Time.deltaTime); The rotation speed now gets fed into the Rotate method using a variable, making it easy to change. Vectors can be multiplied with single value variable types like deltaTime to change all included values of the vector at once. For example, a Vector3 with a value of (X:1, Y:2, Z:3) multiplied with a float with a value of 3 will result in a Vector3 with a value of (X:3, Y:6, Z:9). Always opt for a variable instead of a “magic number” like the 50 you added in before. Doing so will allow you to change and reuse values without having to open the script. Now, save the script and return to the editor. Open the Windmill prefab from the Hierarchy as you did before, and select the Wheel grandchild GameObject again. Take a look at the Inspector, the Rotate component now has a field that you can adjust: Change the Y value of the Rotation Speed field to 120 and exit the prefab mode by clicking the arrow at the top left of the Hierarchy, saving your changes when prompted. Now, play the scene. The wheels are rotating like before, albeit a tad faster. A huge advantage of having variables exposed in the editor is that you can change them while in play mode! Select the wheel of one of the windmills in the Hierarchy and try changing the Rotation Speed. You can slide the Y value from left to right or change the number directly. Doing so will result in the wheel changing its speed in real time: Once you stop play mode, any values you’ve set on GameObjects in the Hierarchy will be reset. This is a great way to play around with values and see what works best. You could tweak the height a character jumps, how much health the enemy orcs have or even the layout of UI elements. Of course — once you have found the values you want — you might want to store these so they get applied each time the game starts. The most robust way to do this is by copying and pasting the values on components and using prefabs. While still in play mode, change the rotation of one of the wheels to anything you think looks good, 150 on the Y-axis for example. Now right-click the Rotate component around its name in the Inspector, or left-click the options cog in the top right of the component, and select Copy Component. This will copy the component and its values to your clipboard. Next, stop the play mode. You’ll notice the speed reverts to its former value in Inspector. Right-click the Rotate component’s name and select Paste Component Values, any values you’ve copied are now pasted into the Rotate component. While this changed the rotation speed for one of the windmills, you want this applied to all of them. To do so, select the grandparent Windmill of the Wheel you’ve altered and select Overrides ► Apply All at the top right of Inspector to apply all changes to the Windmill prefab. Next up is polling for player input to make the machine move and shoot! Player Input and Instantiating Prefabs A game wouldn’t be a game without requiring some level of player input. Scripts can get the state of the keyboard, mouse and any connected gamepads. The first goal is to get that little machine moving on the rails from left to right. Movement Create a new C# script in RW/Scripts, name it HayMachine and open it in a code editor. Add the following variables right above Start: public float movementSpeed; This variable will allow you to specify the speed at which the machine can move. Now, add this method below Update: private void UpdateMovement() { float horizontalInput = Input.GetAxisRaw("Horizontal"); // 1 if (horizontalInput < 0) // 2 { transform.Translate(transform.right * -movementSpeed * Time.deltaTime); } else if (horizontalInput > 0) // 3 { transform.Translate(transform.right * movementSpeed * Time.deltaTime); } } This piece of code moves the hay machine around using the player’s horizontal input: - Get the raw input of the Horizontal axis using the Inputclass and store it in horizontalInput. The Inputclass contains all the methods to poll input devices. GetAxisRawreturns the current value of input as defined in the input manager for the Horizontal axis: In this case, you can use the left and right arrow keys, the A & D keys or a left analog stick as input. - If horizontalInputis less than 0, that means a left movement on the X-axis was detected. In that case, translate (which means move) the machine to the left at a rate of its movementSpeedper second. - If the horizontalInputis higher than 0 instead, move the machine to the right. When Unity doesn’t detect any input, horizontalInput will stay at 0 and the machine won’t move. Now, to call the method you’ve added each frame, add a call to it in Update: UpdateMovement(); Next, save this script and return to the editor. Select Hay Machine in the Hierarchy and add a Hay Machine component to it. Set its Movement Speed to 14 and play the scene. Use the arrow keys or A & D to move the machine from left to right. It works! Oops, you can move the machine outside of the rails and even off-screen, that’s no good. You’ll need to set up some boundaries to stop the machine from moving too far. Open the HayMachine script again and add this variable below the others: public float horizontalBoundary = 22; This variable will be used to limit the movement on the X-axis. It gets assigned 22 as a default value, that will be the initial value that gets filled into the editor as well. Now, edit UpdateMovement‘s if-else statement so it makes use of the boundary in its checks: if (horizontalInput < 0 && transform.position.x > -horizontalBoundary) // 1 { transform.Translate(transform.right * -movementSpeed * Time.deltaTime); } else if (horizontalInput > 0 && transform.position.x < horizontalBoundary) // 2 { transform.Translate(transform.right * movementSpeed * Time.deltaTime); } Here's what changed: - Not only does the horizontal input needs to be negative before allowing movement to the left, the machine's X position also needs to be higher than the negative value of horizontalBoundary. - To move to the right, the horizontal input needs to be positive and the machine's X position should be lower than horizontalBoundary. The image below illustrates what goes on more visually: The white lines on the left and right represent the boundaries, the line going through the machine is its center. Moving the machine in either direction "locks" it once a boundary is reached: Save the script and return to the editor. Try playing the scene and moving the machine left and right once more. The machine gets stopped once it's moved to one of the edges. Next, you'll be implementing the shooting of bales of hay! Creating and Shooting Projectiles Before you can start launching anything, you'll need to create a GameObject for the hay. Start off by creating a new empty GameObject in the Hierarchy by right-clicking an empty space and selecting Create Empty. This will generate an empty GameObject named "GameObject" at the root of the Hierarchy. With the empty GameObject still selected, change its name to Hay Bale in the Inspector and reset its Transform component by right-clicking the Transform component and selecting Reset. Now, add a 3D model to Hay Bale by dragging in the Hay Bale model from RW/Models onto Hay Bale in the Hierarchy. With the Hay Bale model still selected, name it Hay Bale Model and reset its Tranform. You'll now notice the hay firmly planted into the ground in both the Scene and the Game view. Next, select Hay Bale and add the following components by using the Add Component button: - Box Collider - Rigidbody - Rotate Now that the hay has the necessary components to use physics and can rotate around as a way of animating, it's time to configure it. The bale will be shot from the hay machine, flying straight forward without being affected by gravity. Later in this tutorial, once you've added the sheep, they will be used to stop the sheep from hurting themselves. To start off, check the Is Trigger checkbox on the Box Collider so the bale won't be able to push any rigid bodies around. Next, check the Is Kinematic checkbox on its Rigidbody so the hay won't drop through the ground. Finally, set the Rotation Speed on Rotation to (X:300, Y:50, Z:0). Save the scene and press the play button. You'll notice the hay is spinning around in place. To make the hay move forward, you'll need to write another utility script. Create a new C# script in RW/Scripts, name it Move and open it in your code editor. Add the following variables declarations to the top of the class, right above the Start method: public Vector3 movementSpeed; //1 public Space space; //2 Here's what they're used for: - The speed in meters per second the attached GameObject will move in on the X, Y and Z axes. - The space the movement will take place in, either World or Self. The World space transforms a GameObject in Unity's world space, ignoring the rotation of the GameObject, while Self considers the rotation of the GameObject in its calculations. Now, add the following to Update: transform.Translate(movementSpeed * Time.deltaTime, space); This is what actually moves the GameObject by using a translation, that's a geometric term that means to transform a point by a distance in a given direction. Basically, it means to move GameObjects in the context of Unity. The Translate method takes two parameters: The first is the direction and speed, while the second is the space in which the movement happens. The movement is multiplied by Time.deltaTime to perform a smooth movement over an amount of time. Save this script and return to the editor. Add a Move component to Hay Bale, set its Movement Speed to (X:0, Y:0, Z:20) and leave Space set to World. Now, play the scene and you'll see the hay bale flying towards the bridges and off the screen, great! Drag Hay Bale into the RW/Prefabs folder to make it into a prefab and delete the original from the Hierarchy. You'll now be able to reference this prefab to create more whenever you want. To make the hay machine shoot out the bales, you'll need to do some scripting. Open the HayMachine script and add the following variable declarations right above Start: public GameObject hayBalePrefab; // 1 public Transform haySpawnpoint; // 2 public float shootInterval; // 3 private float shootTimer; // 4 Here's a brief explanation of the variables: - Reference to the Hay Bale prefab. - The point from which the hay will to be shot. - The smallest amount of time between shots. This prevents the player from being able to spam the shoot button and fill the screen with bales of hay. - A timer that decreases steadily to keep track whether the machine can shoot or not. Now, add the ShootHay method below UpdateMovement: private void ShootHay() { Instantiate(hayBalePrefab, haySpawnpoint.position, Quaternion.identity); } The Instantiate method creates an instance of a given prefab or GameObject and places it in the scene. It takes three parameters: a prefab or GameObject, a position and a rotation. In this case, the reference to the Hay Bale prefab is used to create an instance with its initial position set to the same as the haySpawnpoint Transform. Quaternion.identity is used for the rotation, this is the default rotation value and is similar to Vector3.Zero as it sets the rotation to (X:0, Y:0, Z:0). To call the code above, you'll need some code to poll for input. Add the following method just above ShootHay: private void UpdateShooting() { shootTimer -= Time.deltaTime; // 1 if (shootTimer <= 0 && Input.GetKey(KeyCode.Space)) // 2 { shootTimer = shootInterval; // 3 ShootHay(); // 4 } } Here's what this block of code does: - Subtract the time between the previous frame and the current one from shootTimer, this will decrease its value by 1 every second. - If the value of shootTimeris equal to or less than 0 and the space bar is pressed in... - Reset the shoot timer. - Shoot a bale of hay! Lastly, add this line to Update, right below UpdateMovement();: UpdateShooting(); This calls the method above every frame. Now, save this script and return to the editor. Select Hay Machine in the Hierarchy, unfold it by clicking the arrow to its left and take a look at the Inspector. The new public variables you just added have become fields that can be assigned. Drag Hay Bale from RW\Prefabs onto the Hay Bale Prefab slot, drag Hay Machine's child Hay Spawnpoint onto the Hay Spawnpoint slot and set Shoot Interval to 0.8. Now, save the scene and click the play button. Move the hay machine around with the arrow keys and shoot some hay using the space bar! Everything should be working like the GIF above. You may have noticed the bales never get destroyed and keep flying off endlessly into nothingness. To fix this, you'll make smart use of triggers, tags and a line or two of code. Tags and Reacting to Physics To identify types of GameObjects, you can use tags. Tags are reference words like "Player" or "Collectible" you can assign to GameObjects to easily find them and differentiate them from other GameObjects. You can use any word or short sentence as a tag. Creating a new tag is pretty easy, select Edit ► Project Settings... in the top menu and open the Tags and Layers tab in the Project Settings window. Now expand the Tags list and you'll notice the project already comes with two tags pre-loaded: DestroyHay and DropSheep. Click the + button below the Tags list, name the new tag Hay and click the Save button to add this new tag to the list. With the Hay tag added, close the Project Settings window and select Hay Bale in the RW\Prefabs folder. Open the Tag dropdown right below the name field and select Hay. Now the difference between the bales of hay and other GameObjects is clear, you can add an area that destroys the hay when it comes into contact with it. Add a new empty GameObject to the Hierarchy and name it Triggers. Reset its Transform and add an empty GameObject as its child. Name this child Hay Destroyer. Select Hay Destroyer, set its position to (X:0, Y:4, Z:68) and add a Box Collider to it. Check the Is Trigger checkbox on the Box Collider and set its Size to (X:60, Y:8, Z:12). Next, change the tag of Hay Destroyer to DestroyHay. You should now see a huge box-shaped collider appear in the Scene view, right outside of the camera's view. Now, in order for this trigger to destroy any hay, you'll need to write yet another utility script. Create a new C# script inside RW\Scripts, name it DestroyOnTrigger and open it in a code editor. Remove the Start and Update methods completely and add this variable declaration in their place: public string tagFilter; This string will allow you to enter the name of any tag that will destroy this GameObject. Now, add this method below the variable you just added: private void OnTriggerEnter(Collider other) // 1 { if (other.CompareTag(tagFilter)) // 2 { Destroy(gameObject); // 3 } } Here's what's going on: OnTriggerEnteris a MonoBehaviour function, it's one of the special methods the Unity engine calls in specific circumstances. In this case, OnTriggerEntergets called when a GameObject with a Rigidbody and a Collider enters the trigger area of a GameObject. - Check if the GameObject that enters the trigger has the tag defined in tagFilter. - Destroy the GameObject this script is attached to. Save this script and return to the editor. Time to test it out! Select Hay Bale in RW\Prefabs, add a Destroy On Trigger component and change Tag Filter to DestroyHay. Now press the play button and try shooting some hay again. You'll notice any hay that hits the Hay Destroyer instantly gets obliterated. Now that you have full control over the hay machine and its projectiles, it's time to introduce some fluffy friends. Sheep Scripting In the game you're creating, a bunch of sheep are panicking and running towards you, stopping at nothing. Unfortunately for them, that includes the ledge just behind the machine, yikes! To start off, create a new empty GameObject in the Hierarchy and name it Sheep. Reset its Transform, set its Y rotation to 180 and add both a Box Collider and a Rigidbody. Check the Is Trigger checkbox of the Box Collider and change its Center and Size to (X:0, Y:1.4, Z:-0.3) and (X:2.5, Y:2, Z:4), respectively. Finally, check the Is Kinematic checkbox on the Rigidbody. The Sheep should now look like this in the Inspector: Now, drag the Sheep model from RW\Models onto Sheep to give it some visuals. Name the GameObject you just added Sheep Model, reset its Transform and set its X rotation to -90 so its head comes out of the ground. This sheep is now ready to be scripted! Create a new C# script named Sheep in RW\Scripts and open it in a code editor. To get started, the sheep simply needs to run forward and disappear when it gets hit by a hay bale. Add the following variable declarations right above Start: public float runSpeed; // 1 public float gotHayDestroyDelay; // 2 private bool hitByHay; // 3 Here's what these are for: - The speed in meter per second that the sheep will run. - The delay in seconds before the sheep gets destroyed after it got hit by hay. - A Boolean that gets set to true once the sheep was hit by hay. With that out of the way, add this line to Update: transform.Translate(Vector3.forward * runSpeed * Time.deltaTime); This makes the sheep run towards its forward vector (the local Z axis) at the speed set in the runSpeed variable. Next, add this method below Update: private void HitByHay() { hitByHay = true; // 1 runSpeed = 0; // 2 Destroy(gameObject, gotHayDestroyDelay); // 3 } Here's the gist of this method: - Set hitByHayto true, this will be useful to check if the method was already called, so it doesn't get called twice or more. - Set the running speed to 0, this stops the sheep in its tracks. - You've already seen this method call, but there's an extra parameter this time. The Destroymethod accepts a second parameter, the delay in seconds before the GameObject gets destroyed. In this case, the delay variable you added above is used. The last part is making the sheep react to physics by adding the following code: private void OnTriggerEnter(Collider other) // 1 { if (other.CompareTag("Hay") && !hitByHay) // 2 { Destroy(other.gameObject); // 3 HitByHay(); // 4 } } Here's what this does: - This method gets called when a trigger enters this GameObject (or vice versa). - If the GameObject that hit this one has the Hay tag assigned and the sheep wasn't hit by hay already... - Destroy the other GameObject (the hay bale). - Call the HitByHaymethod you added before this one. That's it for now, save the script and return to the editor. Select Sheep in the Hierarchy and add a Sheep component. Set its Run Speed to 10 and Got Hay Destroy Delay to 1. Now, play the scene, shoot the sheep and see what happens! Awesome! The sheep stops moving and disappears like you've scripted it to. What happens if the sheep runs through without you shooting it though? Restart the scene and test that out. The sheep flies over the edge as if by magic, that's no good! You'll have to create another trigger zone so the Sheep script can detect collisions with it and react accordingly. Create a new empty GameObject as a child of Triggers, name it Sheep Dropper and reset its Transform. Set its position to (X:0, Y:4, Z:-54) and add a Box Collider with Is Trigger checked and a Size of (X:60, Y:8, Z:12). Now change its Tag to DropSheep and you'll have a nice big trigger behind the hay machine ready to be used. When the sheep hits this trigger, it should fall down and get destroyed once out of sight. To implement this, you'll need to make some adjustments to the Sheep script. Open it again in a code editor and add the following variable declarations below the existing ones: public float dropDestroyDelay; // 1 private Collider myCollider; // 2 private Rigidbody myRigidbody; // 3 They speak for themselves, but here's a brief overview: - The time in seconds before the sheep gets destroyed when it's over the edge and starts dropping. - Reference to the sheep's Collidercomponent. - A reference to the sheep's Rigidbody. Now, assign the needed references by adding this to Start: myCollider = GetComponent<Collider>(); myRigidbody = GetComponent<Rigidbody>(); This finds and caches the sheep's collider and rigidbody for later use. Next, the sheep's collider setup needs adjustments so it gets affected by gravity. Add this method to do just that: private void Drop() { myRigidbody.isKinematic = false; // 1 myCollider.isTrigger = false; // 2 Destroy(gameObject, dropDestroyDelay); // 3 } This method is simple: - Make the sheep's rigidbody non-kinematic so it gets affected by gravity. - Disable the trigger so the sheep becomes a solid object. - Destroy the sheep after the delay specified in dropDestroyDelay. Now, add the following to OnTriggerEnter, right below the existing if-statement: else if (other.CompareTag("DropSheep")) { Drop(); } If the sheep was hit by something other than a hay bale, it checks if the collider it hit has the DropSheep tag assigned; Drop gets called if that's the case. Now save this script and return to the editor. Select Sheep and change Drop Destroy Delay to 4. Play the scene again and let the sheep move past the machine to see what happens. Great! The sheep now falls down to its demise when the player fails to save it. Now that's motivating! Now that the sheep acts as intended, drag it from the Hierarchy to the RW\Prefabs folder to turn it into a prefab and delete the original from the Hierarchy. That's it for the first part of this tutorial! Pat yourself on the back, you have learned the basics of how to create scripts to implement gameplay in Unity. Where to Go From Here? You can download the finished project by clicking on the Download Materials buttons at the top or bottom of this tutorial. If you want to know more about Unity's API, check out these handy resources: Once you're ready to go a step further in scripting with Unity, check out the second part of this tutorial. Here, you'll invite a whole flock of woolly friends and learn how to: - Create lists and iterate them. - Update UI elements. - Use the Event System. - Make use of the Singleton pattern. - Pass data between scenes to customize a game. We hope you enjoyed this tutorial, if you have any questions or comments, join the forum discussion below!
https://www.raywenderlich.com/4180726-introduction-to-unity-scripting-part-1
CC-MAIN-2021-49
refinedweb
5,629
72.05
Graph a Metric You can select metrics and create graphs of the data using the CloudWatch console. CloudWatch supports the following statistics on metrics: Average, Minimum, Maximum, Sum, and SampleCount. For more information, see Statistics. You can view your data at different granularities. For example, you can choose a detailed view (for example 1 minute), which can be useful when troubleshooting. You can choose a less detailed view (for example, 1 hour), which can be useful when viewing a broader time range (for example, 3 days) so that you can see trends over time. For more information, see Periods. Create a Graph To graph a metric Open the CloudWatch console at. In the navigation pane, choose Metrics. On the All metrics tab, type a search term in the search field, such as a metric name or resource name, and press Enter. For example, if you search for the CPUUtilization metric, you'll see the namespaces and dimensions with this metric. Select one of the results for your search to view the metrics. To graph one or more metrics, select the check box next to each metric. To select all metrics, select the check box in the heading row of the table. To view more information about the metric being graphed, hover over the legend. To get a URL for your graph, choose Actions, Share. Copy the URL and save it or share it. To add your graph to a dashboard, choose Actions, Add to dashboard. Update a Graph To update your graph To change the name of the graph, choose the pencil icon. To change the time range, select one of the predefined values or choose custom. For more information, see Modify the Time Range for a Graph. change the refresh interval, choose Refresh options, and then select Auto refresh or choose 1 Minute, 2 Minutes, 5 Minutes, or 15 Minutes.
http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph_a_metric.html
CC-MAIN-2017-04
refinedweb
311
74.08
Write a program that will determine whether a deparment store customer has exceeded the credit limit on a charge account(5000$). The customer gives you his/her account number, he/she has a beginning of the month balance, the program should total all the purchases by the customer for the month, total any credits and display either they are overdrawn or the balance they have remaining in their account. im in beginner computer programming class :P so no hard stuff thanks! rly need help on this... i thought of doing a loop on the question do you have more purchases? and if they say yes they'll have to enter it, and over until they say no. how do i do that? import java.io.*; import java.util.*; public class CA2 { public static void main (String args[]) { Scanner kbReader = new Scanner(System.in); System.out.print ("Enter your account number: "); int acctnum = kbReader.nextInt (); Scanner kb1Reader = new Scanner(System.in); System.out.print ("Please enter the first purchase you made this month: "); double p1 = kb1Reader.nextInt (); double total = ; double remain = 5000 - total; if(total<=5000) { System.out.println("You have" + remain + "dollars remaining in your account"); } else System.out.println("Your account is overdrawn!"); } }
https://www.daniweb.com/programming/software-development/threads/274510/charge-account-program
CC-MAIN-2017-30
refinedweb
204
58.38
In this post post I show that you can combine some techniques from MVC controllers with the new "route-to-code" approach. I show how you can use MVC's automatic content negotiation feature to return XML from a route-to-code endpoint. What is route-to-code? "Route-to-code" is a term that's been used by the ASP.NET Core team for the approach of using the endpoint routing feature introduced in ASP.NET Core 3.0 to create simple APIs. In contrast to the traditional ASP.NET Core approach of creating Web API/MVC controllers, route-to-code is a simpler approach, with fewer features, that puts you closer to the "metal" of a request. For example, the default Web API template includes a WeatherForecastController looks something like the following: () { return Enumerable.Empty<WeatherForecast>(); // this normally returns a value. } } You can see various features of the MVC framework, even in this very basic example: - The controller is a separate class which (theoretically) can be unit tested. - The route that the Get()endpoint is associated with is inferred using [Route]attributes from the name of the controller. - The controller can use Dependency Injection. - The [ApiController]attribute applies additional cross-cutting behaviours to the API using the MVC filter pipeline. - It's not shown here, but you can use model binding it automatically extract values from the request's body/headers/URL. - Returning a C# object from the Get()action method serializes the value using content negotiation. In contrast, route-to-code endpoints are added directly to your middleware pipeline in Startup.Configure(). For example, we could create a similar endpoint to the previous example using the following: public class Startup { public void ConfigureServices(IServiceCollection services) { } public void Configure(IApplicationBuilder app) { app.UseRouting(); app.UseEndpoints(endpoints => { // create a basic endpoint endpoints.MapGet("weather", async (HttpContext context) => { var forecast = new WeatherForecast { Date = DateTime.UtcNow, TemperatureC = 23, Summary = "Warm" }; await context.Response.WriteAsJsonAsync(forecast); }); }); } } This endpoint is similar to the API controller, but it's much more basic: - Routing is very explicit. There's no conventions, the endpoint responds to the /weatherpath and that's it. - There's no filter pipeline, constructor DI, or model binding. - The response is serialized to JSON using System.Text.Json. There's no content negotiation or serializing to other formats. If you need that functionality, you'd have to implement it manually yourself. If you're building simple APIs, then this may well be good enough for you. There's far less infrastructure required for route-to-code, which should make them more performant than MVC APIs. As part of that there's generally just less complexity. If that appeals to you, then route-to-code may be a good option. Filip has a great post on how using new C#9 features in combination with route-to-code to build surprisingly complex APIs with very little code. There's also a great introduction video to route-to-code by Cecil Phillip and Ryan Nowak here. So route-to-code could be a great option where you want to build something simple or performant. But what if you want the middle ground? What if you want to use some of the MVC features. Adding content negotiation to route-to-code One of the useful features of the MVC/Web API framework is that it does content negotiation. Content negotiation is where the framework looks at the the Accept header sent with a request, to see what content type should be returned. For most APIs these days, the Accept header will likely include JSON, hence why the "just return JSON" approach will generally work well for route-to-code APIs. But what if, for example, the Accept header requires XML? In MVC, that's easy. As long as you register the XML formatters in Startup.ConfigureServices(), the MVC framework will automatically format requests for XML as XML. Route-to-code doesn't have any built-in content negotiation. so you have to handle that yourself. In this case, that's probably not too hard, but it's extra boilerplate you must write yourself. If you don't write that code, the endpoint will just return JSON no matter what you request I was interested to find that we have a third option: cheat, and use an MVC ActionResult to perform the content negotiation. The example below is very similar to the route-to-code sample from before, but instead of directly serializing to JSON, we create an ObjectResult instead. We then execute this result, by providing an artificial ActionContext. public void Configure(IApplicationBuilder app) {); }); }); } This code is kind of a hybrid. It uses route-to-code to execute the endpoint, but then it ducks back into the MVC world to actually generate a response. That means it uses the MVC implementation of content-negotiation! In order to use those MVC primitives, we need to add some MVC services to the DI container. We can use the AddMvcCore() extension method to add the services we need, and can add the XML formatters to support our use case: public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddMvcCore() .AddXmlSerializerFormatters(); } public void Configure(IApplicationBuilder app) { // as above); }); }); } } With this in place, we now have MVC-style content negotiation-when the Accept header is set to application/xml, we get XML, without having to do any further work in our endpoint: Be aware that there are many subtleties to MVC's content-negotiation algotithm, such as ignoring the */*value, formatting nullas a 204, and using text/plainfor stringresults, as laid out in the documentation. So now that I've shown that you can do this, should you? Should you do this? To prefix this section I'll just say that I've not actually used this approach in anything more than a sample project. I'm not convinced it's very useful at this stage, but it's interesting to see that it's possible! One of the problems is that calling AddMvcCore(), adds a vast swathe of services to the DI container. This isn't a problem in-and-of itself, but it will slow down your app's startup slightly, and use more memory etc, as you actually register most of the MVC infrastructure. That makes your "lightweight" rout-to-code app a little bit "heavier". On the plus side, the actual execution of your endpoint stays lightweight. There's still no filters or model binding in use, it's only the final ActionResult execution which uses the MVC infrastructure. And as we're executing the ActionResult directly, there's not many additional layers here either, so that's good. Actually executing the ActionResult is a bit messy of course, as you need to instantiate the ActionContext. There might be other implications I'm missing here too - you might need to pass in RouteData for example if you're trying to execute a RedirectResult, or some other ActionResult that's more closely tied to the MVC infrastructure. This is just a proof of concept, but I wonder if it's the sort of thing that we'll see supported more concretely as part of Project Houdini. Exposing the content negotiation capability to route-to-code APIs seems like a very useful possibility, and shouldn't really be tied to MVC. Let's hope 🤞 Summary In this short post I showed that you can execute MVC ActionResults from a route-to-code API endpoint. This allows you to, for example, use automatic content negotiation to serialize to JSON or XML, as requested in the Accept header. The downside to this approach is that it required registering a lot of MVC services, is generally a bit clunky, and isn't technically supported. While I haven't used this approach myself, it could be useful if you have a limited set of requirements and don't want to use the full MVC framework.
https://andrewlock.net/using-action-results-and-content-negotiation-with-route-to-code/
CC-MAIN-2022-05
refinedweb
1,323
55.03
.” People’s most favorite platform for developing apps, React native involves handling texts through TextInput that uses the keyboard. To use TextInput, the keyboard should be popped up and occupy some space on the screen. However, you may face some issues with the keyboard while working on the TextInput. In this article, we will discuss some of the common React Native keyboard issues and how to solve them. Issue 1 – Double-tap issue while the keyboard is already open When you are trying to press some link, while the keyboard has been already opened, the button or link can’t be clicked on with a single click. It should be clicked twice to get opened. Because your first click will be taken for closing the keyboard and the second click will open the button or link. Sometimes, users may not be aware of this and think that the button is not working. It gives a bad user experience. Solution We can resolve this issue by using the keyboardShouldPersistTaps=‘always’ property on the ScrollView or the Content part of your code. This property allows the link or button to respond on the first click itself. Issue 2 – Problem with Scrolling If you want to scroll down to a series of pages, the already opened keyboard will not be closed automatically. It continues to stay there, which can cause discomfort for the user while scrolling. We have to close the keyboard each time manually. Solution This issue can be solved by using the keyboardDismissMode=’on-drag’ property on Scrollview and Content, which will make the keyboard to get disappear automatically on scrolling. Read our article on Why is React Native the best for Mobile App Development? Issue 3 – Multiline Text If you are typing a long paragraph or TextInput with multiple lines using multiline true, the text will start to hide behind the keyboard after some extent. It will cause discomfort as we cannot see the text behind the keyboard. Solution We can use the scrollEnabled={false} property on the TextInput to resolve this issue. Issue 4 – Problem with InputField When you are typing in the input field that is located in the middle or near the end of the page, you cannot see the text input, as the input field will hide behind the keyboard. This causes discomfort as we cannot see the text while we are typing. Solution We can solve this issue by wrapping up the view with any one of the below-mentioned components. Component 1 – Inbuilt <KeyboardAvoidingView style={styles.container} width=15 height=15 data-cke-widget-drag-handler=1> Component.” We would have seen some apps that have some text display more shortly, revealing the full content only after clicking the “more” button. For example, we can see the big Instagram captions below the post only by clicking the “show more” option. Until it will display only a truncated text with fewer lines. We cannot display the whole text all the time. Sometimes we need a truncated version of the whole content. Do you think this less/more button is easy to develop? Absolutely not. Its implementation is somewhat complicated. So what can we do? Since this display text is related to UI, it has to be implemented in such a way that it should be displayed efficiently in different screen sizes. So we can not just implement by adding a substring along with it and insert a button associated with it. We need to create a custom component for this. In this article, we will see how we can implement it. Requirements To achieve this, we need, Read our article on 4 Most Common React Native Keyboard Issues MoreLess Component First, we need a text component that renders another component associated with the text. The moreless component is a functional component that takes 2 props such as truncatedText and fullText. It also has a state known as param and more and a function that updates it. According to the text, the function helps in returning the text component that displays fullText or truncatedText. Its TouchableOpacity helps the user in toggling the “more” state. OnTextLayout Consider a situation, where we have to display the content or text in exact 3 lines for all the screen sizes. If the text is not exceeding the 3 lines, it can be displayed as such, and “more” button should not be added. But if the text exceeds the 3 lines, “more” button has to be added. By clicking on the “more” button, we will be able to see the full text. The revealed, full text will have a “less” button along with it. We achieve this by using the “onTextLayout” prop of the Text component. width=15 height=15 data-cke-widget-drag-handler=1> Before alt data-cke-saved-src=" width=15 height=15 data-cke-widget-drag-handler=1> After This onTextlayout event will tell us how many lines of the text should be displayed by the Text Component. Using this, we can capture the number of required states and save it on the state. Read our article on Custom Tab Bar in React Native using SVG, and D3-Shape Following is the code to achieve this. import React, { useState } from "react"; import { View, Text, StyleSheet, ViewStyle } from "react-native"; import { colors } from "../utils/constants/colors"; import { fonts, fontSize } from "../utils/constants/fonts"; import { SCREEN_WIDTH } from "../utils/globalFunction"; interface PropTypes { text: string; containerStyle?: ViewStyle; targetLines?:number } const TextLessMoreView = (props: PropTypes) => { const [textShown, setTextShown] = useState(false); //To show your remaining Text const [lengthMore, setLengthMore] = useState(false); //to show the "Read more & Less Line" const [triggerTextLocation, setTriggerTextLocation] = useState({ top: 0, right: 0, }); const toggleNumberOfLines = () => { setTextShown(!textShown); }; const onTextLayout = (e) => { const { lines } = e.nativeEvent; if (lines && Array.isArray(lines) && lines.length > 0) { let tempTxtLocaation = { top: (lines.length - 1) * lines[0].height, right: SCREEN_WIDTH - lines[lines.length - 1].width - 10, }; setTriggerTextLocation(tempTxtLocaation); setLengthMore(lines.length >= props.targetLines); } }; return ( <View style={[styles.mainBody, props.containerStyle]}> <Text onTextLayout={onTextLayout} numberOfLines={textShown ? undefined : props.targetLines || 1} style={styles.txtStyle} > {props.text || ""} </Text> {lengthMore ? ( <Text onPress={toggleNumberOfLines} style={[ styles.lessMoreStyle, { position: "absolute", backgroundColor: colors.primary_background_color, right: triggerTextLocation.right, top: triggerTextLocation.top, }, ]} > {textShown ? " less" : "... more"} </Text> ) : null} </View> ); }; const styles = StyleSheet.create({ mainBody: { marginTop: 15, }, txtStyle: { fontFamily: fonts.secondary_regular_font, fontSize: fontSize.modal_title_size, color: colors.white, flex: 1, }, lessMoreStyle: { fontFamily: fonts.secondary_regular_font, fontSize: fontSize.modal_title_size, color: colors.app_orange, }, }); export default TextLessMoreView; width=15 height=15 data-cke-widget-drag-handler=1> Usage – Here this targetLines prop is used to define how many lines to be shown just before to see full content. <TextLessMoreView text={"Text to be shown on screen"} targetLines={1} /> width=15 height=15 data-cke-widget-drag-handler=1> “We transform your idea into reality, reach out to us to discuss it. Or wanna join our cool team email us at [email protected] or see careers at Startxlabs.”
https://startxlabs.com/blog-category/ios/
CC-MAIN-2022-33
refinedweb
1,143
58.08
class Solution(object): def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """ node.val = node.next.val node.next = node.next.next :levitate: @viakondratiuk Exactly same with yours. @ra1den Probably there are a lot of same solutions for this problem. It doesn't give much space for your fantasy. @viakondratiuk Makes one wonder why people still post the same solution over and over again as if it added anything to the discussion rather than diluting it, right? @StefanPochmann I can understand you :) I think it's all about presence on internet. Just skip such solutions. if the node you wanted to delete is the last node,your code will throw an exception,should that be below will be better? def deleteNode(node): if node.next: node.val = node.next.val node.next = node.next.next else: node.val = None but I'm not sure the last line " node.val = None " is safe or correct anyway? @Tina_Liu You should read a task. It says: "Write a function to delete a node (except the tail) in a singly linked list, given only access to that node." So, there is no necessity to delete last node. And with your code you are not deleting last node, you just set value to None, but link on it still exists. Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.
https://discuss.leetcode.com/topic/51706/python-2-liner
CC-MAIN-2017-47
refinedweb
240
75.5
address: ^[^@]+@([-\w]+\.)+[A-Za-z]{2,4}$Personally, I find it easier to read a pattern by dissecting it into components and then attempting to understand each of the components as they relate to the overall pattern. Having said that, this pattern breaks down to the following parts: - ^The caret character at the beginning of a pattern tells the parser to match from the beginning of the line, since the focus of this pattern is to validate a single email address. - [^@]+When the caret character is used within brackets and precedes other characters, it tells the parser to search for everything that is not the specified character. Therefore, here the pattern specifies a search to locate all text that is not an at-sign@ character. (The plus sign tells the parser to find one or more of these non at-sign characters leading up to the next component of the expression.) - @Match on the at-sign literal - ([-\w]+\.)+This part of the pattern is for matching everything from the @ to the upper-level domain (e.g., .com, .edu, etc.). The reason for this is that many times you'll see email addresses with a format like tom.archer@archerconsultinggroup.com. Therefore, this part of the pattern deals with that scenario. The first part[-\w]+tells the parser to find one or more word-letters or dashes. The "\." tells the parser to match on those characters leading up to a period. Finally, all of that is placed within parentheses and modified with the plus operator to specify one or more instances of the entire match. - [A-Za-z]{2,4}$Matches the terminating part of the expressionthe upper-level domain. At this point, reading this part of the pattern should be pretty easy. It simply dictates finding between two- and four-letter characters. The $ character tells the parser that these letters should be the end of the input string. (In other words, $ denotes end of input, compared with ^, which denotes beginning of input.) using namespace System::Text::RegularExpressions; ... bool ValidateEmailAddressFormat(String* email) { Regex* rex = new Regex(S"^[^@]+@([-\\w]+\\.)+[A-Za-z]{2,4}$"); return rex->IsMatch(email); }You then can call this function like this: bool b; // SUCCESS b = ValidateEmailAddressFormat("tom.archer@archerconsultinggroup.com"); // FAILURE!! b = ValidateEmailAddressFormat("tom.archerarcherconsultinggroup.com");Now, original intention for a series on using the .NET regular expressions classes from Managed C++ was to simply cover some basic patterns and usages. However, the more I wrote, the more I realized needed to be covered. So it turned out to be a much-longer-than-planned series. It covered splitting strings, finding matches within a string, using regular expression metacharacters, grouping, creating named groups, working with captures, performing advanced search-and-replace functions, and finally writing a complex email pattern. AcknowledgementsI would like to thank Don J. Plaistow, a Perl and Regular Expressions guru who helped me tremendously when I first started learning regular expressions. Don's help was especially helpful with regards to the email patterns in<<
https://www.developer.com/net/cplus/article.php/10919_3497216_2/Using-Regular-Expressions-to-Parse-for-Email-Addresses.htm
CC-MAIN-2018-43
refinedweb
500
55.24
Python Command Overview Contents - 1 Python API Command Overview - 1.1 The Entire Command - 1.2 Breakdown - 1.3 User Facing Strings: Command Help Python API Command Overview This page will attempt to give some "boilerplate" code for creating a Python API command (with arguments) in MODO. There is much more you can do with commands, but this should cover common uses. We'll start with listing the entire code and then breaking it down. The Entire Command #!/usr/bin/env python import lx import lxu.command class MyCommand_Cmd(lxu.command.BasicCommand): def __init__(self): lxu.command.BasicCommand.__init__ (self)) def cmd_Flags(self): return lx.symbol.fCMD_UNDO | lx.symbol.fCMD_MODEL.") lx.bless (MyCommand_Cmd, "my.command") Breakdown The Header #!/usr/bin/env python import lx import lxu.command This piece simply tells MODO this is a Python file, and imports the basic modules we need for creating a command. You may require other modules depending on the functions you intend to carry out in your command. The Command Class & Init class MyCommand_Cmd(lxu.command.BasicCommand): def __init__(self): lxu.command.BasicCommand.__init__ (self) This section defines a new class which inherits from lxu.command.BasicCommand. The __init__ function is called when the command is loaded by MODO at start up. At the very least, this function should contain lxu.command.BasicCommand.__init__ (self) Argument Definition (Optional) In this example, we have also defined arguments for our command. These are not required, but must go inside the __init__ function if you wish your command to have arguments. They are added to the command in the order they are defined here and assigned corresponding indices. NOTE: This order is important for accessing the argument values later on, as we will be accessing them via their index. At their most basic, arguments are defined with a name and a type. The name is the internal name of the argument and should not contain spaces - we will give them user-friendly display names later on. The names can be used by the Command Help for this command to define user-friendly display names from a config file (which allows for localisation), but we won't be covering that here. Argument Flags By default, all arguments are required to be set for the command to run. If, when the command is called and all the required arguments are not set, a dialog will be displayed to the user allowing them to enter the values. However, you'll note that we've specified flags on two of the arguments. The flags are specified by referencing the index of the argument they apply to (see, order is important!) and giving the flag itself. In this case, we've specified the flag of "OPTIONAL", which means that the user does not have to specify a value for the second and third arguments. We will have to make sure that we assign any unspecified arguments default values in the main execution of the command later on. Argument Types As a brief aside... Although MODO appears to have several different argument types, they are all user-friendly wrappers for the storage of 4 core types; integers, floats, strings and objects. You'll have seen these friendly wrappers for things like distance fields, where you can enter a value in metres, millimetres, feet, microns, etc... However, internally, these are read and stored as a simple float value which is the displayed distance as metres. Similarly, angle fields, where you can enter a value in degrees, are stored internally as a float of the displayed angle in radians. Boolean values (often shown as checkboxes or toggle buttons) are simply stored as integers which are 0 or 1. NOTE: These internal values are what you'll be dealing with when you write commands. Command Flags def cmd_Flags(self): return lx.symbol.fCMD_UNDO | lx.symbol.fCMD_MODEL This is a very important part of a command if you are using the Python API (or TD SDK) to edit the scene in the command execution. The command flags tell MODO what the command is expected to do when it executes and how to handle it. In our case, we specify the standard flags; MODEL and UNDO. These flags are bit masks and as such are joined together into a single integer return value using the pipe | separator. The MODEL flag tells MODO that we will be editing a part of the scene. The name is slightly misleading as it implies changes to a mesh only, however it means any change to anything in the scene; channels, meshes, selection changes, adding or removing items, etc... The UNDO flag is specified by default as part of the MODEL flag, however it's not harmful to add the flag to be clear. This tells MODO that the command should be undoable and that it should set up an undo state for it. NOTE: It is very important that this flag is set, as changing the scene without this flag set causes instability in MODO and usually leads to a crash (if not immediately then very soon). Generally, these should be your standard flags unless you have specific reason to change them. Main Execution.") This is the meat of the command - the code that's actually run when the command is fired. Here, we're not doing anything other than reading the arguments and writing to the Event Log. You can see here that those core types are how we read the arguments in the command, with dyna_Bool (a friendly wrapper for dyna_Int, checking if it's equal to 1 or 0), dyna_Float and dyna_String. These are accessed via index, the same indices we've used throughout the command. Optionally, a default value is given as the second parameter, which is the value returned if the argument has not been set by the user. We can also make use of the command's dyna_IsSet function, which will return True or False depending on whether the argument with that index was specified by the user (this function is what is used internally for the dyna_Float and related functions, to determine whether to return the default value or not). It is important to note that any arguments which have UI hints (such as minimum or maximum values - including text hints) are for UI purposes only, and that arbitrary values can be entered as arguments. This means that if you have a UI hint that gives it a range of 10-50, the user can still enter 12000 manually from a script or the command entry, or enter an out-of-range integer instead of a text hint string. So be sure to manage such values and take appropriate action if such values would cause problems in your code (e.g. aborting execution or limiting the value supplied by the user to the desired range). Also note that, as this is part of the Python API, we can freely use lx.eval() for calling commands and querying values, just like regular fire-and-forget Python scripts. Making Main Execution Useful This is a simple outline of writing a command with arguments. It doesn't actually do anything. For further reading, you can find other examples of code to go into the Execute function on the wiki (such as Creating a Selection Set). Blessing the Command Here, we call the bless command. This promotes the class we created to be a fully fledged command inside of MODO, as opposed to simply a Python script. It takes two arguments. One is the command class we defined, the second is the command that we'll want to assign to this inside MODO. This means that the script is not run via the usual @scriptName.py command that fire-and-forget scripts are. Instead, this command is run be entering my.command as it is a proper command in MODO. lx.bless (MyCommand_Cmd, "my.command") User Facing Strings: Command Help All user-facing strings, such as for the command name, argument names, and so on, should be defined in Command Help config files whenever possible. Config files are considered to be part of any command or kit, and not as optional extras. This is also the only place that the Command List gets user-friendly information that can teach others how to use your commands. This is an example of what the command help for this command would look like. This would be inside a .cfg file that is distributed with the .py file of the actual command. If distributed with this config, you would be able to remove all of the above command's functions which relate to returning user-friendly names for things and MODO would use this file to get the relevant values automatically. It is also worth noting that these can be localized by duplicating the <hash type="Command" key="my.command@en_US"> fragment and it's contents and changing the @en_US' to @[localized language code] then replacing the contents of the atom fragments accordingly. By default, MODO will look for @en_US and this will also be the fallback if the user's specified language isn't found. - Command: this command's internal name and a language code. These are used to find the user strings for the current system locale. - UserName: The name displayed for the command in the Command List and other parts of the UI. - ButtonName: The label of the control when the command is in in a form. - ToolTip: The text displayed in a tooltip when hovering the mouse over the control in a form. - Example: A simple example usage of the command, shown in the Command List. - Desc: Basic documentation for the command, as shown in the command list. - Argument: Given an argument's internal name, this defines its username ad description. The username is shown in command dialogs and the command list. The command list also displays the description, which should be considered documentation for how to use that argument, the default behavior if the argument is optional and not set, and so on. <?xml version="1.0"?> <configuration> <atom type="CommandHelp"> <!-- note the command's name in here; my.command --> <hash type="Command" key="my.command@en_US"> <atom type="UserName">My Command Dialog - also shown in the command list.</atom> <atom type="ButtonName">My Command</atom> <atom type="Tooltip">My command's tooltip</atom> <atom type="Desc">My command's description - shown in the command list.</atom> <atom type="Example">my.command true 1.5 "hello!"</atom><!-- An example of how my command would be called - shown in the command list. --> <hash type="Argument" key="myBoolean"> <atom type="UserName">A Boolean</atom> <atom type="Desc">The boolean argument of my command - shown in the command list.</atom> </hash> <hash type="Argument" key="myDistance"> <atom type="UserName">A Distance</atom> <atom type="Desc">The distance argument of my command - shown in the command list.</atom> </hash> <hash type="Argument" key="myString"> <atom type="UserName">A String</atom> <atom type="Desc">The string argument of my command - shown in the command list.</atom> </hash> </hash> </atom> </configuration> User-Facing String Overrides Generally speaking, you should define all user-facing strings in cmdhelp configs. The configs allow the command to be localized into different languages, and are used in the Command List part of the Command History to provide usage information for users. However, it is sometimes useful to the able to override the cmdhelp-based strings with dynamic strings. These should never be used to return static strings -- those should be in cmdhelp configs. Even when returning dynamic strings with these methods, the strings should come from message tables whenever possible to ensure that they can also be localized. Cases where strings are used directly in code are those that provided by the user, like the name of an item, but care should be take to avoid hard-coding any user-facing text as string literals directly into the code itself. The ButtonName() method provides a short name for when the control is displayed in a form. UserName() is usually a somewhat more verbose name that is display in other parts of the interface. Tooltip() defines a string to display in the tooltip window when the user hovers over the control in a form. UIHints() has a variety of methods, but can be used to set the label for a specific command argument when displayed in the UI, such as in a command dialog. Most of these should never be ended, as these values are usually static and should be set in cmdhelp configs. def basic_ButtonName(self): return dynamicButtonNameStringHere def cmd_Tooltip(self): return dynamicTooltipStringHere def cmd_UserName(self): return dynamicUsernameStringHere def arg_UIHints (self, index, hints): if index == 0: hints.Label (dynamicArgumentName0Here) elif index == 1: hints.Label (dynamicArgumentName1Here) elif index == 2: hints.Label (dynamicArgumentName2Here)
https://modosdk.foundry.com/wiki/Python_Command_Overview
CC-MAIN-2020-10
refinedweb
2,133
63.59
I've made a program that prints out a list of numbers, each one with a greater number of steps (according to the Collatz Conjecture) needed to reach 1 than the previous: limit = 1000000000 maximum = 0 known = {} for num in xrange(2, limit): start_num = num steps = 0 while num != 1: if num < start_num: steps += known[num] break; if num & 1: num = (num*3)+1 steps += 1 steps += 1 num //= 2 known[start_num] = steps if steps > maximum: print start_num,"\t",steps maximum = steps It appears to be inherently hard to speed up Collatz programs enormously; the best programs I'm aware of are distributed, using idle cycles on hundreds (thousands ...) of PCs around the world. There are some easy things you can do to optimize your program a little in pure CPython, although speed and space optimizations are often at odds: knowna list instead of a dict requires significantly less memory. You're storing something for every number; dicts are more suitable for sparse mappings. array.arrayrequires less space still - although is slower than using a list. n, 3*n + 1is necessarily even, so you can collapse 2 steps into 1 by going to (3*n + 1)//2 == n + (n >> 1) + 1directly. ntook ssteps, then 2*nwill take s+1, 4*nwill take s+2, 8*nwill take s+3, and so on. Here's some code with all those suggestions, although I'm using Python 3 (in Python 2, you'll at least want to change range to xrange). Note that there's a long delay at startup - that's the time taken to fill the large array with a billion 32-bit unsigned zeroes. def coll(limit): from array import array maximum = 0 known = array("L", (0 for i in range(limit))) for num in range(2, limit): steps = known[num] if steps: if steps > maximum: print(num, "\t", steps) maximum = steps else: start_num = num steps = 0 while num != 1: if num < start_num: steps += known[num] break while num & 1: num += (num >> 1) + 1 steps += 2 while num & 1 == 0: num >>= 1 steps += 1 if steps > maximum: print(start_num, "\t", steps) maximum = steps while start_num < limit: assert known[start_num] == 0 known[start_num] = steps start_num <<= 1 steps += 1 coll(1000000000)
https://codedump.io/share/8ZxpZ1VjBDxW/1/longest-collatz-or-hailstone-sequence-optimization---python-27
CC-MAIN-2017-43
refinedweb
370
60.18
JWT Auth with Vue, Vuex and Vue Router — Axios & Guards Vuex is the state management library for Vue apps. It provides a central store for globally storing the complete state of the application. It also ensures that data is accessed in certain way by all components. In this tutorial, you will see how you can use Vue.js with Vuex and Axios to create an application that allows users to register and login via JWT authentication. Since Vue.js is only a front-end library we'll need a back-end that handles JWT authentication and returns valid JWT access tokens to the client. Here comes the role of Vuex to store the access tokens and attach them with any outgoing requests to access protected resources using Axios. Prerequisites To be able to take follow this tutorial step by step, you need to have: - A working knowledge of Vue.js, - A recent version of Node.js and NPM installed on your development machine. For the back-end server that implements JWT authentication, you need to follow the Node Express JWT Authentication — jsonwebtoken and bcryptjs tutorial to create it. You also need to read Vuex Tutorial for learning the basic of Vuex. In this tutorial we'll be focusing on the front-end with Vue, Vuex and Axios. Installing Vue CLI 3 and Creating a Project In this tutorial we'll be using Vue CLI 3 to create and work with our project. Vue CLI provides various presets that you can use to generate your project but it also allows you to choose the individual libraries that you want to include in your project. First, install Vue CLI v3 using the following command: $ npm install @vue/cli -g Note: You may be needing to add sudo before you command in Linux/Ubuntu systems or use an administrator command prompt in Windows to install Vue CLI globally on your system. At the time of this writing Vue CLI v3.1.3 is installed. Head to your terminal and run the following command to create a new Vue project: $ vue create vue-vuex-auth When prompted to select a preset, choose Manually select features and press Enter. Next, you'll be prompted for selecting the features you need in your project, make sure to check Router and Vuex. You'll be also asked many other questions, you can simply choose the default options and move on to the next steps. The CLI will create a Vue project in a vue-vuex-auth folder, initialize a GIT repository and then install the npm packages and CLI plugins. When the project is successfully created, navigate inside the vue-vuex-auth folder and launch your development server: $ cd vue-vuex-auth $ npm run serve You'll be able to access your Vue application from the address. You'll be seeing the following page: Installing and Setting up Axios We'll be using Axios for sending HTTP requests to the Express server so we need to install it in the project via npm: $ npm install axios --save Note: As the time of this writing, axios v0.18.0 is installed. Since we'll need to use Axios for sending requests from any Vue component, we'll need to import in the src/main.js file. Open the src/main.js file and update it as follows: import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import Axios from 'axios' Vue.config.productionTip = false Vue.prototype.$http = Axios; const accessToken = localStorage.getItem('access_token') if (accessToken) { Vue.prototype.$http.defaults.headers.common['Authorization'] = accessToken } new Vue({ router, store, render: h => h(App) }).$mount('#app') We first import Axios. Next, we add Axios to the Vue instance as $http. This will make it available any where in our Vue application. If an access token is found on the local storage, we attach it to every outgoing Axios request via the Authorization header. Creating the Signup Component Create a src/views/Signup.vue file and add the following template: <template> <div> <h2>Signup Page</h2> <form @ <div> <input type="text" placeholder="Name" v- </div> <div> <input placeholder="Your email" type="email" v- </div> <div> <input placeholder="Password" type="password" v- </div> <div> <input placeholder="Confirm password" type="password" v- </div> <div> <button type="submit">Register</button> </div> </form> </div> </template> Creating Data and Methods In the same src/views/Signup.vue file, add the following code below the template: <script> export default { data(){ return { name : "", email : "", password : "", password2 : "" } }, } </script> Next define the <script> export default { // [...] methods: { signup: function () { let info = { name: this.name, email: this.email, password: this.password } this.$store.dispatch('signup', info).then(() => this.$router.push('/login')) } } } </script> Creating the Login Component Create a src/views/Login.vue file and add the following template: <template> <div> <h2>Login Page</h2> <form @ <div> <input placeholder="Your email" type="email" v- </div> <div> <input placeholder="Password" type="password" v- </div> <div> <button type="submit">Login</button> </div> </form> </div> </template> Adding Data and Methods In the src/views/Login.vue file, add the following code: <script> export default { data(){ return { email : "", password : "" } }, methods: { login: function () { const email = this.email const password = this.password this.$store.dispatch('login', { email, password }).then(() => this.$router.push('/')) } } } </script> Next, add the login() method: methods: { login: function () { const email = this.email const password = this.password this.$store.dispatch('login', { email, password }).then(() => this.$router.push('/')) } } Adding the Routes Open the src/router.js file and add two routes to the Login components.: '/about', name: 'about', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ './views/About.vue') }, { path: '/signup', name: 'signup', component: Signup }, { path: '/login', name: 'login', component: Login } ] }) Adding Navigation Open the src/App.vue component and add the links to the Login components. <template> <div id="app"> <div id="nav"> <router-linkHome</router-link> | <router-linkAbout</router-link> | <router-linkSignup</router-link> | <router-linkLogin</router-link> </div> <router-view/> </div> </template> Also open the src/views/Home.vue component and update its template: <template> <div class="home"> <h1>Home</h1> </div> </template> This is a screenshot of the main App component at this point: Adding Vuex State Open the src/store.js file and add state for hoding information about the current user and the access token: import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { accessToken: localStorage.getItem('access_token') || '', currentUser : {} }, mutations: { }, actions: { } }) You also need to import axios: import axios from 'axios' Adding the login() Action In the store object inside the actions object, add a login() method:
https://www.techiediaries.com/vue-vuex-axios-auth/
CC-MAIN-2021-39
refinedweb
1,120
56.55
ExtUtils::H2PM - automatically generate perl modules to wrap C header files This module assists in generating wrappers around system functionallity, such as socket() types or ioctl() calls, where the only interesting features required are the values of some constants or layouts of structures normally only known to the C header files. Rather than writing an entire XS module just to contain some constants and pack/unpack functions, this module allows the author to generate, at module build time, a pure perl module containing constant declarations and structure utility functions. The module then requires no XS module to be loaded at run time. In comparison to h2ph, C::Scan::Constants, and so on, this module works by generating a small C program containing printf() lines to output the values of the constants, compiling it, and running it. This allows it to operate without needing tricky syntax parsing or guessing of the contents of C header files. It can also automatically build pack/unpack functions for simple structure layouts, whose members are all simple integer or character array fields. It is not intended as a full replacement of arbitrary code written in XS modules. If structures should contain pointers, or require special custom handling, then likely an XS module will need to be written. Sets the name of the perl module to generate. This will apply a package header. Adds a file to the list of headers which will be included by the C program, to obtain the constants or structures from Adds a numerical constant. The following additional named arguments are also recognised: Use the given name for the generated constant function. If not specified, the C name for the constant will be used. If present, guard the constant with an #ifdef STRING preprocessor macro. If the given string is not defined, no constant will be generated. Adds a structure definition. This requires a named argument, This should be an ARRAY ref containing an even number of name-definition pairs. The first of each pair should be a member name. The second should be one of the following structure member definitions. The following additional named arguments are also recognised: Use the given names for the generated pack or unpack functions. If true, the structure is a header with more data behind it. The pack function takes an optional extra string value for the data tail, and the unpack function will return an extra string value containing it. If true, the generated unpack function will not first check the length of its argument before attempting to unpack it. If the buffer is not long enough to unpack all the required values, the remaining ones will not be returned. This may be useful, for example, in cases where various versions of a structure have been designed, later versions adding extra members, but where the exact version found may not be easy to determine beforehand. Defines the style in which the functions take arguments or return values. Defaults to list, which take or return a list of values in the given order. The other allowed value is hashref, where the pack function takes a HASH reference and the unpack function returns one. Each will consist of keys named after the structure members. If a data tail is included, it will use the hash key of _tail. If present, guard the structure with an #ifdef STRING preprocessor macro. If the given string is not defined, no functions will be generated. The following structure member definitions are allowed: The field contains a single signed or unsigned number. Its size and signedness will be automatically detected. The field contains a NULL-padded string of characters. Its size will be automatically detected. The field contains a single number as for member_numeric. Instead of consuming/returning a value in the arguments list, this member will be packed from an expression, or asserted that it contains the given value. The string $code will be inserted into the generated pack and unpack functions, so it can be used for constants generated by the constant directive. The structure definition results in two new functions being created, pack_$name and unpack_$name, where $name is the name of the structure (with the leading struct prefix stripped). These behave similarly to the familiar functions such as pack_sockaddr_in; the pack_ function will take a list of fields and return a packed string, the unpack_ function will take a string and return a list of fields. Controls the export behaviour of the generated symbols. no_export creates symbols that are not exported by their package, they must be used fully- qualified. use_export creates symbols that are exported by default. use_export_ok creates symbols that are exported if they are specifically requested at use time. The mode can be changed at any time to affect only the symbols that follow it. It defaults to use_export_ok. Returns the generated perl code. This is used internally for testing purposes but normally would not be necessary; see instead write_output. Write the generated perl code into the named file. This would normally be used as the last function in the containing script, to generate the output file. In the case of ExtUtils::MakeMaker or Module::Build invoking the script, the path to the file to be generated should be given in $ARGV[0]. Normally, therefore, the script would end with write_output $ARGV[0]; Normally this module would be used by another module at build time, to construct the relevant constants and structure functions from system headers. For example, suppose your operating system defines a new type of socket, which has its own packet and address families, and perhaps some new socket options which are valid on this socket. We can build a module to contain the relevant constants and structure functions by writing, for example: #!/usr/bin/perl use ExtUtils::H2PM; module "Socket::Moonlaser"; include "moon/laser.h"; constant "AF_MOONLASER"; constant "PF_MOONLASER"; constant "SOL_MOONLASER"; constant "MOONLASER_POWER", name => "POWER"; constant "MOONLASER_WAVELENGTH", name => "WAVELENGTH"; structure "struct laserwl", members => [ lwl_nm_coarse => member_numeric, lwl_nm_fine => member_numeric, ]; write_output $ARGV[0]; If we save this script as, say, lib/Socket/Moonlaser.pm.PL, then when the distribution is built, the script will be used to generate the contents of the file lib/Socket/Moonlaser.pm. Once installed, any other code can simply use Socket::Moonlaser qw( AF_MOONLASER ); to import a constant. The method described above doesn't allow us any room to actually include other code in the module. Perhaps, as well as these simple constants, we'd like to include functions, documentation, etc... To allow this, name the script instead something like lib/Socket/Moonlaser_const.pm.PL, so that this is the name used for the generated output. The code can then be included in the actual lib/Socket/Moonlaser.pm (which will just be a normal perl module) by package Socket::Moonlaser; use Socket::Moonlaser_const; sub get_power { getsockopt( $_[0], SOL_MOONLASER, POWER ); } sub set_power { setsockopt( $_[0], SOL_MOONLASER, POWER, $_[1] ); } sub get_wavelength { my $wl = getsockopt( $_[0], SOL_MOONLASER, WAVELENGTH ); defined $wl or return; unpack_laserwl( $wl ); } sub set_wavelength { my $wl = pack_laserwl( $_[1], $_[2] ); setsockopt( $_[0], SOL_MOONLASER, WAVELENGTH, $wl ); } 1; Sometimes, the actual C structure layout may not exactly match the semantics we wish to present to perl modules using this extension wrapper. Socket address structures typically contain their address family as the first member, whereas this detail isn't exposed by, for example, the sockaddr_in and sockaddr_un functions. To cope with this case, the low-level structure packing and unpacking functions can be generated with a different name, and wrapped in higher-level functions in the main code. For example, in Moonlaser_const.pm.PL: no_export; structure "struct sockaddr_ml", pack_func => "_pack_sockaddr_ml", unpack_func => "_unpack_sockaddr_ml", members => [ ml_family => member_numeric, ml_lat_deg => member_numeric, ml_long_deg => member_numeric, ml_lat_fine => member_numeric, ml_long_fine => member_numeric, ]; This will generate a pack/unpack function pair taking or returning five arguments; these functions will not be exported. In our main Moonlaser.pm file we can wrap these to actually expose a different API: sub pack_sockaddr_ml { @_ == 2 or croak "usage: pack_sockaddr_ml(lat, long)"; my ( $lat, $long ) = @_; return _pack_sockaddr_ml( AF_MOONLASER, int $lat, int $long, ($lat - int $lat) * 1_000_000, ($long - int $long) * 1_000_000); } sub unpack_sockaddr_ml { my ( $family, $lat, $long, $lat_fine, $long_fine ) = _unpack_sockaddr_ml( $_[0] ); $family == AF_MOONLASER or croak "expected family AF_MOONLASER"; return ( $lat + $lat_fine/1_000_000, $long + $long_fine/1_000_000 ); } Sometimes, a structure will contain members which are themselves structures. Suppose a different definition of the above address, which at the C layer is defined as struct angle { short deg; unsigned long fine; }; struct sockaddr_ml { short ml_family; struct angle ml_lat, ml_long; }; We can instead "flatten" this structure tree to obtain the five fields by naming the sub-members of the outer structure: structure "struct sockaddr_ml", members => [ "ml_family" => member_numeric, "ml_lat.deg" => member_numeric, "ml_lat.fine" => member_numeric, "ml_long.deg" => member_numeric, "ml_long.fine" => member_numeric, ]; Paul Evans <leonerd@leonerd.org.uk>
http://search.cpan.org/~pevans/ExtUtils-H2PM-0.09/lib/ExtUtils/H2PM.pm
CC-MAIN-2015-32
refinedweb
1,462
52.8
#include — Includes an external file for processing. It is sometimes convenient to have the orchestra arranged in a number of files, for example with each instrument in a separate file. This style. Note: Csound versions prior to 4.19 had a limit of 20 on the depth of included files and macros. Another suggested use of #include would be to define a set of macros which are part of the composer's style. An extreme form would be to have each instrument defines as a macro, with the instrument number as a parameter. Then an entire orchestra could be constructed from a number of #include statements followed by macro calls. #include "clarinet" #include "flute" #include "bassoon" $CLARINET(1) $FLUTE(2) $BASSOON(3) It must be stressed that these changes are at the textual level and so take no cognizance of any meaning. Here is an example of the include opcode. It uses the file include.csd, and table1.inc. Example 6. Example of the include opcode. /* table1.inc */ ; Table #1, a sine wave. f 1 0 16384 10 1 /* table1.inc */ include.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1 - a basic oscillator. instr 1 kamp = 10000 kcps = 440 ifn = 1 a1 oscil kamp, kcps, ifn out a1 endin </CsInstruments> <CsScore> ; Include the file for Table #1. #include "table1.inc" ; Play Instrument #1 for 2 seconds. i 1 0 2 e </CsScore> </CsoundSynthesizer>
http://www.csounds.com/manualOLPC/include.html
CC-MAIN-2016-18
refinedweb
244
75.3
Crashing after a couple of hours - Åke Forslund last edited by Hi I'm setting up a temperature sensor using the gPy device. My idea was to have it in deepsleep for ~30 minutes and then perform a measurement and go back to sleep. I've created a main.py that looks like this: from machine import Pin import time from onewire import DS18X20, OneWire print("Booted into application at {}".format(time.time())) def get_temperature(): """Get temperature from OneWire sensor.""" ow = OneWire(Pin('P10')) temp = DS18X20(ow) for _ in range(10): temperature = temp.read_temp_async() time.sleep(1) temp.start_conversion() if temperature: break return temperature def publish_to_web(temperature): print('Publishing a temperature of {}'.format(temperature)) pybytes.send_signal(0, temperature) time.sleep(1) temperature = get_temperature() publish_to_web(temperature) time.sleep(1) print("Going to sleep") pybytes.deepsleep(30*60*1000) # 30 Minutes And this works for some time but after 5-8 hours samples stop coming in and when looking at my computer I see that the Atom shell is trying to connect to the serial port but failing. Disconnecting / reconnecting then shows a SyntaxErrormessage. Resetting the device resumes the operation. Has anyone seen anything similar to this? Any ideas how to make it more robust? Could I setup a watchdog in the boot.py and then feed / disable it in my main.py? would it help or is it likely that the issue occurs earlier. I've now connected it to an usb-charger in case there's something my computer does. Any help / insights would be appreciated! - Åke Forslund last edited by Having it plugged to an usb-charger instead of the computer's usb has kept it stable since I sent above message so maybe it was the USB port on my computer or possibly Atom causing the issue.
https://forum.pycom.io/topic/7172/crashing-after-a-couple-of-hours
CC-MAIN-2022-05
refinedweb
300
58.79
05 March 2008 04:30 [Source: ICIS news] By Jeremiah Chan SINGAPORE (ICIS news)--Fatty acid demand in Asia is coming off sharply due to volatility in upstream vegetable oil markets, producers and traders said on Wednesday. Feedstock crude palm oil (CPO) prices ended a record-breaking run on Tuesday with benchmark May-delivery futures falling on the Bursa Malaysia on Tuesday. They plummeted to ringgit (M$) 4,091/tonne ($1,268/tonne) at the close, after hitting a historical high of M$4,486/tonne earlier in the day. Bearish sentiment has continued to Wednesday, as the May CPO retreated to M$3,951/tonne at 0336 GMT, a M$148/tonne drop from last evening. Some market sources attributed the sudden drop to profit taking as speculative funds quickly liquidated their positions. Others felt that the highs over the past few days were unsustainable. “There would be demand destruction at current palm oil price levels,” Henri Bardon, managing director of ethanol trading firm Vertical Asia, said. This, combined with fears of an impending recession would drag palm oil prices down, he said. The turmoil in the vegetable oils market has hit downstream industries, with buyers of derivative fatty acids quickly sidelined by the rapidity of the price movements. “Fatty acid sales have come to a standstill this week,” the senior official of a fatty acid production unit in ?xml:namespace> Despite CPO appearing to have come off highs, demand remained lacklustre at current levels, he said. Other producers agreed, with the marketing official of a fatty acid plant based in A regional oleochemical trader said that the demand for fatty acids would only recover if raw material prices fell further and find some stability. Only then would buyers return to the market, he said. Major fatty acid producers in ($1 = M$3.18) Anu Agarwal.
http://www.icis.com/Articles/2008/03/05/9105827/asia-oleochemicals-suffer-on-volatile-cpo.html
CC-MAIN-2013-20
refinedweb
307
51.99
sphere_detail() Contents sphere_detail()# Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. Examples# def setup(): py5.size(100, 100, py5.P3D) def draw(): py5.background(200) py5.stroke(255, 50) py5.translate(50, 50, 0) py5.rotate_x(py5.mouse_y*0.05) py5.rotate_y(py5.mouse_x*0.05) py5.fill(py5.mouse_x*2, 0, 160) py5.sphere_detail(py5.mouse_x//4) py5.sphere(40) Description# Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. The default resolution is 30, which creates a fairly detailed sphere definition with vertices every 360/30 = 12 degrees. If you’re going to render a great number of spheres per frame, it is advised to reduce the level of detail using this function. The setting stays active until sphere_detail() is called again with a new parameter and so should not be called prior to every sphere() statement, unless you wish to render spheres with different settings, e.g. using less detail for smaller spheres or ones further away from the camera. To control the detail of the horizontal and vertical resolution independently, use the version of the functions with two parameters. Underlying Processing method: sphereDetail Signatures# sphere_detail( res: int, # number of segments (minimum 3) used per full circle revolution /, ) -> None sphere_detail( ures: int, # number of segments used longitudinally per full circle revolutoin vres: int, # number of segments used latitudinally from top to bottom /, ) -> None Updated on September 01, 2022 16:36:02pm UTC
https://py5.ixora.io/reference/sketch_sphere_detail.html
CC-MAIN-2022-40
refinedweb
254
55.54
Chatlog 2011-04-20 From RDF Working Group Wiki See panel, original RRSAgent log or preview nicely formatted version. Please justify/explain non-obvious edits to this page, in your "edit summary" text. 14:25:49 <RRSAgent> RRSAgent has joined #rdf-wg 14:25:49 <RRSAgent> logging to 14:25:51 <trackbot> RRSAgent, make logs world 14:25:51 <Zakim> Zakim has joined #rdf-wg 14:25:53 <trackbot> Zakim, this will be 73394 14:25:53 <Zakim> ok, trackbot; I see SW_RDFWG()11:00AM scheduled to start in 35 minutes 14:25:54 <trackbot> Meeting: RDF Working Group Teleconference 14:25:54 <trackbot> Date: 20 April 2011 14:40:33 <AZ> AZ has joined #rdf-wg 14:46:09 <SteveH> SteveH has joined #rdf-wg 14:48:12 <OlivierCorby> OlivierCorby has joined #rdf-wg 14:53:50 <ivan> ivan has joined #rdf-wg 14:54:28 <cygri> cygri has joined #rdf-wg 14:54:58 <Scott> Scott has joined #rdf-wg 14:56:44 <mbrunati> mbrunati has joined #rdf-wg 14:57:36 <Zakim> SW_RDFWG()11:00AM has now started 14:57:44 <Zakim> +davidwood 14:57:47 <SteveH> Zakim, what's the code 14:57:47 <Zakim> I don't understand 'what's the code', SteveH 14:57:51 <davidwood> Chair: David Wood 14:57:57 <SteveH> Zakim, what is the code? 14:57:57 <Zakim> the conference code is 73394 (tel:+1.617.761.6200 tel:+33.4.26.46.79.03 tel:+44.203.318.0479), SteveH 14:58:00 <davidwood> SteveH: 73394 14:58:01 <mischat_> mischat_ has joined #rdf-wg 14:58:08 <AndyS1> AndyS1 has joined #rdf-wg 14:58:15 <gavinc> gavinc has joined #rdf-wg 14:58:28 <Zakim> +??P8 14:58:38 <Zakim> +Tony 14:58:38 <AZ> AZ has joined #rdf-wg 14:58:48 <Zakim> +Sandro 14:58:58 <SteveH> Zakim, ??P8 is me 14:58:58 <Zakim> +SteveH; got it 14:59:05 <Zakim> +??P7 14:59:18 <mischat_> zakim, ??P7 is me 14:59:18 <Zakim> +mischat_; got it 14:59:20 <Scott> Zakim Tony is me 14:59:22 <mischat_> hello all 14:59:25 <gavinc> zakim, code? 14:59:25 <Zakim> the conference code is 73394 (tel:+1.617.761.6200 tel:+33.4.26.46.79.03 tel:+44.203.318.0479), gavinc 14:59:51 <Zakim> +AxelPolleres 14:59:57 <Zakim> +[IPcaller] 14:59:58 <Zakim> +[IPcaller.a] 15:00:09 <davidwood> Zakim, who is here? 15:00:09 <Zakim> On the phone I see davidwood, SteveH, Tony, Sandro, mischat_, AxelPolleres, [IPcaller.a], [IPcaller] 15:00:11 <Zakim> +??P15 15:00:13 <AndyS> zakim, IPcaller.a is me 15:00:13 <Zakim> +AndyS; got it 15:00:14 <Zakim> +gavinc 15:00:17 <mbrunati> zakim, IPCaller is me 15:00:17 <Zakim> +mbrunati; got it 15:00:20 <AndyS> (probably) 15:00:33 <Scott> Zakim Tony is Scott 15:00:49 <Zakim> +OlivierCorby 15:00:51 <Zakim> +Luca 15:01:03 <Scott> zakim, Tony is Scott 15:01:03 <Zakim> +Scott; got it 15:01:11 <AZ> zakim, Luca may be me 15:01:11 <Zakim> +AZ?; got it 15:01:19 <AlexHall> AlexHall has joined #rdf-wg 15:01:39 <cygri> zakim, what's the coe? 15:01:39 <Zakim> I don't understand your question, cygri. 15:01:44 <cygri> zakim, what's the code? 15:01:44 <Zakim> the conference code is 73394 (tel:+1.617.761.6200 tel:+33.4.26.46.79.03 tel:+44.203.318.0479), cygri 15:01:59 <Zakim> +AlexHall 15:02:07 <ivan> zakim, dial ivan-voip 15:02:07 <Zakim> ok, ivan; the call is being made 15:02:09 <Zakim> +Ivan 15:02:09 <Zakim> +mhausenblas 15:02:23 <FabGandon> FabGandon has joined #rdf-wg 15:02:24 <cygri> zakim, mhausenblas is temporarily me 15:02:24 <Zakim> +cygri; got it 15:02:29 <Zakim> + +34.67.92.aaaa 15:02:36 <NickH> appologies, I can't make this meeting 15:02:47 <Zakim> +??P21 15:02:56 <webr3> Zakim, i am ??P21 15:02:57 <Zakim> +webr3; got it 15:03:11 <JFB> zakim, i am +34.67.92.aaaa 15:03:13 <Zakim> +JFB; got it 15:03:40 <zwu2> zwu2 has joined #rdf-wg 15:03:55 <JFB> zakim, mute me 15:03:55 <Zakim> JFB should now be muted 15:03:58 <Zakim> +LeeF 15:04:12 <cygri> agenda: 15:04:16 <PatH> PatH has joined #rdf-wg 15:04:16 <Zakim> +zwu2 15:04:23 <zwu2> zakim, mute me 15:04:23 <Zakim> zwu2 should now be muted 15:04:33 <davidwood> Scribe: Olivier Corby 15:04:45 <davidwood> ScribeNick: OlivierCorby 15:04:49 <Zakim> + +20598aabb 15:04:57 <danbri> zakim, aabb is danbri 15:04:57 <Zakim> +danbri; got it 15:05:09 <cygri> AxelPolleres LOL 15:05:15 <Zakim> +Souri 15:05:24 <Souri> Souri has joined #rdf-wg 15:05:50 <Zakim> +tomayac 15:06:00 <davidwood> PROPOSED to accept the minutes of the FTF1: 15:06:00 <davidwood> 15:06:00 <davidwood> 15:06:21 <OlivierCorby> there is an issue 15:06:31 <mischat> i haven't cleaned up my scribed session, I will definitely get round to that soon 15:06:34 <OlivierCorby> note in the minutes 15:06:54 <Zakim> +[Sophia] 15:06:56 <OlivierCorby> two people would vote -1 15:07:01 <LeeF> That doesn't seem like an issue with the minutes 15:07:26 <danbri> (can the dissent be linked from the issue tracker as a hub?) 15:07:41 <FabGandon> zakim, [Sophia] is me 15:07:41 <Zakim> +FabGandon; got it 15:07:46 <LeeF> Thanks very much to the scribes from F2F -- minutes are very helpful 15:07:52 <webr3> one of the -1's was mine I know that 15:08:27 <tomayac> LeeF: +1 15:09:00 <AZ> this email is part of the thread: 15:09:09 <webr3> see link: 15:09:25 <gavinc> antoine.zimmermann@deri.org 15:09:29 <AZ> yes I did vote -1 15:09:33 <cygri> 15:09:55 <Zakim> +PatH 15:10:01 <Zakim> +OpenLink_Software 15:10:01 <OlivierCorby> put the URLs in the minutes 15:10:19 <MacTed> Zakim, OpenLink_Software is temporarily me 15:10:19 <Zakim> +MacTed; got it 15:10:22 <MacTed> Zakim, mute me 15:10:22 <Zakim> MacTed should now be muted 15:11:15 <OlivierCorby> actions under review 15:11:26 <cygri> davidwood, AZ: 15:11:35 <OlivierCorby> action 20 15:11:35 <trackbot> Sorry, bad ACTION syntax 15:11:40 <davidwood> 15:12:21 <mischat> 15:12:25 <mischat> it looks ok to me ^^ 15:12:43 <PatH> we can close the opening. 15:12:59 <tomayac> link correction: 15:13:10 <mischat> sorry tomayac 15:13:22 <tomayac> yours was webr3's great work 15:14:00 <cygri> davidwood, and here's the -1 from webr3: 15:14:14 <trackbot> ACTION-27 Make sure the resolution to issue-12 gets into semantics document notes added 15:14:48 <OlivierCorby> 27 and 28 are duplicated 15:17:10 <AndyS> wiki-ize? 15:17:19 <cygri> OlivierCorby, feel free to interrupt us if you want to ask who's speaking 15:18:18 <PatH> I had this vision of a *very* long action list... 15:19:17 <OlivierCorby> Topic: Poll for F2F2 15:19:23 <davidwood> Review the poll regarding location/dates and results: 15:19:23 <davidwood> 15:19:23 <davidwood> 15:19:56 <OlivierCorby> 19 people not responding 15:20:30 <Zakim> -Ivan 15:20:35 <OlivierCorby> towards east cost early october 15:21:06 <OlivierCorby> please respond to the poll 15:21:24 <zwu2> Just realized a conflict, can I change my vote? 15:21:40 <davidwood> Please indicate attendance at: 15:21:41 <OlivierCorby> wiki page for F2F 2 & 3 15:21:44 <sandro> yes. zwu2 15:21:48 <gavinc> Yes, just resubmit the form 15:21:51 <AxelPolleres> Would there be an option to do a two site F2F with a European site connected via Video conf.? 15:21:55 <zwu2> thanks Sandro 15:22:02 <AndyS> +1 to Axel 15:22:07 <yvesr> AxelPolleres, +1 15:22:09 <AxelPolleres> q+ 15:22:13 <mischat> +1 to Axel 15:22:19 <OlivierCorby> Graph task force 15:22:39 <AZ> AZ has joined #rdf-wg 15:23:02 <ivan> ivan has joined #rdf-wg 15:23:30 <ivan> zakim, dial ivan-voip 15:23:30 <Zakim> ok, ivan; the call is being made 15:23:31 <Zakim> +Ivan 15:23:36 <mischat> east coast US works well re: time difference 15:23:45 <zwu2> q+ 15:23:51 <OlivierCorby> remote participation is possible ? 15:24:10 <LeeF> That room at MIT is cozy :) 15:24:27 <OlivierCorby> try with skype 15:24:43 <PatH> I was impressed by how well the remote participation worked in the last F2F. Dont think that full video is really nfecessary. 15:24:44 <LeeF> The nice thing about the 2-site F2F is that having multiple people at each site helps keep everyone more focused 15:24:50 <PatH> Skype is flaky. 15:24:59 <AxelPolleres> +! to ivan, skype not always reliable... 15:25:05 <OlivierCorby> bad experience with skype 15:25:09 <PatH> +1 to ivan. 15:25:24 <LeeF> AndyS ++ 15:25:35 <AxelPolleres> +1 to Andy 15:25:48 <mischat> AndyS++ 15:26:09 <zwu2> q? 15:26:13 <AndyS> q+ 15:26:27 <davidwood> Zakim, who is speaking? 15:26:37 <davidwood> ack AxerPolleres 15:26:38 <Zakim> davidwood, listening for 10 seconds I heard sound from the following: davidwood (33%), AxelPolleres (29%), PatH (14%) 15:26:41 <Souri> 2-site F2F is very good (east coast 8-5pm is tolerable for western Europe time zone, but it does not work the other way :-)) 15:26:45 <LeeF> Everyone in the SPARQL group loved the 2-site, video-linked, F2F style. 15:26:47 <zwu2> zakim, unmute me 15:26:47 <Zakim> zwu2 should no longer be muted 15:26:49 <davidwood> ack zwu 15:26:51 <gavinc> Remote to the F2F1 as fine, other then time zone ;) 15:26:57 <davidwood> ack AxelPolleres 15:26:58 <AxelPolleres> zakim, ack me 15:26:59 <Zakim> I see AndyS on the speaker queue 15:27:50 <davidwood> ack AndyS 15:27:50 <zwu2> zakim, mute me 15:27:51 <Zakim> zwu2 should now be muted 15:27:55 <OlivierCorby> Poll still open, can change vote 15:28:31 <OlivierCorby> Site in Europe ? 15:29:33 <PatH> mischat, good thought. 15:29:51 <mischat> i could ask ECS, and I could ask W3C UK offices 15:29:55 <mischat> and will report back 15:29:59 <mischat> yes 15:30:04 <SteveH> mischat, ECS has the wrong system 15:30:16 <mischat> but yes they have video geeks ... 15:30:19 <sandro> action: mischat look into soton video conf facilities 15:30:19 <trackbot> Created ACTION-40 - Look into soton video conf facilities [on Mischa Tuffield - due 2011-04-27]. 15:30:20 <mischat> will ask anyways 15:30:40 <mischat> zakim, who is making noise ? 15:30:43 <AZ> AZ has joined #rdf-wg 15:30:49 <OlivierCorby> Skolemization 15:30:51 <Zakim> mischat, listening for 10 seconds I heard sound from the following: Sandro (60%), gavinc (15%), davidwood (53%) 15:30:57 <cygri> Topic: Skolemization 15:31:05 <OlivierCorby> Sandro proposal from F2F 15:31:26 <OlivierCorby> discussion on this 15:31:37 <OlivierCorby> move on resolution ? 15:31:43 <pfps> pfps has joined #rdf-wg 15:31:46 <cygri> SteveH: 15:31:49 <cygri> 15:31:53 <davidwood> Steve's Proposal: 15:31:53 <davidwood> Systems wishing to skolemise bNodes, and expose those skolem constants to external systems (e.g. in query results) SHOULD mint fresh a "fresh" (globally unique) URI for each bNode. 15:31:53 <davidwood> All systems performing skolemisation SHOULD do so in a way that they can recognise the constants once skolemised, and map back to the source bNodes where possible. 15:31:53 <davidwood> Systems which want their skolem constants to be identifiable by other systems SHOULD use the .well-known URI prefix. 15:33:02 <OlivierCorby> using a scheme to detect is it a bnode 15:33:09 <cygri> SteveH: yves strongly opposed SHOULD requirement to .well-known 15:33:40 <PatH> +q 15:33:43 <cygri> SteveH: tried to come up with careful wording to allow use cases 15:34:00 <yvesr> slightly happier about this wording, although still concerned with possible over-complexity and mis-interpretations 15:34:14 <cygri> q+ 15:34:36 <davidwood> ack PatH 15:34:58 <cygri> SteveH: having a URI that claims to be a bnode somewhere in the URI is nonsense 15:35:18 <cygri> PatH: we should not publish anything that discourages use of blank nodes 15:35:50 <MacTed> that seems incorrect, cygri... "we should not publish anything that discourages use of blank nodes" is not what I heard 15:35:51 <sandro> pat: the only case that matters is where the publisher wants others to know that some of the URIs are special, that there is no other info to be had about this thing. 15:36:19 <cygri> MacTed then please correct it 15:36:23 <danbri> q+ to note the "But I didn't say that..." scenario; we shouldn't put URIs "into other's mouths" 15:36:28 <sandro> steve: it matters for your own system to be able to recognize what was a bnode, but other systems dont need to be able to tell. 15:36:30 <pfps> So should it be kosher for a graph store to consume something like _:b :loves :Mary and then emit something like :Mary :loves :Mary (and consider these two to be somehow close in meaning)? 15:36:34 <cygri> q- 15:36:39 <sandro> pat: in that case, why do we need a standard here? 15:36:58 <MacTed> PatH: we should not publish anything that discourages replacement of blank nodes with URIs of whatever coinage 15:37:06 <MacTed> cygri ^^^^^ 15:37:15 <MacTed> (is what I get from his words...) 15:37:59 <gavinc> I think it is worth the WG mentioning as folks keep inventing it on their own 15:38:05 <sandro> steve: consequences to sparql update: if you skolemize at export time, then you have to be able to recognize uris coming in as those, so you can unify them with the bnodes in your store. 15:38:14 <MacTed> and that's (yet another) reason to avoid bnodes 15:39:01 <sandro> pat: we're defining a spec about publishing content. what you're talking about is a private matter. 15:39:03 <sandro> q+ 15:39:23 <sandro> steve: sure, it doesn't add something, but it's worth pointing out. 15:39:34 <mischat> perhaps for the primer ? 15:39:45 <sandro> andy: I like it as a practical experience note. 15:40:03 <ivan> q+ 15:40:12 <PatH> I guess Im worried that if we talk about "skolemization" and use SHOULD language, what we write gets to be holy writ. 15:40:30 <davidwood> ack danbri 15:40:30 <Zakim> danbri, you wanted to note the "But I didn't say that..." scenario; we shouldn't put URIs "into other's mouths" 15:40:46 <sandro> NICE. 15:40:55 <sandro> +1 danbri for this usecase 15:41:35 <sandro> danbri: if I take a graph from someone, skolemize, and republish, it's nice to be able to be clear that you've done this. 15:41:53 <Zakim> -Ivan 15:41:59 <PatH> danbri: yes, but that issue is, who is responsible for the 'new' URIs. And the rule surely is, whoevewr coins the URis is responsible for them. 15:42:06 <davidwood> ack sandro 15:42:22 <danbri> ivan, we lost you in audio? 15:42:27 <PatH> I dont think danbri's case is a use case. 15:42:41 <danbri> it's a mis-use case 15:42:46 <PatH> :-) 15:43:01 <PatH> +q 15:43:02 <danbri> dan loads pat's graph, does some trivial transform, republishes it, sandro consumes it, and wants to know what pat actually said 15:43:19 <SteveH> q+ 15:43:20 <danbri> (much as we might care to avoid muddle if dan retransmitted pat's sayings via rdf'99 reification?) 15:43:23 <davidwood> Why is SHOULD considered holy writ? Surely MUST is... 15:43:30 <MacTed> Zakim, unmute me 15:43:30 <Zakim> MacTed should no longer be muted 15:43:32 <davidwood> q? 15:43:32 <MacTed> q+ 15:43:39 <davidwood> ack PatH 15:43:40 <OlivierCorby> problem with multigraph that may share bnodes 15:44:51 <cygri> q+ 15:45:03 <pfps> My action-27 cannot be done until issue-12 is closed, so I've extended the due date for a while. 15:45:34 <Souri> q+ 15:46:06 <davidwood> ack SteveH 15:46:13 <sandro> pat: what about just saying the one who mints an IRI is responsible for it? 15:46:27 <sandro> sandro: yeah, that could work. 15:46:41 <webr3> if people are talking about a specific something by name, then what is the difference between that and a uri-ref, as soon as anybody skolemizes and somebody else uses that uri, then people are talking about a specific thing rather than just something, surely? 15:46:50 <ivan_> ivan_ has joined #rdf-wg 15:46:53 <PatH> +1 to speaker. 15:46:56 <zwu2> why does it need to be globally unique? 15:46:57 <sandro> steve: I don't want to throw the baby out with the bathwater. Skolemizing is what the vast majority of stores now, and I don't like everyone ignoring the standard. 15:47:03 <pfps> Umm, what is the standard specifying?? 15:47:16 <pfps> ... that is being ignored? 15:47:16 <davidwood> q? 15:47:20 <ivan_> zakim, dial ivan-voip 15:47:20 <Zakim> ok, ivan_; the call is being made 15:47:22 <Zakim> +Ivan 15:47:27 <sandro> q? 15:47:57 <sandro> steve: "systems that issues URIs are responsible for them" 15:48:18 <sandro> steve: I just think it makes sense to codify the common practice. 15:48:26 <AlexHall> pfps, that a blank node label is not valid outside the scope of the graph in which it appears? 15:48:28 <cygri> q- 15:49:06 <sandro> david: Steve, can you write a new proposal that attempts to capture that? 15:49:09 <danbri> re responsibility, yeah i tihnk that's part of the issue 15:49:46 <webr3> AlexHall, but there's no way you can prevent people from using that uri in another doc? 15:49:47 <sandro> steve: "if you want your URIs to be identified as sk bno then you should..." is what Pat doesn't like 15:49:47 <danbri> so if i ascribe to pat as author of a graph, but am actually pointing at a graph full of skolem'd bnodes i interfered with, ... is that misrepresenting pat? 15:49:58 <pfps> I think that I would be unhappy. 15:50:00 <davidwood> ack MacTed 15:50:14 <ivan> q- 15:50:51 <pfps> consistent?? 15:51:06 <davidwood> q+ to suggest we have a theory vs practice argument 15:51:07 <pfps> q+ 15:51:37 <PatH> For practical purposes, systems might wish to replace blank nodes by URIs. If done, the responsibility for the meaning of these newly introduced URIs lies with the publisher of the modified data. 15:51:53 <sandro> ted: bnodes are nothing but trouble 15:52:06 <sandro> sandro: this group isn't saying anything of the sort 15:52:17 <danbri> minting open-ended descriptive promises to the planet - also can be troubling 15:52:20 <AndyS> Can we have the wording for any proposal (= evolving working draft) on the wiki please - easier to point to at resolution. It took me some time (error prone?) creating a single, consolidated view. 15:52:34 <SteveH> q+ 15:52:48 <PatH> Whoa. this is not to do woth names being 'variable'. 15:53:02 <sandro> +1 AndyS -- we need a stable on-wiki wording for any proposal 15:53:14 <davidwood> ack Souri 15:53:23 <SteveH> q- 15:53:24 <pfps> q- 15:53:41 <PatH> Cant draft text and listen at the same time. 15:53:47 <sandro> Souri: bnodes are nothing but local-scope variables. once you make it, it's not visible outside the scope. 15:55:10 <sandro> Souri: let the externalizer map the bnode to a URI and then it's normal, and can be used outside. 15:55:11 <PatH> souri: agreed. Our role as a WG is not to rule on private mappings used inside tools. Its only our business when it gets published. 15:55:38 <SteveH> proposal: 15:55:41 <sandro> Souri: ... and then provide a predicate to connect generated URI to the bnode. 15:55:44 <PatH> souri just summarized the entire idea of skolemization, using programming terminology. 15:55:45 <Souri> How about externalizing a bNode by specifying a mapping from bNode to a URI => _:b1 rdf:graphIRI <G1> . _:b1 rdf:bNode2IRI :someUriExternalizerChooses . (or we can use the owl:sameAs property, but that could be an overkill) 15:56:05 <cygri> q+ 15:56:12 <PatH> Exactly, it is up to the app. designer. NOt our business to een know about that. 15:56:14 <webr3> fair to summarize as: skolemization should happen behind the interface before data hits the wire (so no bnodes show to the outside world)? 15:56:50 <PatH> +1 webr3 15:57:01 <PatH> It **is** skolemization. 15:57:06 <sandro> ehhh, skeptical about rdf:bNode2IRI. wrong level. 15:58:16 <PatH> Aaargh, don't say URI **represents** a bnode, please... 15:58:29 <davidwood> q- 15:58:30 <zwu2> +1 to separate what and how 15:58:34 <webr3> PatH, if everybody did that, then there would be no bnodes on the wire, as in no bnodes in serializations or in "visible" rdf ? 15:58:40 <davidwood> ack cygri 15:58:53 <PatH> If everybody did that, yes. BUt of course they wont ALL do it. 15:59:11 <PatH> cygri, nooooo. 16:01:27 <sandro> cygri: In practice you're often confronted with other people's bnodes -- by saying something about sk in our docs, ("look here's a process for when you get bnodes you didnt want...") ... I see Pat's point about it's your own private business, as long as you keep to your own URIs in the process, then why would anyone ned to know about it? I think, however, there is value in writing down the fact that it is okay to do so. It is NOT obvious. YOu have to s 16:01:27 <sandro> pend a lot of time with RDF before you know that. 16:01:35 <davidwood> q? 16:01:39 <webr3> other people skolemizing my data worries me, because for every person that does it the bnode is effectively forked, has multiple identifiers, which makes it impossible to manage, you can't merge or diff graphs fromt he same source, manage data over time etc - which completely invalidates the point of skolemizing afaict 16:02:03 <MacTed> webr3 - that's the reason for *you* to not use bnodes... 16:02:10 <MacTed> Zakim, mute me 16:02:11 <webr3> MacTed, exactly 16:02:22 <Zakim> MacTed should now be muted 16:02:24 <mischat> i don't think people get confused between whether to use a bnode or not. If you don't want your data to be dereferencable via a URI, you use a bnode ... 16:02:30 <sandro> cygri: This doesn't speak to making the skolem constants reconginizable. But it's nice to have a simple recipe that avoids one having to think too much. 16:03:07 <sandro> 16:03:08 <mischat> 16:03:10 <PatH> webr3, I think that managing over time is made tricky just by there being multiple copies. 16:03:38 <zwu2> q+ 16:03:43 <zwu2> q? 16:03:53 <zwu2> zakim, unmute me 16:03:54 <danbri> q+ to suggest a use case: dan publishes a previously private graph. it has some bnodes / skolems representing objects that dan didn't know good public URIs for, and didn't host his own. Sandro loads up that document and reading the properties of the objects it describes, figures out some good replacement URIs. Because he can see which URIs are transient bnode-derrived skolem URIs, Sandro can now REPLACE those in the graph, rather than complicate 16:03:54 <danbri> the graph with sameAs links to the 'better' well known URIs. 16:04:00 <Souri> q+ 16:04:04 <Zakim> zwu2 should no longer be muted 16:04:10 <PatH> Would like to say all this without using 'skolem' anywhere. DOn't need to revert to logic-jargon for the general reader. 16:04:16 <MacTed> in other words -- other people will skolemize (and here's a reasonable way to do that...), when they want to reuse data sets that came to them including bnodes. That causes problems down the line. So it's best not to use bnodes.... :-) 16:04:30 <webr3> PatH, or just by having bnodes at all, it requires the ability to say "something, let us all call it X all the time" afaict 16:04:44 <sandro> q? 16:04:47 <davidwood> ack Zhe 16:05:00 <davidwood> ack zwu 16:05:38 <sandro> zwu2: I'm in favor of skolemizing, but isn't globally unique too strong? why not just locally unique to your store? globally unique is harder. 16:06:33 <sandro> UUID solves this pretty well. 16:06:43 <mischat> but then why not just use a URI 16:07:04 <PatH> The skolem name has to be a URI. What does it mean to say that a URI is only locally unique? 16:07:08 <gavinc> e.g, urn:bnode:<UUID>:<localsegment> 16:07:27 <gavinc> Federated Query too 16:07:42 <AndyS> +1 to gavinc 16:07:43 <PatH> q+ 16:07:48 <davidwood> ack danbri 16:07:48 <Zakim> danbri, you wanted to suggest a use case: dan publishes a previously private graph. it has some bnodes / skolems representing objects that dan didn't know good public URIs for, and 16:07:51 <Zakim> ... didn't host his own. Sandro loads up that document and reading the properties of the objects it describes, figures out some good replacement URIs. Because he can see which URIs 16:07:56 <Zakim> ... are transient bnode-derrived skolem URIs, Sandro can now REPLACE those in the graph, rather than complicate 16:08:00 <pfps> I think that the SHOULD should be a MUST for globally unique. 16:08:48 <cygri> for reference, RFC 2119: SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course. 16:09:26 <davidwood> Zakim, close the queue 16:09:27 <Zakim> ok, davidwood, the speaker queue is closed 16:09:31 <PatH> What danbri is talking about might be called data quality improvement. I agree, people will do this, and its a good thing. But its not skolemization. 16:09:48 <sandro> +1 danbri: the flagging might be useful because it lets you throw away the URIs, BUT there may well be other data that grows up using it, so maybe you can't throw it away. 16:10:06 <pfps> yes, but I think that there is a big distinction between this SHOULD and later SHOULDs in the proposal 16:10:20 <PatH> pfps, +1 16:11:13 <PatH> q- 16:11:16 <davidwood> ack Souri 16:11:18 <cygri> sandro, in data that's all bnodes, this is literally impossible 16:11:34 <sandro> sandro: steve, I agree the sparql-loop is useful but I don't think it's compelling, since users can just write a better query. 16:11:36 <AZ> AZ has joined #rdf-wg 16:11:39 <SteveH> q+ 16:11:39 <AndyS> because the store is changing? Want to "pin" previous query results. 16:12:03 <pfps> but then you are *not* doing skolemization, you are doing something else (which might be fine, of course)!! 16:12:03 <davidwood> General Concept 16:12:03 <davidwood>. 16:12:16 <cygri> AndyS, yes 16:12:33 <sandro> davidwood, Can we do a straw poll on the general concept to see where everyone stands? 16:12:38 <PatH> David, delete second sentence. This is a private issue for the system, not required. 16:12:46 <danbri> PatH, yes I wasn't arguing that the cleanup / improvement is skolem18n, but rather that it is made easier by being able to recognise which URIs are the result of skolemisation [but i've not convinced myself, since even these funny skolem'd URIs might end up popular/useful] 16:12:55 <Souri> I feel better if "globally unique" is just a suggestion (because I think sometimes I may not need it and sometimes I may want a bNode to map to a specific URI (or two or more bNodes from different graphs to map to the same URI)) 16:13:12 <webr3> I'm frequently getting confused with this, if you have { <u> a Foo } that entails that something exists which is a Foo . So I hear lots of people saying they want a persistent name for a blanknode (as something), isn't the definition of saying that just using a URI. It sounds to me like most uses of bnodes are people saying "this thing" rather than "something", why they using bnodes? 16:13:18 <MacTed> Zakim, unmute me 16:13:18 <Zakim> MacTed should no longer be muted 16:13:20 <danbri> "what you do in the privacy of your own database is your own business" 16:13:36 <Souri> +1 to Pat 16:13:41 <AndyS> Agree with PatH: SHOULD -> should (=we suggest) 16:13:47 <sandro> sandro: Yes, we can weaken the second sentence. 16:14:13 <PatH> David, dont be discouraged. We will get this done, honestly. 16:14:22 <PatH> :-) 16:14:28 <webr3> but why indicate it? bob a man entails that something exists that is a man - why do you even need to know "it was a bnode" because it entails all the same stuffs surely :s 16:14:31 <danbri> i was uncomfortable with an unqualified 'should' and remain so; at one point the sentence seemed to be more qualified 16:14:36 <SteveH> +1 to PatH 16:14:47 <mischat> bye all 16:14:49 <Zakim> -Souri 16:14:49 <LeeF> bye 16:14:50 <zwu2> bye 16:14:50 <Zakim> -cygri 16:14:50 <Zakim> -mischat_ 16:14:51 <davidwood> Adjourned 16:14:52 <PatH> byeeee 16:14:53 <Zakim> -SteveH 16:14:54 <Zakim> -LeeF 16:14:54 <Zakim> -MacTed 16:14:54 <sandro> webr3, I think there are practical engineering reasons. there are no firm logic reasons. 16:14:55 <mbrunati> bye 16:14:56 <Zakim> -JFB 16:14:56 <AZ> bye 16:14:58 <Zakim> -webr3 16:15:00 <Zakim> -tomayac 16:15:02 <Zakim> -danbri 16:15:04 <Zakim> -zwu2 16:15:06 <Zakim> -OlivierCorby 16:15:06 <ivan> zakim, drop me 16:15:08 <Zakim> -PatH 16:15:10 <Zakim> -AlexHall 16:15:11 <AlexHall> AlexHall has left #rdf-wg 16:15:12 <Zakim> -??P15 16:15:14 <Zakim> Ivan is being disconnected 16:15:16 <Zakim> -Scott 16:15:18 <Zakim> -Ivan 16:15:20 <Zakim> -mbrunati 16:15:22 <Zakim> -gavinc 16:15:24 <Zakim> -AndyS 16:15:33 <AndyS> AndyS has left #rdf-wg 16:15:38 <gavinc> make it possible for isBlank() to do the "right" thing? 16:15:42 <Zakim> -davidwood 16:15:43 <webr3> @sandro, if there are no firm logic reasons, and the practical engineering reasons are that they want a persistent name, then where does the notion of a blank node come in to it at all? 16:15:44 <Zakim> -AxelPolleres 16:15:47 <Zakim> -Sandro 16:16:28 <cygri> webr3, because a URI may give raise to different expectations w.r.t stability etc compared to a blank node 16:16:31 <SteveH> webr3, [butting in] mostly syntax - but it what people often use bNode syntax for as it stands 16:17:07 <sandro> RRSAgent, make minutes public 16:17:07 <RRSAgent> I'm logging. I don't understand 'make minutes public', sandro. Try /msg RRSAgent help 16:17:15 <Zakim> -FabGandon 16:17:16 <sandro> RRSAgent, make logs public 16:17:17 <Zakim> SW_RDFWG()11:00AM has ended 16:17:19 <Zakim> Attendees were davidwood, Sandro, SteveH, mischat_, AxelPolleres, AndyS, gavinc, mbrunati, OlivierCorby, Scott, AZ?, AlexHall, Ivan, cygri, +34.67.92.aaaa, webr3, JFB, LeeF, zwu2, 16:17:21 <Zakim> ... +20598aabb, danbri, Souri, tomayac, FabGandon, PatH, MacTed 16:17:28 <AndyS> AndyS has joined #rdf-wg 16:17:55 <webr3> cygri, stability in what sense? a blank node is just saying something exists, not this thing, so there's nothing to be stable w/ a blank node ? 16:17:57 <FabGandon> FabGandon has left #rdf-wg 16:18:07 <sandro> I'm really seeing this as an "experimental" thing, but then tag: URIs are "experimental" as well. 16:18:29 <SteveH> I'm seeing it more as codifying common practice 16:18:33 <cygri> webr3, exactly. but once you skolemize it to a uri, it looks more stable but probably isnt 16:19:18 <SteveH> URIs aren't guaranteed to be stable, it's not a promise or anything 16:19:25 <sandro> webr3, I think the main thing about a skolem node is that you have much greater confidence you can throw away the URI. This is important if you've read the same graph many times and thus have many copies of what should have been the same triple. 16:19:47 <SteveH> yup, that's a fair point 16:19:55 <sandro> shall we get back on the phone? :-) 16:20:05 <SteveH> probably wouldn't hurt 16:20:16 <cygri> SteveH, not guaranteed of course, but minting a URI is a promise 16:20:16 <SteveH> but I think we've lost critical mass 16:20:17 <webr3> @sandro, in which case what was the point in skolemizing in the first place 16:20:27 <webr3> if you're just going to throw the name away 16:20:56 <sandro> webr3, because you wanted to pass it through something (like sparql-results-loop or graph-delta) that can't handle bnodes. 16:20:57 <SteveH> noones making you throw it away 16:20:58 <cygri> SteveH, if it weren't, how could you ever hyperlink to someone else's web page? (of course, some promises stronger than others) 16:21:07 <davidwood> webr3, reading you seem to be saying −1 to a proposal that was not resolved that way. Am I missing something? 16:21:26 <SteveH> cygri, well, it's just a best effort thing, I've got URIs from domains that I've lost control of 16:21:42 <webr3> davidwood, perhaps I am missing something, if it wasn't resolved then no -1 from me counts :0 16:21:46 <cygri> SteveH, a promise to best effort ;-) 16:21:57 <davidwood> is still open 16:22:12 <SteveH> cygri, right, and best effort for a bnode skolemisation is "until I have a better idea", *shrug* 16:22:15 <cygri> SteveH, a blank node label is not even a best effort thing. it might change anytime as far as i know 16:22:27 <SteveH> bnoe label != skolem constant 16:23:18 <webr3> @sandro, yes that's why i thought one would skolemize, but for the name to be useful for delta's / over time, then it has to be reliable over time, not just throw away, and in you can have multiple names for the same blank node and not be able to tell they are the same blank node, then i don't follow how that helps at all, surely it just compounds with the illussion of stability 16:23:34 <webr3> and that illussion of stability is the whole problem that blank node identifiers introduced int he first place 16:23:45 <webr3> so it only makes it worse afaict 16:23:55 <SteveH> not in our experience 16:23:57 <cygri> SteveH, if I see a bnode in your data, i know i can't link to it. if i see a URI, it's reasonable for me to expect that I can link to it. if it's a .well-known/bnode URI, then i know i probably shouldn't 16:24:14 <SteveH> cygri, no argument from me 16:24:20 <sandro> +1 cygri 16:24:25 <sandro> nicely put. 16:24:29 <cygri> webr3, see above :-) 16:24:45 <SteveH> cygri, but people who have very stable data (inc. bNodes), and are precious of their HTTP URI space disagree 16:24:52 <sandro> and you probably shouldn'y BECAUSE folks downstream are likely to de-skolemize and throw the sk iri away. 16:25:10 <yvesr> cygri, relying on the shape of a URI to know whether I should link to it or not... 16:25:16 <SteveH> sandro, likely is a bit strong, "free too" maybe 16:25:26 <cygri> yvesr, i'm relying on an RFC, not the shape of the URI 16:25:43 <SteveH> if the URI starts http: you should feel free to link to it, if it's not dereferencable, use tag: 16:25:43 <yvesr> cygri, on an RFC? the one that defines well-known? 16:25:44 <SteveH> natch 16:25:45 <davidwood> +1 to cygri 16:25:49 <sandro> SteveH, can we settle on "more likely to" (than with normal IRI) ? 16:26:01 <yvesr> cygri, there's nothing in that RFC that says i shouldn't link to a .well-known uri 16:26:05 <SteveH> sandro, sure 16:26:19 <SteveH> yvesr, no, quite right 16:26:24 <yvesr> cygri, so you're relying on something built on top of it, not the RFC itself 16:26:37 <davidwood> Updated minutes in relation to ISSUE-12 (Lee's comments). Nathan's −1 related to a proposal that was not adopted. 16:26:43 <SteveH> if the URI starts http: you should feel free to link to it, if it's not dereferencable, use tag: 16:26:47 <SteveH> [repost] :) 16:26:49 <sandro> btw, SteveH I was reading about the 5 versions of UUIDs and seems like you can probably generate them cheaply enough--- 128 bits is a lot of room. 16:27:08 <webr3> cyngri, that makes no sense to me 16:27:17 <SteveH> sandro, yeah... but lets not dictate identifier syntax 16:27:23 <sandro> sure. 16:27:44 <SteveH> I suspect we (garlik) want .../$uuid/$localid 16:27:51 <SteveH> oir something of that nature 16:27:57 <webr3> cygri, if you want to provide a uri and say no more info to get about this thing, just don't give any more info or use a scheme that can't be looked up for more info - i don't see how that has anything to do w/ bnodes ? 16:28:38 <SteveH> webr3, the problem comes when you do want to say more about it 16:28:52 <SteveH> if you don't want to say anything about it, then there's no issue 16:29:28 <webr3> but when you use a bnode you're not talking about a specific thing, you're making a general statement like "a man exists in the world" not "this specific man exists in the world" 16:32:07 <webr3> I'm ever tempted to agree w/ pats original proposal, just loose blank nodes - I can barely see a case where people are actually using bnodes as existentials tbh, seems like peopel are just using them as a quick way of not giving soemthing a proper name (at this time) but might do later 16:33:09 <webr3> everytime somebody see's _:b1 they think a specific think called "_:b1 in this graph only" is being talked about anyway, isn't that the problem here? 16:37:27 <sandro> webr3, the most we can POSSIBLY do there is issue some strongly worded text about why one might want to avoid bnodes. Feel free to start drafting that text..... ? 16:38:36 <webr3> @sandro, yup - perhaps the issue is less about skolemizing and more about avoiding blank nodes in the first place 16:39:15 <sandro> well, for you. For me, it's about providing an intermediary service (federated query, delta) that doesn't mangle the data too badly. 16:40:18 <webr3> @sadnro, I'd like that too.. but unsure if it's possible (when you scale up to there being two intermediaries trying to do that for the same graph and one person using both) 16:40:36 <sandro> Agreed. Thus it's "experimental". :- 16:40:38 <sandro> :-) 16:40:40 <webr3> agree 16:43:32 <webr3> related, have been looking at whether it'd possible to do an object based rdf (like json-ld etc) which didn't have any notion of blank nodes or "anonymous objects", and it seems anonymous objects are very common - /however/ when you do diff/patch or anything over time with nested objects structures which include anonymous objects, there's no problems.. 16:43:32 <webr3> it's only when you try to break it down in to triples that you get the problems.. 16:45:01 <webr3> *although merge can still be tricky 16:45:57 <sandro> right -- triples == merge, I think. 16:50:27 <cygri> yvesr, W3C will register a namespace under .well-known, and in that registration it can say you shouldn't link to those URIs. or at least I can infer from the registration that those aren't stable IDs 16:53:13 <SteveH> cygri, disagree, if you don't want people to link it, use tag: 16:53:20 <SteveH> if it starts http: I think it should be linkable 16:53:29 <sandro> cygri, can you put that more crisply? because obviously we want to use that URIs in more than one place for several of the use cases.... 16:53:59 <cygri> SteveH, you're right, it shouldn't say that you shouldn't link to it 16:54:30 <SteveH> there's perfectly valid usecases for follow-your-nose on skolemised bnodes, e.g. FOAF 16:55:08 <danbri> danbri has joined #rdf-wg 16:55:31 <sandro> I think cygri is saying I shouldn't say eg:sandro foaf:knows <> 16:55:32 <AndyS> UUIDs are very cheap to generate - can amortize overhead arbitrarily and do it with a integer 32 bit +1 + a 16 byte copy. OSs support epochs and clocks going backwards. 16:55:33 <cygri> SteveH, the point is I can tell that they have been auto-generated by some process that doesn't know anything about the identity of the things identified 16:55:48 <SteveH> cygri, yup, agreed 16:56:43 <SteveH> cygri, but there are usecases (where the data is generated internally, and only exposed over SPARQL for e.g.) when you don't need to own up that the URIs originated from bNodes 16:56:55 <SteveH> personally, I don't really care, but some peopel do 16:57:09 <sandro> what do you think about that foaf:knows example? is that an open thing to do? 16:57:44 <cygri> SteveH, sandro, in absence of� any further information from the publisher, i'd expect a .well-known URI to be just as volatile as a blank node label 16:58:01 <SteveH> cygri, fair enough 16:58:14 <sandro> I think so too, yeah. 16:58:15 <cygri> SteveH, sandro, but publishers can make them more stable for their internal use 16:58:28 <SteveH> cygri, sure 16:59:54 <cygri> so in absence of further information from the publisher i probably wouldn't link to them 17:00:30 <SteveH> cygri, which is an argument, for people who know that their skolem constants are just as stable as "normal" URIs to not advertise the fact 17:01:02 <cygri> SteveH, i think they'd be better off using a different namespace, that makes it look just like normal URIs 17:01:31 <cygri> SteveH, in practice I'd hope that my store comes pre-configured with something like .well-known, but lets me override it if i want to 17:01:32 <SteveH> cygri, yes 17:01:38 <SteveH> cygri, yes 17:01:50 <SteveH> exactly 17:02:19 <sandro> sounds like a pretty good plan. 17:02:42 <cygri> sandro, SteveH: so what document should all this go into? 17:02:49 <SteveH> yeah, I'm not quite sure who the dissenters are 17:02:55 <SteveH> cygri, right now, the wiki page I think 17:03:20 <sandro> A short WG note which includes the syntax spex, I think. 17:05:29 <davidwood> SteveH: Everyone :) 17:06:00 <SteveH> davidwood, I'm not convinced, I think there's too much violent agreement 17:06:01 <davidwood> cygri: +1 to good store defaults and overrides. 17:06:28 <davidwood> Perhaps, Steve. That's why I thought we might be close to consensus for the last week. 17:06:51 <SteveH> a note would probably be idea, /if/ the current documents don't explicitly forbid it, which i'm not clear on. by my reading they do 17:07:12 <SteveH> but PatH said otherwise, I think 17:07:15 <cygri> SteveH, do you think so? which parts? 17:07:35 <SteveH> cygri, don't remember, I quoted it in email 17:08:15 <cygri> gross 17:08:18 <SteveH> davidwood, I think we were very close to consensus, again :) 17:08:31 <cygri> just had a spider running over my desk. squished it with a printout of RDF Semantics 17:08:46 <SteveH> poor spider :-| 17:09:11 <cygri> not a nice way to go 17:09:17 <sandro> ha! 17:09:52 <SteveH> sadly probably not the first or last death that will be attributable to that document 17:11:01 <cygri> any recent suicides among the members of recent WGs? 17:11:09 <cygri> anyway 17:12:23 <cygri> SteveH, so the wiki currently says: "All systems performing skolemisation SHOULD do so in a way that they can recognise the constants once skolemised, and map back to the source bNodes where possible." 17:12:25 <sandro> do you count marriages...? (never mind....) 17:13:56 <cygri> SteveH, perhaps sufficient: "Systems may wish to perform skolemisation in a way that they can recognise ..." 17:14:40 <SteveH> cygri, yes, that's better 17:21:52 <cygri> should there be something like: "Systems that encounter skolem constants generated by other systems SHOULD NOT assume that the skolem URIs are permanent." 17:23:56 <mischat> mischat has joined #rdf-wg 17:24:07 <SteveH> cygri, no, I think that's not neccesary 17:24:56 <cygri> SteveH, clarification, i'm talking about .well-known URIs there. still disagree? 17:25:25 <SteveH> cygri, I don't disagree, I just don't think it adds anything 17:25:33 <SteveH> and it may turn out not to be true 17:26:00 <SteveH> preguessing stuff like that has been a bit of a downfall in the past 17:27:25 <cygri> SteveH, would it be better with some language about "unless you know otherwise because the publisher makes some sort of guarantee"? 17:27:43 <SteveH> cygri, no, I think it's best to just leave it unsaid 17:28:19 <SteveH> and not trying to second-guess deployments 17:30:03 <SteveH> not at all, I want to be able to use them 17:30:04 <mischat> :( 17:30:29 <SteveH> I dislike having to explicitly mint URIs for everything 17:30:45 <SteveH> the [ ... ] syntax in turtle is very handy 17:30:52 <SteveH> but not SPARQL friendy 17:30:56 <SteveH> *friendly 17:31:55 <cygri> SteveH sure but the URIs you're going to see for those skolemised blank nodes are likely to change each time you edit something 17:32:30 <cygri> i'm concerned with naive users who assume that those URIs must be sort of stable (because they are URIs) and try to link to them 17:32:51 <pchampin> pchampin has joined #rdf-wg 17:33:14 <SteveH> ie, tag: 17:33:19 <SteveH> v's http: 17:33:24 <SteveH> don't use http: if you don't mean it 17:33:27 <cygri> SteveH, no that's a different issue 17:33:33 <SteveH> ah, I see what you mean 17:33:40 <SteveH> yeah, that's a concern 17:33:41 <cygri> i mean link to in the sense of assuming they are stable names 17:33:42 <mischat> if i had to use a URI for a blanknode, i would use the most useless uri i can think of 17:33:47 <mischat> namely either urn or tag 17:33:59 <mischat> as they are pretty much local variables anyways 17:34:29 <cygri> mischat, the .well-known thing is pretty much that, just easier to register 17:34:41 <mischat> yeah but it starts with http: 17:34:45 <mischat> which would make me want to resolve it 17:34:51 <mischat> but that is a different matter 17:35:17 <SteveH> if you use http: it should really be resolvable, but that was my point when I misunderstood cygri 17:35:32 <SteveH> instability is an issue, but it's all relative 17:36:01 <SteveH> I'd prefer not to gaze into a crystal ball to guess what the right response is 17:36:26 <SteveH> if we issue a note in short order, chances are we can update it with more experience down the line 17:36:36 <SteveH> for the URIs that 4store mints, it's not been an issue that I know of 17:36:42 <cygri> SteveH, mischat: in my experience, many users balk at funny uri schemes, that's why i prefer http://. "should be resolvable" is an issue, that's true 17:36:51 <SteveH> but there's quite clearly not "normal" URIs, which /may/ make a difference 17:37:14 <SteveH> machines don't care about URI schemes, users may 17:39:24 <mischat> i see the point, but humans author the systems which write out data 17:39:42 <mischat> but yeah, meh ... as long as bnodes dont get chucked out i am happy 17:40:59 <cygri> mischat, SteveH: any reason why the note shouldn't list both AND tag:/urn:/whatever? 17:41:06 <cygri> as options? 17:41:23 <cygri> "Systems which want their skolem constants to be identifiable by other systems SHOULD use one of the following two options:" 17:41:38 <SteveH> cygri, no, no reason at all 17:41:51 <SteveH> I'd still liek to see <genid:...>, but it's maybe too optimistiic 17:42:14 <SteveH> I still think we could say that we're aiming to register it in a note, as a none-to-subtle hint 17:42:30 <mischat> something like, if the system decides to use a URI it is free to, but if the authors want to use an http URI it should be of form .well-known/foozle/ 17:43:44 <cygri> mischat, what's the difference in intent between your wording and the wording i gave above? 17:43:54 <mischat> nothing 17:44:00 <cygri> mischat ok :-) 17:44:06 <cygri> SteveH: I would prefer <bnode:...> to be honest 17:44:09 <mischat> trying to stress the fact that you can use any uri scheme 17:44:19 <mischat> i mean ftp should work right ? 17:44:47 <cygri> mischat, yeah sure, the sentence is just about the case where a system wants its URIs to be recognizable by others 17:44:51 <SteveH> mischat, not all URI schemes support /.well-known/ 17:44:53 <cygri> if you don't care about that, use whatever you like 17:44:58 <SteveH> quite 17:45:02 <mischat> sure 17:45:41 <mischat> my only contribution here, is that uri schemes such as tag/urn which are not resolvable are bnodes if you look at them from a certain point of view 17:45:51 <cygri> SteveH how about <nodeid:...>? as per RDF/XML terminology? 17:46:04 <SteveH> cygri, a nodeid is a bNode label, so NO! 17:46:16 <cygri> SteveH, ok fair point 17:46:28 <SteveH> c.f. bnode: 17:47:17 <cygri> mischat, well i'd expect that a tag: uri survives reloading the document; with a blank node label, not necessarily 17:48:02 <cygri> mischat, in other words, it's easy to make long-lived tag: uris, but hard (and sort of discouraged by the specs) with blank nodes 17:52:21 <SteveH> "I'm looking forward to using them as graph names, actually." hehe, quite 18:02:10 <AndyS> AndyS has joined #rdf-wg 18:17:18 <Zakim> Zakim has left #rdf-wg 18:40:01 <pchampin> pchampin has left #rdf-wg 18:54:51 <danbri> danbri has joined #rdf-wg # SPECIAL MARKER FOR CHATSYNC. DO NOT EDIT THIS LINE OR BELOW. SRCLINESUSED=00000666
http://www.w3.org/2011/rdf-wg/wiki/index.php?title=Chatlog_2011-04-20&oldid=1010
CC-MAIN-2014-52
refinedweb
9,031
62.51
So getAsDOM works by serializing the element out to a string, then parsing that as a mini-document. There's a problem with this, though - it doesn't work if there are are namespaced attributes... If we originally had the "xsi" prefix declared at the top level (i.e. <Envelope>), and then ask for this header as DOM: <someHeader xsi: The parser will complain because we're trying to parse exactly that string, which doesn't contain a namespace declaration for the xsi:type element, and thus this is bad XML. If we change the serializer to add the namespace declaration, we alter the structure of the document and, although the parse will work then, we lose the correctness of the DOM representation. Any suggestions? All I can think of at the moment is to serialize the entire envelope, parse it as DOM, and then find the element we're looking for in the tree.... (keeping a cached copy of the DOM around, probably) Glen Daniels Macromedia Building cool stuff for web developers
http://mail-archives.apache.org/mod_mbox/axis-java-dev/200108.mbox/%3C17A15974548DD5118D2A00508B952D96060731@salsa.allaire.com%3E
CC-MAIN-2017-47
refinedweb
173
55.98
On Tue, Aug 03, 2004 at 01:34:08AM +0300, Asko Kauppi wrote: > > I was trying around and noticed this can be done: > > return ({ [0]="yes", [1]="no" })[ rc ] > > ..but this not (had tried before): > > return { [0]="yes", [1]="no" }[ rc ] > > Is there a syntactical reason, or is it just an implementation detail? You're aware of the kludge that prevents you putting a newline before the ( when calling a function? Allows table constructors to be prefixexps would have exactly the same problem, e.g: -- One statement or two? x = f { ... }[i]() Except it's more likely that you'd want a newline there, e.g. some_configuration_directive { ... } -- Jamie Webb
http://lua-users.org/lists/lua-l/2004-08/msg00010.html
crawl-001
refinedweb
109
71.85
Random image rotators everywhere After I came across this I decided that I should write something about the same thing but done in Nevow.After I came across this I decided that I should write something about the same thing but done in Nevow. First of all the task is to write a random image rotation implementation for jpegs, gifs and pngs. This is easily accomplished by doing the following 3 things: 1. Add this to the root Page of your web site. 'random/images/directory' is a directory in your HDD containing lots of images and other random data. child_random_images = static.File('random/images/directory') 2. Add this to each of your Page objects that use the random image (or use a common base class to have this behaviour everywhere for free): def render_random_image(self, ctx, data): files = [f for f in os.listdir('random/images/directory') if os.path.splitext(f)[1] in ['.jpg', '.gif', '.png']] return ctx.tag(src='/random_images/'+random.choice(files)) 3. Use the following tag wherever you want to have a randomly rotated image in your web app: <img nevow: Now you have a wonderfully randomly rotated image in your web browser and with 2 lines less than the Ruby On Rails counterpart without sacrifying readability too much. 2 Comments: Primo! :-) Have you seen this women directory? Links to this post: Create a Link
http://vvolonghi.blogspot.com/2005/12/random-image-rotators-everywhere.html
CC-MAIN-2016-22
refinedweb
230
55.24
Usually, but first we’ll cover the basic principles. Recall from Chapter 3 that a view function is simply a Python function that takes a Web request and returns a Web response. This response can be the HTML contents of a Web page, or a redirect, or a 404 error, or an XML document, or an image...or anything, really. More formally, a Django view function must The key to returning non-HTML content from a view lies in the HttpResponse class, specifically the mimetype-like object” 2006,134 2007,147 Note The preceding listing contains real numbers! They come from the U.S. Federal Aviation Administration. Though CSV looks simple, its formatting details haven’t been universally agreed upon.: The response is given the text/csv MIME type (instead of the default text/html). This tells browsers that the document is a CSV file. The response gets an additional Content-Disposition header, which contains the name of the CSV file. This header (well, the “attachment” part) will instruct the browser to prompt for a location to save the file instead of just displaying it. This file name is arbitrary; call it whatever you want. It will be used by browsers in the “Save As” dialog. To assign a header on an HttpResponse, just treat the HttpResponse as a dictionary and set a key/value. information to writerow(), and it will do the right thing. often used in distributing documents for the purpose of printing them. You can easily generate PDFs with Python and Django thanks to the excellent open source ReportLab library (). The advantage of generating PDF files dynamically is that you can create customized PDFs for different purposes – say, for different users or different pieces of content. For example, your humble authors used Django and ReportLab at KUSports.com to generate customized, printer-ready NCAA tournament brackets. Before you do any PDF generation, however, you’ll need to install ReportLab. It’s usually simple: just download and install the library from. Note If you’re using a modern Linux distribution, you might want to check your package management utility before installing ReportLab. Most package repositories have added ReportLab. For example, if you’re using Ubuntu, a simple apt-get install python-reportlab will do the trick nicely. The user guide (naturally available only as a PDF file) at has additional installation instructions. Test your installation by importing it in the Python interactive interpreter: >>> import reportlab If that command doesn’t raise any errors, the installation worked. Like CSV, generating PDFs dynamically with Django is easy because the ReportLab API acts on file-like: In general, any Python library capable of writing to a file can be hooked into Django. The possibilities are immense. Now that we’ve looked at the basics of generating non-HTML content, let’s step up a level of abstraction. Django ships with some pretty nifty built-in tools for generating some common types of non-HTML content. A sitemap is an XML file on your Web site that tells search engine indexers how frequently your pages change and how “important” certain pages are in relation to other pages on your site. This information helps search engines index your site. For example, here’s a piece of the sitemap for Django’s Web site (): <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns=""> <url> <loc></loc> <changefreq>weekly</changefreq> <priority>0.5</priority> </url> <url> <loc></loc> <changefreq>never</changefreq> <priority>0.1</priority> </url> ... </urlset> For more on sitemaps, see. The Django sitemap framework automates the creation of this XML file by letting you express this information in Python code. To create a sitemap, you just need to write a Sitemap class and point to it in your URLconf. To install the sitemap application, follow these steps: Note The sitemap application doesn’t install any database tables. The only reason it needs to go into INSTALLED_APPS is so the load_template_source template loader can find the default templates. To activate sitemap generation on your Django site, add this line to your URLconf: (r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}) This line tells Django to build a sitemap when a client accesses /sitemap.xml. Note that the dot character in sitemap.xml is escaped with a backslash, because dots have a special meaning in regular expressions. (as described shortly). Sitemap classes must subclass django.contrib.sitemaps.Sitemap. They can live anywhere in your code tree. For example, mysite.blog.models import Entry class BlogSitemap(Sitemap): changefreq = "never" priority = 0.5 def items(self): return Entry.objects.filter(is_draft=False) def lastmod(self, obj): return obj.pub_date Declaring a Sitemap should look very similar to declaring a Feed. That’s by design. Like Feed classes, Sitemap members can be either methods or attributes. See the steps in the earlier “A Complex Example” section for more about how this works. A Sitemap class can define the following methods/attributes: items (required): Provides list of objects. The framework doesn’t care what type of objects they are; all that matters is that these objects get passed to the location(), lastmod(), changefreq(), and priority() methods. location (optional): Gives the absolute URL for a given object. Here, “absolute URL” means a URL that doesn’t include the protocol or domain. Here are some examples: If location isn’t provided, the framework will call the get_absolute_url() method on each object as returned by items(). lastmod (optional): The object’s “last modification” date, as a Python datetime object. changefreq (optional): How often the object changes. Possible values (as given by the Sitemaps specification) are as follows: priority (optional): A suggested indexing priority between 0.0 and 1.0. The default priority of a page is 0.5; see the documentation for more about how priority works. The sitemap framework provides a couple convenience classes for common cases. These are described in the sections that follow. The django.contrib.sitemaps.FlatPageSitemap class looks at all flat pages defined for the current site and creates an entry in the sitemap. These entries include only the location attribute – not lastmod, changefreq, or priority. See Chapter 16 for more about flat pages. The GenericSitemap class works with any generic views (see Chapter 11). Here’s an example of a URLconf using both FlatPageSitemap and GenericSiteMap (with the hypothetical Entry object from earlier): from django.conf.urls.defaults import * from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap from mysite}) ) The sitemap framework also has the ability to create a sitemap index that references individual sitemap files, one per each section defined in your sitemaps dictionary. The only differences in usage are as follows: Here is what the relevant URLconf lines would look like for the previous example: dictionary don’t change at all. lookup, *args, **kwargs): super(Entry, self).save(*args, **kwargs)(). Finally, if 'django.contrib.sitemaps' is in your INSTALLED_APPS, then your manage.py will include a new command, ping_google. This is useful for command-line access to pinging. For example: python manage.py ping_google /sitemap.xml Next, we’ll continue to dig deeper into the built-in tools Django gives you. Chapter 14 looks at all the tools you need to provide user-customized sites: sessions, users, and authentication.
http://www.djangobook.com/en/2.0/chapter13.html
CC-MAIN-2016-26
refinedweb
1,206
58.58
context-free-art: Generate art from context-free grammars [ bsd3, graphics, library, program ] [ Propose Tags ] Create art via context free grammar production rules..Probabilistic import Data.List.NonEmpty -- let's define a Production rule a = Circle 1 -- this will produce an IO (Maybe Svg) from the blaze-svg package -- to turn it into a string we can use one of the `blaze-svg` renderers graphic1 = render $ Circle 1 -- let's create a non-terminal, 'a', which renders a terminal, 'Circle 1' -- and has an 85% chance of rendering itself, placed to its right a = NonTerminal $ (100, Circle 1) :| [(85, b)] b = Mod [Move (2, 0)] a import Art.ContextFree.Definite import Data.List.NonEmpty move = Mod [Move (0, -1.8), Scale 0.8] armN :: Int -> Symbol armN 0 = move $ Circle 1 armN n = move $ NonTerminal $ Circle 1 :| [Mod [Rotate 10] $ armN (n - 1)] arm :: Symbol arm = armN 20 spiral = NonTerminal $ Circle 1 :| [arm, Mod [Rotate 120] arm, Mod [Rotate 240] arm] The latter produces this graphic: Modules [Index] [Quick Jump] - Art Downloads - context-free-art-0.3.0.0.tar.gz [browse] (Cabal source package) - Package description (as included in the package)
https://hackage.haskell.org/package/context-free-art-0.3.0.0
CC-MAIN-2021-31
refinedweb
192
58.72
CryptExportKey (Windows CE 5.0) This function exports cryptographic keys from of a cryptographic service provider (CSP) in a secure manner. The caller passes to the CryptImportKey function a handle to the key to be exported and gets a key binary large object (BLOB). This key BLOB can be sent over a nonsecure transport or stored in a nonsecure storage location. The key BLOB is useless until the intended recipient uses the CryptImportKey function, which imports the key into the recipient's CSP. Parameters - hKey - [in] HCRYPTKEY handle to the key to be exported. - hExpKey - [in] Handle to a cryptographic key belonging to the destination user. This key encrypts the key data within the key BLOB. This ensures that only the destination user will be able to use of the key BLOB. Most often, this will be the key exchange public key of the destination user. However, certain protocols in some CSPs require that a session key belonging to the destination user be used for this purpose. Neither the Microsoft Base Cryptographic Provider nor the Microsoft Enhanced Cryptographic Provider currently support this. If the key BLOB type specified by dwBlobType is PUBLICKEYBLOB, then this parameter is unused and must be set to zero. If the key BLOB type specifies PRIVATEKEYBLOB in dwBlobType, this is typically a handle to a session key that is used to encrypt the key BLOB. Some CSPs allow this parameter to be zero, in which case the application should encrypt the private key BLOB manually to protect it. To determine how Microsoft cryptographic service providers use to this parameter, see the programmer's guide topics under Cryptography. - dwBlobType - [in] Specifies the type of key BLOB to be exported. The following table shows the possible values for this parameter. For more information about exchanging cryptographic keys, see the programmer's guide topics under Cryptography. - dwFlags - [in] Bitmask of flags. - pbData - [out] Pointer to a buffer that receives the key BLOB. This parameter can be NULL when used to acquire the size of the buffer for memory allocation purposes. - pdwbDataLen - [in, out] On input, pointer to a DWORD value that specifies the size, in bytes, of the buffer pointed to by the pbData parameter. On output, the DWORD value contains the number of bytes stored in the buffer. When processing the data returned in the buffer, applications must use the actual size of the data returned. The actual size may be slightly smaller than the size of the buffer specified on input. On input, buffer sizes are usually specified large enough to ensure that the largest possible output data will fit in the buffer. On output, the variable pointed to by this parameter is updated to reflect the actual size of the data copied to the buffer. Return Values. Example Code #include <wincrypt.h> HCRYPTPROV hProv; // Handle to CSP HCRYPTKEY hKey; // Handle to session key HCRYPTKEY hXchgKey; // Handle to receiver's exchange public key BYTE *pbKeyBlob = NULL; DWORD dwBlobLen; ... // Determine the size of the key BLOB and allocate memory. if(!CryptExportKey(hKey, hXchgKey, SIMPLEBLOB, 0, NULL, &dwBlobLen)) { printf("Error %x computing BLOB length!\n", GetLastError()); ... } if((pbKeyBlob = malloc(dwBlobLen)) == NULL) { printf("Out of memory!\n"); ... } // Export the key into a simple key BLOB. if(!CryptExportKey(hKey, hXchgKey, SIMPLEBLOB, 0, pbKeyBlob, &dwBlobLen)) { printf("Error %x during CryptExportKey!\n", GetLastError()); ... } Requirements OS Versions: Windows CE 2.10 and later. Header: Wincrypt.h. Link Library: Coredll.lib. See Also Send Feedback on this topic to the authors
https://msdn.microsoft.com/en-us/library/ms938025.aspx
CC-MAIN-2015-32
refinedweb
576
57.06
Chatlog 2010-03-04 From RDFa Working Group Wiki See CommonScribe Control Panel, original RRSAgent log and preview nicely formatted version. 14:26:34 <RRSAgent> RRSAgent has joined #rdfa 14:26:34 <RRSAgent> logging to 14:26:36 <trackbot> RRSAgent, make logs world 14:26:36 <Zakim> Zakim has joined #rdfa 14:26:38 <trackbot> Zakim, this will be 7332 14:26:38 <Zakim> ok, trackbot; I see SW_RDFa()10:00AM scheduled to start in 34 minutes 14:26:39 <trackbot> Meeting: RDFa Working Group Teleconference 14:26:39 <trackbot> Date: 04 March 2010 14:26:47 <ivan> Chair: manu 14:28:06 <ivan> ivan has changed the topic to: RDFa WG Telco, agenda: 14:40:53 <Benjamin> Benjamin has joined #rdfa 14:41:41 <ShaneM> ShaneM has joined #rdfa 14:43:51 <manu-work> manu-work has joined #rdfa 14:55:39 <Knud> Knud has joined #rdfa 14:57:05 <Zakim> SW_RDFa()10:00AM has now started 14:57:12 <Zakim> +Knud 14:58:49 <Zakim> + +0785583aaaa 14:59:03 <tinkster> zakim, aaaa is me# 14:59:03 <Zakim> +me#; got it 14:59:13 <tinkster> zakim, aaaa is me 14:59:13 <Zakim> sorry, tinkster, I do not recognize a party named 'aaaa' 14:59:24 <tinkster> zakim, i am aaaa 14:59:24 <Zakim> sorry, tinkster, I do not see a party named 'aaaa' 14:59:35 <mgylling> mgylling has joined #rdfa 14:59:46 <Zakim> +RobW 14:59:50 <manu> zakim, ?aaaa is tinkster 14:59:50 <Zakim> sorry, manu, I do not recognize a party named '?aaaa' 14:59:50 <RobW> RobW has joined #rdfa 14:59:51 <ivan> zakim, dial ivan-voip 14:59:51 <Zakim> ok, ivan; the call is being made 14:59:51 <Zakim> +Ivan 15:00:06 <Zakim> +Benjamin 15:00:21 <Zakim> +[IPcaller] 15:00:41 <ivan> zakim, who is here? 15:00:41 <Zakim> On the phone I see Knud, RobW, Ivan, Benjamin, [IPcaller] 15:00:42 <Zakim> On IRC I see RobW, mgylling, Knud, manu, ShaneM, Benjamin, Zakim, RRSAgent, Steven, ivan, tinkster, trackbot 15:00:50 <Zakim> +me# 15:01:11 <tinkster> zakim, i am +me# 15:01:12 <Zakim> sorry, tinkster, I do not see a party named '+me#' 15:01:23 <Zakim> +mgylling 15:01:23 <ivan> zakim, me# is tinkster 15:01:25 <Zakim> +tinkster; got it 15:01:32 <tinkster> zakim, zakim, mute me 15:01:32 <Zakim> I don't understand 'zakim, mute me', tinkster 15:01:35 <manu> zakim, who is on the call? 15:01:35 <Zakim> On the phone I see Knud, RobW, Ivan, Benjamin, [IPcaller], tinkster, mgylling 15:01:47 <manu> zakim, I am [IP 15:01:47 <Zakim> ok, manu, I now associate you with [IPcaller] 15:01:52 <tinkster> zakim, mute me 15:01:52 <Zakim> tinkster should now be muted 15:01:59 <tinkster> zakim, unmute me 15:01:59 <Zakim> tinkster should no longer be muted 15:02:28 <manu> zakim, who is making noise? 15:02:38 <Zakim> manu, listening for 10 seconds I heard sound from the following: Knud (56%), tinkster (10%), [IPcaller] (14%) 15:02:41 <Zakim> +ShaneM 15:02:43 <tinkster> zakim, mute me 15:02:43 <Zakim> tinkster should now be muted 15:02:45 <Knud> zakim, mute me 15:02:45 <Zakim> Knud should now be muted 15:02:57 <manu> zakim, mute ShaneM 15:02:57 <Zakim> ShaneM should now be muted 15:03:01 <Zakim> -ShaneM 15:03:24 <Steven> zakim, dial steven-617 15:03:24 <Zakim> ok, Steven; the call is being made 15:03:25 <Zakim> +Steven 15:03:27 <Zakim> +ShaneM 15:03:34 <Steven> zakim, mute me 15:03:34 <Zakim> Steven should now be muted 15:04:12 <ShaneM> Scribe: ShaneM 15:04:21 <manu> Agenda for today: 15:04:25 <ShaneM> TOPIC: Action Items 15:04:39 <manu> trackbot, Action-3? 15:04:39 <trackbot> Sorry, manu, I don't understand 'trackbot, Action-3?'. Please refer to for help 15:04:44 <manu> trackbot, ACTION-3? 15:04:44 <trackbot> Sorry, manu, I don't understand 'trackbot, ACTION-3?'. Please refer to for help 15:04:49 <manu> ACTION-3? 15:04:49 <trackbot> ACTION-3 -- Manu Sporny to get in touch with LibXML developers about TC 142 -- due 2010-03-11 -- OPEN 15:04:49 <trackbot> 15:05:04 <manu> ACTION-10? 15:05:04 <trackbot> ACTION-10 -- Manu Sporny to get Toby to fill out Invited Expert form. -- due 2010-03-04 -- OPEN 15:05:04 <trackbot> 15:05:12 <manu> trackbot, close ACTION-10 15:05:13 <trackbot> ACTION-10 Get Toby to fill out Invited Expert form. closed 15:05:28 <tinkster> thanks 15:05:28 <manu> trackbot, comment ACTION-10 Toby is now an Invited Expert to RDFa WG 15:05:28 <trackbot> ACTION-10 Get Toby to fill out Invited Expert form. notes added 15:05:44 <manu> ACTION-11? 15:05:44 <trackbot> ACTION-11 -- Shane McCarron to suggest short names for each working group deliverable -- due 2010-03-01 -- OPEN 15:05:44 <trackbot> 15:06:19 <tinkster> 15:06:32 <manu> 15:07:00 <tinkster> W3C list emails contain an "Archived-At" header in the message headers. 15:07:26 <ShaneM> ivan: agrees with the suggested shortnames. some issue with how data should be organized. 15:07:27 <manu> trackbot, close ACTION-11 15:07:27 <trackbot> ACTION-11 Suggest short names for each working group deliverable closed 15:08:25 <ShaneM> TOPIC: ISSUE-4: Referenced version of XML Namespaces Document 15:08:27 <manu> 15:08:58 <manu> scribenick: manu 15:09:30 <manu> ShaneM: The XHTML+RDFa family spec has settled on XML1.0 4th edition, which is not the current publication 15:09:39 <manu> ShaneM: 5th edition is the latest version. 15:09:41 <tinkster> What about other current/potential host languages (e.g. SVG)? 15:09:50 <Steven> nmchar 15:10:06 <manu> ShaneM: This is already fixed, it was a typo in the spec, it's addressed in the errata and is fixed in the draft. 15:10:56 <RobW> RobW has joined #rdfa 15:11:31 <manu> trackbot, close ISSUE-4 15:11:31 <trackbot> ISSUE-4 Determine the proper XML namespaces document to refer to in the RDFa specification closed 15:12:00 <tinkster> SVG 1.2 Tiny uses XML 1.0 4th Ed; Namespaces 1.1 2nd Ed. 15:13:27 <manu> Topic: ISSUE-1: RDFa Vocabularies 15:15:17 <ShaneM> scribenick: ShaneM 15:13:07 <tinkster> I have a third proposal - similar to Manu's 15:13:32 <manu> 15:13:57 <manu> 15:14:24 <tinkster> q+ 15:14:31 <tinkster> zakim, unmute me 15:14:31 <Zakim> tinkster should no longer be muted 15:14:35 <manu> ack tinkster 15:14:38 <trackbot> Sorry, Steven, I don't understand 'trackbot, comment issue-4 The references section in the XHTML+RDFa errata and the RDFa Core 1.1 document have been updated'. Please refer to for help 15:14:51 <tinkster> 15:15:17 <ShaneM> tinkster: similar, but generates fallback triples if the vocabulary document can't be dereferenced 15:15:31 <ShaneM> manu: are you asking that we consider this proposal as well? 15:16:10 <ShaneM> tinkster: It is really just refinements to Manu's proposal - it would be transparent to end users. It allows the definition of a default prefix in a document. 15:16:36 <ivan> q+ 15:16:46 <tinkster> zakim, mute me 15:16:46 <Zakim> tinkster should now be muted 15:16:47 <manu> ack ivan 15:17:41 <ShaneM> ivan: tinkster's proposal is really incremental to EITHER of the basic proposals. 15:19:04 <manu> q+ to review the high-level differences between both proposals. 15:19:19 <manu> zakim, I am [IP 15:19:19 <Zakim> ok, manu, I now associate you with [IPcaller] 15:19:47 <ShaneM> ivan: describing the two basic proposals. mark's proposal has multiple formats. Not a fan of the implementation burden of supporting JSON and RDFa as basic formats. 15:19:51 <manu> ack manu 15:20:32 <ShaneM> manu: prefers aspects of Mark's proposal. 15:22:58 <ShaneM> Essential differences are that Mark's proposal permits declaration of prefixes and keywords. 15:24:10 <ShaneM> ... concept that there is a default vocabulary is a new concept, but one that lots of people seem to like. 15:25:07 <ShaneM> ... profiles proposal allows for recursive inclusion. Vocabulary proposal does not. 15:25:35 <ShaneM> ... vocab proposal defines a new attribute @vocab. profile proposal relies up @profile being in host languages 15:26:33 <ShaneM> ... @profile is not currently a part of HTML5. If HTML5 adopts @profile everywhere, then we could rely upon that. If it does not, we would need to use a different name. 15:28:38 <ShaneM> ... Other items that should be in: Default RDFa Vocabulary / Profile. Mark has indicate that the default should ONLY be used if a page does not specify a profile. If there is a profile specification, then it should be used instead of any default profile. 15:28:38 <ivan> q+ 15:28:48 <manu> ack ivan 15:28:54 <manu> ack [IP 15:28:54 <Zakim> [IPcaller], you wanted to review the high-level differences between both proposals. 15:30:01 <ShaneM> ivan: Would prefer to postpone the discussion of the default profile. If we have a mechanism for specifying a vocabulary, then we can think about how to deal with default profile. 15:30:41 <ShaneM> ... it would be trivial to add the definition of 'prefixes' to the vocab proposal. 15:31:24 <ShaneM> ... it is much more interesting for me to have a default definition for 'foaf:' is more important than defining the individual keywords that make up FOAF. 15:33:28 <ShaneM> manu: yes, it is possible to extend the vocabulary proposal to support prefix declarations. 15:34:18 <ivan> q+ 15:34:33 <ivan> q- 15:34:35 <ShaneM> ... has reservations about using xmlns: to declare prefix mappings. 15:35:23 <manu> ack ivan 15:35:25 <Steven> I disagree with that interpretation 15:35:28 <ShaneM> manu: We should stop overloading xmlns: - declaring tokens with it is an abuse of xmlns. 15:36:03 <Steven> that bit I agree with 15:36:04 <ShaneM> ivan: agree that this is a hack. Also, xmlns defines prefixes for the file that is being processed. Having those declarations leak into another document is inconsistent. 15:36:55 <ShaneM> ... if I have a vocabulary document and I want to document the document itself, then I might want to use RDFa to do that documentation and bring in other vocabularies. Those vocabularies should not leak into the document that is USING the vocabulary. 15:37:05 <Steven> ack me 15:37:09 <ShaneM> q+ to talk about how xmlns is used 15:37:57 <ShaneM> Steven: disagrees that an xmlns declaration introduces a namespace. All xmlns does is declare a prefix mapping and then to scope elements and attributes later. 15:38:10 <manu> Here's what I have reservations about doing: xmlns:Person="" 15:38:24 <tinkster> It's a neat hack, but it's still a hack. 15:38:25 <manu> I don't agree with doing that. 15:39:01 <ShaneM> Steven: Whatever we do needs to be easy for authors. They shouldn't be required to understand mystical aspects of namespaces. 15:39:14 <ShaneM> No one seems to support overloading xmlns in this way. 15:39:37 <manu> ack ShaneM 15:39:37 <Zakim> ShaneM, you wanted to talk about how xmlns is used 15:40:17 <tinkster> +1 15:41:25 <ShaneM> manu: Just to clarify: we don't want to overload xmlns to declare tokens and prefixes in vocabulary documents. Additionally, we WANT to use RDFa to declare terms and prefix mappings in the vocabulary documents. 15:41:39 <ShaneM> ivan: Well, isn't that the next topic? We were going to discuss JSON 15:41:55 <ShaneM> q+ to address the JSON issue 15:42:21 <manu> ack ShaneM 15:42:21 <Zakim> ShaneM, you wanted to address the JSON issue 15:42:22 <ivan> q+ 15:42:23 <ShaneM> manu: the one really positive thing that JSON does is it COULD allow us to not rely upon CORS support in browsers in order to make it work. 15:42:29 <tinkster> no json does not allow workaround for cors - jsonp does. 15:42:41 <manu> Toby is right. 15:43:24 <tinkster> jsonp is a dialect of javascript so theoretically introduces security issues 15:43:55 <ivan> q? 15:44:09 <manu> ack ivan 15:44:33 <ShaneM> ShaneM: no reason to preclude having a JSON version of the vocab come out via content negotiation. Basic format should be RDFa. 15:44:46 <ShaneM> manu: There is a possibility of fragmentation then. And that's bad. 15:44:55 <ShaneM> ShaneM: I know... And I don't really care. 15:45:47 <manu> zakim, unmute toby 15:45:47 <Zakim> sorry, manu, I do not know which phone connection belongs to toby 15:45:47 <ShaneM> ivan: my concern is implementations. there is a cost associated with supporting multiple formats. Also, what is the security concern? 15:45:50 <tinkster> sorry can't speak right now 15:46:15 <tinkster> can post to list later. 15:46:39 <manu> ok, thanks Toby. 15:47:48 <manu> q+ to discuss CORS. 15:47:53 <Benjamin> 15:48:00 <manu> ack [IPCa 15:48:00 <Zakim> [IPcaller], you wanted to discuss CORS. 15:48:24 <ShaneM> ShaneM: The issue is that if you are bringing in a javascript resource from OVER THERE and OVER THERE gets compromised, then badness could ensue 15:48:55 <tinkster> Got to go, but please give me an action to post a writeup of JS/JSON/JSONP/CORS to list. 15:48:58 <ivan> q+ 15:49:07 <Zakim> -tinkster 15:49:22 <ShaneM> manu: There is also the cost of maintaining the JSONp file and keeping it in sync. The alternative is that you enable CORS support. Supporting CORS is potentially easier than maintaining multiple documents. 15:49:27 <manu> ack ivan 15:49:36 <Steven> trackbot, status 15:50:25 <ShaneM> ivan: My understanding is that the implementor can choose which format to provide. 15:50:29 <manu> q+ to discuss RDFa /OR/ JSON 15:51:04 <manu> ack [IPc 15:51:04 <Zakim> [IPcaller], you wanted to discuss RDFa /OR/ JSON 15:51:05 <Steven> Action: Toby to post a writeup of JS/JSON/JSONP/CORS to list 15:51:05 <trackbot> Created ACTION-14 - Post a writeup of JS/JSON/JSONP/CORS to list [on Toby Inkster - due 2010-03-11]. 15:51:33 <ShaneM> ... I was opposed to that because it means an RDFa parser needs to understand multiple formats. But if it enables the javascript implementation, then it might be okay to support JSON. 15:51:53 <ivan> q+ 15:52:43 <ShaneM> manu: Feels that the server MUST support vocabularies in both formats. If what we are trying to do is make it easy for implementors, then we want to have an RDFa mechanism all the way through. The only reason is to have the JSON support is to help javascript implementations. However, that problem can also be solved via CORS. But CORS is not widely distributed yet. 15:52:58 <manu> ack ivan 15:54:36 <manu> q+ to discuss RDFa API 15:55:00 <ShaneM> ivan: Need to make things easy for authors. Implementors can work a little. 15:55:01 <Steven> zakim, who is here? 15:55:01 <Zakim> On the phone I see Knud (muted), RobW, Ivan, Benjamin, [IPcaller], mgylling, ShaneM, Steven 15:55:04 <Zakim> On IRC I see RobW, mgylling, Knud, manu, ShaneM, Benjamin, Zakim, RRSAgent, Steven, ivan, tinkster, trackbot 15:55:15 <Steven> zakim, [IP is manu 15:55:15 <Zakim> +manu; got it 15:55:59 <ShaneM> manu: If RDFa API works out or CORS takes off, then we don't need to worry about marking things up in JSONp 15:56:30 <ivan> q+ 15:56:43 <Steven> ack [IP 15:56:43 <Zakim> [IPcaller], you wanted to discuss RDFa API 15:56:51 <manu> ack ivan 15:57:02 <ShaneM> manu: we need to get general agreement from Mark and Ben about what we discussed today. 15:57:20 <ShaneM> ivan: Is it okay if we extend the vocab proposal so it includes prefix declarations too. 15:57:23 <ShaneM> manu: sure 15:57:33 <ShaneM> ivan: okay - will do that tomorrow and will put it in W3C space 15:57:56 <ivan> zakim, drop me 15:57:56 <Zakim> Ivan is being disconnected 15:57:57 <Zakim> -Ivan 15:57:58 <Zakim> -mgylling 15:58:04 <Zakim> -Steven 15:58:08 <Zakim> -RobW 15:58:10 <Zakim> -ShaneM 15:58:20 <Zakim> -manu 15:58:22 <Zakim> -Knud 15:58:24 <Zakim> -Benjamin 15:58:28 <Zakim> SW_RDFa()10:00AM has ended 15:58:30 <Zakim> Attendees were Knud, +0785583aaaa, RobW, Ivan, Benjamin, [IPcaller], mgylling, tinkster, ShaneM, Steven, manu 16:00:25 <manu> trackbot, help 16:00:25 <trackbot> See for help 16:00:41 <ivan> rrsagent, draft minutes 16:00:41 <RRSAgent> I have made the request to generate ivan # SPECIAL MARKER FOR CHATSYNC. DO NOT EDIT THIS LINE OR BELOW. SRCLINESUSED=00000260
http://www.w3.org/2010/02/rdfa/wiki/Chatlog_2010-03-04
CC-MAIN-2014-10
refinedweb
2,930
66.78
Technical Support On-Line Manuals RL-ARM User's Guide (MDK v4) #include <net_config.h> U8 *http_get_content_type (void); The http_get_content_type function returns a pointer to the Content-Type html header, which was received in the xml or any other type post. You can use this function to check for the content type, which was submitted by the Silverlight web service application. The http_get_content_type function is a system function that is in the RL-TCPnet library. The prototype is defined in net_config.h. note The http_get_content_type function returns a pointer to the content type header, which is a null-terminated string. cgi_process_data, cgx_content_type void cgi_process_data (U8 code, U8 *dat, U16 len) { U8 *pType; switch (code) { case 4: /* Other content type data, last packet. */ pType = http_get_content_type (); if (strcmp (pType,"text/xml; charset=utf-8") == 0) { /* XML encoded, 'utf-8' character set */ .. } return; case 5: /* Other content type data, more to follow. */ return; default: /* Ignore all other codes. */.
http://www.keil.com/support/man/docs/rlarm/rlarm_http_get_content_type.htm
CC-MAIN-2019-30
refinedweb
155
57.06
Getting What Key is Pressed on Keyboard Hey guys I have a simple question. I saw a post on the forum here that was related to this but unfortunately, the only answer on that post did not clarify enough for me. So what I need to ask is this: Say I ask for a user’s input in a text field, how do I make it so that instead of having to press a button in order for the user’s input to be processed, the user can simply hit “return” on the keyboard. For TextField, which contains a single line, pressing Enter automatically calls the actionmethod, so the following also works def a(sender): #called when done entering text print(sender.text ') t=ui.TextField(a) t.action=a t.present('popover') For TextView, you would instead use one of the delegate methods textview_did_change, or textview_should_change. @procryon , if you look at one of my code examples in this thread you see the delegate being used as @JonB pointed out. You can see the TextFields Delegate Documentation here
https://forum.omz-software.com/topic/4483/getting-what-key-is-pressed-on-keyboard
CC-MAIN-2018-13
refinedweb
178
64.34
Richard Branson Announces Virgin Oceanic Submarine samzenpus posted more than 3 years ago | from the 6-miles-down dept. It's the tripnaut! writes "Richard Branson has just revealed that he intends to build a vessel capable of exploring some of the deepest parts of the oceans around the world. The article further states: 'The sub, which was designed by Graham Hawkes, weighs 8,000 lbs and is made of carbon fiber and titanium. It has an operating depth of 37,000 ft and can operate for 24 hours unaided.'" Oh, Sir. Branson (2) yeshuawatso (1774190) | more than 3 years ago | (#35741430) Sir. Branson, is there anything in science fiction you won't waste your billions trying to make into a commercial reality? Re:Oh, Sir. Branson (2) inKubus (199753) | more than 3 years ago | (#35741456) Sir Branson: *waving excitedly* "Next stop, the CENTER of the EARTH!" Re:Oh, Sir. Branson (1) Jeremiah Cornelius (137) | more than 3 years ago | (#35741884) Millionaire killing devices from the mind of Branson. Re:Oh, Sir. Branson (1) countertrolling (1585477) | more than 3 years ago | (#35743362) I was hoping this was some kind of new luxury underwater trans Atlantic service Re:Oh, Sir. Branson (1) CProgrammer98 (240351) | more than 3 years ago | (#35744512) ditto. I was going to ask if it was Yellow... Re:Oh, Sir. Branson (1) sleigher (961421) | more than 3 years ago | (#35744920) Re:Oh, Sir. Branson (1) SteveFoerster (136027) | more than 3 years ago | (#35746074) Yes, and faster, through supercavitation [wikipedia.org] . Re:Oh, Sir. Branson (5, Insightful) Rosco P. Coltrane (209368) | more than 3 years ago | (#35741470) Quite frankly, you may think what you want of Branson's endeavours, but at least he's trying to achieve new and exciting things. He'd make more money setting up a law firm, a hedge fund, or selling razors with 6 blades, but he pegs himself as a visionary and that's what visionaries do. I say the world is better off with a Branson that Yet Another Businessperson [TM]... Re:Oh, Sir. Branson (4, Insightful) Z00L00K (682162) | more than 3 years ago | (#35741536) I agree, what he does is to keep a high profile with stunts like these, but it really improves the brand when he is involved in things that is more than just the usual TV commercial. Anyone can do a CGI with a fantasy these days using a pile of money, but putting that money into an event where you are actually achieving something real - or make a difference - then you do both your brand and the others involved a favor. The submarine will hopefully provide additional knowledge. "There are no failures, just more data". Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35741582) I say the world is better off with a Branson than Yet Another Businessperson [TM]... Hear, Hear! Fixed it for you, but only because I'm nodding in agreement Re:Oh, Sir. Branson (1) buchner.johannes (1139593) | more than 3 years ago | (#35741652) There are a couple of good talks about ocean exploration on TED, for instance [ted.com] Re:Oh, Sir. Branson (5, Insightful) Kozz (7764) | more than 3 years ago | (#35743358) What the FUCK have you done to the layout, styles and scripting on this god-forsaken site? I've tried both FF4 and IE8, but have the same problems: To be honest, I'm not one of those who has been carping about the new layout and design of Slashdot. I'm actually fine with that. But it's got to fucking work. Otherwise I'm ... oh fuck it. I'll probably come back anyhow. But you should know what a shitty job you've done of QA. Moderators: us low-UID folks get a pass to rant once a year or so, don't we? Yeah, it's a bit vitriolic, but it's all truth. Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35743558) Invisible +1 to your comment Re:Oh, Sir. Branson (2) Apocros (6119) | more than 3 years ago | (#35743574) Re:Oh, Sir. Branson (1) linuxwolf69 (1996104) | more than 3 years ago | (#35744184) Re:Oh, Sir. Branson (1) slackbheep (1420367) | more than 3 years ago | (#35743670) Re:Oh, Sir. Branson (1) tom17 (659054) | more than 3 years ago | (#35744328) "* The right-click context menu doesn't come up in FF4 unless I DOUBLE-RIGHTCLICK. " This one annoys the HELL out of me. Took ages to discover it and, after many restarts, realise it's not my OS/Browser. Grrr Re:Oh, Sir. Branson (1) strength_of_10_men (967050) | more than 3 years ago | (#35744516) To add to this, list: * I'm not sure if this is an existing bug but there's an inconsistency between the show/hide comment slider and the actual posts shown. I have the sliders set to -1 and it clearly says that ALL comments "FULL". However, I often find that I have to scroll to the bottom of the page and click "Get $X more comments" to actually show all the comments. Annoying. * for some reason, I can't click the "Post Anonymously" button anymore. I just found this when I modded your comment up and wanted to add to the list. * when I go to my account page, some of the menus are overlaying each other. It's just a mess. I'm fine with the redesigned layout but for god's sake, I would expect this of amateurs. I wish the code could be edited wiki-style so that I could just go in and fix it instead of complaining. Re:Oh, Sir. Branson (3, Informative) Hatta (162192) | more than 3 years ago | (#35744726) Mark Slashdot.org as "Untrusted" in NoScript. Set your discussion style to "classic" in your user preferences. That will fix everything but the bullet point issue. Re:Oh, Sir. Branson (1) Captain Hook (923766) | more than 3 years ago | (#35745140) Re:Oh, Sir. Branson (1) WindBourne (631190) | more than 3 years ago | (#35744850) Mod parent up! (1) Intrepid imaginaut (1970940) | more than 3 years ago | (#35745480) +5 please. Re:Oh, Sir. Branson (1) istartedi (132515) | more than 3 years ago | (#35746716) A better lament against the pile of poo that web design has become, I cannot find. Bravo, sir. Re:Oh, Sir. Branson (1) psyclone (187154) | more than 3 years ago | (#35747132) All of those items affect FF 3.6 as well, except regular right-click still works. Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35742256) Damn straight. He would have made a lot more money if he'd stuck to monetising the Virgin brand (rather than licensing it out), and stopped using his funds to prop up his aeroplane business. But that's not his style, and mad props go out to him to refusing to compromise his ideals for the sake of a few more billion that he doesn't need. Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35742474) He couldn't even make the toilets work properly when he was running a train service in the UK. Fortunately, he has been kicked off. Perhaps the problem arose because the people he associates with are so superior that they have no need for mere bodily functions. Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35742496) Yeah, he is Clive SInclair with more money and a niftier beard. Agreed (0) Anonymous Coward | more than 3 years ago | (#35743074) We need a Branson now especially in an age where scientific exploration (ie NASA) may be neutered due to budgetary constraints. I hope he succeeds. Re:Oh, Sir. Branson (1) hodet (620484) | more than 3 years ago | (#35747134) Re:Oh, Sir. Branson (1) kernelphr34k (1179539) | more than 3 years ago | (#35741486) Re:Oh, Sir. Branson (1) Rik Rohl (1399705) | more than 3 years ago | (#35741524) I hope not. Re:Oh, Sir. Branson (1) elfprince13 (1521333) | more than 3 years ago | (#35741944) Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35741986) I sure hope not! This guy reminds me of the (Sci-Fi) Tom Swift books I read as a kid. I'd love to be adopted by him. (and I'm almost 40) Great (1) WindBourne (631190) | more than 3 years ago | (#35744582) It is people like Branson, Elon Musk, and Paul Allen that are making REAL differences to the future. Musk gets credit for starting up CHEAP solar installation, Cheap spaceX, and of course, getting the electric car industry going. Allen gets the credit for getting cable industry into the net, and getting private space going by funding Scaled Composites X-Prize winner. Allen contrasts against Gates in that Gates pushed Boeing/L-Mart into building EELVs in expensive fashion promising them that he was going to use them for his satellites. Well, we all know the status of that. Re:Oh, Sir. Branson (0) Anonymous Coward | more than 3 years ago | (#35745620) Unlike his megalomaniacally-named Virgin "Galactic", there is actual real technology and precedent for diving to 37000 feet. It's been done in the 1960s. Just Wow! (1) kvvbassboy (2010962) | more than 3 years ago | (#35741468) Re:Just Wow! (1) subk (551165) | more than 3 years ago | (#35741548) If this becomes a relatively cheap reality in the next 30 years How rich are you? This sub weighs about 8,000lb, so it might just have room for -A- passenger. A reeaeeaaally rich passenger. Re:Just Wow! (1) Abstrackt (609015) | more than 3 years ago | (#35744132) If this becomes a relatively cheap reality in the next 30 years How rich are you? This sub weighs about 8,000lb, so it might just have room for -A- passenger. A reeaeeaaally rich passenger. That's the great thing about technology: prices go down. For all we know, this could be the next big thing in 30 years time. Re:Just Wow! (0) Anonymous Coward | more than 3 years ago | (#35741614) Burial at Sea should realise at least one of these, at a very reasonable cost. :-) Re:Just Wow! (1) JWSmythe (446288) | more than 3 years ago | (#35741630) Well, you can do it. Do you have the budget for it though? :) Fly a specially built aircraft up to 60,000 feet. Fire first stage rockets on straight and level heading to accelerate to Mach 3. Drop first stage rockets and switch to ramjet engines. Accelerate to Mach 5, and climb to 80,000 feet. Drop surplus fuel tanks. Engage rockets, and change your vector to "up". You want 0 ground speed, and max climb. If you do "up" right, you have a safe vector back down. To return, maintain an approx 10 degree nose down attitude, relative to ground, with 0 ground speed. As the air density increases, your descent will slow, and when you gain aerodynamic effect again, you can fly home. These are just "back of the napkin" numbers. Don't bother to work those specific numbers too much. Oh, and if you do just happen to build one yourself, even if it wouldn't really work, you'll probably have the attention of plenty of agencies you've never heard of who will either liberate you of your design specs and hardware, or liberate you of your freedom. Calling NASA and saying "Hey, I need a used but serviceable space suit. Because I built a spaceship, and am planning a launch for next Thursday." will either get you laughed at, or picked up faster, either by an agency, or the funny farm. :) Re:Just Wow! (0) Anonymous Coward | more than 3 years ago | (#35741900) I don't know, there's not one but two space suits sitting at the park (exhibition outside) for some months now, could just get these... :-) Re:Just Wow! (0) Anonymous Coward | more than 3 years ago | (#35742360) They didn't laugh, but ask for a delivery address and reminded me, to send in pictures. Re:Just Wow! (0) Anonymous Coward | more than 3 years ago | (#35741942) You have only two ambitions in life, and you don't even know enough about one of them to know what the challenger deep is? 37,000 feet deep? (1) JWSmythe (446288) | more than 3 years ago | (#35741484) Really? 37,000 feet deep? I did a quick look with an online calculator, and that would be 16,055 psi. According to This story [extremescience.com] , the deepest spot in the ocean is about 36,000 feet deep. But hey, if you're going to take a ride down to the bottom of the Marianas trench, I'd prefer to know that the sub is rated for more than it could possibly do. Maybe he's doing some advanced planning for global warming, so people can visit the ancient underwater city previously known as "New York". :) (ya, ya, I know, not enough water on the planet, ice or otherwise, blah, blah, blah.) I do wonder about decompression. 24 hours may seem like a long time, but ascending from that kind of depth is bound to cause some pretty serious problems. I'd bet 16k psi is bound to squish the hull at least a bit. Re:37,000 feet deep? (4, Informative) vivian (156520) | more than 3 years ago | (#35741530) Being a pressure hull, it will be at 1 atmosphere internally - there is no decompression for the occupants to worry about, which is the whole point of having a pressure hull. Last I checked, 37000 is > 35838 feet, which is the actual deepest point in the ocean, so the sub is already overrated for even the deepest depth - let alone the rest of the ocean which is much much shallower - with an average depth of about 13000 ft. The wreck of the titanic is at only 12600ft. I'd definitely pay a decent sum to go see that thing in a sub if the sub had a decent view-port you could look out of. Re:37,000 feet deep? (0) Anonymous Coward | more than 3 years ago | (#35741628) Being a former submariner I can tell you that the pressure does increase as you dive. I always knew when we were diving deep when I was sleeping because i would wake up with the need to piss Re:37,000 feet deep? (3, Funny) hat_eater (1376623) | more than 3 years ago | (#35742288) Re:37,000 feet deep? (0) Anonymous Coward | more than 3 years ago | (#35742728) Speaking of all this, wouldn't it probably be easier to make waterproof systems, then flood the whole insides of the vehicle with water? Obviously the people will be wearing suits. This way, pressure inside could be increased significantly without (much?) damage to the people inside. You could increase the water pressure to values that humans are known to be safe in. Food could be eaten through straw from packets that can be inserted in to a helmet. Essentially a space-suit designed for long-term expeditions. (which can be plugged in to sub if needed, for say, sleeping) Until we get breathable liquids like in that film with the aliens, it is the closest we'd get to it. Re:37,000 feet deep? (1) giorgist (1208992) | more than 3 years ago | (#35741566) Be cool to drive it and chase aroud whatever does live in those depths Re:37,000 feet deep? (2) FrankSchwab (675585) | more than 3 years ago | (#35741598) To add to that, the portholes would not be as intresting as they would have to be rediculously thick so you'd see most things through a video camera and a screen. Too bad then that it has such a large viewing dome: [virginoceanic.com] Re:37,000 feet deep? (0) Anonymous Coward | more than 3 years ago | (#35741690) It's highly likely that viewing dome ceases to maintain a 1ATM environment below a certain depth at which point the pilot moves to the titanium pressure sphere locking himself in to a hamster-ball with a conical quartz peephole. By keeping the Hamster-ball full of a liquid(?diesel?) when not occupied, and by making the viewing dome area's volume less than, or equal to the volume of the titanium hamster-ball, this ballast can be used to brace the viewing dome while the hamster-ball is occupied. This would only impact the trim(distribution of weight) without changing the total buoyancy. Lead acid battery racks on a sliding track could then be used as a counter balance to compensate. The carbon fiber is for no other reason than bling, ease of transportation, and perhaps fuel economy. Re:37,000 feet deep? (1) mosb1000 (710161) | more than 3 years ago | (#35741954) I think the idea is the dome will be made of quartz (their page implies as much) to withstand the pressure. It doesn't look to me like there's room for a "titanium pressure sphere" as you suggest. Re:37,000 feet deep? (1) timeOday (582209) | more than 3 years ago | (#35744428) Re:37,000 feet deep? (2) JWSmythe (446288) | more than 3 years ago | (#35741672) Even video cameras need to be protected from the water. :) That thick glass (or glass like substance) would be the same, regardless if it were for your eyeballs, or for a camera. At least with a video camera, it could be recorded. "I saw a giant squid monster" means nothing if you say it. If you provide authenticated video, then it's fact (although likely to be debunked by "experts" all over the Internet). I still have a thing against getting squished by thousands of pounds of pressure. I'd rather watch the screen from somewhere comfortable naturally around 1 atm. :) Re:37,000 feet deep? (1) delinear (991444) | more than 3 years ago | (#35743186) How this decision went down (1) Anonymous Coward | more than 3 years ago | (#35741570) "Mr. Branson! James Cameron isn't doing that submarine trip to the Mariana Trench after all [flickdirect.com] , since earthquake aftershocks make it too dangerous!" "Perfect! I'll have my own submarine built and go there myself. That smurf-lover has been in the spotlight too long, it's time to remind the world who the real crazy rich guy is! Earthquakes don't scare me." Branson is a Liar and a Fraud (-1) Anonymous Coward | more than 3 years ago | (#35741600) Branson's always been a follower riding on the back of other people. He wouldn't touch this unless a real innovator like James Cameron had made the leap first or someone else hadn't done all the hard work. Can't stand the cunt. Oh, and if he's trying to sell a business off you can bet your life it's worth at least a third what he's asking for and past its peak. Branson is so iffy a parliamentary select committee found him unfit to run a bank. Re:Branson is a Liar and a Fraud (0) Anonymous Coward | more than 3 years ago | (#35741852) Re:Branson is a Liar and a Fraud (1) ciderbrew (1860166) | more than 3 years ago | (#35742394) Re:Branson is a Liar and a Fraud (1) tom17 (659054) | more than 3 years ago | (#35744484) "For Sure!"? Re:Branson is a Liar and a Fraud (1) ciderbrew (1860166) | more than 3 years ago | (#35745050) erm... Re:Branson is a Liar and a Fraud (0) Anonymous Coward | more than 3 years ago | (#35746014) Funny how this has been marked down. Virgin's outsourced web cleaning operation woke up? Check the facts. Trieste / Mariana Trench / January 1960 (1) KC1P (907742) | more than 3 years ago | (#35741606) Why are we pretending this hasn't already been done? [wikipedia.org] Re:Trieste / Mariana Trench / January 1960 (2) oenone.ablaze (1133385) | more than 3 years ago | (#35741782) Re:Trieste / Mariana Trench / January 1960 (1) Samantha Wright (1324923) | more than 3 years ago | (#35741924) FF4 unclickable workaround (0) Anonymous Coward | more than 3 years ago | (#35742498) With my FF4, it's also unclickable. Double-click with the right button brings up the context menu, however. From there, one can open the link in another tab. Re:FF4 unclickable workaround (1) delinear (991444) | more than 3 years ago | (#35743220) Link works fine with FF4 here... (1) Ellis D. Tripp (755736) | more than 3 years ago | (#35743330) As does the AC checkbox.... Re:FF4 unclickable workaround (1) psyclone (187154) | more than 3 years ago | (#35747104) Also affects FF 3.6 Re:Trieste / Mariana Trench / January 1960 (1) countertrolling (1585477) | more than 3 years ago | (#35743408) Not a very exciting experiment. I'm probably going out on a limb by saying, the hell it wasn't! No sense of adventure you have, my dear. Dome (2) maroberts (15852) | more than 3 years ago | (#35741616) Re:Dome (1) mosb1000 (710161) | more than 3 years ago | (#35741962) The website for the submarine says the dome will be made of quartz. Re:Dome (0) Anonymous Coward | more than 3 years ago | (#35741998) If it is going to have a large see through area, what the hell is it made of? Transparent aluminium Re:Dome (1) Hitokiri Battousai (702935) | more than 3 years ago | (#35742848) ...units of measure (1) mriya3 (803189) | more than 3 years ago | (#35741646) 8000 pounds = 3 628.73896 kilograms 24 hours = 8.64 × 10^12 shakes Re:...units of measure (1) $RANDOMLUSER (804576) | more than 3 years ago | (#35741832) Re:...units of measure (0) Anonymous Coward | more than 3 years ago | (#35742010) 111,120km = about 2 trips around the world, underwater (presumably the Nautilus didn't go up on land and follow the equator). Immaculate, too! (0) Anonymous Coward | more than 3 years ago | (#35741694) Richard Branson Announces Virgin Oceanic Submarine Does this mean the sub will no longer be virgin after it's christened? Dumbing down? (2) jandersen (462034) | more than 3 years ago | (#35741858) Well done, mr Branson! One of the few who dare, nowadays. But, what is it that always tends to make American articles appear so downright stupid? Why are numbers and sizes always dumbed down to something you hope the average Joe Sixpack might get his head around? Like "8000 pounds" rather than "4t"? Or "37,000 ft"? Or, in other articles, numbers like "100,000 million billion" - is it just to make it sound impressive? If so, it doesn't work, it just sounds like toddler-talk. I would expect people who are able to understand subjects involving big numbers, are also able to understand the meaning of prefixes like "k", "M" and "G", and even (shudder) metric units. And, of course, I can understand feet and pounds; it's just that every time it feels like yet another example of America wanting to show everybody that they are too bloody high and mighty to follow the lead of others. No, I don't hate America, and I do know that Americans are good and decent people; but then, why not show off all those good sides you guys have? Re:Dumbing down? (1) Xest (935314) | more than 3 years ago | (#35742128) "Well done, mr Branson! One of the few who dare, nowadays." Oh I think there's plenty who dare. Just not many who have enough money and dare. He's unique in that he has money and dares ;) Re:Dumbing down? (0) Anonymous Coward | more than 3 years ago | (#35742298) There is a subtle difference between being daring and being suicidally depressed ... Re:Dumbing down? (1) ciderbrew (1860166) | more than 3 years ago | (#35742426) Re:Dumbing down? (1) icebrain (944107) | more than 3 years ago | (#35744552) How is saying "8000 pounds" "dumbed down"? Or "37000 feet"? I'll grant you the silly thousand-million-billion-gazillion stuff, but using standardized units is by no means dumb. Dumbing-down measurements happens when they start making comparisons using units like "jumbo jets", elephants, Libraries of Congress, average-sized cars, etc. Re:Dumbing down? (1) smellsofbikes (890263) | more than 3 years ago | (#35745458) >I would expect people who are able to understand subjects involving big numbers, are also able to understand the meaning of prefixes like "k", "M" and "G", and even (shudder) metric units. While I feel the same way, and so do a lot of my friends, telling people that I rode 5 megameters on my bicycle last year, or that I'm going to drive 2 megameters to Canada next week, makes them frown. I can't imagine that anyone would find it smooth or intuitive to talk about megamiles. It's much easier to understand a base unit with very large scalars than much less-well-known prefixes and a scalar between 0 and 9, and while kilometers, for example, isn't designated as a base unit it functions as one in people's minds when they're talking about driving distances. I think the same thing happens with tons: people know how much a pound is, and may even know that 8000 pounds is roughly double the weight of their car, but most people don't have any good feel of what a ton is even if you tell them it's 2000 pounds. Sure, it's just math, but for a lot of people the added distance of having to do that math changes the idea from "that's a lot!" to "is that a lot?" TOO LATE (0) Anonymous Coward | more than 3 years ago | (#35741880) the atlantic's bottom is full of oil since 2010 and the pacific was just contaminated with, they say, 7.5 million times the normal radiation at japans shores... :( Necessary (1) pasv (755179) | more than 3 years ago | (#35741908) failed.foibles, endless wars, shutdown welcome (0) Anonymous Coward | more than 3 years ago | (#35742004) just go. never mind pretending to disagree over & over with yourselves, & your other selves, while continuing to lie to each other, & everybody in the world, about your fatal selfish .5billion pop. eugenatic, & weapons peddling agendas. just go. Passengers? (1) android.dreamer (1948792) | more than 3 years ago | (#35742046) Re:Passengers? (0) Anonymous Coward | more than 3 years ago | (#35744526) There's not much life in the middle of the Atlantic. Most of the pretty fish are native to reefs and confined to shallow depths near the coast. Arcteryx Jackets (-1) Anonymous Coward | more than 3 years ago | (#35742466) Welcome to buy the 2011 arcteryx jacket [arcteryxsjackets.com] in the New Year. there are many mens arcteryx jackets [powerbalan...celets.com] for you to choose. If you are interested in them, I think I will give you many style and color to choose. I know he's British... (0) Anonymous Coward | more than 3 years ago | (#35742626) but I can't help picturing Branson as the real life version of Saxton Hale. Vertical excursion (1) srussia (884021) | more than 3 years ago | (#35742680) Re:Vertical excursion (1) Overzeetop (214511) | more than 3 years ago | (#35744554) I know an architect who would like to do this: an 8 month trip "starting" at the sea floor and ending at the top of Everest. He's looking for sponsors and maybe a reality TV segment to fund it. I think he has an early-20s son who he wants to do it with. The most expensive part is the beginning, as getting a ticket on a research sub is (iirc) in the $250k range. It'd be a cool trip to say the least. No seamen please (2) coinreturn (617535) | more than 3 years ago | (#35743398) Re:No seamen please (1) colinrichardday (768814) | more than 3 years ago | (#35745838) Re:No seamen please (1) coinreturn (617535) | more than 3 years ago | (#35746124) Why bother (0) Anonymous Coward | more than 3 years ago | (#35743520) Why bother, all he has to do is to learn to astrally project! I've done it you can, we all can... Steve Fosset (0) Anonymous Coward | more than 3 years ago | (#35743738) It seems like Branson isn't the initiator to this project as much as he'd like to give the impression of. According to, it was built for late Steve Fosset, and the entire thing was a Hawkes/Fosset project from the start. Kudos to Branson for picking up the ball though. This craft will be useful, in special ways (0) Anonymous Coward | more than 3 years ago | (#35745248) Perhaps Branson wants to be uniquely able to retrieve the flight recorder "black boxes" from his Airbus planes after they crash as a result of failure of their computerized flight control systems malfunctioning. There will be more Airbus crashes as a result of flaws in the flight control systems. Scoff now, because later you will only be able to shake your heads. Richard Branson announces more cheap publicity (0) Anonymous Coward | more than 3 years ago | (#35746188) The way it works it this: Branson offers the Virgin brand to a newsworthy enterprise and in return Branson's brand receives huge publicity in the media, worldwide, and keeps the hundreds of Virgin companies in the public consciousness. That kind of publicity is worth millions and he gets it on the cheap just by plastering the rocket/plane/car/boat/balloon/submarine with the Virgin logo. It's a simple trick and you will be taken in by it again.
http://beta.slashdot.org/story/150004
CC-MAIN-2014-42
refinedweb
4,889
79.3
On 5 Jan 2008, at 13:46, Archana wrote: > Hello , > I had previously send the fix for this bug, but i cant find it now, > so I am sending it again. > > > ASSERT(MUTEX_HELD(&mod_lock)); > > if ((fp = ctf_bufopen(&ctfsect, &symsect, &strsect, error)) == NULL) > + dprintf(?cannot open ctf_bufopen()?); > return (NULL); Advertising Even without looking at the bug report or the relevant source file, it's obvious by inspection that this cannot be the correct fix, nor can it have been tested. And in fact bug 6309693 relates to locale definitions, so it's rather unlikely that this patch to what looks like a kernel source file will fix it. Judging from the number of similar postings, I'm guessing that some professor at the Amrita School of Engineering has set "Find and fix a Solaris bug" as a piece of coursework for an undergraduate course. Now whilst it's good for Solaris' outreach to involve these students, and good for their education, I have to question the value of the exercise if the students don't take the time or care to develop correct solutions and submit them in a useful way... It just ends up offloading their education onto the people who sponsor the fixes. Pete.
https://www.mail-archive.com/request-sponsor@mail.opensolaris.org/msg01236.html
CC-MAIN-2016-44
refinedweb
205
55.17
Hints, tips and best practices on the use of BizTalk in the real world While testing the WCF-WSHttp receive adapter this week I ran in this very interesting, and rather obscurely worded error: The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree. The objective of this integration was to expose a service through which we would be able to receive a message from an IBM WebSphere Message Broker implementation initially. The intention was that other applications and back-end systems would also be able to utilise this service at a later stage. It had therefore been decided way back in the design stage of the project that we would accomplish this by using the SOAP 1.2 protocol for receiving messages into BizTalk. To implement this on the BizTalk side we published the schema for the message we were expecting as a WCF service, and created the matching receive location. My first mistake was that I thought we could use the WCF-BasicHttp adapter, as the only requirement was that the service needed to adhere to the WS-BasicProfile standard. What I did not know at the time was that the BasicHttp adapter only supports SOAP 1.1, and to use SOAP 1.2 you have to use the WCF-WSHttp adapter. After using the command line utility discussed in a previous post to recreate the service and update the receive location, I figured everything would be ready and I started to test the service via SOAP 1.2 again. That was when this rather obscure error was returned in the SOAP response. The actual response looked something like this: > After scouring the web for an explanation I came across a number of articles that discussed WCF coding changes and endpoint behaviour changes that would remedy the error. The only problem with that is that we do not have access to making code changes, and changing the endpoint behaviour did not make sense either. I also wanted to stay away from implementing custom WCF bindings, as this is supposed to be "out-of-the-box" functionality. Eventually I came across this article:, which focuses on using incoming SOAP headers, and I noticed the "To" element within the SOAP Header section. With a little more reading and surfing I came to realise that the WSHttp adapter utilises the WS-Addressing standard to identify the receive location to which the message needs to be submitted. With this knowledge in hand I added the following section to the SOAP message I was sending to BizTalk: <soap:Header> <To soap:</To></soap:Header> The addressing namespace can, of course go into the "Envelope" declaration of the SOAP message, but for simplicity sake I am reflecting it as shown here. The URI that is put into the To element is essentially the URI used to get to the service in the first place. A few interesting observations about this URI: After adding this section to the SOAP message and submitting it to BizTalk the message was received and processed successfully. If you would like to receive an email when updates are made to this post, please register here RSS PingBack from Hi: I am facing a similar problem. I would like to know how you passed the custom header metadata information to the client. The msdn documentation you have referred to states that we need to create a custom wsdl file manually to include information on header. Now, how do I indicate the schema for the header in this wsdl file? Even if I create custom soap header in BizTalk ( along with property schema), it is not displayed in the wcf publishing wizard. It would help if you could show that portion of your wsdl that gives header information and also the schema about the header. Thanks in advance, Meena K
http://blogs.msdn.com/nabeelp/archive/2008/03/07/obscure-error-addressfilter-mismatch-at-the-endpointdispatcher.aspx
crawl-002
refinedweb
655
56.79
view raw I'm doing a codewar where you need to find the sum of positive numbers in an array. I was able to find a solution except for when the test arrays are empty or all the elements are negative. How to I return 0 instead of nil? Here is my solution... def positive_sum(arr) arr.select {|x| x > 0}.reduce :+ end There's no need to do both select and reduce. You can check the value of x in your reduce block: def positive_sum(arr) arr.reduce(0) do |sum, x| if x > 0 sum + x else sum end end end positive_sum([10, -3, 20, -8]) # => 30 positive_sum([]) # => 0 positive_sum([-1, -5]) # => 0 Of course, you can make this a oneliner if you prefer: def positive_sum(arr) arr.reduce(0) {|sum, x| x > 0 ? sum + x : sum } end
https://codedump.io/share/St3VEszkvTmA/1/protect-against-nil-in-ruby
CC-MAIN-2017-22
refinedweb
140
76.72
Java doesn’t allow multiple inheritance for the fear of Deadly Diamond of Death. And to circumvent this Java introduced interfaces where in a class can extend only one other class, but implement multiple interfaces. These interfaces don’t contain any implementations. (This is going to change with Defender Methods in Java 8). Lot of other languages support interface like constructs but with greater power. And one such construct in Scala are Traits. also read: Traits like Interfaces in Java Lets have a look at Trait being used as a Interface in Java. Consider a Trait Reader which provides a abstract read method. trait Reader{ def read(source:String):String } This trait can be extended by Scala classes like: class StringReader extends Reader{ import scala.io.Source def read(source:String) = Source.fromString(source).mkString } In Scala we can place imports at any line. Lets see the above code in action: object Main extends App{ val stringReader = new StringReader println(stringReader .read("This is a string to be printed back")) println(stringReader.isInstanceOf[Reader]) } The output is: This is a string to be printed back true You must be thinking: But this is what an Interface can do, how is a trait different? Traits with method implementations Let me edit the Reader trait to implement read method to read the contents from the String i.e what StringReader does. trait Reader{ def read(source:String):String = Source.fromString(source).mkString } Here is the power of traits. They can have implementations. A real advantage is that lot of times we have common implementations of certain methods in Interfaces and we end up implementing those interfaces and copying the code at all the places- A clear violation of DRY. Java is introducing a similar concept in Java 8 called Defender Methods. The main intention of introducing Defender Methods is for enhancing the APIs in such a way that it doesnt break millions of existing implementations. Lets mix in the above trait into a class. class Person(var name:String, var age:Int){ def getDetails = name+ " "+ age } class Employee(name:String, age:Int, var moreDetails:String) extends Person(name,age) with Reader{ override def getDetails = { val details = read(moreDetails) name + " "+age+"\n"+"More: "+details } } We have a Employee class which extends Person class and mixes in the Reader trait. Just like in Java we use implements keyword, in Scala we use with keyword for adding a trait. When we mix in the trait, all its contents are just added as is into the class, which means the read method in the Reader trait can be invoked from the Employee class just as if the method was actually a part of Employee class. Lets see the above classes in Action: object Main extends App{ val employee1 = new Employee("Alex",20, "Some more details as string") println(employee1.getDetails) } The output: Alex 20 More: Some more details as string These were some of the basic concepts of Traits. There’s lot of things yet to be explored, I think I will cover the advanced concepts in a subsequent article. The complete code for the above example: import scala.io.Source trait Reader{ def read(source:String):String = Source.fromString(source).mkString } class Person(var name:String, var age:Int){ def getDetails = name+ " "+ age } class Employee(name:String, age:Int, var moreDetails:String) extends Person(name,age) with Reader{ override def getDetails = { val details = read(moreDetails) name + " "+age+"\n"+"More: "+details } } object Main extends App{ val employee1 = new Employee("Alex",20, "Some more details as string") println(employee1.getDetails) } [...] our previous article we covered very basic concepts on traits. In this article we will expand on our initial work and [...]
http://www.javabeat.net/traits-scala/
CC-MAIN-2014-41
refinedweb
614
63.59
Aros/Developer/Docs/Libraries/BSDsocket Contents Introduction[edit] Amiga had a few attempts at internet access (TCP) and address (IP) stacks. AmiTCP (BSD 4.3) to Miami ( ) to Roadshow (OS4 and possibly AmigaOS (TM)). A few of these functions have macros for easier use (select, inet_ntoa, etc.), but you must use CloseSocket and IoctlSocket in place of close and ioctl. Bsdsocket.library has it's own ernno, which can be queried with Errno() or you can make it use the errno variable using SetErrnoPtr() or SocketBaseTagList() Make sure the bsdsocket.library is opened before you call the bsd functions, if not than its very normal that is where it crashes... net_udp.c contains... #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <sys/param.h> #include <sys/ioctl.h> #include <errno.h> #include <proto/socket.h> #include <sys/socket.h> #include <bsdsocket/socketbasetags.h> #include <net/if.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #ifdef __AROS__ #include proto/bsdsocket.h #endif #ifdef NeXT #include libc.h #endif and uncomment them //extern int gethostname (char *, int); //extern int close (int); For example you create a socket with socket() (from bsdsocket.library) and then you pass it to write() from arosc, but this integer value means something different to arosc. Same with other way around, using fd created by arosc with bsdsocket.library. Do you know that bsdsocket API has support for fd hooks. They allow to sync up fd numbers between bsdsocket.library and libc. If you look at original netlib code, you'll see it. That implementation is based on some support from SAS/C libc. ); } - Under AROS you need -larossupport instead of -ldebug. - Of course you need -lsdl since you are using SDL :) - make sure ioctl or ioctlsocket is defined to IoctlSocket, and close to CloseSocket. Reference[edit] Every bsdsocket.library call takes SocketBase as an argument, and since you declared a global NULL SocketBase socket functions will fail. To solve the problem, you can include the header blow instead of proto/bsdsocket.h, and use SocketBase as normal, which will become the taks's user defined field. Please note that you have to do call init_arossock() in the right thread, preferably in a wrapper around exec_list, and don't declare a global SocketBase variable. As far as i know WaitSelect() works just like select() and would be nice to paste bit of the code here where it fails... WaitSelect can only be used on sockets, not on DOS filehandles. On unix they are handled uniformly, but on Amiga you have to use different code path for file handles and sockets. sys/select.h --------------- ; } } One of the arguments of LockMutex is still NULL, it could be ThreadBase too. One thing I noticed is that you don't use pthread_join/WaitThread in your code. Instead you do busy loops until the given thread sets its state. Because one of the functions which overflows the stack is wait_thread_running(). LockMutex fails in exe_elist(), because cclist_mutex is not itialized for AROS in main.c, hence the NULL pointer. Initializing cclist_mutex solves the problem. Here are the two thread-waiting functions without the busy loop: void wait_thread_running (S4 threadnum) { LockMutex (pthreads_mutex); if (pthreads[threadnum].thread) WaitThread(pthreads[threadnum].thread, NULL); UnlockMutex (pthreads_mutex); } void join_threads (S4 threadnum) { /* wait until all threads are stopped */ S4 i; LockMutex (pthreads_mutex); /* thread zero is the main thread, don't wait for it!!! */ for (i = 1; i < MAXPTHREADS; i++) { /* don't check the calling thread!!! */ if (i != threadnum && pthreads[i].thread) { WaitThread(pthreads[i].thread, NULL); } } UnlockMutex (pthreads_mutex); } Replacing WaitThread with pthread_join would work on other platforms. Checking (pthreads[i].state == PTHREAD_RUNNING) isn't necessary anymore, since these thread waiting functions instantly return on terminated threads. It's waiting till the thread is started (was created). It's the thread_sync function in the examples. This is for synchronizing threads. The next step would be sendig data to the thread: with threadpush (). Also make sure that to open bsdsocket.library in the same thread where you do the socket operations, because you can't share socket descriptors between threads. Technically it's possible to pass sds between threads, but it requires some extra code, and generally not worth the hassle if you can move all the socket manipulation into one thread. Examples[edit] /* Copyright (C) 2008-2009/socket.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> #ifdef __MORPHOS__ #include <sys/filio.h> #elif defined(AROS) #include <sys/ioctl.h> #endif #include <devices/timer.h> #include <proto/exec.h> #include <proto/socket.h> #include <string.h> #include "quakedef.h" #include "sys_net.h" struct SysSocket { int s; }; struct SysNetData { struct Library *SocketBase; struct MsgPort *timerport; struct timerequest *timerrequest; }; #define SocketBase netdata->SocketBase struct SysNetData *Sys_Net_Init() { struct SysNetData *netdata; netdata = AllocVec(sizeof(*netdata), MEMF_ANY); if (netdata) { SocketBase = OpenLibrary("bsdsocket.library", 0); if (SocketBase) { netdata->timerport = CreateMsgPort(); if (netdata->timerport) { netdata->timerrequest = (struct timerequest *)CreateIORequest(netdata->timerport, sizeof(*netdata->timerrequest)); if (netdata->timerrequest) { if (OpenDevice(TIMERNAME, UNIT_MICROHZ, (struct IORequest *)netdata->timerrequest, 0) == 0) { netdata->timerrequest->tr_node.io_Command = TR_ADDREQUEST; netdata->timerrequest->tr_time.tv_secs = 1; netdata->timerrequest->tr_time.tv_micro = 0; SendIO((struct IORequest *)netdata->timerrequest); AbortIO((struct IORequest *)netdata->timerrequest); return netdata; } DeleteIORequest((struct IORequest *)netdata->timerrequest); } DeleteMsgPort(netdata->timerport); } CloseLibrary(SocketBase); } FreeVec(netdata); } return 0; } void Sys_Net_Shutdown(struct SysNetData *netdata) { WaitIO((struct IORequest *)netdata->timerrequest); CloseDevice((struct IORequest *)netdata->timerrequest); DeleteIORequest((struct IORequest *)netdata->timerrequest); DeleteMsgPort(netdata->timerport); CloseLibrary(SocketBase); FreeVec(netdata); } qboolean Sys_Net_ResolveName(struct SysNetData *netdata, const char *name, struct netaddr *address) { struct hostent *remote; remote = gethostbyname(name); if (remote) { address->type = NA_IPV4; *(unsigned int *)address->addr.ipv4.address = *(unsigned int *)remote->h_addr; return true; } return false; } qboolean Sys_Net_ResolveAddress(struct SysNetData *netdata, const struct netaddr *address, char *output, unsigned int outputsize) { struct hostent *remote; struct in_addr addr; if (address->type != NA_IPV4) return false; addr.s_addr = (address->addr.ipv4.address[0]<<24)|(address->addr.ipv4.address[1]<<16)|(address->addr.ipv4.address[2]<<8)|address->addr.ipv4.address[3]; remote = gethostbyaddr((void *)&addr, sizeof(addr), AF_INET); if (remote) { strlcpy(output, remote->h_name, outputsize); return true; } return false; } struct SysSocket *Sys_Net_CreateSocket(struct SysNetData *netdata, enum netaddrtype addrtype) { struct SysSocket *s; int r; int one; one = 1; if (addrtype != NA_IPV4) return 0; s = AllocVec(sizeof(*s), MEMF_ANY); if (s) { s->s = socket(AF_INET, SOCK_DGRAM, 0); if (s->s != -1) { r = IoctlSocket(s->s, FIONBIO, (void *)&one); if (r == 0) { return s; } CloseSocket(s->s); } FreeVec(s); } return 0; } void Sys_Net_DeleteSocket(struct SysNetData *netdata, struct SysSocket *socket) { CloseSocket(socket->s); FreeVec(socket); } qboolean Sys_Net_Bind(struct SysNetData *netdata, struct SysSocket *socket, unsigned short port) { int r; struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(port); *(unsigned int *)&addr.sin_addr.s_addr = 0; r = bind(socket->s, (struct sockaddr *)&addr, sizeof(addr)); if (r == 0) return true; return false; } int Sys_Net_Send(struct SysNetData *netdata, struct SysSocket *socket, const void *data, int datalen, const struct netaddr *address) { int r; if (address) { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(address->addr.ipv4.port); *(unsigned int *)&addr.sin_addr.s_addr = *(unsigned int *)address->addr.ipv4.address; r = sendto(socket->s, data, datalen, 0, (struct sockaddr *)&addr, sizeof(addr)); } else r = send(socket->s, data, datalen, 0); if (r == -1) { if (Errno() == EWOULDBLOCK) return 0; } return r; } int Sys_Net_Receive(struct SysNetData *netdata, struct SysSocket *socket, void *data, int datalen, struct netaddr *address) { int r; if (address) { LONG fromlen; struct sockaddr_in addr; fromlen = sizeof(addr); r = recvfrom(socket->s, data, datalen, 0, (struct sockaddr *)&addr, &fromlen); if (fromlen != sizeof(addr)) return -1; address->type = NA_IPV4; address->addr.ipv4.port = htons(addr.sin_port); *(unsigned int *)address->addr.ipv4.address = *(unsigned int *)&addr.sin_addr.s_addr; } else r = recv(socket->s, data, datalen, 0); if (r == -1) { if (Errno() == EWOULDBLOCK) return 0; } return r; } void Sys_Net_Wait(struct SysNetData *netdata, struct SysSocket *socket, unsigned int timeout_us) { fd_set rfds; ULONG sigmask; WaitIO((struct IORequest *)netdata->timerrequest); if (SetSignal(0, 0) & (1<<netdata->timerport->mp_SigBit)) Wait(1<<netdata->timerport->mp_SigBit); FD_ZERO(&rfds); FD_SET(socket->s, &rfds); netdata->timerrequest->tr_node.io_Command = TR_ADDREQUEST; netdata->timerrequest->tr_time.tv_secs = timeout_us / 1000000; netdata->timerrequest->tr_time.tv_micro = timeout_us % 1000000; SendIO((struct IORequest *)netdata->timerrequest); sigmask = 1<<netdata->timerport->mp_SigBit; WaitSelect(socket->s + 1, &rfds, 0, 0, 0, &sigmask); AbortIO((struct IORequest *)netdata->timerrequest); } Reference[edit] The first is about breaking some api level functionality to make way for supporting IPv6. Would it be a great deal to fix the existing functions that assume IPv4 addresses, so they take generic structures instead? miami.library provides the missing API. Miami was going the same way those back then. IPv6 looks like a failed experiment. No one is seriously deploying it. In fact not much needs to be replaced. It affects mainly resolver, introducing inet_PtoN() and inet_NtoP(). The rest is perfectly handled by existing socket API. Just add AF_INET6. How big a task would it be to replace the existing bsd-based internals of AROSTCP with more upto date code? Take recent NetBSD and you're done. FreeBSD diverted a lot. This will give you working sysctl and BPF/PCAP. AROSTCP already has some upgraded code. Its codebase is NetBSD v2.0.5. BTW, userland (like resolver) from FreeBSD perfectly fits in. One more idea: separate protocols into loadable modules. This would give you AF_UNIX, AF_BT, etc. There is a single-linked list where all protocols are registered. Nodes are looked up using AF_xxx as a key. Then there are several pointers to functions. That's all. This is very well separate-able. In the end you would have protocol modules with these functions exported, and something like bsdcore.library, implementing basic lowlevel stuff like mbufs and bsd_malloc(). Ah, yes, there is some remainder (IIRC) from original BSD4.3, where AF_xxx are indexes into array. I was lazy enough not to remove this. So, for now both lookup mechanisms are coexisting. Throw away the old one, use NetBSD code as a reference. In fact BSD is very modular at source code level, the same as Linux. You can switch on and off any part without affecting others. So, porting the code isn't really difficult. Would like to propose a 'unified file descriptor' model for arosc.library, to simplify porting of POSIX applications. The goal is to be able to use the same 'int fd' type to represent both the DOS BPTR filehandles and bsdsocket.library socket backend. This will eliminate the need to rewrite code to use send() instead of write() to sockets, and call CloseSocket() instead of close() for sockets. Implementation would be as a table (indexed by fd #) that would have the following struct: struct arosc_fd { APTR file; struct arosc_fd_operation { /* Required for all FDs */ int (*close)(APTR file); LONG (*sigmask)(APTR file); /* Gets the IO signal mask for poll(2)ing */ ssize_t (*write)(APTR file, const void *buff, size_t len); ssize_t (*read)(APTR file, void *buff, size_t len); ..etc etc... /* The following are optional operations */ off_t (*lseek)(APTR file, off_t offset, int whence); ssize_t (*sendto)(APTR file, const void *buff, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen); ssize_t (*recvfrom)(APTR file, void *buff, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); ssize_t (*sendmsg)(APTR file, const struct msghdr *msg, int flags); ssize_t (*recvmsg)(APTR file, struct msghdr *msg, int flags); ..etc etc.. } *op; } *fd_table; The C library routines 'open()' and 'socket()' would be modified to: - Ensure that either dos.library or bsdsocket.library is opened. - Allocate a new fd in the FD table - Set fd_table[fd].ops to a 'struct arosc_fd_operation' pointer, that defines the IO operations for either dos.library for bsdsocket.library - Set fd_table[fd].file to a pointer to the private data for those operation (ie BPTR or socket fd #) - Return the new FD number The read()/write()/etc. would be modified to use the fd_table[fd].op routines to perform IO The poll() routine will wait for activity on the OR of all the signal masks of the the provided FDs. The close() routine also deallocates the arosc_fd entry It's a layer on top of it. bsdsocket.library would be opened dynamically from arosc.library's socket() routine if needed. since arosc generated FD's will be different from bsdsocket.library ones how will programmers know what to pass to functions? Programmers would not use the bsdsocket headers nor protos directly (similar arosc.library headers would be generated that wrap them). The point is that programmers would no longer need to treat bsdsocket fd as a special case. the whole fd_table[] mapping concept. The 'file' element of the fd_table[n] would be a BPTR for a open()ed fd, and a bsdsocket.library socket descriptor number for one created by arosc's socket() call. The user would *not* be calling bsdsocket.library directly under the proposed scheme. Everything in that library would be wrapped by arosc.library. make sure that those codes will continue using bsdsocket functions and won't switch half arosc / half bsdsocket (for example arosc->send and bsdsocket->CloseLibrary). The 'best' solution would be to have a compilation flag (ie '#define BSDSOCKET_API') that ifdefs out the arosc send()/recv()/socket()/etc prototypes and makes send()/recv()/CloseSocket() and friends from the bsdsocket protos visible. If BSDSOCKET_API is not defined, but bsdsocket.library is intended (ie calls to CloseSocket(), etc), then the user will get compilation errors about missing function prototypes. If BSDSOCKET_API is defined, but POSIX is intended, then they will get a link error about 'undefined symbol SocketLibrary' Maybe the bsdsocket includes should also have some detection of arosc includes and produce the warning about the BSDSOCKET_API define beeing accessible to developers if both headers are included in the same compilation unit - I'm just wondering how we are going to get the word out to 3rd party developers that they don't have to change their codes and can simply use the define - or maybe it should be the other way around? bsdsocket by default and POSIX_SOCKET_API define to enable the support you mention?
http://en.wikibooks.org/wiki/Aros/Developer/Docs/Libraries/BSDsocket
CC-MAIN-2014-52
refinedweb
2,326
50.63
Odoo Help Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps: CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc. How to avoid on_change recursion? I have four many2one fields from which only one can be populated at a time so I set on_change events on each of them to clear other three fields if something is selected but there's a recursion problem; changing one field clears other fields which in turn clears the initial field. How would one go about avoiding this? After a lot of faffing about, solution turned out to be rather simple; all I had to do was to check whether the field is empty or not before executing the code body of on_change function, here's a little example: def onchange_item1(self, cr, uid, id, item1_id=None, context=None): domain = {} value = {} if item1_id: #Clear all selections value = {'item2_id': False,} return {'domain': domain, 'value': value} def onchange_item2(self, cr, uid, id, item2_id=None, context=None): domain = {} value = {} if item2_id: #Clear all selections value = {'item1_id': False} return {'domain': domain, 'value':
https://www.odoo.com/forum/help-1/question/how-to-avoid-on-change-recursion-10842
CC-MAIN-2017-04
refinedweb
183
59.47
BATTLE FOR AUSTRALIA NEWSLETTER SEPTEMBER 2010 A Micro-Sleep can kill in Seconds! A uniquely Australian Independent organisation dedicated for over 80 years to caring for the families of deceased veterans and members of the Australian Defence Forces who lose their lives as a result of their service. A DONATION, GIFT OR BEQUEST IN YOUR WILL ensures that there will be ongoing funds to provide care and support services to over 10,500 widows and other dependants of deceased veterans living in South Australia and Broken Hill. Legacy’s income is not Government based and must rely on the generosity of the community to fund its services of caring and support. For more information and/or to make a donation or bequest please contact: Legacy Club of Adelaide Inc. 102 Franklin Street, Adelaide SA 5000 T: 08 8231 9812 E: general.manager@legacyadelaide.org.au W: Proud to support 5th Field Ambulance RAAMC Association Driver Fatigue Alarm is a new revolutionary micro-sleep warning technology designed to raise the driver’s awareness from driver fatigue and microsleep. Effective, light weight and easily worn behind the ear. It works on an electronic balance. As the driver’s head begins to tilt forward in a micro-sleep, it emits a loud alarm sound or strong vibration alerting the driver to take corrective action or pull over immediately for a rest. If everybody wears a Driver Fatigue Alarm , our roads will be a lot safer. DRIVER FATIGUE ALARM can be your “drive buddy” for a safer drive. A safer drive for just… $ 19 95 Plus $4.95 Postage and Handling Order Today Online at or Phone (02) 9715 5100 5th FIELD AMBULANCE RAAMC ASSOCIATION PATRON: COL Ray Hyslop OAM RFD OFFICE BEARERS PRESIDENT: LTCOL Derek Cannon RFD ~ 31 Southee Road, RICHMOND NSW 2753 ~ (H) (02) 4578 2185 HON. SECT: Alan Curry ~ 6 Reliance Boulevarde, TANILBA BAY NSW 2319 ~ (H) (02) 4982 4646 Mobile: 0427 824 646 TREASURER: Brian Tams ~ 4/24-26 Barrenjoey Road, ETTALONG BEACH NSW 2257 ~ (H) (02) 4341 9889 COMMITTEE: Warren BARNES Mobile: 0409 909 439 Fred BELL (ASM) Mobile: 0410 939 583 Bill CLUTTERBUCK Phone: (02) 4982 5725 Barry COLLINS OAM Phone: (02) 9398 6448 John de WITT Phone: (02) 9525 4951 Mick ROWLEY Phone: (02) 9570 5381 CONTENTS Vale: Herbert Ronald Ferguson............................................................................................................................................................... 3 Life Members ..................................................................................................................................................................................................... 4 Message from the President / Happy Birthday............................................................................................................................ 5 Message from the Secretary .................................................................................................................................................................... 7 Battle for Australia Commemoration Day ....................................................................................................................................... 9 VP Day Invitation ............................................................................................................................................................................................. 10 Reserve Forces Day ........................................................................................................................................................................................ 12 Congratulations / Sick Parade / Kind Acknowledgements .................................................................................................. 15 Messages from Members........................................................................................................................................................................... 16 New Member..................................................................................................................................................................................................... 20 5 CSSB Health Company News / Please - Just Stay................................................................................................................... 21 The Kokoda Memorial Project................................................................................................................................................................. 22 Items of Interest............................................................................................................................................................................................... 24 An ANZAC Trip Memory ............................................................................................................................................................................. 28 Thank You / Fund Raiser / 2010 Reunion Venue......................................................................................................................... 31 The Carved Figures of Legerwood....................................................................................................................................................... 32 Gunner Peck!...................................................................................................................................................................................................... 35 A letter from Les Burnett............................................................................................................................................................................ 36 A Soldier Returns Home ............................................................................................................................................................................. 39 Activity Sheet..................................................................................................................................................................................................... 43 Application for Membership.................................................................................................................................................................... 44 JTG Electrical Services EC No. 8790 11 Girrawheen Ave, Girrawheen WA 6064 Ph: 0439 966 273 Proud to support 5th Field Ambulance RAAMC Association B I R D W O O D E N G I N E E R I N G • Metal Fabrication • Welding • Hydraulics • Machining • Automotive Service • Air Conditioning • Servicing • Exhaust Systems Phone: 08 8568 5015 33 Pool Street, Birdwood SA 5234 Proud to support 5th Field Ambulance RAAMC Association city perfume AUSTRALIA Shop for the latest fragrances and save up to 70% off RRP and CHEAPER THAN DUTY FREE CHANEL, CHRISTIAN DIOR, ESTEE LAUDER, D&G, LACOSTE, CALVIN KLEIN Use your American Express card and receive 3 bonus points with every dollar you spend online OUR SUGGESTIONS FOR WINTER ARE: For Her Versace Signature 100ml EDP Christina Aguilera 75ml EDP Meditarenean 100ml EDP For Him David Beckam Intimately 75ml EDT Joop! Jump 100ml EDT Hugo XY MEN Tel: (02) 9773 4202 Proud to support 5th Field Ambulance RAAMC Association Thinking of a new car? Think value! Think Parramatta Motor Group Fleet discounts for 5 Field Ambulance R.A.A.M.C. members Cnr Church & Raymond Sts, Auto Alley, Parramatta Ph: 1300 107 565 DL026661 X31398 2 VALE Herbert (Bert) Ronald FERGUSON passed away on the 5th February 2010. Sadly, I only found out when his son, Greg, telephoned me in late June. I never met Bert personally but we often had good conversations by phone and it was as though I had always known him as a friend. Bert was always cheerful even though much sadness befell him with losses in his life, first of his wife Elaine, and then later, his daughter, Denise. It left only himself and his son, Greg. Greg came to live with his dad and look after him when he took sick a couple of years ago. Bert succumbed to prostate cancer and Greg was with him when he passed away peacefully in the John of God Hospital in Subiaco, WA. Bert joined the Regular Army, number 1685, on the 5th February 1948. He had 2 years service in Japan from 1950 until 1952 and then in Vietnam from May 1966 until April 1967. Bert had service with the following units:- Southern Command Depot of Medical & Dental Stores BCOF General Hospital, Japan Eastern Command Advance Depot of Medical Stores Northern Command Depot of Medical & Dental Stores Western Command Depot of Medical & Dental Stores 2nd Field Ambulance 5th Field Ambulance. He discharged from full time service on the 13th February 1970 and started work with Glaxo Pharma - ceuticals as their warehouse manager until his retirement in the mid 80’s. Bert also joined the Army Reserves on the 14th February 1970 until discharge on the 13th February 1976. It struck me as strange that when I was typing Bert’s details how the month of February was very prominent in his life –and eventually, in his passing. Bert’s rank on discharge was Warrant Officer Class 11 and he was awarded:- AASM 1945-75 with Clasp Vietnam ASM 1945-75 with Clasp Japan Australian Defence Medal. Our Association extends its sincere sympathy to his son, Greg. (If any member knew Bert personally and would like to add to our message, I would be very happy to place it in our next magazine.) LEST WE FORGET 3 5 Field Ambulance RAAMC Association LIFE MEMBERS COL Suresh BADAMI OAM RFD CAP Steve BALDICK RFD ED (Rtd) WO II Warren BARNES Mr. Fred BELL Mr. Don BOOTH * MAJGEN John BROADBENT CBE DSO ED Dr. Harding BURNS OAM * Mrs. Edna CANNON LTCOL Derek CANNON RFD Mr. Kevin CARTER Mr. John CHARTER Mr. Barry COLLINS OAM * Mr. Ross CRAFTER Mr. Alan CURRY Mr. Shaun DANAHER MAJ John de WITT ED (RL) Mr. George DONNELLY LTCOL Marie DOYLE LTCOL Andrew ELLIS OAM * LTCOL James ELLIS AM Mr. Phillip FAGUE * WO 1 Bert FERGUSON Mr. Gary FLOOD Mr. Ron FOLEY Mr. Joe GATTY LTCOL J.R. (Ray) GRANT (Rtd) Mr. George HARRIS LTCOL Miles HAVYATT ED (Rtd) MAJ Eileen HENDERSON RFD Mrs. Norma HUTTON COL Ray HYSLOP OAM RFD CAP Jim ILIOPOULOS CAP Natalie ILIOPOULOS Mr. Terry IRVINE # Mr. Don JARMAN Sir Keith JONES KB FRCS (Edin.)FRACS LTCOL Stuart JONESrian LINDSAY # * Mrs. Estelle LINDSAY MAJ Kathleen LOADSMAN Mr. Robert LOVE * Mr. Roy LOVE Mr. Edwin LOWERY Mr. Alen LUCIC Mr. Robert (Bob) LYNCH Mr. Nick MARSHALL COL G.R.W. (“Roy”) McDONALD (Rtd) # Mrs. Yvonne McLEAN Mr. Ken McNUFF COL Bill MOLLOY RFD ED Mr. Barry O’KEEFE WO 1 E. (Bill) O’KEEFE (Rtd)) Mr. Charles O’MEALLY COL John OVERTON OAM MAJ Peter PAISLEY (Rtd) Mr. Barry PERRIGO # Mrs. Heather PERIGO LTCOL David PHILLIPS RFD LTCOL John PHILLIPS OAM RFD ED Mrs. Karen PHILLIPS WO 1 Ken PHILLIPS OAM Mr. John PRICE Dr. F.G. (Geoff) PRIOR Mr. Thomas (Tom) PRITCHARD COL Robert (Bob) REID (Rtd) Mr. Alan ROBINSON CAP James ROCHE OAM Mr. Michael ROWLEY Mr. Bill RYLANDS Sr. Elizabeth SHEARD Mr. Paul SHERGOLD Mr. Robert SHILLINGSWORTH CAP Stephen STEIGRAD (Rtd) Mr. Robert STEWART Mr. Chris STRODE Mr. Peter SULLIVAN Sr. F.E.W. (“Sue”) THOMPSON Mr. Peter THOMPSON * CAP Morrie VANE Mrs. Ruth VAUDIN (nee Corbett) Mrs. Kate VERCOE Mr. Matthew VERCOE Mr. Arthur (“Bubby”) WALTON MAJ Bruce WHITTET (Rtd) MAJ Alex WILLIAMS Mr. David WILLIAMS Dr. Phillip YUILE Mr. Jim ZORBAS # Deceased * Associate 4 Message from the President Welcome to the Spring edition of 5 Field Ambulance RAAMC Association Quarterly Magazine. The Reserve Forces Day (RFD) Parade rehearsal on Sunday, 27 June and Parade on Sunday, 3 July in the Sydney Domain on Sunday, 4 July both went off successfully in excellent weather. Also, our Association, led by Alan Curry, was also represented at the RFD Hunter Region Parade held in Newcastle on 3 July. I would like to take this opportunity to thank Alan Curry and ASM Fred Bell who joined me at the rehearsal and to all of our members who paraded on the main day. Our Secretary ,Alan Curry, who led the Association as Standard Bearer will expand on the two parades and name and thank all for a fine professional turnout including the two cadets who carried our Banner with distinction. Following the RFD Parade some 16 members retired to the Berkeley Hotel, Chippendale for lunch and refreshments where we were delighted to be joined by Association stalwarts John DeWitt and Steve Baldick. The RAAMC ASSOCIATION INC. (NSW) meets on the first Friday of each even month. The next meeting is on Friday, 6 August at Victoria Barracks at 1030h. I encourage 5 Field Ambulance Asso ciation members to attend if possible. Further meet - ings are scheduled for Friday, 1 October and Friday, 3 December. May I draw your Derek Cannon attention to the VP Day Parade. This Parade is to be held on Sunday, 15 August at 2pm, at the Kokoda Memorial Walkway, Killoola Street, Concord. I encourage all who can attend this special day to contact our Secretary, Alan Curry (h) 49824646 (m) 0427824646. Future activities for your diary include The Battle for Australia commemoration Wednesday 1 Septem - ber in Martin Place, Sydney and our Annual reunion luncheon proposed for Saturday 27 November 2010 at the Paddington RSL. Please refer to Secretary Alan’s announcements. To all our special members and with thoughts for our number of sick now including our Treasurer Brian Tams recovering from serious heart surgery, Edna and I wish you all well and hope to catch up with you at one of our future planned gatherings. Derek Cannon JULY: AUGUST: SEPTEMBER: Happy Birthday Neil BARRIE, Helen BOYTER, Robert BOYTER, Lee CASTLE, Alan CURRY, John de WITT, Garry FLOOD, John GALLAGHER, Edwin LOWERY, Huss MAHOMET, Sr. Elizabeth SHEARD, George SIP. Derek CANNON, John DAVIES, Phillip FAGUE, Barry FOSTER, John LAYHE, Brian LINDSAY, John MAIR, David PHILLIPS, Tom PRITCHARD, Robert SHILLINGSWORTH. Robert BAILEY, Bill CLUTTERBUCK, Victor (“Bluey”) DAVIS, Ray GRANT, Norma HUTTON, James JORDAN, John WEAVER, David WILLIAMS, Gordon WRIGHT. Our Association wishes each of you “All the Best” on your “special” day – have you given me your month of birth? 5 TOOLOOGAN VALE FARM Highly Professional Stud Caring for Over 100 Mares 600 Acres of Relaxation WE ARE A THOROUGHBRED BROODMARE FARM Services provided include… • Foaling Down • Walking Mares onto all Hunter Valley Studs • Yearling Preparation for All Major Sales COMPETITIVE RATES Upper Dartbrook Road, Scone NSW Phone: (02) 6545 3312 Proud to support 5th Field Ambulance RAAMC Association Why Yoga? It is relaxing, energising and strengthening Creating balance and flexibility between body and mind Mention this Ad for a Monthly Unlimited Pass $130 Pause Yoga Studio… Cark Park, Cronulla 0409 275 186 9524 0108 Proud to support 5th Field Ambulance RAAMC Association TAX RETURNS Tax Returns prepared from $99 (tax deductible) SPECIALISING IN DEFENCE PERSONNEL TAX RETURNS & RENTAL PROPERTIES (Negative & Positive Gearing) We know what to claim to obtain a bigger refund for you TAX REFUND IN 10 DAYS For an interview contact: Christopher, Sue or Matthew (02) 9744 3443 or (02) 9744 5834 Proud to support 5th Field Ambulance RAAMC Association On Line or Phone Interviews for tax refund also available for your convenience Just post/fax/email us yor Payment Summary AUSTRALIAN INVESTMENTS & ACCOUNTING 6 Message from the Secretary Dear Member, If you are on our “Sick Parade” we are thinking of you. As you read this, if you have a friend who is not 100% health wise, pick up the phone or send them a card. Let them know you haven’t forgotten them. I had the chance, after our lunch on Reserve Forces Day, to visit our Treasurer, Brian Tams, in the Royal North Shore Hospital. I was with our com - mitteeman, Bill Clutterbuck but thankfully Bill was able to sit in my car and “mind” it, because I was in a “restricted” space and he said he would sit in the car and wait until I came back. Brian entered hospital in late June to have a quadruple by-pass operation on his heart. It eventuated that he had five by-passes. Our President, Derek Cannon, had bought a “Get Well” card and asked the members, who came back to the luncheon, to write a few words of encourage ment to Brian. I took the card with me and called in to see Brian on our way back up to Tanilba Bay. Brian was very pleased to see me and to receive the card. He also asked that his thanks be relayed to all who enquired about his well-being. His wife, Gail, and their daughter, Jane, were by his side. Just recently he had a “set-back” and had to undergo a second operation to repair a “nicked” aorta. As of this magazine he is now home and progressing well. Our thoughts in this issue are for the family and friends of our brave soldiers who were killed or injured on duty in Afghanistan, and later, the tragic helicopter crash in late June which caused the death of three soldiers and injuries to another seven. The work of our soldiers in discovering and destroying the caches of IED’s and other arms and ammunition, must never be underestimated—their lives are on the line each time they leave their compounds. A portion of our population does not understand that the members of our ADF are fighting in these dangerous places at the request of the United Nation and our Government. They are trying to make it safe for the peoples of Afghanistan and Iraq, in particular, to have freedom and safety from the “terror tactics” that, if left unchecked, will threaten the safety and freedom of the “Free World” of which we are a part. On another matter, to all who may have my address as No: 8—please amend this to No: 6. I won’t go into the boring details! Kind Regards to all, Alan Curry Khalil Bookkeeping Services 2 Cumberland Avenue, Cumberland Park Ph: (08) 8357 0109 Proud to support 5th Field Ambulance RAAMC Association Stanli Packaging Pty Ltd ABN 54 112 764 520 Unit 2/66 Humphries Terrace Kilkenny SA 5009 Phone: (08) 8243 2140 Proud to support 5th Field Ambulance RAAMC Association Our Motto "ALWAYS READY" (SEMPER PARATUS) Courtesy--Major Eileen Henderson TRAVLEA SUPPORT COMPUTER REPAIR SERVICE • On-Site or Mobile • Repairs & Upgrades • Networking • Virus Removal • Troubleshooting • Competitive Rates • Professional & Friendly Service Mobile: 0414 468 596 • Email: info@travleasupport.com.au Servicing the South Coast of NSW Proud to support 5th Field Ambulance RAAMC Association 7 TURKISH GRILL & PIDE QUEANBEYAN Specialising in Turkish Pizza Kebabs and our famous Meat Lovers Grill Monday to Saturday 10.30am-9.30pm 72 Monaro Street, Queanbeyan NSW Tel: (02) 6297 0209 Proud to support 5th Field Ambulance RAAMC Association • Pankration • Martial Arts • Kid’s Classes • “Little Spartans” • Self Defence • Fitness Classes • Personal Training • School Age to Adult St George PCYC, 9 Ador Avenue, Rockdale NSW Phone: 0418 282 823 Proud to support 5th Field Ambulance RAAMC Association BATHROOM & TILING SOLUTIONS Mitchell 0431 159 981 Canberra & Surrounding Areas, ACT Proud to support 5th Field Ambulance RAAMC Association SPECIALISING IN: • Bathroom Renovations & Restorations • Wall & Floor Tiling • Re-Grouting • Bath & Shower Leak Detection / Repairs • Bathroom Design Service • Free Quote • Competitive Rates PORTABLE COOL ROOMS & FREEZERS SHORT & LONG TERM HIRE (2.4m Long • 1.8m Wide • 2.1m High) • Delivery & Pick up • Supply & Installation • Sporting Events • Parties • Fetes • Planned Maintenance & Refurbishment • Corporate Functions • Weddings Hunter Valley / Newcastle & Central Coast Areas, NSW Proud to support 5th Field Ambulance RAAMC Association ACCURATE DENTURES & PARTIALS SERVICES • Full & Partial Dentures • Same Day Relines & Repairs • Bulk Billing for Eligible Patients (Medicare – Veterans Affairs) • Free No Obligation Consultation Shop 4, 53 Cnr. Saywell & Fields Rds Macquarie Fields NSW 2564 Ph: (02) 9618 6109 Proud to support 5th Field Ambulance RAAMC Association Highlands Fresh FRUITERERS & GREENGROCERS Phone: 02 4871 1370 92 Main Street, Mittagong NSW Proud to support 5th Field Ambulance, RAAMC Association DEE JACKSON AUSTRALIAN PORTRAIT ARTIST A portrait is a wonderful gift for friends and family Black Yoghurt Designs Phone: 02 9416 2265 Mobile: 0439 986 452 deejackson@deejackson.com.au Proud to support 5th Field Ambulance RAAMC Association 8 This day is a very important day and will be commemorated around Australia. We invite you to join us in Martin Place, Sydney, to be part of this Ceremony. It will commence at 11am and we will have some “Reserved” seating for our members. If you are able to be present it would be gratefully appreciated. Afterwards, we usually proceed to the Gallipoli Legions Club in Barrack Street (about a 5 minute walk). DRESS: Lounge Suit, Medals and Name Badge. The very dedicated BFA committee, of whom our good member, David Cooper OAM is a member, is seeking financial support from organisations and indivi - duals to ensure this very important day is NEVER forgotten. Our own committee was unanimous that our Association join this most worthwhile project for $25 per year. (I will be seeking to get the support from my local RSL Sub Branch to also commit to joining in this project.) BATTLE for AUSTRALIA Commemoration Day (Wednesday, 1st September) If any individual member would like to join, the BFA Committee would be most delighted to include you as a member for $10 per year. Please fill out the Application Form (on page 11) and post it, and your cheque/money order, to the address stated. (I have included a copy of an Application Form for you to fill out.) ------------------------- (Continued next page) 9 Those of us old enough to remember the events leading up to the bombings of Darwin in February 1942, and those of us who have later read the frightening accounts of those dark days in early 1942, should never forget the sacrifices of those brave men and women of the Armed Services of Australia. Those who served and those who lost their lives to save Australia being captured by the invading Japanese Imperial Forces. In the space of a few months, from 7th December 1941 to March 1942, the Japanese Imperial Forces had “smashed” the US Pacific Fleet as it lay at anchor in Pearl Harbour. Then followed quick and bloody battles that saw the victorious Japanese invaders conquer Malaya, Singapore, Philippines and East India. They entrenched themselves in Rabaul and Lae and attacked our mainland in various places along the west coast of Australia—most especially at Darwin. We now had to prepare to fight on our own soil—we were not fighting “someone else’s war thousands of miles away”. We had to defend our land, our homes and our families—we had to defend our way of life—our freedom. We were faced with the most momentous event to ever occur in our nation’s history—pre or post Federation. Due to the most strict media control at the time, these terrible events were never allowed to be reported. Even today, almost 70 years later, our school curriculums do not cover this very important piece of our history. IT IS SLOWLY CHANGING. For the first time in our history we saw our Reserve Army (then called the “Militia” and later, the CMF—Citizens’ Military Forces) CONSCRIPTED to go to New Guinea to meet, and stop, the yet unbeaten Japanese Forces. Their nick-name “The Chocco’s”, originally derisive, eventually were recognised as a very brave and courageous soldier for their feats and defeats on the Kokoda (Track) Trail from July 1942 to November 1942. This very intense period saw our troops and our Commanders criticised and admonished for their battle failures. It saw the very senior Field Commanders, LTGEN Rowell and MAJGEN Allen and BRIG Potts relieved of their commands, and even that noted war correspondent, Chester Wilmot, who covered the events at that time, had his accreditation withdrawn and was not allowed to report officially on this campaign again. All the while the Kokoda Campaign was being fought the Japanese also felt their invincibility rebuffed at MILNE BAY between 26th August 1942 to 6th September 1942, when Australian troops, supported by units of the RAN and the RAAF, handed the Japanese forces their FIRST DEFEATS. The tide of battle was turning in favour of Australia and its Allies, the US. It is, therefore, so important that the Battle for Australia is NEVER forgotten. The BFA Committee, Australia wide, have THREE main aspects; (1) To hold Nationwide Commemorative Services in the National and State Capitals, as well as regional cities, on the FIRST WEDNESDAY each SEPTEMBER. The first services were held in 1999 in Sydney and Melbourne. A Kokoda Service had been held in Sydney since 1992 and a Milne Bay Service in Melbourne since 1997. (2) To educate the children of Australia and the “not so young”, the true significance of the Battle for Australia, recognising the great sacrifices made by so many, to save Australia from a determined and victorious enemy. Also, to ensure that the events of this critical time of National crisis, are taught in our Nation’s schools. (3) To encourage and foster the unique relationship that exists between Australia and Papua New Guinea, highlighting the magnificent contribution made by so many Papua New Guineans, in defeating the Japanese invader and gaining the final victory. Let us remember the words of the former High Commissioner to PNG, His Excellency, David Irvine, in the speech he gave at the Kokoda Ceremony in 1999 about the significance of the Battle for Australia… ”Gallipoli made Australia, Kokoda saved Australia” and in finishing his speech he said… ”The sacrifices made and the heroic deeds performed by Australian Servicemen in the defence of our homeland, must always remain part of our National Heritage and History, known by all and never forgotten—LEST WE FORGET”. V.P. DAY INVITATION Our Association has been invited to take part in this very important celebration. The day will mark the 65th Anniversary of Victory in the Pacific. (On the 14 August 1945, Japan unconditionally surrendered to the Allied Forces and the Australian Government, on the 15 August 1945, declared a Public Holiday for Victory in the Pacific—it marked the end of World War Two. Britain, the US and New Zealand refer to the day as VJ Day (Victory over Japan)--With kind thanks to Google and Wikipedia for the above) There will be a small parade and we will bring our Banner which will be carried by the Scouts. All other Banners will also be carried by the Scouting Organisation. There will be NO marching because there is concern that the distance is too long for the veterans—instead it will take the form of a Parade which will see the Police Band leading, followed by the Mounted Police, Australian Light Horse, WW 2 Motor Cycles, 9 WW 2 jeeps carrying WW 2 veterans, 4 Nurses in WW 2 uniform, Association Banners and the NSW Pipes and Drums at the rear. DETAILS: WHEN: Sunday 15 August. TIME: 2pm (be seataed by 1.30pm) WHERE: Kokoda Track Memorial Walkway, Killoola St., CONCORD. DRESS: Lounge Suit, Medals, Beret and Tie, Name Badge. PARKING AREAS: Lovedale Place (Paddock), Killoola St., Concord Hospital Car Park (FREE), Concord RSL Nullawarra Ave., Concord. TRANSPORT: a “Shuttle Service” will operate every 20 minutes from between 12.30pm and 1.30pm— Strathfield Station, Concord RSL and Rhodes Station. RETURN JOURNEYS will commence from 4pm. Refreshments will be served following the service, and a “sausage sizzle” will be available, courtesy of Rotary. 10 Reserve Forces Day (Summary) SYDNEY PARADE What a glorious day it was. A crisp winter’s morning but the sun was shining and it turned out to be a great parade. Our Banner Party was conducted by two members from 202 AACU Blacktown. They were CPL’s Harley Dvorak and Taras Kret. They did a terrific job especially so when they gave up their previous Sunday to attend the RF Day rehearsals. Our Association has sent a “Letter of Thanks” to their CO, CAP Ken Duncan. We formed up with other units of 5 Brigade in Art Gallery Road. We particularly thank BRIG Brian Pezzutti and LTCOL Michael Campion who marched with us, in full uniform. BRIG Pezzzutti almost had the distinction of leading our Association in what we thought was going to be the absence of our President, Derek Cannon! Derek was held up with the train service at Strathfield and arrived with about 3 minutes to spare. Derek led our Association with myself carrying our Standard, our ASM, Fred Bell, marched at the side of our troops. The entire Parade consisted of the RANR, 2 Division, 8 Brigade, RAAF and a very large contingent of the NSSA. In all, there were about 1500 “On Parade”. The grateful assistance of 202 ACU Blacktown. Photo shows the two cadets who carried our Banner – CPL's Harley DVORAK (on left) and Taras KRET Photo shows (in Civvies) Alan Curry (Standard), COL Ray Hyslop OAM RFD (Patron), COL Derek Cannon RFD (President), COL Bill Molloy RFD ED, COL Frank Lang OAM RFD ED, Anthony Jordan and George Harris (partly obscured). In Uniform--BRIG Brian PEZZUTTI RFD and LTCOL Michael Campion Photo shows Terry and Annette Irvine, Bill Clutterbuck (holding Standard) Group photo "On Parade" Sydney RFD 2010 Group Photo Sydney RFD 2010 BRIG Brian PEZZUTTI, Bill MOLLOY, Frank LANG, COL Michael CAMPION and Suresh BADAMI Photo of Derek Cannon, Michael Moroney (Standard) and Fred Bell Photo L/R LTCOL Michael Campion, BRIG Brian Pezzutti, COL Bill Molloy and COL Frank Lang OAM Photo--Anthony Jordan and Bill Clutterbuck 12 We all “Marched off” at 10.45am and marched on to our allotted locations that roughly formed a huge “U” around the edges of the Domain Parade Ground to all face the Official dais. The Bands do a fantastic job and the concept of having them “massed” in front of the dais is also a wonderful spectacle for the Dignitaries and seated guests and visitors. The Governor-General, Her Excellency, Ms Quentin Bryce AC, is to be congratulated for walking the entire Domain to inspect, and talk to some Association Repre - sentatives (me included, as I was carrying our Standard, and I was honoured). Normally, the Inspecting Party would be in a vehicle. It would have taken Her Excellency about 30 minutes to inspect the Associations. At the end of the Official Speeches the Governor-General was given three hearty “Cheers”. We particularly thank the following members and wives/friends who came to wish us well and either march with us, or another Association, or to watch the proceedings, or meet us later at the Berkeley Hotel for lunch. Suresh BADAMI, Steve BALDICK, Warren BARNES, Fred BELL, Barry BRADSHAW, LTCOL Michael CAMPION, Bill CLUTTERBUCK, David COOPER, Alan CURRY, John and Peter de WITT, George HARRIS, Ray HYSLOP, Terry and Annette IRVINE, Anthony JORDAN, Jim JORDAN, Frank and Valerie LANG, Robert LOVE, Edwin LOWERY, Bill MOLLOY, Michael MORONEY, Barry O’KEEFE, BRIG Brian PEZZUTTI, John PHILLIPS and, David VERCO.(My sincere apologies if I have omitted your name) For those who possess a computer, the RF Day website has some wonderful footage of the Parade—go to; NEWCASTLE PARADE This was held on the Saturday prior to Sydney’s Parade. It is well conducted and it is a pity that more Associations don’t participate. The Lord Mayor, Alderman John Tate, has always been involved and encourages the organisers and participants. It was a very nice morning and the air was crisp, all the marchers “Formed Up” in front of the Art Gallery, which overlooks Civic Park where we were all going to march down to. We marched about 500 metres behind the Australian Army band—Newcastle and gave an “EYES RIGHT” to the Dignitaries, MAJGEN Warren GLENNY AO RFD ED (Rtd), Rear Admiral Peter Sinclair AC RAN (Rtd) and Lord Mayor Councillor, John Tate. There would have been about 200 present to hear the wonderful addresses given by the three main Dignitaries. I must commend the “Re-Enactment Group” for their bearing and dedication, they are a credit to the organisers. Our Association thanks the following members or friends who greeted us or marched with us. Mick CARLSON (1st Field Ambulance—he acted as our ASM), Alan CURRY (carried our Standard), George HARRIS (marched with his NSSA Contingent), Kevin HURRELL, Noel MOULDER (marched with his NSSA contingent), Barry O’KEEFE (marched with his NSSA Contingent), Barry and Heather PERIGO, John SMITH. After the march some of us went back to the Newcastle RSL for a lunch before heading back home. I thank Heather Perigo for taking some photos. ★★★★★ NEWCASTLE Reserve Forces Day. Photo shows Barry Perigo, Alan Curry, George Harris and Barry O'Keefe. Marching past the Saluting Dais (Newcastle). Alan Curry (carrying Standard) followed by L/R Barry Perigo and Mick Carlson (1 Fd Amb Assn) and behind them are Kevin Hurrell and John Smith OAM (partly obscured) L/R (Front) Noel Moulder, George Harris, Alan Curry, Barry O'Keefe. (Rear) Barry and Heather Perigo. Members of the Reserve Forces Re-Enactment Guard Another photo of the Re-Enactment Guard. On the Saluting Dais (L/R) MAJGEN Warren Glenny AO RFD ED (Rtd), Rear Admiral Peter Sinclair AC RAN (Rtd) and Lord Mayor of Newcastle, Councillor John Tate. 13 Capri Motel Hosts: Grant & Jo-Anne 207 Market Street Balranald NSW P: 03 5020 1201 F: 03 5020 1201 The Russell Sprout Fruit Market Top Quality Market Fresh Fruit & Vegetables Daily Open Monday to Saturday Saturday 7.30am to 6pm • Sunday 8am to 1pm 97a Russell Rd, New Lambton NSW (Opposite the IGA Car Park) Phone: (02) 4957 5116 Proud to support 5th Field Ambulance RAAMC Association Proud to support 5th Field Ambulance RAAMC Association Cafe 2340 “The Best Coffee in Tamworth” ALL FOOD IS HOMEMADE • Breakfast • Light Meals • Desserts • Cakes • Coffee Phone Orders / Catering Available Open Monday to Saturday 15B White Street, Tamworth NSW Phone: (02) 6766 9466 Proud to support 5th Field Ambulance RAAMC Association COMPLETE Cut Lawns & Garden • Lawn Mowing - Small & Large • All Aspects of Gardening • Pruning • Trimming • Shaping • Rubbish Removal • Pensioner Discounts Chris: 0413 306 444 Hunter Region & Surrounding Areas NSW Proud to support 5th Field Ambulance RAAMC Association Bayview Cafe A fine selection of delicious gourmet food, light meals, cold drinks and great coffee Dine in / Take Away Phone Orders / Catering Available OPEN 7 DAYS A WEEK Shop 2, Campbell Court, Vincentia, NSW Phone: (02) 4441 7077 Proud to support 5th Field Ambulance RAAMC Association RYE PARK KENNELS BLUE RIBBON ACCOMMODATION FOR CATS & DOGS • Safe & Secure Accommodation for Cats & Dogs • Luxury Suites – No Cages • Exercising • Individual Needs Catered for – Food & Activities • Day Care Available – 8am to 8pm (negotiable) “Rye Park” – Hall Street, Gilgai, NSW Phone: (02) 6723 1235 Proud to support 5th Field Ambulance RAAMC Association display your pride MEDALS DIRECT Replica Medals, Medal Mounting & Honour Board Framing David Carruthers Ph: 0414 691 898 Website: buymedalsdirect.com ABN 13 205 007 599 Jill Van Der Kooi CEO Head Office: Liverpool Office: 126 Gladstone Ave, Coniston 292 Bathurst St, Liverpool NSW 2170 PO BOX 6, Coniston NSW 2500 Liverpool NSW 1270 Ph: 02 4228 1200 Ph/Fax: 02 9600 9001 Fx: 02 4228 0165 or: 02 9600 6424 Proud to support 5th Field Ambulance RAAMC Association 14 Congratulations Our Association congratulates our member, Bill Thompson, who was recently acknowledged in a Government “Media Release” regarding the invaluable assistance that is given by employers and organisations in allowing their employees to render ADF Reserve Service. Bill, has been on the Defence Reserves Support Council ACT committee for a number of years and was now retiring, and the Parliamentary Secretary for Defence Support, Dr. Mike Kelly, gave Bill a glowing endorsement for all his efforts after many years of support to the Reserves, in a number of capacities. Dr. Kelly said… “Bill Thompson has done an incredible amount of work in supporting the Reserves. As a former Regular and Reserve soldier, Bill fought for their rights and for improvements in their conditions of service. Bill was, for many years, the ACTU representative on the Defence Reserves Support Council and, in later times, the Chair of the ACT Committee. During this time Bill demonstrated his commitment and ability to contribute in an ongoing and positive manner. He will be greatly missed.” Good on you, Bill, we hope you and Denise can now relax a little. ----------------------------- Our Association sincerely congratulates our good friend, Major John Straskye, on being a recipient of the “Order of Australia” Medal. John was named in the Queen’s Birthday Honours List in June for services, particularly to the Royal Australian Medical Corps. John lived in the Penrith district and attended Penrith High School. His service with the Australian Federal Police and with the Australian Defence Force has seen him serve in many parts of the world. He saw active service in Vietnam as a Rifle Company medical assistant and in this service he, along with his fellow medics, assisted many injured Australian soldiers. John served 21 years in the Regular Army before transferring to the Active Reserves in 1988. He has been the driving force behind setting up the Medical Corps web site, this included all the Medical Associations which have registered with John—a huge task to initially undertake, with the blessing of the Medical Corps. John is also the current (and inaugural) President of the RAAMC Association Inc. which is starting to take shape in every State of our nation. I previously emailed this good news to our members who are on email and I particularly thank our good member, John de Witt, for bringing it to my attention. WELL DONE, MAJ JOHN STRASKYE OAM, you deserve it. I am sure I echo these remarks on behalf of any of our members who know John. SICK PARADE John A’QUILINA, Neil BARRIE, Don BOOTH, Derek CANNON, Kevin CARTER, David CAVANAUGH, Barry COLLINS, John DAVIES, Vic (“Bluey”) DAVIS, John de WITT, George DONNELLY, Nelson FIORENTINO, Ray GRANT, Kevin HURRELL, Neville JOHNSON, Sir Keith JONES, Anthony JORDAN, Ted KREMER, Bob LEECH, Robert LOVE, Huss MAHOMET, “Roy” McDONALD, Rayda NOBLE, Charles O’MEALLY, Chris O’REILLY, Barry and Heather PERIGO, John PHILLIPS, Maurice PORTER (Hayfield Court, Baptist Community Village, Carlingford), Harley RODD, Sr. Elizabeth SHEARD, Rob STEWART, Brian TAMS, Peter (“Tommo”) THOMPSON, Sr. Francis (“Sue”) THOMPSON (Big Sister Hostel, Room 216, 2c Kanimbla Road, Miranda), Arthur WALTON, John WEAVER and John WOODHEAD. KIND ACKNOWLEDGEMENTS (Of monies received since last newsletter of June 2010. Please contact me if your name has been omitted.) • Derek CANNON (Cheque $20) for Name Badge. • Terry IRVINE (D/D $140) for Life Membership $100 and RAAMC Corps Tie $40. • Barry PERRIGO (Cash $50) for 2 Name Badges $40 and 2 Raffle Tickets for Sudan Painting $10. • John ROCHE (Cash $35) for Subs $15 and 4 Raffle Tickets for Sudan Painting $20. • John SMITH(Cash $20) for Subs $15 and 1 Raffle Ticket for Sudan Painting $5. • Alex WILLIAMS (D/D $100) for New Member/Life Member ship. • Worksmart-Interactive (Cheque $275) paid to 5th Fld Amb Assn instead of Statewide Publishing Pty Ltd. 15 MESSAGES FROM MEMBERS Joe GATTY enjoys reading our newsletters and recently wrote that he and his wife, Judy, have recently returned home after visiting their son, Glen, and his family, who are residing in England. Glen took Joe to re-visit some old Western Front battlefields in WW 1, and Joe wrote that no matter how many movies or books you read about the Western Front, and Joe has seen and read many, it did not prepare him for the journey he and Glen experienced when they visited northern France. Joe said his mind was cast back to those dreadful days, and months—that passed into years—that the soldiers had to endure, during that dreadful war. He said farmers were killed or injured, years after the WW 1 conflict was over, by ploughing over unexploded shells and bombs. This region was called the “iron harvest”! Joe included 4 photos of their experience. Photo on right shows a farm house that was used as a field hospital. Their guide said it was staffed by members of 5 Field Ambulance — it was used during one of the battles for Ypres. (The photo still shows the outline of the Red Cross on the wall of the building.) Photo on left shows the cemetery at “VC Corner”. The remains of over 240 killed at the battle of Fromelles on 19/20 July 1916 are beautifully kept here, by the locals. Photo on right shows “Cobber Corner”. The memorial depicts a “digger” being rescued by a comrade after he heard a voice saying… ”don’t leave me, cobber”! Photo on left shows “Pheasant’s Nest”. The buildings on the site are for the excavation of the lost soldiers of Fromelles, which are being re-buried, with dignity, in a beautiful new cemetery on the outskirts of the town. (I wrote about this from a Media Release—see “Items of Interest” 2 (D) in our December 2009 newsletter.) Joe asked to be remembered to all his friends in the Association. He and Judy have just celebrated their 40th Wedding Anniversary on the 9th May. When Joe is not out fishing (which he loves with a passion—rain, hail or shine) he spends a lot of his spare time with the Coast Guard, where he is a keen volunteer. He said they were called out to 125 “assists” in the last calendar year. (Good on you, Joe, and what a great milestone on your 40th W/A. Thank you for your letter and the details and photos of your trip.) ------------------------------ John ROCHE asked to pass on his good wishes to his friends in the Association. He was sorry he could not join us on ANZAC Day but did commemorate the day down his “neck of the woods” in Sutton Forest. John met his mates at Reservists’ Park , which is just down the road from his home, and their ANZAC Day March was about 100 metres. He said there would have been about 200 Marchers and the “Theme” was “The Nurses”. They listened to a “talk” from the local Historian, M/s Linda Emery, who told of the nurses who had gone to WW 1 from the Southern Highlands. John said he recalled a Miss Maurice, when he first came to live in Moss Vale—“She was one of them”. John said…”Later, our Laird of Sutton Forest produced a bottle of Scotch and we all drank to the health and memories of those nurses —and then one to our own.” (The Laird always throws the cork away before the “Toasts”!) John included a photo with an explanation of the photo grapher. John said he is an old friend and long time patient when he came off his motor bike many years ago. He is the local paper’s photographer and “snaps” photos at every opportunity, whether at a “Dinner” or on a tractor in a procession, or in an ANZAC March. The photo was taken in “Reservists Park” with a few of his mates. He said the one at the back of the photo is our “Padre” and he drives an “old car” with the words “The Truckies’ Chaplain” painted on it. The photo of the “Toast to the Nurses” was not available at this time, but John said he was so proud of …”Our Sr, “Sue” Thompson from 5 Field Ambulance and pass on my good wishes to her at Retirement Village in Miranda”. John enclosed some cuttings taken out of the Stamp Bulletin which included sets of stamps for sale on… The Bombing of Darwin in 1942, various Kokoda issues, Queen’s Birthday and items available from the Royal Australian Mint. (If any member is interested in these Stamps, please contact me and I will give you the information.) John also included a “simple set of rules” for ANZAC “Two-Up”—I will put these in this or another magazine when space permits. He was hoping to join us on RF Day but he was hosting a “Berrima Horse Trial” at his place and he was going to be the “gofer” i.e. gofer petrol, gofer ice, put up 5 flags on a flag pole, fill in a rabbit hole etc etc. He said it was a -4 degrees “frost” for the 290 horse competition. His wife, Kath, was kept busy (bad knee and all) in “Cafe` Araluen” (the canteen was in their own horse 16 trial shed) cooking bacon and egg rolls—they went through 38 dozen eggs!!! John also made contact with his, and our, our good friend Charles Murray (it was he who submitted the poems—“The Christ’s of Fromelles” (inadvertently shown as Chris Murray and sincere apologies) in our ANZAC Day Magazine 2010 (page 43) and “At the Shrine of Remembrance” 1914-1918, page 29 in our Reserve Forces Day Magazine 2010). He also informed me of a recent Medical (Educational) Seminar he attended at Macquarie University on the last weekend in June. John said there would have been about 300 in attendance. He “caught up” with a few from 5 Field Ambulance and other friends including Harding Burns, Frank Lang, Sir Keith Jones, Bob McInerney, John Overton, John’s brother James and Harry Learoyd. John included a “handwritten letter” from an old friend, Les Burnett and he mentioned a Dr. Belisario who was in John’s mother’s year in medicine and he went on to become a “doyen of skin specialists”. John feels that when you read Les Burnett’s letter some of our members will remember the names. John also spoke about Mick Susman (I wrote an article on his brother, Eric, in our APRIL 2009 Magazine) and said he was his wife’s (Kath) godfather. He also mentioned a Ben Jones who was a Pathologist from Prince Henry Hospital and he blood-grouped the whole of the 6th Division in between Christmas and the New Year, as their convoy was to leave Sydney in the New Year. Les had also told John that he played Bridge on Crete with (later Sir) Lorimer Dodds, Mick Susman and others—as they had no equipment for their CCS (it was left behind in Greece). They also sang “bawdy” versions of hymns! John mentioned about a “Gunner Peck”? when he was RMO at 5 Field Regiment at Marrickville (in Eastern Command Personnel Depot in Addison Road). It was part of 5 Brigade in 2 Division under the command of Brigadier John Broadbent (Dec.) and they also used the name of Gunner Peck because… we were “descendants of the 2/5th Field Regiment”—he enclosed the interesting story of “Gunner Peck” which I will place in this (or a future) magazine. He closed by writing that he now has to take a jar of “Peck’s Paste” to the North Head Artillery Museum… ”because they haven’t got one!” John has been kept busy “looking after” Kathy, after she had a bad fall a few weeks back, in June, and fractured her patella. (Thank you, John, for your letters and thoughts. Please pass on our good wishes to Kath as we wish her a speedy recovery. We look forward to “catching up” soon.) --------------------------- John PHILLIPS sends his good wishes to his friends in the Association and enjoys reading all the news. John, as many of our members are aware, is involved with the Battle for Australia Day Ceremony in that he is responsible for “looking after” the Fuzzy Wuzzy Angels on this day. He sent me a lot of information pertaining to this Commemorative Day and I am sure it is all our fervent hope that this Day will always be Commemorated and never be forgotten. The Governor-General (at the time), Philip Michael Jeffery, proclaimed (acting with the advice of the Federal Executive Council) on the 19 June 2008, that the FIRST Wednesday in SEPTEMBER be declared a NATIONAL DAY OF OBSERVANCE and be known as BATTLE FOR AUSTRALIA DAY. John kindly enclosed a number of pertinent leaflets relating to the war that came very close to the invasion of our mainland by the Japanese. Among the leaflets was a story on the Kokoda Memorial Project commenced by Rotary International and the RSL of Australia (I have included it in this magazine). He also enclosed some “clippings” from Peter Brune’s book “GONA’S GONE! The Battle for the Beach-head 1942”. I haven’t read Peter’s book but it seems like one to read. Another article was on the Kokoda “Track” or “Trail” controversy. I did write a small piece in our Newsletter of Christmas 2005 (Page 23) regarding the term “Track” or “Trail” and I followed this up with a very interesting reply from our good member, Dr. Phillip Yuile, in our ANZAC Day Newsletter of 2006. (Thank you, John, for all your information. We look forward to greeting you and our PNG representatives on the first Wednesday in September in Martin Place.) ----------------------------- George HARRIS enjoys reading our magazines and passes on his good wishes to his friends in the Association. He wrote to tell me of the memorable tour he went on in April this year. It was a Historic Military Tour of Belgium and France, with the main purpose of commemorating ANZAC Day at the Menin Gates and to visit some of the major battle fields of the Western Front during WW 1. He had a wonderful group to “tour” with and one in particular who came to mind was a lady by the name of Leith MacMillan. Leith is a director of “Day Hospital Consulting” , a company which is based in Queensland, and it was probably because of her medical background and the fact that George was a member of a medical unit, that they struck up a good friendship. George said he could tell how interested she was in reading all the history and the visits to the war cemeteries. There was a genuine feeling of humility and sincerity about her that seemed to permeate those on tour with her. George has adopted Leith to 5 Field Ambulance Association and he is hoping he can persuade her to join us as an Associate Member. He is hopeful that she can meet us one ANZAC Day march, if she is able to make it down south from her home State. George sent a photo of some of the group taken in front of the 2 Division Monument. (Leith and George are on the right of the photo) 17 (The plaque on the Monument reads…) and I know that these men will fight alongside of us again until the cause for which we are all fighting is safe for us and for our children.” French Prime Minister—Georges Clemenceau. JULY 1918. (Thank you, George, for your letter and resume` of your trip. Leith would be a most welcome Member.) -------------------------- Terry IRVINE enjoys reading all our news and sent me an email to say he and his wife, Annette, were planning to come to Sydney to join us on Reserve Forces Day. Terry has now “semi-retired” having sold their pharmacy at Cobargo but is planning to obtain an extra pharmacy qualification that will allow him to enter people’s homes and perform Home Medicine Reviews. They recently returned from a trip where they visited Darwin, Jakarta, Singapore and Tasmania. Terry and Annette did attend the RF Day Parade and Terry appreciated the RAAMC Tie I brought with me for him to wear. He emailed recently to say what a lovely time they had in our company and with the camaraderie afterwards at the lunch in the Berkeley Hotel. (Thank you, Terry and Annette, for making the journey from the South Coast to be with us. Your presence was much appreciated. Our Association also thanks you for your generous donation of Life Membership.) --------------------------- John McKEOWN was saddened to read about the death of Ray Harrington and wrote to me that he was a good friend of Ray and was sorry he did not attend his funeral. He asked that his condolences be passed on to Pattie and her family. John and Ray served together at 1 General Hospital where Ray was the QM and John was the pharmacist. John said they worked closely together on the logistics for the unit and were always heavily involved in planning for week-end activities and annual camps. John said past members of the unit will all remember Ray and will probably have particular memories of AFX 85, held in Uffington State Forest, near Clarencetown, when LTCOL Michael Dally was the acting CO. John, along with Ray and Scotty Boyd (?) and a few others were nearly tearing their hair out trying to organise the camp “extraction plan”. (John thinks LTCOL Dally learned a few lessons from this exercise). The following year, at Captain’s Flat, he was far more effective as acting CO. A few of his senior Officers and NCO’s (who shall remain nameless) caused him some grief when they “stirred up” the unit, by driving onto the site with a siren blaring, as they returned from a visit with the Director of the National Disaster Organisation in Canberra. Their idea was to see how the unit would react to an unannounced casualty arriving, but what they did not know was that the RSM of the Army was on site. He was not impressed and said so. Officially, the unit personnel reacted professionally… exactly as expected. The photo above was taken during an amphibious deployment exercise on Broken Bay and Coal and Candle Creek in October 1984. It shows Ray, Scotty Boyd and Chris DeLuca. John said this exercise was a bit of a shock for some of the 1 General Hospital personnel because the new CO, LTCOL John Vonwiller (Dec.) set himself up in a “hoochie” for the weekend. At that time, wrote John, sleeping in “hoochies” was almost unheard of for hospital staff…Things were soon to change! During this exercise, John’s son and some of his mates from St Aloysius College acted as casualties. They thoroughly enjoyed the “sail” in the LCM 8. (Thank you, John, for your personal insight into some of the time you spent with Ray. Pattie will enjoy reading this little “snippet” and some of our readers will have their memories jogged.) --------------------------- Steve BALDICK wrote to pass on his good wishes to his friends in the Association. He sent me some “nostalgic” photos and a copy of his National Service Magazine for the 13th NS 6th Intake. Steve was in the 2nd Intake of 1953. Two of the photos show the Guard at the main entrance to Balikpapan Barracks and then the troops marching in. Did you “spot the error”? Steve remembers that “D” Company had “mounted the Guard” and had been supervised for some time by the Battalion RSM with “’shunning” and “’unshunning” , “Slope Arms”, “Present Arms”, “Order Arms” ad infinitum—right down to the smallest detail. The Battalion photographer arrived to record the “big” moment as the troops were “forming up” nearby. The Guard was ordered—“PRESENT ARMS” –then it hit the fan! The photographer said that as the troops were marching through at “The Slope” it would “neater” and “more regular” if the Guard was also at “The Slope”? A blazing row then erupted; the RSM (who could have been heard at Liverpool Town Hall) advised them in words of one syllable that the correct drill was “THE PRESENT”. The shouting to and fro got louder. 18 The order of “QUICK MARCH” was heard and tramping feet were getting closer. We (the Guard) stood transfixed! The Armed troops rounded the corner in clear sight! At the last minute “neat and regular” won the day—the Guard “SLOPED ARMS”. The RSM, crimson of face and fury, stalked off and the photo was taken. Although it was 57 years ago, Steve remembers it as though it was yesterday because he was the Sentry at the Guard Box on the right of the photo. The other photo is Steve’s 13th Platoon “D” Company and to save you trying to work out which one is Steve—he is in the 4th Row and 2nd from the Left. The group Sergeant’s photo was taken at Moore Park Barracks about 1955 and shows; Front Row (L/R): Barry Collins, Len Boothman, Gerry Clinch, Steve Baldick and Dave Williams. Back Row (L/R): Dave Parsons, John Graham, Jim Zorbas and ?? (who is this please). (Thank you, Steve, for your letter and photos. I have sent copies to the NS Association for their newsletters.) -------------------------- Rayda NOBLE wrote to pass on her sincere thanks for the article we wrote about her friend’s son, Bradleigh Marshall (June 2010 Magazine, page 17). She gave the article to his mum, Christine, so she can pass it on the Bradleigh. Rayda said our soldiers in Afghanistan and Iraq need to read that their efforts are appreciated (and which they most certainly are). Rayda is endeavouring to have the descendants of the “Rats of Tobruk” Association (Vic. Branch) be allowed to become “Associate Members”. She was “forwarded” an email (about “Suicide Bombers”) from a friend who is the son of a “Rat of Tobruk”—he never got to meet his dad because he was killed in action in PNG in the New Guinea campaign. She said her friend gets his dad’s Banner out each ANZAC Day and, together with his two sons, they proudly march in memory of his dad and their grandfather. Rayda enclosed a “clipping” from the Cairns Post newspaper (29/5/10) depicting three widows (and herself) of three deceased “Rats of Tobruk” (Mrs Ivy Williams, Mrs Dorothy Moody and Mrs Thora Gardiner). The picture shows them all holding a “hand made” flag and one of the 350 Medals from the “Siege”. They all had lunch at the David Williams Memorial Park at Trinity Park. The park was named after Ivy’s late husband, David. (Thank you, Rayda, for all your letters and emails. I think the idea of trying to start an “Association” of the descendants is a very commendable one and our Association wishes you “Good Luck” and hopes it comes to fruition.) --------------------------- Peter PAISLEY passes on his good wishes to his friends in the Association. He sent me an email and asked me to correct a “misunderstanding” regarding what I had written in relation Duntroon and “Micscape” (an “on-line” magazine). Peter said Micscape had probably never heard of Duntroon and would be astonished to read an article about it. He did say might write an appropriate article about the retired head of the Psych. Corps—Arthur Craig—and how he and Arthur’s budgerigar saved them both from a Court Marshall, when they were living in the Duntroon Mess. Then again, wrote Peter, an equally astonishing article could be written on the military aspects of “old microscope slides”! (Thank you, Peter, for your follow-up email. I do apologise if I have misled our readers, or Micscape, regarding what I wrote in our last issue (June 2010, p 17.) ------------------------- Laurie FARRUGIA sends his kind regards to his friends in the Association and enjoys reading all the news. He has written to advise us that he is embarking on a “sea-change” of employment and location. His job with Sai- Global Ltd will see him and his family transferred to Queensland. He is doubtful when the occasion will arise for him to see his old friends from the Association. Laurie’s new address from early September 2010 will be: 12 Matipo Pl., Palm Beach QLD 4221. (Thank you, Laurie, for your email. We, your friends in the Association, wish you and your family all the very best –both with your job and your new location. Those of us who know you, know you will do good.) ------------------------- Ruth VAUDIN (nee Corbet) wrote to say she enjoys reading all the news and to pass on her good wishes to all her friends in the Association. As all of Ruth’s friends know, she and her husband, Ian, and their family reside on the Isle of Guernsey in the Channel Islands (I wrote an article about Ruth and her family and where they live, in our ……. newsletter of p???). Ruth and Ian and their two daughters, Erin 6 and Millie 4 are, all well and enjoyed their summertime in Guernsey. Ruth said it is a busy time, with the school holidays due to start and then Millie will start her schooling in September. There have been sports days, assemblies, graduation parties, “dress-up” days, outings and a whole lot of “fun things” happening at school and kindergarten. Ruth said the whether has also been great which has seen them out fishing in Ruth’s boss’s small fishing boat – not catching much with the rods but his crab and lobster pots yielded a nice meal! Ruth said that with the good whether, the children have enjoyed the beach and also the bar-b-q’s are going good. 19 At the time of writing (mid July), Ruth said the family intended going over to the Isle of Sark for the day “to take the kids to see sheep racing”. (Ruth put a website for our readers with access to the internet –). After this adventure they will all be going on a fortnight’s holiday when they will take their car on the ferry to St Malo in France and then driving down to Spain to visit Ian’s parents, who own a “holiday house” there. (Thank you, Ruth, for your welcome e-mail. We wish you, Ian and the girls a very happy and safe holiday in Spain and hope to read what your impressions were, in due course). ------------------------------ Bruce WHITTET sent me a “return email” to a message I sent to all our email members regarding articles etc required for the Victorian Branch of the RAAMC Association Inc. (See “Items of Interest”—RAAMC Association Inc. Vic Branch.) Bruce said that years ago when he was at HMAS Penguin “they” had an internal newsletter, which originated by “us rogues” in Pathology, called “KAOMAG”. He said it turned out to be real “knock-out” magazine which listed events, happenings and personal columns. Bruce said their superiors congratulated them but in the end had “it” banned as some articles could have been called as “contrary to the good order and naval discipline” but, wrote Bruce, we had fun anyway and no one ended up being “Charged” despite being threatened. In those days, wrote Bruce, we thought Officers had no sense of humour (“Oh, how times change” he said). The name was quite original as Kaomagma was given as a treatment for the shits, diarrhoea and associated bowel problems. (Good on you, Bruce, and thank you for that little “snippet”— perhaps you might have a suggestion for Kevin “Bat” Andrews.) NEW MEMBER Alex WILLIAMS is warmly welcomed to our Association. He is a good friend of our President, Derek Cannon, Stu’ Jones and Fred Bell to name a few. Alex was an OC of 2 Prev Med Coy as well as service with 5 Field Ambulance and 8 Field Ambulance. His service in the Reserves spans some 20 years. Alex is employed by the pharmaceutical company — Scherin-Plough — as the Site Service Support Manager in the Animal and Health Division. He is a very contented husband, father and grandfather and enjoys his game of golf. I thank Alex for a small insight into his life and we look forward to meeting Alex in the not too distant future. I take this opportunity to thank Alex, on behalf of our Association, for his Life Membership donation. MORWELL SPRINGS AND SUSPENSION THE SUSPENSION SPECIALISTS Est Since 1979 Leaf Spring Reconditioning & Manufacturing Everything from minor repairs to performance rebuilds any make, any model, all work guaranteed & where good advice is free 52 Commercial Road, Morwell VIC 3840 Phone: (03) 5134 8999 Fax: (03) 5134 2569 Proud to support 5th Field Ambulance RAAMC Association Building PLANS ➣ Residential & Commercial ➣ New/Renovations/Additions ➣ Specifications & Documentation ➣ BASIX Certification Wagga Wagga NSW Ph: 0404 481 847 or 6922 4299 or at: finaldraft@bdansw.com.au and Proud to support 5th Field Ambulance RAAMC Association Our Motto ~ "ALWAYS READY" (SEMPER PARATUS) Courtesy--Major Eileen Henderson. N J Thompson Carpet Layers Murray Bridge SA 5253 Mobile: 0419 851 892 Proud to support 5th Field Ambulance RAAMC Association • Domestic • Commercial • Industrial • Homes • Offices • Medial Centres • Pubs & Clubs • Factories • Showrooms • Shops • Mowing & Garden Makeovers NO JOB TOO SMALL - FREE QUOTES George: 0449 261 115 Wetherill Park & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association 20 5 CSSB Health Company NEWS I thank the CO of 5 CSSB, LTCOL Phillip Moses, for allowing the Training SGT of the Health Company, SGT David Grace, to send us an “UPDATE” from the last magazine. SGT Grace wrote that June and July were busy months for the members of the Health Company. The unit conducted a CATA (Combined Arms Training Activity) at Singleton Camp, which was very successful. The unit also had the opportunity to put the whole of the Company in the field and support a “Brigade activity”. The unit had RESUS, a Field RAP, Dental, Psych, Environmental Health and a Medium Dependency Unit (MDU). On a personal note, PTE Peggy McGlashan was promoted to Corporal. She is also a part of the Psych Support Team. (Congratulations, Peggy, from the members of our Association.) SGT Grace said the second half of the year looks like being as busy as the first. (I thank SGT Grace for the “update”. If any reader of this section is interested in joining the reserves and being part of this very good Company, please contact either the RSM of the unit, WO 1 Geoff Frew on (02) 9316.0132, or the Training Sergeant of the Health Company, SGT David Grace on (02) 9316.0190) PLEASE – JUST STAY (With kind thanks to member, James Jordan—by email) A nurse took a tired, anxious serviceman to a hospital bedside….”your son is here” she whispered to the sick old man in the bed. She had to repeat the words several times before the patient’s eyes slowly encourage - ment. a while. the nurse would hear the soldier outside the room. Finally, she returned. She started to offer words of sympathy but the soldier interrupted her. “Who was that man”? he asked. ”He was your father.” She answered. “No, he wasn’t, said the soldier, I’ve never seen him before in my life!” “Then why didn’t you say something to me when I first took you to him?” said the nurse. The soldier replied…”I knew right away there had been some mistake but I also knew he needed his son, and his son just wasn’t here. When I realised that he was too sick to tell whether or not I was his son, knowing how much he needed me, I stayed. I came here to find a Mr. William Grey. His son was killed in Iraq yesterday and I was sent here to inform him. What was this gentleman’s name?” The nurse, with tears in her eyes, replied…”Mr. William Grey.” The next time someone needs you---just be there----stay. 21 The Kokoda Memorial Project (with kind thanks for this edited article from COL John Phillips OAM – Chairman, Rotary/RSL Kokoda Memorial Committee) The Rotary International/RSL commenced the Kokoda Memorial Project in March 1995 with the erection of the first Aid Post (AP) at Buna and a Memorial Cairn built by a team from Gosford North (NSW). It was officially opened on 7th July 1995. On the 16th September 1995, Prime Minister Paul Keating officially opened the Kokoda Memorial Hospital. This was the flagship of the project. It was a 24 bed hospital and fully completed in December 1995, with the first patients being admitted in February 1996. Over 300 Rotarian volunteers contributed to this project. Only one Kokoda veteran was present at the official Opening Ceremony and later in September 1995 another Central Coast (NSW) team built a 3rd AP at Sairope Village, about 8kms off the Popondetta/ Kokoda Road on the slopes of Mt. Lamington. The village people were delighted. It was officially opened in March 1996. In May 1996, a Rotary Club team, mainly from Mosman (Sydney area) built another AP at Kebara Village. In August 1996, a 5th AP was built at Hanau Village, home of the famous Fuzzy, Wuzzy Angel, Raphael Oembari OBE, who sadly, had passed away the previous month. This AP will be a fitting Memorial to him and his fellow Fuzzy Wuzzy’s. Saturday, November 2nd 1996, was an appropriate Anniversary of the John Phillips and Benjamin Ijumi at Raphael Oembaris’ grave near Hanau Village. re-taking of Kokoda in 1942 to commemorate and dedicate the Kebara AP. Mach 1997 saw the refurbishment and upgrading of the Gona Health Centre. This was a joint initiative of the 12th Battalion and other ex-Service units. It included a Memorial Cairn to commemorate those killed in the battle for Gona. The work was undertaken by a team of 8 volunteers from the Central Coast and Galston (NSW) areas, and this saw the Hanau AP also completed with the “Opening” held on the 5th September. This was the time where 12 veterans, aged between 75 and 86 years of age (our own Neil Barrie was among these veterans) made a special pilgrimage to PNG for the occasion. They represented their comrades who had supported the Gona Memo - rial Medical Centre and Cairn Project. They also visited Kokoda, Buna and Sanananda and on each occasion were warmly welcomed in the traditional manner and given special recognition. The Gona and Buna facilities and Memorials are a fitting tribute and a significant recognition of the bloody battles fought there and at Sana - nanda, which saw the end of the momentous Kokoda Campaign. 1998 saw a year of challenge especially involving the Asafa AP. The plan to link Asafa with Bagou AP which is near Soputo, Gewoto (the site of Huggins Road block) and Cape Killerton – all had close association with the Sanananda Battle (Nov. ’42 – Jan. ’43). The teams from the Central Coast and Galston Rotary Club also assisted the Asafa team. The teams lived with the village people and shared their simple accommodation, food and lifestyle. They mixed freely with young and old and worked alongside each other – a most rewarding experience for the Rotarians and the PNG peoples. The Asafa Project was a big project, logistics wise, because it is a 12 ½ klms trek from Sairope, rising to 1000ft and crossing three streams with near vertical sections! Due to the difficulties of the Caribou take-offs and landings, only four loads could be delivered. Villagers had to haul two truck loads (approx. 2 ton each) the 12 ½ klms, this allowed the Asafa AP to be completed to lock-up stage. Bulky items like rainwater tanks and sink units had to be delayed until a later date. Later, in April 1999, the Gosford team of 3, who had worked in the previous year, went back to Asafa AP to complete the installation of the rainwater tanks. July 1999 saw the “Opening Dedication” of Asafa and Bagou AP’s, as well as another wing of the Kokoda Hospital, now making this a 40 bed hospital. With “leftover funds” a new library was built for the Kokoda Primary School. This brought the total of Aid Posts built to 7, plus the Gona Health Centre and the 2 Memorial Cairns. Another AP was built at Kagi Village, on the “Track” in September 1999. This AP, together with those previously built at Menari and Sogeri are all in the Central Province and, like the Kokoda Hospital, have been funded by the Australian Government. In 2000, a commitment was made to build an AP in Wairope Village, on the Kumusi River. Investigations were also undertaken about the possibilities for an AP to service the villages of Isurava and Alola and also Abuari on the eastern side of Eora Creek. A further trek was taken to Hagutava Village, which is part of a separate clan known as Upper Biage. In July 2001, a team of 10 Rotarians from Galston, Gosford, Tamworth and Forster/Tuncurry built the Wairope AP and then down to Buna AP for some repair work. In March 2002, agreement was achieved to have Abuari as the location for the AP and school, as the only access was by foot or helicopter. 22 John Phillips on the track to Isurava village Planning was undertaken for August 2002 for a suspension bridge to give permanent access to the 4 villages of the Isurava/Alola areas, 2 on either side of the Eora Creek valley. A new Isurava Memorial was also unveiled by the then Prime Minister John Howard and Sir Michael Somare. Back in Popondetta, an opto met - rical team of two conducted 8 clinics at the Kokoda Hospital and village AP’s. They attended over 600 patients and dispensed over 500 pairs of glasses. 2003 saw further planning for the Upper Biage AP and school. The twobridge site inspected in 2002 saw a new bridge site which resulted in only having to cross one stream. In late 2004, the Australian Army’s 5th Aviation Regt. carried out a high altitude exercise to Abuari and with the help from volunteers from Tun - curry/Wingham Rotary and the locals, loaded and unloaded stores and equipment. Some was stores for later use and others were arduously carried 4-5 hours hard trekking and climbing to some 3500ft. 2005 saw a Rotary team from Tumbarumba start construction in Abuari. These were followed by teams from Taree, Kincumber and Wingham and by June, two buildings were basically completed. A final team went back in October to “tidy-up” a few minor matters and to be present at the Opening and Dedication of the two buildings. So far, the Rotary/RSL Kokoda Memorial Project has seen 12 Aid Posts, the Kokoda Hospital, the upgrade of the Gona Health Centre and two Memorial Cairns constructed as “Living Memorials to the Australians and Papua New Guineans” who fought and died defending their countries during these momentous days of WW 2 in 1942 and 1943 – Today these facilities serve the children and grand children of those brave men. 2006 saw a survey team visit all AP’s to assess maintenance needs with much needed repair work started in November. In 2007, a “team” carried out repair work on water tanks, guttering and installed new LED strip lights. A survey was also made of the partially completed Health Centre at Ioma District HQ. This is a well-populated area and accessed after a 2 hour banana boat trip up the coast from Gona and then a 3 hour trip up the Mambare River. This area also possesses an overgrown and unused airstrip. In November, Cyclone Guba unleashed 12ft of rain in six days causing incredible damage in Oro Province. All the major bridges over the Kumusi River including Double Cross and Girua were completely destroyed. Over 200 village people were drowned, with villages and gardens washed away and destroyed. Amazingly, although some medical facilities were affected, no Rotary AP’s were lost. Over 60 schools were either damaged or destroyed. In 2008 in April, a team of ten was led by Mr Harley Newham, a past president of Rotary and one of the volunteers who had been to PNG on many occasions. They finished much needed work, left unfinished by con - tractors in the mid 1990’s, to the Ioma Health Centre. Harvey travelled by banana boat from Popondetta/Gona with the PNG Health Adviser, Mr Copland Ihove. The team transformed the Health Centre from basically one functioning room to a completed unit serving the community. In November, a team of Rotary volunteers from Newcastle and led by a past president Mr Tony Rhodes spent several days at Embogo undertaking urgent repairs including plumbing and painting and general clean-up work. $7,000 of Rotary funds was spent on materials. When the team returned back home, arrangements were made for replacement of water tanks, a generator and pump as well as books, writing material and school desks. A survey conducted in June 2009 with a detailed submission to the Australian Government for a request for funding of $3-4 million be made to Rotary/RSL has not yet been successful. There are still over 50 schools in need of urgent attention. There are four high schools in the Oro Province and two, Embogo and Bareji, are still in urgent need of attention in the aftermath of Cyclone Guba in late 2007. 2010 saw these items packed into shipping containers through the Rotary Ranfurley Organisation and were available for the 2010 school year. The challenge facing Rotary/RSL is funding to achieve school restoration in the Oro Province. Funding from any source is greatly appreciated to rebuild damaged AP’s, schools and health centres. It is a rather sad indictment of organisations, especially our Federal Governments, that after three years since the tragic loss of life and the destruction of many villages, schools, health centres etc, to see villagers still living in “care centres”. Remember, these people are direct descendants of those very caring Fuzzy Wuzzy Angels who cared for our soldiers and saved very many lives during the Kokoda campaign in WW 2. In saying the above, we do thank the Australian and PNG Governments for all the assistance given to date, we also thank the invaluable assistance given by the ADF in various forms, and also the unstinting time given by the various Rotary groups volunteers who also pay for all their own expenses including air fares and transit accom - modation. Are you able to help? Either financially or practically? Please call either past Presidents – John Phillips (h) (02) 4324.4904 (wk) (02) 4325.2365 or Ray Southeren (02) 4365.1922 (mob) 0418.409.509 Your assistance will be greatly appreciated. ----------------------------- 23 Items of Interest (1) Media Releases (With kind thanks to the Dept. of Defence— edited for space and in no particular date order.) (A) Establishment of Mental Health, Psychology and Rehabilitation Branch: The Government announced in February 2010, the appointment of Mr David Morton as the ADF’s Director General of Mental Health, Psychology and Rehabilitation. This appointment comes as a result of a study on mental health by Professor David Dunt. The Government will support Defence with an additional $83 million over the next four years to implement recommendations. Mr Morton has done previous work with the Department of Veteran Affairs and Veterans and Veteran’s Families Counselling Service and will work with Joint Health Command. The ADF’s Surgeon General and Chief of Joint Health Command, MAJGEN Paul Alexander said…..”defence is bringing the concept of health and wellbeing together as a complete package and it is critical to understand that physical and emotional injuries require support to mend long-after visible scars are healed. This is vital for the ADF to meet our commitment to providing best practice health care. The success of our rehabilitation program is remarkable – last year 87% of all personnel who undertook rehabilitation returned to duties. One of the major aims of the ADF’s Mental Health Strategy is to de-stigmatise mental health problems and to en - courage our personnel to come forward for treat ment, sooner rather than later. Early treatment is one of the keys to successful treatment. David will work with me and the rest of the Command to make sure those who are diagnosed with injury, including mental health conditions, access the extensive rehabilitation programs available”. The Government (Mr Greg Combet) said the ADF has one of the largest workplace mental health support systems in Australia, with a range of mental health and counselling services available to ADF personnel. ----------------------------- (B) Operation Astute -- Townsville Soldiers return from East Timor 72 soldiers from the Townsville based 2nd Bn RAR. returned home in February after a successful deployment to East Timor as part of Operation Astute. That same afternoon the first group of 78 soldiers from 8/9th Bn RAR, which is based in Brisbane, arrived in Dili – the capital of East Timor. Over the coming weeks, a further 180 soldiers serving in the ISF (International Stabilisation Force) will return back to Australia. They will be replaced by more groups from the 8/9th Bn. The deployments are seeing more improved security conditions and the soldiers are performing fewer direct security tasks but with increasing focus on the capacity-building and training of the East Timorese Defence Force. The capacity-building activities include military skills training such as First Aid and Communications, Military Police work and community-based construction projects – all to do with the East Timorese Defence Force. The rotation of deployments also coincides with a further reduction of troop numbers for Operation Astute. The numbers of troops involved in this Operation was 650 in December and now it is down to 400. The ISF is comprised of Defence Forces members from Australia and New Zealand and operates at the request of the Government of East Timor and the United Nations. The Minister of Defence (Senator John Faulkner) welcomed and congratulated the returning troops on the success of their mission and applauded the work they carried out in assisting one of Australia’s closest neighbours. --------------------------------- (C) DEFENCE HONOURS AND AWARDS TRIBUNAL (i) --Is to inquire into “Recognition of Service with the Commonwealth Monitoring Force—RHODESIA 1979-80”. This Service is currently recognised with the Rhodesia Medal but a number of people have raised the issue of Australian recognition for this service. SUBMISSIONS will CLOSE 13 August 2010, if applicable, please write to; Defence Honours and Awards Tribunal, Locked Bag 7765, Canberra Business Centre, ACT 2610. (ii) --Is to inquire “Recognition of Service with the Task Group Medical Support Element during the Gulf War—1990-91”. This Service is currently recognised with the Australian Service Medal with Clasp “Kuwait”. The issue of recognition by way of the Australian Active Service Medal has been raised with the Government and the Tribunal. SUBMISSIONS will CLOSE 23 August 2010, if applicable, please write to: (As Above (i) ) (iii) –inquired into the recognition for members of the ADF for service in PNG after 1975. The Report recommended…”That no general medallic recognition should be given to ADF members who served in PNG after 16 September 1975.” (iv) –is inquiring into the recognition of service with Rifle Company Butterworth, 1970-89. Service is currently recognised with the Australian Service Medal 1945-75 and Australian Service Medal with Clasp “SE Asia”. A number of people have raised with the Government and the Tribunal, the issue of additional recognition Company Butterworth. Submissions closed on 7 June 2010. for Service with Rifle 24 (D) RIMPAC 10 Stands for “EXERCISE Rim-of-the-Pacific” and will test the interoperability with the 14 Pacific Rim Nations, which will include the US, South Korea, Indonesia and Canada. This year marks the 22nd RIMPAC and will commence late June/early July. Our participation will include HMAS Kanimbla, Newcastle and Warramunga; Navy Clearance Divers; Soldiers from the Townsville-based 2nd Bn RAR; Members of 11 Squadron and 92 Wing RAAF Base in Edinburgh, SA. The Commander of the Australian contingent, Commodore Stuart Mayer said…”The biannual Exercise will be the ultimate test of how we operate with our Pacific Partners. This is an exciting new capability the ADF is taking on, and the Navy, Army and Air Force will have a role to play.” This Exercise will see the last of the Navy’s 817 Sea King Squadron as they are due to be decommissioned in 2011. RIMPAC 10 will conclude on the 1st August 2010. --------------------------------- (E) REPUBLIC OF KOREA JOINS ISAF The Chief of the Defence Force, Air Chief Marshall Angus Houston, has acknowledged that the NATO Secretary General has formally welcomed the Republic of Korea (ROK) as the 46th contributor to the International Security Assistance Force (ISAF) in Afghanistan. The ROK is now officially recognised as a non-NATO ISAF Contributing Nation. The ROK will now deploy a Provincial Reconstruction Team to Parwan Province, consisting of 50-70 civilians, 30-50 Police Officers and 200-400 Infantry Troops. The troops will be tasked with the protection of the PRT and will not play a combat role. Australia has 1550 troops deployed in Afghanistan and is the largest non-NATO Contributor to the ISAF Mission in Afghanistan. The military contribution is part of a whole-of- Government effort to; * deny Afghanistan as a training ground and operating base for global terrorist organisations; * stabilise the Nation through a combination of military, police and civilian efforts; * and to train the Afghan National Security Forces to a level where they can take security responsibility for Oruzgan Province themselves. ------------------------------------ (F) COMBINED TASK FORCE 635 DONATE TO SALI SCHOOL The Regional Assistance Mission to the Solomon Islands (RAMSI) has been boosted with an invaluable donation to the Ria Sali Primary School. Rosalie Primary School in Perth, WA, formed a special relationship with Ria Sali Primary School in 2007 with students, teachers and parents in helping to raise money and awareness. Ria Sali is deep in the tropical jungle, an hour from Honiara. Some students have to walk for 2 hours just to get an education. When CTF 635 CO, LTCOL David Thompson and Rosalie Primary School Principal, Sue Goddard, presented the Ria Sali school staff and students with stationery, 10 lap top computers as well as a monetary donation, the School Principal of Ria Sali, Karel Kennedy, said… “There are no words to express how thankful we are towards what you have done for us. To the Principal and Dave Thompson and all of you who have helped our school, we much appreciate it.” LTCOL Thompson said… ”there was a personal satisfaction in giving to the school, and to see the faces of the kids that have so little, and to give them a few gifts, can make their day, their week and potentially, their future.” Sue Goddard said…”It’s been a good two years that the children of Rosalie have been hearing about the needs of Sali school children and doing their best to support them as best they can. I can go back now and share my experience with Rosalie and re-assure them that their efforts and money is being put to good use.” The relationship between CTF and learning facilities in the Solomon Islands strengthen ties between Military Personnel and the Community. --------------------------- (G) ANZAC DAY 2010 IN GIZAB A few days before ANZAC Day, the CO of the Special Operations Task Group, (name withheld) responded to a call for help from community leaders in the remote Oruzgan town of Gizab, after locals staged an uprising against Taliban using the area as a safe haven. After concluding a successful battle to rescue the town from the Taliban, the CO of the SOTG, addressed his troops at the Dawn Service in the town of Gizab in Oruzgan Province. He said…”It was a proud moment for Australian soldiers to conduct an ANZAC Service on the battlefields just as their forefathers did 95 years ago. To be standing on ground recently taken from the enemy by Australian soldiers supporting local Afghans, who have risen against the Taliban, is a great privilege. What.” Some days after ANZAC Day,. ----------------------------- (H AUSTRALIA COMPLETES PARTNERSHIP MISSION IN VIETNAM 22 ADF Members have completed (mid June) a 2 week Humanitarian Assistance Mission (known as PP 10—which is a US-led Pacific Partnership) in Quy Nhon, Vietnam. 25 (I) They were part of a 900 strong team led by the USN Mission Commander, Commodore Lisa Franchetti, aboard the USNS Mercy. The annual US Pacific Fleet sponsored humanitarian mission has given the ADF personnel a unique opportunity to work alongside US Military personnel, partner nations, host nation civilians and nongovernment organisations. A Navy Ophthalmologist conducted 13 eye-saving cataract surgeries and an Army Medical Officer provided medical care to approximately 300 patients in conjunction with Defence Nurses, in the conduct of 132 operations aboard the ship. An Australian Army Dentist (born in Vietnam and moved to Australia at age 2) provided dental care to hundreds of patients at various clinics in the Binh Dinh Province, Vietnam. As well, Australian Army Engineers from the 2nd Combat Engineer Regiment, based in Brisbane, contributed to the re-construction of a school for disabled children; fitting electrical and plumbing services as well as assisting local Vietnamese contractors improve the aesthetics of the building. Commodore Franchetti said she…”was very proud of the efforts of the entire ADF team as they very much contributed to the success of the mission in Vietnam and was grateful for all their assistance.” The Commander of the Australian National Command Element, LTCOL Helen Murphy said…”The chance to work with so many different military personnel was a unique experience and all 22 Australians have enjoyed the opportunity to work alongside the US military personnel and the personnel from the other five partner nations. Each ADF member has been integrated into the multi-national teams and the personal and professional development is already evident, after only 2 weeks.” This year PP 10 will also visit Cambodia, Indonesia and East Timor. For the first time since the inception of the mission, HMAS Tobruk will be used as the Command platform when the mission visits PNG. As well, HMAS Labuan and Brunei (Two Heavy Landing Craft), will provide “ship to shore” support in Indonesia, East Timor and PNG. -------------------------------- ROBOT (MAGIC) CHALLENGE—FINALS RACE (See also June 2010, P 22) Out of 23 teams from 5 countries, the FINAL 6 have now been chosen to develop fully autonomous robots that could undertake dangerous missions on future battlefields. (The term MAGIC is derived from; Multi-Autonomous Ground Robot) The six remaining teams are from Cappadocia (Turkey), Chiba (Japan), Magician (Australia), RASR (USA), Team Michigan (USA) and the University of Pennsylvania (USA). The Teams now have a few more months to “fine tune” their concepts for the Grand Final Challenge. They are required to field at least 3 robots and accomplish a complex task involving mapping and identification of threats while demonstrating a high level of autonomy between the robots. Australia’s Acting Chief Defence Scientist, Dr. William Harch, said…”We want to move from the current (J) paradigm of “one man-one robot” to one man and many robots.” --------------------------- EXERCISE PITCH BLACK This is the RAAF’s largest and most complex air exercise that enables the ADF to train with international air forces in the Northern Territory, every 2 years. The exercise also involves participants from the Australian Army and elements of the Singapore, New Zealand and Thailand Air Forces that will participate in the tasking, planning and execution of Offensive Counter Air and Offensive Air Support operations in a coalition environment. 22 leaders of Industry and Business will get a taste of military life in the Northern Territory, when they are given the opportunity to participate in the Cadet, Reserve and Employer Support Division’s Boss Lift to Exercise Pitch Black. Head of the Division, MAJGEN Greg Melick, said he believes the participants would gain a valuable insight into the benefits that Reservists can bring back to their civilian workplace. The aim is to highlight the skills the Reservists gain from being in the ADF and how those skills can benefit civilian employers. ------------------------------- (K) EXERCISE PIRAP JABIRU This exercise commenced in 1998 and was expanded in 2006. Now in 2010, Australia and Thailand will co-host the multilateral Peacekeeping Exercise in Bangkok from late July to early August. A total of 14 countries are sending military and police participants to obtain a greater understanding of the planning processes of individual countries and those of the United Nations. It will highlight the com - mitment of both Australia and Thailand in promoting regional peacekeeping efforts. The “exercise” also provides an opportunity to develop shared approaches to resolving the complex problems inherent in peacekeeping operations and will enable regional countries to work together better on peacekeeping operations. ---------------------------- (L) GOVERNOR-GENERAL VISITS TROOPS IN AFGHANISTAN A few days before ANZAC Day our Governor-General, M/s Quentin Bryce AC, mad a “surprise” visit to our troops deployed in Taren Kowt and Kandahar Airfield in southern Afghanistan. She had lunch with the soldiers from the First Mentoring Task Force and later shown an equipment display. She later addressed the soldiers and said it means a lot to her and she is so proud of them and what they are doing and this comes from all Australians. CPL Andrew Lawrence was spoken to by the Governor-General who asked about his work and the tasks he performs. CPL Lawrence said it was an honour to have her come over here and greet us and address us. The Governor-General later visited Kandahar Airfield where she met with personnel from the Rotary Wing Group who operate the two CH-47 Chinook helicopters as well as the Australian Heron 26 Detachment, which operate the Heron unmanned surveillance aircraft. This is the 2nd time M/s Bryce has visited our troops in the Middle East. She previously visited troops prior to Australia Day 2009, also at Taren Kowt (in Oruzgan Province). -------------------------------- (M) MAJGEN Ash Power AM CSC MAJGEN Power has been appointed Senior Military Advisor to the Afghan Defence Minister, Abdul Rahim Wardak. General Power will be the first Officer to serve in this capacity to support the Afghan Government decision-making and policy development for long term Afghan National Army development. Australia was invited by ISAF to fill this new position. MAJGEN Power said he looks forward to the challenges and opportunities this role will present. MAJGEN Angus Campbell will replace MAJGEN Power as the Head of Military Strategic Commitments from 29 March 2010. --------------------------- (2) U.S. MAJGEN Richard MILLS CO Camp Pendleton— Afghanistan (Edited--Source- Mark Walker, North County Times, May 16, 2010) As the war in Afghanistan enters its 9th year, the new commander of the 1st Marine Division, MAJ GEN Richard Mills said a new regional command he is overseeing will now include Helmand Province, as well as Nimruz and Farrah Provinces. The expansion roughly triples the size of the Marine’s combat territory. Nearly 20,000 Marines are now serving in Afghanistan— about twice the number from a few months ago. The Helmand River Valley is a key strategic area for insurgent Taliban forces and one of the primary poppy production areas and General Mills said the post poppy harvest fighting season will exact a toll. Commanders such as General Mills are facing a 2011 timeline outlined by the President, Barack Obama, to begin bringing troops home. There is pressure to speed the development of the Afghan National Army and Police Forces as well as create a more effective and less corrupt central government. (Many military experts have said that the US and NATO Forces will need 5 more years to defeat the Taliban.) General Mills said steady gains are being made in clearing and holding of more areas of the expansive Helmand Province…”We are occupying many of the population centres and within these centres we are making progress in governance, economic development and security. The towns of Marjah and Zad are examples of where Marines have rooted out the Taliban in recent months and established rapport with tribal elders. This leads to tips on where Taliban fighters are located and where roadside bombs, the weapons responsible for about 2/3rds of all troop deaths and injuries, are buried.” General Mills had particular praise for the female Marines, who make up about 7% of his troops, who, as well as gathering much needed intelligence information, perform many tasks such as piloting aircraft, driving trucks in convoys and a variety of support tasks. US policy forbids women from direct combat assignments. General Mills said that the poppy cultivation that expanded greatly when the Taliban controlled the Afghan Government, continues to provide the insurgency with money to pay its fighters and purchase arms and bomb materials. The Marines recently seized 5 tons of raw opium and this has seen the coalition forces cut poppy production roughly in half. Farmers have said they will switch crops, such as wheat rather than poppy. ------------------------- (3) Andrew ELLIS article. (With kind thanks to Sunday Telegraph 26/6/10) The below article was emailed to me by our good member, John Smith. It shows us a small window into a part of a dedicated life of another of our Association members. Double life of top Sydney surgeon in world’s trouble spots Front-line lifesaver By Barclay Crawford Andrew Ellis lives a double life as an orthopedic surgeon, performing hip replacements for north shore pensioners in Sydney one week and life-saving operations in war and disaster zones the next. Dr Ellis has served as a lieutenant colonel in the Army Reserve’s 1st Health Support Battalion on Australian peacekeeping missions in Bougain ville, the Solomon Islands, East Timor and, most recently, the war in Afghanistan. He’s also been called to disaster scenes, including Aceh in Indonesia during the aftermath of the 2004 tsunami which killed 165,000 people in the province. And even after 16 years, the challenge of moving between leafy suburban Sydney and life saving surgery amid such turmoil doesn’t get any easier. “It’s hard to come back from the tsunami or Afghanistan and go to work the next day,” he said. “It’s hard to listen to a relatively minor complaint in the rich world after dealing with life-or-death situations. “It’s very challenging to do that. Each of those big missions takes a few months to get over.” Dr Ellis interrupts his career dealing with non-life threatening conditions at Royal North Shore Hospital with stints of up to three months, often working around the clock, in a war or disaster zone. Family is left behind. Events such as birthdays are missed. “The tsunami was at Christmas and we had two weeks booked on the (NSW) South Coast, but all that flies out the window,” he said. Dr Ellis said his double life would be impossible without the support of his wife, who holds the home front and runs his practice at St Leonards in his absence. He said he hoped his example would make others consider making 27 such a sacrifice to help Australian troops who were spending more and more of their careers in foreign theatres of war. “If a young man or woman is injured by supporting the good intentions of the Government through military service, they deserve the same surgical support as a person who is cleaned up by a car on the Pacific Highway,” he said. “And that won’t happen unless individuals give up some of their time to go with them. “I enjoy it, I learn from it and I benefit from it, especially working with good people in adverse circumstances.” ------------------------------ (4) Frank OLIVER is a friend of our Association and recently went on an ANZAC Tour with his wife, Mary, and their eldest son, Mark and his partner, Julie. He kindly sent me a resume` of their trip. I have “edited” his story, as a “Feature”, for your enjoyment. -------------------------- (5) RAAMC Association Inc (Vic. Branch) Our Association sincerely congratulates Kevin (“Bat”) Andrews on being elected as the Inaugural President. Kevin sent me an email to say he will be starting a newsletter and was asking any interested persons to come up with a suitable name for it. He was keen to get any stories, jokes, cooking tips etc etc. Unfortunately, Kevin’s deadline was the 30th July, our readers who don’t have the internet will not be able to respond but if you would like to contribute any type of article (providing it is not offensive) to a future issue of their new newsletter, I am sure it would be welcome. Kevin also said if you wish to “advertise” your business it will cost $5 for a quarter page. He also advised that if any reader is interested in purchasing an “Artist Proof” copy of the Sudan to Afghanistan paintings by the artist Martin Campbell, he has FOUR left. Each copy has been signed by the remaining RAAMC Major Generals and the artist. The original painting now hangs, temporarily, in the SGT’s Mess, Army Logistics Training Centre, Bandiana, but will soon be moved to a PERMANENT public display in a premier location, which will add to the interest and desirability of these prints. COST will be a tax deductible donation of $2,200 plus $300 for framing will go to the RAAMC Fund. Members will be given PRIORITY. (Kevin’s details are; Mobile 0425.785.598) (What is an Artist’s Proof?—thank you to “Bat” and Wikipedia)). Collectors also prefer final artists. ------------------------------ (6) John O’BRIEN is the secretary of the NSW Branch of the RAAMC Association Inc. and he sent me an email saying he saw my name in the (NSW Branch) RSL’s “Reveille” magazine as winning a Jack Thompson CD (which I did). John remarked that he and Jack Thompson served as young soldiers at 3 CCS at Ingleburn in 1961 and used to “haunt” the streets of Liverpool trying to pick up sheilas!! John remembers many a time “emu bobbing” and picking out weeds from the Officer’s Mess gardens. “FEATURE” (With kind thanks to a friend of our Association—Frank Oliver. Frank’s dad served in WW 1 in 5 Field Ambulance, which I mentioned in our June 2010 magazine, and this story is a recall of three memorable days of the ANZAC Commemoration at Zonnebeke, Paschendaele and Ypres on the 24th, 25th and 26th April 2010). An ANZAC Trip memory I had previously made contact with the Paschendaele Memorial Museum 1917, which is situated in the Chateau Zonnebeke, and was very pleased to be informed that not only was a Dawn Service to be held on ANZAC Day but also a 3 day Commemorative week-end—dedicated to ANZAC – was to be centred at the Zonnebeke Chateau. Unfortunately, we had missed the “Remember Me” Exhibition Official Opening which was held on the Friday, 23rd April, at the Town Hall. The exhibition highlighted the work of the Commonwealth War Graves Commission from 1917 to 2010. So, myself and my wife, Mary, together with our eldest son, Mark, and his partner, Julie arrived in Lille (France) on Saturday 24th April. We then proceeded to Zonnebeke where a “Living History Exhibition” was on display throughout the grounds of the Chateau, which had been transposed into a “war behind the front” scene. This included an army camp of Belgium Army personnel, a border crossing, a Field Dressing Station, a Charity Stall for “Men at the Front” and other exhibitions. In the evening we attended an ANZAC Concert which was also in the Chateau grounds. All items were performed by Australian, New Zealand and Belgium artists. On ANZAC Day we departed by coach from the Chateau at 5am to proceed to the Buttes New British War Cemetery, near Polygon Wood, for the Dawn Service. This cemetery is the site of the 5th Australian Memorial and where the Dawn Service was conducted. A most sombre and sincere service was conducted. The Guard was from a detachment of the Belgium Army, together with a Flag Party comprised of former Belgium Servicemen and the Bugler was from the Belgium “Last Post Society”. M/s Wendy Quinlan (who was a “Lead Flautist” with the Sydney Symphony Orchestra and the World Youth Orchestra) played her own composition—“Digger’s Salute”. Following the “Last Post and Reveille”, the National Anthems of the three countries were played and then the “Blessing”. 28 On the coach back to the Chateau no one spoke. It was obvious everyone’s thoughts were on past sacrifices made by very brave servicemen. When we returned to the Chateau our breakfasts included “Tommie Cakes and Pastries”. Later, we had a conducted tour of the 1917 Paschendaele Memorial Museum. This included underground dug-outs that were used as “work places”, command centres, dormitories, dressing stations etc, as everything above ground had been blown apart by continual bombardment. Other areas depicted certain “individual” history’s of 100 men of various sections of the Allied Forces who made the supreme sacrifice—quite a number are Australian. The number 100 represents the 100 days of the Battle of Paschendaele. We then proceeded to the Australian Delegation where we shared refreshments with Wendy Quinlan, John Paul Van Gothem (the Leader of the Belgium Flag Party) and Dr. Brendon Nelson (the Australian Ambassador to European Countries). Dr. Nelson showed keen interest in my late father’s Medals and Decorations and I informed him my father’s Military Medal was awarded for action at the southern end of Zonnebeke Lake—which is within the Chateau grounds immediately behind the Chateau. We then visited a local Memorial outside the village church, where a brief Ceremony was held and then proceeded by coach to Tyne Cot Cemetery. Tyne Cot is the largest Commonwealth Cemetery in the world and contains 12,000 graves, many unknown. The new Visitor’s Centre here, records the names of 35,000 Missing Allied Servicemen—these are additional names to the 54,000 names recorded on the walls at Menin Gate—before 16th August 1917. Other names of “Missing” are recorded at Messines Ridge British Cemetery and 11,000 names at the Ploegstreert Memorial, which stands in the Royal Berks Cemetery Extension. The 3rd Australian Division Memorial is situated at the Tyne Cot Cemetery and we attended a Memorial Ceremony here—similar to the Dawn service at “Buttes” and again a most poignant and sombre Ceremony. At the conclusion of this Ceremony, Dr. Nelson introduced me to Mr. Dick Cardoen, the Mayor of Zonnebeke and Mr. Frankie Byron, a First Alderman. Dr. Nelson informed them that my father had been at Zonnebeke Lake and was decorated for his actions there. The Mayor was very interested to get my father’s Service Records and details of the events. During the afternoon of the 25th we joined the tour of other battlefields in the vicinity and then to Armentieres to the Commonwealth War Graves Commission’s extensive “work depot”, where recycled cemetery materials, including grass clippings, are re-distributed to various sections. In the evening we arrived at Ypres for the Menin Gate Ceremony. The Last Post is sounded here every night at 8pm and has been so since the end of WW 1—it ceased during the German occupation of WW 2. Dr. Nelson kindly introduced me to other members of the Delegation and informed them of my father’s involvement at Zonnebeke. We were informed of the finding of the mass grave at Fromelles and the subsequent identification of many Australian remains. Those brave soldier’s names have now been removed from the “Missing Rolls” on the Menin Gate. The last visit was on the Monday, 26th April. We were taken to the Flanders Fields Museum in Ypres. When you enter the museum you are handed the name of an Allied serviceman and you trace his history through a series of “Information Stations”. The museum is dedicated to the actions that occurred on the Ypres salient and it also includes a number of audiovisual displays, a historical kiosk, a people kiosk and many other features. My attention was drawn to the last photo on the left, before the exit—it was of Zonnebeke Lake and showed the southern end—this is where my father was awarded the Military Medal. I had very mixed emotions and a tear or two as I proceeded through the exit. The trip we undertook was because of my interest in the third battle of Ypres—referred generally as the Battle of Paschendaele. My father was a stretcher-bearer with the 5th Field Ambulance in that theatre of war. This battle was commenced on the 31st July 1917 at Pilkim Ridge and concluded on the 10th November 1917 at Paschendaele. It spanned 102 days of intense fighting and yet only saw the gain of a couple of thousand yards, but the cost of dead and wounded alone was in the vicinity of one million souls. History records a devastated landscape with not a tree or building in existence. There were troops dying in the deep Belgium clay, being unable to free themselves from its sucking, thick clutches. The injured and dying soldiers would take about 4 hours for the stretcher-bearers to carry a cobber maybe 300 yards—all through thick, oozing mud and shell craters and even sniper and machine gun fire—to get life-saving medical attention. On some occasions, stretchers would be carried some thousands of yards with the patient’s only care being the battlefield dressings he was applied with, until expert medical assistance was provided. All these thoughts came to me as I tried to envisage the horror of what these brave souls went through. I felt very proud for my father, when, in 1968, the New Year’s Honours List showed he was bestowed with the “Medal of the British Empire (MBE) for services rendered to Ex-Service personnel.. It was only after my father passed away and I was going through his possessions that I came across his Military Medal Award and read the Citation that was carefully preserved. His Citation read…”About 7am on October 9th, a heavy H.E. and shrapnel barrage was put down over the lower levels at the southern end of Zonnebeke Lake. Many casualties occurred in this area, which is totally devoid of shelter and in many parts deep in mud. Pte Oliver repeatedly called for and led parties of volunteers into the area of heaviest shelling, held the men together by the force of his example and a cheery devotion to a high conception of duty, and undoubtedly saved many lives. His bravery in continuing to dress in the open without shelter inviting almost certain casualty, was a splendid example.” Recommended by—ADMS 2nd Australian Division. 29 Real Estate, Finance/Banking Livestock and Insurance Telephone: 03 5562 2899 717 Raglan Parade, Warrnambool Proud to support 5th Field Ambulance RAAMC Association Lawson Grove café BYO Licence Featuring… • Breakfast • Lunch • Take Home Meals • Coffee & Cakes Phone: 03 9866 3640 1 Lawson Grove, South Yarra Vic 3141 Proud to support 5th Field Ambula nce RAAMC Associa tion AG 1 ENGINEERING Superior Service – Professional Advice Phone/ Fax: 08 9844 8590 16 Thorn Street, Albany WA 6330 Proud to support 5th Field Ambulance RAAMC Association LAWN PERFECTION • Lawn Mowing • Edging • Pruning • Trimming • Garden Makeovers • Yard Clean Ups • Rubbish Removal • Competitive Rates • No Job Too Small • Free Quotes Mobile: 0412 484 922 St George, Sutherland Shire & Inner West, NSW Proud to support 5th Field Ambulance RAAMC Association G n o r t o p & A s s o cia t e s Electrical Training & Consultants Tel: 0 8 8 9 4 7 0 3 0 1 F a x : 0 8 8 9 4 7 0 2 9 5 5/41 Sadgroves Crescent Winnellie NT 0820 Proud to support 5th Field Ambulance RAAMC Association CRAFTSMEN HOMES PTY LTD Specialising in the design and construction of new homes, additions, custom designed homes Telephone: 03 9744 2155 Sunbury Victoria Proud to support 5th Field Ambulance RAAMC Association Wellness HOME BASED BUSINESS Committed to excellence. You will be astounded by this scientifically based advancement in health care. Be excited as you participate in and share this gift. Be involved in revolutionizing the wellness industry and acquiring abundance in the process. Do not hesitate – Call Chris – NOW Tel: 08 8294 0049 • Mobile: 0403 583 413 Proud to support 5th Field Ambulance RAAMC Association GSF Lawn Mowing Service Joe Filippone Mobile: 0408 150 172 Relax! No Job Too Small - Let GSF do it all • Lawn Service • Edging • Pruning • Trimming • Yard Clean Ups • Grass Cuttings Removed FREE QUOTES Competitive Prices Starting from $35 Proud to support 5th Field Ambulance RAAMC Association The Friendly Club Whether it's great food, good fun, entertainment or just a place to sit back and relax why not visit us at Club Liverpool. 185 George Street, Liverpool 2170 Phone 9822 4555 Proud to support 5th Field Ambulance RAAMC Association Telephone: 03 9553 5450 Mike Davidson Factory 1/42 Herald St, Cheltenham Vic 3192 Proud to support 5th Field Ambulance RAAMC Association 30 2010 Fund-Raiser Thank You (From your Committee) Thank you Members, for your yearly dues, donations and LIFE MEMBERSHIPS, they are so very much appreciated. Our Association has purchased one of the paintings “Sudan to Afghanistan” by noted artist Martin Campbell and we intend to make this our major prize. It is “Special Number” 55 of 200. The print overall measurement is 33½ inches x 23½ inches and the actual painting is 22 inches x 16½ inches. It is unframed. The tickets will be $5 each and we will draw the winner ONLY after we recover the cost. May we count on your support? We will still run our raffle at $1 per ticket. The winner will receive half of what we sell and this will be drawn at our Annual “Mixed” Re-Union in November. Your dollar is very valuable to us. 2010 Reunion Venue This is the last “reminder” to enter Saturday, the 27th November (12 noon) in your diaries, or on your calendars, for our 2010 Annual “Mixed” Reunion. We will be holding it at the Paddington RSL Club on Oxford Street, Sydney (nearly opposite Victoria Barracks). Buses from Circular Quay (No: 380 from Stand “E” depart about every 15 minutes on a Saturday) and Eddy Avenue at Central (No: 378 depart about every 15 minutes also) will drop you off at the door of the Club. We have secured a “private room” to seat up to 40 people, so bring your partner and/or friends for a very relaxed and informal lunch. Dress is neat casual (Jacket and Tie is optional). The cost will be $35 per head ($30 for non drinkers of alcohol) for a buffet meal and all drinks Your President and committee members look forward to greeting you. …for giving your “unwanted Magazine” to your local doctors/hospital waiting rooms/Nursing Home/local chemist/etc “Reading Rooms” for their enjoyment. ….To all the businesses that have paid our publishers to have their advertisement placed in our magazine. ….To our members who pay by EFT, thank you for identifying yourself. (There are some members who are a little behind with their Subs—any little effort is much appreciated.) Your contributions, letters and emails are enjoyed by us all and are an encouragement. Members on the Internet—don’t forget our own site (see Front Cover of our magazine) and also “surf” the RAAMC web site:- If you do visit our web site,. 31 The “Carved” figures of Legerwood (My kind thanks to page 24 “Entrée”—not sure of the publication but around 20th December 2009. Also to “Google” for the information on Mr. Eddie Freeman—he did a wonderful job.) During the Christmas period, Ruth and I drove down to Melbourne and then boarded the “Spirit of Tasmania” to stay for 3 glorious weeks, in West Launceston (What a beautiful city), with our daughter, Julie. I was relaxing one day, reading one of the local newspapers, when a story caught my imagination. When World War One started and the call went out around Australia for volunteers to fight the enemy of England, a group of young men, husbands and sons, from around the district of Ringarooma (near Scottsdale, in Tasmania) heeded the call. Sadly, seven did not return. On October 15, 1918, family and friends attended a solemn ceremony at the railway reserve at Ringarooma Road. As each name of the fallen was called out, a relative of the soldier came forward to hold the tree before planting. Nine pine trees were planted. One for each of the fallen, one for Gallipoli and one for the ANZACS. It was determined never to let them be forgotten. In 1936 this small hamlet was officially named Legerwood. As time went on the memorials grew and then wartime residents died or moved on until the reason why these pine trees were there remained with only a few remaining residents. Then, in 1999, the Dorset Council had to declare that the pine trees were a “safety risk” and recommended that they be cut down. The Legerwood community were devastated and rallied. In 2004, permission was granted to secure the services of a local chain-saw carver to “bring the soldiers back to life” in sculpture. Eddie Freeman, a chain-saw carver from nearby Ross, was commissioned by the Legerwood Hall and Reserves Committee to sculpt the soldier figures and other various scenes depicting WW 1. Ruth, Julie and I drove to Legerwood to see these “pine trees”—Words fail me. We drove about ½ hour from Scottsdale, meandering along narrow, winding country roads through some of the most beautiful rural scenery. Then we came to “T” intersection and as I looked along to my left and straight across the road I could barely contain my emotions. There were these beautiful pine tree stumps. Each one carved and oiled—they stretched for about 80 metres along this road. I just sat in the car in awe and took it all in. We got out and walked along each “tree”. At the base of each tree was a plaque which depicted the scene or the “fallen” soldier’s name and occupation. I took a photo of each of the trees and the plaques. I hope they come out ok in our magazine. I would like to suggest to our readers that if you visit Tasmania and have not seen these “trees”—please drive off the beaten track and be amazed. 32 Gunner Peck! (Edited from an article written by Tony Stephens in the SMH 18/4/90 with kind thanks.) (Also to member, John Roche for mailing it to me.) Harry Peck is the soldier who never was! He appeared on Australian Army Charge Sheets—he was named, for various reasons, by the British, French, Germans and Arabs and even at Milne Bay—all during WW 2. Yet he never existed! When questioned at the time, Sir Roden Cutler, who earned the VC during the Syrian Campaign whilst fighting with the 2/5th Australian Field Regiment of the 7th Divisional Artillery said… ”No, there was no actual Harry Peck—and yet there were many Harry Pecks. He was a pivotal point for our esprit de corps. He was a rallying point. He replaced the Standard Bearer of old.” Then after 50 years (in 1995) the true story of Gunner Harry Peck emerged. Terry McGurren was 19 when he was recruited into the 2/5th at Ingleburn in 1940. During training in May, Terry’s hut was inspected this particular morning by the CO together with SGT W.J. (Bill) Mahony. The CO demanded to know who slept in one untidy bed. McGurren, who did not know, answered .. ”Harry, Sir” “Harry who?” asked the CO. “Harry Peck, Sir.” Replied McGurren. Gunner Peck was duly charged under section 40 of the Army Act… ”conduct to the prejudice of good order and military discipline”. Rolls were searched, in vain, for his army number! Harry’s fame grew from here. Some of his achievements are recorded in the official diaries and papers of the 2/5th held at the Australian War Memorial. On the way to the Middle East on board the Queen Mary, Australian soldiers complained that their eggs were “off ”, and began throwing them—Gunner Peck was blamed. In Mersa Matruh, Egypt, a British Army Ordnance Store supplied a variety of equipment to the 2/5th with Harry Peck signing for most of it! Sir Roden said… ”I don’t know how they got away with it. It was a con job, but there was nothing selfish about it. The Regiment was short of supplies and the men could see the supplies were available—the Officers turned a blind eye.” 185b Grange Road, Findon SA 5023 Phone: (08) 8268 9695 Proud to support 5th Field Ambulance RAAMC Association In Tel Aviv a sports goods dealer sold football boots to an Australian officer who signed himself Heinrich Pfeck— without paying for the boots. In Syria, 10 tons of building stone was carted away by Australian Military vehicles. The bill received by AIF HQ referred to… ”goods taken away by soldat Henri Pecque of the 31st Anchovy Division of the Army Australienne.” On Radio Cairo, a program called “Calling the Forces” sent birthday calls… ”To wounded hero Herollary Peck”. An Australian, calling himself Lieutenant H. Peck, gave a 5-minute talk, through Radio Jerusalem, on “Mohammedanism in Australia”. In the history – “Guns and Gunners” – John W. O’Brien wrote regarding Harry Peck… ”The benefits of his useful signature were soon manifest in securing forbidden goods at Ordnance Depots throughout the Middle East. The yield included pistols, tools and even a motor truck. The rapid promotions and demotions of Harry Peck, between Gunner and Lieutenant Colonel suited the moment’s need and added to the trail of confusion left in his path.” When the Customs House canteen at Milne Bay was deserted in the face of an expected Japanese advance, Harry Peck had a field day. O’Brien wrote… ”It was Harry Peck who died on that hot summer’s day on the red bluff at Merdjayoun (Lebanon); Harry Peck who was killed while passing fire orders to the guns at Ibeles Saki (Syria); Harry Peck was by that crude native hut, in the tiny, steamy clearing of K.B. Mission (Milne Bay). Whatever the name on the records, whether its owner be living or dead—his is the one name that covers all.” Back in Australia, a bridge near Kilcoy, north of Brisbane, was called Harry Peck’s Bridge. At the time of this story, Terry was 69 years of age, a retired miner and living in the Camden (NSW) area. When asked how he came up with “Harry Peck” he said he remembered “Harry Peck’s fish paste” because we ate it at home. Terry said he got a bit embarrassed when the name became popular, but it seemed like a good idea at the time.” Gunner Terry McGurren was going to attend his 2/5th’s 50 Anniversary and also present would most probably be “Harry Peck”! ----------------------- GET FRESH FAIRVIEW PARK Shop 1, 325 Hancock Road FAIRVIEW PARK SA 5126 Phone: (08) 8251 5177 Proud to support 5th Field Ambulance RAAMC Association 35 A letter (1998) from Les Burnett to his good friend, John Roche (Les Burnett wrote the story of the 2/3rd CCS, who were in Greece and Crete with 6th Division in WW 2. I am unsure of date of Les’s death. ) (With kind thanks to both Les (Dec) and John) Dear John, Thank you for your long, bright letter re “The Premier CCS of the AIF”. I was surprised and very pleased to read the RAAMC’s interest in recording history and I hope I can help. Yes, I have lots of spare copies of my little efforts so I’ll send a couple more. I had some feedback from unit members. Several were glad to be reminded of some incidents that they had forgotten. A few others commented that I should have included more names of personnel, but I was limited by lack of knowledge of many happenings. One nursing sister complained that I should have written more about the nurses (female). I was a clerk in the Orderly Room and I was insulated from the “goings on” in the wards. I could only give general praise for their work. I can see that you are particularly interested in the medical personnel, so I am digging into my memory bank for information. Lt Col (later Colonel) Belisario—a most impressive person—tall and outstanding. He was noted for his noisy laugh, which at times appeared to be used to cover nervousness. His pre-war experience in a militia Field Ambulance (the 4th, I think) was a great help and he was able to set up a unit which performed creditably. Of course, he was always interested in skin conditions and he was never without his little notebook of pres - criptions. Colonel Rex Money. We saw a fair bit of Rex as the 2/6th AGH was near us on several occasions and he and our medics often met. John Cobley – Likeable chap— always bright— lots of fun in the Officer’s Mess I believe. He was a “tower of strength” up ‘till Beirut when he was transferred. I had heard, much later, that he disagreed with the second CO—Lt Col Gillespie, a Victorian. Post war he lived at Leura and was highly regarded, not only for his medical work but also for his publications about Australia’s early history. Sr. Deane—was the senior Sister from the start to entry into Beirut. (The new CO had her moved to the 2/1st AGH to be replaced by Sr. Vines, another Victorian, perhaps more mature than “our Sally” as we called her.) Sr. Deane later managed a Ward, for most of her post war career, at Prince Henry Hospital (on the Coast) when I was an RMO there in 1953. She remained single and kept in contact with the CCS personnel through the 2/3rd CCS Association which only folded up about 3 years ago. I attended her funeral—she had a breast cancer. “Sally” was like a sister to “her boys”. Major Bruce Hall – yes, a wonder - ful man! His work in the M.E. was out - standing. Firstly, he prepared blue - prints for the arrangements of the various sections of the unit when in action. We used his “lay-out” twice in Greece, very successfully. In Beirut we had to set up a Typhoid Ward, Sister Nellie Luke was In-Charge and Bruce Hall was medico I.C. I was required to type out multiple copies of his observations and recommendations and I am sure his research was outstanding. He had a sense of humour too. He often sent me notes addressed…Pte Burnett and signed… G. Bruce Hall. Once I had to reply so I signed.. L.Wilson Burnett—from then on his messages were addressed to… L.Wilson Burnett. Major Otto Nothling was the 2 I/C from inception until Beirut. He was a Queenslander and a Test Cricketer. I saw him play in his only Test Match on the Sydney Cricket Ground in the early 1920’s. He was a medium-paced bowler and a forceful batsman. However, he did not show good form and he was dropped imme - diately. He was a clever surgeon noted for his deft fingers. He was not young. He left a Practice in Rose Bay to enlist. Major “Mick” Susman and Cap - tain Harley (“Mick”) Turnbull were perhaps the most expert surgeons in our team. Both had outstanding careers in pre and post war times as well as their great contribution to the Army Medical Services. I believe Mick Turnbull remained single throughout his life. Major Norman Wyndham joined us in Beirut. Whilst the unit was on “Stand-By” in the lead-up to Alamein, there was a danger that the troops might become bored and distressed. He organised a programme of lectures, discussions, classes—mainly to keep up morale. He was quite successful. Ben Jones—an amazing person. I had heard of him through our closeness to the 2/6th AGH and much, much later at Bowral in 1977 or thereabouts. My wife, Dorothy, got to know Ben’s wife, Ursula, through a Bible Study group. This led to social visits between the Jones’s and the Burnett’s. Ben’s eyesight, at this stage, was in a bad way but Ursula coped well. I can remember Ben showing me a copy of the history of the 2/6th AGH— a very thick volume. After their deaths, their effects were gathered up by their nephew, Charles Floyd Jones. I know he had Ben’s medals so he may have the book. Sergeant Frank Aarons was the son of Manny Aarons, the Wurlitzer Organist at the State Theatre for many years. That’s about all I can recall at this stage. I could find out addresses of some chaps who worked more closely with the doctors, and their anecdotes may be of some consequence. I am enclosing two more copies of the book—don’t hesitate to ask for more if required. If you wanted more facts I am sure the war museum in Canberra would have lots of documents available. Bye for now, Les. 36 MAKE TIME! Edited—but with kind thanks to member Barry Perigo) After 21 years of marriage my wife wanted me to take another woman out to dinner and a movie. She said… “I love you but I know this other woman loves you also and would love to spend some time with you”. The “other woman” my wife wanted me to take out was my mother. She had been a widow for 19 years, but the demands of my work and our 3 children had made it possible to only visit her occasionally. That night I called mum and invited her out to dinner and a movie. “What’s wrong, are you well?” she asked. My mum is the type of woman who suspects that a late night call or a surprise invitation is a sign of bad news. “I thought it would be pleasant to spend some time with you, just the two of us”. I responded. out with my son, and they were impressed, they can’t wait to hear about our meeting.” She said, as she got into my car. We went to a restaurant, although not elegant, was nice and cozy. My mum took my arm as if she was the First Lady. After we sat down I had to read the menu. Her eyes could only read large print. Half way through the entree’s, I lifted my eyes and saw mum sitting there staring at me—a nostalgic smile was on her lips. “It was I who had to read the menu to you when you were small,” she said. “Then it’s time that you relax and let me return the favour.” I responded. During the dinner we had an agreeable conversation, nothing extraordinary, but catching up on recent events in each other’s lives. We actually talked so much that we missed the movie. When we arrived at her house later, she said… ”I’d like to go out with you again but only if you let me invite you.” I agreed. When I arrived home my wife asked how our dinner date went? “Very nice, I said, much more so than I could have imagined.” A few days later my mum died of a massive heart attack. It happened so suddenly that I didn’t have a chance to do anything for her. Sometime later I received an envelope with a copy of a restaurant receipt from the same place that mum and I had dined. An attached note said… ”I paid this bill in advance. I wasn’t sure that I could be there; but nevertheless, I paid for two plates—one for you and the other for your wife. You will never know what that night with you meant for me. I love you son.” At that moment, I understood the importance of saying in time “I love you” and to give our loved ones the time they deserve. Nothing in life is more important than your family. Give them the time they deserve, because these things cannot be put off ‘till some ‘other time’. Be kinder than neces sary—for everyone you meet is fighting some kind of battle! 37 FOOD & WATER CANTEEN Leonie Dennison 317 Rouse Street, Tenterfield NSW 2372 (Opposite Commonwealth Bank) ABN 64 804 168 582 HOMEMADE BURGERS, SALADS & SPECIALS Tel: (02) 6736 1544 Open 7am-5pm Mon-Wed; 7am-8pm Thurs-Sat Proud to support 5th Field Ambulance RAAMC Association HY FASHION Without the High Price Tag 180 Parker Street, Cootamundra NSW Phone: (02) 6942 4466 • Ladies Fashion & Accessories • Huge Selection of Body Jewellery • Handbags • Sterling Silver Jewellery – GIFT VOUCHERS AVAILABLE – Proud to support 5th Field Ambulance RAAMC Association Westbury Water Blasting Professional High Pressure Cleaning Drains Cleared 6 Inches and Under External Houses, Driveways Cleaned Concrete Pavement Newcastle / Lake Macquarie (NSW) Proud to support 5th Field Ambulance RAAMC Association Phone: Paul 0411 345 149 NORMAN PARKER SLASHING • 6 Foot 4WD Slasher – Acreage Specialist • Great Rates • Free Quotes • Prompt & Reliable Mobile: 0429 576 738 Northern Rivers, NSW Proud to support 5th Field Ambulance RAAMC Association FIXSURE PLUMBING Licensed Plumber, Drainer, Gasfitter & Roofer • Renovations & Extension • Blocked Drains (Eel) • Gutters & Downpipes • Taps & Toilets • Hot Water • Repairs & Maintenance • Available 24 Hours FREE QUOTES: 0413 705 505 Sydney – Inner West – Lic. No. 213299c Proud to support 5th Field Ambulance RAAMC Association A A B S Building Services • Asbestos Removal Specialists • Asbestos Pick Ups • Bathrooms • Toilets • Laundries • Sheds • No Job Too Big or Too Small • 7 Days • Canberra – All Areas Ashley 0431 311 097 Proud to support 5th Field Ambulance RAAMC Association FLAMBOYANT CONSTRUCTIONS SPECIALISING IN • New Homes • Extensions • Renovations • Bathrooms • Landscaping • Maintenance • Decks & Pergolas • Patios & Verandahs Steven 0 4 2 2 4 7 8 2 8 6 Canberra - All Areas • ACT Lic No. 20074 (Class B) Proud to support 5th Field Ambulance RAAMC Association Kylie Bowditch PROFESSIONAL NAIL TECHNICIAN AND MAKE UP ARTIST • Acrylic & Gel Nails • Manicures • Nail Art • Eyelash & Eyebrow Tinting • Eyebrow Shaping • Make up for All Occasions • Friendly Service 186 Sutton Street, Cootamundra NSW Tel: (02) 6942 7214 Proud to support 5th Field Ambulance RAAMC Association B & J B O B C A T S • All Types of General Bobcat Work • 3.5 Tonne Excavator • Landscape Rake • Affordable Rates • Prompt & Reliable Service Mobile: 0438 587 404 • Phone: (02) 6258 7404 Canberra - All Areas Proud to support 5th Field Ambulance RAAMC Association Cosmopolitan Sanding & Polishing 13 Matthew Street, Bedford Park SA 5042 Tel: 08 8357 4051 • Mobile: 0413 992 827 Proud to support 5th Field Ambulance RAAMC Association HURLEY ACCESS P/L Specialising in Scaffolding and Access Equipment 80 Holroyd St, Hampton VIC 3188 Phone: (03) 9521 0306 Mobile: 0417 389 497 Proud to support 5th Field Ambulance RAAMC Association The East Coast Angels • Domestic & Commercial Cleaning Services • Carpet & Upholstery Cleaning • Garden Maintenance • Lawn Mowing • Competitive Rates • Prompt, Professional & Reliable Service Phone: 1300 026 435 Hunter Region, NSW Proud to support 5th Field Ambulance RAAMC Association 38 A Soldier r etur ns home (With much thanks from Member, COL Suresh Badami OAM RFD and the people who sent it to him) I am sending this to you as I believe you will feel the import of this to its very core. As a battle-hardened soldier who has commanded troops in the face of the enemy, you will be able to appreciate this more than any civilian can imagine. We civilians can at best fantasise, about the 'goings-on' on the enemy front, slouching in a comfortable sofa in the ambience of an air conditioned room. Discipline is one of the underpinnings of a civilised society. I think it would be very good if all nations were to follow the Israeli example and impose compulsory military training on their youth. It will only do them good. This is sent to me by Bill Doherty, a godly man. He retired from PanAm as a 747 pilot. Met him in Hawaii and he and his family treated us extremely well. Regards Bill Doherty compart - ment make an announcement to the passengers. He did that and the ramp controller said, “Take your time.” (Continued on page 41) 39 RAY’S LAWN MOWING • Lawn Mowing • Edging • Pruning • Trimming • Rubbish Removal • Competitive Rates Mobile: 0418 308 541 Hunter Valley & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association Lawrence & Hanson ELECTRICAL WHOLESALERS Phone: 03 5443 1611 19 DEBORAH STREET BENDIGO Proud to support 5th Field Ambulance RAAMC Association VALTEC CONSTRUCTIONS PTY LTD 8 Musgrave Avenue West Hindmarsh, SA 5007 Phone: (08) 8340 2663 Proud to support 5th Field Ambulance RAAMC Association Brainiac Learning Centre Literacy and Mathematics Tuition for all students from Kindergarten to Year 8 Kellie Noble - Teacher / Director Suite 4, Camden Court Arcade 180-186 Argyle Street, Camden NSW Phone: (02) 4655 3383 Mobile: 0402 940 318 Proud to support 5th Field Ambulance RAAMC Association Proud to support 5th Field Ambulance RAAMC Association Australian Retro Pty Ltd (Traffic Management) PO Box 572, Gladesville NSW 2111 Phone: (02) 9646 4444 Mobile: 0414 260 644 Cafe on Cooper • Open for Breakfast & Lunch Monday to Saturday • Fast, Friendly Service • Relaxed Atmosphere • Inside & Outside Dining • Affordable Prices 1F Cooper Street, Cessnock NSW Phone: (02) 4991 2762 Proud to support 5th Field Ambulance RAAMC Association • High Pressure Blasting • Graffiti Removal • Brickwork & Driveways • Pool Surrounds • House Cleaning • No Job Too Small • Free Quotes Charlie 0432 484 848 Sydney Metropolitan Areas Proud to support 5th Field Ambulance RAAMC Association CHRIS DEYES GARDEN TIDY UP SERVICES • Yard Clean Ups • Weeding • Trimming • Pruning • Mulching • Waste Removal • Prompt & Reliable Servicing St George & Sutherland Shire of NSW Mobile: 0415 316 273 Proud to support 5th Field Ambulance RAAMC Association BELLAJACK RENOVATIONS Specialising in Bathroom, Kitchen and Laundry Renovations Packages Available to Suit All Budgets David 0404 070 923 Servicing the Illawarra Region of NSW Proud to support 5th Field Ambulance RAAMC Association Anti Graffiti – Restoration – Texture Cutting Maintenance – Repaints – Spray Painting – Special Effects New Homes – Roofs – Colour Consultancy – Insurance Work Approve Texture Applicators – Large and Tiny Jobs FREE QUOTES – 0458 726 400 Servicing Port Macquarie to QLD Border Proud to support 5th Field Ambulance RAAMC Association 40 a Vietnam.! A soldier’s casket is being carried from the plane by his battalion. (AAP: Australian Defence Force) 41 • All Breeds • Hydro Bath and Tidy • Clip and Style Traditional or Novelty • Punk Colours • Pick Ups Available Over 16 Years Experience! Leanne Casiraghi 0401 061 827 22 Carnation Street, Greystanes 2145 Proud to support 5th Field Ambulance RAAMC Association EXOTIC BALI FURNITURE 12B/9 Lyn Parade, Prestons Mobile: 0418 484 167 • Range of Indoor & Outdoor Bali Furniture • Homeware • Mosaic Vases • Mirrors • Bowls • Lamps • Lounges, etc. Proud to support 5th Field Ambulance RAAMC Association Shop 5, Riverside Plaza Shopping Centre Queanbeyan, NSW Large Range of Delicious Donuts & Beverages Cooked & Served Fresh Daily Phone: (02) 6284 3159 Proud to support 5th Field Ambulance RAAMC Association T & M SOUSA CLEANING • Offices • Showrooms • Body Corp • Medical Centres • Government Departments • Weekly/Fornightly/One-Off • Prompt & Professional Service Mobile: 0422 347 754 Mortdale & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association CAROLYN VASS Mobile: 0413 119 700 495 North East Road, HILLCREST, SA 5086 Proud to support 5th Field Ambulance RAAMC Association MARULAN RURAL SERVICES COUNTRY TRANSPORT SPECIALISTS CRANE TRUCK HIRE • All Trucks Fitted with Cranes – Local & Country Work • Stock Feed For Sale – by the Part or Tonne • Hay by the Truck Load • Fully Insured Phone: (02) 4841 0020 Mobile: 0429 077 946 • Fax: (02) 4841 0559 Tallong & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association Smitty’s Mowing • Lawn Mowing • Edging • Pruning • Trimming • Rubbish Removal • Other handyman jobs done • Competitive Rates • Friendly Service Mobile: 0422 716 535 Home: (02) 6545 0366 Scone/Singleton & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association BRICKLAYERS PTY. LTD • Brick & Block Laying • New Work • Extensions • Renovations • Retaining Walls • Commercial & Domestic Nick Callinan Maitland/Newcastle & Surrounding Areas, NSW Proud to support 5th Field Ambulance RAAMC Association R.C. & V.L. EDMUNDS WATER TRANSPORTATION Call: (02) 6889 1482 Mobile: 0418 639 107 Narromine, NSW – All Areas Proud to support 5th Field Ambulance RAAMC Association 42 ✂ 43 44 ✂ Trade Card Mulberry Hill Agistment & Spelling Complex BOOST SALES BOOST CUSTOMER BASE BOOST CASHFLOW REDUCE EXCESS STOCK BUSINESS TRANSACTION CARD THAT SENDS YOU BUSINESS TO REPLENISH INTEREST FREE CREDIT FACILITY UP TO 25 K . Sydney - Brisbane - Melbourne - London - New York - Auckland Pre-Training, Long & Short Stays Available For All Fees, Charges & Enquiries Call Today on 0402 682 200 –NOW LOCATED IN MOOBALL, NSW – Proud to support 5th Field Ambulance RAAMC Association Working for Defence means 36% off petrol Ask us how! Salary packaging makes sense. You can lease a car with SmartSalary and put more in your pocket. SmartSalary’s car lease specialists will: Source your car Use our buying power for the best price Handle all the paperwork Arrange 36% discount on petrol, maintenance (parts & labour), and insurance It’s that easy and that good! Call today for an obligation-free discussion. Visit Average savings of ‘36% off’ is based on a salary between $34,001-$80,000, paying 30% income tax. Fuel saving of 36¢ per litre is based on an average fuel price of $1 per litre. Photo is indicative only. Rapid pain relief? Go for Gold! With its unique coating, Australian made Herron Gold Paracetamol dissolves quickly into your system, eating up pain fast. Herron Gold - Australia’s solution for rapid pain relief. Always read the label. Use only as directed. Incorrect use could be harmful. If symptoms persist, see your healthcare professional. A member of the Sigma group of companies. ASMI/17972-0710
https://www.yumpu.com/en/document/view/38330847/battle-for-australia-newsletter-september-2010
CC-MAIN-2020-05
refinedweb
23,126
58.92
By myfear via carlodaffara.conecta.it Published: Sep 03 2010 / 16:58 After all the talks about platform independence, portability, universality of HTML5, and so on – why Apps? why closed (or half-open) app stores, when theoretically the same thing can be obtained through a web page? I have a set of personal opinion on that, and I believe that we still need some additional features and infrastructures from browsers (and probably operating systems) to really match the feature set and quality of apps. yakkoh replied ago: Local binary execution: I am against it for security and configuration reasons. Instead beef up Javascript or add python to the browser. RawThinkTank replied ago: How about creating a JS JIT native compiler in browser with a new sub JS language standard that also is very secured ? yakkoh replied ago: I prefer a superset of JS, with emphasis on features that allow programmers to debug and build frameworks, features like namespaces, classes, packages, and a rigourous no surprise definition of the language. Voters For This Link (10) Voters Against This Link (0)
http://www.dzone.com/links/web_versus_apps_what_is_missing_in_html5.html
crawl-003
refinedweb
179
51.78
Setting up resource message bundles in JSF to provide multilingal messages and captions is often overlooked when first creating an application. Leaving it till later in the project means you will have to go back and manually change the constants over to resource based values. Resource bundles JSF 1.2 were far from perfect but fortunately, using resource bundles in JSF 2.0 is very easy and this tutorial will show you how to add bundles and use them in your JSF 2.0 pages. For this example, we’ll create a new application using the jee6-servlet-basic-archetype Knappsack Maven archetype. The full source can be downloaded and run using mvn clean jetty:run from the command line. Message resources are stored in properties files which consist of name value pairs that binds a message key string with the message value. We’ll use the following example firstName=First Name lastName=Last Name forgotPassword=Forgot Password? usernameTaken={0} is already taken This file needs to be saved and referenced in a package, which would normally be in the same place as your source code, but Maven provides a separate area for resources. Save the file in the src/main/resources/org/fluttercode/resourcedemo/ folder with the name MessageResources.properties. Open up the faces-config file and add the following XML : <application> <resource-bundle> <base-name>org.fluttercode.resourcedemo.MessageResources</base-name> <var>msgs</var> </resource-bundle> </application> Here, we have told JSF about the resource bundle and assigned a variable name to it. Now we will go and add a reference to one of the messages in our home page. Open home.xhtml and replace the initial message with the following : <h:outputText This is a JSF output text component that gets its value from the resource bunde, in this case, the firstName value. If you are using JBoss Tools, you will see that it can perform autocompletion for you on both the msgs value and the actual property keys on the msgs resources. It also displays the actual property value in the preview window for the page. If you run the app now by typing mvn jetty:run in the command line, you will see that the word First Name appears in the page. Access Resources From Code Typically, in your application you will generate messages for the user that also needs to be obtained from the resource bundle. To do this, we will create a bean that can fetch the resource bundle for us and extract strings from it. public class MessageProvider { private ResourceBundle bundle; public ResourceBundle getBundle() { if (bundle == null) { FacesContext context = FacesContext.getCurrentInstance(); bundle = context.getApplication().getResourceBundle(context, "msgs"); } return bundle; } public String getValue(String key) { String result = null; try { result = getBundle().getString(key); } catch (MissingResourceException e) { result = "???" + key + "??? not found"; } return result; } } This class fetches the resource bundle from the faces context which will determine the best bundle to use based on the supported locales and the client locale. The second method uses the first method to fetch a string resource from the bundle. We’ll create a JSF backing bean to use this bean to return a message to the user. @Named @RequestScoped public class SomeBean { public String getMessage() { String msg = new MessageProvider().getValue("someMessage"); return MessageFormat.format(msg, "SomeValue"); } } In our home.jsf page, we display our message by adding Message = #{someBean.message} Which results in the following phrase being displayed : Message = SomeValue is not valid Having just the one default properties file in place is the bare minimum for using string resource bundles in your applications, and I would recommend using that for any application, even if it is never going to be multi-lingual. At the very least, it keeps your string constants in one place and at best, it makes it really easy to support multiple languages at a later date. Handling JSF Locale Information If you go multi-lingual you will need to provide multiple versions of the resource file for different locales, and list the supported locales in your faces-config.xml file. To test this, create multiple copies of the MessageResources file in the same directory with different names such as MessageResources_de.properties or MessageResources_fr.properties and in the content for each, use the same values, but add the locale on the end. MessageResources_fr.properties firstName=First Name(fr) lastName=Last Name(fr) forgotPassword=Forgot Password?(fr) someMessage={0} is not valid(fr) In the faces-config.xml file you can add the supported locales and set the default locale to use. <application> <locale-config> <default-locale>en_US</default-locale> <supported-locale>de</supported-locale> <supported-locale>en_GB</supported-locale> <supported-locale>fr</supported-locale> </locale-config> <resource-bundle> <base-name>org.fluttercode.resourcedemo.MessageResources</base-name> <var>msgs</var> </resource-bundle> </application> Now, depending on where you are in the world, and your browser locale, if you plan on following along, you’ll have to substitute your own locale for en_US. Since we have a MessageProperties file without a locale in the file name, if it cannot find a matching locale, it will use this default bundle. If the default locale is specified in faces-config,then that locale will be used instead of the non-specific default. Play around with renaming some of the resource files, especially the file that matches your own locale. If the file exists, but it is not included in the list of supported locales in faces-config it won’t be used. You can also change the default-locale value to one other than your own locale and see how the locale would be selected. JSF will also select a locale that matches based on the language if not the specific region. In my case, having a locale of en_US means that if available, JSF will select the MessageResources_en bundle if there is no bundle specifically for en_US. Download the Maven source code for this project and run it locally by unzipping it into a folder and typing mvn clean jetty:run and going to. I have problem with my Russian – English localized test site. Google bot has English locale, so I don’t have searching for Russian. Hi Andy, thanks for this code. A question what comes to my mind was – why do you did not implement the MessageProvider as a Singleton? I’m sure there’s a reason for that. Please let me know. The reason it isn’t a singleton is because the singleton is shared across the whole application by all users, whereas users need their own instance because they could have different locales. However, the spirit of your question is correct, we don’t need to keep creating instances of this bean, and it was left like that to lead on to the next article which is now published. Hey Andy, thanks for the nice examples. They all worked for me except for a test I did putting a bundle message in a JPA 2.0 entity, for example: @Size(min = 3, max=64, message=”#{bundle[‘field.size’]}”) private Field someField; This would print #{bundle[‘field.size’]} as the message. I’ve tried this hard but without success. Any hint on how to make it work? Thanks a lot. Rodrigo, You can’t use JSF EL expression like this in the validator since it is a completely separate API. You have to create a ValidationMessages.properties. Cheers, Andy PS Sorry for the delay. Andy, Thanks, I use your blog entries a lot, compliment. When I used this one, I got something working, but got the feeling it was ‘complicated’. So I tried, and tried and tried and came up with just this in the MessageProvider and no other classes (e.g. for looking up bundles) public String getValue(String key) { final FacesContext c = FacesContext.getCurrentInstance(); final Application application = c.getApplication(); String result = null; try { result = application.evaluateExpressionGet(c, key, String.class); } catch (PropertyNotFoundException e2) { result = “???” + key + “??? not found”; } return result; } Which takes a real EL and parses, parses it and returns what you need. In more scopes, more variables/message bundles etc. It looks simple, so I think I might be missing some functionality. Hey Ronald, yes, you can do that, and if you are using JBoss Solder they have an API to make it even easier to execute EL Expressions. My solution was written so that you can see how to code against resource bundles directly and also because the other resource articles makes use of it. One problem with this is that EL Expressions will be checked against every known EL resolver and will probably take longer. Getting it from the resource bundle directly is more like looking it up in a map. In terms of code written though they are very similar, grab the bundle and do a lookup versus getting the faces context and evaluating it. However, this is a convenience function that creates a value expression and uses that to look up the value. Cheers, Andy Gibson Yep, I agree. Learned a lot from your example(s) and yours is faster, for sure. It’s always a (one of the) trade-off(s). In this case convenience over speed. is it possible to define several resource-bundles and is yes how? In my faces-config file I wrote eu.minipay.common bundleCommon eu.minipay.account bundleAccount the second bundle is invisible. obs the XML is not shown properly, I paste without the application locale-config default-locale en /default-locale /locale-config resource-bundle> base-name eu.minipay.common /base-name> var bundleCommon /var resource-bundle resource-bundle base-name eu.minipay.account /base-name var bundleAccount/var /resource-bundle /application ok for those who care, it seems that property files must be placed under src otherwise are not visible by the server. I had them under WB-INF/resources but his does not work.
http://www.andygibson.net/blog/article/resource-bundles-in-jsf-2-0-applications/
CC-MAIN-2019-13
refinedweb
1,647
56.05
NAME mbuf - memory management in the kernel IPC subsystem SYNOPSIS #include <sys/param.h> #include <sys/systm.h> #include <sys/mbuf.h> Mbuf allocation macros MGET(struct mbuf *mbuf, int how, short type); MGETHDR(struct mbuf *mbuf, int how, short type); MCLGET(struct mbuf *mbuf, int how); MEXTADD(struct mbuf *mbuf, caddr_t buf, u_int size, void (*free)(void *opt_args), void *opt_args, short flags, int type); * m_devget(char *buf, int len, int offset, struct ifnet *ifp, void (*copy)(char *from, caddr_t to, u_int len));); struct mbuf * m_unshare(struct mbuf *m0, int how); DESCRIPTION 0x0800 /* packet is fragment of larger packet */ #define M_FIRSTFRAG 0x1000 /* packet is first fragment */ #define M_LASTFRAG 0x2000 /* packet is last fragment */ The available the sum of MLEN and MHLEN. It is typically preferable to store data into the data region of an mbuf, if size permits, as opposed to allocating a separate mbuf cluster to hold the same data. Macros and Functions There are numerous predefined macros and functions that provide the developer with common utilities. mtod(mbuf, type) Convert an mbuf pointer to a data pointer. The macro expands to the data pointer cast to the pointer on failure. The how argument is to be set to M_TRYWAIT or M_DONTWAIT. It specifies whether the caller is willing to block if necessary. If how is set to M_TRYWAIT, a failed allocation will result in the caller being put to sleep for a designated kern.ipc.mbuf_wait (sysctl(8) tunable) number of ticks. A number of other functions and macros related to mbufs have the same argument because they may at some point need to allocate new mbufs. Programmers should be careful not to confuse the mbuf allocation flag M_DONTWAIT with the malloc(9) allocation flag, M_NOWAIT. They are not the same. MGETHDR(mbuf, how, type) Allocate an mbuf and initialize it to contain a packet header and internal data. See MGET() for details. MCLGET(mbuf, how) Allocate and attach an mbuf cluster to mbuf. If the macro fails, the M_EXT flag will not be set in mbuf. is in mbuf after the call. M_MOVE_PKTHDR(to, from) Using this macro is equivalent to calling m_move_pkthdr(to, from). M_WRITABLE(mbuf) This macro will evaluate true if mbuf is not marked M_RDONLY and if either mbuf does not contain external storage or, if it does, then if the reference count of the storage is not greater than 1. The M_RDONLY flag can be set in mbuf->m_flags. This can be achieved during setup of the external storage, by passing the M_RDONLY bit on failure. properly. Note: It does not allocate any mbuf clusters, so len must be less than MLEN or MHLEN, depending on the M_PKTHDR flag). Return the new mbuf chain on success, NULL on failure (the mbuf chain is freed in this case). Note: It does not allocate any mbuf clusters, so len must be less than MHLEN. initially initially set, and to must be empty on entry. Upon the function’s completion, from will have the flag M_PKTHDR still valid after the function returned. Note: It does not handle M_PKTHDR and friends. m_split(mbuf, len, how) Partition an mbuf chain in two pieces, returning the tail: all but the first len bytes. In case of failure, it returns NULL will be returned and the original chain will be unchanged. Upon success, the original chain will be freed and the new chain will be returned. how should be either M_TRYWAIT or M_DONTWAIT, depending on the caller’s preference. This function is especially useful in network drivers, where certain long mbuf chains must be shortened before being added to TX descriptor lists. m_unshare(m0, how) Create a version of the specified mbuf chain whose contents can be safely modified without affecting other users. If allocation fails and this operation can not be completed, NULL will be returned. The original mbuf chain is always reclaimed and the reference count of any shared mbuf clusters is decremented. how should be either M_TRYWAIT or M_DONTWAIT, This.): · all fragments will have the flag M_FRAG set in their m_flags field; · the first and the last fragments in the chain will have M_FIRSTFRAG or M_LASTFRAG set in their m_flags, correspondingly; · the first fragment in the chain will have the total number of fragments contained in its csum_data field.: to See above. SEE ALSO ifnet(9), mbuf_tags(9) HISTORY Mbufs appeared in an early version of BSD. Besides being used for network packets, they were used to store various dynamic structures, such as routing table entries, interface addresses, protocol control blocks, etc. AUTHORS The original mbuf manual page was written by Yar Tikhiy.
http://manpages.ubuntu.com/manpages/hardy/man9/M_PREPEND.9.html
CC-MAIN-2013-20
refinedweb
766
62.98
How to convert in modern C++ (C++11/14/17) a double into a date time using the date.h library, when the double has been generated while exporting an Excel worksheet as a CSV file? For instance, the datetime appearing in Excel: 21/08/2017 11:54 has been converted by Excel into the CSV file as the double: 42968.4958333333 Thanks. Using date.h, it could look like this: #include "date/date.h" #include <iostream> std::chrono::system_clock::time_point to_chrono_time_point(double d) { using namespace std::chrono; using namespace date; using ddays = duration<double, days::period>; return sys_days{dec/30/1899} + round<system_clock::duration>(ddays{d}); } int main() { using date::operator<<; std::cout << to_chrono_time_point(42968.495833333333333333333) << '\n'; } which outputs: 2017-08-21 11:54:00.000000 This definition assumes that your mapping from 42968.4958333333 to 21/08/2017 11:54 is correct. I see in one other place that the epoch is supposed to be 1899-12-31, not 1899-12-30. In any event, once the correct epoch is found, this is how one would perform the computation. Ah, explains the off-by-one error. The writers of Excel purposely considered 1900 a leap year for the purpose of backwards compatibility with Lotus 1-2-3. This output was generated on macOS where system_clock::duration is microseconds. The output will be slightly different on other platforms where system_clock::duration has other units. Aside: At this range, the precision of an IEEE 64 bit double is coarser than nanoseconds but finer than microseconds (on the order of half of microsecond).
https://codedump.io/share/GLupgfHehmKS/1/how-to-convert-in-modern-c-a-double-into-a-datetime
CC-MAIN-2019-39
refinedweb
262
56.96
jGuru Forums Posted By: Suchot_Nimitraht Posted On: Saturday, December 29, 2001 05:58 AM Hello all I have some problem.Please help me about java 2D. In my project, I use BufferedImage class but i want to get a raw data of Image.How? ex. a image 32*24 pixel so i have 768 Pixels,right. How can i get this raw data of 768 pixels(My Image is 8 bits Grayscale so the raw data range in 0-255)I want this integer(0-255) from 768 pixels Please help me if you give code to me I will appreciate. Thank you so much Little tricky... Posted By: Jon_Morton Posted On: Thursday, January 3, 2002 10:48 AM I wrote a little bit of code to read pixel data for you. The image I used is the jGuru logo on the upper left of this page. I downloaded it and put it in the same directory as the following class. Normally I use packages and such, but for this simple example I crammed everything together in one class. Sorry if it is messy. Note that this code sample should be tweaked to get alpha levels of images and such -- right now it only works for RGB BufferedImages. The technique I used is this:1. Load an image, draw it onto a BufferedImage2. Get the Raster of the BufferedImage3. Use a static Raster method to get pixel information.4. Display the data to the screen. /** * @author Jon Morton */import java.awt.*;import java.awt.image.*;public class RasterTool { Raster raster; BufferedImage image; /** Creates new RasterTool */ public RasterTool(int x, int y) { // Loading an image relative in the same directory as this file. StringBuffer path = new StringBuffer(getClass().getResource("jguru.gif").getPath()); // Using my own utility to load the image. Image jguru = loadImages(path.toString()); // Creating a new BufferedImage to pick apart. image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); // Drawing the image into the buffer. image.getGraphics().drawImage(jguru, 0, 0, new Panel() ); // Adding image data into a raster. raster = image.getData(); // Call the function that gets pixel info. pixelInfo(x, y); } public void pixelInfo(int x, int y) { System.out.println(" Data: " + raster.getNumDataElements() ); System.out.println(" Bands: " + raster.getNumBands() ); System.out.println("Height: " + raster.getHeight() ); int[] pixel = new int[3]; raster.getPixel(x, y, pixel); System.out.println(" Red: "+ pixel[0] ); System.out.println(" Green: "+ pixel[1] ); System.out.println(" Blue: "+ pixel[2] ); } public static void main(String[] args) { RasterTool t = new RasterTool(10,10); } // This is a function from one of my libraries that I use to load images. public static Image loadImages(String path) { Toolkit toolkit = Toolkit.getDefaultToolkit(); MediaTracker tracker = new MediaTracker(new Panel()); Image image = toolkit.getImage( path ); try { tracker.addImage( image, 0 ); tracker.waitForAll(); } catch(InterruptedException ie) { } return image; } }
http://www.jguru.com/forums/view.jsp?EID=704943
CC-MAIN-2015-22
refinedweb
464
52.87
Fast Infoset and bnux performance results: oranges-to-apples? By sandoz on Oct 20, 2005 Wolfgang Hoschek presented, at the GridWorld/GGF15, performance results comparing the XOM-based parsing and serializing of XOM documents encoded using Fast Infoset (FI) and encoded using the bnux format. These results do not show FI performing very well! Before i delve into the performance comparisons a bit of background on bnux follows. Bnux is a simple binary encoding of the XML Information Set that performs similar tricks to FI. I would classify bnux as supporting a subset of the functionality that FI supports: bnux is simpler than FI but supports less features. For example, the bnux encoding restricts streaming support to deserialization. When serializing bnux requires all string-based information of an XML infoset be known (e.g. from a tree representation such as a XOM document) since this string-based information is encoded at the head of the encoding. The advantage of this approach is that it is possible to 'pack' information based on the frequency of such string-based information. With FI it is possible to support the encoding of string-based information up front or in-line, which makes the encoding slightly more complex than bnux. Bnux is part of nux a framework for highly-optimized XML processing. I am impressed with bnux and nux. A lot of good work has gone into developing this highly optimized toolkit. Now back to the performance comparisons. Although a lot of effort has been made to compare 'apples-to-apples' my view is it is more 'oranges-to-apples'. There are lots of additional costs due to the manner in which FI is being measured that when summed together result in very poor results. I will try and explain why this is might be so for case the of parsing. Two forms of parsing are measured: Parsing to a XOM document. Thus measures the cost of parsing and creation of the Java objects associated with the XOM document. (Such forms are called 'bnux?' and 'fi?' models in the presentation for bnux and FI respectively, see slide 6.) Parsing using a 'Null' Node Factory. This measures parsing without the creation of the Java objects associated with the XOM document. (Such forms are called 'bunx?-NNF' and 'fi?-NNF' models in the presentation for bnux and FI respectively, see slide 6.) For bnux measurements a very efficient parser is used that performs no well-formed checking and is optimally integrated with XOM such that features of the bnux encoding are taken advantage of to boost performance. The bnux parser relies on XOM to perform well-formed checks. For FI measurements the FI SAX parser is used in conjunction with the well-formed checking XOM SAX handler. The FI SAX parser performs well-formed checking (for example, in-scope namespaces, duplicate attributes, incorrect use of the XML namespace and prefix, NCName and PCDATA character checks). So for 1) well-formed checking is being performed twice and once for 2) where as for bnux it is only being performed once for 1). The well-formed checking XOM SAX handler also sets up the FI SAX parser to perform string interning (this is a very expensive operation for small documents) and report namespace attributes as part of the array of attributes reported by the start element event (start and prefix mapping events will still occur but are ignored by the XOM handler). Because the SAX API is used it is not possible to take advantage of just the FI-based well-formed checking and FI encoding features (just like bnux takes advantage of the bnux encoding features). All this puts FI at a big disadvantage. The only way to effectively get closer to an 'apples-to-apples' comparison is to compare using the same level of optimizations/tricks and API. That means developing an optimal FI XOM parser or an optimal bnux SAX parser that performs all the well-formed checks. I am currently in the process of developing the former (using the SAX DOM parser as a template). For development am using XOM-1.1b4 (patched with Wolfgang's performance patches) and an early access of nux 1.4 that Wolfgang has kindly sent me. Part of this development requires that i can measure things. I have used Japex to develop specific drivers for 1 and 2 in addition to the FI SAX parser and the soon-to-be-fully implemented optimal FI XOM parser. Preliminary results produced from measuring these drivers (minus the FI XOM parser) on a small set of documents show that: the FI SAX parser (performing well-formed checks) results are not that much slower than bunx form 2) results (using a null node factory, with no well-formed checking); the FI SAX parser form 2) results are twice as slow as the the FI SAX parser results. Which indicates the use of the well-formed checking XOM SAX handler with a null node factory is costly; and the difference between the results of FI SAX parser form 1) and FI SAX parser form 2) is much larger than the difference between the results of bunx form 1) and bunx form 2). This indicates that well-formed checking XOM SAX handler in addition to Java object creation is very expensive (some of the well-formed checking is performed at object creation). Rather than present detailed results of the above and potentially compare 'apples-to-oranges', namely the FI SAX parser with the bnux parser using the null node factory, it would be far more convincing if I wait until the optimal FI XOM parser is complete and present results comparing this to bnux form 1) to give an 'apples-to-apples' comparison. Such results indicate that an optimal FI XOM parser could perform a lot better than using the FI SAX parser and could close the gap between FI and bnux. I hope this will be the case. Stay tuned!
https://blogs.oracle.com/sandoz/entry/fast_infoset_and_bnux_performance
CC-MAIN-2014-15
refinedweb
996
60.24
if __name__ == "__main__": block of code. However, if the module is also meant to possibly be used by itself, then this approach doesn't work and the testing code has to be put in a separate module. I wish it would be possible to write something like if __name__ == ''SomeNameChosenForTestingPurpose": inside this_module.py and that importing the module using import this_module as SomeNameChosenForTestingPurpose would result in the variable __name__ inside this_module.py being assigned to SomeNameChosenForTestingPurpose. This would allow the inclusion of the testing code to be always kept inside a given Python module. To build a test suite, one would only need to have a module that does a series of "import ... as ..." statements. As it is, __name__ is either equal to "__main__" or the original name of the Python file (this_module in the example above). ===In short, I would like to be able to design Python modules in this way: some clever Python code if __name__ == "__main__": some clever Python code to be executed when this module is called as the main program. if __name__ == "SomeNameChosenForTestingPurpose": Some clever Python code to be executed when this module is imported as SomeNameChosenForTestingPurpose
http://aroberge.blogspot.com/2006_02_01_archive.html
CC-MAIN-2014-15
refinedweb
192
52.29
Am Montag, den 09.07.2007, 00:11 +1000 schrieb René Dudfield: > I think the reason is that zope, and paste are not named for what they do. > > I mean, without knowing what's in them, zope and paste are kind of > abstract things for people. > > I mean if something was called zope.configurator vs configurator - > people might think the zope one is zope specific. That it's for zope, > or used with zope. > > Putting all the zope bits separately in the cheeseshop makes it more > obvious that they can be used separately. But I still keep thinking > they are zope specific things - even though I know they can be used > separately. > > Same for paste. > > That is my thinking anyway - maybe other people think that way too. That argument would make any kind of namespacing for packages futile. Would any of the gocept packages imply they are specific to gocept? Is the `sun` namespace in Java packages only for code that is used internally with sun? Why would we put it on the cheeseshop if it wasn't relevant to others as well? Maybe namespace packages did not fully arrive yet. Christian
http://mail.python.org/pipermail/web-sig/2007-July/002735.html
CC-MAIN-2013-20
refinedweb
192
75.91
WebReference.com - Part 3 of Chapter 1: Professional XML Schemas, from Wrox Press Ltd (5/5) Professional XML Schemas Validating an Instance Document Now let's try validating an instance document against our simple schema: <?xml version = "1.0" encoding = "UTF-8"?> <Name xmlns: <firstName>John</firstName> <middleInitial>J</middleInitial> <lastName>Johnson</lastName> </Name> Here, we have used the xsi:noNamespaceSchemaLocation attribute to indicate the location of the schema document to which the XML instance document conforms. In this case, it is in the same directory. Note that if you're validating this with the online version of XSV, both the XML file and the schema file need to be accessible over the web. Here's what the results look like for this file, name.xml: The things to look out for here are the statement that there are no schema-validity problems in the target, and that the " Validation was strict": this means that the instance document has correctly validated against the schema. If you see the validation described as " lax", then you'll know that your document has not been validated, though it may be well formed. Note also the line at the bottom of the output, " Attempt to import a schema document from for no namespace succeeded". This means that XSV has successfully found and loaded the correct schema document. Let's take a look at an instance document with some problems, so you can see how XSV reports errors in document validation. Here, we've simply slipped in an extra title element that is not declared in our schema: <Name xmlns: <title>Dr</title> <firstName>John</firstName> <middleInitial></middleInitial> <lastName>Johnson</lastName> </Name> Let's try this one with our local version of XSV. In this case, we don't use the -i flag, as we are validating an instance document, not a schema, so we use the command: > xsv -o xsv-out.xml -s xsv.msxsl name_2.xml And this is what the output looks like: In the first part of the output, we see the line, " 2 schema-validity problems were found in the target". If you look at the section below, where the problems are listed in detail, you can clearly see that there is a title element that is not allowed according to the schema, and XSV was expecting the firstName element to appear in its place. The first number after the file name (in this case 4) indicates the line number on which the error occurred. Again, this information can be very useful when debugging schemas. The output prefixes all of the element names with {None}to indicate that these elements are not part of a namespace. We'll be seeing how to create schemas with a target namespace in Chapter 6. In the final part of this chapter, we'll be tying together the ideas that we have met so far in a slightly more complex example. [Continued in part 4 - Ed.] Created: October 25, 2001 Revised: October 25, 2001 URL:
http://www.webreference.com/authoring/languages/xml/schemas/chap1/3/5.html
CC-MAIN-2013-48
refinedweb
501
60.24
On 16 Apr, 03:36 pm, pje at telecommunity.com wrote: >At 03:46 AM 4/16/2009 +0000, glyph at divmod.com wrote: >>On 15 Apr, 09:11 pm, pje at telecommunity.com wrote: >. [snip clarifications] >Does that all make sense now? Yes. Thank you very much for the detailed explanation. It was more than I was due :-). >MAL's proposal requires a defining package, which is counterproductive >if you have a pure package with no base, since it now requires you to >create an additional project on PyPI just to hold your defining >package. Just as a use-case: would the Java "com.*" namespace be an example of a "pure package with no base"? i.e. lots of projects are in it, but no project owns it? >. Just to clarify things on my end: "namespace package" to *me* means "package with modules provided from multiple distributions (the distutils term)". The definition provided by the PEP, that a package is spread over multiple directories on disk, seems like an implementation detail..*. Right now it just says that it's a package which resides in multiple directories, and it's not made clear why that's a desirable feature. >> The concept of a "defining package" seems important to avoid >>conflicts like this one: >> >> [snip some stuff about plugins and package layout] >Namespaces are not plugins and vice versa. The purpose of a namespace >package is to allow projects managed by the same entity to share a >namespace (ala Java "package" names) and avoid naming conflicts with >other authors. I think this is missing a key word: *separate* projects managed by the same entity. Hmm. I thought I could illustrate that the same problem actually occurs without using a plugin system, but I can actually only come up with an example if an application implements multi-library-version compatibility by doing try: from bad_old_name import bad_old_feature as feature except ImportError: from good_new_name import good_new_feature as feature rather than the other way around; and that's a terrible idea for other reasons. Other than that, you'd have to use pkg_resources.resource_listdir or somesuch, at which point you pretty much are implementing a plugin system. So I started this reply disagreeing but I think I've convinced myself that you're right. ..
https://mail.python.org/pipermail/python-dev/2009-April/088838.html
CC-MAIN-2017-30
refinedweb
380
61.67
Hi guys, I am having some issues getting my code to compile that I am working on that deals with inline functions and inheritance. The code is supposed to create a squareShape class that inherits the attributes of the rectShape class. I made the main code simply attempt to instantiate a squareShape object with particular properties (xpos, ypos, length of each side, and fill color) assigned to it. I'll include all of the code that I am using and below I'll tell what I've tried to do to resolve this (to no avail): The first header file is d_rectsh.h, which is created/provided by the author of the book: The next part is the sqshape.h file that I created that is supposed to declare the inherited squareShape class and use inline functions within the class:The next part is the sqshape.h file that I created that is supposed to declare the inherited squareShape class and use inline functions within the class:Code:#include <iostream> #include "d_rectsh.h" using namespace std; class squareShape: public rectShape { public: squareShape(double xpos = 0.0, double ypos= 0.0, double side = 0.0, shapeColor c = darkgray): rectShape(xpos,ypos,c), side(s) double getSide() const { return s; } void setSide(double s) { s=side; } private: double s; }; Here are the error messages that I get (I am using Visual C++ 6.0):Here are the error messages that I get (I am using Visual C++ 6.0):Code:#include <iostream> #include "sqshape.h" int main () { squareShape sq(4.0,4.0,3.0,red); return 0; } --------------------Configuration: ex_13_27 - Win32 Debug-------------------- Compiling... ex_13_27.cpp c:\program files\microsoft visual studio\vc98\ex_13_27\sqshape.h(13) : error C2612: trailing '=' illegal in base/member initializer list c:\program files\microsoft visual studio\vc98\ex_13_27\sqshape.h(13) : error C2664: '__thiscall rectShape::rectShape(double,double,double,double,c lass shapeColor)' : cannot convert parameter 3 from 'class shapeColor' to 'double' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called c:\program files\microsoft visual studio\vc98\ex_13_27\sqshape.h(13) : error C2614: 'squareShape' : illegal member initialization: 'side' is not a base or member c:\program files\microsoft visual studio\vc98\ex_13_27\sqshape.h(14) : error C2270: 'getSide' : modifiers not allowed on nonmember functions c:\program files\microsoft visual studio\vc98\ex_13_27\sqshape.h(14) : error C2601: 'getSide' : local function definitions are illegal C:\Program Files\Microsoft Visual Studio\VC98\ex_13_27\ex_13_27.cpp(10) : fatal error C1004: unexpected end of file found Here is what I have tried: I tried what is seen currently in the sqshape.h file and received the error messages above. I have also tried implementing the inline functions by preceeding them with "inline" before the function name, but that did not work. I've also tried using "inline" along with the class name (squareShape), but that did not work. I've looked for examples all over the web and the 3 or 4 other C++ books I have in my possession, but can't find anything that seems to solve my issue. Anything that someone can suggest is greatly appreciated. Thanks for your time, as always!
https://cboard.cprogramming.com/cplusplus-programming/49367-inline-functions-inheritance.html
CC-MAIN-2017-09
refinedweb
533
55.44
izer that automates the creation of new projects. npm init colyseus-app ./my-colyseus-app This interactive initializer takes care of our basic setup. While it’s also possible to use Colyseus with plain old JavaScript or Haxe, we’re going to stick with TypeScript. ? Which language you'd like to use? … ❯ TypeScript (recommended) JavaScript Haxe Once completed, we’ll have the following files generated for us in my-colyseus-app. . ├── MyRoom.ts ├── README.md ├── index.ts ├── loadtest ├── node_modules ├── package-lock.json ├── package.json └── tsconfig.json Let’s dive right into Colyseus by taking a closer look at: index.ts MyRoom.ts index.ts The newly created index.ts file is our main entry point and sets up our server. const port = Number(process.env.PORT || 2567); const app = express() app.use(cors()); app.use(express.json()) const server = http.createServer(app); const gameServer = new Server({ server, }); While not necessarily required, the default colyseus-app templates also uses express, so we can easily register additional route handlers on our backend. In case we don’t want to provide additional handlers, our setup boils down to: const port = Number(process.env.PORT || 2567); const gameServer = new Server(); The second part of our index.ts file is where we actually expose our game logic. // register your room handlers gameServer.define('my_room', MyRoom); // skipped for brevity gameServer.listen(port); console.log(`Listening on ws://localhost:${ port }`) Colyseus uses the notion of rooms to implement game logic. A room is defined on our server by its unique name, which clients use to connect to it. A room handles client connections and also holds the game’s state. It ‘ the central piece of our game. MyRoom.ts import { Room, Client } from "colyseus"; export class MyRoom extends Room { onCreate (options: any) { this.onMessage("type", (client, message) => { // handle "type" message }); } onJoin (client: Client, options: any) { } onLeave (client: Client, consented: boolean) { } onDispose() { } } As you can see, a handful lifecycle events are attached to a Colyseus room: onCreateis the first method to be called when a room is instantiated. We will initialize our game state and wire up our message listeners in onCreate onJoinis called as soon a new client connects to our game room onLeaveis the exact opposite of onJoin, so whenever a client leaves, disconnect and reconnection logic is handled here onDisposeis the last method to be called right before a game room is disposed of and where things such as storing game results to a database might be carried out - Although not included in the default room implementation, onAuthallows us to implement custom authentication methods for joining clients, as shown in the authentication API docs Now that we’ve walked through a basic Colyseus backend setup, let’s start modeling up the backbone of a game. When talking about online multiplayer games, state becomes an even more complex topic. Not only do we have to model it properly, but we also have to think about how we’re going to synchronize our state between all players. And that’s where Colyseus really starts to shine. Its main goal is to take away the burden of networking and state synchronization so we can focus on what matters: the game logic. Stateful game rooms Previously, we learned that a Colyseus room is able to store our game state. Whenever a new room is created, we initialize synchronizationfps). Shorter intervals allow for faster-paced games. fulfill certain properties to be eligible for synchronization: - It has to extend the Schemabase class - Data selected for synchronization requires a typeannotation - A state instance has to be provided to the game room via setState Position is a simple state class that synchronizes two number properties: row and col. It nicely demonstrates how Colyseus Schema classes allow us to assemble our state from primitive types, automatically enabling synchronization. Board Next up is our game board state. Similar to Position, it stores two number properties: the rows and cols of our two-dimensional game board. Additionally, its values property holds an array of numbers, which represents our board. So far, we only worked with single data, so how are we going to model our state class holding a data collection? With Colyseus, collections should be stored in an ArraySchema, Colyseus’ synchronizable Array dat with an additional number property storing its color. We’ll skip it here for brevity’s sake. For more info, you can. Additionally, it possesses several child schema properties to assemble the overall state. Using such nested child state classes gives us great flexibility when modeling our state. @type annotations provide a simple and type-safe way to enable synchronization and nested child schema allows us to break our state down, which enables reuse. Once again, if you want to follow along, the current tag is 02-gamestate in our repository. git checkout tags/02-gamestate -b 02-gamestate Working with game state: Frontend Now that the first draft of our state is completed, let’s see how we can work with it. We’ll start by building a frontend for our game, which will allow us to visualize our game state. Colyseus comes with a JavaScript client: npm i colyseus.js We won’t be using any frontend framework, only plain HTML, CSS, and TypeScript. The only two additional things we’ll use to build our frontend are NES.css and Parcel.js. We’ll include NES Let’s establish a connection to our backend. document.addEventListener('DOMContentLoaded', async () => { const client = new Client(process.env.TETROLYSEUS_SERVER || 'ws://localhost:2567'); ... }); Once connected, we can join or create a game room. const room: Room<GameState> = await client.joinOrCreate<GameState>("tetrolyseus"); The name we’re providing to joinOrCreate must be one of the game rooms defined on or backend. As its name implies, joinOrCreate either joins an existing room instance or creates a new one. Besides that, it’s also possible to explicitly create or join a room. In return, joinOrCreate provides a Room instance holding our GameState, which gives us access to our Board, the current Tetrolyso, its current Position, and so on — everything we need to render our game. Game rendering Now that we have access to our current GameState, werender our UI every time our state changes. Rooms provide certain events to which we can attach a callback,’ll add here is an npm script to build our frontend. "scripts": { "start:frontend": "parcel frontend/index.html" }, The current frontend state can be found in tag 03-frontend. git checkout tags/03-frontend -b 03-frontend Working with game state: Backend It’s time to get started with our game backend. But before we continue writing code, let’s move our existing code to a dedicated subfolder called backend. backend ├── TetrolyseusRoom.ts └── index.ts We’ll start our backend via the start:backend npm script. "scripts": { "start:backend": "ts-node backend/index.ts", "start:frontend": "parcel frontend/index.html" }, Initializing state Now that everything is in place, let’s further extend our TetrolyseusRoom. Since it’s a stateful room, the first thing we’ll do is to initialize. This will show the level, score, and the current and next Tetrolysos. Everything is rendered based on our initialized state. Scorings and 1s, along with row and column information. When visualized, a Z block looks like the following. +--------+ |110||001| |011||011| |000||010| +--------+ block exceeds the board and check whether any nonzero the board. The process of checking whether the current block collides with any of the existing blocks on the board is quite similar. Simply check for overlapping nonzero elements between the Game logic Until now, our game has been rather static. Instead of moving blocks, we just witnessed a single, static block that didn’t move. Before we can get things moving, we have to define some rules our game has to follow. In other words, we need to implement our game logic, which involves the following steps. - Calculate the next position of the falling block - Detect collisions and either move the current block or freeze it at its current position - Determine completed lines - Update scores - Update the board (remove completed lines, add empty ones) - Check whether we reached the next level The game logic implemented in our room reuses functionality from 05-collision to update the Game loop Now that we have our game logic set up, let’s assemble a the game clock. gameLoop!: Delayed; The onCreate handler will start the loop. onCreate(options: any) { ... const loopInterval = 1000 / (this.state.level + 1); this.gameLoop = this.clock.setInterval(this.loopFunction, loopInterval); ... } The blocks will initially drop at one row per second, becoming faster as we level up. If we reach only thing missing in onCreate are message handlers. The frontend communicates with the. If we open the frontend multiple times, we can also move and rotate a block from multiple sessions. If you want to jump straight to this point, you can check out tag 07-game-loop. git checkout tags/07-game-loop -b 07-game-loop Making it multiplayer With our Tetrolyseus game up and running, there’s one question left: What’s the multiplayer approach? Tetrolyesues implements a multiplayer mode that allows one player to only move a block while the other can only rotate it. We’ll keep a list of current players and assign each a>; Tthis map is used in both the); } The map limits player actions in the onMessage handlers. this.onMessage("move", (client, message: Movement) => { if (this.playerMap.has(client.id)) && this.playerMap.get(client.id).isMover()) { ... this.onMessage("rotate", (client, _) => { if (this.playerMap.has(client.id) && this.playerMap.get(client.id).isRotator()) { ... The first player to join is assigned to be a MOVER or ROTATOR at random, the next player is assigned the other role, and so on. Ready to play? Up to this point, our game loop started with the creation of our room. This poses a bit of a problem for the first joining player, who is only able to either move or rotate a block. To address this, let’s add a running flag to our GameState. @type("boolean") running: boolean; Additionally, we’ll introduce a new message type: ReadyState. export interface ReadyState { isReady: boolean; } export const READY = { isReady: true } export const NOT_READY = { isReady: false } The message handler for our ReadyState will update the players’ stat. Once all roles have been assigned and all players are ready, welll(); } }); } The frontend will display a modal prompting players to set themselves as button click sends? We’re finally ready to get our game out there! Let’s tack on some additional scripts to create an application bundle for easier shipping. First, we’ll creates an application bundle in app: app ├── backend ├── messages ├── public └── state The last tag to check out is 09-app-bundle. git checkout tags/09-app-bundle -b 09-app-bundle Summary In this tutorial, we built a fully functional multiplayer game from scratch without worrying too much about networking. Colyseus really keeps it out of our way and allows you to fully focus on your game. Since great gameplay is what ultimately gets people hooked on games, this is a really nice solution for building online multiplayer games. Where do you go from here? Colyseus has a lot more to offer than what we covered here. Some features we didn’t have time to touch on include: - Social login - Password-protected rooms - Configuring rooms - Handling dropouts/reconnets The logical next step would be to add a high score list. Now that you have a basic multiplayer game to build upon and improve, the sky’s the limit!_1<<.
https://blog.logrocket.com/building-a-multiplayer-game-with-colyseus-io/
CC-MAIN-2021-04
refinedweb
1,933
55.64
JavaRanch » Java Forums » Java » Threads and Synchronization Author Thread question Brian Spindler Greenhorn Joined: May 17, 2007 Posts: 29 posted Jun 16, 2007 09:09:00 0 Image you have a method doWork() that can take several minutes to complete, you want to spawn a bunch of these from your getWorkDone() method and wait for them to complete then return. Help me to improve the following code: public class TestInnerRunnable { private int running = 0; public TestInnerRunnable() { } public void getWorkDone() { for (int i = 0; i < 500; i++) { Executors.newSingleThreadExecutor().execute(new Runnable() { public void run() { doWork(); } }); } do { try { Thread.sleep(1 * 1000); System.out.println("Main thread sleeping..."); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } while (running > 0); System.out.println("Threads finished!"); } public void doWork() { this.setRunning(this.getRunning() + 1); try { System.out.println("Thread-" + Thread.currentThread().getId() + " running..."); for (int i = 0; i < 10; i++) { Thread.sleep(1 * 1000); System.out.println("Thread-" + Thread.currentThread().getId() + " processing [" + i + "]..."); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { this.setRunning(this.getRunning() - 1); } } public synchronized int getRunning() { return this.running; } public synchronized void setRunning(int r) { this.running = r; } public static void main(String[] args) { TestInnerRunnable tir = new TestInnerRunnable(); tir.getWorkDone(); } } [ June 16, 2007: Message edited by: Brian Spindler ] Stan James (instanceof Sidekick) Ranch Hand Joined: Jan 29, 2003 Posts: 8791 posted Jun 16, 2007 15:06:00 0 Look at ThreadPoolExecutor awaitTermination. Does that do what you need? There are some other ways. I did exactly what you did before I found join(). This technique loses the benefits of your thread pool if you have more tasks than you'd like to have run all at once. for each task Runnable r = new MyRunnable( task ) Thread t = new Thread( r ) t.start() add t to collection threads next for each Thread in collection threads t.join() next FutureTask is a bit cleaner than that because you don't have to touch the Threads. You could pass a bunch of FutureTasks to an executor and then call get() on each one. for each task create a FutureTask( task ) pass it to an Executor save it in collection tasks next for each future in collection tasks call get() next Now you can control the number of threads working at the same time and reuse them if necessary. Any of that sound good? [ June 16, Jun 16, 2007 15:40:00 0 I like Stan's suggestions here. If you want to stick with the code you've got written though, the big problem I see is here: this.setRunning(this.getRunning() - 1); Both setRunning() and getRunnint() are synchronized, but that's useless here, because there's a gab between the call to getRunning() and the call to setRunning(). It's equivalent to this: int r = this.getRunning(); // other threads can do stuff here this.setRunning(r - 1); To protect against interference from other threads, you would need a synchronized block or method that contains both method calls. For example: public synchronized void decrementRunning() { this.setRunning(this.getRunning() - 1); } or more simply: public synchronized void decrementRunning() { running--; } This sort of problem is common with many synchronized methods - any time you need to call two or more different synchronized methods in succession, you need to consider what happens if another thread calls a method in between those method calls. Typically the answer is to place the synchronization at a higher level than it was before. "I'm not back." - Bill Harding, Twister Nicholas Jordan Ranch Hand Joined: Sep 17, 2006 Posts: 1282 posted Jun 17, 2007 16:19:00 0 In addition to suggestions posted by Stan and Jim. The one thing that stands out for me is the Thread.sleep(1 * 1000); I suggest a join(), or more preferrably CyclicBarrier as established practice. I always waste some processor cycles on checking some condition in a loop or something, considering any sort of wait() to be unreliable Also, see: Concurrent Programming with J2SE 5.0 [ June 17, 2007: Message edited by: Nicholas Jordan ] "The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature." Brian Spindler Greenhorn Joined: May 17, 2007 Posts: 29 posted Jun 18, 2007 05:34:00 0 Thanks Ranchers! I think I've got enough to go on. At this point I'm leaning towards the FutureTask approach, it seems perfect for my needs. I need to submit N tasks and wait for them to finish processing before I can return the computation. And thanks Jim for the heads up on the synchronization issues. I agree. Here's the link: subject: Thread question Similar Threads Why does notifyAll cause deadlock ? synchronised block stopping a thread help me guys 2 thread instances using the same Runnable object All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/233842/threads/java/Thread
CC-MAIN-2014-35
refinedweb
824
64.71
Trend.bz combines a whole heap of the top internet trends into one location. Check out what’s hot on the internet right now including the top YouTube videos, the top Google searches, the top eBay items and more. Trend.bz – The top internet trends in one place Posted in Uncategorized. Comments Off on Trend.bz – The top internet trends in one place – May 31, 2011 Stop Outlook from formatting phone numbers In Australia, mobile numbers are formatted like this: 0499 999 999 If you out that into an Outlook contact record, it will most likely format it in another stupid way. You can stop Microsoft Outlook from automatically formatting phone numbers in Windows 7 by: - Clicking “Start” and search for “dialing rules” - Select “Set up dialing rules” - Edit the entry for “My location” - Set the area code to 1 - Click ok twice Outlook will stop formatting phone numbers. It’s a similar procedure on Windows Vista and XP. Posted in Uncategorized. – October 20, 2010 Create a htaccess file in Windows Creating a .htaccess file using Windows is easy, just put double quotes around the file name when saving. For example, if you are using Notepad: - Click File -> Save As - Enter the filename as: ".htaccess" (with the double quotes) Posted in Uncategorized. – July 6, 2010 Apache: Using htaccess to restrict access to a file As well as being able to restrict access to directories, you can restrict access to specific files using htaccess files in Apache. For example, to protect “secret.php” using basic auth: AuthType Basic AuthName "Authorised users only" AuthUserFile /path/to/user/file AuthGroupFile /path/to/group/file <files secret.php> Require user xxxx </files> Posted in Uncategorized. – June 29, 2010 OnClientClick and ASP.NET Validator controls If you use ASP.NET validator controls and try to use OnClientClick event, you will find that the validator wornt run. The solution is to add this to your javascript code: if(Page_ClientValidate()) From: Posted in Uncategorized. – August 16, 2009 Setting up WatiN with NUnit on Windows 7 - Copy WatiN.Core.dll and Interop.SHDocVw.dll from the WatiN installation folder to your project’s bin folder - Add “using WatiN.Core” directive to the top of your code - The correct threadstate needs to be set () - Create a file in your bin directory which has the same name as your assembly or executable, but with “.config” at the end. Eg: FOr “myFile.exe” create “myFile.exe.config” - Paste in the following: <> - That will let you run tests in NUnit if you load the assembly or executable directly into NUnit. If you want to create an NUnit project, you will also need to copy that config file into the directory that the NUnit project file is saved in. - Add localhost, as well as any other external sites the application references to “Trusted Sites” in internet explorer. That means if you have google ads for example,. you will need to add googleads.g.doubleclick.net to the trusted sites list. - You need to run NUnit as Administrator Posted in Uncategorized. – July 23, 2009 Moving an MS SQL Server database from one server to another This post is for: - Publishing an SQL Server database (including DDL and data)to another server - Moving / publishing a database to a shared hosting service (such as GoDaddy) when that service does not allow you to restore a database that was not backed up using their systems. Creating the scripts - Download the SQL Server Database Publishing Wizard from one of these URLs - - - Install on the source server - Run the GUI and follow the wizard. - Select publishing service if required (GoDaddy instructions are here: - Hosting service URL is found in GoDaddy by clicking: Hosting -> My Hosting Account -> Manage Account -> Databases -> SQL Server -> “Edit/View Details” icon -> “Configuration” icon Installing the scripts You can either run the scripts on the target server manually, or use the Database Publising Wizard to do this for you. Posted in Uncategorized. Comments Off on Moving an MS SQL Server database from one server to another – July 13, 2009 Restoring an SQL Express database on another computer These instructions assume you have backed up to a file using SQL Server to do the backup. The file will have a .bak file extension. These instructions apply to Microsoft SQL Server Management Studio Express 2005 and 2008, which are available as a free downloads from the Microsoft site. Optional – Retaining the old database when restoring to point in time This is an optional step that you can use if you are restoring a database back to a point in time (due to data entry error for example) and will retain the existing database in case you wish to go back to it for any reason. - Using SQL Server Management studio, in the object explorer under the “Databases” node, right click your database and choose “rename”. Give it another name. - Execute the following code: USE master GO ALTER DATABASE [YourDatabaseName] SET OFFLINE WITH ROLLBACK IMMEDIATE GO - The database will now be offline (you may need to right click the database and select “refresh” in the object explorer to see this) - Right click the database select “Properties” - Copy the top value under “Path” - Browse to this path using Windows Explorer. You will see the database files. - Rename the database files to match the new database name you provided above. - If you wish to go back to this database at any time, you may need to: - Go back into properties and alter the file names under the “File Name” to match the new file names you gave to the database files - Bring the database back online (you can right click and select Tasks – > Set Online Performing the restore - Copy the backup file to the target SQL server file system - Using SQL Server Management studio, in the object explorer right click the “Databases” node and select “New Database…” - Name the database how you like and click ok. - In the object explorer, right click the database you just created and select “Properties” - In the left hand side, select “Files” - Copy the two values under “Path” and the two values under “File Name”. Paste into Notepad, joining the File Name to the Path. You will need them later. - In the object explorer, right click “Databases” again and choose “Restore Database…” - In the “To database” field, select the database you just created. - Select “From device” - Now select your .bak file as the source. - In the window below, your backed up database will appear. Check the checkbox to the left of it. - Select “Options” from the left. - Make sure “Overwrite the existing database” is checked. - For first file listed in “Restore the database files as”, paste the locations that you copied in step 6. Make sure the log one goes into the log field and vice versa. - Click OK on the Restore Database window. The restore should now happen without error. - Restart any services that access the database, if applicable. Posted in Uncategorized. – June 28, 2009 PowerShell from ASP.NET and System.Management.Automation – SOLVED! Wow, this took a long time to figure out, but now I can tell you exactly how to get the System.Management.Automation namespace into yout asp.net web site in order to run PowerShell commands. 1. You need to download the Windows SDK. Download it from here: 2. When installing the above SDK, be sure to follow these instructions: 3. Reboot the machine. 4. Open the web.config file in your asp.net website and add the following: <compilation debug=”true”> <assemblies> <add assembly=”System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/> </assemblies> </compilation> 5. On the page that you want to do PowerShell things from, put this at the top: using System.Management.Automation.Runspaces; using System.Management.Automation; 6. Follow this article for a demo of how to execute commands: Posted in Uncategorized. – August 5, 2008 CREATE OR REPLACE syntax for SQL Server I encourange everyone to go to Microsoft Connect and vote for a “CREATE OR REPLACE” syntax for T-SQL: Under the current arrangement, you have to check if the object exists first, if it does then drop it and then re-create – LAME Posted in Uncategorized. – May 7, 2008
http://bx.com.au/blog/page/2/
CC-MAIN-2018-30
refinedweb
1,368
63.9
On Sun, Jul 21, 2019 at 3:00 PM Brian Bouterse <bbouters at redhat.com> wrote: > > > On Sun, Jul 21, 2019 at 6:23 AM Tatiana Tereshchenko <ttereshc at redhat.com> > wrote: > >> +1 to the idea of a repo_key. >> >> Should we also add the ability to apply custom validation of the content >> being added? >> Similar to a repo_key, Content model can optionally provide an additional >> validator. >> Use cases: >> - for pulp_file to avoid relative path overlap - e.g. 'a/b' and 'a' >> > In thinking this over more, I'm unsure that pulp_file has the use case. > Two different Artifacts having relative paths 'a' and 'a/b' in one repo > version doesn't seem problematic. This problem statement is similar to the > Distribution.base_path overlap problem statement where it's unavoidably > ambiguous which Distribution should be matched when base_paths are allowed > to overlap. In this case for pulp_file, it's not ambiguous in the same way, > the relative_path I expect to match to exactly 1 content unit either 'a', > or 'a/b', but not both. What do you think about this? > I agree that the problem is similar to the Distribution.base_path overlap. If I understand you correctly, yes, it's not a problem if you query content one by one. What about use cases when we want to have a repo version on a filesystem? E.g. Browsable repositoiries (this feature has already been asked for by our stakeholders), export (e.g. rsync). > > - for pulp_rpm to filter by signature/signing key >> > Can we expand on this use case a bit? Is it that the repo version should > only contains units signed or unsigned rpms? Or is it that we are ok with a > mixture as long as each NEVRA is unique? I suspect the former, but I want > to be sure. > I think it should contain only signed units and optionally signed by specific keys only. See pulp 2 feature description Another use case which comes to mind is: keeping the last N versions of a unit within a repo verison. Tanya > >> Plugins can solve it by defining their own stage but it seems like almost >> any plugin needs to ensure absence of collisions specific to it, even the >> simple pulp_file. >> It means that our default pipeline becomes less useful and will be hardly >> ever used by any [currently known] plugins. >> >> Any thoughts? >> >> Tanya >> >> >> On Mon, Jul 8, 2019 at 9:09 PM Brian Bouterse <bbouters at redhat.com> >> wrote: >> >>> I want to retell Simon's proposal to have "Content defines a 'repo_key' >>> similar to a unit_key. This key must be unique within a repo version (and >>> not globally like the unit_key." >>> >>> We could adopt his proposal to have the repo_key tuple defined on >>> Content in pulpcore. If we left the add/remove APIs in core and adopt for >>> both sync and add/remove a "keep newest to associate" functionality >>> described earlier in the thread. This "keep newest to associate" code would >>> be used by sync in the form of a core stage that is a generalized version >>> of the RemoveDuplicates stage. This would become part of the default >>> pipeline for all users of Stages API. I think this would be better than >>> plugin writers implementing it over and over and also less effort for >>> plugin wrtiers. This design would meet the current needs of pulp_cookbook, >>> pulp_file, and pulp_rpm which are the only 3 places I know we have this >>> problem so far, but I believe more content types are susceptible to this. >>> >>> What do you think we should do? >>> >>> Thanks! >>> Brian >>> >>> >>> >>> >>> >>> On Thu, Jun 27, 2019 at 4:03 AM Tatiana Tereshchenko < >>> ttereshc at redhat.com> wrote: >>> >>>> Sure, the code can be de-duplicated. >>>> My main worry is that it's a responsibility of a plugin writer not to >>>> forget to ensure uniqueness constraints within a repo version for every >>>> workflow (sync, copy, anything else) where a repo version is created. >>>> Every time before RepositoryVersion.create() is called, there should be >>>> a check that there is no colliding content in a repo version. >>>> It would be much more reliable and friendly, in my opinion, if plugin >>>> writer could define rules/callbacks/whatever for each content and it would >>>> be applied to any repository creation. >>>> At the same time this eliminates the flexibility to define different >>>> logic for content collision for different workflows, however I'm not sure >>>> if such a use case exists or is desired. >>>> >>>> Tanya >>>> >>>> >>>> On Wed, Jun 26, 2019 at 6:49 PM Austin Macdonald <amacdona at redhat.com> >>>> wrote: >>>> >>>>> @Tanya Tereshchenko <ttereshc at redhat.com> >>>>> >>>>>> Do I understand correctly that it doesn't cover the sync case and >>>>>> it's only about explicit repo version creation? >>>>>> >>>>> >>>>> I don't mean that add/remove could not share code with remove >>>>> duplicate stage. I wanted to point out that we have a problem here (how to >>>>> remove duplicates) that has similar patterns to other problems with add >>>>> remove (recursive, copy, deciding which content to keep with a collision, >>>>> etc.) I don't doubt that pulpcore could help solve these problems, but I >>>>> think that as we approach our GA, we should consider solving this problem >>>>> (for now) by getting out of the way of plugin writers rather than by >>>>> implementing code that is supposed to work for all plugins. I suspect that >>>>> plenty of the plugins will be implementing their own add/remove anyway. >>>>> >>>>> On Tue, Jun 25, 2019 at 12:56 PM David Davis <daviddavis at redhat.com> >>>>> wrote: >>>>> >>>>>> I don't think this solution would work in the case of creating a new >>>>>> repository version. Suppose for example you had two content units that >>>>>> collide, one in a repo version and one older unit that a user explicitly >>>>>> wants to add to the repo version. If the latter one is older, then what >>>>>> would happen? >>>>>> >>>>>> David >>>>>> >>>>>> >>>>>> On Tue, Jun 25, 2019 at 12:48 PM Brian Bouterse <bbouters at redhat.com> >>>>>> wrote: >>>>>> >>>>>>> Having a way for units to express their uniqueness per repo sounds >>>>>>> good because then more areas of Pulp's code could answer the question: >>>>>>> "will I have a duplicate if I add content X to repo_version Y". >>>>>>> >>>>>>> Let's assume we know that situation is about to occur during sync >>>>>>> for example, what do we do about it? In the errata case we know the "new" >>>>>>> one should replace the existing one. Maybe we start to 'order' the units >>>>>>> with colliding repo keys and keep the newest one always? Would this work >>>>>>> for pulp_cookbook and pulp_rpm? Would it generalize? Is this what you >>>>>>> imagined? >>>>>>> >>>>>>> On Tue, Jun 25, 2019 at 5:30 AM Tatiana Tereshchenko < >>>>>>> ttereshc at redhat.com> wrote: >>>>>>> >>>>>>>> Do I understand correctly that it doesn't cover the sync case and >>>>>>>> it's only about explicit repo version creation? >>>>>>>> So the suggestion is to implement the same logic twice: for sync >>>>>>>> case - RemoveDuplicates stage and/or maybe some custom stage (e.g. to >>>>>>>> disallow overlapping paths), and for direct repo version creation - your >>>>>>>> proposal. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Jun 24, 2019 at 3:13 PM Austin Macdonald < >>>>>>>> amacdona at redhat.com> wrote: >>>>>>>> >>>>>>>>> I have a design in mind for solving this problem: >>>>>>>>> >>>>>>>>> 1. Remove POST to RepositoryVersion (no general add/remove >>>>>>>>> endpoint). >>>>>>>>> 2. Add an endpoint to kick off an add/remove task, namespaced by >>>>>>>>> plugin. ie `POST pulp/api/v3/docker/add-remove/` >>>>>>>>> This view can be provided to all plugins by the plugin >>>>>>>>> template, and will be based on the current RepositoryVersionCreate: >>>>>>>>> >>>>>>>>> >>>>>>>>> Note: the main purpose of this view is to kick off the general >>>>>>>>> add/remove task, which will be unchanged: >>>>>>>>> >>>>>>>>> >>>>>>>>> 3. Add an add/remove serializer to the plugin API. >>>>>>>>> 3. Plugins needing further customization can provide their own >>>>>>>>> task and subclassed serializer. >>>>>>>>> >>>>>>>>> This gives the plugin writer full control over the endpoint >>>>>>>>> (customizable arguments and validation), and full control over the flow >>>>>>>>> (extra logic, depsolving, enforced uniqueness). It only uses the existing >>>>>>>>> patterns (and existing required knowledge), but requires no work (other >>>>>>>>> than using the template) for the simple case. >>>>>>>>> >>>>>>>>> On Mon, Jun 3, 2019 at 2:56 PM Simon Baatz <gmbnomis at gmail.com> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> On Mon, Jun 03, 2019 at 09:11:07AM -0400, David Davis wrote: >>>>>>>>>> > @Simon I like the idea behind the repo_key solution you came >>>>>>>>>> up with. >>>>>>>>>> > Can you be more specific around cases you think that it >>>>>>>>>> couldn't >>>>>>>>>> > handle? I imagine that plugin writers could use properties or >>>>>>>>>> > denormailzation (ie additional database columns) to solve >>>>>>>>>> cases where >>>>>>>>>> > they need uniqueness across data that isn't in the database. >>>>>>>>>> In a worst >>>>>>>>>> > case scenario, they can't use the pulpcore solution and just >>>>>>>>>> have to >>>>>>>>>> > roll their own. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> What I wrote probably sounded too pessimistic. You are right, in >>>>>>>>>> most cases that should be doable. >>>>>>>>>> >>>>>>>>>> I agree that we could have a simple default solution that just >>>>>>>>>> requires to specify a couple of field names in the easiest case. >>>>>>>>>> As you >>>>>>>>>> say, it should be possible use custom logic in a plugin if >>>>>>>>>> required. >>>>>>>>>> >>>>>>>>>> Here is the case I was thinking of that it can't handle: >>>>>>>>>> >>>>>>>>>> In pulp_file, a uniqueness constraint on "relative_path" would >>>>>>>>>> allow >>>>>>>>>> content units "a" and "a/b" to be in a repo version. >>>>>>>>>> >>>>>>>>>> However, we may want file repos to be representable on an actual >>>>>>>>>> file >>>>>>>>>> system (e.g. when exporting them as tar files). For the repo >>>>>>>>>> above, >>>>>>>>>> this does not work, as "a" can't be a file and a directory at the >>>>>>>>>> same time on a standard Unix file system. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>>: <>
https://listman.redhat.com/archives/pulp-dev/2019-July/003287.html
CC-MAIN-2022-40
refinedweb
1,577
70.63
This solution explains a socket approach to sending a message (broadcast message) to clients in the same VLAN (Virtual Lan). If broadcasting is needed for the whole LAN (over all VLANs) in the same local area network then you have to use Remoting instead of Sockets. The application consists of two programs "Clfrm" and "SERVfrm." Clfrm exists on all LAN computers and SERVfrm exists on the server. When the time is 12:00 AM the SERVfrm will send a broadCast message to all connected clients (Clfrm). The Clfrm will receive the message and run an alert form to notify the user. I use the following namespace to do my job: System.Net System.Net.Sockets The time was an important factor, as was having no delay when sending/receiving a message from the server to all clients. So, I used sockets instead Of remoting (remoting may cause a simple delay). // Timer to Check Server Time private void timer1_Tick(object sender, System.EventArgs e) { // Display Server Time label1.Text = System.DateTime.Now.ToLongTimeString(); The timer here is to get the server time. if(System.DateTime.Now.Hour == 11 && System.DateTime.Now.Minute==59 && System.DateTime.Now.Second==59) Check if the time is 11:59:59. { /* Define a socket Dgram Socket : Provides datagrams, which are connectionless messages of a fixed maximum length. This type of socket is generally used for short messages, such as a name server or time server, since the order and reliability of message delivery is not guaranteed AddressFamily.InterNetwork indicates that an IP version 4 addresses is expected when a socket connects to an end point. */ Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); // Protocol Type is UDP //Get the IP Broadcast address , Use The Port 9050 IPEndPoint iep1 = new IPEndPoint(IPAddress.Broadcast, 9050); //IP Broadcast Range using Port 9050 IPEndPoint iep2 = new IPEndPoint(IPAddress.Parse("192.168.100.255"),9050); byte[] data = Encoding.ASCII.GetBytes("12"); // The Data To Sent /* Set Socket Options ---> SocketOptionLevel Member name Description IP Socket options apply only to IP sockets. IPv6 Socket options apply only to IPv6 sockets. Socket Socket options apply to all sockets. Tcp Socket options apply only to TCP sockets. Udp Socket options apply only to UDP sockets. */ //SocketOptionName.Broadcast : to enable broadcast sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); sock.SendTo(data, iep1); sock.SendTo(data, iep2); sock.Close(); } // In the first run of the client application the firewall will show the below message. When The Clfrm runs on the client machine it will not appear in the desktop or task manager Application tab. I put ShowInaskbar = false in 'Clfrm' which will hide the 'Clfrm' from the Task Manager Application Tab (it will appear in the process tab), and made Opacity = 2 ShowInaskbar = false Opacity = 2 Press unlock to allow the client to use 9050 port to receive messages from the server. // public string TI ="0"; string stringData ; This timer will check the value of stringData stringData private void timer1_Tick(object sender, System.EventArgs e) { Socket sock = new Socket(AddressFamily.InterNetwork,SocketType.Dgram, ProtocolType.Udp); /* The Socket.Bind method uses the Any field to indicate that a Socket instance must listen for client activity on all network interfaces. The Any field is equivalent to 0.0.0.0 in dotted-quad notation. */ IPEndPoint iep = new IPEndPoint(IPAddress.Any, 9050); //Associates a Socket with a local endpoint EndPoint ep = (EndPoint)iep; sock.Bind(iep); byte[] data = new byte[1024]; int recv = sock.ReceiveFrom(data, ref ep);// Receive Data stringData = Encoding.ASCII.GetString(data, 0, recv); TI=stringData; sock.Close(); } private void timer2_Tick(object sender, System.EventArgs e) { if(TI == "12") { timer2.Interval = 3000; TI = "0"; stringData = "0"; Process.Start(Application.StartupPath+"\\ALER.exe"); // Run ALER.exe } else { timer2.Interval =400; } } // The sock.Close(); will close the port 9050 for future use. sock.
http://www.codeproject.com/Articles/21398/Broadcasting-Using-Socket-Oriented-Approach
CC-MAIN-2015-40
refinedweb
636
52.15
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode. Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript). On 12/03/2017 at 01:17, xxxxxxxx wrote: I searched a bit and found some interesting info, but it seemed not possible, but I wanted to just check. If I enable softSelect, is it possible to get the weight value of each vertex? Not only to find out which points will be effected by the softSelect, but also their percentage or influence? I'd like to get all that data to use elsewhere, but I fear it is not possible in Python. Am I wrong? On 13/03/2017 at 03:41, xxxxxxxx wrote: Hi, It's possible to get soft selection values in Python. The hidden soft selection data has to be retrieved and converted from byte string to float values. Note VariableTag.GetAllHighlevelData()/SetAllHighlevelData() doesn't support soft selection tag data so we have to use VariableTag.GetLowlevelDataAddressR()/GetLowlevelDataAddressW()(see c4d.VariableTag for more information). Here's some code: import c4d import array def main() : # Get soft selection tag tag = op.GetTag(c4d.Tsoftselection) if tag is None: return # Get soft selection data data = tag.GetLowlevelDataAddressR() if data is None: return # Convert soft selection byte data to a float array floatArray = array.array('f') floatArray.fromstring(data) softValues = floatArray.tolist() # Print weights for value in softValues: weight = 1.0 - value print weight if __name__=='__main__': main() On 14/03/2017 at 00:12, xxxxxxxx wrote: Thanks Yannick! That works well. But why did you do weight = 1.0 - value? That seems to put unaffected weights to 1.0 instead of 0.0. Otherwise it all worked and my script works like a charm. On 14/03/2017 at 04:04, xxxxxxxx wrote: Glad it works fine. Originally posted by xxxxxxxx But why did you do weight = 1.0 - value? That seems to put unaffected weights to 1.0 instead of 0.0. Originally posted by xxxxxxxx But why did you do weight = 1.0 - value? That seems to put unaffected weights to 1.0 instead of 0.0. Sorry for inverting the weight values. I was confused by some internal code.
https://plugincafe.maxon.net/topic/10008/13474_get-softselection-data-in-python
CC-MAIN-2021-31
refinedweb
387
69.07
That's it... Jaime I guess, you are speaking about export: in your "def" file: //example EXPORTS ; Explicit exports can go here DllGetClassObject PRIVATE DllRegisterServer PRIVATE Dmitriy, MCSE No! if the subject of the question has the word "import" is about that what I was asking for. I am NOT doing a DLL so I DON'T want to make any exports. I just want to USE the functions from a DLL, so that I need to IMPORT them. In BC++ I did something like INT WINAPI _import FS_GetAuxCommMsg( long UnitNo, char *Buffer, long Length ); where GS_GetAux is a function from a DLL. I have to import it so that I am able to use it in my program and the linker can link by using the LIB file which has been added to the project. So... my questions can be enumerated as follows: 1. How to declare the IMPORT in the Header file. Maybe something like _declspec(dllimport). 2. How to include the DLL file in my project. In BC++ I had to create a LIB file from the DLL and then add it to the project, so that the Linker can link the functions properly. How can I do it in VC++ 6.0 Now... that's it thanks in advance Jaime Jaime, maybe you were not on the same wavelength as Dmitriy: You have to export your functions & classes for them to be imported elsewhere. Here is my latest DLL exporting CHook (this is "Hook.h": #include "SetWindowsHookExDLLDeclSpec.h" // START EXPAND #ifndef _SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC__H_ #define _SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC__H_ #ifndef AFX_DLL #define SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC __declspec( dllexport ) #else #define SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC __declspec( dllimport ) #endif #endif // _SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC__H_ // END EXPAND ///////////////////////////////////////////////////////////////////////////// // CHook window class SET_WINDOWS_HOOK_EX_DLL_DECL_SPEC CHook { // whatever.... }; When the above is compiled in the DLL project, AFX_DLL is defined, and the class is exported. When the above is included in the EXE, it is imported, so all you have to do is tell your linker to import the library (through project settings), or in code (#pragma comment lib libname). Note that if you are importing the above in another DLL, you are going to have to change the decl spec define name to something more specific, or it will not be imported by the new dll because most likely the new dll has AFX_DLL defined (was that clear???). An other approach is for you to do LoadLibrary, then GetProcAddress, but then you end up with ugly (in my opinion) typedefs for function pointer types, such as typedef LRESULT (WINAPI *PFN_Hook)(int, WPARAM, LPARAM); HINSTANCE hDLL = LoadLibrary("ShellProcDLL.dll"); ASSERT(NULL != hDLL); PFN_Hook pHook = (PFN_Hook) ::GetProcAddress(hDLL, "CBTProc"); ASSERT(NULL != pHook); I think the answer to my question is simpler than you have actually answered.. I only want to use a FUNCTION from a DLL not made by me... to be able to compile the code, I have include this in the header file: int __declspec( dllimport ) IBE_WIN_ResetBoard(); where IBE_WIN_ResetBoard( ) is the function to be imported. The only problem to be solved now is how can the linker link that function with my project. The name of the DLL is T3IBEW95.DLL. I have included this file in project settings but linker doesn't recognize the format... how can I create the corresponding LIB file? LIB files I could create with BC++ would have different format.. Thanks Jaime There two ways to call DLL's exported functions: Implicit and Explicit. Implicit linking requires lib file during link. This lib file is created when the DLL is built. Therefore, if you don't have the lib file, you should consider explicit linking. Explicit linking is done by you when you need the function (as opposed to Windows loading all DLLs that are implicitly linked when your program gets loaded). You call LoadLibrary() to find/load the DLL and GetProcAddress() to get the address of the function. Example: typedef int (TestFunction)(int); HINSTANCE hDll; TestFunction* pFunc; hDll = ::LoadLibrary("testdll.dll"); pFunc = (TestFunction*)::GetProcAddress(hDll, "FunctionName"); int result = (*pFunc)(100); /* call the function passing 100 as the argument */ Thanks!!! your hint was really useful... I have already solved the problem.. Jaime Hello Sir, I am a final year engineering student.I am writing a DLL for my project.Now I like to import these functions from my DLL (written in VC++) to a VC++ application.When I try to implicitly link the library with the apllication I get a linker error.I have declared all the functions to be exported in the dll as _stdcall.Please help me. Your's sincerely, Vignesh Hello Here are steps for importing functions: In your DLL project you: 1. In stdafx.h add these lines: #define DllImport __declspec( dllimport ) #define DllExport __declspec( dllexport ) 2. In your project settings dialog you must add a macro which will be used as a flag. 'C/C++' tab, Category combo set to 'Preprocessor', in preprocessor definitions you add something like 'MY_FIRST_DLL'. It will be a 'signature' of your DLL. If your application includes more than one project, each DLL must have an unique 'signature' 3. In your DLL you create a header which will include declarations of functions you want to declare. This header must contain these definitions: 3a. #ifdef MY_FIRST_DLL //for header only #define MyFirstDllExport DllExport #else #define MyFirstDllExport DllImport #endif 3b. Declarations of functions or classes you want to export from your DLL. All declarations must be prefixed by the word 'MyFirstDllExport' MyFirstDllExport void MyFunction4Export(); class MyFirstDllExport MyClassForExport { }; 4. You implement you functions and classes in CPP file. It's not necessary to mention any 'import/export' stuff in CPP file - you just do not forget to "#include" header with declaration to CPP 5. That's pretty much it for DLL part. Now after compilation compiler will create a LIB file. To make sure everything is fine try to open thsi file in DevStudio and find names of functions you want to export. File is binary and names will be founded as substrings. Now in EXE project which uses you DLL you: 1. Do the same changes in EXE's stdafx.h, i.e. add these lines: #define DllImport __declspec( dllimport ) #define DllExport __declspec( dllexport ) 2. In the place where you want to call functions from DLL you include a header file from DLL. I assume you have DLL in a separate directory. So, your include will look like #include "MyDLL/ExportedStuff.h" 'ExportedStuff.h' is a file mentioned in p.3 of prev section. 3. You write calls of these functions 4. Do not forget to link your EXE project with LIB generated during DLL compilation 5. Compile EXE project 6. Place DLL file in the same directory where EXE file is and run. That's it. I use this method for years now, it doesn't need any DEF files and never gave me any troubles. Good luck Please rate if you think this response was useful for you Thank you for your kind reply and useful code.But I have written a win32 dll.I use a DEF file to export all functions.How can I import those functions implicitly in a MFC application. Thank you for your kind reply and useful code. - Your are welcome But I have written a win32 dll.I use a DEF file to export all functions.How can I import those functions implicitly in a MFC application. - The mechanizm described in my prev post doesn't work for win32 dll? Did you try? If you didn't try, do it. If you tried and it doesn't work when I don't know. What's not working? Maybe we can fix it togever? Good luck Please rate if you think this response was useful for you Have more questions? Feel free to ask. I have written win32 dll with all the functions to be exported placed in a DEF file.Now I started to develop a VC++ MFC application linking the dll implicitly.I linked the LIB file by changing the project settings.But I get a "unresolved external error symbol" when I use a function from the dll.I have used the same declaration as present in the dll. I have written win32 dll with all the functions to be exported placed in a DEF file - This DLL was written using Visual C++ or another compiler? Good luck Please rate if you think this response was useful for you Have more questions? Feel free to ask. Yes the dll was written using VC++. Yes the dll was written using VC++. - Also I hope you have a source code? In this case why don't you use the method I gave you? Remove DEF from your DLL project, do what I described and recompile your DLL - it will work. Good luck Please rate if you think this response was useful for you Have more questions? Feel free to ask. Forum Rules
http://forums.codeguru.com/showthread.php?61271-How-to-import-a-function-from-a-DLL
CC-MAIN-2014-42
refinedweb
1,473
74.9
Does, I've created one Inbox and one Calendar wepbart as descibed here: using OWAInboxPart and OWACalendarPart (code below). When deploying them and placing them on the same page, only one of them will show anything. It looks like the last added webpart works, while the other won't. If any one of them is placed alone on a page, they work as expected. Does anyone know how to make them work togheter on the same page? Thank you for your time! Best regards, Hans Erik Storeide Inbox wp: using System; using System.Runtime.InteropServices; using System.Web.UI; using System.Web.UI.WebControls.WebParts; using System.Xml.Serialization; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.Portal.WebControls; using Microsoft.SharePoint.WebPartPages; namespace Inbox { [Guid("e306c986-b327-41d2-b677-c05ece3c58d3")] public class fmno_Inbox : System.Web.UI.WebControls.WebParts.WebPart { &nbs hi, Is it possible to convert an email into a task i.e. If creating a helpdesk page - people can email in their requests in a set format and this is translated into an unassigned task within a list? Thanks for your help I am trying to delete a default property in my MOSS 2007 farm. We have created a custom property called Core Skills and I want to remove my default skills field. But the delete button is greyed out. I am noticing this on a few of the default properties. Is there a reason why we can't delete them? We are running MOSS SP2. Thanks.? Sandra. Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
http://www.dotnetspark.com/links/49524-moss-2007-email-integration-question-not.aspx
CC-MAIN-2017-43
refinedweb
267
61.53
An ESP2866 is never going to compete with an actual graphics card. But it has more than enough oomph to explore the fundamentals of 3D graphics. In this short tutorial we'll go through the basics of creating a 3D scene and displaying it on an OLED screen using MicroPython. This kind of mono wireframe 3D reminds me of early ZX Spectrum 3D games which mostly involved shooting one wobbly line at another, and looking at the resulting wobbly lines. It was awesome. The 3D code here is based on this example for Pygame with some simplifications and the display code modified for working with framebuf. Setting up The display used here is a 128x64 OLED which communicates over I2C. We're using the ssd1306 module for OLED displays available in the MicroPython repository to handle this communication for us, and provide a framebuf drawing interface. Upload the ssd1306.py file to your device's filesystem using the ampy tool (or the WebREPL). ampy --port /dev/tty.wchusbserial141120 put ssd1306.py With the ssd1306.py file on your Wemos D1, you should be able. To work with the display, we need to create an I2C object, connecting via pins D1 and D2 — hardware pin 4 & 5 respectively. Passing the resulting i2c object into our SSD1306_I2C class, along with screen dimensions, gets us our interface to draw with. from machine import I2C, Pin import ssd1306 import math i2c = I2C(scl=Pin(5), sda=Pin(4)) display = ssd1306.SSD1306_I2C(128, 64, i2c) Modelling 3. Rotation along each axis and the projection onto a 2D plane is described below. The full code is available for download here if you want to skip ahead and start experimenting. 3D Rotation Rotating an object in 3 dimensions is no different than rotating a object on a 2D surface, it's just a matter of perspective. Take a square drawn on a flat piece of paper, and rotate it 90°. If you look before and after rotation the X and Y coordinates of any given corner change, but the square is still flat on the paper. This is analogous to rotating any 3D object along it's Z axis — the axis that is coming out of the middle of the object and straight up. The same applies to rotation along any axis — the coordinates in the axis of rotation remain unchanged, while coordinates along other axes are modified. # The equivalent Python code for the rotation along the X axis is shown below. It maps directly to the math already described. Note that when rotating in the X dimension, the x coordinates are returned unchanged and we also need to convert from degrees to radians (we could of course write this function to accept radians instead). def rotateX(self, x, y, z, deg): """ Rotates this point around the X axis the given number of degrees. Return the x, y, z coordinates of the result""" rad = deg * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) y = y * cosa - z * sina z = y * sina + z * cosa return x, y, z Projection Since we're displaying our 3D objects on a 2D surface we need to be able to convert, or project, the 3D coordinates onto 2D. The approach we are using here is perspective projection. If you imagine an object moving away from you, it gradually shrinks in size until it disappears into the distance. If it is directly in front of you, the edges of the object will gradually move towards the middle as it recedes. Similarly, a large square transparent object will have the rear edges appear 'within' the bounds of the front edges. This is perspective. To recreate this in our 2D projection, we need to move points towards the middle of our screen the further away from our 'viewer' they are. Our x & y coordinates are zero'd around the center of the screen (an x < 0 means to the left of the center point), so dividing x & y coordinates by some amount of Z will move them towards the middle, appearing 'further away'. The specific formula we're using is shown below. We take into account the field of view — how much of an area the viewer can see — the viewer distance and the screen height and width to project onto our framebuf. x' = x * fov / (z + viewer_distance) + screen_width / 2 y' = -y * fov / (z + viewer_distance) + screen_height / 2 Point3D code The complete code for a single Point3D is shown below, containing the methods for rotation in all 3 axes, and for projection onto a 2D plane. Each of these methods return a new Point3D object, allow us to chain multiple transformations and avoid altering the original points we define. class Point3D: def __init__(self, x = 0, y = 0, z = 0): self.x, self.y, self.z = x, y, z def rotateX(self, angle): """ Rotates this point around the X axis the given number of degrees. """ rad = angle * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) y = self.y * cosa - self.z * sina z = self.y * sina + self.z * cosa return Point3D(self.x, y, z) def rotateY(self, angle): """ Rotates this point around the Y axis the given number of degrees. """ rad = angle * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) z = self.z * cosa - self.x * sina x = self.z * sina + self.x * cosa return Point3D(x, self.y, z) def rotateZ(self, angle): """ Rotates this point around the Z axis the given number) 3D Simulation We can now create a scene by arranging Point3D objects in 3-dimensional space. To create a cube, rather than 8 discrete points, we will connect our vertices to their adjacent vertices after projecting them onto our 2D surface. Vertices The vertices for a cube are shown below. Our cube is centered around 0 in all 3 axes, and rotates around this centre.) ] Polygons or Lines As we're drawing a wireframe cube, we actually have a couple of options — polygons or lines. The cube has 6 faces, which means 6 polygons. To draw a single polygon requires 4 lines, making a total draw for the wireframe cube with polygons of 24 lines. We draw more lines than needed, because each polygon shares sides with 4 others. In contrast drawing only the lines that are required, a wireframe of the cube can be drawn using only 12 lines — half as many. For a filled cube, polygons would make sense, but here we're going to use the lines only, which we call edges. This is an array of indices into our vertices list. self.edges = [ # Back (0, 1), (1, 2), (2, 3), (3, 0), # Front (5, 4), (4, 7), (7, 6), (6, 5), # Front-to-back (0, 5), (1, 4), (2, 7), (3, 6), ] On each iteration we apply the rotational transformations to each point, then project it onto our 2D surface. r = v.rotateX(angleX).rotateY(angleY).rotateZ(angleZ) # Transform the point from 3D to 2D p = r.project(*self.projection) # Put the point in the list of transformed vertices t.append(p) Then we iterate our list of edges, and retrieve the relevant transformed vertices from our list t. A line is then drawn between the x, y coordinates of two points making up the edge. for e in self.edges: display.line(*to_int(t[e[0]].x, t[e[0]].y, t[e[1]].x, t[e[1]].y, 1)) The to_int is just a simple helper function to convert lists of float into lists of int to make updating the OLED display simpler (you can't draw half a pixel). def to_int(*args): return [int(v) for v in args] The complete simulation code is given below. class Simulation: def __init__(self, width=128, height=64, fov=64, distance=4, rotateX=5, rotateY=5, rotateZ] # Rotational speeds self.rotateX = rotateX self.rotateY = rotateY self.rotateZ = rotateZ def run(self): # Starting angle (unrotated in any dimension). angleX, angleY, angleZ = 0, 0, 0 while 1:() # Continue the rotation. angleX += self.rotateX angleY += self.rotateY angleZ += self.rotateZ Running a simulation To display our cube we need to create a Simulation object, and then call .run() to start it running. s = Simulation() s.run() You can pass in different values for rotateX, rotateY, rotateZ to alter the speed of rotation. Set a negative value to rotate in reverse. s = Simulation() s.run() The fov and distance parameters are set at sensible values for the 128x64 OLED by default (based on testing). So you don't need to change these, but you can. s = Simulation(fov=32, distance=8) s.run() The width and height are defined by the display, so you won't want to change these unless you're using a different display output.
https://www.mfitzp.com/creating-a-3d-rotating-cube-with-micropython-and-oled-display/
CC-MAIN-2022-27
refinedweb
1,466
66.03
. My opinion is if you are going to do something like this to C#, you use prototypes like you have in Javascript, JScript.NET, etc. (I’m sure you know what I mean, in case someone reading this doesn’t) function MyClass_MyFunction() { } function MyClass() { } MyClass.prototype.MyFunction = MyClass_MyFunction; new MyClass().MyFunction() Sounds a bit like Delphi’s class helpers. I totally agree use something as the prototype in ECMAscript this concept is very powerfull and it’s THE reason I’m still doing ASP+JScript and I didn’t move fully to ASP.NET+JScript.NET think also to another scenario: me as a programmer or service provider I give a compiled DLL and not a source code for my customer point of view being able to add features with mixin could be a powerfull feature I understand that the abuse could be a turn off for that kind of feature, but look also at the pass with all the different String class you could found in C++ String2, StringUtil, etc… is not good naming convention imho being able to extend existing class, even if it could be abused, would also allow to keep namespace well named and clean just my 0.2 euros 😉 I think we should be more open to static helper methods like that. I find that they make interfaces much more useful. For example, almost all of the new methods on List<T> that take delegates as arguments and perform common list operations can be defined in terms of the IList<T> interface, except that there is nowhere to put them because: a) if they go in the interface, every implementer of that interface has to provide an implementation, even though almost all or all of those implementations will or should be the same because the behavior is defined in terms of the existing interface members b) C# doesn’t allow static members on interfaces (although to my understanding the CLR does) c) if they are defined on a helper class, discoverability becomes a problem In this spefic case, I suggest that we make static versions of all those methods on List<T> or some other class in the System.Collections.Generic namespace that take an IList<T> as an argument, but a more general solution is highly desirable since there are a number of related problems. I really like the idea of being able to add methods to existing classes. A friend of mine had an argument with Stroustrup about it in the C++ world – he always (and unsuccessfully) wanted it added. as far as syntax goes, how’s this for an idea? extender class StringHelper : String { public bool Contains( string subString ) {return Instr( subString)> -1;} public static string FairlyUnique( int length) { return Guid.NewGuid().ToString().Substring( 1, length ); } } Allowing many extenders to exist for a particular class, and giving extenders only public access to the class they are extending. This would brilliantly gel with other requests – like it would get rid of the need to add static functions to interfaces for instance – because you could then do this: public interface IPreferencesStorage { … } extender class IPreferencesStorageFactory : IPreferencesStorage { public IPreferencesStorage CreateFromConfiguration( SystemConfiguration config ) { return (config.UseRegistryForPreferences) ? new RegistryPreferenceStorage() : new FilePreferenceStorage(); } } And then you just have to get to have code like IPreferencesStorage storage = IPreferencesStorage.CreateFromConfiguration( currentSystemConfiguration ); Hi, I think this is just a code game.. Here is my option: public codegame class StringHelper : string//even the string class is sealed { //no fields //will compile into static public string CodeGameLeft(string codegametarget,int len) public string Left(int len) { return Substring(0,len); } public string SafeLeft(int len) { if(Length>=len) return this; return Substring(0,len); } } and call it just like: string s="hello world!"; StringHelper sh=s;//implicit.. string l1=s.Left(3); string l2=((StringHelper)s).Left(4); and it just means : string s="hello world!"; string l1=StringHelper.CodeGameLeft(s,3); string l2=StringHelper.CodeGameLeft(s,4); of cause it’s would be nice if this syntax is ok: string l3=s<StringHelper>.Left(5); I’d say that although it sounds nice to be able to add methods to existing classes, it would probably be a bad idea (putting on my maintenance and code readability hat). That said it would be nice to have a different kind of "inheritance" that allows a "public-only" view of the base class. That means that it is entirely clear which class the additional methods belong to. Cases where this would be useful would be ado.net, where db vendors create sealed class implementations of Connection and DataReader classes. When trying to extend these classes you need to make a clunky wrapper class that implements the interfaces, when you just want to add 1 or 2 methods to them. Anything that gets you to the world of mixins would be a win. This is a great way to get around multiple inheritence hell, yet use functionality nicely. I also like having the ability to be able to have an interface, and put default behaviour in that interface. It is just nice and clean and I find it a lot cleaner compared to having a million files with factories etc. Doug McClean’s comments on the new List<T> methods is correct. Most of those methods would best be attached to IList<T>, and many of them should in fact be attached to IEnumerable<T> (i.e. the ones that dont rely on an indexer). I dont think that adding methods to classes is the right way to go. Interfaces with default methods might be the way to go, but.. it seems to break the basic model of what an interface is. Static helper methods (and operators) in an interface is more like what we are looking for. Maybe whats needed is true multimethods. This feature is a long time coming but I would prefer the following syntax: public class StringExtensions : static string { public String Left(int count) { return this.Substring(0, count); } } The "static" can be used to signify the class is extending sidways. Cool C# becomes type safe Ruby I want to play too 😉 We’re not talking about just extending a sealed class like string, here. Here’s a scenario that we have in ASP.NET: Some third party control editor wants to implement a universal pagination system (like the one in ASP.NET v2 beta 1), and for that he needs to add a few properties and methods to the base Control class (like ControlPager, CurrentPage, etc.). It is necessary to do it on the base class and not on something that derives from Control, because we want every existing control to automatically get the new members. What Microsoft does to implement that is very simple: we just add the new members to the base class (breaking a few existing controls at compile time along the way). But a third party just couldn’t do it. Except if they could write: public new class PaginatedControl : System.Web.UI.Control { // … new member implementations } The Control class would behave as usual for old code, but new code could explicitly cast to PaginatedControl and use the new members. Of course, that would have to be associated with a new set of permissions as this could lead to dangerous code (although if explicit casting is necessary to call the new members, I don’t really see a valid scenario as only new code (which is aware of the new class) can see them, but I may be wrong on this) This concept is new enough, at least to me, to be open to consideration despite a couple of obvious liabilities. From an object oriented design perspective the questions revolve arround the relationship of the operation to the type of thing upon which the operation is performed. In the original example, a permutation function that does not belong to any class can act upon a string without violating the nature of what it means to be a string. Adding the permutation function to the string will necesssarily raise the question, is Permutation consistent with the concept of a string type? Since we may permute numbers as well as strings, does that imply that a string is a number? I realize that this is pretty thin but this sort of confusion is the most common cause of "bad" code. A mis-diagnosed problem yields a solution that is "good enough" for the moment but quickly breaks when attempting to extend the solution to a similar problem. First ask, what is the problem being solved? If you are capable of adding any behaviour to a class, without consideration for the nature of the class, you stand a good chance of introducing confusion, not clarity. E.g., you can add the behaviour of flying to a human being without changing the human into a bird, airplane or Icarus resulting in utter confusion. Such a development would not be progress. On the other hand, you can hobbies, abilities and preferences to a human and be coherent. And the abilitiy to add such properties and behaviours is certainly preferable to defining a new derived class of type cook, athlete or programmer. The potential good that can come from such a feature is the complete abstraction of common features into discrete functors that may be applied to a wide variety of types that cannot be readily predicted prior to development. The potential evil is a level of spaghetti code that would make mangled C++ code look like an elegant algorithm worthy of Knuth. PingBack from
https://blogs.msdn.microsoft.com/ericgu/2004/07/01/extending-existing-classes/
CC-MAIN-2018-22
refinedweb
1,590
57.1
Hi guys here is my assignment for a brief history. Project 9 Random Monoalphabet Cipher Random monoalphabet cipher. The Caesar cipher, which shifts all letters by a fixed amount, is ridiculously easy to crack - just try out all 25 possible keys. Here=s a better idea . For the key, don=t use numbers but words. Suppose the key word is FEATHER. First remove the duplicate letters, yielding FEATHR, and append the other letters of the alphabet in reverse order. Now encrypt the letters as follows A = F B = E C = A D = T E = H G = Z H = Y I = X et etc Write a program that encrypts or decrypts a file using this cipher. For example, decrypt a file using the keyword FEATHER. It is an error not to supply a keyword. You will prepare a file encrypted using this keyword cipher. Make the keyword the first word in the file. You will give your input file to me and I will pass it to another student so that s/he can decrypt it. You must also be prepared to decrypt the file s/he hands you, using this cipher. You are obviously forbidden to use FEATHER as your keyword for the beta-testing. Please name the data files for your program TEST1, TEST2, etc.. This is make beta-testing run more smoothly. Assume that each file will contain only alphabetic characters and spaces between words. You are not to accommodate digits, punctuation or any other special characters in your program code. Here is my code. import java.util.*; import java.io.*; public class Project9 { public static String encrypt(String msg, String cw) { String encryptionMessage = new String(); msg = msg.toUpperCase(); cw = cw.toUpperCase(); int i; for( i = 0; i < msg.length(); i++) { char ch = msg.charAt(i); int shift = (cw.charAt( i% cw.length() )-'A'); int oldPositionInAlphabet = ch - 'A'; int newPositionInAlphabet = (oldPositionInAlphabet + shift)%26; encryptionMessage = encryptionMessage + (char)(newPositionInAlphabet+ 'A'); } return encryptionMessage; } public static void main (String[] args) throws IOException { Scanner scan = new Scanner(System.in); String unencryptedFile; System.out.print( "Please input your Unencrypted file: " ); unencryptedFile = scan.next(); File inputFile = new File(unencryptedFile); Scanner scanOne = new Scanner(inputFile); if(!inputFile.exists()) { System.out.println("This file does not exist!"); System.exit(0); } String codeWord; System.out.println( "Please enter your code word. " ); codeWord = scan.nextLine(); File outFile = new File(unencryptedFile); PrintWriter pw = new PrintWriter(outFile); while(outFile.exists()) { String line = scanOne.nextLine(); String encryptedLine = encrypt(line,codeWord); pw.println(encryptedLine); pw.close(); } scanOne.close(); } } For some reason I keep getting an error message pertaining to my data file. I don't know what else to do. Here is input and error message below. Please input your Unencrypted file: TEST.dat java.io.FileNotFoundException: TEST.dat (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.jav a:138) at java.util.Scanner.<init>(Scanner.java:656) at Project9.main(Project9.java:42) Does anyone have any suggestions?
http://www.javaprogrammingforums.com/whats-wrong-my-code/28569-need-help-inputting-writing-external-data-file.html
CC-MAIN-2014-42
refinedweb
498
53.37
Animation. Install 1.- Unzip in Maya Script Path of your version, C:\Users\[username]\Documents\maya\[version]\scripts Example path in windows with Maya 2013, C:\Users\User\Documents\maya\2013-x64\scripts 2.- Open Script Editor, paste this text in a python console, and execute it. Or Create a python button in the shelf import tx_animationManager_ui tx_anim = tx_animationManager_ui.mainWindow() tx_anim.show() Tutorials and more information Version History NEW: Open Code Universal version, compatible with all Mayas FIX: Export Tangents Fails on 2016.5 NEW: 2016.5 now is supported NEW: Search and Replace 0.9.28: FIX: some keys don't import correctly NEW: incrase import velocity 0.9.27: FIX: import fails on animation layers NEW: Mirror funcion on right mouse button on pose 0.9.25: FIX: import animation import always break tangents FIX: export fails if channel have driven key 0.9.23: FIX: import on selection don't work on sort names FIX: when start loose selection FIX: import fails on channels with min or max don't compatible with imported value FIX: groups and selections changes before import FIX: groups and subgroups refresh problem 0.9.19: FIX: Directory not saved FIX: When create directory that exists previously FIX: Long path with vertex FIX: Namespace works with sort path FIX: Work with Student Version FIX: Mirror rotate=Mirror translate FIX: Better management of dictionary FIX: Create Camera if no exists, erase when close FIX: Ignore Channels connected FIX: Cancel on Browsers not fail NEW: Maya 2016 NEW: Export only selected in channel box NEW: Import only on selected and selected in channel box NEW: Small, Mid and Big Icons NEW: Autoresize columns NEW: Copy Pose/Anim 0.9.09: FIX: Import Pose failed when have animation FIX: Warning when no have Selection groups Please use the Feature Requests to give me ideas. Please use the Support Forum if you have any questions or problems. Please rate and review in the Review section.
https://www.highend3d.com/maya/script/animation-manager-0-9-30-for-maya
CC-MAIN-2019-35
refinedweb
328
50.16
Hey everyone, I've got a problem with my program and don't really know how to fix it. The program is a simulation Game of Life and has these rules: - A new cell is born on an empty square if is surrounded by exactly three neighboring cells - A cell dies of overcrowding if it has four or more neighbors - A cell dies of loneliness if it has zero or one neighbor - Any live cell with two or three live neighbors lives, unchanged, to the next generation. The program is run in a project so I have a driver, cpp and h file. So, I think the problem is with my "countNeighbors" function because every time I try to compile it I get a grid of 2's and 3's instead of a grid with 1's and 0's in it. This is what is in my cpp file: #include <iostream> #include <fstream> #include "life.h" using namespace std; //global data structure string *world; int numRows; int numCols; //reads a text file into an array of strings //will allocate more memory as necessary //assumes each line is same length void populateWorld (string FILE_NAME){ const int SIZE_INCREMENT = 3; char line[80]; numRows = 0; numCols = 0; ifstream inFile; inFile.open(FILE_NAME.data()); world = new string[SIZE_INCREMENT]; while ( inFile.getline(line,80) ) { world [numRows] = line; numCols = world[numRows].length(); numRows++; if (numRows % SIZE_INCREMENT == 0) { //time to resize string *tempWorld = new string[numRows + SIZE_INCREMENT]; for (int i = 0; i < numRows; i++) { tempWorld[i] = world[i]; } //free the world memory delete [] world; world = tempWorld; } } } //Prints out structure as if it were 2D array of characters void showWorld() { //show the the grid or txt file for(int row=0; row < numRows; row++) { for (int col=0; col < numCols; col++) { cout << world[row][col]; } cout << endl; } cout << endl; } // creates a duplicate of the space in the Life program void iterateGeneration() { string *newworld = new string[numRows]; for(int row=0; row < numRows; row++) { string temp = ""; //create a storage place for the next line for (int col=0; col < numCols; col++) { temp += (char) (world[row][col] + 1); } newworld[row] = temp; } delete [] world; world = newworld; return; } // counts number of neighbors in grid int countNeighbors(bool ** newworld, int row, int col){ int neighbors = 0; if ( newworld[row - 1][col - 1] == true ) neighbors++; if ( newworld[row - 1][col] == true ) neighbors++; if ( newworld[row - 1][col + 1] == true ) neighbors++; if ( newworld[row ][col - 1] == true ) neighbors++; if ( newworld[row ][col + 1] == true ) neighbors++; if ( newworld[row + 1][col - 1] == true ) neighbors++; if ( newworld[row + 1][col] == true ) neighbors++; if ( newworld[row + 1][col + 1] == true ) neighbors++; return neighbors; } So, a couple things I forgot to mention: 1. I am only computing the first and second generations. In my driver file I declared it as: "const int NUM_GENERATIONS = 2." 2. I am reading the grid from a txt file declared as this: const string FILE_NAME = "starting_grid.txt." The txt file contains the following: 00000000100000001010 00000000010000001001 11100000010100000010 10100100101010101010 00101010010010101000 Can anyone help me?
https://www.daniweb.com/programming/software-development/threads/178961/help-with-project-program
CC-MAIN-2017-39
refinedweb
500
53.07
If you’ve used C# for any length of time, you’ve used events. Most likely, you wrote something like this: public class MyCoolCSharpClass { public event EventHandler MyCoolEvent; } public class MyOtherClass { public void MyOtherMethod(MyCoolCSharpClass obj) { obj.MyCoolEvent += WhenTheEventFires; } private void WhenTheEventFires(object sender, EventArgs args) { Console.WriteLine("Hello World!"); } } Later, you need parameters to be passed in along with the event, so you changed it to something like this: public event EventHandler<MyEventArgs> MyCoolEvent; public class MyEventArgs : EventArgs { public string Name { get; set; } public DateTime WhenSomethingHappened { get; set; } } ... private void WhenTheEventFires(object sender, MyEventArgs args) { var theCoolCSharpSendingClass = (MyCoolCSharpClass)sender; Console.WriteLine("Hello World! Good to meet you " + args.Name); } You add two or three more events, some property change and changing events, and finally a class with about 4 properties, 3 events, and a little bit of code now has 3 supporting EventArgs classes, casts for every time you need the sender class instance (In this example, I’m assuming the event is always fired by MyCoolCSharpClass, and not through a method from a 3rd class). There’s a lot of code there to maintain even for just a simple class with some very simple functionality. Lets look at this for a minute. First, EventHandler and EventHandler<T> are simply delegates, nothing more nothing less (If you’re not sure what a delegate is, don’t sweat it, it’s not really the point of this discussion). What makes the magic happen for events is that little event keyword the prefaces the event that turns that internally turns the delegate type into a subscribe-able field. Essentially, it simplifies adding and removing multiple methods that are all called when the event is invoked. With the introduction of generics in C# 2.0, and the introduction of LINQ in 3.5, we have generic forms of most of the delegates we could ever use in the form of Action<T1, T2, T3...> and Func<TRes, T1, T2...>. What this means, is that we can change an event declarations to use whatever delegate we want. Something like this is perfectly valid: public event Action<MyCoolCSHarpClass, string, DateTime> MyCoolEvent; And what about when we subscribe? Well, now we get typed parameters: ... private void WhenTheEventFires(MyCoolCSHarpClass sender, string name, DateTime theDate) { Console.WriteLine("Hello World! Good to meet you " + name); } That’s cool. I’ve now reduced the amount of code I have to maintain from 4 classes to 1 and I don’t have to cast my sender. As a matter of fact, I don’t even have to pass a sender. How often have you written an event that’s something like this: public event EventHandler TheTableWasUpdatedGoCheckIt; Whoever is subscribed to this event doesn’t care about who sent it, or what data specifically was updated, all the subscribe cares about was that it was fired, nothing more than that. Even then, in a “you can only use EventHandler delegate world” you’re still stuck creating a method to subscribe to the event that looks like this: private void WhenTheTableWasUpdated(object sender, EventArgs args) { // Go check the database and update stuff... } If we use what we’ve learned and change the event to something like this: public event Action TheTableWasUpdatedGoCheckIt; We can write our method like this: private void WhenTheTableWasUpdated() { // Go check the database and update stuff... } Since we never cared about the parameters in the first place. Thats awesome fine and dandy, but just blindly replacing every instance of EventHandler delegates to Actions isn’t always the best idea, there are a few caveats: First, there are some practical physical limitations of using Action<T1, T2, T2... > vs using a derived class of EventArgs, three main ones that I can think of: - If you change the number or types of parameters, every method that subscribes to that event will have to be changed to conform to the new signature. If this is a public facing event that 3rd party assemblies will be using, and there is any possibility that the number or type of arguments would change, its a very good reason to use a custom class that can later be inherited from to provide more parameters. Remember, you can still use an Action<MyCustomClass>, but deriving from EventArgs is still the Way Things Are Done™ - Using Action<T1, T2, T2... >will prevent you from passing feedback BACK to the calling method unless you have a some kind of object (with a Handled property for instance) that is passed along with the Action, and if you’re going to make a class with a handled property, making it derive from EventArgsis completely reasonable. - You don’t get named parameters by using Action<T1, T2 etc...>so if you’re passing 3 bool‘s, an int, two string‘s, and a DateTime, you won’t immediately know what the meaning of those values. Passing a custom args class provides meaning to those parameters. Secondly, consistency implications. If you have a large system you’re already working with, it’s nearly always better to follow the way the rest of the system is designed unless you have an very good reason not too. If you have publicly facing events that need to be maintained, the ability to substitute derived classes for args might be important. Finally, real life practice, I personally find that I tend to create a lot of one off events for things like property changes that I need to interact with (Particularly when doing MVVM with view models that interact with each other) or where the event has a single parameter. Most of the time these events take on the form of public event Action<[classtype], bool> [PropertyName]Changed; or public event Action SomethingHappened;. In these cases, there are two benefits that you might be able to guess from what you’ve already seen. - I get a type for the issuing class. If MyClassdeclares and is the only class firing the event, I get an explicit instance of MyClassto work with in the event handler. - For simple events such as property change events, the meaning of the parameters is obvious and stated in the name of the event handler and I don’t have to create a myriad of classes for these kinds of events. Food for thought. If you have any comments, feel free to leave them in the comment section below.
https://blogs.interknowlogy.com/tag/discussion/
CC-MAIN-2021-39
refinedweb
1,064
57.71
Large Files And Sensitive Data¶ Some tests require data that are best not checked into source control. These data are typically either sensitive (e.g. cryptographic keys), large (e.g. large seed data), or both. Small Sensitive Data¶ Small pieces of sensitive data, like API keys, are best configured using config variables. Bulk Data: Attachments¶ Bulk data is best handled via a separate mechanism. We generally recommend placing large files in an object store such as AWS’s S3, Azure Blob Storage, etc. You can pass authentication tokens into the build as sensitive data in order to create signed URLs for download during the build process if necessary. For details on handling large, sensitive objects, see below. For less sensitive large files, usually the simplest way to pull them into the build is to us wget in a setup hook. You can cache these downloads with the build. For instance, in a pre_setup hook that places GeoLiteCity.dat in the db/geo sub-directory of your repository might look like this: hooks: pre_setup: set -e wget -O db/geo/GeoLiteCity.dat # other setup tasks go here Solano CI also supports “attachments” which are references to external data sources, e.g. a file hosted in S3 or on your web server. Unless the files you need are unusually large or on the wrong side of a low-bandwidth network connection, we find that most users prefer to use ``wget``. Solano CI will download attachments into your test environment at runtime. Solano CI may also choose to cache downloaded attachments internally to improve performance and save bandwidth. Sensitive data in attachments should be encrypted (see below). Attachments are configured using config/solano.yml. The attachments section of the configuration file contains a hash. Each key is a path name relative to the repository root. This key points to a hash with two keys: url and hash. The url is an https URL for the file and the hash is the SHA-1 hash of the file. An example configuration for the publicly available GeoLiteCity geolocation database might look like this; the target directory must already exist. attachments: 'db/geo/GeoLiteCity.dat': url: '' hash: '2cae5b16ad50bd26b795f22bb30620d829648142' Bulk Data: Sensitive Objects¶ If your tests need access to a large, sensitive object, we recommend encrypting the file and downloading it either directly from a pre_hook or through the attachment mechanism described above. In some cases, the sensitive object may be a ZIP file or tarball from Github. Solano Labs has released a small wrapper around OpenSSL called s3store that is automatically installed into the Solano CI environment. S3store automates the process of encrypting files and storing them in S3 in your local environment and downloading and decrypting them inside Solano CI. To use s3store for secure object storage, you will need to: - Have an Amazon account or IAM identity with access to an S3 bucket of your choice. We recommend a separate IAM identity for uploading and downloading objects so that the identity used in Solano CI has only read permissions. - Export the AWS region, key ID, and access key information to s3 store locally and use it to upload an encrypted blob - Set configuration variables for your repository that will pass the read-only AWS identity (region, key ID, and access key) as well as the shared secret passphrase to the Solano CI build. - Check in a Solano CI pre_hook that downloads the encrypted blob, decrypts it, and moves it into place using s3store (see below) The s3store command expects four configuration environment variables to exported inside Solano CI: - TDDIUM_S3_REGION - the S3 region to use; defaults to us-east-1 - TDDIUM_S3_KEY_ID - the AWS key ID to use - TDDIUM_S3_SECRET - the AWS secret access key value to use - TDDIUM_S3_PASSPHRASE - the passphrase to use with OpenSSL for encryption and decryption You can also pass s3store a YAML configuration file with the first three values. When storing a blob, if a passphrase is not provided, s3store will automatically generate a secure one; when fetching a blob, s3store will interactively prompt for a passphrase if one is not supplied in the environment or the command line. # Copyright (c) 2012, 2013, 2014, 2015, 2016 Solano Labs All Rights Reserved namespace :tddium do desc "solano pre hook" task :pre_hook do url="s3://solano-labs.s3.amazonaws.com/s3store/todo.enc" Kernel.system("s3store fetch #{url}") Kernel.system("mv todo.enc #{ENV['TDDIUM_REPO_ROOT']}/data/secret.dat") end end The s3store command implements two sub-commands: store and fetch. The store sub-command will use the value of the TDDIUM_S3_PASSPHRASE environment variable, if present, as the passphrase. Otherwise, it will use the argument to the -p option as the passphrase or prompt if given the -P option. If the TDDIUM_S3_PASSPHRASE evnironment variable is not set and neither -P nor -p is supplied on the command line, a passphrase will be automatically generated. Usage: s3store store Options: -P, [--passprompt] -p, [--passphrase=PASSPHRASE] -c, [--config=CONFIG] In the typical use case, the s3store fetch sub-command will read the passphrase from the TDDIUM_S3_PASSPHRASE environment variable inside the Solano CI environment. Usage: s3store fetch [file] Options: -p, [--passphrase=PASSPHRASE] -c, [--config=CONFIG] Bulk Data: Sensitive Objects (Github)¶ To download sensitive objects from Github, we recommend creating an OAuth token on Github, adding the OAuth token as a config variable which will be exported into the environment, and then running a curl command to download the object from a pre_hook. Assuming you add the OAuth token as a repo-level config variable called GITHUB_OAUTH_TOKEN, your pre-hook would then contain a command such as: curl -u "your_login:$GITHUB_OAUTH_TOKEN" -o $TMPDIR/repo-dev.zip \
http://docs.solanolabs.com/Setup/large-files-sensitive-data/
CC-MAIN-2017-26
refinedweb
935
50.57
Odoo Help Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps: CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc. Hi, Add a selection field to your model where the user can chose between HTML and PDF. Add a method that call your report based on user choice type = fields.Selection([('qweb-pdf', "PDF"),('qweb-html', "HTML"),], default='qweb-pdf') @api.one def print_report(self): vals = {} return { 'type': 'ir.actions.report.xml', 'report_name':'your_module.report_id', 'datas': { 'model':'model', 'id': report_ids and report_ids[0] or False, 'ids': report_ids and report_ids or [], 'report_type': self.type}, 'nodestroy': True } Call this method by a print button. <button name="print_report" string="Print" type="object" /> Best regards. Even better is to replace @api.one with @api.multi and self.ensure_one() :) Yes, Thanks :). About This Community Odoo Training Center Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now Have you tried to register the same report with two <report> records with 'report-type=qweb-pdf' in the first one and 'report-type=qweb-html' in the other?
https://www.odoo.com/forum/help-1/question/generate-report-in-pdf-and-html-109555
CC-MAIN-2017-30
refinedweb
190
52.56
I have bought a mechanical arm before some days. Its picture looks a little cute. There are two colors for consumers to choose, black and white. I chose black one. There are four servos for it. First one is to control its mechanical hand to catch something. The second one is to control height of its arm and hand. The third servo is to distance between mechanical and object. The last one is to control mechanical arm to turn direction, left or right. When you finish the construction, how to make it work? - I chose an Arduino UNO board named Freaduino to control it. - Connecting the first servo with D0 pin in the UNO board. - Connecting the second servo with D1 pin in the UNO board. - Connecting the third servo with D2 pin in the UNO board. - Connecting the fourth servo with D3 pin in the UNO board. - Check if every servo is working normally. At the end of the passage I will upload test code. Now I am very carried away with how to control this mechanical arm. We can use potentiometer, rocker or Bluetooth to control it. Potentiometer is awkward to use in here. Rocker is universal and not cool enough. So I chose Bluetooth module last. The last step, connecting Bluetooth module with board. Because there are four servos connected with board, we give the board extra power. If don’t do that, the USB circuit is not enough to support it. If we want to control it by UNO board, we must put the libraries of Servo into the folder of libraries. The libraries will be uploaded at last of passage. We can use class of Servo to create four variable. Such as: Servo Servo_Catch; Servo Servo_Height; Servo Servo_Distance; Servo Servo_Direction; And we must give them pins’ number to control corresponding servos. We use “attach” function to do it. Such as: Servo_Catch.attach(0); Servo_Height.attach(1); Servo_Distance.attach(2); Servo_Direction.attach(3); These are initialize of servos. The most useful function of servos is “write()”. This is to control degrees of servos. If you fill a number in the parameter, the servo will turn to the corresponding degree. For example, if I want servo of catching to turn 30 degrees, I can use it like: Servo.write(10); Is it very easy to use? Next, let’s try to write program about how to control the mechanical arm by Bluetooth. In here, I use libraries of ElecfreaksCar directly to receive data from Bluetooth module. It will be easy if I use the libraries. We can use class of ElecfreaksCar to create a new variable which is named BluetoothModule, such as: ElecfreaksCar BluetoothModule; And we use function of “recievedData()” to receive data which is from Bluetooth. We use function of “getRoll()” and “getPitch()” to get data of rocker of APP to control the mechanical arm. Now it is an example about use APP to turn on and turn off LED which is on the UNO board. #include "ElecfreaksCar.h" ElecfreaksCar BluetoothModule; int ledPin = 13; void setup() { Serial.begin(115200); pinMode(ledPin, OUTPUT); } void loop() { while(Serial.available()) { uint8_t c = Serial.read(); BluetoothModule.recievedData(&c, 1); } if(BluetoothModule.getRoll() > 125) { digitalWrite(ledPin, LOW); } else { digitalWrite(ledPin, HIGH); } } Of course, we don’t use these functions to control the LED. So we modify it to make it can control the mechanical arm by Bluetooth. Now I list out functions about class of ElecfreaksCar: getRoll(); //it will return data of roll, from 0 to 250 getPitch(); //it will return data of pitch, from 0 to 250 setFun(void (*Function)()); //it will run the sentence of Function when user presses button of APP. This is program about the mechanical arm witch is written by me. And you can change it to create yourself program of mechanical arm. #include "ElecfreaksCar.h" #include "Servo.h" ElecfreaksCar BluetoothModule; //define a variable of class of ElecfreaksCar which is named BluetoothModule Servo Servo_Roll; //This is a servo which to turn direction Servo Servo_Distance; //This is a servo which is to control the distance between the machanical hand and object. Servo Servo_Catch; //THis is a servo which is to control the manchanical hand to catch or let go. float P=125.00; //This is value of pitch. This value is middle value when the rocker in the middle float R=125.00; //This is value of roll. This value is middle value when the rocker in the middle unsigned char Flag_Catch = 0; //This is a flag about if the machanical hand catch or not void Button() //This function is to be run when user touch the button of APP { if(Flag_Catch == 1) { Servo_Catch.write(0); //Catch Flag_Catch = 0; } else { Servo_Catch.write(90); //let go Flag_Catch = 1; } } void setup() { Serial.begin(115200); //baud rate BluetoothModule.setFun(Button); //The arduino will run the function which is in the parameter. In here, it will run the function of "Button" Servo_Catch.attach(2); //the servo of catch is connected with pin D2 Servo_Distance.attach(4); //the servo of controlling distance between machanical hand and object is connected with pin D4 Servo_Roll.attach(5); //the servo of controlling direction is connected with pin D5 } void loop() { while(Serial.available()) //if there is any data come from bluetooth, it will into the function of while { uint8_t c = Serial.read(); //read the data of serial com BluetoothModule.recievedData(&c, 1); //recieve the data P=(float)BluetoothModule.getPitch(); //get the data of pitch R=(float)BluetoothModule.getRoll(); //get the data of roll P = P * 0.72; //This is important. the value of the rocker of APP is from 0 to 250, But the degree of servo is from 0 degree to 180 degrees. //So we must make the value of pitch to multiplicative (180/250). R = R * 0.72; //the same as pitch } Servo_Distance.write((int)P); //make the servo to run the degree Servo_Roll.write((int)R); } I’m Yuno. See you next time. 😀 ElecfreaksCar APP Download: Libraries Download:
http://www.elecfreaks.com/8331.html
CC-MAIN-2017-17
refinedweb
996
68.36
But don do that. Im. /********************************************************************* * A simple C library file, with a single function, "message", * which is to be made available for use in Python programs. * There is nothing about Python here--this C function can be * called from a C program, as well as Python (with glue code). *********************************************************************/ #include #include static char result[64]; /* this isn exported */ char * message(char *label) /* this is exported */ { strcpy(result, "Hello, "); /* build up C string */ strcat(result, label); /* add passed-in label */ return result; /* return a temporary */ } While you e at it, define the usual C header file to declare the function externally; as shown in Example 19-5. This is probably overkill, but will prove a point. /******************************************************************** * Define hellolib.c exports to the C namespace, not to Python * programs--the latter is defined by a method registration * table in a Python extension modules code, not by this .h; ********************************************************************/ extern char *message(char *label); Now, instead of all the Python extension glue code shown in the prior section, simply write a SWIG type declarations input file, as in Example 19-6. /****************************************************** * Swig module description file, for a C lib file. * Generate by saying "swig -python hellolib.i". ******************************************************/ %module hellowrap %{ #include %} extern char *message(char*); /* or: %include "../HelloLib/hellolib.h" */ /* or: %include hellolib.h, and use -I arg */ This file spells out the C functions type signature. In general, SWIG scans files containing ANSI C and C++ declarations. Its input file can take the form of an interface description file (usually with an .i suffix), or a C/C++ header or source file. Interface files like this one are the most common input form; they can contain comments in C or C++ format, type declarations just like standard header files, and SWIG directives that all start with %. For example: In this example, SWIG could also be made to read the hellolib.h header file directly. But one of the advantages of writing special SWIG input files like hellolib.i is that you can pick and choose which functions are wrapped and exported to Python; scanning a librarys entire header file wraps everything it defines. SWIG is really a utility that you run from your build scripts, not a programming language, so there is not much more to show here. Simply add a step to your makefile that runs SWIG, and compile its output to be linked with Python. Example 19-7 shows one way to do it on Linux. ############################################################### # Use SWIG to integrate hellolib.c for use in Python programs. ############################################################### # unless youve run make install SWIG = ./myswig PY = $(MYPY) LIB = ../HelloLib # the library plus its wrapper hellowrap.so: hellolib_wrap.o $(LIB)/hellolib.o ld -shared hellolib_wrap.o $(LIB)/hellolib.o -o hellowrap.so # generated wrapper module code hellolib_wrap.o: hellolib_wrap.c $(LIB)/hellolib.h gcc hellolib_wrap.c -c -g -I$(LIB) -I$(PY)/Include -I$(PY) hellolib_wrap.c: hellolib.i $(SWIG) -python -I$(LIB) hellolib.i # C library code (in another directory) $(LIB)/hellolib.o: $(LIB)/hellolib.c $(LIB)/hellolib.h gcc $(LIB)/hellolib.c -c -g -I$(LIB) -o $(LIB)/hellolib.o clean: rm -f *.o *.so core force: rm -f *.o *.so core hellolib_wrap.c hellolib_wrap.doc When run on the hellolob.i input file by this makefile, SWIG generates two files: [3] You can wade through this generated file on the books CD (see) if you are so inclined. Also see file PP2EIntegrateExtendHelloLibhellolib_wrapper.con the CD for a hand-coded equivalent; its shorter because SWIG also generates extra support code. This makefile simply runs SWIG, compiles the generated C glue code file into an .o object file, and then combines it with hellolib.c s compiled object file to produce hellowrap.so. The latter is the dynamically loaded C extension module file, and the one to place in a directory on your Python module search path (or "." if you e working in the directory where you compile). Assuming youve got SWIG set to go, run the makefile to generate and compile wrappers for the C function. Here is the build process running on Linux: [mark@toy ~/.../PP2E/Integrate/Extend/Swig]$ make -f makefile.hellolib-swig ./myswig -python -I../HelloLib hellolib.i Generating wrappers for Python gcc hellolib_wrap.c -c -g -I../HelloLib ...more text deleted here... ld -shared hellolib_wrap.o ../HelloLib/hellolib.o -o hellowrap.so And once youve run this makefile, you are finished. The generated C module is used exactly like the manually coded version shown before, except that SWIG has taken care of the complicated parts automatically: [mark@toy ~/.../PP2E/Integrate/Extend/Swig]$ python >>> import hellowrap # import the glue+library file >>> hellowrap.__file__ # cwd always searched on imports ./hellowrap.so >>> hellowrap.message(swig world) Hello, swig world In other words, once you learn how to use SWIG, you can largely forget all the integration coding details introduced in this chapter. In fact, SWIG is so adept at generating Python glue code that its usually much easier and less error-prone to code C extensions for Python as purely C or C++-based libraries first, and later add them to Python by running their header files through SWIG, as demonstrated here. Of course, you must have SWIG before you can run SWIG; its not part of Python itself. Unless it is already on your system, fetch SWIG off the Web (or find it at) and build it from its source code. Youll need a C++ compiler (e.g., g++), but the install is very simple; see SWIGs README file for more details. SWIG is a command-line program, and generally can be run just by saying this: swig -python hellolib.i In my build environment, things are a bit more complex because I have a custom SWIG build. I run SWIG from this csh script called myswig: #!/bin/csh # run custom swig install source $PP2EHOME/Integrate/Extend/Swig/setup-swig.csh swig $* This file in turn sets up pointers to the SWIG install directory by loading the following csh file, called setup-swig.csh : # source me in csh to run SWIG with an unofficial install setenv SWIG_LIB /home/mark/PP2ndEd/dev/examples/SWIG/SWIG1.1p5/swig_lib alias swig "/home/mark/PP2ndEd/dev/examples/SWIG/SWIG1.1p5/swig" But you won need either of these files if you run a make install command in the SWIG source directory to copy it to standard places. Along the way in this chapter, Ill show you a few more SWIG-based alternatives to the remaining examples. You should consult the SWIG Python user manual for the full scoop, but here is a quick look at a few more SWIG highlights: Later in the chapter, Ill also show you how to use SWIG to integrate C++ classes for use in your Python scripts. When given C++ class declarations, SWIG generates glue code that makes C++ classes look just like Python classes in Python scripts. In fact, C++ classes are Python classes under SWIG; you get what SWIG calls a C++ "shadow" class that interfaces with a C++ coded extension module, which in turn talks to C++ classes. Because the integrations outer layer is Python classes, those classes may be subclassed in Python and their instances processed with normal Python object syntax. Besides functions and C++ classes, SWIG can also wrap C global variables and constants for use in Python: they become attributes of an object named cvar inserted in generated modules (e.g., module.cvar.name fetches the value of Cs variable name from a SWIG-generated wrapper module). SWIG passes pointers between languages as strings (not as special Python types) for uniformity, and to allow type safety tests. For instance, a pointer to a Vector type may look like _100f8e2_Vector_p. You normally won care, because pointer values are not much to look at in C either. SWIG can also be made to handle output parameters and C++ references. C structs are converted into a set of get and set accessor functions that are called to fetch and assign fields with a struct object pointer (e.g., module.Vector_fieldx_get(v) fetches Cs Vector.fieldx from a Vector pointer v, like Cs v->fieldx). Similar accessor functions are generated for data members and methods of C++ classes (the C++ class is roughly a struct with extra syntax), but the SWIG shadow class feature allows you to treat wrapped classes just like Python classes, instead of calling the lower-level accessor functions. Although the SWIG examples in this book are simple, you should know that SWIG handles industrial-strength libraries just as easily. For instance, Python developers have successfully used SWIG to integrated libraries as complex as Windows extensions and commonly used graphics APIs. SWIG can also generate integration code for other scripting languages such as Tcl and Perl. In fact, one of its underlying goals is to make components independent of scripting language choices -- C/C++ libraries can be plugged in to whatever scripting language you prefer to use (I prefer to use Python, but I might be biased). SWIGs support for things like classes seems strongest for Python, though, probably because Python is considered to be strong in the classes department. As a language-neutral integration tool, SWIG addresses some of the same goals as systems like COM and CORBA (described in Chapter 20), but provides a code-generation-based alternative instead of an object model. You can find SWIG on this books CD (see) or at its home page on the Web,. Along with full source code, SWIG comes with outstanding documentation (including a manual specifically for Python), so I won cover all of its features in this book. The documentation also describes how to build SWIG extensions on Windows. A SWIG book is reportedly in the works as I write this, so be sure to check the books list at for additional resources.
https://flylib.com/books/en/2.723.1/the_swig_integration_code_generator.html
CC-MAIN-2018-22
refinedweb
1,631
64.81
Code. Collaborate. Organize. No Limits. Try it Today. Have you heard about the TypeScript? If ‘No’ then, TypeScript is a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler. It is an open source programming language developed by Microsoft. This was announced on October 1st in Soma Segar’s blog and Anders Hejlsberg, lead architect of C#, has worked with Steve Lucco and Luke Hoban on TypeScript development. JavaScript is just a scripting language and it was not really designed as a language for big Web apps, JavaScript doesn't provide classes, modules etc. for a real time application development. TypeScript extends JavaScript to do these all. Some of the main points are given below, In VS 2012 Editor If we open TypeScript file there we have options like Refactor, Go To Definition etc . Note: TypeScript is not depend on any IDE's, you can use compiled output of TypeScript file in any application where JavaScript is supported. You can install TypeScript in two ways, Note : Close all other applications to avoid installation problems. If you are installing through the msi then you will get the below screen. If you wanted to see TypeScript in action without installation then click here. To consume TypeScript file in our application we need to compile it. When its compiled it produces a JavaScript (.js) file. You can compile TypeScript file using the TypeScript Compiler (tsc). If you are using TypeScript in Visual Studio 2012 it will automatically compile the ts files when doing build action otherwise you can add a pre-build action command to compile all the TypeScript files to JavaScript. The TypeScript compiler will be installed in the below location by default. C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0 Or C:\Program Files\Microsoft SDKs\TypeScript\0.8.0.0 To compile the TypeScript file we need to use the below command in command prompt, tsc filename.ts Once its compiled successfully then there will be a .js file generated with the same filename in same location. you can change this settings by passing the command line arguments. If you want to automate the TypeScript compiling process then you might be interested in Sholo.TypeScript.Build , Web Essentials 2012. Once you have installed plug-in for Visual Studio 2012, you will get the below templates, HTML Application with TypeScript MVC – TypeScript Internet Application TypeScript File Now I'm going to create a simple HTML Application with TypeScript To create a new html application with typescript, go to File->New-Project Once you click on the 'OK' button then then solution file will be created with the default template files like below, We can see that the app.js is depend on app.ts. The default app.ts file contains class and constructor etc see the code below, The TypeScript file will be (needs to be) compiled to the JavaScript (app.js), see the compiled output from TypeScript, and we are referring the JavaScript (not the typescript) file in our web page. When you build(or re-build) this application you can see that the TypeScript file is getting compiled to JavaScript file. This auto compilation is happened because of the below entry in .??proj file .??proj Wen you run this application the output prints the current date and time. You can play with TypeScript online on Playground In this article I have given an introduction to TypeScript. I hope you have enjoyed this article and got some value addition to your knowledge.) import V = require("VCL/VCL"); export class PageTabHome extends V.TPage { constructor() { super(); var qur = new V.TQuery(this); qur.SQL = "SELECT ID,NAME FROM CUSTOMERS" qur.open(); var grid=new V.TDbGrid(this,"grid"); grid.DataSet=qur; var col = grid.createColumn("NAME"); col.onClicked = ()=>{ //do somthing } } } General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
http://www.codeproject.com/Articles/470129/TypeScript-Superset-of-JavaScript?msg=4393904
CC-MAIN-2014-23
refinedweb
673
65.01
Lab 13: Coroutines Due at 11:59pm on 08/04/2016. Starter Files Download lab13 Question 3 is in lab13.py. - Questions 4 through 10 are optional. It is recommended that you complete these problems on your own time. Starter code for these questions is in lab13_extra.py. Generators A generator function returns a special type of iterator called a generator object. Generator functions have yield statements within the body of the function. Calling a generator function. __next_. When a generator runs to the end of the function, it raises StopIteration. Coroutines Coroutines are generator objects that both produce and consume values. Values are consumed by using the yield expression, which is like the yield statement except it is on the right hand side of an assignment statement. Coroutines naturally enforce modularity in our code by splitting up complex functionality into smaller parts that are easier to write, maintain, and understand. They are also useful for the paradigm of event-driven programming, where an event loop handles particular events, such as user input, and uses callback functions to process those events. Coroutines can be controlled by using the send and close methods. sendresumes the coroutine and passes a value to it. Therefore, calling __next__is equivalent to calling sendwith None. closestops the coroutine and raises a GeneratorExitexception within the coroutine. However, this exception is not propagated out of the coroutine. If we try to use sendor __next__on a coroutine that has been closed, a StopIterationis raised. An example of a coroutine is below: def routine(): count = 0 while count < 2: print("What color is the sky?") ans = (yield) if ans == "blue": count += 1 print("Correct!") else: print("Try again!") >>> r = routine() >>> next(r) What color is the sky? >>> r.send("black") Try again! What color is the sky? >>> r.send("blue") Correct! What color is the sky? >>> next(r) Try again! What color is the sky? >>> r.send("blue") Correct! StopIteration One application of coroutines occurs in sequence processing. When working with data streams, a common technique is to set up a pipeline, where each stage of the pipeline is a coroutine. Data coming through the stream is sent through this pipeline to produce the final result. - Functions at the beginning of the pipeline only send values (and thus are not coroutines) and are called producers. - Coroutines in the middle of the pipeline both send and receive values and are called filters. - Coroutines at the end of the pipeline only receive values and are called consumers. Required Questions What Would Python Display? Question 1: WWPD: Generators Use OK to test your knowledge with the following What would Python Display def generator(): print("Starting") i = 2 while i < 6: print("foo", i) yield i i += 1 print("bar") yield i*2 i += 2 >>> h = generator() >>> iter(h) == h______True>>> next(h)______Starting foo 2 2>>> next(h)______bar 6>>> next(h)______foo 5 5 Trace through the code and make sure you know where and why each statement is printed. You might remember from when we studied iterators that iterator classes that don't define a __next__ method cannot run in a for loop. However, with generators we can get around this. 2: WWPD: Coroutines Use OK to test your knowledge with the following What would Python Display questions: python3 ok -q coroutines -u def search(pattern): print("Looking for", pattern) while True: line = (yield) if pattern in line: print(line) else: print("Nope!") >>> s = search('cs61a') # what type of object is this? >>> next(s)______Looking for cs61a>>> s.send('cs61b is the best class!')______Nope!>>> s.send('I love cs61a')______I love cs61a>>> s.close() >>> s.send('cs61a rocks.') # what is raised if the coroutine has been closed?______StopIteration def truthy(): print("Starting...") num_truths = 0 while num_truths < 3: print("Give me a truth!") truth = (yield) if truth: num_truths += 1 print("Nice truth.") else: print("Liar!") >>> t = truthy() >>> next(t)______Starting... Give me a truth!>>> t.send(True)______Nice truth. Give me a truth!>>> t.send([])______Liar! Give me a truth!>>> t.send(4)______Nice truth. Give me a truth!>>> next(t)______Liar! Give me a truth!>>> t.send([1, 2, 3]) # we break out of the loop______Nice truth. StopIteration Trace through the code and make sure you know where and why each statement is printed. Coding Practice Question 3: Hailstone Write a generator that outputs the hailstone sequence from homework 1. Here's a quick reminder Optional Questions Generators Question 4: Countdown Write both a generator function and an iterator that counts down to 0. def countdown(n): """ >>> for number in countdown(5): ... print(number) ... 5 4 3 2 1 0 """"*** YOUR CODE HERE ***"while n >= 0: yield n n = n - 1 Use OK to test your code: python3 ok -q countdown class Countdown: """ >>> for number in Countdown(5): ... print(number) ... 5 4 3 2 1 0 """ def __init__(self, cur): self.cur = cur def __iter__(self):"*** YOUR CODE HERE ***"while self.cur >= 0: yield self.cur self.cur -= 1 Is it possible to not have a __next__ method in the Countdown class? Use OK to test your code: python3 ok -q Countdown Question 7: ***"for i in lst: for j in lst: yield i, j Use OK to test your code: python3 ok -q pairs Question 8: ***"self.lst = lst self.i = 0 self.j = 0def __next__(self):"*** YOUR CODE HERE ***"if self.i == len(self.lst): raise StopIteration result = (self.lst[self.i], self.lst[self.j]) if self.j == len(self.lst) - 1: self.i += 1 self.j = 0 else: self.j += 1 return resultdef __iter__(self):"*** YOUR CODE HERE ***"return self Use OK to test your code: python3 ok -q PairsIterator Question 9: Remainder Generator - This question is a repeat from Lab 13. Like, a generator of natural numbers with remainder 1 when divided by m. The last generator yield natural numbers with remainder m - 1 when divided by m. def remainders_generator(m): """ Takes in an integer m, and yields m different remainder groups of m. >>> remainders_mod_four = remainders_generator(4) >>> for rem_group in remainders_mod_four: ... for _ in range(3): ... print(next(rem_group)) 0 4 8 1 5 9 2 6 10 3 7 11 """"*** YOUR CODE HERE ***"def remainder_group(rem): start = rem while True: yield start start += m for rem in range(m): yield remainder_group(rem) Note that if you have implemented this correctly, each of the generators yielded by remainder_generator will be infinite - you can keep calling next on them forever without running into a StopIteration exception. Hint: Consider defining an inner generator function. What arguments should it take in? Where should you call it? Use OK to test your code: python3 ok -q remainders_generator Coroutines Question 10: Restaurant (coroutines) One common use of coroutines is to build multi-stage pipelines that pass data items between modular components. In this question, we will write a pipeline to model a restaurant and its customers. There are three stages to the restaurant pipeline. Suppliers source ingredients and send them to Chefs. Chefs receive ingredients and assemble them into the dishes requested by their customers. Customers receive dishes and eat them! We've implemented suppliers and customers for you already—let's take a look at their code. supplier takes a list of ingredients and a chef coroutine to supply, passes the ingredients one by one to the chef, and then closes the chef coroutine. It handles the StopIteration exception, which occurs if the chef exits early: def supplier(ingredients, chef): for ingredient in ingredients: try: chef.send(ingredient) except StopIteration as e: print(e) break chef.close() The customer coroutine takes no arguments. It waits to be sent a dish, then prints a message and enjoys the food! If the coroutine is closed before the customer has eaten, it prints a complaint: def customer(): served = False while True: try: dish = yield print('Yum! Customer got a {}!'.format(dish)) served = True except GeneratorExit: if not served: print('Customer never got served.') raise Your job is to implement chef. Chef takes two arguments, a dictionary mapping customer coroutines to dish names, and a dictionary mapping dish names to ingredient lists. The chef coroutine should: - Receive ingredients from its supplier, using a yieldexpression. After receiving each ingredient, check to see if enough ingredients have been received to serve a customer: - A customer may be served if all of the ingredients in their desired dish have been received. - Ingredients never run out, so the same ingredient can be used to serve multiple customers. - Customers should be served only once. - If the chef coroutine is closed, it should print 'Chef went home.'before exiting. - If the chef coroutine receives ingredients after all customers have been served, it should raise StopIteration('No one left to serve!')to indicate that its work is complete. def chef(customers, dishes): """ >>> cust = customer() >>> next(cust) >>> c = chef({cust: 'hotdog'}, {'hotdog': ['bun', 'hotdog']}) >>> next(c) >>> supplier(['bun', 'hotdog'], c) Yum! Customer got a hotdog! Chef went home. >>> cust = customer() >>> next(cust) >>> c = chef({cust: 'hotdog'}, {'hotdog': ['bun', 'hotdog']}) >>> next(c) >>> supplier(['bun'], c) Chef went home. Customer never got served. >>> cust = customer() >>> next(cust) >>> c = chef({cust: 'hotdog'}, {'hotdog': ['bun', 'hotdog']}) >>> next(c) >>> supplier(['bun', 'hotdog', 'mustard'], c) Yum! Customer got a hotdog! No one left to serve! """"*** YOUR CODE HERE ***"remaining_customers = dict(customers) ingredients = set() while True: try: ingredient = yield except GeneratorExit: print('Chef went home.') for customer in customers: customer.close() raise ingredients.add(ingredient) if not remaining_customers: raise StopIteration('No one left to serve!') for customer, dish_name in dict(remaining_customers).items(): if not set(dishes[dish_name]) - ingredients: customer.send(dish_name) del remaining_customers[customer] Use OK to test your code: python3 ok -q chef
http://inst.eecs.berkeley.edu/~cs61a/su16/lab/lab13/
CC-MAIN-2018-17
refinedweb
1,605
67.65
Bruno Haible 2017-09-23 08:50:07 UTC ======================================================================= #include <locale.h> #include <monetary.h> #include <stdio.h> int main () { char buf[80]; printf ("currency = |%s|\n", localeconv()->currency_symbol); printf ("positive sign = |%s|\n", localeconv()->positive_sign); printf ("negative sign = |%s|\n", localeconv()->negative_sign); strfmon (buf, sizeof (buf), "%^#5.0n", 123.4); printf ("strfmon result for positive value = |%s|\n", buf); strfmon (buf, sizeof (buf), "%^#5.0n", -123.4); printf ("strfmon result for negative value = |%s|\n", buf); } ======================================================================= Results ======= Result on glibc 2.23: currency = || positive sign = || negative sign = || strfmon result for positive value = | 123| strfmon result for negative value = |- 123| Result on Solaris 10: currency = || positive sign = || negative sign = || strfmon result for positive value = | 123| strfmon result for negative value = |- 123| Result on Mac OS X 10.12: currency = || positive sign = || negative sign = || strfmon result for positive value = | 123 | strfmon result for negative value = |( 123)| Discussion ========== The POSIX spec is at [1]. I don't think the Mac OS X 10.12 result is correct because the test program does not specify the '+' nor '(' flag, and POSIX says If '+' is specified, the locale's equivalent of '+' and '-' are used (for example, in many locales, the empty string if positive and '-' if negative). If '(' is specified, negative amounts are enclosed within parentheses. If neither flag is specified, the '+' style is used. I don't think the glibc and Solaris results are correct because they show a '-' sign, although localeconv()->negative_sign is the empty string (which is mandated by POSIX [2]). The Solaris result is worse than the glibc one, because it produces a different number of characters in the negative and in the positive case, which is against what POSIX says for the '#' flag: To ensure alignment, any characters appearing before or after the number in the formatted output such as currency or sign symbols are padded as necessary with <space> characters to make their positive and negative formats an equal length. The result I would have expected is therefore: currency = || positive sign = || negative sign = || strfmon result for positive value = | 123| strfmon result for negative value = | 123| Conclusion ========== strfmon in the C locale is unusable. strfmon in territory locales is probably not much better. I won't spend time to add workarounds for it, because * C is a system programming language, while strfmon is for applications. Applications nowadays are not being written in C any more (except in GNOME). * Especially applications that deal with money. Given the amount of programming mistakes one can do in C and the amount of security vulnerabilities that C programs have on average (compared to other programming languages), who would want to to write monetary applications in C? Bruno [1] [2]
http://bug-gnulib.gnu.narkive.com/DuMljq4U/strfmon-in-the-c-locale
CC-MAIN-2018-34
refinedweb
445
51.28
Recently, in one of my projects, I needed to build a simple user interface consisting of a series of bitmap buttons in a dialog. Something simple and probably easy to use. About the same time, I came across David Pizzolato's very nice article on skinned button at codeproject.com, that got me thinking. What came out of the whole endevour was CAtlBitmapButton - an ATL/WTL ownerdrawn superclassed bitmap button. The class is not really complete and represents work in progress. I'll be glad if any of you find this useful :-). The CAtlBitmapButton class is very friendly and you can learn to use it in no time. The hardest part might be drawing the bitmaps (if you are as artistically challenged as I am !). Now let's get down to the basics. We'll be building an ATL/WTL Dialog-based application so I assume you are slightly familiar with ATL/WTL and ATL Windowing. To build the client, fire up Visual C++ and create a new Win32 application . Next we shall rig up ATL support to the project. Since we'd like to have ATL Wizard support, just follow the instructions step-by-step. If you already know how to do this, you can skip this part. First, in project's stdafx.h file, replace #include <windows.h> #define RICHEDIT_VER 0x0100 #include <atlbase.h> extern CComModule _Module; #include <atlcom.h> #include <atlwin.h> #include <atlapp.h> #include <atlctrls.h> Now add a new IDL file to the project that contains a blank library definition block like library <Project Name> { }; Now, in the ClassView, right-click the IDL file you just added, and choose Settings. In the General tab of the project settings dialog, check the Exclude file from build option. Next modify your projects .cpp file so that it looks like: CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) END_OBJECT_MAP() int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. _Module.Init(0, hInstance); _Module.Term(); return 0; } Having rigged up ATL/WTL support, goto Insert->New ATL Object. In the Miscellaneous category, choose Dialog and click on Next.Enter the short name as Dialog. In the dialog resource, add 4 buttons(IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3 and IDC_BUTTON4) and set the Ownerdraw properties of these buttons to true. You would also need to add a few bitmaps to the project such that each button has three state bitmaps (Selected, Down and Over). Add the file, CAtlBitmapButton.h to the project. In ClassView, right click the dialog class and add four member variables of type CAtlBitmapButton to it like CAtlBitmapButton m_button1,m_button2,m_button3,m_button4; In the dialog's OnInitDialog(), add the following code : m_button1.SubclassWindow(GetDlgItem(IDC_BUTTON1)); m_button1.LoadStateBitmaps(IDB_LOADU, IDB_LOADD, IDB_LOAD); m_button2.SubclassWindow(GetDlgItem(IDC_BUTTON2)); m_button2.LoadStateBitmaps(IDB_PLAYU, IDB_PLAYD, IDB_PLAY); m_button3.SubclassWindow(GetDlgItem(IDC_BUTTON3)); m_button3.LoadStateBitmaps(IDB_SAVEU, IDB_SAVED, IDB_SAVE); m_button4.SubclassWindow(GetDlgItem(ID_BUTTON4)); m_button4.LoadStateBitmaps(IDB_QUITU, IDB_QUITD, IDB_QUIT); CAtlBitmapButton has a method LoadStateBitmaps() to load the state bitmaps. The last thing to do is to add the ATL macro REFLECT_NOTIFICATIONS() to the dialog's message map like: BEGIN_MSG_MAP(CDialog) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) COMMAND_ID_HANDLER(ID_QUIT, OnQuit) REFLECT_NOTIFICATIONS() END_MSG_MAP() Build the project and run it. Check that the buttons are displaying the correct state bitmap. To handle button-clicks. use ATL macro COMMAND_ID_HANDLER() in the message map as shown in above code for the OK and Cancel button. OnCancel looks like: LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); return 0; } That's it. Yippee! Have fun. David Pizzol
http://www.codeproject.com/Articles/1177/CAtlBitmapButton-ATL-WTL-Ownerdraw-Superclassed-Bi?fid=2256&df=90&mpp=10&noise=1&prof=True&sort=Position&view=Expanded&spc=None
CC-MAIN-2013-20
refinedweb
589
50.94
I am trying to create a two dimensional array, which has either 1 or 0 randomly assigned to each coordinate. It works just fine until it gets to the coordinates [20][3]. After that it just throws out "segmentation fault 11". I am absolutely clueless how or why. Especially since I can create a matrix with 200 * 200 for instance but it still gets the same Problem only at the coordinates [200][3]. So it is somehow always the third y coordinate in the last x coordinate where the error occurs. #include <stdio.h> #include <stdlib.h> int main() { int x, y, i, j ; x = 20; y = 20; int grid [x][y]; for ( i = 0; i <= x; i++) { for ( j = 0; j <= y; j++) { grid[i][j] = rand() % 2 ; printf("grid [%d][%d]: %d\n", i, j, grid[i][j]); } } return 0; } C uses 0-based indexing for arrays. So, for an array defined as int grid [x][y] looping for for ( i = 0; i <= x; i++) for ( j = 0; j <= y; j++) if off-by-one. (Note the <= part). to elaborate, for an array of dimension p, the valid indexes are 0 to p-1, inclusive. You should change your loop conditions as i < x and j < y to stay withing the bounds. Accessing out of bound memory causes undefined behavior. That said, int main()should be int main(void), at least, to conform to C standards for hosted environments. gridas VLA here. If the dimensions are already known, better approach is to use a compile-time constant ( #define) to generate the array dimensions.
https://codedump.io/share/vNnEEhBTifhD/1/trying-to-access-array-element-in-loop-causes-segmentation-fault-why
CC-MAIN-2017-30
refinedweb
265
72.87
the database. The following references could be very helpful: - SwiftKuery library - Working with SQL in Swift using Swift-Kuery - Final Bookstore project you can clone from Github Let’s get started! Create a Swift projectYou can create a new Swift project using the Swift package manager by calling: $ swift package initAdd to your Package.swift file the following dependencies: import PackageDescription let package = Package( name: "bookstore", dependencies: [ .Package(url: "", majorVersion: 1, minor: 1), .Package(url: "", majorVersion: 1, minor: 2), .Package(url: "", majorVersion: 0, minor: 2), .Package(url: "", majorVersion: 4, minor: 0) ] ) Create the database schema There are many database choices you can use when developing a Swift project, and many of them can be referenced by the TodoList project where we have over 8 examples using the most popular databases. This example will focus on persisting our data in a relational database. We will use SwiftKuery to help us build syntactically correct SQL queries. One benefit of using an abstraction layer for the SQL database, is that when you build queries for one SQL database, it will usually work for all of them. For example, if you’re currently using PostgreSQL- you can easily move to SQLite, or DB2 in the future. Let’s assume PostgreSQL as your database as we begin to create the schema. You can use the ElephantSQL service in Bluemix in order to set up your PostgreSQL database. The database will contain collection of very basically described books for this example. The book will have columns for the id, title, author, ISBN number, and year of publication: CREATE TABLE books ( book_id SERIAL PRIMARY KEY, title TEXT NOT NULL, author TEXT NOT NULL, ISBN TEXT NOT NULL, year INTEGER NOT NULL ); Since this is meant to be a very simple example, let’s just have a single text field for author. This could be a comma delimited list of authors. For a more mature example, you might have another table just for authors. Then define a many-to-many relationship mapping books to a group of authors. SwiftKuery supports many-to-many relationships, however this is outside of the scope of this tutorial. In addition, store the list of registered users are in a simple table with the first and last name and the ID. This table could be extended to contain a hash of the password, email address, last sign in timestamp, etc. CREATE TABLE users ( user_id SERIAL PRIMARY KEY, first_name TEXT NOT NULL, last_name TEXT NOT NULL ); For each user, there is a shopping cart. This cart contains a list of books and also the quantity of the book (in case someone is buying a bunch as gifts for their friends): CREATE TABLE carts ( user_id INTEGER NOT NULL REFERENCES users, book_id INTEGER NOT NULL REFERENCES books, quantity INTEGER NOT NULL ); The cart contains a foreign reference to the users and books table which prevents new items from being added to the cart where the book or the user does not exist anymore- or vice-versa. For this example, let’s place a bunch of popular fantasy books in the database: INSERT INTO books (book_id, title, author, ISBN, year) VALUES (1, 'A Game of Thrones', 'George R. R. Martin', '978-0553593716', 2003), (2, 'A Clash of Kings', 'George R. R. Martin', '978-0553593716', 2003), (3, 'A Storm of Swords', 'George R. R. Martin', '034554398X', 2003), (4, 'Harry Potter and the Sorcerer''s Stone', 'J.K. Rowling', '0439708184', 1999), (5, 'A Dance with Dragons', 'George R. R. Martin', '0553582011', 2013); An item can be added to the cart as follows: INSERT INTO users (user_id, first_name, last_name) VALUES (1, 'Hermione', 'Granger'); INSERT INTO carts (user_id, book_id, quantity) VALUES (1, 4, 2); In order to make queries into the database faster and more efficient, we can add a few indices into the database. This can be useful as we search for books matching a title or an author. CREATE INDEX idx_title_search ON books(title); CREATE INDEX idx_author_search ON books(author); Describing the Tables Before SwiftKuery can build queries against tables in the database, it must have a description for the names of the tables and the columns inside of the table. You must have your tables inherit from the Table class for this to work properly. Your class must define what the tableName is, and have Columns defined for all of the properties you want your Select statements to fetch from. For instance, the books table is described like this: final class BooksTable : Table { let tableName = "books" let bookID = Column("book_id") let title = Column("title") let ISBN = Column("isbn") let year = Column("year") } The carts table, similarly looks like this: final class CartsTable: Table { let tableName = "carts" let userID = Column("user_id") let bookID = Column("book_id") let quantity = Column("quantity") } You might be wondering how SwiftKuery knows how the Column names are discovered and used if they are simply just defined in the class. What happens automatically for you, is that the initializer for the Table class will use reflection in order to get the properties of the class. Any property that has the type Column is used for the query builder. To keep everything together, create a new class called Database: public class Database { let queue = DispatchQueue(label: "com.bookstore.database", attributes: .concurrent) static let booksTable = BooksTable() static let cartsTable = CartsTable() } This class Database contains static references to these BooksTable and CartsTable that you defined earlier. That will prevent you from having to initialize them each time you build a query that uses the tables. We create a Dispatch queue that will be used to help us execute various stages of calling the database in parallel. We will describe more of that later in the section about Promises. We create a function that creates a new SQL connection: private func createConnection() -> Connection { return PostgreSQLConnection(host: Config.databaseHost, port: Config.databasePort, options: [.userName(Config.userName), .password(Config.password), .databaseName(Config.databaseName)]) } Note that in this example, for every incoming request, we will create a new connection. After you are done with the request, you will call the Connection’s closeConnection method. As an alternative, you can implement automatic reconnect and connection pooling to have all requests go to a singleton connection object. However, that is out of scope for our tutorial. It is a good idea to decouple the PostgreSQLConnection implementation from the SwiftKuery calls. This is because you might in the future want to change the implementation of the database you use. All connection types in SwiftKuery uses the Connection class. Create new queries Let’s now create a couple SwiftKuery executable statements. To get all the books, it’s very straightforward. You can simply create a Select on a table with no additional predicates: static func allBooks() -> Select { return Select(from: Database.booksTable) } If you want to search for books that were written by an author, you can use this instead: static func booksByAuthor(author: String) -> Select { return Select(from: Database.booksTable) .where ( Database.booksTable.author == author ) } For a more complicated example, using “fuzzy matching”. You can have your users get a list of books that partially match a book title. We can use the “like” function to do a pattern match in the text. Order it alphabetically, and limit the results. static func booksLike(title: String) -> Select { return Select(from: Database.booksTable) .where( Database.booksTable.title.like("%"+title+"%")) .order( by: .ASC(booksTable.title)) } Finally, in order to get the book information back from a user’s shopping cart, you must do a join on the two tables. SwiftKuery makes this easy with the join and using methods: static func booksInCart(userID: Int) -> Select { return Select(from: Database.cartsTable) .where(Database.cartsTable.userID == userID) .join(Database.booksTable) .using(Database.cartsTable.bookID) } Query the books Although you could create a different handler for when a user searches for all books, another for searches based on author, and another for fuzzy searches on title, and yet another for queries in the cart. We will create a very general purpose piece of code that handles all database for all book-based queries; all it needs is a Select statement and it will return a promise for a list of books. func queryBooks(with selection: Select) -> Promise<[Book]> { let connection = createConnection() return firstly { connection.connect() } .then(on: queue) { result -> Promise<QueryResult> in selection.execute(connection) } .then(on: queue) { result -> ResultSet in guard let resultSet = result.asResultSet else { throw BookstoreError.noResult } return resultSet }.then(on: queue) { resultSet -> [Book] in let fields = resultToRows(resultSet: resultSet) return fields.flatMap( Book.init(fields:) ) }.always(on: queue) { connection.closeConnection() } } There is a lot going on here, so let’s step through it a bit. The function queryBooks returns a promise of a list of books. This promise serves as a handle for a future event that must be fulfilled or errored. The promise eventually will be resolved into either can error, or it can be a list of books. The important thing to note is that when you have a promise, you do not necessarily have the value of the promise immediately. The calls happen perhaps on another thread, and often must wait on some lengthy I/O before the result is resolved. Another interesting thing with promises is that you can return promises as values, or create various different promise handlers on the chain before returning them. In this example, we first establish a connection, once that is established, the select statement can be invoked, then a query result will come back. Here, we can transform that query result into a list of books. We will always have the promise close the connection whether the sequence led to a successful list of books or an error. We discuss the transformation from the SQL ResultSet into a list of books next: let fields = resultToRows(resultSet: resultSet) return fields.flatMap( Book.init(fields:) ) SQL to structures Your application logic will most likely use Swift structures, classes, or enums for every complex data element. Define a new structure for a Book that has the following properties matching the books table: struct Book { let id: Int let title: String let author: String let ISBN: String let year: Int let quantity: Int? } Notice that the quantity is optional. It does not exist in the books table- it exists in the carts table. This is because a query into the database in the catalog would have a nil value quantity since that is not relevant. However, when the Book is returned in the cart, it will contain a quantity. We must now have some transformation that turns a ResultSet from SwiftKuery into a list of books. Let’s extend the Book structure to have an initializer that makes a list of String to Any pairs and optionally returns a new book or not. We can define this capability with a protocol: public typealias Fields = [String: Any] public protocol FieldMappable { init?( fields: Fields ) } The Book is now extended with the FieldMappable protocol, and the initializer is then defined as follows: extension Book: FieldMappable { init?(fields: [String: Any]) { if let fieldID = fields["book_id"] { id = Int(fieldID as! String)! } else { return nil } title = fields["title"] as! String ISBN = fields["isbn"] as! String if let fieldYear = fields["year"] { year = Int(fieldYear as! String)! } else { return nil } if let fieldAuthor = fields["author"] { author = fieldAuthor as! String } else { return nil } if let fieldQuantity = fields["quantity"] { quantity = Int(fieldQuantity as! String)! } else { quantity = nil } } } Note, this can be augmented with more error checking in case the elements returned from the table do not match what you’re expecting. For this example, we use a lot of force unwrapping of the Optionals for the sake of brevity in this tutorial. Now, recall that when you execute a select statement with SwiftKuery, you are returned a ResultSet. Inside of that, there are two arrays, one that contains an array of column titles and another that contains an array of Any for the values. This is complicated, so an example can be useful. For instance, The titles array would contain: [ "title": "author", "id", "year", "isbn"] with the rows: [ ["A Game of Thrones", "George R. R. Martin", "1", "2003", "978-0553593716"], ["A Dance with Dragons", "George R. R. Martin", "5", "2013", "XXX"]] What we want is simply a Dictionary containing just a String to Any pair. This can be accomplished with the following function: func resultToRows(resultSet: ResultSet) -> [Fields] { let t = resultSet.rows.map { zip(resultSet.titles, $0) } let y: [Fields] = t.map { var dicts = [String: Any]() $0.forEach { let (title, value) = $0 dicts[title] = value } return dicts } return y } What we do is for every row in the database, we can zip the arrays for the title with the arrays for the value. The result can then be iterated over to return a new dictionary where the title becomes the key into the hash. So then, why doesn’t the SwiftKuery library simply return a ‘[String: Any’] object to begin with? This is because a select statement such as select * from books, carts does not necessarily guarantee uniqueness on the titles. This could happen if each table shares the same column id, for example. In our example we purposefully did not have 2 tables share the same name of the column to make this transformation possible. Making SwiftKuery return Promises Notice in the above example, making a connection returns a Promise of the connection, instead of through a callback function that you are used to using in the SwiftKuery library. For instance, instead of: connection.connection() { if let error = error { // do something } else { selection.execute() { result in // callback with the result } } } } With Promises, you can use: return firstly { connection.connect() } Once the connection has been made, the following promise can be chained: .then(on: queue) { result -> Promise<QueryResult> in return selection.execute(connection) } Promises help improve the readability of the code, through eliminating nested callbacks, and simplifying how errors propagate through the chain. SwiftKuery does not automatically support promises. It is designed to support different style of programming for asynchrony. Since developers might choose to use callbacks, promises, reactive and all the various and sundry libraries that support promises and reactive programming, it provides the base which are callbacks. One of the great things about the Swift language is that you can extend the capability of an existing API through extensions. To extend the connection class to instead return a promise, you can use: public extension Connection { func connect() -> Promise<Void> { return Promise { fulfill, reject in self.connect() { error in if let error = error { reject(error) } else { fulfill() } } } } } Also, a QueryResult can be returned as a Promise instead of a callback, through this extension to Query: public extension Query { func execute(_ connection: Connection ) -> Promise<QueryResult> { return Promise { fulfill, reject in self.execute( connection) { result in fulfill(result) } } } } Tests To get books that contain the word “Storm” in it, and check to see if the “Storm of Swords” appears, you can run the following test: func test_getBooksLike() { let e = expectation(description: "Get similar books") let database = Database() firstly { database.queryBooks(with: Database.booksLike(title: "Storm")) }.then { books in print("Returned books are \(books)") XCTAssertNotNil(books) XCTAssertEqual(books.count, 1) let stormBook = books[0] XCTAssertEqual(stormBook.title, "A Storm of Swords") e.fulfill() }.catch { error in XCTFail() } waitForExpectations(timeout: 10) { error in } } To get the books in the shopping cart for user 1, you can create the following test: func test_getBooksInCart() { let e = expectation(description: "Books in cart") let database = Database() firstly { database.queryBooks(with: Database.booksInCart(userID: 1)) }.then { books in print("Books in the cart 1 are: \(books)") XCTAssertNotNil(books) e.fulfill() }.catch { error in XCTFail() } waitForExpectations(timeout: 10) { error in } } What’s Next? We have presented how to interface to a relational database for a typical bookstore application and how SwiftKuery can make it easy to build queries against the database. To make our code more readable in the presence of complicated asynchrony, we have presented how Promises can be helpful for improving the readability of your code and improving error handling. Feel free to download the Bookstore full project to get you started. You may be interested in… - Protocol Buffers in your Kitura apps - Securing Kitura Part 2: Basic Authentication - Build End-to-End Cloud Apps using Swift with Kitura Stay tuned for the next segment in the series where we define a REST API for the Bookstore. 1 Comment on "Creating a Bookstore application: Interface to SQL" 好文章!Thanks
https://developer.ibm.com/swift/2016/12/05/creating-a-bookstore-application-interface-to-sql/
CC-MAIN-2017-13
refinedweb
2,731
52.7
- Computer Vision with Raspberry Pi and the Camera Pi module Let’s see how to use the Camera Pi module, a quality photo video camera, purposely designed for Raspberry PI, to acquire the first knowledge concerning Computer Vision, to recognize colors and shapes. Camera Pi is an excellent add-on for Raspberry Pi, to take pictures and record quality videos, with the possibility to apply a considerable range of configurations and effects. In this post we will describe how to use it to recognize specific contents within the acquired images. We may risk a definition of the Computer Vision discipline as the research and the creation of applications, distinguished by the visual capability of computers, that can be used in difficult or impractical applications for the human sight, such as the analysis of medical diagnostics images, security, or the management of autonomous vehicles. A particular sector of the Computer Vision is the Machine Vision, that has as an objective the development of applications for the quality control, the management of production processes. In this article we will describe the basis of the Computer Vision with the tools available to almost all hobbyists: our jack of all trades, the microcomputer Raspberry Pi, Camera Pi for image acquisition (or a USB webcam), and the professional open source image processing tools, SimpleCV and Python. Let’s start with introducing a couple of tools that are designed for image processing, as hinted by their names. These tools are OpenCV (Open Computer Vision) and the SimpleCV (Simple Computer Vision) framework, that allows its simplified usage with Python language. OpenCV is a specific library for Computer Vision, originally developed by Intel and released under Open Source BSD license. The library is multiplatform and can be used on the GNU/Linux, Mac OS X and Windows operating systems. The library has been designed mainly for processing images in real time, and supports the following functionalities: - real time image capture - video files import - image processing (brightness, contrast, thresholds, etc.) - object recognition (faces, bodies, etc.) - recognition of shapes with homogenous characteristics (blob) The immensity and versatility of the OpenCV functionalities make its utilization by the normal users quite difficult: those will find it difficult to choose and organize, as finished applications, the multitude of available “bricks” and possibilities. Luckily, a second library comes to our aid and, whille partially limiting the functionalities of OpenCV, it makes the utilization much easier. We’re talking about SimpleCV, a framework that has been written and that is useable in Python, easy to use, that encases the functionalities of the OpenCV library and image processing algorithms into higher level “bricks” that simplify the life of the developer that wishes to create artificial vision applications, without necessarily possessing a deep knowledge of Computer Vision, such as one acquired in the most prestigious research institutes of the world. Before starting to work, let’s give some final indications on the complexity of the problems concerning Computer Vision, with some examples of what is easy and what is not easy at all, in the Computer Vision applications. Let’s prepare the tools Our vision system is composed by our Raspberry Pi, by our Camera Pi module and by the libraries that we previously described, with their dependences. Actually, Computer Vision libraries have been designed to determine and manage the vision peripherals on the USB ports, while the Camera Pi module uses a dedicated driver that manages it, by directly interfacing the CSI-2 connector. To make up for this problem, in the Python sample programs that we present we will use the caution to acquire a photogram by means of the management controls of Camera Pi, so to load into memory the corresponding image and to process it by using the functions of the SimpleCV library. What we have to create is an application architecture, like the one that can be seen in the scheme, with all the modules needed for the proper running of the OpenCV and SimpleCV libraries within the Raspberry Pi operating system. Before starting, let’s refresh the operating system by typing in the commands from the terminal window we logged into with the “root” user. apt-get update apt-get upgrade Let’s try to run Camera Pi with the command: raspistill ‐t 5000 After having verified that everything works properly, we may start to install the software components of our vision system. Let’s start to install the OpenCV library, its prerequisite packages and its dependences. In particular, IPython is an “enhanced” Python interpreter, offering an interactive shell that is particularly rich in functionalities, and capable to integrate with other languages and development environments, such as SimpleCV, as we just said. Let’s install everything with the command: apt‐get install ipython python‐opencv python‐scipy python‐numpy python‐setuptools python‐pip We will then move on to install SimpleCV as a Python package, and remember that pip (Python Package Index) that we just installed, is the package that allows us to manage the additional modules of the Python language: pip install Let’s install a further dependence, needed for the running of SimpleCV, “Svgwrite”.SVgwrite deals with the management of the vectorial image format (SVG stands for Scalable Vector Graphics). Being an extension of the Python language, we install it with the pip command: pip install svgwrite Once done with installations, we can carry out the first verifications by making use of the interactive shell supplied with SimpleCV (an equivalent function to the one available in the Python language). Let’s use the shell to verify the proper running of the OpenCV library, by typing in the command: simplecv Before starting to experiment, we should introduce, even if very briefly, the digitalization and memorization image modes. Beyond these many formats, that diversify themselves for the black and white or color mode, and by the rendering quality (number of pixels and number of colors), the images are basically represented by one or more pixel arrays, small and numerous dots that vary on the varying of size and image quality. A 640 x 480 black and white picture will be (in fact) composed by 307200 pixels (about 0,3 megapixels), each one with the size of one or more bits, that contains the shade of color that is present in the picture dot represented by the pixel itself. A picture represented by single bit pixels will be a black (1) and white (0) picture, without shades of grey, a so-called “binarized” picture. Color pictures require a pixel matrix for each color, usually three in the RGB (red, green, blue) representation. Even here, the bit size for each pixel determines the color quality. In Table, the pixel value combinations can be seen, and they represent the main colors in the 8-bit format. - Red: (255, 0, 0) - Green: (0, 255, 0) - Blue: (0, 0, 255) - Yellow: (255, 255, 0) - Brown: (165, 42, 42) - Orange: (255, 165, 0) - Black: (0, 0, 0) - White: (255, 255, 255) In this representation, triplets with identical values all represent shades of grey. Luckily, by using SimpleCV it is not needed to know all the numerical representations of the colors, since the major ones can be recalled by name, as GREEN, RED, YELLOW, and so on, by typing in: help(Color) in the SimpleCV shell it is possible to obtain the list of the recognized color names. By the way, the command help(something) is the one to obtain help from SimpleCV; the help menu can be recalled with help(). Once the picture representation mode has been understood, it becomes easier to understand its processing modes. Let’s see now some easy examples, so that you can see with your own eyes, even if very briefly, the problems connected to image processing. As a reference base, we shall use a sheet upon which we have printed all the geometric format shapes, sizes and different colors. Lighting plays a primary role, and the same goes for the distances, the camera angle, the dimensions, the contrast and the color uniformity. Do experiment. To start, in Listing 1 we see the color recognition of a specific pixel within the picture. To do so, we have to keep in mind that the elements are indexed, starting from the upper left corner of the picture. The index concerning the first pixel in the upper left corner of the picture, has a (0, 0) value. In particular, in the listing we extract the pixel value (120, 200). It is obtained by counting 120 pixels downward and 200 pixels towards the right, at about the center of the first red circle in the upper right. Code 1 import subprocess from SimpleCV import Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato1_1.bmp” % (640, 480), shell=True) img = Image(“Listato1_1.bmp”) img.show() pixel = img[120, 200] print pixel img[120, 200] = (0,0,0) pixel = img[120, 200] img.save(“Listato1_2.bmp”) print pixel In Code, the “subprocess.call()” function allows you to launch an external process, and to wait for this to be terminated before continuing with the processing. The external process that is launched is the “raspistill” allowing you to acquire a single image and save it with the desired name. The “Image()” function loads the specified image file in a variable. The “show()” function shows the image on screen. Finally, the “img()” function allows us to access the contents of the image itself, as for reading and writing. Let’s copy the program of the Listing 1 in a file named Listato1.py in the /home folder and we will execute it with the command: python Listato1.py In this, and for each one of the listings that follow, we have pointed out saving of the intermediate images that are obtained during the process, so to analyze them subsequently. The pictures are then saved in the /home folder, from which they can be taken (e.g.: by using WINScp), so to open them with a visualization and/or graphic editing software. We will obtain the result that can be seen in figure, that shows the pixel value as (127, 16, 32). We can verify the correctness of the result by opening the picture with Photoshop and by visualizing the pixel value. They correspond perfectly. This very simple example allows us to verify in practical terms the help coming from the usage of SimpleCV, as for image processing. The img(120, 200) function does all the work for us. To set up a particular pixel with a particular color we shall use the instruction: img[120, 200] = (0,0,0) Obviously, we will substitute the (0, 0, 0) parameters with the R, G, B values of the color we want. This already allows us to operate on the images in the way we want, practically. In the SimpleCV library it is possible to find a lot of functions that allow to generate lines or geometric figures, to fill areas, to set up transparencies, to overwrite some test, and so on. Let’s start to describe how to recognize one or more shapes within an image. Even here we will start from a “simple” example, such as recognizing the colored areas within an image with a white background. The areas with an uniform color, for which it is possible to recognize an outline in the image processing, are defined as blobs (spots). Naturally, then, the function that recognizes the areas characterized by a color contrasting with the background, is called findBlobs(). In Code 2 we see the application of this function: Code 2 #!/usr/bin/python import subprocess from SimpleCV import Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato2_1.png” % (640, 480), shell=True) img = Image(“Listato2_1.png”) img.show() time.sleep(5) img = img.binarize() img.show() time.sleep(5) macchie = img.findBlobs() img.save(“Listato2_2.png”) img.show() time.sleep(20) The “binarize()” function changes the original picture into a black and white image, without shades of grey, so to “emphasize” the “spots”. Not the yellow ones, though, as they are too similar to the white background. You may try to “fix” a threshold value, one that discriminates the “spots” from the background and gives a value (0-255) to parameter of the binarize() function, e.g.: binarize(130). The findBlobs function, in addition to recognizing “spots”, also returns a series of information for each identified area, such as the size, the angle (direction) in respect to the x axis and the coordinates of the center of the area. These pieces of information are very useful in robotics applications. In Code 3 we find an example of visualization of the said pieces of information. Three arrays are there highlighted: they contain the just said pieces of information. The arrays are placed in order of decreasing size of the recognized area (blob). The first “spot” to be indicated is the one of the biggest size, and then all the other ones follow. Code 3 #!/usr/bin/python import subprocess from SimpleCV import Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato3_1.png” % (640, 480), shell=True) img = Image(“Listato3_1.png”) img.show() time.sleep(5) img = img.binarize() img.show() time.sleep(5) macchie = img.findBlobs() img.show() time.sleep(5) print “Areas: “, macchie.area() print “Angles: “, macchie.angle() print “Centers: “, macchie.coordinates() We may now introduce the selection filters as well, to restrict the research field for possible contrasting color areas. A selection criterion is, in fact, the color. We may decide to have it to recognize only the blue color areas, and to highlight the outlines with contrasting color lines. We may do that with the Code 4 program. The reference “color” (22, 36, 75) was identified, always by using the “Photoshop” or “Gimp” method. The “colorDistance()” function takes away from the picture the pixels that represent colors that are “quite” different from the reference color, while keeping the pixels that represent colors that are “quite” similar. Once all the desidered “spots” are recognized, we highlight them with a thick black outline being three pixels wide, by means of the “draw()” function. Code 4 #!/usr/bin/python import subprocess from SimpleCV import Color, Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato4_1.png” % (640, 480), shell=True) img = Image(“Listato4_1.png”) img.show() time.sleep(5) colore = (22,36,75) blue_distance = img.colorDistance(colore).invert() blobs = blue_distance.findBlobs() blobs.draw(color=Color.BLACK, width=4) blue_distance.save(“Listato4_2.png”) blue_distance.show() time.sleep(5) img.addDrawingLayer(blue_distance.dl()) img.save(“Listato4_3.png”) img.show() time.sleep(5) After having launched the program, you will probably find out that the dark green ellipse is recognized as well: the color is “quite” similar to the blue, in fact. The lighting conditions may influence very much the recognition results. Once again… do experiment. The next step is to recognize the outlines of a particular shape, such as lines, circles and corners. Let’s consider a segment as a sequence of points laying on a straight line, generally forming a part of an outline of the shape of a figure. The method that is used by the SimpleCV “findLine()” function is based on the Hough transform. In a few words, with this technique all the possible lines passing from the points of the bidimensional plane (that is, our picture) are analyzed. To all the points of the picture scores are assigned: they grow as they appear laying on a segment joining two points, such as the vertices of a geometric shape. Code 5 #!/usr/bin/python import subprocess from SimpleCV import Color, Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato5_1.png” % (640, 480), shell=True) img = Image(“Listato5_1.png”) img.show() time.sleep(5) # Imposta il valore di soglia lines = img.findLines(threshold=30) lines.draw(color=Color.BLACK, width=4) img.save(“Listato5_2.png”) img.show() time.sleep(15) Let’s launch the program and probably we will find that some straight line is not recognized (maybe the sheet is not perfectly flat) while it is possible that lines “quite” straight are recognized as parts of the long “sides” of the ellipses. Let’s use the find.Circle() function, to recognize circular figures within the picture. The function has three parameters. Canny represents the precision level (cunning) adopted by the algorithm for detecting circular shapes. The intermediate value is 100: with a higher value, the algorithm becomes more picky and recognizes a lesser amount of circles. With a lower value, the algorithm becomes friendlier and will recognize even shapes that are not perfectly circular. Thresh is the threshold level, as in the case of the straight line detection. Distance determines the minimal distance depending on which it is determined if the recognized shape consists of a single circle or more concentric circles. The rest of the instructions orders the detected circles in ascending order, depending on the area of each one. The smaller one, circles[0], is highlighted with a red outline, while all the other ones are highlighted with a black outline. Code 6 #!/usr/bin/python import subprocess from SimpleCV import Color, Image import time subprocess.call(“raspistill -n -w %s -h %s -o Listato6_1.png” % (640, 480), shell=True) img = Image(“Listato6_1.png”) img.show() time.sleep(5) cerchi = img.findCircle(canny=250,thresh=200,distance=11) cerchi.draw(color=Color.BLACK, width=4) cerchi.show() time.sleep(5) cerchi = cerchi.sortArea() cerchi[0].draw(color=Color.RED, width=4) img_with_circles = img.applyLayers() img_with_circles.save(“Listato6_2.png”) img_with_circles.show() time.sleep(15) Launch the program and… have fun! Try to modify the parameters. Try with sheets on which you will have printed circles without filling, with the circumference of many colors, with lightings of different intensities, and so on. To conclude with this first overview on the subject of image processing, we present the SimpleCV function that allows to read barcodes. It is obviously called “findBarcode()” and is capable to automatically recognize the type and content of the barcodes that are present in the picture. QR codes (Quick Response code) are recognized as well: they are particular bidimensional graphic codes, now very widely spread to diffuse heterogenous information, in particular towards mobile devices. A QR Code cryptogram may contain up to 7089 numeric characters or 4296 alphanumeric ones. As for the code generation, we use the Zint Barcode Studio program, an open source product that allows us to generate barcodes and QR codes of any type, and to save them as images, be it in Bitmap or vector format. Zint Barcode Studio is available for many operating systems, either with a graphical interface for “human” usage, or in library form for the program usage (Zint Barcode Generator). For a correct interpretation of the pictures containing a barcode, we have to add the library “zbar” to the SimpleCV “store”. We may install it with the command: apt-get install python-zbar We have prepared a pair of barcodes, printed them on a sheet, and focused them with a video camera. The program is shown in Code 7. Code 7 #!/usr/bin/python import subprocess from SimpleCV import Image, Barcode import time subprocess.call(“raspistill -n -w %s -h %s -o Listato7_3.png” % (640, 480), shell=True) img = Image(“Listato7_3.png”) img.show() time.sleep(5) # Load a one-dimensional barcode barcode = img.findBarcode() print barcode[0].data All the examples that we described work even without the presence of a video camera. We may safely process even a series of images that have been previously acquired, or that are coming from different or remote sources. You just need to remove the instructions for the image acquisition and point the “image()” function to the path/file that contains the image you want to process. Are you excited of the applications? Let us know what you’ve in mind, and stay tuned for the next update on Raspberry PI and Video Apps!… Face recognition! Pingback: Machine vision with the Raspberry Pi - Artificial Intelligence Online()
http://www.open-electronics.org/computer-vision-with-raspberry-pi-and-the-camera-pi-module/
CC-MAIN-2017-22
refinedweb
3,353
51.99
I also blog frequently on the Yesod Web Framework blog, as well as the FP Complete blog. See a typo? Have a suggestion? Edit this page on Github I recently wrote an FP Complete blog post entitled ResourceT: A necessary evil. I had a line in that post I wanted to expand upon: I believe this is an area where the RAII (Resource Acquisition Is Initialization) approach in both C++ and Rust leads to a nicer solution than even our bracket pattern in Haskell, by (mostly) avoiding the possibility of a premature close. To demonstrate what I’m talking about, let’s first see an example of the problem in Haskell. First, the good code: import Control.Exception (bracket) data MyResource = MyResource newMyResource :: IO MyResource newMyResource = do putStrLn "Creating a new MyResource" pure MyResource closeMyResource :: MyResource -> IO () closeMyResource MyResource = putStrLn "Closing MyResource" withMyResource :: (MyResource -> IO a) -> IO a withMyResource = bracket newMyResource closeMyResource useMyResource :: MyResource -> IO () useMyResource MyResource = putStrLn "Using MyResource" main :: IO () main = withMyResource useMyResource This is correct usage of the bracket pattern, and results in the output: Creating a new MyResource Using MyResource Closing MyResource We’re guaranteed that MyResource will be closed even in the presence of exceptions, and MyResource is closed after we’re done using it. However, it’s not too difficult to misuse this: main :: IO () main = do myResource <- withMyResource pure useMyResource myResource This results in the output: Creating a new MyResource Closing MyResource Using MyResource We’re still guaranteed that MyResource will be closed, but now we’re using it after it was closed! This may look like a contrived example, and easy to spot in code. However: By contrast, with the RAII approach in Rust, this kind of thing can’t happen under normal circumstances. (Sure, you can use unsafe code, and there might be other cases I’m unaware of.) Check this out: struct MyResource(); impl MyResource { fn new() -> MyResource { println!("Creating a new MyResource"); MyResource() } fn use_it(&self) { println!("Using MyResource"); } } impl Drop for MyResource { fn drop(&mut self) { println!("Closing MyResource"); } } fn main() { let my_resource = MyResource::new(); my_resource.use_it(); } Despite looking closer to the bad Haskell code, it still generates the right output: Creating a new MyResource Using MyResource Closing MyResource In fact, try as I might, I cannot figure out a way to get this to close the resource before using it. For example, this is a compile error: fn main() { let my_resource = MyResource::new(); std::mem::drop(my_resource); my_resource.use_it(); } And this works just fine: fn create_it() -> MyResource { MyResource::new() } fn main() { let my_resource = create_it(); my_resource.use_it(); } The life time of the value is determined correctly and only dropped at the end of main, not the end of create_it. UPDATE In my efforts to make this as simple as possible, I included a “solution” that’s got a massive hole in it. It still demonstrates the basic idea correctly, but if you want actual guarantees, you’ll need to include the phantom type variable on the monad as well. See Dominique’s comment for more information. We can use a similar approach as the ST strict state transformer via a phantom variable to apply a “lifetime” to the MyResource: {-# LANGUAGE RankNTypes #-} import Control.Exception (bracket) data MyResource s = MyResource newMyResource :: IO (MyResource s) newMyResource = do putStrLn "Creating a new MyResource" pure MyResource closeMyResource :: MyResource s -> IO () closeMyResource MyResource = putStrLn "Closing MyResource" withMyResource :: (forall s. MyResource s -> IO a) -> IO a withMyResource = bracket newMyResource closeMyResource useMyResource :: MyResource s -> IO () useMyResource MyResource = putStrLn "Using MyResource" main :: IO () main = withMyResource useMyResource Now the bad version of the code won’t compile: main :: IO () main = do myResource <- withMyResource pure useMyResource myResource Results in: Main.hs:22:32: error: • Couldn't match type ‘s0’ with ‘s’ because type variable ‘s’ would escape its scope This (rigid, skolem) type variable is bound by a type expected by the context: forall s. MyResource s -> IO (MyResource s0) at Main.hs:22:17-35 Expected type: MyResource s -> IO (MyResource s0) Actual type: MyResource s0 -> IO (MyResource s0) • In the first argument of ‘withMyResource’, namely ‘pure’ In a stmt of a 'do' block: myResource <- withMyResource pure In the expression: do myResource <- withMyResource pure useMyResource myResource | 22 | myResource <- withMyResource pure | ^^^^ This approach isn’t used much in the Haskell world, and definitely has overhead versus Rust: create_itfunction) As I mentioned in the original blog post, regions based on a paper by Oleg explores this kind of idea in more detail.
https://www.snoyman.com/blog/2018/10/raii-better-than-bracket-pattern
CC-MAIN-2019-09
refinedweb
743
55.27
static... doesn't have to be instantiated, lives in a static class, and can be called at any time by just the method name. static class classA { public static void dosomething() { //method that does something } } intance methods live in a class that must be referenced and constructed... public class classB { classB() { //constructor } public void dosomething() { //method that does somthing. } } an instance of the class that contains it would have to be created as an object and the method it contained would be referenced via the object variable you created. ex. classB clsb = new classB(); clsb.dosomething(); simple. google it next time. Class members qualified with static modifier are called static members. Class members declared without static modifier are called instance members. dint understand what u are telling..can u explain m e in detail? Here is code of Test class. using System; public class Test { public static void Print() { // Static Method Console.WriteLine("Hello - Static"); } public void Show() { // Instance Method Console.WriteLine("Hello - Instance"); } } How to make a call to instance & static method? public class MainTest{ public static void Main() { // Static Method Test.Print(); Test a=new Test(); // Create an instance a
https://www.daniweb.com/programming/software-development/threads/196181/static-vs-instances
CC-MAIN-2016-50
refinedweb
192
68.36
Spin locks are a low-level synchronization mechanism suitable primarily for use on shared memory multiprocessors. When the calling thread requests a spin lock that is already held by another thread, the second thread spins in a loop to test if the lock has become available. When the lock is obtained, it should be held only for a short time, as the spinning wastes processor cycles. Callers should unlock spin locks before calling sleep operations to enable other threads to obtain the lock. Spin locks can be implemented using mutexes and conditional variables, but the pthread_spin_* functions are a standardized way to practice spin locking. The pthread_spin_* functions require much lower overhead for locks of short duration. When performing any lock, a trade-off is made between the processor resources consumed while setting up to block the thread and the processor resources consumed by the thread while it is blocked. Spin locks require few resources to set up the blocking of a thread and then do a simple loop, repeating the atomic locking operation until the lock is available. The thread continues to consume processor resources while it is waiting. Compared to spin locks, mutexes consume a larger amount of processor resources to block the thread. When a mutex lock is not available, the thread changes its scheduling state and adds itself to the queue of waiting threads. When the lock becomes available, these steps must be reversed before the thread obtains the lock. While the thread is blocked, it consumes no processor resources. Therefore, spin locks and mutexes can be useful for different purposes. Spin locks might have lower overall overhead for very short-term blocking, and mutexes might have lower overall overhead when a thread will be blocked for longer periods of time. Use the pthread_spin_init(3C) function to allocate resources required to use a spin lock, and initialize the lock to an unlocked state. int pthread_spin_init(pthread_spinlock_t *lock, int pshared); #include <pthread.h> pthread_spinlock_t lock; int pshared; int ret; /* initialize a spin lock */ ret = pthread_spin_init(&lock, pshared); The pshared attribute has one of the following values: PTHREAD_PROCESS_SHARED Description: Permits a spin lock to be operated on by any thread that has access to the memory where the spin lock is allocated. Operation on the lock is permitted even if the lock is allocated in memory that is shared by multiple processes. PTHREAD_PROCESS_PRIVATE Description: Permits a spin lock to be operated upon only by threads created within the same process as the thread that initialized the spin lock. If threads of differing processes attempt to operate on such a spin lock, the behavior is undefined. The default value of the process-shared attribute is PTHREAD_PROCESS_PRIVATE. Upon successful completion, the pthread_spin_init() function returns 0. Otherwise, one of the following error codes is returned. EAGAIN Description: The system lacks the necessary resources to initialize another. Use the pthread_spin_lock(3C) to lock a spin lock. The calling thread acquires the lock if it is not held by another thread. Otherwise, the thread does not return from the pthread_spin_lock() call until the lock becomes available. The results are undefined if the calling thread holds the lock at the time the call is made. int pthread_spin_lock(pthread_spinlock_t *lock); #include <pthread.h> pthread_spinlock_t lock; int ret; ret = pthread_ spin_lock(&lock); /* lock the spinlock */ Upon successful completion, the pthread_spin_lock() function returns 0. Otherwise, one of the following error codes is returned. EDEADLK Description: The current thread already owns the spin lock. EINVAL Description: The value specified by lock does not refer to an initialized spin lock object. UseY Description: A thread currently owns the spin lock. EINVAL Description: The value specified by lock does not refer to an initialized spin lock object. UsePERM Description: The calling thread does not hold the lock. EINVAL Description: The value specified by lock does not refer to an initialized spin lock object. Use the pthread_spin_destroy(3C) function to destroy a spin lock and release any resources used by the lock. int pthread_spin_destroy(pthread_spinlock_t *lock); #include <pthread.h> pthread_spinlock_t lock; int ret; ret = pthread_spin_destroy(&lock); /* spinlock is destroyed */.
http://docs.oracle.com/cd/E26502_01/html/E35303/ggecq.html
CC-MAIN-2015-06
refinedweb
678
63.59
JavaScript/Operators From Wikibooks, the open-content textbooks collection [edit] Arithmetic Operators Javascript has the arithmetic operators +, -, *, /, and %. These operators function as the addition, subtraction, multiplication, division and modulus operators, and operate very similarly to it's negative counterpart. var a = "1"; var b = a; // b = "1" a string var c = +a; // c = 1: a number var d = -a; //. [edit] Bitwise Operators There are 7 ~ inverts all bits within an integer, and usually appears in combination with the logical bitwise operators. Two bit shift operators, >>, <<, move the bits in one direction which. [edit] els = document.getElementsByTagName('h2'); var i; for (i = 0; i < els.length; i += 1) { // do something eith els[i] } [edit]; [edit] Pre and post-increment operators Increment operators may be applied before or after a variable. When they are applied before a variable they are pre-increment operators, and when they are applied after a variable they are post-increment operators.; [edit] Comparison operators The comparison operators determine if the two operands meet the given condition. ==- returns true if the two operands are equal. This operator may convert the operands to the same type (e.g. change a string to an integer). ===- returns true if the two operands are identical. This operator will not convert the operands types, and only returns true if they are the same type and value. !=- returns true if the two operands are not equal. This operator may convert the operands to the same type (e.g. change a string to an integer) and returns false if they represent the same value. !==- returns true if the two operands are not identical. This operator will not convert the operands types, and only returns false if they are the same type and value. >- Returns true if the first operands is greater than the second one. >=- Returns true if the first operands is greater than or equal to the second one. <- Returns true if the first operands is less than the second one. <=- Returns true if the first operands is less than or equal to the second one. Be careful when using == and != as they convert one of the terms being compared so that it's easier to compare. This can lead to strange and non-intuitive situations, such as: 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null == undefined // true It is better to use === and !== because then you can be sure that the results that you get are those you expect 0 === '' // false 0 === '0' // false false === 'false' // false false === '0' // false false === undefined // false false === null // false null === undefined // false [edit] Logical operators && || ! The logical operators are and, or, and not. The && and || operators accept two operands and provides their associated locical. [edit] Other operators ? : The ? : operator (also called the "ternary" operator) is very useful and cool and can replace verbose and complex if/then/else chains. You can replace if (p && q){ return a; }else{ if (r != s){ return b; }else{ if (t || !v){ return c; }else{ return d; } } } with return (p && q) ? a : (r != s) ? b : (t || !v) ? c : d However, the previous example is a terrible coding style/practice. It is always a bad idea to include nested ternary structures in your programs; whoever comes by to edit or maintain your code (which could very possibly be you) will have a hard time understanding what you meant..
http://en.wikibooks.org/wiki/JavaScript/Operators_and_Expressions
crawl-002
refinedweb
566
56.45
Hey Wix Team, Guys, I have a htttpfunction to delete the contents of a database after some date/time of its creation. I am using a query to initially find the items from two collections to delete and then WixData.Remove to delete the items that I wanted to delete. But I have two issues currently with my code: 1. WixDataOptions is not working in the query function. Why is it so? Am i doing any thing wrong? If i change the database permission to "read anyone", I can delete the contents using the code below. But else the query dont give any output as it dont have the permission 2. I can't do Or operation on query. If i do or operation like below code I am getting this error in from return {"Error":{"code":"WD_VALIDATION_ERROR"}} If I remove the or operation, then everything works expect issue 1 . Pleas help!!! Btw I am calling my function using below link. import { notFound, ok, serverError } from 'wix-http-functions'; import wixData from 'wix-data'; export async function get_deleteOldDatabaseData() { let itemsToDelete; let threeMonthAgoDate = new Date( new Date().getFullYear(), new Date().getMonth() - 3, // Add the month here(Change) new Date().getDate() ); let returnoptions = { "headers": { "Content-Type": "application/json" } }; let options = { "suppressAuth": true, "suppressHooks": true }; let q1 = wixData.query("Events", options) .lt("_createdDate", threeMonthAgoDate); let q2 = wixData.query("Service_Search", options) .lt("_createdDate", threeMonthAgoDate); let full_query = q1.or(q2); return await full_query.find() .then((results) => { if (results.items.length > 0) { itemsToDelete = results.items; for (let i in itemsToDelete) { wixData.remove("Events", itemsToDelete[i]._id, options); } returnoptions.body = { "Status": "Items Deleted = " + results.items.length }; return ok(returnoptions); } returnoptions.body = { "Status": "No Data To Delete" }; return notFound(returnoptions); }) // something went wrong .catch((error) => { returnoptions.body = { "Error": error }; return serverError(returnoptions); }); } Hi Nithin. For your first question: please pay attention, that the WixDataOptions parameter should be supplied to find function, and not to query function as in your example. For the second question, it seems that you are performing an or operation between 2 different collections, which is not supported. We will improve our API reference documentation to reflect that. Regards, Genry. Hello Genry, Thanks a lot for your quick reply. Yes...yesterday I found out the issue with my second question and corrected it myself. And it would be great if both the answers to my questions are entered in the wix code reference as it might help others stuck in the same situation. BTW I would like to say that now wix code support in the forum is improving compared to for example 1 -2 month back. I have complained lot of times in this forum and during some wix user surveys about the bad condition of this forum before...I hope it will continue to improve in future like this...... Thanks.... Hi Nithin. Thanks for you kind words :) Yes, we will improve our documentation to reflect the question asked here. Glad to hear the issue was resolved for you :) Regards, Genry.
https://www.wix.com/corvid/forum/community-discussion/how-to-apply-wixdataoptions-and-or-with-http-function-query
CC-MAIN-2020-05
refinedweb
497
59.3
From Clueless to Currying in Five Minutes In the past month I’ve grasped and forgot the finer points of currying functions a few times, so here’s a quick article that will cover the concept generally. Before we get into it, know that currying is used a lot in functional programming, and it relies on the concept of higher order functions, i.e. passing one function to another. If that sounds confusing, check out the quick read about that concept I wrote here. It’s a 3 minute read to get you up to speed. While the act of currying functions gets its name from Haskell Curry, it helped me to think about it like making a curry. Traditionally, when you call a function, you pass all its arguments in at once, and what the function returns your result. When you curry a function, the function is split into partial functions and it takes its arguments one at a time, passing the first argument to the first partial function. When the first partial returns, the curried function will take the next argument, and so on, until there are no more arguments to process. Add an argument and let it simmer. When it’s ready, add the next argument. It’s a lot like cooking a curry. Okay, that’s a lot to unpack there. Don’t Panic. It’s a simple concept and in a few minutes you’ll have the hang of it, too. Check out the coding examples below. So let’s look at this madlibs function, written traditionally, below. let madlibs = (name, food, number) => 'My name is ' + name + ' and I love ' + food + ', I could eat ' + number +' plates of it!' All the arguments grouped together in the parentheses. Calling this function in our code by passing all our arguments in at once, like this: console.log (madlibs("Jerry","Spaghetti","10")) And our function puts this on the console: My name is Jerry and I love Spaghetti, I could eat 10 plates of it! To curry madlibs, we re-write it like so: let madlibs = name => food => number => 'My name is ' + name + ' and I love ' + food + ', I could eat ' + number +' plates of it!' Notice the nested arrow functions, splitting up our arguments. Which changes the way we call it: console.log (madlibs("Jerry")("Spaghetti")("10")) … now each argument is separate, and each is passed one at a time to each partial function, but we get the same output. My name is Jerry and I love Spaghetti, I could eat 10 plates of it! However, we don’t need to call it all at once! If we do this: console.log (madlibs("Jerry")("Spaghetti")) The console will log the final arrow function. Depending on your environment, you may only see [function] logged to your console, but what’s being returned is: (number) => 'My name is ' + name + ' and I love ' + food + ', I could eat ' + number + ' plates of it!' If you try running the code over at playcode, you can see this logged in the console. The important thing to note here is how currying gives us the ability to slowly add our arguments to our function. While it may not be apparent why just yet, the fact we can pass arguments in gradually and come back to our function later with more arguments is useful, we’ll come back to this concept shortly. But before we do that, one more thing you need to know is that we can use a number of functional programming libraries to have JavaScript curry a traditional function for us, for example, lodash: import _ from 'lodash'let madlibs = (name, food, number) => 'My name is ' + name + ' and I love ' + food + ', I could eat ' + number +' plates of it!'madlibs = _.curry(madlibs)let jerry = madlibs("Jerry")let jerrysFavoriteFood = jerry("Spaghetti")console.log (jerrysFavoriteFood('10')) Here, we use the _ function from lodash to curry the traditional version of madlibs and then we call the first partial and assign the returning function to the variable jerry in the line let jerry = madlibs("Jerry") … and similarly, we call the second partial using jerry("Spaghetti") and assign the last partial function to jerrysFavoriteFood so when we call the final function, we still get our output: My name is Jerry and I love Spaghetti, I could eat 10 plates of it! This last example is similar to the ways I employed lodash while working through a Redux tutorial online. Let’s say I have a dataset of users and I’m looking for the users who love the color red: = (favorite_color, obj) => obj.favorite_color === favorite_colorlet usersThatLoveRed = users.filter(x => faveColor('red', x))console.log(usersThatLoveRed) … which will log the following data. [ {id:1,username:"cambot",favorite_color:"red"},{id:3,username:"tom",favorite_color:"red"},{id:5,username:"joel",favorite_color:"red"} ] (The format it will be logged out as may be less pretty depending on your environment.) This works, but look at the way we call faveColor. We pass it 2 arguments, 'red’ and x. Using currying, we can make the code more readable. In the example below, we achieve the same output: import _ from 'lodash = _.curry((favorite_color, obj) => obj.favorite_color === favorite_color)let usersThatLoveRed = users.filter(faveColor('red'))console.log(usersThatLoveRed) The above implementation does the same thing, however note that now when we call users.filter on faveColor we are only passing one argument, since we are only concerned with the first partial function. In a large codebase with a lot of moving parts, this method of employing currying can make the code more readable for everyone. It’s great for making code self-documenting, too. And really, that’s what currying functions is all about - Either by hand or by using a functional library like lodash, we take a function that takes multiple arguments and split it up into partial functions that take single arguments - The partials we call return the partials yet to be executed. We _can_ call all of those functions in one call, or just the partials we need to use. It’s the potential to only call the first few partials that I think makes currying such a great tool. If we only need some of the curried partials, we stand to make our code easier to read and have less we need to keep track of in our code.
https://s-satsangi.medium.com/on-currying-611f23cd3853
CC-MAIN-2022-40
refinedweb
1,056
61.97
Hi guys, > The problems is often that the text goes trough an extra charset > encodings/decodings when you try to examine it for debugging purposes, > and this can obliterate the traces of the root problem. To spot where > exactly the problem happens, print (e.g. log) the text on various phases > (e.g. when you get the request parameters) with *character codes*, that > is, with numbers. Then check if the printed UCS codes are OK at that > point. (As a catalog of UCS codes you may use "UniBook".) Adding to Daniel's comment, as it is stated in the javadocs, "This method must be called prior to reading request parameters or reading input using getReader()." So the only feasible solution I find with Struts is using a Filter. > >> > >> > >>Using Filter works for me. :) > >> And here's an example of what one might look like: public class PolishFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding("iso-8859-2"); chain.doFilter(request, response); } } ## I'm leaving out unimplemented methods. Best regards, -- Shinobu -- Shinobu "Kawai" Yoshida <shinobu.kawai@gmail.com> --------------------------------------------------------------------- To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: velocity-user-help@jakarta.apache.org
http://mail-archives.us.apache.org/mod_mbox/velocity-user/200501.mbox/%3C376e3b1405011905057c30ba71@mail.gmail.com%3E
CC-MAIN-2019-22
refinedweb
207
50.02
I. Note: there’s no source code accompanying this article. It’s all rather trivial, really. Okay, let me briefly explain: say you’ve got a string and you want to remove its last character. What do you do? Well, the typical solution is to write s.Substring(0, s.Length-1) which is technically correct but feels like you’re hacking zombies with a scalpel (the opposite of ‘brain surgery with a chainsaw’). And in fact, certain languages such as Python (and Boo, by proxy) let you express this idea of slicing up arrays more succinctly. Specifically, you can use negative range values to measure distance from the end of the array. (Or from the end of one element past the array, as the case may be.) Unfortunately, in C# we’re screwed by default, because there’s no way for us to replace the preceding expression with something nice like s[0:-1]. Or is there? s[0:-1] Let’s theorize for a little while. Say you’ve decided that it’s time to end the tyranny of Substring() with a simple extension method that somehow lets you enter all sorts of crazy values or even leave them blank Substring() public static string Substring(this string obj, int start = 0, int end = -1) { if (end < 0) end = obj.Length + end; return obj.Substring(start, end-start); } But this wouldn’t work because there already is a method called Substring() that takes two parameters (albeit differently named). So, what can we do? Well, we can give up and die, rename the method to something like SubString (may VB.NET users forgive us) or, better yet, attempt to encapsulate the whole concept of rangeness (or rangedness) in a separate structure. SubString public struct Range { public int Start; public int End; } Great, right? We can now use this thing in our APIs, and the creepy extension method we wrote previously can now make more sense: public static string Substring(this string obj, Range range) { if (range.End < 0) range.End = obj.Length + range.End; return obj.Substring(range.Start, range.End - range.Start); } However, the invocation is still creepy because we need to write something like string s = "abcde"; string ss = s.Substring(new Range{Start=1,End=-2}); which I’m sure you agree is ugly and not worth the effort. We could narrow it down to a collection initialization Range{1,-2}, but this would require Range to implement IEnumerable which is unidiomatic and generally bad. There has to be another way. Range{1,-2} Range IEnumerable And indeed there is a better way. Remember extension methods? Well, we can have them on any type including, you guessed it, an int. So, without further ado, I bring you the fluent range builder: int public static Range to(this int start, int end) { return new Range {Start = start, End = end}; } Trivial, right? You’ve now got a way of quickly defining a range with weird negative values (if you must) as follows: string ss = s.Substring(1.to(-2)); Isn’t that better? And yes, I know it’s not perfect, but guess what, we live in an imperfect world. The answer to this question is philosophical and depends on how much you actually want. I’ve shown a very simple example of using a range with the Substring extension, but generally, ranges are used to take slices out of arrays/matrices/vectors. For example, applying this concept to an enumeration, we could come up with something like: Substring public static IEnumerable<T> At<T>(this IEnumerable<T> obj, Range range) { var list = obj.ToList(); if (range.Start < 0) range.Start += list.Count; if (range.End < 0) range.End += list.Count; return list.Skip(range.Start).Take(range.End - range.Start); } The above takes a slice out of any IEnumerable (list, array, etc.) given the provided range. Obviously in a real scenario there’d be more rigorous checks on the range parameter, as well as obvious concerns related to materializing the whole collection. The above is for illustration purposes only. range It gets better, though. For example, what if that range parameter above was actually of type params Range[] instead? This would, as if by magic, allow you to take several slices out of one collection and concatenate them all together. Wouldn’t that be great? params Range[] But ranges are ultimately very fragile things, only really useful for denoting the start and end of something. What if you wanted, say, to assign the value of 0 to particular elements of an array? Would you create some Set() extension method? Perhaps, but there’s a more powerful alternative. Set() A view is just a range plus the object it relates to. This difference is crucial because once you have both the range and the target object, you can do all sorts of naughty things like setting all the values in range to a particular value. Let’s flesh out this view thing. First of all, it’s pretty obvious what the class looks like: public class ArrayView<T> { public Range Range; public T[] Array; public ArrayView(T[] array, Range range) { Array = array; if (range < 0) // you know the drill Range = range; } } I’m using an array for illustration purposes, something else could be there! The point is that now instead of an At method we can have a View method: At View public static ArrayView<T> View<T>(this T[] array, Range range) { return new ArrayView<T>(array, range); } The view acts on a pretransformed range (negative values, remember?), but what does it let us do? Well, for starters we can implement a basic indexer: public T this[int i] { get { // don't forget to pre-transform, then return Array[Range.Start + i]; } set { // same here, then Array[Range.Start + i] = value; } } And here’s how you would use it: var a = new[] {1, 2, 3, 4}; var b = a.View(2.to(3)); b[0] = 42; Console.WriteLine(a[2]); And yes, a[2] really does equal 42, as you would expect. a[2] 42 So what can you actually do with views? Well, how about views-of-views? After all, there’s nothing stopping us from having yet another indexer that takes another Range, so… public ArrayView<T> this[int start, int end] { get { // pretransform, as always return new ArrayView<T>(Array, new Range { Start = start + Range.Start, End = end + Range.End }); } } Yep, I’m actually using two parameters in that indexer to represent the range more fluently. If you prefer to use x.to(y) notation, just create an overload. In fact, having one is a good idea for the general case. But wait, what about the setter? Well, on this particular occasion the only thing that will save you is a Set() method that would set the value of each element. Using the = operator doesn’t make much sense in this case. x.to(y) = Here are some other fun things you can do with views: Implement set operations. Obviously these make sense only when the type of array referenced in the view is the same. Implement IEnumerable. It kind of makes sense, that way you can iterate a view of an array. In one of the Batman films, the Joker character says something along the lines of «see how much chaos you can do just with gasoline?». Well, this article is another illustration of how much you can do with extension methods – an unreasonably powerful feature that can let you spawn objets with magical powers. Your mileage will, invariably, vary. But ranges can be useful, in ways that go beyond this article. Good luck and stay tuned for more unreasonable uses of extension methods! This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) Enumerable.Range(begin, count) General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
https://www.codeproject.com/Articles/538561/Ranges-in-Csharp?msg=4501890
CC-MAIN-2017-26
refinedweb
1,343
65.42
RECOMMENDED: If you have Windows errors then we strongly recommend that you download and run this (Windows) Repair Tool. –map CollectMineralShards –agent. The error message "Windows Sockets registry entries required for network connectivity are missing" can be extremely frustrating. Here is how you fix it. Appscan Internal Error Occurred Windows Sockets (Winsock) error codes returned by the WSAGetLastError function. Dealing with Socket Error 10013 « wiki-errors.com – Anytime you are using a Windows based e-mailing program, such as Window Live, you have the chance of connections going bad. When this happens an error such as. You are unable to access internet and it's disturbing. You are actually struck by Windows socket error. How to fix windows socket error? In order to understand what a Windows socket error is, and how to fix it, you first need to know the basics about windows socket. Windows socket is a specification in. Buy Window Socket at Amazon! Free Shipping on Qualified Orders. SmartPCFixer™ is a fully featured and easy-to-use system optimization suite. With it, you can clean windows registry, remove cache files, fix errors, defrag disk. In order to understand what a Windows socket error is, and how to fix it, you first need to know the basics about windows socket. Windows socket is a specification in Windows. Its main function is to define how the network programs will communicate with each other, or how windows software access the network. A good. Who do you call when the toilet clogs, the outlet smokes, the window cracks, or. Explore, download, and import visualization files into Desktop or Web to transform the way you visualize your data Windows sockets error codes, values, and. when no data is queued to be read from the socket. It is a nonfatal error, Windows Sockets only permits. There was a recent newsgroup posting about asynchronous sockets in separate threads. I pointed out many failures in the code, thinking it had been written by the. #Client API #IO. Exposed as the io namespace in the standalone build, or the result of calling require(‘socket.io-client’). <script src="/socket.io/socket.io.js. Following two of the procedures, the implanted metal socket didn’t integrate with. PDF element is one of the best and simplest way to edit the PDF in Windows for free. It allows you to create, edit, convert and sign PDFs. It has a user-friendly. Windows socket error: What is it and How to fix it? – SpeedFixTool – Feb 17, 2014. You are unable to access internet and it's disturbing. You don't really know what the reason behind it is. You checked your internet connection, reset it many times , troubleshoot for errors, and tried sending basic commands yet failed. You are actually struck by Windows socket error. Mar 29, 2017. Description: A blocking operation is currently running. Windows Sockets only permits a single blocking operation for each task or for each thread to be outstanding. If any other function call is made (whether it references that or any other socket), the function fails with the WSAEINPROGRESS error. RECOMMENDED: Click here to fix Windows errors and improve system performance
http://geotecx.com/window-socket-error/
CC-MAIN-2018-17
refinedweb
527
59.5
Forum:Huff the File Namespace From Uncyclopedia, the content-free encyclopedia Before you all groan "lol, what the fuck?", I've already read up on the issues surrounding the File namespace and, more importantly, the arguments for keeping it around. I don't intend for this to be another forum where extreme solutions are thrown back and forth. Instead, this is going to be an analysis of what the File namespace is good for, where it fails, and where it adds needless complications to the wiki. The File namespace has its good points Take a look at File:Mickey Mouse - Hate haet hat!.png. It totally belongs here - a parody of Mickey Mouse in the style of Mickey Mouse. If that's not Uncyclopedian to you, you haven't looked at Category:AGH MY EYES (or its partner in crime, Category:AGH MY EARS). No, it's not a good actual file, but it also doesn't need to be - it's a goddamn parody. We have similar articles in the File namespace that I feel belong here, e.g. File:Antipoop.jpg, another reference to an actual visual thingy taken to ridiculous extremes. I'm sure some of you File namespace fanatics can think of more. But these all share one fact in common... "Files" don't need their own namespace These aren't "files". You can't have proper "files" on a MediaWiki wiki (more on that later). They are articles that look like the things they're about, which we already have a category for. These "files" could easily exist in mainspace without any complaint. There are few enough of them (that is, properly executed file pages) that they don't need their own namespace, less their own Main Page. There's been a lot of discussion about how a file ought to be judged, and I'm here to say they ought to be judged as articles. Does a file serve a satirical purpose? Great! It's an article (that looks like the thing it's about). Otherwise, it's VFD fodder, or porn that needs to be kept in userspace. Most files we have now are not funny and/or do not need to be written in the file format. People assume the File namespace is a free pass to upload a file. It's not; an unfunny file is no different than an unfunny article. If we move files to mainspace I think it'll be clearer just how many files are conceptless bunches of text. And furthermore... Uncyclopedia is not 4chan Is Uncyclopedia meant for posting and discussion of pictures? No? Then we shouldn't have a file namespace (with a complementary file discussion namespace) that instigates just that. Specifically, the pages in question stem from - of all things - licenses. Of course, I didn't actually investigate this junk, but it's obvious file pages exist solely because the MediaWiki developers were shitting their pants about copyright. Well, there's also the description bit, but really, if it needs a description it shouldn't be that difficult to write it as a mainspace article that looks like the thing it's about. But the important thing is we don't need file pages that contain no funniness at all. Think about that for a minute. Most of our file pages don't even contain license information. And the description, if the uploader even bothered to add one, is typically boring, unfunny and/or vandalised. That probably includes a great deal of featured files too. No other namespace - heck, no article - automatically has useless MediaWiki crap added to it. And honestly, if a file isn't in the public domain or unfair use, I'm sure the UN:N license still applies. At this point you might be wondering what the fuck I'm talking about, but you're probably confused because you've been mixing up files and file pages. That's probably because I've been too lazy to clarify which of the two I meant with "file" in the paragraphs above, which I hope you'll forgive me one day. But to get back to the point, files don't need their own pages. They work just fine without a file page. And the file namespace exists solely to host all the file pages. If we want to look at the files themselves, Media:Filename.jpg will do just fine. So what do we do? There aren't any reasons to keep file pages under their own namespace. It confuses things. Because it's its own namespace, we have the impression it ought to be big. And because it's relatively isolated from the rest of the wiki, we (for some reason) imagine that it has different quality rules than everything else. Instead, there are only a few file pages that have a reason to be presented as file pages, just as there are only a few articles that have a reason to be presented as something they aren't. There isn't any need for new quality standards. Something should only be in the file page format if it has a reason to be presented as a file page. The solution is simple. Kill the namespace, move everything into mainspace, VFD the things that aren't funny - just like everything else. I know everyone might not agree with this, but I haven't seen a single valid argument for keeping the namespace. So please, if there's a good reason to keep it separate, tell me. But all I see are reasons it's harming the wiki and making things more complicated than they ought to be. – No Siree Sockpuppet of an unregistered user, PhD (criticize • writings) The obvious vote that always goes along with these stupid kinds of things - For MegaPleb • Dexter111344 • Complain here 21:55, April 4, 2011 (UTC) - Noooooo!! I always use File, never anything else, and have since I got here. All thez people wanting to huff everything they see, must be that radiation effecting the userfolk. Aleister 22:00 4-4-'11 - p.s. a few minutes later. Is this another one of those April fool things, a copy satire of Lollipop's huffing page? Grrrrr. Or, RAR, whichever is more appropriate. - I have a huffing page? -- Lollipop - CONTRIBS - WRITINGS - SHOP - Now adopting! 20:23, April 5, 2011 (UTC) -
http://uncyclopedia.wikia.com/wiki/Forum:Huff_the_File_Namespace
CC-MAIN-2016-22
refinedweb
1,064
73.27
Create a Report with Landscape Pages This example shows how to create a report with landscape pages that are 11 inches wide and 8.5 inches high. Using landscape pages allows fitting content that is too wide to fit on a portrait page, such as side-by-side images depicted here. Import the DOM and Report API packages so that you do not have to use long, fully qualified class names. import mlreportgen.dom.*; import mlreportgen.report.*; Create a container for a PDF report. To create a Word report, change the output type from "pdf" to "docx". rpt = Report("figureSnapshotSideBySideLandscape","pdf"); Set the report landscape layout to true. This sets the entire report layout to landscape. rpt.Layout.Landscape = true; Create a chapter with the title "Types of Cosine Value Plots with Random Noise". chapter = Chapter("Title", "Types of Cosine Value Plots with Random Noise"); Create the variables to plot. Create x as 200 equally spaced values between 0 and 3pi. Create y as cosine values with random noise. x = linspace(0,3*pi,200); y = cos(x) + rand(1,200); Create figure objects of the x and y values: bar graph (fig1), scatter plot (fig2) and 2-D Line plot (fig3) . Create image objects wrapped around the figure snapshot image files. Set the scaling of the figure objects so they fit in the table entries. imgStyle = {ScaleToFit(true)}; fig1 = Figure(bar(x, y)); fig1Img = Image(getSnapshotImage(fig1, rpt)); fig1Img.Style = imgStyle; delete(gcf); fig2 = Figure(scatter(x,y)); fig2Img = Image(getSnapshotImage(fig2, rpt)); fig2Img.Style = imgStyle; delete(gcf); fig3 = Figure(plot(x,y)); fig3Img = Image(getSnapshotImage(fig3, rpt)); fig3Img.Style = imgStyle; delete(gcf); Insert the images in the only row of a 1x5 invisible layout table(lo_table)(space between figures by having 2 empty table entries). A table is considered invisible when the borders are not defined for the table nor any of its table entries. The images are sized to fit the table entries only if the height and width of table entries are specified. lo_table = Table({fig1Img, ' ', fig2Img, ' ',fig3Img}); lo_table.entry(1,1).Style = {Width('3.2in'), Height('3in')}; lo_table.entry(1,2).Style = {Width('.2in'), Height('3in')}; lo_table.entry(1,3).Style = {Width('3.2in'), Height('3in')}; lo_table.entry(1,4).Style = {Width('.2in'), Height('3in')}; lo_table.entry(1,5).Style = {Width('3in'), Height('3in')}; Add the table to the chapter and the chapter to the report. add(chapter, lo_table); add(rpt, chapter); Create a chapter with the title "Surface Plot". chapter1 = Chapter("Title", "Surface Plot"); Create a figure object for surface plot (fig4). Create image objects wrapped around the figure snapshot image files. fig4 = Figure(surf(peaks(20))); fig4Img = Image(getSnapshotImage(fig4, rpt)); fig4Img.Style = imgStyle; delete(gcf); Add the generated image object to the chapter and the chapter to the report. add(chapter1, fig4Img); add(rpt, chapter1); Generate and display the report close(rpt); rptview(rpt); The generated report includes the side-by-side figure snapshots and the surface plot on landscape pages. The generated side-by-side figure snapshots are clearly legible.
https://fr.mathworks.com/help/rptgen/ug/create-a-landscape-report.html
CC-MAIN-2022-33
refinedweb
509
58.99
Timeline … 09/29/11: - 21:16 Ticket #31462 (Samba3 Undefined symbols for architecture x86_64) created by - Everything goes fine, but then the compilation fails because of the arch … - 20:09 Ticket #30481 (Upgrade Transmission to 2.33) closed by - fixed: Fixed in r84708. - 20:09 Ticket #30307 (transmission 2.22 fails to build on Lion) closed by - fixed: Fixed in r84708. - 20:08 Changeset [84708] by - transmission: upgrade to 2.33 and close tickets #30307, #30481 - 20:05 Ticket #30629 (LyX crashes on Lion) closed by - fixed: Made the change and committed in r84707. Let me know if anything breaks! - 20:03 Changeset [84707] by - LyX: fix segmentation fault on Lion and close ticket #30629 - 19:52 Ticket #31296 (Kcolorchooser and Okular: wrong conflict with kdegraphics4) closed by - fixed: Fixed in r84706. - 19:52 Changeset [84706] by - kcolorchooser, okular: don't conflict with kdegraphics4, #31296 - 17:01 Changeset [84705] by - kde4-kile: rewrite master_sites to avoid redirects - 16:42 Changeset [84704] by - kde4-kile should not conflict with kile-devel, because kile-devel is … - 16:36 Changeset [84703] by - kipi-plugins: remove unused files - 16:23 Changeset [84702] by - kde4-kile: patch in post-patch, not pre-configure; consolidate multiple … - 15:44 Changeset [84701] by - distfiles/ardour2: commit distfile for version 2.8.12. - 15:05 nicos edited by - (diff) - 15:04 nicos edited by - (diff) - 14:59 Ticket #28400 (Kile-devel @2.1b5 unable to launch any external app) closed by - fixed: Issue solved with new port kde4-kile, a stable version of replacement of … - 14:57 Ticket #30214 (kile-devel updated to stable version) closed by - fixed: Portfile kde4-kile added in r84698, with consistent dependencies (texlive, … - 14:51 Changeset [84700] by - kile-devel: making port stub with revbump and replacing it with stable … - 14:46 Changeset [84699] by - pangomm: update to version 2.28.3, add license. - 14:06 Changeset [84698] by - kde4-kile: Creating port, based on stable version of kile 2.1, as a … - 13:49 Changeset [84697] by - caml-ounit: use ocaml portgroup - 13:48 Changeset [84696] by - portgroup ocaml: is always not universal; add use_oasis_doc function to … - 13:39 Changeset [84695] by - libxls: adding license - 13:23 Ticket #30971 (virtualbox @4.1.2 Configure error - qt4 not found) closed by - worksforme: I'm closing this -- It seems to arise from factors external to VirtualBox … - 13:16 Changeset [84694] by - ocaml-extunit: use ocaml portgroup - 13:12 Changeset [84693] by - new port group: ocaml-1.0 - 13:07 Ticket #31461 (hdfeos5 configure error under Lion: error: HDF5 was linked without SZIP, ...) created by - Hello, hdfeos5 doesn't build under Lion, the log points to the following … - 12:34 Ticket #31371 (Cairo build error with clang) closed by - fixed: r84692. - 12:34 Changeset [84692] by - cairo, cairo-devel: use llvm-gcc-4.2 instead of clang on Xcode 4.2+; see … - 12:25 Ticket #31460 (molden: update to 5.0-20110929125200) closed by - fixed: Thanks, your diff is fine. Committed in r84691. - 12:25 Changeset [84691] by - molden: update to 5.0-20110929125200; see #31460 - 11:00 Ticket #31456 (klauncher not working) closed by - worksforme - 10:37 Changeset [84690] by - py-htmldocs: Add 31 and 32 flavors. - 10:36 Changeset [84689] by - version bump to 9.0.5 - 10:25 Ticket #31328 (virtualbox: @4.1.2 fixing Python Bindings on Lion) closed by - fixed: Fixed in r84688. Please resubmit the OpenGL as a separate issue. - 10:24 Ticket #31305 (virtualbox: add vnc support) closed by - fixed: Fixed in r84688. - 10:23 Ticket #27155 (VLC 1.0.6 build failure - librsvg-2/librsvg/rsvg.h: No such file or ...) closed by - fixed: Closing as per comment:5. - 10:22 Changeset [84688] by - virtualbox: add VNC and Python binding support and close tickets #31305, … - 10:14 Ticket #27127 (Abiword-x11 @2.8.6 missing dependency on librsvg) closed by - fixed: r81689 - 10:12 Ticket #27113 (zlib: zlib.dylib doesn't get built, causes destroot to fail) closed by - duplicate: No response; assuming duplicate. - 10:11 Changeset [84687] by - version bump to 9.1.1 - 10:09 Ticket #27111 (building gdk-pixbuf2 fails: "glib.h not found" but only in ...) closed by - worksforme: This clearly worked on the build server: … - 10:06 Ticket #27109 (PATCH: blitz headers to work with gcc >4.3) closed by - fixed: r84686 - 10:06 Changeset [84686] by - blitz: patch headers to work with newer gccs, and add gcc variants … - 10:04 Ticket #31460 (molden: update to 5.0-20110929125200) created by - Another stealth upgrade has been issued for molden-5.0. I've attached a … - 09:48 Ticket #31459 (libffi: headers are merged improperly by muniversal portgroup) created by - Installation of libffi via 'sudo port -svk install libffi +universal' … - 09:41 Ticket #31458 (Incorrect checksums for ocaml-doc) created by - It seems the checksums in the Portfile of ocaml-doc are outdated: […] … - 09:24 Ticket #31457 (tcpflow: update to 1.0.2) created by - tcpflow was recently upgraded to 1.0.1. I just downloaded and built the … - 08:49 Ticket #31456 (klauncher not working) created by - I know that some 9-10 months ago there was already a ticket (25178) about … - 08:17 Ticket #31455 (Updated swi-prolog-devel portfile for version 5.11.28) closed by - fixed: r84685 - 08:16 Changeset [84685] by - swi-prolog-devel: Maintainer update to version 5.11.28. (#31455) - 08:12 Ticket #31455 (Updated swi-prolog-devel portfile for version 5.11.28) created by - Updated swi-prolog-devel portfile for version 5.11.28. - 08:10 Ticket #31454 (commons-fileupload fails...causing tomcat6 also to fail.) closed by - duplicate: Please don't open a new ticket for the same problem. - 08:08 Ticket #27776 (commons-fileupload does not build) closed by - fixed - 08:07 Ticket #30321 (root @5.30.00, Revision 1 build fails on OS X Lion) closed by - fixed: I'm going to called this fixed for now. - 05:28 Changeset [84684] by - py-iso8601: fix depspec - 05:04 Changeset [84683] by - p5-catalyst-runtime: license - 05:04 Changeset [84682] by - p5-moosex-role-withoverloading: license - 05:03 Changeset [84681] by - p5-aliased: license - 05:01 Changeset [84680] by - p5-tree-simple-visitorfactory: license - 04:59 Changeset [84679] by - p5-tree-simple: license - 04:58 Changeset [84678] by - p5-text-simpletable: license - 04:56 Changeset [84677] by - p5-string-rewriteprefix: license - 04:55 Changeset [84676] by - p5-path-class: license - 04:54 Ticket #31454 (commons-fileupload fails...causing tomcat6 also to fail.) created by - commons-fileupload fails to install on osx-10.6.8. All of the other … - 04:53 Changeset [84675] by - p5-moosex-getopt: license - 04:53 Changeset [84674] by - p5-test-warn: license - 04:53 Changeset [84673] by - p5-tree-dag_node: license - 04:50 Changeset [84672] by - p5-getopt-long-descriptive: license - 04:46 Changeset [84671] by - p5-moosex-methodattributes: license - 04:45 Changeset [84670] by - p5-namespace-autoclean: license - 04:43 Changeset [84669] by - p5-moosex-emulate-class-accessor-fast: license - 04:41 Changeset [84668] by - p5-moosex-types-common: license - 04:40 Changeset [84667] by - p5-moosex-types: license - 04:39 Changeset [84666] by - p5-namespace-clean: license - 04:39 Changeset [84665] by - p5-sub-identify: license - 04:36 Changeset [84664] by - p5-carp-clan: license - 04:33 Changeset [84663] by - p5-module-pluggable: license - 04:31 Changeset [84662] by - p5-http-request-ascgi: license - 04:29 Changeset [84661] by - p5-http-body: license - 04:29 Changeset [84660] by - p5-test-deep: license - 04:25 Changeset [84659] by - p5-class-c3-adopt-next: license - 04:22 Changeset [84658] by - p5-cgi-simple: license - 04:22 Changeset [84657] by - p5-io-stringy: license - 04:16 Changeset [84656] by - p5-b-hooks-endofscope: license - 04:16 Changeset [84655] by - p5-variable-magic: license - 04:13 Changeset [84654] by - p5-class-data-inheritable: license - 04:07 Changeset [84653] by - p5-class-accessor: license - 04:04 Changeset [84652] by - p5-dbi: license - 04:02 Changeset [84651] by - p5-sql-statement: license - 03:36 Changeset [84650] by - junit: license - 03:35 Changeset [84649] by - hamcrest-core: license - 03:33 Ticket #31453 (update leiningen to 1.6.1.1) created by - Please update leiningen to 1.6.1.1, I'm attaching a patch. - 03:32 Changeset [84648] by - apache-ant: license - 03:26 Ticket #31452 (update maintainer email to macports handle) created by - Please replace maintainer email with new macports handle in ports: […] - 03:21 Ticket #31451 (update maven-ant-tasks to 2.1.3) created by - Please update maven-ant-tasks to 2.1.3, I'm attaching patch. - 03:19 Changeset [84647] by - py-iso8601: add distribute dep - 02:58 Changeset [84646] by - port maven-ant-tasks: fixed Apache license - 02:50 Ticket #30060 (maven-ant-tasks: Could not create local repository) closed by - fixed: Adding […] to Portfile fixes it. Committed r84645 and closing this … - 02:48 Changeset [84645] by - maven-ant-tasks: added license, HOME env variable to build phase. #30060 … - 02:45 Ticket #30765 (unify swig and bindings) closed by - fixed: r84644 - 02:45 Changeset [84644] by - unify swig and bindings (#30765) - 02:30 Ticket #31450 (clojure update 1.3.0) created by - I'm attaching a patchfile to bump clojure to 1.3.0, latest stable from its … - 02:18 Changeset [84643] by - py*-colander: unify - 02:12 Ticket #31449 (netcdf fails to install: cannot find libszip) created by - Hi, installing the netcdf package fails on my OSX Lion MacBook Pro, … - 02:08 Changeset [84642] by - libxls: taking ownership of the port - 02:03 Changeset [84641] by - py*-translationstring: unify - 01:51 Changeset [84640] by - py*-iso8601: unify - 01:45 Ticket #31378 (py26-distribute: checksum mismatch) closed by - fixed: As I wrote above, the file was stealth updated and I (temporarily) removed … - 00:26 Ticket #31350 (QuantLib) closed by - fixed: r84639 - 00:25 Changeset [84639] by - QuantLib: new port, version 1.1; see #31350 - 00:22 Changeset [84638] by - gocr: update to 0.49; enable universal variant - 00:13 Changeset [84637] by - gocr: whitespace changes / reformatting / add modeline - 00:06 Changeset [84636] by - xastir: enable universal variant, removing duplicate FLAG removal code … 09/28/11: - 23:52 Changeset [84635] by - xastir: update to 2.0.0, patched to avoid non-portable use of "echo -n"; … - 23:46 Changeset [84634] by - strigi: rewrite master_sites to avoid redirects - 23:22 Changeset [84633] by - xastir: rewrite master_sites to avoid redirects; fix livecheck - 23:13 Changeset [84632] by - xastir: whitespace changes / reformatting / add modeline - 23:05 Ticket #31448 (dns2tcp @0.4 checksum mismatch) created by - Attempts to install dns2tcp immediately fail. CLI error reported is a … - 23:03 Changeset [84631] by - shapelib: license - 23:02 Changeset [84630] by - shapelib: add universal variant - 23:00 Changeset [84629] by - shapelib: simplify destroot - 22:54 Changeset [84628] by - Correct epoch monotonicity while incrementing the revision. - 22:54 Changeset [84627] by - shapelib: whitespace changes / reformatting / add modeline - 22:40 Changeset [84626] by - py26-clnum: enable universal variant - 22:17 Ticket #31398 (xorg startup/exit infinite-loop) closed by - fixed: r84625 - 22:17 Changeset [84625] by - On SL and Lion, just install a symlink to the system quartz-wm - 21:39 Changeset [84624] by - xine-lib: new reason why universal is disabled - 21:33 Changeset [84623] by - ncid: update to 0.83 - 21:29 Changeset [84622] by - pango-devel: update to 1.29.4 - 21:25 Changeset [84621] by - php5-ssh2: update to 0.11.3 - 21:22 Changeset [84620] by - synfig, synfigstudio: update to 0.63.02 - 21:03 Ticket #31378 (py26-distribute: checksum mismatch) reopened by - This problem seems to have re-occurred (or maybe it remains unfixed). The … - 20:40 Changeset [84619] by - vxl: revise reason for disabling universal - 20:33 Ticket #31440 (baresip: fix building on MacOSX 10.7 (Lion)) closed by - fixed: Thanks, r84618. - 20:33 Changeset [84618] by - baresip: change how the opengl module is linked to fix build on Lion; see … - 20:27 Ticket #31445 (taglib-extras fails due to wrong directory name) closed by - fixed: Fixed in r84617. - 20:27 Changeset [84617] by - taglib-extras: fix worksrcdir; see #31445 - 20:17 Ticket #31447 (root uses software it doesn't declare dependencies on) created by - [ … - 20:13 Ticket #23856 (root@5.26.00 does not include python in build process) closed by - fixed: root does have python variants now so I'm closing this ticket. The … - 19:58 Ticket #31432 (gauche fails to build on Lion) closed by - fixed - 16:24 Ticket #31446 (build fails for openssh @5.9p1) created by - build fails. see the attached log for details - 16:16 Ticket #31445 (taglib-extras fails due to wrong directory name) created by - Attempting "port install taglib-extras" fails. The reason for this is … - 16:11 Ticket #31444 (MacPorts Python decimal module broken; Python installed from source works ...) created by - I noticed very unusual behavior in Python's decimal module, and reported … - 15:45 nicos edited by - (diff) - 15:38 nicos created by - First version of the page - 15:14 Changeset [84616] by - caml-ounit: add license - 15:03 Changeset [84615] by - zope: license - 14:46 Changeset [84614] by - p5-digest: license - 14:44 Changeset [84613] by - koffice: license - 14:43 Changeset [84612] by - autoconf263: correct license - 14:39 Changeset [84611] by - darcs: add license key - 14:38 Ticket #31443 (Report on all the tickets on which someone added a comment or attachment) created by - I believe a report to locate all the tickets someone added an attachment … - 14:14 Ticket #31442 (R fails to build on snow leopard) created by - The first error appears to be on tuklib_integer.h. I have attached the … - 13:56 MacPortsDevelopers edited by - Adding nicos to maintainers list (diff) - 13:41 Changeset [84610] by - mlt: new reason why it's not universal - 13:23 Ticket #31441 (glade3: Workaround for +quartz variant) created by - glade3 cannot be built in a a macports tree with the +quartz variant. Here … - 13:16 Changeset [84609] by - fann: license - 13:15 Changeset [84608] by - fann: fix typo in description - 13:13 Changeset [84607] by - caml-sqlite3: Do not put slashes in front of paths that already start with … - 13:12 Ticket #31372 (octave - error when computing dependencies) closed by - invalid: In any event, as mentioned above, this is a tech support issue. The atlas … - 13:10 Changeset [84606] by - clutter: allow pango-devel and cairo-devel to satisfy pango and cairo … - 13:09 Changeset [84605] by - gtk3: allow glib2-devel to satisfy glib2 dependency - 13:08 Changeset [84604] by - emacs: allow glib2-devel to satisfy glib2 dependency - 13:06 Changeset [84603] by - rspamd: allow glib2-devel to satisfy glib2 dependency - 13:02 Changeset [84602] by - sox: rewrite master_sites to avoid redirects - 13:01 Changeset [84601] by - sox: enable universal variant - 12:51 Ticket #31440 (baresip: fix building on MacOSX 10.7 (Lion)) created by - feedback from people using Lion say that the opengl module fails to … - 12:48 Ticket #31439 (xorg-libxcb @1.7_0+python27: Failed to load the xcbgen Python package!) created by - […] - 12:44 Changeset [84600] by - remove old port -- gcc34 will not build on any recent Mac OS X - 12:31 Ticket #31428 (root: update to 5.30.02) closed by - fixed: Not that error again. It builds fine for me on Snow Leopard. I'm … - 12:30 Changeset [84599] by - root: Maintainer update to version 5.30.02. Remove kerberos5 variant for … - 12:28 Changeset [84598] by - caml-ounit: disable universal variant - 12:27 Ticket #27374 (caml-ounit: update to 1.1.0) closed by - fixed: Markus updated the port in r84504. - 12:24 Changeset [84597] by - libao: license - 12:22 Ticket #31438 (qca-ossl: universal variant broken) created by - The universal variant of qca-ossl doesn't work. During the configure … - 12:21 Changeset [84596] by - nss: license - 12:12 Changeset [84595] by - gauche: update to 0.9.2; see #31432 - 12:08 Changeset [84594] by - gauche: fix build failure when CC contains a space (like when ccache is … - 11:56 Changeset [84593] by - gauche: update homepage and master_sites to avoid redirects; fix livecheck - 11:15 Ticket #31437 (New portfile for kdevelop) closed by - duplicate: Duplicate of #14890. - 10:43 Changeset [84592] by - New port: py-sqlparse - 10:05 Ticket #31437 (New portfile for kdevelop) created by - There used to be a portfile for KDevelop but currently there is not one on … - 09:54 Ticket #31436 (Krdc missing from kdenetwork4) created by - The Krdc application is not included in kdenetwork4 yet I think it should … - 09:49 Ticket #31435 (Build error on py27-wxpython (doesn't detect GCC 4.2)) created by - Py27-wxpython fails to build on my machine. The error log suggests that … - 09:41 Ticket #31430 (BiggerSQL @1.3.9 extract failure) closed by - duplicate: Duplicate of #21117. - 09:35 Ticket #31431 (kdebase @3.5.10 - failed to patch) closed by - duplicate: Duplicate of #31352. - 09:29 Ticket #31405 (Skrooge 0.9.991) closed by - fixed: Thanks to ak.ml we've finally got this resolved in r84591 - 09:29 Changeset [84591] by - skrooge: update to 0.9.991 - 09:17 Ticket #31434 (Update py27-pyfits to 3.0.2) created by - The attached portfile updated pyfits to the latest version, 3.0.2. Despite … - 09:05 Changeset [84590] by - ice-cpp: license - 09:02 Changeset [84589] by - php5-pspell: license - 09:02 Changeset [84588] by - php5-mbstring: license - 09:01 Changeset [84587] by - php5-gettext: license - 08:58 Changeset [84586] by - tiki: license - 08:49 Changeset [84585] by - php5-web: license - 08:43 Changeset [84584] by - php5-mysql: license - 08:42 Ticket #31433 (System ImageMagick `convert` predominates over MacPorts `convert`) closed by - invalid: /usr/local/bin/convert is something that you installed (outside of … - 08:34 Changeset [84583] by - suhosin: remove stub from 2009 - 08:33 Ticket #31433 (System ImageMagick `convert` predominates over MacPorts `convert`) created by - Here is an abbreviated transcript of my experience, from before to after … - 08:30 Changeset [84582] by - phpsymon: license - 08:28 Changeset [84581] by - autoconf213: license - 08:25 Changeset [84580] by - apache2: whitespace - 08:19 Changeset [84579] by - apache2: license - 07:54 Changeset [84578] by - py-twisted-web2: disable livecheck - 07:29 Ticket #31397 (hggit: update to 0.3.1) closed by - fixed: Fixed in r84577. - 07:27 Changeset [84577] by - Fix #31397: update to hggit-0.3.1 - 07:27 Changeset [84576] by - libmicrohttpd: update to 0.9.15 - 07:16 Changeset [84575] by - py-twisted-web2: whitespace - 06:41 Ticket #31432 (gauche fails to build on Lion) created by - Gauche will not install on my iMac (10.7.1). I attached 'main.log'. The … - 06:24 Ticket #27954 (openslp: unable to infer tagged configuration) closed by - fixed: r84574 - 06:21 Ticket #31401 (openslp does not build) closed by - fixed: r84574 - 06:21 Changeset [84574] by - openslp: fix libtool usage (#31401) - 06:16 Ticket #31431 (kdebase @3.5.10 - failed to patch) created by - OS: Mac OS X 10.6.8 Darwin Kernel Version 10.8.0 I run this … - 06:07 Changeset [84573] by - caml-extlib: install documentation - 06:05 Ticket #31401 (openslp does not build) reopened by - After discussion with jmr, openslp still needs to be fixed as it does not … - 06:00 Changeset [84572] by - mail/opendkim: - New port. - 05:55 Ticket #31430 (BiggerSQL @1.3.9 extract failure) created by - […] […] - 05:51 Changeset [84571] by - mail/rspamd: - New port. - 05:45 Changeset [84570] by - caml-sqlite3: install api-doc, too; increase revision; - 05:45 Ticket #31401 (openslp does not build) closed by - invalid - 05:12 Changeset [84569] by - gtksourceview2: undo r84568 for now - 05:06 Changeset [84568] by - gtksourceview2: add missing dependency for +quartz -- perhaps we could … - 05:05 Changeset [84567] by - tyxml: add missing dependency - 04:51 Changeset [84566] by - new port textproc/tyxml - 04:03 Ticket #27074 (fann @2.0.0 submission) closed by - fixed: r84565 - 04:03 Changeset [84565] by - New port: fann, Fast Artificial Neural Network Library (#27074) - 03:33 Changeset [84564] by - libxml: correct deps, set license - 02:56 Changeset [84563] by - ocaml-extunix: add license - 02:47 Changeset [84562] by - ocaml-extunix: patch to enable more functions on OS X (otherwise they are … - 02:22 Ticket #31429 (New portfile for SeqAn) created by - Hi, I would like to submit a new portfile for SeqAn, the scientific … - 01:10 Changeset [84561] by - ocaml: use ncurses for interpreter; inc. revision; - 01:00 Changeset [84560] by - ocmalduce: add license key - 00:54 Ticket #31372 (octave - error when computing dependencies) reopened by - Problem exists for me also === elvis:garrett:1:~ % sudo port -v … - 00:48 Changeset [84559] by - remove obsolete patch - 00:46 Changeset [84558] by - ocmalduce: version 3.12.1.0; take (open)maintainership - 00:27 Ticket #31428 (root: update to 5.30.02) created by - Update to the root port The main changes are : - Bump the version to … 09/27/11: - 23:26 Changeset [84557] by - lablgtk2: add license - 21:32 Changeset [84556] by - scala28: new upstream 2.8.2 release. - 20:28 Ticket #31427 (p5-selenium-remote-driver) closed by - invalid: This is not a port in Macports. - 20:13 Ticket #31427 (p5-selenium-remote-driver) created by - I get error in downloading the packages. Does anybody know why I can not … - 18:26 Ticket #30194 (lint should give a warning about missing licenses) closed by - fixed: Error on unset (default: unknown) license, r84555. We're only keeping a … - 18:23 Changeset [84555] by - base: lint error when license is not set, #30194 - 17:39 Ticket #30208 (wxWidgets-devel: update to 2.9.2) closed by - fixed: In fact this was fixed (not invalid). - 17:39 Ticket #30208 (wxWidgets-devel: update to 2.9.2) reopened by - - 15:20 Ticket #31426 (arm-none-eabi-binutils install fails) created by - I attempted to install arm-none-eabi-gcc and it came back with: […] … - 14:50 Ticket #31425 (py27-htmldocs @2.7.2_0 file permissions unreadable by "others") closed by - fixed: Fixed in r84554. - 14:50 Changeset [84554] by - py-htmldocs: Fix permissions issue #31425 - 14:30 Changeset [84553] by - py27-tornado: update to version 2.1 - 14:09 Changeset [84552] by - py-regex: new unified port - 14:07 Changeset [84551] by - qimageblitz: license - 14:05 Changeset [84550] by - modelines - 13:47 Changeset [84549] by - py-gviz-api: fix license - 13:42 Changeset [84548] by - New port: py-gviz_api - 13:39 Changeset [84547] by - oxygen-icons: * license * modeline - 13:37 Ticket #31425 (py27-htmldocs @2.7.2_0 file permissions unreadable by "others") created by - […] - 13:21 Ticket #31412 (baresip: update to 0.3.0) closed by - fixed: Thanks, committed in r84546 with these changes: * deleted revision line … - 13:21 Changeset [84546] by - baresip: maintainer update to 0.3.0 (#31412); enable universal variant now … - 13:17 Ticket #29538 (spandsp-devel: update to 0.0.6pre18) closed by - fixed: * r84543: fixed livecheck * r84545: updated to 0.0.6pre18 - 13:17 Changeset [84545] by - spandsp-devel: update to 0.0.6pre18; see #29538 (maintainer timeout) - 13:11 Changeset [84544] by - ktoblzcheck: upgrade to 1.36 - 13:11 Changeset [84543] by - spandsp-devel: fix livecheck; see #29538 (maintainer timeout) - 13:03 Changeset [84542] by - py-elementtree: * unify * license * take over maintainership with … - 13:03 Ticket #31413 (restund v0.3.0) closed by - fixed: Thanks, committed in r84541 with these changes: * removed revision line; … - 13:03 Changeset [84541] by - restund: new port, version 0.3.0; see #31413 - 12:50 Ticket #31411 (librem v0.3.0) closed by - fixed: Thanks; r84540. - 12:49 Changeset [84540] by - librem: new port, version 0.3.0; see #31411 - 12:44 Ticket #28662 (baresip 0.1.0) closed by - fixed: Thanks, fixed in r84539. - 12:44 Ticket #31410 (libre: update to 0.3.0) closed by - fixed: Thanks; r84539. - 12:44 Changeset [84539] by - libre: maintainer update to 0.3.0 (#31410); fix install_name of libraries … - 12:25 Ticket #31420 (Relative route instead of a static) closed by - invalid: I'm not certain what you're talking about but I assume the answer is "no." … - 12:19 Changeset [84538] by - spidermonkey: license - 12:10 Changeset [84537] by - nspr: license - 12:06 Changeset [84536] by - clustalx: license - 11:57 Changeset [84535] by - testdisk: license - 11:55 Changeset [84534] by - ntfs-3g: license - 11:51 Changeset [84533] by - libewf: license - 11:47 Changeset [84532] by - e2fsprogs: license - 11:37 Changeset [84531] by - py-hgsvn: license - 11:34 Changeset [84530] by - py-pyxg: license - 11:32 Changeset [84529] by - py-elementtree: license - 11:23 Changeset [84528] by - octave: license - 11:05 Changeset [84527] by - metis: license - 11:05 Changeset [84526] by - add metis to mirror exclusions - 10:44 Changeset [84525] by - gnuplot: license, installs_libs no - 10:28 Changeset [84524] by - ftgl: license - 10:25 Changeset [84523] by - arpack: license - 09:59 Changeset [84522] by - tree: add license, support build_arch - 09:54 Changeset [84521] by - phonon: license - 09:01 Ticket #31424 (Password Safe) created by - Request to add the latest version of Password Safe to MacPorts. * … - 08:42 Changeset [84520] by - kdebase3: license - 08:41 Changeset [84519] by - xorg-libXxf86misc: license - 08:38 Changeset [84518] by - xorg-libXtst: license - 08:35 Changeset [84517] by - unsermake: license - 08:34 Changeset [84516] by - kdelibs3: license - 08:34 Ticket #31423 (py-wxpython: "class wxFont" has no member named "MacGetATSUFontID") created by - Installed MacPorts about a week ago in order to install matplotlib. … - 08:32 Changeset [84515] by - qt3, qt3-mac: license - 08:13 Changeset [84514] by - poll-emulator: update to 1.5.1, add license, support build_arch - 07:44 Changeset [84513] by - py-pyopencl: * unify * given permission to take maintainership - 07:19 Changeset [84512] by - modelines - 06:59 Changeset [84511] by - modelines - 06:51 Changeset [84510] by - py27-mako: license - 06:27 Changeset [84509] by - mime: license - 04:47 Ticket #31422 (unify py*-pygments) created by - Patch against py32-pygments attached. - 04:23 Ticket #31421 (unify py*-docutils) created by - Diff against py27-docutils attached. If you don't want to be listed as … - 04:00 Changeset [84508] by - redis: update to version 2.2.14 - 03:17 Ticket #31420 (Relative route instead of a static) created by - Can I change the default installation dir of a port to be placed in a … - 02:42 Changeset [84507] by - py-kombu: update to version 1.4.1 - 02:40 Changeset [84506] by - py-kombu: set svn props on portfile - 02:29 Changeset [84505] by - new port devel/ocaml-extunix - 02:13 Changeset [84504] by - caml-ounit: version 1.1.0 (#27374); project moved to ocaml forge (updated … - 01:54 Changeset [84503] by - py-distribute: fix livecheck, disable for subports 09/26/11: - 23:45 Changeset [84502] by - new port: devel/ocaml-autoconf - 23:35 Changeset [84501] by - hugs98: use_autoconf so that configure.ac can be patched directly (much … - 19:58 Ticket #31419 (py27-numpy: multiarray.so: wrong architecture) created by - I installed py27-numpy, but I cant seem to import it. I did a succesful … - 19:48 Ticket #31418 (pypy shouldn't need gcc45) created by - At one point pypy couldn't compile with the standard gcc-4.2 included in … - 19:08 Ticket #31407 (git-core: update to 1.7.6.4) closed by - fixed: r84500 - 19:07 Changeset [84500] by - git-core: update to 1.7.6.4 (#31407), download from googlecode for now … - 18:34 Ticket #31403 (nesc @1.3.2 upgrade to 1.3.3) closed by - fixed: Updated in r84499 with some additional changes. - 18:34 Changeset [84499] by - nesc: maintainer update to 1.3.3 (#31403); indicate license; update … - 18:25 Ticket #31417 (Mercurial shouldn't need Python26 if Python27 is available) closed by - duplicate: Duplicate of #27757. - 18:08 Ticket #31417 (Mercurial shouldn't need Python26 if Python27 is available) created by - If Python27 is installed, the Mercurial should not need to install the … - 16:30 Changeset [84498] by - py-psycopg2: fix typos in description - 16:17 Ticket #31416 (iperf: update to 2.0.5) created by - Sourceforge release 2.0.5 dated July 2010 … - 14:57 Ticket #30552 (digikam @1.8.0 should now depend on marble instead of kdeedu4) closed by - fixed: This was handled by #30576 / r81769 - 14:54 Ticket #30804 (digikam: add missing runtime dependency on oxygen-icons) closed by - fixed: r84385 - 14:23 Changeset [84497] by - user dir: experimental Nu portfile with default CC rather than hardcoded. … - 13:38 Changeset [84496] by - hugs98: use libedit instead of readline - 12:27 Changeset [84495] by - py-igraph: license - 12:23 Ticket #31415 (netcdf 4.1.3 Error ld: library not found for -lsz) created by - OS version - Lion 10.7.1 XCode version 4.1 (4B110) […] - 12:22 Changeset [84494] by - py-psycopg2: license - 12:17 Changeset [84493] by - postgresql90: license - 12:11 Changeset [84492] by - opal: license - 12:07 Changeset [84491] by - py-shapely: license - 12:04 Changeset [84490] by - gtksourceview2: fix license - 12:03 Ticket #31406 (mkvtoolnix: update to 5.0.0) closed by - fixed: r84487. - 11:57 Changeset [84489] by - py-twisted-web2: * unify * fix livecheck * license - 11:55 Changeset [84488] by - add missing patchfile - 11:54 Changeset [84487] by - mkvtoolnix: maintainer update to 5.0.0 (#31406), indicate license - 11:53 Changeset [84486] by - hugs98: add 'license' key - 11:38 Ticket #31346 (sqlite3: use libedit instead of readline) closed by - fixed: excellent idea -- thanks, commited in 84485 - 11:38 Changeset [84485] by - sqlite3: use libedit instead of readline (which is BSD licensed instead of … - 11:28 Ticket #31271 (openssl-1.0.0e.tar.gz checksum mismatch) closed by - worksforme: The checksums in the Portfile match the checksums on the openssl homepage. … - 11:20 Ticket #31414 (UPDATE: spin version 6.1.0) created by - update from spin version 6.0.1 to 6.1.0 - 11:17 Ticket #31413 (restund v0.3.0) created by - New package for restund, a modular STUN/TURN server depends on libre … - 11:16 Ticket #31412 (baresip: update to 0.3.0) created by - Update of baresip to latest version v0.3.0 depends on libre v0.3.0 and … - 11:14 Ticket #31411 (librem v0.3.0) created by - New package librem which is used by e.g. baresip v0.3.0 librem depends on … - 11:13 Ticket #31410 (libre: update to 0.3.0) created by - Update to libre version v0.3.0 baresip should also be updated to v0.3.0 - 11:01 Changeset [84484] by - py27-twisted: drop maintainer - 10:58 Changeset [84483] by - py-coverage: license - 10:54 Changeset [84482] by - py-xlwt: unify - 10:11 Changeset [84481] by - allow epoch to be a don't care value in reg_entry_open by passing an empty … - 09:54 Ticket #27966 (bmake @20060728 Failure parsing /usr/share/mk/bsd.compat.mk on install) closed by - fixed: Port resurrected in r84480 - 09:51 Changeset [84480] by - bmake: resurrect port - 09:39 Ticket #31409 (ghci has a broken cosine) created by - ghci does not calculate cosines. […] if pi is replaced by 3.1415 this … - 08:58 Ticket #31408 (Update postgres91{,-doc,-server} to 9.1.1) created by - Patch attached. - 08:57 Changeset [84479] by - gsl: license - 08:56 Changeset [84478] by - user directory - Nu language update from github - 08:53 Changeset [84477] by - orrery: * add modeline * make openmaintainer * add license * use … - 08:49 Changeset [84476] by - maniview: * add modeline * make openmaintainer * add license * use … - 08:42 Changeset [84475] by - gvemodules-xforms: * add modeline * make openmaintainer * add license … - 08:41 Changeset [84474] by - gvemod-xforms-example: * add modeline * make openmaintainer * add … - 08:39 Changeset [84473] by - gvemod-ndview: * add modeline * make openmaintainer * add license * … - 08:35 Changeset [84472] by - gvemod-labeler: * add modeline * make openmaintainer * add license * … - 08:34 Changeset [84471] by - gvemod-crayola: * add modeline * make openmaintainer * add license * … - 08:32 Changeset [84470] by - gvemod-cplxview: * add modeline * add license * make openmaintainer * … - 08:31 Changeset [84469] by - pspp-devel: avoid icon-theme.cache ownership - 08:19 Changeset [84468] by - automoc: license - 08:08 Changeset [84467] by - p5-macosx-file: license - 08:06 Changeset [84466] by - p5-file-which: license - 08:05 Changeset [84465] by - p5-test-script: license - 08:03 Changeset [84464] by - p5-probe-perl: license - 07:57 Changeset [84463] by - p5-file-tempdir: license - 07:57 Changeset [84462] by - py-h5py: Rev-bump to build against updated hdf5-18 port (r84386) - 07:55 Changeset [84461] by - p5-file-tail: license - 07:52 Changeset [84460] by - p5-file-sharedir: license - 07:50 Changeset [84459] by - p5-file-pushd: license - 07:49 Changeset [84458] by - p5-file-temp: license - 07:42 Changeset [84457] by - p5-file-path: license - 07:40 Changeset [84456] by - delete p5-file-ncopy; this module is long deprecated - 07:32 Changeset [84455] by - p5-file-modified: license - 07:29 Changeset [84454] by - p5-file-mmagic: license - 07:23 Changeset [84453] by - p5-file-mimeinfo: license - 07:21 Changeset [84452] by - p5-file-homedir: license - 07:19 Changeset [84451] by - p5-file-flat: license - 07:18 Changeset [84450] by - p5-file-desktopentry: license - 07:17 Changeset [84449] by - p5-file-basedir: license - 07:13 Changeset [84448] by - p5-file-copy-recursive: license - 05:39 Ticket #31407 (git-core: update to 1.7.6.4) created by - The version 1.7.6.1 is buggy. Thanks - 05:28 Changeset [84447] by - licenses for p5-file-comments and dependencies - 05:15 Ticket #31406 (mkvtoolnix: update to 5.0.0) created by - bump mkvtoolnix 4.9.1 -> 5.0.0 - 05:11 Ticket #31405 (Skrooge 0.9.991) created by - A new version of Skrooge has been published. Could you update the … - 04:52 Changeset [84446] by - pspp-devel: update to g5cc0ad - 04:43 Ticket #30414 (ppl, cloog: error: C compiler cannot create executables) reopened by - - 04:32 Ticket #31404 (Xcode 4 does not cost money) created by - The guide currently indicates that Xcode 4 costs money, whereas it does … - 04:31 Changeset [84445] by - py-coverage: * unify * update to 3.5.1 - 04:14 Changeset [84444] by - licenses for p5-file-changenotify and dependencies - 02:40 Changeset [84443] by - p5-digest-md5-file: license - 02:39 Changeset [84442] by - py2*-pymongo: unify - 02:38 Changeset [84441] by - p5-config-inifiles: license - 02:31 Changeset [84440] by - macfile-gimp: license - 02:31 Changeset [84439] by - gimp2: license - 02:30 Changeset [84438] by - aalib: license - 02:30 Changeset [84437] by - libgnomeui: license - 02:29 Changeset [84436] by - libbonoboui: license - 02:29 Changeset [84435] by - libwmf: license - 02:28 Changeset [84434] by - py25-gtk, py27-gtk: license - 02:26 Changeset [84433] by - py25-cairo, py26-cairo, py27-cairo: license - 02:25 Changeset [84432] by - py25-py, py26-py, py27-py: license - 02:22 Changeset [84431] by - w3m: license - 02:22 Changeset [84430] by - boehmgc: license - 02:21 Changeset [84429] by - openexr: license - 02:21 Changeset [84428] by - ilmbase: license - 02:20 Changeset [84427] by - libopenraw: license - 02:20 Changeset [84426] by - libLASi: license - 02:18 Changeset [84425] by - libspiro: license - 02:17 Changeset [84424] by - py25-gobject, py27-gobject: license - 02:08 Changeset [84423] by - py2*-milk: unify - 02:05 Ticket #31403 (nesc @1.3.2 upgrade to 1.3.3) created by - The latest version of NesC is 1.3.3. I tested this version in MacOS 10.5, … - 01:58 Changeset [84422] by - kyototycoon: update to version 0.9.51 - 01:49 Changeset [84421] by - texi2html: license, installs_libs no - 01:48 Changeset [84420] by - yasm: license - 01:48 Changeset [84419] by - py-kombu: update to version 1.4.0 - 01:48 Changeset [84418] by - lame: license - 01:47 Changeset [84417] by - dirac: license - 01:47 Changeset [84416] by - schroedinger: license - 01:46 Changeset [84415] by - speex: license - 01:45 Changeset [84414] by - x264: license - 01:30 Changeset [84413] by - py-pyflakes: update to version 0.5.0 - 00:28 Changeset [84412] by - Eclipse Public License is distributable and GPL-conflicting - 00:11 Changeset [84411] by - ocaml-doc: mark as 'noarch', dont version path; - 00:06 Changeset [84410] by - imapsync: whitespace changes only - 00:03 Changeset [84409] by - wakeonlan: whitespace changes, add more checksums (not only md5) Note: See TracTimeline for information about the timeline view.
https://trac.macports.org/timeline?from=2011-09-30T00%3A32%3A18-0700&precision=second
CC-MAIN-2016-07
refinedweb
5,993
57.4
C++ function call by value The call by value method of passing arguments to a function copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument. By default, C++ uses call by value x into y */ return; } Now, let us call the function swap() by passing actual values as in the following example: #include <iostream> using namespace std; // function declaration void swap(int x, int y); int main () { // local variable declaration: int a = 100; int b = 200; cout << "Before swap, value of a :" << a << endl; cout << "Before swap, value of b :" << b << endl; // calling a function to swap the values. :100 After swap, value of b :200 Which shows that there is no change in the values though they had been changed inside the function.
http://www.tutorialspoint.com/cgi-bin/printversion.cgi?tutorial=cplusplus&file=cpp_function_call_by_value.htm
CC-MAIN-2014-15
refinedweb
146
51.55
Here I’ll go over a bunch more on Python. If you haven’t seen Part 1 of the Python How To Program Tutorial, read it first. In this article I’ll cover functions, exception handling and general file i/o. I’ve read your comments, and yes I will be providing a bunch of Python sample programs and videos. They may already be done actually. Check the right side bar on this site where it says categories, click on Python How to. That will display every Python article. Well on with the article. Python Functions You create functions so that you can encapsulate your code (Make it look neat). Inside a function you can store code that can be easily called from elsewhere in your program. You define functions in Python not by surrounding the code with curly braces {}, like other languages, but instead through indenting. Here is an example function: def bigIterator(): This function is named bigIterator. The braces () that follow the name of the function, is where you would put the names of arguments that are passed to your function. More on that in a minute. Each function definition, also begins with the word def. In Python you then indent (normally 4 spaces) each line that follows the first line of the function. This function doesn’t return a value, but instead just prints a list of numbers from 1 to 200. More can be found on lists in Python How To Part 2. I can call for this function, by just typing bigIterator(), any where else in the program code. Python Function Arguments Here I’ll show you how to create a function that excepts values (arguments) and performs certain calculations on those values. Here is an example: def multiplyTwo(firstNum=1, secondNum=2, *args): If you called the above program with multiplyTwo(1, 2, 3, 4, 5, 6) it would print out the numbers 1 thru six multiplied by 2, on individual lines. If different arguments were passed this function will print out: What is *args, you may ask? When you don’t know how many arguments may be passed you define *args as the last argument for a function. Those values sent beyond what you were expecting, will be saved in a tuple named args. I performed another protective measure here by defining default values for the variables named firstNum and secondNum. I did that by assigning that default with the equals sign (=). If nothing is passed, the default is used. Otherwise the value passed is used. At the end of the function I returned a value to the caller of this function. I’m just forwarding a string with the statement “Everything is Fine”. If I called the function multiplyTwo like this print(multiplyTwo()). The output to the screen would be: 2 4 Everything is Fine That’s pretty much all there is to regular old functions in Python. I’ll cover functions or methods in Object Oriented Python very soon. Python Exceptions Let’s say I didn’t define default values in the function above. What would have happened if I then called multiplyTwo()? I would have received an error message like this: TypeError: multiplyTwo() takes at least 2 positional arguments (0 given) TypeError is the name of the exception that is being raised. The line of text that proceeds the colon, is the error message itself. I could catch this error with an exception handler this way: try: except TypeError as e: else: …rest of the code… The above lines of code will catch the specific error TypeError. The variable e is the error message I defined above. So basically what this does is if the wrond arguments are sent, it prints out the error message to the screen. I could print anything out of course in the print statement however. But, what happens if an error is triggered that I didn’t account for? You can protect against that by just using a blank except like this: except: Now every error will be caught. You can resolve each error differently, by listing multiple except lines for each possible error and then use the blank except: line as a catchall for those you have missed. Raising Exceptions You could also choose to throw your own error messages with the raise command. The raise command excepts the name of the exception followed by the error message you want displayed like this: raise TypeError(‘Enter at least 2 values for multiplyTwo to work’) To finish off this explanation on how to handle errors in Python, I’ll go over the finally option. While it is not needed finally can be used when you definitely want certain code to be executed when the try statement is entered. It works like this: def divideNStuff(x,y): This function protects itself from a ZeroDivisionError. Whether the exception or else statement is ever executed, you can be sure that the finally statement will be executed. That’s All Folks You’ve learned a bunch about Python over the last few articles, but after I go over Object Oriented Programming, Regular Expressions and File I/O, you’ll be ready for more. By more I mean some useful real Python Programs. If you have any questions leave them below. Till Next Time Think Tank
http://www.newthinktank.com/2010/08/python-how-to-functions-exceptions/
CC-MAIN-2020-24
refinedweb
886
71.95
Error - Struts Error Hi, I downloaded the roseindia first struts example... create the url for that action then "Struts Problem Report Struts has detected... ----------------------- RoseIndia.Net Struts 2 Tutorial RoseIndia.net Struts 2 error error The content of element type "struts" must match "(package|include|bean|constant struts2-db connection error - Struts in this file. # Struts Validator Error Messages errors.required={0..."/> </plug-in> </struts-config> validator...;!-- This file contains the default Struts Validator pluggable validator Struts - Struts Struts How to display single validation error message, in stude.... Please visit for more information. Thanks Struts - Struts Struts Hi, I m getting Error when runing struts application. i... /WEB-INF/struts-config.xml 1 ActionServlet *.do but i m getting error ValidatorResources not found in application scope under key "org.apache.commons.validator.VALIDATOR_RESOURCES I get this error when i try the validator framework example.......wat could b the problem struts - Struts the form tag... but it is giving error.. can you please give me solution. First Struts Application - Struts First Struts Application Hello, Hello, I have created a struts simple application by using struts 1.2.9 and Jboss 4.0.4. I am getting... action as unavailable ERROR [[/project1]] Servlet /project1 threw load Struts dispatch action - Struts Struts dispatch action i am using dispatch action. i send the parameter="addUserAction" as querystring.ex: at this time it working fine... now it showing error javax.servlet.ServletException: Request[/View/user] does struts ' struts error : not an sql expression statement error : not an sql expression statement hii I am gettin followin error in connecting to database SQLserver 2005 in Jdeveloper,i m usin struts and jsp my pogram: import java.sql.*; public class TaskBO { public TaskBO loginform giving 404 error , success.jsp, failure.jsp, web.xml, struts-config.xml. when Iam pressing the submit button the give error is populated. HTTP Status 404 - /login.do type java - Database Error - Hibernate Database Error Hi, I am working with Struts 1.2---- AJAX-----Hibernate 3.0 --- MySQL 5.0. At the time of inserting/fetching from Database... your problem. Thanks. Textarea - Struts characters.Can any one? Given examples of struts 2 will show how to validate...;%@ taglib prefix="s" uri="/struts-tags" %><html><head>...;summary1","Brief Summary must be 1 to 250 Charaters");return ERROR... be defined in the Commons Validator configuration when dynamicJavascript="true I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower error!!!!!!!!! error!!!!!!!!! st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
http://roseindia.net/tutorialhelp/comment/87929
CC-MAIN-2014-10
refinedweb
457
53.47
> Further from my own message, attached is a slightly improved > version that expands the macros so that the user doesn't need > to know about them. Third time lucky! Both snippets of code I posted need one little change - the return from fetch-att should be "return (query, '')" rather than simply "return query" (pays to check the code first!). The flaw as it stands, of course, is that whoever receives these atts has to put them back together as they were so that the reply is correctly formatted. I suppose the correct action there is to also change the __cbFetch function, but I'll leave this until I get some confirmation that this is the right sort of thing. =Tony Meyer
http://twistedmatrix.com/pipermail/twisted-python/2003-July/004924.html
CC-MAIN-2017-30
refinedweb
121
72.9
This is a known issue captured and the referenced BZ. Advertising Bottom line is to achieve multi-tenancy using the Kibana version provided by the EFK stack, each user essentially has a 'profile' where there dashboards and visualizations are stored. Their currently is no easy mechanism in the version we provide that would allow you to achieve sharing. On Sun, Sep 18, 2016 at 9:20 PM, Frank Liauw <fr...@vsee.com> wrote: > Hi All, > > I am using Openshift Origin's aggregated logging stack. > > However, my visualizations are not shared amongst users; even via the > direct share link: > > > > Viewers (who are already logged in) get the following error: Could not > locate that visualization (id: response-codes); they have access to the > indices / namespaces on which the visualization was built upon. > > I've experience with vanilla kibanas, and visualizations were shared by > default. > > Thanks! > > Frank > Systems Engineer > > VSee: fr...@vsee.com <> | Cell: +65 9338 0035 > > Join me on VSee for Free <> > > > > > _______________________________________________ > users mailing list > users@lists.openshift.redhat.com > > > -- -- Jeff Cantrill Senior Software Engineer, Red Hat Engineering OpenShift Integration Services Red Hat, Inc. *Office*: 703-748-4420 | 866-546-8970 ext. 8162420 jcant...@redhat.com _______________________________________________ users mailing list users@lists.openshift.redhat.com
https://www.mail-archive.com/users@lists.openshift.redhat.com/msg02464.html
CC-MAIN-2016-40
refinedweb
204
56.15
UART ifinite output - Vladimir Abramov last edited by Vladimir Abramov Hello trying to learn working with UART. According this article i connected TX and RX pins. Form ubuntu open two terminals and open ssh session from both. run cat /dev/ttyS1 in one and echo "test" > /dev/ttyS1 in other. But i see my "test" message only for a moment of time cause my cat continue print empty strings to terminal. what im doing wrong? is some termination symbols should be sent from echo terminal? Also i redirect cat output to text file and found i receive multiple "test" messages. Update: pyserial working as expected. from serial import Serial from time import sleep ser = Serial('/dev/ttyS1', baudrate=115200, timeout=1) while True: data = ser.readline() print(data) sleep(0.5)```.
https://community.onion.io/topic/3057/uart-ifinite-output/
CC-MAIN-2020-29
refinedweb
131
60.31
import "golang.org/x/net/publicsuffix" Package publicsuffix provides a public suffix list based on data from. A public suffix is one under which Internet users can directly register names. var List cookiejar.PublicSuffixList = list{} List implements the cookiejar.PublicSuffixList interface by calling the PublicSuffix function. EffectiveTLDPlusOne returns the effective top level domain plus one more label. For example, the eTLD+1 for "foo.bar.golang.org" is "golang.org". PublicSuffix returns the public suffix of the domain using a copy of the publicsuffix.org database compiled into the library. icann is whether the public suffix is managed by the Internet Corporation for Assigned Names and Numbers. If not, the public suffix is privately managed. For example, foo.org and foo.co.uk are ICANN domains, foo.dyndns.org and foo.blogspot.co.uk are private domains. Use cases for distinguishing ICANN domains like foo.com from private domains like foo.appspot.com can be found at Package publicsuffix imports 3 packages (graph) and is imported by 226 packages. Updated 2018-06-11. Refresh now. Tools for package owners.
https://godoc.org/golang.org/x/net/publicsuffix
CC-MAIN-2018-26
refinedweb
179
55.61
ALTQ(9) BSD Kernel Manual ALTQ(9) ALTQ - kernel interfaces for manipulating output queues on network inter- faces #include <sys/types.h> #include <sys/socket.h> #include <net/if.h> void IFQ_ENQUEUE(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pa, int err); void IFQ_DEQUEUE(struct ifaltq *ifq, struct mbuf *m); void IFQ_POLL(struct ifaltq *ifq, struct mbuf *m); void IFQ_PURGE(struct ifaltq *ifq); void IFQ_CLASSIFY(struct ifaltq *ifq, struct mbuf *m, int af, struct altq_pktattr *pktattr); void IFQ_IS_EMPTY(struct ifaltq *ifq); void IFQ_SET_MAXLEN(struct ifaltq *ifq, int len); void IFQ_INC_LEN(struct ifaltq *ifq); void IFQ_DEC_LEN(struct ifaltq *ifq); void IFQ_INC_DROPS(struct ifaltq *ifq); void IFQ_SET_READY(struct ifaltq *ifq);() enqueues a packet m to the queue ifq. The underlying queu- ing discipline may discard the packet. err is set to 0 on success, or ENOBUFS if the packet is discarded. m will be freed by the device driver on success or by the queuing discipline on failure, so the caller should not touch m after calling IFQ_ENQUEUE().() returns the next packet without removing it from the queue. It is guaranteed by the underlying queuing discipline that IFQ_DEQUEUE() im- mediately after IFQ_POLL() returns the same packet. IFQ_PURGE() discards all the packets in the queue. The purge operation is needed since a non-work conserving queue cannot be emptied by a dequeue loop. IFQ_CLASSIFY() classifies a packet to a scheduling class, and returns the result in pktattr. IFQ_IS_EMPTY() can be used to check if the queue is empty. Note that IFQ_DEQUEUE() could still return NULL if the queuing discipline is non- work conserving. IFQ_SET_MAXLEN() sets the queue length limit to the default FIFO queue. IFQ_INC_LEN() and IFQ_DEC_LEN() increment or decrement the current queue length in packets. IFQ_INC_DROPS() increments the drop counter and is equal to IF_DROP(). It is defined for naming consistency. IFQ_SET_READY() sets a flag to indicate this driver is converted to use the new macros. ALTQ can be enabled only on interfaces with this flag. In order to keep compatibility with the existing code, the new output queue structure ifaltq has the same fields. The traditional IF_XXX() mac- ros and the code directly referencing the fields within if_snd still work with ifaltq. (Once we finish conversions of all the drivers, we no longer need these fields.) #; }; | /* altq related fields */ | ...... | }; | The new structure replaces struct ifqueue in struct ifnet. ##old-style## ##new-style## | struct ifnet { | struct ifnet { .... | .... | struct ifqueue if_snd; | struct ifaltq if_snd; | .... | .... }; | }; | The (simplified) new IFQ_XXX() macros looks like: #ifdef ALTQ #define IFQ_DEQUEUE(ifq, m) \ if (ALTQ_IS_ENABLED((ifq)) \ ALTQ_DEQUEUE((ifq), (m)); \ else \ IF_DEQUEUE((ifq), (m)); #else #define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m)); #endif The semantics of the enqueue operation are changed. In the new style, en- queue and packet drop are combined since they cannot be easily separated in many queuing disciplines. The new enqueue operation corresponds to the following macro that is written with the old macros. #define IFQ_ENQUEUE(ifq, m, pattr, err) \ do { \ if (ALTQ_IS_ENABLED((ifq))) \ ALTQ_ENQUEUE((ifq), (m), (pattr), (err)); \ else { \ if (IF_QFULL((ifq))) { \ m_freem((m)); \ (err) = ENOBUFS; \ } else { \ IF_ENQUEUE((ifq), (m)); \ (err) = 0; \ } \ } \ if ((err)) \ (ifq)->ifq_drops++; \ } while (0) IFQ_ENQUEUE() does the following: - queue a packet - drop (and free) a packet if the enqueue operation fails If the enqueue operation fails, err is set to ENOBUFS. m is freed by the queuing discipline. The caller should not touch m after calling IFQ_ENQUEUE(), so the caller may need to copy the m_pkthdr.len or m_flags fields beforehand for statistics. The caller should not use senderr() since m, | NULL,); } | } | The classifier mechanism is currently implemented in if_output(). struct altq_pktattr is used to store the classifier result, and it is passed to the enqueue function. (We will change the method to tag the classifier result to mbuf in the future.) int ether_output(ifp, m0, dst, rt0) { ...... struct altq_pktattr pktattr; ...... /* classify the packet before prepending link-headers */ IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr); /* prepend link-level headers */ ...... IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); ...... } First, make sure the corresponding if_output() is already converted to the new style. Look for if_snd in the driver. You will probably need to make changes to the lines that include if_snd. If the code checks ifq_head to see whether the queue is empty or not, use IFQ_IS_EMPTY(). ##old-style## ##new-style## | if (ifp->if_snd.ifq_head != NULL) | if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) | Note that IFQ_POLL() can be used for the same purpose, but IFQ_POLL() could be costly for a complex scheduling algorithm since IFQ_POLL() needs to run the scheduling algorithm to select the next packet. On the other hand, IFQ_IS_EMPTY() checks only if there is any packet stored in the queue. Another difference is that even when IFQ_IS_EMPTY() is FALSE, IFQ_DEQUEUE() could still return NULL if the queue is under rate- limiting.. If the code polls the packet at the head of the queue and actually uses the packet before dequeuing it, use IFQ_POLL() and IFQ_DEQUEUE(). ##old-style## ##new-style## | m = ifp->if_snd.ifq_head; | IFQ_POLL(&ifp->if_snd, m); if (m != NULL) { | if (m != NULL) { | /* use m to get resources */ | /* use m to get resources */ if (something goes wrong) | if (something goes wrong) return; | return; | IF_DEQUEUE(&ifp->if_snd, m); | IFQ_DEQUEUE(&ifp->if_snd, m); | /* kick the hardware */ | /* kick the hardware */ } | } | It is guaranteed that IFQ_DEQUEUE() immediately after IFQ_POLL() returns the same packet. Note that they need to be guarded by splimp() if called from outside of if_start(). If the code uses IF_PREPEND(), you have to eliminate it since the prepend operation is not possible for many queuing disciplines. A common use of IF_PREPEND() is to cancel the previous dequeue operation. You have to convert the logic into poll-and-dequeue. ##old-style## ##new-style## | IF_DEQUEUE(&ifp->if_snd, m); | IFQ_POLL(&ifp->if_snd, m); if (m != NULL) { | if (m != NULL) { | if (something_goes_wrong) { | if (something_goes_wrong) { IF_PREPEND(&ifp->if_snd, m); | return; | return; } | } | | /* at this point, the driver | * is committed to send this | * packet. | */ | IFQ_DEQUEUE(&ifp->if_snd, m); | /* kick the hardware */ | /* kick the hardware */ } | } |); | } | | Use IFQ_SET_MAXLEN() to set ifq_maxlen to len. Add IFQ_SET_READY() to show this driver is converted to the new style. (This is used to distin- guish new-style drivers.) ##old-style## ##new-style## | ifp->if_snd.ifq_maxlen = qsize; | IFQ_SET_MAXLEN(&ifp->if_snd, qsize); | IFQ_SET_READY(&ifp->if_snd); if_attach(ifp); | if_attach(ifp); |); | Some drivers instruct the hardware to invoke transmission complete inter- rupts only when it thinks necessary. Rate-limiting breaks its assumption. Some (pseudo) devices (such as slip) have another ifqueue to prioritize packets. It is possible to eliminate the second queue since ALTQ provides more flexible mechanisms but the following shows how to keep the original behavior. struct sl_softc { struct ifnet sc_if; /* network-visible interface */ ... struct ifqueue sc_fastq; /* interactive output queue */ ... }; The driver doesn't compile in the new model since it has the following line (if_snd is no longer a type of struct ifqueue). struct ifqueue *ifq = &ifp->if_snd; A simple way is to use the original IF_XXX() macros for sc_fastq and use the new IFQ_XXX() macros for if_snd. The enqueue operation looks like: ##old-style## ##new-style## | struct ifqueue *ifq = &ifp->if_snd; | struct ifqueue *ifq = NULL; | if (ip->ip_tos & IPTOS_LOWDELAY) | if ((ip->ip_tos & IPTOS_LOWDELAY) && ifq = &sc->sc_fastq; | !ALTQ_IS_ENABLED(&sc->sc_if.if_snd)) { | ifq = &sc->sc_fastq; if (IF_QFULL(ifq)) { | if (IF_QFULL(ifq)) { IF_DROP(ifq); | IF_DROP(ifq); m_freem(m); | m_freem(m); splx(s); | error = ENOBUFS; sc->sc_if.if_oerrors++; | } else { return (ENOBUFS); | IF_ENQUEUE(ifq, m); } | error = 0; IF_ENQUEUE(ifq, m); | } | } else | IFQ_ENQUEUE(&sc->sc_if.if_snd, | NULL, m, error); | | if (error) { | splx(s); | sc->sc_if.if_oerrors++; | return (error); | } if ((sc->sc_oqlen = | if ((sc->sc_oqlen = sc->sc_ttyp->t_outq.c_cc) == 0) | sc->sc_ttyp->t_outq.c_cc) == 0) slstart(sc->sc_ttyp); | slstart(sc->sc_ttyp); splx(s); | splx(s); | The dequeue operations looks like: ##old-style## ##new-style## | s = splimp(); | s = splimp(); IF_DEQUEUE(&sc->sc_fastq, m); | IF_DEQUEUE(&sc->sc_fastq, m); if (m == NULL) | if (m == NULL) IF_DEQUEUE(&sc->sc_if.if_snd, m); | IFQ_DEQUEUE(&sc->sc_if.if_snd, m); splx(s); | splx(s); | Queuing disciplines need to maintain ifq_len (used by IFQ_IS_EMPTY()). Queuing disciplines also need to guarantee the same mbuf is returned if IFQ_DEQUEUE() is called immediately after IFQ_POLL(). pf.conf(5), pfctl(8) The ALTQ system first appeared in March 1997. MirOS BSD #10-current July 10, 2001.
http://www.mirbsd.org/htman/i386/man9/altq.htm
CC-MAIN-2015-14
refinedweb
1,348
57.16
>We're being clever and returning from IO not a Char, but a MyMonad Char >(mimp). Then, we run that, which either produces the answer we wanted, >or throws an error in MyMonad. Thanks. That did the trick! :-) Regards > >However, it's still rather cumbersome, so here's a function similar to >liftError that works for your monad. > > -- I'll assume you have such a function > fromIOError :: IOError -> MyErrorType > > -- The name is intended to convey that IO errors are caught and > -- reintroduced into MyMonad. Better suggestions welcome. > liftIOTrap :: IO a -> MyMonad a > liftIOTrap io = do mx <- liftIO (do x <- io > return (return x) > `catchError` > (\e -> return (throwError > (fromIOError e)))) > mx > > foo :: MyMonad a > foo = do > inp <- liftIOTrap (getChar > `catchError` > (\e -> if isEOFError e then return >'\0' > else throwError >e)) > ... > >Andrew > >[1] > _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE!
http://www.haskell.org/pipermail/haskell-cafe/2005-July/010894.html
CC-MAIN-2014-41
refinedweb
143
55.95
C++ program to add two complex numbers. C++ programming code #include <iostream> using namespace std; class complex { public : int real, img; }; int main() { complex a, b, c; cout << "Enter a and b where a + ib is the first complex number."; cout << "\na = "; cin >> a.real; cout << "b = "; cin >> a.img; cout << "Enter c and d where c + id is the second complex number."; cout << "\nc = "; cin >> b.real; cout << "d = "; cin >> b.img; c.real = a.real + b.real; c.img = a.img + b.img; if ( c.img >= 0 ) cout << "Sum of two complex numbers = " << c.real << " + " << c.img << "i"; else cout << "Sum of two complex numbers = " << c.real << " " << c.img << "i"; return 0; }
https://www.evidhya.com/subjects/cplusplus/program-to-add-two-complex-numbers
CC-MAIN-2021-31
refinedweb
114
87.72
Introduction: -. Namespaces A namespace contains types that you can use in your program. These types are: classes, structures, enumerations, delegates, and interfaces. Here is a list of most of the namespaces found in .NET Framework 4.5.: “If you specify that a method is an async method by using an Async or async modifier, you enable the following two capabilities: - “The marked async method can use Await or await to designate suspension points. The await operator tells the compiler that the async method can’t continue past that point until the awaited asynchronous process is complete. In the meantime, control returns to the caller of the async method. - “The suspension of an async method at an await expression doesn’t constitute an exit from the method, and finally blocks don’t run. “The marked async method can itself be awaited by methods that call it. “An async method typically contains one or more occurrences of an await operator, but the absence of await expressions doesn’t cause a compiler error. If an async method doesn’t use an await operator to mark a suspension point, the method executes as a synchronous method does, despite the async modifier. The compiler issues a warning for such methods.” For more information regarding Async and Await, have a read through an earlier article of mine: Async Programming. 2. String.Split You can use Split to break a string apart and make many other little strings from it. How does this happen? Well, all you need to have is a delimiter. If you look at normal written language: We use a space as a separator between words so that we know which word starts where. In this case, 'Show Nicely Formatted Date MessageBox.Show("Today is : " & _ dtToday.ToString("mmm-dd-yyyy")) 'Show Tomorrow's Date Formatted The Same Way MessageBox.Show("Tomorrow is : " & _ dtTomorrow.ToString("mmm-dd-yyyy"))”.Excel.ApplicationCurCurText) Through the years, access to the Clipboard object has become easier and easier. Here is a small example on using the Clipboard to copy, cut, and paste information to and from textboxes: Private Sub btnClipCopy_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnClipCopy.Click If txtSource.Text <> "" Then If txtSource.SelectionLength > 0 Then strSelectedText = txtSource.SelectedText = "" End If End If End Sub Private Sub btnClipPaste_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnClipPaste.Click Dim ClipText As String 'store text from clipboard Dim OldText As String 'previous text in textbox OldText = txtDest.Text 'store previous!
https://www.codeguru.com/visual-basic/ten-basic-framework-functions-every-vb-developer-should-know/
CC-MAIN-2021-43
refinedweb
422
59.5
interesting and low-effort way to make CompCert more aggressive. Consider these functions: int foo (int x, int y) { return (x==y) || (x>y); }int bar (int x) { return (x>3) && (x>10); } Clearly foo() can be simplified to return “x≥y” and bar() can be simplified to return “x>10.” A random version of GCC emits: _foo: xorl %eax, %eax cmpl %esi, %edi setge %al ret _bar: xorl %eax, %eax cmpl $10, %edi setg %al ret Any aggressive compiler will produce similar output. In contrast, CompCert 1.8.1 does not perform these optimizations. Its output is bulky enough that I won’t give it here. Collectively, the class of missing optimizations that I’m talking about is called peephole optimizations: transformations that operate on a very limited scope and generally remove a redundancy. Opportunities for peephole optimizations can be found even in cleanly written code since inlined functions and results of macro expansions commonly contain redundancies. An aggressive compiler contains literally hundreds of peephole optimizations, and reproducing most of them in CompCert would be time consuming, not to mention unspeakably boring. Fortunately, there’s a better way: most of these optimizations can be automatically derived. The basic idea is from Henry Massalin who developed a superoptimizer in 1987; it was significantly improved about 20 years later by Bansal and Aiken. This piece is about how to create a superoptimizer that proves its transformations are sound. The idea is simple: at a suitable intermediate compilation stage — preferably after the regular optimization passes and before any kind of backend transformation — find all subgraphs of the program dependency graph up to a configurable size. For each subgraph G, enumerate all possible graphs of the CompCert IR up to some (probably smaller) configurable size. For each such graph H, if G and H are equivalent and if H is smaller than G, then replace G with H. Subgraph equivalence can be checked by encoding the problem as an SMT instance and sending the query to some existing solver. The proof of equivalence needed to make CompCert work comes “for free” because there exist SMT solvers that emit proof witnesses. (SMTCoq is an example of a tool that generates Coq proofs from SMT output.) Repeat until a fixpoint is reached — the program being compiled contains no subgraphs that can be replaced. As an example, the IR for foo() above would contain this code: t1 = x==y; t2 = x>y; t3 = t1 || t2; When attempting to optimize this subgraph, the superoptimizer would eventually test for equivalence with: t3 = x>=y; Since t1 and t2 are not subsequently used, a match would be found and the peephole optimization would fire, resulting in smaller and faster code. Of course, the superoptimizer that I have sketched is extremely slow. The Bansal and Aiken paper shows how to make the technique fast enough to be practical. All of their tricks should apply here. Very briefly, the speedups include: - Testing many harvested sequences at once - Reducing the search space using aggressive canonicalization - Avoiding most SMT calls by first running some simple equivalence tests - Remembering successful transformations in a database that supports fast lookup The Bansal and Aiken superoptimizer operated on sequences of x86 instructions. Although this had the advantage of permitting the tool to take advantage of x86-specific tricks, it also had a couple of serious disadvantages. First, a short linear sequence of x86 instructions harvested from an executable does not necessarily encode an interesting unit of computation. In contrast, if we harvest subgraphs from the PDG, we are guaranteed to get code that is semantically connected. Second, the Stanford superoptimizer has no ability to see “volatile” memory references that must not be touched — it will consequently break codes that use multiple threads, UNIX signals, hardware interrupts, or hardware device registers. The technique outlined in this piece is what I call a weak superoptimizer: it finds short equivalent code sequences using brute force enumeration. A strong superoptimizer, on the other hand, would pose the following queries for each harvested subgraph G: - Does there exist a subgraph of size 0 that is equivalent to G? If not… - Does there exist a subgraph of size 1 that is equivalent to G? If not… - Etc. Clearly this leans much more heavily on the solver. It is the approach used in the Denali superoptimizer. Unfortunately, no convincing results about the workability of that approach were ever published (as far as I know), whereas the weak approach appears to be eminently practical. In summary, this post contains what I think are two relatively exploitable ideas. First, a peephole superoptimizer should be based on subgraphs of the PDG rather than linear sequences of instructions. Second, proof-producing SMT should provide a relatively easy path to verified peephole superoptimization. If successful, the result should be a significant improvement in the quality of CompCert’s generated code. Update from 3/29: A random thing I forgot to include in this post is that it would be easy and useful to teach this kind of superoptimizer to take advantage of (nearly) arbitrary dataflow facts. For example, “x /= 16” (where x is signed) is not equivalent to x >>= 4. However, this equivalence does hold if x can be proved to be non-negative using a standard interval analysis. Encoding a fact like “x ≥ 0” in the input to the SMT solver is trivial. The nice thing about dataflow facts is that they give the superoptimizer non-local information. I should also add that when I said “if H is smaller than G, then replace G with H” of course I really mean “cheaper” rather than “smaller” where the cost of a subgraph is determined using some heuristic or machine model. Even after adding a nice IR-level superoptimizer to CompCert, a backend superoptimizer just like Bansal and Aiken’s is still desirable: it can find target-dependent tricks and it can also get rid of low-level grunge such as the unnecessary register-register moves that every compiler’s output seems to contain. The main fix to their work that is needed is a way to prevent it from removing or reordering volatile memory references; this should be straightforward. Getting a Coq term that encodes the correctness of the transformation is more of a “certifying compilation” technique. CompCert is initially a certified compiler (verified in Coq once and for all with no proofs being manipulated at compile-time). I do not know how hard it would be to mix the two approaches. Hi Pascal, CompCert already uses translation validation, for example in the register allocator, so I believe something like what I outlined here would not be too hard to fit in. John, The first sentence you wrote “CompCert is a C compiler that is provably correct.” is not true. What you should have said is something like: “CompCert is a compiler some of whose components have been proved to mimic the behavior of some specification.” Hi Derek, I hear you, but I think you have to admit that as the lead for a blog post, your version sucks :). A few days ago, at CGO, Xavier Leroy talked about software pipelining in CompCert. Instead of proving the transformation, the proposed system checks for certain equivalences between optimized and unoptimized code. I believe they don’t even need the fully power of SMT (SMTCoq is yet unfinished) – a simpler procedure seems capable of proving all needed equivalences. So indeed, translation validation is probably the way to go for certain optimizations that maintain complex invariants. The superoptimizer approach takes this further by essentially running an exhaustive search within a state space. I fear it might be slow… David, thanks for the note. I’d love to see Xavier’s talk, but doesn’t look like it’s online yet. The Stanford superoptimizer did all the heavy lifting offline, so it should be possible to do the same thing here. My guess is that verified compilation fundamentally changes the equilibrium point between search-based techniques and traditional by-hand optimizations.
https://blog.regehr.org/archives/496
CC-MAIN-2020-34
refinedweb
1,340
50.77
Code. Collaborate. Organize. No Limits. Try it Today. This article discusses how to extend ADO.NET TableAdapter functionality in Visual Basic .NET. TableAdapters were introduced in ADO.NET 2.0. Basically, a TableAdapter lets you connect to a database, run queries or stored procedures, return a new table or fill existing DataTables. At the end, it allows you to send updated data from your application back to the database. All of this happens with a minimal amount of fuss and bother! TableAdapter TableAdapters are created inside strongly typed DataSets using the Dataset Designer. There are a couple of ways to create TableAdapters in Visual Studio. Probably the easiest is to build both the DataSet and the TableAdapter(s) as by-products of adding a Data Source to your project. In the Data Source window, just click the link "Add New Data Source..." or click the toolbar button for this purpose. This will invoke the Data Source Configuration Wizard and, after answering a few short questions such as which database, which objects, etc., Visual Studio will add not only a new Data Source, but also a new DataSet with one or more TableAdapter objects inside. You can double-click the XSD file in Solution Explorer to get a "picture" of these objects. Here's the one used in this article's example: Figure 1 As you can see, we are using the good old NorthWind database. For the record, Orders is the ADO.NET DataTable and of course the TableAdapter is OrderTableAdapter. Another way to create a TableAdapter is to use the TableAdapter Configuration Wizard. Simply open an existing DataSet in the DataSet Designer. Drag a TableAdapter from the DataSet tab of the Toolbox onto the design surface. This opens up the TableAdapter Configuration Wizard. Again, simply answer the prompts of the wizard and it will dutifully add a new TableAdapter and DataTable to the DataSet. Note that once it is created, the auto-generated DataSet will appear in Solution Explorer as an XSD file. See the Figure below. TableAdapter DataSet DataTable Figure 2 At this point, you could build a form and put that TableAdapter to good use. Just drag and drop the table or columns from the Data Sources window onto a form's design view. As you drop the table onto your form, this is what you might see appear in the form's component tray: Left to right, these components are: the strongly typed DataSet, a Binding Source, the TableAdapter and a Binding Navigator, which is a visual component that provides toolbar buttons for row navigation and for adding, removing and saving rows in the DataTable. Note that you can add more queries to your TableAdapter beyond the one that the Wizard gives you. Just right click on TableAdapter in the component tray and choose to Edit queries in DataSet Designer. When the designer opens up, you'll see the box representing your TableAdapter. Right click it and select Add Query DataSet Each query will have its own generated Fill method. Typically, additional queries are "parameter-driven" and your code is responsible for passing the appropriate parameter value(s) when you call the TableAdapter's Fill method. For example, suppose your query is against an Employee table and selects based on a range of Last Names. Your SELECT statement, stored in CommandCollection, might be: Fill CommandCollection SELECT * FROM dbo.EMPLOYEES WHERE LASTNAME > @LNAME1 AND LASTNAME < @LNAME2 Your call to the TableAdapter's Fill method might look like this: Me.EmployeesTableAdapter.Fill(Me.HRDBDataSet.Employees,_ "AAAAA","HHHHH") This technique works well as long as your query in the TableAdapter is always the same. You simply add parameters to the select statement when you configure the TableAdapter in the DataSet Designer and you're ready to rock-and-roll. Be sure to use named parameters beginning with @ for the SQL Server data provider. The generated Fill and GetData methods in the TableAdapter will use these parameters and you will be able to pass values on the method calls from your code. Of course, this technique often leads to adding "yet another query" to the TableAdapter. In short, it isn't terribly "dynamic." So, if you want to have more control over your TableAdapter and avoid adding 100 queries to it, you have to hack it a little. Fill GetData Looking again at the DataSet in DataSet Designer, we see that even a very simple TableAdapter incorporates several objects as well as a couple of standard methods like Fill and GetData GetData Figure 3 Each TableAdapter encapsulates the following objects: All of these objects are more-or-less built-in and private. However, these generated objects and methods can be used to fetch data -- even update data -- from the database. At this point, you may well ask yourself: OK. Where have they hidden the code? To dig into the bowels of TableAdapter, have a look at the VB file for the DataSet Designer. In the figures above, this would be NorthWindDBDataSet.Designer.VB. By examining the internals of TableAdapter, you will find: DataAdapter CommandCollection Command The problem with what we've seen of TableAdapter so far is that all this configuration and the resulting code generation is strictly a design-time activity. What if you want to construct your SELECT query at run-time, based upon certain criteria entered by the user on your form? Is there a way to do this and then pass the dynamic SQL to TableAdapter? The short answer is, "No." That is, unless you're willing to hack the auto-generated code in the DataSet Designer VB file. Take a look at the generated Fill method below. You'll see that DataAdapter's SelectCommand gets set to the first occurrence in CommandCollection: DataAdapter SelectCommand Public Overridable Overloads Function Fill(ByVal dataTable As _ NorthWindDBDataSet.OrdersDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = True) Then dataTable.Clear() End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function Clearly, if we want to change DataAdapter's select command on the fly, we have to gain access to CommandCollection. Unfortunately, CommandCollection is a Protected ReadOnly property with a private field behind it. The good news, however, is that the TableAdapter itself is implemented as a Partial Public Class that inherits from System.ComponentModel.System. Partial Public Class System.ComponentModel.System A "partial class" means that you can add your own code to the class in a separate file and just "extend" its functionality. A partial class lets you split the definition of a class -- its properties, methods, etc. -- over two or more source files. Thus, you can add your own class file and put your hack in this file. As mentioned before, our examples are all using the Orders Table from the NorthWind database. So begin by adding a simple TableAdapter to a Windows form. Do this by dragging the entire Orders table from the Data Sources window onto the form's design surface. The wizard automatically adds the components, including the TableAdapter, to the component tray as well as a Data Grid View control to the form. Now make room at the top of the form by moving the grid down a bit. At the top of the form add a couple of text boxes, one labeled Customer ID Like: and the other labeled Ship Country Like:. Give the text boxes appropriate names such as uxCustID and uxShipCntry. Finally, again at the top of the form, add a Button control and change its Text Property to the word Fill. The top of the form above the grid should look something like what's shown in Figure 4. uxCustID uxShipCntry Figure 4 Now we can add our hack. From Solution Explorer, begin by opening up the file NorthWindDBDataSet.Designer.vb. In the code, find the namespace statement for the TableAdapter. This might require a few clicks of the Find Next button. The namespace naming convention is simply: DataSetName + TableAdapter. Since I called my DataSet "NorthWindDBDataSet," my namespace is: Namespace NorthWindDBDataSetTableAdapter Copy and paste this namespace statement or, if you're old-fashioned like me, copy the name down on a Post-it sticky. Next, find the declaration for the TableAdapter class. It will be named using the naming convention: Object + TableAdapter. So in our example, the TableAdapter class would be named OrdersTableAdapter. Now, add a new Class file to your Project! In the class file, add a namespace statement with a name that is identical to that used in the auto-generated DataSet. Next, change the class declaration so it exactly matches that of the TableAdapter class in NorthWindDBDataSet.Designer.vb. In other words: Option Strict Off Option Explicit On Imports System Namespace NorthwindDBDataSetTableAdapters Partial Public Class OrdersTableAdapter Inherits System.ComponentModel.Component End Class End Namespace Now we can hack the code in the class adding to our own file. Let's add a new property called SelectCommand. Make it a public read/write property that controls an array of SqlClient.SqlCommands. The property code is pretty simple. It just lets us get at CommandCollection with a Getter and a Setter as shown below: SelectCommand SqlClient.SqlCommand Public Property SelectCommand() As SqlClient.SqlCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection() End If Return Me._commandCollection End Get Set(ByVal value As SqlClient.SqlCommand()) Me._commandCollection = value End Set End Property The Set property procedure here means that code calling TableAdapter can pass in a properly formed SELECT command and get at the same private field used by the auto-generated TableAdapter – Me._commandCollection. Now we need a new Fill method. Let's call it FillByWhere. This method is modeled after the standard Fill method, but has a signature that lets us pass in a WHERE condition. For example: Me._commandCollection FillByWhere WHERE Public Function FillByWhere(ByVal dataTable As _ NorthWindDBDataSet.OrdersDataTable, ByVal WhereExp As String) _ As Integer Dim stSelect As String stSelect = Me._commandCollection(0).CommandText Try Me._commandCollection(0).CommandText += " WHERE " + WhereExp Return Me.Fill(dataTable) Catch ex As Exception Finally Me._commandCollection(0).CommandText = stSelect End Try End Function To complete the picture, simply write the necessary code behind the form's Fill button. See the code snippet sample below. You can start by moving the auto-generated code that calls the Fill method out of the form's Load event and into the Fill button Click event. In the button's Click event, you will write code to accomplish the following: Click WHERE See the sample button Click event code below. Click Private Sub btnFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFill.Click Dim stCustID As String = Trim(uxCustID.Text) Dim stShipCntry As String = Trim(uxShipCntry.Text) ' Pass in a SELECT with no WHERE that conforms to the the DataTAble ' used by the TableAdapter's DataSet Me.OrdersTableAdapter.SelectCommand(0).CommandText = _ "SELECT * FROM Orders" ' Build a string containing WHERE criteria (without the WHERE) Dim stWhere As String = "" If stCustID <> "" Then stWhere = "CustomerID LIKE '" + stCustID + "%' AND " End If If stShipCntry <> "" Then stWhere = "ShipCountry LIKE '" + stShipCntry + "%' " Else stWhere = Replace(stWhere, " AND ", "") End If If stWhere = "" Then Me.OrdersTableAdapter.Fill(Me.NorthwindDBDataSet.Orders) Else Me.OrdersTableAdapter.FillByWhere( _ Me.NorthwindDBDataSet.Orders, stWhere) End If End Sub That's about it, Ladies and Gentlemen! This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) /// <summary> /// Get a reference to the SqlCommand associated with FillByCustomSelect so the select commmand can be updated with the custom Select query /// </summary> /// <value>The customSelectSqlCommand.</value> public SqlCommand CustomSelectSqlCommand { get {")) return sqlCommand; } return null; } } dataAdapterFill.CustomSelectSqlCommand.CommandText = "SELECT TOP 1 * FROM ItemMaster WHERE IMITM > 6"; dataAdapterFill.FillByCustomSelect(dataSet.JDEF4101); /// <summary> /// Used with FillByCustomSelectSqlCommand property. Get a reference to the SqlCommand associated with FillByCustomSelect so the select commmand can be updated with the custom Select query /// </summary> private SqlCommand _fillByCustomSelectSqlCommand; /// <summary> /// Get a reference to the SqlCommand associated with FillByCustomSelect so the select commmand can be updated with the custom Select query /// </summary> /// <value>The fillByCustomSelect SqlCommand.</value> public SqlCommand FillByCustomSelectSqlCommand { get { if (_fillByCustomSelectSqlCommand == null) {")) { _fillByCustomSelectSqlCommand = sqlCommand; break; } } } return _fillByCustomSelectSqlCommand; } } General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
http://www.codeproject.com/Articles/17324/Extending-TableAdapters-for-Dynamic-SQL?fid=379264&df=90&mpp=10&sort=Position&spc=Relaxed&select=3910063&tid=4004684
CC-MAIN-2014-23
refinedweb
2,051
56.55
I have data streaming in the following format: from StringIO import StringIO data ="""\ ANI/IP sip:[email protected] sip:[email protected] sip:[email protected] """ import pandas as pd df = pd.read_table(StringIO(data),sep='\s+',dtype='str') What I would like to do is replace the column content with just the phone number part of the string above. I tried the suggestions from this thread like so: df['ANI/IP'] = df['ANI/IP'].str.replace(r'\d{10}', '').astype('str') print(df) However, this results in: .....print(df) ANI/IP 0 sip:@10.94.2.15 1 sip:@10.66.7.34 2 sip:@10.94.2.11 I need the phone numbers, so how do I achieve this? : ANI/IP 0 5554447777 1 6665554444 2 3337775555
http://www.howtobuildsoftware.com/index.php/how-do/4rB/python-regex-pandas-replacing-pandas-column-with-a-subset-of-itself-through-regex
CC-MAIN-2019-13
refinedweb
127
69.79
template tricks Testing template rendering Test the rendering of a template.py template def renderTemplate(templatename,*args,**kw): '''quick way to test a template.py template''' import template if not "." in templatename: templatename = templatename + ".tmpl" obj = template.Template(open(templatename).read()) return obj(*args,**kw) print renderTemplate("homepage", now=time.ctime()) If your template takes a dict or a storage, then you can just set global values and let those get passed in: username = "User" lastvisit = "yesterday" print renderTemplate("results", store=web.Storage(globals())) Using the Prototype Javascript library If you are using a Javascript library, such as Prototype, that binds $ so that it can provide shorthand Javascript functions like $, $A, $F and $H, then you'll need to do a few things to make it work: Provide additional keyword args, as shown below, in your template function declaration, so that when template.py can pass-through the Prototype dollar-sign syntax. $def with (arg1, arg2, ELT="$", F="$F", H="$H", A="$A") Note that since $ is special, we are providing $ELTas a replacement Javascript function name. Leave a space after your usage of $ELTet al. so that template.py will not try to funcall it when it sees the parentheses. var cmd = $F ('command'); $ELT ('result').value = originalRequest.responseText; Javascript is fine with the space between the function name and arguments, and if you forget the space, you'll get this error from template.py: 'str' object is not callable Alternatively if you're only using the $ functions a few times, you can just add a $; before the $ and the templator will render it correctly: myElement = $$('elementID');
http://webpy.org/template_tricks
CC-MAIN-2014-15
refinedweb
268
56.45
Hola Amigo, I presume you are already familiar with the Actor Model i.e why you are looking for the lifecycle of an actor. So, let’s dive deeper into the Akka Actor Lifecycle. So, what happens when we create an actor and when it stops? The lifecycle of an actor starts automatically after its creation(instantiation). A started actor can right away start processing messages. So, here’s what basic Akka actor lifecycle looks like: Akka provides us with some hooks which we can override to specify a set instruction that should be executed before or after an actor reaches a particular state. For instance, we can override the preStart() hook to do any work/initialization before an actor starts serving. And postStop() execute after the actor is being stopped to release any acquired resources. An actor can stop itself and by any other actor as well. After an actor reaches a terminated state, it now becomes available for garbage collection. In Scala, to start an actor, we create an actor system and then instantiate an actor. val system = ActorSystem("name_of_system") val actor = system.actorOf(Props[ActorClass]) There are several ways to stop an actor. context.stop(self) // to stop itself or system.stop(actorRef) // actor system will stop the specified actor or context.stop(actorRef) // to stop any other actor from current actor or actorRef ! PoisonPill // get into the mailbox at the end or actorRef ! Kill // get into the mailbox at the end Now, what we need to know is when an actor stops, its child actors also forcefully stops before the parent. Stopping an actor is an asynchronous and recursive task. An actor finishes processing the current message, if any and wait for its child actor confirmation before its termination. PoisonPill and Kill messages These messages are treated as normal messages. The actor stops itself when it processes them. PoisonPill internally calls “context.stop(self())” whereas Kill throws an ActorKilledException. Both of these messages allow an actor to process all the messages which were already there in the mailbox. What if we want to notify an actor about the termination of others? Akka provides us with a mechanism called DeathWatch. An actor can watch another actor and get notified of its termination. Here’s how we do that, context.watch(actorRef) the current actor will watch for the specified actor’s termination. But we need to handle a message called Termination(value) so that we can check which actor died if the actor was watching multiple actors. If we don’t handle this message then we could get DeathPactException. Note: An actor cannot monitor its own death, so never do context.watch(self) // does not makes sense. What happens to the lifecycle when an actor fails? So, when some failure occurs, some other hooks come into picture, such as preRestart() and postRestart(). Here’s the full lifecycle of an actor: These hooks, preRestart() and postRestart() are called whenever an actor is restarted by its supervisor upon failure. This is how we can define these hooks: def preStart(): Unit = () def postStop(): Unit = () def preRestart(reason: Throwable, @unused message: Option[Any]): Unit = { context.children.foreach { child => context.unwatch(child) context.stop(child) } postStop() } def postRestart(@unused reason: Throwable): Unit = { preStart() } Thank you for scrolling. See you next time.
https://blog.knoldus.com/the-lifecycle-of-an-actor-in-akka/
CC-MAIN-2021-04
refinedweb
549
59.09
A while back when I first started with my company, the domain had already been set up using a "xxx.net" DNS name for the internal AD namespace. The shortname is just fine and I feel no need to change it but I have always hated how we used an internet DNS name for our internal AD. We are planning an AD upgrade from 2003 to 2008R2 and I would like to work this DNS name change if possible. I know there are procedures for doing a full domain name change but my question is: Is a FULL domain name change neccessary if all I want to change is the internal DNS name of the domain? Would it be better to do this change after the 2008R2 domain upgrade? If I were you, I'd just leave it as-is. Split DNS is a perfectly valid infrastructure choice, and in some cases would make life easier when switching between the office and being on the road if that's required. For example, using split DNS, you could point Outlook to mail.company.net. This would allow you to get your mail internally via MAPI, and via RPC/HTTP or Outlook Anywhere when away from the office - all without having to reconfigure Outlook. The same goes for Exchange 2007/2010 Autodiscover service records - assuming you're using Exchange, that is. Otherwise, if you want to proceed with the rename, I don't think the functional level of the domain will affect the outcome or execution of the rename process at all. I've done several renames as well as AD migrations at 2003 functional level without issues. I'd do it before the upgrade and make sure everything's bedded down and error-free before moving to a 2008
http://serverfault.com/questions/231198/best-timing-for-windows-ad-domain-name-change
crawl-003
refinedweb
298
67.79